Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
[terra-table] Table single row select (#1901)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm9361 authored Nov 21, 2023
1 parent 5847800 commit c2eadb6
Show file tree
Hide file tree
Showing 33 changed files with 412 additions and 184 deletions.
3 changes: 3 additions & 0 deletions packages/terra-data-grid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

Changed
* Updated Table component to use new `rowSelectionMode` prop instead of `hasSelectableRows`.

## 1.2.0 - (November 20, 2023)

* Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-data-grid/src/DataGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ const DataGrid = forwardRef((props, ref) => {
onSectionSelect={onSectionSelect}
onCellSelect={handleCellSelection}
onRowSelectionHeaderSelect={handleRowSelectionHeaderSelect}
hasSelectableRows={hasSelectableRows}
rowSelectionMode={hasSelectableRows ? 'multiple' : undefined}
hasVisibleColumnHeaders={hasVisibleColumnHeaders}
isStriped
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-data-grid/tests/jest/DataGrid.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('DataGrid', () => {
it('verifies the rows are created with the right props', () => {
const verifyRow = (rowIndex, rowComponent, data, overflowColumns) => {
expect(rowComponent.props.displayedColumns).toEqual(overflowColumns);
expect(rowComponent.props.hasRowSelection).toBe(false);
expect(rowComponent.props.rowSelectionMode).toBeUndefined();
expect(rowComponent.key).toEqual(data.id);
expect(rowComponent.props.onCellSelect).toBeDefined();
expect(rowComponent.props.rowHeaderIndex).toEqual(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5460,7 +5460,6 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
<InjectIntl(Table)
columnHeaderHeight="2.5rem"
defaultColumnWidth={200}
hasSelectableRows={true}
hasVisibleColumnHeaders={true}
id="test-terra-data-grid-table"
isActiveColumnResizing={false}
Expand Down Expand Up @@ -5496,6 +5495,7 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
}
rowHeaderIndex={0}
rowHeight="2.5rem"
rowSelectionMode="multiple"
rows={
Array [
Object {
Expand Down Expand Up @@ -5576,7 +5576,6 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
<Table
columnHeaderHeight="2.5rem"
defaultColumnWidth={200}
hasSelectableRows={true}
hasVisibleColumnHeaders={true}
id="test-terra-data-grid-table"
intl={
Expand Down Expand Up @@ -5639,6 +5638,7 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
}
rowHeaderIndex={0}
rowHeight="2.5rem"
rowSelectionMode="multiple"
rows={
Array [
Object {
Expand Down Expand Up @@ -6538,14 +6538,14 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
},
]
}
hasRowSelection={true}
id="00000000-0000-0000-0000-000000000000"
isHidden={true}
isTableStriped={true}
key="00000000-0000-0000-0000-000000000000"
onCellSelect={[Function]}
rowHeaderIndex={0}
rowHeight="2.5rem"
rowSelectionMode="multiple"
rows={
Array [
Object {
Expand Down Expand Up @@ -6676,14 +6676,14 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
},
]
}
hasRowSelection={true}
height="2.5rem"
id="1"
isTableStriped={true}
key="1"
onCellSelect={[Function]}
rowHeaderIndex={0}
rowIndex={2}
rowSelectionMode="multiple"
tableId="test-terra-data-grid-table"
>
<tr
Expand Down Expand Up @@ -7188,14 +7188,14 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
},
]
}
hasRowSelection={true}
height="2.5rem"
id="2"
isTableStriped={true}
key="2"
onCellSelect={[Function]}
rowHeaderIndex={0}
rowIndex={3}
rowSelectionMode="multiple"
tableId="test-terra-data-grid-table"
>
<tr
Expand Down Expand Up @@ -7696,14 +7696,14 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
},
]
}
hasRowSelection={true}
height="2.5rem"
id="3"
isTableStriped={true}
key="3"
onCellSelect={[Function]}
rowHeaderIndex={0}
rowIndex={4}
rowSelectionMode="multiple"
tableId="test-terra-data-grid-table"
>
<tr
Expand Down Expand Up @@ -8203,7 +8203,6 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
},
]
}
hasRowSelection={true}
height="2.5rem"
id="4"
isSelected={true}
Expand All @@ -8212,6 +8211,7 @@ exports[`DataGrid verifies row selection column header selection 1`] = `
onCellSelect={[Function]}
rowHeaderIndex={0}
rowIndex={5}
rowSelectionMode="multiple"
tableId="test-terra-data-grid-table"
>
<tr
Expand Down
Loading

0 comments on commit c2eadb6

Please sign in to comment.