Skip to content

Commit 3a9e61a

Browse files
committed
OpenConceptLab/ocl_issues#2190 | Added State Icon in sheet
1 parent ee49174 commit 3a9e61a

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/components/map-projects/MapProject.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ const MapProject = () => {
239239

240240
const getColumnsForTable = () => {
241241
let cols = []
242-
forEach(columns, column => {
242+
forEach(columns, (column, idx) => {
243243
const isValidColumn = isValidColumnValue(column.label)
244244
const isUpdatedValue = column.label !== column.original
245245
let headerClass = 'header-valid'
@@ -261,9 +261,21 @@ const MapProject = () => {
261261
headerName: column.label,
262262
editable: true,
263263
headerClassName: headerClass,
264-
valueGetter: (value, _row) => {
265-
return has(_row, column.dataKey + '__updated') ? _row[column.dataKey + '__updated'] : value
264+
renderCell: (params) => {
265+
if(parseInt(idx) === 0) {
266+
let val = has(params.row, column.dataKey + '__updated') ? params?.row[column.dataKey + '__updated'] : params.value
267+
const _state = VIEWS[getStateFromIndex(params.row.__index)]
268+
return <span style={{display: 'flex'}}>
269+
<Tooltip title={_state.label}>
270+
<Typography component='span' sx={{marginRight: '8px', color: _state.color + '.main'}}>
271+
{_state.icon}
272+
</Typography>
273+
</Tooltip>
274+
<span>{val}</span>
275+
</span>
276+
}
266277
},
278+
valueGetter: (value, _row) => has(_row, column.dataKey + '__updated') ? _row[column.dataKey + '__updated'] : value,
267279
...widthParams
268280
})
269281
})

0 commit comments

Comments
 (0)