@mui/x-data-grid 6.1.0 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +101 -1
  2. package/components/GridHeader.d.ts +2 -2
  3. package/components/GridHeader.js +4 -6
  4. package/components/GridPagination.d.ts +2 -2
  5. package/components/base/GridBody.d.ts +0 -1
  6. package/components/base/GridBody.js +32 -15
  7. package/components/columnSelection/GridCellCheckboxRenderer.d.ts +1 -1
  8. package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  9. package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
  10. package/components/containers/GridMainContainer.d.ts +3 -1
  11. package/components/containers/GridMainContainer.js +3 -2
  12. package/components/containers/GridRoot.js +0 -5
  13. package/components/index.d.ts +0 -1
  14. package/components/index.js +0 -1
  15. package/components/panel/GridColumnsPanel.js +3 -2
  16. package/components/panel/GridPanel.d.ts +2 -2
  17. package/components/panel/GridPanel.js +2 -1
  18. package/components/panel/filterPanel/GridFilterInputBoolean.js +37 -29
  19. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +34 -30
  20. package/components/panel/filterPanel/GridFilterPanel.js +5 -2
  21. package/hooks/features/dimensions/gridDimensionsApi.d.ts +4 -0
  22. package/hooks/features/dimensions/useGridDimensions.js +49 -10
  23. package/hooks/features/export/useGridPrintExport.js +3 -1
  24. package/hooks/features/rowSelection/useGridRowSelection.js +5 -26
  25. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +37 -16
  26. package/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
  27. package/index.js +1 -1
  28. package/joy/index.d.ts +2 -0
  29. package/joy/index.js +2 -0
  30. package/joy/joySlots.d.ts +4 -0
  31. package/joy/joySlots.js +71 -0
  32. package/joy/package.json +6 -0
  33. package/legacy/components/GridHeader.js +4 -6
  34. package/legacy/components/base/GridBody.js +33 -16
  35. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  36. package/legacy/components/containers/GridMainContainer.js +3 -2
  37. package/legacy/components/containers/GridRoot.js +0 -5
  38. package/legacy/components/index.js +0 -1
  39. package/legacy/components/panel/GridColumnsPanel.js +3 -2
  40. package/legacy/components/panel/GridPanel.js +2 -1
  41. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +37 -29
  42. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +34 -30
  43. package/legacy/components/panel/filterPanel/GridFilterPanel.js +5 -2
  44. package/legacy/hooks/features/dimensions/useGridDimensions.js +55 -12
  45. package/legacy/hooks/features/export/useGridPrintExport.js +3 -1
  46. package/legacy/hooks/features/rowSelection/useGridRowSelection.js +5 -24
  47. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +12 -6
  48. package/legacy/index.js +1 -1
  49. package/legacy/joy/index.js +2 -0
  50. package/legacy/joy/joySlots.js +73 -0
  51. package/legacy/locales/frFR.js +7 -9
  52. package/legacy/locales/urPK.js +6 -6
  53. package/legacy/utils/utils.js +1 -1
  54. package/locales/frFR.js +7 -9
  55. package/locales/urPK.js +6 -6
  56. package/material/index.d.ts +1 -1
  57. package/models/gridSlotsComponent.d.ts +2 -2
  58. package/modern/components/GridHeader.js +4 -6
  59. package/modern/components/base/GridBody.js +32 -15
  60. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  61. package/modern/components/containers/GridMainContainer.js +3 -2
  62. package/modern/components/containers/GridRoot.js +0 -5
  63. package/modern/components/index.js +0 -1
  64. package/modern/components/panel/GridColumnsPanel.js +3 -2
  65. package/modern/components/panel/GridPanel.js +2 -1
  66. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +36 -28
  67. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +33 -29
  68. package/modern/components/panel/filterPanel/GridFilterPanel.js +5 -2
  69. package/modern/hooks/features/dimensions/useGridDimensions.js +48 -10
  70. package/modern/hooks/features/export/useGridPrintExport.js +3 -1
  71. package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -26
  72. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
  73. package/modern/index.js +1 -1
  74. package/modern/joy/index.js +2 -0
  75. package/modern/joy/joySlots.js +71 -0
  76. package/modern/locales/frFR.js +7 -9
  77. package/modern/locales/urPK.js +6 -6
  78. package/modern/utils/utils.js +1 -1
  79. package/node/components/GridHeader.js +5 -8
  80. package/node/components/base/GridBody.js +32 -15
  81. package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  82. package/node/components/containers/GridMainContainer.js +5 -3
  83. package/node/components/containers/GridRoot.js +0 -5
  84. package/node/components/index.js +0 -11
  85. package/node/components/panel/GridColumnsPanel.js +3 -2
  86. package/node/components/panel/GridPanel.js +2 -1
  87. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +36 -28
  88. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +32 -29
  89. package/node/components/panel/filterPanel/GridFilterPanel.js +5 -2
  90. package/node/hooks/features/dimensions/useGridDimensions.js +47 -9
  91. package/node/hooks/features/export/useGridPrintExport.js +3 -1
  92. package/node/hooks/features/rowSelection/useGridRowSelection.js +4 -25
  93. package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
  94. package/node/index.js +1 -1
  95. package/node/joy/index.js +13 -0
  96. package/node/joy/joySlots.js +79 -0
  97. package/node/locales/frFR.js +7 -9
  98. package/node/locales/urPK.js +6 -6
  99. package/node/utils/utils.js +1 -1
  100. package/package.json +1 -1
  101. package/utils/utils.d.ts +1 -1
  102. package/utils/utils.js +1 -1
  103. package/components/GridAutoSizer.d.ts +0 -44
  104. package/components/GridAutoSizer.js +0 -126
  105. package/legacy/components/GridAutoSizer.js +0 -132
  106. package/modern/components/GridAutoSizer.js +0 -125
  107. package/node/components/GridAutoSizer.js +0 -132
