@mui/x-data-grid 7.22.3 → 7.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/DataGrid/DataGrid.js +9 -1
  3. package/README.md +3 -3
  4. package/components/cell/GridCell.js +10 -10
  5. package/components/toolbar/GridToolbarColumnsButton.js +3 -4
  6. package/components/toolbar/GridToolbarDensitySelector.js +3 -4
  7. package/components/toolbar/GridToolbarExportContainer.js +3 -4
  8. package/components/toolbar/GridToolbarFilterButton.d.ts +2 -0
  9. package/components/toolbar/GridToolbarFilterButton.js +7 -6
  10. package/components/toolbar/GridToolbarQuickFilter.js +1 -0
  11. package/constants/dataGridPropsDefaultValues.js +2 -1
  12. package/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  13. package/hooks/features/columnResize/useGridColumnResize.js +2 -1
  14. package/hooks/features/dimensions/useGridDimensions.js +2 -1
  15. package/hooks/features/index.d.ts +1 -0
  16. package/hooks/features/index.js +1 -0
  17. package/hooks/features/listView/gridListViewSelectors.d.ts +3 -1
  18. package/hooks/features/listView/gridListViewSelectors.js +3 -1
  19. package/hooks/features/listView/index.d.ts +1 -0
  20. package/hooks/features/listView/index.js +1 -0
  21. package/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  22. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
  23. package/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
  24. package/index.js +1 -1
  25. package/joy/joySlots.js +7 -2
  26. package/locales/deDE.js +1 -2
  27. package/locales/esES.js +1 -2
  28. package/locales/ptBR.js +1 -2
  29. package/locales/ptPT.js +1 -2
  30. package/locales/zhCN.js +1 -2
  31. package/models/api/gridCoreApi.d.ts +1 -1
  32. package/models/colDef/gridColDef.d.ts +24 -24
  33. package/models/gridDataSource.d.ts +12 -12
  34. package/models/props/DataGridProps.d.ts +8 -0
  35. package/modern/DataGrid/DataGrid.js +9 -1
  36. package/modern/components/cell/GridCell.js +10 -10
  37. package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -4
  38. package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -4
  39. package/modern/components/toolbar/GridToolbarExportContainer.js +3 -4
  40. package/modern/components/toolbar/GridToolbarFilterButton.js +7 -6
  41. package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -0
  42. package/modern/constants/dataGridPropsDefaultValues.js +2 -1
  43. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  44. package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
  45. package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
  46. package/modern/hooks/features/index.js +1 -0
  47. package/modern/hooks/features/listView/gridListViewSelectors.js +3 -1
  48. package/modern/hooks/features/listView/index.js +1 -0
  49. package/modern/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  50. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
  51. package/modern/index.js +1 -1
  52. package/modern/joy/joySlots.js +7 -2
  53. package/modern/locales/deDE.js +1 -2
  54. package/modern/locales/esES.js +1 -2
  55. package/modern/locales/ptBR.js +1 -2
  56. package/modern/locales/ptPT.js +1 -2
  57. package/modern/locales/zhCN.js +1 -2
  58. package/node/DataGrid/DataGrid.js +9 -1
  59. package/node/components/cell/GridCell.js +10 -10
  60. package/node/components/toolbar/GridToolbarColumnsButton.js +3 -4
  61. package/node/components/toolbar/GridToolbarDensitySelector.js +3 -4
  62. package/node/components/toolbar/GridToolbarExportContainer.js +3 -4
  63. package/node/components/toolbar/GridToolbarFilterButton.js +7 -6
  64. package/node/components/toolbar/GridToolbarQuickFilter.js +1 -0
  65. package/node/constants/dataGridPropsDefaultValues.js +2 -1
  66. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  67. package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
  68. package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
  69. package/node/hooks/features/index.js +11 -0
  70. package/node/hooks/features/listView/gridListViewSelectors.js +3 -1
  71. package/node/hooks/features/listView/index.js +16 -0
  72. package/node/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  73. package/node/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
  74. package/node/index.js +1 -1
  75. package/node/joy/joySlots.js +7 -2
  76. package/node/locales/deDE.js +1 -2
  77. package/node/locales/esES.js +1 -2
  78. package/node/locales/ptBR.js +1 -2
  79. package/node/locales/ptPT.js +1 -2
  80. package/node/locales/zhCN.js +1 -2
  81. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,166 @@
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.23.1
7
+
8
+ _Dec 5, 2024_
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 German locale on the Data Grid component
13
+ - 🐞 Bugfixes
14
+
15
+ Special thanks go out to the community contributors who have helped make this release possible:
16
+ @lhilgert9.
17
+
18
+ Following are all team members who have contributed to this release:
19
+ @arthurbalduini, @cherniavskii, @flaviendelangle, @JCQuintas, @LukasTy and @MBilalShafi.
20
+
21
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
22
+
23
+ ### Data Grid
24
+
25
+ #### `@mui/x-data-grid@7.23.1`
26
+
27
+ - [DataGrid] Make column autosizing work with flex columns (#15712) @cherniavskii
28
+ - [l10n] Improve German (de-DE) locale (#15641) @lhilgert9
29
+
30
+ #### `@mui/x-data-grid-pro@7.23.1` [![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.23.1`, plus:
33
+
34
+ - [DataGridPro] Cleanup pinned rows on removal (#15702) @cherniavskii
35
+
36
+ #### `@mui/x-data-grid-premium@7.23.1` [![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@7.23.1`.
39
+
40
+ ### Date and Time Pickers
41
+
42
+ #### `@mui/x-date-pickers@7.23.1`
43
+
44
+ - [TimePicker] Prevent mouse events after `touchend` event (#15430) @arthurbalduini
45
+
46
+ #### `@mui/x-date-pickers-pro@7.23.1` [![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@7.23.1`.
49
+
50
+ ### Charts
51
+
52
+ #### `@mui/x-charts@7.23.1`
53
+
54
+ - [charts] Improve SVG `pattern` and `gradient` support (#15724) @JCQuintas
55
+
56
+ #### `@mui/x-charts-pro@7.23.1` [![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@7.23.1`.
59
+
60
+ ### Docs
61
+
62
+ - [docs] Fix Pickers theme augmentation example (#15675) @LukasTy
63
+ - [docs] Remove duplicated warning (#15715) @cherniavskii
64
+ - [test] Force hover in headless Chrome (#15711) @cherniavskii
65
+ - [docs-infra] Bump `@mui/internal-markdown` to support nested demo imports (#15738) @alexfauquette
66
+ - [docs] Improve SEO titles for the Data Grid (#15695) @MBilalShafi
67
+
68
+ ### Core
69
+
70
+ - [core] Add `@mui/x-tree-view-pro` to `releaseChangelog` (#15747) @flaviendelangle
71
+
72
+ ## 7.23.0
73
+
74
+ _Nov 29, 2024_
75
+
76
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
77
+
78
+ - ✨ Support for a new display mode on the Data Grid with the [List View feature](https://mui.com/x/react-data-grid/list-view/), offering an extremely flexible way to render datasets and enabling developers to adapt how data is displayed across different screen sizes.
79
+
80
+ https://github.com/user-attachments/assets/61286adc-03fc-4323-9739-8ca726fcc16c
81
+
82
+ - ⚛️ React 19 support
83
+ - 📚 Documentation improvements
84
+ - 🌍 Improve Spanish, Portuguese, Chinese locales on the Data Grid component.
85
+ - 🌍 Improve Dutch locale on the Date and Time Picker components.
86
+ - 🐞 Bugfixes
87
+
88
+ Special thanks go out to the community contributors who have helped make this release possible:
89
+ @dloeda, @headironc, @mathzdev, @nphmuller, @lhilgert9, @lauri865.
90
+ Following are all team members who have contributed to this release:
91
+ @oliviertassinari, @arminmeh, @KenanYusuf, @flaviendelangle, @MBilalShafi.
92
+
93
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
94
+
95
+ ### Data Grid
96
+
97
+ #### `@mui/x-data-grid@v7.23.0`
98
+
99
+ - [DataGrid] React 19 support (#15557) @arminmeh
100
+ - [DataGrid] Change test dom check from `/jsdom/` to `/jsdom|HappyDOM/`. (#15642) @jedesroches
101
+ - [DataGrid] Fix last separator not being hidden when grid is scrollable (#15551) @KenanYusuf
102
+ - [DataGrid] Fix order of spread props on toolbar items (#15556) @KenanYusuf
103
+ - [DataGrid] Fix row-spanning in combination with column-pinning (#15460) @lhilgert9
104
+ - [DataGrid] Improve resize performance (#15592) @lauri865
105
+ - [DataGrid] Support column virtualization with dynamic row height (#15567) @cherniavskii
106
+ - [DataGrid] Improve `GridCell` performance (#15621) @lauri865
107
+ - [l10n] Improve Chinese (zh-CN) locale (#15570) @headironc
108
+ - [l10n] Improve Portuguese (pt-PT) locale (#15561) @mathzdev
109
+
110
+ #### `@mui/x-data-grid-pro@v7.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
111
+
112
+ Same changes as in `@mui/x-data-grid@v7.23.0`, plus:
113
+
114
+ - [DataGridPro] Fix header filtering with `boolean` column type (#15640) @k-rajat19
115
+ - [DataGridPro] Fix pagination state not updating if the data source response has no rows (#15643) @zinoroman
116
+ - [DataGridPro] Fix selection propagation issue on initialization (#15593) @MBilalShafi
117
+
118
+ #### `@mui/x-data-grid-premium@v7.23.0` [![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@v7.23.0`.
121
+
122
+ ### Date and Time Pickers
123
+
124
+ #### `@mui/x-date-pickers@v7.23.0`
125
+
126
+ - [pickers] React 19 support (#15557) @arminmeh
127
+ - [pickers] Fix DST issue with `America/Asuncion` timezone and `AdapterMoment` (#15653) @flaviendelangle
128
+ - [pickers] Use `props.referenceDate` timezone when `props.value` and `props.defaultValue` are not defined (#15544) @flaviendelangle
129
+ - [l10n] Improve Dutch (nl-NL) locale (#15564) @nphmuller
130
+
131
+ #### `@mui/x-date-pickers-pro@v7.23.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-date-pickers@v7.23.0`.
134
+
135
+ ### Charts
136
+
137
+ #### `@mui/x-charts@v7.23.0`
138
+
139
+ - [charts] React 19 support (#15557) @arminmeh
140
+ - [charts] Prevent invalid `releasePointerCapture` (#15609) @alexfauquette
141
+
142
+ #### `@mui/x-charts-pro@v7.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
143
+
144
+ Same changes as in `@mui/x-charts@v7.23.0`.
145
+
146
+ ### Tree View
147
+
148
+ #### `@mui/x-tree-view@v7.23.0`
149
+
150
+ - [TreeView] React 19 support (#15557) @arminmeh
151
+
152
+ #### `@mui/x-tree-view-pro@7.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
153
+
154
+ Same changes as in `@mui/x-tree-view@7.23.0`.
155
+
156
+ ### Docs
157
+
158
+ - [docs] Add data caching to lazy loaded detail panel demo (#15555) @cherniavskii
159
+ - [docs] Remove selectors section from list view docs (#15639) @KenanYusuf
160
+ - [docs] Add documentation for the list view feature (#15344) @KenanYusuf
161
+
162
+ ### Core
163
+
164
+ - [core] Update @mui/monorepo (#15574) @oliviertassinari
165
+
6
166
  ## 7.22.3
7
167
 
8
168
  _Nov 21, 2024_
@@ -766,5 +766,13 @@ DataGridRaw.propTypes = {
766
766
  * If `true`, the Data Grid will auto span the cells over the rows having the same value.
767
767
  * @default false
768
768
  */
769
- unstable_rowSpanning: PropTypes.bool
769
+ unstable_rowSpanning: PropTypes.bool,
770
+ /**
771
+ * If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
772
+ * By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
773
+ * For datasets with a large number of columns, this can cause performance issues.
774
+ * The downside of enabling this prop is that the row height will be estimated based the cells that are currently rendered, which can cause row height change when scrolling horizontally.
775
+ * @default false
776
+ */
777
+ virtualizeColumnsWithAutoRowHeight: PropTypes.bool
770
778
  };
package/README.md CHANGED
@@ -15,9 +15,9 @@ This component has the following peer dependencies that you will need to install
15
15
 
16
16
  ```json
17
17
  "peerDependencies": {
18
- "@mui/material": "^5.15.14",
19
- "react": "^17.0.0 || ^18.0.0",
20
- "react-dom": "^17.0.0 || ^18.0.0"
18
+ "@mui/material": "^5.15.14 || ^6.0.0",
19
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
20
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
21
21
  },
22
22
  ```
23
23
 
@@ -15,7 +15,6 @@ import { useGridSelector, objectShallowCompare } from "../../hooks/utils/useGrid
15
15
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
16
16
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
17
17
  import { gridFocusCellSelector } from "../../hooks/features/focus/gridFocusStateSelector.js";
18
- import { MissingRowIdError } from "../../hooks/features/rows/useGridParamsApi.js";
19
18
  import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../../utils/cellBorderUtils.js";
20
19
  import { GridPinnedColumnPosition } from "../../hooks/features/columns/gridColumnsInterfaces.js";
21
20
  import { gridRowSpanningHiddenCellsSelector, gridRowSpanningSpannedCellsSelector } from "../../hooks/features/rows/gridRowSpanningSelectors.js";
@@ -114,16 +113,13 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
114
113
  // This is required because `.getCellParams` tries to get the `state.rows.tree` entry
115
114
  // associated with `rowId`/`fieldId`, but this selector runs after the state has been
116
115
  // updated, while `rowId`/`fieldId` reference an entry in the old state.
117
- try {
118
- const result = apiRef.current.getCellParams(rowId, field);
119
- result.api = apiRef.current;
120
- return result;
121
- } catch (error) {
122
- if (error instanceof MissingRowIdError) {
123
- return EMPTY_CELL_PARAMS;
124
- }
125
- throw error;
116
+ const row = apiRef.current.getRow(rowId);
117
+ if (!row) {
118
+ return EMPTY_CELL_PARAMS;
126
119
  }
120
+ const result = apiRef.current.getCellParams(rowId, field);
121
+ result.api = apiRef.current;
122
+ return result;
127
123
  }, objectShallowCompare);
128
124
  const isSelected = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
129
125
  id: rowId,
@@ -211,6 +207,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
211
207
  padding: 0,
212
208
  opacity: 0,
213
209
  width: 0,
210
+ height: 0,
214
211
  border: 0
215
212
  };
216
213
  }
@@ -229,6 +226,9 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
229
226
  if (rowSpan > 1) {
230
227
  cellStyle.height = `calc(var(--height) * ${rowSpan})`;
231
228
  cellStyle.zIndex = 5;
229
+ if (isLeftPinned || isRightPinned) {
230
+ cellStyle.zIndex = 6;
231
+ }
232
232
  }
233
233
  return cellStyle;
234
234
  }, [width, isNotVisible, styleProp, pinnedOffset, pinnedPosition, isRtl, rowSpan]);
@@ -36,7 +36,7 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
36
36
  return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
37
37
  title: apiRef.current.getLocaleText('toolbarColumnsLabel'),
38
38
  enterDelay: 1000
39
- }, tooltipProps, rootProps.slotProps?.baseTooltip, {
39
+ }, rootProps.slotProps?.baseTooltip, tooltipProps, {
40
40
  children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
41
41
  ref: ref,
42
42
  id: columnButtonId,
@@ -45,10 +45,9 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
45
45
  "aria-haspopup": "menu",
46
46
  "aria-expanded": isOpen,
47
47
  "aria-controls": isOpen ? columnPanelId : undefined,
48
- startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
49
- }, buttonProps, {
48
+ startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {}),
50
49
  onClick: showColumns
51
- }, rootProps.slotProps?.baseButton, {
50
+ }, rootProps.slotProps?.baseButton, buttonProps, {
52
51
  children: apiRef.current.getLocaleText('toolbarColumns')
53
52
  }))
54
53
  }));
@@ -85,7 +85,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
85
85
  children: [/*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
86
86
  title: apiRef.current.getLocaleText('toolbarDensityLabel'),
87
87
  enterDelay: 1000
88
- }, tooltipProps, rootProps.slotProps?.baseTooltip, {
88
+ }, rootProps.slotProps?.baseTooltip, tooltipProps, {
89
89
  children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
90
90
  ref: handleRef,
91
91
  size: "small",
@@ -94,10 +94,9 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
94
94
  "aria-haspopup": "menu",
95
95
  "aria-expanded": open,
96
96
  "aria-controls": open ? densityMenuId : undefined,
97
- id: densityButtonId
98
- }, buttonProps, {
97
+ id: densityButtonId,
99
98
  onClick: handleDensitySelectorOpen
100
- }, rootProps.slotProps?.baseButton, {
99
+ }, rootProps.slotProps?.baseButton, buttonProps, {
101
100
  children: apiRef.current.getLocaleText('toolbarDensity')
102
101
  }))
103
102
  })), /*#__PURE__*/_jsx(GridMenu, {
@@ -43,7 +43,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
43
43
  children: [/*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
44
44
  title: apiRef.current.getLocaleText('toolbarExportLabel'),
45
45
  enterDelay: 1000
46
- }, tooltipProps, rootProps.slotProps?.baseTooltip, {
46
+ }, rootProps.slotProps?.baseTooltip, tooltipProps, {
47
47
  children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
48
48
  ref: handleRef,
49
49
  size: "small",
@@ -52,10 +52,9 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
52
52
  "aria-label": apiRef.current.getLocaleText('toolbarExportLabel'),
53
53
  "aria-haspopup": "menu",
54
54
  "aria-controls": open ? exportMenuId : undefined,
55
- id: exportButtonId
56
- }, buttonProps, {
55
+ id: exportButtonId,
57
56
  onClick: handleMenuOpen
58
- }, rootProps.slotProps?.baseButton, {
57
+ }, rootProps.slotProps?.baseButton, buttonProps, {
59
58
  children: apiRef.current.getLocaleText('toolbarExport')
60
59
  }))
61
60
  })), /*#__PURE__*/_jsx(GridMenu, {
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ButtonProps } from '@mui/material/Button';
3
3
  import { TooltipProps } from '@mui/material/Tooltip';
4
+ import { BadgeProps } from '@mui/material/Badge';
4
5
  export interface GridToolbarFilterButtonProps {
5
6
  /**
6
7
  * The props used for each slot inside.
@@ -9,6 +10,7 @@ export interface GridToolbarFilterButtonProps {
9
10
  slotProps?: {
10
11
  button?: Partial<ButtonProps>;
11
12
  tooltip?: Partial<TooltipProps>;
13
+ badge?: Partial<BadgeProps>;
12
14
  };
13
15
  }
14
16
  declare const GridToolbarFilterButton: React.ForwardRefExoticComponent<GridToolbarFilterButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -37,6 +37,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
37
37
  } = props;
38
38
  const buttonProps = slotProps.button || {};
39
39
  const tooltipProps = slotProps.tooltip || {};
40
+ const badgeProps = slotProps.badge || {};
40
41
  const apiRef = useGridApiContext();
41
42
  const rootProps = useGridRootProps();
42
43
  const activeFilters = useGridSelector(apiRef, gridFilterActiveItemsSelector);
@@ -94,7 +95,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
94
95
  return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
95
96
  title: tooltipContentNode,
96
97
  enterDelay: 1000
97
- }, tooltipProps, rootProps.slotProps?.baseTooltip, {
98
+ }, rootProps.slotProps?.baseTooltip, tooltipProps, {
98
99
  children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
99
100
  ref: ref,
100
101
  id: filterButtonId,
@@ -103,14 +104,14 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
103
104
  "aria-controls": isOpen ? filterPanelId : undefined,
104
105
  "aria-expanded": isOpen,
105
106
  "aria-haspopup": true,
106
- startIcon: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
107
+ startIcon: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, _extends({
107
108
  badgeContent: activeFilters.length,
108
- color: "primary",
109
+ color: "primary"
110
+ }, rootProps.slotProps?.baseBadge, badgeProps, {
109
111
  children: /*#__PURE__*/_jsx(rootProps.slots.openFilterButtonIcon, {})
110
- })
111
- }, buttonProps, {
112
+ })),
112
113
  onClick: toggleFilter
113
- }, rootProps.slotProps?.baseButton, {
114
+ }, rootProps.slotProps?.baseButton, buttonProps, {
114
115
  children: apiRef.current.getLocaleText('toolbarFilters')
115
116
  }))
116
117
  }));
@@ -78,6 +78,7 @@ function GridToolbarQuickFilter(props) {
78
78
  apiRef.current.setQuickFilterValues(newQuickFilterValues);
79
79
  }, [apiRef, quickFilterParser]);
80
80
  const debouncedUpdateSearchValue = React.useMemo(() => debounce(updateSearchValue, debounceMs), [updateSearchValue, debounceMs]);
81
+ React.useEffect(() => debouncedUpdateSearchValue.clear, [debouncedUpdateSearchValue]);
81
82
  const handleSearchValueChange = React.useCallback(event => {
82
83
  const newSearchValue = event.target.value;
83
84
  setSearchValue(newSearchValue);
@@ -56,5 +56,6 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
56
56
  sortingMode: 'client',
57
57
  sortingOrder: ['asc', 'desc', null],
58
58
  throttleRowsMs: 0,
59
- unstable_rowSpanning: false
59
+ unstable_rowSpanning: false,
60
+ virtualizeColumnsWithAutoRowHeight: false
60
61
  };
@@ -283,7 +283,7 @@ export const useGridColumnHeaders = props => {
283
283
  fields: headerInfo.fields,
284
284
  colIndex: headerInfo.colIndex,
285
285
  depth: depth,
286
- isLastColumn: headerInfo.colIndex === visibleColumns.length - headerInfo.fields.length,
286
+ isLastColumn: index === visibleColumnGroupHeader.length - 1,
287
287
  maxDepth: headerGroupingMaxDepth,
288
288
  height: dimensions.groupHeaderHeight,
289
289
  hasFocus: hasFocus,
@@ -489,7 +489,8 @@ export const useGridColumnResize = (apiRef, props) => {
489
489
  const widthByField = extractColumnWidths(apiRef, options, columns);
490
490
  const newColumns = columns.map(column => _extends({}, column, {
491
491
  width: widthByField[column.field],
492
- computedWidth: widthByField[column.field]
492
+ computedWidth: widthByField[column.field],
493
+ flex: 0
493
494
  }));
494
495
  if (options.expand) {
495
496
  const visibleColumns = state.orderedFields.map(field => state.lookup[field]).filter(c => state.columnVisibilityModel[c.field] !== false);
@@ -66,6 +66,7 @@ export function useGridDimensions(apiRef, props) {
66
66
  const rightPinnedWidth = pinnedColumns.right.reduce((w, col) => w + col.computedWidth, 0);
67
67
  const [savedSize, setSavedSize] = React.useState();
68
68
  const debouncedSetSavedSize = React.useMemo(() => throttle(setSavedSize, props.resizeThrottleMs), [props.resizeThrottleMs]);
69
+ React.useEffect(() => debouncedSetSavedSize.clear, [debouncedSetSavedSize]);
69
70
  const previousSize = React.useRef();
70
71
  const getRootDimensions = () => apiRef.current.state.dimensions;
71
72
  const setDimensions = useEventCallback(dimensions => {
@@ -238,7 +239,7 @@ export function useGridDimensions(apiRef, props) {
238
239
  rootDimensionsRef.current = size;
239
240
 
240
241
  // jsdom has no layout capabilities
241
- const isJSDOM = /jsdom/.test(window.navigator.userAgent);
242
+ const isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
242
243
  if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
243
244
  logger.error(['The parent DOM element of the Data Grid has an empty height.', 'Please make sure that this element has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
244
245
  errorShown.current = true;
@@ -6,6 +6,7 @@ export * from './density';
6
6
  export * from './editing';
7
7
  export * from './filter';
8
8
  export * from './focus';
9
+ export * from './listView';
9
10
  export * from './pagination';
10
11
  export * from './preferencesPanel';
11
12
  export * from './rows';
@@ -7,6 +7,7 @@ export * from "./density/index.js";
7
7
  export * from "./editing/index.js";
8
8
  export * from "./filter/index.js";
9
9
  export * from "./focus/index.js";
10
+ export * from "./listView/index.js";
10
11
  export * from "./pagination/index.js";
11
12
  export * from "./preferencesPanel/index.js";
12
13
  export * from "./rows/index.js";
@@ -1,5 +1,7 @@
1
1
  import { GridStateCommunity } from '../../../models/gridStateCommunity';
2
2
  /**
3
- * Get a list column definition
3
+ * Get the list column definition
4
+ * @category List View
5
+ * @ignore - Do not document
4
6
  */
5
7
  export declare const gridListColumnSelector: (state: GridStateCommunity) => import("./useGridListView").GridListViewState;
@@ -1,4 +1,6 @@
1
1
  /**
2
- * Get a list column definition
2
+ * Get the list column definition
3
+ * @category List View
4
+ * @ignore - Do not document
3
5
  */
4
6
  export const gridListColumnSelector = state => state.listViewColumn;
@@ -0,0 +1 @@
1
+ export * from './gridListViewSelectors';
@@ -0,0 +1 @@
1
+ export * from "./gridListViewSelectors.js";
@@ -248,11 +248,7 @@ export const useGridRowSelection = (apiRef, props) => {
248
248
  /*
249
249
  * EVENTS
250
250
  */
251
- const isFirstRender = React.useRef(true);
252
251
  const removeOutdatedSelection = React.useCallback((sortModelUpdated = false) => {
253
- if (isFirstRender.current) {
254
- return;
255
- }
256
252
  const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
257
253
  const rowsLookup = gridRowsLookupSelector(apiRef);
258
254
  const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
@@ -480,9 +476,4 @@ export const useGridRowSelection = (apiRef, props) => {
480
476
  React.useEffect(() => {
481
477
  runIfRowSelectionIsEnabled(removeOutdatedSelection);
482
478
  }, [removeOutdatedSelection, runIfRowSelectionIsEnabled]);
483
- React.useEffect(() => {
484
- if (isFirstRender.current) {
485
- isFirstRender.current = false;
486
- }
487
- }, []);
488
479
  };
@@ -12,7 +12,7 @@ export declare const useGridVirtualScroller: () => {
12
12
  renderContext?: GridRenderContext;
13
13
  }) => React.ReactNode[];
14
14
  getContainerProps: () => {
15
- ref: React.RefObject<HTMLDivElement>;
15
+ ref: (node: HTMLDivElement | null) => (() => void) | undefined;
16
16
  };
17
17
  getScrollerProps: () => {
18
18
  ref: React.RefObject<HTMLDivElement>;
@@ -4,8 +4,8 @@ import * as ReactDOM from 'react-dom';
4
4
  import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback } from '@mui/utils';
5
5
  import useLazyRef from '@mui/utils/useLazyRef';
6
6
  import useTimeout from '@mui/utils/useTimeout';
7
- import { useResizeObserver } from '@mui/x-internals/useResizeObserver';
8
7
  import { useRtl } from '@mui/system/RtlProvider';
8
+ import reactMajor from '@mui/x-internals/reactMajor';
9
9
  import { useGridPrivateApiContext } from "../../utils/useGridPrivateApiContext.js";
10
10
  import { useGridRootProps } from "../../utils/useGridRootProps.js";
11
11
  import { useGridSelector } from "../../utils/useGridSelector.js";
@@ -48,7 +48,7 @@ const createScrollCache = (isRtl, rowBufferPx, columnBufferPx, verticalBuffer, h
48
48
  let isJSDOM = false;
49
49
  try {
50
50
  if (typeof window !== 'undefined') {
51
- isJSDOM = /jsdom/.test(window.navigator.userAgent);
51
+ isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
52
52
  }
53
53
  } catch (_) {
54
54
  /* ignore */
@@ -86,7 +86,44 @@ export const useGridVirtualScroller = () => {
86
86
  const contentHeight = dimensions.contentSize.height;
87
87
  const columnsTotalWidth = dimensions.columnsTotalWidth;
88
88
  const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
89
- useResizeObserver(mainRef, () => apiRef.current.resize());
89
+ const mainRefCallback = React.useCallback(node => {
90
+ mainRef.current = node;
91
+ if (!node) {
92
+ return undefined;
93
+ }
94
+ const initialRect = node.getBoundingClientRect();
95
+ let lastSize = {
96
+ width: initialRect.width,
97
+ height: initialRect.height
98
+ };
99
+ apiRef.current.publishEvent('resize', lastSize);
100
+ if (typeof ResizeObserver === 'undefined') {
101
+ return undefined;
102
+ }
103
+ const observer = new ResizeObserver(entries => {
104
+ const entry = entries[0];
105
+ if (!entry) {
106
+ return;
107
+ }
108
+ const newSize = {
109
+ width: entry.contentRect.width,
110
+ height: entry.contentRect.height
111
+ };
112
+ if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
113
+ return;
114
+ }
115
+ apiRef.current.publishEvent('resize', newSize);
116
+ lastSize = newSize;
117
+ });
118
+ observer.observe(node);
119
+ if (reactMajor >= 19) {
120
+ return () => {
121
+ mainRef.current = null;
122
+ observer.disconnect();
123
+ };
124
+ }
125
+ return undefined;
126
+ }, [apiRef, mainRef]);
90
127
 
91
128
  /*
92
129
  * Scroll context logic
@@ -137,9 +174,13 @@ export const useGridVirtualScroller = () => {
137
174
  previousContextScrollPosition.current = scrollPosition.current;
138
175
  }, [apiRef, dimensions.isReady]);
139
176
  const triggerUpdateRenderContext = useEventCallback(() => {
177
+ const scroller = scrollerRef.current;
178
+ if (!scroller) {
179
+ return undefined;
180
+ }
140
181
  const newScroll = {
141
- top: scrollerRef.current.scrollTop,
142
- left: scrollerRef.current.scrollLeft
182
+ top: scroller.scrollTop,
183
+ left: scroller.scrollLeft
143
184
  };
144
185
  const dx = newScroll.left - scrollPosition.current.left;
145
186
  const dy = newScroll.top - scrollPosition.current.top;
@@ -389,10 +430,6 @@ export const useGridVirtualScroller = () => {
389
430
  React.useEffect(() => {
390
431
  apiRef.current.publishEvent('virtualScrollerContentSizeChange');
391
432
  }, [apiRef, contentSize]);
392
- useEnhancedEffect(() => {
393
- // FIXME: Is this really necessary?
394
- apiRef.current.resize();
395
- }, [apiRef, rowsMeta.currentPageTotalHeight]);
396
433
  useEnhancedEffect(() => {
397
434
  // TODO a scroll reset should not be necessary
398
435
  if (enabledForColumns) {
@@ -428,7 +465,7 @@ export const useGridVirtualScroller = () => {
428
465
  setPanels,
429
466
  getRows,
430
467
  getContainerProps: () => ({
431
- ref: mainRef
468
+ ref: mainRefCallback
432
469
  }),
433
470
  getScrollerProps: () => ({
434
471
  ref: scrollerRef,
@@ -485,7 +522,8 @@ function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
485
522
  pinnedColumns: gridVisiblePinnedColumnDefinitionsSelector(apiRef),
486
523
  visibleColumns,
487
524
  hiddenCellsOriginMap,
488
- listView: rootProps.unstable_listView ?? false
525
+ listView: rootProps.unstable_listView ?? false,
526
+ virtualizeColumnsWithAutoRowHeight: rootProps.virtualizeColumnsWithAutoRowHeight
489
527
  };
490
528
  }
491
529
  function computeRenderContext(inputs, scrollPosition, scrollCache) {
@@ -533,11 +571,13 @@ function computeRenderContext(inputs, scrollPosition, scrollCache) {
533
571
  positions: inputs.rowsMeta.positions,
534
572
  lastSize: inputs.lastRowHeight
535
573
  });
536
- for (let i = firstRowToRender; i < lastRowToRender && !hasRowWithAutoHeight; i += 1) {
537
- const row = inputs.rows[i];
538
- hasRowWithAutoHeight = inputs.apiRef.current.rowHasAutoHeight(row.id);
574
+ if (!inputs.virtualizeColumnsWithAutoRowHeight) {
575
+ for (let i = firstRowToRender; i < lastRowToRender && !hasRowWithAutoHeight; i += 1) {
576
+ const row = inputs.rows[i];
577
+ hasRowWithAutoHeight = inputs.apiRef.current.rowHasAutoHeight(row.id);
578
+ }
539
579
  }
540
- if (!hasRowWithAutoHeight) {
580
+ if (!hasRowWithAutoHeight || inputs.virtualizeColumnsWithAutoRowHeight) {
541
581
  firstColumnIndex = binarySearch(realLeft, inputs.columnPositions, {
542
582
  atStart: true,
543
583
  lastPosition: inputs.columnsTotalWidth
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.22.3
2
+ * @mui/x-data-grid v7.23.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the