Skip to content

Commit 88f50fa

Browse files
authored
feat(AnalyticalTable): add allVisibleRowsSelected to onRowSelect & improve select behavior (#8224)
Changes in this PR: - adds `allVisibleRowsSelected` to the `onRowSelect` event detail. When all visible rows in a filtered table (all not filtered-out rows) are selected, this property is `true`. - refactors how the `onRowSelect` event is fired. Now, the original event is persisted on the mutable table instance and only enriched and fired after the respective table state is finalized. - forks the `useRowSelect` react-table hook - Early exit when `selectionMode` is 'None' - Skips `selectedFlatRows` computation, `isAllRowsSelected` checks, and `prepareRow` overhead when selection is disabled - `isAllRowsSelected` computation is memoized - Uses stable noop references when disabled - Fixes select-all indeterminate state considering filtered-out rows (now only visible rows are considered) - Fixes indeterminate state of select-all checkbox when the table is filtered. - `useIndeterminateRowSelection`: parent row is now also included in `selectedRowIds` when all sub rows are selected - improves `stateReducer` type
1 parent 2f52b2d commit 88f50fa

13 files changed

Lines changed: 809 additions & 162 deletions

REUSE.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ path = "packages/main/src/internal/safeGetChildrenArray.ts"
3838
precedence = "aggregate"
3939
SPDX-FileCopyrightText = "2022 Adobe Inc."
4040
SPDX-License-Identifier = "Apache-2.0"
41+
42+
[[annotations]]
43+
path = "packages/main/src/components/AnalyticalTable/hooks/useRowSelect.ts"
44+
precedence = "aggregate"
45+
SPDX-FileCopyrightText = "2019-2021 Tanner Linsley"
46+
SPDX-License-Identifier = "MIT"

packages/main/src/components/AnalyticalTable/AnalyticalTable.cy.tsx

Lines changed: 229 additions & 24 deletions
Large diffs are not rendered by default.

packages/main/src/components/AnalyticalTable/AnalyticalTable.module.css

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,20 @@
369369
user-select: none;
370370
}
371371

372-
.checkBox::part(root) {
373-
display: flex;
374-
width: unset;
375-
height: unset;
376-
justify-content: center;
377-
min-height: unset;
378-
min-width: unset;
379-
padding: 0;
372+
.checkBox {
373+
vertical-align: middle;
374+
pointer-events: none;
375+
display: block;
376+
377+
&::part(root) {
378+
display: flex;
379+
width: unset;
380+
height: unset;
381+
justify-content: center;
382+
min-height: unset;
383+
min-width: unset;
384+
padding: 0;
385+
}
380386
}
381387

382388
/* ==========================================================================

0 commit comments

Comments
 (0)