@mui/x-data-grid-pro 5.17.5 → 6.0.0-alpha.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 +297 -19
- package/DataGridPro/DataGridPro.js +4 -14
- package/DataGridPro/useDataGridProProps.js +2 -2
- package/components/DataGridProVirtualScroller.js +2 -2
- package/components/GridDetailPanelToggleCell.js +1 -1
- package/components/GridRowReorderCell.js +4 -6
- package/components/GridTreeDataGroupingCell.d.ts +2 -2
- package/components/GridTreeDataGroupingCell.js +1 -1
- package/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/hooks/features/lazyLoader/useGridLazyLoader.js +20 -9
- package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.d.ts +1 -1
- package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +20 -6
- package/hooks/features/rowPinning/gridRowPinningInterface.d.ts +2 -2
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +16 -16
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +62 -25
- package/hooks/features/rowReorder/useGridRowReorder.js +5 -5
- package/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/hooks/features/treeData/gridTreeDataUtils.js +14 -12
- package/hooks/features/treeData/useGridTreeData.js +2 -6
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -18
- package/index.js +1 -1
- package/internals/index.d.ts +4 -2
- package/internals/index.js +4 -2
- package/legacy/DataGridPro/DataGridPro.js +4 -14
- package/legacy/DataGridPro/useDataGridProProps.js +2 -2
- package/legacy/components/DataGridProVirtualScroller.js +2 -2
- package/legacy/components/GridDetailPanelToggleCell.js +1 -1
- package/legacy/components/GridRowReorderCell.js +4 -6
- package/legacy/components/GridTreeDataGroupingCell.js +1 -1
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/legacy/hooks/features/lazyLoader/useGridLazyLoader.js +25 -15
- package/legacy/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +21 -7
- package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +62 -25
- package/legacy/hooks/features/rowReorder/useGridRowReorder.js +5 -5
- package/legacy/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/legacy/hooks/features/treeData/gridTreeDataUtils.js +14 -12
- package/legacy/hooks/features/treeData/useGridTreeData.js +2 -6
- package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +37 -22
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +4 -2
- package/legacy/utils/tree/createRowTree.js +36 -0
- package/legacy/utils/tree/index.js +1 -1
- package/legacy/utils/tree/insertDataRowInTree.js +127 -0
- package/legacy/utils/tree/models.js +1 -0
- package/legacy/utils/tree/removeDataRowFromTree.js +97 -0
- package/legacy/utils/tree/sortRowTree.js +49 -43
- package/legacy/utils/tree/updateRowTree.js +81 -0
- package/legacy/utils/tree/utils.js +184 -0
- package/models/dataGridProProps.d.ts +3 -3
- package/modern/DataGridPro/DataGridPro.js +4 -14
- package/modern/DataGridPro/useDataGridProProps.js +2 -2
- package/modern/components/DataGridProVirtualScroller.js +2 -2
- package/modern/components/GridDetailPanelToggleCell.js +1 -1
- package/modern/components/GridRowReorderCell.js +4 -4
- package/modern/components/GridTreeDataGroupingCell.js +1 -1
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/modern/hooks/features/lazyLoader/useGridLazyLoader.js +20 -9
- package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +20 -6
- package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +60 -23
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +5 -3
- package/modern/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/modern/hooks/features/treeData/gridTreeDataUtils.js +13 -9
- package/modern/hooks/features/treeData/useGridTreeData.js +2 -4
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -18
- package/modern/index.js +1 -1
- package/modern/internals/index.js +4 -2
- package/modern/utils/tree/createRowTree.js +35 -0
- package/modern/utils/tree/index.js +1 -1
- package/modern/utils/tree/insertDataRowInTree.js +127 -0
- package/modern/utils/tree/models.js +1 -0
- package/modern/utils/tree/removeDataRowFromTree.js +100 -0
- package/modern/utils/tree/sortRowTree.js +46 -40
- package/modern/utils/tree/updateRowTree.js +83 -0
- package/modern/utils/tree/utils.js +180 -0
- package/node/DataGridPro/DataGridPro.js +4 -14
- package/node/DataGridPro/useDataGridProProps.js +1 -1
- package/node/components/DataGridProVirtualScroller.js +1 -1
- package/node/components/GridDetailPanelToggleCell.js +1 -1
- package/node/components/GridRowReorderCell.js +3 -5
- package/node/components/GridTreeDataGroupingCell.js +1 -1
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +1 -1
- package/node/hooks/features/lazyLoader/useGridLazyLoader.js +19 -8
- package/node/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +18 -5
- package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +63 -26
- package/node/hooks/features/rowReorder/useGridRowReorder.js +4 -4
- package/node/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/node/hooks/features/treeData/gridTreeDataUtils.js +14 -12
- package/node/hooks/features/treeData/useGridTreeData.js +1 -5
- package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -17
- package/node/index.js +1 -1
- package/node/internals/index.js +35 -10
- package/node/utils/tree/createRowTree.js +46 -0
- package/node/utils/tree/index.js +2 -2
- package/node/utils/tree/insertDataRowInTree.js +139 -0
- package/node/utils/tree/models.js +5 -0
- package/node/utils/tree/removeDataRowFromTree.js +110 -0
- package/node/utils/tree/sortRowTree.js +50 -43
- package/node/utils/tree/updateRowTree.js +98 -0
- package/node/utils/tree/utils.js +217 -0
- package/package.json +5 -5
- package/utils/tree/createRowTree.d.ts +15 -0
- package/utils/tree/createRowTree.js +35 -0
- package/utils/tree/index.d.ts +1 -1
- package/utils/tree/index.js +1 -1
- package/utils/tree/insertDataRowInTree.d.ts +51 -0
- package/utils/tree/insertDataRowInTree.js +129 -0
- package/utils/tree/models.d.ts +13 -0
- package/utils/tree/models.js +1 -0
- package/utils/tree/removeDataRowFromTree.d.ts +40 -0
- package/utils/tree/removeDataRowFromTree.js +100 -0
- package/utils/tree/sortRowTree.d.ts +6 -1
- package/utils/tree/sortRowTree.js +46 -40
- package/utils/tree/updateRowTree.d.ts +19 -0
- package/utils/tree/updateRowTree.js +83 -0
- package/utils/tree/utils.d.ts +66 -0
- package/utils/tree/utils.js +186 -0
- package/legacy/utils/tree/buildRowTree.js +0 -195
- package/modern/utils/tree/buildRowTree.js +0 -174
- package/node/utils/tree/buildRowTree.js +0 -195
- package/utils/tree/buildRowTree.d.ts +0 -48
- package/utils/tree/buildRowTree.js +0 -186
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
4
|
-
import {
|
|
4
|
+
import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
|
|
5
5
|
export const GRID_SKELETON_ROW_ROOT_ID = 'auto-generated-skeleton-row-root';
|
|
6
6
|
|
|
7
7
|
const getSkeletonRowId = index => `${GRID_SKELETON_ROW_ROOT_ID}-${index}`;
|
|
@@ -13,19 +13,33 @@ export const useGridLazyLoaderPreProcessors = (apiRef, props) => {
|
|
|
13
13
|
lazyLoading
|
|
14
14
|
} = (_props$experimentalFe = props.experimentalFeatures) != null ? _props$experimentalFe : {};
|
|
15
15
|
const addSkeletonRows = React.useCallback(groupingParams => {
|
|
16
|
-
|
|
16
|
+
const tree = _extends({}, groupingParams.tree);
|
|
17
|
+
|
|
18
|
+
const rootGroup = tree[GRID_ROOT_GROUP_ID];
|
|
19
|
+
|
|
20
|
+
if (!lazyLoading || props.rowsLoadingMode !== 'server' || !props.rowCount || rootGroup.children.length >= props.rowCount) {
|
|
17
21
|
return groupingParams;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
const
|
|
24
|
+
const rootGroupChildren = [...rootGroup.children];
|
|
21
25
|
|
|
22
|
-
for (let i = 0; i < props.rowCount -
|
|
26
|
+
for (let i = 0; i < props.rowCount - rootGroup.children.length; i += 1) {
|
|
23
27
|
const skeletonId = getSkeletonRowId(i);
|
|
24
|
-
|
|
28
|
+
rootGroupChildren.push(skeletonId);
|
|
29
|
+
const skeletonRowNode = {
|
|
30
|
+
type: 'skeletonRow',
|
|
31
|
+
id: skeletonId,
|
|
32
|
+
parent: GRID_ROOT_GROUP_ID,
|
|
33
|
+
depth: 0
|
|
34
|
+
};
|
|
35
|
+
tree[skeletonId] = skeletonRowNode;
|
|
25
36
|
}
|
|
26
37
|
|
|
38
|
+
tree[GRID_ROOT_GROUP_ID] = _extends({}, rootGroup, {
|
|
39
|
+
children: rootGroupChildren
|
|
40
|
+
});
|
|
27
41
|
return _extends({}, groupingParams, {
|
|
28
|
-
|
|
42
|
+
tree
|
|
29
43
|
});
|
|
30
44
|
}, [props.rowCount, props.rowsLoadingMode, lazyLoading]);
|
|
31
45
|
useGridRegisterPipeProcessor(apiRef, 'hydrateRows', addSkeletonRows);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridRowId,
|
|
1
|
+
import { GridRowId, GridRowIdToModelLookup, GridRowsProp, GridValidRowModel } from '@mui/x-data-grid';
|
|
2
2
|
export interface GridPinnedRowsProp<R extends GridValidRowModel = GridValidRowModel> {
|
|
3
3
|
top?: GridRowsProp<R>;
|
|
4
4
|
bottom?: GridRowsProp<R>;
|
|
@@ -13,5 +13,5 @@ export interface GridRowPinningApi {
|
|
|
13
13
|
export interface GridRowPinningInternalCache {
|
|
14
14
|
topIds: GridRowId[];
|
|
15
15
|
bottomIds: GridRowId[];
|
|
16
|
-
idLookup:
|
|
16
|
+
idLookup: GridRowIdToModelLookup;
|
|
17
17
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridHydrateRowsValue } from '@mui/x-data-grid/internals';
|
|
3
|
-
import {
|
|
3
|
+
import { GridRowId, GridRowModel } from '@mui/x-data-grid';
|
|
4
4
|
import { GridApiPro } from '../../../models/gridApiPro';
|
|
5
5
|
import { GridPinnedRowsProp } from './gridRowPinningInterface';
|
|
6
6
|
declare type GridPinnedRowPosition = keyof GridPinnedRowsProp;
|
|
7
|
-
export declare function addPinnedRow({ groupingParams, rowModel, rowId, position, apiRef, }: {
|
|
7
|
+
export declare function addPinnedRow({ groupingParams, rowModel, rowId, position, apiRef, isAutoGenerated, }: {
|
|
8
8
|
groupingParams: GridHydrateRowsValue;
|
|
9
|
-
rowModel: GridRowModel;
|
|
9
|
+
rowModel: GridRowModel | undefined;
|
|
10
10
|
rowId: GridRowId;
|
|
11
11
|
position: GridPinnedRowPosition;
|
|
12
12
|
apiRef: React.MutableRefObject<GridApiPro>;
|
|
13
|
+
isAutoGenerated: boolean;
|
|
13
14
|
}): {
|
|
14
|
-
|
|
15
|
+
dataRowIdToModelLookup: {
|
|
15
16
|
[x: string]: import("@mui/x-data-grid").GridValidRowModel;
|
|
16
|
-
|
|
17
|
+
};
|
|
18
|
+
dataRowIdToIdLookup: {
|
|
19
|
+
[x: string]: GridRowId;
|
|
17
20
|
};
|
|
18
21
|
tree: {
|
|
19
|
-
[x: string]: import("@mui/x-data-grid").
|
|
20
|
-
[x: number]: import("@mui/x-data-grid").
|
|
22
|
+
[x: string]: import("@mui/x-data-grid").GridTreeNode;
|
|
23
|
+
[x: number]: import("@mui/x-data-grid").GridTreeNode;
|
|
21
24
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
top?: GridRowEntry<import("@mui/x-data-grid").GridValidRowModel>[] | undefined;
|
|
25
|
-
bottom?: GridRowEntry<import("@mui/x-data-grid").GridValidRowModel>[] | undefined;
|
|
26
|
-
};
|
|
25
|
+
treeDepths: {
|
|
26
|
+
[x: number]: number;
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
dataRowIds: GridRowId[];
|
|
29
|
+
additionalRowGroups?: {
|
|
30
|
+
pinnedRows?: import("@mui/x-data-grid/internals").GridPinnedRowsState | undefined;
|
|
31
|
+
} | undefined;
|
|
32
32
|
};
|
|
33
33
|
export declare const useGridRowPinningPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>) => void;
|
|
34
34
|
export {};
|
|
@@ -1,42 +1,68 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
4
|
+
import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
|
|
5
|
+
import { insertNodeInTree } from '../../../utils/tree/utils';
|
|
4
6
|
export function addPinnedRow({
|
|
5
7
|
groupingParams,
|
|
6
8
|
rowModel,
|
|
7
9
|
rowId,
|
|
8
10
|
position,
|
|
9
|
-
apiRef
|
|
11
|
+
apiRef,
|
|
12
|
+
isAutoGenerated
|
|
10
13
|
}) {
|
|
11
|
-
var _groupingParams$addit;
|
|
14
|
+
var _groupingParams$addit, _groupingParams$addit2, _groupingParams$addit3, _groupingParams$addit4;
|
|
12
15
|
|
|
13
|
-
const
|
|
16
|
+
const dataRowIdToModelLookup = _extends({}, groupingParams.dataRowIdToModelLookup);
|
|
14
17
|
|
|
15
|
-
const
|
|
18
|
+
const dataRowIdToIdLookup = _extends({}, groupingParams.dataRowIdToIdLookup);
|
|
16
19
|
|
|
20
|
+
const tree = _extends({}, groupingParams.tree);
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
// ids.push(rowId);
|
|
22
|
+
const treeDepths = _extends({}, groupingParams.treeDepths); // TODO: warn if id is already present in `props.rows`
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
|
|
25
|
+
const node = {
|
|
26
|
+
type: 'pinnedRow',
|
|
22
27
|
id: rowId,
|
|
23
|
-
isAutoGenerated: false,
|
|
24
|
-
parent: null,
|
|
25
28
|
depth: 0,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
isPinned: true
|
|
29
|
+
parent: GRID_ROOT_GROUP_ID,
|
|
30
|
+
isAutoGenerated
|
|
29
31
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
insertNodeInTree({
|
|
33
|
+
node,
|
|
34
|
+
tree,
|
|
35
|
+
treeDepths
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (!isAutoGenerated) {
|
|
39
|
+
dataRowIdToModelLookup[rowId] = rowModel;
|
|
40
|
+
dataRowIdToIdLookup[rowId] = rowId;
|
|
41
|
+
} // Do not push it to ids list so that pagination is not affected by pinned rows
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
apiRef.current.unstable_caches.rows.dataRowIdToModelLookup[rowId] = _extends({}, rowModel);
|
|
45
|
+
apiRef.current.unstable_caches.rows.dataRowIdToIdLookup[rowId] = rowId;
|
|
32
46
|
const previousPinnedRows = ((_groupingParams$addit = groupingParams.additionalRowGroups) == null ? void 0 : _groupingParams$addit.pinnedRows) || {};
|
|
33
47
|
const newPinnedRow = {
|
|
34
48
|
id: rowId,
|
|
35
49
|
model: rowModel
|
|
36
50
|
};
|
|
51
|
+
|
|
52
|
+
if ((_groupingParams$addit2 = groupingParams.additionalRowGroups) != null && (_groupingParams$addit3 = _groupingParams$addit2.pinnedRows) != null && (_groupingParams$addit4 = _groupingParams$addit3[position]) != null && _groupingParams$addit4.includes(newPinnedRow)) {
|
|
53
|
+
return _extends({}, groupingParams, {
|
|
54
|
+
dataRowIdToModelLookup,
|
|
55
|
+
dataRowIdToIdLookup,
|
|
56
|
+
tree,
|
|
57
|
+
treeDepths
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
37
61
|
return _extends({}, groupingParams, {
|
|
38
|
-
|
|
62
|
+
dataRowIdToModelLookup,
|
|
63
|
+
dataRowIdToIdLookup,
|
|
39
64
|
tree,
|
|
65
|
+
treeDepths,
|
|
40
66
|
additionalRowGroups: _extends({}, groupingParams.additionalRowGroups, {
|
|
41
67
|
pinnedRows: _extends({}, previousPinnedRows, {
|
|
42
68
|
[position]: [...(previousPinnedRows[position] || []), newPinnedRow]
|
|
@@ -46,7 +72,7 @@ export function addPinnedRow({
|
|
|
46
72
|
}
|
|
47
73
|
export const useGridRowPinningPreProcessors = apiRef => {
|
|
48
74
|
const addPinnedRows = React.useCallback(groupingParams => {
|
|
49
|
-
var _pinnedRowsCache$topI, _pinnedRowsCache$bott;
|
|
75
|
+
var _pinnedRowsCache$topI, _pinnedRowsCache$bott, _pinnedRowsCache$bott2, _pinnedRowsCache$topI2;
|
|
50
76
|
|
|
51
77
|
const pinnedRowsCache = apiRef.current.unstable_caches.pinnedRows || {};
|
|
52
78
|
|
|
@@ -63,7 +89,8 @@ export const useGridRowPinningPreProcessors = apiRef => {
|
|
|
63
89
|
rowModel: pinnedRowsCache.idLookup[rowId],
|
|
64
90
|
rowId,
|
|
65
91
|
position: 'top',
|
|
66
|
-
apiRef
|
|
92
|
+
apiRef,
|
|
93
|
+
isAutoGenerated: false
|
|
67
94
|
});
|
|
68
95
|
});
|
|
69
96
|
(_pinnedRowsCache$bott = pinnedRowsCache.bottomIds) == null ? void 0 : _pinnedRowsCache$bott.forEach(rowId => {
|
|
@@ -72,17 +99,27 @@ export const useGridRowPinningPreProcessors = apiRef => {
|
|
|
72
99
|
rowModel: pinnedRowsCache.idLookup[rowId],
|
|
73
100
|
rowId,
|
|
74
101
|
position: 'bottom',
|
|
75
|
-
apiRef
|
|
102
|
+
apiRef,
|
|
103
|
+
isAutoGenerated: false
|
|
76
104
|
});
|
|
77
|
-
}); // If row with the same `id` is present both in `rows` and `pinnedRows` - remove it from
|
|
105
|
+
}); // If row with the same `id` is present both in `rows` and `pinnedRows` - remove it from the root group children
|
|
78
106
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
107
|
+
if ((_pinnedRowsCache$bott2 = pinnedRowsCache.bottomIds) != null && _pinnedRowsCache$bott2.length || (_pinnedRowsCache$topI2 = pinnedRowsCache.topIds) != null && _pinnedRowsCache$topI2.length) {
|
|
108
|
+
const shouldKeepRow = rowId => {
|
|
109
|
+
if (newGroupingParams.tree[rowId] && newGroupingParams.tree[rowId].type === 'pinnedRow') {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return true;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const rootGroupNode = newGroupingParams.tree[GRID_ROOT_GROUP_ID];
|
|
117
|
+
newGroupingParams.tree[GRID_ROOT_GROUP_ID] = _extends({}, rootGroupNode, {
|
|
118
|
+
children: rootGroupNode.children.filter(shouldKeepRow)
|
|
119
|
+
});
|
|
120
|
+
newGroupingParams.dataRowIds = newGroupingParams.dataRowIds.filter(shouldKeepRow);
|
|
121
|
+
}
|
|
83
122
|
|
|
84
|
-
return true;
|
|
85
|
-
});
|
|
86
123
|
return newGroupingParams;
|
|
87
124
|
}, [apiRef]);
|
|
88
125
|
useGridRegisterPipeProcessor(apiRef, 'hydrateRows', addPinnedRows);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
3
|
-
import { useGridLogger, useGridApiEventHandler, getDataGridUtilityClass, useGridSelector, gridSortModelSelector,
|
|
3
|
+
import { useGridLogger, useGridApiEventHandler, getDataGridUtilityClass, useGridSelector, gridSortModelSelector, gridRowMaximumTreeDepthSelector, useGridApiOptionHandler, gridEditRowsStateSelector } from '@mui/x-data-grid';
|
|
4
4
|
|
|
5
5
|
const useUtilityClasses = ownerState => {
|
|
6
6
|
const {
|
|
@@ -20,7 +20,7 @@ const useUtilityClasses = ownerState => {
|
|
|
20
20
|
export const useGridRowReorder = (apiRef, props) => {
|
|
21
21
|
const logger = useGridLogger(apiRef, 'useGridRowReorder');
|
|
22
22
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
23
|
-
const treeDepth = useGridSelector(apiRef,
|
|
23
|
+
const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
24
24
|
const dragRowNode = React.useRef(null);
|
|
25
25
|
const originRowIndex = React.useRef(null);
|
|
26
26
|
const removeDnDStylesTimeout = React.useRef();
|
|
@@ -60,13 +60,13 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
60
60
|
originRowIndex.current = apiRef.current.getRowIndex(params.id);
|
|
61
61
|
}, [isRowReorderDisabled, classes.rowDragging, logger, apiRef]);
|
|
62
62
|
const handleDragOver = React.useCallback((params, event) => {
|
|
63
|
-
var _apiRef$current$getRo;
|
|
64
|
-
|
|
65
63
|
if (dragRowId === '') {
|
|
66
64
|
return;
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
|
|
67
|
+
const rowNode = apiRef.current.getRowNode(params.id);
|
|
68
|
+
|
|
69
|
+
if (!rowNode || rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -12,7 +12,7 @@ export const GRID_TREE_DATA_GROUPING_COL_DEF = _extends({}, GRID_STRING_COL_DEF,
|
|
|
12
12
|
disableReorder: true,
|
|
13
13
|
align: 'left',
|
|
14
14
|
width: 200,
|
|
15
|
-
valueGetter: params => params.rowNode.groupingKey
|
|
15
|
+
valueGetter: params => params.rowNode.type === 'group' ? params.rowNode.groupingKey : undefined
|
|
16
16
|
});
|
|
17
17
|
export const GRID_TREE_DATA_GROUPING_FIELD = '__tree_data_group__';
|
|
18
18
|
export const GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES = {
|
|
@@ -17,14 +17,12 @@ export const filterRowTreeFromTreeData = params => {
|
|
|
17
17
|
const filteredDescendantCountLookup = {};
|
|
18
18
|
|
|
19
19
|
const filterTreeNode = (node, isParentMatchingFilters, areAncestorsExpanded) => {
|
|
20
|
-
var _node$children;
|
|
21
|
-
|
|
22
20
|
const shouldSkipFilters = disableChildrenFiltering && node.depth > 0;
|
|
23
21
|
let isMatchingFilters;
|
|
24
22
|
|
|
25
23
|
if (shouldSkipFilters) {
|
|
26
24
|
isMatchingFilters = null;
|
|
27
|
-
} else if (!isRowMatchingFilters || node.
|
|
25
|
+
} else if (!isRowMatchingFilters || node.type === 'footer') {
|
|
28
26
|
isMatchingFilters = true;
|
|
29
27
|
} else {
|
|
30
28
|
const {
|
|
@@ -35,13 +33,17 @@ export const filterRowTreeFromTreeData = params => {
|
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
let filteredDescendantCount = 0;
|
|
38
|
-
(_node$children = node.children) == null ? void 0 : _node$children.forEach(childId => {
|
|
39
|
-
var _isMatchingFilters;
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
if (node.type === 'group') {
|
|
38
|
+
node.children.forEach(childId => {
|
|
39
|
+
var _isMatchingFilters;
|
|
40
|
+
|
|
41
|
+
const childNode = rowTree[childId];
|
|
42
|
+
const childSubTreeSize = filterTreeNode(childNode, (_isMatchingFilters = isMatchingFilters) != null ? _isMatchingFilters : isParentMatchingFilters, areAncestorsExpanded && !!node.childrenExpanded);
|
|
43
|
+
filteredDescendantCount += childSubTreeSize;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
45
47
|
let shouldPassFilters;
|
|
46
48
|
|
|
47
49
|
switch (isMatchingFilters) {
|
|
@@ -65,9 +67,9 @@ export const filterRowTreeFromTreeData = params => {
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
|
|
68
|
-
filteredRowsLookup[node.id] = shouldPassFilters;
|
|
70
|
+
filteredRowsLookup[node.id] = shouldPassFilters; // TODO: Should we keep storing the visibility status of footer independently or rely on the group visibility in the selector ?
|
|
69
71
|
|
|
70
|
-
if (node.footerId != null) {
|
|
72
|
+
if (node.type === 'group' && node.footerId != null) {
|
|
71
73
|
visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -77,7 +79,7 @@ export const filterRowTreeFromTreeData = params => {
|
|
|
77
79
|
|
|
78
80
|
filteredDescendantCountLookup[node.id] = filteredDescendantCount;
|
|
79
81
|
|
|
80
|
-
if (node.
|
|
82
|
+
if (node.type === 'footer') {
|
|
81
83
|
return filteredDescendantCount;
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useGridApiEventHandler
|
|
2
|
+
import { useGridApiEventHandler } from '@mui/x-data-grid';
|
|
3
3
|
export const useGridTreeData = apiRef => {
|
|
4
4
|
/**
|
|
5
5
|
* EVENTS
|
|
@@ -8,11 +8,7 @@ export const useGridTreeData = apiRef => {
|
|
|
8
8
|
const cellParams = apiRef.current.getCellParams(params.id, params.field);
|
|
9
9
|
|
|
10
10
|
if (cellParams.colDef.type === 'treeDataGroup' && event.key === ' ' && !event.shiftKey) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const filteredDescendantCount = (_gridFilteredDescenda = gridFilteredDescendantCountLookupSelector(apiRef)[params.id]) != null ? _gridFilteredDescenda : 0;
|
|
14
|
-
|
|
15
|
-
if (filteredDescendantCount === 0) {
|
|
11
|
+
if (params.rowNode.type !== 'group') {
|
|
16
12
|
return;
|
|
17
13
|
}
|
|
18
14
|
|
|
@@ -2,13 +2,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["hideDescendantCount"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid';
|
|
6
6
|
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
|
|
7
7
|
import { GRID_TREE_DATA_GROUPING_COL_DEF, GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES } from './gridTreeDataGroupColDef';
|
|
8
8
|
import { filterRowTreeFromTreeData, TREE_DATA_STRATEGY } from './gridTreeDataUtils';
|
|
9
9
|
import { GridTreeDataGroupingCell } from '../../../components';
|
|
10
|
-
import {
|
|
10
|
+
import { createRowTree } from '../../../utils/tree/createRowTree';
|
|
11
11
|
import { sortRowTree } from '../../../utils/tree/sortRowTree';
|
|
12
|
+
import { updateRowTree } from '../../../utils/tree/updateRowTree';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
export const useGridTreeDataPreProcessors = (apiRef, props) => {
|
|
14
15
|
const setStrategyAvailability = React.useCallback(() => {
|
|
@@ -71,28 +72,45 @@ export const useGridTreeDataPreProcessors = (apiRef, props) => {
|
|
|
71
72
|
|
|
72
73
|
return columnsState;
|
|
73
74
|
}, [props.treeData, getGroupingColDef]);
|
|
74
|
-
const
|
|
75
|
+
const createRowTreeForTreeData = React.useCallback(params => {
|
|
75
76
|
if (!props.getTreeDataPath) {
|
|
76
77
|
throw new Error('MUI: No getTreeDataPath given.');
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
const
|
|
80
|
+
const getRowTreeBuilderNode = rowId => ({
|
|
80
81
|
id: rowId,
|
|
81
|
-
path: props.getTreeDataPath(params.
|
|
82
|
+
path: props.getTreeDataPath(params.dataRowIdToModelLookup[rowId]).map(key => ({
|
|
82
83
|
key,
|
|
83
84
|
field: null
|
|
84
85
|
}))
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const onDuplicatePath = (firstId, secondId, path) => {
|
|
89
|
+
throw new Error(['MUI: The path returned by `getTreeDataPath` should be unique.', `The rows with id #${firstId} and #${secondId} have the same.`, `Path: ${JSON.stringify(path.map(step => step.key))}.`].join('\n'));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
if (params.updates.type === 'full') {
|
|
93
|
+
return createRowTree({
|
|
94
|
+
nodes: params.updates.rows.map(getRowTreeBuilderNode),
|
|
95
|
+
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
96
|
+
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
97
|
+
groupingName: TREE_DATA_STRATEGY,
|
|
98
|
+
onDuplicatePath
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return updateRowTree({
|
|
103
|
+
nodes: {
|
|
104
|
+
inserted: params.updates.actions.insert.map(getRowTreeBuilderNode),
|
|
105
|
+
modified: params.updates.actions.modify.map(getRowTreeBuilderNode),
|
|
106
|
+
removed: params.updates.actions.remove
|
|
107
|
+
},
|
|
108
|
+
previousTree: params.previousTree,
|
|
109
|
+
previousTreeDepth: params.previousTreeDepths,
|
|
89
110
|
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
90
111
|
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
91
|
-
groupingName: TREE_DATA_STRATEGY
|
|
92
|
-
|
|
93
|
-
throw new Error(['MUI: The path returned by `getTreeDataPath` should be unique.', `The rows with id #${firstId} and #${secondId} have the same.`, `Path: ${JSON.stringify(path.map(step => step.key))}.`].join('\n'));
|
|
94
|
-
}
|
|
95
|
-
}));
|
|
112
|
+
groupingName: TREE_DATA_STRATEGY
|
|
113
|
+
});
|
|
96
114
|
}, [props.getTreeDataPath, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
97
115
|
const filterRows = React.useCallback(params => {
|
|
98
116
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
@@ -106,16 +124,15 @@ export const useGridTreeDataPreProcessors = (apiRef, props) => {
|
|
|
106
124
|
}, [apiRef, props.disableChildrenFiltering]);
|
|
107
125
|
const sortRows = React.useCallback(params => {
|
|
108
126
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
109
|
-
const rowIds = gridRowIdsSelector(apiRef);
|
|
110
127
|
return sortRowTree({
|
|
111
128
|
rowTree,
|
|
112
|
-
rowIds,
|
|
113
129
|
sortRowList: params.sortRowList,
|
|
114
|
-
disableChildrenSorting: props.disableChildrenSorting
|
|
130
|
+
disableChildrenSorting: props.disableChildrenSorting,
|
|
131
|
+
shouldRenderGroupBelowLeaves: false
|
|
115
132
|
});
|
|
116
133
|
}, [apiRef, props.disableChildrenSorting]);
|
|
117
134
|
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
|
|
118
|
-
useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'rowTreeCreation',
|
|
135
|
+
useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'rowTreeCreation', createRowTreeForTreeData);
|
|
119
136
|
useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'filtering', filterRows);
|
|
120
137
|
useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'sorting', sortRows);
|
|
121
138
|
/**
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils
|
|
|
16
16
|
export { useGridRowPinning, rowPinningStateInitializer, } from '../hooks/features/rowPinning/useGridRowPinning';
|
|
17
17
|
export { useGridRowPinningPreProcessors, addPinnedRow, } from '../hooks/features/rowPinning/useGridRowPinningPreProcessors';
|
|
18
18
|
export type { GridExperimentalProFeatures, DataGridProPropsWithoutDefaultValue, DataGridProPropsWithDefaultValue, } from '../models/dataGridProProps';
|
|
19
|
-
export {
|
|
20
|
-
export
|
|
19
|
+
export { createRowTree } from '../utils/tree/createRowTree';
|
|
20
|
+
export { updateRowTree } from '../utils/tree/updateRowTree';
|
|
21
21
|
export { sortRowTree } from '../utils/tree/sortRowTree';
|
|
22
|
+
export { insertNodeInTree, removeNodeFromTree } from '../utils/tree/utils';
|
|
23
|
+
export type { RowTreeBuilderGroupingCriterion } from '../utils/tree/models';
|
package/internals/index.js
CHANGED
|
@@ -15,5 +15,7 @@ export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGrid
|
|
|
15
15
|
export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils';
|
|
16
16
|
export { useGridRowPinning, rowPinningStateInitializer } from '../hooks/features/rowPinning/useGridRowPinning';
|
|
17
17
|
export { useGridRowPinningPreProcessors, addPinnedRow } from '../hooks/features/rowPinning/useGridRowPinningPreProcessors';
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
18
|
+
export { createRowTree } from '../utils/tree/createRowTree';
|
|
19
|
+
export { updateRowTree } from '../utils/tree/updateRowTree';
|
|
20
|
+
export { sortRowTree } from '../utils/tree/sortRowTree';
|
|
21
|
+
export { insertNodeInTree, removeNodeFromTree } from '../utils/tree/utils';
|
|
@@ -437,7 +437,7 @@ DataGridProRaw.propTypes = {
|
|
|
437
437
|
/**
|
|
438
438
|
* Determines if a group should be expanded after its creation.
|
|
439
439
|
* This prop takes priority over the `defaultGroupingExpansionDepth` prop.
|
|
440
|
-
* @param {
|
|
440
|
+
* @param {GridGroupNode} node The node of the group to test.
|
|
441
441
|
* @returns {boolean} A boolean indicating if the group is expanded.
|
|
442
442
|
*/
|
|
443
443
|
isGroupExpandedByDefault: PropTypes.func,
|
|
@@ -615,16 +615,6 @@ DataGridProRaw.propTypes = {
|
|
|
615
615
|
*/
|
|
616
616
|
onColumnResize: PropTypes.func,
|
|
617
617
|
|
|
618
|
-
/**
|
|
619
|
-
* Callback fired when a column visibility changes.
|
|
620
|
-
* Only works when no `columnVisibilityModel` is provided and if we change the visibility of a single column at a time.
|
|
621
|
-
* @param {GridColumnVisibilityChangeParams} params With all properties from [[GridColumnVisibilityChangeParams]].
|
|
622
|
-
* @param {MuiEvent<{}>} event The event object.
|
|
623
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
624
|
-
* @deprecated Use `onColumnVisibilityModelChange` instead.
|
|
625
|
-
*/
|
|
626
|
-
onColumnVisibilityChange: PropTypes.func,
|
|
627
|
-
|
|
628
618
|
/**
|
|
629
619
|
* Callback fired when the column visibility model changes.
|
|
630
620
|
* @param {GridColumnVisibilityModel} model The new model.
|
|
@@ -876,8 +866,8 @@ DataGridProRaw.propTypes = {
|
|
|
876
866
|
* Rows data to pin on top or bottom.
|
|
877
867
|
*/
|
|
878
868
|
pinnedRows: PropTypes.shape({
|
|
879
|
-
bottom: PropTypes.
|
|
880
|
-
top: PropTypes.
|
|
869
|
+
bottom: PropTypes.arrayOf(PropTypes.object),
|
|
870
|
+
top: PropTypes.arrayOf(PropTypes.object)
|
|
881
871
|
}),
|
|
882
872
|
|
|
883
873
|
/**
|
|
@@ -922,7 +912,7 @@ DataGridProRaw.propTypes = {
|
|
|
922
912
|
/**
|
|
923
913
|
* Set of rows of type [[GridRowsProp]].
|
|
924
914
|
*/
|
|
925
|
-
rows: PropTypes.
|
|
915
|
+
rows: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
926
916
|
|
|
927
917
|
/**
|
|
928
918
|
* Loading rows can be processed on the server or client-side.
|
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useThemeProps } from '@mui/material/styles';
|
|
5
|
-
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES
|
|
5
|
+
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The default values of `DataGridProPropsWithDefaultValue` to inject in the props of DataGridPro.
|
|
@@ -15,7 +15,7 @@ export var DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_DEF
|
|
|
15
15
|
disableChildrenFiltering: false,
|
|
16
16
|
disableChildrenSorting: false,
|
|
17
17
|
rowReordering: false,
|
|
18
|
-
rowsLoadingMode:
|
|
18
|
+
rowsLoadingMode: 'client',
|
|
19
19
|
getDetailPanelHeight: function getDetailPanelHeight() {
|
|
20
20
|
return 500;
|
|
21
21
|
}
|
|
@@ -7,7 +7,7 @@ var _excluded = ["className", "disableVirtualization"];
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { styled, alpha } from '@mui/material/styles';
|
|
9
9
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
10
|
-
import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler } from '@mui/x-data-grid';
|
|
10
|
+
import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler, GridOverlays } from '@mui/x-data-grid';
|
|
11
11
|
import { GridVirtualScroller, GridVirtualScrollerContent, GridVirtualScrollerRenderZone, useGridVirtualScroller, calculatePinnedRowsHeight } from '@mui/x-data-grid/internals';
|
|
12
12
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
13
13
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
@@ -312,7 +312,7 @@ var DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
return /*#__PURE__*/_jsxs(GridVirtualScroller, _extends({}, getRootProps(other), {
|
|
315
|
-
children: [topPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
|
|
315
|
+
children: [/*#__PURE__*/_jsx(GridOverlays, {}), topPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
|
|
316
316
|
className: classes.topPinnedRows,
|
|
317
317
|
ownerState: {
|
|
318
318
|
position: 'top'
|
|
@@ -112,7 +112,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
112
112
|
/**
|
|
113
113
|
* The row model of the row that the current cell belongs to.
|
|
114
114
|
*/
|
|
115
|
-
row: PropTypes.
|
|
115
|
+
row: PropTypes.any.isRequired,
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* The node of the row that the current cell belongs to.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
|
-
import {
|
|
4
|
+
import { gridRowMaximumTreeDepthSelector, gridSortModelSelector, useGridApiContext, useGridSelector, getDataGridUtilityClass, gridEditRowsStateSelector } from '@mui/x-data-grid';
|
|
5
5
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -17,12 +17,10 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
var GridRowReorderCell = function GridRowReorderCell(params) {
|
|
20
|
-
var _params$rowNode$posit;
|
|
21
|
-
|
|
22
20
|
var apiRef = useGridApiContext();
|
|
23
21
|
var rootProps = useGridRootProps();
|
|
24
22
|
var sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
25
|
-
var treeDepth = useGridSelector(apiRef,
|
|
23
|
+
var treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
26
24
|
var editRowsState = useGridSelector(apiRef, gridEditRowsStateSelector); // eslint-disable-next-line no-underscore-dangle
|
|
27
25
|
|
|
28
26
|
var cellValue = params.row.__reorder__ || params.id; // TODO: remove sortModel and treeDepth checks once row reorder is compatible
|
|
@@ -62,7 +60,7 @@ var GridRowReorderCell = function GridRowReorderCell(params) {
|
|
|
62
60
|
onDragEnd: publish('rowDragEnd')
|
|
63
61
|
} : null;
|
|
64
62
|
|
|
65
|
-
if (
|
|
63
|
+
if (params.rowNode.type === 'footer') {
|
|
66
64
|
return null;
|
|
67
65
|
}
|
|
68
66
|
|
|
@@ -79,7 +77,7 @@ var GridRowReorderCell = function GridRowReorderCell(params) {
|
|
|
79
77
|
|
|
80
78
|
export { GridRowReorderCell };
|
|
81
79
|
export var renderRowReorderCell = function renderRowReorderCell(params) {
|
|
82
|
-
if (params.rowNode.
|
|
80
|
+
if (params.rowNode.type === 'footer' || params.rowNode.type === 'pinnedRow') {
|
|
83
81
|
return null;
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -147,7 +147,7 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
147
147
|
/**
|
|
148
148
|
* The row model of the row that the current cell belongs to.
|
|
149
149
|
*/
|
|
150
|
-
row: PropTypes.
|
|
150
|
+
row: PropTypes.any.isRequired,
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* The node of the row that the current cell belongs to.
|