@mui/x-data-grid 8.18.0 → 8.20.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 (162) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/DataGrid/useDataGridComponent.js +4 -3
  3. package/components/GridRow.js +5 -2
  4. package/components/GridRowDragAndDropOverlay.d.ts +7 -0
  5. package/components/GridRowDragAndDropOverlay.js +73 -0
  6. package/components/cell/GridActionsCell.d.ts +9 -0
  7. package/components/cell/GridActionsCell.js +54 -34
  8. package/components/cell/GridBooleanCell.js +0 -10
  9. package/components/cell/GridCell.js +4 -10
  10. package/components/columnHeaders/GridColumnHeaderItem.js +2 -2
  11. package/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
  12. package/components/containers/GridRootStyles.js +17 -40
  13. package/components/toolbarV8/Toolbar.js +1 -1
  14. package/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
  15. package/components/virtualization/GridVirtualScrollbar.js +13 -8
  16. package/components/virtualization/GridVirtualScroller.js +2 -1
  17. package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
  18. package/constants/dataGridPropsDefaultValues.js +2 -1
  19. package/constants/gridClasses.d.ts +0 -8
  20. package/constants/gridClasses.js +1 -1
  21. package/esm/DataGrid/useDataGridComponent.js +5 -4
  22. package/esm/components/GridRow.js +5 -2
  23. package/esm/components/GridRowDragAndDropOverlay.d.ts +7 -0
  24. package/esm/components/GridRowDragAndDropOverlay.js +66 -0
  25. package/esm/components/cell/GridActionsCell.d.ts +9 -0
  26. package/esm/components/cell/GridActionsCell.js +55 -34
  27. package/esm/components/cell/GridBooleanCell.js +0 -10
  28. package/esm/components/cell/GridCell.js +4 -10
  29. package/esm/components/columnHeaders/GridColumnHeaderItem.js +2 -2
  30. package/esm/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
  31. package/esm/components/containers/GridRootStyles.js +17 -40
  32. package/esm/components/toolbarV8/Toolbar.js +1 -1
  33. package/esm/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
  34. package/esm/components/virtualization/GridVirtualScrollbar.js +12 -7
  35. package/esm/components/virtualization/GridVirtualScroller.js +2 -1
  36. package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
  37. package/esm/constants/dataGridPropsDefaultValues.js +2 -1
  38. package/esm/constants/gridClasses.d.ts +0 -8
  39. package/esm/constants/gridClasses.js +1 -1
  40. package/esm/hooks/core/gridPropsSelectors.d.ts +2 -1
  41. package/esm/hooks/core/gridPropsSelectors.js +3 -0
  42. package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
  43. package/esm/hooks/core/useGridProps.js +8 -2
  44. package/esm/hooks/core/useGridVirtualizer.d.ts +80 -6
  45. package/esm/hooks/core/useGridVirtualizer.js +27 -12
  46. package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
  47. package/esm/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
  48. package/esm/hooks/features/columns/useGridColumnSpanning.js +9 -4
  49. package/esm/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
  50. package/esm/hooks/features/dimensions/useGridDimensions.js +12 -6
  51. package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
  52. package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
  53. package/esm/hooks/features/export/serializers/csvSerializer.js +2 -4
  54. package/esm/hooks/features/export/useGridPrintExport.js +18 -18
  55. package/esm/hooks/features/filter/gridFilterUtils.js +5 -11
  56. package/esm/hooks/features/filter/index.d.ts +1 -1
  57. package/esm/hooks/features/filter/index.js +1 -1
  58. package/esm/hooks/features/filter/useGridFilter.d.ts +1 -1
  59. package/esm/hooks/features/filter/useGridFilter.js +3 -1
  60. package/esm/hooks/features/focus/useGridFocus.js +0 -1
  61. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  62. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
  63. package/esm/hooks/features/pagination/useGridPaginationMeta.js +3 -3
  64. package/esm/hooks/features/pagination/useGridPaginationModel.js +7 -4
  65. package/esm/hooks/features/pagination/useGridRowCount.js +31 -15
  66. package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
  67. package/esm/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
  68. package/esm/hooks/features/rowReorder/gridRowReorderSelector.js +19 -1
  69. package/esm/hooks/features/rowSelection/useGridRowSelection.js +17 -8
  70. package/esm/hooks/features/rowSelection/utils.d.ts +1 -0
  71. package/esm/hooks/features/rowSelection/utils.js +17 -4
  72. package/esm/hooks/features/rows/useGridRowSpanning.js +23 -60
  73. package/esm/hooks/features/rows/useGridRows.js +3 -1
  74. package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
  75. package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
  76. package/esm/hooks/features/scroll/useGridScroll.js +2 -3
  77. package/esm/hooks/features/sorting/gridSortingUtils.js +1 -3
  78. package/esm/hooks/features/sorting/useGridSorting.d.ts +1 -1
  79. package/esm/hooks/features/sorting/useGridSorting.js +3 -1
  80. package/esm/hooks/features/virtualization/useGridVirtualization.js +24 -5
  81. package/esm/hooks/utils/useGridEvent.js +6 -2
  82. package/esm/hooks/utils/useGridSelector.js +2 -4
  83. package/esm/hooks/utils/useRunOncePerLoop.d.ts +4 -1
  84. package/esm/hooks/utils/useRunOncePerLoop.js +28 -18
  85. package/esm/index.js +1 -1
  86. package/esm/internals/index.d.ts +5 -4
  87. package/esm/internals/index.js +3 -3
  88. package/esm/material/index.js +1 -4
  89. package/esm/models/api/gridRowApi.d.ts +14 -1
  90. package/esm/models/api/index.d.ts +1 -1
  91. package/esm/models/api/index.js +0 -1
  92. package/esm/models/colDef/gridColDef.d.ts +14 -0
  93. package/esm/models/configuration/gridConfiguration.d.ts +2 -2
  94. package/esm/models/configuration/gridRowConfiguration.d.ts +6 -5
  95. package/esm/models/events/gridEventLookup.d.ts +5 -0
  96. package/esm/models/gridStateCommunity.d.ts +1 -1
  97. package/esm/models/params/gridCellParams.d.ts +0 -10
  98. package/esm/models/props/DataGridProps.d.ts +13 -6
  99. package/esm/utils/keyboardUtils.d.ts +1 -8
  100. package/esm/utils/keyboardUtils.js +0 -7
  101. package/hooks/core/gridPropsSelectors.d.ts +2 -1
  102. package/hooks/core/gridPropsSelectors.js +4 -1
  103. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
  104. package/hooks/core/useGridProps.js +8 -2
  105. package/hooks/core/useGridVirtualizer.d.ts +80 -6
  106. package/hooks/core/useGridVirtualizer.js +26 -11
  107. package/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
  108. package/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
  109. package/hooks/features/columns/useGridColumnSpanning.js +9 -4
  110. package/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
  111. package/hooks/features/dimensions/useGridDimensions.js +12 -6
  112. package/hooks/features/editing/useGridCellEditing.js +1 -1
  113. package/hooks/features/editing/useGridRowEditing.js +1 -1
  114. package/hooks/features/export/serializers/csvSerializer.js +2 -4
  115. package/hooks/features/export/useGridPrintExport.js +18 -18
  116. package/hooks/features/filter/gridFilterUtils.js +5 -11
  117. package/hooks/features/filter/index.d.ts +1 -1
  118. package/hooks/features/filter/index.js +6 -0
  119. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  120. package/hooks/features/filter/useGridFilter.js +3 -1
  121. package/hooks/features/focus/useGridFocus.js +0 -1
  122. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  123. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
  124. package/hooks/features/pagination/useGridPaginationMeta.js +2 -2
  125. package/hooks/features/pagination/useGridPaginationModel.js +7 -4
  126. package/hooks/features/pagination/useGridRowCount.js +30 -14
  127. package/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
  128. package/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
  129. package/hooks/features/rowReorder/gridRowReorderSelector.js +20 -2
  130. package/hooks/features/rowSelection/useGridRowSelection.js +17 -8
  131. package/hooks/features/rowSelection/utils.d.ts +1 -0
  132. package/hooks/features/rowSelection/utils.js +16 -3
  133. package/hooks/features/rows/useGridRowSpanning.js +23 -60
  134. package/hooks/features/rows/useGridRows.js +3 -1
  135. package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
  136. package/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
  137. package/hooks/features/scroll/useGridScroll.js +2 -3
  138. package/hooks/features/sorting/gridSortingUtils.js +1 -3
  139. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  140. package/hooks/features/sorting/useGridSorting.js +3 -1
  141. package/hooks/features/virtualization/useGridVirtualization.js +24 -5
  142. package/hooks/utils/useGridEvent.js +6 -2
  143. package/hooks/utils/useGridSelector.js +2 -4
  144. package/hooks/utils/useRunOncePerLoop.d.ts +4 -1
  145. package/hooks/utils/useRunOncePerLoop.js +27 -18
  146. package/index.js +1 -1
  147. package/internals/index.d.ts +5 -4
  148. package/internals/index.js +16 -9
  149. package/material/index.js +1 -4
  150. package/models/api/gridRowApi.d.ts +14 -1
  151. package/models/api/index.d.ts +1 -1
  152. package/models/api/index.js +0 -11
  153. package/models/colDef/gridColDef.d.ts +14 -0
  154. package/models/configuration/gridConfiguration.d.ts +2 -2
  155. package/models/configuration/gridRowConfiguration.d.ts +6 -5
  156. package/models/events/gridEventLookup.d.ts +5 -0
  157. package/models/gridStateCommunity.d.ts +1 -1
  158. package/models/params/gridCellParams.d.ts +0 -10
  159. package/models/props/DataGridProps.d.ts +13 -6
  160. package/package.json +3 -3
  161. package/utils/keyboardUtils.d.ts +1 -8
  162. package/utils/keyboardUtils.js +1 -13
