@mui/x-data-grid 7.23.2 → 7.23.3

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 (52) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/DataGrid/DataGrid.js +3 -1
  3. package/components/GridRow.js +12 -1
  4. package/components/cell/GridActionsCell.js +8 -1
  5. package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  6. package/components/columnSelection/GridHeaderCheckbox.js +1 -1
  7. package/components/virtualization/GridMainContainer.js +1 -1
  8. package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
  9. package/hooks/features/columnResize/gridColumnResizeApi.d.ts +6 -0
  10. package/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
  11. package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
  12. package/hooks/features/columnResize/useGridColumnResize.js +9 -4
  13. package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
  14. package/hooks/features/columns/gridColumnsUtils.js +2 -1
  15. package/hooks/features/rows/useGridRowSpanning.js +13 -5
  16. package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  17. package/index.js +1 -1
  18. package/internals/utils/useProps.js +3 -0
  19. package/locales/koKR.js +36 -39
  20. package/models/gridSlotsComponentsProps.d.ts +10 -0
  21. package/models/props/DataGridProps.d.ts +1 -0
  22. package/modern/DataGrid/DataGrid.js +3 -1
  23. package/modern/components/GridRow.js +12 -1
  24. package/modern/components/cell/GridActionsCell.js +8 -1
  25. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  26. package/modern/components/columnSelection/GridHeaderCheckbox.js +1 -1
  27. package/modern/components/virtualization/GridMainContainer.js +1 -1
  28. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
  29. package/modern/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
  30. package/modern/hooks/features/columnResize/useGridColumnResize.js +9 -4
  31. package/modern/hooks/features/columns/gridColumnsUtils.js +2 -1
  32. package/modern/hooks/features/rows/useGridRowSpanning.js +13 -5
  33. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  34. package/modern/index.js +1 -1
  35. package/modern/internals/utils/useProps.js +3 -0
  36. package/modern/locales/koKR.js +36 -39
  37. package/node/DataGrid/DataGrid.js +3 -1
  38. package/node/components/GridRow.js +12 -1
  39. package/node/components/cell/GridActionsCell.js +8 -1
  40. package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  41. package/node/components/columnSelection/GridHeaderCheckbox.js +1 -1
  42. package/node/components/virtualization/GridMainContainer.js +1 -1
  43. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
  44. package/node/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
  45. package/node/hooks/features/columnResize/useGridColumnResize.js +9 -4
  46. package/node/hooks/features/columns/gridColumnsUtils.js +2 -1
  47. package/node/hooks/features/rows/useGridRowSpanning.js +13 -5
  48. package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  49. package/node/index.js +1 -1
  50. package/node/internals/utils/useProps.js +3 -0
  51. package/node/locales/koKR.js +36 -39
  52. package/package.json +1 -1
@@ -79,8 +79,8 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
79
79
  if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
80
80
  return null;
81
81
  }
82
- const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
83
82
  const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
