@mui/x-data-grid-pro 7.25.0 → 7.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/DataGridPro/DataGridPro.js +11 -4
  3. package/DataGridPro/useDataGridProComponent.js +3 -3
  4. package/components/GridPinnedRows.js +3 -4
  5. package/esm/DataGridPro/DataGridPro.js +11 -4
  6. package/esm/DataGridPro/useDataGridProComponent.js +3 -3
  7. package/esm/components/GridPinnedRows.js +4 -5
  8. package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -7
  9. package/esm/hooks/features/detailPanel/useGridDetailPanel.js +7 -12
  10. package/esm/hooks/features/infiniteLoader/useGridInfiniteLoader.js +6 -6
  11. package/esm/hooks/features/serverSideTreeData/utils.js +2 -3
  12. package/esm/utils/releaseInfo.js +1 -1
  13. package/esm/utils/tree/utils.js +1 -1
  14. package/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -5
  15. package/hooks/features/detailPanel/useGridDetailPanel.js +7 -12
  16. package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -4
  17. package/hooks/features/serverSideTreeData/utils.d.ts +5 -5
  18. package/hooks/features/serverSideTreeData/utils.js +1 -2
  19. package/hooks/utils/useGridApiContext.d.ts +3 -1
  20. package/index.js +1 -1
  21. package/modern/DataGridPro/DataGridPro.js +11 -4
  22. package/modern/DataGridPro/useDataGridProComponent.js +3 -3
  23. package/modern/components/GridPinnedRows.js +4 -5
  24. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -7
  25. package/modern/hooks/features/detailPanel/useGridDetailPanel.js +7 -12
  26. package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +6 -6
  27. package/modern/hooks/features/serverSideTreeData/utils.js +2 -3
  28. package/modern/index.js +1 -1
  29. package/modern/utils/releaseInfo.js +1 -1
  30. package/modern/utils/tree/utils.js +1 -1
  31. package/package.json +4 -4
  32. package/utils/releaseInfo.js +1 -1
  33. package/utils/tree/utils.d.ts +1 -1
  34. package/utils/tree/utils.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,139 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.27.0
