@mui/x-data-grid-pro 5.8.0 → 5.11.0
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 +333 -66
- package/DataGridPro/DataGridPro.d.ts +1 -1
- package/DataGridPro/DataGridPro.js +51 -3
- package/DataGridPro/useDataGridProComponent.js +9 -4
- package/DataGridPro/useDataGridProProps.js +20 -5
- package/LICENSE +12 -0
- package/README.md +7 -5
- package/components/DataGridProColumnHeaders.js +2 -8
- package/components/DataGridProVirtualScroller.js +7 -7
- package/components/GridDetailPanelToggleCell.js +13 -2
- package/components/GridGroupingCriteriaCell.js +2 -2
- package/components/GridRowReorderCell.d.ts +5 -0
- package/components/GridRowReorderCell.js +72 -0
- package/components/GridTreeDataGroupingCell.js +15 -4
- package/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/hooks/features/columnReorder/useGridColumnReorder.d.ts +0 -1
- package/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
- package/hooks/features/columnResize/useGridColumnResize.d.ts +0 -1
- package/hooks/features/columnResize/useGridColumnResize.js +31 -20
- package/hooks/features/detailPanel/useGridDetailPanel.js +14 -6
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/hooks/features/index.d.ts +1 -1
- package/hooks/features/index.js +1 -1
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.d.ts +0 -1
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
- package/hooks/features/rowGrouping/createGroupingColDef.d.ts +1 -1
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +1 -1
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +0 -2
- package/hooks/features/rowGrouping/useGridRowGrouping.js +8 -12
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/hooks/features/rowReorder/gridRowReorderColDef.d.ts +2 -0
- package/hooks/features/rowReorder/gridRowReorderColDef.js +18 -0
- package/hooks/features/rowReorder/index.d.ts +1 -0
- package/hooks/features/rowReorder/index.js +1 -0
- package/hooks/features/rowReorder/useGridRowReorder.d.ts +8 -0
- package/hooks/features/rowReorder/useGridRowReorder.js +111 -0
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +4 -0
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +51 -0
- package/hooks/features/treeData/useGridTreeData.d.ts +0 -3
- package/hooks/features/treeData/useGridTreeData.js +2 -8
- package/index.d.ts +6 -1
- package/index.js +7 -3
- package/internals/index.d.ts +19 -0
- package/internals/index.js +17 -0
- package/internals/package.json +6 -0
- package/legacy/DataGridPro/DataGridPro.js +51 -3
- package/legacy/DataGridPro/useDataGridProComponent.js +9 -4
- package/legacy/DataGridPro/useDataGridProProps.js +20 -5
- package/legacy/components/DataGridProColumnHeaders.js +2 -8
- package/legacy/components/DataGridProVirtualScroller.js +7 -7
- package/legacy/components/GridDetailPanelToggleCell.js +13 -2
- package/legacy/components/GridGroupingCriteriaCell.js +2 -2
- package/legacy/components/GridRowReorderCell.js +74 -0
- package/legacy/components/GridTreeDataGroupingCell.js +15 -4
- package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +31 -20
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +14 -6
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/legacy/hooks/features/index.js +1 -1
- package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
- package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -5
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +8 -12
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +20 -0
- package/legacy/hooks/features/rowReorder/index.js +1 -0
- package/legacy/hooks/features/rowReorder/useGridRowReorder.js +115 -0
- package/legacy/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +52 -0
- package/legacy/hooks/features/treeData/useGridTreeData.js +2 -8
- package/legacy/index.js +7 -3
- package/legacy/internals/index.js +17 -0
- package/legacy/models/gridRowOrderChangeParams.js +1 -0
- package/legacy/models/index.js +1 -2
- package/legacy/typeOverloads/index.js +1 -0
- package/legacy/utils/domUtils.js +30 -3
- package/legacy/utils/index.js +1 -0
- package/legacy/utils/releaseInfo.js +1 -1
- package/legacy/utils/tree/buildRowTree.js +11 -4
- package/legacy/utils/tree/index.js +1 -0
- package/models/dataGridProProps.d.ts +36 -24
- package/models/gridApiPro.d.ts +3 -2
- package/models/gridRowOrderChangeParams.d.ts +18 -0
- package/models/gridRowOrderChangeParams.js +1 -0
- package/models/gridStatePro.d.ts +4 -3
- package/models/index.d.ts +1 -2
- package/models/index.js +1 -2
- package/modern/DataGridPro/DataGridPro.js +51 -3
- package/modern/DataGridPro/useDataGridProComponent.js +9 -4
- package/modern/DataGridPro/useDataGridProProps.js +16 -3
- package/modern/components/DataGridProColumnHeaders.js +2 -8
- package/modern/components/DataGridProVirtualScroller.js +7 -7
- package/modern/components/GridDetailPanelToggleCell.js +13 -2
- package/modern/components/GridGroupingCriteriaCell.js +2 -2
- package/modern/components/GridRowReorderCell.js +72 -0
- package/modern/components/GridTreeDataGroupingCell.js +15 -4
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/modern/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
- package/modern/hooks/features/columnResize/useGridColumnResize.js +31 -20
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +14 -6
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/modern/hooks/features/index.js +1 -1
- package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +8 -12
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +18 -0
- package/modern/hooks/features/rowReorder/index.js +1 -0
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +111 -0
- package/modern/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +51 -0
- package/modern/hooks/features/treeData/useGridTreeData.js +2 -8
- package/modern/index.js +7 -3
- package/modern/internals/index.js +17 -0
- package/modern/models/gridRowOrderChangeParams.js +1 -0
- package/modern/models/index.js +1 -2
- package/modern/typeOverloads/index.js +1 -0
- package/modern/utils/domUtils.js +30 -3
- package/modern/utils/index.js +1 -0
- package/modern/utils/releaseInfo.js +1 -1
- package/modern/utils/tree/buildRowTree.js +9 -2
- package/modern/utils/tree/index.js +1 -0
- package/node/DataGridPro/DataGridPro.js +51 -3
- package/node/DataGridPro/useDataGridProComponent.js +12 -5
- package/node/DataGridPro/useDataGridProProps.js +21 -5
- package/node/components/DataGridProColumnHeaders.js +1 -7
- package/node/components/DataGridProVirtualScroller.js +6 -6
- package/node/components/GridDetailPanelToggleCell.js +13 -2
- package/node/components/GridGroupingCriteriaCell.js +1 -1
- package/node/components/GridRowReorderCell.js +92 -0
- package/node/components/GridTreeDataGroupingCell.js +14 -3
- package/node/hooks/features/columnPinning/useGridColumnPinning.js +3 -3
- package/node/hooks/features/columnReorder/useGridColumnReorder.js +7 -8
- package/node/hooks/features/columnResize/useGridColumnResize.js +30 -19
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +13 -5
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/node/hooks/features/index.js +4 -4
- package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +3 -4
- package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +7 -11
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +4 -4
- package/node/hooks/features/rowReorder/gridRowReorderColDef.js +31 -0
- package/node/hooks/features/rowReorder/index.js +18 -0
- package/node/hooks/features/rowReorder/useGridRowReorder.js +126 -0
- package/node/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +70 -0
- package/node/hooks/features/treeData/useGridTreeData.js +1 -6
- package/node/index.js +45 -3
- package/node/internals/index.js +193 -0
- package/node/models/gridRowOrderChangeParams.js +5 -0
- package/node/models/index.js +4 -4
- package/node/typeOverloads/index.js +18 -0
- package/node/utils/domUtils.js +30 -3
- package/node/utils/index.js +18 -0
- package/node/utils/releaseInfo.js +1 -1
- package/node/utils/tree/buildRowTree.js +12 -2
- package/node/utils/tree/index.js +13 -0
- package/package.json +8 -8
- package/typeOverloads/index.d.ts +1 -0
- package/typeOverloads/index.js +1 -0
- package/typeOverloads/modules.d.ts +41 -15
- package/typeOverloads/package.json +6 -0
- package/utils/domUtils.d.ts +2 -1
- package/utils/domUtils.js +30 -3
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/package.json +6 -0
- package/utils/releaseInfo.js +1 -1
- package/utils/tree/buildRowTree.d.ts +1 -0
- package/utils/tree/buildRowTree.js +9 -2
- package/utils/tree/index.d.ts +1 -0
- package/utils/tree/index.js +1 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
3
|
+
import { useGridLogger, useGridApiEventHandler, getDataGridUtilityClass, useGridSelector, gridSortModelSelector, gridRowTreeDepthSelector, useGridApiOptionHandler, gridEditRowsStateSelector } from '@mui/x-data-grid';
|
|
4
|
+
|
|
5
|
+
const useUtilityClasses = ownerState => {
|
|
6
|
+
const {
|
|
7
|
+
classes
|
|
8
|
+
} = ownerState;
|
|
9
|
+
const slots = {
|
|
10
|
+
rowDragging: ['row--dragging']
|
|
11
|
+
};
|
|
12
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Only available in DataGridPro
|
|
16
|
+
* @requires useGridRows (method)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export const useGridRowReorder = (apiRef, props) => {
|
|
21
|
+
const logger = useGridLogger(apiRef, 'useGridRowReorder');
|
|
22
|
+
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
23
|
+
const treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
|
|
24
|
+
const dragRowNode = React.useRef(null);
|
|
25
|
+
const originRowIndex = React.useRef(null);
|
|
26
|
+
const removeDnDStylesTimeout = React.useRef();
|
|
27
|
+
const ownerState = {
|
|
28
|
+
classes: props.classes
|
|
29
|
+
};
|
|
30
|
+
const classes = useUtilityClasses(ownerState);
|
|
31
|
+
const [dragRowId, setDragRowId] = React.useState('');
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
return () => {
|
|
34
|
+
clearTimeout(removeDnDStylesTimeout.current);
|
|
35
|
+
};
|
|
36
|
+
}, []); // TODO: remove sortModel check once row reorder is sorting compatible
|
|
37
|
+
// remove treeDepth once row reorder is tree compatible
|
|
38
|
+
|
|
39
|
+
const isRowReorderDisabled = React.useMemo(() => {
|
|
40
|
+
return !props.rowReordering || !!sortModel.length || treeDepth !== 1;
|
|
41
|
+
}, [props.rowReordering, sortModel, treeDepth]);
|
|
42
|
+
const handleDragStart = React.useCallback((params, event) => {
|
|
43
|
+
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
44
|
+
const editRowsState = gridEditRowsStateSelector(apiRef.current.state);
|
|
45
|
+
|
|
46
|
+
if (isRowReorderDisabled || Object.keys(editRowsState).length !== 0) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
logger.debug(`Start dragging row ${params.id}`); // Prevent drag events propagation.
|
|
51
|
+
// For more information check here https://github.com/mui/mui-x/issues/2680.
|
|
52
|
+
|
|
53
|
+
event.stopPropagation();
|
|
54
|
+
dragRowNode.current = event.currentTarget;
|
|
55
|
+
dragRowNode.current.classList.add(classes.rowDragging);
|
|
56
|
+
setDragRowId(params.id);
|
|
57
|
+
removeDnDStylesTimeout.current = setTimeout(() => {
|
|
58
|
+
dragRowNode.current.classList.remove(classes.rowDragging);
|
|
59
|
+
});
|
|
60
|
+
originRowIndex.current = apiRef.current.getRowIndex(params.id);
|
|
61
|
+
}, [isRowReorderDisabled, classes.rowDragging, logger, apiRef]);
|
|
62
|
+
const handleDragOver = React.useCallback((params, event) => {
|
|
63
|
+
logger.debug(`Dragging over row ${params.id}`);
|
|
64
|
+
event.preventDefault(); // Prevent drag events propagation.
|
|
65
|
+
// For more information check here https://github.com/mui/mui-x/issues/2680.
|
|
66
|
+
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
|
|
69
|
+
if (params.id !== dragRowId) {
|
|
70
|
+
const targetRowIndex = apiRef.current.getRowIndex(params.id);
|
|
71
|
+
apiRef.current.setRowIndex(dragRowId, targetRowIndex);
|
|
72
|
+
}
|
|
73
|
+
}, [apiRef, logger, dragRowId]);
|
|
74
|
+
const handleDragEnd = React.useCallback((params, event) => {
|
|
75
|
+
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
76
|
+
const editRowsState = gridEditRowsStateSelector(apiRef.current.state);
|
|
77
|
+
|
|
78
|
+
if (isRowReorderDisabled || Object.keys(editRowsState).length !== 0) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
logger.debug('End dragging row');
|
|
83
|
+
event.preventDefault(); // Prevent drag events propagation.
|
|
84
|
+
// For more information check here https://github.com/mui/mui-x/issues/2680.
|
|
85
|
+
|
|
86
|
+
event.stopPropagation();
|
|
87
|
+
clearTimeout(removeDnDStylesTimeout.current);
|
|
88
|
+
dragRowNode.current = null; // Check if the row was dropped outside the grid.
|
|
89
|
+
|
|
90
|
+
if (event.dataTransfer.dropEffect === 'none') {
|
|
91
|
+
// Accessing params.field may contain the wrong field as header elements are reused
|
|
92
|
+
apiRef.current.setRowIndex(dragRowId, originRowIndex.current);
|
|
93
|
+
originRowIndex.current = null;
|
|
94
|
+
} else {
|
|
95
|
+
// Emit the rowOrderChange event only once when the reordering stops.
|
|
96
|
+
const rowOrderChangeParams = {
|
|
97
|
+
row: apiRef.current.getRow(dragRowId),
|
|
98
|
+
targetIndex: apiRef.current.getRowIndex(params.id),
|
|
99
|
+
oldIndex: originRowIndex.current
|
|
100
|
+
};
|
|
101
|
+
apiRef.current.publishEvent('rowOrderChange', rowOrderChangeParams);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setDragRowId('');
|
|
105
|
+
}, [isRowReorderDisabled, logger, apiRef, dragRowId]);
|
|
106
|
+
useGridApiEventHandler(apiRef, 'rowDragStart', handleDragStart);
|
|
107
|
+
useGridApiEventHandler(apiRef, 'rowDragOver', handleDragOver);
|
|
108
|
+
useGridApiEventHandler(apiRef, 'rowDragEnd', handleDragEnd);
|
|
109
|
+
useGridApiEventHandler(apiRef, 'cellDragOver', handleDragOver);
|
|
110
|
+
useGridApiOptionHandler(apiRef, 'rowOrderChange', props.onRowOrderChange);
|
|
111
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
|
+
import { getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
5
|
+
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
6
|
+
import { GRID_REORDER_COL_DEF } from './gridRowReorderColDef';
|
|
7
|
+
|
|
8
|
+
const useUtilityClasses = ownerState => {
|
|
9
|
+
const {
|
|
10
|
+
classes
|
|
11
|
+
} = ownerState;
|
|
12
|
+
return React.useMemo(() => {
|
|
13
|
+
const slots = {
|
|
14
|
+
rowReorderCellContainer: ['rowReorderCellContainer'],
|
|
15
|
+
columnHeaderReorder: ['columnHeaderReorder']
|
|
16
|
+
};
|
|
17
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
18
|
+
}, [classes]);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const useGridRowReorderPreProcessors = (apiRef, props) => {
|
|
22
|
+
const ownerState = {
|
|
23
|
+
classes: props.classes
|
|
24
|
+
};
|
|
25
|
+
const classes = useUtilityClasses(ownerState);
|
|
26
|
+
const updateReorderColumn = React.useCallback(columnsState => {
|
|
27
|
+
const reorderColumn = _extends({}, GRID_REORDER_COL_DEF, {
|
|
28
|
+
cellClassName: classes.rowReorderCellContainer,
|
|
29
|
+
headerClassName: classes.columnHeaderReorder,
|
|
30
|
+
headerName: apiRef.current.getLocaleText('rowReorderingHeaderName')
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const shouldHaveReorderColumn = props.rowReordering;
|
|
34
|
+
const haveReorderColumn = columnsState.lookup[reorderColumn.field] != null;
|
|
35
|
+
|
|
36
|
+
if (shouldHaveReorderColumn && haveReorderColumn) {
|
|
37
|
+
return columnsState;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (shouldHaveReorderColumn && !haveReorderColumn) {
|
|
41
|
+
columnsState.lookup[reorderColumn.field] = reorderColumn;
|
|
42
|
+
columnsState.all = [reorderColumn.field, ...columnsState.all];
|
|
43
|
+
} else if (!shouldHaveReorderColumn && haveReorderColumn) {
|
|
44
|
+
delete columnsState.lookup[reorderColumn.field];
|
|
45
|
+
columnsState.all = columnsState.all.filter(field => field !== reorderColumn.field);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return columnsState;
|
|
49
|
+
}, [apiRef, classes, props.rowReordering]);
|
|
50
|
+
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateReorderColumn);
|
|
51
|
+
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useGridApiEventHandler,
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Only available in DataGridPro
|
|
6
|
-
*/
|
|
2
|
+
import { useGridApiEventHandler, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid';
|
|
7
3
|
export const useGridTreeData = apiRef => {
|
|
8
4
|
/**
|
|
9
5
|
* EVENTS
|
|
@@ -12,8 +8,6 @@ export const useGridTreeData = apiRef => {
|
|
|
12
8
|
const cellParams = apiRef.current.getCellParams(params.id, params.field);
|
|
13
9
|
|
|
14
10
|
if (cellParams.colDef.type === 'treeDataGroup' && event.key === ' ' && !event.shiftKey) {
|
|
15
|
-
event.stopPropagation();
|
|
16
|
-
event.preventDefault();
|
|
17
11
|
const filteredDescendantCount = gridFilteredDescendantCountLookupSelector(apiRef)[params.id] ?? 0;
|
|
18
12
|
|
|
19
13
|
if (filteredDescendantCount === 0) {
|
|
@@ -23,5 +17,5 @@ export const useGridTreeData = apiRef => {
|
|
|
23
17
|
apiRef.current.setRowChildrenExpansion(params.id, !params.rowNode.childrenExpanded);
|
|
24
18
|
}
|
|
25
19
|
}, [apiRef]);
|
|
26
|
-
useGridApiEventHandler(apiRef,
|
|
20
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
27
21
|
};
|
package/modern/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.11.0
|
|
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.
|
|
5
5
|
*/
|
|
6
|
-
import './typeOverloads
|
|
6
|
+
import './typeOverloads';
|
|
7
7
|
export { LicenseInfo } from '@mui/x-license-pro';
|
|
8
8
|
export * from '@mui/x-data-grid/components';
|
|
9
9
|
export * from '@mui/x-data-grid/constants';
|
|
@@ -17,4 +17,8 @@ export * from './DataGridPro';
|
|
|
17
17
|
export * from './hooks';
|
|
18
18
|
export * from './models';
|
|
19
19
|
export * from './components';
|
|
20
|
-
export
|
|
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';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from '@mui/x-data-grid/internals';
|
|
2
|
+
export { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
|
|
3
|
+
export { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders';
|
|
4
|
+
export { useGridColumnResize, columnResizeStateInitializer } from '../hooks/features/columnResize/useGridColumnResize';
|
|
5
|
+
export { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
|
|
6
|
+
export { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
|
|
7
|
+
export { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
8
|
+
export { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
9
|
+
export { useGridDetailPanelCache } from '../hooks/features/detailPanel/useGridDetailPanelCache';
|
|
10
|
+
export { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
|
|
11
|
+
export { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
|
|
12
|
+
export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorder';
|
|
13
|
+
export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
|
|
14
|
+
export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
|
|
15
|
+
export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
|
|
16
|
+
export { buildRowTree } from '../utils/tree/buildRowTree';
|
|
17
|
+
export { sortRowTree } from '../utils/tree/sortRowTree';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/modern/models/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modules';
|
package/modern/utils/domUtils.js
CHANGED
|
@@ -6,14 +6,41 @@ export function getFieldFromHeaderElem(colCellEl) {
|
|
|
6
6
|
export function findHeaderElementFromField(elem, field) {
|
|
7
7
|
return elem.querySelector(`[data-field="${field}"]`);
|
|
8
8
|
}
|
|
9
|
-
export function findGridCellElementsFromCol(col) {
|
|
10
|
-
const field = col.getAttribute('data-field');
|
|
9
|
+
export function findGridCellElementsFromCol(col, api) {
|
|
11
10
|
const root = findParentElementFromClassName(col, 'MuiDataGrid-root');
|
|
12
11
|
|
|
13
12
|
if (!root) {
|
|
14
13
|
throw new Error('MUI: The root element is not found.');
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const
|
|
16
|
+
const ariaColIndex = col.getAttribute('aria-colindex');
|
|
17
|
+
|
|
18
|
+
if (!ariaColIndex) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const colIndex = Number(ariaColIndex) - 1;
|
|
23
|
+
const cells = [];
|
|
24
|
+
const renderedRowElements = root.querySelectorAll(`.${gridClasses.row}`);
|
|
25
|
+
renderedRowElements.forEach(rowElement => {
|
|
26
|
+
const rowId = rowElement.getAttribute('data-id');
|
|
27
|
+
|
|
28
|
+
if (!rowId) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let columnIndex = colIndex;
|
|
33
|
+
const cellColSpanInfo = api.unstable_getCellColSpanInfo(rowId, colIndex);
|
|
34
|
+
|
|
35
|
+
if (cellColSpanInfo && cellColSpanInfo.spannedByColSpan) {
|
|
36
|
+
columnIndex = cellColSpanInfo.leftVisibleCellIndex;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const cell = rowElement.querySelector(`[data-colindex="${columnIndex}"]`);
|
|
40
|
+
|
|
41
|
+
if (cell) {
|
|
42
|
+
cells.push(cell);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
18
45
|
return cells;
|
|
19
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tree';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY1MjM5MjgwMDAwMA==";
|
|
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,5 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
|
|
2
|
+
export const getGroupRowIdFromPath = path => {
|
|
3
|
+
const pathStr = path.map(groupingCriteria => `${groupingCriteria.field}/${groupingCriteria.key}`).join('-');
|
|
4
|
+
return `auto-generated-row-${pathStr}`;
|
|
5
|
+
};
|
|
3
6
|
/**
|
|
4
7
|
* Transform a list of rows into a tree structure where each row references its parent and children.
|
|
5
8
|
* If a row have a parent which does not exist in the input rows, creates an auto generated row
|
|
@@ -29,6 +32,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
29
32
|
}
|
|
30
33
|
```
|
|
31
34
|
*/
|
|
35
|
+
|
|
32
36
|
export const buildRowTree = params => {
|
|
33
37
|
// During the build, we store the children as a Record to avoid linear complexity when checking if a children is already defined.
|
|
34
38
|
const tempTree = {};
|
|
@@ -37,6 +41,8 @@ export const buildRowTree = params => {
|
|
|
37
41
|
|
|
38
42
|
const idRowsLookup = _extends({}, params.idRowsLookup);
|
|
39
43
|
|
|
44
|
+
const idToIdLookup = _extends({}, params.idToIdLookup);
|
|
45
|
+
|
|
40
46
|
const groupingCriteriaToIdTree = {};
|
|
41
47
|
|
|
42
48
|
const isGroupExpandedByDefault = node => {
|
|
@@ -88,7 +94,7 @@ export const buildRowTree = params => {
|
|
|
88
94
|
if (depth === row.path.length - 1) {
|
|
89
95
|
nodeId = row.id;
|
|
90
96
|
} else {
|
|
91
|
-
nodeId =
|
|
97
|
+
nodeId = getGroupRowIdFromPath(row.path.slice(0, depth + 1));
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
keyConfig = {
|
|
@@ -162,6 +168,7 @@ export const buildRowTree = params => {
|
|
|
162
168
|
treeDepth,
|
|
163
169
|
ids,
|
|
164
170
|
idRowsLookup,
|
|
171
|
+
idToIdLookup,
|
|
165
172
|
groupingName: params.groupingName
|
|
166
173
|
};
|
|
167
174
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getGroupRowIdFromPath } from './buildRowTree';
|
|
@@ -96,6 +96,11 @@ DataGridProRaw.propTypes = {
|
|
|
96
96
|
*/
|
|
97
97
|
autoPageSize: _propTypes.default.bool,
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Controls the modes of the cells.
|
|
101
|
+
*/
|
|
102
|
+
cellModesModel: _propTypes.default.object,
|
|
103
|
+
|
|
99
104
|
/**
|
|
100
105
|
* If `true`, the grid get a first column with a checkbox that allows to select rows.
|
|
101
106
|
* @default false
|
|
@@ -249,7 +254,7 @@ DataGridProRaw.propTypes = {
|
|
|
249
254
|
disableMultipleColumnsSorting: _propTypes.default.bool,
|
|
250
255
|
|
|
251
256
|
/**
|
|
252
|
-
* If `true`, multiple selection using the
|
|
257
|
+
* If `true`, multiple selection using the Ctrl or CMD key is disabled.
|
|
253
258
|
* @default false
|
|
254
259
|
*/
|
|
255
260
|
disableMultipleSelection: _propTypes.default.bool,
|
|
@@ -322,7 +327,9 @@ DataGridProRaw.propTypes = {
|
|
|
322
327
|
operatorValue: _propTypes.default.string,
|
|
323
328
|
value: _propTypes.default.any
|
|
324
329
|
})).isRequired,
|
|
325
|
-
linkOperator: _propTypes.default.oneOf(['and', 'or'])
|
|
330
|
+
linkOperator: _propTypes.default.oneOf(['and', 'or']),
|
|
331
|
+
quickFilterLogicOperator: _propTypes.default.oneOf(['and', 'or']),
|
|
332
|
+
quickFilterValues: _propTypes.default.array
|
|
326
333
|
}),
|
|
327
334
|
|
|
328
335
|
/**
|
|
@@ -454,6 +461,14 @@ DataGridProRaw.propTypes = {
|
|
|
454
461
|
*/
|
|
455
462
|
isRowSelectable: _propTypes.default.func,
|
|
456
463
|
|
|
464
|
+
/**
|
|
465
|
+
* If `true`, the selection model will retain selected rows that do not exist.
|
|
466
|
+
* Useful when using server side pagination and row selections need to be retained
|
|
467
|
+
* when changing pages.
|
|
468
|
+
* @default false
|
|
469
|
+
*/
|
|
470
|
+
keepNonExistentRowsSelected: _propTypes.default.bool,
|
|
471
|
+
|
|
457
472
|
/**
|
|
458
473
|
* If `true`, a loading overlay is displayed.
|
|
459
474
|
*/
|
|
@@ -541,6 +556,13 @@ DataGridProRaw.propTypes = {
|
|
|
541
556
|
*/
|
|
542
557
|
onCellKeyDown: _propTypes.default.func,
|
|
543
558
|
|
|
559
|
+
/**
|
|
560
|
+
* Callback fired when the `cellModesModel` prop changes.
|
|
561
|
+
* @param {GridCellModesModel} cellModesModel Object containig which cells are in "edit" mode.
|
|
562
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
563
|
+
*/
|
|
564
|
+
onCellModesModelChange: _propTypes.default.func,
|
|
565
|
+
|
|
544
566
|
/**
|
|
545
567
|
* Callback fired when a click event comes from a column header element.
|
|
546
568
|
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
@@ -642,7 +664,7 @@ DataGridProRaw.propTypes = {
|
|
|
642
664
|
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
|
|
643
665
|
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
|
|
644
666
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
645
|
-
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/api/data-grid/grid-col-def/)
|
|
667
|
+
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
|
|
646
668
|
*/
|
|
647
669
|
onEditCellPropsChange: _propTypes.default.func,
|
|
648
670
|
|
|
@@ -764,6 +786,21 @@ DataGridProRaw.propTypes = {
|
|
|
764
786
|
*/
|
|
765
787
|
onRowGroupingModelChange: _propTypes.default.func,
|
|
766
788
|
|
|
789
|
+
/**
|
|
790
|
+
* Callback fired when the `rowModesModel` prop changes.
|
|
791
|
+
* @param {GridRowModesModel} rowModesModel Object containig which rows are in "edit" mode.
|
|
792
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
793
|
+
*/
|
|
794
|
+
onRowModesModelChange: _propTypes.default.func,
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Callback fired when a row is being reordered.
|
|
798
|
+
* @param {GridRowOrderChangeParams} params With all properties from [[GridRowOrderChangeParams]].
|
|
799
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
800
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
801
|
+
*/
|
|
802
|
+
onRowOrderChange: _propTypes.default.func,
|
|
803
|
+
|
|
767
804
|
/**
|
|
768
805
|
* Callback fired when scrolling to the bottom of the grid viewport.
|
|
769
806
|
* @param {GridRowScrollEndParams} params With all properties from [[GridRowScrollEndParams]].
|
|
@@ -870,6 +907,17 @@ DataGridProRaw.propTypes = {
|
|
|
870
907
|
*/
|
|
871
908
|
rowHeight: _propTypes.default.number,
|
|
872
909
|
|
|
910
|
+
/**
|
|
911
|
+
* Controls the modes of the rows.
|
|
912
|
+
*/
|
|
913
|
+
rowModesModel: _propTypes.default.object,
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* If `true`, the reordering of rows is enabled.
|
|
917
|
+
* @default false
|
|
918
|
+
*/
|
|
919
|
+
rowReordering: _propTypes.default.bool,
|
|
920
|
+
|
|
873
921
|
/**
|
|
874
922
|
* Set of rows of type [[GridRowsProp]].
|
|
875
923
|
*/
|
|
@@ -17,10 +17,6 @@ var _useGridTreeData = require("../hooks/features/treeData/useGridTreeData");
|
|
|
17
17
|
|
|
18
18
|
var _useGridTreeDataPreProcessors = require("../hooks/features/treeData/useGridTreeDataPreProcessors");
|
|
19
19
|
|
|
20
|
-
var _useGridRowGrouping = require("../hooks/features/rowGrouping/useGridRowGrouping");
|
|
21
|
-
|
|
22
|
-
var _useGridRowGroupingPreProcessors = require("../hooks/features/rowGrouping/useGridRowGroupingPreProcessors");
|
|
23
|
-
|
|
24
20
|
var _useGridColumnPinning = require("../hooks/features/columnPinning/useGridColumnPinning");
|
|
25
21
|
|
|
26
22
|
var _useGridColumnPinningPreProcessors = require("../hooks/features/columnPinning/useGridColumnPinningPreProcessors");
|
|
@@ -31,6 +27,14 @@ var _useGridDetailPanelCache = require("../hooks/features/detailPanel/useGridDet
|
|
|
31
27
|
|
|
32
28
|
var _useGridDetailPanelPreProcessors = require("../hooks/features/detailPanel/useGridDetailPanelPreProcessors");
|
|
33
29
|
|
|
30
|
+
var _useGridRowReorder = require("../hooks/features/rowReorder/useGridRowReorder");
|
|
31
|
+
|
|
32
|
+
var _useGridRowReorderPreProcessors = require("../hooks/features/rowReorder/useGridRowReorderPreProcessors");
|
|
33
|
+
|
|
34
|
+
var _useGridRowGrouping = require("../hooks/features/rowGrouping/useGridRowGrouping");
|
|
35
|
+
|
|
36
|
+
var _useGridRowGroupingPreProcessors = require("../hooks/features/rowGrouping/useGridRowGroupingPreProcessors");
|
|
37
|
+
|
|
34
38
|
// Pro-only features
|
|
35
39
|
const useDataGridProComponent = (inputApiRef, props) => {
|
|
36
40
|
var _props$experimentalFe, _props$experimentalFe2;
|
|
@@ -41,6 +45,7 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
41
45
|
*/
|
|
42
46
|
|
|
43
47
|
(0, _internals.useGridSelectionPreProcessors)(apiRef, props);
|
|
48
|
+
(0, _useGridRowReorderPreProcessors.useGridRowReorderPreProcessors)(apiRef, props);
|
|
44
49
|
(0, _useGridRowGroupingPreProcessors.useGridRowGroupingPreProcessors)(apiRef, props);
|
|
45
50
|
(0, _useGridTreeDataPreProcessors.useGridTreeDataPreProcessors)(apiRef, props);
|
|
46
51
|
(0, _useGridDetailPanelPreProcessors.useGridDetailPanelPreProcessors)(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
|
|
@@ -78,18 +83,20 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
78
83
|
(0, _internals.useGridColumns)(apiRef, props);
|
|
79
84
|
(0, _internals.useGridRows)(apiRef, props);
|
|
80
85
|
(0, _internals.useGridParamsApi)(apiRef);
|
|
86
|
+
(0, _internals.useGridColumnSpanning)(apiRef);
|
|
81
87
|
(0, _useGridDetailPanelCache.useGridDetailPanelCache)(apiRef, props);
|
|
82
88
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? _internals.useGridEditing_new : _internals.useGridEditing_old;
|
|
83
89
|
useGridEditing(apiRef, props);
|
|
84
90
|
(0, _internals.useGridFocus)(apiRef, props);
|
|
85
|
-
(0, _internals.useGridSorting)(apiRef, props);
|
|
86
91
|
(0, _internals.useGridPreferencesPanel)(apiRef);
|
|
87
92
|
(0, _internals.useGridFilter)(apiRef, props);
|
|
93
|
+
(0, _internals.useGridSorting)(apiRef, props);
|
|
88
94
|
(0, _internals.useGridDensity)(apiRef, props);
|
|
89
95
|
(0, _useGridColumnReorder.useGridColumnReorder)(apiRef, props);
|
|
90
96
|
(0, _useGridColumnResize.useGridColumnResize)(apiRef, props);
|
|
91
97
|
(0, _internals.useGridPagination)(apiRef, props);
|
|
92
98
|
(0, _internals.useGridRowsMeta)(apiRef, props);
|
|
99
|
+
(0, _useGridRowReorder.useGridRowReorder)(apiRef, props);
|
|
93
100
|
(0, _internals.useGridScroll)(apiRef, props);
|
|
94
101
|
(0, _useGridInfiniteLoader.useGridInfiniteLoader)(apiRef, props);
|
|
95
102
|
(0, _internals.useGridColumnMenu)(apiRef);
|
|
@@ -15,6 +15,8 @@ var _styles = require("@mui/material/styles");
|
|
|
15
15
|
|
|
16
16
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
17
17
|
|
|
18
|
+
var _internals = require("@mui/x-data-grid/internals");
|
|
19
|
+
|
|
18
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
21
|
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -27,13 +29,15 @@ const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = (0, _extends2.default)({}, _xDataGrid
|
|
|
27
29
|
treeData: false,
|
|
28
30
|
defaultGroupingExpansionDepth: 0,
|
|
29
31
|
disableColumnPinning: false,
|
|
30
|
-
disableRowGrouping: false,
|
|
31
32
|
disableChildrenFiltering: false,
|
|
32
33
|
disableChildrenSorting: false,
|
|
33
|
-
|
|
34
|
-
getDetailPanelHeight: () => 500
|
|
34
|
+
rowReordering: false,
|
|
35
|
+
getDetailPanelHeight: () => 500,
|
|
36
|
+
disableRowGrouping: false,
|
|
37
|
+
rowGroupingColumnMode: 'single'
|
|
35
38
|
});
|
|
36
39
|
exports.DATA_GRID_PRO_PROPS_DEFAULT_VALUES = DATA_GRID_PRO_PROPS_DEFAULT_VALUES;
|
|
40
|
+
const rowGroupingWarning = (0, _internals.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');
|
|
37
41
|
|
|
38
42
|
const useDataGridProProps = inProps => {
|
|
39
43
|
const themedProps = (0, _styles.useThemeProps)({
|
|
@@ -54,11 +58,23 @@ const useDataGridProProps = inProps => {
|
|
|
54
58
|
});
|
|
55
59
|
return mergedComponents;
|
|
56
60
|
}, [themedProps.components]);
|
|
61
|
+
|
|
62
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
63
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
var _themedProps$experime;
|
|
66
|
+
|
|
67
|
+
if ((_themedProps$experime = themedProps.experimentalFeatures) != null && _themedProps$experime.rowGrouping) {
|
|
68
|
+
rowGroupingWarning();
|
|
69
|
+
}
|
|
70
|
+
}, [themedProps.experimentalFeatures]);
|
|
71
|
+
}
|
|
72
|
+
|
|
57
73
|
return React.useMemo(() => {
|
|
58
|
-
var _themedProps$
|
|
74
|
+
var _themedProps$experime2;
|
|
59
75
|
|
|
60
76
|
return (0, _extends2.default)({}, DATA_GRID_PRO_PROPS_DEFAULT_VALUES, themedProps, {
|
|
61
|
-
disableRowGrouping: themedProps.disableRowGrouping || !((_themedProps$
|
|
77
|
+
disableRowGrouping: themedProps.disableRowGrouping || !((_themedProps$experime2 = themedProps.experimentalFeatures) != null && _themedProps$experime2.rowGrouping),
|
|
62
78
|
localeText,
|
|
63
79
|
components,
|
|
64
80
|
signature: 'DataGridPro'
|
|
@@ -110,13 +110,12 @@ const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
110
110
|
const newScrollbarSize = apiRef.current.windowRef.current.offsetWidth - apiRef.current.windowRef.current.clientWidth;
|
|
111
111
|
setScrollbarSize(newScrollbarSize);
|
|
112
112
|
}, [apiRef]);
|
|
113
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
113
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'virtualScrollerContentSizeChange', handleContentSizeChange);
|
|
114
114
|
const pinnedColumns = (0, _xDataGrid.useGridSelector)(apiRef, _columnPinning.gridPinnedColumnsSelector);
|
|
115
115
|
const [leftPinnedColumns, rightPinnedColumns] = (0, _DataGridProVirtualScroller.filterColumns)(pinnedColumns, visibleColumnFields);
|
|
116
116
|
const {
|
|
117
117
|
isDragging,
|
|
118
118
|
renderContext,
|
|
119
|
-
updateInnerPosition,
|
|
120
119
|
getRootProps,
|
|
121
120
|
getInnerProps,
|
|
122
121
|
getColumns
|
|
@@ -130,11 +129,6 @@ const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
130
129
|
classes: rootProps.classes
|
|
131
130
|
};
|
|
132
131
|
const classes = useUtilityClasses(ownerState);
|
|
133
|
-
React.useEffect(() => {
|
|
134
|
-
if (renderContext) {
|
|
135
|
-
updateInnerPosition(renderContext);
|
|
136
|
-
}
|
|
137
|
-
}, [renderContext, updateInnerPosition]);
|
|
138
132
|
const leftRenderContext = renderContext && leftPinnedColumns.length ? (0, _extends2.default)({}, renderContext, {
|
|
139
133
|
firstColumnIndex: 0,
|
|
140
134
|
lastColumnIndex: leftPinnedColumns.length
|
|
@@ -99,7 +99,9 @@ const VirtualScrollerDetailPanels = (0, _styles.styled)('div', {
|
|
|
99
99
|
name: 'MuiDataGrid',
|
|
100
100
|
slot: 'DetailPanels',
|
|
101
101
|
overridesResolver: (props, styles) => styles.detailPanels
|
|
102
|
-
})({
|
|
102
|
+
})({
|
|
103
|
+
position: 'relative'
|
|
104
|
+
});
|
|
103
105
|
const VirtualScrollerDetailPanel = (0, _styles.styled)(_Box.default, {
|
|
104
106
|
name: 'MuiDataGrid',
|
|
105
107
|
slot: 'DetailPanel',
|
|
@@ -200,11 +202,9 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
200
202
|
updateRenderZonePosition(renderContext);
|
|
201
203
|
}
|
|
202
204
|
}, [renderContext, updateRenderZonePosition]);
|
|
203
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
204
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
205
|
-
|
|
206
|
-
refreshRenderZonePosition();
|
|
207
|
-
}, [refreshRenderZonePosition]);
|
|
205
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'columnWidthChange', refreshRenderZonePosition);
|
|
206
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'columnOrderChange', refreshRenderZonePosition);
|
|
207
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'rowOrderChange', refreshRenderZonePosition);
|
|
208
208
|
const leftRenderContext = renderContext && leftPinnedColumns.length > 0 ? (0, _extends2.default)({}, renderContext, {
|
|
209
209
|
firstColumnIndex: 0,
|
|
210
210
|
lastColumnIndex: leftPinnedColumns.length
|
|
@@ -95,10 +95,21 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
95
95
|
*/
|
|
96
96
|
field: _propTypes.default.string.isRequired,
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* A ref allowing to set imperative focus.
|
|
100
|
+
* It can be passed to the element that should receive focus.
|
|
101
|
+
* @ignore - do not document.
|
|
102
|
+
*/
|
|
103
|
+
focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
104
|
+
current: _propTypes.default.shape({
|
|
105
|
+
focus: _propTypes.default.func.isRequired
|
|
106
|
+
})
|
|
107
|
+
})]),
|
|
108
|
+
|
|
98
109
|
/**
|
|
99
110
|
* The cell value formatted with the column valueFormatter.
|
|
100
111
|
*/
|
|
101
|
-
formattedValue: _propTypes.default.any
|
|
112
|
+
formattedValue: _propTypes.default.any,
|
|
102
113
|
|
|
103
114
|
/**
|
|
104
115
|
* Get the cell value of a row and field.
|
|
@@ -142,5 +153,5 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
142
153
|
/**
|
|
143
154
|
* The cell value, but if the column has valueGetter, use getValue.
|
|
144
155
|
*/
|
|
145
|
-
value: _propTypes.default.any
|
|
156
|
+
value: _propTypes.default.any
|
|
146
157
|
} : void 0;
|
|
@@ -63,7 +63,7 @@ const GridGroupingCriteriaCell = props => {
|
|
|
63
63
|
event.stopPropagation();
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
apiRef.current.publishEvent(
|
|
66
|
+
apiRef.current.publishEvent('cellKeyDown', props, event);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const handleClick = event => {
|