@mui/x-data-grid-pro 5.11.0 → 5.12.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 +237 -16
- package/DataGridPro/DataGridPro.js +26 -27
- package/DataGridPro/useDataGridProComponent.js +0 -5
- package/DataGridPro/useDataGridProProps.js +6 -27
- package/LICENSE +3 -3
- package/README.md +3 -4
- 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.js +73 -28
- package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +67 -4
- package/hooks/features/columnResize/useGridColumnResize.js +32 -15
- package/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
- package/hooks/features/rowReorder/useGridRowReorder.js +5 -1
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +2 -2
- package/index.d.ts +0 -2
- package/index.js +2 -5
- package/legacy/DataGridPro/DataGridPro.js +26 -27
- package/legacy/DataGridPro/useDataGridProComponent.js +0 -5
- package/legacy/DataGridPro/useDataGridProProps.js +1 -20
- 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/useGridDetailPanel.js +1 -1
- package/legacy/hooks/features/rowReorder/useGridRowReorder.js +5 -1
- package/legacy/index.js +2 -5
- 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 +0 -5
- package/modern/DataGridPro/useDataGridProProps.js +1 -16
- 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/useGridDetailPanel.js +1 -1
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +5 -1
- package/modern/index.js +2 -5
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPro/DataGridPro.js +26 -27
- package/node/DataGridPro/useDataGridProComponent.js +0 -7
- package/node/DataGridPro/useDataGridProProps.js +6 -28
- 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/useGridDetailPanel.js +1 -1
- package/node/hooks/features/rowReorder/useGridRowReorder.js +5 -1
- package/node/index.js +2 -30
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +9 -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/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/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/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/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
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
4
4
|
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid';
|
|
5
|
-
import { buildWarning } from '@mui/x-data-grid/internals';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* The default values of `DataGridProPropsWithDefaultValue` to inject in the props of DataGridPro.
|
|
@@ -15,11 +14,8 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
|
|
|
15
14
|
disableChildrenFiltering: false,
|
|
16
15
|
disableChildrenSorting: false,
|
|
17
16
|
rowReordering: false,
|
|
18
|
-
getDetailPanelHeight: () => 500
|
|
19
|
-
disableRowGrouping: false,
|
|
20
|
-
rowGroupingColumnMode: 'single'
|
|
17
|
+
getDetailPanelHeight: () => 500
|
|
21
18
|
});
|
|
22
|
-
const rowGroupingWarning = buildWarning(['MUI: The row grouping has been moved to the new `@mui/x-data-grid-premium` package.', 'The feature is deprecated in `@mui/x-data-grid-pro`, and it will soon be removed from this package.'], 'error');
|
|
23
19
|
export const useDataGridProProps = inProps => {
|
|
24
20
|
const themedProps = useThemeProps({
|
|
25
21
|
props: inProps,
|
|
@@ -39,18 +35,7 @@ export const useDataGridProProps = inProps => {
|
|
|
39
35
|
});
|
|
40
36
|
return mergedComponents;
|
|
41
37
|
}, [themedProps.components]);
|
|
42
|
-
|
|
43
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
45
|
-
React.useEffect(() => {
|
|
46
|
-
if (themedProps.experimentalFeatures?.rowGrouping) {
|
|
47
|
-
rowGroupingWarning();
|
|
48
|
-
}
|
|
49
|
-
}, [themedProps.experimentalFeatures]);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
38
|
return React.useMemo(() => _extends({}, DATA_GRID_PRO_PROPS_DEFAULT_VALUES, themedProps, {
|
|
53
|
-
disableRowGrouping: themedProps.disableRowGrouping || !themedProps.experimentalFeatures?.rowGrouping,
|
|
54
39
|
localeText,
|
|
55
40
|
components,
|
|
56
41
|
signature: 'DataGridPro'
|
|
@@ -82,7 +82,8 @@ const VirtualScrollerDetailPanel = styled(Box, {
|
|
|
82
82
|
zIndex: 2,
|
|
83
83
|
width: '100%',
|
|
84
84
|
position: 'absolute',
|
|
85
|
-
backgroundColor: theme.palette.background.default
|
|
85
|
+
backgroundColor: theme.palette.background.default,
|
|
86
|
+
overflow: 'auto'
|
|
86
87
|
}));
|
|
87
88
|
const VirtualScrollerPinnedColumns = styled('div', {
|
|
88
89
|
name: 'MuiDataGrid',
|
|
@@ -239,7 +240,8 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
239
240
|
renderContext: leftRenderContext,
|
|
240
241
|
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
241
242
|
maxLastColumn: leftRenderContext.lastColumnIndex,
|
|
242
|
-
availableSpace: 0
|
|
243
|
+
availableSpace: 0,
|
|
244
|
+
ignoreAutoHeight: true
|
|
243
245
|
})
|
|
244
246
|
}), /*#__PURE__*/_jsx(GridVirtualScrollerRenderZone, _extends({}, getRenderZoneProps(), {
|
|
245
247
|
children: getRows({
|
|
@@ -256,7 +258,8 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
256
258
|
renderContext: rightRenderContext,
|
|
257
259
|
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
258
260
|
maxLastColumn: rightRenderContext.lastColumnIndex,
|
|
259
|
-
availableSpace: 0
|
|
261
|
+
availableSpace: 0,
|
|
262
|
+
ignoreAutoHeight: true
|
|
260
263
|
})
|
|
261
264
|
}), detailPanels.length > 0 && /*#__PURE__*/_jsx(VirtualScrollerDetailPanels, {
|
|
262
265
|
className: classes.detailPanels,
|
|
@@ -27,7 +27,7 @@ const GridRowReorderCell = params => {
|
|
|
27
27
|
|
|
28
28
|
const cellValue = params.row.__reorder__ || params.id; // TODO: remove sortModel and treeDepth checks once row reorder is compatible
|
|
29
29
|
|
|
30
|
-
const isDraggable = !!rootProps.rowReordering && !sortModel.length && treeDepth === 1 && Object.keys(editRowsState).length === 0;
|
|
30
|
+
const isDraggable = React.useMemo(() => !!rootProps.rowReordering && !sortModel.length && treeDepth === 1 && Object.keys(editRowsState).length === 0, [rootProps.rowReordering, sortModel, treeDepth, editRowsState]);
|
|
31
31
|
const ownerState = {
|
|
32
32
|
isDraggable,
|
|
33
33
|
classes: rootProps.classes
|
|
@@ -42,21 +42,21 @@ const GridRowReorderCell = params => {
|
|
|
42
42
|
} // The row might have been deleted
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
if (!apiRef.current.getRow(params.
|
|
45
|
+
if (!apiRef.current.getRow(params.id)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.
|
|
49
|
+
apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.id), event);
|
|
50
50
|
|
|
51
51
|
if (propHandler) {
|
|
52
52
|
propHandler(event);
|
|
53
53
|
}
|
|
54
|
-
}, [apiRef, params.
|
|
55
|
-
const draggableEventHandlers = {
|
|
54
|
+
}, [apiRef, params.id]);
|
|
55
|
+
const draggableEventHandlers = isDraggable ? {
|
|
56
56
|
onDragStart: publish('rowDragStart'),
|
|
57
57
|
onDragOver: publish('rowDragOver'),
|
|
58
58
|
onDragEnd: publish('rowDragEnd')
|
|
59
|
-
};
|
|
59
|
+
} : null;
|
|
60
60
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
61
61
|
className: classes.root,
|
|
62
62
|
draggable: isDraggable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import MuiDivider from '@mui/material/Divider';
|
|
4
|
-
import { useGridSelector, gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector, gridVisibleColumnFieldsSelector, gridClasses, useGridApiMethod, useGridApiEventHandler } from '@mui/x-data-grid';
|
|
4
|
+
import { useGridSelector, gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector, gridVisibleColumnFieldsSelector, gridClasses, useGridApiMethod, useGridApiEventHandler, gridColumnFieldsSelector } from '@mui/x-data-grid';
|
|
5
5
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { GridColumnPinningMenuItems } from '../../../components/GridColumnPinningMenuItems';
|
|
7
7
|
import { GridPinnedPosition } from './gridColumnPinningInterface';
|
|
@@ -13,7 +13,10 @@ const Divider = () => /*#__PURE__*/_jsx(MuiDivider, {
|
|
|
13
13
|
onClick: event => event.stopPropagation()
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
export const columnPinningStateInitializer = (state, props) => {
|
|
16
|
+
export const columnPinningStateInitializer = (state, props, apiRef) => {
|
|
17
|
+
apiRef.current.unstable_caches.columnPinning = {
|
|
18
|
+
orderedFieldsBeforePinningColumns: null
|
|
19
|
+
};
|
|
17
20
|
let model;
|
|
18
21
|
|
|
19
22
|
if (props.disableColumnPinning) {
|
|
@@ -180,7 +183,7 @@ export const useGridColumnPinning = (apiRef, props) => {
|
|
|
180
183
|
useGridRegisterPipeProcessor(apiRef, 'canBeReordered', checkIfCanBeReordered);
|
|
181
184
|
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
182
185
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
183
|
-
apiRef.current.
|
|
186
|
+
apiRef.current.unstable_registerControlState({
|
|
184
187
|
stateId: 'pinnedColumns',
|
|
185
188
|
propModel: props.pinnedColumns,
|
|
186
189
|
propOnChange: props.onPinnedColumnsChange,
|
|
@@ -199,34 +202,20 @@ export const useGridColumnPinning = (apiRef, props) => {
|
|
|
199
202
|
return;
|
|
200
203
|
}
|
|
201
204
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return _extends({}, state, {
|
|
211
|
-
pinnedColumns: newPinnedColumns
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
apiRef.current.forceUpdate();
|
|
215
|
-
}, [apiRef, checkIfEnabled]);
|
|
205
|
+
const otherSide = side === GridPinnedPosition.right ? GridPinnedPosition.left : GridPinnedPosition.right;
|
|
206
|
+
const newPinnedColumns = {
|
|
207
|
+
[side]: [...(pinnedColumns[side] || []), field],
|
|
208
|
+
[otherSide]: (pinnedColumns[otherSide] || []).filter(column => column !== field)
|
|
209
|
+
};
|
|
210
|
+
apiRef.current.setPinnedColumns(newPinnedColumns);
|
|
211
|
+
}, [apiRef, checkIfEnabled, pinnedColumns]);
|
|
216
212
|
const unpinColumn = React.useCallback(field => {
|
|
217
213
|
checkIfEnabled('unpinColumn');
|
|
218
|
-
apiRef.current.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
right: (state.pinnedColumns.right || []).filter(column => column !== field)
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
return _extends({}, state, {
|
|
225
|
-
pinnedColumns: newPinnedColumns
|
|
226
|
-
});
|
|
214
|
+
apiRef.current.setPinnedColumns({
|
|
215
|
+
left: (pinnedColumns.left || []).filter(column => column !== field),
|
|
216
|
+
right: (pinnedColumns.right || []).filter(column => column !== field)
|
|
227
217
|
});
|
|
228
|
-
|
|
229
|
-
}, [apiRef, checkIfEnabled]);
|
|
218
|
+
}, [apiRef, checkIfEnabled, pinnedColumns.left, pinnedColumns.right]);
|
|
230
219
|
const getPinnedColumns = React.useCallback(() => {
|
|
231
220
|
checkIfEnabled('getPinnedColumns');
|
|
232
221
|
return gridPinnedColumnsSelector(apiRef.current.state);
|
|
@@ -260,6 +249,62 @@ export const useGridColumnPinning = (apiRef, props) => {
|
|
|
260
249
|
isColumnPinned
|
|
261
250
|
};
|
|
262
251
|
useGridApiMethod(apiRef, columnPinningApi, 'columnPinningApi');
|
|
252
|
+
const handleColumnOrderChange = React.useCallback(params => {
|
|
253
|
+
if (!apiRef.current.unstable_caches.columnPinning.orderedFieldsBeforePinningColumns) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const {
|
|
258
|
+
field,
|
|
259
|
+
targetIndex,
|
|
260
|
+
oldIndex
|
|
261
|
+
} = params;
|
|
262
|
+
const delta = targetIndex > oldIndex ? 1 : -1;
|
|
263
|
+
const latestColumnFields = gridColumnFieldsSelector(apiRef);
|
|
264
|
+
/**
|
|
265
|
+
* When a column X is reordered to somewhere else, the position where this column X is dropped
|
|
266
|
+
* on must be moved to left or right to make room for it. The ^^^ below represents the column
|
|
267
|
+
* which gave space to receive X.
|
|
268
|
+
*
|
|
269
|
+
* | X | B | C | D | -> | B | C | D | X | (e.g. X moved to after D, so delta=1)
|
|
270
|
+
* ^^^ ^^^
|
|
271
|
+
*
|
|
272
|
+
* | A | B | C | X | -> | X | A | B | C | (e.g. X moved before A, so delta=-1)
|
|
273
|
+
* ^^^ ^^^
|
|
274
|
+
*
|
|
275
|
+
* If column P is pinned, it will not move to provide space. However, it will jump to the next
|
|
276
|
+
* non-pinned column.
|
|
277
|
+
*
|
|
278
|
+
* | X | B | P | D | -> | B | D | P | X | (e.g. X moved to after D, with P pinned)
|
|
279
|
+
* ^^^ ^^^
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
const siblingField = latestColumnFields[targetIndex - delta];
|
|
283
|
+
const newOrderedFieldsBeforePinningColumns = [...apiRef.current.unstable_caches.columnPinning.orderedFieldsBeforePinningColumns]; // The index to start swapping fields
|
|
284
|
+
|
|
285
|
+
let i = newOrderedFieldsBeforePinningColumns.findIndex(column => column === field); // The index of the field to swap with
|
|
286
|
+
|
|
287
|
+
let j = i + delta; // When to stop swapping fields.
|
|
288
|
+
// We stop one field before because the swap is done with i + 1 (if delta=1)
|
|
289
|
+
|
|
290
|
+
const stop = newOrderedFieldsBeforePinningColumns.findIndex(column => column === siblingField);
|
|
291
|
+
|
|
292
|
+
while (delta > 0 ? i < stop : i > stop) {
|
|
293
|
+
// If the field to swap with is a pinned column, jump to the next
|
|
294
|
+
while (apiRef.current.isColumnPinned(newOrderedFieldsBeforePinningColumns[j])) {
|
|
295
|
+
j += delta;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const temp = newOrderedFieldsBeforePinningColumns[i];
|
|
299
|
+
newOrderedFieldsBeforePinningColumns[i] = newOrderedFieldsBeforePinningColumns[j];
|
|
300
|
+
newOrderedFieldsBeforePinningColumns[j] = temp;
|
|
301
|
+
i = j;
|
|
302
|
+
j = i + delta;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
apiRef.current.unstable_caches.columnPinning.orderedFieldsBeforePinningColumns = newOrderedFieldsBeforePinningColumns;
|
|
306
|
+
}, [apiRef]);
|
|
307
|
+
useGridApiEventHandler(apiRef, 'columnOrderChange', handleColumnOrderChange);
|
|
263
308
|
React.useEffect(() => {
|
|
264
309
|
if (props.pinnedColumns) {
|
|
265
310
|
apiRef.current.setPinnedColumns(props.pinnedColumns);
|
|
@@ -23,23 +23,86 @@ export const useGridColumnPinningPreProcessors = (apiRef, props) => {
|
|
|
23
23
|
pinnedColumns = gridPinnedColumnsSelector(initializedState);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
const prevAllPinnedColumns = React.useRef();
|
|
26
27
|
const reorderPinnedColumns = React.useCallback(columnsState => {
|
|
27
28
|
if (columnsState.all.length === 0 || disableColumnPinning) {
|
|
28
29
|
return columnsState;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const [leftPinnedColumns, rightPinnedColumns] = filterColumns(pinnedColumns, columnsState.all);
|
|
33
|
+
let newOrderedFields;
|
|
34
|
+
const allPinnedColumns = [...leftPinnedColumns, ...rightPinnedColumns];
|
|
35
|
+
const {
|
|
36
|
+
orderedFieldsBeforePinningColumns
|
|
37
|
+
} = apiRef.current.unstable_caches.columnPinning;
|
|
32
38
|
|
|
33
|
-
if (
|
|
34
|
-
|
|
39
|
+
if (orderedFieldsBeforePinningColumns) {
|
|
40
|
+
newOrderedFields = new Array(columnsState.all.length).fill(null);
|
|
41
|
+
const newOrderedFieldsBeforePinningColumns = [...newOrderedFields]; // Contains the fields not added to the orderedFields array yet
|
|
42
|
+
|
|
43
|
+
const remainingFields = [...columnsState.all]; // First, we check if the column was unpinned since the last processing.
|
|
44
|
+
// If yes and it still exists, we move it back to the same position it was before pinning
|
|
45
|
+
|
|
46
|
+
prevAllPinnedColumns.current.forEach(field => {
|
|
47
|
+
if (!allPinnedColumns.includes(field) && columnsState.lookup[field]) {
|
|
48
|
+
// Get the position before pinning
|
|
49
|
+
const index = orderedFieldsBeforePinningColumns.indexOf(field);
|
|
50
|
+
newOrderedFields[index] = field;
|
|
51
|
+
newOrderedFieldsBeforePinningColumns[index] = field; // This field was already consumed so we prevent from being added again
|
|
52
|
+
|
|
53
|
+
remainingFields.splice(remainingFields.indexOf(field), 1);
|
|
54
|
+
}
|
|
55
|
+
}); // For columns still pinned, we keep stored their original positions
|
|
56
|
+
|
|
57
|
+
allPinnedColumns.forEach(field => {
|
|
58
|
+
let index = orderedFieldsBeforePinningColumns.indexOf(field); // If index = -1, the pinned field didn't exist in the last processing, it's possibly being added now
|
|
59
|
+
// If index >= newOrderedFieldsBeforePinningColumns.length, then one or more columns were removed
|
|
60
|
+
// In both cases, use the position from the columns array
|
|
61
|
+
// TODO: detect removed columns and decrease the positions after it
|
|
62
|
+
|
|
63
|
+
if (index === -1 || index >= newOrderedFieldsBeforePinningColumns.length) {
|
|
64
|
+
index = columnsState.all.indexOf(field);
|
|
65
|
+
} // The fallback above may make the column to be inserted in a position already occupied
|
|
66
|
+
// In this case, put it in any empty slot available
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if (newOrderedFieldsBeforePinningColumns[index] !== null) {
|
|
70
|
+
index = 0;
|
|
71
|
+
|
|
72
|
+
while (newOrderedFieldsBeforePinningColumns[index] !== null) {
|
|
73
|
+
index += 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
newOrderedFields[index] = field;
|
|
78
|
+
newOrderedFieldsBeforePinningColumns[index] = field; // This field was already consumed so we prevent from being added again
|
|
79
|
+
|
|
80
|
+
remainingFields.splice(remainingFields.indexOf(field), 1);
|
|
81
|
+
}); // The fields remaining are those that're neither pinnned nor were unpinned
|
|
82
|
+
// For these, we spread them across both arrays making sure to not override existing values
|
|
83
|
+
|
|
84
|
+
let i = 0;
|
|
85
|
+
remainingFields.forEach(field => {
|
|
86
|
+
while (newOrderedFieldsBeforePinningColumns[i] !== null) {
|
|
87
|
+
i += 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
newOrderedFieldsBeforePinningColumns[i] = field;
|
|
91
|
+
newOrderedFields[i] = field;
|
|
92
|
+
});
|
|
93
|
+
apiRef.current.unstable_caches.columnPinning.orderedFieldsBeforePinningColumns = newOrderedFieldsBeforePinningColumns;
|
|
94
|
+
} else {
|
|
95
|
+
newOrderedFields = [...columnsState.all];
|
|
96
|
+
apiRef.current.unstable_caches.columnPinning.orderedFieldsBeforePinningColumns = [...columnsState.all];
|
|
35
97
|
}
|
|
36
98
|
|
|
37
|
-
|
|
99
|
+
prevAllPinnedColumns.current = allPinnedColumns;
|
|
100
|
+
const centerColumns = newOrderedFields.filter(field => {
|
|
38
101
|
return !leftPinnedColumns.includes(field) && !rightPinnedColumns.includes(field);
|
|
39
102
|
});
|
|
40
103
|
return _extends({}, columnsState, {
|
|
41
104
|
all: [...leftPinnedColumns, ...centerColumns, ...rightPinnedColumns]
|
|
42
105
|
});
|
|
43
|
-
}, [disableColumnPinning, pinnedColumns]);
|
|
106
|
+
}, [apiRef, disableColumnPinning, pinnedColumns]);
|
|
44
107
|
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', reorderPinnedColumns);
|
|
45
108
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ownerDocument, useEventCallback } from '@mui/material/utils';
|
|
4
|
-
import { gridClasses,
|
|
4
|
+
import { gridClasses, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
|
|
5
5
|
import { clamp, findParentElementFromClassName } from '@mui/x-data-grid/internals';
|
|
6
|
+
import { useTheme } from '@mui/material/styles';
|
|
6
7
|
import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField } from '../../../utils/domUtils';
|
|
7
8
|
// TODO: remove support for Safari < 13.
|
|
8
9
|
// https://caniuse.com/#search=touch-action
|
|
@@ -50,10 +51,10 @@ function trackFinger(event, currentTouchId) {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds,
|
|
54
|
+
function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, resizeDirection) {
|
|
54
55
|
let newWidth = initialOffsetToSeparator;
|
|
55
56
|
|
|
56
|
-
if (
|
|
57
|
+
if (resizeDirection === 'Right') {
|
|
57
58
|
newWidth += clickX - columnBounds.left;
|
|
58
59
|
} else {
|
|
59
60
|
newWidth += columnBounds.right - clickX;
|
|
@@ -62,16 +63,31 @@ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separat
|
|
|
62
63
|
return newWidth;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
function computeOffsetToSeparator(clickX, columnBounds,
|
|
66
|
-
if (
|
|
66
|
+
function computeOffsetToSeparator(clickX, columnBounds, resizeDirection) {
|
|
67
|
+
if (resizeDirection === 'Left') {
|
|
67
68
|
return clickX - columnBounds.left;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
return columnBounds.right - clickX;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
function
|
|
74
|
-
|
|
74
|
+
function flipResizeDirection(side) {
|
|
75
|
+
if (side === 'Right') {
|
|
76
|
+
return 'Left';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return 'Right';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function getResizeDirection(element, direction) {
|
|
83
|
+
const side = element.classList.contains(gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
|
|
84
|
+
|
|
85
|
+
if (direction === 'rtl') {
|
|
86
|
+
// Resizing logic should be mirrored in the RTL case
|
|
87
|
+
return flipResizeDirection(side);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return side;
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
export const columnResizeStateInitializer = state => _extends({}, state, {
|
|
@@ -88,12 +104,13 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
88
104
|
const logger = useGridLogger(apiRef, 'useGridColumnResize');
|
|
89
105
|
const colDefRef = React.useRef();
|
|
90
106
|
const colElementRef = React.useRef();
|
|
91
|
-
const colCellElementsRef = React.useRef();
|
|
107
|
+
const colCellElementsRef = React.useRef();
|
|
108
|
+
const theme = useTheme(); // To improve accessibility, the separator has padding on both sides.
|
|
92
109
|
// Clicking inside the padding area should be treated as a click in the separator.
|
|
93
110
|
// This ref stores the offset between the click and the separator.
|
|
94
111
|
|
|
95
112
|
const initialOffsetToSeparator = React.useRef();
|
|
96
|
-
const
|
|
113
|
+
const resizeDirection = React.useRef();
|
|
97
114
|
const stopResizeEventTimeout = React.useRef();
|
|
98
115
|
const touchId = React.useRef();
|
|
99
116
|
|
|
@@ -150,7 +167,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
150
167
|
return;
|
|
151
168
|
}
|
|
152
169
|
|
|
153
|
-
let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(),
|
|
170
|
+
let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
154
171
|
newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
|
|
155
172
|
updateWidth(newWidth);
|
|
156
173
|
const params = {
|
|
@@ -184,8 +201,8 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
184
201
|
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
|
|
185
202
|
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
186
203
|
doc.body.style.cursor = 'col-resize';
|
|
187
|
-
|
|
188
|
-
initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(),
|
|
204
|
+
resizeDirection.current = getResizeDirection(event.currentTarget, theme.direction);
|
|
205
|
+
initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
189
206
|
doc.addEventListener('mousemove', handleResizeMouseMove);
|
|
190
207
|
doc.addEventListener('mouseup', handleResizeMouseUp);
|
|
191
208
|
});
|
|
@@ -218,7 +235,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
218
235
|
return;
|
|
219
236
|
}
|
|
220
237
|
|
|
221
|
-
let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(),
|
|
238
|
+
let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
222
239
|
newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
|
|
223
240
|
updateWidth(newWidth);
|
|
224
241
|
const params = {
|
|
@@ -257,8 +274,8 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
257
274
|
colDefRef.current = colDef;
|
|
258
275
|
colElementRef.current = findHeaderElementFromField(apiRef.current.columnHeadersElementRef?.current, colDef.field);
|
|
259
276
|
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
|
|
260
|
-
|
|
261
|
-
initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(),
|
|
277
|
+
resizeDirection.current = getResizeDirection(event.target, theme.direction);
|
|
278
|
+
initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
262
279
|
const doc = ownerDocument(event.currentTarget);
|
|
263
280
|
doc.addEventListener('touchmove', handleTouchMove);
|
|
264
281
|
doc.addEventListener('touchend', handleTouchEnd);
|
|
@@ -63,7 +63,7 @@ export const useGridDetailPanel = (apiRef, props) => {
|
|
|
63
63
|
});
|
|
64
64
|
}, [apiRef, expandedRowIds]);
|
|
65
65
|
useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
|
|
66
|
-
apiRef.current.
|
|
66
|
+
apiRef.current.unstable_registerControlState({
|
|
67
67
|
stateId: 'detailPanels',
|
|
68
68
|
propModel: props.detailPanelExpandedRowIds,
|
|
69
69
|
propOnChange: props.onDetailPanelExpandedRowIdsChange,
|
|
@@ -60,6 +60,10 @@ 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
|
+
if (dragRowId === '') {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
logger.debug(`Dragging over row ${params.id}`);
|
|
64
68
|
event.preventDefault(); // Prevent drag events propagation.
|
|
65
69
|
// For more information check here https://github.com/mui/mui-x/issues/2680.
|
|
@@ -75,7 +79,7 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
75
79
|
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
76
80
|
const editRowsState = gridEditRowsStateSelector(apiRef.current.state);
|
|
77
81
|
|
|
78
|
-
if (isRowReorderDisabled || Object.keys(editRowsState).length !== 0) {
|
|
82
|
+
if (dragRowId === '' || isRowReorderDisabled || Object.keys(editRowsState).length !== 0) {
|
|
79
83
|
return;
|
|
80
84
|
}
|
|
81
85
|
|
package/modern/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.12.1
|
|
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.
|
|
@@ -18,7 +18,4 @@ export * from './hooks';
|
|
|
18
18
|
export * from './models';
|
|
19
19
|
export * from './components';
|
|
20
20
|
export * from './utils';
|
|
21
|
-
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
22
|
-
// We export them from here to avoid export duplication between pro and premium
|
|
23
|
-
export * from './hooks/features/rowGrouping';
|
|
24
|
-
export * from './models/gridGroupingValueGetterParams';
|
|
21
|
+
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY1NDgxMjAwMDAwMA==";
|
|
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).
|
|
@@ -259,12 +259,6 @@ DataGridProRaw.propTypes = {
|
|
|
259
259
|
*/
|
|
260
260
|
disableMultipleSelection: _propTypes.default.bool,
|
|
261
261
|
|
|
262
|
-
/**
|
|
263
|
-
* If `true`, the row grouping is disabled.
|
|
264
|
-
* @default false
|
|
265
|
-
*/
|
|
266
|
-
disableRowGrouping: _propTypes.default.bool,
|
|
267
|
-
|
|
268
262
|
/**
|
|
269
263
|
* If `true`, the selection on click on a row or cell is disabled.
|
|
270
264
|
* @default false
|
|
@@ -300,7 +294,6 @@ DataGridProRaw.propTypes = {
|
|
|
300
294
|
experimentalFeatures: _propTypes.default.shape({
|
|
301
295
|
newEditingApi: _propTypes.default.bool,
|
|
302
296
|
preventCommitWhileValidating: _propTypes.default.bool,
|
|
303
|
-
rowGrouping: _propTypes.default.bool,
|
|
304
297
|
warnIfFocusStateIsNotSynced: _propTypes.default.bool
|
|
305
298
|
}),
|
|
306
299
|
|
|
@@ -354,6 +347,15 @@ DataGridProRaw.propTypes = {
|
|
|
354
347
|
*/
|
|
355
348
|
getDetailPanelHeight: _propTypes.default.func,
|
|
356
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Function that returns the estimated height for a row.
|
|
352
|
+
* Only works if dynamic row height is used.
|
|
353
|
+
* Once the row height is measured this value is discarded.
|
|
354
|
+
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
|
|
355
|
+
* @returns {number | null} The estimated row height value. If `null` or `undefined` then the default row height, based on the density, is applied.
|
|
356
|
+
*/
|
|
357
|
+
getEstimatedRowHeight: _propTypes.default.func,
|
|
358
|
+
|
|
357
359
|
/**
|
|
358
360
|
* Function that applies CSS classes dynamically on rows.
|
|
359
361
|
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
|
|
@@ -364,7 +366,7 @@ DataGridProRaw.propTypes = {
|
|
|
364
366
|
/**
|
|
365
367
|
* Function that sets the row height per row.
|
|
366
368
|
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
|
|
367
|
-
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
|
|
369
|
+
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied. If "auto" then the row height is calculated based on the content.
|
|
368
370
|
*/
|
|
369
371
|
getRowHeight: _propTypes.default.func,
|
|
370
372
|
|
|
@@ -690,6 +692,22 @@ DataGridProRaw.propTypes = {
|
|
|
690
692
|
*/
|
|
691
693
|
onFilterModelChange: _propTypes.default.func,
|
|
692
694
|
|
|
695
|
+
/**
|
|
696
|
+
* Callback fired when the menu is closed.
|
|
697
|
+
* @param {GridMenuParams} params With all properties from [[GridMenuParams]].
|
|
698
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
699
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
700
|
+
*/
|
|
701
|
+
onMenuClose: _propTypes.default.func,
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Callback fired when the menu is opened.
|
|
705
|
+
* @param {GridMenuParams} params With all properties from [[GridMenuParams]].
|
|
706
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
707
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
708
|
+
*/
|
|
709
|
+
onMenuOpen: _propTypes.default.func,
|
|
710
|
+
|
|
693
711
|
/**
|
|
694
712
|
* Callback fired when the current page has changed.
|
|
695
713
|
* @param {number} page Index of the page displayed on the Grid.
|
|
@@ -779,13 +797,6 @@ DataGridProRaw.propTypes = {
|
|
|
779
797
|
*/
|
|
780
798
|
onRowEditStop: _propTypes.default.func,
|
|
781
799
|
|
|
782
|
-
/**
|
|
783
|
-
* Callback fired when the row grouping model changes.
|
|
784
|
-
* @param {GridRowGroupingModel} model Columns used as grouping criteria.
|
|
785
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
786
|
-
*/
|
|
787
|
-
onRowGroupingModelChange: _propTypes.default.func,
|
|
788
|
-
|
|
789
800
|
/**
|
|
790
801
|
* Callback fired when the `rowModesModel` prop changes.
|
|
791
802
|
* @param {GridRowModesModel} rowModesModel Object containig which rows are in "edit" mode.
|
|
@@ -889,18 +900,6 @@ DataGridProRaw.propTypes = {
|
|
|
889
900
|
*/
|
|
890
901
|
rowCount: _propTypes.default.number,
|
|
891
902
|
|
|
892
|
-
/**
|
|
893
|
-
* If `single`, all column we are grouping by will be represented in the same grouping the same column.
|
|
894
|
-
* If `multiple`, each column we are grouping by will be represented in its own column.
|
|
895
|
-
* @default 'single'
|
|
896
|
-
*/
|
|
897
|
-
rowGroupingColumnMode: _propTypes.default.oneOf(['multiple', 'single']),
|
|
898
|
-
|
|
899
|
-
/**
|
|
900
|
-
* Set the row grouping model of the grid.
|
|
901
|
-
*/
|
|
902
|
-
rowGroupingModel: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
903
|
-
|
|
904
903
|
/**
|
|
905
904
|
* Set the height in pixel of a row in the grid.
|
|
906
905
|
* @default 52
|
|
@@ -31,10 +31,6 @@ var _useGridRowReorder = require("../hooks/features/rowReorder/useGridRowReorder
|
|
|
31
31
|
|
|
32
32
|
var _useGridRowReorderPreProcessors = require("../hooks/features/rowReorder/useGridRowReorderPreProcessors");
|
|
33
33
|
|
|
34
|
-
var _useGridRowGrouping = require("../hooks/features/rowGrouping/useGridRowGrouping");
|
|
35
|
-
|
|
36
|
-
var _useGridRowGroupingPreProcessors = require("../hooks/features/rowGrouping/useGridRowGroupingPreProcessors");
|
|
37
|
-
|
|
38
34
|
// Pro-only features
|
|
39
35
|
const useDataGridProComponent = (inputApiRef, props) => {
|
|
40
36
|
var _props$experimentalFe, _props$experimentalFe2;
|
|
@@ -46,7 +42,6 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
46
42
|
|
|
47
43
|
(0, _internals.useGridSelectionPreProcessors)(apiRef, props);
|
|
48
44
|
(0, _useGridRowReorderPreProcessors.useGridRowReorderPreProcessors)(apiRef, props);
|
|
49
|
-
(0, _useGridRowGroupingPreProcessors.useGridRowGroupingPreProcessors)(apiRef, props);
|
|
50
45
|
(0, _useGridTreeDataPreProcessors.useGridTreeDataPreProcessors)(apiRef, props);
|
|
51
46
|
(0, _useGridDetailPanelPreProcessors.useGridDetailPanelPreProcessors)(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
|
|
52
47
|
// Because it changes the order of the columns.
|
|
@@ -57,7 +52,6 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
57
52
|
* Register all state initializers here.
|
|
58
53
|
*/
|
|
59
54
|
|
|
60
|
-
(0, _internals.useGridInitializeState)(_useGridRowGrouping.rowGroupingStateInitializer, apiRef, props);
|
|
61
55
|
(0, _internals.useGridInitializeState)(_internals.selectionStateInitializer, apiRef, props);
|
|
62
56
|
(0, _internals.useGridInitializeState)(_useGridDetailPanel.detailPanelStateInitializer, apiRef, props);
|
|
63
57
|
(0, _internals.useGridInitializeState)(_useGridColumnPinning.columnPinningStateInitializer, apiRef, props);
|
|
@@ -74,7 +68,6 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
74
68
|
(0, _internals.useGridInitializeState)(_internals.paginationStateInitializer, apiRef, props);
|
|
75
69
|
(0, _internals.useGridInitializeState)(_internals.rowsMetaStateInitializer, apiRef, props);
|
|
76
70
|
(0, _internals.useGridInitializeState)(_internals.columnMenuStateInitializer, apiRef, props);
|
|
77
|
-
(0, _useGridRowGrouping.useGridRowGrouping)(apiRef, props);
|
|
78
71
|
(0, _useGridTreeData.useGridTreeData)(apiRef);
|
|
79
72
|
(0, _internals.useGridKeyboardNavigation)(apiRef, props);
|
|
80
73
|
(0, _internals.useGridSelection)(apiRef, props);
|