@@ -41,7 +41,7 @@ export { useGridPrintExport } from "../hooks/features/export/useGridPrintExport.
41
41
  export { useGridFilter, filterStateInitializer } from "../hooks/features/filter/useGridFilter.js";
42
42
  export { defaultGridFilterLookup } from "../hooks/features/filter/gridFilterState.js";
43
43
  export { passFilterLogic } from "../hooks/features/filter/gridFilterUtils.js";
44
- export { gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector, gridExpandedSortedRowIndexLookupSelector, gridFilteredSortedDepthRowEntriesSelector } from "../hooks/features/filter/gridFilterSelector.js";
44
+ export { gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector, gridFilteredSortedDepthRowEntriesSelector } from "../hooks/features/filter/gridFilterSelector.js";
45
45
  export { isSingleSelectColDef } from "../components/panel/filterPanel/filterPanelUtils.js";
46
46
  export type { GridAggregatedFilterItemApplier, GridAggregatedFilterItemApplierResult } from "../hooks/features/filter/gridFilterState.js";
47
47
  export { useGridFocus, focusStateInitializer } from "../hooks/features/focus/useGridFocus.js";
@@ -54,7 +54,7 @@ export { useGridRows, rowsStateInitializer } from "../hooks/features/rows/useGri
54
54
  export { useGridRowSpanning, rowSpanningStateInitializer } from "../hooks/features/rows/useGridRowSpanning.js";
