@mui/x-data-grid 7.24.0 → 7.25.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 (228) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/DataGrid/DataGrid.js +1 -7
  3. package/DataGrid/useDataGridComponent.d.ts +2 -1
  4. package/components/GridRow.d.ts +0 -1
  5. package/components/GridRow.js +25 -19
  6. package/components/cell/GridCell.d.ts +9 -6
  7. package/components/cell/GridCell.js +29 -52
  8. package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
  9. package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
  10. package/components/containers/GridRootStyles.js +135 -37
  11. package/components/panel/GridPanel.js +2 -1
  12. package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
  13. package/components/toolbar/GridToolbarColumnsButton.js +8 -2
  14. package/components/toolbar/GridToolbarDensitySelector.js +2 -2
  15. package/components/toolbar/GridToolbarExportContainer.js +2 -2
  16. package/components/toolbar/GridToolbarFilterButton.js +8 -2
  17. package/components/virtualization/GridMainContainer.d.ts +10 -0
  18. package/components/virtualization/GridMainContainer.js +10 -2
  19. package/components/virtualization/GridVirtualScrollbar.d.ts +4 -0
  20. package/components/virtualization/GridVirtualScrollbar.js +5 -5
  21. package/components/virtualization/GridVirtualScroller.js +18 -5
  22. package/components/virtualization/GridVirtualScrollerContent.js +11 -2
  23. package/context/GridContextProvider.d.ts +2 -1
  24. package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +2 -2
  25. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -2
  26. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
  27. package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
  28. package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +2 -2
  29. package/hooks/core/useGridApiInitialization.d.ts +2 -2
  30. package/hooks/core/useGridInitialization.d.ts +2 -2
  31. package/hooks/core/useGridIsRtl.d.ts +2 -2
  32. package/hooks/core/useGridLocaleText.d.ts +2 -2
  33. package/hooks/core/useGridLoggerFactory.d.ts +2 -2
  34. package/hooks/core/useGridRefs.d.ts +2 -2
  35. package/hooks/core/useGridStateInitialization.d.ts +2 -2
  36. package/hooks/features/clipboard/useGridClipboard.d.ts +2 -2
  37. package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +2 -2
  38. package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -2
  39. package/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  40. package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -2
  41. package/hooks/features/columnResize/useGridColumnResize.js +2 -1
  42. package/hooks/features/columns/gridColumnsUtils.d.ts +4 -4
  43. package/hooks/features/columns/useGridColumnSpanning.d.ts +2 -2
  44. package/hooks/features/columns/useGridColumns.d.ts +2 -2
  45. package/hooks/features/columns/useGridColumns.js +7 -3
  46. package/hooks/features/density/useGridDensity.d.ts +2 -2
  47. package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
  48. package/hooks/features/dimensions/useGridDimensions.js +7 -11
  49. package/hooks/features/editing/gridEditingSelectors.d.ts +6 -0
  50. package/hooks/features/editing/gridEditingSelectors.js +7 -1
  51. package/hooks/features/editing/index.d.ts +1 -1
  52. package/hooks/features/editing/index.js +1 -1
  53. package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
  54. package/hooks/features/editing/useGridCellEditing.js +3 -3
  55. package/hooks/features/editing/useGridEditing.d.ts +2 -2
  56. package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
  57. package/hooks/features/editing/useGridRowEditing.js +5 -6
  58. package/hooks/features/events/useGridEvents.d.ts +2 -2
  59. package/hooks/features/export/serializers/csvSerializer.d.ts +2 -1
  60. package/hooks/features/export/useGridCsvExport.d.ts +2 -2
  61. package/hooks/features/export/useGridPrintExport.d.ts +2 -2
  62. package/hooks/features/export/utils.d.ts +2 -2
  63. package/hooks/features/filter/gridFilterUtils.d.ts +7 -7
  64. package/hooks/features/filter/gridFilterUtils.js +3 -3
  65. package/hooks/features/filter/useGridFilter.d.ts +2 -2
  66. package/hooks/features/focus/useGridFocus.d.ts +2 -2
  67. package/hooks/features/focus/useGridFocus.js +3 -2
  68. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
  69. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
  70. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
  71. package/hooks/features/keyboardNavigation/utils.d.ts +3 -4
  72. package/hooks/features/keyboardNavigation/utils.js +0 -5
  73. package/hooks/features/listView/useGridListView.d.ts +2 -2
  74. package/hooks/features/listView/useGridListView.js +2 -1
  75. package/hooks/features/pagination/useGridPagination.d.ts +2 -2
  76. package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
  77. package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
  78. package/hooks/features/pagination/useGridRowCount.d.ts +2 -2
  79. package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +1 -0
  80. package/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
  81. package/hooks/features/preferencesPanel/index.d.ts +1 -1
  82. package/hooks/features/preferencesPanel/index.js +1 -1
  83. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +2 -2
  84. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  85. package/hooks/features/rowSelection/useGridRowSelection.d.ts +2 -2
  86. package/hooks/features/rowSelection/useGridRowSelection.js +3 -3
  87. package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +2 -2
  88. package/hooks/features/rowSelection/utils.d.ts +3 -2
  89. package/hooks/features/rows/gridRowSpanningUtils.d.ts +2 -2
  90. package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
  91. package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
  92. package/hooks/features/rows/useGridParamsApi.js +33 -14
  93. package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
  94. package/hooks/features/rows/useGridRowSpanning.js +94 -91
  95. package/hooks/features/rows/useGridRows.d.ts +2 -2
  96. package/hooks/features/rows/useGridRows.js +7 -8
  97. package/hooks/features/rows/useGridRowsMeta.d.ts +2 -2
  98. package/hooks/features/rows/useGridRowsMeta.js +3 -2
  99. package/hooks/features/rows/useGridRowsPreProcessors.d.ts +2 -2
  100. package/hooks/features/scroll/useGridScroll.d.ts +2 -2
  101. package/hooks/features/sorting/gridSortingUtils.d.ts +3 -3
  102. package/hooks/features/sorting/gridSortingUtils.js +2 -2
  103. package/hooks/features/sorting/useGridSorting.d.ts +2 -2
  104. package/hooks/features/statePersistence/useGridStatePersistence.d.ts +2 -2
  105. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
  106. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +9 -1
  107. package/hooks/features/virtualization/useGridVirtualScroller.js +32 -53
  108. package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
  109. package/hooks/utils/useGridApiContext.d.ts +2 -2
  110. package/hooks/utils/useGridApiEventHandler.d.ts +4 -4
  111. package/hooks/utils/useGridApiMethod.d.ts +2 -2
  112. package/hooks/utils/useGridApiRef.d.ts +2 -2
  113. package/hooks/utils/useGridApiRef.js +3 -1
  114. package/hooks/utils/useGridInitializeState.d.ts +3 -3
  115. package/hooks/utils/useGridLogger.d.ts +2 -2
  116. package/hooks/utils/useGridNativeEventListener.d.ts +2 -1
  117. package/hooks/utils/useGridPrivateApiContext.d.ts +2 -1
  118. package/hooks/utils/useGridSelector.d.ts +3 -3
  119. package/hooks/utils/useGridVisibleRows.d.ts +3 -3
  120. package/index.js +1 -1
  121. package/locales/faIR.js +5 -6
  122. package/models/api/gridApiCommon.d.ts +2 -2
  123. package/models/api/gridParamsApi.d.ts +29 -2
  124. package/models/api/index.d.ts +1 -1
  125. package/models/api/index.js +0 -1
  126. package/models/colDef/gridColDef.d.ts +9 -8
  127. package/models/gridExport.d.ts +2 -2
  128. package/models/gridFilterOperator.d.ts +2 -1
  129. package/models/props/DataGridProps.d.ts +2 -1
  130. package/modern/DataGrid/DataGrid.js +1 -7
  131. package/modern/components/GridRow.js +25 -19
  132. package/modern/components/cell/GridCell.js +29 -52
  133. package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
  134. package/modern/components/containers/GridRootStyles.js +135 -37
  135. package/modern/components/panel/GridPanel.js +2 -1
  136. package/modern/components/toolbar/GridToolbarColumnsButton.js +8 -2
  137. package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
  138. package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
  139. package/modern/components/toolbar/GridToolbarFilterButton.js +8 -2
  140. package/modern/components/virtualization/GridMainContainer.js +10 -2
  141. package/modern/components/virtualization/GridVirtualScrollbar.js +5 -5
  142. package/modern/components/virtualization/GridVirtualScroller.js +18 -5
  143. package/modern/components/virtualization/GridVirtualScrollerContent.js +11 -2
  144. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  145. package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
  146. package/modern/hooks/features/columns/useGridColumns.js +7 -3
  147. package/modern/hooks/features/dimensions/useGridDimensions.js +7 -11
  148. package/modern/hooks/features/editing/gridEditingSelectors.js +7 -1
  149. package/modern/hooks/features/editing/index.js +1 -1
  150. package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
  151. package/modern/hooks/features/editing/useGridRowEditing.js +5 -6
  152. package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
  153. package/modern/hooks/features/focus/useGridFocus.js +3 -2
  154. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
  155. package/modern/hooks/features/keyboardNavigation/utils.js +0 -5
  156. package/modern/hooks/features/listView/useGridListView.js +2 -1
  157. package/modern/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
  158. package/modern/hooks/features/preferencesPanel/index.js +1 -1
  159. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  160. package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -3
  161. package/modern/hooks/features/rows/useGridParamsApi.js +33 -14
  162. package/modern/hooks/features/rows/useGridRowSpanning.js +94 -91
  163. package/modern/hooks/features/rows/useGridRows.js +7 -8
  164. package/modern/hooks/features/rows/useGridRowsMeta.js +3 -2
  165. package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
  166. package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
  167. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +32 -53
  168. package/modern/hooks/utils/useGridApiRef.js +3 -1
  169. package/modern/index.js +1 -1
  170. package/modern/locales/faIR.js +5 -6
  171. package/modern/models/api/index.js +0 -1
  172. package/modern/utils/isJSDOM.js +1 -0
  173. package/modern/utils/roundToDecimalPlaces.js +3 -0
  174. package/modern/utils/utils.js +6 -1
  175. package/node/DataGrid/DataGrid.js +1 -7
  176. package/node/components/GridRow.js +22 -16
  177. package/node/components/cell/GridCell.js +27 -50
  178. package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
  179. package/node/components/containers/GridRootStyles.js +135 -37
  180. package/node/components/panel/GridPanel.js +2 -1
  181. package/node/components/toolbar/GridToolbarColumnsButton.js +8 -2
  182. package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
  183. package/node/components/toolbar/GridToolbarExportContainer.js +2 -2
  184. package/node/components/toolbar/GridToolbarFilterButton.js +8 -2
  185. package/node/components/virtualization/GridMainContainer.js +10 -2
  186. package/node/components/virtualization/GridVirtualScrollbar.js +5 -5
  187. package/node/components/virtualization/GridVirtualScroller.js +18 -5
  188. package/node/components/virtualization/GridVirtualScrollerContent.js +11 -2
  189. package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  190. package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
  191. package/node/hooks/features/columns/useGridColumns.js +7 -3
  192. package/node/hooks/features/dimensions/useGridDimensions.js +9 -13
  193. package/node/hooks/features/editing/gridEditingSelectors.js +8 -2
  194. package/node/hooks/features/editing/index.js +7 -11
  195. package/node/hooks/features/editing/useGridCellEditing.js +2 -2
  196. package/node/hooks/features/editing/useGridRowEditing.js +3 -4
  197. package/node/hooks/features/filter/gridFilterUtils.js +3 -3
  198. package/node/hooks/features/focus/useGridFocus.js +3 -2
  199. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -15
  200. package/node/hooks/features/keyboardNavigation/utils.js +0 -6
  201. package/node/hooks/features/listView/useGridListView.js +2 -1
  202. package/node/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +9 -2
  203. package/node/hooks/features/preferencesPanel/index.js +11 -10
  204. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  205. package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -2
  206. package/node/hooks/features/rows/useGridParamsApi.js +33 -14
  207. package/node/hooks/features/rows/useGridRowSpanning.js +92 -89
  208. package/node/hooks/features/rows/useGridRows.js +7 -8
  209. package/node/hooks/features/rows/useGridRowsMeta.js +5 -4
  210. package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
  211. package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
  212. package/node/hooks/features/virtualization/useGridVirtualScroller.js +34 -55
  213. package/node/hooks/utils/useGridApiRef.js +3 -1
  214. package/node/index.js +1 -1
  215. package/node/locales/faIR.js +5 -6
  216. package/node/models/api/index.js +0 -11
  217. package/node/utils/isJSDOM.js +7 -0
  218. package/node/utils/roundToDecimalPlaces.js +9 -0
  219. package/node/utils/utils.js +8 -1
  220. package/package.json +2 -2
  221. package/utils/createSelector.d.ts +3 -3
  222. package/utils/getPublicApiRef.d.ts +2 -1
  223. package/utils/isJSDOM.d.ts +1 -0
  224. package/utils/isJSDOM.js +1 -0
  225. package/utils/roundToDecimalPlaces.d.ts +1 -0
  226. package/utils/roundToDecimalPlaces.js +3 -0
  227. package/utils/utils.d.ts +1 -0
  228. package/utils/utils.js +6 -1
