@mui/x-data-grid 7.22.2 → 7.23.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 (232) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/DataGrid/DataGrid.js +9 -1
  3. package/README.md +3 -3
  4. package/components/GridDetailPanels.js +0 -1
  5. package/components/GridPinnedRows.js +0 -1
  6. package/components/GridRow.d.ts +2 -2
  7. package/components/GridRow.js +1 -1
  8. package/components/base/GridOverlays.js +5 -6
  9. package/components/cell/GridCell.d.ts +41 -3
  10. package/components/cell/GridCell.js +11 -19
  11. package/components/cell/GridEditInputCell.js +0 -67
  12. package/components/columnsManagement/GridColumnsManagement.d.ts +2 -0
  13. package/components/columnsManagement/GridColumnsManagement.js +53 -6
  14. package/components/panel/GridPanel.d.ts +1 -1
  15. package/components/toolbar/GridToolbar.d.ts +2 -2
  16. package/components/toolbar/GridToolbar.js +12 -4
  17. package/components/toolbar/GridToolbarColumnsButton.js +3 -4
  18. package/components/toolbar/GridToolbarDensitySelector.js +3 -4
  19. package/components/toolbar/GridToolbarExport.d.ts +2 -2
  20. package/components/toolbar/GridToolbarExport.js +4 -3
  21. package/components/toolbar/GridToolbarExportContainer.js +3 -4
  22. package/components/toolbar/GridToolbarFilterButton.d.ts +2 -0
  23. package/components/toolbar/GridToolbarFilterButton.js +7 -6
  24. package/components/toolbar/GridToolbarQuickFilter.js +1 -0
  25. package/components/toolbar/index.d.ts +1 -1
  26. package/constants/dataGridPropsDefaultValues.js +2 -1
  27. package/constants/gridClasses.d.ts +4 -0
  28. package/constants/gridClasses.js +1 -1
  29. package/constants/localeTextConstants.js +1 -0
  30. package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  31. package/hooks/features/dimensions/useGridDimensions.js +2 -1
  32. package/hooks/features/export/useGridCsvExport.js +1 -1
  33. package/hooks/features/export/useGridPrintExport.js +1 -1
  34. package/hooks/features/index.d.ts +1 -0
  35. package/hooks/features/index.js +1 -0
  36. package/hooks/features/listView/gridListViewSelectors.d.ts +3 -1
  37. package/hooks/features/listView/gridListViewSelectors.js +3 -1
  38. package/hooks/features/listView/index.d.ts +1 -0
  39. package/hooks/features/listView/index.js +1 -0
  40. package/hooks/features/pagination/useGridPaginationModel.js +2 -2
  41. package/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  42. package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  43. package/hooks/features/rows/gridRowsUtils.js +1 -5
  44. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
  45. package/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
  46. package/hooks/utils/useGridSelector.d.ts +3 -2
  47. package/hooks/utils/useGridSelector.js +27 -2
  48. package/index.d.ts +0 -1
  49. package/index.js +1 -1
  50. package/joy/joySlots.js +7 -2
  51. package/locales/arSD.js +1 -0
  52. package/locales/beBY.js +1 -0
  53. package/locales/bgBG.js +2 -0
  54. package/locales/csCZ.js +2 -0
  55. package/locales/daDK.js +2 -0
  56. package/locales/deDE.js +2 -0
  57. package/locales/elGR.js +1 -0
  58. package/locales/esES.js +5 -4
  59. package/locales/faIR.js +2 -0
  60. package/locales/fiFI.js +2 -0
  61. package/locales/frFR.js +2 -0
  62. package/locales/heIL.js +2 -0
  63. package/locales/hrHR.js +2 -0
  64. package/locales/huHU.js +2 -0
  65. package/locales/isIS.js +1 -0
  66. package/locales/itIT.js +2 -0
  67. package/locales/jaJP.js +2 -0
  68. package/locales/koKR.js +1 -0
  69. package/locales/nbNO.js +2 -0
  70. package/locales/nlNL.js +2 -0
  71. package/locales/nnNO.js +2 -0
  72. package/locales/plPL.js +1 -0
  73. package/locales/ptBR.js +1 -0
  74. package/locales/ptPT.js +1 -0
  75. package/locales/roRO.js +1 -0
  76. package/locales/ruRU.js +2 -0
  77. package/locales/skSK.js +1 -0
  78. package/locales/svSE.js +6 -5
  79. package/locales/trTR.js +4 -2
  80. package/locales/ukUA.js +1 -0
  81. package/locales/urPK.js +1 -0
  82. package/locales/viVN.js +2 -0
  83. package/locales/zhCN.js +5 -4
  84. package/locales/zhHK.js +1 -0
  85. package/locales/zhTW.js +1 -0
  86. package/models/api/gridCoreApi.d.ts +1 -1
  87. package/models/api/gridLocaleTextApi.d.ts +1 -0
  88. package/models/colDef/gridColDef.d.ts +24 -24
  89. package/models/gridDataSource.d.ts +12 -12
  90. package/models/props/DataGridProps.d.ts +9 -1
  91. package/modern/DataGrid/DataGrid.js +9 -1
  92. package/modern/components/GridDetailPanels.js +0 -1
  93. package/modern/components/GridPinnedRows.js +0 -1
  94. package/modern/components/GridRow.js +1 -1
  95. package/modern/components/base/GridOverlays.js +5 -6
  96. package/modern/components/cell/GridCell.js +11 -19
  97. package/modern/components/cell/GridEditInputCell.js +0 -67
  98. package/modern/components/columnsManagement/GridColumnsManagement.js +53 -6
  99. package/modern/components/toolbar/GridToolbar.js +12 -4
  100. package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -4
  101. package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -4
  102. package/modern/components/toolbar/GridToolbarExport.js +4 -3
  103. package/modern/components/toolbar/GridToolbarExportContainer.js +3 -4
  104. package/modern/components/toolbar/GridToolbarFilterButton.js +7 -6
  105. package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -0
  106. package/modern/constants/dataGridPropsDefaultValues.js +2 -1
  107. package/modern/constants/gridClasses.js +1 -1
  108. package/modern/constants/localeTextConstants.js +1 -0
  109. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  110. package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
  111. package/modern/hooks/features/export/useGridCsvExport.js +1 -1
  112. package/modern/hooks/features/export/useGridPrintExport.js +1 -1
  113. package/modern/hooks/features/index.js +1 -0
  114. package/modern/hooks/features/listView/gridListViewSelectors.js +3 -1
  115. package/modern/hooks/features/listView/index.js +1 -0
  116. package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -2
  117. package/modern/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  118. package/modern/hooks/features/rows/gridRowsUtils.js +1 -5
  119. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
  120. package/modern/hooks/utils/useGridSelector.js +27 -2
  121. package/modern/index.js +1 -1
  122. package/modern/joy/joySlots.js +7 -2
  123. package/modern/locales/arSD.js +1 -0
  124. package/modern/locales/beBY.js +1 -0
  125. package/modern/locales/bgBG.js +2 -0
  126. package/modern/locales/csCZ.js +2 -0
  127. package/modern/locales/daDK.js +2 -0
  128. package/modern/locales/deDE.js +2 -0
  129. package/modern/locales/elGR.js +1 -0
  130. package/modern/locales/esES.js +5 -4
  131. package/modern/locales/faIR.js +2 -0
  132. package/modern/locales/fiFI.js +2 -0
  133. package/modern/locales/frFR.js +2 -0
  134. package/modern/locales/heIL.js +2 -0
  135. package/modern/locales/hrHR.js +2 -0
  136. package/modern/locales/huHU.js +2 -0
  137. package/modern/locales/isIS.js +1 -0
  138. package/modern/locales/itIT.js +2 -0
  139. package/modern/locales/jaJP.js +2 -0
  140. package/modern/locales/koKR.js +1 -0
  141. package/modern/locales/nbNO.js +2 -0
  142. package/modern/locales/nlNL.js +2 -0
  143. package/modern/locales/nnNO.js +2 -0
  144. package/modern/locales/plPL.js +1 -0
  145. package/modern/locales/ptBR.js +1 -0
  146. package/modern/locales/ptPT.js +1 -0
  147. package/modern/locales/roRO.js +1 -0
  148. package/modern/locales/ruRU.js +2 -0
  149. package/modern/locales/skSK.js +1 -0
  150. package/modern/locales/svSE.js +6 -5
  151. package/modern/locales/trTR.js +4 -2
  152. package/modern/locales/ukUA.js +1 -0
  153. package/modern/locales/urPK.js +1 -0
  154. package/modern/locales/viVN.js +2 -0
  155. package/modern/locales/zhCN.js +5 -4
  156. package/modern/locales/zhHK.js +1 -0
  157. package/modern/locales/zhTW.js +1 -0
  158. package/modern/utils/createSelector.js +11 -1
  159. package/modern/utils/utils.js +1 -3
  160. package/node/DataGrid/DataGrid.js +9 -1
  161. package/node/components/GridDetailPanels.js +0 -1
  162. package/node/components/GridPinnedRows.js +0 -1
  163. package/node/components/GridRow.js +1 -1
  164. package/node/components/base/GridOverlays.js +5 -6
  165. package/node/components/cell/GridCell.js +11 -19
  166. package/node/components/cell/GridEditInputCell.js +0 -67
  167. package/node/components/columnsManagement/GridColumnsManagement.js +53 -6
  168. package/node/components/toolbar/GridToolbar.js +12 -4
  169. package/node/components/toolbar/GridToolbarColumnsButton.js +3 -4
  170. package/node/components/toolbar/GridToolbarDensitySelector.js +3 -4
  171. package/node/components/toolbar/GridToolbarExport.js +4 -3
  172. package/node/components/toolbar/GridToolbarExportContainer.js +3 -4
  173. package/node/components/toolbar/GridToolbarFilterButton.js +7 -6
  174. package/node/components/toolbar/GridToolbarQuickFilter.js +1 -0
  175. package/node/constants/dataGridPropsDefaultValues.js +2 -1
  176. package/node/constants/gridClasses.js +1 -1
  177. package/node/constants/localeTextConstants.js +1 -0
  178. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  179. package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
  180. package/node/hooks/features/export/useGridCsvExport.js +2 -2
  181. package/node/hooks/features/export/useGridPrintExport.js +2 -2
  182. package/node/hooks/features/index.js +11 -0
  183. package/node/hooks/features/listView/gridListViewSelectors.js +3 -1
  184. package/node/hooks/features/listView/index.js +16 -0
  185. package/node/hooks/features/pagination/useGridPaginationModel.js +2 -2
  186. package/node/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  187. package/node/hooks/features/rows/gridRowsUtils.js +2 -8
  188. package/node/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
  189. package/node/hooks/utils/useGridSelector.js +29 -3
  190. package/node/index.js +1 -1
  191. package/node/joy/joySlots.js +7 -2
  192. package/node/locales/arSD.js +1 -0
  193. package/node/locales/beBY.js +1 -0
  194. package/node/locales/bgBG.js +2 -0
  195. package/node/locales/csCZ.js +2 -0
  196. package/node/locales/daDK.js +2 -0
  197. package/node/locales/deDE.js +2 -0
  198. package/node/locales/elGR.js +1 -0
  199. package/node/locales/esES.js +5 -4
  200. package/node/locales/faIR.js +2 -0
  201. package/node/locales/fiFI.js +2 -0
  202. package/node/locales/frFR.js +2 -0
  203. package/node/locales/heIL.js +2 -0
  204. package/node/locales/hrHR.js +2 -0
  205. package/node/locales/huHU.js +2 -0
  206. package/node/locales/isIS.js +1 -0
  207. package/node/locales/itIT.js +2 -0
  208. package/node/locales/jaJP.js +2 -0
  209. package/node/locales/koKR.js +1 -0
  210. package/node/locales/nbNO.js +2 -0
  211. package/node/locales/nlNL.js +2 -0
  212. package/node/locales/nnNO.js +2 -0
  213. package/node/locales/plPL.js +1 -0
  214. package/node/locales/ptBR.js +1 -0
  215. package/node/locales/ptPT.js +1 -0
  216. package/node/locales/roRO.js +1 -0
  217. package/node/locales/ruRU.js +2 -0
  218. package/node/locales/skSK.js +1 -0
  219. package/node/locales/svSE.js +6 -5
  220. package/node/locales/trTR.js +4 -2
  221. package/node/locales/ukUA.js +1 -0
  222. package/node/locales/urPK.js +1 -0
  223. package/node/locales/viVN.js +2 -0
  224. package/node/locales/zhCN.js +5 -4
  225. package/node/locales/zhHK.js +1 -0
  226. package/node/locales/zhTW.js +1 -0
  227. package/node/utils/createSelector.js +11 -1
  228. package/node/utils/utils.js +1 -3
  229. package/package.json +4 -4
  230. package/utils/createSelector.d.ts +1 -1
  231. package/utils/createSelector.js +11 -1
  232. package/utils/utils.js +1 -3
