@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
@@ -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,
@@ -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',
@@ -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',
@@ -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',
@@ -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: '清除全部',
@@ -773,5 +773,13 @@ DataGridRaw.propTypes = {
773
773
  * If `true`, the Data Grid will auto span the cells over the rows having the same value.
774
774
  * @default false
775
775
  */
776
- unstable_rowSpanning: _propTypes.default.bool
776
+ unstable_rowSpanning: _propTypes.default.bool,
777
+ /**
778
+ * If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
779
+ * By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
780
+ * For datasets with a large number of columns, this can cause performance issues.
781
+ * 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.
782
+ * @default false
783
+ */
784
+ virtualizeColumnsWithAutoRowHeight: _propTypes.default.bool
777
785
  };
@@ -21,7 +21,6 @@ var _useGridSelector = require("../../hooks/utils/useGridSelector");
21
21
  var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
22
22
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
23
23
  var _gridFocusStateSelector = require("../../hooks/features/focus/gridFocusStateSelector");
24
- var _useGridParamsApi = require("../../hooks/features/rows/useGridParamsApi");
25
24
  var _cellBorderUtils = require("../../utils/cellBorderUtils");
26
25
  var _gridColumnsInterfaces = require("../../hooks/features/columns/gridColumnsInterfaces");
27
26
  var _gridRowSpanningSelectors = require("../../hooks/features/rows/gridRowSpanningSelectors");
@@ -122,16 +121,13 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
122
121
  // This is required because `.getCellParams` tries to get the `state.rows.tree` entry
123
122
  // associated with `rowId`/`fieldId`, but this selector runs after the state has been
124
123
  // updated, while `rowId`/`fieldId` reference an entry in the old state.
125
- try {
126
- const result = apiRef.current.getCellParams(rowId, field);
127
- result.api = apiRef.current;
128
- return result;
129
- } catch (error) {
130
- if (error instanceof _useGridParamsApi.MissingRowIdError) {
131
- return EMPTY_CELL_PARAMS;
132
- }
133
- throw error;
124
+ const row = apiRef.current.getRow(rowId);
125
+ if (!row) {
126
+ return EMPTY_CELL_PARAMS;
134
127
  }
128
+ const result = apiRef.current.getCellParams(rowId, field);
129
+ result.api = apiRef.current;
130
+ return result;
135
131
  }, _useGridSelector.objectShallowCompare);
136
132
  const isSelected = (0, _useGridSelector.useGridSelector)(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
137
133
  id: rowId,
@@ -219,6 +215,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
219
215
  padding: 0,
220
216
  opacity: 0,
221
217
  width: 0,
218
+ height: 0,
222
219
  border: 0
223
220
  };
224
221
  }
@@ -237,6 +234,9 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
237
234
  if (rowSpan > 1) {
238
235
  cellStyle.height = `calc(var(--height) * ${rowSpan})`;
239
236
  cellStyle.zIndex = 5;
237
+ if (isLeftPinned || isRightPinned) {
238
+ cellStyle.zIndex = 6;
239
+ }
240
240
  }
241
241
  return cellStyle;
242
242
  }, [width, isNotVisible, styleProp, pinnedOffset, pinnedPosition, isRtl, rowSpan]);
