@mui/x-data-grid-pro 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/components/GridDataSourceTreeDataGroupingCell.js +1 -2
- package/esm/components/GridDataSourceTreeDataGroupingCell.js +1 -2
- package/esm/hooks/features/dataSource/cache.js +1 -1
- package/esm/hooks/features/dataSource/gridDataSourceSelector.js +0 -2
- package/esm/hooks/features/dataSource/useGridDataSource.js +4 -3
- package/esm/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -1
- package/esm/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.js +9 -9
- package/esm/hooks/features/treeData/gridTreeDataGroupColDef.js +2 -1
- package/esm/hooks/features/treeData/gridTreeDataUtils.js +5 -1
- package/esm/hooks/features/treeData/useGridTreeDataPreProcessors.js +9 -9
- package/esm/internals/index.js +1 -1
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/dataSource/cache.js +1 -1
- package/hooks/features/dataSource/gridDataSourceSelector.d.ts +0 -1
- package/hooks/features/dataSource/gridDataSourceSelector.js +0 -2
- package/hooks/features/dataSource/useGridDataSource.js +4 -3
- package/hooks/features/detailPanel/gridDetailPanelToggleColDef.d.ts +2 -1
- package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +9 -3
- package/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.js +9 -9
- package/hooks/features/treeData/gridTreeDataGroupColDef.d.ts +2 -1
- package/hooks/features/treeData/gridTreeDataGroupColDef.js +9 -3
- package/hooks/features/treeData/gridTreeDataUtils.d.ts +4 -1
- package/hooks/features/treeData/gridTreeDataUtils.js +6 -3
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +8 -8
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +16 -9
- package/modern/components/GridDataSourceTreeDataGroupingCell.js +1 -2
- package/modern/hooks/features/dataSource/cache.js +1 -1
- package/modern/hooks/features/dataSource/gridDataSourceSelector.js +0 -2
- package/modern/hooks/features/dataSource/useGridDataSource.js +4 -3
- package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -1
- package/modern/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.js +9 -9
- package/modern/hooks/features/treeData/gridTreeDataGroupColDef.js +2 -1
- package/modern/hooks/features/treeData/gridTreeDataUtils.js +5 -1
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +9 -9
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +3 -3
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,148 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.22.1
|
|
7
|
+
|
|
8
|
+
_Nov 1, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🐞 Bugfixes
|
|
13
|
+
- 📚 Documentation improvements
|
|
14
|
+
- 🌍 Improve Polish (pl-PL) locale on the Date Pickers
|
|
15
|
+
|
|
16
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
17
|
+
@wojtkolos, @dpak-maurya, @k-rajat19.
|
|
18
|
+
Following are all team members who have contributed to this release:
|
|
19
|
+
@LukasTy, @arminmeh, @MBilalShafi, @KenanYusuf, @flaviendelangle.
|
|
20
|
+
|
|
21
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
22
|
+
|
|
23
|
+
### Data Grid
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid@7.22.1`
|
|
26
|
+
|
|
27
|
+
- [DataGrid] Fix right column group header border (#15152) @KenanYusuf
|
|
28
|
+
- [DataGrid] Fix scroll jump when holding down arrow keys (#15167) @arminmeh
|
|
29
|
+
- [DataGrid] Move `rowGroupingModelChange` handler to respective hook (#15127) @MBilalShafi
|
|
30
|
+
- [DataGrid] Prevent error when deleting the last row (#15153) @dpak-maurya
|
|
31
|
+
- [DataGrid] Fix overlay height in autoHeight mode (#15205) @cherniavskii
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-pro@7.22.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid@7.22.1`, plus:
|
|
36
|
+
|
|
37
|
+
- [DataGridPro] Add list view tests (#15166) @KenanYusuf
|
|
38
|
+
|
|
39
|
+
#### `@mui/x-data-grid-premium@7.22.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
40
|
+
|
|
41
|
+
- [DataGridPremium] Keep focus on the grouping cell on space bar press #15155 @k-rajat19
|
|
42
|
+
|
|
43
|
+
### Date and Time Pickers
|
|
44
|
+
|
|
45
|
+
#### `@mui/x-date-pickers@7.22.1`
|
|
46
|
+
|
|
47
|
+
- [l10n] Improve Polish (pl-PL) locale (#15177) @wojtkolos
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers-pro@7.22.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-date-pickers@7.22.1`.
|
|
52
|
+
|
|
53
|
+
### Tree View
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-tree-view@7.22.1`
|
|
56
|
+
|
|
57
|
+
- [TreeView] Export `TreeItem2DragAndDropOverlay` and `TreeItem2LabelInput` from the root of each package (#15208) @flaviendelangle
|
|
58
|
+
- [TreeView] Fix drag and drop color usage (#15149) @LukasTy
|
|
59
|
+
|
|
60
|
+
#### `@mui/x-tree-view-pro@7.22.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
61
|
+
|
|
62
|
+
Same changes as in `@mui/x-tree-view@7.22.1`.
|
|
63
|
+
|
|
64
|
+
### Docs
|
|
65
|
+
|
|
66
|
+
- [docs] Add section explaining how to keep the selection while filtering in Data grid docs (#15199) @arminmeh
|
|
67
|
+
|
|
68
|
+
## 7.22.0
|
|
69
|
+
|
|
70
|
+
_Oct 25, 2024_
|
|
71
|
+
|
|
72
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
73
|
+
|
|
74
|
+
- 🛰 Introduce [server-side support for Data Grid row grouping](https://mui.com/x/react-data-grid/server-side-data/row-grouping/)
|
|
75
|
+
- 🐞 Bugfixes
|
|
76
|
+
- 📚 Documentation improvements
|
|
77
|
+
- 🌍 Improve Portuguese (pt-BR) locale on the Data Grid component
|
|
78
|
+
|
|
79
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
80
|
+
@clins1994, @GITPHLAP, @k-rajat19, @kalyan90, @merotosc, @yash49.
|
|
81
|
+
Following are all team members who have contributed to this release:
|
|
82
|
+
@cherniavskii, @flaviendelangle, @LukasTy, @MBilalShafi, @romgrk.
|
|
83
|
+
|
|
84
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
85
|
+
|
|
86
|
+
### Data Grid
|
|
87
|
+
|
|
88
|
+
#### `@mui/x-data-grid@7.22.0`
|
|
89
|
+
|
|
90
|
+
- [DataGrid] Fix `GridPanelAnchor` positioning (#15022) @k-rajat19
|
|
91
|
+
- [DataGrid] Fix ugly prop-types for the `pageStyle` prop of the `GridPrintExportMenuItem` component (#15015) @flaviendelangle
|
|
92
|
+
- [DataGrid] Fix value type in filter model for number and boolean column type (#14733) @k-rajat19
|
|
93
|
+
- [DataGrid] Focus next row when the focused row is deleted (#15067) @cherniavskii
|
|
94
|
+
- [DataGrid] Remove some usages of `<Box />` and `<Badge />` (#15013) @romgrk
|
|
95
|
+
- [DataGrid] Fix number of rows to display for page size options with negative value (#14890) @kalyan90
|
|
96
|
+
- [l10n] Improve Portuguese (pt-BR) locale (#15021) @k-rajat19
|
|
97
|
+
|
|
98
|
+
#### `@mui/x-data-grid-pro@7.22.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
99
|
+
|
|
100
|
+
Same changes as in `@mui/x-data-grid@7.22.0`, plus:
|
|
101
|
+
|
|
102
|
+
- [DataGridPro] Fix column pinning layout (#15073) @cherniavskii
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-data-grid-premium@7.22.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
105
|
+
|
|
106
|
+
Same changes as in `@mui/x-data-grid-pro@7.22.0`, plus:
|
|
107
|
+
|
|
108
|
+
- [DataGridPremium] Server-side data source with row grouping (#15109) @MBilalShafi
|
|
109
|
+
|
|
110
|
+
### Date and Time Pickers
|
|
111
|
+
|
|
112
|
+
#### `@mui/x-date-pickers@7.22.0`
|
|
113
|
+
|
|
114
|
+
- [pickers] Fix `DateCalendar` timezone management (#15119) @LukasTy
|
|
115
|
+
- [pickers] Fix `DigitalClock` time options on a `DST` switch day (#15092) @LukasTy
|
|
116
|
+
|
|
117
|
+
#### `@mui/x-date-pickers-pro@7.22.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
118
|
+
|
|
119
|
+
Same changes as in `@mui/x-date-pickers@7.22.0`.
|
|
120
|
+
|
|
121
|
+
### Charts
|
|
122
|
+
|
|
123
|
+
#### `@mui/x-charts@7.22.0`
|
|
124
|
+
|
|
125
|
+
- [charts] Export data type in `onAxisClick(_, data)` callback (#15038) @clins1994
|
|
126
|
+
|
|
127
|
+
#### `@mui/x-charts-pro@7.0.0-beta.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
128
|
+
|
|
129
|
+
Same changes as in `@mui/x-charts@7.22.0`.
|
|
130
|
+
|
|
131
|
+
### Tree View
|
|
132
|
+
|
|
133
|
+
#### `@mui/x-tree-view@7.22.0`
|
|
134
|
+
|
|
135
|
+
- [TreeView] Make the cancellable event types public (#14992) @flaviendelangle
|
|
136
|
+
|
|
137
|
+
### Docs
|
|
138
|
+
|
|
139
|
+
- [docs] Fix typo in Tree View docs (#15047) @yash49
|
|
140
|
+
|
|
141
|
+
### Core
|
|
142
|
+
|
|
143
|
+
- [core] Adjust cherry-pick GH actions (#15101) @LukasTy
|
|
144
|
+
- [core] Update prettier target branch (#15100) @MBilalShafi
|
|
145
|
+
- [core] Update some `default-branch-switch` instances for `v7.x` (#15085) @MBilalShafi
|
|
146
|
+
- [test] Revert to using `fireEvent` instead of `userEvent` (#14927) @LukasTy
|
|
147
|
+
|
|
6
148
|
## 7.21.0
|
|
7
149
|
|
|
8
150
|
_Oct 17, 2024_
|
|
@@ -10,7 +10,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
12
12
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
-
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
14
13
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
15
14
|
var _internals = require("@mui/x-data-grid/internals");
|
|
16
15
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
@@ -69,7 +68,7 @@ function GridTreeDataGroupingCellIcon(props) {
|
|
|
69
68
|
}, rootProps?.slotProps?.baseIconButton, {
|
|
70
69
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, {
|
|
71
70
|
title: error?.message ?? null,
|
|
72
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseBadge, {
|
|
73
72
|
variant: "dot",
|
|
74
73
|
color: "error",
|
|
75
74
|
invisible: !error,
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import composeClasses from '@mui/utils/composeClasses';
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
5
|
-
import Badge from '@mui/material/Badge';
|
|
6
5
|
import { getDataGridUtilityClass, useGridSelector } from '@mui/x-data-grid';
|
|
7
6
|
import { useGridSelectorV8 } from '@mui/x-data-grid/internals';
|
|
8
7
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
@@ -61,7 +60,7 @@ function GridTreeDataGroupingCellIcon(props) {
|
|
|
61
60
|
}, rootProps?.slotProps?.baseIconButton, {
|
|
62
61
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
63
62
|
title: error?.message ?? null,
|
|
64
|
-
children: /*#__PURE__*/_jsx(
|
|
63
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
65
64
|
variant: "dot",
|
|
66
65
|
color: "error",
|
|
67
66
|
invisible: !error,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function getKey(params) {
|
|
2
|
-
return JSON.stringify([params.paginationModel, params.filterModel, params.sortModel, params.groupKeys]);
|
|
2
|
+
return JSON.stringify([params.paginationModel, params.filterModel, params.sortModel, params.groupKeys, params.groupFields]);
|
|
3
3
|
}
|
|
4
4
|
export class GridDataSourceCacheDefault {
|
|
5
5
|
constructor({
|
|
@@ -12,8 +12,6 @@ const computeStartEnd = paginationModel => {
|
|
|
12
12
|
export const gridGetRowsParamsSelector = createSelector(gridFilterModelSelector, gridSortModelSelector, gridPaginationModelSelector, (filterModel, sortModel, paginationModel) => {
|
|
13
13
|
return _extends({
|
|
14
14
|
groupKeys: [],
|
|
15
|
-
// TODO: Implement with `rowGrouping`
|
|
16
|
-
groupFields: [],
|
|
17
15
|
paginationModel,
|
|
18
16
|
sortModel,
|
|
19
17
|
filterModel
|
|
@@ -47,7 +47,7 @@ export const useGridDataSource = (apiRef, props) => {
|
|
|
47
47
|
if (dataSourceState !== INITIAL_STATE) {
|
|
48
48
|
apiRef.current.resetDataSourceState();
|
|
49
49
|
}
|
|
50
|
-
const fetchParams = gridGetRowsParamsSelector(apiRef);
|
|
50
|
+
const fetchParams = _extends({}, gridGetRowsParamsSelector(apiRef), apiRef.current.unstable_applyPipeProcessors('getRowsParams', {}));
|
|
51
51
|
const cachedData = apiRef.current.unstable_dataSource.cache.get(fetchParams);
|
|
52
52
|
if (cachedData !== undefined) {
|
|
53
53
|
const rows = cachedData.rows;
|
|
@@ -76,7 +76,8 @@ export const useGridDataSource = (apiRef, props) => {
|
|
|
76
76
|
}
|
|
77
77
|
}, [nestedDataManager, apiRef, props.unstable_dataSource?.getRows, onError]);
|
|
78
78
|
const fetchRowChildren = React.useCallback(async id => {
|
|
79
|
-
|
|
79
|
+
const pipedParams = apiRef.current.unstable_applyPipeProcessors('getRowsParams', {});
|
|
80
|
+
if (!props.treeData && (pipedParams.groupFields?.length ?? 0) === 0) {
|
|
80
81
|
nestedDataManager.clearPendingRequest(id);
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
@@ -90,7 +91,7 @@ export const useGridDataSource = (apiRef, props) => {
|
|
|
90
91
|
nestedDataManager.clearPendingRequest(id);
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
|
-
const fetchParams = _extends({}, gridGetRowsParamsSelector(apiRef), {
|
|
94
|
+
const fetchParams = _extends({}, gridGetRowsParamsSelector(apiRef), pipedParams, {
|
|
94
95
|
groupKeys: rowNode.path
|
|
95
96
|
});
|
|
96
97
|
const cachedData = apiRef.current.unstable_dataSource.cache.get(fetchParams);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
4
|
+
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '@mui/x-data-grid/internals';
|
|
4
5
|
import { GridDetailPanelToggleCell } from "../../../components/GridDetailPanelToggleCell.js";
|
|
5
6
|
import { gridDetailPanelExpandedRowIdsSelector } from "./gridDetailPanelSelector.js";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export
|
|
8
|
+
export { GRID_DETAIL_PANEL_TOGGLE_FIELD };
|
|
8
9
|
export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
9
10
|
type: 'custom',
|
|
10
11
|
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
@@ -10,18 +10,18 @@ import { GridDataSourceTreeDataGroupingCell } from "../../../components/GridData
|
|
|
10
10
|
import { createRowTree } from "../../../utils/tree/createRowTree.js";
|
|
11
11
|
import { updateRowTree } from "../../../utils/tree/updateRowTree.js";
|
|
12
12
|
import { getVisibleRowsLookup } from "../../../utils/tree/utils.js";
|
|
13
|
+
import { TreeDataStrategy } from "../treeData/gridTreeDataUtils.js";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const DATA_SOURCE_TREE_DATA_STRATEGY = 'dataSourceTreeData';
|
|
15
15
|
export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) => {
|
|
16
16
|
const setStrategyAvailability = React.useCallback(() => {
|
|
17
|
-
privateApiRef.current.setStrategyAvailability('rowTree',
|
|
17
|
+
privateApiRef.current.setStrategyAvailability('rowTree', TreeDataStrategy.DataSource, props.treeData && props.unstable_dataSource ? () => true : () => false);
|
|
18
18
|
}, [privateApiRef, props.treeData, props.unstable_dataSource]);
|
|
19
19
|
const getGroupingColDef = React.useCallback(() => {
|
|
20
20
|
const groupingColDefProp = props.groupingColDef;
|
|
21
21
|
let colDefOverride;
|
|
22
22
|
if (typeof groupingColDefProp === 'function') {
|
|
23
23
|
const params = {
|
|
24
|
-
groupingName:
|
|
24
|
+
groupingName: TreeDataStrategy.DataSource,
|
|
25
25
|
fields: []
|
|
26
26
|
};
|
|
27
27
|
colDefOverride = groupingColDefProp(params);
|
|
@@ -95,7 +95,7 @@ export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) =>
|
|
|
95
95
|
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
96
96
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
97
97
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
98
|
-
groupingName:
|
|
98
|
+
groupingName: TreeDataStrategy.DataSource,
|
|
99
99
|
onDuplicatePath
|
|
100
100
|
});
|
|
101
101
|
}
|
|
@@ -110,7 +110,7 @@ export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) =>
|
|
|
110
110
|
previousTreeDepth: params.previousTreeDepths,
|
|
111
111
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
112
112
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
113
|
-
groupingName:
|
|
113
|
+
groupingName: TreeDataStrategy.DataSource
|
|
114
114
|
});
|
|
115
115
|
}, [props.unstable_dataSource, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
116
116
|
const filterRows = React.useCallback(() => {
|
|
@@ -122,10 +122,10 @@ export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) =>
|
|
|
122
122
|
return skipSorting(rowTree);
|
|
123
123
|
}, [privateApiRef]);
|
|
124
124
|
useGridRegisterPipeProcessor(privateApiRef, 'hydrateColumns', updateGroupingColumn);
|
|
125
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
126
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
127
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
128
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
125
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.DataSource, 'rowTreeCreation', createRowTreeForTreeData);
|
|
126
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.DataSource, 'filtering', filterRows);
|
|
127
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.DataSource, 'sorting', sortRows);
|
|
128
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.DataSource, 'visibleRowsLookupCreation', getVisibleRowsLookup);
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* 1ST RENDER
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
3
|
+
import { GRID_TREE_DATA_GROUPING_FIELD } from '@mui/x-data-grid/internals';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* TODO: Add sorting and filtering on the value and the filteredDescendantCount
|
|
@@ -18,7 +19,7 @@ export const GRID_TREE_DATA_GROUPING_COL_DEF = _extends({}, GRID_STRING_COL_DEF,
|
|
|
18
19
|
return rowNode?.type === 'group' || rowNode?.type === 'leaf' ? rowNode.groupingKey : undefined;
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
|
-
export
|
|
22
|
+
export { GRID_TREE_DATA_GROUPING_FIELD };
|
|
22
23
|
export const GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES = {
|
|
23
24
|
field: GRID_TREE_DATA_GROUPING_FIELD,
|
|
24
25
|
editable: false,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { passFilterLogic } from '@mui/x-data-grid/internals';
|
|
2
|
-
export
|
|
2
|
+
export let TreeDataStrategy = /*#__PURE__*/function (TreeDataStrategy) {
|
|
3
|
+
TreeDataStrategy["Default"] = "tree-data";
|
|
4
|
+
TreeDataStrategy["DataSource"] = "tree-data-source";
|
|
5
|
+
return TreeDataStrategy;
|
|
6
|
+
}({});
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* A node is visible if one of the following criteria is met:
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid';
|
|
6
6
|
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
|
|
7
7
|
import { GRID_TREE_DATA_GROUPING_COL_DEF, GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES } from "./gridTreeDataGroupColDef.js";
|
|
8
|
-
import { filterRowTreeFromTreeData,
|
|
8
|
+
import { filterRowTreeFromTreeData, TreeDataStrategy } from "./gridTreeDataUtils.js";
|
|
9
9
|
import { GridTreeDataGroupingCell } from "../../../components/index.js";
|
|
10
10
|
import { createRowTree } from "../../../utils/tree/createRowTree.js";
|
|
11
11
|
import { sortRowTree } from "../../../utils/tree/sortRowTree.js";
|
|
@@ -14,14 +14,14 @@ import { getVisibleRowsLookup } from "../../../utils/tree/utils.js";
|
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
16
16
|
const setStrategyAvailability = React.useCallback(() => {
|
|
17
|
-
privateApiRef.current.setStrategyAvailability('rowTree',
|
|
17
|
+
privateApiRef.current.setStrategyAvailability('rowTree', TreeDataStrategy.Default, props.treeData && !props.unstable_dataSource ? () => true : () => false);
|
|
18
18
|
}, [privateApiRef, props.treeData, props.unstable_dataSource]);
|
|
19
19
|
const getGroupingColDef = React.useCallback(() => {
|
|
20
20
|
const groupingColDefProp = props.groupingColDef;
|
|
21
21
|
let colDefOverride;
|
|
22
22
|
if (typeof groupingColDefProp === 'function') {
|
|
23
23
|
const params = {
|
|
24
|
-
groupingName:
|
|
24
|
+
groupingName: TreeDataStrategy.Default,
|
|
25
25
|
fields: []
|
|
26
26
|
};
|
|
27
27
|
colDefOverride = groupingColDefProp(params);
|
|
@@ -85,7 +85,7 @@ export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
85
85
|
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
86
86
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
87
87
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
88
|
-
groupingName:
|
|
88
|
+
groupingName: TreeDataStrategy.Default,
|
|
89
89
|
onDuplicatePath
|
|
90
90
|
});
|
|
91
91
|
}
|
|
@@ -99,7 +99,7 @@ export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
99
99
|
previousTreeDepth: params.previousTreeDepths,
|
|
100
100
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
101
101
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
102
|
-
groupingName:
|
|
102
|
+
groupingName: TreeDataStrategy.Default
|
|
103
103
|
});
|
|
104
104
|
}, [props.getTreeDataPath, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
105
105
|
const filterRows = React.useCallback(params => {
|
|
@@ -122,10 +122,10 @@ export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
122
122
|
});
|
|
123
123
|
}, [privateApiRef, props.disableChildrenSorting]);
|
|
124
124
|
useGridRegisterPipeProcessor(privateApiRef, 'hydrateColumns', updateGroupingColumn);
|
|
125
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
126
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
127
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
128
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
125
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.Default, 'rowTreeCreation', createRowTreeForTreeData);
|
|
126
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.Default, 'filtering', filterRows);
|
|
127
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.Default, 'sorting', sortRows);
|
|
128
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.Default, 'visibleRowsLookupCreation', getVisibleRowsLookup);
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* 1ST RENDER
|
package/esm/internals/index.js
CHANGED
|
@@ -22,7 +22,6 @@ export { useGridRowReorder } from "../hooks/features/rowReorder/useGridRowReorde
|
|
|
22
22
|
export { useGridRowReorderPreProcessors } from "../hooks/features/rowReorder/useGridRowReorderPreProcessors.js";
|
|
23
23
|
export { useGridTreeData } from "../hooks/features/treeData/useGridTreeData.js";
|
|
24
24
|
export { useGridTreeDataPreProcessors } from "../hooks/features/treeData/useGridTreeDataPreProcessors.js";
|
|
25
|
-
export { TREE_DATA_STRATEGY } from "../hooks/features/treeData/gridTreeDataUtils.js";
|
|
26
25
|
export { useGridRowPinning, rowPinningStateInitializer } from "../hooks/features/rowPinning/useGridRowPinning.js";
|
|
27
26
|
export { useGridRowPinningPreProcessors, addPinnedRow } from "../hooks/features/rowPinning/useGridRowPinningPreProcessors.js";
|
|
28
27
|
export { useGridLazyLoader } from "../hooks/features/lazyLoader/useGridLazyLoader.js";
|
|
@@ -32,4 +31,5 @@ export { createRowTree } from "../utils/tree/createRowTree.js";
|
|
|
32
31
|
export { updateRowTree } from "../utils/tree/updateRowTree.js";
|
|
33
32
|
export { sortRowTree } from "../utils/tree/sortRowTree.js";
|
|
34
33
|
export { insertNodeInTree, removeNodeFromTree, getVisibleRowsLookup } from "../utils/tree/utils.js";
|
|
34
|
+
export { skipSorting, skipFiltering } from "../hooks/features/serverSideTreeData/utils.js";
|
|
35
35
|
export * from "./propValidation.js";
|
package/esm/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMDQzMzYwMDAwMA==";
|
|
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
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.GridDataSourceCacheDefault = void 0;
|
|
7
7
|
function getKey(params) {
|
|
8
|
-
return JSON.stringify([params.paginationModel, params.filterModel, params.sortModel, params.groupKeys]);
|
|
8
|
+
return JSON.stringify([params.paginationModel, params.filterModel, params.sortModel, params.groupKeys, params.groupFields]);
|
|
9
9
|
}
|
|
10
10
|
class GridDataSourceCacheDefault {
|
|
11
11
|
constructor({
|
|
@@ -4,7 +4,6 @@ export declare const gridGetRowsParamsSelector: import("@mui/x-data-grid").Outpu
|
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
6
|
groupKeys: never[];
|
|
7
|
-
groupFields: never[];
|
|
8
7
|
paginationModel: GridPaginationModel;
|
|
9
8
|
sortModel: import("@mui/x-data-grid").GridSortModel;
|
|
10
9
|
filterModel: import("@mui/x-data-grid").GridFilterModel;
|
|
@@ -19,8 +19,6 @@ const computeStartEnd = paginationModel => {
|
|
|
19
19
|
const gridGetRowsParamsSelector = exports.gridGetRowsParamsSelector = (0, _internals.createSelector)(_xDataGrid.gridFilterModelSelector, _xDataGrid.gridSortModelSelector, _xDataGrid.gridPaginationModelSelector, (filterModel, sortModel, paginationModel) => {
|
|
20
20
|
return (0, _extends2.default)({
|
|
21
21
|
groupKeys: [],
|
|
22
|
-
// TODO: Implement with `rowGrouping`
|
|
23
|
-
groupFields: [],
|
|
24
22
|
paginationModel,
|
|
25
23
|
sortModel,
|
|
26
24
|
filterModel
|
|
@@ -56,7 +56,7 @@ const useGridDataSource = (apiRef, props) => {
|
|
|
56
56
|
if (dataSourceState !== INITIAL_STATE) {
|
|
57
57
|
apiRef.current.resetDataSourceState();
|
|
58
58
|
}
|
|
59
|
-
const fetchParams = (0, _gridDataSourceSelector.gridGetRowsParamsSelector)(apiRef);
|
|
59
|
+
const fetchParams = (0, _extends2.default)({}, (0, _gridDataSourceSelector.gridGetRowsParamsSelector)(apiRef), apiRef.current.unstable_applyPipeProcessors('getRowsParams', {}));
|
|
60
60
|
const cachedData = apiRef.current.unstable_dataSource.cache.get(fetchParams);
|
|
61
61
|
if (cachedData !== undefined) {
|
|
62
62
|
const rows = cachedData.rows;
|
|
@@ -85,7 +85,8 @@ const useGridDataSource = (apiRef, props) => {
|
|
|
85
85
|
}
|
|
86
86
|
}, [nestedDataManager, apiRef, props.unstable_dataSource?.getRows, onError]);
|
|
87
87
|
const fetchRowChildren = React.useCallback(async id => {
|
|
88
|
-
|
|
88
|
+
const pipedParams = apiRef.current.unstable_applyPipeProcessors('getRowsParams', {});
|
|
89
|
+
if (!props.treeData && (pipedParams.groupFields?.length ?? 0) === 0) {
|
|
89
90
|
nestedDataManager.clearPendingRequest(id);
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
@@ -99,7 +100,7 @@ const useGridDataSource = (apiRef, props) => {
|
|
|
99
100
|
nestedDataManager.clearPendingRequest(id);
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
|
-
const fetchParams = (0, _extends2.default)({}, (0, _gridDataSourceSelector.gridGetRowsParamsSelector)(apiRef), {
|
|
103
|
+
const fetchParams = (0, _extends2.default)({}, (0, _gridDataSourceSelector.gridGetRowsParamsSelector)(apiRef), pipedParams, {
|
|
103
104
|
groupKeys: rowNode.path
|
|
104
105
|
});
|
|
105
106
|
const cachedData = apiRef.current.unstable_dataSource.cache.get(fetchParams);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { GridColDef } from '@mui/x-data-grid';
|
|
2
|
-
|
|
2
|
+
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '@mui/x-data-grid/internals';
|
|
3
|
+
export { GRID_DETAIL_PANEL_TOGGLE_FIELD };
|
|
3
4
|
export declare const GRID_DETAIL_PANEL_TOGGLE_COL_DEF: GridColDef;
|
|
@@ -5,17 +5,23 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.GRID_DETAIL_PANEL_TOGGLE_COL_DEF = void 0;
|
|
9
|
+
Object.defineProperty(exports, "GRID_DETAIL_PANEL_TOGGLE_FIELD", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _internals.GRID_DETAIL_PANEL_TOGGLE_FIELD;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
9
15
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
16
|
var React = _interopRequireWildcard(require("react"));
|
|
11
17
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
18
|
+
var _internals = require("@mui/x-data-grid/internals");
|
|
12
19
|
var _GridDetailPanelToggleCell = require("../../../components/GridDetailPanelToggleCell");
|
|
13
20
|
var _gridDetailPanelSelector = require("./gridDetailPanelSelector");
|
|
14
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
const GRID_DETAIL_PANEL_TOGGLE_FIELD = exports.GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
16
22
|
const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = exports.GRID_DETAIL_PANEL_TOGGLE_COL_DEF = (0, _extends2.default)({}, _xDataGrid.GRID_STRING_COL_DEF, {
|
|
17
23
|
type: 'custom',
|
|
18
|
-
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
24
|
+
field: _internals.GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
19
25
|
editable: false,
|
|
20
26
|
sortable: false,
|
|
21
27
|
filterable: false,
|
|
@@ -17,19 +17,19 @@ var _GridDataSourceTreeDataGroupingCell = require("../../../components/GridDataS
|
|
|
17
17
|
var _createRowTree = require("../../../utils/tree/createRowTree");
|
|
18
18
|
var _updateRowTree = require("../../../utils/tree/updateRowTree");
|
|
19
19
|
var _utils2 = require("../../../utils/tree/utils");
|
|
20
|
+
var _gridTreeDataUtils = require("../treeData/gridTreeDataUtils");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
22
|
const _excluded = ["hideDescendantCount"];
|
|
22
|
-
const DATA_SOURCE_TREE_DATA_STRATEGY = 'dataSourceTreeData';
|
|
23
23
|
const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) => {
|
|
24
24
|
const setStrategyAvailability = React.useCallback(() => {
|
|
25
|
-
privateApiRef.current.setStrategyAvailability('rowTree',
|
|
25
|
+
privateApiRef.current.setStrategyAvailability('rowTree', _gridTreeDataUtils.TreeDataStrategy.DataSource, props.treeData && props.unstable_dataSource ? () => true : () => false);
|
|
26
26
|
}, [privateApiRef, props.treeData, props.unstable_dataSource]);
|
|
27
27
|
const getGroupingColDef = React.useCallback(() => {
|
|
28
28
|
const groupingColDefProp = props.groupingColDef;
|
|
29
29
|
let colDefOverride;
|
|
30
30
|
if (typeof groupingColDefProp === 'function') {
|
|
31
31
|
const params = {
|
|
32
|
-
groupingName:
|
|
32
|
+
groupingName: _gridTreeDataUtils.TreeDataStrategy.DataSource,
|
|
33
33
|
fields: []
|
|
34
34
|
};
|
|
35
35
|
colDefOverride = groupingColDefProp(params);
|
|
@@ -103,7 +103,7 @@ const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
103
103
|
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
104
104
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
105
105
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
106
|
-
groupingName:
|
|
106
|
+
groupingName: _gridTreeDataUtils.TreeDataStrategy.DataSource,
|
|
107
107
|
onDuplicatePath
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -118,7 +118,7 @@ const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
118
118
|
previousTreeDepth: params.previousTreeDepths,
|
|
119
119
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
120
120
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
121
|
-
groupingName:
|
|
121
|
+
groupingName: _gridTreeDataUtils.TreeDataStrategy.DataSource
|
|
122
122
|
});
|
|
123
123
|
}, [props.unstable_dataSource, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
124
124
|
const filterRows = React.useCallback(() => {
|
|
@@ -130,10 +130,10 @@ const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
130
130
|
return (0, _utils.skipSorting)(rowTree);
|
|
131
131
|
}, [privateApiRef]);
|
|
132
132
|
(0, _internals.useGridRegisterPipeProcessor)(privateApiRef, 'hydrateColumns', updateGroupingColumn);
|
|
133
|
-
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef,
|
|
134
|
-
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef,
|
|
135
|
-
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef,
|
|
136
|
-
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef,
|
|
133
|
+
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.TreeDataStrategy.DataSource, 'rowTreeCreation', createRowTreeForTreeData);
|
|
134
|
+
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.TreeDataStrategy.DataSource, 'filtering', filterRows);
|
|
135
|
+
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.TreeDataStrategy.DataSource, 'sorting', sortRows);
|
|
136
|
+
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.TreeDataStrategy.DataSource, 'visibleRowsLookupCreation', _utils2.getVisibleRowsLookup);
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* 1ST RENDER
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GridColDef } from '@mui/x-data-grid';
|
|
2
|
+
import { GRID_TREE_DATA_GROUPING_FIELD } from '@mui/x-data-grid/internals';
|
|
2
3
|
/**
|
|
3
4
|
* TODO: Add sorting and filtering on the value and the filteredDescendantCount
|
|
4
5
|
*/
|
|
5
6
|
export declare const GRID_TREE_DATA_GROUPING_COL_DEF: Omit<GridColDef, 'field' | 'editable'>;
|
|
6
|
-
export
|
|
7
|
+
export { GRID_TREE_DATA_GROUPING_FIELD };
|
|
7
8
|
export declare const GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES: Pick<GridColDef, 'field' | 'editable' | 'groupable'>;
|
|
@@ -4,9 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES = exports.GRID_TREE_DATA_GROUPING_COL_DEF = void 0;
|
|
8
|
+
Object.defineProperty(exports, "GRID_TREE_DATA_GROUPING_FIELD", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _internals.GRID_TREE_DATA_GROUPING_FIELD;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
15
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
16
|
+
var _internals = require("@mui/x-data-grid/internals");
|
|
10
17
|
/**
|
|
11
18
|
* TODO: Add sorting and filtering on the value and the filteredDescendantCount
|
|
12
19
|
*/
|
|
@@ -24,9 +31,8 @@ const GRID_TREE_DATA_GROUPING_COL_DEF = exports.GRID_TREE_DATA_GROUPING_COL_DEF
|
|
|
24
31
|
return rowNode?.type === 'group' || rowNode?.type === 'leaf' ? rowNode.groupingKey : undefined;
|
|
25
32
|
}
|
|
26
33
|
});
|
|
27
|
-
const GRID_TREE_DATA_GROUPING_FIELD = exports.GRID_TREE_DATA_GROUPING_FIELD = '__tree_data_group__';
|
|
28
34
|
const GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES = exports.GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES = {
|
|
29
|
-
field: GRID_TREE_DATA_GROUPING_FIELD,
|
|
35
|
+
field: _internals.GRID_TREE_DATA_GROUPING_FIELD,
|
|
30
36
|
editable: false,
|
|
31
37
|
groupable: false
|
|
32
38
|
};
|
|
@@ -8,7 +8,10 @@ interface FilterRowTreeFromTreeDataParams {
|
|
|
8
8
|
filterModel: GridFilterModel;
|
|
9
9
|
apiRef: React.MutableRefObject<GridPrivateApiPro>;
|
|
10
10
|
}
|
|
11
|
-
export declare
|
|
11
|
+
export declare enum TreeDataStrategy {
|
|
12
|
+
Default = "tree-data",
|
|
13
|
+
DataSource = "tree-data-source"
|
|
14
|
+
}
|
|
12
15
|
/**
|
|
13
16
|
* A node is visible if one of the following criteria is met:
|
|
14
17
|
* - One of its children is passing the filter
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.filterRowTreeFromTreeData = exports.
|
|
6
|
+
exports.filterRowTreeFromTreeData = exports.TreeDataStrategy = void 0;
|
|
7
7
|
var _internals = require("@mui/x-data-grid/internals");
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
let TreeDataStrategy = exports.TreeDataStrategy = /*#__PURE__*/function (TreeDataStrategy) {
|
|
9
|
+
TreeDataStrategy["Default"] = "tree-data";
|
|
10
|
+
TreeDataStrategy["DataSource"] = "tree-data-source";
|
|
11
|
+
return TreeDataStrategy;
|
|
12
|
+
}({});
|
|
10
13
|
/**
|
|
11
14
|
* A node is visible if one of the following criteria is met:
|
|
12
15
|
* - One of its children is passing the filter
|
|
@@ -22,14 +22,14 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
22
|
const _excluded = ["hideDescendantCount"];
|
|
23
23
|
const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
24
24
|
const setStrategyAvailability = React.useCallback(() => {
|
|
25
|
-
privateApiRef.current.setStrategyAvailability('rowTree', _gridTreeDataUtils.
|
|
25
|
+
privateApiRef.current.setStrategyAvailability('rowTree', _gridTreeDataUtils.TreeDataStrategy.Default, props.treeData && !props.unstable_dataSource ? () => true : () => false);
|
|
26
26
|
}, [privateApiRef, props.treeData, props.unstable_dataSource]);
|
|
27
27
|
const getGroupingColDef = React.useCallback(() => {
|
|
28
28
|
const groupingColDefProp = props.groupingColDef;
|
|
29
29
|
let colDefOverride;
|
|
30
30
|
if (typeof groupingColDefProp === 'function') {
|
|
31
31
|
const params = {
|
|
32
|
-
groupingName: _gridTreeDataUtils.
|
|
32
|
+
groupingName: _gridTreeDataUtils.TreeDataStrategy.Default,
|
|
33
33
|
fields: []
|
|
34
34
|
};
|
|
35
35
|
colDefOverride = groupingColDefProp(params);
|
|
@@ -93,7 +93,7 @@ const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
93
93
|
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
94
94
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
95
95
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
96
|
-
groupingName: _gridTreeDataUtils.
|
|
96
|
+
groupingName: _gridTreeDataUtils.TreeDataStrategy.Default,
|
|
97
97
|
onDuplicatePath
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -107,7 +107,7 @@ const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
107
107
|
previousTreeDepth: params.previousTreeDepths,
|
|
108
108
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
109
109
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
110
|
-
groupingName: _gridTreeDataUtils.
|
|
110
|
+
groupingName: _gridTreeDataUtils.TreeDataStrategy.Default
|
|
111
111
|
});
|
|
112
112
|
}, [props.getTreeDataPath, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
113
113
|
const filterRows = React.useCallback(params => {
|
|
@@ -130,10 +130,10 @@ const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
130
130
|
});
|
|
131
131
|
}, [privateApiRef, props.disableChildrenSorting]);
|
|
132
132
|
(0, _internals.useGridRegisterPipeProcessor)(privateApiRef, 'hydrateColumns', updateGroupingColumn);
|
|
133
|
-
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.
|
|
134
|
-
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.
|
|
135
|
-
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.
|
|
136
|
-
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.
|
|
133
|
+
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.TreeDataStrategy.Default, 'rowTreeCreation', createRowTreeForTreeData);
|
|
134
|
+
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.TreeDataStrategy.Default, 'filtering', filterRows);
|
|
135
|
+
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.TreeDataStrategy.Default, 'sorting', sortRows);
|
|
136
|
+
(0, _internals.useGridRegisterStrategyProcessor)(privateApiRef, _gridTreeDataUtils.TreeDataStrategy.Default, 'visibleRowsLookupCreation', _utils.getVisibleRowsLookup);
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* 1ST RENDER
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorde
|
|
|
15
15
|
export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
|
|
16
16
|
export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
|
|
17
17
|
export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
|
|
18
|
-
export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils';
|
|
19
18
|
export { useGridRowPinning, rowPinningStateInitializer, } from '../hooks/features/rowPinning/useGridRowPinning';
|
|
20
19
|
export { useGridRowPinningPreProcessors, addPinnedRow, } from '../hooks/features/rowPinning/useGridRowPinningPreProcessors';
|
|
21
20
|
export { useGridLazyLoader } from '../hooks/features/lazyLoader/useGridLazyLoader';
|
|
@@ -27,4 +26,5 @@ export { updateRowTree } from '../utils/tree/updateRowTree';
|
|
|
27
26
|
export { sortRowTree } from '../utils/tree/sortRowTree';
|
|
28
27
|
export { insertNodeInTree, removeNodeFromTree, getVisibleRowsLookup } from '../utils/tree/utils';
|
|
29
28
|
export type { RowTreeBuilderGroupingCriterion } from '../utils/tree/models';
|
|
29
|
+
export { skipSorting, skipFiltering } from '../hooks/features/serverSideTreeData/utils';
|
|
30
30
|
export * from './propValidation';
|
package/internals/index.js
CHANGED
|
@@ -23,7 +23,6 @@ var _exportNames = {
|
|
|
23
23
|
useGridRowReorderPreProcessors: true,
|
|
24
24
|
useGridTreeData: true,
|
|
25
25
|
useGridTreeDataPreProcessors: true,
|
|
26
|
-
TREE_DATA_STRATEGY: true,
|
|
27
26
|
useGridRowPinning: true,
|
|
28
27
|
rowPinningStateInitializer: true,
|
|
29
28
|
useGridRowPinningPreProcessors: true,
|
|
@@ -37,7 +36,9 @@ var _exportNames = {
|
|
|
37
36
|
sortRowTree: true,
|
|
38
37
|
insertNodeInTree: true,
|
|
39
38
|
removeNodeFromTree: true,
|
|
40
|
-
getVisibleRowsLookup: true
|
|
39
|
+
getVisibleRowsLookup: true,
|
|
40
|
+
skipSorting: true,
|
|
41
|
+
skipFiltering: true
|
|
41
42
|
};
|
|
42
43
|
Object.defineProperty(exports, "DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS", {
|
|
43
44
|
enumerable: true,
|
|
@@ -51,12 +52,6 @@ Object.defineProperty(exports, "GridColumnHeaders", {
|
|
|
51
52
|
return _GridColumnHeaders.GridColumnHeaders;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
Object.defineProperty(exports, "TREE_DATA_STRATEGY", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _gridTreeDataUtils.TREE_DATA_STRATEGY;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
55
|
Object.defineProperty(exports, "addPinnedRow", {
|
|
61
56
|
enumerable: true,
|
|
62
57
|
get: function () {
|
|
@@ -117,6 +112,18 @@ Object.defineProperty(exports, "rowPinningStateInitializer", {
|
|
|
117
112
|
return _useGridRowPinning.rowPinningStateInitializer;
|
|
118
113
|
}
|
|
119
114
|
});
|
|
115
|
+
Object.defineProperty(exports, "skipFiltering", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function () {
|
|
118
|
+
return _utils2.skipFiltering;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(exports, "skipSorting", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () {
|
|
124
|
+
return _utils2.skipSorting;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
120
127
|
Object.defineProperty(exports, "sortRowTree", {
|
|
121
128
|
enumerable: true,
|
|
122
129
|
get: function () {
|
|
@@ -271,7 +278,6 @@ var _useGridRowReorder = require("../hooks/features/rowReorder/useGridRowReorder
|
|
|
271
278
|
var _useGridRowReorderPreProcessors = require("../hooks/features/rowReorder/useGridRowReorderPreProcessors");
|
|
272
279
|
var _useGridTreeData = require("../hooks/features/treeData/useGridTreeData");
|
|
273
280
|
var _useGridTreeDataPreProcessors = require("../hooks/features/treeData/useGridTreeDataPreProcessors");
|
|
274
|
-
var _gridTreeDataUtils = require("../hooks/features/treeData/gridTreeDataUtils");
|
|
275
281
|
var _useGridRowPinning = require("../hooks/features/rowPinning/useGridRowPinning");
|
|
276
282
|
var _useGridRowPinningPreProcessors = require("../hooks/features/rowPinning/useGridRowPinningPreProcessors");
|
|
277
283
|
var _useGridLazyLoader = require("../hooks/features/lazyLoader/useGridLazyLoader");
|
|
@@ -281,6 +287,7 @@ var _createRowTree = require("../utils/tree/createRowTree");
|
|
|
281
287
|
var _updateRowTree = require("../utils/tree/updateRowTree");
|
|
282
288
|
var _sortRowTree = require("../utils/tree/sortRowTree");
|
|
283
289
|
var _utils = require("../utils/tree/utils");
|
|
290
|
+
var _utils2 = require("../hooks/features/serverSideTreeData/utils");
|
|
284
291
|
var _propValidation = require("./propValidation");
|
|
285
292
|
Object.keys(_propValidation).forEach(function (key) {
|
|
286
293
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import composeClasses from '@mui/utils/composeClasses';
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
5
|
-
import Badge from '@mui/material/Badge';
|
|
6
5
|
import { getDataGridUtilityClass, useGridSelector } from '@mui/x-data-grid';
|
|
7
6
|
import { useGridSelectorV8 } from '@mui/x-data-grid/internals';
|
|
8
7
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
@@ -61,7 +60,7 @@ function GridTreeDataGroupingCellIcon(props) {
|
|
|
61
60
|
}, rootProps?.slotProps?.baseIconButton, {
|
|
62
61
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
63
62
|
title: error?.message ?? null,
|
|
64
|
-
children: /*#__PURE__*/_jsx(
|
|
63
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
65
64
|
variant: "dot",
|
|
66
65
|
color: "error",
|
|
67
66
|
invisible: !error,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function getKey(params) {
|
|
2
|
-
return JSON.stringify([params.paginationModel, params.filterModel, params.sortModel, params.groupKeys]);
|
|
2
|
+
return JSON.stringify([params.paginationModel, params.filterModel, params.sortModel, params.groupKeys, params.groupFields]);
|
|
3
3
|
}
|
|
4
4
|
export class GridDataSourceCacheDefault {
|
|
5
5
|
constructor({
|
|
@@ -12,8 +12,6 @@ const computeStartEnd = paginationModel => {
|
|
|
12
12
|
export const gridGetRowsParamsSelector = createSelector(gridFilterModelSelector, gridSortModelSelector, gridPaginationModelSelector, (filterModel, sortModel, paginationModel) => {
|
|
13
13
|
return _extends({
|
|
14
14
|
groupKeys: [],
|
|
15
|
-
// TODO: Implement with `rowGrouping`
|
|
16
|
-
groupFields: [],
|
|
17
15
|
paginationModel,
|
|
18
16
|
sortModel,
|
|
19
17
|
filterModel
|
|
@@ -47,7 +47,7 @@ export const useGridDataSource = (apiRef, props) => {
|
|
|
47
47
|
if (dataSourceState !== INITIAL_STATE) {
|
|
48
48
|
apiRef.current.resetDataSourceState();
|
|
49
49
|
}
|
|
50
|
-
const fetchParams = gridGetRowsParamsSelector(apiRef);
|
|
50
|
+
const fetchParams = _extends({}, gridGetRowsParamsSelector(apiRef), apiRef.current.unstable_applyPipeProcessors('getRowsParams', {}));
|
|
51
51
|
const cachedData = apiRef.current.unstable_dataSource.cache.get(fetchParams);
|
|
52
52
|
if (cachedData !== undefined) {
|
|
53
53
|
const rows = cachedData.rows;
|
|
@@ -76,7 +76,8 @@ export const useGridDataSource = (apiRef, props) => {
|
|
|
76
76
|
}
|
|
77
77
|
}, [nestedDataManager, apiRef, props.unstable_dataSource?.getRows, onError]);
|
|
78
78
|
const fetchRowChildren = React.useCallback(async id => {
|
|
79
|
-
|
|
79
|
+
const pipedParams = apiRef.current.unstable_applyPipeProcessors('getRowsParams', {});
|
|
80
|
+
if (!props.treeData && (pipedParams.groupFields?.length ?? 0) === 0) {
|
|
80
81
|
nestedDataManager.clearPendingRequest(id);
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
@@ -90,7 +91,7 @@ export const useGridDataSource = (apiRef, props) => {
|
|
|
90
91
|
nestedDataManager.clearPendingRequest(id);
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
|
-
const fetchParams = _extends({}, gridGetRowsParamsSelector(apiRef), {
|
|
94
|
+
const fetchParams = _extends({}, gridGetRowsParamsSelector(apiRef), pipedParams, {
|
|
94
95
|
groupKeys: rowNode.path
|
|
95
96
|
});
|
|
96
97
|
const cachedData = apiRef.current.unstable_dataSource.cache.get(fetchParams);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
4
|
+
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '@mui/x-data-grid/internals';
|
|
4
5
|
import { GridDetailPanelToggleCell } from "../../../components/GridDetailPanelToggleCell.js";
|
|
5
6
|
import { gridDetailPanelExpandedRowIdsSelector } from "./gridDetailPanelSelector.js";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export
|
|
8
|
+
export { GRID_DETAIL_PANEL_TOGGLE_FIELD };
|
|
8
9
|
export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
9
10
|
type: 'custom',
|
|
10
11
|
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
@@ -10,18 +10,18 @@ import { GridDataSourceTreeDataGroupingCell } from "../../../components/GridData
|
|
|
10
10
|
import { createRowTree } from "../../../utils/tree/createRowTree.js";
|
|
11
11
|
import { updateRowTree } from "../../../utils/tree/updateRowTree.js";
|
|
12
12
|
import { getVisibleRowsLookup } from "../../../utils/tree/utils.js";
|
|
13
|
+
import { TreeDataStrategy } from "../treeData/gridTreeDataUtils.js";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const DATA_SOURCE_TREE_DATA_STRATEGY = 'dataSourceTreeData';
|
|
15
15
|
export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) => {
|
|
16
16
|
const setStrategyAvailability = React.useCallback(() => {
|
|
17
|
-
privateApiRef.current.setStrategyAvailability('rowTree',
|
|
17
|
+
privateApiRef.current.setStrategyAvailability('rowTree', TreeDataStrategy.DataSource, props.treeData && props.unstable_dataSource ? () => true : () => false);
|
|
18
18
|
}, [privateApiRef, props.treeData, props.unstable_dataSource]);
|
|
19
19
|
const getGroupingColDef = React.useCallback(() => {
|
|
20
20
|
const groupingColDefProp = props.groupingColDef;
|
|
21
21
|
let colDefOverride;
|
|
22
22
|
if (typeof groupingColDefProp === 'function') {
|
|
23
23
|
const params = {
|
|
24
|
-
groupingName:
|
|
24
|
+
groupingName: TreeDataStrategy.DataSource,
|
|
25
25
|
fields: []
|
|
26
26
|
};
|
|
27
27
|
colDefOverride = groupingColDefProp(params);
|
|
@@ -95,7 +95,7 @@ export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) =>
|
|
|
95
95
|
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
96
96
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
97
97
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
98
|
-
groupingName:
|
|
98
|
+
groupingName: TreeDataStrategy.DataSource,
|
|
99
99
|
onDuplicatePath
|
|
100
100
|
});
|
|
101
101
|
}
|
|
@@ -110,7 +110,7 @@ export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) =>
|
|
|
110
110
|
previousTreeDepth: params.previousTreeDepths,
|
|
111
111
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
112
112
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
113
|
-
groupingName:
|
|
113
|
+
groupingName: TreeDataStrategy.DataSource
|
|
114
114
|
});
|
|
115
115
|
}, [props.unstable_dataSource, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
116
116
|
const filterRows = React.useCallback(() => {
|
|
@@ -122,10 +122,10 @@ export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) =>
|
|
|
122
122
|
return skipSorting(rowTree);
|
|
123
123
|
}, [privateApiRef]);
|
|
124
124
|
useGridRegisterPipeProcessor(privateApiRef, 'hydrateColumns', updateGroupingColumn);
|
|
125
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
126
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
127
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
128
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
125
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.DataSource, 'rowTreeCreation', createRowTreeForTreeData);
|
|
126
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.DataSource, 'filtering', filterRows);
|
|
127
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.DataSource, 'sorting', sortRows);
|
|
128
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.DataSource, 'visibleRowsLookupCreation', getVisibleRowsLookup);
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* 1ST RENDER
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
3
|
+
import { GRID_TREE_DATA_GROUPING_FIELD } from '@mui/x-data-grid/internals';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* TODO: Add sorting and filtering on the value and the filteredDescendantCount
|
|
@@ -18,7 +19,7 @@ export const GRID_TREE_DATA_GROUPING_COL_DEF = _extends({}, GRID_STRING_COL_DEF,
|
|
|
18
19
|
return rowNode?.type === 'group' || rowNode?.type === 'leaf' ? rowNode.groupingKey : undefined;
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
|
-
export
|
|
22
|
+
export { GRID_TREE_DATA_GROUPING_FIELD };
|
|
22
23
|
export const GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES = {
|
|
23
24
|
field: GRID_TREE_DATA_GROUPING_FIELD,
|
|
24
25
|
editable: false,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { passFilterLogic } from '@mui/x-data-grid/internals';
|
|
2
|
-
export
|
|
2
|
+
export let TreeDataStrategy = /*#__PURE__*/function (TreeDataStrategy) {
|
|
3
|
+
TreeDataStrategy["Default"] = "tree-data";
|
|
4
|
+
TreeDataStrategy["DataSource"] = "tree-data-source";
|
|
5
|
+
return TreeDataStrategy;
|
|
6
|
+
}({});
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* A node is visible if one of the following criteria is met:
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid';
|
|
6
6
|
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
|
|
7
7
|
import { GRID_TREE_DATA_GROUPING_COL_DEF, GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES } from "./gridTreeDataGroupColDef.js";
|
|
8
|
-
import { filterRowTreeFromTreeData,
|
|
8
|
+
import { filterRowTreeFromTreeData, TreeDataStrategy } from "./gridTreeDataUtils.js";
|
|
9
9
|
import { GridTreeDataGroupingCell } from "../../../components/index.js";
|
|
10
10
|
import { createRowTree } from "../../../utils/tree/createRowTree.js";
|
|
11
11
|
import { sortRowTree } from "../../../utils/tree/sortRowTree.js";
|
|
@@ -14,14 +14,14 @@ import { getVisibleRowsLookup } from "../../../utils/tree/utils.js";
|
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
16
16
|
const setStrategyAvailability = React.useCallback(() => {
|
|
17
|
-
privateApiRef.current.setStrategyAvailability('rowTree',
|
|
17
|
+
privateApiRef.current.setStrategyAvailability('rowTree', TreeDataStrategy.Default, props.treeData && !props.unstable_dataSource ? () => true : () => false);
|
|
18
18
|
}, [privateApiRef, props.treeData, props.unstable_dataSource]);
|
|
19
19
|
const getGroupingColDef = React.useCallback(() => {
|
|
20
20
|
const groupingColDefProp = props.groupingColDef;
|
|
21
21
|
let colDefOverride;
|
|
22
22
|
if (typeof groupingColDefProp === 'function') {
|
|
23
23
|
const params = {
|
|
24
|
-
groupingName:
|
|
24
|
+
groupingName: TreeDataStrategy.Default,
|
|
25
25
|
fields: []
|
|
26
26
|
};
|
|
27
27
|
colDefOverride = groupingColDefProp(params);
|
|
@@ -85,7 +85,7 @@ export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
85
85
|
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
86
86
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
87
87
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
88
|
-
groupingName:
|
|
88
|
+
groupingName: TreeDataStrategy.Default,
|
|
89
89
|
onDuplicatePath
|
|
90
90
|
});
|
|
91
91
|
}
|
|
@@ -99,7 +99,7 @@ export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
99
99
|
previousTreeDepth: params.previousTreeDepths,
|
|
100
100
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
101
101
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
102
|
-
groupingName:
|
|
102
|
+
groupingName: TreeDataStrategy.Default
|
|
103
103
|
});
|
|
104
104
|
}, [props.getTreeDataPath, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
105
105
|
const filterRows = React.useCallback(params => {
|
|
@@ -122,10 +122,10 @@ export const useGridTreeDataPreProcessors = (privateApiRef, props) => {
|
|
|
122
122
|
});
|
|
123
123
|
}, [privateApiRef, props.disableChildrenSorting]);
|
|
124
124
|
useGridRegisterPipeProcessor(privateApiRef, 'hydrateColumns', updateGroupingColumn);
|
|
125
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
126
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
127
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
128
|
-
useGridRegisterStrategyProcessor(privateApiRef,
|
|
125
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.Default, 'rowTreeCreation', createRowTreeForTreeData);
|
|
126
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.Default, 'filtering', filterRows);
|
|
127
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.Default, 'sorting', sortRows);
|
|
128
|
+
useGridRegisterStrategyProcessor(privateApiRef, TreeDataStrategy.Default, 'visibleRowsLookupCreation', getVisibleRowsLookup);
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* 1ST RENDER
|
package/modern/index.js
CHANGED
|
@@ -22,7 +22,6 @@ export { useGridRowReorder } from "../hooks/features/rowReorder/useGridRowReorde
|
|
|
22
22
|
export { useGridRowReorderPreProcessors } from "../hooks/features/rowReorder/useGridRowReorderPreProcessors.js";
|
|
23
23
|
export { useGridTreeData } from "../hooks/features/treeData/useGridTreeData.js";
|
|
24
24
|
export { useGridTreeDataPreProcessors } from "../hooks/features/treeData/useGridTreeDataPreProcessors.js";
|
|
25
|
-
export { TREE_DATA_STRATEGY } from "../hooks/features/treeData/gridTreeDataUtils.js";
|
|
26
25
|
export { useGridRowPinning, rowPinningStateInitializer } from "../hooks/features/rowPinning/useGridRowPinning.js";
|
|
27
26
|
export { useGridRowPinningPreProcessors, addPinnedRow } from "../hooks/features/rowPinning/useGridRowPinningPreProcessors.js";
|
|
28
27
|
export { useGridLazyLoader } from "../hooks/features/lazyLoader/useGridLazyLoader.js";
|
|
@@ -32,4 +31,5 @@ export { createRowTree } from "../utils/tree/createRowTree.js";
|
|
|
32
31
|
export { updateRowTree } from "../utils/tree/updateRowTree.js";
|
|
33
32
|
export { sortRowTree } from "../utils/tree/sortRowTree.js";
|
|
34
33
|
export { insertNodeInTree, removeNodeFromTree, getVisibleRowsLookup } from "../utils/tree/utils.js";
|
|
34
|
+
export { skipSorting, skipFiltering } from "../hooks/features/serverSideTreeData/utils.js";
|
|
35
35
|
export * from "./propValidation.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMDQzMzYwMDAwMA==";
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-pro",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.22.1",
|
|
4
4
|
"description": "The Pro plan edition of the Data Grid components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
41
|
"reselect": "^5.1.1",
|
|
42
|
+
"@mui/x-data-grid": "7.22.1",
|
|
42
43
|
"@mui/x-internals": "7.21.0",
|
|
43
|
-
"@mui/x-license": "7.21.0"
|
|
44
|
-
"@mui/x-data-grid": "7.21.0"
|
|
44
|
+
"@mui/x-license": "7.21.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@emotion/react": "^11.9.0",
|
package/utils/releaseInfo.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getReleaseInfo = void 0;
|
|
7
7
|
var _utils = require("@mui/utils");
|
|
8
8
|
const getReleaseInfo = () => {
|
|
9
|
-
const releaseInfo = "
|
|
9
|
+
const releaseInfo = "MTczMDQzMzYwMDAwMA==";
|
|
10
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
11
11
|
// A simple hack to set the value in the test environment (has no build step).
|
|
12
12
|
// eslint-disable-next-line no-useless-concat
|