@@ -5,6 +5,8 @@ import PropTypes from 'prop-types';
5
5
  import composeClasses from '@mui/utils/composeClasses';
6
6
  import FormControlLabel from '@mui/material/FormControlLabel';
7
7
  import { styled } from '@mui/material/styles';
8
+ import TextField from '@mui/material/TextField';
9
+ import { inputBaseClasses } from '@mui/material/InputBase';
8
10
  import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from "../../hooks/features/columns/gridColumnsSelector.js";
9
11
  import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
10
12
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
@@ -20,6 +22,7 @@ const useUtilityClasses = ownerState => {
20
22
  const slots = {
21
23
  root: ['columnsManagement'],
22
24
  header: ['columnsManagementHeader'],
25
+ searchInput: ['columnsManagementSearchInput'],
23
26
  footer: ['columnsManagementFooter'],
24
27
  row: ['columnsManagementRow']
25
28
  };
@@ -42,7 +45,8 @@ function GridColumnsManagement(props) {
42
45
  disableShowHideToggle = false,
43
46
  disableResetButton = false,
44
47
  toggleAllMode = 'all',
45
- getTogglableColumns
48
+ getTogglableColumns,
49
+ searchInputProps
46
50
  } = props;
47
51
  const isResetDisabled = React.useMemo(() => checkColumnVisibilityModelsSame(columnVisibilityModel, initialColumnVisibilityModel), [columnVisibilityModel, initialColumnVisibilityModel]);
48
52
  const sortedColumns = React.useMemo(() => {
@@ -109,28 +113,52 @@ function GridColumnsManagement(props) {
109
113
  }
110
114
  return false;
111
115
  };
116
+ const handleSearchReset = React.useCallback(() => {
117
+ setSearchValue('');
118
+ searchInputRef.current.focus();
119
+ }, []);
112
120
  return /*#__PURE__*/_jsxs(React.Fragment, {
113
121
  children: [/*#__PURE__*/_jsx(GridColumnsManagementHeader, {
114
122
  className: classes.header,
115
123
  ownerState: rootProps,
116
- children: /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
124
+ children: /*#__PURE__*/_jsx(SearchInput, _extends({
125
+ as: rootProps.slots.baseTextField,
126
+ ownerState: rootProps,
117
127
  placeholder: apiRef.current.getLocaleText('columnsManagementSearchTitle'),
118
128
  inputRef: searchInputRef,
129
+ className: classes.searchInput,
119
130
  value: searchValue,
120
131
  onChange: handleSearchValueChange,
121
132
  variant: "outlined",
122
133
  size: "small",
134
+ type: "search",
123
135
  InputProps: {
124
136
  startAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseInputAdornment, {
125
137
  position: "start",
126
138
  children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {})
127
139
  }),
128
- sx: {
129
- pl: 1.5
130
- }
140
+ endAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
141
+ "aria-label": apiRef.current.getLocaleText('columnsManagementDeleteIconLabel'),
142
+ size: "small",
143
+ sx: [searchValue ? {
144
+ visibility: 'visible'
145
+ } : {
146
+ visibility: 'hidden'
147
+ }],
148
+ tabIndex: -1,
149
+ onClick: handleSearchReset
150
+ }, rootProps.slotProps?.baseIconButton, {
151
+ children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterClearIcon, {
152
+ fontSize: "small"
153
+ })
154
+ }))
155
+ },
156
+ inputProps: {
157
+ 'aria-label': apiRef.current.getLocaleText('columnsManagementSearchTitle')
131
158
  },
159
+ autoComplete: "off",
132
160
  fullWidth: true
133
- }, rootProps.slotProps?.baseTextField))
161
+ }, rootProps.slotProps?.baseTextField, searchInputProps))
134
162
  }), /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
