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

Grouping #2106

Merged
merged 98 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
cd928bc
Initial commit
Jul 30, 2020
611ab6f
Merge branch 'canary' into am-group
amanmahajan7 Aug 5, 2020
3d6dd33
Group by multiple columns
Aug 6, 2020
bc00cbc
Cleanup viewport rows
Aug 6, 2020
654ce7f
memoize group row, add groupRowRenderer prop
Aug 7, 2020
067f4e6
Cleanup useViewportColumns
Aug 7, 2020
5122d29
Merge branch 'canary' into am-group
amanmahajan7 Aug 10, 2020
c56e0a1
Merge branch 'canary' into am-group
amanmahajan7 Aug 10, 2020
8ed8a15
Merge branch 'canary' into am-group
Aug 14, 2020
c5de19e
Fix keys
Aug 14, 2020
4f8e333
Add column.groupFormatter prop and checkbox column
Aug 17, 2020
d6300f7
Merge branch 'canary' into am-group
Aug 17, 2020
93f3a97
Checkbox selection for group row
Aug 17, 2020
1d60925
Validate groupBy columns
Aug 17, 2020
cd46e74
Ckeck isSelectable
Aug 17, 2020
f82ec68
ColSpan
Aug 17, 2020
0a89bd8
Merge branch 'canary' into am-group
amanmahajan7 Aug 17, 2020
e3ff003
Disable copy/paste and cell drag down on treegrid
Aug 18, 2020
8f06cb8
Add treegrid aria attributes
Aug 18, 2020
25e2269
Fix rowsCount
Aug 18, 2020
2d856dc
Fix rowsCount
Aug 18, 2020
4815742
Fix aria-rowindex and aria-rowcount and update grouprow props
Aug 19, 2020
3efd6c8
Change expandedGroupIds/onExpandedGroupIdsChange to props
Aug 19, 2020
33c23ff
Use 1 loop
Aug 19, 2020
bd4c121
Cleanup
Aug 19, 2020
cbfd03f
Add GroupCell component
Aug 19, 2020
b0df238
Add row selection for group rows
Aug 21, 2020
c7b7156
Cleanup
Aug 21, 2020
e6954eb
Merge branch 'canary' into am-group
Aug 21, 2020
3d94e78
Merge branch 'canary' into am-group
amanmahajan7 Aug 21, 2020
6d5ab53
Handle Home and End keys for GroupRow
Aug 21, 2020
f0c894d
Clanup navigation logic
Aug 21, 2020
e2f9116
Cleanup
Aug 21, 2020
2deba45
Improve navigation logic
Aug 22, 2020
a63d051
Cleanup
Aug 23, 2020
7f5e2da
Merge branch 'canary' into am-group
amanmahajan7 Aug 24, 2020
26b2712
Merge branch 'canary' into am-group
Aug 24, 2020
45308ab
Merge branch 'canary' into am-group
amanmahajan7 Aug 24, 2020
410e248
Handle copy/paste
Aug 24, 2020
58beda7
Grouping story
Aug 24, 2020
0142a4d
Add select to choose group by field
Aug 24, 2020
73a4ce9
Use SortableSelect
Aug 25, 2020
0b1c8d2
Cleanup
Aug 25, 2020
11c10d0
Improve types
Aug 25, 2020
a09c1cf
Merge branch 'canary' into am-group
Aug 25, 2020
0b7fd8c
Fic type
Aug 25, 2020
984fe09
Address comments
Aug 25, 2020
3a2b7a6
Merge branch 'canary' into am-group
amanmahajan7 Aug 26, 2020
84c310a
Merge branch 'canary' into am-group
Aug 26, 2020
26a33dd
useFocusRef
Aug 26, 2020
ed7b131
Update src/DataGrid.tsx
amanmahajan7 Aug 26, 2020
49fa7ab
Update src/DataGrid.tsx
amanmahajan7 Aug 26, 2020
917a906
Update src/types.ts
amanmahajan7 Aug 26, 2020
d19914d
Update src/types.ts
amanmahajan7 Aug 26, 2020
1618d8b
Fix types
Aug 26, 2020
c53fd7a
Add stopPropagation helper
Aug 26, 2020
4ea5d71
Move onExpandedGroupIdsChange check outside
Aug 26, 2020
dce4652
Cleanup
Aug 26, 2020
44e7da4
Add groupFocusable and remove __isGroup field
Aug 26, 2020
db1b1ff
fix dependencies
Aug 26, 2020
c94af15
Merge branch 'canary' into am-group
amanmahajan7 Aug 26, 2020
66430ea
Fix expandedGroupId
Aug 26, 2020
df78487
Fix row navigation
Aug 26, 2020
5131f2b
fix border styles
nstepien Aug 27, 2020
ea64380
Use a single array
Aug 28, 2020
2d14c81
Cleanup groupBy columns logic
Aug 28, 2020
5f8aaf5
Link TS issue
Aug 28, 2020
40ffbf0
Add icon prop to ToggleGroupedFormatter
Aug 28, 2020
07d79ab
Cell drag is not supported on a treegrid
Aug 28, 2020
b438c8a
Add caret icon
Aug 28, 2020
02d336a
Center align
Aug 28, 2020
b9134d5
-moz-middle-with-baseline;
Aug 28, 2020
ca9d900
Update changelog
Aug 28, 2020
b8cd85b
Update src/utils/columnUtils.ts
amanmahajan7 Aug 28, 2020
e6273f6
Address comments
Aug 28, 2020
a4cd283
Use the suggested sorting logic
Aug 28, 2020
b42a5fe
Do not mutate formatterOptions
Aug 28, 2020
5813f4a
Make group cell clickable
Aug 28, 2020
fa5ca5f
Mock less files for tests
Aug 28, 2020
46d122a
Merge branch 'canary' into am-group
Sep 1, 2020
7df2db6
Merge branch 'canary' into am-group
Sep 1, 2020
e3dc7a6
Inline getVerticalRangeToRender
Sep 1, 2020
426b8c8
Merge branch 'canary' into am-group
amanmahajan7 Sep 1, 2020
9e0edfd
Merge branch 'canary' into am-group
amanmahajan7 Sep 2, 2020
359e6cf
Update src/DataGrid.tsx
amanmahajan7 Sep 2, 2020
0bc28c1
Update src/DataGrid.tsx
amanmahajan7 Sep 2, 2020
58f991d
Update src/formatters/ToggleGroupFormatter.tsx
amanmahajan7 Sep 2, 2020
40aec7e
Update src/formatters/ToggleGroupFormatter.tsx
amanmahajan7 Sep 2, 2020
6d34c54
Revert jest changes
Sep 2, 2020
9306ff4
Cleanup parameters
Sep 2, 2020
7a15b05
add grouprow.less
Sep 2, 2020
85b5e99
Add a comment
Sep 2, 2020
bc56dc5
Update src/GroupCell.tsx
amanmahajan7 Sep 2, 2020
3173451
Update stories/demos/Grouping.tsx
amanmahajan7 Sep 2, 2020
18eb98a
Update stories/demos/Grouping.tsx
amanmahajan7 Sep 2, 2020
b41bf6e
Update style/index.less
amanmahajan7 Sep 2, 2020
5132d47
Do not extract all the props
Sep 2, 2020
d2d1ff0
Do not extract focus and keydown
Sep 2, 2020
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
- `rowClass`
- `defaultColumnOptions`
- ⚠️ This replaces the `minColumnWidth` and `defaultFormatter` props
- `groupBy`
- `rowGrouper`
- More info in [#2106](https://github.com/adazzle/react-data-grid/pull/2106)
- `column.cellClass(row)` function support:
- `column = { ..., cellClass(row) { return string; } }`
- `column.minWidth`
Expand All @@ -26,6 +29,8 @@
- `column.editor2`
- `column.editorOptions`
- More info in [#2102](https://github.com/adazzle/react-data-grid/pull/2102)
- `column.groupFormatter`
- More info in [#2106](https://github.com/adazzle/react-data-grid/pull/2106)
- `scrollToRow` method
- ⚠️ This replaces the `scrollToRowIndex` prop
- **Removed:**
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"react-dom": "next",
"react-popper": "^2.2.3",
"react-select": "^3.1.0",
"react-sortable-hoc": "^1.11.0",
"ts-jest": "^26.1.4",
"ts-loader": "^8.0.2",
"typescript": "~4.0.2"
Expand Down
24 changes: 14 additions & 10 deletions src/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,20 @@ function Cell<R, SR>({
onContextMenu={wrapEvent(handleContextMenu, onContextMenu)}
{...props}
>
<column.formatter
column={column}
rowIdx={rowIdx}
row={row}
isCellSelected={isCellSelected}
isRowSelected={isRowSelected}
onRowSelectionChange={onRowSelectionChange}
/>
{dragHandleProps && (
<div className="rdg-cell-drag-handle" {...dragHandleProps} />
{!column.rowGroup && (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rendering an empty cell for groupBy columns

<>
<column.formatter
column={column}
rowIdx={rowIdx}
row={row}
isCellSelected={isCellSelected}
isRowSelected={isRowSelected}
onRowSelectionChange={onRowSelectionChange}
/>
{dragHandleProps && (
<div className="rdg-cell-drag-handle" {...dragHandleProps} />
)}
</>
)}
</div>
);
Expand Down
17 changes: 16 additions & 1 deletion src/Columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { SelectCellFormatter } from './formatters';
import { Column } from './types';
import { stopPropagation } from './utils';

export const SELECT_COLUMN_KEY = 'select-row';

// TODO: fix type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const SelectColumn: Column<any, any> = {
key: 'select-row',
key: SELECT_COLUMN_KEY,
name: '',
width: 35,
maxWidth: 35,
Expand All @@ -33,5 +35,18 @@ export const SelectColumn: Column<any, any> = {
onChange={props.onRowSelectionChange}
/>
);
},
groupFormatter(props) {
return (
<SelectCellFormatter
aria-label="Select Group"
tabIndex={-1}
isCellSelected={props.isCellSelected}
value={props.isRowSelected}
onChange={props.onRowSelectionChange}
// Stop propagation to prevent row selection
onClick={stopPropagation}
/>
);
}
};
Loading