@@ -8,6 +8,7 @@ import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
8
8
  import { getValueFromValueOptions, isSingleSelectColDef } from './filterPanelUtils';
9
9
  import { createElement as _createElement } from "react";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
12
  const renderSingleSelectOptions = ({
12
13
  column: {
13
14
  valueOptions,
@@ -33,7 +34,7 @@ const renderSingleSelectOptions = ({
33
34
  });
34
35
  };
35
36
  function GridFilterInputSingleSelect(props) {
36
- var _item$value, _rootProps$slotProps, _baseSelectProps$nati, _rootProps$slotProps2, _resolvedColumn, _resolvedColumn2, _rootProps$slotProps3, _rootProps$slotProps4;
37
+ var _item$value, _rootProps$slotProps$, _rootProps$slotProps, _rootProps$slotProps$2, _resolvedColumn, _resolvedColumn2, _rootProps$slotProps2, _rootProps$slotProps3, _rootProps$slotProps4;
37
38
  const {
38
39
  item,
39
40
  applyValue,
@@ -46,10 +47,9 @@ function GridFilterInputSingleSelect(props) {
46
47
  others = _objectWithoutPropertiesLoose(props, _excluded);
47
48
  const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) != null ? _item$value : '');
48
49
  const id = useId();
50
+ const labelId = useId();
49
51
  const rootProps = useGridRootProps();
50
- const baseSelectProps = ((_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseSelect) || {};
51
- const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
52
- const baseSelectOptionProps = ((_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseSelectOption) || {};
52
+ const isSelectNative = (_rootProps$slotProps$ = (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : (_rootProps$slotProps$2 = _rootProps$slotProps.baseSelect) == null ? void 0 : _rootProps$slotProps$2.native) != null ? _rootProps$slotProps$ : true;
53
53
  let resolvedColumn = null;
54
54
  if (item.field) {
55
55
  const column = apiRef.current.getColumn(item.field);
@@ -101,33 +101,37 @@ function GridFilterInputSingleSelect(props) {
101
101
  if (!isSingleSelectColDef(resolvedColumn)) {
102
102
  return null;
103
103
  }
104
- return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
105
- // TODO: use baseSelect slot
106
- id: id,
107
- label: apiRef.current.getLocaleText('filterPanelInputLabel'),
108
- placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
109
- value: filterValueState,
110
- onChange: onFilterChange,
111
- variant: "standard",
112
- type: type || 'text',
113
- InputLabelProps: {
114
- shrink: true
115
- },
116
- inputRef: focusElementRef,
117
- select: true,
118
- SelectProps: _extends({
104
+ const label = apiRef.current.getLocaleText('filterPanelInputLabel');
105
+ return /*#__PURE__*/_jsxs(React.Fragment, {
106
+ children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseInputLabel, {
107
+ id: labelId,
108
+ shrink: true,
109
+ variant: "standard",
110
+ children: label
111
+ })), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
112
+ id: id,
113
+ label: label,
114
+ labelId: labelId,
115
+ value: filterValueState,
116
+ onChange: onFilterChange,
117
+ variant: "standard",
118
+ type: type || 'text',
119
+ inputProps: {
120
+ ref: focusElementRef,
121
+ placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder')
122
+ },
119
123
  native: isSelectNative
120
- }, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect)
121
- }, others, (_rootProps$slotProps4 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps4.baseTextField, {
122
- children: renderSingleSelectOptions({
123
- column: resolvedColumn,
124
- OptionComponent: rootProps.slots.baseSelectOption,
125
- getOptionLabel,
126
- getOptionValue,
127
- isSelectNative,
128
- baseSelectOptionProps
129
- })
130
- }));
124
+ }, others, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect, {
125
+ children: renderSingleSelectOptions({
126
+ column: resolvedColumn,
127
+ OptionComponent: rootProps.slots.baseSelectOption,
128
+ getOptionLabel,
129
+ getOptionValue,
130
+ isSelectNative,
131
+ baseSelectOptionProps: (_rootProps$slotProps4 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps4.baseSelectOption
132
+ })
133
+ }))]
134
+ });
131
135
  }
132
136
  process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
133
137
  // ----------------------------- Warning --------------------------------
@@ -27,6 +27,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
27
27
  const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
28
28
  const filterableColumns = useGridSelector(apiRef, gridFilterableColumnDefinitionsSelector);
29
29
  const lastFilterRef = React.useRef(null);
30
+ const placeholderFilter = React.useRef(null);
30
31
  const {
31
32
  logicOperators = [GridLogicOperator.And, GridLogicOperator.Or],
32
33
  columnsSort,
@@ -93,8 +94,10 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
93
94
  if (filterModel.items.length) {
94
95
  return filterModel.items;
95
96
  }
96
- const defaultFilter = getDefaultFilter();
97
- return defaultFilter ? [defaultFilter] : [];
97
+ if (!placeholderFilter.current) {
98
+ placeholderFilter.current = getDefaultFilter();
99
+ }
100
+ return placeholderFilter.current ? [placeholderFilter.current] : [];
98
101
  }, [filterModel.items, getDefaultFilter]);
