@mui/x-data-grid 8.10.0 → 8.10.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 (43) hide show
  1. package/CHANGELOG.md +182 -0
  2. package/components/GridRow.js +5 -5
  3. package/components/columnHeaders/GridColumnHeaderItem.js +5 -1
  4. package/components/containers/GridRootStyles.js +5 -0
  5. package/components/virtualization/GridVirtualScroller.js +3 -3
  6. package/esm/DataGrid/index.js +1 -1
  7. package/esm/components/GridRow.js +5 -5
  8. package/esm/components/columnHeaders/GridColumnHeaderItem.js +5 -1
  9. package/esm/components/containers/GridRootStyles.js +5 -0
  10. package/esm/components/virtualization/GridVirtualScroller.js +3 -3
  11. package/esm/hooks/core/useGridVirtualizer.js +64 -44
  12. package/esm/hooks/features/dataSource/cache.js +0 -3
  13. package/esm/hooks/features/dataSource/gridDataSourceError.js +16 -16
  14. package/esm/hooks/features/dataSource/utils.js +51 -52
  15. package/esm/hooks/features/dimensions/gridDimensionsApi.d.ts +2 -67
  16. package/esm/hooks/features/dimensions/useGridDimensions.js +20 -15
  17. package/esm/hooks/features/export/serializers/csvSerializer.js +2 -3
  18. package/esm/hooks/features/export/useGridPrintExport.js +3 -8
  19. package/esm/hooks/features/filter/gridFilterUtils.js +11 -2
  20. package/esm/index.js +1 -1
  21. package/esm/internals/utils/cache.js +0 -1
  22. package/esm/locales/fiFI.js +6 -6
  23. package/esm/models/api/gridApiCommon.d.ts +1 -1
  24. package/esm/models/gridRowSelectionManager.js +0 -2
  25. package/esm/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +5 -7
  26. package/esm/utils/cleanupTracking/TimerBasedCleanupTracking.js +2 -2
  27. package/hooks/core/useGridVirtualizer.js +62 -42
  28. package/hooks/features/dataSource/cache.js +0 -3
  29. package/hooks/features/dataSource/gridDataSourceError.js +16 -16
  30. package/hooks/features/dataSource/utils.js +51 -52
  31. package/hooks/features/dimensions/gridDimensionsApi.d.ts +2 -67
  32. package/hooks/features/dimensions/useGridDimensions.js +20 -15
  33. package/hooks/features/export/serializers/csvSerializer.js +2 -3
  34. package/hooks/features/export/useGridPrintExport.js +3 -8
  35. package/hooks/features/filter/gridFilterUtils.js +10 -1
  36. package/index.js +1 -1
  37. package/internals/utils/cache.js +0 -1
  38. package/locales/fiFI.js +6 -6
  39. package/models/api/gridApiCommon.d.ts +1 -1
  40. package/models/gridRowSelectionManager.js +0 -2
  41. package/package.json +8 -9
  42. package/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +5 -7
  43. package/utils/cleanupTracking/TimerBasedCleanupTracking.js +2 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,188 @@
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.10.2
9
+
10
+ _Aug 20, 2025_
11
+
12
+ We'd like to extend a big thank you to the 10 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🌎 Improve Finnish (fi-FI) locale on the Data Grid
15
+
16
+ Special thanks go out to the community members for their valuable contributions:
17
+ @lauri-heinonen-2025-04, @Methuselah96, @sai6855, @wilcoschoneveld
18
+
19
+ The following are all team members who have contributed to this release:
20
+ @alexfauquette, @cherniavskii, @flaviendelangle, @Janpot, @oliviertassinari, @rita-codes
21
+
22
+ ### Data Grid
23
+
24
+ #### `@mui/x-data-grid@8.10.2`
25
+
26
+ - [DataGrid] Fix display for `<GridEditSingleSelect />` when `density='compact'` (#19249) @sai6855
27
+ - [DataGrid] Fix column header sortable classname when using `disableColumnSorting` (#19222) @wilcoschoneveld
28
+ - [l10n] Improve finnish (fi-FI) locale (#19163) @lauri-heinonen-2025-04
29
+
30
+ #### `@mui/x-data-grid-pro@8.10.2` [![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@8.10.2`, plus:
33
+
34
+ - [DataGridPro] Fix quick filter not working in List View mode (#19254) @cherniavskii
35
+
36
+ #### `@mui/x-data-grid-premium@8.10.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link "Premium plan")
37
+
38
+ Same changes as in `@mui/x-data-grid-pro@8.10.2`.
39
+
40
+ ### Date and Time Pickers
41
+
42
+ #### `@mui/x-date-pickers@8.10.2`
43
+
44
+ Internal changes.
45
+
46
+ #### `@mui/x-date-pickers-pro@8.10.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
47
+
48
+ Same changes as in `@mui/x-date-pickers@8.10.2`.
49
+
50
+ ### Charts
51
+
52
+ #### `@mui/x-charts@8.10.2`
53
+
54
+ Internal changes.
55
+
56
+ #### `@mui/x-charts-pro@8.10.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
57
+
58
+ Same changes as in `@mui/x-charts@8.10.2`.
59
+
60
+ ### Tree View
61
+
62
+ #### `@mui/x-tree-view@8.10.2`
63
+
64
+ - [tree view] Add `aria-hidden` to the Tree Item Checkbox (#19246) @flaviendelangle
65
+
66
+ #### `@mui/x-tree-view-pro@8.10.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.10.2`.
69
+
70
+ ### Codemod
71
+
72
+ #### `@mui/x-codemod@8.10.2`
73
+
74
+ Internal changes.
75
+
76
+ ### Docs
77
+
78
+ - [docs] Fix links to the pyramid chart (#19250) @alexfauquette
79
+
80
+ ### Core
81
+
82
+ - [internal] Avoid script for CI only @oliviertassinari
83
+ - [internal] Fix `renovate.json` @oliviertassinari
84
+ - [internal] Polish renovate config @oliviertassinari
85
+ - [internal] Rename core to internal (#19203) @oliviertassinari
86
+ - [internal] Update link to GitHub labels @oliviertassinari
87
+
88
+ ### Miscellaneous
89
+
90
+ - [code-infra] Prepare for incoming `execa` update (#19229) @Janpot
91
+ - [virtualizer] Fix type import (#19192) @Methuselah96
92
+ - [virtualizer] Improve type export (#19192) @Methuselah96
93
+
94
+ ## 8.10.1
95
+
96
+ _Aug 15, 2025_
97
+
98
+ We'd like to extend a big thank you to the 8 contributors who made this release possible. Here are some highlights ✨:
99
+
100
+ - 📊 Y-axes can now be grouped by category when using `band` and `point` scales.
101
+ - 📚 Documentation improvements
102
+
103
+ The following are all team members who have contributed to this release:
104
+ @alexfauquette, @bernardobelchior, @Janpot, @JCQuintas, @mnajdova, @oliviertassinari, @prakhargupta1, @romgrk
105
+
106
+ ### Data Grid
107
+
108
+ #### `@mui/x-data-grid@8.10.1`
109
+
110
+ - [DataGrid] Fix scroll jumping (#19156) @romgrk
111
+ - [DataGrid] Fix scroll restoration (#19182) @romgrk
112
+ - [DataGrid] Fix "no row with id" error (#19193) @romgrk
113
+
114
+ #### `@mui/x-data-grid-pro@8.10.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
115
+
116
+ Same changes as in `@mui/x-data-grid@8.10.1`.
117
+
118
+ #### `@mui/x-data-grid-premium@8.10.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link "Premium plan")
119
+
120
+ Same changes as in `@mui/x-data-grid-pro@8.10.1`.
121
+
122
+ ### Date and Time Pickers
123
+
124
+ #### `@mui/x-date-pickers@8.10.0`
125
+
126
+ Internal changes.
127
+
128
+ #### `@mui/x-date-pickers-pro@8.10.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
129
+
130
+ Same changes as in `@mui/x-date-pickers@8.10.0`.
131
+
132
+ ### Charts
133
+
134
+ - Axes can now be grouped by category when using `band` and `point` scales
135
+
136
+ <img width="643" height="455" alt="Bar chart with y-axis grouped per categories" src="https://github.com/user-attachments/assets/59044afe-bcc5-4152-8bf1-225db0635025" />
137
+
138
+ #### `@mui/x-charts@8.10.1`
139
+
140
+ - [charts] Allow y-axis to be grouped (#19081) @JCQuintas
141
+ - [charts] Fix default axis highlight for axes without data attribute (#18985) @alexfauquette
142
+ - [charts] Fix tooltip mark unexpected wrapping in mobile (#19122) @bernardobelchior
143
+ - [charts] Prevent overflow on charts tooltip (#19123) @bernardobelchior
144
+
145
+ #### `@mui/x-charts-pro@8.10.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
146
+
147
+ Same changes as in `@mui/x-charts@8.10.1`.
148
+
149
+ ### Tree View
150
+
151
+ #### `@mui/x-tree-view@8.10.1`
152
+
153
+ Internal changes.
154
+
155
+ #### `@mui/x-tree-view-pro@8.10.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
156
+
157
+ Same changes as in `@mui/x-tree-view@8.10.1`.
158
+
159
+ ### Codemod
160
+
161
+ #### `@mui/x-codemod@8.10.1`
162
+
163
+ Internal changes.
164
+
165
+ ### Docs
166
+
167
+ - [docs] Add all planned charts on the overview page (#19077) @prakhargupta1
168
+ - [docs] Add future charts components link in the sidebar (#19140) @prakhargupta1
169
+ - [docs] Fix Heatmap docs duplicate text (#19138) @JCQuintas
170
+ - [docs] Remove preview from Toolbar & Funnel (#19131) @mnajdova
171
+ - [docs] Reproduce npm sparkline (#19089) @alexfauquette
172
+
173
+ ### Core
174
+
175
+ - [core] Fix licensing model name (#19025) @oliviertassinari
176
+ - [core] Fix usage of `:catalog` for `@babel/runtime` (#19028) @oliviertassinari
177
+ - [core] Refactor virtualizer API (#18995) @romgrk
178
+
179
+ ### Miscellaneous
180
+
181
+ - [code-infra] Remove namespaces (#19071) @Janpot
182
+ - [code-infra] Fix `fs-extra` removal from `formattedTSDemos` script (#19132) @bernardobelchior
183
+ - [code-infra] Remove unused code and dependency (#19139) @bernardobelchior
184
+ - [code-infra] Replace `fs-extra` with `node:fs` where possible (#19127) @bernardobelchior
185
+ - [internal] Edit, keep `lockFileMaintenance` simple @oliviertassinari
186
+ - [internal] Fix writing style action name @oliviertassinari
187
+ - [internal] Make it clear that `lockFileMaintenance` is enabled @oliviertassinari
188
+ - [support-infra] Remove default issue label (#19104) @oliviertassinari
189
+
8
190
  ## 8.10.0
9
191
 
10
192
  _Aug 8, 2025_
@@ -200,6 +200,11 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
200
200
  }
201
201
  return rowStyle;
202
202
  }, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
203
+
204
+ // HACK: Sometimes, the rowNode has already been removed from the state but the row is still rendered.
205
+ if (!rowNode) {
206
+ return null;
207
+ }
203
208
  const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
204
209
  const ariaAttributes = getRowAriaAttributes(rowNode, index);
205
210
  if (typeof rootProps.getRowClassName === 'function') {
@@ -211,11 +216,6 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
211
216
  });
212
217
  rowClassNames.push(rootProps.getRowClassName(rowParams));
213
218
  }
214
-
215
- // XXX: fix this properly
216
- if (!rowNode) {
217
- return null;
218
- }
219
219
  const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = _constants.PinnedColumnPosition.NONE) => {
220
220
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
221
221
  if (cellColSpanInfo?.spannedByColSpan) {
@@ -26,6 +26,9 @@ var _constants = require("../../internals/constants");
26
26
  var _utils = require("../../internals/utils");
27
27
  var _jsxRuntime = require("react/jsx-runtime");
28
28
  const useUtilityClasses = ownerState => {
29
+ const {
30
+ disableColumnSorting
31
+ } = (0, _useGridRootProps.useGridRootProps)();
29
32
  const {
30
33
  colDef,
31
34
  classes,
@@ -38,12 +41,13 @@ const useUtilityClasses = ownerState => {
38
41
  isLastUnpinned,
39
42
  isSiblingFocused
40
43
  } = ownerState;
44
+ const isColumnSortable = colDef.sortable && !disableColumnSorting;
41
45
  const isColumnSorted = sortDirection != null;
42
46
  const isColumnFiltered = filterItemsCounter != null && filterItemsCounter > 0;
43
47
  // todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
44
48
  const isColumnNumeric = colDef.type === 'number';
45
49
  const slots = {
46
- root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', colDef.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition === _constants.PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === _constants.PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight',
50
+ root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', isColumnSortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition === _constants.PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === _constants.PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight',
47
51
  // TODO: Remove classes below and restore `:has` selectors when they are supported in jsdom
48
52
  // See https://github.com/mui/mui-x/pull/14559
49
53
  isLastUnpinned && 'columnHeader--lastUnpinned', isSiblingFocused && 'columnHeader--siblingFocused'],
@@ -689,6 +689,11 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
689
689
  outlineOffset: focusOutlineWidth * -1
690
690
  }
691
691
  },
692
+ [`& .${_gridClasses.gridClasses['cell--editing']}`]: {
693
+ '& .MuiInputBase-root': {
694
+ height: '100%'
695
+ }
696
+ },
692
697
  [`& .${_gridClasses.gridClasses['row--editing']}`]: {
693
698
  boxShadow: _cssVariables.vars.shadows.base
694
699
  },
@@ -90,7 +90,6 @@ function GridVirtualScroller(props) {
90
90
  getContainerProps,
91
91
  getScrollerProps,
92
92
  getContentProps,
93
- getRenderZoneProps,
94
93
  getScrollbarVerticalProps,
95
94
  getScrollbarHorizontalProps,
96
95
  getRows,
@@ -119,11 +118,12 @@ function GridVirtualScroller(props) {
119
118
  virtualScroller: virtualScroller
120
119
  })]
121
120
  }), getOverlay(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridVirtualScrollerContent.GridVirtualScrollerContent, (0, _extends2.default)({}, getContentProps(), {
122
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridVirtualScrollerRenderZone.GridVirtualScrollerRenderZone, (0, _extends2.default)({}, getRenderZoneProps(), {
121
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridVirtualScrollerRenderZone.GridVirtualScrollerRenderZone, {
122
+ role: "rowgroup",
123
123
  children: [rows, /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.detailPanels, {
124
124
  virtualScroller: virtualScroller
125
125
  })]
126
- }))
126
+ })
127
127
  })), hasBottomFiller && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridVirtualScrollerFiller.GridVirtualScrollerFiller, {
128
128
  rowsLength: rows.length
129
129
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.bottomContainer, {
@@ -1,2 +1,2 @@
1
- import "../index.css";
1
+ import '../index.css';
2
2
  export * from "./DataGrid.js";
@@ -193,6 +193,11 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
193
193
  }
194
194
  return rowStyle;
195
195
  }, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
196
+
197
+ // HACK: Sometimes, the rowNode has already been removed from the state but the row is still rendered.
198
+ if (!rowNode) {
199
+ return null;
200
+ }
196
201
  const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
197
202
  const ariaAttributes = getRowAriaAttributes(rowNode, index);
198
203
  if (typeof rootProps.getRowClassName === 'function') {
@@ -204,11 +209,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
204
209
  });
205
210
  rowClassNames.push(rootProps.getRowClassName(rowParams));
206
211
  }
207
-
208
- // XXX: fix this properly
209
- if (!rowNode) {
210
- return null;
211
- }
212
212
  const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
213
213
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
214
214
  if (cellColSpanInfo?.spannedByColSpan) {
@@ -19,6 +19,9 @@ import { PinnedColumnPosition } from "../../internals/constants.js";
19
19
  import { attachPinnedStyle } from "../../internals/utils/index.js";
20
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
21
  const useUtilityClasses = ownerState => {
22
+ const {
23
+ disableColumnSorting
24
+ } = useGridRootProps();
22
25
  const {
23
26
  colDef,
24
27
  classes,
@@ -31,12 +34,13 @@ const useUtilityClasses = ownerState => {
31
34
  isLastUnpinned,
32
35
  isSiblingFocused
33
36
  } = ownerState;
37
+ const isColumnSortable = colDef.sortable && !disableColumnSorting;
34
38
  const isColumnSorted = sortDirection != null;
35
39
  const isColumnFiltered = filterItemsCounter != null && filterItemsCounter > 0;
36
40
  // todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
37
41
  const isColumnNumeric = colDef.type === 'number';
38
42
  const slots = {
39
- root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', colDef.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition === PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight',
43
+ root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', isColumnSortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition === PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight',
40
44
  // TODO: Remove classes below and restore `:has` selectors when they are supported in jsdom
41
45
  // See https://github.com/mui/mui-x/pull/14559
42
46
  isLastUnpinned && 'columnHeader--lastUnpinned', isSiblingFocused && 'columnHeader--siblingFocused'],
@@ -683,6 +683,11 @@ export const GridRootStyles = styled('div', {
683
683
  outlineOffset: focusOutlineWidth * -1
684
684
  }
685
685
  },
686
+ [`& .${c['cell--editing']}`]: {
687
+ '& .MuiInputBase-root': {
688
+ height: '100%'
689
+ }
690
+ },
686
691
  [`& .${c['row--editing']}`]: {
687
692
  boxShadow: vars.shadows.base
688
693
  },
@@ -82,7 +82,6 @@ function GridVirtualScroller(props) {
82
82
  getContainerProps,
83
83
  getScrollerProps,
84
84
  getContentProps,
85
- getRenderZoneProps,
86
85
  getScrollbarVerticalProps,
87
86
  getScrollbarHorizontalProps,
88
87
  getRows,
@@ -111,11 +110,12 @@ function GridVirtualScroller(props) {
111
110
  virtualScroller: virtualScroller
112
111
  })]
113
112
  }), getOverlay(), /*#__PURE__*/_jsx(Content, _extends({}, getContentProps(), {
114
- children: /*#__PURE__*/_jsxs(RenderZone, _extends({}, getRenderZoneProps(), {
113
+ children: /*#__PURE__*/_jsxs(RenderZone, {
114
+ role: "rowgroup",
115
115
  children: [rows, /*#__PURE__*/_jsx(rootProps.slots.detailPanels, {
116
116
  virtualScroller: virtualScroller
117
117
  })]
118
- }))
118
+ })
119
119
  })), hasBottomFiller && /*#__PURE__*/_jsx(SpaceFiller, {
120
120
  rowsLength: rows.length
121
121
  }), /*#__PURE__*/_jsx(rootProps.slots.bottomContainer, {
@@ -1,14 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import useLazyRef from '@mui/utils/useLazyRef';
3
4
  import useEventCallback from '@mui/utils/useEventCallback';
4
5
  import { useRtl } from '@mui/system/RtlProvider';
5
6
  import { roundToDecimalPlaces } from '@mui/x-internals/math';
7
+ import { lruMemoize } from '@mui/x-internals/lruMemoize';
6
8
  import { useStoreEffect } from '@mui/x-internals/store';
7
- import { useVirtualizer } from '@mui/x-virtualizer';
9
+ import { useVirtualizer, Dimensions } from '@mui/x-virtualizer';
8
10
  import { useFirstRender } from "../utils/useFirstRender.js";
9
11
  import { createSelector } from "../../utils/createSelector.js";
10
12
  import { useGridSelector } from "../utils/useGridSelector.js";
11
- import { gridContentHeightSelector, gridHasFillerSelector, gridVerticalScrollbarWidthSelector } from "../features/dimensions/gridDimensionsSelectors.js";
13
+ import { gridHasFillerSelector, gridVerticalScrollbarWidthSelector } from "../features/dimensions/gridDimensionsSelectors.js";
12
14
  import { gridDensityFactorSelector } from "../features/density/index.js";
13
15
  import { gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridHasColSpanSelector } from "../features/columns/gridColumnsSelector.js";
14
16
  import { gridPinnedRowsSelector, gridRowCountSelector } from "../features/rows/gridRowsSelector.js";
@@ -31,6 +33,18 @@ const columnsTotalWidthSelector = createSelector(gridVisibleColumnDefinitionsSel
31
33
  return roundToDecimalPlaces(positions[colCount - 1] + visibleColumns[colCount - 1].computedWidth, 1);
32
34
  });
33
35
 
36
+ /** Translates virtualizer state to grid state */
37
+ const addGridDimensionsCreator = () => lruMemoize((dimensions, headerHeight, groupHeaderHeight, headerFilterHeight, headersTotalHeight) => {
38
+ return _extends({}, dimensions, {
39
+ headerHeight,
40
+ groupHeaderHeight,
41
+ headerFilterHeight,
42
+ headersTotalHeight
43
+ });
44
+ }, {
45
+ maxSize: 1
46
+ });
47
+
34
48
  /**
35
49
  * Virtualizer setup
36
50
  */
@@ -46,9 +60,6 @@ export function useGridVirtualizer(apiRef, rootProps) {
46
60
  const isRowSelected = id => rowSelectionManager.has(id) && apiRef.current.isRowSelectable(id);
47
61
  const currentPage = useGridVisibleRows(apiRef);
48
62
  const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
49
-
50
- /* TODO: extract dimensions code */
51
- const contentHeight = useGridSelector(apiRef, gridContentHeightSelector);
52
63
  const verticalScrollbarWidth = useGridSelector(apiRef, gridVerticalScrollbarWidthSelector);
53
64
  const hasFiller = useGridSelector(apiRef, gridHasFillerSelector);
54
65
  const {
@@ -67,16 +78,17 @@ export function useGridVirtualizer(apiRef, rootProps) {
67
78
  const headersTotalHeight = getTotalHeaderHeight(apiRef, rootProps);
68
79
  const leftPinnedWidth = pinnedColumns.left.reduce((w, col) => w + col.computedWidth, 0);
69
80
  const rightPinnedWidth = pinnedColumns.right.reduce((w, col) => w + col.computedWidth, 0);
70
- const dimensions = {
81
+ const dimensionsParams = {
71
82
  rowHeight,
72
83
  headerHeight,
73
- groupHeaderHeight,
74
- headerFilterHeight,
75
84
  columnsTotalWidth,
76
- headersTotalHeight,
77
85
  leftPinnedWidth,
78
- rightPinnedWidth
86
+ rightPinnedWidth,
87
+ topPinnedHeight: headersTotalHeight,
88
+ bottomPinnedHeight: 0,
89
+ scrollbarSize: rootProps.scrollbarSize
79
90
  };
91
+ const addGridDimensions = useLazyRef(addGridDimensionsCreator).current;
80
92
 
81
93
  // </DIMENSIONS>
82
94
 
@@ -93,32 +105,42 @@ export function useGridVirtualizer(apiRef, rootProps) {
93
105
 
94
106
  const focusedVirtualCell = useGridSelector(apiRef, gridFocusedVirtualCellSelector);
95
107
  const virtualizer = useVirtualizer({
96
- scrollbarSize: rootProps.scrollbarSize,
97
- dimensions,
108
+ refs: {
109
+ container: apiRef.current.mainElementRef,
110
+ scroller: apiRef.current.virtualScrollerRef,
111
+ scrollbarVertical: apiRef.current.virtualScrollbarVerticalRef,
112
+ scrollbarHorizontal: apiRef.current.virtualScrollbarHorizontalRef
113
+ },
114
+ dimensions: dimensionsParams,
115
+ virtualization: {
116
+ isRtl,
117
+ rowBufferPx: rootProps.rowBufferPx,
118
+ columnBufferPx: rootProps.columnBufferPx
119
+ },
120
+ colspan: {
121
+ enabled: hasColSpan,
122
+ getColspan: (rowId, column) => {
123
+ if (typeof column.colSpan === 'function') {
124
+ const row = apiRef.current.getRow(rowId);
125
+ const value = apiRef.current.getRowValue(row, column);
126
+ return column.colSpan(value, row, column, apiRef) ?? 0;
127
+ }
128
+ return column.colSpan ?? 1;
129
+ }
130
+ },
98
131
  initialState: {
99
132
  scroll: rootProps.initialState?.scroll,
100
- dimensions: apiRef.current.state.dimensions,
101
133
  rowSpanning: apiRef.current.state.rowSpanning,
102
134
  virtualization: apiRef.current.state.virtualization
103
135
  },
104
- isRtl,
105
136
  rows: currentPage.rows,
106
137
  range: currentPage.range,
107
- rowIdToIndexMap: currentPage.rowIdToIndexMap,
108
138
  rowCount,
109
139
  columns: visibleColumns,
110
140
  pinnedRows,
111
141
  pinnedColumns,
112
- refs: {
113
- container: apiRef.current.mainElementRef,
114
- scroller: apiRef.current.virtualScrollerRef,
115
- scrollbarVertical: apiRef.current.virtualScrollbarVerticalRef,
116
- scrollbarHorizontal: apiRef.current.virtualScrollbarHorizontalRef
117
- },
118
- hasColSpan,
119
- contentHeight,
120
- minimalContentHeight,
121
142
  autoHeight,
143
+ minimalContentHeight,
122
144
  getRowHeight: React.useMemo(() => {
123
145
  if (!getRowHeight) {
124
146
  return undefined;
@@ -130,14 +152,20 @@ export function useGridVirtualizer(apiRef, rootProps) {
130
152
  getEstimatedRowHeight: React.useMemo(() => getEstimatedRowHeight ? rowEntry => getEstimatedRowHeight(_extends({}, rowEntry, {
131
153
  densityFactor: density
132
154
  })) : undefined, [getEstimatedRowHeight, density]),
133
- getRowSpacing: React.useMemo(() => getRowSpacing ? (rowEntry, visibility) => getRowSpacing(_extends({}, rowEntry, visibility, {
134
- indexRelativeToCurrentPage: apiRef.current.getRowIndexRelativeToVisibleRows(rowEntry.id)
135
- })) : undefined, [apiRef, getRowSpacing]),
155
+ getRowSpacing: React.useMemo(() => getRowSpacing ? rowEntry => {
156
+ const indexRelativeToCurrentPage = currentPage.rowIdToIndexMap.get(rowEntry.id) ?? -1;
157
+ const visibility = {
158
+ isFirstVisible: indexRelativeToCurrentPage === 0,
159
+ isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
160
+ indexRelativeToCurrentPage
161
+ };
162
+ return getRowSpacing(_extends({}, rowEntry, visibility, {
163
+ indexRelativeToCurrentPage: apiRef.current.getRowIndexRelativeToVisibleRows(rowEntry.id)
164
+ }));
165
+ } : undefined, [apiRef, getRowSpacing, currentPage.rows, currentPage.rowIdToIndexMap]),
136
166
  applyRowHeight: useEventCallback((entry, row) => apiRef.current.unstable_applyPipeProcessors('rowHeight', entry, row)),
137
167
  virtualizeColumnsWithAutoRowHeight: rootProps.virtualizeColumnsWithAutoRowHeight,
138
168
  focusedVirtualCell: useEventCallback(() => focusedVirtualCell),
139
- rowBufferPx: rootProps.rowBufferPx,
140
- columnBufferPx: rootProps.columnBufferPx,
141
169
  resizeThrottleMs: rootProps.resizeThrottleMs,
142
170
  onResize: useEventCallback(size => apiRef.current.publishEvent('resize', size)),
143
171
  onWheel: useEventCallback(event => {
@@ -157,14 +185,6 @@ export function useGridVirtualizer(apiRef, rootProps) {
157
185
  });
158
186
  },
159
187
  scrollReset,
160
- getColspan: (rowId, column) => {
161
- if (typeof column.colSpan === 'function') {
162
- const row = apiRef.current.getRow(rowId);
163
- const value = apiRef.current.getRowValue(row, column);
164
- return column.colSpan(value, row, column, apiRef) ?? 0;
165
- }
166
- return column.colSpan ?? 0;
167
- },
168
188
  renderRow: params => /*#__PURE__*/_jsx(rootProps.slots.row, _extends({
169
189
  row: params.model,
170
190
  rowId: params.id,
@@ -174,7 +194,7 @@ export function useGridVirtualizer(apiRef, rootProps) {
174
194
  columnsTotalWidth: columnsTotalWidth,
175
195
  rowHeight: params.baseRowHeight,
176
196
  pinnedColumns: pinnedColumns,
177
- visibleColumns: params.columns,
197
+ visibleColumns: visibleColumns,
178
198
  firstColumnIndex: params.firstColumnIndex,
179
199
  lastColumnIndex: params.lastColumnIndex,
180
200
  focusedColumnIndex: params.focusedColumnIndex,
@@ -196,16 +216,16 @@ export function useGridVirtualizer(apiRef, rootProps) {
196
216
  //
197
217
  // TODO(v9): Remove this
198
218
  useFirstRender(() => {
199
- apiRef.current.store.state.dimensions = virtualizer.store.state.dimensions;
219
+ apiRef.current.store.state.dimensions = addGridDimensions(virtualizer.store.state.dimensions, headerHeight, groupHeaderHeight, headerFilterHeight, headersTotalHeight);
200
220
  apiRef.current.store.state.rowsMeta = virtualizer.store.state.rowsMeta;
201
221
  apiRef.current.store.state.virtualization = virtualizer.store.state.virtualization;
202
222
  });
223
+ useStoreEffect(virtualizer.store, Dimensions.selectors.dimensions, (_, dimensions) => {
224
+ apiRef.current.setState(gridState => _extends({}, gridState, {
225
+ dimensions: addGridDimensions(dimensions, headerHeight, groupHeaderHeight, headerFilterHeight, headersTotalHeight)
226
+ }));
227
+ });
203
228
  useStoreEffect(virtualizer.store, identity, (_, state) => {
204
- if (state.dimensions !== apiRef.current.state.dimensions) {
205
- apiRef.current.setState(gridState => _extends({}, gridState, {
206
- dimensions: state.dimensions
207
- }));
208
- }
209
229
  if (state.rowsMeta !== apiRef.current.state.rowsMeta) {
210
230
  apiRef.current.setState(gridState => _extends({}, gridState, {
211
231
  rowsMeta: state.rowsMeta
@@ -6,9 +6,6 @@ export class GridDataSourceCacheDefault {
6
6
  ttl = 300_000,
7
7
  getKey = getKeyDefault
8
8
  }) {
9
- this.cache = void 0;
10
- this.ttl = void 0;
11
- this.getKey = void 0;
12
9
  this.cache = {};
13
10
  this.ttl = ttl;
14
11
  this.getKey = getKey;
@@ -1,30 +1,30 @@
1
1
  export class GridGetRowsError extends Error {
2
+ /**
3
+ * The parameters used in the failed request
4
+ */
5
+
6
+ /**
7
+ * The original error that caused this error
8
+ */
9
+
2
10
  constructor(options) {
3
11
  super(options.message);
4
- /**
5
- * The parameters used in the failed request
6
- */
7
- this.params = void 0;
8
- /**
9
- * The original error that caused this error
10
- */
11
- this.cause = void 0;
12
12
  this.name = 'GridGetRowsError';
13
13
  this.params = options.params;
14
14
  this.cause = options.cause;
15
15
  }
16
16
  }
17
17
  export class GridUpdateRowError extends Error {
18
+ /**
19
+ * The parameters used in the failed request
20
+ */
21
+
22
+ /**
23
+ * The original error that caused this error
24
+ */
25
+
18
26
  constructor(options) {
19
27
  super(options.message);
20
- /**
21
- * The parameters used in the failed request
22
- */
23
- this.params = void 0;
24
- /**
25
- * The original error that caused this error
26
- */
27
- this.cause = void 0;
28
28
  this.name = 'GridUpdateRowError';
29
29
  this.params = options.params;
30
30
  this.cause = options.cause;