Add table range selection feature#1837
Open
paustint wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Shift-click range selection for data-table row checkboxes by introducing a shared “anchor row” (last non-shift toggle) and a helper that applies selection across the visible row model range.
Changes:
- Added a
selectRowRange()helper to apply selection/unselection across a contiguous visible row range. - Introduced a shared row-selection “anchor” via
GridRuntimeContext, backed by a stable ref inGridContainer. - Updated checkbox selection handling and keyboard navigation to avoid conflicting Shift behaviors in the select column.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| libs/ui/src/lib/data-table/grid/renderers/CellRenderers.tsx | Implements Shift-click range selection behavior in the select-row checkbox renderer. |
| libs/ui/src/lib/data-table/grid/keyboard/useGridKeyboardNavigation.ts | Prevents Shift-click in the select column from extending rectangular cell selection. |
| libs/ui/src/lib/data-table/grid/grid-row-utils.ts | Adds selectRowRange() utility to update selection across a row id range. |
| libs/ui/src/lib/data-table/grid/grid-context.tsx | Extends grid runtime context with optional row-selection anchor getter/setter. |
| libs/ui/src/lib/data-table/grid/components/GridContainer.tsx | Stores the selection anchor in a ref and exposes stable getter/setter via runtime context. |
| libs/ui/src/lib/data-table/grid/tests/grid-row-utils.spec.ts | Adds unit tests covering selectRowRange() behavior (forward/backward, grouped rows, non-selectable rows, missing ids). |
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.
Introduce a shift-click range selection capability for table rows, allowing users to select multiple rows at once. This feature includes the necessary state management and updates to the row selection logic. The implementation ensures that the last toggled row serves as an anchor for the selection range.