@mui/x-data-grid 5.6.0 → 5.6.1

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 (230) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/DataGrid/DataGrid.js +18 -3
  3. package/DataGrid/useDataGridComponent.js +19 -15
  4. package/DataGrid/useDataGridProps.js +3 -2
  5. package/colDef/gridNumericOperators.d.ts +1 -1
  6. package/colDef/gridNumericOperators.js +1 -1
  7. package/components/ErrorBoundary.d.ts +2 -2
  8. package/components/GridRow.js +29 -3
  9. package/components/base/GridErrorHandler.d.ts +8 -2
  10. package/components/base/GridErrorHandler.js +13 -2
  11. package/components/cell/GridBooleanCell.d.ts +2 -1
  12. package/components/cell/GridCell.js +4 -2
  13. package/components/cell/GridEditBooleanCell.d.ts +2 -1
  14. package/components/cell/GridEditDateCell.d.ts +2 -1
  15. package/components/cell/GridEditInputCell.d.ts +2 -1
  16. package/components/cell/GridEditSingleSelectCell.d.ts +2 -1
  17. package/components/cell/GridEditSingleSelectCell.js +2 -1
  18. package/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  19. package/components/containers/GridRootStyles.js +1 -1
  20. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -1
  21. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
  22. package/components/panel/filterPanel/filterPanelUtils.d.ts +2 -2
  23. package/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
  24. package/constants/gridClasses.d.ts +5 -1
  25. package/constants/gridClasses.js +1 -1
  26. package/context/GridContextProvider.d.ts +9 -6
  27. package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -0
  28. package/hooks/features/columnMenu/useGridColumnMenu.js +6 -7
  29. package/hooks/features/columns/gridColumnsSelector.d.ts +8 -8
  30. package/hooks/features/columns/gridColumnsSelector.js +11 -10
  31. package/hooks/features/columns/gridColumnsUtils.js +7 -5
  32. package/hooks/features/density/useGridDensity.d.ts +2 -0
  33. package/hooks/features/density/useGridDensity.js +3 -4
  34. package/hooks/features/dimensions/useGridDimensions.js +2 -2
  35. package/hooks/features/editRows/useGridEditing.d.ts +2 -0
  36. package/hooks/features/editRows/useGridEditing.js +3 -4
  37. package/hooks/features/export/serializers/csvSerializer.js +4 -4
  38. package/hooks/features/filter/gridFilterSelector.d.ts +1 -0
  39. package/hooks/features/filter/gridFilterSelector.js +1 -0
  40. package/hooks/features/focus/useGridFocus.d.ts +2 -0
  41. package/hooks/features/focus/useGridFocus.js +10 -11
  42. package/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
  43. package/hooks/features/pagination/useGridPage.d.ts +1 -2
  44. package/hooks/features/pagination/useGridPage.js +5 -17
  45. package/hooks/features/pagination/useGridPageSize.d.ts +1 -2
  46. package/hooks/features/pagination/useGridPageSize.js +5 -26
  47. package/hooks/features/pagination/useGridPagination.d.ts +2 -0
  48. package/hooks/features/pagination/useGridPagination.js +25 -2
  49. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +3 -1
  50. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +10 -11
  51. package/hooks/features/rows/useGridParamsApi.js +3 -10
  52. package/hooks/features/rows/useGridRows.js +14 -6
  53. package/hooks/features/rows/useGridRowsMeta.d.ts +3 -1
  54. package/hooks/features/rows/useGridRowsMeta.js +42 -24
  55. package/hooks/features/selection/gridSelectionSelector.d.ts +1 -1
  56. package/hooks/features/selection/useGridSelection.d.ts +2 -0
  57. package/hooks/features/selection/useGridSelection.js +28 -16
  58. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -3
  59. package/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  60. package/hooks/utils/useGridApi.js +10 -1
  61. package/hooks/utils/useGridInitializeState.d.ts +2 -1
  62. package/hooks/utils/useGridSelector.js +4 -4
  63. package/hooks/utils/useGridState.js +10 -1
  64. package/hooks/utils/{useCurrentPageRows.d.ts → useGridVisibleRows.d.ts} +7 -6
  65. package/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
  66. package/index.js +1 -1
  67. package/internals/index.d.ts +9 -12
  68. package/internals/index.js +9 -12
  69. package/legacy/DataGrid/DataGrid.js +18 -3
  70. package/legacy/DataGrid/useDataGridComponent.js +19 -15
  71. package/legacy/DataGrid/useDataGridProps.js +8 -2
  72. package/legacy/colDef/gridNumericOperators.js +1 -1
  73. package/legacy/components/GridRow.js +30 -3
  74. package/legacy/components/base/GridErrorHandler.js +13 -2
  75. package/legacy/components/cell/GridCell.js +4 -2
  76. package/legacy/components/cell/GridEditSingleSelectCell.js +10 -9
  77. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  78. package/legacy/components/containers/GridRootStyles.js +1 -1
  79. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +29 -26
  80. package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
  81. package/legacy/constants/gridClasses.js +1 -1
  82. package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +8 -9
  83. package/legacy/hooks/features/columns/gridColumnsSelector.js +13 -12
  84. package/legacy/hooks/features/columns/gridColumnsUtils.js +7 -5
  85. package/legacy/hooks/features/density/useGridDensity.js +5 -6
  86. package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -2
  87. package/legacy/hooks/features/editRows/useGridEditing.js +5 -6
  88. package/legacy/hooks/features/export/serializers/csvSerializer.js +4 -4
  89. package/legacy/hooks/features/filter/gridFilterSelector.js +1 -0
  90. package/legacy/hooks/features/focus/useGridFocus.js +12 -13
  91. package/legacy/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
  92. package/legacy/hooks/features/pagination/useGridPage.js +5 -17
  93. package/legacy/hooks/features/pagination/useGridPageSize.js +5 -26
  94. package/legacy/hooks/features/pagination/useGridPagination.js +25 -2
  95. package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +10 -11
  96. package/legacy/hooks/features/rows/useGridParamsApi.js +3 -10
  97. package/legacy/hooks/features/rows/useGridRows.js +17 -6
  98. package/legacy/hooks/features/rows/useGridRowsMeta.js +44 -26
  99. package/legacy/hooks/features/selection/useGridSelection.js +29 -19
  100. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  101. package/legacy/hooks/utils/useGridApi.js +7 -0
  102. package/legacy/hooks/utils/useGridSelector.js +4 -4
  103. package/legacy/hooks/utils/useGridState.js +7 -0
  104. package/legacy/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
  105. package/legacy/index.js +1 -1
  106. package/legacy/internals/index.js +9 -12
  107. package/legacy/models/colDef/gridDefaultColumnTypes.js +4 -4
  108. package/legacy/utils/createSelector.js +4 -4
  109. package/legacy/utils/getGridLocalization.js +2 -2
  110. package/lib/lodash/_baseGetAllKeys.d.ts +1 -1
  111. package/lib/lodash/_baseIsEqual.d.ts +1 -1
  112. package/lib/lodash/_baseIsEqualDeep.d.ts +1 -1
  113. package/lib/lodash/_baseKeys.d.ts +1 -1
  114. package/lib/lodash/_cacheHas.d.ts +1 -1
  115. package/lib/lodash/_equalArrays.d.ts +1 -1
  116. package/lib/lodash/_equalByTag.d.ts +1 -1
  117. package/lib/lodash/_equalObjects.d.ts +1 -1
  118. package/lib/lodash/_getAllKeys.d.ts +1 -1
  119. package/lib/lodash/_getMapData.d.ts +1 -1
  120. package/lib/lodash/_getNative.d.ts +1 -1
  121. package/lib/lodash/_getValue.d.ts +1 -1
  122. package/lib/lodash/_hashSet.d.ts +1 -1
  123. package/lib/lodash/_listCacheSet.d.ts +1 -1
  124. package/lib/lodash/_mapCacheSet.d.ts +1 -1
  125. package/lib/lodash/_mapToArray.d.ts +1 -1
  126. package/lib/lodash/_setCacheAdd.d.ts +1 -1
  127. package/lib/lodash/_setToArray.d.ts +1 -1
  128. package/lib/lodash/_stackSet.d.ts +1 -1
  129. package/lib/lodash/keys.d.ts +1 -1
  130. package/models/api/gridRowApi.d.ts +6 -0
  131. package/models/api/gridRowsMetaApi.d.ts +7 -0
  132. package/models/api/gridSortApi.d.ts +1 -0
  133. package/models/colDef/gridColDef.d.ts +1 -2
  134. package/models/colDef/gridDefaultColumnTypes.js +2 -2
  135. package/models/gridRows.d.ts +8 -2
  136. package/models/params/gridRowParams.d.ts +29 -1
  137. package/models/props/DataGridProps.d.ts +20 -4
  138. package/modern/DataGrid/DataGrid.js +18 -3
  139. package/modern/DataGrid/useDataGridComponent.js +19 -15
  140. package/modern/DataGrid/useDataGridProps.js +3 -2
  141. package/modern/colDef/gridNumericOperators.js +1 -1
  142. package/modern/components/GridRow.js +29 -3
  143. package/modern/components/base/GridErrorHandler.js +13 -2
  144. package/modern/components/cell/GridCell.js +2 -2
  145. package/modern/components/cell/GridEditSingleSelectCell.js +2 -1
  146. package/modern/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  147. package/modern/components/containers/GridRootStyles.js +1 -1
  148. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
  149. package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
  150. package/modern/constants/gridClasses.js +1 -1
  151. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +6 -7
  152. package/modern/hooks/features/columns/gridColumnsSelector.js +11 -10
  153. package/modern/hooks/features/columns/gridColumnsUtils.js +7 -5
  154. package/modern/hooks/features/density/useGridDensity.js +3 -4
  155. package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
  156. package/modern/hooks/features/editRows/useGridEditing.js +3 -4
  157. package/modern/hooks/features/export/serializers/csvSerializer.js +4 -4
  158. package/modern/hooks/features/filter/gridFilterSelector.js +1 -0
  159. package/modern/hooks/features/focus/useGridFocus.js +10 -11
  160. package/modern/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
  161. package/modern/hooks/features/pagination/useGridPage.js +1 -9
  162. package/modern/hooks/features/pagination/useGridPageSize.js +1 -20
  163. package/modern/hooks/features/pagination/useGridPagination.js +23 -2
  164. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +6 -7
  165. package/modern/hooks/features/rows/useGridParamsApi.js +3 -10
  166. package/modern/hooks/features/rows/useGridRows.js +14 -6
  167. package/modern/hooks/features/rows/useGridRowsMeta.js +36 -24
  168. package/modern/hooks/features/selection/useGridSelection.js +24 -16
  169. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  170. package/modern/hooks/utils/useGridApi.js +10 -1
  171. package/modern/hooks/utils/useGridSelector.js +4 -4
  172. package/modern/hooks/utils/useGridState.js +10 -1
  173. package/modern/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
  174. package/modern/index.js +1 -1
  175. package/modern/internals/index.js +9 -12
  176. package/modern/models/colDef/gridDefaultColumnTypes.js +2 -2
  177. package/modern/utils/createSelector.js +4 -4
  178. package/modern/utils/getGridLocalization.js +1 -1
  179. package/node/DataGrid/DataGrid.js +18 -3
  180. package/node/DataGrid/useDataGridComponent.js +11 -9
  181. package/node/DataGrid/useDataGridProps.js +3 -2
  182. package/node/colDef/gridNumericOperators.js +1 -1
  183. package/node/components/GridRow.js +28 -3
  184. package/node/components/base/GridErrorHandler.js +11 -1
  185. package/node/components/cell/GridCell.js +4 -2
  186. package/node/components/cell/GridEditSingleSelectCell.js +2 -1
  187. package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  188. package/node/components/containers/GridRootStyles.js +1 -1
  189. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
  190. package/node/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
  191. package/node/constants/gridClasses.js +1 -1
  192. package/node/hooks/features/columnMenu/useGridColumnMenu.js +10 -8
  193. package/node/hooks/features/columns/gridColumnsSelector.js +11 -9
  194. package/node/hooks/features/columns/gridColumnsUtils.js +7 -5
  195. package/node/hooks/features/density/useGridDensity.js +7 -6
  196. package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
  197. package/node/hooks/features/editRows/useGridEditing.js +8 -5
  198. package/node/hooks/features/export/serializers/csvSerializer.js +5 -4
  199. package/node/hooks/features/filter/gridFilterSelector.js +1 -0
  200. package/node/hooks/features/focus/useGridFocus.js +15 -13
  201. package/node/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
  202. package/node/hooks/features/pagination/useGridPage.js +7 -20
  203. package/node/hooks/features/pagination/useGridPageSize.js +6 -26
  204. package/node/hooks/features/pagination/useGridPagination.js +31 -1
  205. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +15 -13
  206. package/node/hooks/features/rows/useGridParamsApi.js +4 -10
  207. package/node/hooks/features/rows/useGridRows.js +15 -6
  208. package/node/hooks/features/rows/useGridRowsMeta.js +47 -26
  209. package/node/hooks/features/selection/useGridSelection.js +32 -18
  210. package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  211. package/node/hooks/utils/useGridApi.js +11 -1
  212. package/node/hooks/utils/useGridSelector.js +6 -4
  213. package/node/hooks/utils/useGridState.js +11 -1
  214. package/node/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +11 -10
  215. package/node/index.js +1 -1
  216. package/node/internals/index.js +45 -21
  217. package/node/models/colDef/gridDefaultColumnTypes.js +2 -2
  218. package/node/utils/createSelector.js +5 -4
  219. package/node/utils/getGridLocalization.js +2 -2
  220. package/package.json +2 -2
  221. package/utils/createSelector.js +4 -4
  222. package/utils/getGridLocalization.d.ts +2 -1
  223. package/utils/getGridLocalization.js +2 -2
  224. package/utils/keyboardUtils.d.ts +1 -1
  225. package/utils/warning.d.ts +1 -1
  226. package/hooks/utils/useGridStateInit.d.ts +0 -7
  227. package/hooks/utils/useGridStateInit.js +0 -9
  228. package/legacy/hooks/utils/useGridStateInit.js +0 -9
  229. package/modern/hooks/utils/useGridStateInit.js +0 -9
  230. package/node/hooks/utils/useGridStateInit.js +0 -23