99
102
  const hasMultipleFilters = items.length > 1;
100
103
  const addNewFilter = () => {
@@ -43,4 +43,8 @@ export interface GridDimensionsPrivateApi {
43
43
  * Forces a recalculation of all dimensions.
44
44
  */
45
45
  updateGridDimensionsRef: () => void;
46
+ /**
47
+ * Computes the size and publishes a `resize` event with the new value.
48
+ */
49
+ computeSizeAndPublishResizeEvent: () => void;
46
50
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { unstable_debounce as debounce, unstable_ownerDocument as ownerDocument, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
2
+ import { unstable_debounce as debounce, unstable_ownerDocument as ownerDocument, unstable_useEnhancedEffect as useEnhancedEffect, unstable_ownerWindow as ownerWindow } from '@mui/utils';
3
3
  import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
4
4
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
5
5
  import { useGridLogger } from '../../utils/useGridLogger';
@@ -10,6 +10,7 @@ import { getVisibleRows } from '../../utils/useGridVisibleRows';
10
10
  import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
11
11
  import { calculatePinnedRowsHeight } from '../rows/gridRowsUtils';
12
12
  import { getTotalHeaderHeight } from '../columns/gridColumnsUtils';
13
+ import { gridClasses } from '../../../constants/gridClasses';
13
14
  const isTestEnvironment = process.env.NODE_ENV === 'test';
14
15
  const hasScroll = ({
15
16
  content,
@@ -114,10 +115,20 @@ export function useGridDimensions(apiRef, props) {
114
115
  apiRef.current.publishEvent('viewportInnerSizeChange', newFullDimensions.viewportInnerSize);
115
116
  }
116
117
  }, [apiRef, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, totalHeaderHeight]);
118
+ const [savedSize, setSavedSize] = React.useState();
119
+ const debouncedSetSavedSize = React.useMemo(() => debounce(setSavedSize, 60), []);
120
+ const previousSize = React.useRef();
121
+ useEnhancedEffect(() => {
122
+ if (savedSize) {
123
+ updateGridDimensionsRef();
124
+ apiRef.current.publishEvent('debouncedResize', rootDimensionsRef.current);
125
+ }
126
+ }, [apiRef, savedSize, updateGridDimensionsRef]);
127
+
128
+ // This is the function called by apiRef.current.resize()
117
129
  const resize = React.useCallback(() => {
118
- updateGridDimensionsRef();
119
- apiRef.current.publishEvent('debouncedResize', rootDimensionsRef.current);
120
- }, [apiRef, updateGridDimensionsRef]);
130
+ apiRef.current.computeSizeAndPublishResizeEvent();
131
+ }, [apiRef]);
121
132
  const getRootDimensions = React.useCallback(() => fullDimensionsRef.current, []);
122
133
  const getViewportPageSize = React.useCallback(() => {
123
134
  const dimensions = apiRef.current.getRootDimensions();
@@ -139,17 +150,45 @@ export function useGridDimensions(apiRef, props) {
139
150
  const maximumPageSizeWithoutScrollBar = Math.floor(dimensions.viewportInnerSize.height / rowHeight);
140
151
  return Math.min(maximumPageSizeWithoutScrollBar, currentPage.rows.length);
141
152
  }, [apiRef, props.pagination, props.paginationMode, props.getRowHeight, rowHeight]);
153
+ const computeSizeAndPublishResizeEvent = React.useCallback(() => {
154
+ var _apiRef$current$rootE2, _previousSize$current, _previousSize$current2;
155
+ const rootEl = (_apiRef$current$rootE2 = apiRef.current.rootElementRef) == null ? void 0 : _apiRef$current$rootE2.current;
156
+ const mainEl = rootEl == null ? void 0 : rootEl.querySelector(`.${gridClasses.main}`);
157
+ if (!mainEl) {
158
+ return;
159
+ }
160
+ const height = mainEl.offsetHeight || 0;
161
+ const width = mainEl.offsetWidth || 0;
162
+ const win = ownerWindow(mainEl);
163
+ const computedStyle = win.getComputedStyle(mainEl);
164
+ const paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0;
165
+ const paddingRight = parseInt(computedStyle.paddingRight, 10) || 0;
166
+ const paddingTop = parseInt(computedStyle.paddingTop, 10) || 0;
167
+ const paddingBottom = parseInt(computedStyle.paddingBottom, 10) || 0;
168
+ const newHeight = height - paddingTop - paddingBottom;
169
+ const newWidth = width - paddingLeft - paddingRight;
170
+ const hasHeightChanged = newHeight !== ((_previousSize$current = previousSize.current) == null ? void 0 : _previousSize$current.height);
171
+ const hasWidthChanged = newWidth !== ((_previousSize$current2 = previousSize.current) == null ? void 0 : _previousSize$current2.width);
172
+ if (!previousSize.current || hasHeightChanged || hasWidthChanged) {
173
+ const size = {
174
+ width: newWidth,
175
+ height: newHeight
176
+ };
177
+ apiRef.current.publishEvent('resize', size);
178
+ previousSize.current = size;
179
+ }
180
+ }, [apiRef]);
142
181
  const dimensionsApi = {
143
182
  resize,
144
183
  getRootDimensions
145
184
  };
146
185
  const dimensionsPrivateApi = {
147
186
  getViewportPageSize,
148
- updateGridDimensionsRef
187
+ updateGridDimensionsRef,
188
+ computeSizeAndPublishResizeEvent
149
189
  };
150
190
  useGridApiMethod(apiRef, dimensionsApi, 'public');
151
191
  useGridApiMethod(apiRef, dimensionsPrivateApi, 'private');
152
- const debounceResize = React.useMemo(() => debounce(resize, 60), [resize]);
153
192
  const isFirstSizing = React.useRef(true);
154
193
  const handleResize = React.useCallback(size => {
155
194
  rootDimensionsRef.current = size;
@@ -166,18 +205,18 @@ export function useGridDimensions(apiRef, props) {
166
205
  }
167
206
  if (isTestEnvironment) {
168
207
  // We don't need to debounce the resize for tests.
169
- resize();
208
+ setSavedSize(size);
170
209
  isFirstSizing.current = false;
171
210
  return;
172
211
  }
173
212
  if (isFirstSizing.current) {
174
213
  // We want to initialize the grid dimensions as soon as possible to avoid flickering
175
- resize();
214
+ setSavedSize(size);
176
215
  isFirstSizing.current = false;
177
216
  return;
178
217
  }
179
- debounceResize();
180
- }, [props.autoHeight, debounceResize, logger, resize]);
218
+ debouncedSetSavedSize(size);
219
+ }, [props.autoHeight, debouncedSetSavedSize, logger]);
181
220
  useEnhancedEffect(() => updateGridDimensionsRef(), [updateGridDimensionsRef]);