@@ -44,7 +44,7 @@ const GridToolbarColumnsButton = exports.GridToolbarColumnsButton = /*#__PURE__*
44
44
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, (0, _extends2.default)({
45
45
  title: apiRef.current.getLocaleText('toolbarColumnsLabel'),
46
46
  enterDelay: 1000
47
- }, tooltipProps, rootProps.slotProps?.baseTooltip, {
47
+ }, rootProps.slotProps?.baseTooltip, tooltipProps, {
48
48
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseButton, (0, _extends2.default)({
49
49
  ref: ref,
50
50
  id: columnButtonId,
@@ -53,10 +53,9 @@ const GridToolbarColumnsButton = exports.GridToolbarColumnsButton = /*#__PURE__*
53
53
  "aria-haspopup": "menu",
54
54
  "aria-expanded": isOpen,
55
55
  "aria-controls": isOpen ? columnPanelId : undefined,
56
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnSelectorIcon, {})
57
- }, buttonProps, {
56
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnSelectorIcon, {}),
58
57
  onClick: showColumns
59
- }, rootProps.slotProps?.baseButton, {
58
+ }, rootProps.slotProps?.baseButton, buttonProps, {
60
59
  children: apiRef.current.getLocaleText('toolbarColumns')
61
60
  }))
62
61
  }));
@@ -93,7 +93,7 @@ const GridToolbarDensitySelector = exports.GridToolbarDensitySelector = /*#__PUR
93
93
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, (0, _extends2.default)({
94
94
  title: apiRef.current.getLocaleText('toolbarDensityLabel'),
95
95
  enterDelay: 1000
96
- }, tooltipProps, rootProps.slotProps?.baseTooltip, {
96
+ }, rootProps.slotProps?.baseTooltip, tooltipProps, {
97
97
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseButton, (0, _extends2.default)({
98
98
  ref: handleRef,
99
99
  size: "small",
@@ -102,10 +102,9 @@ const GridToolbarDensitySelector = exports.GridToolbarDensitySelector = /*#__PUR
102
102
  "aria-haspopup": "menu",
103
103
  "aria-expanded": open,
104
104
  "aria-controls": open ? densityMenuId : undefined,
105
- id: densityButtonId
106
- }, buttonProps, {
105
+ id: densityButtonId,
107
106
  onClick: handleDensitySelectorOpen
108
- }, rootProps.slotProps?.baseButton, {
107
+ }, rootProps.slotProps?.baseButton, buttonProps, {
109
108
  children: apiRef.current.getLocaleText('toolbarDensity')
110
109
  }))
111
110
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridMenu.GridMenu, {
@@ -51,7 +51,7 @@ const GridToolbarExportContainer = exports.GridToolbarExportContainer = /*#__PUR
51
51
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, (0, _extends2.default)({
52
52
  title: apiRef.current.getLocaleText('toolbarExportLabel'),
53
53
  enterDelay: 1000
54
- }, tooltipProps, rootProps.slotProps?.baseTooltip, {
54
+ }, rootProps.slotProps?.baseTooltip, tooltipProps, {
55
55
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseButton, (0, _extends2.default)({
56
56
  ref: handleRef,
57
57
  size: "small",
@@ -60,10 +60,9 @@ const GridToolbarExportContainer = exports.GridToolbarExportContainer = /*#__PUR
60
60
  "aria-label": apiRef.current.getLocaleText('toolbarExportLabel'),
61
61
  "aria-haspopup": "menu",
62
62
  "aria-controls": open ? exportMenuId : undefined,
63
- id: exportButtonId
64
- }, buttonProps, {
63
+ id: exportButtonId,
65
64
  onClick: handleMenuOpen
66
- }, rootProps.slotProps?.baseButton, {
65
+ }, rootProps.slotProps?.baseButton, buttonProps, {
67
66
  children: apiRef.current.getLocaleText('toolbarExport')
68
67
  }))
69
68
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridMenu.GridMenu, {
@@ -45,6 +45,7 @@ const GridToolbarFilterButton = exports.GridToolbarFilterButton = /*#__PURE__*/R
45
45
  } = props;
46
46
  const buttonProps = slotProps.button || {};
47
47
  const tooltipProps = slotProps.tooltip || {};
48
+ const badgeProps = slotProps.badge || {};
48
49
  const apiRef = (0, _useGridApiContext.useGridApiContext)();
49
50
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
50
51
  const activeFilters = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridFilterActiveItemsSelector);
@@ -102,7 +103,7 @@ const GridToolbarFilterButton = exports.GridToolbarFilterButton = /*#__PURE__*/R
102
103
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, (0, _extends2.default)({
103
104
  title: tooltipContentNode,
104
105
  enterDelay: 1000
105
- }, tooltipProps, rootProps.slotProps?.baseTooltip, {
106
+ }, rootProps.slotProps?.baseTooltip, tooltipProps, {
106
107
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseButton, (0, _extends2.default)({
107
108
  ref: ref,
108
109
  id: filterButtonId,
@@ -111,14 +112,14 @@ const GridToolbarFilterButton = exports.GridToolbarFilterButton = /*#__PURE__*/R
111
112
  "aria-controls": isOpen ? filterPanelId : undefined,
112
113
  "aria-expanded": isOpen,
113
114
  "aria-haspopup": true,
114
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseBadge, {
115
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseBadge, (0, _extends2.default)({
115
116
  badgeContent: activeFilters.length,
116
- color: "primary",
117
+ color: "primary"
118
+ }, rootProps.slotProps?.baseBadge, badgeProps, {
117
119
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.openFilterButtonIcon, {})
118
- })
119
- }, buttonProps, {
120
+ })),
120
121
  onClick: toggleFilter
121
- }, rootProps.slotProps?.baseButton, {
122
+ }, rootProps.slotProps?.baseButton, buttonProps, {
122
123
  children: apiRef.current.getLocaleText('toolbarFilters')
123
124
  }))