@@ -16,7 +16,7 @@ import { GridEditCellProps } from '../gridEditRowModel';
16
16
  * Alignment used in position elements in Cells.
17
17
  */
18
18
  export declare type GridAlignment = 'left' | 'right' | 'center';
19
- declare type ValueOptions = string | number | {
19
+ export declare type ValueOptions = string | number | {
20
20
  value: any;
21
21
  label: string;
22
22
  };
@@ -238,4 +238,3 @@ export interface GridColumnsMeta {
238
238
  totalWidth: number;
239
239
  positions: number[];
240
240
  }
241
- export {};
@@ -13,8 +13,8 @@ export const getGridDefaultColumnTypes = () => {
13
13
  dateTime: GRID_DATETIME_COL_DEF,
14
14
  boolean: GRID_BOOLEAN_COL_DEF,
15
15
  singleSelect: GRID_SINGLE_SELECT_COL_DEF,
16
- [GRID_ACTIONS_COLUMN_TYPE]: GRID_ACTIONS_COL_DEF
16
+ [GRID_ACTIONS_COLUMN_TYPE]: GRID_ACTIONS_COL_DEF,
17
+ [DEFAULT_GRID_COL_TYPE_KEY]: GRID_STRING_COL_DEF
17
18
  };
18
- nativeColumnTypes[DEFAULT_GRID_COL_TYPE_KEY] = GRID_STRING_COL_DEF;
19
19
  return nativeColumnTypes;
20
20
  };
