@mui/x-data-grid-pro 5.6.1 → 5.9.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.
Files changed (119) hide show
  1. package/CHANGELOG.md +275 -53
  2. package/DataGridPro/DataGridPro.d.ts +7 -1
  3. package/DataGridPro/DataGridPro.js +47 -18
  4. package/DataGridPro/useDataGridProComponent.js +15 -13
  5. package/DataGridPro/useDataGridProProps.d.ts +2 -1
  6. package/LICENSE +12 -0
  7. package/README.md +1 -1
  8. package/components/DataGridProColumnHeaders.js +10 -16
  9. package/components/DataGridProVirtualScroller.js +6 -9
  10. package/components/GridDetailPanelToggleCell.js +15 -4
  11. package/components/GridGroupingCriteriaCell.d.ts +2 -5
  12. package/components/GridGroupingCriteriaCell.js +2 -74
  13. package/components/GridTreeDataGroupingCell.js +15 -4
  14. package/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
  15. package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
  16. package/hooks/features/columnReorder/useGridColumnReorder.js +1 -1
  17. package/hooks/features/columnResize/useGridColumnResize.js +18 -6
  18. package/hooks/features/detailPanel/useGridDetailPanel.js +12 -4
  19. package/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
  20. package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
  21. package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +6 -0
  22. package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +5 -2
  23. package/hooks/features/rowGrouping/gridRowGroupingUtils.js +18 -3
  24. package/hooks/features/rowGrouping/useGridRowGrouping.js +45 -168
  25. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +1 -1
  26. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +131 -4
  27. package/hooks/features/treeData/gridTreeDataUtils.d.ts +1 -0
  28. package/hooks/features/treeData/gridTreeDataUtils.js +2 -0
  29. package/hooks/features/treeData/useGridTreeData.d.ts +1 -5
  30. package/hooks/features/treeData/useGridTreeData.js +3 -84
  31. package/hooks/features/treeData/useGridTreeDataPreProcessors.d.ts +1 -1
  32. package/hooks/features/treeData/useGridTreeDataPreProcessors.js +73 -4
  33. package/index.d.ts +1 -1
  34. package/index.js +2 -2
  35. package/legacy/DataGridPro/DataGridPro.js +47 -18
  36. package/legacy/DataGridPro/useDataGridProComponent.js +15 -13
  37. package/legacy/components/DataGridProColumnHeaders.js +10 -16
  38. package/legacy/components/DataGridProVirtualScroller.js +6 -9
  39. package/legacy/components/GridDetailPanelToggleCell.js +15 -4
  40. package/legacy/components/GridGroupingCriteriaCell.js +2 -74
  41. package/legacy/components/GridTreeDataGroupingCell.js +15 -4
  42. package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
  43. package/legacy/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
  44. package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +1 -1
  45. package/legacy/hooks/features/columnResize/useGridColumnResize.js +18 -6
  46. package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +12 -4
  47. package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
  48. package/legacy/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
  49. package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +19 -2
  50. package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +47 -173
  51. package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +138 -4
  52. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +2 -0
  53. package/legacy/hooks/features/treeData/useGridTreeData.js +3 -92
  54. package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +85 -4
  55. package/legacy/index.js +2 -2
  56. package/legacy/utils/domUtils.js +30 -3
  57. package/legacy/utils/releaseInfo.js +15 -0
  58. package/models/dataGridProProps.d.ts +9 -8
  59. package/models/gridGroupingColDefOverride.d.ts +2 -2
  60. package/models/gridGroupingValueGetterParams.d.ts +1 -1
  61. package/modern/DataGridPro/DataGridPro.js +47 -18
  62. package/modern/DataGridPro/useDataGridProComponent.js +13 -13
  63. package/modern/components/DataGridProColumnHeaders.js +10 -16
  64. package/modern/components/DataGridProVirtualScroller.js +6 -9
  65. package/modern/components/GridDetailPanelToggleCell.js +15 -4
  66. package/modern/components/GridGroupingCriteriaCell.js +2 -74
  67. package/modern/components/GridTreeDataGroupingCell.js +15 -4
  68. package/modern/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
  69. package/modern/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
  70. package/modern/hooks/features/columnReorder/useGridColumnReorder.js +1 -1
  71. package/modern/hooks/features/columnResize/useGridColumnResize.js +18 -6
  72. package/modern/hooks/features/detailPanel/useGridDetailPanel.js +12 -4
  73. package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
  74. package/modern/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
  75. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +18 -3
  76. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +45 -168
  77. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +131 -4
  78. package/modern/hooks/features/treeData/gridTreeDataUtils.js +2 -0
  79. package/modern/hooks/features/treeData/useGridTreeData.js +3 -84
  80. package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +73 -4
  81. package/modern/index.js +2 -2
  82. package/modern/utils/domUtils.js +30 -3
  83. package/modern/utils/releaseInfo.js +15 -0
  84. package/node/DataGridPro/DataGridPro.js +45 -17
  85. package/node/DataGridPro/useDataGridProComponent.js +15 -13
  86. package/node/components/DataGridProColumnHeaders.js +10 -16
  87. package/node/components/DataGridProVirtualScroller.js +6 -9
  88. package/node/components/GridDetailPanelToggleCell.js +15 -4
  89. package/node/components/GridGroupingCriteriaCell.js +1 -72
  90. package/node/components/GridTreeDataGroupingCell.js +15 -4
  91. package/node/hooks/features/columnPinning/useGridColumnPinning.js +5 -5
  92. package/node/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +1 -1
  93. package/node/hooks/features/columnReorder/useGridColumnReorder.js +1 -1
  94. package/node/hooks/features/columnResize/useGridColumnResize.js +18 -6
  95. package/node/hooks/features/detailPanel/useGridDetailPanel.js +11 -3
  96. package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
  97. package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +1 -1
  98. package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +24 -5
  99. package/node/hooks/features/rowGrouping/useGridRowGrouping.js +41 -166
  100. package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +134 -1
  101. package/node/hooks/features/treeData/gridTreeDataUtils.js +5 -2
  102. package/node/hooks/features/treeData/useGridTreeData.js +2 -93
  103. package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +75 -3
  104. package/node/index.js +9 -9
  105. package/node/utils/domUtils.js +30 -3
  106. package/node/utils/releaseInfo.js +25 -0
  107. package/package.json +7 -7
  108. package/typeOverloads/modules.d.ts +6 -6
  109. package/typeOverloads/reexports.d.ts +1 -1
  110. package/utils/domUtils.d.ts +2 -1
  111. package/utils/domUtils.js +30 -3
  112. package/utils/releaseInfo.d.ts +1 -0
  113. package/utils/releaseInfo.js +15 -0
  114. package/utils/tree/buildRowTree.d.ts +3 -3
  115. package/components/Watermark.d.ts +0 -2
  116. package/components/Watermark.js +0 -43
  117. package/legacy/components/Watermark.js +0 -43
  118. package/modern/components/Watermark.js +0 -43
  119. package/node/components/Watermark.js +0 -56