@@ -3,6 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.gridPreferencePanelStateSelector = void 0;
6
+ exports.gridPreferencePanelStateSelector = exports.gridPreferencePanelSelectorWithLabel = void 0;
7
+ var _createSelector = require("../../../utils/createSelector");
7
8
  const gridPreferencePanelStateSelector = state => state.preferencePanel;
8
- exports.gridPreferencePanelStateSelector = gridPreferencePanelStateSelector;
9
+ exports.gridPreferencePanelStateSelector = gridPreferencePanelStateSelector;
10
+ const gridPreferencePanelSelectorWithLabel = exports.gridPreferencePanelSelectorWithLabel = (0, _createSelector.createSelectorV8)(gridPreferencePanelStateSelector, (panel, labelId) => {
11
+ if (panel.open && panel.labelId === labelId) {
12
+ return true;
13
+ }
14
+ return false;
15
+ });
@@ -3,20 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _gridPreferencePanelSelector = require("./gridPreferencePanelSelector");
7
- Object.keys(_gridPreferencePanelSelector).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _gridPreferencePanelSelector[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _gridPreferencePanelSelector[key];
14
- }
15
- });
6
+ var _exportNames = {
7
+ gridPreferencePanelStateSelector: true
8
+ };
9
+ Object.defineProperty(exports, "gridPreferencePanelStateSelector", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _gridPreferencePanelSelector.gridPreferencePanelStateSelector;
13
+ }
16
14
  });
