@mui/x-data-grid-pro 5.10.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 +163 -10
- package/DataGridPro/DataGridPro.d.ts +1 -1
- package/DataGridPro/DataGridPro.js +36 -2
- package/DataGridPro/useDataGridProComponent.js +2 -2
- package/DataGridPro/useDataGridProProps.js +19 -5
- package/LICENSE +2 -2
- package/README.md +1 -1
- package/components/DataGridProColumnHeaders.js +2 -2
- package/components/DataGridProVirtualScroller.js +7 -5
- package/components/GridGroupingCriteriaCell.js +2 -2
- package/components/GridRowReorderCell.js +4 -4
- package/components/GridTreeDataGroupingCell.js +2 -2
- package/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/hooks/features/columnReorder/useGridColumnReorder.d.ts +0 -1
- package/hooks/features/columnReorder/useGridColumnReorder.js +7 -8
- package/hooks/features/columnResize/useGridColumnResize.d.ts +0 -1
- package/hooks/features/columnResize/useGridColumnResize.js +13 -14
- package/hooks/features/detailPanel/useGridDetailPanel.js +4 -4
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/hooks/features/index.d.ts +0 -1
- package/hooks/features/index.js +0 -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 +6 -8
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/hooks/features/rowReorder/useGridRowReorder.js +7 -7
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +1 -1
- package/hooks/features/treeData/useGridTreeData.d.ts +0 -3
- package/hooks/features/treeData/useGridTreeData.js +2 -6
- 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 +36 -2
- package/legacy/DataGridPro/useDataGridProComponent.js +2 -2
- package/legacy/DataGridPro/useDataGridProProps.js +19 -5
- package/legacy/components/DataGridProColumnHeaders.js +2 -2
- package/legacy/components/DataGridProVirtualScroller.js +7 -5
- package/legacy/components/GridGroupingCriteriaCell.js +2 -2
- package/legacy/components/GridRowReorderCell.js +4 -4
- package/legacy/components/GridTreeDataGroupingCell.js +2 -2
- package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +7 -8
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +13 -14
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +4 -4
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/legacy/hooks/features/index.js +0 -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 +6 -8
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/legacy/hooks/features/rowReorder/useGridRowReorder.js +7 -7
- package/legacy/hooks/features/treeData/useGridTreeData.js +2 -6
- package/legacy/index.js +7 -3
- package/legacy/internals/index.js +17 -0
- package/legacy/models/index.js +1 -3
- package/legacy/typeOverloads/index.js +1 -0
- 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 +29 -29
- package/models/gridApiPro.d.ts +3 -2
- package/models/gridStatePro.d.ts +4 -3
- package/models/index.d.ts +0 -2
- package/models/index.js +1 -3
- package/modern/DataGridPro/DataGridPro.js +36 -2
- package/modern/DataGridPro/useDataGridProComponent.js +2 -2
- package/modern/DataGridPro/useDataGridProProps.js +15 -3
- package/modern/components/DataGridProColumnHeaders.js +2 -2
- package/modern/components/DataGridProVirtualScroller.js +7 -5
- package/modern/components/GridGroupingCriteriaCell.js +2 -2
- package/modern/components/GridRowReorderCell.js +4 -4
- package/modern/components/GridTreeDataGroupingCell.js +2 -2
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/modern/hooks/features/columnReorder/useGridColumnReorder.js +7 -8
- package/modern/hooks/features/columnResize/useGridColumnResize.js +13 -14
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +4 -4
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/modern/hooks/features/index.js +0 -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 +6 -8
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +7 -7
- package/modern/hooks/features/treeData/useGridTreeData.js +2 -6
- package/modern/index.js +7 -3
- package/modern/internals/index.js +17 -0
- package/modern/models/index.js +1 -3
- package/modern/typeOverloads/index.js +1 -0
- 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 +36 -2
- package/node/DataGridPro/useDataGridProComponent.js +4 -4
- package/node/DataGridPro/useDataGridProProps.js +20 -5
- package/node/components/DataGridProColumnHeaders.js +1 -1
- package/node/components/DataGridProVirtualScroller.js +6 -4
- package/node/components/GridGroupingCriteriaCell.js +1 -1
- package/node/components/GridRowReorderCell.js +3 -3
- package/node/components/GridTreeDataGroupingCell.js +1 -1
- package/node/hooks/features/columnPinning/useGridColumnPinning.js +3 -3
- package/node/hooks/features/columnReorder/useGridColumnReorder.js +6 -7
- package/node/hooks/features/columnResize/useGridColumnResize.js +12 -13
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +3 -3
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/node/hooks/features/index.js +0 -13
- 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 +5 -7
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +4 -4
- package/node/hooks/features/rowReorder/useGridRowReorder.js +6 -6
- package/node/hooks/features/treeData/useGridTreeData.js +1 -4
- package/node/index.js +45 -3
- package/node/internals/index.js +193 -0
- package/node/models/index.js +0 -13
- package/node/typeOverloads/index.js +18 -0
- 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 +4 -4
- package/typeOverloads/index.d.ts +1 -0
- package/typeOverloads/index.js +1 -0
- package/typeOverloads/modules.d.ts +38 -15
- package/typeOverloads/package.json +6 -0
- 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
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useGridSelector,
|
|
2
|
+
import { useGridSelector, useGridApiEventHandler, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, gridRowsMetaSelector } from '@mui/x-data-grid';
|
|
3
3
|
import { useGridVisibleRows } from '@mui/x-data-grid/internals';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Only available in DataGridPro
|
|
7
6
|
* @requires useGridColumns (state)
|
|
8
7
|
* @requires useGridDimensions (method) - can be after
|
|
9
8
|
* @requires useGridScroll (method
|
|
@@ -34,7 +33,7 @@ export const useGridInfiniteLoader = (apiRef, props) => {
|
|
|
34
33
|
viewportPageSize,
|
|
35
34
|
virtualRowsCount: currentPage.rows.length
|
|
36
35
|
};
|
|
37
|
-
apiRef.current.publishEvent(
|
|
36
|
+
apiRef.current.publishEvent('rowsScrollEnd', rowScrollEndParam);
|
|
38
37
|
isInScrollBottomArea.current = true;
|
|
39
38
|
}
|
|
40
39
|
}, [contentHeight, props.scrollEndThreshold, visibleColumns, apiRef, currentPage.rows.length]);
|
|
@@ -47,6 +46,6 @@ export const useGridInfiniteLoader = (apiRef, props) => {
|
|
|
47
46
|
top
|
|
48
47
|
});
|
|
49
48
|
}, [handleRowsScrollEnd]);
|
|
50
|
-
useGridApiEventHandler(apiRef,
|
|
51
|
-
useGridApiOptionHandler(apiRef,
|
|
49
|
+
useGridApiEventHandler(apiRef, 'rowsScroll', handleGridScroll);
|
|
50
|
+
useGridApiOptionHandler(apiRef, 'rowsScrollEnd', props.onRowsScrollEnd);
|
|
52
51
|
};
|
|
@@ -23,12 +23,12 @@ export const isGroupingColumn = field => field === GRID_ROW_GROUPING_SINGLE_GROU
|
|
|
23
23
|
/**
|
|
24
24
|
* When filtering a group, we only want to filter according to the items related to this grouping column.
|
|
25
25
|
*/
|
|
26
|
-
const shouldApplyFilterItemOnGroup = (
|
|
27
|
-
if (
|
|
26
|
+
const shouldApplyFilterItemOnGroup = (columnField, node) => {
|
|
27
|
+
if (columnField === GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD) {
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const groupingCriteriaField = getRowGroupingCriteriaFromGroupingField(
|
|
31
|
+
const groupingCriteriaField = getRowGroupingCriteriaFromGroupingField(columnField);
|
|
32
32
|
return groupingCriteriaField === node.groupingField;
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
@@ -54,7 +54,7 @@ export const filterRowTreeFromGroupingColumns = params => {
|
|
|
54
54
|
if (!isRowMatchingFilters) {
|
|
55
55
|
isMatchingFilters = true;
|
|
56
56
|
} else {
|
|
57
|
-
const shouldApplyItem = node.isAutoGenerated ?
|
|
57
|
+
const shouldApplyItem = node.isAutoGenerated ? columnField => shouldApplyFilterItemOnGroup(columnField, node) : undefined;
|
|
58
58
|
isMatchingFilters = isRowMatchingFilters(node.id, shouldApplyItem);
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import Divider from '@mui/material/Divider';
|
|
4
|
-
import {
|
|
4
|
+
import { useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid';
|
|
5
5
|
import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector, gridRowGroupingStateSelector } from './gridRowGroupingSelector';
|
|
7
7
|
import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability } from './gridRowGroupingUtils';
|
|
@@ -15,11 +15,9 @@ export const rowGroupingStateInitializer = (state, props) => _extends({}, state,
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
/**
|
|
18
|
-
* Only available in DataGridPro
|
|
19
18
|
* @requires useGridColumns (state, method) - can be after, async only
|
|
20
19
|
* @requires useGridRows (state, method) - can be after, async only
|
|
21
20
|
* @requires useGridParamsApi (method) - can be after, async only
|
|
22
|
-
* TODO: Move the the Premium plan once available and remove the `experimentalFeatures.rowGrouping` flag
|
|
23
21
|
*/
|
|
24
22
|
|
|
25
23
|
export const useGridRowGrouping = (apiRef, props) => {
|
|
@@ -28,7 +26,7 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
28
26
|
propModel: props.rowGroupingModel,
|
|
29
27
|
propOnChange: props.onRowGroupingModelChange,
|
|
30
28
|
stateSelector: gridRowGroupingModelSelector,
|
|
31
|
-
changeEvent:
|
|
29
|
+
changeEvent: 'rowGroupingModelChange'
|
|
32
30
|
});
|
|
33
31
|
/**
|
|
34
32
|
* API METHODS
|
|
@@ -175,13 +173,13 @@ export const useGridRowGrouping = (apiRef, props) => {
|
|
|
175
173
|
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|
|
176
174
|
|
|
177
175
|
if (apiRef.current.unstable_getActiveStrategy('rowTree') === ROW_GROUPING_STRATEGY) {
|
|
178
|
-
apiRef.current.publishEvent(
|
|
176
|
+
apiRef.current.publishEvent('activeStrategyProcessorChange', 'rowTreeCreation');
|
|
179
177
|
}
|
|
180
178
|
}
|
|
181
179
|
}, [apiRef, props.disableRowGrouping]);
|
|
182
|
-
useGridApiEventHandler(apiRef,
|
|
183
|
-
useGridApiEventHandler(apiRef,
|
|
184
|
-
useGridApiEventHandler(apiRef,
|
|
180
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
181
|
+
useGridApiEventHandler(apiRef, 'columnsChange', checkGroupingColumnsModelDiff);
|
|
182
|
+
useGridApiEventHandler(apiRef, 'rowGroupingModelChange', checkGroupingColumnsModelDiff);
|
|
185
183
|
/**
|
|
186
184
|
* EFFECTS
|
|
187
185
|
*/
|
|
@@ -2,11 +2,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid';
|
|
4
4
|
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
|
|
5
|
+
import { sortRowTree } from '../../../utils/tree/sortRowTree';
|
|
6
|
+
import { buildRowTree } from '../../../utils/tree/buildRowTree';
|
|
5
7
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
6
8
|
import { createGroupingColDefForAllGroupingCriteria, createGroupingColDefForOneGroupingCriteria } from './createGroupingColDef';
|
|
7
9
|
import { filterRowTreeFromGroupingColumns, getColDefOverrides, ROW_GROUPING_STRATEGY, isGroupingColumn, setStrategyAvailability } from './gridRowGroupingUtils';
|
|
8
|
-
import { buildRowTree } from '../../../utils/tree/buildRowTree';
|
|
9
|
-
import { sortRowTree } from '../../../utils/tree/sortRowTree';
|
|
10
10
|
export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
11
11
|
const getGroupingColDefs = React.useCallback(columnsState => {
|
|
12
12
|
if (props.disableRowGrouping) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
3
|
-
import { useGridLogger,
|
|
3
|
+
import { useGridLogger, useGridApiEventHandler, getDataGridUtilityClass, useGridSelector, gridSortModelSelector, gridRowTreeDepthSelector, useGridApiOptionHandler, gridEditRowsStateSelector } from '@mui/x-data-grid';
|
|
4
4
|
|
|
5
5
|
const useUtilityClasses = ownerState => {
|
|
6
6
|
const {
|
|
@@ -98,14 +98,14 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
98
98
|
targetIndex: apiRef.current.getRowIndex(params.id),
|
|
99
99
|
oldIndex: originRowIndex.current
|
|
100
100
|
};
|
|
101
|
-
apiRef.current.publishEvent(
|
|
101
|
+
apiRef.current.publishEvent('rowOrderChange', rowOrderChangeParams);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
setDragRowId('');
|
|
105
105
|
}, [isRowReorderDisabled, logger, apiRef, dragRowId]);
|
|
106
|
-
useGridApiEventHandler(apiRef,
|
|
107
|
-
useGridApiEventHandler(apiRef,
|
|
108
|
-
useGridApiEventHandler(apiRef,
|
|
109
|
-
useGridApiEventHandler(apiRef,
|
|
110
|
-
useGridApiOptionHandler(apiRef,
|
|
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
111
|
};
|
|
@@ -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
|
|
@@ -21,5 +17,5 @@ export const useGridTreeData = apiRef => {
|
|
|
21
17
|
apiRef.current.setRowChildrenExpansion(params.id, !params.rowNode.childrenExpanded);
|
|
22
18
|
}
|
|
23
19
|
}, [apiRef]);
|
|
24
|
-
useGridApiEventHandler(apiRef,
|
|
20
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
25
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';
|
package/modern/models/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modules';
|
|
@@ -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]].
|
|
@@ -764,6 +786,13 @@ 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
|
+
|
|
767
796
|
/**
|
|
768
797
|
* Callback fired when a row is being reordered.
|
|
769
798
|
* @param {GridRowOrderChangeParams} params With all properties from [[GridRowOrderChangeParams]].
|
|
@@ -878,6 +907,11 @@ DataGridProRaw.propTypes = {
|
|
|
878
907
|
*/
|
|
879
908
|
rowHeight: _propTypes.default.number,
|
|
880
909
|
|
|
910
|
+
/**
|
|
911
|
+
* Controls the modes of the rows.
|
|
912
|
+
*/
|
|
913
|
+
rowModesModel: _propTypes.default.object,
|
|
914
|
+
|
|
881
915
|
/**
|
|
882
916
|
* If `true`, the reordering of rows is enabled.
|
|
883
917
|
* @default false
|
|
@@ -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");
|
|
@@ -35,6 +31,10 @@ var _useGridRowReorder = require("../hooks/features/rowReorder/useGridRowReorder
|
|
|
35
31
|
|
|
36
32
|
var _useGridRowReorderPreProcessors = require("../hooks/features/rowReorder/useGridRowReorderPreProcessors");
|
|
37
33
|
|
|
34
|
+
var _useGridRowGrouping = require("../hooks/features/rowGrouping/useGridRowGrouping");
|
|
35
|
+
|
|
36
|
+
var _useGridRowGroupingPreProcessors = require("../hooks/features/rowGrouping/useGridRowGroupingPreProcessors");
|
|
37
|
+
|
|
38
38
|
// Pro-only features
|
|
39
39
|
const useDataGridProComponent = (inputApiRef, props) => {
|
|
40
40
|
var _props$experimentalFe, _props$experimentalFe2;
|
|
@@ -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,14 +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
|
-
rowGroupingColumnMode: 'single',
|
|
34
34
|
rowReordering: false,
|
|
35
|
-
getDetailPanelHeight: () => 500
|
|
35
|
+
getDetailPanelHeight: () => 500,
|
|
36
|
+
disableRowGrouping: false,
|
|
37
|
+
rowGroupingColumnMode: 'single'
|
|
36
38
|
});
|
|
37
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');
|
|
38
41
|
|
|
39
42
|
const useDataGridProProps = inProps => {
|
|
40
43
|
const themedProps = (0, _styles.useThemeProps)({
|
|
@@ -55,11 +58,23 @@ const useDataGridProProps = inProps => {
|
|
|
55
58
|
});
|
|
56
59
|
return mergedComponents;
|
|
57
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
|
+
|
|
58
73
|
return React.useMemo(() => {
|
|
59
|
-
var _themedProps$
|
|
74
|
+
var _themedProps$experime2;
|
|
60
75
|
|
|
61
76
|
return (0, _extends2.default)({}, DATA_GRID_PRO_PROPS_DEFAULT_VALUES, themedProps, {
|
|
62
|
-
disableRowGrouping: themedProps.disableRowGrouping || !((_themedProps$
|
|
77
|
+
disableRowGrouping: themedProps.disableRowGrouping || !((_themedProps$experime2 = themedProps.experimentalFeatures) != null && _themedProps$experime2.rowGrouping),
|
|
63
78
|
localeText,
|
|
64
79
|
components,
|
|
65
80
|
signature: 'DataGridPro'
|
|
@@ -110,7 +110,7 @@ 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 {
|
|
@@ -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,9 +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
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
205
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'columnWidthChange', refreshRenderZonePosition);
|
|
206
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'columnOrderChange', refreshRenderZonePosition);
|
|
207
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'rowOrderChange', refreshRenderZonePosition);
|
|
206
208
|
const leftRenderContext = renderContext && leftPinnedColumns.length > 0 ? (0, _extends2.default)({}, renderContext, {
|
|
207
209
|
firstColumnIndex: 0,
|
|
208
210
|
lastColumnIndex: leftPinnedColumns.length
|
|
@@ -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 => {
|
|
@@ -70,9 +70,9 @@ const GridRowReorderCell = params => {
|
|
|
70
70
|
}
|
|
71
71
|
}, [apiRef, params.row.id]);
|
|
72
72
|
const draggableEventHandlers = {
|
|
73
|
-
onDragStart: publish(
|
|
74
|
-
onDragOver: publish(
|
|
75
|
-
onDragEnd: publish(
|
|
73
|
+
onDragStart: publish('rowDragStart'),
|
|
74
|
+
onDragOver: publish('rowDragOver'),
|
|
75
|
+
onDragEnd: publish('rowDragEnd')
|
|
76
76
|
};
|
|
77
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
78
78
|
className: classes.root,
|
|
@@ -68,7 +68,7 @@ const GridTreeDataGroupingCell = props => {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if ((0, _internals.isNavigationKey)(event.key) && !event.shiftKey) {
|
|
71
|
-
apiRef.current.publishEvent(
|
|
71
|
+
apiRef.current.publishEvent('cellNavigationKeyDown', props, event);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
|
|
@@ -107,8 +107,8 @@ const useGridColumnPinning = (apiRef, props) => {
|
|
|
107
107
|
const handleMouseLeave = React.useCallback((params, event) => {
|
|
108
108
|
updateHoveredClassOnSiblingRows(event);
|
|
109
109
|
}, [updateHoveredClassOnSiblingRows]);
|
|
110
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
111
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
110
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'rowMouseEnter', handleMouseEnter);
|
|
111
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'rowMouseLeave', handleMouseLeave);
|
|
112
112
|
/**
|
|
113
113
|
* PRE-PROCESSING
|
|
114
114
|
*/
|
|
@@ -215,7 +215,7 @@ const useGridColumnPinning = (apiRef, props) => {
|
|
|
215
215
|
propModel: props.pinnedColumns,
|
|
216
216
|
propOnChange: props.onPinnedColumnsChange,
|
|
217
217
|
stateSelector: _gridColumnPinningSelector.gridPinnedColumnsSelector,
|
|
218
|
-
changeEvent:
|
|
218
|
+
changeEvent: 'pinnedColumnsChange'
|
|
219
219
|
});
|
|
220
220
|
const checkIfEnabled = React.useCallback(methodName => {
|
|
221
221
|
if (props.disableColumnPinning) {
|
|
@@ -46,7 +46,6 @@ const columnReorderStateInitializer = state => (0, _extends2.default)({}, state,
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
/**
|
|
49
|
-
* Only available in DataGridPro
|
|
50
49
|
* @requires useGridColumns (method)
|
|
51
50
|
*/
|
|
52
51
|
|
|
@@ -177,12 +176,12 @@ const useGridColumnReorder = (apiRef, props) => {
|
|
|
177
176
|
}));
|
|
178
177
|
apiRef.current.forceUpdate();
|
|
179
178
|
}, [props.disableColumnReorder, logger, apiRef]);
|
|
180
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
181
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
182
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
183
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
184
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
185
|
-
(0, _xDataGrid.useGridApiEventHandler)(apiRef,
|
|
179
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'columnHeaderDragStart', handleDragStart);
|
|
180
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'columnHeaderDragEnter', handleDragEnter);
|
|
181
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'columnHeaderDragOver', handleDragOver);
|
|
182
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'columnHeaderDragEnd', handleDragEnd);
|
|
183
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'cellDragEnter', handleDragEnter);
|
|
184
|
+
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'cellDragOver', handleDragOver);
|
|
186
185
|
};
|
|
187
186
|
|
|
188
187
|
exports.useGridColumnReorder = useGridColumnReorder;
|