182
221
  useGridApiOptionHandler(apiRef, 'sortedRowsSet', updateGridDimensionsRef);
183
222
  useGridApiOptionHandler(apiRef, 'paginationModelChange', updateGridDimensionsRef);
@@ -124,7 +124,9 @@ export const useGridPrintExport = (apiRef, props) => {
124
124
  printDoc.body.classList.add(...normalizeOptions.bodyClassName.split(' '));
125
125
  }
126
126
  if (normalizeOptions.copyStyles) {
127
- const headStyleElements = doc.current.querySelectorAll("style, link[rel='stylesheet']");
127
+ const rootCandidate = gridRootElement.getRootNode();
128
+ const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc.current;
129
+ const headStyleElements = root.querySelectorAll("style, link[rel='stylesheet']");
128
130
  for (let i = 0; i < headStyleElements.length; i += 1) {
129
131
  const node = headStyleElements[i];
130
132
  if (node.tagName === 'STYLE') {
@@ -11,7 +11,7 @@ import { gridExpandedSortedRowIdsSelector } from '../filter/gridFilterSelector';
11
11
  import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
12
12
  import { GridCellModes } from '../../../models/gridEditRowModel';
13
13
  import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
14
- import { getVisibleRows, useGridVisibleRows } from '../../utils/useGridVisibleRows';
14
+ import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
15
15
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
16
16
  import { gridClasses } from '../../../constants/gridClasses';
17
17
  const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
@@ -61,8 +61,6 @@ export const useGridRowSelection = (apiRef, props) => {
61
61
  checkboxSelection,
62
62
  disableMultipleRowSelection,
63
63
  disableRowSelectionOnClick,
64
- pagination,
65
- paginationMode,
66
64
  isRowSelectable: propIsRowSelectable
67
65
  } = props;
68
66
  const canHaveMultipleSelection = !disableMultipleRowSelection || checkboxSelection;
@@ -381,32 +379,13 @@ export const useGridRowSelection = (apiRef, props) => {
381
379
  }
382
380
  }, [apiRef, isRowSelectable, isStateControlled, props.rowSelection]);
383
381
  React.useEffect(() => {
384
- if (!props.rowSelection) {
382
+ if (!props.rowSelection || isStateControlled) {
385
383
  return;
386
384
  }
387
385
  const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
388
386
  if (!canHaveMultipleSelection && currentSelection.length > 1) {
389
- const {
390
- rows: currentPageRows
391
- } = getVisibleRows(apiRef, {
392
- pagination,
393
- paginationMode
394
- });
395
- const currentPageRowsLookup = currentPageRows.reduce((acc, {
396
- id
397
- }) => {
398
- acc[id] = true;
399
- return acc;
400
- }, {});
401
- const firstSelectableRow = currentSelection.find(id => {
402
- let isSelectable = true;
403
- if (isRowSelectable) {
404
- isSelectable = isRowSelectable(id);
405
- }
406
- return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page
407
- });
408
-
409
- apiRef.current.setRowSelectionModel(firstSelectableRow !== undefined ? [firstSelectableRow] : []);
387
+ // See https://github.com/mui/mui-x/issues/8455
388
+ apiRef.current.setRowSelectionModel([]);
410
389
  }
411
- }, [apiRef, canHaveMultipleSelection, checkboxSelection, disableMultipleRowSelection, isRowSelectable, pagination, paginationMode, props.rowSelection]);
390
+ }, [apiRef, canHaveMultipleSelection, checkboxSelection, isStateControlled, props.rowSelection]);
412
391
  };
@@ -31,6 +31,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
31
31
  availableSpace?: number | null | undefined;
32
32
  rows?: GridRowEntry<import("../../../models").GridValidRowModel>[] | undefined;
33
33
  rowIndexOffset?: number | undefined;
34
+ onRowRender?: ((rowId: GridRowId) => void) | undefined;
34
35
  }) => JSX.Element[] | null;