55
55
  export { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
56
56
  export { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
57
- export { useGridRowsOverridableMethods } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
57
+ export { useGridRowsOverridableMethods as useGridRowsOverridableMethodsCommunity } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
58
58
  export { useGridParamsOverridableMethods } from "../hooks/features/rows/useGridParamsOverridableMethods.js";
59
59
  export { useIsCellEditable } from "../hooks/features/editing/useGridCellEditable.js";
60
60
  export { useGridRowsPreProcessors } from "../hooks/features/rows/useGridRowsPreProcessors.js";
@@ -66,7 +66,7 @@ export { getRowIdFromRowModel, GRID_ID_AUTOGENERATED, getRowValue } from "../hoo
66
66
  export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, gridRowSelector } from "../hooks/features/rows/gridRowsSelector.js";
67
67
  export { headerFilteringStateInitializer, useGridHeaderFiltering } from "../hooks/features/headerFiltering/useGridHeaderFiltering.js";
68
68
  export { useGridRowSelection, rowSelectionStateInitializer } from "../hooks/features/rowSelection/useGridRowSelection.js";
69
- export { gridIsRowDragActiveSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
69
+ export { gridIsRowDragActiveSelector, gridRowDropPositionSelector, gridRowDropTargetRowIdSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
70
70
  export type { GridRowReorderState } from "../hooks/features/rowReorder/gridRowReorderInterfaces.js";
71
71
  export { useGridRowSelectionPreProcessors } from "../hooks/features/rowSelection/useGridRowSelectionPreProcessors.js";
72
72
  export { useGridSorting, sortingStateInitializer } from "../hooks/features/sorting/useGridSorting.js";
@@ -121,4 +121,5 @@ export type { GridConfiguration } from "../models/configuration/gridConfiguratio
121
121
  export type { CellEditableConditionFn } from "../models/configuration/gridCellEditableConfiguration.js";
122
122
  export * from "../hooks/features/pivoting/index.js";
123
123
  export { createSvgIcon } from "../material/icons/createSvgIcon.js";
124
- export { useGridPanelContext } from "../components/panel/GridPanelContext.js";
124
+ export { useGridPanelContext } from "../components/panel/GridPanelContext.js";
125
+ export type { RowReorderDropPosition, RowReorderDragDirection } from "../models/api/gridRowApi.js";
@@ -31,7 +31,7 @@ export { useGridPrintExport } from "../hooks/features/export/useGridPrintExport.
31
31
  export { useGridFilter, filterStateInitializer } from "../hooks/features/filter/useGridFilter.js";
32
32
  export { defaultGridFilterLookup } from "../hooks/features/filter/gridFilterState.js";
33
33
  export { passFilterLogic } from "../hooks/features/filter/gridFilterUtils.js";
34
- export { gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector, gridExpandedSortedRowIndexLookupSelector, gridFilteredSortedDepthRowEntriesSelector } from "../hooks/features/filter/gridFilterSelector.js";
34
+ export { gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector, gridFilteredSortedDepthRowEntriesSelector } from "../hooks/features/filter/gridFilterSelector.js";
35
35
  export { isSingleSelectColDef } from "../components/panel/filterPanel/filterPanelUtils.js";
36
36
  export { useGridFocus, focusStateInitializer } from "../hooks/features/focus/useGridFocus.js";
37
37
  export { useGridKeyboardNavigation } from "../hooks/features/keyboardNavigation/useGridKeyboardNavigation.js";
@@ -43,7 +43,7 @@ export { useGridRows, rowsStateInitializer } from "../hooks/features/rows/useGri
43
43
  export { useGridRowSpanning, rowSpanningStateInitializer } from "../hooks/features/rows/useGridRowSpanning.js";
44
44
  export { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
45
45
  export { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
46
- export { useGridRowsOverridableMethods } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
46
+ export { useGridRowsOverridableMethods as useGridRowsOverridableMethodsCommunity } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
47
47
  export { useGridParamsOverridableMethods } from "../hooks/features/rows/useGridParamsOverridableMethods.js";
48
48
  export { useIsCellEditable } from "../hooks/features/editing/useGridCellEditable.js";
49
49
  export { useGridRowsPreProcessors } from "../hooks/features/rows/useGridRowsPreProcessors.js";
@@ -54,7 +54,7 @@ export { getRowIdFromRowModel, GRID_ID_AUTOGENERATED, getRowValue } from "../hoo
54
54
  export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, gridRowSelector } from "../hooks/features/rows/gridRowsSelector.js";
55
55
  export { headerFilteringStateInitializer, useGridHeaderFiltering } from "../hooks/features/headerFiltering/useGridHeaderFiltering.js";
56
56
  export { useGridRowSelection, rowSelectionStateInitializer } from "../hooks/features/rowSelection/useGridRowSelection.js";
57
- export { gridIsRowDragActiveSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
57
+ export { gridIsRowDragActiveSelector, gridRowDropPositionSelector, gridRowDropTargetRowIdSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
58
58
  export { useGridRowSelectionPreProcessors } from "../hooks/features/rowSelection/useGridRowSelectionPreProcessors.js";
59
59
  export { useGridSorting, sortingStateInitializer } from "../hooks/features/sorting/useGridSorting.js";
60
60
  export { gridSortedRowIndexLookupSelector } from "../hooks/features/sorting/gridSortingSelector.js";
@@ -589,10 +589,7 @@ function BasePopper(props) {
589
589
  if (flip) {
590
590
  result.push({
591
591
  name: 'flip',
592
- enabled: true,
593
- options: {
594
- rootBoundary: 'document'
595
- }
592
+ enabled: true
596
593
  });
597
594
  }
598
595
  if (onDidShow || onDidHide) {
@@ -1,4 +1,6 @@
1
1
  import { GridRowModel, GridRowId, GridRowModelUpdate, GridValidRowModel, GridTreeNode } from "../gridRows.js";
2
+ export type RowReorderDropPosition = 'above' | 'below' | 'inside';
3
+ export type RowReorderDragDirection = 'up' | 'down';
2
4
  export interface GridRowGroupChildrenGetterParams {
3
5
  /**
4
6
  * The row id of the group
@@ -96,10 +98,21 @@ export interface GridRowApi {
96
98
  export interface GridRowProApi {
97
99
  /**
98
100
  * Moves a row from its original position to the position given by `targetIndex`.
101
+ * Doesn't support tree data ordering. Use `setRowPosition()` instead.
99
102
  * @param {GridRowId} rowId The row id
100
103
  * @param {number} targetIndex The new position (0-based).
104
+ * @returns {void | Promise<void>} Returns a Promise when async operations are involved (e.g., processRowUpdate)
105
+ * @deprecated Use `setRowPosition()` instead. This method will be removed in the next major version.
101
106
  */
102
- setRowIndex: (rowId: GridRowId, targetIndex: number) => void;
107
+ setRowIndex: (rowId: GridRowId, targetIndex: number) => void | Promise<void>;
108
+ /**
109
+ * Moves a row to a new position relative to another row.
110
+ * @param {GridRowId} sourceRowId The ID of the row to move
111
+ * @param {GridRowId} targetRowId The ID of the row to position relative to
112
+ * @param {DropPosition} position Where to place the source row: 'above', 'below', or 'over' (for tree data)
113
+ * @returns {void | Promise<void>} Returns a Promise when async operations are involved (e.g., processRowUpdate)
114
+ */
115
+ setRowPosition: (sourceRowId: GridRowId, targetRowId: GridRowId, position: RowReorderDropPosition) => void | Promise<void>;
103
116
  /**
104
117
  * Gets the rows of a grouping criteria.
105
118
  * Only contains the rows provided to the grid, not the rows automatically generated by it.
@@ -3,7 +3,7 @@ export type { GridParamsApi } from "./gridParamsApi.js";
3
3
  export type { GridCoreApi } from "./gridCoreApi.js";
4
4
  export * from "./gridColumnApi.js";
5
5
  export * from "./gridDensityApi.js";
6
- export * from "./gridRowApi.js";
6
+ export type { GridRowGroupChildrenGetterParams, GridRowApi, GridRowProApi, GridRowProPrivateApi } from "./gridRowApi.js";
7
7
  export type { GridRowsMetaApi } from "./gridRowsMetaApi.js";
8
8
  export * from "./gridRowSelectionApi.js";
9
9
  export * from "./gridSortApi.js";
@@ -1,6 +1,5 @@
1
1
  export * from "./gridColumnApi.js";
2
2
  export * from "./gridDensityApi.js";
3
- export * from "./gridRowApi.js";
4
3
  export * from "./gridRowSelectionApi.js";
5
4
  export * from "./gridSortApi.js";
6
5
  export * from "./gridCsvExportApi.js";
@@ -257,6 +257,20 @@ export interface GridActionsColDef<R extends GridValidRowModel = any, V = any, F
257
257
  * Function that returns the actions to be shown.
258
258
  * @param {GridRowParams} params The params for each row.
259
259
  * @returns {readonly React.ReactElement<GridActionsCellItemProps>[]} An array of [[GridActionsCell]] elements.
260
+ * @deprecated Use `renderCell` instead
261
+ * @example
262
+ * // Before
263
+ * getActions: (params) => [
264
+ * <GridActionsCellItem icon={...} onClick={...} label="Delete" />,
265
+ * <GridActionsCellItem icon={...} onClick={...} label="Print" showInMenu />,
266
+ * ],
267
+ * // After
268
+ * renderCell: (params) => (
269
+ * <GridActionsCell {...params}>
270
+ * <GridActionsCellItem icon={...} onClick={...} label="Delete" />
271
+ * <GridActionsCellItem icon={...} onClick={...} label="Print" showInMenu />
272
+ * </GridActionsCell>
273
+ * ),
260
274
  */
261
275
  getActions: (params: GridRowParams<R>) => readonly React.ReactElement<GridActionsCellItemProps>[];
262
276
  }
@@ -3,14 +3,14 @@ import type { GridRowAriaAttributesInternalHook, GridRowsOverridableMethodsInter
3
3
  import type { GridAggregationInternalHooks } from "./gridAggregationConfiguration.js";
4
4
  import type { GridCellEditableInternalHook } from "./gridCellEditableConfiguration.js";
5
5
  import type { GridCSSVariablesInterface } from "../../constants/cssVariables.js";
6
- import { DataGridProcessedProps } from "../props/DataGridProps.js";
7
6
  import type { GridPrivateApiCommon } from "../api/gridApiCommon.js";
8
7
  import type { GridPrivateApiCommunity } from "../api/gridApiCommunity.js";
8
+ import type { DataGridProcessedProps } from "../props/DataGridProps.js";
9
9
  import type { GridParamsOverridableMethodsInternalHook } from "./gridParamsConfiguration.js";
10
10
  export interface GridAriaAttributesInternalHook {
11
11
  useGridAriaAttributes: () => React.HTMLAttributes<HTMLElement>;
12
12
  }
13
- export interface GridInternalHook<Api, Props> extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook, GridCellEditableInternalHook<Api, Props>, GridAggregationInternalHooks<Api, Props>, GridRowsOverridableMethodsInternalHook<Api>, GridParamsOverridableMethodsInternalHook<Api> {
13
+ export interface GridInternalHook<Api, Props> extends GridAriaAttributesInternalHook, GridRowAriaAttributesInternalHook, GridCellEditableInternalHook<Api, Props>, GridAggregationInternalHooks<Api, Props>, GridRowsOverridableMethodsInternalHook<Api, Props>, GridParamsOverridableMethodsInternalHook<Api> {
14
14
  useCSSVariables: () => {
15
15
  id: string;
16
16
  variables: GridCSSVariablesInterface;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { RefObject } from '@mui/x-internals/types';
3
- import { GridTreeNode, GridRowId } from "../gridRows.js";
4
- import { DataGridProcessedProps } from "../props/DataGridProps.js";
3
+ import { GridTreeNode } from "../gridRows.js";
4
+ import { GridRowProApi } from "../api/index.js";
5
5
  /**
6
6
  * Get the ARIA attributes for a row
7
7
  * @param {GridTreeNode} rowNode The row node
@@ -15,8 +15,9 @@ export interface GridRowAriaAttributesInternalHook {
15
15
  /**
16
16
  * Overridable row methods interface, these methods could be overriden in a higher plan package.
17
17
  */
18
- export interface GridRowsOverridableMethodsInternalHook<Api> {
19
- useGridRowsOverridableMethods: (apiRef: RefObject<Api>, props: Pick<DataGridProcessedProps, 'processRowUpdate' | 'onProcessRowUpdateError' | 'dataSource'>) => {
20
- setRowIndex: (rowId: GridRowId, targetIndex: number) => void;
18
+ export interface GridRowsOverridableMethodsInternalHook<Api, Props> {
19
+ useGridRowsOverridableMethods: (apiRef: RefObject<Api>, props: Props) => {
20
+ setRowIndex: GridRowProApi['setRowIndex'];
21
+ setRowPosition: GridRowProApi['setRowPosition'];
21
22
  };
22
23
  }
@@ -516,6 +516,11 @@ export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEve
516
516
  * @ignore - do not document
517
517
  */
518
518
  sortedRowsSet: {};
519
+ /**
520
+ * Fired when the aggregations are done
521
+ * @ignore - do not document
522
+ */
523
+ aggregationLookupSet: {};
519
524
  /**
520
525
  * Fired when the expansion of a row is changed. Called with a [[GridGroupNode]] object.
521
526
  */
@@ -13,7 +13,7 @@ import type { GridRowReorderState } from "../hooks/features/rowReorder/gridRowRe
13
13
  * Some props are passed on the state to enable grid selectors to select
14
14
  * and react to them.
15
15
  */
16
- export type GridStateProps = Pick<DataGridProcessedProps, 'getRowId' | 'listView' | 'isCellEditable'>;
16
+ export type GridStateProps = Pick<DataGridProcessedProps, 'getRowId' | 'listView' | 'isCellEditable' | 'isRowSelectable'>;
17
17
  /**
18
18
  * The state of Data Grid.
19
19
  */
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { GridCellMode } from "../gridCell.js";
3
2
  import { GridRowId, GridRowModel, GridTreeNode, GridTreeNodeWithRender, GridValidRowModel } from "../gridRows.js";
4
3
  import type { GridStateColDef } from "../colDef/gridColDef.js";
@@ -58,9 +57,6 @@ export interface GridCellParams<R extends GridValidRowModel = any, V = unknown,
58
57
  */
59
58
  api: GridApiCommunity;
60
59
  }
61
- export interface FocusElement {
62
- focus(): void;
63
- }
64
60
  /**
65
61
  * GridCellParams containing api.
66
62
  */
@@ -69,12 +65,6 @@ export interface GridRenderCellParams<R extends GridValidRowModel = any, V = any
69
65
  * GridApi that let you manipulate the grid.
70
66
  */
71
67
  api: GridApiCommunity;
72
- /**
73
- * A ref allowing to set imperative focus.
74
- * It can be passed to the element that should receive focus.
75
- * @ignore - do not document.
76
- */
77
- focusElementRef?: React.Ref<FocusElement>;
78
68
  }
79
69
  /**
80
70
  * GridEditCellProps containing api.
@@ -79,13 +79,11 @@ export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
79
79
  */
80
80
  export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = any> {
81
81
  /**
82
- * If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
82
+ * If `true`, the Data Grid height is dynamic and takes as much space as it needs to display all rows.
83
+ * Use it instead of a flex parent container approach, if:
84
+ * - you don't need to set a minimum or maximum height for the Data Grid
85
+ * - you want to avoid the scrollbar flickering when the content changes
83
86
  * @default false
84
- * @deprecated Use flex parent container instead: https://mui.com/x/react-data-grid/layout/#flex-parent-container
85
- * @example
86
- * <div style={{ display: 'flex', flexDirection: 'column' }}>
87
- * <DataGrid />
88
- * </div>
89
87
  */
90
88
  autoHeight: boolean;
91
89
  /**
@@ -381,6 +379,15 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
381
379
  * @default false
382
380
  */
383
381
  virtualizeColumnsWithAutoRowHeight: boolean;
382
+ /**
383
+ * Sets the tab navigation behavior for the Data Grid.
384
+ * - "none": No Data Grid specific tab navigation. Pressing the tab key will move the focus to the next element in the tab sequence.
385
+ * - "content": Pressing the tab key will move the focus to the next cell in the same row or the first cell in the next row. Shift+Tab will move the focus to the previous cell in the same row or the last cell in the previous row. Tab navigation is not enabled for the header.
386
+ * - "header": Pressing the tab key will move the focus to the next column group, column header or header filter. Shift+Tab will move the focus to the previous column group, column header or header filter. Tab navigation is not enabled for the content.
387
+ * - "all": Combines the "content" and "header" behavior.
388
+ * @default "none"
389
+ */
390
+ tabNavigation: 'none' | 'content' | 'header' | 'all';
384
391
  }
385
392
  /**
386
393
  * The Data Grid props with no default value.
@@ -1,14 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export declare function isPrintableKey(event: React.KeyboardEvent<HTMLElement>): boolean;
3
- export declare const GRID_MULTIPLE_SELECTION_KEYS: string[];
4
- export declare const GRID_CELL_EXIT_EDIT_MODE_KEYS: string[];
5
- export declare const GRID_CELL_EDIT_COMMIT_KEYS: string[];
6
- export declare const isMultipleKey: (key: string) => boolean;
7
- export declare const isCellEnterEditModeKeys: (event: React.KeyboardEvent<HTMLElement>) => boolean;
8
- export declare const isCellExitEditModeKeys: (key: string) => boolean;
9
- export declare const isCellEditCommitKeys: (key: string) => boolean;
10
3
  export declare const isNavigationKey: (key: string) => boolean;
11
4
  export declare const isKeyboardEvent: (event: any) => event is React.KeyboardEvent<HTMLElement>;
12
- export declare const isHideMenuKey: (key: React.KeyboardEvent["key"]) => key is "Escape" | "Tab";
5
+ export declare const isHideMenuKey: (key: React.KeyboardEvent["key"]) => key is "Tab" | "Escape";
13
6
  export declare function isPasteShortcut(event: React.KeyboardEvent): boolean;
14
7
  export declare function isCopyShortcut(event: KeyboardEvent): boolean;
@@ -8,13 +8,6 @@
8
8
  export function isPrintableKey(event) {
9
9
  return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
10
10
  }
11
- export const GRID_MULTIPLE_SELECTION_KEYS = ['Meta', 'Control', 'Shift'];
12
- export const GRID_CELL_EXIT_EDIT_MODE_KEYS = ['Enter', 'Escape', 'Tab'];
13
- export const GRID_CELL_EDIT_COMMIT_KEYS = ['Enter', 'Tab'];
14
- export const isMultipleKey = key => GRID_MULTIPLE_SELECTION_KEYS.indexOf(key) > -1;
15
- export const isCellEnterEditModeKeys = event => isPrintableKey(event) || event.key === 'Enter' || event.key === 'Backspace' || event.key === 'Delete';
16
- export const isCellExitEditModeKeys = key => GRID_CELL_EXIT_EDIT_MODE_KEYS.indexOf(key) > -1;
17
- export const isCellEditCommitKeys = key => GRID_CELL_EDIT_COMMIT_KEYS.indexOf(key) > -1;
18
11
  export const isNavigationKey = key => key.indexOf('Arrow') === 0 || key.indexOf('Page') === 0 || key === ' ' || key === 'Home' || key === 'End';
19
12
  export const isKeyboardEvent = event => !!event.key;
20
13
  export const isHideMenuKey = key => key === 'Tab' || key === 'Escape';
@@ -6,4 +6,5 @@ import type { GridRowId } from "../../models/gridRows.js";
6
6
  * @param {GridRowModel} row - The row to get the id for
7
7
  * @returns {GridRowId} The row id
8
8
  */
9
- export declare const gridRowIdSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, import("@mui/x-data-grid").GridValidRowModel, GridRowId>;
9
+ export declare const gridRowIdSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, import("@mui/x-data-grid").GridValidRowModel, GridRowId>;
10
+ export declare const gridRowSelectableSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, ((params: import("@mui/x-data-grid").GridRowParams<any>) => boolean) | undefined>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.gridRowIdSelector = void 0;
6
+ exports.gridRowSelectableSelector = exports.gridRowIdSelector = void 0;
7
7
  var _gridRowsUtils = require("../features/rows/gridRowsUtils");
8
8
  var _createSelector = require("../../utils/createSelector");
9
9
  /**
@@ -17,4 +17,7 @@ const gridRowIdSelector = exports.gridRowIdSelector = (0, _createSelector.create
17
17
  return row[_gridRowsUtils.GRID_ID_AUTOGENERATED];
18
18
  }
19
19
  return state.props.getRowId ? state.props.getRowId(row) : row.id;
20
+ });
21
+ const gridRowSelectableSelector = exports.gridRowSelectableSelector = (0, _createSelector.createRootSelector)(state => {
22
+ return state.props.isRowSelectable;
20
23
  });
@@ -8,6 +8,7 @@ import { GridHydrateRowsValue } from "../../features/rows/gridRowsInterfaces.js"
8
8
  import { GridPreferencePanelsValue } from "../../features/preferencesPanel/index.js";
9
9
  import { GridGetRowsParams, GridGetRowsResponse } from "../../../models/gridDataSource.js";
10
10
  import { HeightEntry } from "../../features/rows/gridRowsMetaInterfaces.js";
11
+ import type { RowReorderDropPosition } from "../../../models/api/gridRowApi.js";
11
12
  export type GridPipeProcessorGroup = keyof GridPipeProcessingLookup;
12
13
  export interface GridPipeProcessingLookup {
13
14
  columnMenu: {
@@ -97,12 +98,12 @@ export interface GridPipeProcessingLookup {
97
98
  * - For example before first row is `0` and after the last row is `rows.length`.
98
99
  * If the reorder is invalid, it returns `-1`.
99
100
  */
100
- getRowReorderTargetIndex: {
101
- value: number;
101
+ isRowReorderValid: {
102
+ value: boolean;
102
103
  context: {
103
104
  sourceRowId: GridRowId;
104
105
  targetRowId: GridRowId;
105
- dropPosition: 'above' | 'below';
106
+ dropPosition: RowReorderDropPosition;
106
107
  dragDirection: 'up' | 'down';
107
108
  };
108
109
  };
@@ -20,14 +20,20 @@ const propsStateInitializer = (state, props) => {
20
20
  };
21
21
  exports.propsStateInitializer = propsStateInitializer;
22
22
  const useGridProps = (apiRef, props) => {
23
+ const isFirstRender = React.useRef(true);
23
24
  React.useEffect(() => {
25
+ if (isFirstRender.current) {
26
+ isFirstRender.current = false;
27
+ return;
28
+ }
24
29
  apiRef.current.setState(state => (0, _extends2.default)({}, state, {
25
30
  props: {
26
31
  listView: props.listView,
27
32
  getRowId: props.getRowId,
28
- isCellEditable: props.isCellEditable
33
+ isCellEditable: props.isCellEditable,
34
+ isRowSelectable: props.isRowSelectable
29
35
  }
30
36
  }));
31
- }, [apiRef, props.listView, props.getRowId, props.isCellEditable]);
37
+ }, [apiRef, props.listView, props.getRowId, props.isCellEditable, props.isRowSelectable]);
32
38
  };
33
39
  exports.useGridProps = useGridProps;
@@ -1,9 +1,83 @@
1
- import { RefObject } from '@mui/x-internals/types';
2
- import { GridPrivateApiCommunity } from "../../models/api/gridApiCommunity.js";
3
- import { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
4
- type RootProps = DataGridProcessedProps;
1
+ import * as React from 'react';
2
+ import { Dimensions, Virtualization } from '@mui/x-virtualizer';
5
3
  /**
6
4
  * Virtualizer setup
7
5
  */
8
- export declare function useGridVirtualizer(apiRef: RefObject<GridPrivateApiCommunity>, rootProps: RootProps): void;
9
- export {};
6
+ export declare function useGridVirtualizer(): {
7
+ store: import("@mui/x-internals/store").Store<Dimensions.State & Virtualization.State & import("@mui/x-virtualizer").Colspan.State & import("@mui/x-virtualizer").Rowspan.State>;
8
+ api: {
9
+ updateDimensions: (firstUpdate?: boolean) => void;
10
+ debouncedUpdateDimensions: (((firstUpdate?: boolean) => void) & import("@mui/x-internals/throttle").Cancelable) | undefined;
11
+ rowsMeta: {
12
+ getRowHeight: (rowId: import("@mui/x-virtualizer/models").RowId) => any;
13
+ setLastMeasuredRowIndex: (index: number) => void;
14
+ storeRowHeightMeasurement: (id: import("@mui/x-virtualizer/models").RowId, height: number) => void;
15
+ hydrateRowsMeta: () => void;
16
+ observeRowHeight: (element: Element, rowId: import("@mui/x-virtualizer/models").RowId) => () => void | undefined;
17
+ rowHasAutoHeight: (id: import("@mui/x-virtualizer/models").RowId) => any;
18
+ getRowHeightEntry: (rowId: import("@mui/x-virtualizer/models").RowId) => any;
19
+ getLastMeasuredRowIndex: () => number;
20
+ resetRowHeights: () => void;
21
+ };
22
+ } & {
23
+ getters: {
24
+ setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
25
+ getOffsetTop: () => number;
26
+ getRows: (rowParams?: {
27
+ rows?: import("@mui/x-virtualizer/models").RowEntry[];
28
+ position?: import("@mui/x-virtualizer/models").PinnedRowPosition;
29
+ renderContext?: import("@mui/x-virtualizer/models").RenderContext;
30
+ }, unstable_rowTree?: Record<import("@mui/x-virtualizer/models").RowId, any>) => React.ReactNode[];
31
+ rows: import("@mui/x-virtualizer/models").RowEntry[];
32
+ getContainerProps: () => {
33
+ ref: (node: HTMLDivElement | null) => (() => void | undefined) | undefined;
34
+ };
35
+ getScrollerProps: () => {
36
+ ref: (node: HTMLDivElement | null) => (() => void | undefined) | undefined;
37
+ style: React.CSSProperties;
38
+ role: string;
39
+ tabIndex: number | undefined;
40
+ };
41
+ getContentProps: () => {
42
+ ref: (node: HTMLDivElement | null) => void;
43
+ style: React.CSSProperties;
44
+ role: string;
45
+ };
46
+ getScrollbarVerticalProps: () => {
47
+ ref: (node: HTMLDivElement | null) => void;
48
+ scrollPosition: React.RefObject<{
49
+ top: number;
50
+ left: number;
51
+ }>;
52
+ };
53
+ getScrollbarHorizontalProps: () => {
54
+ ref: (node: HTMLDivElement | null) => void;
55
+ scrollPosition: React.RefObject<{
56
+ top: number;
57
+ left: number;
58
+ }>;
59
+ };
60
+ getScrollAreaProps: () => {
61
+ scrollPosition: React.RefObject<{
62
+ top: number;
63
+ left: number;
64
+ }>;
65
+ };
66
+ };
67
+ useVirtualization: () => import("@mui/x-virtualizer").BaseState;
68
+ setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
69
+ forceUpdateRenderContext: () => void;
70
+ scheduleUpdateRenderContext: () => void;
71
+ getCellColSpanInfo: (rowId: import("@mui/x-virtualizer/models").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer/models").CellColSpanInfo;
72
+ calculateColSpan: (rowId: import("@mui/x-virtualizer/models").RowId, minFirstColumn: import("@mui/x-internals/types").integer, maxLastColumn: import("@mui/x-internals/types").integer, columns: import("@mui/x-virtualizer/models").ColumnWithWidth[]) => void;
73
+ getHiddenCellsOrigin: () => Record<import("@mui/x-virtualizer/models").RowId, Record<number, number>>;
74
+ } & {
75
+ resetColSpan: () => void;
76
+ getCellColSpanInfo: (rowId: import("@mui/x-virtualizer/models").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer/models").CellColSpanInfo | undefined;
77
+ calculateColSpan: (rowId: import("@mui/x-virtualizer/models").RowId, minFirstColumn: import("@mui/x-internals/types").integer, maxLastColumn: import("@mui/x-internals/types").integer, columns: import("@mui/x-virtualizer/models").ColumnWithWidth[]) => void;
78
+ } & {
79
+ getHiddenCellsOrigin: () => Record<number, Record<number, number>>;
80
+ } & {
81
+ getViewportPageSize: () => number;
82
+ };
83
+ };
@@ -30,10 +30,11 @@ var _dataGridPropsDefaultValues = require("../../constants/dataGridPropsDefaultV
30
30
  var _gridRowsUtils = require("../features/rows/gridRowsUtils");
31
31
  var _gridColumnsUtils = require("../features/columns/gridColumnsUtils");
32
32
  var _useGridOverlays = require("../features/overlays/useGridOverlays");
33
+ var _useGridRootProps = require("../utils/useGridRootProps");
34
+ var _useGridPrivateApiContext = require("../utils/useGridPrivateApiContext");
35
+ var _useGridRowsMeta = require("../features/rows/useGridRowsMeta");
36
+ var _utils = require("../../utils/utils");
33
37
  var _jsxRuntime = require("react/jsx-runtime");
34
- function identity(x) {
35
- return x;
36
- }
37
38
  const columnsTotalWidthSelector = (0, _createSelector.createSelector)(_gridColumnsSelector.gridVisibleColumnDefinitionsSelector, _gridColumnsSelector.gridColumnPositionsSelector, (visibleColumns, positions) => {
38
39
  const colCount = visibleColumns.length;
39
40
  if (colCount === 0) {
@@ -57,8 +58,10 @@ const addGridDimensionsCreator = () => (0, _lruMemoize.lruMemoize)((dimensions,
57
58
  /**
58
59
  * Virtualizer setup
59
60
  */
60
- function useGridVirtualizer(apiRef, rootProps) {
61
+ function useGridVirtualizer() {
61
62
  const isRtl = (0, _RtlProvider.useRtl)();
63
+ const rootProps = (0, _useGridRootProps.useGridRootProps)();
64
+ const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
62
65
  const {
63
66
  listView
64
67
  } = rootProps;
@@ -113,9 +116,11 @@ function useGridVirtualizer(apiRef, rootProps) {
113
116
  } = rootProps;
114
117
  // </ROWS_META>
115
118
 
116
- const focusedVirtualCell = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusedVirtualCellSelector.gridFocusedVirtualCellSelector);
117
119
  const RowSlot = rootProps.slots.row;
118
120
  const rowSlotProps = rootProps.slotProps?.row;
121
+ const focusedVirtualCell = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusedVirtualCellSelector.gridFocusedVirtualCellSelector);
122
+ // We need it to trigger a new render, but rowsMeta needs access to the latest value, hence we cannot pass it to the focusedVirtualCell callback in the virtualizer params
123
+ (0, _utils.eslintUseValue)(focusedVirtualCell);
119
124
  const virtualizer = (0, _xVirtualizer.useVirtualizer)({
120
125
  refs: {
121
126
  container: apiRef.current.mainElementRef,
@@ -179,7 +184,7 @@ function useGridVirtualizer(apiRef, rootProps) {
179
184
  } : undefined, [apiRef, getRowSpacing, currentPage.rows, currentPage.rowIdToIndexMap]),
180
185
  applyRowHeight: (0, _useEventCallback.default)((entry, row) => apiRef.current.unstable_applyPipeProcessors('rowHeight', entry, row)),
181
186
  virtualizeColumnsWithAutoRowHeight: rootProps.virtualizeColumnsWithAutoRowHeight,
182
- focusedVirtualCell: (0, _useEventCallback.default)(() => focusedVirtualCell),
187
+ focusedVirtualCell: (0, _useEventCallback.default)(() => (0, _gridFocusedVirtualCellSelector.gridFocusedVirtualCellSelector)(apiRef)),
183
188
  resizeThrottleMs: rootProps.resizeThrottleMs,
184
189
  onResize: (0, _useEventCallback.default)(size => apiRef.current.publishEvent('resize', size)),
185
190
  onWheel: (0, _useEventCallback.default)(event => {
@@ -235,23 +240,33 @@ function useGridVirtualizer(apiRef, rootProps) {
235
240
  apiRef.current.store.state.virtualization = virtualizer.store.state.virtualization;
236
241
  });
237
242
  (0, _store.useStoreEffect)(virtualizer.store, _xVirtualizer.Dimensions.selectors.dimensions, (_, dimensions) => {
243
+ if (!dimensions.isReady) {
244
+ return;
245
+ }
238
246
  apiRef.current.setState(gridState => (0, _extends2.default)({}, gridState, {
239
247
  dimensions: addGridDimensions(dimensions, headerHeight, groupHeaderHeight, headerFilterHeight, headersTotalHeight)
240
248
  }));
241
249
  });
242
- (0, _store.useStoreEffect)(virtualizer.store, identity, (_, state) => {
243
- if (state.rowsMeta !== apiRef.current.state.rowsMeta) {
250
+ (0, _store.useStoreEffect)(virtualizer.store, _xVirtualizer.Dimensions.selectors.rowsMeta, (_, rowsMeta) => {
251
+ if (rowsMeta !== apiRef.current.state.rowsMeta) {
244
252
  apiRef.current.setState(gridState => (0, _extends2.default)({}, gridState, {
245
- rowsMeta: state.rowsMeta
253
+ rowsMeta
246
254
  }));
247
255
  }
248
- if (state.virtualization !== apiRef.current.state.virtualization) {
256
+ });
257
+ (0, _store.useStoreEffect)(virtualizer.store, _xVirtualizer.Virtualization.selectors.store, (_, virtualization) => {
258
+ if (virtualization.renderContext === _xVirtualizer.EMPTY_RENDER_CONTEXT) {
259
+ return;
260
+ }
261
+ if (virtualization !== apiRef.current.state.virtualization) {
249
262
  apiRef.current.setState(gridState => (0, _extends2.default)({}, gridState, {
250
- virtualization: state.virtualization
263
+ virtualization
251
264
  }));
252
265
  }
253
266
  });
254
267
  apiRef.current.register('private', {
255
268
  virtualizer
256
269
  });
270
+ (0, _useGridRowsMeta.useGridRowsMeta)(apiRef, rootProps);
271
+ return virtualizer;
257
272
  }
@@ -19,7 +19,9 @@ const columnGroupsStateInitializer = (state, props, apiRef) => {
19
19
  lastColumnGroupingModel: props.columnGroupingModel
20
20
  };
21
21
  if (!props.columnGroupingModel) {
22
- return state;
22
+ return (0, _extends2.default)({}, state, {
23
+ columnGrouping: undefined
24
+ });
23
25
  }
24
26
  const columnFields = (0, _columns.gridColumnFieldsSelector)(apiRef);
25
27
  const visibleColumnFields = (0, _columns.gridVisibleColumnFieldsSelector)(apiRef);
@@ -73,6 +75,9 @@ const useGridColumnGrouping = (apiRef, props) => {
73
75
  });
74
76
  }, [apiRef, props.columnGroupingModel]);
75
77
  const updateColumnGroupingState = React.useCallback(columnGroupingModel => {
78
+ if (!columnGroupingModel && !apiRef.current.caches.columnGrouping.lastColumnGroupingModel) {
79
+ return;
80
+ }
76
81
  apiRef.current.caches.columnGrouping.lastColumnGroupingModel = columnGroupingModel;
77
82
  // @ts-expect-error Move this logic to `Pro` package
78
83
  const pinnedColumns = apiRef.current.getPinnedColumns?.() ?? {};