@mui/x-data-grid-premium 5.11.1 → 5.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +199 -20
  2. package/DataGridPremium/DataGridPremium.js +26 -2
  3. package/DataGridPremium/useDataGridPremiumComponent.js +1 -2
  4. package/README.md +2 -2
  5. package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +6 -5
  6. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  7. package/hooks/features/rowGrouping/useGridRowGrouping.js +9 -11
  8. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +3 -29
  9. package/index.d.ts +0 -1
  10. package/index.js +1 -2
  11. package/legacy/DataGridPremium/DataGridPremium.js +26 -2
  12. package/legacy/DataGridPremium/useDataGridPremiumComponent.js +1 -2
  13. package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +9 -13
  14. package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +3 -33
  15. package/legacy/index.js +1 -2
  16. package/legacy/typeOverloads/index.js +2 -1
  17. package/legacy/typeOverloads/modules.js +1 -33
  18. package/legacy/utils/releaseInfo.js +1 -1
  19. package/modern/DataGridPremium/DataGridPremium.js +26 -2
  20. package/modern/DataGridPremium/useDataGridPremiumComponent.js +1 -2
  21. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +14 -14
  22. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +3 -29
  23. package/modern/index.js +1 -2
  24. package/modern/typeOverloads/index.js +2 -1
  25. package/modern/typeOverloads/modules.js +1 -33
  26. package/modern/utils/releaseInfo.js +1 -1
  27. package/node/DataGridPremium/DataGridPremium.js +26 -2
  28. package/node/DataGridPremium/useDataGridPremiumComponent.js +0 -1
  29. package/node/hooks/features/rowGrouping/useGridRowGrouping.js +8 -10
  30. package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -28
  31. package/node/index.js +1 -3
  32. package/node/typeOverloads/index.js +3 -1
  33. package/node/typeOverloads/modules.js +5 -34
  34. package/node/utils/releaseInfo.js +1 -1
  35. package/package.json +11 -10
  36. package/typeOverloads/index.d.ts +1 -0
  37. package/typeOverloads/index.js +2 -1
  38. package/typeOverloads/modules.d.ts +34 -0
  39. package/typeOverloads/modules.js +1 -33
  40. package/utils/releaseInfo.js +1 -1
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  import * as React from 'react';
4
- import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid-pro';
4
+ import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid-pro';
5
5
  import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor, sortRowTree, buildRowTree } from '@mui/x-data-grid-pro/internals';
6
6
  import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
7
7
  import { createGroupingColDefForAllGroupingCriteria, createGroupingColDefForOneGroupingCriteria } from './createGroupingColDef';
@@ -73,7 +73,7 @@ export var useGridRowGroupingPreProcessors = function useGridRowGroupingPreProce
73
73
 
74
74
  newColumnsLookup[groupingColDef.field] = groupingColDef;
75
75
  });
76
- var startIndex = newColumnFields[0] === '__check__' ? 1 : 0;
76
+ var startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
77
77
  newColumnFields = [].concat(_toConsumableArray(newColumnFields.slice(0, startIndex)), _toConsumableArray(groupingColDefs.map(function (colDef) {
78
78
  return colDef.field;
79
79
  })), _toConsumableArray(newColumnFields.slice(startIndex)));
