@mui/x-data-grid-pro 8.26.0 → 8.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/DataGridPro/DataGridPro.d.ts +2 -2
  3. package/DataGridPro/DataGridPro.js +1 -1
  4. package/DataGridPro/useDataGridProComponent.d.ts +4 -4
  5. package/DataGridPro/useDataGridProProps.d.ts +2 -2
  6. package/components/GridColumnHeaders.d.ts +1 -1
  7. package/components/GridColumnMenuPinningItem.d.ts +1 -1
  8. package/components/GridDataSourceTreeDataGroupingCell.d.ts +1 -1
  9. package/components/GridDetailPanel.d.ts +1 -1
  10. package/components/GridDetailPanelToggleCell.d.ts +1 -1
  11. package/components/GridDetailPanels.d.ts +1 -1
  12. package/components/GridPinnedRows.d.ts +1 -1
  13. package/components/GridProColumnMenu.d.ts +2 -2
  14. package/components/GridProColumnMenu.js +3 -1
  15. package/components/GridRowReorderCell.d.ts +1 -1
  16. package/components/GridRowReorderCell.js +2 -2
  17. package/components/GridTreeDataGroupingCell.d.ts +1 -1
  18. package/components/headerFiltering/GridHeaderFilterCell.d.ts +2 -2
  19. package/components/headerFiltering/GridHeaderFilterCell.js +2 -1
  20. package/components/headerFiltering/GridHeaderFilterClearButton.d.ts +1 -1
  21. package/components/headerFiltering/GridHeaderFilterMenu.d.ts +1 -1
  22. package/components/headerFiltering/GridHeaderFilterMenuContainer.d.ts +1 -1
  23. package/esm/DataGridPro/DataGridPro.d.ts +2 -2
  24. package/esm/DataGridPro/DataGridPro.js +1 -1
  25. package/esm/DataGridPro/useDataGridProComponent.d.ts +4 -4
  26. package/esm/DataGridPro/useDataGridProProps.d.ts +2 -2
  27. package/esm/components/GridColumnHeaders.d.ts +1 -1
  28. package/esm/components/GridColumnMenuPinningItem.d.ts +1 -1
  29. package/esm/components/GridDataSourceTreeDataGroupingCell.d.ts +1 -1
  30. package/esm/components/GridDetailPanel.d.ts +1 -1
  31. package/esm/components/GridDetailPanelToggleCell.d.ts +1 -1
  32. package/esm/components/GridDetailPanels.d.ts +1 -1
  33. package/esm/components/GridPinnedRows.d.ts +1 -1
  34. package/esm/components/GridProColumnMenu.d.ts +2 -2
  35. package/esm/components/GridProColumnMenu.js +3 -1
  36. package/esm/components/GridRowReorderCell.d.ts +1 -1
  37. package/esm/components/GridRowReorderCell.js +1 -1
  38. package/esm/components/GridTreeDataGroupingCell.d.ts +1 -1
  39. package/esm/components/headerFiltering/GridHeaderFilterCell.d.ts +2 -2
  40. package/esm/components/headerFiltering/GridHeaderFilterCell.js +2 -1
  41. package/esm/components/headerFiltering/GridHeaderFilterClearButton.d.ts +1 -1
  42. package/esm/components/headerFiltering/GridHeaderFilterMenu.d.ts +1 -1
  43. package/esm/components/headerFiltering/GridHeaderFilterMenuContainer.d.ts +1 -1
  44. package/esm/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
  45. package/esm/hooks/features/columnPinning/gridColumnPinningInterface.d.ts +2 -2
  46. package/esm/hooks/features/columnPinning/useGridColumnPinning.d.ts +4 -4
  47. package/esm/hooks/features/columnPinning/useGridColumnPinning.js +4 -0
  48. package/esm/hooks/features/columnPinning/useGridColumnPinningPreProcessors.d.ts +3 -3
  49. package/esm/hooks/features/columnReorder/columnReorderSelector.d.ts +1 -1
  50. package/esm/hooks/features/columnReorder/useGridColumnReorder.d.ts +4 -4
  51. package/esm/hooks/features/dataSource/gridDataSourceSelector.d.ts +1 -1
  52. package/esm/hooks/features/dataSource/useGridDataSourceBasePro.d.ts +6 -6
  53. package/esm/hooks/features/dataSource/useGridDataSourcePro.d.ts +4 -4
  54. package/esm/hooks/features/dataSource/utils.d.ts +3 -3
  55. package/esm/hooks/features/detailPanel/gridDetailPanelInterface.d.ts +2 -2
  56. package/esm/hooks/features/detailPanel/gridDetailPanelSelector.d.ts +1 -1
  57. package/esm/hooks/features/detailPanel/gridDetailPanelToggleColDef.d.ts +1 -1
  58. package/esm/hooks/features/detailPanel/useGridDetailPanel.d.ts +4 -4
  59. package/esm/hooks/features/detailPanel/useGridDetailPanelPreProcessors.d.ts +3 -3
  60. package/esm/hooks/features/infiniteLoader/useGridInfiniteLoader.d.ts +3 -3
  61. package/esm/hooks/features/lazyLoader/useGridLazyLoader.d.ts +3 -3
  62. package/esm/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.d.ts +3 -3
  63. package/esm/hooks/features/lazyLoader/utils.d.ts +23 -8
  64. package/esm/hooks/features/lazyLoader/utils.js +23 -0
  65. package/esm/hooks/features/rowPinning/gridRowPinningInterface.d.ts +1 -1
  66. package/esm/hooks/features/rowPinning/useGridRowPinning.d.ts +4 -4
  67. package/esm/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +4 -4
  68. package/esm/hooks/features/rowReorder/gridRowReorderColDef.d.ts +1 -1
  69. package/esm/hooks/features/rowReorder/models.d.ts +1 -1
  70. package/esm/hooks/features/rowReorder/reorderValidator.d.ts +1 -1
  71. package/esm/hooks/features/rowReorder/useGridRowReorder.d.ts +3 -3
  72. package/esm/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +3 -3
  73. package/esm/hooks/features/rowReorder/utils.d.ts +2 -2
  74. package/esm/hooks/features/rows/useGridRowAriaAttributes.d.ts +1 -1
  75. package/esm/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.d.ts +3 -3
  76. package/esm/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.js +23 -28
  77. package/esm/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.d.ts +3 -3
  78. package/esm/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.js +1 -1
  79. package/esm/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.d.ts +3 -3
  80. package/esm/hooks/features/serverSideTreeData/utils.d.ts +5 -2
  81. package/esm/hooks/features/serverSideTreeData/utils.js +14 -2
  82. package/esm/hooks/features/treeData/gridTreeDataGroupColDef.d.ts +1 -1
  83. package/esm/hooks/features/treeData/gridTreeDataUtils.d.ts +3 -3
  84. package/esm/hooks/features/treeData/treeDataReorderExecutor.d.ts +1 -1
  85. package/esm/hooks/features/treeData/useGridTreeData.d.ts +1 -1
  86. package/esm/hooks/features/treeData/useGridTreeDataPreProcessors.d.ts +3 -3
  87. package/esm/hooks/utils/useGridApiContext.d.ts +3 -3
  88. package/esm/hooks/utils/useGridApiRef.d.ts +2 -2
  89. package/esm/hooks/utils/useGridAriaAttributes.d.ts +1 -1
  90. package/esm/hooks/utils/useGridPrivateApiContext.d.ts +1 -1
  91. package/esm/index.js +1 -1
  92. package/esm/internals/propValidation.d.ts +2 -2
  93. package/esm/models/dataGridProProps.d.ts +4 -4
  94. package/esm/models/gridApiPro.d.ts +3 -3
  95. package/esm/models/gridFetchRowsParams.d.ts +1 -1
  96. package/esm/models/gridGroupingColDefOverride.d.ts +1 -1
  97. package/esm/models/gridProIconSlotsComponent.d.ts +2 -2
  98. package/esm/models/gridProSlotProps.d.ts +1 -1
  99. package/esm/models/gridProSlotsComponent.d.ts +2 -2
  100. package/esm/models/gridRowOrderChangeParams.d.ts +1 -1
  101. package/esm/models/gridRowScrollEndParams.d.ts +1 -1
  102. package/esm/models/gridStatePro.d.ts +1 -1
  103. package/esm/themeAugmentation/overrides.d.ts +1 -1
  104. package/esm/themeAugmentation/props.d.ts +2 -2
  105. package/esm/typeOverloads/modules.d.ts +2 -2
  106. package/esm/utils/tree/createRowTree.d.ts +4 -4
  107. package/esm/utils/tree/insertDataRowInTree.d.ts +4 -4
  108. package/esm/utils/tree/models.d.ts +1 -1
  109. package/esm/utils/tree/removeDataRowFromTree.d.ts +2 -2
  110. package/esm/utils/tree/sortRowTree.d.ts +2 -2
  111. package/esm/utils/tree/updateRowTree.d.ts +3 -3
  112. package/esm/utils/tree/utils.d.ts +4 -4
  113. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
  114. package/hooks/features/columnPinning/gridColumnPinningInterface.d.ts +2 -2
  115. package/hooks/features/columnPinning/useGridColumnPinning.d.ts +4 -4
  116. package/hooks/features/columnPinning/useGridColumnPinning.js +4 -0
  117. package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.d.ts +3 -3
  118. package/hooks/features/columnReorder/columnReorderSelector.d.ts +1 -1
  119. package/hooks/features/columnReorder/useGridColumnReorder.d.ts +4 -4
  120. package/hooks/features/dataSource/gridDataSourceSelector.d.ts +1 -1
  121. package/hooks/features/dataSource/useGridDataSourceBasePro.d.ts +6 -6
  122. package/hooks/features/dataSource/useGridDataSourcePro.d.ts +4 -4
  123. package/hooks/features/dataSource/utils.d.ts +3 -3
  124. package/hooks/features/detailPanel/gridDetailPanelInterface.d.ts +2 -2
  125. package/hooks/features/detailPanel/gridDetailPanelSelector.d.ts +1 -1
  126. package/hooks/features/detailPanel/gridDetailPanelToggleColDef.d.ts +1 -1
  127. package/hooks/features/detailPanel/useGridDetailPanel.d.ts +4 -4
  128. package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.d.ts +3 -3
  129. package/hooks/features/infiniteLoader/useGridInfiniteLoader.d.ts +3 -3
  130. package/hooks/features/lazyLoader/useGridLazyLoader.d.ts +3 -3
  131. package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.d.ts +3 -3
  132. package/hooks/features/lazyLoader/utils.d.ts +23 -8
  133. package/hooks/features/lazyLoader/utils.js +26 -1
  134. package/hooks/features/rowPinning/gridRowPinningInterface.d.ts +1 -1
  135. package/hooks/features/rowPinning/useGridRowPinning.d.ts +4 -4
  136. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +4 -4
  137. package/hooks/features/rowReorder/gridRowReorderColDef.d.ts +1 -1
  138. package/hooks/features/rowReorder/models.d.ts +1 -1
  139. package/hooks/features/rowReorder/reorderValidator.d.ts +1 -1
  140. package/hooks/features/rowReorder/useGridRowReorder.d.ts +3 -3
  141. package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +3 -3
  142. package/hooks/features/rowReorder/utils.d.ts +2 -2
  143. package/hooks/features/rows/useGridRowAriaAttributes.d.ts +1 -1
  144. package/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.d.ts +3 -3
  145. package/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.js +23 -28
  146. package/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.d.ts +3 -3
  147. package/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.js +2 -2
  148. package/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.d.ts +3 -3
  149. package/hooks/features/serverSideTreeData/utils.d.ts +5 -2
  150. package/hooks/features/serverSideTreeData/utils.js +14 -2
  151. package/hooks/features/treeData/gridTreeDataGroupColDef.d.ts +1 -1
  152. package/hooks/features/treeData/gridTreeDataUtils.d.ts +3 -3
  153. package/hooks/features/treeData/treeDataReorderExecutor.d.ts +1 -1
  154. package/hooks/features/treeData/useGridTreeData.d.ts +1 -1
  155. package/hooks/features/treeData/useGridTreeDataPreProcessors.d.ts +3 -3
  156. package/hooks/utils/useGridApiContext.d.ts +3 -3
  157. package/hooks/utils/useGridApiRef.d.ts +2 -2
  158. package/hooks/utils/useGridAriaAttributes.d.ts +1 -1
  159. package/hooks/utils/useGridPrivateApiContext.d.ts +1 -1
  160. package/index.js +1 -1
  161. package/internals/propValidation.d.ts +2 -2
  162. package/models/dataGridProProps.d.ts +4 -4
  163. package/models/gridApiPro.d.ts +3 -3
  164. package/models/gridFetchRowsParams.d.ts +1 -1
  165. package/models/gridGroupingColDefOverride.d.ts +1 -1
  166. package/models/gridProIconSlotsComponent.d.ts +2 -2
  167. package/models/gridProSlotProps.d.ts +1 -1
  168. package/models/gridProSlotsComponent.d.ts +2 -2
  169. package/models/gridRowOrderChangeParams.d.ts +1 -1
  170. package/models/gridRowScrollEndParams.d.ts +1 -1
  171. package/models/gridStatePro.d.ts +1 -1
  172. package/package.json +4 -4
  173. package/themeAugmentation/overrides.d.ts +1 -1
  174. package/themeAugmentation/props.d.ts +2 -2
  175. package/typeOverloads/modules.d.ts +2 -2
  176. package/utils/tree/createRowTree.d.ts +4 -4
  177. package/utils/tree/insertDataRowInTree.d.ts +4 -4
  178. package/utils/tree/models.d.ts +1 -1
  179. package/utils/tree/removeDataRowFromTree.d.ts +2 -2
  180. package/utils/tree/sortRowTree.d.ts +2 -2
  181. package/utils/tree/updateRowTree.d.ts +3 -3
  182. package/utils/tree/utils.d.ts +4 -4