7
+
8
+ _Feb 17, 2025_
9
+
10
+ We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - ⚡ Improve Data Grid Excel export serialization performance
13
+ - 🐞 Bugfixes
14
+ - 🌍 Improve Polish (pl-PL) and Ukrainian (uk-UA) locale on the Data Grid
15
+
16
+ Special thanks go out to the community contributors who have helped make this release possible:
17
+ @pawelkula, @Neonin.
18
+ Following are all team members who have contributed to this release:
19
+ @cherniavskii, @JCQuintas, @oliviertassinari, @arminmeh and @LukasTy
20
+
21
+ ### Data Grid
22
+
23
+ #### `@mui/x-data-grid@7.27.0`
24
+
25
+ - [DataGrid] Add `resetPageOnSortFilter` prop that resets the page after sorting and filtering (#16580) @arminmeh
26
+ - [DataGrid] Avoid `undefined` value for pagination `rowCount` (#16558) @cherniavskii
27
+ - [l10n] Improve Polish (pl-PL) locale (#16594) @pawelkula
28
+ - [l10n] Improve Ukrainian (uk-UA) locale (#16593) @Neonin
29
+
30
+ #### `@mui/x-data-grid-pro@7.27.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
31
+
32
+ Same changes as in `@mui/x-data-grid@7.27.0`.
33
+
34
+ #### `@mui/x-data-grid-premium@7.27.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
35
+
36
+ Same changes as in `@mui/x-data-grid-pro@7.27.0`, plus:
37
+
38
+ - [DataGridPremium] Fix Excel export Web Worker demo not working in dev mode (#16532) @cherniavskii
39
+ - [DataGridPremium] Improve Excel export serialization performance (#16545) @cherniavskii
40
+ - [DataGridPremium] Namespace Excel export worker (#16539) @oliviertassinari
41
+
42
+ ### Date and Time Pickers
43
+
44
+ #### `@mui/x-date-pickers@7.27.0`
45
+
46
+ Internal changes.
47
+
48
+ #### `@mui/x-date-pickers-pro@7.27.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
49
+
50
+ Same changes as in `@mui/x-date-pickers@7.27.0`, plus:
51
+
52
+ - [DateRangePicker] Avoid unnecessary field section focusing (#16569) @LukasTy
53
+
54
+ ### Charts
55
+
56
+ #### `@mui/x-charts@7.27.0`
57
+
58
+ Internal changes.
59
+
60
+ #### `@mui/x-charts-pro@7.27.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
61
+
62
+ - [charts-pro] Fix automatic type overloads (#16579) @JCQuintas
63
+
64
+ ### Core
65
+
66
+ - [test] Fix Data Grid data source error test on React 18 (#16565) @arminmeh
67
+
68
+ ## 7.26.0
69
+
70
+ _Feb 7, 2025_
71
+
72
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
73
+
74
+ - ⚡ Mount and resize performance improvements for the Data Grid
75
+ - 🐞 Bugfixes
76
+
77
+ Special thanks go out to the community contributors who have helped make this release possible:
78
+ @lauri865.
79
+ Following are all team members who have contributed to this release:
80
+ @arminmeh, @noraleonte, @LukasTy, @KenanYusuf, @flaviendelangle.
81
+
82
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
83
+
84
+ ### Data Grid
85
+
86
+ #### `@mui/x-data-grid@7.26.0`
87
+
88
+ - [DataGrid] Avoid `<GridRoot />` double-render pass on mount in SPA mode (#16480) @lauri865
89
+
90
+ #### `@mui/x-data-grid-pro@7.26.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
91
+
92
+ Same changes as in `@mui/x-data-grid@7.26.0`, plus:
93
+
94
+ - [DataGridPro] Fix the return type of `useGridApiContext()` for Pro and Premium packages on React < 19 (#16446) @arminmeh
95
+
96
+ #### `@mui/x-data-grid-premium@7.26.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
97
+
98
+ Same changes as in `@mui/x-data-grid-pro@7.26.0`, plus:
99
+
100
+ - [DataGridPremium] Fix "no rows" overlay not showing with active aggregation (#16468) @KenanYusuf
101
+
102
+ ### Date and Time Pickers
103
+
104
+ #### `@mui/x-date-pickers@7.26.0`
105
+
106
+ Internal changes.
107
+
108
+ #### `@mui/x-date-pickers-pro@7.26.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
109
+
110
+ Same changes as in `@mui/x-date-pickers@7.26.0`, plus:
111
+
112
+ - [DateRangePicker] Fix `currentMonthCalendarPosition` prop behavior on mobile (#16457) @LukasTy
113
+ - [DateRangePicker] Fix vertical alignment for multi input fields (#16490) @noraleonte
114
+
115
+ ### Charts
116
+
117
+ #### `@mui/x-charts@7.26.0`
118
+
119
+ Internal changes.
120
+
121
+ #### `@mui/x-charts-pro@7.26.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
122
+
123
+ Same changes as in `@mui/x-charts@7.26.0`.
124
+
125
+ ### Tree View
126
+
127
+ #### `@mui/x-tree-view@7.26.0`
128
+
129
+ Internal changes.
130
+
131
+ #### `@mui/x-tree-view-pro@7.26.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
132
+
133
+ Same changes as in `@mui/x-tree-view@7.26.0`.
134
+
135
+ ### Core
136
+
137
+ - [core] Fix corepack and pnpm installation in CircleCI (#16452) @flaviendelangle
138
+
6
139
  ## 7.25.0
7
140
 
8
141
  _Jan 31, 2025_
@@ -28,6 +28,10 @@ const configuration = {
28
28
  }
29
29
  };
30
30
  const releaseInfo = (0, _releaseInfo.getReleaseInfo)();
31
+ const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
32
+ packageName: "x-data-grid-pro",
33
+ releaseInfo: releaseInfo
34
+ });
31
35
  const DataGridProRaw = (0, _forwardRef.forwardRef)(function DataGridPro(inProps, ref) {
32
36
  const props = (0, _useDataGridProProps.useDataGridProProps)(inProps);
33
37
  const privateApiRef = (0, _useDataGridProComponent.useDataGridProComponent)(props.apiRef, props);
@@ -45,10 +49,7 @@ const DataGridProRaw = (0, _forwardRef.forwardRef)(function DataGridPro(inProps,
45
49
  sx: props.sx
46
50
  }, props.forwardedProps, props.slotProps?.root, {
47
51
  ref: ref,
48
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
49
- packageName: "x-data-grid-pro",
50
- releaseInfo: releaseInfo
51
- })
52
+ children: watermark
52
53
  }))
53
54
  });
54
55
  });
@@ -818,6 +819,12 @@ DataGridProRaw.propTypes = {
818
819
  * @returns {Promise<R> | R} The final values to update the row.
819
820
  */
820
821
  processRowUpdate: _propTypes.default.func,
822
+ /**
823
+ * If `true`, the page is set to 0 after each sorting or filtering.
824
+ * This prop will be removed in the next major version and resetting the page will become the default behavior.
825
+ * @default false
826
+ */
827
+ resetPageOnSortFilter: _propTypes.default.bool,
821
828
  /**
822
829
  * The milliseconds throttle delay for resizing the grid.
823
830
  * @default 60
@@ -44,15 +44,14 @@ const useDataGridProComponent = (inputApiRef, props) => {
44
44
  /**
45
45
  * Register all state initializers here.
46
46
  */
47
- (0, _internals.useGridInitializeState)(_internals.dimensionsStateInitializer, apiRef, props);
48
47
  (0, _internals.useGridInitializeState)(_internals.headerFilteringStateInitializer, apiRef, props);
49
48
  (0, _internals.useGridInitializeState)(_internals.rowSelectionStateInitializer, apiRef, props);
50
49
  (0, _internals.useGridInitializeState)(_useGridDetailPanel.detailPanelStateInitializer, apiRef, props);
51
50
  (0, _internals.useGridInitializeState)(_useGridColumnPinning.columnPinningStateInitializer, apiRef, props);
52
51
  (0, _internals.useGridInitializeState)(_internals.columnsStateInitializer, apiRef, props);
53
52
  (0, _internals.useGridInitializeState)(_useGridRowPinning.rowPinningStateInitializer, apiRef, props);
54
- (0, _internals.useGridInitializeState)(_internals.paginationStateInitializer, apiRef, props);
55
53
  (0, _internals.useGridInitializeState)(_internals.rowsStateInitializer, apiRef, props);
54
+ (0, _internals.useGridInitializeState)(_internals.paginationStateInitializer, apiRef, props);
56
55
  (0, _internals.useGridInitializeState)(_internals.editingStateInitializer, apiRef, props);
57
56
  (0, _internals.useGridInitializeState)(_internals.focusStateInitializer, apiRef, props);
58
57
  (0, _internals.useGridInitializeState)(_internals.sortingStateInitializer, apiRef, props);
@@ -62,11 +61,12 @@ const useDataGridProComponent = (inputApiRef, props) => {
62
61
  (0, _internals.useGridInitializeState)(_internals.densityStateInitializer, apiRef, props);
63
62
  (0, _internals.useGridInitializeState)(_useGridColumnReorder.columnReorderStateInitializer, apiRef, props);
64
63
  (0, _internals.useGridInitializeState)(_internals.columnResizeStateInitializer, apiRef, props);
65
- (0, _internals.useGridInitializeState)(_internals.rowsMetaStateInitializer, apiRef, props);
66
64
  (0, _internals.useGridInitializeState)(_internals.columnMenuStateInitializer, apiRef, props);
67
65
  (0, _internals.useGridInitializeState)(_internals.columnGroupsStateInitializer, apiRef, props);
68
66
  (0, _internals.useGridInitializeState)(_internals.virtualizationStateInitializer, apiRef, props);
69
67
  (0, _internals.useGridInitializeState)(_useGridDataSource.dataSourceStateInitializer, apiRef, props);
68
+ (0, _internals.useGridInitializeState)(_internals.dimensionsStateInitializer, apiRef, props);
69
+ (0, _internals.useGridInitializeState)(_internals.rowsMetaStateInitializer, apiRef, props);
70
70
  (0, _internals.useGridInitializeState)(_internals.listViewStateInitializer, apiRef, props);
71
71
  (0, _internals.useGridHeaderFiltering)(apiRef, props);
72
72
  (0, _useGridTreeData.useGridTreeData)(apiRef, props);
@@ -24,15 +24,14 @@ function GridPinnedRows({
24
24
  }) {
25
25
  const classes = useUtilityClasses();
26
26
  const apiRef = (0, _internals.useGridPrivateApiContext)();
27
- const renderContext = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridRenderContextSelector);
28
27
  const pinnedRowsData = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridPinnedRowsSelector);
29
28
  const rows = pinnedRowsData[position];
30
29
  const pinnedRenderContext = React.useMemo(() => ({
31
30
  firstRowIndex: 0,
32
31
  lastRowIndex: rows.length,
33
- firstColumnIndex: renderContext.firstColumnIndex,
34
- lastColumnIndex: renderContext.lastColumnIndex
35
- }), [rows, renderContext.firstColumnIndex, renderContext.lastColumnIndex]);
32
+ firstColumnIndex: -1,
33
+ lastColumnIndex: -1
34
+ }), [rows]);
36
35
  if (rows.length === 0) {
37
36
  return null;
38
37
  }
@@ -21,6 +21,10 @@ const configuration = {
21
21
  }
22
22
  };
23
23
  const releaseInfo = getReleaseInfo();
24
+ const watermark = /*#__PURE__*/_jsx(Watermark, {
25
+ packageName: "x-data-grid-pro",
26
+ releaseInfo: releaseInfo
27
+ });
24
28
  const DataGridProRaw = forwardRef(function DataGridPro(inProps, ref) {
25
29
  const props = useDataGridProProps(inProps);
26
30
  const privateApiRef = useDataGridProComponent(props.apiRef, props);
@@ -38,10 +42,7 @@ const DataGridProRaw = forwardRef(function DataGridPro(inProps, ref) {
38
42
  sx: props.sx
39
43
  }, props.forwardedProps, props.slotProps?.root, {
40
44
  ref: ref,
41
- children: /*#__PURE__*/_jsx(Watermark, {
42
- packageName: "x-data-grid-pro",
43
- releaseInfo: releaseInfo
44
- })
45
+ children: watermark
45
46
  }))
46
47
  });
47
48
  });
@@ -811,6 +812,12 @@ DataGridProRaw.propTypes = {
811
812
  * @returns {Promise<R> | R} The final values to update the row.
812
813
  */
813
814
  processRowUpdate: PropTypes.func,
815
+ /**
816
+ * If `true`, the page is set to 0 after each sorting or filtering.
817
+ * This prop will be removed in the next major version and resetting the page will become the default behavior.
818
+ * @default false
819
+ */
820
+ resetPageOnSortFilter: PropTypes.bool,
814
821
  /**
815
822
  * The milliseconds throttle delay for resizing the grid.
816
823
  * @default 60
@@ -37,15 +37,14 @@ export const useDataGridProComponent = (inputApiRef, props) => {
37
37
  /**
38
38
  * Register all state initializers here.
39
39
  */
40
- useGridInitializeState(dimensionsStateInitializer, apiRef, props);
41
40
  useGridInitializeState(headerFilteringStateInitializer, apiRef, props);
42
41
  useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
43
42
  useGridInitializeState(detailPanelStateInitializer, apiRef, props);
44
43
  useGridInitializeState(columnPinningStateInitializer, apiRef, props);
45
44
  useGridInitializeState(columnsStateInitializer, apiRef, props);
46
45
  useGridInitializeState(rowPinningStateInitializer, apiRef, props);
47
- useGridInitializeState(paginationStateInitializer, apiRef, props);
48
46
  useGridInitializeState(rowsStateInitializer, apiRef, props);
47
+ useGridInitializeState(paginationStateInitializer, apiRef, props);
49
48
  useGridInitializeState(editingStateInitializer, apiRef, props);
50
49
  useGridInitializeState(focusStateInitializer, apiRef, props);
51
50
  useGridInitializeState(sortingStateInitializer, apiRef, props);
@@ -55,11 +54,12 @@ export const useDataGridProComponent = (inputApiRef, props) => {
55
54
  useGridInitializeState(densityStateInitializer, apiRef, props);
56
55
  useGridInitializeState(columnReorderStateInitializer, apiRef, props);
57
56
  useGridInitializeState(columnResizeStateInitializer, apiRef, props);
58
- useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
59
57
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
60
58
  useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
61
59
  useGridInitializeState(virtualizationStateInitializer, apiRef, props);
62
60
  useGridInitializeState(dataSourceStateInitializer, apiRef, props);
61
+ useGridInitializeState(dimensionsStateInitializer, apiRef, props);
62
+ useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
63
63
  useGridInitializeState(listViewStateInitializer, apiRef, props);
64
64
  useGridHeaderFiltering(apiRef, props);
65
65
  useGridTreeData(apiRef, props);
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import clsx from 'clsx';
3
3
  import composeClasses from '@mui/utils/composeClasses';
4
4
  import { getDataGridUtilityClass, gridClasses, useGridSelector } from '@mui/x-data-grid';
5
- import { gridPinnedRowsSelector, gridRenderContextSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
5
+ import { gridPinnedRowsSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const useUtilityClasses = () => {
8
8
  const slots = {
@@ -16,15 +16,14 @@ export function GridPinnedRows({
16
16
  }) {
17
17
  const classes = useUtilityClasses();
18
18
  const apiRef = useGridPrivateApiContext();
19
- const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
20
19
  const pinnedRowsData = useGridSelector(apiRef, gridPinnedRowsSelector);
21
20
  const rows = pinnedRowsData[position];
22
21
  const pinnedRenderContext = React.useMemo(() => ({
23
22
  firstRowIndex: 0,
24
23
  lastRowIndex: rows.length,
25
- firstColumnIndex: renderContext.firstColumnIndex,
26
- lastColumnIndex: renderContext.lastColumnIndex
27
- }), [rows, renderContext.firstColumnIndex, renderContext.lastColumnIndex]);
24
+ firstColumnIndex: -1,
25
+ lastColumnIndex: -1
26
+ }), [rows]);
28
27
  if (rows.length === 0) {
29
28
  return null;
30
29
  }
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["getColumnsToRender", "getPinnedCellOffset", "renderContext", "leftRenderContext", "rightRenderContext", "pinnedColumns", "visibleColumns", "columnPositions"];
4
4
  import * as React from 'react';
5
- import { gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, gridTabIndexColumnHeaderFilterSelector, getDataGridUtilityClass, gridDimensionsSelector } from '@mui/x-data-grid';
6
- import { useGridColumnHeaders as useGridColumnHeadersCommunity, useGridPrivateApiContext, getGridFilter, GridColumnHeaderRow, shouldCellShowLeftBorder, shouldCellShowRightBorder, PinnedColumnPosition } from '@mui/x-data-grid/internals';
5
+ import { gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, gridTabIndexColumnHeaderFilterSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
6
+ import { gridColumnsTotalWidthSelector, gridHasFillerSelector, gridHeaderFilterHeightSelector, gridVerticalScrollbarWidthSelector, useGridColumnHeaders as useGridColumnHeadersCommunity, useGridPrivateApiContext, getGridFilter, GridColumnHeaderRow, shouldCellShowLeftBorder, shouldCellShowRightBorder, PinnedColumnPosition } from '@mui/x-data-grid/internals';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { useGridRootProps } from "../../utils/useGridRootProps.js";
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -48,9 +48,11 @@ export const useGridColumnHeaders = props => {
48
48
  const rootProps = useGridRootProps();
49
49
  const classes = useUtilityClasses(rootProps);
50
50
  const disableHeaderFiltering = !rootProps.headerFilters;
51
- const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
52
51
  const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
53
- const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
52
+ const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
53
+ const gridHasFiller = useGridSelector(apiRef, gridHasFillerSelector);
54
+ const headerFilterHeight = useGridSelector(apiRef, gridHeaderFilterHeightSelector);
55
+ const scrollbarWidth = useGridSelector(apiRef, gridVerticalScrollbarWidthSelector);
54
56
  const columnHeaderFilterFocus = useGridSelector(apiRef, gridFocusColumnHeaderFilterSelector);
55
57
  const getFilterItem = React.useCallback(colDef => {
56
58
  const filterModelItem = filterModel?.items.find(it => it.field === colDef.field && it.operator !== 'isAnyOf');
@@ -87,15 +89,14 @@ export const useGridColumnHeaders = props => {
87
89
  }) : colDef.headerClassName;
88
90
  const item = getFilterItem(colDef);
89
91
  const pinnedPosition = params?.position;
90
- const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
91
- const pinnedOffset = getPinnedCellOffset(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, dimensions.columnsTotalWidth, scrollbarWidth);
92
+ const pinnedOffset = getPinnedCellOffset(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, columnsTotalWidth, scrollbarWidth);
92
93
  const indexInSection = i;
93
94
  const sectionLength = renderedColumns.length;
94
95
  const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
95
96
  const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
96
97
  filters.push(/*#__PURE__*/_jsx(rootProps.slots.headerFilterCell, _extends({
97
98
  colIndex: columnIndex,
98
- height: dimensions.headerFilterHeight,
99
+ height: headerFilterHeight,
99
100
  width: colDef.computedWidth,
100
101
  colDef: colDef,
101
102
  hasFocus: hasFocus,
@@ -4,9 +4,6 @@ import { useGridSelector, useGridApiEventHandler, useGridApiMethod, gridDataRowI
4
4
  import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
5
5
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "./gridDetailPanelToggleColDef.js";
6
6
  import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelRawHeightCacheSelector } from "./gridDetailPanelSelector.js";
7
- // FIXME: calling `api.updateDimensions()` here triggers a cycle where `updateDimensions` is
8
- // called 3 times when opening/closing a panel.
9
-
10
7
  export const detailPanelStateInitializer = (state, props) => {
11
8
  return _extends({}, state, {
12
9
  detailPanel: {
@@ -101,8 +98,6 @@ export const useGridDetailPanel = (apiRef, props) => {
101
98
  })
102
99
  });
103
100
  });
104
- apiRef.current.updateDimensions();
105
- apiRef.current.forceUpdate();
106
101
  }, [apiRef]);
107
102
  const storeDetailPanelHeight = React.useCallback((id, height) => {
108
103
  const heightCache = gridDetailPanelRawHeightCacheSelector(apiRef.current.state);
@@ -120,7 +115,6 @@ export const useGridDetailPanel = (apiRef, props) => {
120
115
  })
121
116
  });
122
117
  });
123
- apiRef.current.updateDimensions();
124
118
  apiRef.current.requestPipeProcessorsApplication('rowHeight');
125
119
  }, [apiRef]);
126
120
  const detailPanelHasAutoHeight = React.useCallback(id => {
@@ -147,17 +141,19 @@ export const useGridDetailPanel = (apiRef, props) => {
147
141
  }
148
142
  }, [apiRef, props.detailPanelExpandedRowIds]);
149
143
  const updateCachesAndForceUpdate = React.useCallback(() => {
144
+ if (!props.getDetailPanelContent) {
145
+ return;
146
+ }
150
147
  apiRef.current.setState(state => {
151
148
  return _extends({}, state, {
152
149
  detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
153
150
  });
154
151
  });
155
- apiRef.current.updateDimensions?.();
156
152
  apiRef.current.forceUpdate();
157
153
  }, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
158
154
  useGridApiEventHandler(apiRef, 'sortedRowsSet', updateCachesAndForceUpdate);
159
- const previousGetDetailPanelContentProp = React.useRef(null);
160
- const previousGetDetailPanelHeightProp = React.useRef(null);
155
+ const previousGetDetailPanelContentProp = React.useRef(undefined);
156
+ const previousGetDetailPanelHeightProp = React.useRef(undefined);
161
157
  const updateCachesIfNeeded = React.useCallback(() => {
162
158
  if (props.getDetailPanelContent === previousGetDetailPanelContentProp.current && props.getDetailPanelHeight === previousGetDetailPanelHeightProp.current) {
163
159
  return;
@@ -167,7 +163,6 @@ export const useGridDetailPanel = (apiRef, props) => {
167
163
  detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
168
164
  });
169
165
  });
170
- apiRef.current.updateDimensions?.();
171
166
  previousGetDetailPanelContentProp.current = props.getDetailPanelContent;
172
167
  previousGetDetailPanelHeightProp.current = props.getDetailPanelHeight;
173
168
  }, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
@@ -181,7 +176,8 @@ export const useGridDetailPanel = (apiRef, props) => {
181
176
  initialValue.detail = heightCache[row.id] ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
182
177
  return initialValue;
183
178
  }, [apiRef, expandedRowIds, updateCachesIfNeeded]);
184
- useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
179
+ const enabled = props.getDetailPanelContent !== undefined;
180
+ useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight, enabled);
185
181
  const isFirstRender = React.useRef(true);
186
182
  if (isFirstRender.current) {
187
183
  updateCachesIfNeeded();
@@ -189,7 +185,6 @@ export const useGridDetailPanel = (apiRef, props) => {
189
185
  React.useEffect(() => {
190
186
  if (!isFirstRender.current) {
191
187
  updateCachesIfNeeded();
192
- apiRef.current.hydrateRowsMeta();
193
188
  }
194
189
  isFirstRender.current = false;
195
190
  }, [apiRef, updateCachesIfNeeded]);
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { useGridSelector, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, useGridApiMethod, gridDimensionsSelector } from '@mui/x-data-grid';
3
- import { useGridVisibleRows, useTimeout } from '@mui/x-data-grid/internals';
2
+ import { useGridSelector, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, useGridApiMethod } from '@mui/x-data-grid';
3
+ import { useGridVisibleRows, useTimeout, gridHorizontalScrollbarHeightSelector } from '@mui/x-data-grid/internals';
4
4
  import useEventCallback from '@mui/utils/useEventCallback';
5
5
  import { styled } from '@mui/system';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -39,10 +39,8 @@ export const useGridInfiniteLoader = (apiRef, props) => {
39
39
  triggerElement.current = null;
40
40
  }
41
41
  });
42
- const virtualScroller = apiRef.current.virtualScrollerRef.current;
43
- const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
44
- const marginBottom = props.scrollEndThreshold - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
45
42
  React.useEffect(() => {
43
+ const virtualScroller = apiRef.current.virtualScrollerRef.current;
46
44
  if (!isEnabled) {
47
45
  return;
48
46
  }
@@ -50,6 +48,8 @@ export const useGridInfiniteLoader = (apiRef, props) => {
50
48
  return;
51
49
  }
52
50
  observer.current?.disconnect();
51
+ const horizontalScrollbarHeight = gridHorizontalScrollbarHeightSelector(apiRef.current.state);
52
+ const marginBottom = props.scrollEndThreshold - horizontalScrollbarHeight;
53
53
  observer.current = new IntersectionObserver(handleLoadMoreRows, {
54
54
  threshold: 1,
55
55
  root: virtualScroller,
@@ -58,7 +58,7 @@ export const useGridInfiniteLoader = (apiRef, props) => {
58
58
  if (triggerElement.current) {
59
59
  observer.current.observe(triggerElement.current);
60
60
  }
61
- }, [virtualScroller, handleLoadMoreRows, isEnabled, marginBottom]);
61
+ }, [apiRef, handleLoadMoreRows, isEnabled, props.scrollEndThreshold]);
62
62
  const updateTarget = node => {
63
63
  if (triggerElement.current !== node) {
64
64
  observer.current?.disconnect();
@@ -1,9 +1,8 @@
1
1
  import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
2
- import { getTreeNodeDescendants } from '@mui/x-data-grid/internals';
2
+ import { defaultGridFilterLookup, getTreeNodeDescendants } from '@mui/x-data-grid/internals';
3
3
  export function skipFiltering(rowTree) {
4
4
  const filteredRowsLookup = {};
5
5
  const filteredChildrenCountLookup = {};
6
- const filteredDescendantCountLookup = {};
7
6
  const nodes = Object.values(rowTree);
8
7
  for (let i = 0; i < nodes.length; i += 1) {
9
8
  const node = nodes[i];
@@ -13,7 +12,7 @@ export function skipFiltering(rowTree) {
13
12
  return {
14
13
  filteredRowsLookup,
15
14
  filteredChildrenCountLookup,
16
- filteredDescendantCountLookup
15
+ filteredDescendantCountLookup: defaultGridFilterLookup.filteredDescendantCountLookup
17
16
  };
18
17
  }
19
18
  export function skipSorting(rowTree) {
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczODI5OTYwMDAwMA==";
3
+ const releaseInfo = "MTczOTc0NjgwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -166,7 +166,7 @@ export const getVisibleRowsLookup = ({
166
166
  }
167
167
  const visibleRowsLookup = {};
168
168
  const handleTreeNode = (node, areAncestorsExpanded) => {
169
- const isPassingFiltering = filteredRowsLookup[node.id];
169
+ const isPassingFiltering = filteredRowsLookup[node.id] !== false;
170
170
  if (node.type === 'group') {
171
171
  node.children.forEach(childId => {
172
172
  const childNode = tree[childId];
@@ -56,9 +56,11 @@ const useGridColumnHeaders = props => {
56
56
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
57
57
  const classes = useUtilityClasses(rootProps);
58
58
  const disableHeaderFiltering = !rootProps.headerFilters;
59
- const dimensions = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridDimensionsSelector);
60
59
  const filterModel = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridFilterModelSelector);
61
- const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
60
+ const columnsTotalWidth = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridColumnsTotalWidthSelector);
61
+ const gridHasFiller = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridHasFillerSelector);
62
+ const headerFilterHeight = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridHeaderFilterHeightSelector);
63
+ const scrollbarWidth = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridVerticalScrollbarWidthSelector);
62
64
  const columnHeaderFilterFocus = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridFocusColumnHeaderFilterSelector);
63
65
  const getFilterItem = React.useCallback(colDef => {
64
66
  const filterModelItem = filterModel?.items.find(it => it.field === colDef.field && it.operator !== 'isAnyOf');
@@ -95,15 +97,14 @@ const useGridColumnHeaders = props => {
95
97
  }) : colDef.headerClassName;
96
98
  const item = getFilterItem(colDef);
97
99
  const pinnedPosition = params?.position;
98
- const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
99
- const pinnedOffset = getPinnedCellOffset(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, dimensions.columnsTotalWidth, scrollbarWidth);
100
+ const pinnedOffset = getPinnedCellOffset(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, columnsTotalWidth, scrollbarWidth);
100
101
  const indexInSection = i;
101
102
  const sectionLength = renderedColumns.length;
102
103
  const showLeftBorder = (0, _internals.shouldCellShowLeftBorder)(pinnedPosition, indexInSection);
103
104
  const showRightBorder = (0, _internals.shouldCellShowRightBorder)(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
104
105
  filters.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.headerFilterCell, (0, _extends2.default)({
105
106
  colIndex: columnIndex,
106
- height: dimensions.headerFilterHeight,
107
+ height: headerFilterHeight,
107
108
  width: colDef.computedWidth,
108
109
  colDef: colDef,
109
110
  hasFocus: hasFocus,
@@ -12,9 +12,6 @@ var _xDataGrid = require("@mui/x-data-grid");
12
12
  var _internals = require("@mui/x-data-grid/internals");
13
13
  var _gridDetailPanelToggleColDef = require("./gridDetailPanelToggleColDef");
14
14
  var _gridDetailPanelSelector = require("./gridDetailPanelSelector");
15
- // FIXME: calling `api.updateDimensions()` here triggers a cycle where `updateDimensions` is
16
- // called 3 times when opening/closing a panel.
17
-
18
15
  const detailPanelStateInitializer = (state, props) => {
19
16
  return (0, _extends2.default)({}, state, {
20
17
  detailPanel: {
@@ -110,8 +107,6 @@ const useGridDetailPanel = (apiRef, props) => {
110
107
  })
111
108
  });
112
109
  });
113
- apiRef.current.updateDimensions();
114
- apiRef.current.forceUpdate();
115
110
  }, [apiRef]);
116
111
  const storeDetailPanelHeight = React.useCallback((id, height) => {
117
112
  const heightCache = (0, _gridDetailPanelSelector.gridDetailPanelRawHeightCacheSelector)(apiRef.current.state);
@@ -129,7 +124,6 @@ const useGridDetailPanel = (apiRef, props) => {
129
124
  })
130
125
  });
131
126
  });
132
- apiRef.current.updateDimensions();
133
127
  apiRef.current.requestPipeProcessorsApplication('rowHeight');
134
128
  }, [apiRef]);
135
129
  const detailPanelHasAutoHeight = React.useCallback(id => {
@@ -156,17 +150,19 @@ const useGridDetailPanel = (apiRef, props) => {
156
150
  }
157
151
  }, [apiRef, props.detailPanelExpandedRowIds]);
158
152
  const updateCachesAndForceUpdate = React.useCallback(() => {
153
+ if (!props.getDetailPanelContent) {
154
+ return;
155
+ }
159
156
  apiRef.current.setState(state => {
160
157
  return (0, _extends2.default)({}, state, {
161
158
  detailPanel: (0, _extends2.default)({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
162
159
  });
163
160
  });
164
- apiRef.current.updateDimensions?.();
165
161
  apiRef.current.forceUpdate();
166
162
  }, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
167
163
  (0, _xDataGrid.useGridApiEventHandler)(apiRef, 'sortedRowsSet', updateCachesAndForceUpdate);
168
- const previousGetDetailPanelContentProp = React.useRef(null);
169
- const previousGetDetailPanelHeightProp = React.useRef(null);
164
+ const previousGetDetailPanelContentProp = React.useRef(undefined);
165
+ const previousGetDetailPanelHeightProp = React.useRef(undefined);
170
166
  const updateCachesIfNeeded = React.useCallback(() => {
171
167
  if (props.getDetailPanelContent === previousGetDetailPanelContentProp.current && props.getDetailPanelHeight === previousGetDetailPanelHeightProp.current) {
172
168
  return;
@@ -176,7 +172,6 @@ const useGridDetailPanel = (apiRef, props) => {
176
172
  detailPanel: (0, _extends2.default)({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
177
173
  });
178
174
  });
179
- apiRef.current.updateDimensions?.();
180
175
  previousGetDetailPanelContentProp.current = props.getDetailPanelContent;
181
176
  previousGetDetailPanelHeightProp.current = props.getDetailPanelHeight;
182
177
  }, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
@@ -190,7 +185,8 @@ const useGridDetailPanel = (apiRef, props) => {
190
185
  initialValue.detail = heightCache[row.id] ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
191
186
  return initialValue;
192
187
  }, [apiRef, expandedRowIds, updateCachesIfNeeded]);
193
- (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'rowHeight', addDetailHeight);
188
+ const enabled = props.getDetailPanelContent !== undefined;
189
+ (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'rowHeight', addDetailHeight, enabled);
194
190
  const isFirstRender = React.useRef(true);
195
191
  if (isFirstRender.current) {
196
192
  updateCachesIfNeeded();
@@ -198,7 +194,6 @@ const useGridDetailPanel = (apiRef, props) => {
198
194
  React.useEffect(() => {
199
195
  if (!isFirstRender.current) {
200
196
  updateCachesIfNeeded();
201
- apiRef.current.hydrateRowsMeta();
202
197
  }
203
198
  isFirstRender.current = false;
204
199
  }, [apiRef, updateCachesIfNeeded]);
@@ -47,10 +47,8 @@ const useGridInfiniteLoader = (apiRef, props) => {
47
47
  triggerElement.current = null;
48
48
  }
49
49
  });
50
- const virtualScroller = apiRef.current.virtualScrollerRef.current;
51
- const dimensions = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridDimensionsSelector);
52
- const marginBottom = props.scrollEndThreshold - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
53
50
  React.useEffect(() => {
51
+ const virtualScroller = apiRef.current.virtualScrollerRef.current;
54
52
  if (!isEnabled) {
55
53
  return;
56
54
  }
@@ -58,6 +56,8 @@ const useGridInfiniteLoader = (apiRef, props) => {
58
56
  return;
59
57
  }
60
58
  observer.current?.disconnect();
59
+ const horizontalScrollbarHeight = (0, _internals.gridHorizontalScrollbarHeightSelector)(apiRef.current.state);
60
+ const marginBottom = props.scrollEndThreshold - horizontalScrollbarHeight;
61
61
  observer.current = new IntersectionObserver(handleLoadMoreRows, {
62
62
  threshold: 1,
63
63
  root: virtualScroller,
@@ -66,7 +66,7 @@ const useGridInfiniteLoader = (apiRef, props) => {
66
66
  if (triggerElement.current) {
67
67
  observer.current.observe(triggerElement.current);
68
68
  }
69
- }, [virtualScroller, handleLoadMoreRows, isEnabled, marginBottom]);
69
+ }, [apiRef, handleLoadMoreRows, isEnabled, props.scrollEndThreshold]);
70
70
  const updateTarget = node => {
71
71
  if (triggerElement.current !== node) {
72
72
  observer.current?.disconnect();
@@ -1,7 +1,7 @@
1
- import { GridRowId, GridRowTreeConfig } from '@mui/x-data-grid';
1
+ import { GridRowTreeConfig } from '@mui/x-data-grid';
2
2
  export declare function skipFiltering(rowTree: GridRowTreeConfig): {
3
- filteredRowsLookup: Record<GridRowId, boolean>;
4
- filteredChildrenCountLookup: Record<GridRowId, number>;
5
- filteredDescendantCountLookup: Record<GridRowId, number>;
3
+ filteredRowsLookup: Record<import("@mui/x-data-grid").GridRowId, boolean>;
4
+ filteredChildrenCountLookup: Record<import("@mui/x-data-grid").GridRowId, number>;
5
+ filteredDescendantCountLookup: {};
6
6
  };
7
- export declare function skipSorting(rowTree: GridRowTreeConfig): GridRowId[];
7
+ export declare function skipSorting(rowTree: GridRowTreeConfig): import("@mui/x-data-grid").GridRowId[];
@@ -10,7 +10,6 @@ var _internals = require("@mui/x-data-grid/internals");
10
10
  function skipFiltering(rowTree) {
11
11
  const filteredRowsLookup = {};
12
12
  const filteredChildrenCountLookup = {};
13
- const filteredDescendantCountLookup = {};
14
13
  const nodes = Object.values(rowTree);
15
14
  for (let i = 0; i < nodes.length; i += 1) {
16
15
  const node = nodes[i];
@@ -20,7 +19,7 @@ function skipFiltering(rowTree) {
20
19
  return {
21
20
  filteredRowsLookup,
22
21
  filteredChildrenCountLookup,
23
- filteredDescendantCountLookup
22
+ filteredDescendantCountLookup: _internals.defaultGridFilterLookup.filteredDescendantCountLookup
24
23
  };
25
24
  }
26
25
  function skipSorting(rowTree) {
@@ -1,2 +1,4 @@
1
+ import { RefObject } from '@mui/x-internals/types';
2
+ import { GridApiCommon } from '@mui/x-data-grid';
1
3
  import { GridApiPro } from '../../models/gridApiPro';
2
- export declare const useGridApiContext: () => import("react").RefObject<GridApiPro>;
4
+ export declare const useGridApiContext: <Api extends GridApiCommon = GridApiPro>() => RefObject<Api>;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v7.25.0
2
+ * @mui/x-data-grid-pro v7.27.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -21,6 +21,10 @@ const configuration = {
21
21
  }
22
22
  };
23
23
  const releaseInfo = getReleaseInfo();
24
+ const watermark = /*#__PURE__*/_jsx(Watermark, {
25
+ packageName: "x-data-grid-pro",
26
+ releaseInfo: releaseInfo
27
+ });
24
28
  const DataGridProRaw = forwardRef(function DataGridPro(inProps, ref) {
25
29
  const props = useDataGridProProps(inProps);
26
30
  const privateApiRef = useDataGridProComponent(props.apiRef, props);
@@ -38,10 +42,7 @@ const DataGridProRaw = forwardRef(function DataGridPro(inProps, ref) {
38
42
  sx: props.sx
39
43
  }, props.forwardedProps, props.slotProps?.root, {
40
44
  ref: ref,
41
- children: /*#__PURE__*/_jsx(Watermark, {
42
- packageName: "x-data-grid-pro",
43
- releaseInfo: releaseInfo
44
- })
45
+ children: watermark
45
46
  }))
46
47
  });
47
48
  });
@@ -811,6 +812,12 @@ DataGridProRaw.propTypes = {
811
812
  * @returns {Promise<R> | R} The final values to update the row.
812
813
  */
813
814
  processRowUpdate: PropTypes.func,
815
+ /**
816
+ * If `true`, the page is set to 0 after each sorting or filtering.
817
+ * This prop will be removed in the next major version and resetting the page will become the default behavior.
818
+ * @default false
819
+ */
820
+ resetPageOnSortFilter: PropTypes.bool,
814
821
  /**
815
822
  * The milliseconds throttle delay for resizing the grid.
816
823
  * @default 60
@@ -37,15 +37,14 @@ export const useDataGridProComponent = (inputApiRef, props) => {
37
37
  /**
38
38
  * Register all state initializers here.
39
39
  */
40
- useGridInitializeState(dimensionsStateInitializer, apiRef, props);
41
40
  useGridInitializeState(headerFilteringStateInitializer, apiRef, props);
42
41
  useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
43
42
  useGridInitializeState(detailPanelStateInitializer, apiRef, props);
44
43
  useGridInitializeState(columnPinningStateInitializer, apiRef, props);
45
44
  useGridInitializeState(columnsStateInitializer, apiRef, props);
46
45
  useGridInitializeState(rowPinningStateInitializer, apiRef, props);
47
- useGridInitializeState(paginationStateInitializer, apiRef, props);
48
46
  useGridInitializeState(rowsStateInitializer, apiRef, props);
47
+ useGridInitializeState(paginationStateInitializer, apiRef, props);
49
48
  useGridInitializeState(editingStateInitializer, apiRef, props);
50
49
  useGridInitializeState(focusStateInitializer, apiRef, props);
51
50
  useGridInitializeState(sortingStateInitializer, apiRef, props);
@@ -55,11 +54,12 @@ export const useDataGridProComponent = (inputApiRef, props) => {
55
54
  useGridInitializeState(densityStateInitializer, apiRef, props);
56
55
  useGridInitializeState(columnReorderStateInitializer, apiRef, props);
57
56
  useGridInitializeState(columnResizeStateInitializer, apiRef, props);
58
- useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
59
57
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
60
58
  useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
61
59
  useGridInitializeState(virtualizationStateInitializer, apiRef, props);
62
60
  useGridInitializeState(dataSourceStateInitializer, apiRef, props);
61
+ useGridInitializeState(dimensionsStateInitializer, apiRef, props);
62
+ useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
63
63
  useGridInitializeState(listViewStateInitializer, apiRef, props);
64
64
  useGridHeaderFiltering(apiRef, props);
65
65
  useGridTreeData(apiRef, props);
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import clsx from 'clsx';
3
3
  import composeClasses from '@mui/utils/composeClasses';
4
4
  import { getDataGridUtilityClass, gridClasses, useGridSelector } from '@mui/x-data-grid';
5
- import { gridPinnedRowsSelector, gridRenderContextSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
5
+ import { gridPinnedRowsSelector, useGridPrivateApiContext } from '@mui/x-data-grid/internals';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const useUtilityClasses = () => {
8
8
  const slots = {
@@ -16,15 +16,14 @@ export function GridPinnedRows({
16
16
  }) {
17
17
  const classes = useUtilityClasses();
18
18
  const apiRef = useGridPrivateApiContext();
19
- const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
20
19
  const pinnedRowsData = useGridSelector(apiRef, gridPinnedRowsSelector);
21
20
  const rows = pinnedRowsData[position];
22
21
  const pinnedRenderContext = React.useMemo(() => ({
23
22
  firstRowIndex: 0,
24
23
  lastRowIndex: rows.length,
25
- firstColumnIndex: renderContext.firstColumnIndex,
26
- lastColumnIndex: renderContext.lastColumnIndex
27
- }), [rows, renderContext.firstColumnIndex, renderContext.lastColumnIndex]);
24
+ firstColumnIndex: -1,
25
+ lastColumnIndex: -1
26
+ }), [rows]);
28
27
  if (rows.length === 0) {
29
28
  return null;
30
29
  }
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["getColumnsToRender", "getPinnedCellOffset", "renderContext", "leftRenderContext", "rightRenderContext", "pinnedColumns", "visibleColumns", "columnPositions"];
4
4
  import * as React from 'react';
5
- import { gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, gridTabIndexColumnHeaderFilterSelector, getDataGridUtilityClass, gridDimensionsSelector } from '@mui/x-data-grid';
6
- import { useGridColumnHeaders as useGridColumnHeadersCommunity, useGridPrivateApiContext, getGridFilter, GridColumnHeaderRow, shouldCellShowLeftBorder, shouldCellShowRightBorder, PinnedColumnPosition } from '@mui/x-data-grid/internals';
5
+ import { gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, gridTabIndexColumnHeaderFilterSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
6
+ import { gridColumnsTotalWidthSelector, gridHasFillerSelector, gridHeaderFilterHeightSelector, gridVerticalScrollbarWidthSelector, useGridColumnHeaders as useGridColumnHeadersCommunity, useGridPrivateApiContext, getGridFilter, GridColumnHeaderRow, shouldCellShowLeftBorder, shouldCellShowRightBorder, PinnedColumnPosition } from '@mui/x-data-grid/internals';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { useGridRootProps } from "../../utils/useGridRootProps.js";
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -48,9 +48,11 @@ export const useGridColumnHeaders = props => {
48
48
  const rootProps = useGridRootProps();
49
49
  const classes = useUtilityClasses(rootProps);
50
50
  const disableHeaderFiltering = !rootProps.headerFilters;
51
- const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
52
51
  const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
53
- const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
52
+ const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
53
+ const gridHasFiller = useGridSelector(apiRef, gridHasFillerSelector);
54
+ const headerFilterHeight = useGridSelector(apiRef, gridHeaderFilterHeightSelector);
55
+ const scrollbarWidth = useGridSelector(apiRef, gridVerticalScrollbarWidthSelector);
54
56
  const columnHeaderFilterFocus = useGridSelector(apiRef, gridFocusColumnHeaderFilterSelector);
55
57
  const getFilterItem = React.useCallback(colDef => {
56
58
  const filterModelItem = filterModel?.items.find(it => it.field === colDef.field && it.operator !== 'isAnyOf');
@@ -87,15 +89,14 @@ export const useGridColumnHeaders = props => {
87
89
  }) : colDef.headerClassName;
88
90
  const item = getFilterItem(colDef);
89
91
  const pinnedPosition = params?.position;
90
- const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
91
- const pinnedOffset = getPinnedCellOffset(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, dimensions.columnsTotalWidth, scrollbarWidth);
92
+ const pinnedOffset = getPinnedCellOffset(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, columnsTotalWidth, scrollbarWidth);
92
93
  const indexInSection = i;
93
94
  const sectionLength = renderedColumns.length;
94
95
  const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
95
96
  const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
96
97
  filters.push(/*#__PURE__*/_jsx(rootProps.slots.headerFilterCell, _extends({
97
98
  colIndex: columnIndex,
98
- height: dimensions.headerFilterHeight,
99
+ height: headerFilterHeight,
99
100
  width: colDef.computedWidth,
100
101
  colDef: colDef,
101
102
  hasFocus: hasFocus,
@@ -4,9 +4,6 @@ import { useGridSelector, useGridApiEventHandler, useGridApiMethod, gridDataRowI
4
4
  import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
5
5
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "./gridDetailPanelToggleColDef.js";
6
6
  import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelRawHeightCacheSelector } from "./gridDetailPanelSelector.js";
7
- // FIXME: calling `api.updateDimensions()` here triggers a cycle where `updateDimensions` is
8
- // called 3 times when opening/closing a panel.
9
-
10
7
  export const detailPanelStateInitializer = (state, props) => {
11
8
  return _extends({}, state, {
12
9
  detailPanel: {
@@ -101,8 +98,6 @@ export const useGridDetailPanel = (apiRef, props) => {
101
98
  })
102
99
  });
103
100
  });
104
- apiRef.current.updateDimensions();
105
- apiRef.current.forceUpdate();
106
101
  }, [apiRef]);
107
102
  const storeDetailPanelHeight = React.useCallback((id, height) => {
108
103
  const heightCache = gridDetailPanelRawHeightCacheSelector(apiRef.current.state);
@@ -120,7 +115,6 @@ export const useGridDetailPanel = (apiRef, props) => {
120
115
  })
121
116
  });
122
117
  });
123
- apiRef.current.updateDimensions();
124
118
  apiRef.current.requestPipeProcessorsApplication('rowHeight');
125
119
  }, [apiRef]);
126
120
  const detailPanelHasAutoHeight = React.useCallback(id => {
@@ -147,17 +141,19 @@ export const useGridDetailPanel = (apiRef, props) => {
147
141
  }
148
142
  }, [apiRef, props.detailPanelExpandedRowIds]);
149
143
  const updateCachesAndForceUpdate = React.useCallback(() => {
144
+ if (!props.getDetailPanelContent) {
145
+ return;
146
+ }
150
147
  apiRef.current.setState(state => {
151
148
  return _extends({}, state, {
152
149
  detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
153
150
  });
154
151
  });
155
- apiRef.current.updateDimensions?.();
156
152
  apiRef.current.forceUpdate();
157
153
  }, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
158
154
  useGridApiEventHandler(apiRef, 'sortedRowsSet', updateCachesAndForceUpdate);
159
- const previousGetDetailPanelContentProp = React.useRef(null);
160
- const previousGetDetailPanelHeightProp = React.useRef(null);
155
+ const previousGetDetailPanelContentProp = React.useRef(undefined);
156
+ const previousGetDetailPanelHeightProp = React.useRef(undefined);
161
157
  const updateCachesIfNeeded = React.useCallback(() => {
162
158
  if (props.getDetailPanelContent === previousGetDetailPanelContentProp.current && props.getDetailPanelHeight === previousGetDetailPanelHeightProp.current) {
163
159
  return;
@@ -167,7 +163,6 @@ export const useGridDetailPanel = (apiRef, props) => {
167
163
  detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight, state.detailPanel.heightCache))
168
164
  });
169
165
  });
170
- apiRef.current.updateDimensions?.();
171
166
  previousGetDetailPanelContentProp.current = props.getDetailPanelContent;
172
167
  previousGetDetailPanelHeightProp.current = props.getDetailPanelHeight;
173
168
  }, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
@@ -181,7 +176,8 @@ export const useGridDetailPanel = (apiRef, props) => {
181
176
  initialValue.detail = heightCache[row.id] ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
182
177
  return initialValue;
183
178
  }, [apiRef, expandedRowIds, updateCachesIfNeeded]);
184
- useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
179
+ const enabled = props.getDetailPanelContent !== undefined;
180
+ useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight, enabled);
185
181
  const isFirstRender = React.useRef(true);
186
182
  if (isFirstRender.current) {
187
183
  updateCachesIfNeeded();
@@ -189,7 +185,6 @@ export const useGridDetailPanel = (apiRef, props) => {
189
185
  React.useEffect(() => {
190
186
  if (!isFirstRender.current) {
191
187
  updateCachesIfNeeded();
192
- apiRef.current.hydrateRowsMeta();
193
188
  }
194
189
  isFirstRender.current = false;
195
190
  }, [apiRef, updateCachesIfNeeded]);
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { useGridSelector, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, useGridApiMethod, gridDimensionsSelector } from '@mui/x-data-grid';
3
- import { useGridVisibleRows, useTimeout } from '@mui/x-data-grid/internals';
2
+ import { useGridSelector, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, useGridApiMethod } from '@mui/x-data-grid';
3
+ import { useGridVisibleRows, useTimeout, gridHorizontalScrollbarHeightSelector } from '@mui/x-data-grid/internals';
4
4
  import useEventCallback from '@mui/utils/useEventCallback';
5
5
  import { styled } from '@mui/system';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -39,10 +39,8 @@ export const useGridInfiniteLoader = (apiRef, props) => {
39
39
  triggerElement.current = null;
40
40
  }
41
41
  });
42
- const virtualScroller = apiRef.current.virtualScrollerRef.current;
43
- const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
44
- const marginBottom = props.scrollEndThreshold - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
45
42
  React.useEffect(() => {
43
+ const virtualScroller = apiRef.current.virtualScrollerRef.current;
46
44
  if (!isEnabled) {
47
45
  return;
48
46
  }
@@ -50,6 +48,8 @@ export const useGridInfiniteLoader = (apiRef, props) => {
50
48
  return;
51
49
  }
52
50
  observer.current?.disconnect();
51
+ const horizontalScrollbarHeight = gridHorizontalScrollbarHeightSelector(apiRef.current.state);
52
+ const marginBottom = props.scrollEndThreshold - horizontalScrollbarHeight;
53
53
  observer.current = new IntersectionObserver(handleLoadMoreRows, {
54
54
  threshold: 1,
55
55
  root: virtualScroller,
@@ -58,7 +58,7 @@ export const useGridInfiniteLoader = (apiRef, props) => {
58
58
  if (triggerElement.current) {
59
59
  observer.current.observe(triggerElement.current);
60
60
  }
61
- }, [virtualScroller, handleLoadMoreRows, isEnabled, marginBottom]);
61
+ }, [apiRef, handleLoadMoreRows, isEnabled, props.scrollEndThreshold]);
62
62
  const updateTarget = node => {
63
63
  if (triggerElement.current !== node) {
64
64
  observer.current?.disconnect();
@@ -1,9 +1,8 @@
1
1
  import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
2
- import { getTreeNodeDescendants } from '@mui/x-data-grid/internals';
2
+ import { defaultGridFilterLookup, getTreeNodeDescendants } from '@mui/x-data-grid/internals';
3
3
  export function skipFiltering(rowTree) {
4
4
  const filteredRowsLookup = {};
5
5
  const filteredChildrenCountLookup = {};
6
- const filteredDescendantCountLookup = {};
7
6
  const nodes = Object.values(rowTree);
8
7
  for (let i = 0; i < nodes.length; i += 1) {
9
8
  const node = nodes[i];
@@ -13,7 +12,7 @@ export function skipFiltering(rowTree) {
13
12
  return {
14
13
  filteredRowsLookup,
15
14
  filteredChildrenCountLookup,
16
- filteredDescendantCountLookup
15
+ filteredDescendantCountLookup: defaultGridFilterLookup.filteredDescendantCountLookup
17
16
  };
18
17
  }
19
18
  export function skipSorting(rowTree) {
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-pro v7.25.0
2
+ * @mui/x-data-grid-pro v7.27.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczODI5OTYwMDAwMA==";
3
+ const releaseInfo = "MTczOTc0NjgwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -166,7 +166,7 @@ export const getVisibleRowsLookup = ({
166
166
  }
167
167
  const visibleRowsLookup = {};
168
168
  const handleTreeNode = (node, areAncestorsExpanded) => {
169
- const isPassingFiltering = filteredRowsLookup[node.id];
169
+ const isPassingFiltering = filteredRowsLookup[node.id] !== false;
170
170
  if (node.type === 'group') {
171
171
  node.children.forEach(childId => {
172
172
  const childNode = tree[childId];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "7.25.0",
3
+ "version": "7.27.0",
4
4
  "description": "The Pro plan edition of the Data Grid components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -39,9 +39,9 @@
39
39
  "clsx": "^2.1.1",
40
40
  "prop-types": "^15.8.1",
41
41
  "reselect": "^5.1.1",
42
- "@mui/x-data-grid": "7.25.0",
43
- "@mui/x-license": "7.25.0",
44
- "@mui/x-internals": "7.25.0"
42
+ "@mui/x-data-grid": "7.27.0",
43
+ "@mui/x-internals": "7.26.0",
44
+ "@mui/x-license": "7.26.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@emotion/react": "^11.9.0",
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getReleaseInfo = void 0;
7
7
  var _utils = require("@mui/utils");
8
8
  const getReleaseInfo = () => {
9
- const releaseInfo = "MTczODI5OTYwMDAwMA==";
9
+ const releaseInfo = "MTczOTc0NjgwMDAwMA==";
10
10
  if (process.env.NODE_ENV !== 'production') {
11
11
  // A simple hack to set the value in the test environment (has no build step).
12
12
  // eslint-disable-next-line no-useless-concat
@@ -35,4 +35,4 @@ export declare const createUpdatedGroupsManager: () => GridRowTreeUpdatedGroupsM
35
35
  export declare const getVisibleRowsLookup: ({ tree, filteredRowsLookup, }: {
36
36
  tree: GridRowsState["tree"];
37
37
  filteredRowsLookup: GridFilterState["filteredRowsLookup"];
38
- }) => Record<GridRowId, boolean>;
38
+ }) => import("@mui/x-data-grid/hooks/features/filter/gridFilterState").GridVisibleRowsLookupState;
@@ -181,7 +181,7 @@ const getVisibleRowsLookup = ({
181
181
  }
182
182
  const visibleRowsLookup = {};
183
183
  const handleTreeNode = (node, areAncestorsExpanded) => {
184
- const isPassingFiltering = filteredRowsLookup[node.id];
184
+ const isPassingFiltering = filteredRowsLookup[node.id] !== false;
185
185
  if (node.type === 'group') {
186
186
  node.children.forEach(childId => {
187
187
  const childNode = tree[childId];