135
163
  className: classes.root,
136
164
  ownerState: rootProps,
@@ -205,6 +233,7 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
205
233
  * @returns {GridColDef['field'][]} The list of togglable columns' field names.
206
234
  */
207
235
  getTogglableColumns: PropTypes.func,
236
+ searchInputProps: PropTypes.object,
208
237
  searchPredicate: PropTypes.func,
209
238
  sort: PropTypes.oneOf(['asc', 'desc']),
210
239
  /**
@@ -239,6 +268,24 @@ const GridColumnsManagementHeader = styled('div', {
239
268
  }) => ({
240
269
  padding: theme.spacing(1.5, 3)
241
270
  }));
271
+ const SearchInput = styled(TextField, {
272
+ name: 'MuiDataGrid',
273
+ slot: 'ColumnsManagementSearchInput',
274
+ overridesResolver: (props, styles) => styles.columnsManagementSearchInput
275
+ })(({
276
+ theme
277
+ }) => ({
278
+ [`& .${inputBaseClasses.root}`]: {
279
+ padding: theme.spacing(0, 1.5, 0, 1.5)
280
+ },
281
+ [`& .${inputBaseClasses.input}::-webkit-search-decoration,
282
+ & .${inputBaseClasses.input}::-webkit-search-cancel-button,
283
+ & .${inputBaseClasses.input}::-webkit-search-results-button,
284
+ & .${inputBaseClasses.input}::-webkit-search-results-decoration`]: {
285
+ /* clears the 'X' icon from Chrome */
286
+ display: 'none'
287
+ }
288
+ }));
242
289
  const GridColumnsManagementFooter = styled('div', {
243
290
  name: 'MuiDataGrid',
244
291
  slot: 'ColumnsManagementFooter',
@@ -14,14 +14,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, ref) {
15
15
  // TODO v7: think about where export option should be passed.
16
16
  // from slotProps={{ toolbarExport: { ...exportOption } }} seems to be more appropriate
17
- const {
17
+ const _ref = props,
18
+ {
18
19
  csvOptions,
19
20
  printOptions,
20
21
  excelOptions,
21
22
  showQuickFilter = false,
22
23
  quickFilterProps = {}
23
- } = props,
24
- other = _objectWithoutPropertiesLoose(props, _excluded);
24
+ } = _ref,
25
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
25
26
  const rootProps = useGridRootProps();
26
27
  if (rootProps.disableColumnFilter && rootProps.disableColumnSelector && rootProps.disableDensitySelector && !showQuickFilter) {
27
28
  return null;
@@ -32,7 +33,7 @@ const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, re
32
33
  children: [/*#__PURE__*/_jsx(GridToolbarColumnsButton, {}), /*#__PURE__*/_jsx(GridToolbarFilterButton, {}), /*#__PURE__*/_jsx(GridToolbarDensitySelector, {}), /*#__PURE__*/_jsx(GridToolbarExport, {
33
34
  csvOptions: csvOptions,
34
35
  printOptions: printOptions
35
- // TODO: remove the reference to excelOptions in community package
36
+ // @ts-ignore
36
37
  ,
37
38
  excelOptions: excelOptions
38
39
  }), /*#__PURE__*/_jsx("div", {
@@ -47,6 +48,8 @@ process.env.NODE_ENV !== "production" ? GridToolbar.propTypes = {
47
48
  // | These PropTypes are generated from the TypeScript type definitions |
48
49
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
49
50
  // ----------------------------------------------------------------------
51
+ csvOptions: PropTypes.object,
52
+ printOptions: PropTypes.object,
50
53
  /**
51
54
  * Props passed to the quick filter component.
52
55
  */
@@ -56,6 +59,11 @@ process.env.NODE_ENV !== "production" ? GridToolbar.propTypes = {
56
59
  * @default false
57
60
  */
58
61
  showQuickFilter: PropTypes.bool,
62
+ /**
63
+ * The props used for each slot inside.
64
+ * @default {}
65
+ */
66
+ slotProps: PropTypes.object,
59
67
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
60
68
  } : void 0;
61
69
  export { GridToolbar };
@@ -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, {
@@ -82,12 +82,13 @@ process.env.NODE_ENV !== "production" ? GridPrintExportMenuItem.propTypes = {
82
82
  })
83
83
  } : void 0;
84
84
  const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExport(props, ref) {
85
- const {
85
+ const _ref = props,
86
+ {
86
87
  csvOptions = {},
87
88
  printOptions = {},
88
89
  excelOptions
89
- } = props,
90
- other = _objectWithoutPropertiesLoose(props, _excluded3);
90
+ } = _ref,
91
+ other = _objectWithoutPropertiesLoose(_ref, _excluded3);
91
92
  const apiRef = useGridApiContext();
92
93
  const preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('exportMenu', [], {
93
94
  excelOptions,
@@ -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, {
@@ -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
  };
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
2
2
  export function getDataGridUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiDataGrid', slot);
4
4
  }
5
- export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
5
+ export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
@@ -32,6 +32,7 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
32
32
  columnsManagementNoColumns: 'No columns',
33
33
  columnsManagementShowHideAllText: 'Show/Hide All',
34
34
  columnsManagementReset: 'Reset',
35
+ columnsManagementDeleteIconLabel: 'Clear',
35
36
  // Filter panel text
36
37
  filterPanelAddFilter: 'Add filter',
37
38
  filterPanelRemoveAll: 'Remove all',
@@ -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,
@@ -291,7 +291,7 @@ export const useGridColumnHeaders = props => {
291
291
  pinnedPosition: pinnedPosition,
292
292
  style: style,
293
293
  indexInSection: indexInSection,
294
- sectionLength: rowStructure.length,
294
+ sectionLength: visibleColumnGroupHeader.length,
295
295
  gridHasFiller: gridHasFiller
296
296
  }, index);
297
297
  });
@@ -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;
@@ -5,7 +5,7 @@ import { exportAs } from "../../../utils/exportAs.js";
5
5
  import { buildCSV } from "./serializers/csvSerializer.js";
6
6
  import { getColumnsToExport, defaultGetRowsToExport } from "./utils.js";
7
7
  import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.js";
8
- import { GridCsvExportMenuItem } from "../../../components/toolbar/GridToolbarExport.js";
8
+ import { GridCsvExportMenuItem } from "../../../components/toolbar/index.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  /**
11
11
  * @requires useGridColumns (state)
@@ -11,7 +11,7 @@ import { GRID_ID_AUTOGENERATED } from "../rows/gridRowsUtils.js";
11
11
  import { defaultGetRowsToExport, getColumnsToExport } from "./utils.js";
12
12
  import { getDerivedPaginationModel } from "../pagination/useGridPaginationModel.js";
13
13
  import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.js";
14
- import { GridPrintExportMenuItem } from "../../../components/toolbar/GridToolbarExport.js";
14
+ import { GridPrintExportMenuItem } from "../../../components/toolbar/index.js";
15
15
  import { getTotalHeaderHeight } from "../columns/gridColumnsUtils.js";
16
16
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from "../../../colDef/gridCheckboxSelectionColDef.js";
17
17
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -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,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.js";
@@ -75,7 +75,7 @@ export const useGridPaginationModel = (apiRef, props) => {
75
75
  pagination: _extends({}, state.pagination, {
76
76
  paginationModel: getDerivedPaginationModel(state.pagination, props.signature, paginationModel)
77
77
  })
78
- }));
78
+ }), 'setPaginationModel');
79
79
  }, [apiRef, logger, props.signature]);