@@ -73,10 +73,16 @@ export declare type GridRowsLookup = Record<GridRowId, GridRowModel>;
73
73
  * The type of Id supported by the grid.
74
74
  */
75
75
  export declare type GridRowId = string | number;
76
- export declare type GridRowEntry = {
76
+ export interface GridRowEntry {
77
+ /**
78
+ * The row id.
79
+ */
77
80
  id: GridRowId;
81
+ /**
82
+ * The row model.
83
+ */
78
84
  model: GridRowModel;
79
- };
85
+ }
80
86
  /**
81
87
  * The function to retrieve the id of a [[GridRowModel]].
82
88
  */
@@ -26,8 +26,23 @@ export interface GridRowParams<R extends GridRowModel = GridRowModel> {
26
26
  */
27
27
  getValue: (id: GridRowId, field: string) => GridCellValue;
28
28
  }
29
+ interface GridRowVisibilityParams {
30
+ /**
31
+ * Whether this row is the first visible or not.
32
+ */
33
+ isFirstVisible: boolean;
34
+ /**
35
+ * Whether this row is the last visible or not.
36
+ */
37
+ isLastVisible: boolean;
38
+ }
39
+ /**
40
+ * Object passed as parameter in the row `getRowClassName` callback prop.
41
+ */
42
+ export interface GridRowClassNameParams extends GridRowParams, GridRowVisibilityParams {
43
+ }
29
44
  /**
30
- * Object passed as parameter in the row getRowHeight callback.
45
+ * Object passed as parameter in the row `getRowHeight` callback prop.
31
46
  */
