@mui/x-data-grid-pro 8.27.0 → 8.27.2

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 (28) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/DataGridPro/DataGridPro.js +1 -1
  3. package/components/GridProColumnMenu.d.ts +2 -2
  4. package/components/GridProColumnMenu.js +3 -1
  5. package/components/GridRowReorderCell.js +2 -2
  6. package/components/headerFiltering/GridHeaderFilterCell.js +1 -1
  7. package/esm/DataGridPro/DataGridPro.js +1 -1
  8. package/esm/components/GridProColumnMenu.d.ts +2 -2
  9. package/esm/components/GridProColumnMenu.js +3 -1
  10. package/esm/components/GridRowReorderCell.js +1 -1
  11. package/esm/components/headerFiltering/GridHeaderFilterCell.js +1 -1
  12. package/esm/hooks/features/columnPinning/useGridColumnPinning.js +4 -0
  13. package/esm/hooks/features/lazyLoader/utils.d.ts +20 -5
  14. package/esm/hooks/features/lazyLoader/utils.js +23 -0
  15. package/esm/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.js +23 -28
  16. package/esm/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.js +1 -1
  17. package/esm/hooks/features/serverSideTreeData/utils.d.ts +3 -0
  18. package/esm/hooks/features/serverSideTreeData/utils.js +14 -2
  19. package/esm/index.js +1 -1
  20. package/hooks/features/columnPinning/useGridColumnPinning.js +4 -0
  21. package/hooks/features/lazyLoader/utils.d.ts +20 -5
  22. package/hooks/features/lazyLoader/utils.js +26 -1
  23. package/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.js +23 -28
  24. package/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.js +2 -2
  25. package/hooks/features/serverSideTreeData/utils.d.ts +3 -0
  26. package/hooks/features/serverSideTreeData/utils.js +14 -2
  27. package/index.js +1 -1
  28. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -5,6 +5,131 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.27.2
