Skip to content

Commit

Permalink
Added boolean cells support (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
roll authored Sep 27, 2024
1 parent c6d3173 commit 899de5a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/components/Editors/Table/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function createColumns(
const dataFields = getDataFields({ schema, report })
for (const field of dataFields) {
const labelErrors = errorIndex.label[field.name]
const columnType = ['integer', 'number'].includes(field.type) ? 'number' : 'string'

const renderHeader: IColumn['header'] = () => {
const firstError = labelErrors?.[0]
Expand All @@ -66,6 +67,11 @@ export function createColumns(
const rowKey = `${rowNumber}`
const cellKey = `${rowNumber},${columnName}`

// Value
if (columnType === 'string') {
value = value?.toString()
}

// Selection
if (selection) {
if (rowNumber === selection.rowNumber || columnName === selection.columnName) {
Expand Down Expand Up @@ -112,7 +118,7 @@ export function createColumns(
dataColumns.push({
name: field.name,
header: renderHeader,
type: ['integer', 'number'].includes(field.type) ? 'number' : 'string',
type: columnType,
editable: !field.isExtra,
headerProps: labelErrors
? { style: { color: 'white', background: colorPalette.OKFNRed400.main } }
Expand Down

0 comments on commit 899de5a

Please sign in to comment.