@@ -1,100 +1,19 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import * as React from 'react';
3
- import { useGridApiEventHandler, GridEvents, gridRowIdsSelector, gridRowTreeSelector, gridFilteredDescendantCountLookupSelector, useFirstRender } from '@mui/x-data-grid';
4
- import { useGridRegisterSortingMethod, useGridRegisterFilteringMethod } from '@mui/x-data-grid/internals';
5
- import { buildRowTree } from '../../../utils/tree/buildRowTree';
6
- import { sortRowTree } from '../../../utils/tree/sortRowTree';
7
- import { filterRowTreeFromTreeData } from './gridTreeDataUtils';
8
- export const TREE_DATA_GROUPING_NAME = 'tree-data';
2
+ import { useGridApiEventHandler, GridEvents, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid';
3
+
9
4
  /**
10
5
  * Only available in DataGridPro
11
- * @requires useGridPreProcessing (method)
12
- * @requires useGridRowGroupsPreProcessing (method)
13
6
  */
14
-
15
- export const useGridTreeData = (apiRef, props) => {
16
- /**
17
- * ROW GROUPING
18
- */
19
- const updateRowGrouping = React.useCallback(() => {
20
- if (!props.treeData) {
21
- return apiRef.current.unstable_registerRowGroupsBuilder('treeData', null);
22
- }
23
-
24
- const groupRows = params => {
25
- if (!props.getTreeDataPath) {
26
- throw new Error('MUI: No getTreeDataPath given.');
27
- }
28
-
29
- const rows = params.ids.map(rowId => ({
30
- id: rowId,
31
- path: props.getTreeDataPath(params.idRowsLookup[rowId]).map(key => ({
32
- key,
33
- field: null
34
- }))
35
- })).sort((a, b) => a.path.length - b.path.length);
36
- return buildRowTree(_extends({
37
- rows
38
- }, params, {
39
- defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
40
- isGroupExpandedByDefault: props.isGroupExpandedByDefault,
41
- groupingName: TREE_DATA_GROUPING_NAME,
42
- onDuplicatePath: (firstId, secondId, path) => {
43
- throw new Error(['MUI: The path returned by `getTreeDataPath` should be unique.', `The rows with id #${firstId} and #${secondId} have the same.`, `Path: ${JSON.stringify(path.map(step => step.key))}.`].join('\n'));
44
- }
45
- }));
46
- };
47
-
48
- return apiRef.current.unstable_registerRowGroupsBuilder('treeData', groupRows);
49
- }, [apiRef, props.getTreeDataPath, props.treeData, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
50
- useFirstRender(() => {
51
- updateRowGrouping();
52
- });
53
- const isFirstRender = React.useRef(true);
54
- React.useEffect(() => {
55
- if (isFirstRender.current) {
56
- isFirstRender.current = false;
57
- return;
58
- }
59
-
60
- updateRowGrouping();
61
- }, [updateRowGrouping]);
62
- /**
63
- * PRE-PROCESSING
64
- */
65
-
66
- const filteringMethod = React.useCallback(params => {
67
- const rowTree = gridRowTreeSelector(apiRef);
68
- return filterRowTreeFromTreeData({
69
- rowTree,
70
- isRowMatchingFilters: params.isRowMatchingFilters,
71
- disableChildrenFiltering: props.disableChildrenFiltering
72
- });
73
- }, [apiRef, props.disableChildrenFiltering]);
74
- const sortingMethod = React.useCallback(params => {
75
- const rowTree = gridRowTreeSelector(apiRef);
76
- const rowIds = gridRowIdsSelector(apiRef);
77
- return sortRowTree({
78
- rowTree,
79
- rowIds,
80
- sortRowList: params.sortRowList,
81
- disableChildrenSorting: props.disableChildrenSorting
82
- });
83
- }, [apiRef, props.disableChildrenSorting]);
84
- useGridRegisterFilteringMethod(apiRef, TREE_DATA_GROUPING_NAME, filteringMethod);
85
- useGridRegisterSortingMethod(apiRef, TREE_DATA_GROUPING_NAME, sortingMethod);
7
+ export const useGridTreeData = apiRef => {
86
8
  /**
87
9
  * EVENTS
88
10
  */
89
-
90
11
  const handleCellKeyDown = React.useCallback((params, event) => {
91
12
  const cellParams = apiRef.current.getCellParams(params.id, params.field);
92
13
 
93
14
  if (cellParams.colDef.type === 'treeDataGroup' && event.key === ' ' && !event.shiftKey) {
94
15
  var _gridFilteredDescenda;
95
16
 
96
- event.stopPropagation();
97
- event.preventDefault();
98
17
  const filteredDescendantCount = (_gridFilteredDescenda = gridFilteredDescendantCountLookupSelector(apiRef)[params.id]) != null ? _gridFilteredDescenda : 0;
99
18
 
100
19
  if (filteredDescendantCount === 0) {
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
3
3
  import { GridApiPro } from '../../../models/gridApiPro';
4
- export declare const useGridTreeDataPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'treeData' | 'groupingColDef'>) => void;
4
+ export declare const useGridTreeDataPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'treeData' | 'groupingColDef' | 'getTreeDataPath' | 'disableChildrenSorting' | 'disableChildrenFiltering' | 'defaultGroupingExpansionDepth' | 'isGroupExpandedByDefault'>) => void;
@@ -2,12 +2,18 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["hideDescendantCount"];
4
4
  import * as React from 'react';
5
- import { useGridRegisterPreProcessor } from '@mui/x-data-grid/internals';
5
+ import { gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid';
6
+ import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
6
7
  import { GRID_TREE_DATA_GROUPING_COL_DEF, GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES } from './gridTreeDataGroupColDef';
7
- import { TREE_DATA_GROUPING_NAME } from './useGridTreeData';
8
+ import { filterRowTreeFromTreeData, TREE_DATA_STRATEGY } from './gridTreeDataUtils';
8
9
  import { GridTreeDataGroupingCell } from '../../../components';
10
+ import { buildRowTree } from '../../../utils/tree/buildRowTree';
11
+ import { sortRowTree } from '../../../utils/tree/sortRowTree';
9
12
  import { jsx as _jsx } from "react/jsx-runtime";
10
13
  export const useGridTreeDataPreProcessors = (apiRef, props) => {
14
+ const setStrategyAvailability = React.useCallback(() => {
15
+ apiRef.current.unstable_setStrategyAvailability('rowTree', TREE_DATA_STRATEGY, props.treeData ? () => true : () => false);
16
+ }, [apiRef, props.treeData]);
11
17
  const getGroupingColDef = React.useCallback(() => {
12
18
  var _colDefOverride;
13
19
 
@@ -16,7 +22,7 @@ export const useGridTreeDataPreProcessors = (apiRef, props) => {
16
22
 
17
23
  if (typeof groupingColDefProp === 'function') {
18
24
  const params = {
19
- groupingName: TREE_DATA_GROUPING_NAME,
25
+ groupingName: TREE_DATA_STRATEGY,
20
26
  fields: []
21
27
  };
22
28
  colDefOverride = groupingColDefProp(params);
@@ -65,5 +71,68 @@ export const useGridTreeDataPreProcessors = (apiRef, props) => {
65
71
 
66
72
  return columnsState;
67
73
  }, [props.treeData, getGroupingColDef]);
68
- useGridRegisterPreProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
74
+ const createRowTree = React.useCallback(params => {
75
+ if (!props.getTreeDataPath) {
76
+ throw new Error('MUI: No getTreeDataPath given.');
77
+ }
78
+
79
+ const rows = params.ids.map(rowId => ({
80
+ id: rowId,
81
+ path: props.getTreeDataPath(params.idRowsLookup[rowId]).map(key => ({
82
+ key,
83
+ field: null
84
+ }))
85
+ })).sort((a, b) => a.path.length - b.path.length);
86
+ return buildRowTree(_extends({
87
+ rows
88
+ }, params, {
89
+ defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
90
+ isGroupExpandedByDefault: props.isGroupExpandedByDefault,
91
+ groupingName: TREE_DATA_STRATEGY,
92
+ onDuplicatePath: (firstId, secondId, path) => {
93
+ throw new Error(['MUI: The path returned by `getTreeDataPath` should be unique.', `The rows with id #${firstId} and #${secondId} have the same.`, `Path: ${JSON.stringify(path.map(step => step.key))}.`].join('\n'));
94
+ }
95
+ }));
96
+ }, [props.getTreeDataPath, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
97
+ const filterRows = React.useCallback(params => {
98
+ const rowTree = gridRowTreeSelector(apiRef);
99
+ return filterRowTreeFromTreeData({
100
+ rowTree,
101
+ isRowMatchingFilters: params.isRowMatchingFilters,
102
+ disableChildrenFiltering: props.disableChildrenFiltering
103
+ });
104
+ }, [apiRef, props.disableChildrenFiltering]);
105
+ const sortRows = React.useCallback(params => {
106
+ const rowTree = gridRowTreeSelector(apiRef);
107
+ const rowIds = gridRowIdsSelector(apiRef);
108
+ return sortRowTree({
109
+ rowTree,
110
+ rowIds,
111
+ sortRowList: params.sortRowList,
112
+ disableChildrenSorting: props.disableChildrenSorting
113
+ });
114
+ }, [apiRef, props.disableChildrenSorting]);
115
+ useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
116
+ useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'rowTreeCreation', createRowTree);
117
+ useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'filtering', filterRows);
118
+ useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'sorting', sortRows);
119
+ /**
120
+ * 1ST RENDER
121
+ */
122
+
123
+ useFirstRender(() => {
124
+ setStrategyAvailability();
125
+ });
126
+ /**
127
+ * EFFECTS
128
+ */
129
+
130
+ const isFirstRender = React.useRef(true);
131
+ React.useEffect(() => {
132
+ if (!isFirstRender.current) {
133
+ setStrategyAvailability();
134
+ } else {
135
+ isFirstRender.current = false;
136
+ }
137
+ }, [setStrategyAvailability]);
69
138
  };
package/index.d.ts CHANGED
@@ -6,8 +6,8 @@ export * from '@mui/x-data-grid/hooks';
6
6
  export * from '@mui/x-data-grid/locales';
7
7
  export * from '@mui/x-data-grid/models';
8
8
  export * from '@mui/x-data-grid/context';
9
- export * from '@mui/x-data-grid/colDef';
10
9
  export * from '@mui/x-data-grid/utils';
10
+ export * from '@mui/x-data-grid/colDef';
11
11
  export * from './DataGridPro';
12
12
  export * from './hooks';
13
13
  export * from './models';
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.6.1
1
+ /** @license MUI v5.9.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.
@@ -11,8 +11,8 @@ export * from '@mui/x-data-grid/hooks';
11
11
  export * from '@mui/x-data-grid/locales';
12
12
  export * from '@mui/x-data-grid/models';
13
13
  export * from '@mui/x-data-grid/context';
14
- export * from '@mui/x-data-grid/colDef';
15
14
  export * from '@mui/x-data-grid/utils';
15
+ export * from '@mui/x-data-grid/colDef';
16
16
  export * from './DataGridPro';
17
17
  export * from './hooks';
18
18
  export * from './models';
@@ -1,28 +1,20 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { LicenseInfo } from '@mui/x-license-pro';
4
- import { chainPropTypes, ponyfillGlobal } from '@mui/utils';
3
+ import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
4
+ import { chainPropTypes } from '@mui/utils';
5
5
  import { GridBody, GridErrorHandler, GridFooterPlaceholder, GridHeaderPlaceholder, GridRoot, GridContextProvider } from '@mui/x-data-grid';
6
6
  import { useDataGridProComponent } from './useDataGridProComponent';
7
- import { Watermark } from '../components/Watermark';
8
7
  import { useDataGridProProps } from './useDataGridProProps';
9
8
  import { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
10
- import { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders'; // This is the package release date. Each package version should update this const
11
- // automatically when a new version is published on npm.
12
-
9
+ import { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders';
10
+ import { getReleaseInfo } from '../utils/releaseInfo';
13
11
  import { jsx as _jsx } from "react/jsx-runtime";
14
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
- var RELEASE_INFO = "MTY0Njg2NjgwMDAwMA=="; // eslint-disable-next-line no-useless-concat
16
-
17
- if (process.env.NODE_ENV !== 'production' && RELEASE_INFO === '__RELEASE' + '_INFO__') {
18
- // eslint-disable-next-line no-underscore-dangle
19
- RELEASE_INFO = ponyfillGlobal.__MUI_RELEASE_INFO__;
20
- }
21
-
22
- LicenseInfo.setReleaseInfo(RELEASE_INFO);
13
+ var releaseInfo = getReleaseInfo();
23
14
  var DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProps, ref) {
24
15
  var props = useDataGridProProps(inProps);
25
16
  var apiRef = useDataGridProComponent(props.apiRef, props);
17
+ useLicenseVerifier('x-data-grid-pro', releaseInfo);
26
18
  return /*#__PURE__*/_jsx(GridContextProvider, {
27
19
  apiRef: apiRef,
28
20
  props: props,
@@ -35,7 +27,10 @@ var DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProps,
35
27
  children: [/*#__PURE__*/_jsx(GridHeaderPlaceholder, {}), /*#__PURE__*/_jsx(GridBody, {
36
28
  ColumnHeadersComponent: DataGridProColumnHeaders,
37
29
  VirtualScrollerComponent: DataGridProVirtualScroller,
38
- children: /*#__PURE__*/_jsx(Watermark, {})
30
+ children: /*#__PURE__*/_jsx(Watermark, {
31
+ packageName: "x-data-grid-pro",
32
+ releaseInfo: releaseInfo
33
+ })
39
34
  }), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
40
35
  })
41
36
  })
@@ -274,6 +269,7 @@ DataGridProRaw.propTypes = {
274
269
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
275
270
  */
276
271
  experimentalFeatures: PropTypes.shape({
272
+ newEditingApi: PropTypes.bool,
277
273
  preventCommitWhileValidating: PropTypes.bool,
278
274
  rowGrouping: PropTypes.bool,
279
275
  warnIfFocusStateIsNotSynced: PropTypes.bool
@@ -357,7 +353,8 @@ DataGridProRaw.propTypes = {
357
353
  * Determines the path of a row in the tree data.
358
354
  * For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
359
355
  * Note that all paths must contain at least one element.
360
- * @param {GridRowModel} row The row from which we want the path.
356
+ * @template R
357
+ * @param {R} row The row from which we want the path.
361
358
  * @returns {string[]} The path to the row.
362
359
  */
363
360
  getTreeDataPath: PropTypes.func,
@@ -621,7 +618,7 @@ DataGridProRaw.propTypes = {
621
618
  * @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
622
619
  * @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
623
620
  * @param {GridCallbackDetails} details Additional details for this callback.
624
- * @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/api/data-grid/grid-col-def/)
621
+ * @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
625
622
  */
626
623
  onEditCellPropsChange: PropTypes.func,
627
624
 
@@ -668,6 +665,28 @@ DataGridProRaw.propTypes = {
668
665
  */
669
666
  onPinnedColumnsChange: PropTypes.func,
670
667
 
668
+ /**
669
+ * Callback fired when the preferences panel is closed.
670
+ * @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
671
+ * @param {MuiEvent<{}>} event The event object.
672
+ * @param {GridCallbackDetails} details Additional details for this callback.
673
+ */
674
+ onPreferencePanelClose: PropTypes.func,
675
+
676
+ /**
677
+ * Callback fired when the preferences panel is opened.
678
+ * @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
679
+ * @param {MuiEvent<{}>} event The event object.
680
+ * @param {GridCallbackDetails} details Additional details for this callback.
681
+ */
682
+ onPreferencePanelOpen: PropTypes.func,
683
+
684
+ /**
685
+ * Callback called when `processRowUpdate` throws an error or rejects.
686
+ * @param {any} error The error thrown.
687
+ */
688
+ onProcessRowUpdateError: PropTypes.func,
689
+
671
690
  /**
672
691
  * Callback fired when the grid is resized.
673
692
  * @param {ElementSize} containerSize With all properties from [[ElementSize]].
@@ -787,6 +806,16 @@ DataGridProRaw.propTypes = {
787
806
  right: PropTypes.arrayOf(PropTypes.string)
788
807
  }),
789
808
 
809
+ /**
810
+ * Callback called before updating a row with new values in the row and cell editing.
811
+ * Only applied if `props.experimentalFeatures.newEditingApi: true`.
812
+ * @template R
813
+ * @param {R} newRow Row object with the new values.
814
+ * @param {R} oldRow Row object with the old values.
815
+ * @returns {Promise<R> | R} The final values to update the row.
816
+ */
817
+ processRowUpdate: PropTypes.func,
818
+
790
819
  /**
791
820
  * Number of extra rows to be rendered before/after the visible slice.
792
821
  * @default 3
@@ -820,7 +849,7 @@ DataGridProRaw.propTypes = {
820
849
  /**
821
850
  * Set of rows of type [[GridRowsProp]].
822
851
  */
823
- rows: PropTypes.arrayOf(PropTypes.object).isRequired,
852
+ rows: PropTypes.array.isRequired,
824
853
 
825
854
  /**
826
855
  * Sets the type of space between rows added by `getRowSpacing`.
@@ -1,4 +1,4 @@
1
- import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboard, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, useGridRows, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, editingStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer } from '@mui/x-data-grid/internals';
1
+ import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer } from '@mui/x-data-grid/internals';
2
2
  // Pro-only features
3
3
  import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
4
4
  import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
@@ -13,6 +13,8 @@ import { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/featur
13
13
  import { useGridDetailPanelCache } from '../hooks/features/detailPanel/useGridDetailPanelCache';
14
14
  import { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
15
15
  export var useDataGridProComponent = function useDataGridProComponent(inputApiRef, props) {
16
+ var _props$experimentalFe, _props$experimentalFe2;
17
+
16
18
  var apiRef = useGridInitialization(inputApiRef, props);
17
19
  /**
18
20
  * Register all pre-processors called during state initialization here.
@@ -21,25 +23,22 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
21
23
  useGridSelectionPreProcessors(apiRef, props);
22
24
  useGridRowGroupingPreProcessors(apiRef, props);
23
25
  useGridTreeDataPreProcessors(apiRef, props);
24
- useGridDetailPanelPreProcessors(apiRef, props);
25
- useGridColumnPinningPreProcessors(apiRef, props); // Must be the last because it changes the order of the columns.
26
+ useGridDetailPanelPreProcessors(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
27
+ // Because it changes the order of the columns.
26
28
 
29
+ useGridColumnPinningPreProcessors(apiRef, props);
30
+ useGridRowsPreProcessors(apiRef);
27
31
  /**
28
32
  * Register all state initializers here.
29
33
  */
30
34
 
35
+ useGridInitializeState(rowGroupingStateInitializer, apiRef, props);
31
36
  useGridInitializeState(selectionStateInitializer, apiRef, props);
32
37
  useGridInitializeState(detailPanelStateInitializer, apiRef, props);
33
38
  useGridInitializeState(columnPinningStateInitializer, apiRef, props);
34
- useGridInitializeState(rowGroupingStateInitializer, apiRef, props); // FIXME Call in the same relative position that useGridRowGrouping is called
35
-
36
39
  useGridInitializeState(columnsStateInitializer, apiRef, props);
37
- useGridRowGrouping(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
38
-
39
- useGridTreeData(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
40
-
41
40
  useGridInitializeState(rowsStateInitializer, apiRef, props);
42
- useGridInitializeState(editingStateInitializer, apiRef, props);
41
+ useGridInitializeState((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
43
42
  useGridInitializeState(focusStateInitializer, apiRef, props);
44
43
  useGridInitializeState(sortingStateInitializer, apiRef, props);
45
44
  useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
@@ -50,18 +49,23 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
50
49
  useGridInitializeState(paginationStateInitializer, apiRef, props);
51
50
  useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
52
51
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
52
+ useGridRowGrouping(apiRef, props);
53
+ useGridTreeData(apiRef);
54
+ useGridKeyboardNavigation(apiRef, props);
53
55
  useGridSelection(apiRef, props);
54
56
  useGridDetailPanel(apiRef, props);
55
57
  useGridColumnPinning(apiRef, props);
56
58
  useGridColumns(apiRef, props);
57
59
  useGridRows(apiRef, props);
58
60
  useGridParamsApi(apiRef);
61
+ useGridColumnSpanning(apiRef);
59
62
  useGridDetailPanelCache(apiRef, props);
63
+ var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
60
64
  useGridEditing(apiRef, props);
61
65
  useGridFocus(apiRef, props);
62
- useGridSorting(apiRef, props);
63
66
  useGridPreferencesPanel(apiRef);
64
67
  useGridFilter(apiRef, props);
68
+ useGridSorting(apiRef, props);
65
69
  useGridDensity(apiRef, props);
66
70
  useGridColumnReorder(apiRef, props);
67
71
  useGridColumnResize(apiRef, props);
@@ -70,8 +74,6 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
70
74
  useGridScroll(apiRef, props);
71
75
  useGridInfiniteLoader(apiRef, props);
72
76
  useGridColumnMenu(apiRef);
73
- useGridKeyboard(apiRef);
74
- useGridKeyboardNavigation(apiRef, props);
75
77
  useGridCsvExport(apiRef);
76
78
  useGridPrintExport(apiRef, props);
77
79
  useGridClipboard(apiRef);
@@ -104,7 +104,6 @@ export var DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function Dat
104
104
  }),
105
105
  isDragging = _useGridColumnHeaders.isDragging,
106
106
  renderContext = _useGridColumnHeaders.renderContext,
107
- updateInnerPosition = _useGridColumnHeaders.updateInnerPosition,
108
107
  getRootProps = _useGridColumnHeaders.getRootProps,
109
108
  getInnerProps = _useGridColumnHeaders.getInnerProps,
110
109
  getColumns = _useGridColumnHeaders.getColumns;
@@ -115,11 +114,6 @@ export var DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function Dat
115
114
  classes: rootProps.classes
116
115
  };
117
116
  var classes = useUtilityClasses(ownerState);
118
- React.useEffect(function () {
119
- if (renderContext) {
120
- updateInnerPosition(renderContext);
121
- }
122
- }, [renderContext, updateInnerPosition]);
123
117
  var leftRenderContext = renderContext && leftPinnedColumns.length ? _extends({}, renderContext, {
124
118
  firstColumnIndex: 0,
125
119
  lastColumnIndex: leftPinnedColumns.length
@@ -144,7 +138,15 @@ export var DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function Dat
144
138
  }, {
145
139
  disableReorder: true
146
140
  })
147
- }), rightRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, {
141
+ }), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
142
+ isDragging: isDragging
143
+ }, getInnerProps(), {
144
+ children: getColumns({
145
+ renderContext: renderContext,
146
+ minFirstColumn: leftPinnedColumns.length,
147
+ maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
148
+ })
149
+ })), rightRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, {
148
150
  ownerState: {
149
151
  side: GridPinnedPosition.right
150
152
  },
@@ -160,14 +162,6 @@ export var DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function Dat
160
162
  disableReorder: true,
161
163
  separatorSide: GridColumnHeaderSeparatorSides.Left
162
164
  })
163
- }), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
164
- isDragging: isDragging
165
- }, getInnerProps(), {
166
- children: getColumns({
167
- renderContext: renderContext,
168
- minFirstColumn: leftPinnedColumns.length,
169
- maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
170
- })
171
- }))]
165
+ })]
172
166
  }));