9
+
10
+ _Feb 20, 2026_
11
+
12
+ We'd like to extend a big thank you to the 3 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🐞 Bugfixes
15
+
16
+ ### Data Grid
17
+
18
+ #### `@mui/x-data-grid@8.27.2`
19
+
20
+ Internal changes.
21
+
22
+ #### `@mui/x-data-grid-pro@8.27.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
23
+
24
+ Same changes as in `@mui/x-data-grid@8.27.2`, plus:
25
+
26
+ - [DataGridPro] Fix number input visibility in header filters (#21345) @michelengelen
27
+
28
+ #### `@mui/x-data-grid-premium@8.27.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
29
+
30
+ Same changes as in `@mui/x-data-grid-pro@8.27.2`.
31
+
32
+ ### Date and Time Pickers
33
+
34
+ #### `@mui/x-date-pickers@8.27.2`
35
+
36
+ - [DatePicker] Add keyboard support for selecting day, month, and year (#21399) @michelengelen
37
+
38
+ #### `@mui/x-date-pickers-pro@8.27.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
39
+
40
+ Same changes as in `@mui/x-date-pickers@8.27.2`, plus:
41
+
42
+ - [DateRangePicker] Fix timezone update issue leading to `invalidRange` error (#21382) @michelengelen
43
+
44
+ ### Charts
45
+
46
+ #### `@mui/x-charts@8.27.2`
47
+
48
+ Internal changes.
49
+
50
+ #### `@mui/x-charts-pro@8.27.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
51
+
52
+ Same changes as in `@mui/x-charts@8.27.2`, plus:
53
+
54
+ - [charts-pro] Handle edge case in export image (#21206) @bernardobelchior
55
+
56
+ #### `@mui/x-charts-premium@8.27.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
57
+
58
+ Same changes as in `@mui/x-charts-pro@8.27.2`.
59
+
60
+ ### Tree View
61
+
62
+ #### `@mui/x-tree-view@8.27.2`
63
+
64
+ - [tree view] Focus item sibling on unmount instead of the 1st item (#21386) @flaviendelangle
65
+
66
+ #### `@mui/x-tree-view-pro@8.27.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
67
+
68
+ Same changes as in `@mui/x-tree-view@8.27.2`.
69
+
70
+ ### Codemod
71
+
72
+ #### `@mui/x-codemod@8.27.2`
73
+
74
+ Internal changes.
75
+
76
+ ### Core
77
+
78
+ - [code-infra] Only ignore `renovate[bot]` in changelog generation script (#21188) @bernardobelchior
79
+
80
+ ## v8.27.1
81
+
82
+ <!-- generated comparing v8.27.0..v8.x -->
83
+
84
+ _Feb 13, 2026_
85
+
86
+ We'd like to extend a big thank you to the 6 contributors who made this release possible. Here are some highlights ✨:
87
+
88
+ - 📝 CSS bundler support is no longer needed for the Data Grid
89
+ - 🐞 Bugfixes
90
+
91
+ Special thanks go out to these community members for their valuable contributions:
92
+ @sai6855
93
+
94
+ The following team members contributed to this release:
95
+ @arminmeh, @cherniavskii, @flaviendelangle, @mj12albert, @MBilalShafi
96
+
97
+ ### Data Grid
98
+
99
+ #### `@mui/x-data-grid@8.27.1`
100
+
101
+ - [DataGrid] Hide column menu icon when there are no items (#21303) @MBilalShafi
102
+ - [DataGrid] Migrate styled imports and remove `index.css` (#21176) @MBilalShafi
103
+ - [DataGrid] Optimize `GridRootStyles` overrides resolver (#21251) @sai6855
104
+
105
+ #### `@mui/x-data-grid-pro@8.27.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
106
+
107
+ Same changes as in `@mui/x-data-grid@8.27.1`, plus:
108
+
109
+ - [DataGridPro] Fix column pinning issue with `restoreState` (#21305) @MBilalShafi
110
+ - [DataGridPro] Fix lazy loading params for page with one row (#21238) @MBilalShafi
111
+ - [DataGridPro] Properly extract parent path (#21301) @arminmeh
112
+
113
+ #### `@mui/x-data-grid-premium@8.27.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
114
+
115
+ Same changes as in `@mui/x-data-grid-pro@8.27.1`, plus:
116
+
117
+ - [DataGridPremium] Fix aggregation display when `initialState` has both `sortModel` and `pinnedColumns` (#21152) @mj12albert
118
+
119
+ ### Tree View
120
+
121
+ #### `@mui/x-tree-view@8.27.1`
122
+
123
+ - [tree view] Fix `apiRef.current.setItemExpansion()` (#21095) @flaviendelangle
124
+
125
+ #### `@mui/x-tree-view-pro@8.27.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
126
+
127
+ Same changes as in `@mui/x-tree-view@8.27.1`.
128
+
129
+ ### Core
130
+
131
+ - [internal] Add CLI for translation using LLM (#21299) @cherniavskii
132
+
8
133
  ## v8.27.0
9
134
 
10
135
  _Feb 2, 2026_
@@ -34,7 +34,7 @@ const configuration = {
34
34
  useFilterValueGetter: apiRef => apiRef.current.getRowValue
35
35
  }
36
36
  };
37
- const releaseInfo = "MTc2OTk5MDQwMDAwMA==";
37
+ const releaseInfo = "MTc3MTU0NTYwMDAwMA==";
38
38
  const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
39
39
  packageName: "x-data-grid-pro",
40
40
  releaseInfo: releaseInfo
@@ -1,4 +1,4 @@
1
- import { type GridColumnMenuProps } from '@mui/x-data-grid';
1
+ import type { GridColumnMenuComponent } from '@mui/x-data-grid/internals';
2
2
  import { GridColumnMenuPinningItem } from "./GridColumnMenuPinningItem.js";
3
3
  export declare const GRID_COLUMN_MENU_SLOTS_PRO: {
4
4
  columnMenuPinningItem: typeof GridColumnMenuPinningItem;
@@ -20,4 +20,4 @@ export declare const GRID_COLUMN_MENU_SLOT_PROPS_PRO: {
20
20
  displayOrder: number;
21
21
  };
22
22
  };
23
- export declare const GridProColumnMenu: import("react").ForwardRefExoticComponent<GridColumnMenuProps> | import("react").ForwardRefExoticComponent<GridColumnMenuProps & import("react").RefAttributes<HTMLUListElement>>;
23
+ export declare const GridProColumnMenu: GridColumnMenuComponent;
@@ -26,4 +26,6 @@ const GridProColumnMenu = exports.GridProColumnMenu = (0, _forwardRef.forwardRef
26
26
  ref: ref
27
27
  }));
28
28
  });
29
- if (process.env.NODE_ENV !== "production") GridProColumnMenu.displayName = "GridProColumnMenu";
29
+ if (process.env.NODE_ENV !== "production") GridProColumnMenu.displayName = "GridProColumnMenu";
30
+ GridProColumnMenu.defaultSlots = GRID_COLUMN_MENU_SLOTS_PRO;
31
+ GridProColumnMenu.defaultSlotProps = GRID_COLUMN_MENU_SLOT_PROPS_PRO;
@@ -11,7 +11,7 @@ exports.renderRowReorderCell = void 0;
11
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
- var _system = require("@mui/system");
14
+ var _styles = require("@mui/material/styles");
15
15
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
16
16
  var _xDataGrid = require("@mui/x-data-grid");
17
17
  var _internals = require("@mui/x-data-grid/internals");
@@ -29,7 +29,7 @@ const useUtilityClasses = ownerState => {
29
29
  };
30
30
  return (0, _composeClasses.default)(slots, _xDataGrid.getDataGridUtilityClass, classes);
31
31
  };
32
- const RowReorderIcon = (0, _system.styled)('svg', {
32
+ const RowReorderIcon = (0, _styles.styled)('svg', {
33
33
  name: 'MuiDataGrid',
34
34
  slot: 'RowReorderIcon'
35
35
  })({
@@ -34,7 +34,7 @@ const StyledInputComponent = (0, _styles.styled)(_xDataGrid.GridFilterInputValue
34
34
  flex: 1,
35
35
  marginRight: _internals.vars.spacing(0.5),
36
36
  marginBottom: _internals.vars.spacing(-0.25),
37
- '& input[type="number"], & input[type="date"], & input[type="datetime-local"]': {
37
+ '& input[type="date"], & input[type="datetime-local"]': {
38
38
  '&[value=""]:not(:focus)': {
39
39
  color: 'transparent'
40
40
  }
@@ -27,7 +27,7 @@ const configuration = {
27
27
  useFilterValueGetter: apiRef => apiRef.current.getRowValue
28
28
  }
29
29
  };
30
- const releaseInfo = "MTc2OTk5MDQwMDAwMA==";
30
+ const releaseInfo = "MTc3MTU0NTYwMDAwMA==";
31
31
  const watermark = /*#__PURE__*/_jsx(Watermark, {
32
32
  packageName: "x-data-grid-pro",
33
33
  releaseInfo: releaseInfo
@@ -1,4 +1,4 @@
1
- import { type GridColumnMenuProps } from '@mui/x-data-grid';
1
+ import type { GridColumnMenuComponent } from '@mui/x-data-grid/internals';
2
2
  import { GridColumnMenuPinningItem } from "./GridColumnMenuPinningItem.js";
3
3
  export declare const GRID_COLUMN_MENU_SLOTS_PRO: {
4
4
  columnMenuPinningItem: typeof GridColumnMenuPinningItem;
@@ -20,4 +20,4 @@ export declare const GRID_COLUMN_MENU_SLOT_PROPS_PRO: {
20
20
  displayOrder: number;
21
21
  };
22
22
  };
23
- export declare const GridProColumnMenu: import("react").ForwardRefExoticComponent<GridColumnMenuProps> | import("react").ForwardRefExoticComponent<GridColumnMenuProps & import("react").RefAttributes<HTMLUListElement>>;
23
+ export declare const GridProColumnMenu: GridColumnMenuComponent;
@@ -20,4 +20,6 @@ export const GridProColumnMenu = forwardRef(function GridProColumnMenu(props, re
20
20
  ref: ref
21
21
  }));
22
22
  });
23
- if (process.env.NODE_ENV !== "production") GridProColumnMenu.displayName = "GridProColumnMenu";
23
+ if (process.env.NODE_ENV !== "production") GridProColumnMenu.displayName = "GridProColumnMenu";
24
+ GridProColumnMenu.defaultSlots = GRID_COLUMN_MENU_SLOTS_PRO;
25
+ GridProColumnMenu.defaultSlotProps = GRID_COLUMN_MENU_SLOT_PROPS_PRO;
@@ -3,7 +3,7 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { styled } from '@mui/system';
6
+ import { styled } from '@mui/material/styles';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { gridSortModelSelector, useGridApiContext, useGridSelector, getDataGridUtilityClass, gridClasses } from '@mui/x-data-grid';
9
9
  import { gridEditRowsStateSelector, isEventTargetInPortal, vars } from '@mui/x-data-grid/internals';
@@ -27,7 +27,7 @@ const StyledInputComponent = styled(GridFilterInputValue, {
27
27
  flex: 1,
28
28
  marginRight: vars.spacing(0.5),
29
29
  marginBottom: vars.spacing(-0.25),
30
- '& input[type="number"], & input[type="date"], & input[type="datetime-local"]': {
30
+ '& input[type="date"], & input[type="datetime-local"]': {
31
31
  '&[value=""]:not(:focus)': {
32
32
  color: 'transparent'
33
33
  }
@@ -104,7 +104,11 @@ export const useGridColumnPinning = (apiRef, props) => {
104
104
  const stateRestorePreProcessing = React.useCallback((params, context) => {
105
105
  const newPinnedColumns = context.stateToRestore.pinnedColumns;
106
106
  if (newPinnedColumns != null) {
107
+ apiRef.current.caches.columnPinning.orderedFieldsBeforePinningColumns = null;
107
108
  setState(apiRef, newPinnedColumns);
109
+ return _extends({}, params, {
110
+ callbacks: [...params.callbacks, () => apiRef.current.requestPipeProcessorsApplication('hydrateColumns')]
111
+ });
108
112
  }
109
113
  return params;
110
114
  }, [apiRef]);
@@ -1,6 +1,23 @@
1
1
  import type { RefObject } from '@mui/x-internals/types';
2
2
  import { type GridRowEntry } from '@mui/x-data-grid';
3
3
  import type { GridPrivateApiPro } from "../../../models/gridApiPro.js";
4
+ interface GridRowRenderContext {
5
+ firstRowIndex: number;
6
+ lastRowIndex: number;
7
+ }
8
+ interface AdjustRowParamsOptions {
9
+ pageSize: number;
10
+ rowCount: number | undefined;
11
+ }
12
+ /**
13
+ * Adjusts the row fetch parameters to align with page boundaries.
14
+ * - Start index is decreased to the start of the page
15
+ * - End index is increased to the end of the page (capped by rowCount - 1 if defined)
16
+ */
17
+ export declare const adjustRowParams: <T extends {
18
+ start: number | string;
19
+ end: number;
20
+ }>(params: T, options: AdjustRowParamsOptions) => T;
4
21
  export declare const findSkeletonRowsSection: ({
5
22
  apiRef,
6
23
  visibleRows,
@@ -8,11 +25,9 @@ export declare const findSkeletonRowsSection: ({
8
25
  }: {
9
26
  apiRef: RefObject<GridPrivateApiPro>;
10
27
  visibleRows: GridRowEntry[];
11
- range: {
12
- firstRowIndex: number;
13
- lastRowIndex: number;
14
- };
28
+ range: GridRowRenderContext;
15
29
  }) => {
16
30
  firstRowIndex: number;
17
31
  lastRowIndex: number;
18
- } | undefined;
32
+ } | undefined;
33
+ export {};
@@ -1,4 +1,27 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import { gridRowNodeSelector } from '@mui/x-data-grid';
3
+ /**
4
+ * Adjusts the row fetch parameters to align with page boundaries.
5
+ * - Start index is decreased to the start of the page
6
+ * - End index is increased to the end of the page (capped by rowCount - 1 if defined)
7
+ */
8
+ export const adjustRowParams = (params, options) => {
9
+ if (typeof params.start !== 'number') {
10
+ return params;
11
+ }
12
+ const {
13
+ pageSize,
14
+ rowCount
15
+ } = options;
16
+ const adjustedStart = params.start - params.start % pageSize;
17
+ const pageAlignedEnd = params.end + pageSize - params.end % pageSize - 1;
18
+ // rowCount of -1 means "unknown/infinite", treat same as undefined (no capping)
19
+ const maxEnd = rowCount !== undefined && rowCount !== -1 ? Math.max(0, rowCount - 1) : Infinity;
20
+ return _extends({}, params, {
21
+ start: adjustedStart,
22
+ end: Math.min(maxEnd, pageAlignedEnd)
23
+ });
24
+ };
2
25
  export const findSkeletonRowsSection = ({
3
26
  apiRef,
4
27
  visibleRows,
@@ -7,7 +7,7 @@ import useEventCallback from '@mui/utils/useEventCallback';
7
7
  import debounce from '@mui/utils/debounce';
8
8
  import { useGridEvent, gridSortModelSelector, gridFilterModelSelector, GRID_ROOT_GROUP_ID, gridPaginationModelSelector, gridFilteredSortedRowIdsSelector, gridRowIdSelector } from '@mui/x-data-grid';
9
9
  import { getVisibleRows, gridRenderContextSelector, GridStrategyGroup, useGridRegisterStrategyProcessor, runIf, DataSourceRowsUpdateStrategy } from '@mui/x-data-grid/internals';
10
- import { findSkeletonRowsSection } from "../lazyLoader/utils.js";
10
+ import { findSkeletonRowsSection, adjustRowParams } from "../lazyLoader/utils.js";
11
11
  import { GRID_SKELETON_ROW_ROOT_ID } from "../lazyLoader/useGridLazyLoaderPreProcessors.js";
12
12
  var LoadingTrigger = /*#__PURE__*/function (LoadingTrigger) {
13
13
  LoadingTrigger[LoadingTrigger["VIEWPORT"] = 0] = "VIEWPORT";
@@ -39,19 +39,6 @@ export const useGridDataSourceLazyLoader = (privateApiRef, props) => {
39
39
  privateApiRef.current.dataSource.fetchRows(GRID_ROOT_GROUP_ID, params);
40
40
  }, [privateApiRef]);
41
41
  const debouncedFetchRows = React.useMemo(() => debounce(fetchRows, 0), [fetchRows]);
42
-
43
- // Adjust the render context range to fit the pagination model's page size
44
- // First row index should be decreased to the start of the page, end row index should be increased to the end of the page
45
- const adjustRowParams = React.useCallback(params => {
46
- if (typeof params.start !== 'number') {
47
- return params;
48
- }
49
- const paginationModel = gridPaginationModelSelector(privateApiRef);
50
- return _extends({}, params, {
51
- start: params.start - params.start % paginationModel.pageSize,
52
- end: params.end + paginationModel.pageSize - params.end % paginationModel.pageSize - 1
53
- });
54
- }, [privateApiRef]);
55
42
  const resetGrid = React.useCallback(() => {
56
43
  privateApiRef.current.setLoading(true);
57
44
  privateApiRef.current.dataSource.cache.clear();
@@ -102,9 +89,13 @@ export const useGridDataSourceLazyLoader = (privateApiRef, props) => {
102
89
  if (rootChildrenCount === 0) {
103
90
  return;
104
91
  }
92
+ const paginationModel = gridPaginationModelSelector(privateApiRef);
105
93
  const pageToSkip = adjustRowParams({
106
94
  start: renderedRowsIntervalCache.current.firstRowToRender,
107
95
  end: renderedRowsIntervalCache.current.lastRowToRender
96
+ }, {
97
+ pageSize: paginationModel.pageSize,
98
+ rowCount: pageRowCount
108
99
  });
109
100
  let hasChanged = false;
110
101
  const isInitialPage = renderedRowsIntervalCache.current.firstRowToRender === 0 && renderedRowsIntervalCache.current.lastRowToRender === 0;
@@ -157,7 +148,7 @@ export const useGridDataSourceLazyLoader = (privateApiRef, props) => {
157
148
  tree
158
149
  })
159
150
  }), 'addSkeletonRows');
160
- }, [privateApiRef, adjustRowParams]);
151
+ }, [privateApiRef]);
161
152
  const updateLoadingTrigger = React.useCallback(rowCount => {
162
153
  const newLoadingTrigger = rowCount === -1 ? LoadingTrigger.SCROLL_END : LoadingTrigger.VIEWPORT;
163
154
  if (loadingTrigger.current !== null) {
@@ -268,43 +259,47 @@ export const useGridDataSourceLazyLoader = (privateApiRef, props) => {
268
259
  filterModel
269
260
  };
270
261
  privateApiRef.current.setLoading(true);
271
- fetchRows(adjustRowParams(getRowsParams));
262
+ fetchRows(adjustRowParams(getRowsParams, {
263
+ pageSize: paginationModel.pageSize,
264
+ rowCount: privateApiRef.current.state.pagination.rowCount
265
+ }));
272
266
  });
273
- const handleRenderedRowsIntervalChange = React.useCallback(params => {
267
+ const handleRenderedRowsIntervalChange = React.useCallback(renderContext => {
274
268
  if (rowsStale.current) {
275
269
  return;
276
270
  }
277
271
  const sortModel = gridSortModelSelector(privateApiRef);
278
272
  const filterModel = gridFilterModelSelector(privateApiRef);
279
273
  const getRowsParams = {
280
- start: params.firstRowIndex,
281
- end: params.lastRowIndex - 1,
274
+ start: renderContext.firstRowIndex,
275
+ end: renderContext.lastRowIndex - 1,
282
276
  sortModel,
283
277
  filterModel
284
278
  };
285
- if (renderedRowsIntervalCache.current.firstRowToRender === params.firstRowIndex && renderedRowsIntervalCache.current.lastRowToRender === params.lastRowIndex) {
279
+ if (renderedRowsIntervalCache.current.firstRowToRender === renderContext.firstRowIndex && renderedRowsIntervalCache.current.lastRowToRender === renderContext.lastRowIndex) {
286
280
  return;
287
281
  }
288
282
  renderedRowsIntervalCache.current = {
289
- firstRowToRender: params.firstRowIndex,
290
- lastRowToRender: params.lastRowIndex
283
+ firstRowToRender: renderContext.firstRowIndex,
284
+ lastRowToRender: renderContext.lastRowIndex
291
285
  };
292
286
  const currentVisibleRows = getVisibleRows(privateApiRef);
293
287
  const skeletonRowsSection = findSkeletonRowsSection({
294
288
  apiRef: privateApiRef,
295
289
  visibleRows: currentVisibleRows.rows,
296
- range: {
297
- firstRowIndex: params.firstRowIndex,
298
- lastRowIndex: params.lastRowIndex - 1
299
- }
290
+ range: renderContext
300
291
  });
301
292
  if (!skeletonRowsSection) {
302
293
  return;
303
294
  }
304
295
  getRowsParams.start = skeletonRowsSection.firstRowIndex;
305
296
  getRowsParams.end = skeletonRowsSection.lastRowIndex;
306
- fetchRows(adjustRowParams(getRowsParams));
307
- }, [privateApiRef, adjustRowParams, fetchRows]);
297
+ const paginationModel = gridPaginationModelSelector(privateApiRef);
298
+ fetchRows(adjustRowParams(getRowsParams, {
299
+ pageSize: paginationModel.pageSize,
300
+ rowCount: privateApiRef.current.state.pagination.rowCount
301
+ }));
302
+ }, [privateApiRef, fetchRows]);
308
303
  const throttledHandleRenderedRowsIntervalChange = React.useMemo(() => throttle(handleRenderedRowsIntervalChange, props.lazyLoadingRequestThrottleMs), [props.lazyLoadingRequestThrottleMs, handleRenderedRowsIntervalChange]);
309
304
  React.useEffect(() => {
310
305
  return () => {
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import { useGridSelector, useGridApiMethod, gridDimensionsSelector } from '@mui/x-data-grid';
5
5
  import { useTimeout, gridHorizontalScrollbarHeightSelector } from '@mui/x-data-grid/internals';
6
6
  import useEventCallback from '@mui/utils/useEventCallback';
7
- import { styled } from '@mui/system';
7
+ import { styled } from '@mui/material/styles';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  const InfiniteLoadingTriggerElement = styled('div', {
10
10
  slot: 'internal',
@@ -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[];
@@ -20,10 +20,22 @@ export function skipSorting(rowTree) {
20
20
  /**
21
21
  * Retrieves the parent path for a row from the previous tree state.
22
22
  * Used during full tree updates to maintain correct hierarchy.
23
+ *
24
+ * Uses the parent node's `path` property, which stores the group keys
25
+ * representing the full path to the parent (i.e. the keys used to fetch the current node).
23
26
  */
24
27
  export function getParentPath(rowId, treeCreationParams) {
25
- if (treeCreationParams.updates.type !== 'full' || !treeCreationParams.previousTree?.[rowId] || treeCreationParams.previousTree[rowId].depth < 1 || !('path' in treeCreationParams.previousTree[rowId])) {
28
+ if (treeCreationParams.updates.type !== 'full' || !treeCreationParams.previousTree?.[rowId] || treeCreationParams.previousTree[rowId].depth < 1) {
26
29
  return [];
27
30
  }
28
- return treeCreationParams.previousTree[rowId].path || [];
31
+ const node = treeCreationParams.previousTree[rowId];
32
+ const parentId = node.parent;
33
+ if (parentId == null) {
34
+ return [];
35
+ }
36
+ const parentNode = treeCreationParams.previousTree[parentId];
37
+ if (parentNode && 'path' in parentNode) {
38
+ return parentNode.path || [];
39
+ }
40
+ return [];
29
41
  }
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v8.27.0
2
+ * @mui/x-data-grid-pro v8.27.2
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
@@ -112,7 +112,11 @@ const useGridColumnPinning = (apiRef, props) => {
112
112
  const stateRestorePreProcessing = React.useCallback((params, context) => {
113
113
  const newPinnedColumns = context.stateToRestore.pinnedColumns;
114
114
  if (newPinnedColumns != null) {
115
+ apiRef.current.caches.columnPinning.orderedFieldsBeforePinningColumns = null;
115
116
  setState(apiRef, newPinnedColumns);
117
+ return (0, _extends2.default)({}, params, {
118
+ callbacks: [...params.callbacks, () => apiRef.current.requestPipeProcessorsApplication('hydrateColumns')]
119
+ });
116
120
  }
117
121
  return params;
118
122
  }, [apiRef]);
@@ -1,6 +1,23 @@
1
1
  import type { RefObject } from '@mui/x-internals/types';
2
2
  import { type GridRowEntry } from '@mui/x-data-grid';
3
3
  import type { GridPrivateApiPro } from "../../../models/gridApiPro.js";
4
+ interface GridRowRenderContext {
5
+ firstRowIndex: number;
6
+ lastRowIndex: number;
7
+ }
8
+ interface AdjustRowParamsOptions {
9
+ pageSize: number;
10
+ rowCount: number | undefined;
11
+ }
12
+ /**
13
+ * Adjusts the row fetch parameters to align with page boundaries.
14
+ * - Start index is decreased to the start of the page
15
+ * - End index is increased to the end of the page (capped by rowCount - 1 if defined)
16
+ */
17
+ export declare const adjustRowParams: <T extends {
18
+ start: number | string;
19
+ end: number;
20
+ }>(params: T, options: AdjustRowParamsOptions) => T;
4
21
  export declare const findSkeletonRowsSection: ({
5
22
  apiRef,
6
23
  visibleRows,
@@ -8,11 +25,9 @@ export declare const findSkeletonRowsSection: ({
8
25
  }: {
9
26
  apiRef: RefObject<GridPrivateApiPro>;
10
27
  visibleRows: GridRowEntry[];
11
- range: {
12
- firstRowIndex: number;
13
- lastRowIndex: number;
14
- };
28
+ range: GridRowRenderContext;
15
29
  }) => {
16
30
  firstRowIndex: number;
17
31
  lastRowIndex: number;
18
- } | undefined;
32
+ } | undefined;
33
+ export {};
@@ -1,10 +1,35 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.findSkeletonRowsSection = void 0;
7
+ exports.findSkeletonRowsSection = exports.adjustRowParams = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
9
  var _xDataGrid = require("@mui/x-data-grid");
10
+ /**
11
+ * Adjusts the row fetch parameters to align with page boundaries.
12
+ * - Start index is decreased to the start of the page
13
+ * - End index is increased to the end of the page (capped by rowCount - 1 if defined)
14
+ */
15
+ const adjustRowParams = (params, options) => {
16
+ if (typeof params.start !== 'number') {
17
+ return params;
18
+ }
19
+ const {
20
+ pageSize,
21
+ rowCount
22
+ } = options;
23
+ const adjustedStart = params.start - params.start % pageSize;
24
+ const pageAlignedEnd = params.end + pageSize - params.end % pageSize - 1;
25
+ // rowCount of -1 means "unknown/infinite", treat same as undefined (no capping)
26
+ const maxEnd = rowCount !== undefined && rowCount !== -1 ? Math.max(0, rowCount - 1) : Infinity;
27
+ return (0, _extends2.default)({}, params, {
28
+ start: adjustedStart,
29
+ end: Math.min(maxEnd, pageAlignedEnd)
30
+ });
31
+ };
32
+ exports.adjustRowParams = adjustRowParams;
8
33
  const findSkeletonRowsSection = ({
9
34
  apiRef,
10
35
  visibleRows,
@@ -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 () => {
@@ -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
  })({
@@ -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
  }
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v8.27.0
2
+ * @mui/x-data-grid-pro v8.27.2
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "8.27.0",
3
+ "version": "8.27.2",
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-internals": "8.26.0",
41
- "@mui/x-data-grid": "8.27.0",
42
- "@mui/x-license": "8.26.0"
40
+ "@mui/x-license": "8.26.0",
41
+ "@mui/x-data-grid": "8.27.1",
42
+ "@mui/x-internals": "8.26.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@emotion/react": "^11.9.0",