@mui/x-data-grid 8.0.0-alpha.5 → 8.0.0-alpha.7

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 (264) hide show
  1. package/CHANGELOG.md +206 -1
  2. package/DataGrid/DataGrid.js +4 -3
  3. package/DataGrid/useDataGridComponent.d.ts +1 -1
  4. package/components/GridColumnHeaders.d.ts +1 -1
  5. package/components/GridColumnHeaders.js +4 -4
  6. package/components/GridFooter.d.ts +2 -1
  7. package/components/GridFooter.js +4 -4
  8. package/components/GridLoadingOverlay.d.ts +1 -1
  9. package/components/GridLoadingOverlay.js +10 -8
  10. package/components/GridNoResultsOverlay.d.ts +2 -1
  11. package/components/GridNoResultsOverlay.js +4 -4
  12. package/components/GridNoRowsOverlay.d.ts +2 -1
  13. package/components/GridNoRowsOverlay.js +4 -4
  14. package/components/GridPagination.d.ts +1 -1
  15. package/components/GridPagination.js +5 -3
  16. package/components/GridRow.d.ts +1 -1
  17. package/components/GridRow.js +3 -2
  18. package/components/GridRowCount.d.ts +1 -1
  19. package/components/GridRowCount.js +3 -2
  20. package/components/GridSelectedRowCount.d.ts +4 -1
  21. package/components/GridSelectedRowCount.js +3 -2
  22. package/components/GridSkeletonLoadingOverlay.d.ts +1 -1
  23. package/components/GridSkeletonLoadingOverlay.js +4 -3
  24. package/components/cell/GridActionsCellItem.d.ts +17 -10
  25. package/components/cell/GridActionsCellItem.js +5 -2
  26. package/components/cell/GridCell.d.ts +1 -1
  27. package/components/cell/GridCell.js +3 -2
  28. package/components/cell/GridEditDateCell.js +1 -1
  29. package/components/cell/GridEditInputCell.d.ts +1 -1
  30. package/components/cell/GridEditInputCell.js +73 -4
  31. package/components/cell/GridEditSingleSelectCell.js +2 -2
  32. package/components/cell/GridSkeletonCell.js +1 -2
  33. package/components/columnHeaders/ColumnHeaderMenuIcon.d.ts +1 -1
  34. package/components/columnHeaders/GridBaseColumnHeaders.d.ts +1 -1
  35. package/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
  36. package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +0 -1
  37. package/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
  38. package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -1
  39. package/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
  40. package/components/columnHeaders/GridIconButtonContainer.d.ts +1 -1
  41. package/components/columnHeaders/GridIconButtonContainer.js +5 -3
  42. package/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
  43. package/components/columnSelection/GridCellCheckboxRenderer.js +7 -4
  44. package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
  45. package/components/columnSelection/GridHeaderCheckbox.js +11 -5
  46. package/components/columnsManagement/GridColumnsManagement.js +2 -2
  47. package/components/containers/GridFooterContainer.d.ts +1 -1
  48. package/components/containers/GridFooterContainer.js +5 -3
  49. package/components/containers/GridOverlay.d.ts +1 -1
  50. package/components/containers/GridOverlay.js +5 -3
  51. package/components/containers/GridRoot.d.ts +1 -1
  52. package/components/containers/GridRoot.js +5 -3
  53. package/components/containers/GridToolbarContainer.d.ts +1 -1
  54. package/components/containers/GridToolbarContainer.js +3 -2
  55. package/components/menu/columnMenu/GridColumnMenu.d.ts +2 -2
  56. package/components/menu/columnMenu/GridColumnMenu.js +5 -5
  57. package/components/menu/columnMenu/GridColumnMenuContainer.d.ts +1 -1
  58. package/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
  59. package/components/panel/GridPanel.d.ts +2 -2
  60. package/components/panel/GridPanel.js +3 -2
  61. package/components/panel/GridPanelWrapper.d.ts +1 -1
  62. package/components/panel/GridPanelWrapper.js +5 -3
  63. package/components/panel/filterPanel/GridFilterForm.d.ts +1 -1
  64. package/components/panel/filterPanel/GridFilterForm.js +3 -2
  65. package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
  66. package/components/panel/filterPanel/GridFilterInputBoolean.js +9 -9
  67. package/components/panel/filterPanel/GridFilterInputValue.js +13 -9
  68. package/components/panel/filterPanel/GridFilterPanel.d.ts +1 -1
  69. package/components/panel/filterPanel/GridFilterPanel.js +4 -4
  70. package/components/panel/filterPanel/index.d.ts +2 -1
  71. package/components/panel/filterPanel/index.js +1 -1
  72. package/components/toolbar/GridToolbar.d.ts +1 -1
  73. package/components/toolbar/GridToolbar.js +4 -4
  74. package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
  75. package/components/toolbar/GridToolbarColumnsButton.js +3 -2
  76. package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
  77. package/components/toolbar/GridToolbarDensitySelector.js +3 -2
  78. package/components/toolbar/GridToolbarExport.d.ts +1 -1
  79. package/components/toolbar/GridToolbarExport.js +2 -1
  80. package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
  81. package/components/toolbar/GridToolbarExportContainer.js +3 -2
  82. package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
  83. package/components/toolbar/GridToolbarFilterButton.js +3 -2
  84. package/components/toolbar/GridToolbarQuickFilter.js +2 -2
  85. package/components/virtualization/GridMainContainer.d.ts +3 -1
  86. package/components/virtualization/GridMainContainer.js +3 -2
  87. package/components/virtualization/GridVirtualScrollbar.d.ts +1 -1
  88. package/components/virtualization/GridVirtualScrollbar.js +2 -1
  89. package/components/virtualization/GridVirtualScrollerContent.d.ts +2 -0
  90. package/components/virtualization/GridVirtualScrollerContent.js +5 -5
  91. package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +2 -0
  92. package/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
  93. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +9 -2
  94. package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +1 -1
  95. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +1 -1
  96. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
  97. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
  98. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
  99. package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +1 -1
  100. package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +1 -1
  101. package/hooks/core/useGridApiInitialization.d.ts +1 -1
  102. package/hooks/core/useGridApiInitialization.js +2 -2
  103. package/hooks/core/useGridInitialization.d.ts +1 -1
  104. package/hooks/core/useGridIsRtl.d.ts +1 -1
  105. package/hooks/core/useGridLocaleText.d.ts +1 -1
  106. package/hooks/core/useGridLoggerFactory.d.ts +1 -1
  107. package/hooks/core/useGridRefs.d.ts +1 -1
  108. package/hooks/core/useGridStateInitialization.d.ts +1 -1
  109. package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
  110. package/hooks/features/columnResize/useGridColumnResize.js +4 -4
  111. package/hooks/features/editing/useGridRowEditing.js +1 -1
  112. package/hooks/features/export/useGridPrintExport.js +1 -1
  113. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  114. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +2 -2
  115. package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +1 -1
  116. package/hooks/features/rows/useGridRowSpanning.js +76 -87
  117. package/hooks/features/rows/useGridRowsPreProcessors.d.ts +1 -1
  118. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -3
  119. package/hooks/features/virtualization/useGridVirtualScroller.js +5 -1
  120. package/hooks/utils/useGridApiEventHandler.js +1 -1
  121. package/hooks/utils/useGridApiMethod.d.ts +1 -1
  122. package/hooks/utils/useGridApiRef.d.ts +1 -1
  123. package/hooks/utils/useGridInitializeState.d.ts +2 -2
  124. package/hooks/utils/useGridLogger.d.ts +1 -1
  125. package/hooks/utils/useGridVisibleRows.d.ts +2 -2
  126. package/index.js +1 -1
  127. package/internals/index.d.ts +1 -1
  128. package/locales/nlNL.js +5 -6
  129. package/material/index.js +6 -0
  130. package/models/api/gridCoreApi.d.ts +7 -7
  131. package/models/api/gridDensityApi.d.ts +1 -1
  132. package/models/gridBaseSlots.d.ts +47 -2
  133. package/models/gridSlotsComponent.d.ts +16 -1
  134. package/models/gridSlotsComponentsProps.d.ts +24 -7
  135. package/models/props/DataGridProps.d.ts +1 -1
  136. package/modern/DataGrid/DataGrid.js +4 -3
  137. package/modern/components/GridColumnHeaders.js +4 -4
  138. package/modern/components/GridFooter.js +4 -4
  139. package/modern/components/GridLoadingOverlay.js +10 -8
  140. package/modern/components/GridNoResultsOverlay.js +4 -4
  141. package/modern/components/GridNoRowsOverlay.js +4 -4
  142. package/modern/components/GridPagination.js +5 -3
  143. package/modern/components/GridRow.js +3 -2
  144. package/modern/components/GridRowCount.js +3 -2
  145. package/modern/components/GridSelectedRowCount.js +3 -2
  146. package/modern/components/GridSkeletonLoadingOverlay.js +4 -3
  147. package/modern/components/cell/GridActionsCellItem.js +5 -2
  148. package/modern/components/cell/GridCell.js +3 -2
  149. package/modern/components/cell/GridEditDateCell.js +1 -1
  150. package/modern/components/cell/GridEditInputCell.js +73 -4
  151. package/modern/components/cell/GridEditSingleSelectCell.js +2 -2
  152. package/modern/components/cell/GridSkeletonCell.js +1 -2
  153. package/modern/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
  154. package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +0 -1
  155. package/modern/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
  156. package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
  157. package/modern/components/columnHeaders/GridIconButtonContainer.js +5 -3
  158. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +7 -4
  159. package/modern/components/columnSelection/GridHeaderCheckbox.js +11 -5
  160. package/modern/components/columnsManagement/GridColumnsManagement.js +2 -2
  161. package/modern/components/containers/GridFooterContainer.js +5 -3
  162. package/modern/components/containers/GridOverlay.js +5 -3
  163. package/modern/components/containers/GridRoot.js +5 -3
  164. package/modern/components/containers/GridToolbarContainer.js +3 -2
  165. package/modern/components/menu/columnMenu/GridColumnMenu.js +5 -5
  166. package/modern/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
  167. package/modern/components/panel/GridPanel.js +3 -2
  168. package/modern/components/panel/GridPanelWrapper.js +5 -3
  169. package/modern/components/panel/filterPanel/GridFilterForm.js +3 -2
  170. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +9 -9
  171. package/modern/components/panel/filterPanel/GridFilterInputValue.js +13 -9
  172. package/modern/components/panel/filterPanel/GridFilterPanel.js +4 -4
  173. package/modern/components/panel/filterPanel/index.js +1 -1
  174. package/modern/components/toolbar/GridToolbar.js +4 -4
  175. package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -2
  176. package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -2
  177. package/modern/components/toolbar/GridToolbarExport.js +2 -1
  178. package/modern/components/toolbar/GridToolbarExportContainer.js +3 -2
  179. package/modern/components/toolbar/GridToolbarFilterButton.js +3 -2
  180. package/modern/components/toolbar/GridToolbarQuickFilter.js +2 -2
  181. package/modern/components/virtualization/GridMainContainer.js +3 -2
  182. package/modern/components/virtualization/GridVirtualScrollbar.js +2 -1
  183. package/modern/components/virtualization/GridVirtualScrollerContent.js +5 -5
  184. package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
  185. package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
  186. package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
  187. package/modern/hooks/core/useGridApiInitialization.js +2 -2
  188. package/modern/hooks/features/columnResize/useGridColumnResize.js +4 -4
  189. package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
  190. package/modern/hooks/features/export/useGridPrintExport.js +1 -1
  191. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +2 -2
  192. package/modern/hooks/features/rows/useGridRowSpanning.js +76 -87
  193. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +5 -1
  194. package/modern/hooks/utils/useGridApiEventHandler.js +1 -1
  195. package/modern/index.js +1 -1
  196. package/modern/locales/nlNL.js +5 -6
  197. package/modern/material/index.js +6 -0
  198. package/modern/utils/utils.js +6 -1
  199. package/node/DataGrid/DataGrid.js +4 -3
  200. package/node/components/GridColumnHeaders.js +4 -4
  201. package/node/components/GridFooter.js +4 -4
  202. package/node/components/GridLoadingOverlay.js +10 -8
  203. package/node/components/GridNoResultsOverlay.js +4 -4
  204. package/node/components/GridNoRowsOverlay.js +4 -4
  205. package/node/components/GridPagination.js +5 -3
  206. package/node/components/GridRow.js +3 -2
  207. package/node/components/GridRowCount.js +3 -2
  208. package/node/components/GridSelectedRowCount.js +3 -2
  209. package/node/components/GridSkeletonLoadingOverlay.js +4 -3
  210. package/node/components/cell/GridActionsCellItem.js +4 -3
  211. package/node/components/cell/GridCell.js +3 -2
  212. package/node/components/cell/GridEditDateCell.js +1 -1
  213. package/node/components/cell/GridEditInputCell.js +73 -4
  214. package/node/components/cell/GridEditSingleSelectCell.js +2 -2
  215. package/node/components/cell/GridSkeletonCell.js +1 -2
  216. package/node/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
  217. package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +0 -1
  218. package/node/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
  219. package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
  220. package/node/components/columnHeaders/GridIconButtonContainer.js +5 -3
  221. package/node/components/columnSelection/GridCellCheckboxRenderer.js +7 -4
  222. package/node/components/columnSelection/GridHeaderCheckbox.js +11 -5
  223. package/node/components/columnsManagement/GridColumnsManagement.js +2 -2
  224. package/node/components/containers/GridFooterContainer.js +5 -3
  225. package/node/components/containers/GridOverlay.js +5 -3
  226. package/node/components/containers/GridRoot.js +5 -3
  227. package/node/components/containers/GridToolbarContainer.js +3 -2
  228. package/node/components/menu/columnMenu/GridColumnMenu.js +5 -5
  229. package/node/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
  230. package/node/components/panel/GridPanel.js +3 -2
  231. package/node/components/panel/GridPanelWrapper.js +5 -3
  232. package/node/components/panel/filterPanel/GridFilterForm.js +3 -2
  233. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +10 -11
  234. package/node/components/panel/filterPanel/GridFilterInputValue.js +13 -9
  235. package/node/components/panel/filterPanel/GridFilterPanel.js +4 -4
  236. package/node/components/panel/filterPanel/index.js +7 -11
  237. package/node/components/toolbar/GridToolbar.js +4 -4
  238. package/node/components/toolbar/GridToolbarColumnsButton.js +3 -2
  239. package/node/components/toolbar/GridToolbarDensitySelector.js +3 -2
  240. package/node/components/toolbar/GridToolbarExport.js +2 -1
  241. package/node/components/toolbar/GridToolbarExportContainer.js +3 -2
  242. package/node/components/toolbar/GridToolbarFilterButton.js +3 -2
  243. package/node/components/toolbar/GridToolbarQuickFilter.js +2 -2
  244. package/node/components/virtualization/GridMainContainer.js +3 -2
  245. package/node/components/virtualization/GridVirtualScrollbar.js +2 -1
  246. package/node/components/virtualization/GridVirtualScrollerContent.js +5 -5
  247. package/node/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
  248. package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
  249. package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
  250. package/node/hooks/core/useGridApiInitialization.js +2 -2
  251. package/node/hooks/features/columnResize/useGridColumnResize.js +4 -4
  252. package/node/hooks/features/editing/useGridRowEditing.js +1 -1
  253. package/node/hooks/features/export/useGridPrintExport.js +1 -1
  254. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +2 -2
  255. package/node/hooks/features/rows/useGridRowSpanning.js +74 -85
  256. package/node/hooks/features/virtualization/useGridVirtualScroller.js +5 -1
  257. package/node/hooks/utils/useGridApiEventHandler.js +1 -1
  258. package/node/index.js +1 -1
  259. package/node/locales/nlNL.js +5 -6
  260. package/node/material/index.js +6 -0
  261. package/node/utils/utils.js +8 -1
  262. package/package.json +2 -2
  263. package/utils/utils.d.ts +1 -0
  264. package/utils/utils.js +6 -1
