@mui/x-data-grid-pro 8.13.1 → 8.14.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 +204 -1
- package/DataGridPro/DataGridPro.js +1 -1
- package/esm/DataGridPro/DataGridPro.js +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBasePro.js +2 -2
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +0 -1
- package/esm/internals/index.js +0 -1
- package/esm/utils/tree/createRowTree.d.ts +1 -0
- package/esm/utils/tree/createRowTree.js +2 -1
- package/esm/utils/tree/insertDataRowInTree.d.ts +4 -9
- package/esm/utils/tree/insertDataRowInTree.js +5 -9
- package/esm/utils/tree/removeDataRowFromTree.d.ts +1 -8
- package/esm/utils/tree/removeDataRowFromTree.js +4 -12
- package/esm/utils/tree/updateRowTree.d.ts +1 -0
- package/esm/utils/tree/updateRowTree.js +5 -11
- package/esm/utils/tree/utils.d.ts +3 -4
- package/esm/utils/tree/utils.js +6 -12
- package/hooks/features/dataSource/useGridDataSourceBasePro.js +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +0 -1
- package/internals/index.js +8 -16
- package/package.json +5 -6
- package/utils/tree/createRowTree.d.ts +1 -0
- package/utils/tree/createRowTree.js +2 -1
- package/utils/tree/insertDataRowInTree.d.ts +4 -9
- package/utils/tree/insertDataRowInTree.js +5 -9
- package/utils/tree/removeDataRowFromTree.d.ts +1 -8
- package/utils/tree/removeDataRowFromTree.js +4 -12
- package/utils/tree/updateRowTree.d.ts +1 -0
- package/utils/tree/updateRowTree.js +4 -10
- package/utils/tree/utils.d.ts +3 -4
- package/utils/tree/utils.js +7 -14
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,209 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.14.1
|
|
9
|
+
|
|
10
|
+
_Oct 16, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🚀 Charts have optimized data structures for closest point calculations — initial render times reduced by ~25% for 1,000+ data points, with greater gains at larger scales (#19790) @bernardobelchior
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
19
|
+
@djpremier, @jacknot, @justdoit1897, @mellis481, @sai6855
|
|
20
|
+
|
|
21
|
+
The following are all team members who have contributed to this release:
|
|
22
|
+
@arminmeh, @bernardobelchior, @brijeshb42, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @noraleonte, @siriwatknp
|
|
23
|
+
|
|
24
|
+
### Data Grid
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid@8.14.1`
|
|
27
|
+
|
|
28
|
+
- [DataGrid] Fix cell not rerendering on `isCellEditable` prop change (#19898) @cherniavskii
|
|
29
|
+
- [DataGrid] Fix virtualizer memory leaks (#19886) @cherniavskii
|
|
30
|
+
- [DataGrid] Fix tree data unable to deselect row for exclude model (#19846) @siriwatknp
|
|
31
|
+
- [l10n] Improve Italian (it-IT) locale (#19322) @jacknot and (#19940) @justdoit1897
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-pro@8.14.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid@8.14.1`, plus:
|
|
36
|
+
|
|
37
|
+
- [DataGridPro] Clear cache before new request to the nested request queue after a row has been edited (#19873) @arminmeh
|
|
38
|
+
|
|
39
|
+
#### `@mui/x-data-grid-premium@8.14.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
40
|
+
|
|
41
|
+
Same changes as in `@mui/x-data-grid-pro@8.14.1`.
|
|
42
|
+
|
|
43
|
+
### Date and Time Pickers
|
|
44
|
+
|
|
45
|
+
#### `@mui/x-date-pickers@8.14.1`
|
|
46
|
+
|
|
47
|
+
Internal changes.
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers-pro@8.14.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-date-pickers@8.14.1`.
|
|
52
|
+
|
|
53
|
+
### Charts
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-charts@8.14.1`
|
|
56
|
+
|
|
57
|
+
- [charts] Fix `minBarSize` when y-axis is reversed (#19932) @bernardobelchior
|
|
58
|
+
- [charts] Fix bar chart border radius when axis is reversed (#19895) @bernardobelchior
|
|
59
|
+
- [charts] Fix scatter chart `datasetKeys.id` not being optional (#19897) @bernardobelchior
|
|
60
|
+
- [charts] Use more performant data structure for closest point (#19790) @bernardobelchior
|
|
61
|
+
- [charts] Fix `GaugeValueArc` having wrong class (#19965) @bernardobelchior
|
|
62
|
+
- [charts] Fix `undefined` path when highlight empty line chart axis (#19969) @bernardobelchior
|
|
63
|
+
|
|
64
|
+
#### `@mui/x-charts-pro@8.14.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
65
|
+
|
|
66
|
+
Same changes as in `@mui/x-charts@8.14.1`, plus:
|
|
67
|
+
|
|
68
|
+
- [charts-pro] Add `highlighting` to Sankey chart (#19662) @JCQuintas
|
|
69
|
+
|
|
70
|
+
#### `@mui/x-charts-premium@8.14.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
71
|
+
|
|
72
|
+
Same changes as in `@mui/x-charts-pro@8.14.1`.
|
|
73
|
+
|
|
74
|
+
### Tree View
|
|
75
|
+
|
|
76
|
+
#### `@mui/x-tree-view@8.14.1`
|
|
77
|
+
|
|
78
|
+
- [tree view] Do not forward the `ownerState` to the icon (#19772) @flaviendelangle
|
|
79
|
+
|
|
80
|
+
#### `@mui/x-tree-view-pro@8.14.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
81
|
+
|
|
82
|
+
Same changes as in `@mui/x-tree-view@8.14.1`.
|
|
83
|
+
|
|
84
|
+
### Codemod
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-codemod@8.14.0`
|
|
87
|
+
|
|
88
|
+
Internal changes.
|
|
89
|
+
|
|
90
|
+
### Docs
|
|
91
|
+
|
|
92
|
+
- [docs] Add `'bumpX'` and `'bumpY'` curve types to the interpolation demo (#19676) @djpremier
|
|
93
|
+
- [docs] Add scatter chart with linear regression demo (#19900) @bernardobelchior
|
|
94
|
+
- [docs] Correctly describe Data Grid's row selection behavior (#19968) @arminmeh
|
|
95
|
+
- [docs] Fix `isExpanded` type in tree view docs (#19092) @mellis481
|
|
96
|
+
|
|
97
|
+
### Core
|
|
98
|
+
|
|
99
|
+
- [code-infra] Disable Netlify cache plugin (#19950) @Janpot
|
|
100
|
+
- [code-infra] Lint json through eslint (#19890) @Janpot
|
|
101
|
+
- [docs-infra] Use published netlify cache plugin package (#19929) @brijeshb42
|
|
102
|
+
|
|
103
|
+
## 8.14.0
|
|
104
|
+
|
|
105
|
+
_Oct 9, 2025_
|
|
106
|
+
|
|
107
|
+
We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
108
|
+
|
|
109
|
+
- 📊 The [Chart zoom now supports the `pressAndDrag` gesture](https://mui.com/x/react-charts/zoom-and-pan/#zoom-interactions-configuration). Pan by pressing and dragging.
|
|
110
|
+
- 🔄 [Server-side pivoting](https://mui.com/x/react-data-grid/server-side-data/pivoting/) support for the Data Grid
|
|
111
|
+
- 🐞 Bugfixes
|
|
112
|
+
- 📚 Documentation improvements
|
|
113
|
+
|
|
114
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
115
|
+
@djpremier, @Utkarsh-0304
|
|
116
|
+
|
|
117
|
+
The following are all team members who have contributed to this release:
|
|
118
|
+
@alexfauquette, @bernardobelchior, @flaviendelangle, @hasdfa, @Janpot, @JCQuintas, @prakhargupta1, @rita-codes, @noraleonte, @brijeshb42, @arminmeh, @michelengelen
|
|
119
|
+
|
|
120
|
+
### Data Grid
|
|
121
|
+
|
|
122
|
+
#### `@mui/x-data-grid@8.14.0`
|
|
123
|
+
|
|
124
|
+
- [l10n] Improve Brazilian Portuguese (pt-BR) locale (#19658) @djpremier
|
|
125
|
+
|
|
126
|
+
#### `@mui/x-data-grid-pro@8.14.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
127
|
+
|
|
128
|
+
Same changes as in `@mui/x-data-grid@8.14.0`.
|
|
129
|
+
|
|
130
|
+
#### `@mui/x-data-grid-premium@8.14.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
131
|
+
|
|
132
|
+
Same changes as in `@mui/x-data-grid-pro@8.14.0`, plus:
|
|
133
|
+
|
|
134
|
+
- [DataGridPremium] Server-side pivoting (#19575) @arminmeh
|
|
135
|
+
|
|
136
|
+
### Date and Time Pickers
|
|
137
|
+
|
|
138
|
+
#### `@mui/x-date-pickers@8.14.0`
|
|
139
|
+
|
|
140
|
+
- [pickers] Fixed the extra element for the disabled date picker (#19387) @Utkarsh-0304
|
|
141
|
+
- [pickers] Fix input `autoCapitalize` value for Firefox compatibility (#19285) @michelengelen
|
|
142
|
+
- [l10n] Improve Brazilian Portuguese (pt-BR) locale (#19658) @djpremier
|
|
143
|
+
|
|
144
|
+
#### `@mui/x-date-pickers-pro@8.14.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
145
|
+
|
|
146
|
+
Same changes as in `@mui/x-date-pickers@8.14.0`.
|
|
147
|
+
|
|
148
|
+
### Charts
|
|
149
|
+
|
|
150
|
+
#### `@mui/x-charts@8.14.0`
|
|
151
|
+
|
|
152
|
+
- [charts] Add `pressAndDrag` pan gesture (#19779) @JCQuintas
|
|
153
|
+
- [charts] Allow `minPointers` and `maxPointers` to be configured by pointer type (#19794) @JCQuintas
|
|
154
|
+
- [charts] Correct scale domain types (#19844) @bernardobelchior
|
|
155
|
+
- [charts] Fix tooltip position when scrolling (#19857) @alexfauquette
|
|
156
|
+
- [charts] Link item highlight with keyboard navigation (#19768) @alexfauquette
|
|
157
|
+
- [charts] Refactor domain/scale selectors (#19832) @bernardobelchior
|
|
158
|
+
- [charts] Remove min/max from ordinal configuration (#19789) @alexfauquette
|
|
159
|
+
- [charts] Simplify axes filters selectors (#19833) @bernardobelchior
|
|
160
|
+
- [l10n] Improve Brazilian Portuguese (pt-BR) locale (#19658) @djpremier
|
|
161
|
+
|
|
162
|
+
#### `@mui/x-charts-pro@8.14.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
163
|
+
|
|
164
|
+
Same changes as in `@mui/x-charts@8.14.0`.
|
|
165
|
+
|
|
166
|
+
#### `@mui/x-charts-premium@8.14.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
167
|
+
|
|
168
|
+
Same changes as in `@mui/x-charts-pro@8.14.0`.
|
|
169
|
+
|
|
170
|
+
### Tree View
|
|
171
|
+
|
|
172
|
+
#### `@mui/x-tree-view@8.14.0`
|
|
173
|
+
|
|
174
|
+
- [tree view] Fix Tree View tooltip anchoring on overview page (#19806) @noraleonte
|
|
175
|
+
|
|
176
|
+
#### `@mui/x-tree-view-pro@8.14.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
177
|
+
|
|
178
|
+
Same changes as in `@mui/x-tree-view@8.14.0`.
|
|
179
|
+
|
|
180
|
+
### Codemod
|
|
181
|
+
|
|
182
|
+
#### `@mui/x-codemod@8.14.0`
|
|
183
|
+
|
|
184
|
+
Internal changes.
|
|
185
|
+
|
|
186
|
+
### Docs
|
|
187
|
+
|
|
188
|
+
- [docs] Add overview section for pie chart (#19672) @prakhargupta1
|
|
189
|
+
- [docs] Fix demo title knob keys (#19843) @JCQuintas
|
|
190
|
+
- [docs] Hide UI elements of unsupported features in the data source demos (#19849) @arminmeh
|
|
191
|
+
|
|
192
|
+
### Core
|
|
193
|
+
|
|
194
|
+
- [code-infra] Cleanup unused dependencies (#19788) @brijeshb42
|
|
195
|
+
- [code-infra] Fix pnpm-lock issue (#19861) @JCQuintas
|
|
196
|
+
- [code-infra] Improve publishing docs (#19404) @Janpot
|
|
197
|
+
- [code-infra] Remove tsconfig `baseUrl` (#19837) @Janpot
|
|
198
|
+
- [code-infra] Support custom npm dist tags during release (#19803) @Janpot
|
|
199
|
+
- [code-infra] Wait longer for print dialog (#19795) @JCQuintas
|
|
200
|
+
- [code-infra] Replace `lodash` with `es-toolkit` (#19853) @bernardobelchior
|
|
201
|
+
- [code-infra] Update release script PR checklist (#19785) @bernardobelchior
|
|
202
|
+
- [code-infra] Remove remaining usages of `lodash` (#19864) @bernardobelchior
|
|
203
|
+
- [docs-infra] Add `title` knob (#19792) @JCQuintas
|
|
204
|
+
- [docs-infra] Fix missing key in title knob (#19804) @JCQuintas
|
|
205
|
+
|
|
206
|
+
### Miscellaneous
|
|
207
|
+
|
|
208
|
+
- [x-telemetry] Fix transpile issues (#19761) @hasdfa
|
|
209
|
+
- [x-telemetry] Fix ref to deleted file (#19842) @JCQuintas
|
|
210
|
+
|
|
8
211
|
## 8.13.1
|
|
9
212
|
|
|
10
213
|
_Oct 1, 2025_
|
|
@@ -222,7 +425,7 @@ We'd like to extend a big thank you to the 15 contributors who made this release
|
|
|
222
425
|
|
|
223
426
|

|
|
224
427
|
|
|
225
|
-
|
|
428
|
+
👉 [🎥 Watch the full video](https://github.com/user-attachments/assets/28f1848e-dc85-4077-8756-a3e88afd4e54)
|
|
226
429
|
|
|
227
430
|
- ⌨️ Charts keyboard navigation
|
|
228
431
|
- ⚡️ Charts: Add new `renderer="svg-batch"` prop to Scatter charts that provides improved performance for large datasets
|
|
@@ -32,7 +32,7 @@ const configuration = {
|
|
|
32
32
|
useFilterValueGetter: apiRef => apiRef.current.getRowValue
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
const releaseInfo = "
|
|
35
|
+
const releaseInfo = "MTc2MDU3MjgwMDAwMA==";
|
|
36
36
|
const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
|
|
37
37
|
packageName: "x-data-grid-pro",
|
|
38
38
|
releaseInfo: releaseInfo
|
|
@@ -25,7 +25,7 @@ const configuration = {
|
|
|
25
25
|
useFilterValueGetter: apiRef => apiRef.current.getRowValue
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
const releaseInfo = "
|
|
28
|
+
const releaseInfo = "MTc2MDU3MjgwMDAwMA==";
|
|
29
29
|
const watermark = /*#__PURE__*/_jsx(Watermark, {
|
|
30
30
|
packageName: "x-data-grid-pro",
|
|
31
31
|
releaseInfo: releaseInfo
|
|
@@ -27,12 +27,12 @@ export const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
|
|
|
27
27
|
return null;
|
|
28
28
|
}, [apiRef, nestedDataManager]);
|
|
29
29
|
const handleEditRow = React.useCallback((params, updatedRow) => {
|
|
30
|
-
const groupKeys = getGroupKeys(gridRowTreeSelector(apiRef), params.rowId);
|
|
31
|
-
apiRef.current.updateNestedRows([updatedRow], groupKeys);
|
|
32
30
|
if (updatedRow && !isDeepEqual(updatedRow, params.previousRow)) {
|
|
33
31
|
// Reset the outdated cache, only if the row is _actually_ updated
|
|
34
32
|
apiRef.current.dataSource.cache.clear();
|
|
35
33
|
}
|
|
34
|
+
const groupKeys = getGroupKeys(gridRowTreeSelector(apiRef), params.rowId);
|
|
35
|
+
apiRef.current.updateNestedRows([updatedRow], groupKeys);
|
|
36
36
|
}, [apiRef]);
|
|
37
37
|
const {
|
|
38
38
|
api,
|
package/esm/index.js
CHANGED
package/esm/internals/index.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ export { useGridInfiniteLoadingIntersection } from "../hooks/features/serverSide
|
|
|
25
25
|
export { dataSourceStateInitializer } from "../hooks/features/dataSource/useGridDataSourcePro.js";
|
|
26
26
|
export { useGridDataSourceBasePro } from "../hooks/features/dataSource/useGridDataSourceBasePro.js";
|
|
27
27
|
export { gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector } from "../hooks/features/dataSource/gridDataSourceSelector.js";
|
|
28
|
-
export { getGroupKeys } from "../hooks/features/dataSource/utils.js";
|
|
29
28
|
export type { GridExperimentalProFeatures, DataGridProPropsWithoutDefaultValue, DataGridProPropsWithDefaultValue } from "../models/dataGridProProps.js";
|
|
30
29
|
export type { GridProSlotProps } from "../models/gridProSlotProps.js";
|
|
31
30
|
export { createRowTree } from "../utils/tree/createRowTree.js";
|
package/esm/internals/index.js
CHANGED
|
@@ -28,7 +28,6 @@ export { useGridInfiniteLoadingIntersection } from "../hooks/features/serverSide
|
|
|
28
28
|
export { dataSourceStateInitializer } from "../hooks/features/dataSource/useGridDataSourcePro.js";
|
|
29
29
|
export { useGridDataSourceBasePro } from "../hooks/features/dataSource/useGridDataSourceBasePro.js";
|
|
30
30
|
export { gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector } from "../hooks/features/dataSource/gridDataSourceSelector.js";
|
|
31
|
-
export { getGroupKeys } from "../hooks/features/dataSource/utils.js";
|
|
32
31
|
export { createRowTree } from "../utils/tree/createRowTree.js";
|
|
33
32
|
export { updateRowTree } from "../utils/tree/updateRowTree.js";
|
|
34
33
|
export { sortRowTree } from "../utils/tree/sortRowTree.js";
|
|
@@ -9,6 +9,7 @@ interface CreateRowTreeParams {
|
|
|
9
9
|
isGroupExpandedByDefault?: DataGridProProps['isGroupExpandedByDefault'];
|
|
10
10
|
groupingName: string;
|
|
11
11
|
onDuplicatePath?: GridTreePathDuplicateHandler;
|
|
12
|
+
maxDepth?: number;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Transform a list of rows into a tree structure where each row references its parent and children.
|
|
@@ -24,7 +24,8 @@ export const createRowTree = params => {
|
|
|
24
24
|
treeDepths,
|
|
25
25
|
isGroupExpandedByDefault: params.isGroupExpandedByDefault,
|
|
26
26
|
defaultGroupingExpansionDepth: params.defaultGroupingExpansionDepth,
|
|
27
|
-
groupsToFetch
|
|
27
|
+
groupsToFetch,
|
|
28
|
+
maxDepth: params.maxDepth
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
|
|
2
|
-
import { GridTreeDepths
|
|
2
|
+
import { GridTreeDepths } from '@mui/x-data-grid/internals';
|
|
3
3
|
import { GridTreePathDuplicateHandler, RowTreeBuilderGroupingCriterion } from "./models.js";
|
|
4
4
|
import { DataGridProProps } from "../../models/dataGridProProps.js";
|
|
5
5
|
interface InsertDataRowInTreeParams {
|
|
@@ -32,12 +32,6 @@ interface InsertDataRowInTreeParams {
|
|
|
32
32
|
* - `treeDepths[nodeDepth] = treeDepth[nodeDepth] + 1` => valid
|
|
33
33
|
*/
|
|
34
34
|
treeDepths: GridTreeDepths;
|
|
35
|
-
/**
|
|
36
|
-
* Object tracking the action performed on each group.
|
|
37
|
-
* Used to decide which groups to refresh on sorting, filtering, aggregation, ...
|
|
38
|
-
* If not defined, then the tracking will be skipped.
|
|
39
|
-
*/
|
|
40
|
-
updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
|
|
41
35
|
/**
|
|
42
36
|
* Callback fired when trying to insert a data row for a path already populated by another data row.
|
|
43
37
|
*/
|
|
@@ -46,6 +40,7 @@ interface InsertDataRowInTreeParams {
|
|
|
46
40
|
defaultGroupingExpansionDepth: number;
|
|
47
41
|
serverChildrenCount?: number;
|
|
48
42
|
groupsToFetch?: Set<GridRowId>;
|
|
43
|
+
maxDepth?: number;
|
|
49
44
|
}
|
|
50
45
|
/**
|
|
51
46
|
* Inserts a data row in a tree.
|
|
@@ -56,7 +51,6 @@ interface InsertDataRowInTreeParams {
|
|
|
56
51
|
export declare const insertDataRowInTree: ({
|
|
57
52
|
id,
|
|
58
53
|
path,
|
|
59
|
-
updatedGroupsManager,
|
|
60
54
|
previousTree,
|
|
61
55
|
tree,
|
|
62
56
|
treeDepths,
|
|
@@ -64,6 +58,7 @@ export declare const insertDataRowInTree: ({
|
|
|
64
58
|
isGroupExpandedByDefault,
|
|
65
59
|
defaultGroupingExpansionDepth,
|
|
66
60
|
serverChildrenCount,
|
|
67
|
-
groupsToFetch
|
|
61
|
+
groupsToFetch,
|
|
62
|
+
maxDepth
|
|
68
63
|
}: InsertDataRowInTreeParams) => void;
|
|
69
64
|
export {};
|
|
@@ -9,7 +9,6 @@ import { updateGroupDefaultExpansion, checkGroupChildrenExpansion, getGroupRowId
|
|
|
9
9
|
export const insertDataRowInTree = ({
|
|
10
10
|
id,
|
|
11
11
|
path,
|
|
12
|
-
updatedGroupsManager,
|
|
13
12
|
previousTree,
|
|
14
13
|
tree,
|
|
15
14
|
treeDepths,
|
|
@@ -17,7 +16,8 @@ export const insertDataRowInTree = ({
|
|
|
17
16
|
isGroupExpandedByDefault,
|
|
18
17
|
defaultGroupingExpansionDepth,
|
|
19
18
|
serverChildrenCount,
|
|
20
|
-
groupsToFetch
|
|
19
|
+
groupsToFetch,
|
|
20
|
+
maxDepth
|
|
21
21
|
}) => {
|
|
22
22
|
let parentNodeId = GRID_ROOT_GROUP_ID;
|
|
23
23
|
for (let depth = 0; depth < path.length; depth += 1) {
|
|
@@ -51,7 +51,7 @@ export const insertDataRowInTree = ({
|
|
|
51
51
|
childrenExpanded: false,
|
|
52
52
|
serverChildrenCount
|
|
53
53
|
};
|
|
54
|
-
const shouldFetchChildren = checkGroupChildrenExpansion(node, defaultGroupingExpansionDepth,
|
|
54
|
+
const shouldFetchChildren = checkGroupChildrenExpansion(node, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault);
|
|
55
55
|
if (shouldFetchChildren) {
|
|
56
56
|
groupsToFetch?.add(id);
|
|
57
57
|
}
|
|
@@ -64,7 +64,6 @@ export const insertDataRowInTree = ({
|
|
|
64
64
|
groupingKey: key
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
updatedGroupsManager?.addAction(parentNodeId, 'insertChildren');
|
|
68
67
|
insertNodeInTree(node, tree, treeDepths, previousTree);
|
|
69
68
|
} else {
|
|
70
69
|
const existingNodeWithPartialPath = tree[existingNodeIdWithPartialPath];
|
|
@@ -72,8 +71,6 @@ export const insertDataRowInTree = ({
|
|
|
72
71
|
// If we already have an auto-generated group matching the partial path,
|
|
73
72
|
// We replace it with the node from of data row passed to `insertNodeInTree`
|
|
74
73
|
if (existingNodeWithPartialPath.type === 'group' && existingNodeWithPartialPath.isAutoGenerated) {
|
|
75
|
-
updatedGroupsManager?.addAction(parentNodeId, 'removeChildren');
|
|
76
|
-
updatedGroupsManager?.addAction(parentNodeId, 'insertChildren');
|
|
77
74
|
updateGroupNodeIdAndAutoGenerated({
|
|
78
75
|
tree,
|
|
79
76
|
previousTree,
|
|
@@ -110,8 +107,7 @@ export const insertDataRowInTree = ({
|
|
|
110
107
|
childrenFromPath: {},
|
|
111
108
|
childrenExpanded: false
|
|
112
109
|
};
|
|
113
|
-
|
|
114
|
-
insertNodeInTree(updateGroupDefaultExpansion(autoGeneratedGroupNode, defaultGroupingExpansionDepth, isGroupExpandedByDefault, previousTree?.[nodeId]?.childrenExpanded), tree, treeDepths, previousTree);
|
|
110
|
+
insertNodeInTree(updateGroupDefaultExpansion(autoGeneratedGroupNode, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, previousTree?.[nodeId]?.childrenExpanded), tree, treeDepths, previousTree);
|
|
115
111
|
parentNodeId = nodeId;
|
|
116
112
|
}
|
|
117
113
|
// For the intermediary steps of the path
|
|
@@ -133,7 +129,7 @@ export const insertDataRowInTree = ({
|
|
|
133
129
|
childrenFromPath: {},
|
|
134
130
|
childrenExpanded: false
|
|
135
131
|
};
|
|
136
|
-
tree[existingNodeIdWithPartialPath] = updateGroupDefaultExpansion(groupNode, defaultGroupingExpansionDepth, isGroupExpandedByDefault, previousTree?.[currentGroupNode.id]?.childrenExpanded);
|
|
132
|
+
tree[existingNodeIdWithPartialPath] = updateGroupDefaultExpansion(groupNode, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, previousTree?.[currentGroupNode.id]?.childrenExpanded);
|
|
137
133
|
}
|
|
138
134
|
parentNodeId = currentGroupNode.id;
|
|
139
135
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
|
|
2
|
-
import { GridTreeDepths
|
|
2
|
+
import { GridTreeDepths } from '@mui/x-data-grid/internals';
|
|
3
3
|
interface RemoveDataRowFromTreeParams {
|
|
4
4
|
/**
|
|
5
5
|
* ID of the data row to remove from the tree.
|
|
@@ -22,12 +22,6 @@ interface RemoveDataRowFromTreeParams {
|
|
|
22
22
|
* - `treeDepths[nodeDepth] = treeDepth[nodeDepth] + 1` => valid
|
|
23
23
|
*/
|
|
24
24
|
treeDepths: GridTreeDepths;
|
|
25
|
-
/**
|
|
26
|
-
* Object tracking the action performed on each group.
|
|
27
|
-
* Used to decide which groups to refresh on sorting, filtering, aggregation, ...
|
|
28
|
-
* If not defined, then the tracking will be skipped.
|
|
29
|
-
*/
|
|
30
|
-
updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
|
|
31
25
|
groupingName: string;
|
|
32
26
|
}
|
|
33
27
|
/**
|
|
@@ -41,7 +35,6 @@ export declare const removeDataRowFromTree: ({
|
|
|
41
35
|
id,
|
|
42
36
|
tree,
|
|
43
37
|
treeDepths,
|
|
44
|
-
updatedGroupsManager,
|
|
45
38
|
groupingName
|
|
46
39
|
}: RemoveDataRowFromTreeParams) => void;
|
|
47
40
|
export {};
|
|
@@ -23,8 +23,7 @@ const removeNode = ({
|
|
|
23
23
|
const removeNodeAndCleanParent = ({
|
|
24
24
|
node,
|
|
25
25
|
tree,
|
|
26
|
-
treeDepths
|
|
27
|
-
updatedGroupsManager
|
|
26
|
+
treeDepths
|
|
28
27
|
}) => {
|
|
29
28
|
removeNode({
|
|
30
29
|
node,
|
|
@@ -32,7 +31,6 @@ const removeNodeAndCleanParent = ({
|
|
|
32
31
|
treeDepths
|
|
33
32
|
});
|
|
34
33
|
const parentNode = tree[node.parent];
|
|
35
|
-
updatedGroupsManager?.addAction(parentNode.id, 'removeChildren');
|
|
36
34
|
const shouldDeleteGroup = parentNode.id !== GRID_ROOT_GROUP_ID && parentNode.children.length === 0;
|
|
37
35
|
if (shouldDeleteGroup) {
|
|
38
36
|
if (parentNode.isAutoGenerated) {
|
|
@@ -55,11 +53,8 @@ const removeNodeAndCleanParent = ({
|
|
|
55
53
|
const replaceDataGroupWithAutoGeneratedGroup = ({
|
|
56
54
|
node,
|
|
57
55
|
tree,
|
|
58
|
-
treeDepths
|
|
59
|
-
updatedGroupsManager
|
|
56
|
+
treeDepths
|
|
60
57
|
}) => {
|
|
61
|
-
updatedGroupsManager?.addAction(node.parent, 'removeChildren');
|
|
62
|
-
updatedGroupsManager?.addAction(node.parent, 'insertChildren');
|
|
63
58
|
updateGroupNodeIdAndAutoGenerated({
|
|
64
59
|
previousTree: null,
|
|
65
60
|
tree,
|
|
@@ -86,7 +81,6 @@ export const removeDataRowFromTree = ({
|
|
|
86
81
|
id,
|
|
87
82
|
tree,
|
|
88
83
|
treeDepths,
|
|
89
|
-
updatedGroupsManager,
|
|
90
84
|
groupingName
|
|
91
85
|
}) => {
|
|
92
86
|
const node = tree[id];
|
|
@@ -94,15 +88,13 @@ export const removeDataRowFromTree = ({
|
|
|
94
88
|
replaceDataGroupWithAutoGeneratedGroup({
|
|
95
89
|
node,
|
|
96
90
|
tree,
|
|
97
|
-
treeDepths
|
|
98
|
-
updatedGroupsManager
|
|
91
|
+
treeDepths
|
|
99
92
|
});
|
|
100
93
|
} else if (groupingName === TreeDataStrategy.Default || groupingName === RowGroupingStrategy.Default) {
|
|
101
94
|
removeNodeAndCleanParent({
|
|
102
95
|
node,
|
|
103
96
|
tree,
|
|
104
|
-
treeDepths
|
|
105
|
-
updatedGroupsManager
|
|
97
|
+
treeDepths
|
|
106
98
|
});
|
|
107
99
|
} else {
|
|
108
100
|
removeNode({
|
|
@@ -15,6 +15,7 @@ interface UpdateRowTreeParams {
|
|
|
15
15
|
groupingName: string;
|
|
16
16
|
onDuplicatePath?: GridTreePathDuplicateHandler;
|
|
17
17
|
previousGroupsToFetch?: GridRowId[];
|
|
18
|
+
maxDepth?: number;
|
|
18
19
|
}
|
|
19
20
|
export declare const updateRowTree: (params: UpdateRowTreeParams) => GridRowTreeCreationValue;
|
|
20
21
|
export {};
|
|
@@ -4,11 +4,10 @@ import { getTreeNodeDescendants } from '@mui/x-data-grid/internals';
|
|
|
4
4
|
import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
|
|
5
5
|
import { insertDataRowInTree } from "./insertDataRowInTree.js";
|
|
6
6
|
import { removeDataRowFromTree } from "./removeDataRowFromTree.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getNodePathInTree } from "./utils.js";
|
|
8
8
|
export const updateRowTree = params => {
|
|
9
9
|
const tree = _extends({}, params.previousTree);
|
|
10
10
|
const treeDepths = _extends({}, params.previousTreeDepth);
|
|
11
|
-
const updatedGroupsManager = createUpdatedGroupsManager();
|
|
12
11
|
const groupsToFetch = params.previousGroupsToFetch ? new Set([...params.previousGroupsToFetch]) : new Set([]);
|
|
13
12
|
for (let i = 0; i < params.nodes.inserted.length; i += 1) {
|
|
14
13
|
const {
|
|
@@ -20,14 +19,14 @@ export const updateRowTree = params => {
|
|
|
20
19
|
previousTree: params.previousTree,
|
|
21
20
|
tree,
|
|
22
21
|
treeDepths,
|
|
23
|
-
updatedGroupsManager,
|
|
24
22
|
id,
|
|
25
23
|
path,
|
|
26
24
|
serverChildrenCount,
|
|
27
25
|
onDuplicatePath: params.onDuplicatePath,
|
|
28
26
|
isGroupExpandedByDefault: params.isGroupExpandedByDefault,
|
|
29
27
|
defaultGroupingExpansionDepth: params.defaultGroupingExpansionDepth,
|
|
30
|
-
groupsToFetch
|
|
28
|
+
groupsToFetch,
|
|
29
|
+
maxDepth: params.maxDepth
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
for (let i = 0; i < params.nodes.removed.length; i += 1) {
|
|
@@ -35,7 +34,6 @@ export const updateRowTree = params => {
|
|
|
35
34
|
removeDataRowFromTree({
|
|
36
35
|
tree,
|
|
37
36
|
treeDepths,
|
|
38
|
-
updatedGroupsManager,
|
|
39
37
|
id: nodeId,
|
|
40
38
|
groupingName: params.groupingName
|
|
41
39
|
});
|
|
@@ -55,7 +53,6 @@ export const updateRowTree = params => {
|
|
|
55
53
|
removeDataRowFromTree({
|
|
56
54
|
tree,
|
|
57
55
|
treeDepths,
|
|
58
|
-
updatedGroupsManager,
|
|
59
56
|
id,
|
|
60
57
|
groupingName: params.groupingName
|
|
61
58
|
});
|
|
@@ -63,17 +60,15 @@ export const updateRowTree = params => {
|
|
|
63
60
|
previousTree: params.previousTree,
|
|
64
61
|
tree,
|
|
65
62
|
treeDepths,
|
|
66
|
-
updatedGroupsManager,
|
|
67
63
|
id,
|
|
68
64
|
path,
|
|
69
65
|
serverChildrenCount,
|
|
70
66
|
onDuplicatePath: params.onDuplicatePath,
|
|
71
67
|
isGroupExpandedByDefault: params.isGroupExpandedByDefault,
|
|
72
68
|
defaultGroupingExpansionDepth: params.defaultGroupingExpansionDepth,
|
|
73
|
-
groupsToFetch
|
|
69
|
+
groupsToFetch,
|
|
70
|
+
maxDepth: params.maxDepth
|
|
74
71
|
});
|
|
75
|
-
} else {
|
|
76
|
-
updatedGroupsManager?.addAction(tree[id].parent, 'modifyChildren');
|
|
77
72
|
}
|
|
78
73
|
}
|
|
79
74
|
|
|
@@ -84,7 +79,6 @@ export const updateRowTree = params => {
|
|
|
84
79
|
treeDepths,
|
|
85
80
|
groupingName: params.groupingName,
|
|
86
81
|
dataRowIds,
|
|
87
|
-
updatedGroupsManager,
|
|
88
82
|
groupsToFetch: Array.from(groupsToFetch)
|
|
89
83
|
};
|
|
90
84
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridFilterState, GridGroupNode, GridRowId, GridRowTreeConfig, GridRowsState, GridTreeNode } from '@mui/x-data-grid';
|
|
2
|
-
import { GridTreeDepths
|
|
2
|
+
import { GridTreeDepths } from '@mui/x-data-grid/internals';
|
|
3
3
|
import { RowTreeBuilderGroupingCriterion } from "./models.js";
|
|
4
4
|
import { DataGridProProps } from "../../models/dataGridProProps.js";
|
|
5
5
|
export declare const getGroupRowIdFromPath: (path: RowTreeBuilderGroupingCriterion[]) => string;
|
|
@@ -10,8 +10,8 @@ export declare const getNodePathInTree: ({
|
|
|
10
10
|
id: GridRowId;
|
|
11
11
|
tree: GridRowTreeConfig;
|
|
12
12
|
}) => RowTreeBuilderGroupingCriterion[];
|
|
13
|
-
export declare const checkGroupChildrenExpansion: (node: GridGroupNode, defaultGroupingExpansionDepth: number, isGroupExpandedByDefault?: DataGridProProps["isGroupExpandedByDefault"], prevChildrenExpanded?: boolean) => boolean;
|
|
14
|
-
export declare const updateGroupDefaultExpansion: (node: GridGroupNode, defaultGroupingExpansionDepth: number, isGroupExpandedByDefault?: DataGridProProps["isGroupExpandedByDefault"], prevChildrenExpanded?: boolean) => GridGroupNode;
|
|
13
|
+
export declare const checkGroupChildrenExpansion: (node: GridGroupNode, defaultGroupingExpansionDepth: number, maxDepth?: number, isGroupExpandedByDefault?: DataGridProProps["isGroupExpandedByDefault"], prevChildrenExpanded?: boolean) => boolean;
|
|
14
|
+
export declare const updateGroupDefaultExpansion: (node: GridGroupNode, defaultGroupingExpansionDepth: number, maxDepth?: number, isGroupExpandedByDefault?: DataGridProProps["isGroupExpandedByDefault"], prevChildrenExpanded?: boolean) => GridGroupNode;
|
|
15
15
|
/**
|
|
16
16
|
* Insert a node in the tree
|
|
17
17
|
*/
|
|
@@ -44,7 +44,6 @@ export declare const updateGroupNodeIdAndAutoGenerated: ({
|
|
|
44
44
|
tree: GridRowTreeConfig;
|
|
45
45
|
treeDepths: GridTreeDepths;
|
|
46
46
|
}) => void;
|
|
47
|
-
export declare const createUpdatedGroupsManager: () => GridRowTreeUpdatedGroupsManager;
|
|
48
47
|
export declare const getVisibleRowsLookup: ({
|
|
49
48
|
tree,
|
|
50
49
|
filteredRowsLookup
|
package/esm/utils/tree/utils.js
CHANGED
|
@@ -20,7 +20,10 @@ export const getNodePathInTree = ({
|
|
|
20
20
|
path.reverse();
|
|
21
21
|
return path;
|
|
22
22
|
};
|
|
23
|
-
export const checkGroupChildrenExpansion = (node, defaultGroupingExpansionDepth, isGroupExpandedByDefault, prevChildrenExpanded) => {
|
|
23
|
+
export const checkGroupChildrenExpansion = (node, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, prevChildrenExpanded) => {
|
|
24
|
+
if (maxDepth !== undefined && node.depth >= maxDepth) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
24
27
|
let childrenExpanded;
|
|
25
28
|
if (node.id === GRID_ROOT_GROUP_ID) {
|
|
26
29
|
childrenExpanded = true;
|
|
@@ -31,8 +34,8 @@ export const checkGroupChildrenExpansion = (node, defaultGroupingExpansionDepth,
|
|
|
31
34
|
}
|
|
32
35
|
return childrenExpanded;
|
|
33
36
|
};
|
|
34
|
-
export const updateGroupDefaultExpansion = (node, defaultGroupingExpansionDepth, isGroupExpandedByDefault, prevChildrenExpanded) => {
|
|
35
|
-
const childrenExpanded = checkGroupChildrenExpansion(node, defaultGroupingExpansionDepth, isGroupExpandedByDefault, prevChildrenExpanded);
|
|
37
|
+
export const updateGroupDefaultExpansion = (node, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, prevChildrenExpanded) => {
|
|
38
|
+
const childrenExpanded = checkGroupChildrenExpansion(node, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, prevChildrenExpanded);
|
|
36
39
|
node.childrenExpanded = childrenExpanded;
|
|
37
40
|
return node;
|
|
38
41
|
};
|
|
@@ -148,15 +151,6 @@ export const updateGroupNodeIdAndAutoGenerated = ({
|
|
|
148
151
|
const groupNode = _extends({}, node, updatedNode);
|
|
149
152
|
insertNodeInTree(groupNode, tree, treeDepths, previousTree);
|
|
150
153
|
};
|
|
151
|
-
export const createUpdatedGroupsManager = () => ({
|
|
152
|
-
value: {},
|
|
153
|
-
addAction(groupId, action) {
|
|
154
|
-
if (!this.value[groupId]) {
|
|
155
|
-
this.value[groupId] = {};
|
|
156
|
-
}
|
|
157
|
-
this.value[groupId][action] = true;
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
154
|
export const getVisibleRowsLookup = ({
|
|
161
155
|
tree,
|
|
162
156
|
filteredRowsLookup
|
|
@@ -34,12 +34,12 @@ const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
|
|
|
34
34
|
return null;
|
|
35
35
|
}, [apiRef, nestedDataManager]);
|
|
36
36
|
const handleEditRow = React.useCallback((params, updatedRow) => {
|
|
37
|
-
const groupKeys = (0, _utils.getGroupKeys)((0, _xDataGrid.gridRowTreeSelector)(apiRef), params.rowId);
|
|
38
|
-
apiRef.current.updateNestedRows([updatedRow], groupKeys);
|
|
39
37
|
if (updatedRow && !(0, _isDeepEqual.isDeepEqual)(updatedRow, params.previousRow)) {
|
|
40
38
|
// Reset the outdated cache, only if the row is _actually_ updated
|
|
41
39
|
apiRef.current.dataSource.cache.clear();
|
|
42
40
|
}
|
|
41
|
+
const groupKeys = (0, _utils.getGroupKeys)((0, _xDataGrid.gridRowTreeSelector)(apiRef), params.rowId);
|
|
42
|
+
apiRef.current.updateNestedRows([updatedRow], groupKeys);
|
|
43
43
|
}, [apiRef]);
|
|
44
44
|
const {
|
|
45
45
|
api,
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ export { useGridInfiniteLoadingIntersection } from "../hooks/features/serverSide
|
|
|
25
25
|
export { dataSourceStateInitializer } from "../hooks/features/dataSource/useGridDataSourcePro.js";
|
|
26
26
|
export { useGridDataSourceBasePro } from "../hooks/features/dataSource/useGridDataSourceBasePro.js";
|
|
27
27
|
export { gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector } from "../hooks/features/dataSource/gridDataSourceSelector.js";
|
|
28
|
-
export { getGroupKeys } from "../hooks/features/dataSource/utils.js";
|
|
29
28
|
export type { GridExperimentalProFeatures, DataGridProPropsWithoutDefaultValue, DataGridProPropsWithDefaultValue } from "../models/dataGridProProps.js";
|
|
30
29
|
export type { GridProSlotProps } from "../models/gridProSlotProps.js";
|
|
31
30
|
export { createRowTree } from "../utils/tree/createRowTree.js";
|
package/internals/index.js
CHANGED
|
@@ -37,7 +37,6 @@ var _exportNames = {
|
|
|
37
37
|
useGridDataSourceBasePro: true,
|
|
38
38
|
gridDataSourceErrorSelector: true,
|
|
39
39
|
gridDataSourceLoadingIdSelector: true,
|
|
40
|
-
getGroupKeys: true,
|
|
41
40
|
createRowTree: true,
|
|
42
41
|
updateRowTree: true,
|
|
43
42
|
sortRowTree: true,
|
|
@@ -97,22 +96,16 @@ Object.defineProperty(exports, "detailPanelStateInitializer", {
|
|
|
97
96
|
return _useGridDetailPanel.detailPanelStateInitializer;
|
|
98
97
|
}
|
|
99
98
|
});
|
|
100
|
-
Object.defineProperty(exports, "getGroupKeys", {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
get: function () {
|
|
103
|
-
return _utils.getGroupKeys;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
99
|
Object.defineProperty(exports, "getParentPath", {
|
|
107
100
|
enumerable: true,
|
|
108
101
|
get: function () {
|
|
109
|
-
return
|
|
102
|
+
return _utils2.getParentPath;
|
|
110
103
|
}
|
|
111
104
|
});
|
|
112
105
|
Object.defineProperty(exports, "getVisibleRowsLookup", {
|
|
113
106
|
enumerable: true,
|
|
114
107
|
get: function () {
|
|
115
|
-
return
|
|
108
|
+
return _utils.getVisibleRowsLookup;
|
|
116
109
|
}
|
|
117
110
|
});
|
|
118
111
|
Object.defineProperty(exports, "gridDataSourceErrorSelector", {
|
|
@@ -130,13 +123,13 @@ Object.defineProperty(exports, "gridDataSourceLoadingIdSelector", {
|
|
|
130
123
|
Object.defineProperty(exports, "insertNodeInTree", {
|
|
131
124
|
enumerable: true,
|
|
132
125
|
get: function () {
|
|
133
|
-
return
|
|
126
|
+
return _utils.insertNodeInTree;
|
|
134
127
|
}
|
|
135
128
|
});
|
|
136
129
|
Object.defineProperty(exports, "removeNodeFromTree", {
|
|
137
130
|
enumerable: true,
|
|
138
131
|
get: function () {
|
|
139
|
-
return
|
|
132
|
+
return _utils.removeNodeFromTree;
|
|
140
133
|
}
|
|
141
134
|
});
|
|
142
135
|
Object.defineProperty(exports, "rowPinningStateInitializer", {
|
|
@@ -154,13 +147,13 @@ Object.defineProperty(exports, "rowReorderStateInitializer", {
|
|
|
154
147
|
Object.defineProperty(exports, "skipFiltering", {
|
|
155
148
|
enumerable: true,
|
|
156
149
|
get: function () {
|
|
157
|
-
return
|
|
150
|
+
return _utils2.skipFiltering;
|
|
158
151
|
}
|
|
159
152
|
});
|
|
160
153
|
Object.defineProperty(exports, "skipSorting", {
|
|
161
154
|
enumerable: true,
|
|
162
155
|
get: function () {
|
|
163
|
-
return
|
|
156
|
+
return _utils2.skipSorting;
|
|
164
157
|
}
|
|
165
158
|
});
|
|
166
159
|
Object.defineProperty(exports, "sortRowTree", {
|
|
@@ -338,12 +331,11 @@ var _useGridInfiniteLoadingIntersection = require("../hooks/features/serverSideL
|
|
|
338
331
|
var _useGridDataSourcePro = require("../hooks/features/dataSource/useGridDataSourcePro");
|
|
339
332
|
var _useGridDataSourceBasePro = require("../hooks/features/dataSource/useGridDataSourceBasePro");
|
|
340
333
|
var _gridDataSourceSelector = require("../hooks/features/dataSource/gridDataSourceSelector");
|
|
341
|
-
var _utils = require("../hooks/features/dataSource/utils");
|
|
342
334
|
var _createRowTree = require("../utils/tree/createRowTree");
|
|
343
335
|
var _updateRowTree = require("../utils/tree/updateRowTree");
|
|
344
336
|
var _sortRowTree = require("../utils/tree/sortRowTree");
|
|
345
|
-
var
|
|
346
|
-
var
|
|
337
|
+
var _utils = require("../utils/tree/utils");
|
|
338
|
+
var _utils2 = require("../hooks/features/serverSideTreeData/utils");
|
|
347
339
|
var _propValidation = require("./propValidation");
|
|
348
340
|
Object.keys(_propValidation).forEach(function (key) {
|
|
349
341
|
if (key === "default" || key === "__esModule") return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-pro",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Pro plan edition of the MUI X Data Grid components.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -34,13 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.28.4",
|
|
37
|
-
"@mui/utils": "^7.3.
|
|
38
|
-
"@types/format-util": "^1.0.4",
|
|
37
|
+
"@mui/utils": "^7.3.3",
|
|
39
38
|
"clsx": "^2.1.1",
|
|
40
39
|
"prop-types": "^15.8.1",
|
|
41
|
-
"@mui/x-data-grid": "8.
|
|
42
|
-
"@mui/x-
|
|
43
|
-
"@mui/x-
|
|
40
|
+
"@mui/x-data-grid": "8.14.1",
|
|
41
|
+
"@mui/x-license": "8.14.1",
|
|
42
|
+
"@mui/x-internals": "8.14.0"
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|
|
46
45
|
"@emotion/react": "^11.9.0",
|
|
@@ -9,6 +9,7 @@ interface CreateRowTreeParams {
|
|
|
9
9
|
isGroupExpandedByDefault?: DataGridProProps['isGroupExpandedByDefault'];
|
|
10
10
|
groupingName: string;
|
|
11
11
|
onDuplicatePath?: GridTreePathDuplicateHandler;
|
|
12
|
+
maxDepth?: number;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Transform a list of rows into a tree structure where each row references its parent and children.
|
|
@@ -30,7 +30,8 @@ const createRowTree = params => {
|
|
|
30
30
|
treeDepths,
|
|
31
31
|
isGroupExpandedByDefault: params.isGroupExpandedByDefault,
|
|
32
32
|
defaultGroupingExpansionDepth: params.defaultGroupingExpansionDepth,
|
|
33
|
-
groupsToFetch
|
|
33
|
+
groupsToFetch,
|
|
34
|
+
maxDepth: params.maxDepth
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
|
|
2
|
-
import { GridTreeDepths
|
|
2
|
+
import { GridTreeDepths } from '@mui/x-data-grid/internals';
|
|
3
3
|
import { GridTreePathDuplicateHandler, RowTreeBuilderGroupingCriterion } from "./models.js";
|
|
4
4
|
import { DataGridProProps } from "../../models/dataGridProProps.js";
|
|
5
5
|
interface InsertDataRowInTreeParams {
|
|
@@ -32,12 +32,6 @@ interface InsertDataRowInTreeParams {
|
|
|
32
32
|
* - `treeDepths[nodeDepth] = treeDepth[nodeDepth] + 1` => valid
|
|
33
33
|
*/
|
|
34
34
|
treeDepths: GridTreeDepths;
|
|
35
|
-
/**
|
|
36
|
-
* Object tracking the action performed on each group.
|
|
37
|
-
* Used to decide which groups to refresh on sorting, filtering, aggregation, ...
|
|
38
|
-
* If not defined, then the tracking will be skipped.
|
|
39
|
-
*/
|
|
40
|
-
updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
|
|
41
35
|
/**
|
|
42
36
|
* Callback fired when trying to insert a data row for a path already populated by another data row.
|
|
43
37
|
*/
|
|
@@ -46,6 +40,7 @@ interface InsertDataRowInTreeParams {
|
|
|
46
40
|
defaultGroupingExpansionDepth: number;
|
|
47
41
|
serverChildrenCount?: number;
|
|
48
42
|
groupsToFetch?: Set<GridRowId>;
|
|
43
|
+
maxDepth?: number;
|
|
49
44
|
}
|
|
50
45
|
/**
|
|
51
46
|
* Inserts a data row in a tree.
|
|
@@ -56,7 +51,6 @@ interface InsertDataRowInTreeParams {
|
|
|
56
51
|
export declare const insertDataRowInTree: ({
|
|
57
52
|
id,
|
|
58
53
|
path,
|
|
59
|
-
updatedGroupsManager,
|
|
60
54
|
previousTree,
|
|
61
55
|
tree,
|
|
62
56
|
treeDepths,
|
|
@@ -64,6 +58,7 @@ export declare const insertDataRowInTree: ({
|
|
|
64
58
|
isGroupExpandedByDefault,
|
|
65
59
|
defaultGroupingExpansionDepth,
|
|
66
60
|
serverChildrenCount,
|
|
67
|
-
groupsToFetch
|
|
61
|
+
groupsToFetch,
|
|
62
|
+
maxDepth
|
|
68
63
|
}: InsertDataRowInTreeParams) => void;
|
|
69
64
|
export {};
|
|
@@ -15,7 +15,6 @@ var _utils = require("./utils");
|
|
|
15
15
|
const insertDataRowInTree = ({
|
|
16
16
|
id,
|
|
17
17
|
path,
|
|
18
|
-
updatedGroupsManager,
|
|
19
18
|
previousTree,
|
|
20
19
|
tree,
|
|
21
20
|
treeDepths,
|
|
@@ -23,7 +22,8 @@ const insertDataRowInTree = ({
|
|
|
23
22
|
isGroupExpandedByDefault,
|
|
24
23
|
defaultGroupingExpansionDepth,
|
|
25
24
|
serverChildrenCount,
|
|
26
|
-
groupsToFetch
|
|
25
|
+
groupsToFetch,
|
|
26
|
+
maxDepth
|
|
27
27
|
}) => {
|
|
28
28
|
let parentNodeId = _xDataGrid.GRID_ROOT_GROUP_ID;
|
|
29
29
|
for (let depth = 0; depth < path.length; depth += 1) {
|
|
@@ -57,7 +57,7 @@ const insertDataRowInTree = ({
|
|
|
57
57
|
childrenExpanded: false,
|
|
58
58
|
serverChildrenCount
|
|
59
59
|
};
|
|
60
|
-
const shouldFetchChildren = (0, _utils.checkGroupChildrenExpansion)(node, defaultGroupingExpansionDepth,
|
|
60
|
+
const shouldFetchChildren = (0, _utils.checkGroupChildrenExpansion)(node, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault);
|
|
61
61
|
if (shouldFetchChildren) {
|
|
62
62
|
groupsToFetch?.add(id);
|
|
63
63
|
}
|
|
@@ -70,7 +70,6 @@ const insertDataRowInTree = ({
|
|
|
70
70
|
groupingKey: key
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
updatedGroupsManager?.addAction(parentNodeId, 'insertChildren');
|
|
74
73
|
(0, _utils.insertNodeInTree)(node, tree, treeDepths, previousTree);
|
|
75
74
|
} else {
|
|
76
75
|
const existingNodeWithPartialPath = tree[existingNodeIdWithPartialPath];
|
|
@@ -78,8 +77,6 @@ const insertDataRowInTree = ({
|
|
|
78
77
|
// If we already have an auto-generated group matching the partial path,
|
|
79
78
|
// We replace it with the node from of data row passed to `insertNodeInTree`
|
|
80
79
|
if (existingNodeWithPartialPath.type === 'group' && existingNodeWithPartialPath.isAutoGenerated) {
|
|
81
|
-
updatedGroupsManager?.addAction(parentNodeId, 'removeChildren');
|
|
82
|
-
updatedGroupsManager?.addAction(parentNodeId, 'insertChildren');
|
|
83
80
|
(0, _utils.updateGroupNodeIdAndAutoGenerated)({
|
|
84
81
|
tree,
|
|
85
82
|
previousTree,
|
|
@@ -116,8 +113,7 @@ const insertDataRowInTree = ({
|
|
|
116
113
|
childrenFromPath: {},
|
|
117
114
|
childrenExpanded: false
|
|
118
115
|
};
|
|
119
|
-
|
|
120
|
-
(0, _utils.insertNodeInTree)((0, _utils.updateGroupDefaultExpansion)(autoGeneratedGroupNode, defaultGroupingExpansionDepth, isGroupExpandedByDefault, previousTree?.[nodeId]?.childrenExpanded), tree, treeDepths, previousTree);
|
|
116
|
+
(0, _utils.insertNodeInTree)((0, _utils.updateGroupDefaultExpansion)(autoGeneratedGroupNode, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, previousTree?.[nodeId]?.childrenExpanded), tree, treeDepths, previousTree);
|
|
121
117
|
parentNodeId = nodeId;
|
|
122
118
|
}
|
|
123
119
|
// For the intermediary steps of the path
|
|
@@ -139,7 +135,7 @@ const insertDataRowInTree = ({
|
|
|
139
135
|
childrenFromPath: {},
|
|
140
136
|
childrenExpanded: false
|
|
141
137
|
};
|
|
142
|
-
tree[existingNodeIdWithPartialPath] = (0, _utils.updateGroupDefaultExpansion)(groupNode, defaultGroupingExpansionDepth, isGroupExpandedByDefault, previousTree?.[currentGroupNode.id]?.childrenExpanded);
|
|
138
|
+
tree[existingNodeIdWithPartialPath] = (0, _utils.updateGroupDefaultExpansion)(groupNode, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, previousTree?.[currentGroupNode.id]?.childrenExpanded);
|
|
143
139
|
}
|
|
144
140
|
parentNodeId = currentGroupNode.id;
|
|
145
141
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
|
|
2
|
-
import { GridTreeDepths
|
|
2
|
+
import { GridTreeDepths } from '@mui/x-data-grid/internals';
|
|
3
3
|
interface RemoveDataRowFromTreeParams {
|
|
4
4
|
/**
|
|
5
5
|
* ID of the data row to remove from the tree.
|
|
@@ -22,12 +22,6 @@ interface RemoveDataRowFromTreeParams {
|
|
|
22
22
|
* - `treeDepths[nodeDepth] = treeDepth[nodeDepth] + 1` => valid
|
|
23
23
|
*/
|
|
24
24
|
treeDepths: GridTreeDepths;
|
|
25
|
-
/**
|
|
26
|
-
* Object tracking the action performed on each group.
|
|
27
|
-
* Used to decide which groups to refresh on sorting, filtering, aggregation, ...
|
|
28
|
-
* If not defined, then the tracking will be skipped.
|
|
29
|
-
*/
|
|
30
|
-
updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
|
|
31
25
|
groupingName: string;
|
|
32
26
|
}
|
|
33
27
|
/**
|
|
@@ -41,7 +35,6 @@ export declare const removeDataRowFromTree: ({
|
|
|
41
35
|
id,
|
|
42
36
|
tree,
|
|
43
37
|
treeDepths,
|
|
44
|
-
updatedGroupsManager,
|
|
45
38
|
groupingName
|
|
46
39
|
}: RemoveDataRowFromTreeParams) => void;
|
|
47
40
|
export {};
|
|
@@ -29,8 +29,7 @@ const removeNode = ({
|
|
|
29
29
|
const removeNodeAndCleanParent = ({
|
|
30
30
|
node,
|
|
31
31
|
tree,
|
|
32
|
-
treeDepths
|
|
33
|
-
updatedGroupsManager
|
|
32
|
+
treeDepths
|
|
34
33
|
}) => {
|
|
35
34
|
removeNode({
|
|
36
35
|
node,
|
|
@@ -38,7 +37,6 @@ const removeNodeAndCleanParent = ({
|
|
|
38
37
|
treeDepths
|
|
39
38
|
});
|
|
40
39
|
const parentNode = tree[node.parent];
|
|
41
|
-
updatedGroupsManager?.addAction(parentNode.id, 'removeChildren');
|
|
42
40
|
const shouldDeleteGroup = parentNode.id !== _xDataGrid.GRID_ROOT_GROUP_ID && parentNode.children.length === 0;
|
|
43
41
|
if (shouldDeleteGroup) {
|
|
44
42
|
if (parentNode.isAutoGenerated) {
|
|
@@ -61,11 +59,8 @@ const removeNodeAndCleanParent = ({
|
|
|
61
59
|
const replaceDataGroupWithAutoGeneratedGroup = ({
|
|
62
60
|
node,
|
|
63
61
|
tree,
|
|
64
|
-
treeDepths
|
|
65
|
-
updatedGroupsManager
|
|
62
|
+
treeDepths
|
|
66
63
|
}) => {
|
|
67
|
-
updatedGroupsManager?.addAction(node.parent, 'removeChildren');
|
|
68
|
-
updatedGroupsManager?.addAction(node.parent, 'insertChildren');
|
|
69
64
|
(0, _utils.updateGroupNodeIdAndAutoGenerated)({
|
|
70
65
|
previousTree: null,
|
|
71
66
|
tree,
|
|
@@ -92,7 +87,6 @@ const removeDataRowFromTree = ({
|
|
|
92
87
|
id,
|
|
93
88
|
tree,
|
|
94
89
|
treeDepths,
|
|
95
|
-
updatedGroupsManager,
|
|
96
90
|
groupingName
|
|
97
91
|
}) => {
|
|
98
92
|
const node = tree[id];
|
|
@@ -100,15 +94,13 @@ const removeDataRowFromTree = ({
|
|
|
100
94
|
replaceDataGroupWithAutoGeneratedGroup({
|
|
101
95
|
node,
|
|
102
96
|
tree,
|
|
103
|
-
treeDepths
|
|
104
|
-
updatedGroupsManager
|
|
97
|
+
treeDepths
|
|
105
98
|
});
|
|
106
99
|
} else if (groupingName === _gridTreeDataUtils.TreeDataStrategy.Default || groupingName === _internals.RowGroupingStrategy.Default) {
|
|
107
100
|
removeNodeAndCleanParent({
|
|
108
101
|
node,
|
|
109
102
|
tree,
|
|
110
|
-
treeDepths
|
|
111
|
-
updatedGroupsManager
|
|
103
|
+
treeDepths
|
|
112
104
|
});
|
|
113
105
|
} else {
|
|
114
106
|
removeNode({
|
|
@@ -15,6 +15,7 @@ interface UpdateRowTreeParams {
|
|
|
15
15
|
groupingName: string;
|
|
16
16
|
onDuplicatePath?: GridTreePathDuplicateHandler;
|
|
17
17
|
previousGroupsToFetch?: GridRowId[];
|
|
18
|
+
maxDepth?: number;
|
|
18
19
|
}
|
|
19
20
|
export declare const updateRowTree: (params: UpdateRowTreeParams) => GridRowTreeCreationValue;
|
|
20
21
|
export {};
|
|
@@ -15,7 +15,6 @@ var _utils = require("./utils");
|
|
|
15
15
|
const updateRowTree = params => {
|
|
16
16
|
const tree = (0, _extends2.default)({}, params.previousTree);
|
|
17
17
|
const treeDepths = (0, _extends2.default)({}, params.previousTreeDepth);
|
|
18
|
-
const updatedGroupsManager = (0, _utils.createUpdatedGroupsManager)();
|
|
19
18
|
const groupsToFetch = params.previousGroupsToFetch ? new Set([...params.previousGroupsToFetch]) : new Set([]);
|
|
20
19
|
for (let i = 0; i < params.nodes.inserted.length; i += 1) {
|
|
21
20
|
const {
|
|
@@ -27,14 +26,14 @@ const updateRowTree = params => {
|
|
|
27
26
|
previousTree: params.previousTree,
|
|
28
27
|
tree,
|
|
29
28
|
treeDepths,
|
|
30
|
-
updatedGroupsManager,
|
|
31
29
|
id,
|
|
32
30
|
path,
|
|
33
31
|
serverChildrenCount,
|
|
34
32
|
onDuplicatePath: params.onDuplicatePath,
|
|
35
33
|
isGroupExpandedByDefault: params.isGroupExpandedByDefault,
|
|
36
34
|
defaultGroupingExpansionDepth: params.defaultGroupingExpansionDepth,
|
|
37
|
-
groupsToFetch
|
|
35
|
+
groupsToFetch,
|
|
36
|
+
maxDepth: params.maxDepth
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
for (let i = 0; i < params.nodes.removed.length; i += 1) {
|
|
@@ -42,7 +41,6 @@ const updateRowTree = params => {
|
|
|
42
41
|
(0, _removeDataRowFromTree.removeDataRowFromTree)({
|
|
43
42
|
tree,
|
|
44
43
|
treeDepths,
|
|
45
|
-
updatedGroupsManager,
|
|
46
44
|
id: nodeId,
|
|
47
45
|
groupingName: params.groupingName
|
|
48
46
|
});
|
|
@@ -62,7 +60,6 @@ const updateRowTree = params => {
|
|
|
62
60
|
(0, _removeDataRowFromTree.removeDataRowFromTree)({
|
|
63
61
|
tree,
|
|
64
62
|
treeDepths,
|
|
65
|
-
updatedGroupsManager,
|
|
66
63
|
id,
|
|
67
64
|
groupingName: params.groupingName
|
|
68
65
|
});
|
|
@@ -70,17 +67,15 @@ const updateRowTree = params => {
|
|
|
70
67
|
previousTree: params.previousTree,
|
|
71
68
|
tree,
|
|
72
69
|
treeDepths,
|
|
73
|
-
updatedGroupsManager,
|
|
74
70
|
id,
|
|
75
71
|
path,
|
|
76
72
|
serverChildrenCount,
|
|
77
73
|
onDuplicatePath: params.onDuplicatePath,
|
|
78
74
|
isGroupExpandedByDefault: params.isGroupExpandedByDefault,
|
|
79
75
|
defaultGroupingExpansionDepth: params.defaultGroupingExpansionDepth,
|
|
80
|
-
groupsToFetch
|
|
76
|
+
groupsToFetch,
|
|
77
|
+
maxDepth: params.maxDepth
|
|
81
78
|
});
|
|
82
|
-
} else {
|
|
83
|
-
updatedGroupsManager?.addAction(tree[id].parent, 'modifyChildren');
|
|
84
79
|
}
|
|
85
80
|
}
|
|
86
81
|
|
|
@@ -91,7 +86,6 @@ const updateRowTree = params => {
|
|
|
91
86
|
treeDepths,
|
|
92
87
|
groupingName: params.groupingName,
|
|
93
88
|
dataRowIds,
|
|
94
|
-
updatedGroupsManager,
|
|
95
89
|
groupsToFetch: Array.from(groupsToFetch)
|
|
96
90
|
};
|
|
97
91
|
};
|
package/utils/tree/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridFilterState, GridGroupNode, GridRowId, GridRowTreeConfig, GridRowsState, GridTreeNode } from '@mui/x-data-grid';
|
|
2
|
-
import { GridTreeDepths
|
|
2
|
+
import { GridTreeDepths } from '@mui/x-data-grid/internals';
|
|
3
3
|
import { RowTreeBuilderGroupingCriterion } from "./models.js";
|
|
4
4
|
import { DataGridProProps } from "../../models/dataGridProProps.js";
|
|
5
5
|
export declare const getGroupRowIdFromPath: (path: RowTreeBuilderGroupingCriterion[]) => string;
|
|
@@ -10,8 +10,8 @@ export declare const getNodePathInTree: ({
|
|
|
10
10
|
id: GridRowId;
|
|
11
11
|
tree: GridRowTreeConfig;
|
|
12
12
|
}) => RowTreeBuilderGroupingCriterion[];
|
|
13
|
-
export declare const checkGroupChildrenExpansion: (node: GridGroupNode, defaultGroupingExpansionDepth: number, isGroupExpandedByDefault?: DataGridProProps["isGroupExpandedByDefault"], prevChildrenExpanded?: boolean) => boolean;
|
|
14
|
-
export declare const updateGroupDefaultExpansion: (node: GridGroupNode, defaultGroupingExpansionDepth: number, isGroupExpandedByDefault?: DataGridProProps["isGroupExpandedByDefault"], prevChildrenExpanded?: boolean) => GridGroupNode;
|
|
13
|
+
export declare const checkGroupChildrenExpansion: (node: GridGroupNode, defaultGroupingExpansionDepth: number, maxDepth?: number, isGroupExpandedByDefault?: DataGridProProps["isGroupExpandedByDefault"], prevChildrenExpanded?: boolean) => boolean;
|
|
14
|
+
export declare const updateGroupDefaultExpansion: (node: GridGroupNode, defaultGroupingExpansionDepth: number, maxDepth?: number, isGroupExpandedByDefault?: DataGridProProps["isGroupExpandedByDefault"], prevChildrenExpanded?: boolean) => GridGroupNode;
|
|
15
15
|
/**
|
|
16
16
|
* Insert a node in the tree
|
|
17
17
|
*/
|
|
@@ -44,7 +44,6 @@ export declare const updateGroupNodeIdAndAutoGenerated: ({
|
|
|
44
44
|
tree: GridRowTreeConfig;
|
|
45
45
|
treeDepths: GridTreeDepths;
|
|
46
46
|
}) => void;
|
|
47
|
-
export declare const createUpdatedGroupsManager: () => GridRowTreeUpdatedGroupsManager;
|
|
48
47
|
export declare const getVisibleRowsLookup: ({
|
|
49
48
|
tree,
|
|
50
49
|
filteredRowsLookup
|
package/utils/tree/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.updateGroupNodeIdAndAutoGenerated = exports.updateGroupDefaultExpansion = exports.removeNodeFromTree = exports.insertNodeInTree = exports.getVisibleRowsLookup = exports.getNodePathInTree = exports.getGroupRowIdFromPath = exports.
|
|
7
|
+
exports.updateGroupNodeIdAndAutoGenerated = exports.updateGroupDefaultExpansion = exports.removeNodeFromTree = exports.insertNodeInTree = exports.getVisibleRowsLookup = exports.getNodePathInTree = exports.getGroupRowIdFromPath = exports.checkGroupChildrenExpansion = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
10
10
|
const getGroupRowIdFromPath = path => {
|
|
@@ -29,7 +29,10 @@ const getNodePathInTree = ({
|
|
|
29
29
|
return path;
|
|
30
30
|
};
|
|
31
31
|
exports.getNodePathInTree = getNodePathInTree;
|
|
32
|
-
const checkGroupChildrenExpansion = (node, defaultGroupingExpansionDepth, isGroupExpandedByDefault, prevChildrenExpanded) => {
|
|
32
|
+
const checkGroupChildrenExpansion = (node, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, prevChildrenExpanded) => {
|
|
33
|
+
if (maxDepth !== undefined && node.depth >= maxDepth) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
33
36
|
let childrenExpanded;
|
|
34
37
|
if (node.id === _xDataGrid.GRID_ROOT_GROUP_ID) {
|
|
35
38
|
childrenExpanded = true;
|
|
@@ -41,8 +44,8 @@ const checkGroupChildrenExpansion = (node, defaultGroupingExpansionDepth, isGrou
|
|
|
41
44
|
return childrenExpanded;
|
|
42
45
|
};
|
|
43
46
|
exports.checkGroupChildrenExpansion = checkGroupChildrenExpansion;
|
|
44
|
-
const updateGroupDefaultExpansion = (node, defaultGroupingExpansionDepth, isGroupExpandedByDefault, prevChildrenExpanded) => {
|
|
45
|
-
const childrenExpanded = checkGroupChildrenExpansion(node, defaultGroupingExpansionDepth, isGroupExpandedByDefault, prevChildrenExpanded);
|
|
47
|
+
const updateGroupDefaultExpansion = (node, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, prevChildrenExpanded) => {
|
|
48
|
+
const childrenExpanded = checkGroupChildrenExpansion(node, defaultGroupingExpansionDepth, maxDepth, isGroupExpandedByDefault, prevChildrenExpanded);
|
|
46
49
|
node.childrenExpanded = childrenExpanded;
|
|
47
50
|
return node;
|
|
48
51
|
};
|
|
@@ -162,16 +165,6 @@ const updateGroupNodeIdAndAutoGenerated = ({
|
|
|
162
165
|
insertNodeInTree(groupNode, tree, treeDepths, previousTree);
|
|
163
166
|
};
|
|
164
167
|
exports.updateGroupNodeIdAndAutoGenerated = updateGroupNodeIdAndAutoGenerated;
|
|
165
|
-
const createUpdatedGroupsManager = () => ({
|
|
166
|
-
value: {},
|
|
167
|
-
addAction(groupId, action) {
|
|
168
|
-
if (!this.value[groupId]) {
|
|
169
|
-
this.value[groupId] = {};
|
|
170
|
-
}
|
|
171
|
-
this.value[groupId][action] = true;
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
exports.createUpdatedGroupsManager = createUpdatedGroupsManager;
|
|
175
168
|
const getVisibleRowsLookup = ({
|
|
176
169
|
tree,
|
|
177
170
|
filteredRowsLookup
|