@mui/x-data-grid 7.22.3 → 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 (75) hide show
  1. package/CHANGELOG.md +94 -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/dimensions/useGridDimensions.js +2 -1
  14. package/hooks/features/index.d.ts +1 -0
  15. package/hooks/features/index.js +1 -0
  16. package/hooks/features/listView/gridListViewSelectors.d.ts +3 -1
  17. package/hooks/features/listView/gridListViewSelectors.js +3 -1
  18. package/hooks/features/listView/index.d.ts +1 -0
  19. package/hooks/features/listView/index.js +1 -0
  20. package/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  21. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
  22. package/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
  23. package/index.js +1 -1
  24. package/joy/joySlots.js +7 -2
  25. package/locales/esES.js +1 -2
  26. package/locales/ptBR.js +1 -2
  27. package/locales/ptPT.js +1 -2
  28. package/locales/zhCN.js +1 -2
  29. package/models/api/gridCoreApi.d.ts +1 -1
  30. package/models/colDef/gridColDef.d.ts +24 -24
  31. package/models/gridDataSource.d.ts +12 -12
  32. package/models/props/DataGridProps.d.ts +8 -0
  33. package/modern/DataGrid/DataGrid.js +9 -1
  34. package/modern/components/cell/GridCell.js +10 -10
  35. package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -4
  36. package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -4
  37. package/modern/components/toolbar/GridToolbarExportContainer.js +3 -4
  38. package/modern/components/toolbar/GridToolbarFilterButton.js +7 -6
  39. package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -0
  40. package/modern/constants/dataGridPropsDefaultValues.js +2 -1
  41. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  42. package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
  43. package/modern/hooks/features/index.js +1 -0
  44. package/modern/hooks/features/listView/gridListViewSelectors.js +3 -1
  45. package/modern/hooks/features/listView/index.js +1 -0
  46. package/modern/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  47. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
  48. package/modern/index.js +1 -1
  49. package/modern/joy/joySlots.js +7 -2
  50. package/modern/locales/esES.js +1 -2
  51. package/modern/locales/ptBR.js +1 -2
  52. package/modern/locales/ptPT.js +1 -2
  53. package/modern/locales/zhCN.js +1 -2
  54. package/node/DataGrid/DataGrid.js +9 -1
  55. package/node/components/cell/GridCell.js +10 -10
  56. package/node/components/toolbar/GridToolbarColumnsButton.js +3 -4
  57. package/node/components/toolbar/GridToolbarDensitySelector.js +3 -4
  58. package/node/components/toolbar/GridToolbarExportContainer.js +3 -4
  59. package/node/components/toolbar/GridToolbarFilterButton.js +7 -6
  60. package/node/components/toolbar/GridToolbarQuickFilter.js +1 -0
  61. package/node/constants/dataGridPropsDefaultValues.js +2 -1
  62. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
  63. package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
  64. package/node/hooks/features/index.js +11 -0
  65. package/node/hooks/features/listView/gridListViewSelectors.js +3 -1
  66. package/node/hooks/features/listView/index.js +16 -0
  67. package/node/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  68. package/node/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
  69. package/node/index.js +1 -1
  70. package/node/joy/joySlots.js +7 -2
  71. package/node/locales/esES.js +1 -2
  72. package/node/locales/ptBR.js +1 -2
  73. package/node/locales/ptPT.js +1 -2
  74. package/node/locales/zhCN.js +1 -2
  75. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,100 @@
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.0
7
+
8
+ _Nov 29, 2024_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - ✨ 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.
13
+
14
+ https://github.com/user-attachments/assets/61286adc-03fc-4323-9739-8ca726fcc16c
15
+
16
+ - ⚛️ React 19 support
17
+ - 📚 Documentation improvements
18
+ - 🌍 Improve Spanish, Portuguese, Chinese locales on the Data Grid component.
19
+ - 🌍 Improve Dutch locale on the Date and Time Picker components.
20
+ - 🐞 Bugfixes
21
+
22
+ Special thanks go out to the community contributors who have helped make this release possible:
23
+ @dloeda, @headironc, @mathzdev, @nphmuller, @lhilgert9, @lauri865.
24
+ Following are all team members who have contributed to this release:
25
+ @oliviertassinari, @arminmeh, @KenanYusuf, @flaviendelangle, @MBilalShafi.
26
+
27
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
28
+
29
+ ### Data Grid
30
+
31
+ #### `@mui/x-data-grid@v7.23.0`
32
+
33
+ - [DataGrid] React 19 support (#15557) @arminmeh
34
+ - [DataGrid] Change test dom check from `/jsdom/` to `/jsdom|HappyDOM/`. (#15642) @jedesroches
35
+ - [DataGrid] Fix last separator not being hidden when grid is scrollable (#15551) @KenanYusuf
36
+ - [DataGrid] Fix order of spread props on toolbar items (#15556) @KenanYusuf
37
+ - [DataGrid] Fix row-spanning in combination with column-pinning (#15460) @lhilgert9
38
+ - [DataGrid] Improve resize performance (#15592) @lauri865
39
+ - [DataGrid] Support column virtualization with dynamic row height (#15567) @cherniavskii
40
+ - [DataGrid] Improve `GridCell` performance (#15621) @lauri865
41
+ - [l10n] Improve Chinese (zh-CN) locale (#15570) @headironc
42
+ - [l10n] Improve Portuguese (pt-PT) locale (#15561) @mathzdev
43
+
44
+ #### `@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')
45
+
46
+ Same changes as in `@mui/x-data-grid@v7.23.0`, plus:
47
+
48
+ - [DataGridPro] Fix header filtering with `boolean` column type (#15640) @k-rajat19
49
+ - [DataGridPro] Fix pagination state not updating if the data source response has no rows (#15643) @zinoroman
50
+ - [DataGridPro] Fix selection propagation issue on initialization (#15593) @MBilalShafi
51
+
52
+ #### `@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')
53
+
54
+ Same changes as in `@mui/x-data-grid-pro@v7.23.0`.
55
+
56
+ ### Date and Time Pickers
57
+
58
+ #### `@mui/x-date-pickers@v7.23.0`
59
+
60
+ - [pickers] React 19 support (#15557) @arminmeh
61
+ - [pickers] Fix DST issue with `America/Asuncion` timezone and `AdapterMoment` (#15653) @flaviendelangle
62
+ - [pickers] Use `props.referenceDate` timezone when `props.value` and `props.defaultValue` are not defined (#15544) @flaviendelangle
63
+ - [l10n] Improve Dutch (nl-NL) locale (#15564) @nphmuller
64
+
65
+ #### `@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')
66
+
67
+ Same changes as in `@mui/x-date-pickers@v7.23.0`.
68
+
69
+ ### Charts
70
+
71
+ #### `@mui/x-charts@v7.23.0`
72
+
73
+ - [charts] React 19 support (#15557) @arminmeh
74
+ - [charts] Prevent invalid `releasePointerCapture` (#15609) @alexfauquette
75
+
76
+ #### `@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')
77
+
78
+ Same changes as in `@mui/x-charts@v7.23.0`.
79
+
80
+ ### Tree View
81
+
82
+ #### `@mui/x-tree-view@v7.23.0`
83
+
84
+ - [TreeView] React 19 support (#15557) @arminmeh
85
+
86
+ #### `@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')
87
+
88
+ Same changes as in `@mui/x-tree-view@7.23.0`.
89
+
90
+ ### Docs
91
+
92
+ - [docs] Add data caching to lazy loaded detail panel demo (#15555) @cherniavskii
93
+ - [docs] Remove selectors section from list view docs (#15639) @KenanYusuf
94
+ - [docs] Add documentation for the list view feature (#15344) @KenanYusuf
95
+
96
+ ### Core
97
+
98
+ - [core] Update @mui/monorepo (#15574) @oliviertassinari
99
+
6
100
  ## 7.22.3
7
101
 
8
102
  _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,
@@ -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.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/joy/joySlots.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["slotProps", "variant", "color", "sx"],
3
+ const _excluded = ["slotProps", "variant", "color", "sx", "anchorOrigin"],
4
4
  _excluded2 = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"],
5
5
  _excluded3 = ["onChange", "label", "placeholder", "value", "inputRef", "type", "size", "variant"],
6
6
  _excluded4 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
@@ -64,10 +64,15 @@ function convertVariant(variant, defaultVariant = 'plain') {
64
64
  const Badge = /*#__PURE__*/React.forwardRef((_ref, ref) => {
65
65
  let {
66
66
  color,
67
- sx
67
+ sx,
68
+ anchorOrigin
68
69
  } = _ref,
69
70
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
70
71
  return /*#__PURE__*/_jsx(JoyBadge, _extends({}, props, {
72
+ anchorOrigin: anchorOrigin?.horizontal && anchorOrigin?.vertical ? anchorOrigin : {
73
+ vertical: 'top',
74
+ horizontal: 'right'
75
+ },
71
76
  color: convertColor(color),
72
77
  variant: "plain",
73
78
  sx: sx,
package/locales/esES.js CHANGED
@@ -34,8 +34,7 @@ const esESGrid = {
34
34
  columnsManagementNoColumns: 'Sin columnas',
35
35
  columnsManagementShowHideAllText: 'Mostrar/Ocultar todas',
36
36
  columnsManagementReset: 'Restablecer',
37
- // columnsManagementDeleteIconLabel: 'Clear',
38
-
37
+ columnsManagementDeleteIconLabel: 'Limpiar',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: 'Agregar filtro',
41
40
  filterPanelRemoveAll: 'Remover todos',
package/locales/ptBR.js CHANGED
@@ -34,8 +34,7 @@ const ptBRGrid = {
34
34
  columnsManagementNoColumns: 'Nenhuma coluna',
35
35
  columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
36
36
  columnsManagementReset: 'Redefinir',
37
- // columnsManagementDeleteIconLabel: 'Clear',
38
-
37
+ columnsManagementDeleteIconLabel: 'Limpar',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: 'Adicionar filtro',
41
40
  filterPanelRemoveAll: 'Remover todos',
package/locales/ptPT.js CHANGED
@@ -34,8 +34,7 @@ const ptPTGrid = {
34
34
  columnsManagementNoColumns: 'Sem colunas',
35
35
  columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
36
36
  columnsManagementReset: 'Repor',
37
- // columnsManagementDeleteIconLabel: 'Clear',
38
-
37
+ columnsManagementDeleteIconLabel: 'Limpar',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: 'Adicionar filtro',
41
40
  filterPanelRemoveAll: 'Excluir todos',
package/locales/zhCN.js CHANGED
@@ -34,8 +34,7 @@ const zhCNGrid = {
34
34
  columnsManagementNoColumns: '没有列',
35
35
  columnsManagementShowHideAllText: '显示/隐藏所有',
36
36
  columnsManagementReset: '重置',
37
- // columnsManagementDeleteIconLabel: 'Clear',
38
-
37
+ columnsManagementDeleteIconLabel: '清除',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: '添加筛选器',
41
40
  filterPanelRemoveAll: '清除全部',
@@ -59,7 +59,7 @@ export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPri
59
59
  /**
60
60
  * The React ref of the grid main container div element.
61
61
  */
62
- mainElementRef: React.RefObject<HTMLDivElement>;
62
+ mainElementRef: React.MutableRefObject<HTMLDivElement | null>;
63
63
  /**
64
64
  * The React ref of the grid's virtual scroller container element.
65
65
  */