feat: add table row group headers#4807
Draft
ernst-dev wants to merge 1 commit into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4807 +/- ##
=======================================
Coverage 97.61% 97.61%
=======================================
Files 952 953 +1
Lines 30816 30852 +36
Branches 11318 11331 +13
=======================================
+ Hits 30081 30117 +36
- Misses 688 728 +40
+ Partials 47 7 -40 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an opt-in
rowGroupingproperty toTablethat visually groups rows under non-selectable group header rows, without changing the flatitemsdata structure.rowGroupingaccepts:getGroupId(item)— returns a group id for each item. Consecutive items sharing an id form a group.renderGroupHeader({ groupId, items })— renders the content of the group header row.A group header row is rendered above the first item of each group. It spans all visible columns (including the selection column) via a single
colSpancell and is not selectable, editable, or expandable. Tables that do not setrowGroupingare entirely unaffected (backward compatible).Implementation follows the existing Table row-rendering pattern in
internal.tsx(grouping is precomputed withuseMemo; a newGroupHeaderRowsub-component renders the spanning row, avoiding per-column hooks). A newfindRowGroupHeaders()test-utils selector is added, andfindRows()now excludes group header rows.Related links, issue #, if available: SIM AWSUI-60452
How has this been tested?
src/table/__tests__/row-grouping.test.tsx(9 tests): group header rendering/ordering, colspan with & without selection, non-selectability,data-group-id, non-consecutive group ids, andfindRowsexclusion.quick-build, and fullbuildall green (Node v24).pages/table/row-grouping.page.tsxfor manual/visual verification (with and without selection).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.