@mui/x-data-grid-premium 5.11.1 → 5.12.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 (35) hide show
  1. package/CHANGELOG.md +95 -18
  2. package/DataGridPremium/DataGridPremium.js +26 -2
  3. package/README.md +2 -2
  4. package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +6 -5
  5. package/hooks/features/rowGrouping/useGridRowGrouping.js +8 -10
  6. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
  7. package/index.d.ts +0 -1
  8. package/index.js +1 -2
  9. package/legacy/DataGridPremium/DataGridPremium.js +26 -2
  10. package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +8 -12
  11. package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -31
  12. package/legacy/index.js +1 -2
  13. package/legacy/typeOverloads/index.js +2 -1
  14. package/legacy/typeOverloads/modules.js +1 -33
  15. package/legacy/utils/releaseInfo.js +1 -1
  16. package/modern/DataGridPremium/DataGridPremium.js +26 -2
  17. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +13 -13
  18. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
  19. package/modern/index.js +1 -2
  20. package/modern/typeOverloads/index.js +2 -1
  21. package/modern/typeOverloads/modules.js +1 -33
  22. package/modern/utils/releaseInfo.js +1 -1
  23. package/node/DataGridPremium/DataGridPremium.js +26 -2
  24. package/node/hooks/features/rowGrouping/useGridRowGrouping.js +7 -9
  25. package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
  26. package/node/index.js +1 -3
  27. package/node/typeOverloads/index.js +3 -1
  28. package/node/typeOverloads/modules.js +5 -34
  29. package/node/utils/releaseInfo.js +1 -1
  30. package/package.json +9 -9
  31. package/typeOverloads/index.d.ts +1 -0
  32. package/typeOverloads/index.js +2 -1
  33. package/typeOverloads/modules.d.ts +34 -0
  34. package/typeOverloads/modules.js +1 -33
  35. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,85 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## v5.12.0