35
36
  getRootProps: ({ style, ...other }?: {
36
37
  style?: {} | undefined;
@@ -125,6 +126,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
125
126
  breakInside?: import("csstype").Property.BreakInside | undefined;
126
127
  captionSide?: import("csstype").Property.CaptionSide | undefined;
127
128
  caretColor?: import("csstype").Property.CaretColor | undefined;
129
+ caretShape?: import("csstype").Property.CaretShape | undefined;
128
130
  clear?: import("csstype").Property.Clear | undefined;
129
131
  clipPath?: import("csstype").Property.ClipPath | undefined;
130
132
  color?: import("csstype").Property.Color | undefined;
@@ -139,6 +141,12 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
139
141
  columnSpan?: import("csstype").Property.ColumnSpan | undefined;
140
142
  columnWidth?: import("csstype").Property.ColumnWidth<string | number> | undefined;
141
143
  contain?: import("csstype").Property.Contain | undefined;
144
+ containIntrinsicBlockSize?: import("csstype").Property.ContainIntrinsicBlockSize<string | number> | undefined;
145
+ containIntrinsicHeight?: import("csstype").Property.ContainIntrinsicHeight<string | number> | undefined;
146
+ containIntrinsicInlineSize?: import("csstype").Property.ContainIntrinsicInlineSize<string | number> | undefined;
147
+ containIntrinsicWidth?: import("csstype").Property.ContainIntrinsicWidth<string | number> | undefined;
148
+ containerName?: import("csstype").Property.ContainerName | undefined;
149
+ containerType?: import("csstype").Property.ContainerType | undefined;
142
150
  content?: import("csstype").Property.Content | undefined;
143
151
  contentVisibility?: import("csstype").Property.ContentVisibility | undefined;
144
152
  counterIncrement?: import("csstype").Property.CounterIncrement | undefined;
@@ -160,6 +168,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
160
168
  fontKerning?: import("csstype").Property.FontKerning | undefined;
161
169
  fontLanguageOverride?: import("csstype").Property.FontLanguageOverride | undefined;
162
170
  fontOpticalSizing?: import("csstype").Property.FontOpticalSizing | undefined;
171
+ fontPalette?: import("csstype").Property.FontPalette | undefined;
163
172
  fontSize?: import("csstype").Property.FontSize<string | number> | undefined;
164
173
  fontSizeAdjust?: import("csstype").Property.FontSizeAdjust | undefined;
165
174
  fontSmooth?: import("csstype").Property.FontSmooth<string | number> | undefined;
@@ -170,6 +179,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
170
179
  fontVariantAlternates?: import("csstype").Property.FontVariantAlternates | undefined;
171
180
  fontVariantCaps?: import("csstype").Property.FontVariantCaps | undefined;
172
181
  fontVariantEastAsian?: import("csstype").Property.FontVariantEastAsian | undefined;
182
+ fontVariantEmoji?: import("csstype").Property.FontVariantEmoji | undefined;
173
183
  fontVariantLigatures?: import("csstype").Property.FontVariantLigatures | undefined;
174
184
  fontVariantNumeric?: import("csstype").Property.FontVariantNumeric | undefined;
175
185
  fontVariantPosition?: import("csstype").Property.FontVariantPosition | undefined;
@@ -189,6 +199,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
189
199
  hangingPunctuation?: import("csstype").Property.HangingPunctuation | undefined;
190
200
  height?: import("csstype").Property.Height<string | number> | undefined;
191
201
  hyphenateCharacter?: import("csstype").Property.HyphenateCharacter | undefined;
202
+ hyphenateLimitChars?: import("csstype").Property.HyphenateLimitChars | undefined;
192
203
  hyphens?: import("csstype").Property.Hyphens | undefined;
193
204
  imageOrientation?: import("csstype").Property.ImageOrientation | undefined;
194
205
  imageRendering?: import("csstype").Property.ImageRendering | undefined;
@@ -196,11 +207,8 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
196
207
  initialLetter?: import("csstype").Property.InitialLetter | undefined;
197
208
  inlineSize?: import("csstype").Property.InlineSize<string | number> | undefined;
198
209
  inputSecurity?: import("csstype").Property.InputSecurity | undefined;
199
- inset?: import("csstype").Property.Inset<string | number> | undefined;
200
- insetBlock?: import("csstype").Property.InsetBlock<string | number> | undefined;
201
210
  insetBlockEnd?: import("csstype").Property.InsetBlockEnd<string | number> | undefined;
202
211
  insetBlockStart?: import("csstype").Property.InsetBlockStart<string | number> | undefined;
203
- insetInline?: import("csstype").Property.InsetInline<string | number> | undefined;
204
212
  insetInlineEnd?: import("csstype").Property.InsetInlineEnd<string | number> | undefined;
205
213
  insetInlineStart?: import("csstype").Property.InsetInlineStart<string | number> | undefined;
206
214
  isolation?: import("csstype").Property.Isolation | undefined;
@@ -216,16 +224,15 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
216
224
  listStyleImage?: import("csstype").Property.ListStyleImage | undefined;
217
225
  listStylePosition?: import("csstype").Property.ListStylePosition | undefined;
218
226
  listStyleType?: import("csstype").Property.ListStyleType | undefined;
219
- marginBlock?: import("csstype").Property.MarginBlock<string | number> | undefined;
220
227
  marginBlockEnd?: import("csstype").Property.MarginBlockEnd<string | number> | undefined;
221
228
  marginBlockStart?: import("csstype").Property.MarginBlockStart<string | number> | undefined;
222
229
  marginBottom?: import("csstype").Property.MarginBottom<string | number> | undefined;
223
- marginInline?: import("csstype").Property.MarginInline<string | number> | undefined;
224
230
  marginInlineEnd?: import("csstype").Property.MarginInlineEnd<string | number> | undefined;
225
231
  marginInlineStart?: import("csstype").Property.MarginInlineStart<string | number> | undefined;
226
232
  marginLeft?: import("csstype").Property.MarginLeft<string | number> | undefined;
227
233
  marginRight?: import("csstype").Property.MarginRight<string | number> | undefined;
228
234
  marginTop?: import("csstype").Property.MarginTop<string | number> | undefined;
235
+ marginTrim?: import("csstype").Property.MarginTrim | undefined;
229
236
  maskBorderMode?: import("csstype").Property.MaskBorderMode | undefined;
230
237
  maskBorderOutset?: import("csstype").Property.MaskBorderOutset<string | number> | undefined;
231
238
  maskBorderRepeat?: import("csstype").Property.MaskBorderRepeat | undefined;
@@ -262,6 +269,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
262
269
  offsetAnchor?: import("csstype").Property.OffsetAnchor<string | number> | undefined;
263
270
  offsetDistance?: import("csstype").Property.OffsetDistance<string | number> | undefined;
264
271
  offsetPath?: import("csstype").Property.OffsetPath | undefined;
272
+ offsetPosition?: import("csstype").Property.OffsetPosition<string | number> | undefined;
265
273
  offsetRotate?: import("csstype").Property.OffsetRotate | undefined;
266
274
  offsetRotation?: import("csstype").Property.OffsetRotate | undefined;
267
275
  opacity?: import("csstype").Property.Opacity | undefined;
@@ -283,23 +291,21 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
283
291
  overscrollBehaviorInline?: import("csstype").Property.OverscrollBehaviorInline | undefined;
284
292
  overscrollBehaviorX?: import("csstype").Property.OverscrollBehaviorX | undefined;
285
293
  overscrollBehaviorY?: import("csstype").Property.OverscrollBehaviorY | undefined;
286
- paddingBlock?: import("csstype").Property.PaddingBlock<string | number> | undefined;
287
294
  paddingBlockEnd?: import("csstype").Property.PaddingBlockEnd<string | number> | undefined;
288
295
  paddingBlockStart?: import("csstype").Property.PaddingBlockStart<string | number> | undefined;
289
296
  paddingBottom?: import("csstype").Property.PaddingBottom<string | number> | undefined;
290
- paddingInline?: import("csstype").Property.PaddingInline<string | number> | undefined;
291
297
  paddingInlineEnd?: import("csstype").Property.PaddingInlineEnd<string | number> | undefined;
292
298
  paddingInlineStart?: import("csstype").Property.PaddingInlineStart<string | number> | undefined;
293
299
  paddingLeft?: import("csstype").Property.PaddingLeft<string | number> | undefined;
294
300
  paddingRight?: import("csstype").Property.PaddingRight<string | number> | undefined;
295
301
  paddingTop?: import("csstype").Property.PaddingTop<string | number> | undefined;
302
+ page?: import("csstype").Property.Page | undefined;
296
303
  pageBreakAfter?: import("csstype").Property.PageBreakAfter | undefined;
297
304
  pageBreakBefore?: import("csstype").Property.PageBreakBefore | undefined;
298
305
  pageBreakInside?: import("csstype").Property.PageBreakInside | undefined;
299
306
  paintOrder?: import("csstype").Property.PaintOrder | undefined;
300
307
  perspective?: import("csstype").Property.Perspective<string | number> | undefined;
301
308
  perspectiveOrigin?: import("csstype").Property.PerspectiveOrigin<string | number> | undefined;
302
- placeContent?: import("csstype").Property.PlaceContent | undefined;
303
309
  pointerEvents?: import("csstype").Property.PointerEvents | undefined;
304
310
  position?: import("csstype").Property.Position | undefined;
305
311
  printColorAdjust?: import("csstype").Property.PrintColorAdjust | undefined;
@@ -313,36 +319,31 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
313
319
  rubyPosition?: import("csstype").Property.RubyPosition | undefined;
314
320
  scale?: import("csstype").Property.Scale | undefined;
315
321
  scrollBehavior?: import("csstype").Property.ScrollBehavior | undefined;
316
- scrollMargin?: import("csstype").Property.ScrollMargin<string | number> | undefined;
317
- scrollMarginBlock?: import("csstype").Property.ScrollMarginBlock<string | number> | undefined;
318
322
  scrollMarginBlockEnd?: import("csstype").Property.ScrollMarginBlockEnd<string | number> | undefined;
319
323
  scrollMarginBlockStart?: import("csstype").Property.ScrollMarginBlockStart<string | number> | undefined;
320
324
  scrollMarginBottom?: import("csstype").Property.ScrollMarginBottom<string | number> | undefined;
321
- scrollMarginInline?: import("csstype").Property.ScrollMarginInline<string | number> | undefined;
322
325
  scrollMarginInlineEnd?: import("csstype").Property.ScrollMarginInlineEnd<string | number> | undefined;
323
326
  scrollMarginInlineStart?: import("csstype").Property.ScrollMarginInlineStart<string | number> | undefined;
324
327
  scrollMarginLeft?: import("csstype").Property.ScrollMarginLeft<string | number> | undefined;
325
328
  scrollMarginRight?: import("csstype").Property.ScrollMarginRight<string | number> | undefined;
326
329
  scrollMarginTop?: import("csstype").Property.ScrollMarginTop<string | number> | undefined;
327
- scrollPadding?: import("csstype").Property.ScrollPadding<string | number> | undefined;
328
- scrollPaddingBlock?: import("csstype").Property.ScrollPaddingBlock<string | number> | undefined;
329
330
  scrollPaddingBlockEnd?: import("csstype").Property.ScrollPaddingBlockEnd<string | number> | undefined;
330
331
  scrollPaddingBlockStart?: import("csstype").Property.ScrollPaddingBlockStart<string | number> | undefined;
331
332
  scrollPaddingBottom?: import("csstype").Property.ScrollPaddingBottom<string | number> | undefined;
332
- scrollPaddingInline?: import("csstype").Property.ScrollPaddingInline<string | number> | undefined;
333
333
  scrollPaddingInlineEnd?: import("csstype").Property.ScrollPaddingInlineEnd<string | number> | undefined;
334
334
  scrollPaddingInlineStart?: import("csstype").Property.ScrollPaddingInlineStart<string | number> | undefined;
335
335
  scrollPaddingLeft?: import("csstype").Property.ScrollPaddingLeft<string | number> | undefined;
336
336
  scrollPaddingRight?: import("csstype").Property.ScrollPaddingRight<string | number> | undefined;
337
337
  scrollPaddingTop?: import("csstype").Property.ScrollPaddingTop<string | number> | undefined;
338
338
  scrollSnapAlign?: import("csstype").Property.ScrollSnapAlign | undefined;
339
- scrollSnapMargin?: import("csstype").Property.ScrollMargin<string | number> | undefined;
340
339
  scrollSnapMarginBottom?: import("csstype").Property.ScrollMarginBottom<string | number> | undefined;
341
340
  scrollSnapMarginLeft?: import("csstype").Property.ScrollMarginLeft<string | number> | undefined;
342
341
  scrollSnapMarginRight?: import("csstype").Property.ScrollMarginRight<string | number> | undefined;
343
342
  scrollSnapMarginTop?: import("csstype").Property.ScrollMarginTop<string | number> | undefined;
344
343
  scrollSnapStop?: import("csstype").Property.ScrollSnapStop | undefined;
345
344
  scrollSnapType?: import("csstype").Property.ScrollSnapType | undefined;
345
+ scrollTimelineAxis?: import("csstype").Property.ScrollTimelineAxis | undefined;
346
+ scrollTimelineName?: import("csstype").Property.ScrollTimelineName | undefined;
346
347
  scrollbarColor?: import("csstype").Property.ScrollbarColor | undefined;
347
348
  scrollbarGutter?: import("csstype").Property.ScrollbarGutter | undefined;
348
349
  scrollbarWidth?: import("csstype").Property.ScrollbarWidth | undefined;
@@ -387,6 +388,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
387
388
  unicodeBidi?: import("csstype").Property.UnicodeBidi | undefined;
388
389
  userSelect?: import("csstype").Property.UserSelect | undefined;
389
390
  verticalAlign?: import("csstype").Property.VerticalAlign<string | number> | undefined;
391
+ viewTransitionName?: import("csstype").Property.ViewTransitionName | undefined;
390
392
  visibility?: import("csstype").Property.Visibility | undefined;
391
393
  whiteSpace?: import("csstype").Property.WhiteSpace | undefined;
392
394
  widows?: import("csstype").Property.Widows | undefined;
@@ -418,8 +420,11 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
418
420
  borderStyle?: import("csstype").Property.BorderStyle | undefined;
419
421
  borderTop?: import("csstype").Property.BorderTop<string | number> | undefined;
420
422
  borderWidth?: import("csstype").Property.BorderWidth<string | number> | undefined;
423
+ caret?: import("csstype").Property.Caret | undefined;
421
424
  columnRule?: import("csstype").Property.ColumnRule<string | number> | undefined;
422
425
  columns?: import("csstype").Property.Columns<string | number> | undefined;
426
+ containIntrinsicSize?: import("csstype").Property.ContainIntrinsicSize<string | number> | undefined;
427
+ container?: import("csstype").Property.Container | undefined;
423
428
  flex?: import("csstype").Property.Flex<string | number> | undefined;
424
429
  flexFlow?: import("csstype").Property.FlexFlow | undefined;
425
430
  font?: import("csstype").Property.Font | undefined;
@@ -429,9 +434,14 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
429
434
  gridColumn?: import("csstype").Property.GridColumn | undefined;
430
435
  gridRow?: import("csstype").Property.GridRow | undefined;
431
436
  gridTemplate?: import("csstype").Property.GridTemplate | undefined;
437
+ inset?: import("csstype").Property.Inset<string | number> | undefined;
438
+ insetBlock?: import("csstype").Property.InsetBlock<string | number> | undefined;
439
+ insetInline?: import("csstype").Property.InsetInline<string | number> | undefined;
432
440
  lineClamp?: import("csstype").Property.LineClamp | undefined;
433
441
  listStyle?: import("csstype").Property.ListStyle | undefined;
434
442
  margin?: import("csstype").Property.Margin<string | number> | undefined;
443
+ marginBlock?: import("csstype").Property.MarginBlock<string | number> | undefined;
444
+ marginInline?: import("csstype").Property.MarginInline<string | number> | undefined;
435
445
  mask?: import("csstype").Property.Mask<string | number> | undefined;
436
446
  maskBorder?: import("csstype").Property.MaskBorder | undefined;
437
447
  motion?: import("csstype").Property.Offset<string | number> | undefined;
@@ -440,8 +450,19 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
440
450
  overflow?: import("csstype").Property.Overflow | undefined;
441
451
  overscrollBehavior?: import("csstype").Property.OverscrollBehavior | undefined;
442
452
  padding?: import("csstype").Property.Padding<string | number> | undefined;
453
+ paddingBlock?: import("csstype").Property.PaddingBlock<string | number> | undefined;
454
+ paddingInline?: import("csstype").Property.PaddingInline<string | number> | undefined;
455
+ placeContent?: import("csstype").Property.PlaceContent | undefined;
443
456
  placeItems?: import("csstype").Property.PlaceItems | undefined;
444
457
  placeSelf?: import("csstype").Property.PlaceSelf | undefined;
458
+ scrollMargin?: import("csstype").Property.ScrollMargin<string | number> | undefined;
459
+ scrollMarginBlock?: import("csstype").Property.ScrollMarginBlock<string | number> | undefined;
460
+ scrollMarginInline?: import("csstype").Property.ScrollMarginInline<string | number> | undefined;
461
+ scrollPadding?: import("csstype").Property.ScrollPadding<string | number> | undefined;
462
+ scrollPaddingBlock?: import("csstype").Property.ScrollPaddingBlock<string | number> | undefined;
463
+ scrollPaddingInline?: import("csstype").Property.ScrollPaddingInline<string | number> | undefined;
464
+ scrollSnapMargin?: import("csstype").Property.ScrollMargin<string | number> | undefined;
465
+ scrollTimeline?: import("csstype").Property.ScrollTimeline | undefined;
445
466
  textDecoration?: import("csstype").Property.TextDecoration<string | number> | undefined;
446
467
  textEmphasis?: import("csstype").Property.TextEmphasis | undefined;
447
468
  transition?: import("csstype").Property.Transition<string & {}> | undefined;
@@ -455,6 +476,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
455
476
  MozAnimationTimingFunction?: import("csstype").Property.AnimationTimingFunction | undefined;
456
477
  MozAppearance?: import("csstype").Property.MozAppearance | undefined;
457
478
  MozBackfaceVisibility?: import("csstype").Property.BackfaceVisibility | undefined;
479
+ MozBinding?: import("csstype").Property.MozBinding | undefined;
458
480
  MozBorderBottomColors?: import("csstype").Property.MozBorderBottomColors | undefined;
459
481
  MozBorderEndColor?: import("csstype").Property.BorderInlineEndColor | undefined;
460
482
  MozBorderEndStyle?: import("csstype").Property.BorderInlineEndStyle | undefined;
@@ -735,7 +757,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
735
757
  MozBackgroundInlinePolicy?: import("csstype").Property.BoxDecorationBreak | undefined;
736
758
  MozBackgroundOrigin?: import("csstype").Property.BackgroundOrigin | undefined;
737
759
  MozBackgroundSize?: import("csstype").Property.BackgroundSize<string | number> | undefined;
738
- MozBinding?: import("csstype").Property.MozBinding | undefined;
739
760
  MozBorderRadius?: import("csstype").Property.BorderRadius<string | number> | undefined;
740
761
  MozBorderRadiusBottomleft?: import("csstype").Property.BorderBottomLeftRadius<string | number> | undefined;
741
762
  MozBorderRadiusBottomright?: import("csstype").Property.BorderBottomRightRadius<string | number> | undefined;
@@ -176,11 +176,13 @@ export const useGridVirtualScroller = props => {
176
176
  height: rootRef.current.clientHeight
177
177
  });
178
178
  }, [rowsMeta.currentPageTotalHeight]);