173
167
  });
@@ -192,9 +192,6 @@ var DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGrid
192
192
  }, [renderContext, updateRenderZonePosition]);
193
193
  useGridApiEventHandler(apiRef, GridEvents.columnWidthChange, refreshRenderZonePosition);
194
194
  useGridApiEventHandler(apiRef, GridEvents.columnOrderChange, refreshRenderZonePosition);
195
- React.useEffect(function () {
196
- refreshRenderZonePosition();
197
- }, [refreshRenderZonePosition]);
198
195
  var leftRenderContext = renderContext && leftPinnedColumns.length > 0 ? _extends({}, renderContext, {
199
196
  firstColumnIndex: 0,
200
197
  lastColumnIndex: leftPinnedColumns.length
@@ -260,7 +257,11 @@ var DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGrid
260
257
  maxLastColumn: leftRenderContext.lastColumnIndex,
261
258
  availableSpace: 0
262
259
  })
263
- }), rightRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
260
+ }), /*#__PURE__*/_jsx(GridVirtualScrollerRenderZone, _extends({}, getRenderZoneProps(), {
261
+ children: getRows({
262
+ renderContext: renderContext
263
+ })
264
+ })), rightRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
264
265
  ref: rightColumns,
265
266
  ownerState: {
266
267
  side: GridPinnedPosition.right
@@ -273,11 +274,7 @@ var DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGrid
273
274
  maxLastColumn: rightRenderContext.lastColumnIndex,
274
275
  availableSpace: 0
275
276
  })
