diff --git a/packages/terra-data-grid/CHANGELOG.md b/packages/terra-data-grid/CHANGELOG.md index 98885337188..ae1178e1419 100644 --- a/packages/terra-data-grid/CHANGELOG.md +++ b/packages/terra-data-grid/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +* Added + * Added "No result" cells to FlowsheetDataGrid. + ## 0.8.1 - (October 17, 2023) * Fixed @@ -14,7 +17,6 @@ * Added * Added base FlowsheetDataGrid component. - * Added "No result" cells to FlowsheetDataGrid. * Changed * Updated prop descriptions for better consistency and accuracy in the `terra-data-grid` component. diff --git a/packages/terra-data-grid/src/FlowsheetDataGrid.jsx b/packages/terra-data-grid/src/FlowsheetDataGrid.jsx index 81460bfda5b..3167df0f880 100644 --- a/packages/terra-data-grid/src/FlowsheetDataGrid.jsx +++ b/packages/terra-data-grid/src/FlowsheetDataGrid.jsx @@ -102,6 +102,8 @@ function FlowsheetDataGrid(props) { const pinnedColumns = flowsheetColumns.length ? [flowsheetColumns[0]] : []; const overflowColumns = flowsheetColumns.length > 1 ? flowsheetColumns.slice(1) : []; + const contentHasNoResult = (content) => (content === null || content === '' || content === '--'); + const flowsheetRows = useMemo(() => { const noResultCellContent = ( <> @@ -114,8 +116,8 @@ function FlowsheetDataGrid(props) { newRows.forEach((row, rowIndex) => { const newCells = [...row.cells]; newCells.forEach((cell, cellIndex) => { - // Cell has no content and is not a row header (first column), set content to "No result". - if (!cell.content && cellIndex !== 0) { + // Cell content has no result and is not a row header (first column), set content to "No result". + if (contentHasNoResult(cell.content) && cellIndex !== 0) { newCells[cellIndex].content = noResultCellContent; } }); diff --git a/packages/terra-data-grid/tests/jest/FlowsheetDataGrid.test.jsx b/packages/terra-data-grid/tests/jest/FlowsheetDataGrid.test.jsx index 59c31cdbf39..62e8920e970 100644 --- a/packages/terra-data-grid/tests/jest/FlowsheetDataGrid.test.jsx +++ b/packages/terra-data-grid/tests/jest/FlowsheetDataGrid.test.jsx @@ -153,7 +153,7 @@ describe('FlowsheetDataGrid', () => { id: '3', cells: [ { content: 'Cardiac Index (L/min/m2)' }, - { content: undefined }, + { content: '' }, { content: '2.28' }, ], }, @@ -162,7 +162,7 @@ describe('FlowsheetDataGrid', () => { cells: [ { content: '' }, { content: null }, - { content: undefined }, + { content: '--' }, ], }, ], diff --git a/packages/terra-framework-docs/src/terra-dev-site/doc/data-grid/FlowsheetDataGrid.4/About.5.doc.mdx b/packages/terra-framework-docs/src/terra-dev-site/doc/data-grid/FlowsheetDataGrid.4/About.5.doc.mdx index 9e58e30a7f6..cf238089962 100644 --- a/packages/terra-framework-docs/src/terra-dev-site/doc/data-grid/FlowsheetDataGrid.4/About.5.doc.mdx +++ b/packages/terra-framework-docs/src/terra-dev-site/doc/data-grid/FlowsheetDataGrid.4/About.5.doc.mdx @@ -48,7 +48,7 @@ import { FlowsheetDataGrid } from 'terra-data-grid'; ## Examples diff --git a/packages/terra-framework-docs/src/terra-dev-site/doc/data-grid/FlowsheetDataGrid.4/Examples.6/FlowsheetDataGridResultsMissing.2.doc.mdx b/packages/terra-framework-docs/src/terra-dev-site/doc/data-grid/FlowsheetDataGrid.4/Examples.6/FlowsheetDataGridResultsMissing.2.doc.mdx index 19118a588c1..561f08cd377 100644 --- a/packages/terra-framework-docs/src/terra-dev-site/doc/data-grid/FlowsheetDataGrid.4/Examples.6/FlowsheetDataGridResultsMissing.2.doc.mdx +++ b/packages/terra-framework-docs/src/terra-dev-site/doc/data-grid/FlowsheetDataGrid.4/Examples.6/FlowsheetDataGridResultsMissing.2.doc.mdx @@ -1,3 +1,6 @@ import FlowsheetDataGridResultsMissing from './FlowsheetDataGridResultsMissing?dev-site-example'; - +