@@ -46,19 +46,6 @@ const useGridDataSourceLazyLoader = (privateApiRef, props) => {
46
46
  privateApiRef.current.dataSource.fetchRows(_xDataGrid.GRID_ROOT_GROUP_ID, params);
47
47
  }, [privateApiRef]);
48
48
  const debouncedFetchRows = React.useMemo(() => (0, _debounce.default)(fetchRows, 0), [fetchRows]);
49
-
50
- // Adjust the render context range to fit the pagination model's page size
51
- // First row index should be decreased to the start of the page, end row index should be increased to the end of the page
52
- const adjustRowParams = React.useCallback(params => {
53
- if (typeof params.start !== 'number') {
54
- return params;
55
- }
56
- const paginationModel = (0, _xDataGrid.gridPaginationModelSelector)(privateApiRef);
57
- return (0, _extends2.default)({}, params, {
58
- start: params.start - params.start % paginationModel.pageSize,
59
- end: params.end + paginationModel.pageSize - params.end % paginationModel.pageSize - 1
60
- });
61
- }, [privateApiRef]);
62
49
  const resetGrid = React.useCallback(() => {
63
50
  privateApiRef.current.setLoading(true);
64
51
  privateApiRef.current.dataSource.cache.clear();
@@ -109,9 +96,13 @@ const useGridDataSourceLazyLoader = (privateApiRef, props) => {
109
96
  if (rootChildrenCount === 0) {
110
97
  return;
111
98
  }
112
- const pageToSkip = adjustRowParams({
99
+ const paginationModel = (0, _xDataGrid.gridPaginationModelSelector)(privateApiRef);
100
+ const pageToSkip = (0, _utils.adjustRowParams)({
113
101
  start: renderedRowsIntervalCache.current.firstRowToRender,
114
102
  end: renderedRowsIntervalCache.current.lastRowToRender
103
+ }, {
104
+ pageSize: paginationModel.pageSize,
105
+ rowCount: pageRowCount
115
106
  });
116
107
  let hasChanged = false;
117
108
  const isInitialPage = renderedRowsIntervalCache.current.firstRowToRender === 0 && renderedRowsIntervalCache.current.lastRowToRender === 0;
@@ -164,7 +155,7 @@ const useGridDataSourceLazyLoader = (privateApiRef, props) => {
164
155
  tree
165
156
  })
166
157
  }), 'addSkeletonRows');
167
- }, [privateApiRef, adjustRowParams]);
158
+ }, [privateApiRef]);
168
159
  const updateLoadingTrigger = React.useCallback(rowCount => {
169
160
  const newLoadingTrigger = rowCount === -1 ? LoadingTrigger.SCROLL_END : LoadingTrigger.VIEWPORT;
170
161
  if (loadingTrigger.current !== null) {
@@ -275,43 +266,47 @@ const useGridDataSourceLazyLoader = (privateApiRef, props) => {
275
266
  filterModel
276
267
  };
277
268
  privateApiRef.current.setLoading(true);
278
- fetchRows(adjustRowParams(getRowsParams));
269
+ fetchRows((0, _utils.adjustRowParams)(getRowsParams, {
270
+ pageSize: paginationModel.pageSize,
271
+ rowCount: privateApiRef.current.state.pagination.rowCount
272
+ }));
279
273
  });
280
- const handleRenderedRowsIntervalChange = React.useCallback(params => {
274
+ const handleRenderedRowsIntervalChange = React.useCallback(renderContext => {
281
275
  if (rowsStale.current) {
282
276
  return;
283
277
  }
284
278
  const sortModel = (0, _xDataGrid.gridSortModelSelector)(privateApiRef);
285
279
  const filterModel = (0, _xDataGrid.gridFilterModelSelector)(privateApiRef);
286
280
  const getRowsParams = {
287
- start: params.firstRowIndex,
288
- end: params.lastRowIndex - 1,
281
+ start: renderContext.firstRowIndex,
282
+ end: renderContext.lastRowIndex - 1,
289
283
  sortModel,
290
284
  filterModel
291
285
  };
292
- if (renderedRowsIntervalCache.current.firstRowToRender === params.firstRowIndex && renderedRowsIntervalCache.current.lastRowToRender === params.lastRowIndex) {
286
+ if (renderedRowsIntervalCache.current.firstRowToRender === renderContext.firstRowIndex && renderedRowsIntervalCache.current.lastRowToRender === renderContext.lastRowIndex) {
293
287
  return;
294
288
  }
295
289
  renderedRowsIntervalCache.current = {
296
- firstRowToRender: params.firstRowIndex,
297
- lastRowToRender: params.lastRowIndex
290
+ firstRowToRender: renderContext.firstRowIndex,
291
+ lastRowToRender: renderContext.lastRowIndex
298
292
  };
299
293
  const currentVisibleRows = (0, _internals.getVisibleRows)(privateApiRef);
300
294
  const skeletonRowsSection = (0, _utils.findSkeletonRowsSection)({
301
295
  apiRef: privateApiRef,
302
296
  visibleRows: currentVisibleRows.rows,
303
- range: {
304
- firstRowIndex: params.firstRowIndex,
305
- lastRowIndex: params.lastRowIndex - 1
306
- }
297
+ range: renderContext
307
298
  });
308
299
  if (!skeletonRowsSection) {
309
300
  return;
310
301
  }
311
302
  getRowsParams.start = skeletonRowsSection.firstRowIndex;
312
303
  getRowsParams.end = skeletonRowsSection.lastRowIndex;
313
- fetchRows(adjustRowParams(getRowsParams));
314
- }, [privateApiRef, adjustRowParams, fetchRows]);
304
+ const paginationModel = (0, _xDataGrid.gridPaginationModelSelector)(privateApiRef);
305
+ fetchRows((0, _utils.adjustRowParams)(getRowsParams, {
306
+ pageSize: paginationModel.pageSize,
307
+ rowCount: privateApiRef.current.state.pagination.rowCount
308
+ }));
309
+ }, [privateApiRef, fetchRows]);
315
310
  const throttledHandleRenderedRowsIntervalChange = React.useMemo(() => (0, _throttle.throttle)(handleRenderedRowsIntervalChange, props.lazyLoadingRequestThrottleMs), [props.lazyLoadingRequestThrottleMs, handleRenderedRowsIntervalChange]);
316
311
  React.useEffect(() => {
317
312
  return () => {
@@ -1,6 +1,6 @@
1
- import { RefObject } from '@mui/x-internals/types';
2
- import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
3
- import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
1
+ import type { RefObject } from '@mui/x-internals/types';
2
+ import type { GridPrivateApiPro } from "../../../models/gridApiPro.js";
3
+ import type { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
4
4
  /**
5
5
  * @requires useGridDimensions (method) - can be after
6
6
  */
@@ -11,9 +11,9 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _xDataGrid = require("@mui/x-data-grid");
12
12
  var _internals = require("@mui/x-data-grid/internals");
13
13
  var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
14
- var _system = require("@mui/system");
14
+ var _styles = require("@mui/material/styles");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
- const InfiniteLoadingTriggerElement = (0, _system.styled)('div', {
16
+ const InfiniteLoadingTriggerElement = (0, _styles.styled)('div', {
17
17
  slot: 'internal',
18
18
  shouldForwardProp: undefined
19
19
  })({
@@ -1,4 +1,4 @@
1
- import { RefObject } from '@mui/x-internals/types';
2
- import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
3
- import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
1
+ import type { RefObject } from '@mui/x-internals/types';
2
+ import type { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
3
+ import type { GridPrivateApiPro } from "../../../models/gridApiPro.js";
4
4
  export declare const useGridDataSourceTreeDataPreProcessors: (privateApiRef: RefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, "treeData" | "groupingColDef" | "disableChildrenSorting" | "disableChildrenFiltering" | "defaultGroupingExpansionDepth" | "isGroupExpandedByDefault" | "dataSource">) => void;
@@ -1,5 +1,5 @@
1
- import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
2
- import { GridRowTreeCreationParams } from '@mui/x-data-grid/internals';
1
+ import { type GridRowId, type GridRowTreeConfig } from '@mui/x-data-grid';
2
+ import { type GridRowTreeCreationParams } from '@mui/x-data-grid/internals';
3
3
  export declare function skipFiltering(rowTree: GridRowTreeConfig): {
4
4
  filteredRowsLookup: {};
5
5
  filteredChildrenCountLookup: Record<GridRowId, number>;
@@ -9,5 +9,8 @@ export declare function skipSorting(rowTree: GridRowTreeConfig): GridRowId[];
9
9
  /**
10
10
  * Retrieves the parent path for a row from the previous tree state.
11
11
  * Used during full tree updates to maintain correct hierarchy.
12
+ *
13
+ * Uses the parent node's `path` property, which stores the group keys
14
+ * representing the full path to the parent (i.e. the keys used to fetch the current node).
12
15
  */
13
16
  export declare function getParentPath(rowId: GridRowId, treeCreationParams: GridRowTreeCreationParams): string[];
@@ -28,10 +28,22 @@ function skipSorting(rowTree) {
28
28
  /**
29
29
  * Retrieves the parent path for a row from the previous tree state.
30
30
  * Used during full tree updates to maintain correct hierarchy.
31
+ *
32
+ * Uses the parent node's `path` property, which stores the group keys
33
+ * representing the full path to the parent (i.e. the keys used to fetch the current node).
31
34
  */
32
35
  function getParentPath(rowId, treeCreationParams) {
33
- if (treeCreationParams.updates.type !== 'full' || !treeCreationParams.previousTree?.[rowId] || treeCreationParams.previousTree[rowId].depth < 1 || !('path' in treeCreationParams.previousTree[rowId])) {
36
+ if (treeCreationParams.updates.type !== 'full' || !treeCreationParams.previousTree?.[rowId] || treeCreationParams.previousTree[rowId].depth < 1) {
34
37
  return [];
35
38
  }
36
- return treeCreationParams.previousTree[rowId].path || [];
39
+ const node = treeCreationParams.previousTree[rowId];
40
+ const parentId = node.parent;
41
+ if (parentId == null) {
42
+ return [];
43
+ }
44
+ const parentNode = treeCreationParams.previousTree[parentId];
45
+ if (parentNode && 'path' in parentNode) {
46
+ return parentNode.path || [];
47
+ }
48
+ return [];
37
49
  }
@@ -1,4 +1,4 @@
1
- import { GridColDef } from '@mui/x-data-grid';
1
+ import { type GridColDef } from '@mui/x-data-grid';
2
2
  import { GRID_TREE_DATA_GROUPING_FIELD } from '@mui/x-data-grid/internals';
3
3
  /**
4
4
  * TODO: Add sorting and filtering on the value and the filteredDescendantCount
@@ -1,6 +1,6 @@
1
- import { RefObject } from '@mui/x-internals/types';
2
- import { GridRowTreeConfig, GridFilterState, GridFilterModel, GridRowModel, GridColDef } from '@mui/x-data-grid';
3
- import { GridAggregatedFilterItemApplier } from '@mui/x-data-grid/internals';
1
+ import type { RefObject } from '@mui/x-internals/types';
2
+ import type { GridRowTreeConfig, GridFilterState, GridFilterModel, GridRowModel, GridColDef } from '@mui/x-data-grid';
3
+ import { type GridAggregatedFilterItemApplier } from '@mui/x-data-grid/internals';
4
4
  import type { GridPrivateApiPro } from "../../../models/gridApiPro.js";
5
5
  interface FilterRowTreeFromTreeDataParams {
6
6
  rowTree: GridRowTreeConfig;
@@ -1,5 +1,5 @@
1
1
  import { BaseReorderOperation, RowReorderExecutor } from "../rowReorder/reorderExecutor.js";
2
- import { type ReorderOperation, type ReorderExecutionContext } from "../rowReorder/types.js";
2
+ import type { ReorderOperation, ReorderExecutionContext } from "../rowReorder/types.js";
3
3
  /**
4
4
  * Handles reordering of items within the same parent group.
5
5
  */
@@ -1,4 +1,4 @@
1
- import { RefObject } from '@mui/x-internals/types';
1
+ import type { RefObject } from '@mui/x-internals/types';
2
2
  import type { GridPrivateApiPro } from "../../../models/gridApiPro.js";
3
3
  import type { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
4
4
  export declare const useGridTreeData: (apiRef: RefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, "treeData" | "dataSource" | "isValidRowReorder">) => void;
@@ -1,4 +1,4 @@
1
- import { RefObject } from '@mui/x-internals/types';
2
- import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
3
- import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
1
+ import type { RefObject } from '@mui/x-internals/types';
2
+ import type { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
3
+ import type { GridPrivateApiPro } from "../../../models/gridApiPro.js";
4
4
  export declare const useGridTreeDataPreProcessors: (privateApiRef: RefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, "treeData" | "groupingColDef" | "getTreeDataPath" | "disableChildrenSorting" | "disableChildrenFiltering" | "defaultGroupingExpansionDepth" | "isGroupExpandedByDefault" | "dataSource">) => void;
@@ -1,4 +1,4 @@
1
- import { RefObject } from '@mui/x-internals/types';
2
- import { GridApiCommon } from '@mui/x-data-grid';
3
- import { GridApiPro } from "../../models/gridApiPro.js";
1
+ import type { RefObject } from '@mui/x-internals/types';
2
+ import { type GridApiCommon } from '@mui/x-data-grid';
3
+ import type { GridApiPro } from "../../models/gridApiPro.js";
4
4
  export declare const useGridApiContext: <Api extends GridApiCommon = GridApiPro>() => RefObject<Api>;
@@ -1,3 +1,3 @@
1
- import { RefObject } from '@mui/x-internals/types';
2
- import { GridApiPro } from "../../models/gridApiPro.js";
1
+ import type { RefObject } from '@mui/x-internals/types';
2
+ import type { GridApiPro } from "../../models/gridApiPro.js";
3
3
  export declare const useGridApiRef: () => RefObject<GridApiPro | null>;
@@ -1,2 +1,2 @@
1
- import * as React from 'react';
1
+ import type * as React from 'react';
2
2
  export declare const useGridAriaAttributesPro: () => React.HTMLAttributes<HTMLElement>;
@@ -1,2 +1,2 @@
1
- import { GridPrivateApiPro } from "../../models/gridApiPro.js";
1
+ import type { GridPrivateApiPro } from "../../models/gridApiPro.js";
2
2
  export declare const useGridPrivateApiContext: () => import("react").RefObject<GridPrivateApiPro>;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v8.26.0
2
+ * @mui/x-data-grid-pro v8.27.1
3
3
  *
4
4
  * @license SEE LICENSE IN LICENSE
5
5
  * This source code is licensed under the SEE LICENSE IN LICENSE license found in the
@@ -1,3 +1,3 @@
1
- import { PropValidator } from '@mui/x-data-grid/internals';
2
- import { DataGridProProcessedProps } from "../models/dataGridProProps.js";
1
+ import { type PropValidator } from '@mui/x-data-grid/internals';
2
+ import type { DataGridProProcessedProps } from "../models/dataGridProProps.js";
3
3
  export declare const propValidatorsDataGridPro: PropValidator<DataGridProProcessedProps>[];
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
2
- import { RefObject } from '@mui/x-internals/types';
3
- import { GridEventListener, GridCallbackDetails, GridRowParams, GridRowId, GridValidRowModel, GridGroupNode, GridFeatureMode, GridListViewColDef, GridGetRowsError, GridUpdateRowError } from '@mui/x-data-grid';
1
+ import type * as React from 'react';
2
+ import type { RefObject } from '@mui/x-internals/types';
3
+ import type { GridEventListener, GridCallbackDetails, GridRowParams, GridRowId, GridValidRowModel, GridGroupNode, GridFeatureMode, GridListViewColDef, GridGetRowsError, GridUpdateRowError } from '@mui/x-data-grid';
4
4
  import type { GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, GridPinnedColumnFields, DataGridProSharedPropsWithDefaultValue, DataGridProSharedPropsWithoutDefaultValue } from '@mui/x-data-grid/internals';
5
5
  import type { GridPinnedRowsProp } from "../hooks/features/rowPinning/index.js";
6
6
  import type { GridApiPro } from "./gridApiPro.js";
7
- import { GridGroupingColDefOverride, GridGroupingColDefOverrideParams } from "./gridGroupingColDefOverride.js";
7
+ import type { GridGroupingColDefOverride, GridGroupingColDefOverrideParams } from "./gridGroupingColDefOverride.js";
8
8
  import type { GridInitialStatePro } from "./gridStatePro.js";
9
9
  import type { GridProSlotsComponent } from "./gridProSlotsComponent.js";
10
10
  import type { GridProSlotProps } from "./gridProSlotProps.js";
@@ -1,6 +1,6 @@
1
- import { GridApiCommon, GridColumnReorderApi, GridRowMultiSelectionApi, GridRowProApi } from '@mui/x-data-grid';
2
- import { GridPrivateOnlyApiCommon, GridInfiniteLoaderPrivateApi } from '@mui/x-data-grid/internals';
3
- import { GridInitialStatePro, GridStatePro } from "./gridStatePro.js";
1
+ import type { GridApiCommon, GridColumnReorderApi, GridRowMultiSelectionApi, GridRowProApi } from '@mui/x-data-grid';
2
+ import type { GridPrivateOnlyApiCommon, GridInfiniteLoaderPrivateApi } from '@mui/x-data-grid/internals';
3
+ import type { GridInitialStatePro, GridStatePro } from "./gridStatePro.js";
4
4
  import type { GridColumnPinningApi, GridDetailPanelApi, GridRowPinningApi, GridDetailPanelPrivateApi } from "../hooks/index.js";
5
5
  import type { GridRowReorderPrivateApi } from "./gridRowReorderApi.js";
6
6
  import type { GridDataSourceApiPro, GridDataSourcePrivateApiPro } from "../hooks/features/dataSource/models.js";
@@ -1,4 +1,4 @@
1
- import { GridFilterModel, GridSortModel } from '@mui/x-data-grid/models';
1
+ import type { GridFilterModel, GridSortModel } from '@mui/x-data-grid/models';
2
2
  /**
3
3
  * Object passed as parameter to the [[onFetchRows]] option.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { GridColDef, GridValidRowModel } from '@mui/x-data-grid';
1
+ import type { GridColDef, GridValidRowModel } from '@mui/x-data-grid';
2
2
  export interface GridGroupingColDefOverride<R extends GridValidRowModel = any> extends Omit<GridColDef<R>, 'editable' | 'valueSetter' | 'field' | 'type' | 'preProcessEditCellProps' | 'renderEditCell' | 'groupable'> {
3
3
  /**
4
4
  * The field from which we want to apply the sorting and the filtering for the grouping column.
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
2
- import { BaseSlots } from '@mui/x-data-grid/internals';
1
+ import type * as React from 'react';
2
+ import type { BaseSlots } from '@mui/x-data-grid/internals';
3
3
  type IconProps = BaseSlots.IconProps;
4
4
  export interface GridProIconSlotsComponent {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { GridSlotsComponentsProps } from '@mui/x-data-grid/internals';
1
+ import type { GridSlotsComponentsProps } from '@mui/x-data-grid/internals';
2
2
  import type { GridHeaderFilterCellProps } from "../components/headerFiltering/GridHeaderFilterCell.js";
3
3
  export interface HeaderFilterCellPropsOverrides {}
4
4
  type SlotProps<Props, Overrides> = Partial<Props & Overrides>;
@@ -1,5 +1,5 @@
1
- import { GridSlotsComponent } from '@mui/x-data-grid';
2
- import { GridProIconSlotsComponent } from "./gridProIconSlotsComponent.js";
1
+ import type { GridSlotsComponent } from '@mui/x-data-grid';
2
+ import type { GridProIconSlotsComponent } from "./gridProIconSlotsComponent.js";
3
3
  /**
4
4
  * Grid components React prop interface containing all the overridable components
5
5
  * for Pro package
@@ -1,4 +1,4 @@
1
- import { GridRowModel, GridRowId } from '@mui/x-data-grid';
1
+ import type { GridRowModel, GridRowId } from '@mui/x-data-grid';
2
2
  /**
3
3
  * Object passed as parameter of the row order change event.
4
4
  * @demos
@@ -1,4 +1,4 @@
1
- import { GridColDef } from '@mui/x-data-grid';
1
+ import type { GridColDef } from '@mui/x-data-grid';
2
2
  /**
3
3
  * Object passed as parameter in the onRowsScrollEnd callback.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { GridInitialState as GridInitialStateCommunity, GridState as GridStateCommunity, GridColumnPinningState, GridPinnedColumnFields } from '@mui/x-data-grid';
1
+ import type { GridInitialState as GridInitialStateCommunity, GridState as GridStateCommunity, GridColumnPinningState, GridPinnedColumnFields } from '@mui/x-data-grid';
2
2
  import type { GridDetailPanelState, GridDetailPanelInitialState, GridColumnReorderState } from "../hooks/index.js";
3
3
  import type { GridDataSourceState } from "../hooks/features/dataSource/models.js";
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "8.26.0",
3
+ "version": "8.27.1",
4
4
  "author": "MUI Team",
5
5
  "description": "The Pro plan edition of the MUI X Data Grid components.",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -37,9 +37,9 @@
37
37
  "@mui/utils": "^7.3.5",
38
38
  "clsx": "^2.1.1",
39
39
  "prop-types": "^15.8.1",
40
- "@mui/x-data-grid": "8.26.0",
41
- "@mui/x-license": "8.26.0",
42
- "@mui/x-internals": "8.26.0"
40
+ "@mui/x-data-grid": "8.27.1",
41
+ "@mui/x-internals": "8.26.0",
42
+ "@mui/x-license": "8.26.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@emotion/react": "^11.9.0",
@@ -1,4 +1,4 @@
1
- import { GridClassKey } from '@mui/x-data-grid';
1
+ import type { GridClassKey } from '@mui/x-data-grid';
2
2
  export interface DataGridProComponentNameToClassKey {
3
3
  MuiDataGrid: GridClassKey;
4
4
  }
@@ -1,5 +1,5 @@
1
- import { ComponentsOverrides, ComponentsProps } from '@mui/material/styles';
2
- import { DataGridProProps } from "../models/dataGridProProps.js";
1
+ import type { ComponentsOverrides, ComponentsProps } from '@mui/material/styles';
2
+ import type { DataGridProProps } from "../models/dataGridProProps.js";
3
3
  export interface DataGridProComponentsPropsList {
4
4
  MuiDataGrid: DataGridProProps;
5
5
  }
@@ -1,9 +1,9 @@
1
- import { GridRowId, GridPinnedColumnFields } from '@mui/x-data-grid';
1
+ import type { GridRowId, GridPinnedColumnFields } from '@mui/x-data-grid';
2
2
  import type { GridRowScrollEndParams, GridRowOrderChangeParams, GridFetchRowsParams } from "../models/index.js";
3
3
  import type { GridRenderHeaderFilterProps } from "../components/headerFiltering/GridHeaderFilterCell.js";
4
4
  import type { GridColumnPinningInternalCache } from "../hooks/features/columnPinning/gridColumnPinningInterface.js";
5
5
  import type { GridCanBeReorderedPreProcessingContext } from "../hooks/features/columnReorder/columnReorderInterfaces.js";
6
- import { GridRowPinningInternalCache } from "../hooks/features/rowPinning/gridRowPinningInterface.js";
6
+ import type { GridRowPinningInternalCache } from "../hooks/features/rowPinning/gridRowPinningInterface.js";
7
7
  export interface GridColDefPro {
8
8
  /**
9
9
  * Allows to render a component in the column header filter cell.
@@ -1,7 +1,7 @@
1
- import { GridRowTreeConfig } from '@mui/x-data-grid';
2
- import { GridRowTreeCreationValue } from '@mui/x-data-grid/internals';
3
- import { RowTreeBuilderNode, GridTreePathDuplicateHandler } from "./models.js";
4
- import { DataGridProProps } from "../../models/dataGridProProps.js";
1
+ import { type GridRowTreeConfig } from '@mui/x-data-grid';
2
+ import { type GridRowTreeCreationValue } from '@mui/x-data-grid/internals';
3
+ import type { RowTreeBuilderNode, GridTreePathDuplicateHandler } from "./models.js";
4
+ import type { DataGridProProps } from "../../models/dataGridProProps.js";
5
5
  interface CreateRowTreeParams {
6
6
  previousTree: GridRowTreeConfig | null;
7
7
  nodes: RowTreeBuilderNode[];
@@ -1,7 +1,7 @@
1
- import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
2
- import { GridTreeDepths } from '@mui/x-data-grid/internals';
3
- import { GridTreePathDuplicateHandler, RowTreeBuilderGroupingCriterion } from "./models.js";
4
- import { DataGridProProps } from "../../models/dataGridProProps.js";
1
+ import { type GridRowId, type GridRowTreeConfig } from '@mui/x-data-grid';
2
+ import type { GridTreeDepths } from '@mui/x-data-grid/internals';
3
+ import type { GridTreePathDuplicateHandler, RowTreeBuilderGroupingCriterion } from "./models.js";
4
+ import type { DataGridProProps } from "../../models/dataGridProProps.js";
5
5
  interface InsertDataRowInTreeParams {
6
6
  /**
7
7
  * ID of the data row to insert in the tree.
@@ -1,4 +1,4 @@
1
- import { GridKeyValue, GridRowId } from '@mui/x-data-grid';
1
+ import type { GridKeyValue, GridRowId } from '@mui/x-data-grid';
2
2
  export interface RowTreeBuilderGroupingCriterion {
3
3
  field: string | null;
4
4
  key: GridKeyValue | null;
@@ -1,5 +1,5 @@
1
- import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
2
- import { GridTreeDepths } from '@mui/x-data-grid/internals';
1
+ import { type GridRowId, type GridRowTreeConfig } from '@mui/x-data-grid';
2
+ import type { GridTreeDepths } from '@mui/x-data-grid/internals';
3
3
  interface RemoveDataRowFromTreeParams {
4
4
  /**
5
5
  * ID of the data row to remove from the tree.
@@ -1,5 +1,5 @@
1
- import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
2
- import { GridSortingModelApplier } from '@mui/x-data-grid/internals';
1
+ import { type GridRowId, type GridRowTreeConfig } from '@mui/x-data-grid';
2
+ import type { GridSortingModelApplier } from '@mui/x-data-grid/internals';
3
3
  interface SortRowTreeParams {
4
4
  rowTree: GridRowTreeConfig;
5
5
  disableChildrenSorting: boolean;
@@ -1,6 +1,6 @@
1
- import { GridGroupNode, GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
2
- import { GridRowTreeCreationValue, GridTreeDepths } from '@mui/x-data-grid/internals';
3
- import { GridTreePathDuplicateHandler, RowTreeBuilderNode } from "./models.js";
1
+ import { type GridGroupNode, type GridRowId, type GridRowTreeConfig } from '@mui/x-data-grid';
2
+ import { type GridRowTreeCreationValue, type GridTreeDepths } from '@mui/x-data-grid/internals';
3
+ import type { GridTreePathDuplicateHandler, RowTreeBuilderNode } from "./models.js";
4
4
  export interface UpdateRowTreeNodes {
5
5
  inserted: RowTreeBuilderNode[];
6
6
  modified: RowTreeBuilderNode[];
@@ -1,7 +1,7 @@
1
- import { GridFilterState, GridGroupNode, GridRowId, GridRowTreeConfig, GridRowsState, GridTreeNode } from '@mui/x-data-grid';
2
- import { GridTreeDepths } from '@mui/x-data-grid/internals';
3
- import { RowTreeBuilderGroupingCriterion } from "./models.js";
4
- import { DataGridProProps } from "../../models/dataGridProProps.js";
1
+ import { type GridFilterState, type GridGroupNode, type GridRowId, type GridRowTreeConfig, type GridRowsState, type GridTreeNode } from '@mui/x-data-grid';
2
+ import type { GridTreeDepths } from '@mui/x-data-grid/internals';
3
+ import type { RowTreeBuilderGroupingCriterion } from "./models.js";
4
+ import type { DataGridProProps } from "../../models/dataGridProProps.js";
5
5
  import type { GridStatePro } from "../../models/gridStatePro.js";
6
6
  export declare const getGroupRowIdFromPath: (path: RowTreeBuilderGroupingCriterion[]) => string;
7
7
  export declare const getNodePathInTree: ({