124
125
  }));
@@ -86,6 +86,7 @@ function GridToolbarQuickFilter(props) {
86
86
  apiRef.current.setQuickFilterValues(newQuickFilterValues);
87
87
  }, [apiRef, quickFilterParser]);
88
88
  const debouncedUpdateSearchValue = React.useMemo(() => (0, _utils.unstable_debounce)(updateSearchValue, debounceMs), [updateSearchValue, debounceMs]);
89
+ React.useEffect(() => debouncedUpdateSearchValue.clear, [debouncedUpdateSearchValue]);
89
90
  const handleSearchValueChange = React.useCallback(event => {
90
91
  const newSearchValue = event.target.value;
91
92
  setSearchValue(newSearchValue);
@@ -62,5 +62,6 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES =
62
62
  sortingMode: 'client',
63
63
  sortingOrder: ['asc', 'desc', null],
64
64
  throttleRowsMs: 0,
65
- unstable_rowSpanning: false
65
+ unstable_rowSpanning: false,
66
+ virtualizeColumnsWithAutoRowHeight: false
66
67
  };
@@ -291,7 +291,7 @@ const useGridColumnHeaders = props => {
291
291
  fields: headerInfo.fields,
292
292
  colIndex: headerInfo.colIndex,
293
293
  depth: depth,
294
- isLastColumn: headerInfo.colIndex === visibleColumns.length - headerInfo.fields.length,
294
+ isLastColumn: index === visibleColumnGroupHeader.length - 1,
295
295
  maxDepth: headerGroupingMaxDepth,
296
296
  height: dimensions.groupHeaderHeight,
297
297
  hasFocus: hasFocus,
@@ -76,6 +76,7 @@ function useGridDimensions(apiRef, props) {
76
76
  const rightPinnedWidth = pinnedColumns.right.reduce((w, col) => w + col.computedWidth, 0);
77
77
  const [savedSize, setSavedSize] = React.useState();
78
78
  const debouncedSetSavedSize = React.useMemo(() => (0, _throttle.throttle)(setSavedSize, props.resizeThrottleMs), [props.resizeThrottleMs]);
79
+ React.useEffect(() => debouncedSetSavedSize.clear, [debouncedSetSavedSize]);
79
80
  const previousSize = React.useRef();
80
81
  const getRootDimensions = () => apiRef.current.state.dimensions;
81
82
  const setDimensions = (0, _utils.unstable_useEventCallback)(dimensions => {
@@ -248,7 +249,7 @@ function useGridDimensions(apiRef, props) {
248
249
  rootDimensionsRef.current = size;
249
250
 
250
251
  // jsdom has no layout capabilities
251
- const isJSDOM = /jsdom/.test(window.navigator.userAgent);
252
+ const isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
252
253
  if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
253
254
  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'));
254
255
  errorShown.current = true;
@@ -91,6 +91,17 @@ Object.keys(_focus).forEach(function (key) {
91
91
  }
92
92
  });
93
93
  });
94
+ var _listView = require("./listView");
95
+ Object.keys(_listView).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _listView[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function () {
101
+ return _listView[key];
102
+ }
103
+ });
104
+ });
94
105
  var _pagination = require("./pagination");