@@ -8,7 +8,7 @@ exports.useGridRegisterPipeProcessor = void 0;
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
  var _useFirstRender = require("../../utils/useFirstRender");
10
10
  const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
11
- const cleanup = React.useRef();
11
+ const cleanup = React.useRef(null);
12
12
  const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
13
13
  const registerPreProcessor = React.useCallback(() => {
14
14
  cleanup.current = apiRef.current.registerPipeProcessor(group, id.current, callback);
@@ -76,8 +76,8 @@ function createPublicAPI(privateApiRef) {
76
76
  return publicApi;
77
77
  }
78
78
  function useGridApiInitialization(inputApiRef, props) {
79
- const publicApiRef = React.useRef();
80
- const privateApiRef = React.useRef();
79
+ const publicApiRef = React.useRef(null);
80
+ const privateApiRef = React.useRef(null);
81
81
  if (!privateApiRef.current) {
82
82
  privateApiRef.current = createPrivateAPI(publicApiRef);
83
83
  }
@@ -78,7 +78,7 @@ function preventClick(event) {
78
78
  * is disabled.
79
79
  */
80
80
  function useColumnVirtualizationDisabled(apiRef) {
81
- const promise = React.useRef();
81
+ const promise = React.useRef(undefined);
82
82
  const selector = () => (0, _virtualization.gridVirtualizationColumnEnabledSelector)(apiRef);
83
83
  const value = (0, _utils2.useGridSelector)(apiRef, selector);
84
84
  React.useEffect(() => {
@@ -193,10 +193,10 @@ const useGridColumnResize = (apiRef, props) => {
193
193
  // To improve accessibility, the separator has padding on both sides.
194
194
  // Clicking inside the padding area should be treated as a click in the separator.
195
195
  // This ref stores the offset between the click and the separator.
196
- const initialOffsetToSeparator = React.useRef();
197
- const resizeDirection = React.useRef();
196
+ const initialOffsetToSeparator = React.useRef(null);
197
+ const resizeDirection = React.useRef(null);
198
198
  const stopResizeEventTimeout = (0, _useTimeout.useTimeout)();
199
- const touchId = React.useRef();
199
+ const touchId = React.useRef(undefined);
200
200
  const updateWidth = newWidth => {
201
201
  logger.debug(`Updating width to ${newWidth} for col ${refs.colDef.field}`);
202
202
  const prevWidth = refs.columnHeaderElement.offsetWidth;
@@ -29,7 +29,7 @@ const useGridRowEditing = (apiRef, props) => {
29
29
  const [rowModesModel, setRowModesModel] = React.useState({});
30
30
  const rowModesModelRef = React.useRef(rowModesModel);
31
31
  const prevRowModesModel = React.useRef({});
32
- const focusTimeout = React.useRef();
32
+ const focusTimeout = React.useRef(undefined);
33
33
  const nextFocusedCell = React.useRef(null);
34
34
  const {
35
35
  processRowUpdate,
@@ -52,7 +52,7 @@ const useGridPrintExport = (apiRef, props) => {
52
52
  const previousGridState = React.useRef(null);
53
53
  const previousColumnVisibility = React.useRef({});
54
54
  const previousRows = React.useRef([]);
55
- const previousVirtualizationState = React.useRef();
55
+ const previousVirtualizationState = React.useRef(null);
56
56
  React.useEffect(() => {
57
57
  doc.current = (0, _utils.unstable_ownerDocument)(apiRef.current.rootElementRef.current);
58
58
  }, [apiRef, hasRootReference]);
@@ -24,8 +24,8 @@ 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();
28
- const immediateTimeout = React.useRef();
27
+ const hideTimeout = React.useRef(undefined);
28
+ const immediateTimeout = React.useRef(undefined);
29
29
 
30
30
  /**
31
31
  * API METHODS
@@ -13,10 +13,10 @@ 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
20
  const EMPTY_STATE = {
21
21
  spannedCells: {},
22
22
  hiddenCells: {},
@@ -61,8 +61,8 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
61
61
  const backwardsHiddenCells = [];
62
62
  if (index === rangeToProcess.firstRowIndex) {
63
63
  let prevIndex = index - 1;
64
- const prevRowEntry = visibleRows[prevIndex];
65
- while (prevIndex >= range.firstRowIndex && (0, _gridRowSpanningUtils.getCellValue)(prevRowEntry.model, colDef, apiRef) === cellValue) {
64
+ let prevRowEntry = visibleRows[prevIndex];
65
+ while (prevIndex >= range.firstRowIndex && prevRowEntry && (0, _gridRowSpanningUtils.getCellValue)(prevRowEntry.model, colDef, apiRef) === cellValue) {
66
66
  const currentRow = visibleRows[prevIndex + 1];
67
67
  if (hiddenCells[currentRow.id]) {
68
68
  hiddenCells[currentRow.id][colDef.field] = true;
@@ -76,6 +76,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
76
76
  spannedRowId = prevRowEntry.id;
77
77
  spannedRowIndex = prevIndex;
78
78
  prevIndex -= 1;
79
+ prevRowEntry = visibleRows[prevIndex];
79
80
  }
80
81
  }
81
82
  backwardsHiddenCells.forEach(hiddenCellIndex => {
@@ -138,75 +139,59 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
138
139
  * @requires filterStateInitializer (method) - should be initialized before
139
140
  */
140
141
  const rowSpanningStateInitializer = (state, props, apiRef) => {
141
- if (props.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);
142
+ if (!props.rowSpanning) {
166
143
  return (0, _extends2.default)({}, state, {
167
- rowSpanning: {
168
- spannedCells,
169
- hiddenCells,
170
- hiddenCellOriginMap
171
- }
144
+ rowSpanning: EMPTY_STATE
172
145
  });
173
146
  }
147
+ const rowIds = state.rows.dataRowIds || [];
148
+ const orderedFields = state.columns.orderedFields || [];
149
+ const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
150
+ const columnsLookup = state.columns.lookup;
151
+ const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
152
+ if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
153
+ return (0, _extends2.default)({}, state, {
154
+ rowSpanning: EMPTY_STATE
155
+ });
156
+ }
157
+ const rangeToProcess = {
158
+ firstRowIndex: 0,
159
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
160
+ };
161
+ const rows = rowIds.map(id => ({
162
+ id,
163
+ model: dataRowIdToModelLookup[id]
164
+ }));
165
+ const colDefs = orderedFields.map(field => columnsLookup[field]);
166
+ const {
167
+ spannedCells,
168
+ hiddenCells,
169
+ hiddenCellOriginMap
170
+ } = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
174
171
  return (0, _extends2.default)({}, state, {
175
- rowSpanning: EMPTY_STATE
172
+ rowSpanning: {
173
+ spannedCells,
174
+ hiddenCells,
175
+ hiddenCellOriginMap
176
+ }
176
177
  });
177
178
  };
178
179
  exports.rowSpanningStateInitializer = rowSpanningStateInitializer;
179
180
  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
181
  const processedRange = (0, _useLazyRef.default)(() => {
188
182
  return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
189
183
  firstRowIndex: 0,
190
184
  lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
191
185
  } : EMPTY_RANGE;
192
186
  });
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.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
- }
187
+ const updateRowSpanningState = React.useCallback((renderContext, resetState = false) => {
188
+ const {
189
+ range,
190
+ rows: visibleRows
191
+ } = (0, _useGridVisibleRows.getVisibleRows)(apiRef, {
192
+ pagination: props.pagination,
193
+ paginationMode: props.paginationMode
194
+ });
210
195
  if (range === null || !(0, _gridRowSpanningUtils.isRowContextInitialized)(renderContext)) {
211
196
  return;
212
197
  }
@@ -220,6 +205,7 @@ const useGridRowSpanning = (apiRef, props) => {
220
205
  if (rangeToProcess === null) {
221
206
  return;
222
207
  }
208
+ const colDefs = (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
223
209
  const {
224
210
  spannedCells,
225
211
  hiddenCells,
@@ -232,7 +218,8 @@ const useGridRowSpanning = (apiRef, props) => {
232
218
  const currentSpannedCellsCount = Object.keys(apiRef.current.state.rowSpanning.spannedCells).length;
233
219
  const currentHiddenCellsCount = Object.keys(apiRef.current.state.rowSpanning.hiddenCells).length;
234
220
  const shouldUpdateState = resetState || newSpannedCellsCount !== currentSpannedCellsCount || newHiddenCellsCount !== currentHiddenCellsCount;
235
- if (!shouldUpdateState) {
221
+ const hasNoSpannedCells = newSpannedCellsCount === 0 && currentSpannedCellsCount === 0;
222
+ if (!shouldUpdateState || hasNoSpannedCells) {
236
223
  return;
237
224
  }
238
225
  apiRef.current.setState(state => {
@@ -244,34 +231,36 @@ const useGridRowSpanning = (apiRef, props) => {
244
231
  }
245
232
  });
246
233
  });
247
- }, [apiRef, props.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);
234
+ }, [apiRef, processedRange, props.pagination, props.paginationMode]);
235
+
236
+ // Reset events trigger a full re-computation of the row spanning state:
237
+ // - The `unstable_rowSpanning` prop is updated (feature flag)
238
+ // - The filtering is applied
239
+ // - The sorting is applied
240
+ // - The `paginationModel` is updated
241
+ // - The rows are updated
242
+ const resetRowSpanningState = React.useCallback(() => {
243
+ const renderContext = (0, _gridVirtualizationSelectors.gridRenderContextSelector)(apiRef);
244
+ if (!(0, _gridRowSpanningUtils.isRowContextInitialized)(renderContext)) {
260
245
  return;
261
246
  }
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;
247
+ updateRowSpanningState(renderContext, true);
248
+ }, [apiRef, updateRowSpanningState]);
249
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'renderedRowsIntervalChange', (0, _utils.runIf)(props.rowSpanning, updateRowSpanningState));
250
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'sortedRowsSet', (0, _utils.runIf)(props.rowSpanning, resetRowSpanningState));
251
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'paginationModelChange', (0, _utils.runIf)(props.rowSpanning, resetRowSpanningState));
252
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'filteredRowsSet', (0, _utils.runIf)(props.rowSpanning, resetRowSpanningState));
253
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'columnsChange', (0, _utils.runIf)(props.rowSpanning, resetRowSpanningState));
254
+ React.useEffect(() => {
255
+ if (!props.rowSpanning) {
256
+ if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
257
+ apiRef.current.setState(state => (0, _extends2.default)({}, state, {
258
+ rowSpanning: EMPTY_STATE
259
+ }));
270
260
  }
271
- prevRenderContext.current = renderContext;
272
- return;
261
+ } else if (apiRef.current.state.rowSpanning === EMPTY_STATE) {
262
+ resetRowSpanningState();
273
263
  }
274
- updateRowSpanningState();
275
- }, [updateRowSpanningState, renderContext, range, lastRange, tree]);
264
+ }, [apiRef, resetRowSpanningState, props.rowSpanning]);
276
265
  };
277
266
  exports.useGridRowSpanning = useGridRowSpanning;
@@ -97,6 +97,7 @@ const useGridVirtualScroller = () => {
97
97
  const contentHeight = dimensions.contentSize.height;
98
98
  const columnsTotalWidth = dimensions.columnsTotalWidth;
99
99
  const hasColSpan = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridHasColSpanSelector);
100
+ const previousSize = React.useRef(null);
100
101
  const mainRefCallback = React.useCallback(node => {
101
102
  mainRef.current = node;
102
103
  if (!node) {
@@ -104,7 +105,10 @@ const useGridVirtualScroller = () => {
104
105
  }
105
106
  const initialRect = node.getBoundingClientRect();
106
107
  let lastSize = roundDimensions(initialRect);
107
- apiRef.current.publishEvent('resize', lastSize);
108
+ if (!previousSize.current || lastSize.width !== previousSize.current.width && lastSize.height !== previousSize.current.height) {
109
+ previousSize.current = lastSize;
110
+ apiRef.current.publishEvent('resize', lastSize);
111
+ }
108
112
  if (typeof ResizeObserver === 'undefined') {
109
113
  return undefined;
110
114
  }
@@ -34,7 +34,7 @@ function createUseGridApiEventHandler(registryContainer) {
34
34
  }
35
35
  const [objectRetainedByReact] = React.useState(new ObjectToBeRetainedByReact());
36
36
  const subscription = React.useRef(null);
37
- const handlerRef = React.useRef();
37
+ const handlerRef = React.useRef(null);
38
38
  handlerRef.current = handler;
39
39
  const cleanupTokenRef = React.useRef(null);
40
40
  if (!subscription.current && handlerRef.current) {
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.0.0-alpha.5
2
+ * @mui/x-data-grid v8.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -51,8 +51,7 @@ const nlNLGrid = {
51
51
  columnsManagementNoColumns: 'Geen kolommen',
52
52
  columnsManagementShowHideAllText: 'Toon/Verberg Alle',
53
53
  columnsManagementReset: 'Reset',
54
- // columnsManagementDeleteIconLabel: 'Clear',
55
-
54
+ columnsManagementDeleteIconLabel: 'Verwijderen',
56
55
  // Filter panel text
57
56
  filterPanelAddFilter: 'Filter toevoegen',
58
57
  filterPanelRemoveAll: 'Alles verwijderen',
@@ -66,9 +65,9 @@ const nlNLGrid = {
66
65
  filterPanelInputPlaceholder: 'Filter waarde',
67
66
  // Filter operators text
68
67
  filterOperatorContains: 'bevat',
69
- // filterOperatorDoesNotContain: 'does not contain',
68
+ filterOperatorDoesNotContain: 'bevat niet',
70
69
  filterOperatorEquals: 'gelijk aan',
71
- // filterOperatorDoesNotEqual: 'does not equal',
70
+ filterOperatorDoesNotEqual: 'niet gelijk aan',
72
71
  filterOperatorStartsWith: 'begint met',
73
72
  filterOperatorEndsWith: 'eindigt met',
74
73
  filterOperatorIs: 'is',
@@ -88,9 +87,9 @@ const nlNLGrid = {
88
87
  'filterOperator<=': '<=',
89
88
  // Header filter operators text
90
89
  headerFilterOperatorContains: 'Bevat',
91
- // headerFilterOperatorDoesNotContain: 'Does not contain',
90
+ headerFilterOperatorDoesNotContain: 'Bevat niet',
92
91
  headerFilterOperatorEquals: 'Gelijk aan',
93
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
92
+ headerFilterOperatorDoesNotEqual: 'Niet gelijk aan',
94
93
  headerFilterOperatorStartsWith: 'Begint met',
95
94
  headerFilterOperatorEndsWith: 'Eindigt met',
96
95
  headerFilterOperatorIs: 'Is',
@@ -11,7 +11,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
13
13
  var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
14
+ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
14
15
  var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
16
+ var _LinearProgress = _interopRequireDefault(require("@mui/material/LinearProgress"));
15
17
  var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
16
18
  var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
17
19
  var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
@@ -26,6 +28,7 @@ var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
26
28
  var _Popper = _interopRequireDefault(require("@mui/material/Popper"));
27
29
  var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
28
30
  var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
31
+ var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
29
32
  var _GridColumnUnsortedIcon = require("./icons/GridColumnUnsortedIcon");
30
33
  var _icons = require("./icons");
31
34
  var _MUISelectOption = _interopRequireDefault(require("./components/MUISelectOption"));
@@ -71,7 +74,9 @@ const iconSlots = {
71
74
  const baseSlots = {
72
75
  baseBadge: _Badge.default,
73
76
  baseCheckbox: _Checkbox.default,
77
+ baseCircularProgress: _CircularProgress.default,
74
78
  baseDivider: _Divider.default,
79
+ baseLinearProgress: _LinearProgress.default,
75
80
  baseMenuList: _MenuList.default,
76
81
  baseMenuItem: BaseMenuItem,
77
82
  baseTextField: _TextField.default,
@@ -84,6 +89,7 @@ const baseSlots = {
84
89
  basePopper: _Popper.default,
85
90
  baseInputLabel: _InputLabel.default,
86
91
  baseSelectOption: _MUISelectOption.default,
92
+ baseSkeleton: _Skeleton.default,
87
93
  baseChip: _Chip.default
88
94
  };
89
95
  const materialSlots = (0, _extends2.default)({}, baseSlots, iconSlots);
@@ -14,6 +14,7 @@ exports.isNumber = isNumber;
14
14
  exports.isObject = isObject;
15
15
  exports.localStorageAvailable = localStorageAvailable;
16
16
  exports.range = range;
17
+ exports.runIf = void 0;
17
18
  function isNumber(value) {
18
19
  return typeof value === 'number' && !Number.isNaN(value);
19
20
  }
@@ -213,4 +214,10 @@ function deepClone(obj) {
213
214
  * of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
214
215
  * that hint disables checks on all values instead of just one.
215
216
  */
216
- function eslintUseValue(_) {}
217
+ function eslintUseValue(_) {}
218
+ const runIf = (condition, fn) => params => {
219
+ if (condition) {
220
+ fn(params);
221
+ }
222
+ };
223
+ exports.runIf = runIf;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "8.0.0-alpha.5",
3
+ "version": "8.0.0-alpha.7",
4
4
  "description": "The Community plan edition of the Data Grid components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -42,7 +42,7 @@
42
42
  "clsx": "^2.1.1",
43
43
  "prop-types": "^15.8.1",
44
44
  "reselect": "^5.1.1",
45
- "@mui/x-internals": "8.0.0-alpha.5"
45
+ "@mui/x-internals": "8.0.0-alpha.7"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@emotion/react": "^11.9.0",
package/utils/utils.d.ts CHANGED
@@ -54,3 +54,4 @@ export declare function deepClone(obj: Record<string, any>): any;
54
54
  * that hint disables checks on all values instead of just one.
55
55
  */
56
56
  export declare function eslintUseValue(_: any): void;
57
+ export declare const runIf: (condition: boolean, fn: Function) => (params: unknown) => void;
package/utils/utils.js CHANGED
@@ -196,4 +196,9 @@ export function deepClone(obj) {
196
196
  * of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
197
197
  * that hint disables checks on all values instead of just one.
198
198
  */
199
- export function eslintUseValue(_) {}
199
+ export function eslintUseValue(_) {}
200
+ export const runIf = (condition, fn) => params => {
201
+ if (condition) {
202
+ fn(params);
203
+ }
204
+ };