83
+ const label = apiRef.current.getLocaleText(checked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
84
84
  return /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
85
85
  ref: handleRef,
86
86
  tabIndex: tabIndex,
@@ -92,8 +92,8 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
92
92
  React.useEffect(() => {
93
93
  return apiRef.current.subscribeEvent('rowSelectionChange', handleSelectionChange);
94
94
  }, [apiRef, handleSelectionChange]);
95
- const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
96
95
  const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
96
+ const label = apiRef.current.getLocaleText(checked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
97
97
  return /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
98
98
  ref: ref,
99
99
  indeterminate: isIndeterminate,
@@ -30,7 +30,7 @@ export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
30
30
  ownerState: rootProps,
31
31
  className: props.className,
32
32
  tabIndex: -1
33
- }, ariaAttributes, {
33
+ }, ariaAttributes, rootProps.slotProps?.main, {
34
34
  children: [/*#__PURE__*/_jsx(GridPanelAnchor, {
35
35
  role: "presentation",
36
36
  "data-id": "gridPanelAnchor"
@@ -47,7 +47,7 @@ export const useGridColumnHeaders = props => {
47
47
  const isRtl = useRtl();
48
48
  const rootProps = useGridRootProps();
49
49
  const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
50
- const hasVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
50
+ const hasColumnVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
51
51
  const columnGroupsModel = useGridSelector(apiRef, gridColumnGroupsUnwrappedModelSelector);
52
52
  const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
53
53
  const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
@@ -87,8 +87,15 @@ export const useGridColumnHeaders = props => {
87
87
  renderContext: currentContext = renderContext,
88
88
  maxLastColumn = visibleColumns.length
89
89
  } = params || {};
90
- const firstColumnToRender = currentContext.firstColumnIndex;
91
- const lastColumnToRender = !hasVirtualization ? maxLastColumn : currentContext.lastColumnIndex;
90
+ let firstColumnToRender;
91
+ let lastColumnToRender;
92
+ if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
93
+ firstColumnToRender = 0;
94
+ lastColumnToRender = maxLastColumn;
95
+ } else {
96
+ firstColumnToRender = currentContext.firstColumnIndex;
97
+ lastColumnToRender = currentContext.lastColumnIndex;
98
+ }
92
99
  const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
93
100
  return {
94
101
  renderedColumns,
@@ -2,7 +2,8 @@ export const DEFAULT_GRID_AUTOSIZE_OPTIONS = {
2
2
  includeHeaders: true,
3
3
  includeOutliers: false,
4
4
  outliersFactor: 1.5,
5
- expand: false
5
+ expand: false,
6
+ disableColumnVirtualization: true
6
7
  };
7
8
 
8
9
  /**
@@ -458,6 +458,7 @@ export const useGridColumnResize = (apiRef, props) => {
458
458
  return;
459
459
  }
460
460
  apiRef.current.autosizeColumns(_extends({}, props.autosizeOptions, {
461
+ disableColumnVirtualization: false,
461
462
  columns: [column.field]
462
463
  }));
463
464
  });
@@ -484,8 +485,10 @@ export const useGridColumnResize = (apiRef, props) => {
484
485
  options.columns = options.columns.filter(c => state.columnVisibilityModel[c] !== false);
485
486
  const columns = options.columns.map(c => apiRef.current.state.columns.lookup[c]);
486
487
  try {
487
- apiRef.current.unstable_setColumnVirtualization(false);
488
- await columnVirtualizationDisabled();
488
+ if (!props.disableVirtualization && options.disableColumnVirtualization) {
489
+ apiRef.current.unstable_setColumnVirtualization(false);
490
+ await columnVirtualizationDisabled();
491
+ }
489
492
  const widthByField = extractColumnWidths(apiRef, options, columns);
490
493
  const newColumns = columns.map(column => _extends({}, column, {
491
494
  width: widthByField[column.field],
@@ -517,10 +520,12 @@ export const useGridColumnResize = (apiRef, props) => {
517
520
  }
518
521
  });
519
522
  } finally {
520
- apiRef.current.unstable_setColumnVirtualization(true);
523
+ if (!props.disableVirtualization) {
524
+ apiRef.current.unstable_setColumnVirtualization(true);
525
+ }
521
526
  isAutosizingRef.current = false;
522
527
  }
523
- }, [apiRef, columnVirtualizationDisabled]);
528
+ }, [apiRef, columnVirtualizationDisabled, props.disableVirtualization]);
524
529
 
525
530
  /**
526
531
  * EFFECTS
@@ -319,6 +319,7 @@ export function getTotalHeaderHeight(apiRef, props) {
319
319
  const maxDepth = gridColumnGroupsHeaderMaxDepthSelector(apiRef);
320
320
  const isHeaderFilteringEnabled = gridHeaderFilteringEnabledSelector(apiRef);
321
321
  const columnHeadersHeight = Math.floor(props.columnHeaderHeight * densityFactor);
322
+ const columnGroupHeadersHeight = Math.floor((props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor);
322
323
  const filterHeadersHeight = isHeaderFilteringEnabled ? Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor) : 0;
323
- return columnHeadersHeight * (1 + (maxDepth ?? 0)) + filterHeadersHeight;
324
+ return columnHeadersHeight + columnGroupHeadersHeight * maxDepth + filterHeadersHeight;
324
325
  }
@@ -6,6 +6,7 @@ import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSele
6
6
  import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
7
7
  import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
8
8
  import { useGridSelector } from "../../utils/useGridSelector.js";
9
+ import { gridRowTreeSelector } from "./gridRowsSelector.js";
9
10
  import { getUnprocessedRange, isRowRangeUpdated, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
10
11
  import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
11
12
  const EMPTY_STATE = {
@@ -35,7 +36,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
35
36
  if (skippedFields.has(colDef.field)) {
36
37
  return;
37
38
  }
38
- for (let index = rangeToProcess.firstRowIndex; index <= rangeToProcess.lastRowIndex; index += 1) {
39
+ for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
39
40
  const row = visibleRows[index];
40
41
  if (hiddenCells[row.id]?.[colDef.field]) {
41
42
  continue;
@@ -142,7 +143,7 @@ export const rowSpanningStateInitializer = (state, props, apiRef) => {
142
143
  }
143
144
  const rangeToProcess = {
144
145
  firstRowIndex: 0,
145
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS - 1, Math.max(rowIds.length - 1, 0))
146
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
146
147
  };
147
148
  const rows = rowIds.map(id => ({
148
149
  id,
@@ -173,10 +174,11 @@ export const useGridRowSpanning = (apiRef, props) => {
173
174
  } = useGridVisibleRows(apiRef, props);
174
175
  const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
175
176
  const colDefs = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
177
+ const tree = useGridSelector(apiRef, gridRowTreeSelector);
176
178
  const processedRange = useLazyRef(() => {
177
179
  return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
178
180
  firstRowIndex: 0,
179
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS - 1, Math.max(apiRef.current.state.rows.dataRowIds.length - 1, 0))
181
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
180
182
  } : EMPTY_RANGE;
181
183
  });
182
184
  const lastRange = React.useRef(EMPTY_RANGE);
@@ -204,7 +206,7 @@ export const useGridRowSpanning = (apiRef, props) => {
204
206
  }
205
207
  const rangeToProcess = getUnprocessedRange({
206
208
  firstRowIndex: renderContext.firstRowIndex,
207
- lastRowIndex: Math.min(renderContext.lastRowIndex - 1, range.lastRowIndex)
209
+ lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
208
210
  }, processedRange.current);
209
211
  if (rangeToProcess === null) {
210
212
  return;
@@ -237,11 +239,17 @@ export const useGridRowSpanning = (apiRef, props) => {
237
239
  const prevRenderContext = React.useRef(renderContext);
238
240
  const isFirstRender = React.useRef(true);
239
241
  const shouldResetState = React.useRef(false);
242
+ const previousTree = React.useRef(tree);
240
243
  React.useEffect(() => {
241
244
  const firstRender = isFirstRender.current;
242
245
  if (isFirstRender.current) {
243
246
  isFirstRender.current = false;
244
247
  }
248
+ if (tree !== previousTree.current) {
249
+ previousTree.current = tree;
250
+ updateRowSpanningState(true);
251
+ return;
252
+ }
245
253
  if (range && lastRange.current && isRowRangeUpdated(range, lastRange.current)) {
246
254
  lastRange.current = range;
247
255
  shouldResetState.current = true;
@@ -255,5 +263,5 @@ export const useGridRowSpanning = (apiRef, props) => {
255
263
  return;
256
264
  }
257
265
  updateRowSpanningState();
258
- }, [updateRowSpanningState, renderContext, range, lastRange]);
266
+ }, [updateRowSpanningState, renderContext, range, lastRange, tree]);
259
267
  };
@@ -92,10 +92,7 @@ export const useGridVirtualScroller = () => {
92
92
  return undefined;
93
93
  }
94
94
  const initialRect = node.getBoundingClientRect();
95
- let lastSize = {
96
- width: initialRect.width,
97
- height: initialRect.height
98
- };
95
+ let lastSize = roundDimensions(initialRect);
99
96
  apiRef.current.publishEvent('resize', lastSize);
100
97
  if (typeof ResizeObserver === 'undefined') {
101
98
  return undefined;
@@ -105,10 +102,7 @@ export const useGridVirtualScroller = () => {
105
102
  if (!entry) {
106
103
  return;
107
104
  }
108
- const newSize = {
109
- width: entry.contentRect.width,
110
- height: entry.contentRect.height
111
- };
105
+ const newSize = roundDimensions(entry.contentRect);
112
106
  if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
113
107
  return;
114
108
  }
@@ -784,4 +778,13 @@ function bufferForDirection(isRtl, direction, rowBufferPx, columnBufferPx, verti
784
778
  // eslint unable to figure out enum exhaustiveness
785
779
  throw new Error('unreachable');
786
780
  }
781
+ }
782
+
783
+ // Round to avoid issues with subpixel rendering
784
+ // https://github.com/mui/mui-x/issues/15721
785
+ function roundDimensions(dimensions) {
786
+ return {
787
+ width: Math.round(dimensions.width * 10) / 10,
788
+ height: Math.round(dimensions.height * 10) / 10
789
+ };
787
790
  }
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.23.2
2
+ * @mui/x-data-grid v7.23.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -2,6 +2,9 @@ import * as React from 'react';
2
2
 
3
3
  /** Gathers props for the root element into a single `.forwardedProps` field */
4
4
  function groupForwardedProps(props) {
5
+ if (props.slotProps?.root) {
6
+ return props;
7
+ }
5
8
  const keys = Object.keys(props);
6
9
  if (!keys.some(key => key.startsWith('aria-') || key.startsWith('data-'))) {
7
10
  return props;
@@ -30,15 +30,14 @@ const koKRGrid = {
30
30
  toolbarExportPrint: '프린트',
31
31
  toolbarExportExcel: 'Excel로 내보내기',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
- // columnsManagementReset: 'Reset',
37
- // columnsManagementDeleteIconLabel: 'Clear',
38
-
33
+ columnsManagementSearchTitle: '검색',
34
+ columnsManagementNoColumns: '열이 없습니다.',
35
+ columnsManagementShowHideAllText: '모두 보기/숨기기',
36
+ columnsManagementReset: '초기화',
37
+ columnsManagementDeleteIconLabel: '제거',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: '필터 추가',
41
- // filterPanelRemoveAll: 'Remove all',
40
+ filterPanelRemoveAll: '모두 삭제',
42
41
  filterPanelDeleteIconLabel: '삭제',
43
42
  filterPanelLogicOperator: '논리 연산자',
44
43
  filterPanelOperator: '연산자',
@@ -49,9 +48,9 @@ const koKRGrid = {
49
48
  filterPanelInputPlaceholder: '값 입력',
50
49
  // Filter operators text
51
50
  filterOperatorContains: '포함하는',
52
- // filterOperatorDoesNotContain: 'does not contain',
51
+ filterOperatorDoesNotContain: '포함하지 않는',
53
52
  filterOperatorEquals: '값이 같은',
54
- // filterOperatorDoesNotEqual: 'does not equal',
53
+ filterOperatorDoesNotEqual: '값이 다른',
55
54
  filterOperatorStartsWith: '시작하는',
56
55
  filterOperatorEndsWith: '끝나는',
57
56
  filterOperatorIs: '~인',
@@ -63,36 +62,34 @@ const koKRGrid = {
63
62
  filterOperatorIsEmpty: '값이 없는',
64
63
  filterOperatorIsNotEmpty: '값이 있는',
65
64
  filterOperatorIsAnyOf: '값 중 하나인',
66
- // 'filterOperator=': '=',
67
- // 'filterOperator!=': '!=',
68
- // 'filterOperator>': '>',
69
- // 'filterOperator>=': '>=',
70
- // 'filterOperator<': '<',
71
- // 'filterOperator<=': '<=',
72
-
65
+ 'filterOperator=': '=',
66
+ 'filterOperator!=': '!=',
67
+ 'filterOperator>': '>',
68
+ 'filterOperator>=': '>=',
69
+ 'filterOperator<': '<',
70
+ 'filterOperator<=': '<=',
73
71
  // Header filter operators text
74
- // headerFilterOperatorContains: 'Contains',
75
- // headerFilterOperatorDoesNotContain: 'Does not contain',
76
- // headerFilterOperatorEquals: 'Equals',
77
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
78
- // headerFilterOperatorStartsWith: 'Starts with',
79
- // headerFilterOperatorEndsWith: 'Ends with',
80
- // headerFilterOperatorIs: 'Is',
81
- // headerFilterOperatorNot: 'Is not',
82
- // headerFilterOperatorAfter: 'Is after',
83
- // headerFilterOperatorOnOrAfter: 'Is on or after',
84
- // headerFilterOperatorBefore: 'Is before',
85
- // headerFilterOperatorOnOrBefore: 'Is on or before',
86
- // headerFilterOperatorIsEmpty: 'Is empty',
87
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
88
- // headerFilterOperatorIsAnyOf: 'Is any of',
89
- // 'headerFilterOperator=': 'Equals',
90
- // 'headerFilterOperator!=': 'Not equals',
91
- // 'headerFilterOperator>': 'Greater than',
92
- // 'headerFilterOperator>=': 'Greater than or equal to',
93
- // 'headerFilterOperator<': 'Less than',
94
- // 'headerFilterOperator<=': 'Less than or equal to',
95
-
72
+ headerFilterOperatorContains: '포함하는',
73
+ headerFilterOperatorDoesNotContain: '포함하지 않는',
74
+ headerFilterOperatorEquals: '값이 같은',
75
+ headerFilterOperatorDoesNotEqual: '값이 다른',
76
+ headerFilterOperatorStartsWith: '시작하는',
77
+ headerFilterOperatorEndsWith: '끝나는',
78
+ headerFilterOperatorIs: '~인',
79
+ headerFilterOperatorNot: '~아닌',
80
+ headerFilterOperatorAfter: ' 이후',
81
+ headerFilterOperatorOnOrAfter: '이후',
82
+ headerFilterOperatorBefore: ' 이전',
83
+ headerFilterOperatorOnOrBefore: '이전',
84
+ headerFilterOperatorIsEmpty: '값이 없는',
85
+ headerFilterOperatorIsNotEmpty: '값이 있는',
86
+ headerFilterOperatorIsAnyOf: ' 하나인',
87
+ 'headerFilterOperator=': '값이 같은',
88
+ 'headerFilterOperator!=': '값이 다른',
89
+ 'headerFilterOperator>': ' ',
90
+ 'headerFilterOperator>=': '같거나 ',
91
+ 'headerFilterOperator<': ' 작은',
92
+ 'headerFilterOperator<=': '같거나 작은',
96
93
  // Filter values text
97
94
  filterValueAny: '아무값',
98
95
  filterValueTrue: '참',
@@ -100,7 +97,7 @@ const koKRGrid = {
100
97
  // Column menu text
101
98
  columnMenuLabel: '메뉴',
102
99
  columnMenuShowColumns: '열 표시',
103
- // columnMenuManageColumns: 'Manage columns',
100
+ columnMenuManageColumns: ' 관리',
104
101
  columnMenuFilter: '필터',
105
102
  columnMenuHideColumn: '열 숨기기',
106
103
  columnMenuUnsort: '정렬 해제',
@@ -45,7 +45,7 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
45
45
  style: props.style,
46
46
  sx: props.sx,
47
47
  ref: ref
48
- }, props.forwardedProps, {
48
+ }, props.forwardedProps, props.slotProps?.root, {
49
49
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridHeader, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridBody, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridFooterPlaceholder, {})]
50
50
  }))
51
51
  });
@@ -102,6 +102,7 @@ DataGridRaw.propTypes = {
102
102
  */
103
103
  autosizeOptions: _propTypes.default.shape({
104
104
  columns: _propTypes.default.arrayOf(_propTypes.default.string),
105
+ disableColumnVirtualization: _propTypes.default.bool,
105
106
  expand: _propTypes.default.bool,
106
107
  includeHeaders: _propTypes.default.bool,
107
108
  includeOutliers: _propTypes.default.bool,
@@ -338,6 +339,7 @@ DataGridRaw.propTypes = {
338
339
  * If `deselect`, it will deselect all the rows under it.
339
340
  * Works only if `checkboxSelection` is enabled.
340
341
  * @default "deselect"
342
+ * @deprecated `select` will be the default behavior from v8 onwards
341
343
  */
342
344
  indeterminateCheckboxAction: _propTypes.default.oneOf(['deselect', 'select']),
343
345
  /**
@@ -32,6 +32,7 @@ var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
32
32
  var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
33
33
  var _useGridConfiguration = require("../hooks/utils/useGridConfiguration");
34
34
  var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
35
+ var _hooks = require("../hooks");
35
36
  var _jsxRuntime = require("react/jsx-runtime");
36
37
  const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
37
38
  function EmptyCell({
@@ -97,6 +98,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
97
98
  const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
98
99
  const editing = apiRef.current.getRowMode(rowId) === _gridEditRowModel.GridRowModes.Edit;
99
100
  const editable = rootProps.editMode === _gridEditRowModel.GridEditModes.Row;
101
+ const hasColumnVirtualization = (0, _useGridSelector.useGridSelector)(apiRef, _hooks.gridVirtualizationColumnEnabledSelector);
100
102
  const hasFocusCell = focusedColumnIndex !== undefined;
101
103
  const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
102
104
  const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
@@ -278,7 +280,16 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
278
280
  if (hasVirtualFocusCellLeft) {
279
281
  cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, _GridCell.PinnedPosition.VIRTUAL));
280
282
  }
281
- for (let i = renderContext.firstColumnIndex; i < renderContext.lastColumnIndex; i += 1) {
283
+ let firstColumnIndex;
284
+ let lastColumnIndex;
285
+ if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
286
+ firstColumnIndex = 0;
287
+ lastColumnIndex = visibleColumns.length;
288
+ } else {
289
+ firstColumnIndex = renderContext.firstColumnIndex;
290
+ lastColumnIndex = renderContext.lastColumnIndex;
291
+ }
292
+ for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
282
293
  const column = visibleColumns[i];
283
294
  const indexInSection = i - pinnedColumns.left.length;
284
295
  if (!column) {
@@ -99,6 +99,13 @@ function GridActionsCell(props) {
99
99
  const hideMenu = () => {
100
100
  setOpen(false);
101
101
  };
102
+ const toggleMenu = () => {
103
+ if (open) {
104
+ hideMenu();
105
+ } else {
106
+ showMenu();
107
+ }
108
+ };
102
109
  const handleTouchRippleRef = index => instance => {
103
110
  touchRippleRefs.current[index] = instance;
104
111
  };
@@ -169,7 +176,7 @@ function GridActionsCell(props) {
169
176
  "aria-controls": open ? menuId : undefined,
170
177
  role: "menuitem",
171
178
  size: "small",
172
- onClick: showMenu,
179
+ onClick: toggleMenu,
173
180
  touchRippleRef: handleTouchRippleRef(buttonId),
174
181
  tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
175
182
  }, rootProps.slotProps?.baseIconButton, {
@@ -87,8 +87,8 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = /*#__PUR
87
87
  if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
88
88
  return null;
89
89
  }
90
- const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
91
90
  const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
91
+ const label = apiRef.current.getLocaleText(checked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
92
92
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseCheckbox, (0, _extends2.default)({
93
93
  ref: handleRef,
94
94
  tabIndex: tabIndex,
@@ -100,8 +100,8 @@ const GridHeaderCheckbox = exports.GridHeaderCheckbox = /*#__PURE__*/React.forwa
100
100
  React.useEffect(() => {
101
101
  return apiRef.current.subscribeEvent('rowSelectionChange', handleSelectionChange);
102
102
  }, [apiRef, handleSelectionChange]);
103
- const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
104
103
  const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
104
+ const label = apiRef.current.getLocaleText(checked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
105
105
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseCheckbox, (0, _extends2.default)({
106
106
  ref: ref,
107
107
  indeterminate: isIndeterminate,
@@ -38,7 +38,7 @@ const GridMainContainer = exports.GridMainContainer = /*#__PURE__*/React.forward
38
38
  ownerState: rootProps,
39
39
  className: props.className,
40
40
  tabIndex: -1
41
- }, ariaAttributes, {
41
+ }, ariaAttributes, rootProps.slotProps?.main, {
42
42
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelAnchor, {
43
43
  role: "presentation",
44
44
  "data-id": "gridPanelAnchor"
@@ -55,7 +55,7 @@ const useGridColumnHeaders = props => {
55
55
  const isRtl = (0, _RtlProvider.useRtl)();
56
56
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
57
57
  const dimensions = (0, _utils.useGridSelector)(apiRef, _dimensions.gridDimensionsSelector);
58
- const hasVirtualization = (0, _utils.useGridSelector)(apiRef, _virtualization.gridVirtualizationColumnEnabledSelector);
58
+ const hasColumnVirtualization = (0, _utils.useGridSelector)(apiRef, _virtualization.gridVirtualizationColumnEnabledSelector);
59
59
  const columnGroupsModel = (0, _utils.useGridSelector)(apiRef, _gridColumnGroupsSelector.gridColumnGroupsUnwrappedModelSelector);
60
60
  const columnPositions = (0, _utils.useGridSelector)(apiRef, _columns.gridColumnPositionsSelector);
61
61
  const renderContext = (0, _utils.useGridSelector)(apiRef, _virtualization.gridRenderContextColumnsSelector);
@@ -95,8 +95,15 @@ const useGridColumnHeaders = props => {
95
95
  renderContext: currentContext = renderContext,
96
96
  maxLastColumn = visibleColumns.length
97
97
  } = params || {};
98
- const firstColumnToRender = currentContext.firstColumnIndex;
99
- const lastColumnToRender = !hasVirtualization ? maxLastColumn : currentContext.lastColumnIndex;
98
+ let firstColumnToRender;
99
+ let lastColumnToRender;
100
+ if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
101
+ firstColumnToRender = 0;
102
+ lastColumnToRender = maxLastColumn;
103
+ } else {
104
+ firstColumnToRender = currentContext.firstColumnIndex;
105
+ lastColumnToRender = currentContext.lastColumnIndex;
106
+ }
100
107
  const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
101
108
  return {
102
109
  renderedColumns,
@@ -8,7 +8,8 @@ const DEFAULT_GRID_AUTOSIZE_OPTIONS = exports.DEFAULT_GRID_AUTOSIZE_OPTIONS = {
8
8
  includeHeaders: true,
9
9
  includeOutliers: false,
10
10
  outliersFactor: 1.5,
11
- expand: false
11
+ expand: false,
12
+ disableColumnVirtualization: true
12
13
  };
13
14
 
14
15
  /**
@@ -467,6 +467,7 @@ const useGridColumnResize = (apiRef, props) => {
467
467
  return;
468
468
  }
469
469
  apiRef.current.autosizeColumns((0, _extends2.default)({}, props.autosizeOptions, {
470
+ disableColumnVirtualization: false,
470
471
  columns: [column.field]
471
472
  }));
472
473
  });
@@ -493,8 +494,10 @@ const useGridColumnResize = (apiRef, props) => {
493
494
  options.columns = options.columns.filter(c => state.columnVisibilityModel[c] !== false);
494
495
  const columns = options.columns.map(c => apiRef.current.state.columns.lookup[c]);
495
496
  try {
496
- apiRef.current.unstable_setColumnVirtualization(false);
497
- await columnVirtualizationDisabled();
497
+ if (!props.disableVirtualization && options.disableColumnVirtualization) {
498
+ apiRef.current.unstable_setColumnVirtualization(false);
499
+ await columnVirtualizationDisabled();
500
+ }
498
501
  const widthByField = extractColumnWidths(apiRef, options, columns);
499
502
  const newColumns = columns.map(column => (0, _extends2.default)({}, column, {
500
503
  width: widthByField[column.field],
@@ -526,10 +529,12 @@ const useGridColumnResize = (apiRef, props) => {
526
529
  }
527
530
  });
528
531
  } finally {
529
- apiRef.current.unstable_setColumnVirtualization(true);
532
+ if (!props.disableVirtualization) {
533
+ apiRef.current.unstable_setColumnVirtualization(true);
534
+ }
530
535
  isAutosizingRef.current = false;
531
536
  }
532
- }, [apiRef, columnVirtualizationDisabled]);
537
+ }, [apiRef, columnVirtualizationDisabled, props.disableVirtualization]);
533
538
 
534
539
  /**
535
540
  * EFFECTS
@@ -334,6 +334,7 @@ function getTotalHeaderHeight(apiRef, props) {
334
334
  const maxDepth = (0, _gridColumnGroupsSelector.gridColumnGroupsHeaderMaxDepthSelector)(apiRef);
335
335
  const isHeaderFilteringEnabled = (0, _gridHeaderFilteringSelectors.gridHeaderFilteringEnabledSelector)(apiRef);
336
336
  const columnHeadersHeight = Math.floor(props.columnHeaderHeight * densityFactor);
337
+ const columnGroupHeadersHeight = Math.floor((props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor);
337
338
  const filterHeadersHeight = isHeaderFilteringEnabled ? Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor) : 0;
338
- return columnHeadersHeight * (1 + (maxDepth ?? 0)) + filterHeadersHeight;
339
+ return columnHeadersHeight + columnGroupHeadersHeight * maxDepth + filterHeadersHeight;
339
340
  }
@@ -14,6 +14,7 @@ var _gridColumnsSelector = require("../columns/gridColumnsSelector");
14
14
  var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
15
15
  var _gridVirtualizationSelectors = require("../virtualization/gridVirtualizationSelectors");
16
16
  var _useGridSelector = require("../../utils/useGridSelector");
17
+ var _gridRowsSelector = require("./gridRowsSelector");
17
18
  var _gridRowSpanningUtils = require("./gridRowSpanningUtils");
18
19
  var _gridCheckboxSelectionColDef = require("../../../colDef/gridCheckboxSelectionColDef");
19
20
  const EMPTY_STATE = {
@@ -43,7 +44,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
43
44
  if (skippedFields.has(colDef.field)) {
44
45
  return;
45
46
  }
46
- for (let index = rangeToProcess.firstRowIndex; index <= rangeToProcess.lastRowIndex; index += 1) {
47
+ for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
47
48
  const row = visibleRows[index];
48
49
  if (hiddenCells[row.id]?.[colDef.field]) {
49
50
  continue;
@@ -150,7 +151,7 @@ const rowSpanningStateInitializer = (state, props, apiRef) => {
150
151
  }
151
152
  const rangeToProcess = {
152
153
  firstRowIndex: 0,
153
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS - 1, Math.max(rowIds.length - 1, 0))
154
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
154
155
  };
155
156
  const rows = rowIds.map(id => ({
156
157
  id,
@@ -182,10 +183,11 @@ const useGridRowSpanning = (apiRef, props) => {
182
183
  } = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props);
183
184
  const renderContext = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridRenderContextSelector);
184
185
  const colDefs = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector);
186
+ const tree = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowTreeSelector);
185
187
  const processedRange = (0, _useLazyRef.default)(() => {
186
188
  return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
187
189
  firstRowIndex: 0,
188
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS - 1, Math.max(apiRef.current.state.rows.dataRowIds.length - 1, 0))
190
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
189
191
  } : EMPTY_RANGE;
190
192
  });
191
193
  const lastRange = React.useRef(EMPTY_RANGE);
@@ -213,7 +215,7 @@ const useGridRowSpanning = (apiRef, props) => {
213
215
  }
214
216
  const rangeToProcess = (0, _gridRowSpanningUtils.getUnprocessedRange)({
215
217
  firstRowIndex: renderContext.firstRowIndex,
216
- lastRowIndex: Math.min(renderContext.lastRowIndex - 1, range.lastRowIndex)
218
+ lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
217
219
  }, processedRange.current);
218
220
  if (rangeToProcess === null) {
219
221
  return;
@@ -246,11 +248,17 @@ const useGridRowSpanning = (apiRef, props) => {
246
248
  const prevRenderContext = React.useRef(renderContext);
247
249
  const isFirstRender = React.useRef(true);
248
250
  const shouldResetState = React.useRef(false);
251
+ const previousTree = React.useRef(tree);
249
252
  React.useEffect(() => {
250
253
  const firstRender = isFirstRender.current;
251
254
  if (isFirstRender.current) {
252
255
  isFirstRender.current = false;
253
256
  }
257
+ if (tree !== previousTree.current) {
258
+ previousTree.current = tree;
259
+ updateRowSpanningState(true);
260
+ return;
261
+ }
254
262
  if (range && lastRange.current && (0, _gridRowSpanningUtils.isRowRangeUpdated)(range, lastRange.current)) {
255
263
  lastRange.current = range;
256
264
  shouldResetState.current = true;
@@ -264,6 +272,6 @@ const useGridRowSpanning = (apiRef, props) => {
264
272
  return;
265
273
  }
266
274
  updateRowSpanningState();
267
- }, [updateRowSpanningState, renderContext, range, lastRange]);
275
+ }, [updateRowSpanningState, renderContext, range, lastRange, tree]);
268
276
  };
269
277
  exports.useGridRowSpanning = useGridRowSpanning;