@@ -84,19 +84,7 @@ export var useGridRowGroupingPreProcessors = function useGridRowGroupingPreProce
84
84
  var createRowTree = React.useCallback(function (params) {
85
85
  var rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
86
86
  var columnsLookup = gridColumnLookupSelector(apiRef);
87
- apiRef.current.setState(function (state) {
88
- return _extends({}, state, {
89
- rowGrouping: _extends({}, state.rowGrouping, {
90
- unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
91
- })
92
- });
93
- });
94
- var distinctValues = Object.fromEntries(rowGroupingModel.map(function (groupingField) {
95
- return [groupingField, {
96
- lookup: {},
97
- list: []
98
- }];
99
- }));
87
+ apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
100
88
 
101
89
  var getCellGroupingCriteria = function getCellGroupingCriteria(_ref) {
102
90
  var row = _ref.row,
@@ -127,24 +115,6 @@ export var useGridRowGroupingPreProcessors = function useGridRowGroupingPreProce
127
115
  };
128
116
  };
129
117
 
130
- params.ids.forEach(function (rowId) {
131
- var row = params.idRowsLookup[rowId];
132
- rowGroupingModel.forEach(function (groupingCriteria) {
133
- var _getCellGroupingCrite = getCellGroupingCriteria({
134
- row: row,
135
- id: rowId,
136
- colDef: columnsLookup[groupingCriteria]
137
- }),
138
- key = _getCellGroupingCrite.key;
139
-
140
- var groupingFieldsDistinctKeys = distinctValues[groupingCriteria];
141
-
142
- if (key != null && !groupingFieldsDistinctKeys.lookup[key.toString()]) {
143
- groupingFieldsDistinctKeys.lookup[key.toString()] = true;
144
- groupingFieldsDistinctKeys.list.push(key);
145
- }
146
- });
147
- });
148
118
  var rows = params.ids.map(function (rowId) {
149
119
  var row = params.idRowsLookup[rowId];
150
120
  var parentPath = rowGroupingModel.map(function (groupingField) {
package/legacy/index.js CHANGED
@@ -1,10 +1,9 @@
1
- /** @license MUI v5.11.1
1
+ /** @license MUI v5.12.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
5
5
  */
6
6
  import './typeOverloads';
7
- import '@mui/x-data-grid-pro/typeOverloads';
8
7
  export { LicenseInfo } from '@mui/x-license-pro';
9
8
  export * from '@mui/x-data-grid/components';
10
9
  export * from '@mui/x-data-grid-pro/components';
@@ -1 +1,2 @@
1
- import '@mui/x-data-grid-pro/typeOverloads';
1
+ import '@mui/x-data-grid-pro/typeOverloads';
2
+ import './modules';
@@ -1,33 +1 @@
1
- // import { GridKeyValue, GridValidRowModel } from '@mui/x-data-grid-pro';
2
- // import type { GridControlledStateEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
3
- // import type { GridGroupingValueGetterParams } from '../models';
4
- // import type { GridRowGroupingModel } from '../hooks';
5
- //
6
- // export interface GridControlledStateEventLookupPremium {
7
- // /**
8
- // * Fired when the row grouping model changes.
9
- // */
10
- // rowGroupingModelChange: { params: GridRowGroupingModel };
11
- // }
12
- //
13
- // // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
- // export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
15
- // /**
16
- // * Function that transforms a complex cell value into a key that be used for grouping the rows.
17
- // * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
18
- // * @returns {GridKeyValue | null | undefined} The cell key.
19
- // */
20
- // groupingValueGetter?: (
21
- // params: GridGroupingValueGetterParams<V, R>,
22
- // ) => GridKeyValue | null | undefined;
23
- // }
24
- //
25
- // declare module '@mui/x-data-grid-pro' {
26
- // export interface GridColDef<R extends GridValidRowModel = any, V = any, F = V>
27
- // extends GridColDefPremium<R, V, F> {}
28
- //
29
- // // TODO: Remove explicit augmentation of pro package
30
- // interface GridControlledStateEventLookup
31
- // extends GridControlledStateEventLookupPro,
32
- // GridControlledStateEventLookupPremium {}
33
- // }
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export var getReleaseInfo = function getReleaseInfo() {
3
- var releaseInfo = "MTY1Mjk5NzYwMDAwMA==";
3
+ var releaseInfo = "MTY1NTMzMDQwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -275,7 +275,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
275
275
  experimentalFeatures: PropTypes.shape({
276
276
  newEditingApi: PropTypes.bool,
277
277
  preventCommitWhileValidating: PropTypes.bool,
278
- rowGrouping: PropTypes.bool,
279
278
  warnIfFocusStateIsNotSynced: PropTypes.bool
280
279
  }),
281
280
 
@@ -329,6 +328,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
329
328
  */
330
329
  getDetailPanelHeight: PropTypes.func,
331
330
 
331
+ /**
332
+ * Function that returns the estimated height for a row.
333
+ * Only works if dynamic row height is used.
334
+ * Once the row height is measured this value is discarded.
335
+ * @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
336
+ * @returns {number | null} The estimated row height value. If `null` or `undefined` then the default row height, based on the density, is applied.
337
+ */
338
+ getEstimatedRowHeight: PropTypes.func,
339
+
332
340
  /**
333
341
  * Function that applies CSS classes dynamically on rows.
334
342
  * @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
@@ -339,7 +347,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
339
347
  /**
340
348
  * Function that sets the row height per row.
341
349
  * @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
342
- * @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
350
+ * @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied. If "auto" then the row height is calculated based on the content.
343
351
  */
344
352
  getRowHeight: PropTypes.func,
345
353
 
@@ -665,6 +673,22 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
665
673
  */
666
674
  onFilterModelChange: PropTypes.func,
667
675
 
676
+ /**
677
+ * Callback fired when the menu is closed.
678
+ * @param {GridMenuParams} params With all properties from [[GridMenuParams]].
679
+ * @param {MuiEvent<{}>} event The event object.
680
+ * @param {GridCallbackDetails} details Additional details for this callback.
681
+ */
682
+ onMenuClose: PropTypes.func,
683
+
684
+ /**
685
+ * Callback fired when the menu is opened.
686
+ * @param {GridMenuParams} params With all properties from [[GridMenuParams]].
687
+ * @param {MuiEvent<{}>} event The event object.
688
+ * @param {GridCallbackDetails} details Additional details for this callback.
689
+ */
690
+ onMenuOpen: PropTypes.func,
691
+
668
692
  /**
669
693
  * Callback fired when the current page has changed.
670
694
  * @param {number} page Index of the page displayed on the Grid.
@@ -1,4 +1,4 @@
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, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelCache, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors } from '@mui/x-data-grid-pro/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, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors } from '@mui/x-data-grid-pro/internals';
2
2
  // Premium-only features
3
3
  import { useGridRowGrouping, rowGroupingStateInitializer } from '../hooks/features/rowGrouping/useGridRowGrouping';
4
4
  import { useGridRowGroupingPreProcessors } from '../hooks/features/rowGrouping/useGridRowGroupingPreProcessors';
@@ -49,7 +49,6 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
49
49
  useGridRows(apiRef, props);
50
50
  useGridParamsApi(apiRef);
51
51
  useGridColumnSpanning(apiRef);
52
- useGridDetailPanelCache(apiRef, props);
53
52
  const useGridEditing = props.experimentalFeatures?.newEditingApi ? useGridEditing_new : useGridEditing_old;
54
53
  useGridEditing(apiRef, props);
55
54
  useGridFocus(apiRef, props);
@@ -3,17 +3,21 @@ import * as React from 'react';
3
3
  import Divider from '@mui/material/Divider';
4
4
  import { useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid-pro';
5
5
  import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid-pro/internals';
6
- import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector, gridRowGroupingStateSelector } from './gridRowGroupingSelector';
6
+ import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
7
7
  import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability } from './gridRowGroupingUtils';
8
8
  import { GridRowGroupableColumnMenuItems } from '../../../components/GridRowGroupableColumnMenuItems';
9
9
  import { GridRowGroupingColumnMenuItems } from '../../../components/GridRowGroupingColumnMenuItems';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- export const rowGroupingStateInitializer = (state, props) => _extends({}, state, {
12
- rowGrouping: {
13
- model: props.rowGroupingModel ?? props.initialState?.rowGrouping?.model ?? [],
14
- unstable_sanitizedModelOnLastRowTreeCreation: []
15
- }
16
- });
11
+ export const rowGroupingStateInitializer = (state, props, apiRef) => {
12
+ apiRef.current.unstable_caches.rowGrouping = {
13
+ sanitizedModelOnLastRowTreeCreation: []
14
+ };
15
+ return _extends({}, state, {
16
+ rowGrouping: {
17
+ model: props.rowGroupingModel ?? props.initialState?.rowGrouping?.model ?? []
18
+ }
19
+ });
20
+ };
17
21
  /**
18
22
  * @requires useGridColumns (state, method) - can be after, async only
19
23
  * @requires useGridRows (state, method) - can be after, async only
@@ -21,7 +25,7 @@ export const rowGroupingStateInitializer = (state, props) => _extends({}, state,
21
25
  */
22
26
 
23
27
  export const useGridRowGrouping = (apiRef, props) => {
24
- apiRef.current.unstable_updateControlState({
28
+ apiRef.current.unstable_registerControlState({
25
29
  stateId: 'rowGrouping',
26
30
  propModel: props.rowGroupingModel,
27
31
  propOnChange: props.onRowGroupingModelChange,
@@ -160,14 +164,10 @@ export const useGridRowGrouping = (apiRef, props) => {
160
164
  }, [apiRef, props.rowGroupingColumnMode]);
161
165
  const checkGroupingColumnsModelDiff = React.useCallback(() => {
162
166
  const rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
163
- const lastGroupingColumnsModelApplied = gridRowGroupingStateSelector(apiRef.current.state).unstable_sanitizedModelOnLastRowTreeCreation;
167
+ const lastGroupingColumnsModelApplied = apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation;
164
168
 
165
169
  if (!isDeepEqual(lastGroupingColumnsModelApplied, rowGroupingModel)) {
166
- apiRef.current.setState(state => _extends({}, state, {
167
- rowGrouping: _extends({}, state.rowGrouping, {
168
- unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
169
- })
170
- }));
170
+ apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
171
171
  apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
172
172
  setStrategyAvailability(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
173
173
  // TODO: Add a clean way to re-run a strategy processing without publishing a private event
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid-pro';
3
+ import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid-pro';
4
4
  import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor, sortRowTree, buildRowTree } from '@mui/x-data-grid-pro/internals';
5
5
  import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
6
6
  import { createGroupingColDefForAllGroupingCriteria, createGroupingColDefForOneGroupingCriteria } from './createGroupingColDef';
@@ -68,7 +68,7 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
68
68
 
69
69
  newColumnsLookup[groupingColDef.field] = groupingColDef;
70
70
  });
71
- const startIndex = newColumnFields[0] === '__check__' ? 1 : 0;
71
+ const startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
72
72
  newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
73
73
  columnsState.all = newColumnFields;
74
74
  columnsState.lookup = newColumnsLookup;
@@ -77,15 +77,7 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
77
77
  const createRowTree = React.useCallback(params => {
78
78
  const rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
79
79
  const columnsLookup = gridColumnLookupSelector(apiRef);
80
- apiRef.current.setState(state => _extends({}, state, {
81
- rowGrouping: _extends({}, state.rowGrouping, {
82
- unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
83
- })
84
- }));
85
- const distinctValues = Object.fromEntries(rowGroupingModel.map(groupingField => [groupingField, {
86
- lookup: {},
87
- list: []
88
- }]));
80
+ apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
89
81
 
90
82
  const getCellGroupingCriteria = ({
91
83
  row,
@@ -117,24 +109,6 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
117
109
  };
118
110
  };
119
111
 
120
- params.ids.forEach(rowId => {
121
- const row = params.idRowsLookup[rowId];
122
- rowGroupingModel.forEach(groupingCriteria => {
123
- const {
124
- key
125
- } = getCellGroupingCriteria({
126
- row,
127
- id: rowId,
128
- colDef: columnsLookup[groupingCriteria]
129
- });
130
- const groupingFieldsDistinctKeys = distinctValues[groupingCriteria];
131
-
132
- if (key != null && !groupingFieldsDistinctKeys.lookup[key.toString()]) {
133
- groupingFieldsDistinctKeys.lookup[key.toString()] = true;
134
- groupingFieldsDistinctKeys.list.push(key);
135
- }
136
- });
137
- });
138
112
  const rows = params.ids.map(rowId => {
139
113
  const row = params.idRowsLookup[rowId];
140
114
  const parentPath = rowGroupingModel.map(groupingField => getCellGroupingCriteria({
package/modern/index.js CHANGED
@@ -1,10 +1,9 @@
1
- /** @license MUI v5.11.1
1
+ /** @license MUI v5.12.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
5
5
  */
6
6
  import './typeOverloads';
7
- import '@mui/x-data-grid-pro/typeOverloads';
8
7
  export { LicenseInfo } from '@mui/x-license-pro';
9
8
  export * from '@mui/x-data-grid/components';
10
9
  export * from '@mui/x-data-grid-pro/components';
@@ -1 +1,2 @@
1
- import '@mui/x-data-grid-pro/typeOverloads';
1
+ import '@mui/x-data-grid-pro/typeOverloads';
2
+ import './modules';
@@ -1,33 +1 @@
1
- // import { GridKeyValue, GridValidRowModel } from '@mui/x-data-grid-pro';
2
- // import type { GridControlledStateEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
3
- // import type { GridGroupingValueGetterParams } from '../models';
4
- // import type { GridRowGroupingModel } from '../hooks';
5
- //
6
- // export interface GridControlledStateEventLookupPremium {
7
- // /**
8
- // * Fired when the row grouping model changes.
9
- // */
10
- // rowGroupingModelChange: { params: GridRowGroupingModel };
11
- // }
12
- //
13
- // // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
- // export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
15
- // /**
16
- // * Function that transforms a complex cell value into a key that be used for grouping the rows.
17
- // * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
18
- // * @returns {GridKeyValue | null | undefined} The cell key.
19
- // */
20
- // groupingValueGetter?: (
21
- // params: GridGroupingValueGetterParams<V, R>,
22
- // ) => GridKeyValue | null | undefined;
23
- // }
24
- //
25
- // declare module '@mui/x-data-grid-pro' {
26
- // export interface GridColDef<R extends GridValidRowModel = any, V = any, F = V>
27
- // extends GridColDefPremium<R, V, F> {}
28
- //
29
- // // TODO: Remove explicit augmentation of pro package
30
- // interface GridControlledStateEventLookup
31
- // extends GridControlledStateEventLookupPro,
32
- // GridControlledStateEventLookupPremium {}
33
- // }
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY1Mjk5NzYwMDAwMA==";
3
+ const releaseInfo = "MTY1NTMzMDQwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -298,7 +298,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
298
298
  experimentalFeatures: _propTypes.default.shape({
299
299
  newEditingApi: _propTypes.default.bool,
300
300
  preventCommitWhileValidating: _propTypes.default.bool,
301
- rowGrouping: _propTypes.default.bool,
302
301
  warnIfFocusStateIsNotSynced: _propTypes.default.bool
303
302
  }),
304
303
 
@@ -352,6 +351,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
352
351
  */
353
352
  getDetailPanelHeight: _propTypes.default.func,
354
353
 
354
+ /**
355
+ * Function that returns the estimated height for a row.
356
+ * Only works if dynamic row height is used.
357
+ * Once the row height is measured this value is discarded.
358
+ * @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
359
+ * @returns {number | null} The estimated row height value. If `null` or `undefined` then the default row height, based on the density, is applied.
360
+ */
361
+ getEstimatedRowHeight: _propTypes.default.func,
362
+
355
363
  /**
356
364
  * Function that applies CSS classes dynamically on rows.
357
365
  * @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
@@ -362,7 +370,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
362
370
  /**
363
371
  * Function that sets the row height per row.
364
372
  * @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
365
- * @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
373
+ * @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied. If "auto" then the row height is calculated based on the content.
366
374
  */
367
375
  getRowHeight: _propTypes.default.func,
368
376
 
@@ -688,6 +696,22 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
688
696
  */
689
697
  onFilterModelChange: _propTypes.default.func,
690
698
 
699
+ /**
700
+ * Callback fired when the menu is closed.
701
+ * @param {GridMenuParams} params With all properties from [[GridMenuParams]].
702
+ * @param {MuiEvent<{}>} event The event object.
703
+ * @param {GridCallbackDetails} details Additional details for this callback.
704
+ */
705
+ onMenuClose: _propTypes.default.func,
706
+
707
+ /**
708
+ * Callback fired when the menu is opened.
709
+ * @param {GridMenuParams} params With all properties from [[GridMenuParams]].
710
+ * @param {MuiEvent<{}>} event The event object.
711
+ * @param {GridCallbackDetails} details Additional details for this callback.
712
+ */
713
+ onMenuOpen: _propTypes.default.func,
714
+
691
715
  /**
692
716
  * Callback fired when the current page has changed.
693
717
  * @param {number} page Index of the page displayed on the Grid.
@@ -62,7 +62,6 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
62
62
  (0, _internals.useGridRows)(apiRef, props);
63
63
  (0, _internals.useGridParamsApi)(apiRef);
64
64
  (0, _internals.useGridColumnSpanning)(apiRef);
65
- (0, _internals.useGridDetailPanelCache)(apiRef, props);
66
65
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? _internals.useGridEditing_new : _internals.useGridEditing_old;
67
66
  useGridEditing(apiRef, props);
68
67
  (0, _internals.useGridFocus)(apiRef, props);
@@ -31,13 +31,15 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
31
31
 
32
32
  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; }
33
33
 
34
- const rowGroupingStateInitializer = (state, props) => {
34
+ const rowGroupingStateInitializer = (state, props, apiRef) => {
35
35
  var _ref, _props$rowGroupingMod, _props$initialState, _props$initialState$r;
36
36
 
37
+ apiRef.current.unstable_caches.rowGrouping = {
38
+ sanitizedModelOnLastRowTreeCreation: []
39
+ };
37
40
  return (0, _extends2.default)({}, state, {
38
41
  rowGrouping: {
39
- model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : [],
40
- unstable_sanitizedModelOnLastRowTreeCreation: []
42
+ model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : []
41
43
  }
42
44
  });
43
45
  };
@@ -51,7 +53,7 @@ const rowGroupingStateInitializer = (state, props) => {
51
53
  exports.rowGroupingStateInitializer = rowGroupingStateInitializer;
52
54
 
53
55
  const useGridRowGrouping = (apiRef, props) => {
54
- apiRef.current.unstable_updateControlState({
56
+ apiRef.current.unstable_registerControlState({
55
57
  stateId: 'rowGrouping',
56
58
  propModel: props.rowGroupingModel,
57
59
  propOnChange: props.onRowGroupingModelChange,
@@ -194,14 +196,10 @@ const useGridRowGrouping = (apiRef, props) => {
194
196
  }, [apiRef, props.rowGroupingColumnMode]);
195
197
  const checkGroupingColumnsModelDiff = React.useCallback(() => {
196
198
  const rowGroupingModel = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)(apiRef);
197
- const lastGroupingColumnsModelApplied = (0, _gridRowGroupingSelector.gridRowGroupingStateSelector)(apiRef.current.state).unstable_sanitizedModelOnLastRowTreeCreation;
199
+ const lastGroupingColumnsModelApplied = apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation;
198
200
 
199
201
  if (!(0, _internals.isDeepEqual)(lastGroupingColumnsModelApplied, rowGroupingModel)) {
200
- apiRef.current.setState(state => (0, _extends2.default)({}, state, {
201
- rowGrouping: (0, _extends2.default)({}, state.rowGrouping, {
202
- unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
203
- })
204
- }));
202
+ apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
205
203
  apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
206
204
  (0, _gridRowGroupingUtils.setStrategyAvailability)(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
207
205
  // TODO: Add a clean way to re-run a strategy processing without publishing a private event
@@ -88,7 +88,7 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
88
88
 
89
89
  newColumnsLookup[groupingColDef.field] = groupingColDef;
90
90
  });
91
- const startIndex = newColumnFields[0] === '__check__' ? 1 : 0;
91
+ const startIndex = newColumnFields[0] === _xDataGridPro.GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
92
92
  newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
93
93
  columnsState.all = newColumnFields;
94
94
  columnsState.lookup = newColumnsLookup;
@@ -97,15 +97,7 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
97
97
  const createRowTree = React.useCallback(params => {
98
98
  const rowGroupingModel = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)(apiRef);
99
99
  const columnsLookup = (0, _xDataGridPro.gridColumnLookupSelector)(apiRef);
100
- apiRef.current.setState(state => (0, _extends2.default)({}, state, {
101
- rowGrouping: (0, _extends2.default)({}, state.rowGrouping, {
102
- unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
103
- })
104
- }));
105
- const distinctValues = Object.fromEntries(rowGroupingModel.map(groupingField => [groupingField, {
106
- lookup: {},
107
- list: []
108
- }]));
100
+ apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
109
101
 
110
102
  const getCellGroupingCriteria = ({
111
103
  row,
@@ -137,24 +129,6 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
137
129
  };
138
130
  };
139
131
 
140
- params.ids.forEach(rowId => {
141
- const row = params.idRowsLookup[rowId];
142
- rowGroupingModel.forEach(groupingCriteria => {
143
- const {
144
- key
145
- } = getCellGroupingCriteria({
146
- row,
147
- id: rowId,
148
- colDef: columnsLookup[groupingCriteria]
149
- });
150
- const groupingFieldsDistinctKeys = distinctValues[groupingCriteria];
151
-
152
- if (key != null && !groupingFieldsDistinctKeys.lookup[key.toString()]) {
153
- groupingFieldsDistinctKeys.lookup[key.toString()] = true;
154
- groupingFieldsDistinctKeys.list.push(key);
155
- }
156
- });
157
- });
158
132
  const rows = params.ids.map(rowId => {
159
133
  const row = params.idRowsLookup[rowId];
160
134
  const parentPath = rowGroupingModel.map(groupingField => getCellGroupingCriteria({
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.11.1
1
+ /** @license MUI v5.12.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -41,8 +41,6 @@ Object.defineProperty(exports, "useGridRootProps", {
41
41
 
42
42
  require("./typeOverloads");
43
43
 
44
- require("@mui/x-data-grid-pro/typeOverloads");
45
-
46
44
  var _xLicensePro = require("@mui/x-license-pro");
47
45
 
48
46
  var _components = require("@mui/x-data-grid/components");
@@ -1,3 +1,5 @@
1
1
  "use strict";
2
2
 
3
- require("@mui/x-data-grid-pro/typeOverloads");
3
+ require("@mui/x-data-grid-pro/typeOverloads");
4
+
5
+ require("./modules");
@@ -1,34 +1,5 @@
1
- // import { GridKeyValue, GridValidRowModel } from '@mui/x-data-grid-pro';
2
- // import type { GridControlledStateEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
3
- // import type { GridGroupingValueGetterParams } from '../models';
4
- // import type { GridRowGroupingModel } from '../hooks';
5
- //
6
- // export interface GridControlledStateEventLookupPremium {
7
- // /**
8
- // * Fired when the row grouping model changes.
9
- // */
10
- // rowGroupingModelChange: { params: GridRowGroupingModel };
11
- // }
12
- //
13
- // // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
- // export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
15
- // /**
16
- // * Function that transforms a complex cell value into a key that be used for grouping the rows.
17
- // * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
18
- // * @returns {GridKeyValue | null | undefined} The cell key.
19
- // */
20
- // groupingValueGetter?: (
21
- // params: GridGroupingValueGetterParams<V, R>,
22
- // ) => GridKeyValue | null | undefined;
23
- // }
24
- //
25
- // declare module '@mui/x-data-grid-pro' {
26
- // export interface GridColDef<R extends GridValidRowModel = any, V = any, F = V>
27
- // extends GridColDefPremium<R, V, F> {}
28
- //
29
- // // TODO: Remove explicit augmentation of pro package
30
- // interface GridControlledStateEventLookup
31
- // extends GridControlledStateEventLookupPro,
32
- // GridControlledStateEventLookupPremium {}
33
- // }
34
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
8
8
  var _utils = require("@mui/utils");
9
9
 
10
10
  const getReleaseInfo = () => {
11
- const releaseInfo = "MTY1Mjk5NzYwMDAwMA==";
11
+ const releaseInfo = "MTY1NTMzMDQwMDAwMA==";
12
12
 
13
13
  if (process.env.NODE_ENV !== 'production') {
14
14
  // A simple hack to set the value in the test environment (has no build step).