7
+
8
+ _May 31, 2022_
9
+
10
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
13
+
14
+ <img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
15
+
16
+ - ⚠️ Remove deprecated row grouping feature from `@mui/x-data-grid-pro`
17
+
18
+ Row grouping is available through the `@mui/x-data-grid-premium` package - see [Premium plan release blogpost](https://mui.com/blog/premium-plan-release/).
19
+
20
+ - 🐞 Bug fixes and improvements
21
+
22
+ ### `@mui/x-data-grid@v5.12.0` / `@mui/x-data-grid-pro@v5.12.0` / `@mui/x-data-grid-premium@v5.12.0`
23
+
24
+ - [DataGrid] Support dynamic row height (#4859) @m4theushw
25
+ - [DataGrid] Add `onMenuOpen` and `onMenuClose` props (#4825) @DanailH
26
+ - [DataGrid] Add generics to `GridActionsColDef` to match `GridColDef` (#4982) @subvertallchris
27
+ - [DataGrid] Disable drag event handlers when row or column reorder are disabled (#4857) @DanailH
28
+ - [DataGrid] Allow other attempts to stop edit mode if the first failed (#5016) @m4theushw
29
+ - [DataGrid] Better reflect the dependency on Material UI (#4795) @oliviertassinari
30
+ - [DataGrid] Add an id to the filter item created when opening the filter panel (#5014) @flaviendelangle
31
+ - [DataGrid] Use column visibility model on Hide All / Show All when enabled (#5050) @flaviendelangle
32
+ - [DataGridPro] Unpin columns back to original position (#4512) @m4theushw
33
+ - [DataGridPro] Remove experimental row grouping from Pro plan (#4949) @flaviendelangle
34
+ - [DataGridPro] Allow to scroll detail panel content if it overflows the panel (#4979) @cherniavskii
35
+ - [DataGridPro] Do not call `setRowIndex` when dragging a column over a row (#4987) @flaviendelangle
36
+ - [l10n] Add Norwegian (Bokmål) (nb-NO) locale (#5001) @spiftire
37
+ - [l10n] Add Turkish (tr-TR) locale (#5026) @Rassilion
38
+
39
+ ### `@mui/x-date-pickers@5.0.0-alpha.5` / `@mui/x-date-pickers-pro@5.0.0-alpha.5`
40
+
41
+ #### Breaking changes
42
+
43
+ - [pickers] Restructure props in `MonthPicker` / `YearPicker` and `DayPicker` (#4814) @flaviendelangle
44
+
45
+ The props of `MonthPicker` / `YearPicker` and `DayPicker` have been reworked to make them more consistent for a standalone usage (#4814) @flaviendelangle
46
+
47
+ **MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
48
+
49
+ **YearPicker**: The prop `onYearPicker` has been removed, you can use `onChange` instead since every change is a year change
50
+
51
+ **DayPicker**: The prop `isDateDisabled` has been removed, you can now use the same validation props as for the other components (`maxDate`, `minDate`, `shouldDisableDate`, `disableFuture` and `disablePast`)
52
+
53
+ #### Changes
54
+
55
+ - [pickers] Add German (de-DE) translations (#4974) @felixh10r
56
+ - [pickers] Support action bar on static pickers and improve typing (#5015) @flaviendelangle
57
+
58
+ ### Docs
59
+
60
+ - [docs] Add docs sections / pages for upcoming features on pickers (#4603) @flaviendelangle
61
+ - [docs] Add docs for filter panel components (#4919) @m4theushw
62
+ - [docs] Explain how to manage focus with `renderCell` (#4254) @alexfauquette
63
+ - [docs] Fix broken links to GitHub source (#5003) @Edwardveb
64
+ - [docs] Fix navigation links (#4956) @oliviertassinari
65
+ - [docs] Fix typo on rows docs (#4952) @jamesRadicl
66
+ - [docs] New WAI-ARIA guidelines location (#4957) @oliviertassinari
67
+ - [docs] Add "Slots" section to the right nav in the API pages (#4993) @DanailH
68
+ - [docs] Fix docs feedback widget not working (#4905) @cherniavskii
69
+ - [docs] Replace custom notes and warning with callouts (#5008) @flaviendelangle
70
+
71
+ ### Core
72
+
73
+ - [core] Avoid Order ID to refer to GitHub issues/PRs (#5005) @oliviertassinari
74
+ - [core] Improve the workflow for incomplete issues (#5012) @mnajdova
75
+ - [core] Remove dead code on row grouping tree creation (#4945) @flaviendelangle
76
+ - [core] Use new cache api for the row grouping last model tracking (#4980) @flaviendelangle
77
+ - [core] Ensure that PRs have atleast 1 label (#5011) @DanailH
78
+ - [core] Fix trailing-space @oliviertassinari
79
+ - [core] Stop Renovate PR updates when PR is on hold (#5020) @cherniavskii
80
+ - [license] Remove support for UTF-8 (#4893) @oliviertassinari
81
+ - [license] Tweak error messages (#4907) @mbrookes
82
+ - [test] Skip Safari and Firefox on broken tests (#4994) @alexfauquette
83
+ - [test] Make argos screenshots stable (#5061) @m4theushw
84
+
6
85
  ## v5.11.1
7
86
 
8
87
  _May 20, 2022_
@@ -38,30 +117,28 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
38
117
 
39
118
  To decide which button must be displayed and in which order, you can now use the `actions` prop of the `actionBar` component slot props.
40
119
 
41
- ```jsx
42
- <DatePicker
43
- componentsProps={{
44
- actionBar: {
45
- // The actions will be the same between desktop and mobile
46
- actions: ['clear'],
120
+ ```jsx
121
+ <DatePicker
122
+ componentsProps={{
123
+ actionBar: {
124
+ // The actions will be the same between desktop and mobile
125
+ actions: ['clear'],
47
126
 
48
- // The actions will be different between desktop and mobile
49
- actions: (variant) => variant === 'desktop' ? [] : ['clear'],
50
- }
51
- }}
52
- />
53
- ```
127
+ // The actions will be different between desktop and mobile
128
+ actions: (variant) => (variant === 'desktop' ? [] : ['clear']),
129
+ },
130
+ }}
131
+ />
132
+ ```
54
133
 
55
134
  The build-in `ActionBar` component supports 4 different actions: `'clear'`, `'cancel'`, `'accept'`, and `'today'`.
56
135
  By default, the pickers will render the cancel and accept button on mobile and no action on desktop.
57
136
 
58
137
  If you need other actions, you can provide your own component to the `ActionBar` component slot
59
138
 
60
- ```jsx
61
- <DatePicker
62
- components={{ ActionBar: CustomActionBar }}
63
- />
64
- ```
139
+ ```jsx
140
+ <DatePicker components={{ ActionBar: CustomActionBar }} />
141
+ ```
65
142
 
66
143
  #### Changes
67
144
 
@@ -121,7 +198,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
121
198
 
122
199
  - 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
123
200
 
124
- - 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation]( https://mui.com/x/react-data-grid/filtering/#quick-filter).
201
+ - 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/#quick-filter).
125
202
 
126
203
  <img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
127
204
 
@@ -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.
package/README.md CHANGED
@@ -19,8 +19,8 @@ This component has the following peer dependencies that you will need to install
19
19
 
20
20
  ```json
21
21
  "peerDependencies": {
22
- "@mui/material": "^5.2.8",
23
- "@mui/system": "^5.2.8",
22
+ "@mui/material": "^5.4.1",
23
+ "@mui/system": "^5.4.1",
24
24
  "react": "^17.0.2 || ^18.0.0"
25
25
  },
26
26
  ```
@@ -1,15 +1,16 @@
1
1
  export declare type GridRowGroupingModel = string[];
2
2
  export interface GridRowGroupingState {
3
3
  model: GridRowGroupingModel;
4
+ }
5
+ export interface GridRowGroupingInitialState {
6
+ model?: GridRowGroupingModel;
7
+ }
8
+ export interface GridRowGroupingInternalCache {
4
9
  /**
5
10
  * Tracks the model on the last pre-processing
6
11
  * Allows to check if we need to re-build the grouping columns when the grid upserts a column.
7
- * TODO: Move outside of the state
8
12
  */
9
- unstable_sanitizedModelOnLastRowTreeCreation: GridRowGroupingModel;
10
- }
11
- export interface GridRowGroupingInitialState {
12
- model?: GridRowGroupingModel;
13
+ sanitizedModelOnLastRowTreeCreation: GridRowGroupingModel;
13
14
  }
14
15
  export interface GridRowGroupingApi {
15
16
  /**
@@ -3,18 +3,20 @@ 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) => {
11
+ export const rowGroupingStateInitializer = (state, props, apiRef) => {
12
12
  var _ref, _props$rowGroupingMod, _props$initialState, _props$initialState$r;
13
13
 
14
+ apiRef.current.unstable_caches.rowGrouping = {
15
+ sanitizedModelOnLastRowTreeCreation: []
16
+ };
14
17
  return _extends({}, state, {
15
18
  rowGrouping: {
16
- 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 : [],
17
- unstable_sanitizedModelOnLastRowTreeCreation: []
19
+ 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 : []
18
20
  }
19
21
  });
20
22
  };
@@ -168,14 +170,10 @@ export const useGridRowGrouping = (apiRef, props) => {
168
170
  }, [apiRef, props.rowGroupingColumnMode]);
169
171
  const checkGroupingColumnsModelDiff = React.useCallback(() => {
170
172
  const rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
171
- const lastGroupingColumnsModelApplied = gridRowGroupingStateSelector(apiRef.current.state).unstable_sanitizedModelOnLastRowTreeCreation;
173
+ const lastGroupingColumnsModelApplied = apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation;
172
174
 
173
175
  if (!isDeepEqual(lastGroupingColumnsModelApplied, rowGroupingModel)) {
174
- apiRef.current.setState(state => _extends({}, state, {
175
- rowGrouping: _extends({}, state.rowGrouping, {
176
- unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
177
- })
178
- }));
176
+ apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
179
177
  apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
180
178
  setStrategyAvailability(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
181
179
  // TODO: Add a clean way to re-run a strategy processing without publishing a private event
@@ -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/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import './typeOverloads';
2
- import '@mui/x-data-grid-pro/typeOverloads';
3
2
  export { LicenseInfo } from '@mui/x-license-pro';
4
3
  export * from '@mui/x-data-grid/components';
5
4
  export * from '@mui/x-data-grid-pro/components';
package/index.js CHANGED
@@ -1,10 +1,9 @@
1
- /** @license MUI v5.11.1
1
+ /** @license MUI v5.12.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
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';
@@ -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.
@@ -4,18 +4,20 @@ import * as React from 'react';
4
4
  import Divider from '@mui/material/Divider';
5
5
  import { useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid-pro';
6
6
  import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid-pro/internals';
7
- import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector, gridRowGroupingStateSelector } from './gridRowGroupingSelector';
7
+ import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
8
8
  import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability } from './gridRowGroupingUtils';
9
9
  import { GridRowGroupableColumnMenuItems } from '../../../components/GridRowGroupableColumnMenuItems';
10
10
  import { GridRowGroupingColumnMenuItems } from '../../../components/GridRowGroupingColumnMenuItems';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
- export var rowGroupingStateInitializer = function rowGroupingStateInitializer(state, props) {
12
+ export var rowGroupingStateInitializer = function rowGroupingStateInitializer(state, props, apiRef) {
13
13
  var _ref, _props$rowGroupingMod, _props$initialState, _props$initialState$r;
14
14
 
15
+ apiRef.current.unstable_caches.rowGrouping = {
16
+ sanitizedModelOnLastRowTreeCreation: []
17
+ };
15
18
  return _extends({}, state, {
16
19
  rowGrouping: {
17
- 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 : [],
18
- unstable_sanitizedModelOnLastRowTreeCreation: []
20
+ 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 : []
19
21
  }
20
22
  });
21
23
  };
@@ -172,16 +174,10 @@ export var useGridRowGrouping = function useGridRowGrouping(apiRef, props) {
172
174
  }, [apiRef, props.rowGroupingColumnMode]);
173
175
  var checkGroupingColumnsModelDiff = React.useCallback(function () {
174
176
  var rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
175
- var lastGroupingColumnsModelApplied = gridRowGroupingStateSelector(apiRef.current.state).unstable_sanitizedModelOnLastRowTreeCreation;
177
+ var lastGroupingColumnsModelApplied = apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation;
176
178
 
177
179
  if (!isDeepEqual(lastGroupingColumnsModelApplied, rowGroupingModel)) {
178
- apiRef.current.setState(function (state) {
179
- return _extends({}, state, {
180
- rowGrouping: _extends({}, state.rowGrouping, {
181
- unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
182
- })
183
- });
184
- });
180
+ apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
185
181
  apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
186
182
  setStrategyAvailability(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
187
183
  // TODO: Add a clean way to re-run a strategy processing without publishing a private event
@@ -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.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
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 = "MTY1Mzk0ODAwMDAwMA==";
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.
@@ -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
@@ -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
@@ -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.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
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 = "MTY1Mzk0ODAwMDAwMA==";
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.
@@ -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
  };
@@ -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
@@ -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.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.
@@ -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 = "MTY1Mzk0ODAwMDAwMA==";
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).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-premium",
3
- "version": "5.11.1",
3
+ "version": "5.12.0",
4
4
  "description": "The Premium plan edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -32,19 +32,19 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.17.2",
35
- "@mui/utils": "^5.7.0",
36
- "@mui/x-data-grid": "5.11.1",
37
- "@mui/x-data-grid-pro": "5.11.1",
38
- "@mui/x-license-pro": "5.11.1",
35
+ "@mui/utils": "^5.4.1",
36
+ "@mui/x-data-grid": "5.12.0",
37
+ "@mui/x-data-grid-pro": "5.12.0",
38
+ "@mui/x-license-pro": "5.12.0",
39
39
  "@types/format-util": "^1.0.2",
40
40
  "clsx": "^1.0.4",
41
+ "exceljs": "^4.3.0",
41
42
  "prop-types": "^15.8.1",
42
- "reselect": "^4.1.5",
43
- "exceljs": "^4.3.0"
43
+ "reselect": "^4.1.5"
44
44
  },
45
45
  "peerDependencies": {
46
- "@mui/material": "^5.2.8",
47
- "@mui/system": "^5.2.8",
46
+ "@mui/material": "^5.4.1",
47
+ "@mui/system": "^5.4.1",
48
48
  "react": "^17.0.2 || ^18.0.0"
49
49
  },
50
50
  "setupFiles": [
@@ -1 +1,2 @@
1
1
  import '@mui/x-data-grid-pro/typeOverloads';
2
+ import './modules';
@@ -1 +1,2 @@
1
- import '@mui/x-data-grid-pro/typeOverloads';
1
+ import '@mui/x-data-grid-pro/typeOverloads';
2
+ import './modules';
@@ -0,0 +1,34 @@
1
+ import { GridKeyValue, GridValidRowModel } from '@mui/x-data-grid-pro';
2
+ import type { GridControlledStateEventLookupPro, GridApiCachesPro } from '@mui/x-data-grid-pro/typeOverloads';
3
+ import type { GridGroupingValueGetterParams } from '../models';
4
+ import type { GridRowGroupingModel } from '../hooks';
5
+ import { GridRowGroupingInternalCache } from '../hooks/features/rowGrouping/gridRowGroupingInterfaces';
6
+ export interface GridControlledStateEventLookupPremium {
7
+ /**
8
+ * Fired when the row grouping model changes.
9
+ */
10
+ rowGroupingModelChange: {
11
+ params: GridRowGroupingModel;
12
+ };
13
+ }
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?: (params: GridGroupingValueGetterParams<V, R>) => GridKeyValue | null | undefined;
21
+ }
22
+ export interface GridApiCachesPremium extends GridApiCachesPro {
23
+ rowGrouping: GridRowGroupingInternalCache;
24
+ }
25
+ declare module '@mui/x-data-grid-pro' {
26
+ interface GridColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridColDefPremium<R, V, F> {
27
+ }
28
+ interface GridControlledStateEventLookup extends GridControlledStateEventLookupPro, GridControlledStateEventLookupPremium {
29
+ }
30
+ }
31
+ declare module '@mui/x-data-grid-pro/internals' {
32
+ interface GridApiCaches extends GridApiCachesPremium {
33
+ }
34
+ }
@@ -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 = "MTY1Mzk0ODAwMDAwMA==";
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).