@mui/x-data-grid-premium 7.21.0 → 7.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -0
- package/DataGridPremium/useDataGridPremiumComponent.js +2 -0
- package/components/GridDataSourceGroupingCriteriaCell.d.ts +7 -0
- package/components/GridDataSourceGroupingCriteriaCell.js +134 -0
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +2 -0
- package/esm/components/GridDataSourceGroupingCriteriaCell.js +126 -0
- package/esm/hooks/features/rowGrouping/createGroupingColDef.js +18 -8
- package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +12 -15
- package/esm/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +73 -0
- package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +17 -6
- package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +17 -22
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/rowGrouping/createGroupingColDef.d.ts +5 -2
- package/hooks/features/rowGrouping/createGroupingColDef.js +17 -7
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +9 -9
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +34 -20
- package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +4 -0
- package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +81 -0
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
- package/hooks/features/rowGrouping/useGridRowGrouping.js +16 -5
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +1 -1
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +16 -21
- package/index.js +1 -1
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +2 -0
- package/modern/components/GridDataSourceGroupingCriteriaCell.js +126 -0
- package/modern/hooks/features/rowGrouping/createGroupingColDef.js +18 -8
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +12 -15
- package/modern/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +73 -0
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +17 -6
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +17 -22
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +4 -4
- package/utils/releaseInfo.js +1 -1
|
@@ -38,7 +38,7 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
38
38
|
changeEvent: 'rowGroupingModelChange'
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
/*
|
|
42
42
|
* API METHODS
|
|
43
43
|
*/
|
|
44
44
|
const setRowGroupingModel = React.useCallback(model => {
|
|
@@ -95,6 +95,11 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
95
95
|
}
|
|
96
96
|
return columnMenuItems;
|
|
97
97
|
}, [props.disableRowGrouping]);
|
|
98
|
+
const addGetRowsParams = React.useCallback(params => {
|
|
99
|
+
return (0, _extends2.default)({}, params, {
|
|
100
|
+
groupFields: (0, _gridRowGroupingSelector.gridRowGroupingModelSelector)(apiRef)
|
|
101
|
+
});
|
|
102
|
+
}, [apiRef]);
|
|
98
103
|
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
99
104
|
const rowGroupingModelToExport = (0, _gridRowGroupingSelector.gridRowGroupingModelSelector)(apiRef);
|
|
100
105
|
const shouldExportRowGroupingModel =
|
|
@@ -126,10 +131,11 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
126
131
|
return params;
|
|
127
132
|
}, [apiRef, props.disableRowGrouping]);
|
|
128
133
|
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'columnMenu', addColumnMenuButtons);
|
|
134
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'getRowsParams', addGetRowsParams);
|
|
129
135
|
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
|
|
130
136
|
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
131
137
|
|
|
132
|
-
|
|
138
|
+
/*
|
|
133
139
|
* EVENTS
|
|
134
140
|
*/
|
|
135
141
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
@@ -144,9 +150,13 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
144
150
|
if (!isOnGroupingCell) {
|
|
145
151
|
return;
|
|
146
152
|
}
|
|
153
|
+
if (props.unstable_dataSource && !params.rowNode.childrenExpanded) {
|
|
154
|
+
apiRef.current.unstable_dataSource.fetchRows(params.id);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
147
157
|
apiRef.current.setRowChildrenExpansion(params.id, !params.rowNode.childrenExpanded);
|
|
148
158
|
}
|
|
149
|
-
}, [apiRef, props.rowGroupingColumnMode]);
|
|
159
|
+
}, [apiRef, props.rowGroupingColumnMode, props.unstable_dataSource]);
|
|
150
160
|
const checkGroupingColumnsModelDiff = React.useCallback(() => {
|
|
151
161
|
const sanitizedRowGroupingModel = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)(apiRef);
|
|
152
162
|
const rulesOnLastRowTreeCreation = apiRef.current.caches.rowGrouping.rulesOnLastRowTreeCreation || [];
|
|
@@ -161,7 +171,7 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
161
171
|
|
|
162
172
|
// Refresh the row tree creation strategy processing
|
|
163
173
|
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|
|
164
|
-
if (apiRef.current.getActiveStrategy('rowTree') === _gridRowGroupingUtils.
|
|
174
|
+
if (apiRef.current.getActiveStrategy('rowTree') === _gridRowGroupingUtils.RowGroupingStrategy.Default) {
|
|
165
175
|
apiRef.current.publishEvent('activeStrategyProcessorChange', 'rowTreeCreation');
|
|
166
176
|
}
|
|
167
177
|
}
|
|
@@ -169,8 +179,9 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
169
179
|
(0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
170
180
|
(0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'columnsChange', checkGroupingColumnsModelDiff);
|
|
171
181
|
(0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'rowGroupingModelChange', checkGroupingColumnsModelDiff);
|
|
182
|
+
(0, _xDataGridPro.useGridApiEventHandler)(apiRef, 'rowGroupingModelChange', () => apiRef.current.unstable_dataSource.fetchRows());
|
|
172
183
|
|
|
173
|
-
|
|
184
|
+
/*
|
|
174
185
|
* EFFECTS
|
|
175
186
|
*/
|
|
176
187
|
React.useEffect(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
3
3
|
import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
|
|
4
|
-
export declare const useGridRowGroupingPreProcessors: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "disableRowGrouping" | "groupingColDef" | "rowGroupingColumnMode" | "defaultGroupingExpansionDepth" | "isGroupExpandedByDefault">) => void;
|
|
4
|
+
export declare const useGridRowGroupingPreProcessors: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "disableRowGrouping" | "groupingColDef" | "rowGroupingColumnMode" | "defaultGroupingExpansionDepth" | "isGroupExpandedByDefault" | "unstable_dataSource">) => void;
|
|
@@ -16,6 +16,7 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
16
16
|
if (props.disableRowGrouping) {
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
|
+
const strategy = props.unstable_dataSource ? _gridRowGroupingUtils.RowGroupingStrategy.DataSource : _gridRowGroupingUtils.RowGroupingStrategy.Default;
|
|
19
20
|
const groupingColDefProp = props.groupingColDef;
|
|
20
21
|
|
|
21
22
|
// We can't use `gridGroupingRowsSanitizedModelSelector` here because the new columns are not in the state yet
|
|
@@ -29,8 +30,9 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
29
30
|
return [(0, _createGroupingColDef.createGroupingColDefForAllGroupingCriteria)({
|
|
30
31
|
apiRef,
|
|
31
32
|
rowGroupingModel,
|
|
32
|
-
colDefOverride: (0, _gridRowGroupingUtils.getColDefOverrides)(groupingColDefProp, rowGroupingModel),
|
|
33
|
-
columnsLookup: columnsState.lookup
|
|
33
|
+
colDefOverride: (0, _gridRowGroupingUtils.getColDefOverrides)(groupingColDefProp, rowGroupingModel, strategy),
|
|
34
|
+
columnsLookup: columnsState.lookup,
|
|
35
|
+
strategy
|
|
34
36
|
})];
|
|
35
37
|
}
|
|
36
38
|
case 'multiple':
|
|
@@ -39,7 +41,8 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
39
41
|
groupingCriteria,
|
|
40
42
|
colDefOverride: (0, _gridRowGroupingUtils.getColDefOverrides)(groupingColDefProp, [groupingCriteria]),
|
|
41
43
|
groupedByColDef: columnsState.lookup[groupingCriteria],
|
|
42
|
-
columnsLookup: columnsState.lookup
|
|
44
|
+
columnsLookup: columnsState.lookup,
|
|
45
|
+
strategy
|
|
43
46
|
}));
|
|
44
47
|
}
|
|
45
48
|
default:
|
|
@@ -47,7 +50,7 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
47
50
|
return [];
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
|
-
}, [apiRef, props.groupingColDef, props.rowGroupingColumnMode, props.disableRowGrouping]);
|
|
53
|
+
}, [apiRef, props.groupingColDef, props.rowGroupingColumnMode, props.disableRowGrouping, props.unstable_dataSource]);
|
|
51
54
|
const updateGroupingColumn = React.useCallback(columnsState => {
|
|
52
55
|
const groupingColDefs = getGroupingColDefs(columnsState);
|
|
53
56
|
let newColumnFields = [];
|
|
@@ -107,7 +110,7 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
107
110
|
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
108
111
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
109
112
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
110
|
-
groupingName: _gridRowGroupingUtils.
|
|
113
|
+
groupingName: _gridRowGroupingUtils.RowGroupingStrategy.Default
|
|
111
114
|
});
|
|
112
115
|
}
|
|
113
116
|
return (0, _internals.updateRowTree)({
|
|
@@ -120,7 +123,7 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
120
123
|
previousTreeDepth: params.previousTreeDepths,
|
|
121
124
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
122
125
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
123
|
-
groupingName: _gridRowGroupingUtils.
|
|
126
|
+
groupingName: _gridRowGroupingUtils.RowGroupingStrategy.Default
|
|
124
127
|
});
|
|
125
128
|
}, [apiRef, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
126
129
|
const filterRows = React.useCallback(params => {
|
|
@@ -142,28 +145,20 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
142
145
|
});
|
|
143
146
|
}, [apiRef]);
|
|
144
147
|
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'hydrateColumns', updateGroupingColumn);
|
|
145
|
-
(0, _internals.useGridRegisterStrategyProcessor)(apiRef, _gridRowGroupingUtils.
|
|
146
|
-
(0, _internals.useGridRegisterStrategyProcessor)(apiRef, _gridRowGroupingUtils.
|
|
147
|
-
(0, _internals.useGridRegisterStrategyProcessor)(apiRef, _gridRowGroupingUtils.
|
|
148
|
-
(0, _internals.useGridRegisterStrategyProcessor)(apiRef, _gridRowGroupingUtils.
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* 1ST RENDER
|
|
152
|
-
*/
|
|
148
|
+
(0, _internals.useGridRegisterStrategyProcessor)(apiRef, _gridRowGroupingUtils.RowGroupingStrategy.Default, 'rowTreeCreation', createRowTreeForRowGrouping);
|
|
149
|
+
(0, _internals.useGridRegisterStrategyProcessor)(apiRef, _gridRowGroupingUtils.RowGroupingStrategy.Default, 'filtering', filterRows);
|
|
150
|
+
(0, _internals.useGridRegisterStrategyProcessor)(apiRef, _gridRowGroupingUtils.RowGroupingStrategy.Default, 'sorting', sortRows);
|
|
151
|
+
(0, _internals.useGridRegisterStrategyProcessor)(apiRef, _gridRowGroupingUtils.RowGroupingStrategy.Default, 'visibleRowsLookupCreation', _internals.getVisibleRowsLookup);
|
|
153
152
|
(0, _xDataGridPro.useFirstRender)(() => {
|
|
154
|
-
(0, _gridRowGroupingUtils.setStrategyAvailability)(apiRef, props.disableRowGrouping);
|
|
153
|
+
(0, _gridRowGroupingUtils.setStrategyAvailability)(apiRef, props.disableRowGrouping, props.unstable_dataSource);
|
|
155
154
|
});
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* EFFECTS
|
|
159
|
-
*/
|
|
160
155
|
const isFirstRender = React.useRef(true);
|
|
161
156
|
React.useEffect(() => {
|
|
162
157
|
if (!isFirstRender.current) {
|
|
163
|
-
(0, _gridRowGroupingUtils.setStrategyAvailability)(apiRef, props.disableRowGrouping);
|
|
158
|
+
(0, _gridRowGroupingUtils.setStrategyAvailability)(apiRef, props.disableRowGrouping, props.unstable_dataSource);
|
|
164
159
|
} else {
|
|
165
160
|
isFirstRender.current = false;
|
|
166
161
|
}
|
|
167
|
-
}, [apiRef, props.disableRowGrouping]);
|
|
162
|
+
}, [apiRef, props.disableRowGrouping, props.unstable_dataSource]);
|
|
168
163
|
};
|
|
169
164
|
exports.useGridRowGroupingPreProcessors = useGridRowGroupingPreProcessors;
|
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { useGridAggregation, aggregationStateInitializer } from "../hooks/featur
|
|
|
4
4
|
import { useGridAggregationPreProcessors } from "../hooks/features/aggregation/useGridAggregationPreProcessors.js";
|
|
5
5
|
import { useGridRowGrouping, rowGroupingStateInitializer } from "../hooks/features/rowGrouping/useGridRowGrouping.js";
|
|
6
6
|
import { useGridRowGroupingPreProcessors } from "../hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js";
|
|
7
|
+
import { useGridDataSourceRowGroupingPreProcessors } from "../hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js";
|
|
7
8
|
import { useGridExcelExport } from "../hooks/features/export/useGridExcelExport.js";
|
|
8
9
|
import { cellSelectionStateInitializer, useGridCellSelection } from "../hooks/features/cellSelection/useGridCellSelection.js";
|
|
9
10
|
import { useGridClipboardImport } from "../hooks/features/clipboard/useGridClipboardImport.js";
|
|
@@ -16,6 +17,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
16
17
|
useGridRowSelectionPreProcessors(apiRef, props);
|
|
17
18
|
useGridRowReorderPreProcessors(apiRef, props);
|
|
18
19
|
useGridRowGroupingPreProcessors(apiRef, props);
|
|
20
|
+
useGridDataSourceRowGroupingPreProcessors(apiRef, props);
|
|
19
21
|
useGridTreeDataPreProcessors(apiRef, props);
|
|
20
22
|
useGridDataSourceTreeDataPreProcessors(apiRef, props);
|
|
21
23
|
useGridLazyLoaderPreProcessors(apiRef, props);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
|
+
import { useGridPrivateApiContext } from '@mui/x-data-grid-pro/internals';
|
|
7
|
+
import { useGridSelector, getDataGridUtilityClass } from '@mui/x-data-grid-pro';
|
|
8
|
+
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
9
|
+
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const useUtilityClasses = ownerState => {
|
|
12
|
+
const {
|
|
13
|
+
classes
|
|
14
|
+
} = ownerState;
|
|
15
|
+
const slots = {
|
|
16
|
+
root: ['groupingCriteriaCell'],
|
|
17
|
+
toggle: ['groupingCriteriaCellToggle'],
|
|
18
|
+
loadingContainer: ['groupingCriteriaCellLoadingContainer']
|
|
19
|
+
};
|
|
20
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
21
|
+
};
|
|
22
|
+
function GridGroupingCriteriaCellIcon(props) {
|
|
23
|
+
const apiRef = useGridPrivateApiContext();
|
|
24
|
+
const rootProps = useGridRootProps();
|
|
25
|
+
const classes = useUtilityClasses(rootProps);
|
|
26
|
+
const {
|
|
27
|
+
rowNode,
|
|
28
|
+
id,
|
|
29
|
+
field,
|
|
30
|
+
descendantCount
|
|
31
|
+
} = props;
|
|
32
|
+
const loadingSelector = state => state.dataSource.loading[id] ?? false;
|
|
33
|
+
const errorSelector = state => state.dataSource.errors[id];
|
|
34
|
+
const isDataLoading = useGridSelector(apiRef, loadingSelector);
|
|
35
|
+
const error = useGridSelector(apiRef, errorSelector);
|
|
36
|
+
const handleClick = event => {
|
|
37
|
+
if (!rowNode.childrenExpanded) {
|
|
38
|
+
// always fetch/get from cache the children when the node is expanded
|
|
39
|
+
apiRef.current.unstable_dataSource.fetchRows(id);
|
|
40
|
+
} else {
|
|
41
|
+
apiRef.current.setRowChildrenExpansion(id, !rowNode.childrenExpanded);
|
|
42
|
+
}
|
|
43
|
+
apiRef.current.setCellFocus(id, field);
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
};
|
|
46
|
+
const Icon = rowNode.childrenExpanded ? rootProps.slots.groupingCriteriaCollapseIcon : rootProps.slots.groupingCriteriaExpandIcon;
|
|
47
|
+
if (isDataLoading) {
|
|
48
|
+
return /*#__PURE__*/_jsx("div", {
|
|
49
|
+
className: classes.loadingContainer,
|
|
50
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {
|
|
51
|
+
size: "1rem",
|
|
52
|
+
color: "inherit"
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return descendantCount > 0 ? /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
57
|
+
size: "small",
|
|
58
|
+
onClick: handleClick,
|
|
59
|
+
tabIndex: -1,
|
|
60
|
+
"aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand')
|
|
61
|
+
}, rootProps?.slotProps?.baseIconButton, {
|
|
62
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
63
|
+
title: error?.message ?? null,
|
|
64
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
65
|
+
variant: "dot",
|
|
66
|
+
color: "error",
|
|
67
|
+
invisible: !error,
|
|
68
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
69
|
+
fontSize: "inherit"
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})) : null;
|
|
74
|
+
}
|
|
75
|
+
export function GridDataSourceGroupingCriteriaCell(props) {
|
|
76
|
+
const {
|
|
77
|
+
id,
|
|
78
|
+
field,
|
|
79
|
+
rowNode,
|
|
80
|
+
hideDescendantCount,
|
|
81
|
+
formattedValue
|
|
82
|
+
} = props;
|
|
83
|
+
const rootProps = useGridRootProps();
|
|
84
|
+
const apiRef = useGridApiContext();
|
|
85
|
+
const rowSelector = state => state.rows.dataRowIdToModelLookup[id];
|
|
86
|
+
const row = useGridSelector(apiRef, rowSelector);
|
|
87
|
+
const classes = useUtilityClasses(rootProps);
|
|
88
|
+
let descendantCount = 0;
|
|
89
|
+
if (row) {
|
|
90
|
+
descendantCount = Math.max(rootProps.unstable_dataSource?.getChildrenCount?.(row) ?? 0, 0);
|
|
91
|
+
}
|
|
92
|
+
let cellContent;
|
|
93
|
+
const colDef = apiRef.current.getColumn(rowNode.groupingField);
|
|
94
|
+
if (typeof colDef?.renderCell === 'function') {
|
|
95
|
+
cellContent = colDef.renderCell(props);
|
|
96
|
+
} else if (typeof formattedValue !== 'undefined') {
|
|
97
|
+
cellContent = /*#__PURE__*/_jsx("span", {
|
|
98
|
+
children: formattedValue
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
cellContent = /*#__PURE__*/_jsx("span", {
|
|
102
|
+
children: rowNode.groupingKey
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
106
|
+
className: classes.root,
|
|
107
|
+
sx: {
|
|
108
|
+
ml: rootProps.rowGroupingColumnMode === 'multiple' ? 0 : theme => `calc(var(--DataGrid-cellOffsetMultiplier) * ${theme.spacing(rowNode.depth)})`
|
|
109
|
+
},
|
|
110
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
111
|
+
className: classes.toggle,
|
|
112
|
+
children: /*#__PURE__*/_jsx(GridGroupingCriteriaCellIcon, {
|
|
113
|
+
id: id,
|
|
114
|
+
field: field,
|
|
115
|
+
rowNode: rowNode,
|
|
116
|
+
row: row,
|
|
117
|
+
descendantCount: descendantCount
|
|
118
|
+
})
|
|
119
|
+
}), cellContent, !hideDescendantCount && descendantCount > 0 ? /*#__PURE__*/_jsxs("span", {
|
|
120
|
+
style: {
|
|
121
|
+
whiteSpace: 'pre'
|
|
122
|
+
},
|
|
123
|
+
children: [" (", descendantCount, ")"]
|
|
124
|
+
}) : null]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
@@ -7,18 +7,24 @@ import { GRID_STRING_COL_DEF } from '@mui/x-data-grid-pro';
|
|
|
7
7
|
import { isSingleSelectColDef } from '@mui/x-data-grid-pro/internals';
|
|
8
8
|
import { GridGroupingColumnFooterCell } from "../../../components/GridGroupingColumnFooterCell.js";
|
|
9
9
|
import { GridGroupingCriteriaCell } from "../../../components/GridGroupingCriteriaCell.js";
|
|
10
|
+
import { GridDataSourceGroupingCriteriaCell } from "../../../components/GridDataSourceGroupingCriteriaCell.js";
|
|
10
11
|
import { GridGroupingColumnLeafCell } from "../../../components/GridGroupingColumnLeafCell.js";
|
|
11
|
-
import { getRowGroupingFieldFromGroupingCriteria, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD } from "./gridRowGroupingUtils.js";
|
|
12
|
+
import { getRowGroupingFieldFromGroupingCriteria, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, RowGroupingStrategy } from "./gridRowGroupingUtils.js";
|
|
12
13
|
import { gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const GROUPING_COL_DEF_DEFAULT_PROPERTIES = _extends({}, GRID_STRING_COL_DEF, {
|
|
15
16
|
type: 'custom',
|
|
16
17
|
disableReorder: true
|
|
17
18
|
});
|
|
18
|
-
const
|
|
19
|
+
const GROUPING_COL_DEF_FORCED_PROPERTIES_DEFAULT = {
|
|
19
20
|
editable: false,
|
|
20
21
|
groupable: false
|
|
21
22
|
};
|
|
23
|
+
const GROUPING_COL_DEF_FORCED_PROPERTIES_DATA_SOURCE = _extends({}, GROUPING_COL_DEF_FORCED_PROPERTIES_DEFAULT, {
|
|
24
|
+
// TODO: Support these features on the grouping column(s)
|
|
25
|
+
filterable: false,
|
|
26
|
+
sortable: false
|
|
27
|
+
});
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* When sorting two cells with different grouping criteria, we consider that the cell with the grouping criteria coming first in the model should be displayed below.
|
|
@@ -84,7 +90,8 @@ export const createGroupingColDefForOneGroupingCriteria = ({
|
|
|
84
90
|
columnsLookup,
|
|
85
91
|
groupedByColDef,
|
|
86
92
|
groupingCriteria,
|
|
87
|
-
colDefOverride
|
|
93
|
+
colDefOverride,
|
|
94
|
+
strategy = RowGroupingStrategy.Default
|
|
88
95
|
}) => {
|
|
89
96
|
const _ref = colDefOverride ?? {},
|
|
90
97
|
{
|
|
@@ -94,6 +101,7 @@ export const createGroupingColDefForOneGroupingCriteria = ({
|
|
|
94
101
|
} = _ref,
|
|
95
102
|
colDefOverrideProperties = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
96
103
|
const leafColDef = leafField ? columnsLookup[leafField] : null;
|
|
104
|
+
const CriteriaCell = strategy === RowGroupingStrategy.Default ? GridGroupingCriteriaCell : GridDataSourceGroupingCriteriaCell;
|
|
97
105
|
|
|
98
106
|
// The properties that do not depend on the presence of a `leafColDef` and that can be overridden by `colDefOverride`
|
|
99
107
|
const commonProperties = {
|
|
@@ -121,7 +129,7 @@ export const createGroupingColDefForOneGroupingCriteria = ({
|
|
|
121
129
|
|
|
122
130
|
// Render current grouping criteria groups
|
|
123
131
|
if (params.rowNode.groupingField === groupingCriteria) {
|
|
124
|
-
return /*#__PURE__*/_jsx(
|
|
132
|
+
return /*#__PURE__*/_jsx(CriteriaCell, _extends({}, params, {
|
|
125
133
|
hideDescendantCount: hideDescendantCount
|
|
126
134
|
}));
|
|
127
135
|
}
|
|
@@ -166,7 +174,7 @@ export const createGroupingColDefForOneGroupingCriteria = ({
|
|
|
166
174
|
// The properties that can't be overridden with `colDefOverride`
|
|
167
175
|
const forcedProperties = _extends({
|
|
168
176
|
field: getRowGroupingFieldFromGroupingCriteria(groupingCriteria)
|
|
169
|
-
},
|
|
177
|
+
}, GROUPING_COL_DEF_FORCED_PROPERTIES_DEFAULT);
|
|
170
178
|
return _extends({}, GROUPING_COL_DEF_DEFAULT_PROPERTIES, commonProperties, sourceProperties, colDefOverrideProperties, forcedProperties);
|
|
171
179
|
};
|
|
172
180
|
/**
|
|
@@ -176,7 +184,8 @@ export const createGroupingColDefForAllGroupingCriteria = ({
|
|
|
176
184
|
apiRef,
|
|
177
185
|
columnsLookup,
|
|
178
186
|
rowGroupingModel,
|
|
179
|
-
colDefOverride
|
|
187
|
+
colDefOverride,
|
|
188
|
+
strategy = RowGroupingStrategy.Default
|
|
180
189
|
}) => {
|
|
181
190
|
const _ref2 = colDefOverride ?? {},
|
|
182
191
|
{
|
|
@@ -186,6 +195,7 @@ export const createGroupingColDefForAllGroupingCriteria = ({
|
|
|
186
195
|
} = _ref2,
|
|
187
196
|
colDefOverrideProperties = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
188
197
|
const leafColDef = leafField ? columnsLookup[leafField] : null;
|
|
198
|
+
const CriteriaCell = strategy === RowGroupingStrategy.Default ? GridGroupingCriteriaCell : GridDataSourceGroupingCriteriaCell;
|
|
189
199
|
|
|
190
200
|
// The properties that do not depend on the presence of a `leafColDef` and that can be overridden by `colDefOverride`
|
|
191
201
|
const commonProperties = {
|
|
@@ -213,7 +223,7 @@ export const createGroupingColDefForAllGroupingCriteria = ({
|
|
|
213
223
|
}
|
|
214
224
|
|
|
215
225
|
// Render the groups
|
|
216
|
-
return /*#__PURE__*/_jsx(
|
|
226
|
+
return /*#__PURE__*/_jsx(CriteriaCell, _extends({}, params, {
|
|
217
227
|
hideDescendantCount: hideDescendantCount
|
|
218
228
|
}));
|
|
219
229
|
},
|
|
@@ -253,6 +263,6 @@ export const createGroupingColDefForAllGroupingCriteria = ({
|
|
|
253
263
|
// The properties that can't be overridden with `colDefOverride`
|
|
254
264
|
const forcedProperties = _extends({
|
|
255
265
|
field: GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD
|
|
256
|
-
},
|
|
266
|
+
}, strategy === RowGroupingStrategy.Default ? GROUPING_COL_DEF_FORCED_PROPERTIES_DEFAULT : GROUPING_COL_DEF_FORCED_PROPERTIES_DATA_SOURCE);
|
|
257
267
|
return _extends({}, GROUPING_COL_DEF_DEFAULT_PROPERTIES, commonProperties, sourceProperties, colDefOverrideProperties, forcedProperties);
|
|
258
268
|
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { passFilterLogic } from '@mui/x-data-grid-pro/internals';
|
|
2
|
+
import { passFilterLogic, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, getRowGroupingCriteriaFromGroupingField, isGroupingColumn } from '@mui/x-data-grid-pro/internals';
|
|
3
3
|
import { gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export { GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, getRowGroupingCriteriaFromGroupingField, isGroupingColumn };
|
|
5
|
+
export let RowGroupingStrategy = /*#__PURE__*/function (RowGroupingStrategy) {
|
|
6
|
+
RowGroupingStrategy["Default"] = "grouping-columns";
|
|
7
|
+
RowGroupingStrategy["DataSource"] = "grouping-columns-data-source";
|
|
8
|
+
return RowGroupingStrategy;
|
|
9
|
+
}({});
|
|
6
10
|
export const getRowGroupingFieldFromGroupingCriteria = groupingCriteria => {
|
|
7
11
|
if (groupingCriteria === null) {
|
|
8
12
|
return GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD;
|
|
9
13
|
}
|
|
10
14
|
return `__row_group_by_columns_group_${groupingCriteria}__`;
|
|
11
15
|
};
|
|
12
|
-
export const getRowGroupingCriteriaFromGroupingField = groupingColDefField => {
|
|
13
|
-
const match = groupingColDefField.match(/^__row_group_by_columns_group_(.*)__$/);
|
|
14
|
-
if (!match) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return match[1];
|
|
18
|
-
};
|
|
19
|
-
export const isGroupingColumn = field => field === GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD || getRowGroupingCriteriaFromGroupingField(field) !== null;
|
|
20
16
|
/**
|
|
21
17
|
* When filtering a group, we only want to filter according to the items related to this grouping column.
|
|
22
18
|
*/
|
|
@@ -103,10 +99,10 @@ export const filterRowTreeFromGroupingColumns = params => {
|
|
|
103
99
|
filteredDescendantCountLookup
|
|
104
100
|
};
|
|
105
101
|
};
|
|
106
|
-
export const getColDefOverrides = (groupingColDefProp, fields) => {
|
|
102
|
+
export const getColDefOverrides = (groupingColDefProp, fields, strategy) => {
|
|
107
103
|
if (typeof groupingColDefProp === 'function') {
|
|
108
104
|
return groupingColDefProp({
|
|
109
|
-
groupingName:
|
|
105
|
+
groupingName: strategy ?? RowGroupingStrategy.Default,
|
|
110
106
|
fields
|
|
111
107
|
});
|
|
112
108
|
}
|
|
@@ -117,7 +113,7 @@ export const mergeStateWithRowGroupingModel = rowGroupingModel => state => _exte
|
|
|
117
113
|
model: rowGroupingModel
|
|
118
114
|
})
|
|
119
115
|
});
|
|
120
|
-
export const setStrategyAvailability = (privateApiRef, disableRowGrouping) => {
|
|
116
|
+
export const setStrategyAvailability = (privateApiRef, disableRowGrouping, dataSource) => {
|
|
121
117
|
let isAvailable;
|
|
122
118
|
if (disableRowGrouping) {
|
|
123
119
|
isAvailable = () => false;
|
|
@@ -127,7 +123,8 @@ export const setStrategyAvailability = (privateApiRef, disableRowGrouping) => {
|
|
|
127
123
|
return rowGroupingSanitizedModel.length > 0;
|
|
128
124
|
};
|
|
129
125
|
}
|
|
130
|
-
|
|
126
|
+
const strategy = dataSource ? RowGroupingStrategy.DataSource : RowGroupingStrategy.Default;
|
|
127
|
+
privateApiRef.current.setStrategyAvailability('rowTree', strategy, isAvailable);
|
|
131
128
|
};
|
|
132
129
|
export const getCellGroupingCriteria = ({
|
|
133
130
|
row,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { gridRowTreeSelector, gridColumnLookupSelector } from '@mui/x-data-grid-pro';
|
|
3
|
+
import { useGridRegisterStrategyProcessor, createRowTree, updateRowTree, getVisibleRowsLookup, skipSorting, skipFiltering } from '@mui/x-data-grid-pro/internals';
|
|
4
|
+
import { getGroupingRules, RowGroupingStrategy } from "./gridRowGroupingUtils.js";
|
|
5
|
+
import { gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
|
|
6
|
+
export const useGridDataSourceRowGroupingPreProcessors = (apiRef, props) => {
|
|
7
|
+
const createRowTreeForRowGrouping = React.useCallback(params => {
|
|
8
|
+
const getGroupKey = props.unstable_dataSource?.getGroupKey;
|
|
9
|
+
if (!getGroupKey) {
|
|
10
|
+
throw new Error('MUI X: No `getGroupKey` method provided with the dataSource.');
|
|
11
|
+
}
|
|
12
|
+
const getChildrenCount = props.unstable_dataSource?.getChildrenCount;
|
|
13
|
+
if (!getChildrenCount) {
|
|
14
|
+
throw new Error('MUI X: No `getChildrenCount` method provided with the dataSource.');
|
|
15
|
+
}
|
|
16
|
+
const sanitizedRowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
|
|
17
|
+
const columnsLookup = gridColumnLookupSelector(apiRef);
|
|
18
|
+
const groupingRules = getGroupingRules({
|
|
19
|
+
sanitizedRowGroupingModel,
|
|
20
|
+
columnsLookup
|
|
21
|
+
});
|
|
22
|
+
apiRef.current.caches.rowGrouping.rulesOnLastRowTreeCreation = groupingRules;
|
|
23
|
+
const getRowTreeBuilderNode = rowId => {
|
|
24
|
+
const parentPath = params.updates.groupKeys ?? [];
|
|
25
|
+
const row = params.dataRowIdToModelLookup[rowId];
|
|
26
|
+
const groupingRule = groupingRules[parentPath.length];
|
|
27
|
+
const groupingValueGetter = groupingRule?.groupingValueGetter;
|
|
28
|
+
const leafKey = groupingValueGetter?.(row[groupingRule.field], row, columnsLookup[groupingRule.field], apiRef) ?? getGroupKey(params.dataRowIdToModelLookup[rowId]);
|
|
29
|
+
return {
|
|
30
|
+
id: rowId,
|
|
31
|
+
path: [...parentPath, leafKey ?? rowId.toString()].map((key, i) => ({
|
|
32
|
+
key,
|
|
33
|
+
field: groupingRules[i]?.field ?? null
|
|
34
|
+
})),
|
|
35
|
+
serverChildrenCount: getChildrenCount(params.dataRowIdToModelLookup[rowId]) ?? 0
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
if (params.updates.type === 'full') {
|
|
39
|
+
return createRowTree({
|
|
40
|
+
previousTree: params.previousTree,
|
|
41
|
+
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
42
|
+
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
43
|
+
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
44
|
+
groupingName: RowGroupingStrategy.DataSource
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return updateRowTree({
|
|
48
|
+
nodes: {
|
|
49
|
+
inserted: params.updates.actions.insert.map(getRowTreeBuilderNode),
|
|
50
|
+
modified: params.updates.actions.modify.map(getRowTreeBuilderNode),
|
|
51
|
+
removed: params.updates.actions.remove
|
|
52
|
+
},
|
|
53
|
+
previousTree: params.previousTree,
|
|
54
|
+
previousGroupsToFetch: params.previousGroupsToFetch,
|
|
55
|
+
previousTreeDepth: params.previousTreeDepths,
|
|
56
|
+
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
57
|
+
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
58
|
+
groupingName: RowGroupingStrategy.DataSource
|
|
59
|
+
});
|
|
60
|
+
}, [apiRef, props.unstable_dataSource, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
61
|
+
const filterRows = React.useCallback(() => {
|
|
62
|
+
const rowTree = gridRowTreeSelector(apiRef);
|
|
63
|
+
return skipFiltering(rowTree);
|
|
64
|
+
}, [apiRef]);
|
|
65
|
+
const sortRows = React.useCallback(() => {
|
|
66
|
+
const rowTree = gridRowTreeSelector(apiRef);
|
|
67
|
+
return skipSorting(rowTree);
|
|
68
|
+
}, [apiRef]);
|
|
69
|
+
useGridRegisterStrategyProcessor(apiRef, RowGroupingStrategy.DataSource, 'rowTreeCreation', createRowTreeForRowGrouping);
|
|
70
|
+
useGridRegisterStrategyProcessor(apiRef, RowGroupingStrategy.DataSource, 'filtering', filterRows);
|
|
71
|
+
useGridRegisterStrategyProcessor(apiRef, RowGroupingStrategy.DataSource, 'sorting', sortRows);
|
|
72
|
+
useGridRegisterStrategyProcessor(apiRef, RowGroupingStrategy.DataSource, 'visibleRowsLookupCreation', getVisibleRowsLookup);
|
|
73
|
+
};
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useGridApiEventHandler, useGridApiMethod, gridColumnLookupSelector } from '@mui/x-data-grid-pro';
|
|
4
4
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid-pro/internals';
|
|
5
5
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
|
|
6
|
-
import { getRowGroupingFieldFromGroupingCriteria,
|
|
6
|
+
import { getRowGroupingFieldFromGroupingCriteria, RowGroupingStrategy, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability, getGroupingRules, areGroupingRulesEqual } from "./gridRowGroupingUtils.js";
|
|
7
7
|
export const rowGroupingStateInitializer = (state, props, apiRef) => {
|
|
8
8
|
apiRef.current.caches.rowGrouping = {
|
|
9
9
|
rulesOnLastRowTreeCreation: []
|
|
@@ -29,7 +29,7 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
29
29
|
changeEvent: 'rowGroupingModelChange'
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
/*
|
|
33
33
|
* API METHODS
|
|
34
34
|
*/
|
|
35
35
|
const setRowGroupingModel = React.useCallback(model => {
|
|
@@ -86,6 +86,11 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
86
86
|
}
|
|
87
87
|
return columnMenuItems;
|
|
88
88
|
}, [props.disableRowGrouping]);
|
|
89
|
+
const addGetRowsParams = React.useCallback(params => {
|
|
90
|
+
return _extends({}, params, {
|
|
91
|
+
groupFields: gridRowGroupingModelSelector(apiRef)
|
|
92
|
+
});
|
|
93
|
+
}, [apiRef]);
|
|
89
94
|
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
90
95
|
const rowGroupingModelToExport = gridRowGroupingModelSelector(apiRef);
|
|
91
96
|
const shouldExportRowGroupingModel =
|
|
@@ -117,10 +122,11 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
117
122
|
return params;
|
|
118
123
|
}, [apiRef, props.disableRowGrouping]);
|
|
119
124
|
useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuButtons);
|
|
125
|
+
useGridRegisterPipeProcessor(apiRef, 'getRowsParams', addGetRowsParams);
|
|
120
126
|
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
121
127
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
122
128
|
|
|
123
|
-
|
|
129
|
+
/*
|
|
124
130
|
* EVENTS
|
|
125
131
|
*/
|
|
126
132
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
@@ -135,9 +141,13 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
135
141
|
if (!isOnGroupingCell) {
|
|
136
142
|
return;
|
|
137
143
|
}
|
|
144
|
+
if (props.unstable_dataSource && !params.rowNode.childrenExpanded) {
|
|
145
|
+
apiRef.current.unstable_dataSource.fetchRows(params.id);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
138
148
|
apiRef.current.setRowChildrenExpansion(params.id, !params.rowNode.childrenExpanded);
|
|
139
149
|
}
|
|
140
|
-
}, [apiRef, props.rowGroupingColumnMode]);
|
|
150
|
+
}, [apiRef, props.rowGroupingColumnMode, props.unstable_dataSource]);
|
|
141
151
|
const checkGroupingColumnsModelDiff = React.useCallback(() => {
|
|
142
152
|
const sanitizedRowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
|
|
143
153
|
const rulesOnLastRowTreeCreation = apiRef.current.caches.rowGrouping.rulesOnLastRowTreeCreation || [];
|
|
@@ -152,7 +162,7 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
152
162
|
|
|
153
163
|
// Refresh the row tree creation strategy processing
|
|
154
164
|
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|
|
155
|
-
if (apiRef.current.getActiveStrategy('rowTree') ===
|
|
165
|
+
if (apiRef.current.getActiveStrategy('rowTree') === RowGroupingStrategy.Default) {
|
|
156
166
|
apiRef.current.publishEvent('activeStrategyProcessorChange', 'rowTreeCreation');
|
|
157
167
|
}
|
|
158
168
|
}
|
|
@@ -160,8 +170,9 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
160
170
|
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
161
171
|
useGridApiEventHandler(apiRef, 'columnsChange', checkGroupingColumnsModelDiff);
|
|
162
172
|
useGridApiEventHandler(apiRef, 'rowGroupingModelChange', checkGroupingColumnsModelDiff);
|
|
173
|
+
useGridApiEventHandler(apiRef, 'rowGroupingModelChange', () => apiRef.current.unstable_dataSource.fetchRows());
|
|
163
174
|
|
|
164
|
-
|
|
175
|
+
/*
|
|
165
176
|
* EFFECTS
|
|
166
177
|
*/
|
|
167
178
|
React.useEffect(() => {
|