Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Allow to select range of rows with shift key #2456

Merged
merged 61 commits into from
Oct 5, 2021
Merged
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f3e4234
[DataGrid] Allow to select range of rows with shift key
flaviendelangle Aug 26, 2021
903fb99
Work
flaviendelangle Aug 26, 2021
4bf5240
Rework
flaviendelangle Aug 27, 2021
373f09c
Fix
flaviendelangle Aug 27, 2021
244220b
Fix
flaviendelangle Aug 27, 2021
3c75548
Merge
flaviendelangle Sep 1, 2021
ad00397
Work
flaviendelangle Sep 1, 2021
5e04bab
Regen docs
flaviendelangle Sep 1, 2021
d990c31
Add tests
flaviendelangle Sep 1, 2021
1523956
Fix
flaviendelangle Sep 1, 2021
4ce88ad
[DataGrid] Clean the selection public api
flaviendelangle Sep 2, 2021
49590a5
Work
flaviendelangle Sep 2, 2021
d6e61c1
Merge
flaviendelangle Sep 2, 2021
02d512c
Fix
flaviendelangle Sep 2, 2021
b247afa
Merge branch 'rework-selection-api' into selection-range
flaviendelangle Sep 2, 2021
0886d10
Fix
flaviendelangle Sep 2, 2021
57d837e
Merge
flaviendelangle Sep 2, 2021
781f7bd
Merge
flaviendelangle Sep 3, 2021
e98c4d1
Fix
flaviendelangle Sep 3, 2021
47b8a64
Merge
flaviendelangle Sep 8, 2021
153f03d
Fix
flaviendelangle Sep 8, 2021
614e76f
Fix shit + space key
flaviendelangle Sep 8, 2021
24185b2
Fix
flaviendelangle Sep 8, 2021
3d0c4e3
Fix
flaviendelangle Sep 8, 2021
e4c1a1d
Prettier
flaviendelangle Sep 8, 2021
0796451
Merge
flaviendelangle Sep 8, 2021
a7e00cc
Merge
flaviendelangle Sep 10, 2021
5af8328
Working improvments
flaviendelangle Sep 10, 2021
5f12225
Improve perfs
flaviendelangle Sep 10, 2021
89d1567
Code review : remove DOM selection
flaviendelangle Sep 13, 2021
927a5b0
Fix
flaviendelangle Sep 13, 2021
c72829e
Code review
flaviendelangle Sep 13, 2021
e7cab9c
Build doc api
flaviendelangle Sep 13, 2021
e14d0e2
Merge branch 'next' into selection-range
flaviendelangle Sep 13, 2021
e9bd3a6
Merge
flaviendelangle Sep 13, 2021
dff7cb1
Fix
flaviendelangle Sep 13, 2021
b465773
Merge branch 'next' into selection-range
flaviendelangle Sep 14, 2021
f9ee108
Update feature comparison
flaviendelangle Sep 14, 2021
86fbd9d
Update feature comparison
flaviendelangle Sep 14, 2021
a5d8c72
Code review
flaviendelangle Sep 15, 2021
51f9766
Code review
flaviendelangle Sep 15, 2021
b200b3d
Fix
flaviendelangle Sep 15, 2021
7b4edf0
Merge branch 'next' into selection-range
flaviendelangle Sep 27, 2021
6bc387c
Handle range selection on checkboxes
flaviendelangle Sep 27, 2021
c6e2cc2
Fix docs
flaviendelangle Sep 27, 2021
1cbc155
Update docs/src/pages/components/data-grid/selection/selection.md
flaviendelangle Sep 29, 2021
30e7d8d
Code review
flaviendelangle Sep 29, 2021
8801185
Update docs/src/pages/components/data-grid/getting-started/getting-st…
flaviendelangle Sep 29, 2021
5ba4eeb
Update docs/src/pages/components/data-grid/accessibility/accessibilit…
flaviendelangle Sep 29, 2021
f81bd2e
prettier
flaviendelangle Sep 29, 2021
d8b1323
Remove console
flaviendelangle Sep 29, 2021
fb1f202
Use events for selection checkboxes
flaviendelangle Sep 29, 2021
4a9ca83
Proptypes
flaviendelangle Sep 29, 2021
02e5b52
Fix
flaviendelangle Sep 29, 2021
c61bc1d
Merge branch 'next' into selection-range
flaviendelangle Oct 1, 2021
946ed4f
Code review
flaviendelangle Oct 1, 2021
c014676
Code review
flaviendelangle Oct 4, 2021
95b5def
Remove header checkbox improvments
flaviendelangle Oct 5, 2021
13c9d36
Update packages/grid/_modules_/grid/constants/eventsConstants.ts
flaviendelangle Oct 5, 2021
7be97ba
Clean expandSelection
flaviendelangle Oct 5, 2021
94d40ce
Regen docs
flaviendelangle Oct 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
flaviendelangle committed Sep 2, 2021
commit 0886d103ff699f9f5ff8a3db397907853f29a7f3
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,19 @@ export const useGridSelection = (apiRef: GridApiRef, props: GridComponentProps):
}

const hasCtrlKey = event.metaKey || event.ctrlKey;
const resetSelection = !hasCtrlKey || !canHaveMultipleSelection;
const resetSelection = !canHaveMultipleSelection || (!hasCtrlKey && !checkboxSelection);

if (resetSelection) {
apiRef.current.selectRow(
params.id,
hasCtrlKey ? !apiRef.current.isRowSelected(params.id) : true,
hasCtrlKey || checkboxSelection ? !apiRef.current.isRowSelected(params.id) : true,
true,
);
} else {
apiRef.current.selectRow(params.id, !apiRef.current.isRowSelected(params.id), false);
}
},
[apiRef, canHaveMultipleSelection, disableSelectionOnClick],
[apiRef, canHaveMultipleSelection, disableSelectionOnClick, checkboxSelection],
);

useGridApiEventHandler(apiRef, GridEvents.rowClick, handleRowClick);
Expand Down