95
106
  Object.keys(_pagination).forEach(function (key) {
96
107
  if (key === "default" || key === "__esModule") return;
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.gridListColumnSelector = void 0;
7
7
  /**
8
- * Get a list column definition
8
+ * Get the list column definition
9
+ * @category List View
10
+ * @ignore - Do not document
9
11
  */
10
12
  const gridListColumnSelector = state => state.listViewColumn;
11
13
  exports.gridListColumnSelector = gridListColumnSelector;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _gridListViewSelectors = require("./gridListViewSelectors");
7
+ Object.keys(_gridListViewSelectors).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _gridListViewSelectors[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _gridListViewSelectors[key];
14
+ }
15
+ });
16
+ });
@@ -257,11 +257,7 @@ const useGridRowSelection = (apiRef, props) => {
257
257
  /*
258
258
  * EVENTS
259
259
  */
260
- const isFirstRender = React.useRef(true);
261
260
  const removeOutdatedSelection = React.useCallback((sortModelUpdated = false) => {
262
- if (isFirstRender.current) {
263
- return;
264
- }
265
261
  const currentSelection = (0, _gridRowSelectionSelector.gridRowSelectionStateSelector)(apiRef.current.state);
266
262
  const rowsLookup = (0, _gridRowsSelector.gridRowsLookupSelector)(apiRef);
267
263
  const filteredRowsLookup = (0, _gridFilterSelector.gridFilteredRowsLookupSelector)(apiRef);
@@ -489,10 +485,5 @@ const useGridRowSelection = (apiRef, props) => {
489
485
  React.useEffect(() => {
490
486
  runIfRowSelectionIsEnabled(removeOutdatedSelection);
491
487
  }, [removeOutdatedSelection, runIfRowSelectionIsEnabled]);
492
- React.useEffect(() => {
493
- if (isFirstRender.current) {
494
- isFirstRender.current = false;
495
- }
496
- }, []);
497
488
  };
498
489
  exports.useGridRowSelection = useGridRowSelection;
@@ -15,8 +15,8 @@ var ReactDOM = _interopRequireWildcard(require("react-dom"));
15
15
  var _utils = require("@mui/utils");
16
16
  var _useLazyRef = _interopRequireDefault(require("@mui/utils/useLazyRef"));
17
17
  var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
18
- var _useResizeObserver = require("@mui/x-internals/useResizeObserver");
19
18
  var _RtlProvider = require("@mui/system/RtlProvider");
19
+ var _reactMajor = _interopRequireDefault(require("@mui/x-internals/reactMajor"));
20
20
  var _useGridPrivateApiContext = require("../../utils/useGridPrivateApiContext");
21
21
  var _useGridRootProps = require("../../utils/useGridRootProps");
22
22
  var _useGridSelector = require("../../utils/useGridSelector");
@@ -59,7 +59,7 @@ const createScrollCache = (isRtl, rowBufferPx, columnBufferPx, verticalBuffer, h
59
59
  let isJSDOM = false;
60
60
  try {
61
61
  if (typeof window !== 'undefined') {
62
- isJSDOM = /jsdom/.test(window.navigator.userAgent);
62
+ isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
63
63
  }
64
64
  } catch (_) {
65
65
  /* ignore */
@@ -97,7 +97,44 @@ const useGridVirtualScroller = () => {
97
97
  const contentHeight = dimensions.contentSize.height;
98
98
  const columnsTotalWidth = dimensions.columnsTotalWidth;
99
99
  const hasColSpan = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridHasColSpanSelector);
100
- (0, _useResizeObserver.useResizeObserver)(mainRef, () => apiRef.current.resize());
100
+ const mainRefCallback = React.useCallback(node => {
101
+ mainRef.current = node;
102
+ if (!node) {
103
+ return undefined;
104
+ }
105
+ const initialRect = node.getBoundingClientRect();
106
+ let lastSize = {
107
+ width: initialRect.width,
108
+ height: initialRect.height
109
+ };
110
+ apiRef.current.publishEvent('resize', lastSize);
111
+ if (typeof ResizeObserver === 'undefined') {
112
+ return undefined;
113
+ }
114
+ const observer = new ResizeObserver(entries => {
115
+ const entry = entries[0];
116
+ if (!entry) {
117
+ return;
118
+ }
119
+ const newSize = {
120
+ width: entry.contentRect.width,
121
+ height: entry.contentRect.height
122
+ };
123
+ if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
124
+ return;
125
+ }
126
+ apiRef.current.publishEvent('resize', newSize);
127
+ lastSize = newSize;
128
+ });
129
+ observer.observe(node);
130
+ if (_reactMajor.default >= 19) {
131
+ return () => {
132
+ mainRef.current = null;
133
+ observer.disconnect();
134
+ };
135
+ }
136
+ return undefined;
137
+ }, [apiRef, mainRef]);
101
138
 
102
139
  /*
103
140
  * Scroll context logic
@@ -148,9 +185,13 @@ const useGridVirtualScroller = () => {
148
185
  previousContextScrollPosition.current = scrollPosition.current;
149
186
  }, [apiRef, dimensions.isReady]);
150
187
  const triggerUpdateRenderContext = (0, _utils.unstable_useEventCallback)(() => {
188
+ const scroller = scrollerRef.current;
189
+ if (!scroller) {
190
+ return undefined;
191
+ }
151
192
  const newScroll = {
152
- top: scrollerRef.current.scrollTop,
153
- left: scrollerRef.current.scrollLeft
193
+ top: scroller.scrollTop,
194
+ left: scroller.scrollLeft
154
195
  };
155
196
  const dx = newScroll.left - scrollPosition.current.left;
156
197
  const dy = newScroll.top - scrollPosition.current.top;
@@ -400,10 +441,6 @@ const useGridVirtualScroller = () => {
400
441
  React.useEffect(() => {
401
442
  apiRef.current.publishEvent('virtualScrollerContentSizeChange');
402
443
  }, [apiRef, contentSize]);
403
- (0, _utils.unstable_useEnhancedEffect)(() => {
404
- // FIXME: Is this really necessary?
405
- apiRef.current.resize();
406
- }, [apiRef, rowsMeta.currentPageTotalHeight]);
407
444
  (0, _utils.unstable_useEnhancedEffect)(() => {
408
445
  // TODO a scroll reset should not be necessary
409
446
  if (enabledForColumns) {
@@ -439,7 +476,7 @@ const useGridVirtualScroller = () => {
439
476
  setPanels,
440
477
  getRows,
441
478
  getContainerProps: () => ({
442
- ref: mainRef
479
+ ref: mainRefCallback
443
480
  }),
444
481
  getScrollerProps: () => ({
445
482
  ref: scrollerRef,
@@ -497,7 +534,8 @@ function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
497
534
  pinnedColumns: (0, _gridColumnsSelector.gridVisiblePinnedColumnDefinitionsSelector)(apiRef),
498
535
  visibleColumns,
499
536
  hiddenCellsOriginMap,
500
- listView: rootProps.unstable_listView ?? false
537
+ listView: rootProps.unstable_listView ?? false,
538
+ virtualizeColumnsWithAutoRowHeight: rootProps.virtualizeColumnsWithAutoRowHeight
501
539
  };
502
540
  }
503
541
  function computeRenderContext(inputs, scrollPosition, scrollCache) {
@@ -545,11 +583,13 @@ function computeRenderContext(inputs, scrollPosition, scrollCache) {
545
583
  positions: inputs.rowsMeta.positions,
546
584
  lastSize: inputs.lastRowHeight
547
585
  });
548
- for (let i = firstRowToRender; i < lastRowToRender && !hasRowWithAutoHeight; i += 1) {
549
- const row = inputs.rows[i];
550
- hasRowWithAutoHeight = inputs.apiRef.current.rowHasAutoHeight(row.id);
586
+ if (!inputs.virtualizeColumnsWithAutoRowHeight) {
587
+ for (let i = firstRowToRender; i < lastRowToRender && !hasRowWithAutoHeight; i += 1) {
588
+ const row = inputs.rows[i];
589
+ hasRowWithAutoHeight = inputs.apiRef.current.rowHasAutoHeight(row.id);
590
+ }
551
591
  }
552
- if (!hasRowWithAutoHeight) {
592
+ if (!hasRowWithAutoHeight || inputs.virtualizeColumnsWithAutoRowHeight) {
553
593
  firstColumnIndex = binarySearch(realLeft, inputs.columnPositions, {
554
594
  atStart: true,
555
595
  lastPosition: inputs.columnsTotalWidth
package/node/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
@@ -30,7 +30,7 @@ var _useGridRootProps = require("../hooks/utils/useGridRootProps");
30
30
  var _hooks = require("../hooks");
31
31
  var _GridOverlay = require("../components/containers/GridOverlay");
32
32
  var _jsxRuntime = require("react/jsx-runtime");
33
- const _excluded = ["slotProps", "variant", "color", "sx"],
33
+ const _excluded = ["slotProps", "variant", "color", "sx", "anchorOrigin"],
34
34
  _excluded2 = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"],
35
35
  _excluded3 = ["onChange", "label", "placeholder", "value", "inputRef", "type", "size", "variant"],
36
36
  _excluded4 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
@@ -72,10 +72,15 @@ function convertVariant(variant, defaultVariant = 'plain') {
72
72
  const Badge = /*#__PURE__*/React.forwardRef((_ref, ref) => {
73
73
  let {
74
74
  color,
75
- sx
75
+ sx,
76
+ anchorOrigin
76
77
  } = _ref,
77
78
  props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
78
79
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Badge.default, (0, _extends2.default)({}, props, {
80
+ anchorOrigin: anchorOrigin?.horizontal && anchorOrigin?.vertical ? anchorOrigin : {
81
+ vertical: 'top',
82
+ horizontal: 'right'
83
+ },
79
84
  color: convertColor(color),
80
85
  variant: "plain",
81
86
  sx: sx,
@@ -40,8 +40,7 @@ const esESGrid = {
40
40
  columnsManagementNoColumns: 'Sin columnas',
41
41
  columnsManagementShowHideAllText: 'Mostrar/Ocultar todas',
42
42
  columnsManagementReset: 'Restablecer',
43
- // columnsManagementDeleteIconLabel: 'Clear',
44
-
43
+ columnsManagementDeleteIconLabel: 'Limpiar',
45
44
  // Filter panel text
46
45
  filterPanelAddFilter: 'Agregar filtro',
47
46
  filterPanelRemoveAll: 'Remover todos',
@@ -40,8 +40,7 @@ const ptBRGrid = {
40
40
  columnsManagementNoColumns: 'Nenhuma coluna',
41
41
  columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
42
42
  columnsManagementReset: 'Redefinir',
43
- // columnsManagementDeleteIconLabel: 'Clear',
44
-
43
+ columnsManagementDeleteIconLabel: 'Limpar',
45
44
  // Filter panel text
46
45
  filterPanelAddFilter: 'Adicionar filtro',
47
46
  filterPanelRemoveAll: 'Remover todos',
@@ -40,8 +40,7 @@ const ptPTGrid = {
40
40
  columnsManagementNoColumns: 'Sem colunas',
41
41
  columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
42
42
  columnsManagementReset: 'Repor',
43
- // columnsManagementDeleteIconLabel: 'Clear',
44
-
43
+ columnsManagementDeleteIconLabel: 'Limpar',
45
44
  // Filter panel text
46
45
  filterPanelAddFilter: 'Adicionar filtro',
47
46
  filterPanelRemoveAll: 'Excluir todos',
@@ -40,8 +40,7 @@ const zhCNGrid = {
40
40
  columnsManagementNoColumns: '没有列',
41
41
  columnsManagementShowHideAllText: '显示/隐藏所有',
42
42
  columnsManagementReset: '重置',
43
- // columnsManagementDeleteIconLabel: 'Clear',
44
-
43
+ columnsManagementDeleteIconLabel: '清除',
45
44
  // Filter panel text
46
45
  filterPanelAddFilter: '添加筛选器',
47
46
  filterPanelRemoveAll: '清除全部',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "7.22.3",
3
+ "version": "7.23.0",
4
4
  "description": "The Community plan edition of the Data Grid components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -42,15 +42,15 @@
42
42
  "clsx": "^2.1.1",
43
43
  "prop-types": "^15.8.1",
44
44
  "reselect": "^5.1.1",
45
- "@mui/x-internals": "7.21.0"
45
+ "@mui/x-internals": "7.23.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@emotion/react": "^11.9.0",
49
49
  "@emotion/styled": "^11.8.1",
50
50
  "@mui/material": "^5.15.14 || ^6.0.0",
51
51
  "@mui/system": "^5.15.14 || ^6.0.0",
52
- "react": "^17.0.0 || ^18.0.0",
53
- "react-dom": "^17.0.0 || ^18.0.0"
52
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
53
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@emotion/react": {