@mui/x-data-grid-premium 7.21.0 → 7.22.0
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 +80 -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 +10 -5
- package/esm/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +73 -0
- package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +16 -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 +7 -4
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +11 -6
- 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 +15 -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 +10 -5
- package/modern/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +73 -0
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +16 -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
|
@@ -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
|
};
|
|
@@ -2,7 +2,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { passFilterLogic } from '@mui/x-data-grid-pro/internals';
|
|
3
3
|
import { gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
|
|
4
4
|
export const GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = '__row_group_by_columns_group__';
|
|
5
|
-
export
|
|
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;
|
|
@@ -103,10 +107,10 @@ export const filterRowTreeFromGroupingColumns = params => {
|
|
|
103
107
|
filteredDescendantCountLookup
|
|
104
108
|
};
|
|
105
109
|
};
|
|
106
|
-
export const getColDefOverrides = (groupingColDefProp, fields) => {
|
|
110
|
+
export const getColDefOverrides = (groupingColDefProp, fields, strategy) => {
|
|
107
111
|
if (typeof groupingColDefProp === 'function') {
|
|
108
112
|
return groupingColDefProp({
|
|
109
|
-
groupingName:
|
|
113
|
+
groupingName: strategy ?? RowGroupingStrategy.Default,
|
|
110
114
|
fields
|
|
111
115
|
});
|
|
112
116
|
}
|
|
@@ -117,7 +121,7 @@ export const mergeStateWithRowGroupingModel = rowGroupingModel => state => _exte
|
|
|
117
121
|
model: rowGroupingModel
|
|
118
122
|
})
|
|
119
123
|
});
|
|
120
|
-
export const setStrategyAvailability = (privateApiRef, disableRowGrouping) => {
|
|
124
|
+
export const setStrategyAvailability = (privateApiRef, disableRowGrouping, dataSource) => {
|
|
121
125
|
let isAvailable;
|
|
122
126
|
if (disableRowGrouping) {
|
|
123
127
|
isAvailable = () => false;
|
|
@@ -127,7 +131,8 @@ export const setStrategyAvailability = (privateApiRef, disableRowGrouping) => {
|
|
|
127
131
|
return rowGroupingSanitizedModel.length > 0;
|
|
128
132
|
};
|
|
129
133
|
}
|
|
130
|
-
|
|
134
|
+
const strategy = dataSource ? RowGroupingStrategy.DataSource : RowGroupingStrategy.Default;
|
|
135
|
+
privateApiRef.current.setStrategyAvailability('rowTree', strategy, isAvailable);
|
|
131
136
|
};
|
|
132
137
|
export const getCellGroupingCriteria = ({
|
|
133
138
|
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
|
}
|
|
@@ -161,7 +171,7 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
161
171
|
useGridApiEventHandler(apiRef, 'columnsChange', checkGroupingColumnsModelDiff);
|
|
162
172
|
useGridApiEventHandler(apiRef, 'rowGroupingModelChange', checkGroupingColumnsModelDiff);
|
|
163
173
|
|
|
164
|
-
|
|
174
|
+
/*
|
|
165
175
|
* EFFECTS
|
|
166
176
|
*/
|
|
167
177
|
React.useEffect(() => {
|
|
@@ -3,12 +3,13 @@ import { gridColumnLookupSelector, gridRowTreeSelector, useFirstRender, GRID_CHE
|
|
|
3
3
|
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor, sortRowTree, createRowTree, updateRowTree, getVisibleRowsLookup } from '@mui/x-data-grid-pro/internals';
|
|
4
4
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
|
|
5
5
|
import { createGroupingColDefForAllGroupingCriteria, createGroupingColDefForOneGroupingCriteria } from "./createGroupingColDef.js";
|
|
6
|
-
import { filterRowTreeFromGroupingColumns, getColDefOverrides,
|
|
6
|
+
import { filterRowTreeFromGroupingColumns, getColDefOverrides, RowGroupingStrategy, isGroupingColumn, setStrategyAvailability, getCellGroupingCriteria, getGroupingRules } from "./gridRowGroupingUtils.js";
|
|
7
7
|
export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
8
8
|
const getGroupingColDefs = React.useCallback(columnsState => {
|
|
9
9
|
if (props.disableRowGrouping) {
|
|
10
10
|
return [];
|
|
11
11
|
}
|
|
12
|
+
const strategy = props.unstable_dataSource ? RowGroupingStrategy.DataSource : RowGroupingStrategy.Default;
|
|
12
13
|
const groupingColDefProp = props.groupingColDef;
|
|
13
14
|
|
|
14
15
|
// We can't use `gridGroupingRowsSanitizedModelSelector` here because the new columns are not in the state yet
|
|
@@ -22,8 +23,9 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
22
23
|
return [createGroupingColDefForAllGroupingCriteria({
|
|
23
24
|
apiRef,
|
|
24
25
|
rowGroupingModel,
|
|
25
|
-
colDefOverride: getColDefOverrides(groupingColDefProp, rowGroupingModel),
|
|
26
|
-
columnsLookup: columnsState.lookup
|
|
26
|
+
colDefOverride: getColDefOverrides(groupingColDefProp, rowGroupingModel, strategy),
|
|
27
|
+
columnsLookup: columnsState.lookup,
|
|
28
|
+
strategy
|
|
27
29
|
})];
|
|
28
30
|
}
|
|
29
31
|
case 'multiple':
|
|
@@ -32,7 +34,8 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
32
34
|
groupingCriteria,
|
|
33
35
|
colDefOverride: getColDefOverrides(groupingColDefProp, [groupingCriteria]),
|
|
34
36
|
groupedByColDef: columnsState.lookup[groupingCriteria],
|
|
35
|
-
columnsLookup: columnsState.lookup
|
|
37
|
+
columnsLookup: columnsState.lookup,
|
|
38
|
+
strategy
|
|
36
39
|
}));
|
|
37
40
|
}
|
|
38
41
|
default:
|
|
@@ -40,7 +43,7 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
40
43
|
return [];
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
|
-
}, [apiRef, props.groupingColDef, props.rowGroupingColumnMode, props.disableRowGrouping]);
|
|
46
|
+
}, [apiRef, props.groupingColDef, props.rowGroupingColumnMode, props.disableRowGrouping, props.unstable_dataSource]);
|
|
44
47
|
const updateGroupingColumn = React.useCallback(columnsState => {
|
|
45
48
|
const groupingColDefs = getGroupingColDefs(columnsState);
|
|
46
49
|
let newColumnFields = [];
|
|
@@ -100,7 +103,7 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
100
103
|
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
101
104
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
102
105
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
103
|
-
groupingName:
|
|
106
|
+
groupingName: RowGroupingStrategy.Default
|
|
104
107
|
});
|
|
105
108
|
}
|
|
106
109
|
return updateRowTree({
|
|
@@ -113,7 +116,7 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
113
116
|
previousTreeDepth: params.previousTreeDepths,
|
|
114
117
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
115
118
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
116
|
-
groupingName:
|
|
119
|
+
groupingName: RowGroupingStrategy.Default
|
|
117
120
|
});
|
|
118
121
|
}, [apiRef, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
119
122
|
const filterRows = React.useCallback(params => {
|
|
@@ -135,27 +138,19 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
135
138
|
});
|
|
136
139
|
}, [apiRef]);
|
|
137
140
|
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
|
|
138
|
-
useGridRegisterStrategyProcessor(apiRef,
|
|
139
|
-
useGridRegisterStrategyProcessor(apiRef,
|
|
140
|
-
useGridRegisterStrategyProcessor(apiRef,
|
|
141
|
-
useGridRegisterStrategyProcessor(apiRef,
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* 1ST RENDER
|
|
145
|
-
*/
|
|
141
|
+
useGridRegisterStrategyProcessor(apiRef, RowGroupingStrategy.Default, 'rowTreeCreation', createRowTreeForRowGrouping);
|
|
142
|
+
useGridRegisterStrategyProcessor(apiRef, RowGroupingStrategy.Default, 'filtering', filterRows);
|
|
143
|
+
useGridRegisterStrategyProcessor(apiRef, RowGroupingStrategy.Default, 'sorting', sortRows);
|
|
144
|
+
useGridRegisterStrategyProcessor(apiRef, RowGroupingStrategy.Default, 'visibleRowsLookupCreation', getVisibleRowsLookup);
|
|
146
145
|
useFirstRender(() => {
|
|
147
|
-
setStrategyAvailability(apiRef, props.disableRowGrouping);
|
|
146
|
+
setStrategyAvailability(apiRef, props.disableRowGrouping, props.unstable_dataSource);
|
|
148
147
|
});
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* EFFECTS
|
|
152
|
-
*/
|
|
153
148
|
const isFirstRender = React.useRef(true);
|
|
154
149
|
React.useEffect(() => {
|
|
155
150
|
if (!isFirstRender.current) {
|
|
156
|
-
setStrategyAvailability(apiRef, props.disableRowGrouping);
|
|
151
|
+
setStrategyAvailability(apiRef, props.disableRowGrouping, props.unstable_dataSource);
|
|
157
152
|
} else {
|
|
158
153
|
isFirstRender.current = false;
|
|
159
154
|
}
|
|
160
|
-
}, [apiRef, props.disableRowGrouping]);
|
|
155
|
+
}, [apiRef, props.disableRowGrouping, props.unstable_dataSource]);
|
|
161
156
|
};
|
package/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcyOTc5NjQwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|