15
+ var _gridPreferencePanelSelector = require("./gridPreferencePanelSelector");
17
16
  var _gridPreferencePanelState = require("./gridPreferencePanelState");
18
17
  Object.keys(_gridPreferencePanelState).forEach(function (key) {
19
18
  if (key === "default" || key === "__esModule") return;
19
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
20
  if (key in exports && exports[key] === _gridPreferencePanelState[key]) return;
21
21
  Object.defineProperty(exports, key, {
22
22
  enumerable: true,
@@ -28,6 +28,7 @@ Object.keys(_gridPreferencePanelState).forEach(function (key) {
28
28
  var _gridPreferencePanelsValue = require("./gridPreferencePanelsValue");
29
29
  Object.keys(_gridPreferencePanelsValue).forEach(function (key) {
30
30
  if (key === "default" || key === "__esModule") return;
31
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
31
32
  if (key in exports && exports[key] === _gridPreferencePanelsValue[key]) return;
32
33
  Object.defineProperty(exports, key, {
33
34
  enumerable: true,
@@ -24,42 +24,29 @@ const preferencePanelStateInitializer = (state, props) => (0, _extends2.default)
24
24
  exports.preferencePanelStateInitializer = preferencePanelStateInitializer;
25
25
  const useGridPreferencesPanel = (apiRef, props) => {
26
26
  const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridPreferencesPanel');
27
- const hideTimeout = React.useRef(undefined);
28
- const immediateTimeout = React.useRef(undefined);
29
27
 
30
28
  /**
31
29
  * API METHODS
32
30
  */
33
31
  const hidePreferences = React.useCallback(() => {
34
- logger.debug('Hiding Preferences Panel');
35
- const preferencePanelState = (0, _gridPreferencePanelSelector.gridPreferencePanelStateSelector)(apiRef.current.state);
36
- if (preferencePanelState.openedPanelValue) {
32
+ apiRef.current.setState(state => {
33
+ if (!state.preferencePanel.open) {
34
+ return state;
35
+ }
36
+ logger.debug('Hiding Preferences Panel');
37
+ const preferencePanelState = (0, _gridPreferencePanelSelector.gridPreferencePanelStateSelector)(state);
37
38
  apiRef.current.publishEvent('preferencePanelClose', {
38
39
  openedPanelValue: preferencePanelState.openedPanelValue
39
40
  });
40
- }
41
- apiRef.current.setState(state => (0, _extends2.default)({}, state, {
42
- preferencePanel: {
43
- open: false
44
- }
45
- }));
46
- apiRef.current.forceUpdate();
41
+ return (0, _extends2.default)({}, state, {
42
+ preferencePanel: {
43
+ open: false
44
+ }
45
+ });
46
+ });
47
47
  }, [apiRef, logger]);
48
-
49
- // This is to prevent the preferences from closing when you open a select box or another panel,
50
- // The issue is in MUI core V4 => Fixed in V5
51
- const doNotHidePanel = React.useCallback(() => {
52
- immediateTimeout.current = setTimeout(() => clearTimeout(hideTimeout.current), 0);
53
- }, []);
54
-
55
- // This is a hack for the issue with Core V4, by delaying hiding the panel on the clickAwayListener,
56
- // we can cancel the action if the trigger element still need the panel...
57
- const hidePreferencesDelayed = React.useCallback(() => {
58
- hideTimeout.current = setTimeout(hidePreferences, 100);
59
- }, [hidePreferences]);
60
48
  const showPreferences = React.useCallback((newValue, panelId, labelId) => {
61
49
  logger.debug('Opening Preferences Panel');
62
- doNotHidePanel();
63
50
  apiRef.current.setState(state => (0, _extends2.default)({}, state, {
64
51
  preferencePanel: (0, _extends2.default)({}, state.preferencePanel, {
65
52
  open: true,
@@ -71,11 +58,10 @@ const useGridPreferencesPanel = (apiRef, props) => {
71
58
  apiRef.current.publishEvent('preferencePanelOpen', {
72
59
  openedPanelValue: newValue
73
60
  });
74
- apiRef.current.forceUpdate();
75
- }, [logger, doNotHidePanel, apiRef]);
61
+ }, [logger, apiRef]);
76
62
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, {
77
63
  showPreferences,
78
- hidePreferences: hidePreferencesDelayed
64
+ hidePreferences
79
65
  }, 'public');
80
66
 
81
67
  /**
@@ -108,15 +94,5 @@ const useGridPreferencesPanel = (apiRef, props) => {
108
94
  }, [apiRef]);
109
95
  (0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
110
96
  (0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
111
-
112
- /**
113
- * EFFECTS
114
- */
115
- React.useEffect(() => {
116
- return () => {
117
- clearTimeout(hideTimeout.current);
118
- clearTimeout(immediateTimeout.current);
119
- };
120
- }, []);
121
97
  };
122
98
  exports.useGridPreferencesPanel = useGridPreferencesPanel;
@@ -73,7 +73,6 @@ const useGridRowSelection = (apiRef, props) => {
73
73
  isRowSelectable: propIsRowSelectable
74
74
  } = props;
75
75
  const canHaveMultipleSelection = (0, _utils.isMultipleRowSelectionEnabled)(props);
76
- const visibleRows = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props);
77
76
  const tree = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowTreeSelector);
78
77
  const isNestedData = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowMaximumTreeDepthSelector) > 1;
79
78
  const expandMouseRowRangeSelection = React.useCallback(id => {
@@ -421,6 +420,7 @@ const useGridRowSelection = (apiRef, props) => {
421
420
  end = previousRowIndex;
422
421
  }
423
422
  }
423
+ const visibleRows = (0, _useGridVisibleRows.getVisibleRows)(apiRef);
424
424
  const rowsBetweenStartAndEnd = visibleRows.rows.slice(start, end + 1).map(row => row.id);
425
425
  apiRef.current.selectRows(rowsBetweenStartAndEnd, !isNextRowSelected);
426
426
  return;
@@ -435,7 +435,7 @@ const useGridRowSelection = (apiRef, props) => {
435
435
  event.preventDefault();
436
436
  selectRows(apiRef.current.getAllRowIds(), true);
437
437
  }
438
- }, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);
438
+ }, [apiRef, handleSingleRowSelection, selectRows, canHaveMultipleSelection]);
439
439
  (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'sortedRowsSet', runIfRowSelectionIsEnabled(() => removeOutdatedSelection(true)));
440
440
  (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'filteredRowsSet', runIfRowSelectionIsEnabled(removeOutdatedSelection));
441
441
  (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'rowClick', runIfRowSelectionIsEnabled(handleRowClick));
@@ -39,37 +39,52 @@ function useGridParamsApi(apiRef, props) {
39
39
  };
40
40
  return params;
41
41
  }, [apiRef]);
42
- const getCellParams = React.useCallback((id, field) => {
43
- const colDef = props.unstable_listView ? (0, _gridListViewSelectors.gridListColumnSelector)(apiRef.current.state) : apiRef.current.getColumn(field);
44
- const row = apiRef.current.getRow(id);
45
- const rowNode = apiRef.current.getRowNode(id);
46
- if (!row || !rowNode) {
47
- throw new MissingRowIdError(`No row with id #${id} found`);
48
- }
42
+ const getCellParamsForRow = React.useCallback((id, field, row, {
43
+ cellMode,
44
+ colDef,
45
+ hasFocus,
46
+ rowNode,
47
+ tabIndex
48
+ }) => {
49
49
  const rawValue = row[field];
50
50
  const value = colDef?.valueGetter ? colDef.valueGetter(rawValue, row, colDef, apiRef) : rawValue;
51
- const cellFocus = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
52
- const cellTabIndex = (0, _gridFocusStateSelector.gridTabIndexCellSelector)(apiRef);
53
51
  const params = {
54
52
  id,
55
53
  field,
56
54
  row,
57
55
  rowNode,
58
56
  colDef,
59
- cellMode: apiRef.current.getCellMode(id, field),
60
- hasFocus: cellFocus !== null && cellFocus.field === field && cellFocus.id === id,
61
- tabIndex: cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === id ? 0 : -1,
57
+ cellMode,
58
+ hasFocus,
59
+ tabIndex,
62
60
  value,
63
61
  formattedValue: value,
64
62
  isEditable: false,
65
- api: {}
63
+ api: null
66
64
  };
67
65
  if (colDef && colDef.valueFormatter) {
68
66
  params.formattedValue = colDef.valueFormatter(value, row, colDef, apiRef);
69
67
  }
70
68
  params.isEditable = colDef && apiRef.current.isCellEditable(params);
71
69
  return params;
72
- }, [apiRef, props.unstable_listView]);
70
+ }, [apiRef]);
71
+ const getCellParams = React.useCallback((id, field) => {
72
+ const row = apiRef.current.getRow(id);
73
+ const rowNode = apiRef.current.getRowNode(id);
74
+ if (!row || !rowNode) {
75
+ throw new MissingRowIdError(`No row with id #${id} found`);
76
+ }
77
+ const cellFocus = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
78
+ const cellTabIndex = (0, _gridFocusStateSelector.gridTabIndexCellSelector)(apiRef);
79
+ const cellMode = apiRef.current.getCellMode(id, field);
80
+ return apiRef.current.getCellParamsForRow(id, field, row, {
81
+ colDef: props.unstable_listView && props.unstable_listColumn?.field === field ? (0, _gridListViewSelectors.gridListColumnSelector)(apiRef.current.state) : apiRef.current.getColumn(field),
82
+ rowNode,
83
+ hasFocus: cellFocus !== null && cellFocus.field === field && cellFocus.id === id,
84
+ tabIndex: cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === id ? 0 : -1,
85
+ cellMode
86
+ });
87
+ }, [apiRef, props.unstable_listView, props.unstable_listColumn?.field]);
73
88
  const getCellValue = React.useCallback((id, field) => {
74
89
  const colDef = apiRef.current.getColumn(field);
75
90
  const row = apiRef.current.getRow(id);
@@ -128,5 +143,9 @@ function useGridParamsApi(apiRef, props) {
128
143
  getColumnHeaderParams,
129
144
  getColumnHeaderElement
130
145
  };
146
+ const paramsPrivateApi = {
147
+ getCellParamsForRow
148
+ };
131
149
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, paramsApi, 'public');
150
+ (0, _useGridApiMethod.useGridApiMethod)(apiRef, paramsPrivateApi, 'private');
132
151
  }
@@ -13,10 +13,12 @@ var _constants = require("../../../internals/constants");
13
13
  var _gridColumnsSelector = require("../columns/gridColumnsSelector");
14
14
  var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
15
15
  var _gridVirtualizationSelectors = require("../virtualization/gridVirtualizationSelectors");
16
- var _useGridSelector = require("../../utils/useGridSelector");
17
- var _gridRowsSelector = require("./gridRowsSelector");
18
16
  var _gridRowSpanningUtils = require("./gridRowSpanningUtils");
19
17
  var _gridCheckboxSelectionColDef = require("../../../colDef/gridCheckboxSelectionColDef");
18
+ var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
19
+ var _utils = require("../../../utils/utils");
20
+ var _pagination = require("../pagination");
21
+ var _gridRowsSelector = require("./gridRowsSelector");
20
22
  const EMPTY_STATE = {
21
23
  spannedCells: {},
22
24
  hiddenCells: {},
@@ -61,8 +63,8 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
61
63
  const backwardsHiddenCells = [];
62
64
  if (index === rangeToProcess.firstRowIndex) {
63
65
  let prevIndex = index - 1;
64
- const prevRowEntry = visibleRows[prevIndex];
65
- while (prevIndex >= range.firstRowIndex && (0, _gridRowSpanningUtils.getCellValue)(prevRowEntry.model, colDef, apiRef) === cellValue) {
66
+ let prevRowEntry = visibleRows[prevIndex];
67
+ while (prevIndex >= range.firstRowIndex && prevRowEntry && (0, _gridRowSpanningUtils.getCellValue)(prevRowEntry.model, colDef, apiRef) === cellValue) {
66
68
  const currentRow = visibleRows[prevIndex + 1];
67
69
  if (hiddenCells[currentRow.id]) {
68
70
  hiddenCells[currentRow.id][colDef.field] = true;
@@ -76,6 +78,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
76
78
  spannedRowId = prevRowEntry.id;
77
79
  spannedRowIndex = prevIndex;
78
80
  prevIndex -= 1;
81
+ prevRowEntry = visibleRows[prevIndex];
79
82
  }
80
83
  }
81
84
  backwardsHiddenCells.forEach(hiddenCellIndex => {
@@ -131,6 +134,24 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
131
134
  processedRange
132
135
  };
133
136
  };
137
+ const getInitialRangeToProcess = (props, apiRef) => {
138
+ const rowCount = (0, _gridRowsSelector.gridDataRowIdsSelector)(apiRef).length;
139
+ if (props.pagination) {
140
+ const pageSize = (0, _pagination.gridPageSizeSelector)(apiRef);
141
+ let paginationLastRowIndex = DEFAULT_ROWS_TO_PROCESS;
142
+ if (pageSize > 0) {
143
+ paginationLastRowIndex = pageSize - 1;
144
+ }
145
+ return {
146
+ firstRowIndex: 0,
147
+ lastRowIndex: Math.min(paginationLastRowIndex, rowCount)
148
+ };
149
+ }
150
+ return {
151
+ firstRowIndex: 0,
152
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, rowCount)
153
+ };
154
+ };
134
155
 
135
156
  /**
136
157
  * @requires columnsStateInitializer (method) - should be initialized before
@@ -138,75 +159,53 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
138
159
  * @requires filterStateInitializer (method) - should be initialized before
139
160
  */
140
161
  const rowSpanningStateInitializer = (state, props, apiRef) => {
141
- if (props.unstable_rowSpanning) {
142
- const rowIds = state.rows.dataRowIds || [];
143
- const orderedFields = state.columns.orderedFields || [];
144
- const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
145
- const columnsLookup = state.columns.lookup;
146
- const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
147
- if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
148
- return (0, _extends2.default)({}, state, {
149
- rowSpanning: EMPTY_STATE
150
- });
151
- }
152
- const rangeToProcess = {
153
- firstRowIndex: 0,
154
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
155
- };
156
- const rows = rowIds.map(id => ({
157
- id,
158
- model: dataRowIdToModelLookup[id]
159
- }));
160
- const colDefs = orderedFields.map(field => columnsLookup[field]);
161
- const {
162
- spannedCells,
163
- hiddenCells,
164
- hiddenCellOriginMap
165
- } = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
162
+ if (!props.unstable_rowSpanning) {
166
163
  return (0, _extends2.default)({}, state, {
167
- rowSpanning: {
168
- spannedCells,
169
- hiddenCells,
170
- hiddenCellOriginMap
171
- }
164
+ rowSpanning: EMPTY_STATE
165
+ });
166
+ }
167
+ const rowIds = state.rows.dataRowIds || [];
168
+ const orderedFields = state.columns.orderedFields || [];
169
+ const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
170
+ const columnsLookup = state.columns.lookup;
171
+ const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
172
+ if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
173
+ return (0, _extends2.default)({}, state, {
174
+ rowSpanning: EMPTY_STATE
172
175
  });
173
176
  }
177
+ const rangeToProcess = getInitialRangeToProcess(props, apiRef);
178
+ const rows = rowIds.map(id => ({
179
+ id,
180
+ model: dataRowIdToModelLookup[id]
181
+ }));
182
+ const colDefs = orderedFields.map(field => columnsLookup[field]);
183
+ const {
184
+ spannedCells,
185
+ hiddenCells,
186
+ hiddenCellOriginMap
187
+ } = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
174
188
  return (0, _extends2.default)({}, state, {
175
- rowSpanning: EMPTY_STATE
189
+ rowSpanning: {
190
+ spannedCells,
191
+ hiddenCells,
192
+ hiddenCellOriginMap
193
+ }
176
194
  });
177
195
  };
178
196
  exports.rowSpanningStateInitializer = rowSpanningStateInitializer;
179
197
  const useGridRowSpanning = (apiRef, props) => {
180
- const {
181
- range,
182
- rows: visibleRows
183
- } = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props);
184
- const renderContext = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridRenderContextSelector);
185
- const colDefs = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector);
186
- const tree = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowTreeSelector);
187
198
  const processedRange = (0, _useLazyRef.default)(() => {
188
- return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
189
- firstRowIndex: 0,
190
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
191
- } : EMPTY_RANGE;
199
+ return apiRef.current.state.rowSpanning !== EMPTY_STATE ? getInitialRangeToProcess(props, apiRef) : EMPTY_RANGE;
192
200
  });
193
- const lastRange = React.useRef(EMPTY_RANGE);
194
- const updateRowSpanningState = React.useCallback(
195
- // A reset needs to occur when:
196
- // - The `unstable_rowSpanning` prop is updated (feature flag)
197
- // - The filtering is applied
198
- // - The sorting is applied
199
- // - The `paginationModel` is updated
200
- // - The rows are updated
201
- (resetState = true) => {
202
- if (!props.unstable_rowSpanning) {
203
- if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
204
- apiRef.current.setState(state => (0, _extends2.default)({}, state, {
205
- rowSpanning: EMPTY_STATE
206
- }));
207
- }
208
- return;
209
- }
201
+ const updateRowSpanningState = React.useCallback((renderContext, resetState = false) => {
202
+ const {
203
+ range,
204
+ rows: visibleRows
205
+ } = (0, _useGridVisibleRows.getVisibleRows)(apiRef, {
206
+ pagination: props.pagination,
207
+ paginationMode: props.paginationMode
208
+ });
210
209
  if (range === null || !(0, _gridRowSpanningUtils.isRowContextInitialized)(renderContext)) {
211
210
  return;
212
211
  }
@@ -220,6 +219,7 @@ const useGridRowSpanning = (apiRef, props) => {
220
219
  if (rangeToProcess === null) {
221
220
  return;
222
221
  }
222
+ const colDefs = (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
223
223
  const {
224
224
  spannedCells,
225
225
  hiddenCells,
@@ -232,7 +232,8 @@ const useGridRowSpanning = (apiRef, props) => {
232
232
  const currentSpannedCellsCount = Object.keys(apiRef.current.state.rowSpanning.spannedCells).length;
233
233
  const currentHiddenCellsCount = Object.keys(apiRef.current.state.rowSpanning.hiddenCells).length;
234
234
  const shouldUpdateState = resetState || newSpannedCellsCount !== currentSpannedCellsCount || newHiddenCellsCount !== currentHiddenCellsCount;
235
- if (!shouldUpdateState) {
235
+ const hasNoSpannedCells = newSpannedCellsCount === 0 && currentSpannedCellsCount === 0;
236
+ if (!shouldUpdateState || hasNoSpannedCells) {
236
237
  return;
237
238
  }
238
239
  apiRef.current.setState(state => {
@@ -244,34 +245,36 @@ const useGridRowSpanning = (apiRef, props) => {
244
245
  }
245
246
  });
246
247
  });
247
- }, [apiRef, props.unstable_rowSpanning, range, renderContext, visibleRows, colDefs, processedRange]);
248
- const prevRenderContext = React.useRef(renderContext);
249
- const isFirstRender = React.useRef(true);
250
- const shouldResetState = React.useRef(false);
251
- const previousTree = React.useRef(tree);
252
- React.useEffect(() => {
253
- const firstRender = isFirstRender.current;
254
- if (isFirstRender.current) {
255
- isFirstRender.current = false;
256
- }
257
- if (tree !== previousTree.current) {
258
- previousTree.current = tree;
259
- updateRowSpanningState(true);
248
+ }, [apiRef, processedRange, props.pagination, props.paginationMode]);
249
+
250
+ // Reset events trigger a full re-computation of the row spanning state:
251
+ // - The `unstable_rowSpanning` prop is updated (feature flag)
252
+ // - The filtering is applied
253
+ // - The sorting is applied
254
+ // - The `paginationModel` is updated
255
+ // - The rows are updated
256
+ const resetRowSpanningState = React.useCallback(() => {
257
+ const renderContext = (0, _gridVirtualizationSelectors.gridRenderContextSelector)(apiRef);
258
+ if (!(0, _gridRowSpanningUtils.isRowContextInitialized)(renderContext)) {
260
259
  return;
261
260
  }
262
- if (range && lastRange.current && (0, _gridRowSpanningUtils.isRowRangeUpdated)(range, lastRange.current)) {
263
- lastRange.current = range;
264
- shouldResetState.current = true;
265
- }
266
- if (!firstRender && prevRenderContext.current !== renderContext) {
267
- if ((0, _gridRowSpanningUtils.isRowRangeUpdated)(prevRenderContext.current, renderContext)) {
268
- updateRowSpanningState(shouldResetState.current);
269
- shouldResetState.current = false;
261
+ updateRowSpanningState(renderContext, true);
262
+ }, [apiRef, updateRowSpanningState]);
263
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'renderedRowsIntervalChange', (0, _utils.runIf)(props.unstable_rowSpanning, updateRowSpanningState));
264
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'sortedRowsSet', (0, _utils.runIf)(props.unstable_rowSpanning, resetRowSpanningState));
265
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'paginationModelChange', (0, _utils.runIf)(props.unstable_rowSpanning, resetRowSpanningState));
266
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'filteredRowsSet', (0, _utils.runIf)(props.unstable_rowSpanning, resetRowSpanningState));
267
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'columnsChange', (0, _utils.runIf)(props.unstable_rowSpanning, resetRowSpanningState));
268
+ React.useEffect(() => {
269
+ if (!props.unstable_rowSpanning) {
270
+ if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
271
+ apiRef.current.setState(state => (0, _extends2.default)({}, state, {
272
+ rowSpanning: EMPTY_STATE
273
+ }));
270
274
  }
271
- prevRenderContext.current = renderContext;
272
- return;
275
+ } else if (apiRef.current.state.rowSpanning === EMPTY_STATE) {
276
+ resetRowSpanningState();
273
277
  }
274
- updateRowSpanningState();
275
- }, [updateRowSpanningState, renderContext, range, lastRange, tree]);
278
+ }, [apiRef, resetRowSpanningState, props.unstable_rowSpanning]);
276
279
  };
