@mui/x-data-grid-pro 5.7.0 → 5.8.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 (72) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/DataGridPro/DataGridPro.d.ts +7 -1
  3. package/DataGridPro/DataGridPro.js +29 -5
  4. package/DataGridPro/useDataGridProComponent.js +2 -3
  5. package/DataGridPro/useDataGridProProps.d.ts +2 -1
  6. package/components/GridDetailPanelToggleCell.js +2 -2
  7. package/components/GridGroupingCriteriaCell.d.ts +2 -5
  8. package/components/GridGroupingCriteriaCell.js +2 -74
  9. package/components/GridTreeDataGroupingCell.js +2 -2
  10. package/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
  11. package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
  12. package/hooks/features/columnReorder/useGridColumnReorder.js +1 -1
  13. package/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
  14. package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
  15. package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +1 -1
  16. package/hooks/features/rowGrouping/useGridRowGrouping.js +4 -4
  17. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
  18. package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
  19. package/index.d.ts +1 -1
  20. package/index.js +2 -2
  21. package/legacy/DataGridPro/DataGridPro.js +29 -5
  22. package/legacy/DataGridPro/useDataGridProComponent.js +2 -3
  23. package/legacy/components/GridDetailPanelToggleCell.js +2 -2
  24. package/legacy/components/GridGroupingCriteriaCell.js +2 -74
  25. package/legacy/components/GridTreeDataGroupingCell.js +2 -2
  26. package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
  27. package/legacy/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
  28. package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +1 -1
  29. package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
  30. package/legacy/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
  31. package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +4 -4
  32. package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
  33. package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
  34. package/legacy/index.js +2 -2
  35. package/legacy/utils/releaseInfo.js +1 -1
  36. package/models/dataGridProProps.d.ts +9 -8
  37. package/models/gridGroupingColDefOverride.d.ts +2 -2
  38. package/models/gridGroupingValueGetterParams.d.ts +1 -1
  39. package/modern/DataGridPro/DataGridPro.js +29 -5
  40. package/modern/DataGridPro/useDataGridProComponent.js +2 -3
  41. package/modern/components/GridDetailPanelToggleCell.js +2 -2
  42. package/modern/components/GridGroupingCriteriaCell.js +2 -74
  43. package/modern/components/GridTreeDataGroupingCell.js +2 -2
  44. package/modern/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
  45. package/modern/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
  46. package/modern/hooks/features/columnReorder/useGridColumnReorder.js +1 -1
  47. package/modern/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
  48. package/modern/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
  49. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +4 -4
  50. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
  51. package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
  52. package/modern/index.js +2 -2
  53. package/modern/utils/releaseInfo.js +1 -1
  54. package/node/DataGridPro/DataGridPro.js +29 -5
  55. package/node/DataGridPro/useDataGridProComponent.js +1 -2
  56. package/node/components/GridDetailPanelToggleCell.js +2 -2
  57. package/node/components/GridGroupingCriteriaCell.js +1 -72
  58. package/node/components/GridTreeDataGroupingCell.js +2 -2
  59. package/node/hooks/features/columnPinning/useGridColumnPinning.js +5 -5
  60. package/node/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +1 -1
  61. package/node/hooks/features/columnReorder/useGridColumnReorder.js +1 -1
  62. package/node/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
  63. package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +1 -1
  64. package/node/hooks/features/rowGrouping/useGridRowGrouping.js +3 -3
  65. package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -1
  66. package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +1 -1
  67. package/node/index.js +9 -9
  68. package/node/utils/releaseInfo.js +1 -1
  69. package/package.json +2 -2
  70. package/typeOverloads/modules.d.ts +6 -6
  71. package/typeOverloads/reexports.d.ts +1 -1
  72. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,80 @@
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
+ ## 5.8.0
7
+ <!-- generated comparing v5.7.0..master -->
8
+ _Apr 4, 2022_
9
+
10
+ We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 Expose new methods to save and restore the grid state (#4028) @flaviendelangle
13
+
14
+ The different methods to save and restore the data-grid state are now [documented](mui.com/components/data-grid/state/#save-and-restore-the-state)
15
+
16
+ - ⌚️ Move date and time picker components from the lab (#3451) @flaviendelangle
17
+
18
+ Date and time picker components have been moved to the MUI-X repo.
19
+ They are now accessible in their own packages: `@mui/x-date-pickers` and `@mui/x-date-pickers-pro`.
20
+ For more information, you can read the [blog article](https://mui.com/blog/lab-pickers-to-mui-x) and the [migration guide](https://mui.com/x/react-date-pickers/migration-lab)
21
+
22
+ - 📝 Add `onProcessRowUpdateError` prop to simplify error management in edit mode (#4267) @m4theushw
23
+ - ✨ Add generic typing to `GridColDef` and derived interfaces (#4064) @flaviendelangle
24
+
25
+ You can now strongly type all the objects related to the row and the cell values.
26
+ Here is an example, you can find out more in the description of #4064.
27
+
28
+ ```tsx
29
+ const rows: Movie[] = [];
30
+
31
+ return (
32
+ <DataGrid
33
+ rows={rows}
34
+ columns={[{
35
+ // typeof params.row => Movie (R)
36
+ valueGetter: params => params.row.year,
37
+ }]}
38
+ />
39
+ );
40
+ ```
41
+
42
+ ### `@mui/x-data-grid@v5.8.0` / `@mui/x-data-grid-pro@v5.8.0`
43
+
44
+ #### Changes
45
+
46
+ - [DataGrid] Add `onProcessRowUpdateError` prop (#4267) @m4theushw
47
+ - [DataGrid] Add generic typing to `GridColDef` and derived interfaces (#4064) @flaviendelangle
48
+ - [DataGrid] Add missing classes on `gridClasses` and `gridPanelClasses` (#4273) @flaviendelangle
49
+ - [DataGrid] Add `onPreferencePanelClose`/`onPreferencePanelOpen` props (#4265) @kyeongsoosoo
50
+ - [DataGrid] Add slot for filter icon button (#4276) @m4theushw
51
+ - [DataGrid] Add the documentation of the portable state (#4028) @flaviendelangle
52
+ - [DataGrid] Allow to use keyboard navigation even with no rows (#4302) @alexfauquette
53
+ - [DataGrid] Fix inconsistency in the border of the last column (#4224) @alexfauquette
54
+ - [DataGrid] Fix overlay blocking scrollbar when rows is empty (#4281) @m4theushw
55
+ - [DataGrid] Improve selection with keyboard (#4157) @flaviendelangle
56
+ - [DataGrid] Scroll to the top of the page when changing page (#4272) @flaviendelangle
57
+ - [l10n] Improve Danish (da-DK) locale (#4271) @simplenotezy
58
+
59
+ ### `@mui/x-date-pickers@v5.0.0-alpha.0` / `@mui/x-date-pickers-pro@v5.0.0-alpha.0`
60
+
61
+ #### Changes
62
+
63
+ - [DatePicker] Import date-picker components from the lab (#3451) @flaviendelangle
64
+
65
+ ### Docs
66
+
67
+ - [docs] Create an home page for "Advanced Components" (#4298) @flaviendelangle
68
+ - [docs] Update installation docs (#4259) @cherniavskii
69
+ - [docs] New page for the migration of date and time pickers from the lab (#4327) @flaviendelangle
70
+
71
+ ### Core
72
+
73
+ - [core] Fix typo in issue template @oliviertassinari
74
+ - [core] Move last variables outside of the models folder (#4303) @flaviendelangle
75
+ - [core] Remove dead code (#4283) @oliviertassinari
76
+ - [core] Rename the "pre-processing" concept "pipe-processing" (#4261) @flaviendelangle
77
+ - [core] Reuse previous state when updating the columns prop (#4229) @m4theushw
78
+ - [core] Fix Argos flakyness for pickers tests (#4312) @flaviendelangle
79
+
6
80
  ## 5.7.0
7
81
 
8
82
  _Mar 24, 2022_
@@ -1,3 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { GridValidRowModel } from '@mui/x-data-grid';
2
3
  import { DataGridProProps } from '../models';
3
- export declare const DataGridPro: React.MemoExoticComponent<React.ForwardRefExoticComponent<DataGridProProps & React.RefAttributes<HTMLDivElement>>>;
4
+ interface DataGridProComponent {
5
+ <R extends GridValidRowModel = any>(props: DataGridProProps<R> & React.RefAttributes<HTMLDivElement>): JSX.Element;
6
+ propTypes?: any;
7
+ }
8
+ export declare const DataGridPro: DataGridProComponent;
9
+ export {};
@@ -353,7 +353,8 @@ DataGridProRaw.propTypes = {
353
353
  * Determines the path of a row in the tree data.
354
354
  * For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
355
355
  * Note that all paths must contain at least one element.
356
- * @param {GridRowModel} row The row from which we want the path.
356
+ * @template R
357
+ * @param {R} row The row from which we want the path.
357
358
  * @returns {string[]} The path to the row.
358
359
  */
359
360
  getTreeDataPath: PropTypes.func,
@@ -664,6 +665,28 @@ DataGridProRaw.propTypes = {
664
665
  */
665
666
  onPinnedColumnsChange: PropTypes.func,
666
667
 
668
+ /**
669
+ * Callback fired when the preferences panel is closed.
670
+ * @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
671
+ * @param {MuiEvent<{}>} event The event object.
672
+ * @param {GridCallbackDetails} details Additional details for this callback.
673
+ */
674
+ onPreferencePanelClose: PropTypes.func,
675
+
676
+ /**
677
+ * Callback fired when the preferences panel is opened.
678
+ * @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
679
+ * @param {MuiEvent<{}>} event The event object.
680
+ * @param {GridCallbackDetails} details Additional details for this callback.
681
+ */
682
+ onPreferencePanelOpen: PropTypes.func,
683
+
684
+ /**
685
+ * Callback called when `processRowUpdate` throws an error or rejects.
686
+ * @param {any} error The error thrown.
687
+ */
688
+ onProcessRowUpdateError: PropTypes.func,
689
+
667
690
  /**
668
691
  * Callback fired when the grid is resized.
669
692
  * @param {ElementSize} containerSize With all properties from [[ElementSize]].
@@ -786,9 +809,10 @@ DataGridProRaw.propTypes = {
786
809
  /**
787
810
  * Callback called before updating a row with new values in the row and cell editing.
788
811
  * Only applied if `props.experimentalFeatures.newEditingApi: true`.
789
- * @param {GridRowModel} newRow Row object with the new values.
790
- * @param {GridRowModel} oldRow Row object with the old values.
791
- * @returns {Promise<GridRowModel> | GridRowModel} The final values to update the row.
812
+ * @template R
813
+ * @param {R} newRow Row object with the new values.
814
+ * @param {R} oldRow Row object with the old values.
815
+ * @returns {Promise<R> | R} The final values to update the row.
792
816
  */
793
817
  processRowUpdate: PropTypes.func,
794
818
 
@@ -825,7 +849,7 @@ DataGridProRaw.propTypes = {
825
849
  /**
826
850
  * Set of rows of type [[GridRowsProp]].
827
851
  */
828
- rows: PropTypes.arrayOf(PropTypes.object).isRequired,
852
+ rows: PropTypes.array.isRequired,
829
853
 
830
854
  /**
831
855
  * Sets the type of space between rows added by `getRowSpacing`.
@@ -1,4 +1,4 @@
1
- import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboard, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_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 } from '@mui/x-data-grid/internals';
1
+ import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer } from '@mui/x-data-grid/internals';
2
2
  // Pro-only features
3
3
  import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
4
4
  import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
@@ -51,6 +51,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
51
51
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
52
52
  useGridRowGrouping(apiRef, props);
53
53
  useGridTreeData(apiRef);
54
+ useGridKeyboardNavigation(apiRef, props);
54
55
  useGridSelection(apiRef, props);
55
56
  useGridDetailPanel(apiRef, props);
56
57
  useGridColumnPinning(apiRef, props);
@@ -72,8 +73,6 @@ export const useDataGridProComponent = (inputApiRef, props) => {
72
73
  useGridScroll(apiRef, props);
73
74
  useGridInfiniteLoader(apiRef, props);
74
75
  useGridColumnMenu(apiRef);
75
- useGridKeyboard(apiRef);
76
- useGridKeyboardNavigation(apiRef, props);
77
76
  useGridCsvExport(apiRef);
78
77
  useGridPrintExport(apiRef, props);
79
78
  useGridClipboard(apiRef);
@@ -1,6 +1,7 @@
1
+ import { GridValidRowModel } from '@mui/x-data-grid';
1
2
  import { DataGridProProps, DataGridProProcessedProps, DataGridProPropsWithDefaultValue } from '../models/dataGridProProps';
2
3
  /**
3
4
  * The default values of `DataGridProPropsWithDefaultValue` to inject in the props of DataGridPro.
4
5
  */
5
6
  export declare const DATA_GRID_PRO_PROPS_DEFAULT_VALUES: DataGridProPropsWithDefaultValue;
6
- export declare const useDataGridProProps: (inProps: DataGridProProps) => DataGridProProcessedProps;
7
+ export declare const useDataGridProProps: <R extends GridValidRowModel>(inProps: DataGridProProps<R>) => DataGridProProcessedProps<R>;
@@ -82,7 +82,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
82
82
  * Get the cell value of a row and field.
83
83
  * @param {GridRowId} id The row id.
84
84
  * @param {string} field The field.
85
- * @returns {GridCellValue} The cell value.
85
+ * @returns {any} The cell value.
86
86
  * @deprecated Use `params.row` to directly access the fields you want instead.
87
87
  */
88
88
  getValue: PropTypes.func.isRequired,
@@ -105,7 +105,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
105
105
  /**
106
106
  * The row model of the row that the current cell belongs to.
107
107
  */
108
- row: PropTypes.any.isRequired,
108
+ row: PropTypes.object.isRequired,
109
109
 
110
110
  /**
111
111
  * The node of the row that the current cell belongs to.
@@ -3,8 +3,5 @@ import { GridRenderCellParams } from '@mui/x-data-grid';
3
3
  interface GridGroupingCriteriaCellProps extends GridRenderCellParams {
4
4
  hideDescendantCount?: boolean;
5
5
  }
6
- declare const GridGroupingCriteriaCell: {
7
- (props: GridGroupingCriteriaCellProps): JSX.Element;
8
- propTypes: any;
9
- };
10
- export { GridGroupingCriteriaCell };
6
+ export declare const GridGroupingCriteriaCell: (props: GridGroupingCriteriaCellProps) => JSX.Element;
7
+ export {};
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { unstable_composeClasses as composeClasses } from '@mui/material';
4
3
  import IconButton from '@mui/material/IconButton';
5
4
  import Box from '@mui/material/Box';
@@ -20,7 +19,7 @@ const useUtilityClasses = ownerState => {
20
19
  return composeClasses(slots, getDataGridUtilityClass, classes);
21
20
  };
22
21
 
23
- const GridGroupingCriteriaCell = props => {
22
+ export const GridGroupingCriteriaCell = props => {
24
23
  var _filteredDescendantCo;
25
24
 
26
25
  const {
@@ -76,75 +75,4 @@ const GridGroupingCriteriaCell = props => {
76
75
  children: [formattedValue === undefined ? rowNode.groupingKey : formattedValue, !hideDescendantCount && filteredDescendantCount > 0 ? ` (${filteredDescendantCount})` : '']
77
76
  })]
78
77
  });
79
- };
80
-
81
- process.env.NODE_ENV !== "production" ? GridGroupingCriteriaCell.propTypes = {
82
- // ----------------------------- Warning --------------------------------
83
- // | These PropTypes are generated from the TypeScript type definitions |
84
- // | To update them edit the TypeScript types and run "yarn proptypes" |
85
- // ----------------------------------------------------------------------
86
-
87
- /**
88
- * GridApi that let you manipulate the grid.
89
- */
90
- api: PropTypes.any.isRequired,
91
-
92
- /**
93
- * The mode of the cell.
94
- */
95
- cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
96
-
97
- /**
98
- * The column of the row that the current cell belongs to.
99
- */
100
- colDef: PropTypes.object.isRequired,
101
-
102
- /**
103
- * The column field of the cell that triggered the event.
104
- */
105
- field: PropTypes.string.isRequired,
106
-
107
- /**
108
- * The cell value formatted with the column valueFormatter.
109
- */
110
- formattedValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.object, PropTypes.string, PropTypes.bool]),
111
-
112
- /**
113
- * Get the cell value of a row and field.
114
- * @param {GridRowId} id The row id.
115
- * @param {string} field The field.
116
- * @returns {GridCellValue} The cell value.
117
- */
118
- getValue: PropTypes.func.isRequired,
119
-
120
- /**
121
- * If true, the cell is the active element.
122
- */
123
- hasFocus: PropTypes.bool.isRequired,
124
-
125
- /**
126
- * The grid row id.
127
- */
128
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
129
-
130
- /**
131
- * If true, the cell is editable.
132
- */
133
- isEditable: PropTypes.bool,
134
-
135
- /**
136
- * The row model of the row that the current cell belongs to.
137
- */
138
- row: PropTypes.object.isRequired,
139
-
140
- /**
141
- * the tabIndex value.
142
- */
143
- tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
144
-
145
- /**
146
- * The cell value, but if the column has valueGetter, use getValue.
147
- */
148
- value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.object, PropTypes.string, PropTypes.bool])
149
- } : void 0;
150
- export { GridGroupingCriteriaCell };
78
+ };
@@ -116,7 +116,7 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
116
116
  * Get the cell value of a row and field.
117
117
  * @param {GridRowId} id The row id.
118
118
  * @param {string} field The field.
119
- * @returns {GridCellValue} The cell value.
119
+ * @returns {any} The cell value.
120
120
  * @deprecated Use `params.row` to directly access the fields you want instead.
121
121
  */
122
122
  getValue: PropTypes.func.isRequired,
@@ -140,7 +140,7 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
140
140
  /**
141
141
  * The row model of the row that the current cell belongs to.
142
142
  */
143
- row: PropTypes.any.isRequired,
143
+ row: PropTypes.object.isRequired,
144
144
 
145
145
  /**
146
146
  * The node of the row that the current cell belongs to.
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import MuiDivider from '@mui/material/Divider';
4
4
  import { useGridSelector, gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector, gridVisibleColumnFieldsSelector, gridClasses, GridEvents, useGridApiMethod, useGridApiEventHandler } from '@mui/x-data-grid';
5
- import { useGridRegisterPreProcessor } from '@mui/x-data-grid/internals';
5
+ import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
6
6
  import { GridColumnPinningMenuItems } from '../../../components/GridColumnPinningMenuItems';
7
7
  import { GridPinnedPosition } from './gridColumnPinningInterface';
8
8
  import { gridPinnedColumnsSelector } from './gridColumnPinningSelector';
@@ -181,11 +181,11 @@ export const useGridColumnPinning = (apiRef, props) => {
181
181
 
182
182
  return params;
183
183
  }, [apiRef]);
184
- useGridRegisterPreProcessor(apiRef, 'scrollToIndexes', calculateScrollLeft);
185
- useGridRegisterPreProcessor(apiRef, 'columnMenu', addColumnMenuButtons);
186
- useGridRegisterPreProcessor(apiRef, 'canBeReordered', checkIfCanBeReordered);
187
- useGridRegisterPreProcessor(apiRef, 'exportState', stateExportPreProcessing);
188
- useGridRegisterPreProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
184
+ useGridRegisterPipeProcessor(apiRef, 'scrollToIndexes', calculateScrollLeft);
185
+ useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuButtons);
186
+ useGridRegisterPipeProcessor(apiRef, 'canBeReordered', checkIfCanBeReordered);
187
+ useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
188
+ useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
189
189
  apiRef.current.unstable_updateControlState({
190
190
  stateId: 'pinnedColumns',
191
191
  propModel: props.pinnedColumns,
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { useGridRegisterPreProcessor } from '@mui/x-data-grid/internals';
3
+ import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
4
4
  import { gridPinnedColumnsSelector } from './gridColumnPinningSelector';
5
5
  import { columnPinningStateInitializer } from './useGridColumnPinning';
6
6
  import { filterColumns } from '../../../components/DataGridProVirtualScroller';
@@ -41,5 +41,5 @@ export const useGridColumnPinningPreProcessors = (apiRef, props) => {
41
41
  all: [...leftPinnedColumns, ...centerColumns, ...rightPinnedColumns]
42
42
  });
43
43
  }, [disableColumnPinning, pinnedColumns]);
44
- useGridRegisterPreProcessor(apiRef, 'hydrateColumns', reorderPinnedColumns);
44
+ useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', reorderPinnedColumns);
45
45
  };
@@ -116,7 +116,7 @@ export const useGridColumnReorder = (apiRef, props) => {
116
116
  canBeReordered = targetColIndex < visibleColumns.length - 1 && !visibleColumns[targetColIndex + 1].disableReorder;
117
117
  }
118
118
 
119
- const canBeReorderedProcessed = apiRef.current.unstable_applyPreProcessors('canBeReordered', canBeReordered, {
119
+ const canBeReorderedProcessed = apiRef.current.unstable_applyPipeProcessors('canBeReordered', canBeReordered, {
120
120
  targetIndex: targetColVisibleIndex
121
121
  });
122
122
 
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { GridEvents, useGridSelector, useGridApiEventHandler, useGridApiMethod } from '@mui/x-data-grid';
4
- import { useGridRegisterPreProcessor } from '@mui/x-data-grid/internals';
4
+ import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
5
5
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from './gridDetailPanelToggleColDef';
6
6
  import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector } from './gridDetailPanelSelector';
7
7
  export const detailPanelStateInitializer = (state, props) => {
@@ -58,7 +58,7 @@ export const useGridDetailPanel = (apiRef, props) => {
58
58
 
59
59
  });
60
60
  }, [apiRef, expandedRowIds]);
61
- useGridRegisterPreProcessor(apiRef, 'rowHeight', addDetailHeight);
61
+ useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
62
62
  apiRef.current.unstable_updateControlState({
63
63
  stateId: 'detailPanels',
64
64
  propModel: props.detailPanelExpandedRowIds,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { useGridRegisterPreProcessor } from '@mui/x-data-grid/internals';
2
+ import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
3
3
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD, GRID_DETAIL_PANEL_TOGGLE_COL_DEF } from './gridDetailPanelToggleColDef';
4
4
  export const useGridDetailPanelPreProcessors = (apiRef, props) => {
5
5
  const addToggleColumn = React.useCallback(columnsState => {
@@ -24,5 +24,5 @@ export const useGridDetailPanelPreProcessors = (apiRef, props) => {
24
24
  columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] = GRID_DETAIL_PANEL_TOGGLE_COL_DEF;
25
25
  return columnsState;
26
26
  }, [props.getDetailPanelContent]);
27
- useGridRegisterPreProcessor(apiRef, 'hydrateColumns', addToggleColumn);
27
+ useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', addToggleColumn);
28
28
  };
@@ -21,7 +21,7 @@ interface FilterRowTreeFromTreeDataParams {
21
21
  * - It is passing the filter
22
22
  */
23
23
  export declare const filterRowTreeFromGroupingColumns: (params: FilterRowTreeFromTreeDataParams) => Omit<GridFilterState, 'filterModel'>;
24
- export declare const getColDefOverrides: (groupingColDefProp: DataGridProProcessedProps['groupingColDef'], fields: string[]) => import("../../..").GridGroupingColDefOverride | null | undefined;
24
+ export declare const getColDefOverrides: (groupingColDefProp: DataGridProProcessedProps['groupingColDef'], fields: string[]) => import("../../..").GridGroupingColDefOverride<any> | null | undefined;
25
25
  export declare const mergeStateWithRowGroupingModel: (rowGroupingModel: GridRowGroupingModel) => (state: GridStatePro) => GridStatePro;
26
26
  export declare const setStrategyAvailability: (apiRef: React.MutableRefObject<GridApiPro>, disableRowGrouping: boolean) => void;
27
27
  export {};
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import Divider from '@mui/material/Divider';
4
4
  import { GridEvents, useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid';
5
- import { useGridRegisterPreProcessor, isDeepEqual } from '@mui/x-data-grid/internals';
5
+ import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid/internals';
6
6
  import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector, gridRowGroupingStateSelector } from './gridRowGroupingSelector';
7
7
  import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability } from './gridRowGroupingUtils';
8
8
  import { GridRowGroupableColumnMenuItems } from '../../../components/GridRowGroupableColumnMenuItems';
@@ -143,9 +143,9 @@ export const useGridRowGrouping = (apiRef, props) => {
143
143
 
144
144
  return params;
145
145
  }, [apiRef, props.disableRowGrouping]);
146
- useGridRegisterPreProcessor(apiRef, 'columnMenu', addColumnMenuButtons);
147
- useGridRegisterPreProcessor(apiRef, 'exportState', stateExportPreProcessing);
148
- useGridRegisterPreProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
146
+ useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuButtons);
147
+ useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
148
+ useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
149
149
  /**
150
150
  * EVENTS
151
151
  */
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid';
4
- import { useGridRegisterPreProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
4
+ import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
5
5
  import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
6
6
  import { createGroupingColDefForAllGroupingCriteria, createGroupingColDefForOneGroupingCriteria } from './createGroupingColDef';
7
7
  import { filterRowTreeFromGroupingColumns, getColDefOverrides, ROW_GROUPING_STRATEGY, isGroupingColumn, setStrategyAvailability } from './gridRowGroupingUtils';
@@ -177,7 +177,7 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
177
177
  disableChildrenSorting: false
178
178
  });
179
179
  }, [apiRef]);
180
- useGridRegisterPreProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
180
+ useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
181
181
  useGridRegisterStrategyProcessor(apiRef, ROW_GROUPING_STRATEGY, 'rowTreeCreation', createRowTree);
182
182
  useGridRegisterStrategyProcessor(apiRef, ROW_GROUPING_STRATEGY, 'filtering', filterRows);
183
183
  useGridRegisterStrategyProcessor(apiRef, ROW_GROUPING_STRATEGY, 'sorting', sortRows);
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["hideDescendantCount"];
4
4
  import * as React from 'react';
5
5
  import { gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid';
6
- import { useGridRegisterPreProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
6
+ import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
7
7
  import { GRID_TREE_DATA_GROUPING_COL_DEF, GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES } from './gridTreeDataGroupColDef';
8
8
  import { filterRowTreeFromTreeData, TREE_DATA_STRATEGY } from './gridTreeDataUtils';
9
9
  import { GridTreeDataGroupingCell } from '../../../components';
@@ -112,7 +112,7 @@ export const useGridTreeDataPreProcessors = (apiRef, props) => {
112
112
  disableChildrenSorting: props.disableChildrenSorting
113
113
  });
114
114
  }, [apiRef, props.disableChildrenSorting]);
115
- useGridRegisterPreProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
115
+ useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
116
116
  useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'rowTreeCreation', createRowTree);
117
117
  useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'filtering', filterRows);
118
118
  useGridRegisterStrategyProcessor(apiRef, TREE_DATA_STRATEGY, 'sorting', sortRows);
package/index.d.ts CHANGED
@@ -6,8 +6,8 @@ export * from '@mui/x-data-grid/hooks';
6
6
  export * from '@mui/x-data-grid/locales';
7
7
  export * from '@mui/x-data-grid/models';
8
8
  export * from '@mui/x-data-grid/context';
9
- export * from '@mui/x-data-grid/colDef';
10
9
  export * from '@mui/x-data-grid/utils';
10
+ export * from '@mui/x-data-grid/colDef';
11
11
  export * from './DataGridPro';
12
12
  export * from './hooks';
13
13
  export * from './models';
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.7.0
1
+ /** @license MUI v5.8.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -11,8 +11,8 @@ export * from '@mui/x-data-grid/hooks';
11
11
  export * from '@mui/x-data-grid/locales';
12
12
  export * from '@mui/x-data-grid/models';
13
13
  export * from '@mui/x-data-grid/context';
14
- export * from '@mui/x-data-grid/colDef';
15
14
  export * from '@mui/x-data-grid/utils';
15
+ export * from '@mui/x-data-grid/colDef';
16
16
  export * from './DataGridPro';
17
17
  export * from './hooks';
18
18
  export * from './models';
@@ -353,7 +353,8 @@ DataGridProRaw.propTypes = {
353
353
  * Determines the path of a row in the tree data.
354
354
  * For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
355
355
  * Note that all paths must contain at least one element.
356
- * @param {GridRowModel} row The row from which we want the path.
356
+ * @template R
357
+ * @param {R} row The row from which we want the path.
357
358
  * @returns {string[]} The path to the row.
358
359
  */
359
360
  getTreeDataPath: PropTypes.func,
@@ -664,6 +665,28 @@ DataGridProRaw.propTypes = {
664
665
  */
665
666
  onPinnedColumnsChange: PropTypes.func,
666
667
 
668
+ /**
669
+ * Callback fired when the preferences panel is closed.
670
+ * @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
671
+ * @param {MuiEvent<{}>} event The event object.
672
+ * @param {GridCallbackDetails} details Additional details for this callback.
673
+ */
674
+ onPreferencePanelClose: PropTypes.func,
675
+
676
+ /**
677
+ * Callback fired when the preferences panel is opened.
678
+ * @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
679
+ * @param {MuiEvent<{}>} event The event object.
680
+ * @param {GridCallbackDetails} details Additional details for this callback.
681
+ */
682
+ onPreferencePanelOpen: PropTypes.func,
683
+
684
+ /**
685
+ * Callback called when `processRowUpdate` throws an error or rejects.
686
+ * @param {any} error The error thrown.
687
+ */
688
+ onProcessRowUpdateError: PropTypes.func,
689
+
667
690
  /**
668
691
  * Callback fired when the grid is resized.
669
692
  * @param {ElementSize} containerSize With all properties from [[ElementSize]].
@@ -786,9 +809,10 @@ DataGridProRaw.propTypes = {
786
809
  /**
787
810
  * Callback called before updating a row with new values in the row and cell editing.
788
811
  * Only applied if `props.experimentalFeatures.newEditingApi: true`.
789
- * @param {GridRowModel} newRow Row object with the new values.
790
- * @param {GridRowModel} oldRow Row object with the old values.
791
- * @returns {Promise<GridRowModel> | GridRowModel} The final values to update the row.
812
+ * @template R
813
+ * @param {R} newRow Row object with the new values.
814
+ * @param {R} oldRow Row object with the old values.
815
+ * @returns {Promise<R> | R} The final values to update the row.
792
816
  */
793
817
  processRowUpdate: PropTypes.func,
794
818
 
@@ -825,7 +849,7 @@ DataGridProRaw.propTypes = {
825
849
  /**
826
850
  * Set of rows of type [[GridRowsProp]].
827
851
  */
828
- rows: PropTypes.arrayOf(PropTypes.object).isRequired,
852
+ rows: PropTypes.array.isRequired,
829
853
 
830
854
  /**
831
855
  * Sets the type of space between rows added by `getRowSpacing`.
@@ -1,4 +1,4 @@
1
- import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboard, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_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 } from '@mui/x-data-grid/internals';
1
+ import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer } from '@mui/x-data-grid/internals';
2
2
  // Pro-only features
3
3
  import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
4
4
  import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
@@ -51,6 +51,7 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
51
51
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
52
52
  useGridRowGrouping(apiRef, props);
53
53
  useGridTreeData(apiRef);
54
+ useGridKeyboardNavigation(apiRef, props);
54
55
  useGridSelection(apiRef, props);
55
56
  useGridDetailPanel(apiRef, props);
56
57
  useGridColumnPinning(apiRef, props);
@@ -72,8 +73,6 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
72
73
  useGridScroll(apiRef, props);
73
74
  useGridInfiniteLoader(apiRef, props);
74
75
  useGridColumnMenu(apiRef);
75
- useGridKeyboard(apiRef);
76
- useGridKeyboardNavigation(apiRef, props);
77
76
  useGridCsvExport(apiRef);
78
77
  useGridPrintExport(apiRef, props);
79
78
  useGridClipboard(apiRef);
@@ -78,7 +78,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
78
78
  * Get the cell value of a row and field.
79
79
  * @param {GridRowId} id The row id.
80
80
  * @param {string} field The field.
81
- * @returns {GridCellValue} The cell value.
81
+ * @returns {any} The cell value.
82
82
  * @deprecated Use `params.row` to directly access the fields you want instead.
83
83
  */
84
84
  getValue: PropTypes.func.isRequired,
@@ -101,7 +101,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
101
101
  /**
102
102
  * The row model of the row that the current cell belongs to.
103
103
  */
104
- row: PropTypes.any.isRequired,
104
+ row: PropTypes.object.isRequired,
105
105
 
106
106
  /**
107
107
  * The node of the row that the current cell belongs to.