feat: Table Column Groups Table#4482
Conversation
40c20ee to
84451af
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4482 +/- ##
==========================================
- Coverage 97.41% 97.39% -0.03%
==========================================
Files 933 942 +9
Lines 29595 30094 +499
Branches 10757 10969 +212
==========================================
+ Hits 28831 29309 +478
- Misses 716 778 +62
+ Partials 48 7 -41 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
84451af to
e9f4fd0
Compare
d6a98cb to
5cec8c8
Compare
8da3b07 to
227f21b
Compare
…er, remove inline colgroup from sticky heder
…backwards compatibility
…lization" This reverts commit 9bdb50b.
| }: { | ||
| columnDisplay?: ReadonlyArray<TableProps.ColumnDisplayProperties>; | ||
| visibleColumns?: ReadonlyArray<string>; | ||
| visibleColumns?: ReadonlyArray<string | number>; |
There was a problem hiding this comment.
why is this string | number now?
There was a problem hiding this comment.
Lines 30 to 32 in 1d90d18
The getColumnKey returns column.id || index when a column definition doesn't have an explicit id, it falls back to the numeric array index.
The column groups code path (useColumnGroups > calculateHierarchyTree > getVisibleColumnDefinitions), which previously only accepted string.
components/src/table/column-groups/use-column-groups.tsx
Lines 10 to 22 in 1d90d18
If it's okay I could just cast the type only in the useColumnGroups, and we din't have to do all the | number in all the props.
const visibleIds = visibleColumns
? Array.from(visibleColumns)
: columnDefinitions.map((col, idx) => getColumnKey(col, idx).toString());
I'm fine with both
| setColumnWidths(columnWidths => updateWidths(visibleColumns, columnWidths ?? new Map(), newWidth, columnId)); | ||
| } | ||
|
|
||
| /* istanbul ignore next: covered by integration tests, requires real DOM measurements */ |
There was a problem hiding this comment.
We have some unit tests for column widths here: src/table/tests/columns-width.test.tsx
Can these tests be extended to support the groups use cases?
| const { getColumnStyles, columnWidths, updateColumn, setCell } = useColumnWidths(); | ||
| const { getColumnStyles, columnWidths, updateColumn, updateGroup, setCell } = useColumnWidths(); | ||
|
|
||
| const handleSplitGroupResize = (leafIds: string[], newWidth: number) => { |
There was a problem hiding this comment.
what are "leaf ids" here - is that columns ids or can it be groups, too?
There was a problem hiding this comment.
It's a column only, I will rename the leaf to colmn to make it less confusing
| styles.label, | ||
| styles.root, | ||
| verticalAlign === 'top' && !spansRows && styles['label-top'], | ||
| spansRows && styles['label-bottom'] |
There was a problem hiding this comment.
Will this create an inconsistent look? I think the reason we have 'lavel-top' is to ensure the selection element is at the top of the cell when the column headers are multiline (with wrap-lines: true). Now, with col groups + wrap-lines it will look different.
Description
Add Table Column Grouping Feature support for Table Component.
Related links, issue AWSUI-9594, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.