32
47
  export interface GridRowHeightParams extends GridRowEntry {
33
48
  /**
@@ -39,3 +54,16 @@ export interface GridRowHeightParams extends GridRowEntry {
39
54
  * The getRowHeight return value.
40
55
  */
41
56
  export declare type GridRowHeightReturnValue = number | null | undefined;
57
+ /**
58
+ * Object passed as parameter in the row `getRowSpacing` callback prop.
59
+ */
60
+ export interface GridRowSpacingParams extends GridRowEntry, GridRowVisibilityParams {
61
+ }
62
+ /**
63
+ * The getRowSpacing return value.
64
+ */
65
+ export interface GridRowSpacing {
66
+ top?: number;
67
+ bottom?: number;
68
+ }
69
+ export {};
@@ -15,7 +15,7 @@ import { GridApiCommunity } from '../api/gridApiCommunity';
15
15
  import type { GridColumnTypesRecord } from '../colDef';
16
16
  import type { GridColumns } from '../colDef/gridColDef';
17
17
  import { GridClasses } from '../../constants/gridClasses';
18
- import { GridRowHeightParams, GridRowHeightReturnValue, GridRowParams } from '../params';
18
+ import { GridRowHeightParams, GridRowHeightReturnValue, GridRowParams, GridRowSpacing, GridRowSpacingParams, GridRowClassNameParams } from '../params';
19
19
  import { GridCellParams } from '../params/gridCellParams';
20
20
  import { GridFilterModel } from '../gridFilterModel';
21
21
  import { GridInputSelectionModel, GridSelectionModel } from '../gridSelectionModel';
@@ -27,6 +27,11 @@ export interface GridExperimentalFeatures {
27
27
  * Will be part of the premium-plan when fully ready.
28
28
  */
29
29
  preventCommitWhileValidating: boolean;
30
+ /**
31
+ * Emits a warning if the cell receives focus without also syncing the focus state.
32
+ * Only works if NODE_ENV=test.
33
+ */
34
+ warnIfFocusStateIsNotSynced: boolean;
30
35
  }
31
36
  /**
32
37
  * The props users can give to the `DataGrid` component.
@@ -61,7 +66,7 @@ export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
61
66
  components?: Partial<GridSlotsComponent>;
62
67
  /**
63
68
  * Set the locale text of the grid.
64
- * You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/internals/constants/localeTextConstants.ts) in the GitHub repository.
69
+ * You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
65
70
  */
66
71
  localeText?: Partial<GridLocaleText>;
67
72
  }
