@mui/x-data-grid-pro 5.11.1 → 5.12.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 +199 -20
- package/DataGridPro/DataGridPro.js +26 -27
- package/DataGridPro/useDataGridProComponent.js +1 -8
- package/DataGridPro/useDataGridProProps.js +6 -27
- package/README.md +2 -2
- package/components/DataGridProColumnHeaders.js +10 -7
- package/components/DataGridProVirtualScroller.d.ts +1 -1
- package/components/DataGridProVirtualScroller.js +6 -3
- package/components/GridRowReorderCell.js +6 -6
- package/hooks/features/columnPinning/gridColumnPinningInterface.d.ts +6 -0
- package/hooks/features/columnPinning/useGridColumnPinning.d.ts +1 -1
- package/hooks/features/columnPinning/useGridColumnPinning.js +73 -28
- package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +67 -4
- package/hooks/features/columnResize/useGridColumnResize.js +32 -15
- package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -2
- package/hooks/features/detailPanel/useGridDetailPanel.d.ts +1 -1
- package/hooks/features/detailPanel/useGridDetailPanel.js +78 -18
- package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +5 -2
- package/hooks/features/rowReorder/useGridRowReorder.js +5 -1
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +2 -2
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/index.d.ts +0 -2
- package/index.js +2 -5
- package/internals/index.d.ts +0 -1
- package/internals/index.js +0 -1
- package/legacy/DataGridPro/DataGridPro.js +26 -27
- package/legacy/DataGridPro/useDataGridProComponent.js +1 -8
- package/legacy/DataGridPro/useDataGridProProps.js +1 -20
- package/legacy/components/DataGridProColumnHeaders.js +10 -7
- package/legacy/components/DataGridProVirtualScroller.js +6 -3
- package/legacy/components/GridRowReorderCell.js +8 -6
- package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +82 -33
- package/legacy/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +70 -5
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +32 -15
- package/legacy/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +3 -1
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +78 -18
- package/legacy/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +5 -2
- package/legacy/hooks/features/rowReorder/useGridRowReorder.js +5 -1
- package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/legacy/index.js +2 -5
- package/legacy/internals/index.js +0 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridProProps.d.ts +0 -26
- package/models/gridApiPro.d.ts +1 -2
- package/models/gridStatePro.d.ts +0 -3
- package/modern/DataGridPro/DataGridPro.js +26 -27
- package/modern/DataGridPro/useDataGridProComponent.js +1 -8
- package/modern/DataGridPro/useDataGridProProps.js +1 -16
- package/modern/components/DataGridProColumnHeaders.js +11 -6
- package/modern/components/DataGridProVirtualScroller.js +6 -3
- package/modern/components/GridRowReorderCell.js +6 -6
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +73 -28
- package/modern/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +67 -4
- package/modern/hooks/features/columnResize/useGridColumnResize.js +32 -15
- package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -2
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +76 -16
- package/modern/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +5 -2
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +5 -1
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/modern/index.js +2 -5
- package/modern/internals/index.js +0 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPro/DataGridPro.js +26 -27
- package/node/DataGridPro/useDataGridProComponent.js +1 -11
- package/node/DataGridPro/useDataGridProProps.js +6 -28
- package/node/components/DataGridProColumnHeaders.js +11 -7
- package/node/components/DataGridProVirtualScroller.js +6 -3
- package/node/components/GridRowReorderCell.js +6 -6
- package/node/hooks/features/columnPinning/useGridColumnPinning.js +72 -24
- package/node/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +68 -5
- package/node/hooks/features/columnResize/useGridColumnResize.js +32 -14
- package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -2
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +76 -17
- package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +8 -2
- package/node/hooks/features/rowReorder/useGridRowReorder.js +5 -1
- package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +1 -1
- package/node/index.js +2 -30
- package/node/internals/index.js +0 -9
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +8 -7
- package/typeOverloads/modules.d.ts +9 -21
- package/utils/releaseInfo.js +1 -1
- package/components/GridGroupingColumnLeafCell.d.ts +0 -4
- package/components/GridGroupingColumnLeafCell.js +0 -22
- package/components/GridGroupingCriteriaCell.d.ts +0 -7
- package/components/GridGroupingCriteriaCell.js +0 -78
- package/components/GridRowGroupableColumnMenuItems.d.ts +0 -11
- package/components/GridRowGroupableColumnMenuItems.js +0 -63
- package/components/GridRowGroupingColumnMenuItems.d.ts +0 -11
- package/components/GridRowGroupingColumnMenuItems.js +0 -58
- package/hooks/features/detailPanel/useGridDetailPanelCache.d.ts +0 -4
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +0 -57
- package/hooks/features/rowGrouping/createGroupingColDef.d.ts +0 -43
- package/hooks/features/rowGrouping/createGroupingColDef.js +0 -318
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +0 -37
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +0 -1
- package/hooks/features/rowGrouping/gridRowGroupingSelector.d.ts +0 -4
- package/hooks/features/rowGrouping/gridRowGroupingSelector.js +0 -5
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +0 -27
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +0 -139
- package/hooks/features/rowGrouping/index.d.ts +0 -3
- package/hooks/features/rowGrouping/index.js +0 -3
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +0 -11
- package/hooks/features/rowGrouping/useGridRowGrouping.js +0 -200
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +0 -4
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +0 -203
- package/legacy/components/GridGroupingColumnLeafCell.js +0 -20
- package/legacy/components/GridGroupingCriteriaCell.js +0 -74
- package/legacy/components/GridRowGroupableColumnMenuItems.js +0 -61
- package/legacy/components/GridRowGroupingColumnMenuItems.js +0 -56
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +0 -57
- package/legacy/hooks/features/rowGrouping/createGroupingColDef.js +0 -319
- package/legacy/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +0 -1
- package/legacy/hooks/features/rowGrouping/gridRowGroupingSelector.js +0 -13
- package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +0 -147
- package/legacy/hooks/features/rowGrouping/index.js +0 -3
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +0 -206
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +0 -217
- package/legacy/models/gridGroupingValueGetterParams.js +0 -1
- package/models/gridGroupingValueGetterParams.d.ts +0 -31
- package/models/gridGroupingValueGetterParams.js +0 -1
- package/modern/components/GridGroupingColumnLeafCell.js +0 -20
- package/modern/components/GridGroupingCriteriaCell.js +0 -76
- package/modern/components/GridRowGroupableColumnMenuItems.js +0 -61
- package/modern/components/GridRowGroupingColumnMenuItems.js +0 -56
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +0 -57
- package/modern/hooks/features/rowGrouping/createGroupingColDef.js +0 -302
- package/modern/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +0 -1
- package/modern/hooks/features/rowGrouping/gridRowGroupingSelector.js +0 -5
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +0 -137
- package/modern/hooks/features/rowGrouping/index.js +0 -3
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +0 -192
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +0 -203
- package/modern/models/gridGroupingValueGetterParams.js +0 -1
- package/node/components/GridGroupingColumnLeafCell.js +0 -38
- package/node/components/GridGroupingCriteriaCell.js +0 -99
- package/node/components/GridRowGroupableColumnMenuItems.js +0 -82
- package/node/components/GridRowGroupingColumnMenuItems.js +0 -78
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +0 -74
- package/node/hooks/features/rowGrouping/createGroupingColDef.js +0 -341
- package/node/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +0 -5
- package/node/hooks/features/rowGrouping/gridRowGroupingSelector.js +0 -18
- package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +0 -172
- package/node/hooks/features/rowGrouping/index.js +0 -51
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +0 -228
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +0 -227
- package/node/models/gridGroupingValueGetterParams.js +0 -5
|
@@ -27,7 +27,6 @@ const GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
|
27
27
|
exports.GRID_DETAIL_PANEL_TOGGLE_FIELD = GRID_DETAIL_PANEL_TOGGLE_FIELD;
|
|
28
28
|
const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = (0, _extends2.default)({}, _xDataGrid.GRID_STRING_COL_DEF, {
|
|
29
29
|
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
30
|
-
headerName: '',
|
|
31
30
|
type: 'detailPanelToggle',
|
|
32
31
|
editable: false,
|
|
33
32
|
sortable: false,
|
|
@@ -42,6 +41,7 @@ const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = (0, _extends2.default)({}, _xDataGrid.G
|
|
|
42
41
|
const expandedRowIds = (0, _gridDetailPanelSelector.gridDetailPanelExpandedRowIdsSelector)(params.api.state);
|
|
43
42
|
return expandedRowIds.includes(params.id);
|
|
44
43
|
},
|
|
45
|
-
renderCell: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridDetailPanelToggleCell.GridDetailPanelToggleCell, (0, _extends2.default)({}, params))
|
|
44
|
+
renderCell: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridDetailPanelToggleCell.GridDetailPanelToggleCell, (0, _extends2.default)({}, params)),
|
|
45
|
+
renderHeader: () => null
|
|
46
46
|
});
|
|
47
47
|
exports.GRID_DETAIL_PANEL_TOGGLE_COL_DEF = GRID_DETAIL_PANEL_TOGGLE_COL_DEF;
|
|
@@ -35,6 +35,34 @@ const detailPanelStateInitializer = (state, props) => {
|
|
|
35
35
|
|
|
36
36
|
exports.detailPanelStateInitializer = detailPanelStateInitializer;
|
|
37
37
|
|
|
38
|
+
function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeight) {
|
|
39
|
+
if (typeof getDetailPanelContent !== 'function') {
|
|
40
|
+
return {};
|
|
41
|
+
} // TODO change to lazy approach using a Proxy
|
|
42
|
+
// only call getDetailPanelContent when asked for an id
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const rowIds = (0, _xDataGrid.gridRowIdsSelector)(apiRef);
|
|
46
|
+
const contentCache = rowIds.reduce((acc, id) => {
|
|
47
|
+
const params = apiRef.current.getRowParams(id);
|
|
48
|
+
acc[id] = getDetailPanelContent(params);
|
|
49
|
+
return acc;
|
|
50
|
+
}, {});
|
|
51
|
+
const heightCache = rowIds.reduce((acc, id) => {
|
|
52
|
+
if (contentCache[id] == null) {
|
|
53
|
+
return acc;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const params = apiRef.current.getRowParams(id);
|
|
57
|
+
acc[id] = getDetailPanelHeight(params);
|
|
58
|
+
return acc;
|
|
59
|
+
}, {});
|
|
60
|
+
return {
|
|
61
|
+
contentCache,
|
|
62
|
+
heightCache
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
38
66
|
const useGridDetailPanel = (apiRef, props) => {
|
|
39
67
|
const expandedRowIds = (0, _xDataGrid.useGridSelector)(apiRef, _gridDetailPanelSelector.gridDetailPanelExpandedRowIdsSelector);
|
|
40
68
|
const contentCache = (0, _xDataGrid.useGridSelector)(apiRef, _gridDetailPanelSelector.gridDetailPanelExpandedRowsContentCacheSelector);
|
|
@@ -73,23 +101,7 @@ const useGridDetailPanel = (apiRef, props) => {
|
|
|
73
101
|
}, [apiRef, props.getDetailPanelContent]);
|
|
74
102
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'cellClick', handleCellClick);
|
|
75
103
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
76
|
-
|
|
77
|
-
var _heightCache$row$id;
|
|
78
|
-
|
|
79
|
-
if (expandedRowIds.length === 0 || !expandedRowIds.includes(row.id)) {
|
|
80
|
-
return (0, _extends2.default)({}, initialValue, {
|
|
81
|
-
detail: 0
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const heightCache = (0, _gridDetailPanelSelector.gridDetailPanelExpandedRowsHeightCacheSelector)(apiRef.current.state);
|
|
86
|
-
return (0, _extends2.default)({}, initialValue, {
|
|
87
|
-
detail: (_heightCache$row$id = heightCache[row.id]) != null ? _heightCache$row$id : 0 // Fallback to zero because the cache might not be ready yet (e.g. page was changed)
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
}, [apiRef, expandedRowIds]);
|
|
91
|
-
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'rowHeight', addDetailHeight);
|
|
92
|
-
apiRef.current.unstable_updateControlState({
|
|
104
|
+
apiRef.current.unstable_registerControlState({
|
|
93
105
|
stateId: 'detailPanels',
|
|
94
106
|
propModel: props.detailPanelExpandedRowIds,
|
|
95
107
|
propOnChange: props.onDetailPanelExpandedRowIdsChange,
|
|
@@ -136,6 +148,53 @@ const useGridDetailPanel = (apiRef, props) => {
|
|
|
136
148
|
}
|
|
137
149
|
}
|
|
138
150
|
}, [apiRef, props.detailPanelExpandedRowIds]);
|
|
151
|
+
const updateCachesAndForceUpdate = React.useCallback(() => {
|
|
152
|
+
apiRef.current.setState(state => {
|
|
153
|
+
return (0, _extends2.default)({}, state, {
|
|
154
|
+
detailPanel: (0, _extends2.default)({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight))
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
apiRef.current.forceUpdate();
|
|
158
|
+
}, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
|
|
159
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'sortedRowsSet', updateCachesAndForceUpdate);
|
|
160
|
+
const previousGetDetailPanelContentProp = React.useRef();
|
|
161
|
+
const previousGetDetailPanelHeightProp = React.useRef();
|
|
162
|
+
const updateCachesIfNeeded = React.useCallback(() => {
|
|
163
|
+
if (props.getDetailPanelContent === previousGetDetailPanelContentProp.current && props.getDetailPanelHeight === previousGetDetailPanelHeightProp.current) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
apiRef.current.setState(state => {
|
|
168
|
+
return (0, _extends2.default)({}, state, {
|
|
169
|
+
detailPanel: (0, _extends2.default)({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight))
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
previousGetDetailPanelContentProp.current = props.getDetailPanelContent;
|
|
173
|
+
previousGetDetailPanelHeightProp.current = props.getDetailPanelHeight;
|
|
174
|
+
}, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
|
|
175
|
+
const addDetailHeight = React.useCallback((initialValue, row) => {
|
|
176
|
+
var _heightCache$row$id;
|
|
177
|
+
|
|
178
|
+
if (!expandedRowIds || expandedRowIds.length === 0 || !expandedRowIds.includes(row.id)) {
|
|
179
|
+
return (0, _extends2.default)({}, initialValue, {
|
|
180
|
+
detail: 0
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
updateCachesIfNeeded();
|
|
185
|
+
const heightCache = (0, _gridDetailPanelSelector.gridDetailPanelExpandedRowsHeightCacheSelector)(apiRef.current.state);
|
|
186
|
+
return (0, _extends2.default)({}, initialValue, {
|
|
187
|
+
detail: (_heightCache$row$id = heightCache[row.id]) != null ? _heightCache$row$id : 0 // Fallback to zero because the cache might not be ready yet (e.g. page was changed)
|
|
188
|
+
|
|
189
|
+
});
|
|
190
|
+
}, [apiRef, expandedRowIds, updateCachesIfNeeded]);
|
|
191
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'rowHeight', addDetailHeight);
|
|
192
|
+
const isFirstRender = React.useRef(true);
|
|
193
|
+
|
|
194
|
+
if (isFirstRender.current) {
|
|
195
|
+
isFirstRender.current = false;
|
|
196
|
+
updateCachesIfNeeded();
|
|
197
|
+
}
|
|
139
198
|
};
|
|
140
199
|
|
|
141
200
|
exports.useGridDetailPanel = useGridDetailPanel;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.useGridDetailPanelPreProcessors = void 0;
|
|
7
9
|
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
8
12
|
var React = _interopRequireWildcard(require("react"));
|
|
9
13
|
|
|
10
14
|
var _internals = require("@mui/x-data-grid/internals");
|
|
@@ -35,9 +39,11 @@ const useGridDetailPanelPreProcessors = (apiRef, props) => {
|
|
|
35
39
|
|
|
36
40
|
|
|
37
41
|
columnsState.all = [_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.all];
|
|
38
|
-
columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD] = _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_COL_DEF
|
|
42
|
+
columnsState.lookup[_gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD] = (0, _extends2.default)({}, _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_COL_DEF, {
|
|
43
|
+
headerName: apiRef.current.getLocaleText('detailPanelToggle')
|
|
44
|
+
});
|
|
39
45
|
return columnsState;
|
|
40
|
-
}, [props.getDetailPanelContent]);
|
|
46
|
+
}, [apiRef, props.getDetailPanelContent]);
|
|
41
47
|
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'hydrateColumns', addToggleColumn);
|
|
42
48
|
};
|
|
43
49
|
|
|
@@ -73,6 +73,10 @@ const useGridRowReorder = (apiRef, props) => {
|
|
|
73
73
|
originRowIndex.current = apiRef.current.getRowIndex(params.id);
|
|
74
74
|
}, [isRowReorderDisabled, classes.rowDragging, logger, apiRef]);
|
|
75
75
|
const handleDragOver = React.useCallback((params, event) => {
|
|
76
|
+
if (dragRowId === '') {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
76
80
|
logger.debug(`Dragging over row ${params.id}`);
|
|
77
81
|
event.preventDefault(); // Prevent drag events propagation.
|
|
78
82
|
// For more information check here https://github.com/mui/mui-x/issues/2680.
|
|
@@ -88,7 +92,7 @@ const useGridRowReorder = (apiRef, props) => {
|
|
|
88
92
|
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
89
93
|
const editRowsState = (0, _xDataGrid.gridEditRowsStateSelector)(apiRef.current.state);
|
|
90
94
|
|
|
91
|
-
if (isRowReorderDisabled || Object.keys(editRowsState).length !== 0) {
|
|
95
|
+
if (dragRowId === '' || isRowReorderDisabled || Object.keys(editRowsState).length !== 0) {
|
|
92
96
|
return;
|
|
93
97
|
}
|
|
94
98
|
|
|
@@ -85,7 +85,7 @@ const useGridTreeDataPreProcessors = (apiRef, props) => {
|
|
|
85
85
|
columnsState.lookup[groupingColDefField] = newGroupingColumn;
|
|
86
86
|
|
|
87
87
|
if (prevGroupingColumn == null) {
|
|
88
|
-
const index = columnsState.all[0] ===
|
|
88
|
+
const index = columnsState.all[0] === _xDataGrid.GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
|
|
89
89
|
columnsState.all = [...columnsState.all.slice(0, index), groupingColDefField, ...columnsState.all.slice(index)];
|
|
90
90
|
}
|
|
91
91
|
} else if (!shouldHaveGroupingColumn && prevGroupingColumn) {
|
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.12.2
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -225,32 +225,4 @@ Object.keys(_utils2).forEach(function (key) {
|
|
|
225
225
|
});
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
-
var _reexports = require("./typeOverloads/reexports");
|
|
229
|
-
|
|
230
|
-
var _rowGrouping = require("./hooks/features/rowGrouping");
|
|
231
|
-
|
|
232
|
-
Object.keys(_rowGrouping).forEach(function (key) {
|
|
233
|
-
if (key === "default" || key === "__esModule") return;
|
|
234
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
235
|
-
if (key in exports && exports[key] === _rowGrouping[key]) return;
|
|
236
|
-
Object.defineProperty(exports, key, {
|
|
237
|
-
enumerable: true,
|
|
238
|
-
get: function () {
|
|
239
|
-
return _rowGrouping[key];
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
var _gridGroupingValueGetterParams = require("./models/gridGroupingValueGetterParams");
|
|
245
|
-
|
|
246
|
-
Object.keys(_gridGroupingValueGetterParams).forEach(function (key) {
|
|
247
|
-
if (key === "default" || key === "__esModule") return;
|
|
248
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
249
|
-
if (key in exports && exports[key] === _gridGroupingValueGetterParams[key]) return;
|
|
250
|
-
Object.defineProperty(exports, key, {
|
|
251
|
-
enumerable: true,
|
|
252
|
-
get: function () {
|
|
253
|
-
return _gridGroupingValueGetterParams[key];
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
});
|
|
228
|
+
var _reexports = require("./typeOverloads/reexports");
|
package/node/internals/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var _exportNames = {
|
|
|
15
15
|
columnReorderStateInitializer: true,
|
|
16
16
|
useGridDetailPanel: true,
|
|
17
17
|
detailPanelStateInitializer: true,
|
|
18
|
-
useGridDetailPanelCache: true,
|
|
19
18
|
useGridDetailPanelPreProcessors: true,
|
|
20
19
|
useGridInfiniteLoader: true,
|
|
21
20
|
useGridRowReorder: true,
|
|
@@ -103,12 +102,6 @@ Object.defineProperty(exports, "useGridDetailPanel", {
|
|
|
103
102
|
return _useGridDetailPanel.useGridDetailPanel;
|
|
104
103
|
}
|
|
105
104
|
});
|
|
106
|
-
Object.defineProperty(exports, "useGridDetailPanelCache", {
|
|
107
|
-
enumerable: true,
|
|
108
|
-
get: function () {
|
|
109
|
-
return _useGridDetailPanelCache.useGridDetailPanelCache;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
105
|
Object.defineProperty(exports, "useGridDetailPanelPreProcessors", {
|
|
113
106
|
enumerable: true,
|
|
114
107
|
get: function () {
|
|
@@ -174,8 +167,6 @@ var _useGridColumnReorder = require("../hooks/features/columnReorder/useGridColu
|
|
|
174
167
|
|
|
175
168
|
var _useGridDetailPanel = require("../hooks/features/detailPanel/useGridDetailPanel");
|
|
176
169
|
|
|
177
|
-
var _useGridDetailPanelCache = require("../hooks/features/detailPanel/useGridDetailPanelCache");
|
|
178
|
-
|
|
179
170
|
var _useGridDetailPanelPreProcessors = require("../hooks/features/detailPanel/useGridDetailPanelPreProcessors");
|
|
180
171
|
|
|
181
172
|
var _useGridInfiniteLoader = require("../hooks/features/infiniteLoader/useGridInfiniteLoader");
|
|
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
|
|
|
8
8
|
var _utils = require("@mui/utils");
|
|
9
9
|
|
|
10
10
|
const getReleaseInfo = () => {
|
|
11
|
-
const releaseInfo = "
|
|
11
|
+
const releaseInfo = "MTY1NTMzMDQwMDAwMA==";
|
|
12
12
|
|
|
13
13
|
if (process.env.NODE_ENV !== 'production') {
|
|
14
14
|
// A simple hack to set the value in the test environment (has no build step).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-pro",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.2",
|
|
4
4
|
"description": "The Pro plan edition of the data grid component (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -32,18 +32,19 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.17.2",
|
|
35
|
-
"@mui/utils": "^5.
|
|
36
|
-
"@mui/x-data-grid": "5.
|
|
37
|
-
"@mui/x-license-pro": "5.
|
|
35
|
+
"@mui/utils": "^5.4.1",
|
|
36
|
+
"@mui/x-data-grid": "5.12.2",
|
|
37
|
+
"@mui/x-license-pro": "5.12.2",
|
|
38
38
|
"@types/format-util": "^1.0.2",
|
|
39
39
|
"clsx": "^1.0.4",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
41
|
"reselect": "^4.1.5"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@mui/material": "^5.
|
|
45
|
-
"@mui/system": "^5.
|
|
46
|
-
"react": "^17.0.2 || ^18.0.0"
|
|
44
|
+
"@mui/material": "^5.4.1",
|
|
45
|
+
"@mui/system": "^5.4.1",
|
|
46
|
+
"react": "^17.0.2 || ^18.0.0",
|
|
47
|
+
"react-dom": "^17.0.2 || ^18.0.0"
|
|
47
48
|
},
|
|
48
49
|
"setupFiles": [
|
|
49
50
|
"<rootDir>/src/setupTests.js"
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GridRowId } from '@mui/x-data-grid';
|
|
2
2
|
import type { GridRowScrollEndParams, GridRowOrderChangeParams } from '../models';
|
|
3
|
-
import type { GridPinnedColumns } from '../hooks';
|
|
3
|
+
import type { GridColumnPinningInternalCache, GridPinnedColumns } from '../hooks/features/columnPinning/gridColumnPinningInterface';
|
|
4
4
|
import type { GridCanBeReorderedPreProcessingContext } from '../hooks/features/columnReorder/columnReorderInterfaces';
|
|
5
|
-
import { GridGroupingValueGetterParams } from '../models/gridGroupingValueGetterParams';
|
|
6
|
-
import { GridRowGroupingModel } from '../hooks/features/rowGrouping';
|
|
7
5
|
export interface GridControlledStateEventLookupPro {
|
|
8
6
|
/**
|
|
9
7
|
* Fired when the open detail panels are changed.
|
|
@@ -19,21 +17,6 @@ export interface GridControlledStateEventLookupPro {
|
|
|
19
17
|
pinnedColumnsChange: {
|
|
20
18
|
params: GridPinnedColumns;
|
|
21
19
|
};
|
|
22
|
-
/**
|
|
23
|
-
* Fired when the row grouping model changes.
|
|
24
|
-
* TODO: Add back on premium when removing it from pro
|
|
25
|
-
*/
|
|
26
|
-
rowGroupingModelChange: {
|
|
27
|
-
params: GridRowGroupingModel;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface GridColDefPro<R extends GridValidRowModel = any, V = any, F = V> {
|
|
31
|
-
/**
|
|
32
|
-
* Function that transforms a complex cell value into a key that be used for grouping the rows.
|
|
33
|
-
* @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
|
|
34
|
-
* @returns {GridKeyValue | null | undefined} The cell key.
|
|
35
|
-
*/
|
|
36
|
-
groupingValueGetter?: (params: GridGroupingValueGetterParams<V, R>) => GridKeyValue | null | undefined;
|
|
37
20
|
}
|
|
38
21
|
export interface GridEventLookupPro {
|
|
39
22
|
/**
|
|
@@ -55,13 +38,18 @@ export interface GridPipeProcessingLookupPro {
|
|
|
55
38
|
context: GridCanBeReorderedPreProcessingContext;
|
|
56
39
|
};
|
|
57
40
|
}
|
|
41
|
+
export interface GridApiCachesPro {
|
|
42
|
+
columnPinning: GridColumnPinningInternalCache;
|
|
43
|
+
}
|
|
58
44
|
declare module '@mui/x-data-grid' {
|
|
59
45
|
interface GridEventLookup extends GridEventLookupPro {
|
|
60
46
|
}
|
|
61
|
-
interface GridColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridColDefPro<R, V, F> {
|
|
62
|
-
}
|
|
63
47
|
interface GridControlledStateEventLookup extends GridControlledStateEventLookupPro {
|
|
64
48
|
}
|
|
65
49
|
interface GridPipeProcessingLookup extends GridPipeProcessingLookupPro {
|
|
66
50
|
}
|
|
67
51
|
}
|
|
52
|
+
declare module '@mui/x-data-grid/internals' {
|
|
53
|
+
interface GridApiCaches extends GridApiCachesPro {
|
|
54
|
+
}
|
|
55
|
+
}
|
package/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY1NTMzMDQwMDAwMA==";
|
|
4
4
|
|
|
5
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
6
6
|
// A simple hack to set the value in the test environment (has no build step).
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import Box from '@mui/material/Box';
|
|
3
|
-
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
const GridGroupingColumnLeafCell = props => {
|
|
7
|
-
var _props$formattedValue;
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
rowNode
|
|
11
|
-
} = props;
|
|
12
|
-
const rootProps = useGridRootProps();
|
|
13
|
-
const marginLeft = rootProps.rowGroupingColumnMode === 'multiple' ? 1 : rowNode.depth * 2;
|
|
14
|
-
return /*#__PURE__*/_jsx(Box, {
|
|
15
|
-
sx: {
|
|
16
|
-
ml: marginLeft
|
|
17
|
-
},
|
|
18
|
-
children: (_props$formattedValue = props.formattedValue) != null ? _props$formattedValue : props.value
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { GridGroupingColumnLeafCell };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
|
-
interface GridGroupingCriteriaCellProps extends GridRenderCellParams {
|
|
4
|
-
hideDescendantCount?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare const GridGroupingCriteriaCell: (props: GridGroupingCriteriaCellProps) => JSX.Element;
|
|
7
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
3
|
-
import IconButton from '@mui/material/IconButton';
|
|
4
|
-
import Box from '@mui/material/Box';
|
|
5
|
-
import { useGridSelector, gridFilteredDescendantCountLookupSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
6
|
-
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
7
|
-
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
|
|
11
|
-
const useUtilityClasses = ownerState => {
|
|
12
|
-
const {
|
|
13
|
-
classes
|
|
14
|
-
} = ownerState;
|
|
15
|
-
const slots = {
|
|
16
|
-
root: ['groupingCriteriaCell'],
|
|
17
|
-
toggle: ['groupingCriteriaCellToggle']
|
|
18
|
-
};
|
|
19
|
-
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const GridGroupingCriteriaCell = props => {
|
|
23
|
-
var _filteredDescendantCo;
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
id,
|
|
27
|
-
field,
|
|
28
|
-
rowNode,
|
|
29
|
-
hideDescendantCount,
|
|
30
|
-
formattedValue
|
|
31
|
-
} = props;
|
|
32
|
-
const rootProps = useGridRootProps();
|
|
33
|
-
const apiRef = useGridApiContext();
|
|
34
|
-
const ownerState = {
|
|
35
|
-
classes: rootProps.classes
|
|
36
|
-
};
|
|
37
|
-
const classes = useUtilityClasses(ownerState);
|
|
38
|
-
const filteredDescendantCountLookup = useGridSelector(apiRef, gridFilteredDescendantCountLookupSelector);
|
|
39
|
-
const filteredDescendantCount = (_filteredDescendantCo = filteredDescendantCountLookup[rowNode.id]) != null ? _filteredDescendantCo : 0;
|
|
40
|
-
const Icon = rowNode.childrenExpanded ? rootProps.components.GroupingCriteriaCollapseIcon : rootProps.components.GroupingCriteriaExpandIcon;
|
|
41
|
-
|
|
42
|
-
const handleKeyDown = event => {
|
|
43
|
-
if (event.key === ' ') {
|
|
44
|
-
event.stopPropagation();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
apiRef.current.publishEvent('cellKeyDown', props, event);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const handleClick = event => {
|
|
51
|
-
apiRef.current.setRowChildrenExpansion(id, !rowNode.childrenExpanded);
|
|
52
|
-
apiRef.current.setCellFocus(id, field);
|
|
53
|
-
event.stopPropagation();
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const marginLeft = rootProps.rowGroupingColumnMode === 'multiple' ? 0 : rowNode.depth * 2;
|
|
57
|
-
return /*#__PURE__*/_jsxs(Box, {
|
|
58
|
-
className: classes.root,
|
|
59
|
-
sx: {
|
|
60
|
-
ml: marginLeft
|
|
61
|
-
},
|
|
62
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
63
|
-
className: classes.toggle,
|
|
64
|
-
children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(IconButton, {
|
|
65
|
-
size: "small",
|
|
66
|
-
onClick: handleClick,
|
|
67
|
-
onKeyDown: handleKeyDown,
|
|
68
|
-
tabIndex: -1,
|
|
69
|
-
"aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand'),
|
|
70
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
71
|
-
fontSize: "inherit"
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
}), /*#__PURE__*/_jsxs("span", {
|
|
75
|
-
children: [formattedValue === undefined ? rowNode.groupingKey : formattedValue, !hideDescendantCount && filteredDescendantCount > 0 ? ` (${filteredDescendantCount})` : '']
|
|
76
|
-
})]
|
|
77
|
-
});
|
|
78
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { GridColDef } from '@mui/x-data-grid';
|
|
3
|
-
interface GridRowGroupableColumnMenuItemsProps {
|
|
4
|
-
column?: GridColDef;
|
|
5
|
-
onClick?: (event: React.MouseEvent<any>) => void;
|
|
6
|
-
}
|
|
7
|
-
declare const GridRowGroupableColumnMenuItems: {
|
|
8
|
-
(props: GridRowGroupableColumnMenuItemsProps): JSX.Element | null;
|
|
9
|
-
propTypes: any;
|
|
10
|
-
};
|
|
11
|
-
export { GridRowGroupableColumnMenuItems };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
4
|
-
import { gridColumnLookupSelector, useGridSelector } from '@mui/x-data-grid';
|
|
5
|
-
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
6
|
-
import { gridRowGroupingSanitizedModelSelector } from '../hooks/features/rowGrouping/gridRowGroupingSelector';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
const GridRowGroupableColumnMenuItems = props => {
|
|
10
|
-
var _columnsLookup$column;
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
column,
|
|
14
|
-
onClick
|
|
15
|
-
} = props;
|
|
16
|
-
const apiRef = useGridApiContext();
|
|
17
|
-
const rowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector);
|
|
18
|
-
const columnsLookup = useGridSelector(apiRef, gridColumnLookupSelector);
|
|
19
|
-
|
|
20
|
-
if (!(column != null && column.groupable)) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const ungroupColumn = event => {
|
|
25
|
-
apiRef.current.removeRowGroupingCriteria(column.field);
|
|
26
|
-
|
|
27
|
-
if (onClick) {
|
|
28
|
-
onClick(event);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const groupColumn = event => {
|
|
33
|
-
apiRef.current.addRowGroupingCriteria(column.field);
|
|
34
|
-
|
|
35
|
-
if (onClick) {
|
|
36
|
-
onClick(event);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const name = (_columnsLookup$column = columnsLookup[column.field].headerName) != null ? _columnsLookup$column : column.field;
|
|
41
|
-
|
|
42
|
-
if (rowGroupingModel.includes(column.field)) {
|
|
43
|
-
return /*#__PURE__*/_jsx(MenuItem, {
|
|
44
|
-
onClick: ungroupColumn,
|
|
45
|
-
children: apiRef.current.getLocaleText('unGroupColumn')(name)
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return /*#__PURE__*/_jsx(MenuItem, {
|
|
50
|
-
onClick: groupColumn,
|
|
51
|
-
children: apiRef.current.getLocaleText('groupColumn')(name)
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
process.env.NODE_ENV !== "production" ? GridRowGroupableColumnMenuItems.propTypes = {
|
|
56
|
-
// ----------------------------- Warning --------------------------------
|
|
57
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
58
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
59
|
-
// ----------------------------------------------------------------------
|
|
60
|
-
column: PropTypes.object,
|
|
61
|
-
onClick: PropTypes.func
|
|
62
|
-
} : void 0;
|
|
63
|
-
export { GridRowGroupableColumnMenuItems };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { GridColDef } from '@mui/x-data-grid';
|
|
3
|
-
interface GridRowGroupingColumnMenuItemsProps {
|
|
4
|
-
column?: GridColDef;
|
|
5
|
-
onClick?: (event: React.MouseEvent<any>) => void;
|
|
6
|
-
}
|
|
7
|
-
declare const GridRowGroupingColumnMenuItems: {
|
|
8
|
-
(props: GridRowGroupingColumnMenuItemsProps): JSX.Element | null;
|
|
9
|
-
propTypes: any;
|
|
10
|
-
};
|
|
11
|
-
export { GridRowGroupingColumnMenuItems };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
4
|
-
import { useGridSelector, gridColumnLookupSelector } from '@mui/x-data-grid';
|
|
5
|
-
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
6
|
-
import { gridRowGroupingSanitizedModelSelector } from '../hooks/features/rowGrouping/gridRowGroupingSelector';
|
|
7
|
-
import { getRowGroupingCriteriaFromGroupingField, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, isGroupingColumn } from '../hooks/features/rowGrouping/gridRowGroupingUtils';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
|
|
10
|
-
const GridRowGroupingColumnMenuItems = props => {
|
|
11
|
-
const {
|
|
12
|
-
column,
|
|
13
|
-
onClick
|
|
14
|
-
} = props;
|
|
15
|
-
const apiRef = useGridApiContext();
|
|
16
|
-
const rowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector);
|
|
17
|
-
const columnsLookup = useGridSelector(apiRef, gridColumnLookupSelector);
|
|
18
|
-
|
|
19
|
-
const renderUnGroupingMenuItem = field => {
|
|
20
|
-
var _columnsLookup$field$;
|
|
21
|
-
|
|
22
|
-
const ungroupColumn = event => {
|
|
23
|
-
apiRef.current.removeRowGroupingCriteria(field);
|
|
24
|
-
|
|
25
|
-
if (onClick) {
|
|
26
|
-
onClick(event);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const name = (_columnsLookup$field$ = columnsLookup[field].headerName) != null ? _columnsLookup$field$ : field;
|
|
31
|
-
return /*#__PURE__*/_jsx(MenuItem, {
|
|
32
|
-
onClick: ungroupColumn,
|
|
33
|
-
children: apiRef.current.getLocaleText('unGroupColumn')(name)
|
|
34
|
-
}, field);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
if (!column || !isGroupingColumn(column.field)) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (column.field === GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD) {
|
|
42
|
-
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
43
|
-
children: rowGroupingModel.map(renderUnGroupingMenuItem)
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return renderUnGroupingMenuItem(getRowGroupingCriteriaFromGroupingField(column.field));
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
process.env.NODE_ENV !== "production" ? GridRowGroupingColumnMenuItems.propTypes = {
|
|
51
|
-
// ----------------------------- Warning --------------------------------
|
|
52
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
53
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
54
|
-
// ----------------------------------------------------------------------
|
|
55
|
-
column: PropTypes.object,
|
|
56
|
-
onClick: PropTypes.func
|
|
57
|
-
} : void 0;
|
|
58
|
-
export { GridRowGroupingColumnMenuItems };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { GridApiPro } from '../../../models/gridApiPro';
|
|
3
|
-
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
4
|
-
export declare const useGridDetailPanelCache: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'getDetailPanelContent' | 'getDetailPanelHeight'>) => void;
|