@mui/x-data-grid-pro 8.9.0 → 8.9.2
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 +124 -0
- package/DataGridPro/DataGridPro.js +8 -3
- package/DataGridPro/useDataGridProComponent.js +1 -0
- package/components/GridColumnHeaders.js +1 -1
- package/components/GridDataSourceTreeDataGroupingCell.js +3 -1
- package/components/GridDetailPanels.js +4 -9
- package/components/GridPinnedRows.js +5 -2
- package/esm/DataGridPro/DataGridPro.js +10 -5
- package/esm/DataGridPro/useDataGridProComponent.js +2 -1
- package/esm/components/GridColumnHeaders.js +2 -2
- package/esm/components/GridDataSourceTreeDataGroupingCell.js +3 -1
- package/esm/components/GridDetailPanels.js +4 -9
- package/esm/components/GridPinnedRows.js +6 -3
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/esm/hooks/features/dataSource/models.d.ts +6 -0
- package/esm/hooks/features/dataSource/useGridDataSourceBasePro.d.ts +1 -0
- package/esm/hooks/features/dataSource/useGridDataSourceBasePro.js +26 -1
- package/esm/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +1 -0
- package/esm/hooks/features/rowReorder/gridRowReorderColDef.js +3 -2
- package/esm/hooks/features/rows/useGridRowAriaAttributes.d.ts +1 -1
- package/esm/hooks/features/rows/useGridRowAriaAttributes.js +2 -2
- package/esm/hooks/utils/useGridAriaAttributes.d.ts +1 -1
- package/esm/hooks/utils/useGridAriaAttributes.js +1 -1
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +7 -6
- package/esm/internals/index.js +9 -8
- package/esm/utils/tree/removeDataRowFromTree.d.ts +3 -1
- package/esm/utils/tree/removeDataRowFromTree.js +25 -5
- package/esm/utils/tree/updateRowTree.js +4 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -3
- package/hooks/features/dataSource/models.d.ts +6 -0
- package/hooks/features/dataSource/useGridDataSourceBasePro.d.ts +1 -0
- package/hooks/features/dataSource/useGridDataSourceBasePro.js +26 -1
- package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +1 -0
- package/hooks/features/rowReorder/gridRowReorderColDef.js +2 -1
- package/hooks/features/rows/useGridRowAriaAttributes.d.ts +1 -1
- package/hooks/features/rows/useGridRowAriaAttributes.js +4 -4
- package/hooks/utils/useGridAriaAttributes.d.ts +1 -1
- package/hooks/utils/useGridAriaAttributes.js +3 -3
- package/index.js +1 -1
- package/internals/index.d.ts +7 -6
- package/internals/index.js +20 -10
- package/package.json +6 -7
- package/utils/tree/removeDataRowFromTree.d.ts +3 -1
- package/utils/tree/removeDataRowFromTree.js +25 -5
- package/utils/tree/updateRowTree.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,130 @@
|
|
|
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.9.2
|
|
9
|
+
|
|
10
|
+
_Jul 31, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 23 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🌎 Improve French (fr-FR), Hebrew (he-IL) and Polish (pl-PL) locales on the Data Grid
|
|
15
|
+
- 🌎 Improve Korean (ko-KR) locale on the Date and Time Pickers
|
|
16
|
+
- 📈 Add symlog scale to charts
|
|
17
|
+
- 📊 Fix bar border radius on Firefox
|
|
18
|
+
- 🐞 Bugfixes
|
|
19
|
+
- 📚 Documentation improvements
|
|
20
|
+
|
|
21
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
22
|
+
@AmrElnaggar99, @atlanteh, @ddolcimascolo, @Jiseoup, @leonaha5, @noherczeg, @sai6855
|
|
23
|
+
|
|
24
|
+
The following are all team members who have contributed to this release:
|
|
25
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @bharatkashyap, @brijeshb42, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @KenanYusuf, @LukasTy, @mapache-salvaje, @MBilalShafi, @rita-codes, @romgrk, @siriwatknp
|
|
26
|
+
|
|
27
|
+
### Data Grid
|
|
28
|
+
|
|
29
|
+
#### `@mui/x-data-grid@8.9.2`
|
|
30
|
+
|
|
31
|
+
- [DataGrid] Add debounce for columns panel search (#18719) @noherczeg
|
|
32
|
+
- [DataGrid] Extract virtualization engine (#18275) @romgrk
|
|
33
|
+
- [DataGrid] Improve types in `<GridEditSingleSelect />` (#18184) @sai6855
|
|
34
|
+
- [l10n] Improve French (fr-FR) locale (#18905) @ddolcimascolo
|
|
35
|
+
- [l10n] Improve Hebrew (he-IL) locale (#18665) @atlanteh
|
|
36
|
+
- [l10n] Improve Polish (pl-PL) locale (#18068) @leonaha5
|
|
37
|
+
|
|
38
|
+
#### `@mui/x-data-grid-pro@8.9.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
39
|
+
|
|
40
|
+
Same changes as in `@mui/x-data-grid@8.9.2`, plus:
|
|
41
|
+
|
|
42
|
+
- [DataGridPro] Fix duplicate nested rows for dynamically updated row IDs (#18526) @MBilalShafi
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid-premium@8.9.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
45
|
+
|
|
46
|
+
Same changes as in `@mui/x-data-grid-pro@8.9.2`, plus:
|
|
47
|
+
|
|
48
|
+
- [DataGridPremium] Add `privateMode` to AI assistant prompt resolver (#18759) @bharatkashyap
|
|
49
|
+
- [DataGridPremium] Fix empty nested group values caused by main criterial `valueFormatter()` (#18916) @cherniavskii
|
|
50
|
+
- [DataGridPremium] Sidebar content and state is managed the same way as for preference panel (#18741) @arminmeh
|
|
51
|
+
- [DataGridPremium] Make `api` param for the aggregation function optional (#18984) @arminmeh
|
|
52
|
+
|
|
53
|
+
### Date and Time Pickers
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-date-pickers@8.9.2`
|
|
56
|
+
|
|
57
|
+
- [l10n] Improve Korean (ko-KR) locale (#18664) @Jiseoup
|
|
58
|
+
- [pickers] Fix popper click-away behavior (#18804) @LukasTy
|
|
59
|
+
- [pickers] Fix usage not in main document (#18944) @LukasTy
|
|
60
|
+
|
|
61
|
+
#### `@mui/x-date-pickers-pro@8.9.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
62
|
+
|
|
63
|
+
Same changes as in `@mui/x-date-pickers@8.9.2`.
|
|
64
|
+
|
|
65
|
+
### Charts
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-charts@8.9.2`
|
|
68
|
+
|
|
69
|
+
- [charts] Add symlog scale to charts (#18729) @bernardobelchior
|
|
70
|
+
- [charts] Fix bar border radius on Firefox (#18824) @bernardobelchior
|
|
71
|
+
- [charts] Fix crash when rendering large scatter dataset (#18845) @bernardobelchior
|
|
72
|
+
- [charts] Remove unnecessary type assertion in tooltip `valueFormatter()` (#18877) @sai6855
|
|
73
|
+
- [charts] Export `ChartsWrapper` from `'./ChartsWrapper'` rather than `'./internals'` (#18966) @JCQuintas
|
|
74
|
+
|
|
75
|
+
#### `@mui/x-charts-pro@8.9.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
76
|
+
|
|
77
|
+
Same changes as in `@mui/x-charts@8.9.2`, plus:
|
|
78
|
+
|
|
79
|
+
- [charts-pro] Fix voronoi interaction with zoom (#18950) @alexfauquette
|
|
80
|
+
- [charts-pro] Hide toolbar by default when exporting (#18764) @bernardobelchior
|
|
81
|
+
|
|
82
|
+
### Codemod
|
|
83
|
+
|
|
84
|
+
#### `@mui/x-codemod@8.9.2`
|
|
85
|
+
|
|
86
|
+
Internal changes.
|
|
87
|
+
|
|
88
|
+
### Docs
|
|
89
|
+
|
|
90
|
+
- [docs] Add Data Grid demo pages (#18180) @KenanYusuf
|
|
91
|
+
- [docs] Copyedit the Charts Overview page (#18840) @mapache-salvaje
|
|
92
|
+
- [docs] Fix incorrect parameter name in pickers "Custom components" page from `variant` to `pickerVariant` (#18919) @AmrElnaggar99
|
|
93
|
+
|
|
94
|
+
### Miscellaneous
|
|
95
|
+
|
|
96
|
+
- [code-infra] Auto-generate deep exports to prevent asymmetric exports (#18917) @JCQuintas
|
|
97
|
+
- [docs-infra] Turn on "Edit in Chat" for X docs (#18869) @siriwatknp
|
|
98
|
+
- [infra] Add specific bundle size tracking (#18884) @Janpot
|
|
99
|
+
- [infra] Fix markdown formatting in llms generation (#18914) @Janpot
|
|
100
|
+
- [infra] Use CI action from mui-public (#18709) @brijeshb42
|
|
101
|
+
|
|
102
|
+
## 8.9.1
|
|
103
|
+
|
|
104
|
+
_Jul 21, 2025_
|
|
105
|
+
|
|
106
|
+
We'd like to extend a big thank you to the 2 contributors who made this release possible. Here are some highlights ✨:
|
|
107
|
+
|
|
108
|
+
🐞 Fix package publish issue
|
|
109
|
+
|
|
110
|
+
The following are all team members who have contributed to this release:
|
|
111
|
+
@KenanYusuf, @MBilalShafi
|
|
112
|
+
|
|
113
|
+
### Data Grid
|
|
114
|
+
|
|
115
|
+
#### `@mui/x-data-grid@8.9.1`
|
|
116
|
+
|
|
117
|
+
- [DataGrid] Move conditional list view column logic into `gridVisibleColumnDefinitionsSelector` (#18724) @KenanYusuf
|
|
118
|
+
- [DataGrid] Fix row selection "exclude" model inconsistency (#18844) @MBilalShafi
|
|
119
|
+
|
|
120
|
+
#### `@mui/x-data-grid-pro@8.9.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
121
|
+
|
|
122
|
+
Same changes as in `@mui/x-data-grid@8.9.1`.
|
|
123
|
+
|
|
124
|
+
#### `@mui/x-data-grid-premium@8.9.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
125
|
+
|
|
126
|
+
Same changes as in `@mui/x-data-grid-pro@8.9.1`.
|
|
127
|
+
|
|
128
|
+
### Core
|
|
129
|
+
|
|
130
|
+
- [core] Follow yml syntax convention @oliviertassinari
|
|
131
|
+
|
|
8
132
|
## 8.9.0
|
|
9
133
|
|
|
10
134
|
_Jul 17, 2025_
|
|
@@ -24,12 +24,12 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
24
24
|
const configuration = {
|
|
25
25
|
hooks: {
|
|
26
26
|
useCSSVariables: _material.useMaterialCSSVariables,
|
|
27
|
-
useGridAriaAttributes: _useGridAriaAttributes.
|
|
28
|
-
useGridRowAriaAttributes: _useGridRowAriaAttributes.
|
|
27
|
+
useGridAriaAttributes: _useGridAriaAttributes.useGridAriaAttributesPro,
|
|
28
|
+
useGridRowAriaAttributes: _useGridRowAriaAttributes.useGridRowAriaAttributesPro,
|
|
29
29
|
useCellAggregationResult: () => null
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
const releaseInfo = "
|
|
32
|
+
const releaseInfo = "MTc1MzkxMjgwMDAwMA==";
|
|
33
33
|
const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
|
|
34
34
|
packageName: "x-data-grid-pro",
|
|
35
35
|
releaseInfo: releaseInfo
|
|
@@ -146,6 +146,11 @@ DataGridProRaw.propTypes = {
|
|
|
146
146
|
* @default 150
|
|
147
147
|
*/
|
|
148
148
|
columnBufferPx: _propTypes.default.number,
|
|
149
|
+
/**
|
|
150
|
+
* The milliseconds delay to wait after a keystroke before triggering filtering in the columns menu.
|
|
151
|
+
* @default 150
|
|
152
|
+
*/
|
|
153
|
+
columnFilterDebounceMs: _propTypes.default.number,
|
|
149
154
|
/**
|
|
150
155
|
* Sets the height in pixels of the column group headers in the Data Grid.
|
|
151
156
|
* Inherits the `columnHeaderHeight` value if not set.
|
|
@@ -78,6 +78,7 @@ const useDataGridProComponent = (apiRef, props) => {
|
|
|
78
78
|
(0, _internals.useGridInitializeState)(_internals.dimensionsStateInitializer, apiRef, props);
|
|
79
79
|
(0, _internals.useGridInitializeState)(_internals.rowsMetaStateInitializer, apiRef, props);
|
|
80
80
|
(0, _internals.useGridInitializeState)(_internals.listViewStateInitializer, apiRef, props);
|
|
81
|
+
(0, _internals.useGridVirtualizer)(apiRef, props);
|
|
81
82
|
(0, _internals.useGridHeaderFiltering)(apiRef, props);
|
|
82
83
|
(0, _useGridTreeData.useGridTreeData)(apiRef, props);
|
|
83
84
|
(0, _internals.useGridKeyboardNavigation)(apiRef, props);
|
|
@@ -42,7 +42,7 @@ const GridColumnHeaders = exports.GridColumnHeaders = (0, _forwardRef.forwardRef
|
|
|
42
42
|
getColumnHeadersRow,
|
|
43
43
|
getColumnFiltersRow,
|
|
44
44
|
getColumnGroupHeadersRows
|
|
45
|
-
} = (0, _useGridColumnHeaders.
|
|
45
|
+
} = (0, _useGridColumnHeaders.useGridColumnHeadersPro)({
|
|
46
46
|
visibleColumns,
|
|
47
47
|
sortColumnLookup,
|
|
48
48
|
filterColumnLookup,
|
|
@@ -43,7 +43,9 @@ function GridTreeDataGroupingCellIcon(props) {
|
|
|
43
43
|
// always fetch/get from cache the children when the node is expanded
|
|
44
44
|
apiRef.current.dataSource.fetchRows(id);
|
|
45
45
|
} else {
|
|
46
|
-
|
|
46
|
+
// Collapse the node and remove child rows from the grid
|
|
47
|
+
apiRef.current.setRowChildrenExpansion(id, false);
|
|
48
|
+
apiRef.current.removeChildrenRows(id);
|
|
47
49
|
}
|
|
48
50
|
apiRef.current.setCellFocus(id, field);
|
|
49
51
|
event.stopPropagation(); // TODO remove event.stopPropagation
|
|
@@ -10,7 +10,6 @@ exports.GridDetailPanels = GridDetailPanels;
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
12
12
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
13
|
-
var _internals = require("@mui/x-data-grid/internals");
|
|
14
13
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
15
14
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
16
15
|
var _detailPanel = require("../hooks/features/detailPanel");
|
|
@@ -60,15 +59,11 @@ function GridDetailPanelsImpl({
|
|
|
60
59
|
}, `panel-${rowId}`);
|
|
61
60
|
}, [apiRef, classes.detailPanel, detailPanelsHeights, detailPanelsContent]);
|
|
62
61
|
React.useEffect(() => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const map = new Map();
|
|
67
|
-
for (const rowId of expandedRowIds) {
|
|
68
|
-
map.set(rowId, getDetailPanel(rowId));
|
|
69
|
-
}
|
|
70
|
-
setPanels(map);
|
|
62
|
+
const map = new Map();
|
|
63
|
+
for (const rowId of expandedRowIds) {
|
|
64
|
+
map.set(rowId, getDetailPanel(rowId));
|
|
71
65
|
}
|
|
66
|
+
setPanels(map);
|
|
72
67
|
}, [expandedRowIds, setPanels, getDetailPanel]);
|
|
73
68
|
return null;
|
|
74
69
|
}
|
|
@@ -26,6 +26,9 @@ function GridPinnedRows({
|
|
|
26
26
|
const apiRef = (0, _internals.useGridPrivateApiContext)();
|
|
27
27
|
const pinnedRowsData = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridPinnedRowsSelector);
|
|
28
28
|
const rows = pinnedRowsData[position];
|
|
29
|
+
const {
|
|
30
|
+
getRows
|
|
31
|
+
} = virtualScroller;
|
|
29
32
|
const pinnedRenderContext = React.useMemo(() => ({
|
|
30
33
|
firstRowIndex: 0,
|
|
31
34
|
lastRowIndex: rows.length,
|
|
@@ -35,11 +38,11 @@ function GridPinnedRows({
|
|
|
35
38
|
if (rows.length === 0) {
|
|
36
39
|
return null;
|
|
37
40
|
}
|
|
38
|
-
const pinnedRows =
|
|
41
|
+
const pinnedRows = getRows({
|
|
39
42
|
position,
|
|
40
43
|
rows,
|
|
41
44
|
renderContext: pinnedRenderContext
|
|
42
|
-
});
|
|
45
|
+
}, (0, _xDataGrid.gridRowTreeSelector)(apiRef));
|
|
43
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
44
47
|
className: (0, _clsx.default)(classes.root, _xDataGrid.gridClasses[`pinnedRows--${position}`]),
|
|
45
48
|
role: "presentation",
|
|
@@ -11,18 +11,18 @@ import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
|
11
11
|
import { useDataGridProComponent } from "./useDataGridProComponent.js";
|
|
12
12
|
import { useDataGridProProps } from "./useDataGridProProps.js";
|
|
13
13
|
import { propValidatorsDataGridPro } from "../internals/propValidation.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { useGridAriaAttributesPro } from "../hooks/utils/useGridAriaAttributes.js";
|
|
15
|
+
import { useGridRowAriaAttributesPro } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
const configuration = {
|
|
18
18
|
hooks: {
|
|
19
19
|
useCSSVariables: useMaterialCSSVariables,
|
|
20
|
-
useGridAriaAttributes,
|
|
21
|
-
useGridRowAriaAttributes,
|
|
20
|
+
useGridAriaAttributes: useGridAriaAttributesPro,
|
|
21
|
+
useGridRowAriaAttributes: useGridRowAriaAttributesPro,
|
|
22
22
|
useCellAggregationResult: () => null
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const releaseInfo = "
|
|
25
|
+
const releaseInfo = "MTc1MzkxMjgwMDAwMA==";
|
|
26
26
|
const watermark = /*#__PURE__*/_jsx(Watermark, {
|
|
27
27
|
packageName: "x-data-grid-pro",
|
|
28
28
|
releaseInfo: releaseInfo
|
|
@@ -139,6 +139,11 @@ DataGridProRaw.propTypes = {
|
|
|
139
139
|
* @default 150
|
|
140
140
|
*/
|
|
141
141
|
columnBufferPx: PropTypes.number,
|
|
142
|
+
/**
|
|
143
|
+
* The milliseconds delay to wait after a keystroke before triggering filtering in the columns menu.
|
|
144
|
+
* @default 150
|
|
145
|
+
*/
|
|
146
|
+
columnFilterDebounceMs: PropTypes.number,
|
|
142
147
|
/**
|
|
143
148
|
* Sets the height in pixels of the column group headers in the Data Grid.
|
|
144
149
|
* Inherits the `columnHeaderHeight` value if not set.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridColumnResize, columnResizeStateInitializer, useGridRowSpanning, rowSpanningStateInitializer, useGridListView, listViewStateInitializer, propsStateInitializer } from '@mui/x-data-grid/internals';
|
|
4
|
+
import { useGridInitialization, useGridInitializeState, useGridVirtualizer, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridColumnResize, columnResizeStateInitializer, useGridRowSpanning, rowSpanningStateInitializer, useGridListView, listViewStateInitializer, propsStateInitializer } from '@mui/x-data-grid/internals';
|
|
5
5
|
// Pro-only features
|
|
6
6
|
import { useGridInfiniteLoader } from "../hooks/features/infiniteLoader/useGridInfiniteLoader.js";
|
|
7
7
|
import { useGridColumnReorder, columnReorderStateInitializer } from "../hooks/features/columnReorder/useGridColumnReorder.js";
|
|
@@ -71,6 +71,7 @@ export const useDataGridProComponent = (apiRef, props) => {
|
|
|
71
71
|
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
|
|
72
72
|
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
73
73
|
useGridInitializeState(listViewStateInitializer, apiRef, props);
|
|
74
|
+
useGridVirtualizer(apiRef, props);
|
|
74
75
|
useGridHeaderFiltering(apiRef, props);
|
|
75
76
|
useGridTreeData(apiRef, props);
|
|
76
77
|
useGridKeyboardNavigation(apiRef, props);
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
7
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
8
|
import { vars, GridBaseColumnHeaders } from '@mui/x-data-grid/internals';
|
|
9
|
-
import {
|
|
9
|
+
import { useGridColumnHeadersPro } from "../hooks/features/columnHeaders/useGridColumnHeaders.js";
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
const Filler = styled('div')({
|
|
12
12
|
flex: 1,
|
|
@@ -34,7 +34,7 @@ const GridColumnHeaders = forwardRef(function GridColumnHeaders(props, ref) {
|
|
|
34
34
|
getColumnHeadersRow,
|
|
35
35
|
getColumnFiltersRow,
|
|
36
36
|
getColumnGroupHeadersRows
|
|
37
|
-
} =
|
|
37
|
+
} = useGridColumnHeadersPro({
|
|
38
38
|
visibleColumns,
|
|
39
39
|
sortColumnLookup,
|
|
40
40
|
filterColumnLookup,
|
|
@@ -35,7 +35,9 @@ function GridTreeDataGroupingCellIcon(props) {
|
|
|
35
35
|
// always fetch/get from cache the children when the node is expanded
|
|
36
36
|
apiRef.current.dataSource.fetchRows(id);
|
|
37
37
|
} else {
|
|
38
|
-
|
|
38
|
+
// Collapse the node and remove child rows from the grid
|
|
39
|
+
apiRef.current.setRowChildrenExpansion(id, false);
|
|
40
|
+
apiRef.current.removeChildrenRows(id);
|
|
39
41
|
}
|
|
40
42
|
apiRef.current.setCellFocus(id, field);
|
|
41
43
|
event.stopPropagation(); // TODO remove event.stopPropagation
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
5
5
|
import { getDataGridUtilityClass, useGridSelector } from '@mui/x-data-grid';
|
|
6
|
-
import { EMPTY_DETAIL_PANELS } from '@mui/x-data-grid/internals';
|
|
7
6
|
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
8
7
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
9
8
|
import { gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowIdsSelector } from "../hooks/features/detailPanel/index.js";
|
|
@@ -53,15 +52,11 @@ function GridDetailPanelsImpl({
|
|
|
53
52
|
}, `panel-${rowId}`);
|
|
54
53
|
}, [apiRef, classes.detailPanel, detailPanelsHeights, detailPanelsContent]);
|
|
55
54
|
React.useEffect(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const map = new Map();
|
|
60
|
-
for (const rowId of expandedRowIds) {
|
|
61
|
-
map.set(rowId, getDetailPanel(rowId));
|
|
62
|
-
}
|
|
63
|
-
setPanels(map);
|
|
55
|
+
const map = new Map();
|
|
56
|
+
for (const rowId of expandedRowIds) {
|
|
57
|
+
map.set(rowId, getDetailPanel(rowId));
|
|
64
58
|
}
|
|
59
|
+
setPanels(map);
|
|
65
60
|
}, [expandedRowIds, setPanels, getDetailPanel]);
|
|
66
61
|
return null;
|
|
67
62
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import composeClasses from '@mui/utils/composeClasses';
|
|
4
|
-
import { getDataGridUtilityClass, gridClasses, useGridSelector } from '@mui/x-data-grid';
|
|
4
|
+
import { getDataGridUtilityClass, gridClasses, gridRowTreeSelector, useGridSelector } from '@mui/x-data-grid';
|
|
5
5
|
import { gridPinnedRowsSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
const useUtilityClasses = () => {
|
|
@@ -18,6 +18,9 @@ export function GridPinnedRows({
|
|
|
18
18
|
const apiRef = useGridPrivateApiContext();
|
|
19
19
|
const pinnedRowsData = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
20
20
|
const rows = pinnedRowsData[position];
|
|
21
|
+
const {
|
|
22
|
+
getRows
|
|
23
|
+
} = virtualScroller;
|
|
21
24
|
const pinnedRenderContext = React.useMemo(() => ({
|
|
22
25
|
firstRowIndex: 0,
|
|
23
26
|
lastRowIndex: rows.length,
|
|
@@ -27,11 +30,11 @@ export function GridPinnedRows({
|
|
|
27
30
|
if (rows.length === 0) {
|
|
28
31
|
return null;
|
|
29
32
|
}
|
|
30
|
-
const pinnedRows =
|
|
33
|
+
const pinnedRows = getRows({
|
|
31
34
|
position,
|
|
32
35
|
rows,
|
|
33
36
|
renderContext: pinnedRenderContext
|
|
34
|
-
});
|
|
37
|
+
}, gridRowTreeSelector(apiRef));
|
|
35
38
|
return /*#__PURE__*/_jsx("div", {
|
|
36
39
|
className: clsx(classes.root, gridClasses[`pinnedRows--${position}`]),
|
|
37
40
|
role: "presentation",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { UseGridColumnHeadersProps, GetHeadersParams } from '@mui/x-data-grid/internals';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const useGridColumnHeadersPro: (props: UseGridColumnHeadersProps) => {
|
|
4
4
|
getColumnFiltersRow: () => React.JSX.Element | null;
|
|
5
5
|
getFillers: (params: GetHeadersParams | undefined, children: React.ReactNode, leftOverflow: number, borderBottom?: boolean) => React.JSX.Element;
|
|
6
6
|
getColumnHeadersRow: () => React.JSX.Element;
|
|
@@ -19,7 +19,7 @@ const useUtilityClasses = ownerState => {
|
|
|
19
19
|
}, [classes]);
|
|
20
20
|
};
|
|
21
21
|
const filterItemsCache = Object.create(null);
|
|
22
|
-
export const
|
|
22
|
+
export const useGridColumnHeadersPro = props => {
|
|
23
23
|
const apiRef = useGridPrivateApiContext();
|
|
24
24
|
const {
|
|
25
25
|
headerGroupingMaxDepth,
|
|
@@ -72,4 +72,10 @@ export interface GridDataSourcePrivateApiPro {
|
|
|
72
72
|
* Resets the data source state.
|
|
73
73
|
*/
|
|
74
74
|
resetDataSourceState: () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Removes the children rows of a parent from the grid.
|
|
77
|
+
* This is used when collapsing a parent row to ensure dynamic data updates work properly.
|
|
78
|
+
* @param {GridRowId} parentId The id of the parent node.
|
|
79
|
+
*/
|
|
80
|
+
removeChildrenRows: (parentId: GridRowId) => void;
|
|
75
81
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
+
import { GridRowId } from '@mui/x-data-grid';
|
|
2
3
|
import { CacheChunkManager, DataSourceRowsUpdateStrategy, GridDataSourceBaseOptions } from '@mui/x-data-grid/internals';
|
|
3
4
|
import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
|
|
4
5
|
import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
|
|
@@ -181,6 +181,30 @@ export const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
|
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
183
|
}, [apiRef]);
|
|
184
|
+
const removeChildrenRows = React.useCallback(parentId => {
|
|
185
|
+
const rowNode = gridRowNodeSelector(apiRef, parentId);
|
|
186
|
+
if (!rowNode || rowNode.type !== 'group' || rowNode.children.length === 0) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const removedRows = [];
|
|
190
|
+
const traverse = nodeId => {
|
|
191
|
+
const node = gridRowNodeSelector(apiRef, nodeId);
|
|
192
|
+
if (!node) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (node.type === 'group' && node.children.length > 0) {
|
|
196
|
+
node.children.forEach(traverse);
|
|
197
|
+
}
|
|
198
|
+
removedRows.push({
|
|
199
|
+
id: nodeId,
|
|
200
|
+
_action: 'delete'
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
rowNode.children.forEach(traverse);
|
|
204
|
+
if (removedRows.length > 0) {
|
|
205
|
+
apiRef.current.updateNestedRows(removedRows, rowNode.path);
|
|
206
|
+
}
|
|
207
|
+
}, [apiRef]);
|
|
184
208
|
const dataSourceApi = {
|
|
185
209
|
dataSource: _extends({}, api.public.dataSource, {
|
|
186
210
|
setChildrenLoading,
|
|
@@ -189,7 +213,8 @@ export const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
|
|
|
189
213
|
};
|
|
190
214
|
const dataSourcePrivateApi = {
|
|
191
215
|
fetchRowChildren,
|
|
192
|
-
resetDataSourceState
|
|
216
|
+
resetDataSourceState,
|
|
217
|
+
removeChildrenRows
|
|
193
218
|
};
|
|
194
219
|
React.useEffect(() => {
|
|
195
220
|
if (groupsToAutoFetch && groupsToAutoFetch.length && scheduledGroups.current < groupsToAutoFetch.length) {
|
|
@@ -25,6 +25,7 @@ export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF
|
|
|
25
25
|
const expandedRowIds = gridDetailPanelExpandedRowIdsSelector(apiRef);
|
|
26
26
|
return expandedRowIds.has(rowId);
|
|
27
27
|
},
|
|
28
|
+
rowSpanValueGetter: (_, row, __, apiRef) => gridRowIdSelector(apiRef, row),
|
|
28
29
|
renderCell: params => /*#__PURE__*/_jsx(GridDetailPanelToggleCell, _extends({}, params)),
|
|
29
30
|
renderHeader: ({
|
|
30
31
|
colDef
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
2
|
+
import { gridRowIdSelector, GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
3
3
|
import { renderRowReorderCell } from "../../../components/GridRowReorderCell.js";
|
|
4
4
|
export const GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
5
5
|
type: 'custom',
|
|
@@ -16,5 +16,6 @@ export const GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
aggregable: false,
|
|
18
18
|
renderHeader: () => ' ',
|
|
19
|
-
renderCell: renderRowReorderCell
|
|
19
|
+
renderCell: renderRowReorderCell,
|
|
20
|
+
rowSpanValueGetter: (_, row, __, apiRef) => gridRowIdSelector(apiRef, row)
|
|
20
21
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridTreeNode } from '@mui/x-data-grid';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const useGridRowAriaAttributesPro: (addTreeDataAttributes?: boolean) => (rowNode: GridTreeNode, index: number) => React.HTMLAttributes<HTMLElement>;
|
|
@@ -3,7 +3,7 @@ import { useGridSelector, gridFilteredTopLevelRowCountSelector, GRID_ROOT_GROUP_
|
|
|
3
3
|
import { useGridRowAriaAttributes as useGridRowAriaAttributesCommunity, gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector } from '@mui/x-data-grid/internals';
|
|
4
4
|
import { useGridPrivateApiContext } from "../../utils/useGridPrivateApiContext.js";
|
|
5
5
|
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
6
|
-
export const
|
|
6
|
+
export const useGridRowAriaAttributesPro = addTreeDataAttributes => {
|
|
7
7
|
const apiRef = useGridPrivateApiContext();
|
|
8
8
|
const props = useGridRootProps();
|
|
9
9
|
const getRowAriaAttributesCommunity = useGridRowAriaAttributesCommunity();
|
|
@@ -12,7 +12,7 @@ export const useGridRowAriaAttributes = addTreeDataAttributes => {
|
|
|
12
12
|
const sortedVisibleRowPositionsLookup = useGridSelector(apiRef, gridExpandedSortedRowTreeLevelPositionLookupSelector);
|
|
13
13
|
return React.useCallback((rowNode, index) => {
|
|
14
14
|
const ariaAttributes = getRowAriaAttributesCommunity(rowNode, index);
|
|
15
|
-
if (rowNode
|
|
15
|
+
if (!rowNode || !(props.treeData || addTreeDataAttributes)) {
|
|
16
16
|
return ariaAttributes;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const useGridAriaAttributesPro: () => React.HTMLAttributes<HTMLElement>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { useGridAriaAttributes as useGridAriaAttributesCommunity } from '@mui/x-data-grid/internals';
|
|
3
3
|
import { useGridRootProps } from "./useGridRootProps.js";
|
|
4
|
-
export const
|
|
4
|
+
export const useGridAriaAttributesPro = () => {
|
|
5
5
|
const ariaAttributesCommunity = useGridAriaAttributesCommunity();
|
|
6
6
|
const rootProps = useGridRootProps();
|
|
7
7
|
const ariaAttributesPro = rootProps.treeData ? {
|
package/esm/index.js
CHANGED
package/esm/internals/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
export * from '@mui/x-data-grid/internals';
|
|
2
2
|
export { GridColumnHeaders } from "../components/GridColumnHeaders.js";
|
|
3
3
|
export { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from "../constants/dataGridProDefaultSlotsComponents.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { useGridColumnHeaders } from "../hooks/features/columnHeaders/useGridColumnHeaders.js";
|
|
8
|
-
export { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
|
|
9
|
-
export { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
4
|
+
export { useGridColumnHeadersPro } from "../hooks/features/columnHeaders/useGridColumnHeaders.js";
|
|
5
|
+
export { useGridAriaAttributesPro } from "../hooks/utils/useGridAriaAttributes.js";
|
|
6
|
+
export { useGridRowAriaAttributesPro } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
10
7
|
export { useGridColumnPinning, columnPinningStateInitializer } from "../hooks/features/columnPinning/useGridColumnPinning.js";
|
|
11
8
|
export { useGridColumnPinningPreProcessors } from "../hooks/features/columnPinning/useGridColumnPinningPreProcessors.js";
|
|
12
9
|
export { useGridColumnReorder, columnReorderStateInitializer } from "../hooks/features/columnReorder/useGridColumnReorder.js";
|
|
@@ -35,4 +32,8 @@ export { sortRowTree } from "../utils/tree/sortRowTree.js";
|
|
|
35
32
|
export { insertNodeInTree, removeNodeFromTree, getVisibleRowsLookup } from "../utils/tree/utils.js";
|
|
36
33
|
export type { RowTreeBuilderGroupingCriterion } from "../utils/tree/models.js";
|
|
37
34
|
export { skipSorting, skipFiltering, getParentPath } from "../hooks/features/serverSideTreeData/utils.js";
|
|
35
|
+
export declare enum RowGroupingStrategy {
|
|
36
|
+
Default = "grouping-columns",
|
|
37
|
+
DataSource = "grouping-columns-data-source",
|
|
38
|
+
}
|
|
38
39
|
export * from "./propValidation.js";
|
package/esm/internals/index.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
// eslint-disable-next-line import/export
|
|
2
1
|
export * from '@mui/x-data-grid/internals';
|
|
3
2
|
export { GridColumnHeaders } from "../components/GridColumnHeaders.js";
|
|
4
3
|
export { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from "../constants/dataGridProDefaultSlotsComponents.js";
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
/*
|
|
7
6
|
* x-data-grid-pro internals that are overriding the x-data-grid internals
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
13
|
-
/* eslint-enable import/export */
|
|
14
|
-
|
|
8
|
+
export { useGridColumnHeadersPro } from "../hooks/features/columnHeaders/useGridColumnHeaders.js";
|
|
9
|
+
export { useGridAriaAttributesPro } from "../hooks/utils/useGridAriaAttributes.js";
|
|
10
|
+
export { useGridRowAriaAttributesPro } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
15
11
|
export { useGridColumnPinning, columnPinningStateInitializer } from "../hooks/features/columnPinning/useGridColumnPinning.js";
|
|
16
12
|
export { useGridColumnPinningPreProcessors } from "../hooks/features/columnPinning/useGridColumnPinningPreProcessors.js";
|
|
17
13
|
export { useGridColumnReorder, columnReorderStateInitializer } from "../hooks/features/columnReorder/useGridColumnReorder.js";
|
|
@@ -38,4 +34,9 @@ export { updateRowTree } from "../utils/tree/updateRowTree.js";
|
|
|
38
34
|
export { sortRowTree } from "../utils/tree/sortRowTree.js";
|
|
39
35
|
export { insertNodeInTree, removeNodeFromTree, getVisibleRowsLookup } from "../utils/tree/utils.js";
|
|
40
36
|
export { skipSorting, skipFiltering, getParentPath } from "../hooks/features/serverSideTreeData/utils.js";
|
|
37
|
+
export let RowGroupingStrategy = /*#__PURE__*/function (RowGroupingStrategy) {
|
|
38
|
+
RowGroupingStrategy["Default"] = "grouping-columns";
|
|
39
|
+
RowGroupingStrategy["DataSource"] = "grouping-columns-data-source";
|
|
40
|
+
return RowGroupingStrategy;
|
|
41
|
+
}({});
|
|
41
42
|
export * from "./propValidation.js";
|
|
@@ -28,6 +28,7 @@ interface RemoveDataRowFromTreeParams {
|
|
|
28
28
|
* If not defined, then the tracking will be skipped.
|
|
29
29
|
*/
|
|
30
30
|
updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
|
|
31
|
+
groupingName: string;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Removed a data row from the tree.
|
|
@@ -40,6 +41,7 @@ export declare const removeDataRowFromTree: ({
|
|
|
40
41
|
id,
|
|
41
42
|
tree,
|
|
42
43
|
treeDepths,
|
|
43
|
-
updatedGroupsManager
|
|
44
|
+
updatedGroupsManager,
|
|
45
|
+
groupingName
|
|
44
46
|
}: RemoveDataRowFromTreeParams) => void;
|
|
45
47
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
|
|
2
2
|
import { getNodePathInTree, getGroupRowIdFromPath, removeNodeFromTree, updateGroupNodeIdAndAutoGenerated } from "./utils.js";
|
|
3
|
-
|
|
3
|
+
import { TreeDataStrategy } from "../../hooks/features/treeData/gridTreeDataUtils.js";
|
|
4
|
+
import { RowGroupingStrategy } from "../../internals/index.js";
|
|
5
|
+
const removeNode = ({
|
|
4
6
|
node,
|
|
5
7
|
tree,
|
|
6
|
-
treeDepths
|
|
7
|
-
updatedGroupsManager
|
|
8
|
+
treeDepths
|
|
8
9
|
}) => {
|
|
9
10
|
removeNodeFromTree({
|
|
10
11
|
node,
|
|
@@ -18,6 +19,18 @@ const removeNodeAndCleanParent = ({
|
|
|
18
19
|
treeDepths
|
|
19
20
|
});
|
|
20
21
|
}
|
|
22
|
+
};
|
|
23
|
+
const removeNodeAndCleanParent = ({
|
|
24
|
+
node,
|
|
25
|
+
tree,
|
|
26
|
+
treeDepths,
|
|
27
|
+
updatedGroupsManager
|
|
28
|
+
}) => {
|
|
29
|
+
removeNode({
|
|
30
|
+
node,
|
|
31
|
+
tree,
|
|
32
|
+
treeDepths
|
|
33
|
+
});
|
|
21
34
|
const parentNode = tree[node.parent];
|
|
22
35
|
updatedGroupsManager?.addAction(parentNode.id, 'removeChildren');
|
|
23
36
|
const shouldDeleteGroup = parentNode.id !== GRID_ROOT_GROUP_ID && parentNode.children.length === 0;
|
|
@@ -73,7 +86,8 @@ export const removeDataRowFromTree = ({
|
|
|
73
86
|
id,
|
|
74
87
|
tree,
|
|
75
88
|
treeDepths,
|
|
76
|
-
updatedGroupsManager
|
|
89
|
+
updatedGroupsManager,
|
|
90
|
+
groupingName
|
|
77
91
|
}) => {
|
|
78
92
|
const node = tree[id];
|
|
79
93
|
if (node.type === 'group' && node.children.length > 0) {
|
|
@@ -83,12 +97,18 @@ export const removeDataRowFromTree = ({
|
|
|
83
97
|
treeDepths,
|
|
84
98
|
updatedGroupsManager
|
|
85
99
|
});
|
|
86
|
-
} else {
|
|
100
|
+
} else if (groupingName === TreeDataStrategy.Default || groupingName === RowGroupingStrategy.Default) {
|
|
87
101
|
removeNodeAndCleanParent({
|
|
88
102
|
node,
|
|
89
103
|
tree,
|
|
90
104
|
treeDepths,
|
|
91
105
|
updatedGroupsManager
|
|
92
106
|
});
|
|
107
|
+
} else {
|
|
108
|
+
removeNode({
|
|
109
|
+
node,
|
|
110
|
+
tree,
|
|
111
|
+
treeDepths
|
|
112
|
+
});
|
|
93
113
|
}
|
|
94
114
|
};
|
|
@@ -36,7 +36,8 @@ export const updateRowTree = params => {
|
|
|
36
36
|
tree,
|
|
37
37
|
treeDepths,
|
|
38
38
|
updatedGroupsManager,
|
|
39
|
-
id: nodeId
|
|
39
|
+
id: nodeId,
|
|
40
|
+
groupingName: params.groupingName
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
for (let i = 0; i < params.nodes.modified.length; i += 1) {
|
|
@@ -55,7 +56,8 @@ export const updateRowTree = params => {
|
|
|
55
56
|
tree,
|
|
56
57
|
treeDepths,
|
|
57
58
|
updatedGroupsManager,
|
|
58
|
-
id
|
|
59
|
+
id,
|
|
60
|
+
groupingName: params.groupingName
|
|
59
61
|
});
|
|
60
62
|
insertDataRowInTree({
|
|
61
63
|
previousTree: params.previousTree,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { UseGridColumnHeadersProps, GetHeadersParams } from '@mui/x-data-grid/internals';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const useGridColumnHeadersPro: (props: UseGridColumnHeadersProps) => {
|
|
4
4
|
getColumnFiltersRow: () => React.JSX.Element | null;
|
|
5
5
|
getFillers: (params: GetHeadersParams | undefined, children: React.ReactNode, leftOverflow: number, borderBottom?: boolean) => React.JSX.Element;
|
|
6
6
|
getColumnHeadersRow: () => React.JSX.Element;
|
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.useGridColumnHeadersPro = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
@@ -27,7 +27,7 @@ const useUtilityClasses = ownerState => {
|
|
|
27
27
|
}, [classes]);
|
|
28
28
|
};
|
|
29
29
|
const filterItemsCache = Object.create(null);
|
|
30
|
-
const
|
|
30
|
+
const useGridColumnHeadersPro = props => {
|
|
31
31
|
const apiRef = (0, _internals.useGridPrivateApiContext)();
|
|
32
32
|
const {
|
|
33
33
|
headerGroupingMaxDepth,
|
|
@@ -150,4 +150,4 @@ const useGridColumnHeaders = props => {
|
|
|
150
150
|
getColumnFiltersRow
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
|
-
exports.
|
|
153
|
+
exports.useGridColumnHeadersPro = useGridColumnHeadersPro;
|
|
@@ -72,4 +72,10 @@ export interface GridDataSourcePrivateApiPro {
|
|
|
72
72
|
* Resets the data source state.
|
|
73
73
|
*/
|
|
74
74
|
resetDataSourceState: () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Removes the children rows of a parent from the grid.
|
|
77
|
+
* This is used when collapsing a parent row to ensure dynamic data updates work properly.
|
|
78
|
+
* @param {GridRowId} parentId The id of the parent node.
|
|
79
|
+
*/
|
|
80
|
+
removeChildrenRows: (parentId: GridRowId) => void;
|
|
75
81
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
+
import { GridRowId } from '@mui/x-data-grid';
|
|
2
3
|
import { CacheChunkManager, DataSourceRowsUpdateStrategy, GridDataSourceBaseOptions } from '@mui/x-data-grid/internals';
|
|
3
4
|
import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
|
|
4
5
|
import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
|
|
@@ -188,6 +188,30 @@ const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
|
|
|
188
188
|
});
|
|
189
189
|
});
|
|
190
190
|
}, [apiRef]);
|
|
191
|
+
const removeChildrenRows = React.useCallback(parentId => {
|
|
192
|
+
const rowNode = (0, _xDataGrid.gridRowNodeSelector)(apiRef, parentId);
|
|
193
|
+
if (!rowNode || rowNode.type !== 'group' || rowNode.children.length === 0) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const removedRows = [];
|
|
197
|
+
const traverse = nodeId => {
|
|
198
|
+
const node = (0, _xDataGrid.gridRowNodeSelector)(apiRef, nodeId);
|
|
199
|
+
if (!node) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (node.type === 'group' && node.children.length > 0) {
|
|
203
|
+
node.children.forEach(traverse);
|
|
204
|
+
}
|
|
205
|
+
removedRows.push({
|
|
206
|
+
id: nodeId,
|
|
207
|
+
_action: 'delete'
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
rowNode.children.forEach(traverse);
|
|
211
|
+
if (removedRows.length > 0) {
|
|
212
|
+
apiRef.current.updateNestedRows(removedRows, rowNode.path);
|
|
213
|
+
}
|
|
214
|
+
}, [apiRef]);
|
|
191
215
|
const dataSourceApi = {
|
|
192
216
|
dataSource: (0, _extends2.default)({}, api.public.dataSource, {
|
|
193
217
|
setChildrenLoading,
|
|
@@ -196,7 +220,8 @@ const useGridDataSourceBasePro = (apiRef, props, options = {}) => {
|
|
|
196
220
|
};
|
|
197
221
|
const dataSourcePrivateApi = {
|
|
198
222
|
fetchRowChildren,
|
|
199
|
-
resetDataSourceState
|
|
223
|
+
resetDataSourceState,
|
|
224
|
+
removeChildrenRows
|
|
200
225
|
};
|
|
201
226
|
React.useEffect(() => {
|
|
202
227
|
if (groupsToAutoFetch && groupsToAutoFetch.length && scheduledGroups.current < groupsToAutoFetch.length) {
|
|
@@ -38,6 +38,7 @@ const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = exports.GRID_DETAIL_PANEL_TOGGLE_COL_DE
|
|
|
38
38
|
const expandedRowIds = (0, _gridDetailPanelSelector.gridDetailPanelExpandedRowIdsSelector)(apiRef);
|
|
39
39
|
return expandedRowIds.has(rowId);
|
|
40
40
|
},
|
|
41
|
+
rowSpanValueGetter: (_, row, __, apiRef) => (0, _xDataGrid.gridRowIdSelector)(apiRef, row),
|
|
41
42
|
renderCell: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridDetailPanelToggleCell.GridDetailPanelToggleCell, (0, _extends2.default)({}, params)),
|
|
42
43
|
renderHeader: ({
|
|
43
44
|
colDef
|
|
@@ -23,5 +23,6 @@ const GRID_REORDER_COL_DEF = exports.GRID_REORDER_COL_DEF = (0, _extends2.defaul
|
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
aggregable: false,
|
|
25
25
|
renderHeader: () => ' ',
|
|
26
|
-
renderCell: _GridRowReorderCell.renderRowReorderCell
|
|
26
|
+
renderCell: _GridRowReorderCell.renderRowReorderCell,
|
|
27
|
+
rowSpanValueGetter: (_, row, __, apiRef) => (0, _xDataGrid.gridRowIdSelector)(apiRef, row)
|
|
27
28
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridTreeNode } from '@mui/x-data-grid';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const useGridRowAriaAttributesPro: (addTreeDataAttributes?: boolean) => (rowNode: GridTreeNode, index: number) => React.HTMLAttributes<HTMLElement>;
|
|
@@ -4,13 +4,13 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.useGridRowAriaAttributesPro = void 0;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
10
10
|
var _internals = require("@mui/x-data-grid/internals");
|
|
11
11
|
var _useGridPrivateApiContext = require("../../utils/useGridPrivateApiContext");
|
|
12
12
|
var _useGridRootProps = require("../../utils/useGridRootProps");
|
|
13
|
-
const
|
|
13
|
+
const useGridRowAriaAttributesPro = addTreeDataAttributes => {
|
|
14
14
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
15
15
|
const props = (0, _useGridRootProps.useGridRootProps)();
|
|
16
16
|
const getRowAriaAttributesCommunity = (0, _internals.useGridRowAriaAttributes)();
|
|
@@ -19,7 +19,7 @@ const useGridRowAriaAttributes = addTreeDataAttributes => {
|
|
|
19
19
|
const sortedVisibleRowPositionsLookup = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridExpandedSortedRowTreeLevelPositionLookupSelector);
|
|
20
20
|
return React.useCallback((rowNode, index) => {
|
|
21
21
|
const ariaAttributes = getRowAriaAttributesCommunity(rowNode, index);
|
|
22
|
-
if (rowNode
|
|
22
|
+
if (!rowNode || !(props.treeData || addTreeDataAttributes)) {
|
|
23
23
|
return ariaAttributes;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -42,4 +42,4 @@ const useGridRowAriaAttributes = addTreeDataAttributes => {
|
|
|
42
42
|
return ariaAttributes;
|
|
43
43
|
}, [props.treeData, addTreeDataAttributes, filteredTopLevelRowCount, filteredChildrenCountLookup, sortedVisibleRowPositionsLookup, getRowAriaAttributesCommunity]);
|
|
44
44
|
};
|
|
45
|
-
exports.
|
|
45
|
+
exports.useGridRowAriaAttributesPro = useGridRowAriaAttributesPro;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const useGridAriaAttributesPro: () => React.HTMLAttributes<HTMLElement>;
|
|
@@ -4,11 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.useGridAriaAttributesPro = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _internals = require("@mui/x-data-grid/internals");
|
|
10
10
|
var _useGridRootProps = require("./useGridRootProps");
|
|
11
|
-
const
|
|
11
|
+
const useGridAriaAttributesPro = () => {
|
|
12
12
|
const ariaAttributesCommunity = (0, _internals.useGridAriaAttributes)();
|
|
13
13
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
14
14
|
const ariaAttributesPro = rootProps.treeData ? {
|
|
@@ -16,4 +16,4 @@ const useGridAriaAttributes = () => {
|
|
|
16
16
|
} : {};
|
|
17
17
|
return (0, _extends2.default)({}, ariaAttributesCommunity, ariaAttributesPro);
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
19
|
+
exports.useGridAriaAttributesPro = useGridAriaAttributesPro;
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
export * from '@mui/x-data-grid/internals';
|
|
2
2
|
export { GridColumnHeaders } from "../components/GridColumnHeaders.js";
|
|
3
3
|
export { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from "../constants/dataGridProDefaultSlotsComponents.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { useGridColumnHeaders } from "../hooks/features/columnHeaders/useGridColumnHeaders.js";
|
|
8
|
-
export { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
|
|
9
|
-
export { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
4
|
+
export { useGridColumnHeadersPro } from "../hooks/features/columnHeaders/useGridColumnHeaders.js";
|
|
5
|
+
export { useGridAriaAttributesPro } from "../hooks/utils/useGridAriaAttributes.js";
|
|
6
|
+
export { useGridRowAriaAttributesPro } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
10
7
|
export { useGridColumnPinning, columnPinningStateInitializer } from "../hooks/features/columnPinning/useGridColumnPinning.js";
|
|
11
8
|
export { useGridColumnPinningPreProcessors } from "../hooks/features/columnPinning/useGridColumnPinningPreProcessors.js";
|
|
12
9
|
export { useGridColumnReorder, columnReorderStateInitializer } from "../hooks/features/columnReorder/useGridColumnReorder.js";
|
|
@@ -35,4 +32,8 @@ export { sortRowTree } from "../utils/tree/sortRowTree.js";
|
|
|
35
32
|
export { insertNodeInTree, removeNodeFromTree, getVisibleRowsLookup } from "../utils/tree/utils.js";
|
|
36
33
|
export type { RowTreeBuilderGroupingCriterion } from "../utils/tree/models.js";
|
|
37
34
|
export { skipSorting, skipFiltering, getParentPath } from "../hooks/features/serverSideTreeData/utils.js";
|
|
35
|
+
export declare enum RowGroupingStrategy {
|
|
36
|
+
Default = "grouping-columns",
|
|
37
|
+
DataSource = "grouping-columns-data-source",
|
|
38
|
+
}
|
|
38
39
|
export * from "./propValidation.js";
|
package/internals/index.js
CHANGED
|
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
+
RowGroupingStrategy: true,
|
|
7
8
|
GridColumnHeaders: true,
|
|
8
9
|
DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS: true,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
useGridColumnHeadersPro: true,
|
|
11
|
+
useGridAriaAttributesPro: true,
|
|
12
|
+
useGridRowAriaAttributesPro: true,
|
|
12
13
|
useGridColumnPinning: true,
|
|
13
14
|
columnPinningStateInitializer: true,
|
|
14
15
|
useGridColumnPinningPreProcessors: true,
|
|
@@ -58,6 +59,7 @@ Object.defineProperty(exports, "GridColumnHeaders", {
|
|
|
58
59
|
return _GridColumnHeaders.GridColumnHeaders;
|
|
59
60
|
}
|
|
60
61
|
});
|
|
62
|
+
exports.RowGroupingStrategy = void 0;
|
|
61
63
|
Object.defineProperty(exports, "addPinnedRow", {
|
|
62
64
|
enumerable: true,
|
|
63
65
|
get: function () {
|
|
@@ -166,16 +168,16 @@ Object.defineProperty(exports, "updateRowTree", {
|
|
|
166
168
|
return _updateRowTree.updateRowTree;
|
|
167
169
|
}
|
|
168
170
|
});
|
|
169
|
-
Object.defineProperty(exports, "
|
|
171
|
+
Object.defineProperty(exports, "useGridAriaAttributesPro", {
|
|
170
172
|
enumerable: true,
|
|
171
173
|
get: function () {
|
|
172
|
-
return _useGridAriaAttributes.
|
|
174
|
+
return _useGridAriaAttributes.useGridAriaAttributesPro;
|
|
173
175
|
}
|
|
174
176
|
});
|
|
175
|
-
Object.defineProperty(exports, "
|
|
177
|
+
Object.defineProperty(exports, "useGridColumnHeadersPro", {
|
|
176
178
|
enumerable: true,
|
|
177
179
|
get: function () {
|
|
178
|
-
return _useGridColumnHeaders.
|
|
180
|
+
return _useGridColumnHeaders.useGridColumnHeadersPro;
|
|
179
181
|
}
|
|
180
182
|
});
|
|
181
183
|
Object.defineProperty(exports, "useGridColumnPinning", {
|
|
@@ -250,10 +252,10 @@ Object.defineProperty(exports, "useGridLazyLoaderPreProcessors", {
|
|
|
250
252
|
return _useGridLazyLoaderPreProcessors.useGridLazyLoaderPreProcessors;
|
|
251
253
|
}
|
|
252
254
|
});
|
|
253
|
-
Object.defineProperty(exports, "
|
|
255
|
+
Object.defineProperty(exports, "useGridRowAriaAttributesPro", {
|
|
254
256
|
enumerable: true,
|
|
255
257
|
get: function () {
|
|
256
|
-
return _useGridRowAriaAttributes.
|
|
258
|
+
return _useGridRowAriaAttributes.useGridRowAriaAttributesPro;
|
|
257
259
|
}
|
|
258
260
|
});
|
|
259
261
|
Object.defineProperty(exports, "useGridRowPinning", {
|
|
@@ -346,4 +348,12 @@ Object.keys(_propValidation).forEach(function (key) {
|
|
|
346
348
|
return _propValidation[key];
|
|
347
349
|
}
|
|
348
350
|
});
|
|
349
|
-
});
|
|
351
|
+
});
|
|
352
|
+
/*
|
|
353
|
+
* x-data-grid-pro internals that are overriding the x-data-grid internals
|
|
354
|
+
*/
|
|
355
|
+
let RowGroupingStrategy = exports.RowGroupingStrategy = /*#__PURE__*/function (RowGroupingStrategy) {
|
|
356
|
+
RowGroupingStrategy["Default"] = "grouping-columns";
|
|
357
|
+
RowGroupingStrategy["DataSource"] = "grouping-columns-data-source";
|
|
358
|
+
return RowGroupingStrategy;
|
|
359
|
+
}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-pro",
|
|
3
|
-
"version": "8.9.
|
|
3
|
+
"version": "8.9.2",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Pro plan edition of the MUI X Data Grid components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"**/*.css"
|
|
14
14
|
],
|
|
15
15
|
"publishConfig": {
|
|
16
|
-
"access": "public"
|
|
17
|
-
"directory": "build"
|
|
16
|
+
"access": "public"
|
|
18
17
|
},
|
|
19
18
|
"keywords": [
|
|
20
19
|
"react",
|
|
@@ -35,14 +34,14 @@
|
|
|
35
34
|
"directory": "packages/x-data-grid-pro"
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@babel/runtime": "^7.
|
|
37
|
+
"@babel/runtime": "^7.28.2",
|
|
39
38
|
"@mui/utils": "^7.2.0",
|
|
40
39
|
"@types/format-util": "^1.0.4",
|
|
41
40
|
"clsx": "^2.1.1",
|
|
42
41
|
"prop-types": "^15.8.1",
|
|
43
|
-
"@mui/x-
|
|
44
|
-
"@mui/x-
|
|
45
|
-
"@mui/x-
|
|
42
|
+
"@mui/x-license": "8.9.2",
|
|
43
|
+
"@mui/x-internals": "8.9.2",
|
|
44
|
+
"@mui/x-data-grid": "8.9.2"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
47
|
"@emotion/react": "^11.9.0",
|
|
@@ -28,6 +28,7 @@ interface RemoveDataRowFromTreeParams {
|
|
|
28
28
|
* If not defined, then the tracking will be skipped.
|
|
29
29
|
*/
|
|
30
30
|
updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
|
|
31
|
+
groupingName: string;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Removed a data row from the tree.
|
|
@@ -40,6 +41,7 @@ export declare const removeDataRowFromTree: ({
|
|
|
40
41
|
id,
|
|
41
42
|
tree,
|
|
42
43
|
treeDepths,
|
|
43
|
-
updatedGroupsManager
|
|
44
|
+
updatedGroupsManager,
|
|
45
|
+
groupingName
|
|
44
46
|
}: RemoveDataRowFromTreeParams) => void;
|
|
45
47
|
export {};
|
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.removeDataRowFromTree = void 0;
|
|
7
7
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
8
8
|
var _utils = require("./utils");
|
|
9
|
-
|
|
9
|
+
var _gridTreeDataUtils = require("../../hooks/features/treeData/gridTreeDataUtils");
|
|
10
|
+
var _internals = require("../../internals");
|
|
11
|
+
const removeNode = ({
|
|
10
12
|
node,
|
|
11
13
|
tree,
|
|
12
|
-
treeDepths
|
|
13
|
-
updatedGroupsManager
|
|
14
|
+
treeDepths
|
|
14
15
|
}) => {
|
|
15
16
|
(0, _utils.removeNodeFromTree)({
|
|
16
17
|
node,
|
|
@@ -24,6 +25,18 @@ const removeNodeAndCleanParent = ({
|
|
|
24
25
|
treeDepths
|
|
25
26
|
});
|
|
26
27
|
}
|
|
28
|
+
};
|
|
29
|
+
const removeNodeAndCleanParent = ({
|
|
30
|
+
node,
|
|
31
|
+
tree,
|
|
32
|
+
treeDepths,
|
|
33
|
+
updatedGroupsManager
|
|
34
|
+
}) => {
|
|
35
|
+
removeNode({
|
|
36
|
+
node,
|
|
37
|
+
tree,
|
|
38
|
+
treeDepths
|
|
39
|
+
});
|
|
27
40
|
const parentNode = tree[node.parent];
|
|
28
41
|
updatedGroupsManager?.addAction(parentNode.id, 'removeChildren');
|
|
29
42
|
const shouldDeleteGroup = parentNode.id !== _xDataGrid.GRID_ROOT_GROUP_ID && parentNode.children.length === 0;
|
|
@@ -79,7 +92,8 @@ const removeDataRowFromTree = ({
|
|
|
79
92
|
id,
|
|
80
93
|
tree,
|
|
81
94
|
treeDepths,
|
|
82
|
-
updatedGroupsManager
|
|
95
|
+
updatedGroupsManager,
|
|
96
|
+
groupingName
|
|
83
97
|
}) => {
|
|
84
98
|
const node = tree[id];
|
|
85
99
|
if (node.type === 'group' && node.children.length > 0) {
|
|
@@ -89,13 +103,19 @@ const removeDataRowFromTree = ({
|
|
|
89
103
|
treeDepths,
|
|
90
104
|
updatedGroupsManager
|
|
91
105
|
});
|
|
92
|
-
} else {
|
|
106
|
+
} else if (groupingName === _gridTreeDataUtils.TreeDataStrategy.Default || groupingName === _internals.RowGroupingStrategy.Default) {
|
|
93
107
|
removeNodeAndCleanParent({
|
|
94
108
|
node,
|
|
95
109
|
tree,
|
|
96
110
|
treeDepths,
|
|
97
111
|
updatedGroupsManager
|
|
98
112
|
});
|
|
113
|
+
} else {
|
|
114
|
+
removeNode({
|
|
115
|
+
node,
|
|
116
|
+
tree,
|
|
117
|
+
treeDepths
|
|
118
|
+
});
|
|
99
119
|
}
|
|
100
120
|
};
|
|
101
121
|
exports.removeDataRowFromTree = removeDataRowFromTree;
|
|
@@ -43,7 +43,8 @@ const updateRowTree = params => {
|
|
|
43
43
|
tree,
|
|
44
44
|
treeDepths,
|
|
45
45
|
updatedGroupsManager,
|
|
46
|
-
id: nodeId
|
|
46
|
+
id: nodeId,
|
|
47
|
+
groupingName: params.groupingName
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
for (let i = 0; i < params.nodes.modified.length; i += 1) {
|
|
@@ -62,7 +63,8 @@ const updateRowTree = params => {
|
|
|
62
63
|
tree,
|
|
63
64
|
treeDepths,
|
|
64
65
|
updatedGroupsManager,
|
|
65
|
-
id
|
|
66
|
+
id,
|
|
67
|
+
groupingName: params.groupingName
|
|
66
68
|
});
|
|
67
69
|
(0, _insertDataRowInTree.insertDataRowInTree)({
|
|
68
70
|
previousTree: params.previousTree,
|