@@ -237,6 +242,11 @@ export interface DataGridPropsWithDefaultValues {
237
242
  * @default [25, 50, 100]
238
243
  */
239
244
  rowsPerPageOptions: number[];
245
+ /**
246
+ * Sets the type of space between rows added by `getRowSpacing`.
247
+ * @default "margin"
248
+ */
249
+ rowSpacingType: 'margin' | 'border';
240
250
  /**
241
251
  * If `true`, the right border of the cells are displayed.
242
252
  * @default false
@@ -317,16 +327,22 @@ export interface DataGridPropsWithoutDefaultValue extends CommonProps {
317
327
  getCellClassName?: (params: GridCellParams) => string;
318
328
  /**
319
329
  * Function that applies CSS classes dynamically on rows.
320
- * @param {GridRowParams} params With all properties from [[GridRowParams]].
330
+ * @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
321
331
  * @returns {string} The CSS class to apply to the row.
322
332
  */
323
- getRowClassName?: (params: GridRowParams) => string;
333
+ getRowClassName?: (params: GridRowClassNameParams) => string;
324
334
  /**
325
335
  * Function that sets the row height per row.
326
336
  * @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
327
337
  * @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
328
338
  */
329
339
  getRowHeight?: (params: GridRowHeightParams) => GridRowHeightReturnValue;
340
+ /**
341
+ * Function that allows to specify the spacing between rows.
342
+ * @param {GridRowSpacingParams} params With all properties from [[GridRowSpacingParams]].
343
+ * @returns {GridRowSpacing} The row spacing values.
344
+ */
345
+ getRowSpacing?: (params: GridRowSpacingParams) => GridRowSpacing;
330
346
  /**
331
347
  * Function that returns the element to render in row detail.
332
348
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
@@ -79,6 +79,7 @@ DataGridRaw.propTypes = {
79
79
  * Set of columns of type [[GridColumns]].
80
80
  */
81
81
  columns: chainPropTypes(PropTypes.array.isRequired, props => {
82
+ // @ts-ignore because otherwise `build:api` doesn't work
82
83
  if (props.columns && props.columns.some(column => column.resizable)) {
83
84
  return new Error([`MUI: \`column.resizable = true\` is not a valid prop.`, 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to the DataGridPro component to unlock this feature.'].join('\n'));
84
85
  }
@@ -182,7 +183,8 @@ DataGridRaw.propTypes = {
182
183
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
183
184
  */
184
185
  experimentalFeatures: PropTypes.shape({
185
- preventCommitWhileValidating: PropTypes.bool
186
+ preventCommitWhileValidating: PropTypes.bool,
187
+ warnIfFocusStateIsNotSynced: PropTypes.bool
186
188
  }),
187
189
 
188
190
  /**
@@ -221,7 +223,7 @@ DataGridRaw.propTypes = {
221
223
 
222
224
  /**
223
225
  * Function that applies CSS classes dynamically on rows.
224
- * @param {GridRowParams} params With all properties from [[GridRowParams]].
226
+ * @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
225
227
  * @returns {string} The CSS class to apply to the row.
226
228
  */
227
229
  getRowClassName: PropTypes.func,
@@ -238,6 +240,13 @@ DataGridRaw.propTypes = {
238
240
  */
239
241
  getRowId: PropTypes.func,
240
242
 
243
+ /**
244
+ * Function that allows to specify the spacing between rows.
245
+ * @param {GridRowSpacingParams} params With all properties from [[GridRowSpacingParams]].
246
+ * @returns {GridRowSpacing} The row spacing values.
247
+ */
248
+ getRowSpacing: PropTypes.func,
249
+
241
250
  /**
242
251
  * Set the height in pixel of the column headers in the grid.
243
252
  * @default 56
@@ -290,7 +299,7 @@ DataGridRaw.propTypes = {
290
299
 
291
300
  /**
292
301
  * Set the locale text of the grid.
293
- * You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/internals/constants/localeTextConstants.ts) in the GitHub repository.
302
+ * You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
294
303
  */
295
304
  localeText: PropTypes.object,
296
305
 
@@ -614,6 +623,12 @@ DataGridRaw.propTypes = {
614
623
  */
615
624
  rows: PropTypes.arrayOf(PropTypes.object).isRequired,
616
625
 
626
+ /**
627
+ * Sets the type of space between rows added by `getRowSpacing`.
628
+ * @default "margin"
629
+ */
630
+ rowSpacingType: PropTypes.oneOf(['border', 'margin']),
631
+
617
632
  /**
618
633
  * Select the pageSize dynamically using the component UI.
619
634
  * @default [25, 50, 100]
@@ -1,29 +1,27 @@
1
1
  import { useGridInitialization } from '../hooks/core/useGridInitialization';
2
2
  import { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
3
3
  import { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
4
- import { useGridColumnMenu } from '../hooks/features/columnMenu/useGridColumnMenu';
4
+ import { columnMenuStateInitializer, useGridColumnMenu } from '../hooks/features/columnMenu/useGridColumnMenu';
5
5
  import { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
6
- import { useGridDensity } from '../hooks/features/density/useGridDensity';
6
+ import { densityStateInitializer, useGridDensity } from '../hooks/features/density/useGridDensity';
7
7
  import { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
8
8
  import { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
9
9
  import { useGridFilter, filterStateInitializer } from '../hooks/features/filter/useGridFilter';
10
- import { useGridFocus } from '../hooks/features/focus/useGridFocus';
10
+ import { focusStateInitializer, useGridFocus } from '../hooks/features/focus/useGridFocus';
11
11
  import { useGridKeyboard } from '../hooks/features/keyboard/useGridKeyboard';
12
12
  import { useGridKeyboardNavigation } from '../hooks/features/keyboard/useGridKeyboardNavigation';
13
- import { useGridPagination } from '../hooks/features/pagination/useGridPagination';
14
- import { pageStateInitializer } from '../hooks/features/pagination/useGridPage';
15
- import { pageSizeStateInitializer } from '../hooks/features/pagination/useGridPageSize';
16
- import { useGridPreferencesPanel } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
17
- import { useGridEditing } from '../hooks/features/editRows/useGridEditing';
13
+ import { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
14
+ import { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
15
+ import { useGridEditing, editingStateInitializer } from '../hooks/features/editRows/useGridEditing';
18
16
  import { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
19
17
  import { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
20
- import { useGridSelection } from '../hooks/features/selection/useGridSelection';
18
+ import { selectionStateInitializer, useGridSelection } from '../hooks/features/selection/useGridSelection';
21
19
  import { useGridSelectionPreProcessors } from '../hooks/features/selection/useGridSelectionPreProcessors';
22
20
  import { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
23
21
  import { useGridScroll } from '../hooks/features/scroll/useGridScroll';
24
22
  import { useGridEvents } from '../hooks/features/events/useGridEvents';
25
23
  import { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
26
- import { useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
24
+ import { rowsMetaStateInitializer, useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
27
25
  import { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
28
26
  export const useDataGridComponent = props => {
29
27
  const apiRef = useGridInitialization(undefined, props);
@@ -36,12 +34,18 @@ export const useDataGridComponent = props => {
36
34
  * Register all state initializers here.
37
35
  */
38
36
 
39
- useGridInitializeState(filterStateInitializer, apiRef, props);
40
- useGridInitializeState(pageSizeStateInitializer, apiRef, props);
41
- useGridInitializeState(pageStateInitializer, apiRef, props);
37
+ useGridInitializeState(selectionStateInitializer, apiRef, props);
38
+ useGridInitializeState(columnsStateInitializer, apiRef, props);
42
39
  useGridInitializeState(rowsStateInitializer, apiRef, props);
40
+ useGridInitializeState(editingStateInitializer, apiRef, props);
41
+ useGridInitializeState(focusStateInitializer, apiRef, props);
43
42
  useGridInitializeState(sortingStateInitializer, apiRef, props);
44
- useGridInitializeState(columnsStateInitializer, apiRef, props);
43
+ useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
44
+ useGridInitializeState(filterStateInitializer, apiRef, props);
45
+ useGridInitializeState(densityStateInitializer, apiRef, props);
46
+ useGridInitializeState(paginationStateInitializer, apiRef, props);
47
+ useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
48
+ useGridInitializeState(columnMenuStateInitializer, apiRef, props);
45
49
  useGridSelection(apiRef, props);
46
50
  useGridColumns(apiRef, props);
47
51
  useGridRows(apiRef, props);
@@ -49,7 +53,7 @@ export const useDataGridComponent = props => {
49
53
  useGridEditing(apiRef, props);
50
54
  useGridFocus(apiRef, props);
51
55
  useGridSorting(apiRef, props);
52
- useGridPreferencesPanel(apiRef, props);
56
+ useGridPreferencesPanel(apiRef);
53
57
  useGridFilter(apiRef, props);
54
58
  useGridDensity(apiRef, props);
55
59
  useGridPagination(apiRef, props);
@@ -54,6 +54,7 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
54
54
  paginationMode: GridFeatureModeConstant.client,
55
55
  rowHeight: 52,
56
56
  rowsPerPageOptions: [25, 50, 100],
57
+ rowSpacingType: 'margin',
57
58
  showCellRightBorder: false,
58
59
  showColumnRightBorder: false,
59
60
  sortingOrder: ['asc', 'desc', null],
@@ -80,8 +81,8 @@ export const useDataGridProps = inProps => {
80
81
  }
81
82
 
82
83
  const mergedComponents = {};
83
- Object.keys(DATA_GRID_DEFAULT_SLOTS_COMPONENTS).forEach(key => {
84
- mergedComponents[key] = overrides[key] === undefined ? DATA_GRID_DEFAULT_SLOTS_COMPONENTS[key] : overrides[key];
84
+ Object.entries(DATA_GRID_DEFAULT_SLOTS_COMPONENTS).forEach(([key, defaultComponent]) => {
85
+ mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
85
86
  });
86
87
  return mergedComponents;
87
88
  }, [themedProps.components]);
@@ -174,4 +174,4 @@ export const getGridNumericOperators = () => [{
174
174
  * @deprecated Use `getGridNumericOperators` instead.
175
175
  */
176
176
 
177
- export const getGridNumericColumnOperators = wrapWithWarningOnCall(getGridNumericOperators, 'MUI: Using getGridNumericColumnOperators is deprecated, use getGridNumericOperators instead.');
177
+ export const getGridNumericColumnOperators = wrapWithWarningOnCall(getGridNumericOperators, ['MUI: The method getGridNumericColumnOperators is deprecated and will be removed in the next major version.', 'Use getGridNumericOperators instead.']);
@@ -16,6 +16,7 @@ import { getDataGridUtilityClass, gridClasses } from '../constants/gridClasses';
16
16
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
17
17
  import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
18
18
  import { useGridSelector } from '../hooks/utils/useGridSelector';
19
+ import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
19
20
  import { findParentElementFromClassName } from '../utils/domUtils';
20
21
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
21
22
  import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
@@ -81,6 +82,7 @@ function GridRow(props) {
81
82
 
82
83
  const apiRef = useGridApiContext();
83
84
  const rootProps = useGridRootProps();
85
+ const currentPage = useGridVisibleRows(apiRef, rootProps);
84
86
  const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
85
87
  const {
86
88
  hasScrollX,
@@ -148,12 +150,36 @@ function GridRow(props) {
148
150
  publish(GridEvents.rowClick, onClick)(event);
149
151
  }, [apiRef, onClick, publish, rowId]);
150
152
 
151
- const style = _extends({
153
+ const style = _extends({}, styleProp, {
152
154
  maxHeight: rowHeight,
153
155
  minHeight: rowHeight
154
- }, styleProp);
156
+ });
157
+
158
+ const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
159
+
160
+ if (sizes?.spacingTop) {
161
+ const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
162
+ style[property] = sizes.spacingTop;
163
+ }
164
+
165
+ if (sizes?.spacingBottom) {
166
+ const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
167
+ style[property] = sizes.spacingBottom;
168
+ }
169
+
170
+ let rowClassName = null;
171
+
172
+ if (typeof rootProps.getRowClassName === 'function') {
173
+ const indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
174
+
175
+ const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
176
+ isFirstVisible: indexRelativeToCurrentPage === 0,
177
+ isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1
178
+ });
179
+
180
+ rowClassName = rootProps.getRowClassName(rowParams);
181
+ }
155
182
 
156
- const rowClassName = typeof rootProps.getRowClassName === 'function' && rootProps.getRowClassName(apiRef.current.getRowParams(rowId));
157
183
  const cells = [];
158
184
 
159
185
  for (let i = 0; i < renderedColumns.length; i += 1) {
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
3
4
  import { styled } from '@mui/material/styles';
4
5
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
5
6
  import { useGridLogger } from '../../hooks/utils/useGridLogger';
@@ -15,7 +16,8 @@ const ErrorOverlayWrapper = styled('div')({
15
16
  width: '100%',
16
17
  height: '100%'
17
18
  });
18
- export function GridErrorHandler(props) {
19
+
20
+ function GridErrorHandler(props) {
19
21
  const {
20
22
  children
21
23
  } = props;
@@ -43,4 +45,13 @@ export function GridErrorHandler(props) {
43
45
  }),
44
46
  children: children
45
47
  });
46
- }
48
+ }
49
+
50
+ process.env.NODE_ENV !== "production" ? GridErrorHandler.propTypes = {
51
+ // ----------------------------- Warning --------------------------------
52
+ // | These PropTypes are generated from the TypeScript type definitions |
53
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
54
+ // ----------------------------------------------------------------------
55
+ children: PropTypes.node
56
+ } : void 0;
57
+ export { GridErrorHandler };
@@ -141,7 +141,7 @@ function GridCell(props) {
141
141
  }, [hasFocus, cellMode, apiRef]);
142
142
  let handleFocus = other.onFocus;
143
143
 
144
- if (process.env.NODE_ENV === 'test') {
144
+ if (process.env.NODE_ENV === 'test' && rootProps.experimentalFeatures?.warnIfFocusStateIsNotSynced) {
145
145
  handleFocus = event => {
146
146
  const focusedCell = gridFocusCellSelector(apiRef);
147
147
 
@@ -154,7 +154,7 @@ function GridCell(props) {
154
154
  }
155
155
 
156
156
  if (!warnedOnce) {
157
- console.error([`MUI: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${focusedCell?.field}.`, 'In the next render, the focus will be changed to match the state.', 'Call `fireEvent.mouseUp` and `fireEvent.click` before to sync the focus with the state.'].join('\n'));
157
+ console.warn([`MUI: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${focusedCell?.field}.`, "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
158
158
  warnedOnce = true;
159
159
  }
160
160
  };
@@ -68,10 +68,11 @@ function GridEditSingleSelectCell(props) {
68
68
 
69
69
  const handleChange = async event => {
70
70
  setOpen(false);
71
+ const target = event.target;
71
72
  const isValid = await api.setEditCellValue({
72
73
  id,
73
74
  field,
74
- value: event.target.value
75
+ value: target.value
75
76
  }, event); // We use isValid === false because the default return is undefined which evaluates to true with !isValid
76
77
 
77
78
  if (rootProps.editMode === GridEditModes.Row || isValid === false) {
@@ -23,13 +23,15 @@ const useUtilityClasses = ownerState => {
23
23
  classes,
24
24
  isDragging,
25
25
  sortDirection,
26
- showRightBorder
26
+ showRightBorder,
27
+ filterItemsCounter
27
28
  } = ownerState;
28
- const isColumnSorted = sortDirection != null; // todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
29
+ const isColumnSorted = sortDirection != null;
30
+ const isColumnFiltered = filterItemsCounter != null && filterItemsCounter > 0; // todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
29
31
 
30
32
  const isColumnNumeric = column.type === 'number';
31
33
  const slots = {
32
- root: ['columnHeader', column.headerAlign === 'left' && 'columnHeader--alignLeft', column.headerAlign === 'center' && 'columnHeader--alignCenter', column.headerAlign === 'right' && 'columnHeader--alignRight', column.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnNumeric && 'columnHeader--numeric', showRightBorder && 'withBorder'],
34
+ root: ['columnHeader', column.headerAlign === 'left' && 'columnHeader--alignLeft', column.headerAlign === 'center' && 'columnHeader--alignCenter', column.headerAlign === 'right' && 'columnHeader--alignRight', column.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', showRightBorder && 'withBorder'],
33
35
  draggableContainer: ['columnHeaderDraggableContainer'],
34
36
  titleContainer: ['columnHeaderTitleContainer'],
35
37
  titleContainerContent: ['columnHeaderTitleContainerContent']
@@ -138,7 +138,7 @@ export const GridRootStyles = styled('div', {
138
138
  display: 'flex',
139
139
  alignItems: 'center'
140
140
  },
141
- [`& .${gridClasses['columnHeader--sorted']} .${gridClasses.iconButtonContainer}`]: {
141
+ [`& .${gridClasses['columnHeader--sorted']} .${gridClasses.iconButtonContainer}, & .${gridClasses['columnHeader--filtered']} .${gridClasses.iconButtonContainer}`]: {
142
142
  visibility: 'visible',
143
143
  width: 'auto'
144
144
  },
@@ -10,21 +10,6 @@ import { unstable_useId as useId } from '@mui/material/utils';
10
10
  import { getValueFromOption } from './filterPanelUtils';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
 
13
- const getSingleSelectOptionFormatter = ({
14
- valueFormatter,
15
- field
16
- }, api) => option => {
17
- if (typeof option === 'object') {
18
- return option.label;
19
- }
20
-
21
- return valueFormatter && option !== '' ? valueFormatter({
22
- value: option,
23
- field,
24
- api
25
- }) : option;
26
- };
27
-
28
13
  const isOptionEqualToValue = (option, value) => getValueFromOption(option) === getValueFromOption(value);
29
14
 
30
15
  const filter = createFilterOptions();
@@ -41,15 +26,31 @@ function GridFilterInputMultipleSingleSelect(props) {
41
26
  const id = useId();
42
27
  const resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
43
28
  const resolvedValueOptions = React.useMemo(() => {
44
- return typeof resolvedColumn.valueOptions === 'function' ? resolvedColumn.valueOptions({
29
+ return typeof resolvedColumn?.valueOptions === 'function' ? resolvedColumn.valueOptions({
45
30
  field: resolvedColumn.field
46
- }) : resolvedColumn.valueOptions;
31
+ }) : resolvedColumn?.valueOptions;
47
32
  }, [resolvedColumn]);
48
33
  const resolvedFormattedValueOptions = React.useMemo(() => {
49
- return resolvedValueOptions.map(getValueFromOption);
34
+ return resolvedValueOptions?.map(getValueFromOption);
50
35
  }, [resolvedValueOptions]);
51
- const filterValueOptionFormatter = getSingleSelectOptionFormatter(apiRef.current.getColumn(item.columnField), apiRef.current); // The value is computed from the item.value and used directly
52
- // If it was done by a useEffect/useSate, the Autocomplete could receive incoherent value and options
36
+ const {
37
+ valueFormatter,
38
+ field
39
+ } = apiRef.current.getColumn(item.columnField);
40
+
41
+ const filterValueOptionFormatter = option => {
42
+ if (typeof option === 'object') {
43
+ return option.label;
44
+ }
45
+
46
+ return valueFormatter && option !== '' ? valueFormatter({
47
+ value: option,
48
+ field,
49
+ api: apiRef.current
50
+ }) : option;
51
+ }; // The value is computed from the item.value and used directly
52
+ // If it was done by a useEffect/useState, the Autocomplete could receive incoherent value and options
53
+
53
54
 
54
55
  const filterValues = React.useMemo(() => {
55
56
  if (!Array.isArray(item.value)) {
@@ -60,7 +61,7 @@ function GridFilterInputMultipleSingleSelect(props) {
60
61
  const itemValueIndexes = item.value.map(element => {
61
62
  // get the index matching between values and valueoptions
62
63
  const formattedElement = getValueFromOption(element);
63
- const index = resolvedFormattedValueOptions.findIndex(formatedOption => formatedOption === formattedElement);
64
+ const index = resolvedFormattedValueOptions?.findIndex(formatedOption => formatedOption === formattedElement) || 0;
64
65
  return index;
65
66
  });
66
67
  return itemValueIndexes.filter(index => index >= 0).map(index => resolvedValueOptions[index]);
@@ -85,7 +86,8 @@ function GridFilterInputMultipleSingleSelect(props) {
85
86
  multiple: true,
86
87
  freeSolo: false,
87
88
  limitTags: 1,
88
- options: resolvedValueOptions,
89
+ options: resolvedValueOptions // TODO: avoid `any`?
90
+ ,
89
91
  isOptionEqualToValue: isOptionEqualToValue,
90
92
  filterOptions: filter,
91
93
  id: id,
@@ -116,7 +118,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputMultipleSingleSelect.prop
116
118
  // | These PropTypes are generated from the TypeScript type definitions |
117
119
  // | To update them edit the TypeScript types and run "yarn proptypes" |
118
120
  // ----------------------------------------------------------------------
119
- apiRef: PropTypes.any.isRequired,
121
+ apiRef: PropTypes.shape({
122
+ current: PropTypes.object.isRequired
123
+ }).isRequired,
120
124
  applyValue: PropTypes.func.isRequired,
121
125
  focusElementRef: PropTypes
122
126
  /* @typescript-to-proptypes-ignore */
@@ -24,7 +24,10 @@ const VirtualScrollerRenderZoneRoot = styled('div', {
24
24
  slot: 'VirtualScrollerRenderZone',
25
25
  overridesResolver: (props, styles) => styles.virtualScrollerRenderZone
26
26
  })({
27
- position: 'absolute'
27
+ position: 'absolute',
28
+ display: 'flex',
29
+ // Prevents margin collapsing when using `getRowSpacing`
30
+ flexDirection: 'column'
28
31
  });
29
32
  const GridVirtualScrollerRenderZone = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerRenderZone(props, ref) {
30
33
  const {
@@ -2,4 +2,4 @@ import { generateUtilityClasses, generateUtilityClass } from '@mui/material';
2
2
  export function getDataGridUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiDataGrid', slot);
4
4
  }
5
- export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'row--editable', 'row--editing', 'row', 'row--lastVisible', 'rowCount', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
5
+ export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'row--editable', 'row--editing', 'row', 'row--lastVisible', 'rowCount', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
@@ -1,21 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { GridEvents } from '../../../models/events';
4
- import { useGridStateInit } from '../../utils/useGridStateInit';
5
4
  import { useGridLogger, useGridApiMethod, useGridApiEventHandler } from '../../utils';
6
5
  import { gridColumnMenuSelector } from './columnMenuSelector';
7
-
6
+ export const columnMenuStateInitializer = state => _extends({}, state, {
7
+ columnMenu: {
8
+ open: false
9
+ }
10
+ });
8
11
  /**
9
12
  * @requires useGridColumnResize (event)
10
13
  * @requires useGridInfiniteLoader (event)
11
14
  */
15
+
12
16
  export const useGridColumnMenu = apiRef => {
13
17
  const logger = useGridLogger(apiRef, 'useGridColumnMenu');
14
- useGridStateInit(apiRef, state => _extends({}, state, {
15
- columnMenu: {
16
- open: false
17
- }
18
- }));
19
18
  /**
20
19
  * API METHODS
21
20
  */