179
- const handleResize = React.useCallback(params => {
180
- setContainerDimensions({
181
- width: params.width,
182
- height: params.height
183
- });
179
+ const handleResize = React.useCallback(() => {
180
+ if (rootRef.current) {
181
+ setContainerDimensions({
182
+ width: rootRef.current.clientWidth,
183
+ height: rootRef.current.clientHeight
184
+ });
185
+ }
184
186
  }, []);
185
187
  useGridApiEventHandler(apiRef, 'debouncedResize', handleResize);
186
188
  const updateRenderZonePosition = React.useCallback(nextRenderContext => {
@@ -307,6 +309,7 @@ export const useGridVirtualScroller = props => {
307
309
  }) => {
308
310
  var _rootProps$slotProps;
309
311
  const {
312
+ onRowRender,
310
313
  renderContext: nextRenderContext,
311
314
  minFirstColumn = renderZoneMinColumnIndex,
312
315
  maxLastColumn = renderZoneMaxColumnIndex,
@@ -391,6 +394,9 @@ export const useGridVirtualScroller = props => {
391
394
  } else {
392
395
  isSelected = apiRef.current.isRowSelectable(id);
393
396
  }
397
+ if (onRowRender) {
398
+ onRowRender(id);
399
+ }
394
400
  const focusedCell = cellFocus !== null && cellFocus.id === id ? cellFocus.field : null;
395
401
  let tabbableCell = null;
396
402
  if (cellTabIndex !== null && cellTabIndex.id === id) {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.1.0
2
+ * @mui/x-data-grid v6.2.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/joy/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import joySlots from './joySlots';
2
+ export { joySlots as unstable_joySlots };
package/joy/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import joySlots from './joySlots';
2
+ export { joySlots as unstable_joySlots };
@@ -0,0 +1,4 @@
1
+ import type { UncapitalizeObjectKeys } from '../internals/utils';
2
+ import type { GridSlotsComponent } from '../models';
3
+ declare const joySlots: UncapitalizeObjectKeys<Partial<GridSlotsComponent>>;
4
+ export default joySlots;