80
80
  const paginationModelApi = {
81
81
  setPage,
@@ -113,7 +113,7 @@ export const useGridPaginationModel = (apiRef, props) => {
113
113
  pagination: _extends({}, state.pagination, {
114
114
  paginationModel: getDerivedPaginationModel(state.pagination, props.signature, paginationModel)
115
115
  })
116
- }));
116
+ }), 'stateRestorePreProcessing');
117
117
  return params;
118
118
  }, [apiRef, props.autoPageSize, props.signature]);
119
119
  useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
@@ -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
  };
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { gridPinnedRowsSelector } from "./gridRowsSelector.js";
3
- import { gridDimensionsSelector } from "../dimensions/gridDimensionsSelectors.js";
4
3
  export const GRID_ROOT_GROUP_ID = `auto-generated-group-node-root`;
5
4
  export const GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
6
5
  export const buildRootGroup = () => ({
@@ -285,10 +284,7 @@ export function calculatePinnedRowsHeight(apiRef) {
285
284
  bottom: bottomPinnedRowsHeight
286
285
  };
287
286
  }
288
- export function getMinimalContentHeight(apiRef) {
289
- const dimensions = gridDimensionsSelector(apiRef.current.state);
290
- return `var(--DataGrid-overlayHeight, ${2 * dimensions.rowHeight}px)`;
291
- }
287
+ export const minimalContentHeight = 'var(--DataGrid-overlayHeight, calc(var(--height) * 2))';
292
288
  export function computeRowsUpdates(apiRef, updates, getRowId) {
293
289
  const nonPinnedRowsUpdates = [];
294
290
  updates.forEach(update => {
@@ -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";
@@ -21,11 +21,11 @@ import { clamp, range } from "../../../utils/utils.js";
21
21
  import { selectedIdsLookupSelector } from "../rowSelection/gridRowSelectionSelector.js";
22
22
  import { gridRowsMetaSelector } from "../rows/gridRowsMetaSelector.js";
23
23
  import { getFirstNonSpannedColumnToRender } from "../columns/gridColumnsUtils.js";
24
- import { getMinimalContentHeight } from "../rows/gridRowsUtils.js";
25
24
  import { gridRenderContextSelector, gridVirtualizationRowEnabledSelector, gridVirtualizationColumnEnabledSelector } from "./gridVirtualizationSelectors.js";
26
25
  import { EMPTY_RENDER_CONTEXT } from "./useGridVirtualization.js";
27
26
  import { gridRowSpanningHiddenCellsOriginMapSelector } from "../rows/gridRowSpanningSelectors.js";
28
27
  import { gridListColumnSelector } from "../listView/gridListViewSelectors.js";
28
+ import { minimalContentHeight } from "../rows/gridRowsUtils.js";
29
29
  import { jsx as _jsx } from "react/jsx-runtime";
30
30
  const MINIMUM_COLUMN_WIDTH = 50;
31
31
  var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
@@ -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;
@@ -381,18 +422,14 @@ export const useGridVirtualScroller = () => {
381
422
  flexBasis: contentHeight,
382
423
  flexShrink: 0
383
424
  };
384
- if (rootProps.autoHeight && currentPage.rows.length === 0) {
385
- size.flexBasis = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
425
+ if (size.flexBasis === 0) {
426
+ size.flexBasis = minimalContentHeight; // Give room to show the overlay when there no rows.
386
427
  }
387
428
  return size;
388
- }, [apiRef, columnsTotalWidth, contentHeight, needsHorizontalScrollbar, rootProps.autoHeight, currentPage.rows.length]);
429
+ }, [columnsTotalWidth, contentHeight, needsHorizontalScrollbar]);
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