277
280
  exports.useGridRowSpanning = useGridRowSpanning;
@@ -48,7 +48,6 @@ const useGridRows = (apiRef, props) => {
48
48
  }
49
49
  }
50
50
  const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridRows');
51
- const currentPage = (0, _useGridVisibleRows.getVisibleRows)(apiRef);
52
51
  const lastUpdateMs = React.useRef(Date.now());
53
52
  const lastRowCount = React.useRef(props.rowCount);
54
53
  const timeout = (0, _useTimeout.useTimeout)();
@@ -75,12 +74,6 @@ const useGridRows = (apiRef, props) => {
75
74
  }
76
75
  return row.id;
77
76
  }, [getRowIdProp]);
78
- const lookup = React.useMemo(() => currentPage.rows.reduce((acc, {
79
- id
80
- }, index) => {
81
- acc[id] = index;
82
- return acc;
83
- }, {}), [currentPage.rows]);
84
77
  const throttledRowsChange = React.useCallback(({
85
78
  cache,
86
79
  throttle
@@ -179,7 +172,13 @@ const useGridRows = (apiRef, props) => {
179
172
  }, [apiRef]);
180
173
  const getRowsCount = React.useCallback(() => (0, _gridRowsSelector.gridRowCountSelector)(apiRef), [apiRef]);
181
174
  const getAllRowIds = React.useCallback(() => (0, _gridRowsSelector.gridDataRowIdsSelector)(apiRef), [apiRef]);
182
- const getRowIndexRelativeToVisibleRows = React.useCallback(id => lookup[id], [lookup]);
175
+ const getRowIndexRelativeToVisibleRows = React.useCallback(id => {
176
+ const row = apiRef.current.getRow(id);
177
+ const {
178
+ rowToIndexMap
179
+ } = (0, _useGridVisibleRows.getVisibleRows)(apiRef);
180
+ return rowToIndexMap.get(row);
181
+ }, [apiRef]);
183
182
  const setRowChildrenExpansion = React.useCallback((id, isExpanded) => {
184
183
  const currentNode = apiRef.current.getRowNode(id);
185
184
  if (!currentNode) {
@@ -9,9 +9,10 @@ exports.useGridRowsMeta = exports.rowsMetaStateInitializer = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _useLazyRef = _interopRequireDefault(require("@mui/utils/useLazyRef"));
12
+ var _utils = require("@mui/utils");
12
13
  var _ResizeObserver = require("../../../utils/ResizeObserver");
13
14
  var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
14
- var _utils = require("../../../utils/utils");
15
+ var _utils2 = require("../../../utils/utils");
15
16
  var _useGridApiMethod = require("../../utils/useGridApiMethod");
16
17
  var _useGridSelector = require("../../utils/useGridSelector");
17
18
  var _densitySelector = require("../density/densitySelector");
@@ -77,7 +78,7 @@ const useGridRowsMeta = (apiRef, props) => {
77
78
  // HACK: rowHeight trails behind the most up-to-date value just enough to
78
79
  // mess the initial rowsMeta hydration :/
79
80
  const baseRowHeight = (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef.current.state).rowHeight;
80
- (0, _utils.eslintUseValue)(rowHeight);
81
+ (0, _utils2.eslintUseValue)(rowHeight);
81
82
  const entry = apiRef.current.getRowHeightEntry(row.id);
82
83
  if (!getRowHeightProp) {
83
84
  entry.content = baseRowHeight;
@@ -119,7 +120,7 @@ const useGridRowsMeta = (apiRef, props) => {
119
120
  }
120
121
  apiRef.current.unstable_applyPipeProcessors('rowHeight', entry, row);
121
122
  return entry;
122
- }, [apiRef, currentPage.rows.length, getRowHeightProp, getEstimatedRowHeight, rowHeight, getRowSpacing, densityFactor]);
123
+ }, [apiRef, currentPage.rows, getRowHeightProp, getEstimatedRowHeight, rowHeight, getRowSpacing, densityFactor]);
123
124
  const hydrateRowsMeta = React.useCallback(() => {
124
125
  hasRowWithAutoHeight.current = false;
125
126
  pinnedRows.top.forEach(processHeightEntry);
@@ -190,7 +191,7 @@ const useGridRowsMeta = (apiRef, props) => {
190
191
 
191
192
  // The effect is used to build the rows meta data - currentPageTotalHeight and positions.
192
193
  // Because of variable row height this is needed for the virtualization
193
- React.useEffect(() => {
194
+ (0, _utils.unstable_useEnhancedEffect)(() => {
194
195
  hydrateRowsMeta();
195
196
  }, [filterModel, paginationState, sortModel, hydrateRowsMeta]);
196
197
  const rowsMetaApi = {
@@ -28,7 +28,7 @@ const isDesc = direction => direction === 'desc';
28
28
  /**
29
29
  * Transform an item of the sorting model into a method comparing two rows.
30
30
  * @param {GridSortItem} sortItem The sort item we want to apply.
31
- * @param {React.RefObject<GridApiCommunity>} apiRef The API of the grid.
31
+ * @param {RefObject<GridApiCommunity>} apiRef The API of the grid.
32
32
  * @returns {GridParsedSortItem | null} The parsed sort item. Returns `null` is the sort item is not valid.
33
33
  */
34
34
  const parseSortItem = (sortItem, apiRef) => {
@@ -81,7 +81,7 @@ const compareRows = (parsedSortItems, row1, row2) => {
81
81
  /**
82
82
  * Generates a method to easily sort a list of rows according to the current sort model.
83
83
  * @param {GridSortModel} sortModel The model with which we want to sort the rows.
84
- * @param {React.RefObject<GridApiCommunity>} apiRef The API of the grid.
84
+ * @param {RefObject<GridApiCommunity>} apiRef The API of the grid.
85
85
  * @returns {GridSortingModelApplier | null} A method that generates a list of sorted row ids from a list of rows according to the current sort model. If `null`, we consider that the rows should remain in the order there were provided.
86
86
  */
87
87
  const buildAggregatedSortingApplier = (sortModel, apiRef) => {
@@ -13,7 +13,7 @@ var _gridVirtualizationSelectors = require("./gridVirtualizationSelectors");
13
13
  var _focus = require("../focus");
14
14
  var _pagination = require("../pagination");
15
15
  var _rows = require("../rows");
16
- const gridIsFocusedCellOutOfContex = (0, _reselect.createSelector)(_focus.gridFocusCellSelector, _gridVirtualizationSelectors.gridRenderContextSelector, _pagination.gridVisibleRowsSelector, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector, _rows.gridRowsLookupSelector, (focusedCell, renderContext, currentPage, visibleColumns, rows) => {
16
+ const gridIsFocusedCellOutOfContext = (0, _reselect.createSelector)(_focus.gridFocusCellSelector, _gridVirtualizationSelectors.gridRenderContextSelector, _pagination.gridVisibleRowsSelector, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector, _rows.gridRowsLookupSelector, (focusedCell, renderContext, currentPage, visibleColumns, rows) => {
17
17
  if (!focusedCell) {
18
18
  return false;
19
19
  }
@@ -26,7 +26,7 @@ const gridIsFocusedCellOutOfContex = (0, _reselect.createSelector)(_focus.gridFo
26
26
  const isInRenderContext = rowIndex !== undefined && columnIndex !== -1 && rowIndex >= renderContext.firstRowIndex && rowIndex <= renderContext.lastRowIndex;
27
27
  return !isInRenderContext;
28
28
  });
29
- const gridFocusedVirtualCellSelector = exports.gridFocusedVirtualCellSelector = (0, _createSelector.createSelectorMemoized)(gridIsFocusedCellOutOfContex, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector, _pagination.gridVisibleRowsSelector, _rows.gridRowsLookupSelector, _focus.gridFocusCellSelector, (isFocusedCellOutOfRenderContext, visibleColumns, currentPage, rows, focusedCell) => {
29
+ const gridFocusedVirtualCellSelector = exports.gridFocusedVirtualCellSelector = (0, _createSelector.createSelectorMemoized)(gridIsFocusedCellOutOfContext, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector, _pagination.gridVisibleRowsSelector, _rows.gridRowsLookupSelector, _focus.gridFocusCellSelector, (isFocusedCellOutOfRenderContext, visibleColumns, currentPage, rows, focusedCell) => {
30
30
  if (!isFocusedCellOutOfRenderContext) {
31
31
  return null;
32
32
  }