276
- }), /*#__PURE__*/_jsx(GridVirtualScrollerRenderZone, _extends({}, getRenderZoneProps(), {
277
- children: getRows({
278
- renderContext: renderContext
279
- })
280
- })), detailPanels.length > 0 && /*#__PURE__*/_jsx(VirtualScrollerDetailPanels, {
277
+ }), detailPanels.length > 0 && /*#__PURE__*/_jsx(VirtualScrollerDetailPanels, {
281
278
  className: classes.detailPanels,
282
279
  children: detailPanels
283
280
  })]
@@ -69,16 +69,27 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
69
69
  */
70
70
  field: PropTypes.string.isRequired,
71
71
 
72
+ /**
73
+ * A ref allowing to set imperative focus.
74
+ * It can be passed to the element that should receive focus.
75
+ * @ignore - do not document.
76
+ */
77
+ focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
78
+ current: PropTypes.shape({
79
+ focus: PropTypes.func.isRequired
80
+ })
81
+ })]),
82
+
72
83
  /**
73
84
  * The cell value formatted with the column valueFormatter.
74
85
  */
75
- formattedValue: PropTypes.any.isRequired,
86
+ formattedValue: PropTypes.any,
76
87
 
77
88
  /**
78
89
  * Get the cell value of a row and field.
79
90
  * @param {GridRowId} id The row id.
80
91
  * @param {string} field The field.
81
- * @returns {GridCellValue} The cell value.
92
+ * @returns {any} The cell value.
82
93
  * @deprecated Use `params.row` to directly access the fields you want instead.
83
94
  */
84
95
  getValue: PropTypes.func.isRequired,
@@ -101,7 +112,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
101
112
  /**
102
113
  * The row model of the row that the current cell belongs to.
103
114
  */
104
- row: PropTypes.any.isRequired,
115
+ row: PropTypes.object.isRequired,
105
116
 
106
117
  /**
107
118
  * The node of the row that the current cell belongs to.
@@ -116,6 +127,6 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
116
127
  /**
117
128
  * The cell value, but if the column has valueGetter, use getValue.
118
129
  */
119
- value: PropTypes.any.isRequired
130
+ value: PropTypes.any
120
131
  } : void 0;
121
132
  export { GridDetailPanelToggleCell };