@mui/x-data-grid 7.23.1 → 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 (76) hide show
  1. package/CHANGELOG.md +129 -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/panel/GridColumnsPanel.js +1 -2
  8. package/components/virtualization/GridMainContainer.js +1 -1
  9. package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
  10. package/hooks/features/columnResize/gridColumnResizeApi.d.ts +6 -0
  11. package/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
  12. package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
  13. package/hooks/features/columnResize/useGridColumnResize.js +9 -4
  14. package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
  15. package/hooks/features/columns/gridColumnsUtils.js +2 -1
  16. package/hooks/features/overlays/useGridOverlays.js +3 -1
  17. package/hooks/features/rows/useGridRowSpanning.js +13 -5
  18. package/hooks/features/sorting/gridSortingSelector.d.ts +7 -2
  19. package/hooks/features/sorting/gridSortingSelector.js +11 -0
  20. package/hooks/features/sorting/index.d.ts +2 -1
  21. package/hooks/features/sorting/index.js +1 -1
  22. package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  23. package/index.js +1 -1
  24. package/internals/index.d.ts +1 -0
  25. package/internals/index.js +1 -0
  26. package/internals/utils/useProps.js +3 -0
  27. package/locales/koKR.js +36 -39
  28. package/locales/roRO.js +9 -10
  29. package/locales/trTR.js +3 -4
  30. package/models/gridSlotsComponentsProps.d.ts +10 -0
  31. package/models/props/DataGridProps.d.ts +1 -0
  32. package/modern/DataGrid/DataGrid.js +3 -1
  33. package/modern/components/GridRow.js +12 -1
  34. package/modern/components/cell/GridActionsCell.js +8 -1
  35. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  36. package/modern/components/columnSelection/GridHeaderCheckbox.js +1 -1
  37. package/modern/components/panel/GridColumnsPanel.js +1 -2
  38. package/modern/components/virtualization/GridMainContainer.js +1 -1
  39. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
  40. package/modern/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
  41. package/modern/hooks/features/columnResize/useGridColumnResize.js +9 -4
  42. package/modern/hooks/features/columns/gridColumnsUtils.js +2 -1
  43. package/modern/hooks/features/overlays/useGridOverlays.js +3 -1
  44. package/modern/hooks/features/rows/useGridRowSpanning.js +13 -5
  45. package/modern/hooks/features/sorting/gridSortingSelector.js +11 -0
  46. package/modern/hooks/features/sorting/index.js +1 -1
  47. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  48. package/modern/index.js +1 -1
  49. package/modern/internals/index.js +1 -0
  50. package/modern/internals/utils/useProps.js +3 -0
  51. package/modern/locales/koKR.js +36 -39
  52. package/modern/locales/roRO.js +9 -10
  53. package/modern/locales/trTR.js +3 -4
  54. package/node/DataGrid/DataGrid.js +3 -1
  55. package/node/components/GridRow.js +12 -1
  56. package/node/components/cell/GridActionsCell.js +8 -1
  57. package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  58. package/node/components/columnSelection/GridHeaderCheckbox.js +1 -1
  59. package/node/components/panel/GridColumnsPanel.js +1 -2
  60. package/node/components/virtualization/GridMainContainer.js +1 -1
  61. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
  62. package/node/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
  63. package/node/hooks/features/columnResize/useGridColumnResize.js +9 -4
  64. package/node/hooks/features/columns/gridColumnsUtils.js +2 -1
  65. package/node/hooks/features/overlays/useGridOverlays.js +3 -1
  66. package/node/hooks/features/rows/useGridRowSpanning.js +13 -5
  67. package/node/hooks/features/sorting/gridSortingSelector.js +12 -1
  68. package/node/hooks/features/sorting/index.js +24 -16
  69. package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  70. package/node/index.js +1 -1
  71. package/node/internals/index.js +8 -0
  72. package/node/internals/utils/useProps.js +3 -0
  73. package/node/locales/koKR.js +36 -39
  74. package/node/locales/roRO.js +9 -10
  75. package/node/locales/trTR.js +3 -4
  76. package/package.json +1 -1
package/locales/koKR.js CHANGED
@@ -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: '정렬 해제',
package/locales/roRO.js CHANGED
@@ -30,12 +30,11 @@ const roROGrid = {
30
30
  toolbarExportPrint: 'Printare',
31
31
  toolbarExportExcel: 'Download în format 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: 'Caută',
34
+ columnsManagementNoColumns: 'Nicio coloană',
35
+ columnsManagementShowHideAllText: 'Arată/Ascunde tot',
36
+ columnsManagementReset: 'Resetează',
37
+ columnsManagementDeleteIconLabel: 'Șterge',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: 'Adăugare filtru',
41
40
  filterPanelRemoveAll: 'Șterge tot',
@@ -49,9 +48,9 @@ const roROGrid = {
49
48
  filterPanelInputPlaceholder: 'Filtrare valoare',
50
49
  // Filter operators text
51
50
  filterOperatorContains: 'conține',
52
- // filterOperatorDoesNotContain: 'does not contain',
51
+ filterOperatorDoesNotContain: 'nu conține',
53
52
  filterOperatorEquals: 'este egal cu',
54
- // filterOperatorDoesNotEqual: 'does not equal',
53
+ filterOperatorDoesNotEqual: 'nu este egal cu',
55
54
  filterOperatorStartsWith: 'începe cu',
56
55
  filterOperatorEndsWith: 'se termină cu',
57
56
  filterOperatorIs: 'este',
@@ -71,9 +70,9 @@ const roROGrid = {
71
70
  'filterOperator<=': '<=',
72
71
  // Header filter operators text
73
72
  headerFilterOperatorContains: 'Conține',
74
- // headerFilterOperatorDoesNotContain: 'Does not contain',
73
+ headerFilterOperatorDoesNotContain: 'Nu conține',
75
74
  headerFilterOperatorEquals: 'Egal cu',
76
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
75
+ headerFilterOperatorDoesNotEqual: 'Nu este egal cu',
77
76
  headerFilterOperatorStartsWith: 'Începe cu',
78
77
  headerFilterOperatorEndsWith: 'Se termină cu',
79
78
  headerFilterOperatorIs: 'Este',
package/locales/trTR.js CHANGED
@@ -34,8 +34,7 @@ const trTRGrid = {
34
34
  columnsManagementNoColumns: 'Kolon yok',
35
35
  columnsManagementShowHideAllText: 'Hepsini Göster/Gizle',
36
36
  columnsManagementReset: 'Sıfırla',
37
- // columnsManagementDeleteIconLabel: 'Clear',
38
-
37
+ columnsManagementDeleteIconLabel: 'Temizle',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: 'Filtre Ekle',
41
40
  filterPanelRemoveAll: 'Hepsini kaldır',
@@ -49,9 +48,9 @@ const trTRGrid = {
49
48
  filterPanelInputPlaceholder: 'Filtre değeri',
50
49
  // Filter operators text
51
50
  filterOperatorContains: 'içerir',
52
- // filterOperatorDoesNotContain: 'does not contain',
51
+ filterOperatorDoesNotContain: 'içermiyor',
53
52
  filterOperatorEquals: 'eşittir',
54
- // filterOperatorDoesNotEqual: 'does not equal',
53
+ filterOperatorDoesNotEqual: 'eşit değil',
55
54
  filterOperatorStartsWith: 'ile başlar',
56
55
  filterOperatorEndsWith: 'ile biter',
57
56
  filterOperatorIs: 'eşittir',
@@ -32,6 +32,8 @@ import type { GridLoadingOverlayProps } from '../components/GridLoadingOverlay';
32
32
  import type { GridRowCountProps } from '../components/GridRowCount';
33
33
  import type { GridColumnHeaderSortIconProps } from '../components/columnHeaders/GridColumnHeaderSortIcon';
34
34
  type DividerProps = {};
35
+ type RootProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
36
+ type MainProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
35
37
  export interface BaseBadgePropsOverrides {
36
38
  }
37
39
  export interface BaseCheckboxPropsOverrides {
@@ -140,6 +142,14 @@ export interface GridSlotProps {
140
142
  row: GridRowProps & RowPropsOverrides;
141
143
  skeletonCell: GridSkeletonCellProps & SkeletonCellPropsOverrides;
142
144
  toolbar: GridToolbarProps & ToolbarPropsOverrides;
145
+ /**
146
+ * Props passed to the `.main` (role="grid") element
147
+ */
148
+ main: MainProps;
149
+ /**
150
+ * Props passed to the `.root` element
151
+ */
152
+ root: RootProps;
143
153
  }
144
154
  /**
145
155
  * Overridable components props dynamically passed to the component at rendering.
@@ -229,6 +229,7 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
229
229
  * If `deselect`, it will deselect all the rows under it.
230
230
  * Works only if `checkboxSelection` is enabled.
231
231
  * @default "deselect"
232
+ * @deprecated `select` will be the default behavior from v8 onwards
232
233
  */
233
234
  indeterminateCheckboxAction: 'select' | 'deselect';
234
235
  /**
@@ -38,7 +38,7 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
38
38
  style: props.style,
39
39
  sx: props.sx,
40
40
  ref: ref
41
- }, props.forwardedProps, {
41
+ }, props.forwardedProps, props.slotProps?.root, {
42
42
  children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {}), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
43
43
  }))
44
44
  });
@@ -95,6 +95,7 @@ DataGridRaw.propTypes = {
95
95
  */
96
96
  autosizeOptions: PropTypes.shape({
97
97
  columns: PropTypes.arrayOf(PropTypes.string),
98
+ disableColumnVirtualization: PropTypes.bool,
98
99
  expand: PropTypes.bool,
99
100
  includeHeaders: PropTypes.bool,
100
101
  includeOutliers: PropTypes.bool,
@@ -331,6 +332,7 @@ DataGridRaw.propTypes = {
331
332
  * If `deselect`, it will deselect all the rows under it.
332
333
  * Works only if `checkboxSelection` is enabled.
333
334
  * @default "deselect"
335
+ * @deprecated `select` will be the default behavior from v8 onwards
334
336
  */
335
337
  indeterminateCheckboxAction: PropTypes.oneOf(['deselect', 'select']),
336
338
  /**
@@ -25,6 +25,7 @@ import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFille
25
25
  import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
26
26
  import { useGridConfiguration } from "../hooks/utils/useGridConfiguration.js";
27
27
  import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
28
+ import { gridVirtualizationColumnEnabledSelector } from "../hooks/index.js";
28
29
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
30
  function EmptyCell({
30
31
  width
@@ -89,6 +90,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
89
90
  const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
90
91
  const editing = apiRef.current.getRowMode(rowId) === GridRowModes.Edit;
91
92
  const editable = rootProps.editMode === GridEditModes.Row;
93
+ const hasColumnVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
92
94
  const hasFocusCell = focusedColumnIndex !== undefined;
93
95
  const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
94
96
  const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
@@ -270,7 +272,16 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
270
272
  if (hasVirtualFocusCellLeft) {
271
273
  cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, PinnedPosition.VIRTUAL));
272
274
  }
273
- for (let i = renderContext.firstColumnIndex; i < renderContext.lastColumnIndex; i += 1) {
275
+ let firstColumnIndex;
276
+ let lastColumnIndex;
277
+ if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
278
+ firstColumnIndex = 0;
279
+ lastColumnIndex = visibleColumns.length;
280
+ } else {
281
+ firstColumnIndex = renderContext.firstColumnIndex;
282
+ lastColumnIndex = renderContext.lastColumnIndex;
283
+ }
284
+ for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
274
285
  const column = visibleColumns[i];
275
286
  const indexInSection = i - pinnedColumns.left.length;
276
287
  if (!column) {
@@ -90,6 +90,13 @@ function GridActionsCell(props) {
90
90
  const hideMenu = () => {
91
91
  setOpen(false);
92
92
  };
93
+ const toggleMenu = () => {
94
+ if (open) {
95
+ hideMenu();
96
+ } else {
97
+ showMenu();
98
+ }
99
+ };
93
100
  const handleTouchRippleRef = index => instance => {
94
101
  touchRippleRefs.current[index] = instance;
95
102
  };
@@ -160,7 +167,7 @@ function GridActionsCell(props) {
160
167
  "aria-controls": open ? menuId : undefined,
161
168
  role: "menuitem",
162
169
  size: "small",
163
- onClick: showMenu,
170
+ onClick: toggleMenu,
164
171
  touchRippleRef: handleTouchRippleRef(buttonId),
165
172
  tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
166
173
  }, rootProps.slotProps?.baseIconButton, {
@@ -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,
@@ -2,13 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { GridPanelWrapper } from "./GridPanelWrapper.js";
5
- import { GridColumnsManagement } from "../columnsManagement/index.js";
6
5
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
7
  function GridColumnsPanel(props) {
9
8
  const rootProps = useGridRootProps();
10
9
  return /*#__PURE__*/_jsx(GridPanelWrapper, _extends({}, props, {
11
- children: /*#__PURE__*/_jsx(GridColumnsManagement, _extends({}, rootProps.slotProps?.columnsManagement))
10
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnsManagement, _extends({}, rootProps.slotProps?.columnsManagement))
12
11
  }));
13
12
  }
14
13
  process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
@@ -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
  }
@@ -3,6 +3,7 @@ import { useGridApiContext } from "../../utils/useGridApiContext.js";
3
3
  import { useGridRootProps } from "../../utils/useGridRootProps.js";
4
4
  import { gridExpandedRowCountSelector } from "../filter/index.js";
5
5
  import { gridRowCountSelector, gridRowsLoadingSelector } from "../rows/index.js";
6
+ import { gridPinnedRowsCountSelector } from "../rows/gridRowsSelector.js";
6
7
  /**
7
8
  * Uses the grid state to determine which overlay to display.
8
9
  * Returns the active overlay type and the active loading overlay variant.
@@ -12,7 +13,8 @@ export const useGridOverlays = () => {
12
13
  const rootProps = useGridRootProps();
13
14
  const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
14
15
  const visibleRowCount = useGridSelector(apiRef, gridExpandedRowCountSelector);
15
- const noRows = totalRowCount === 0;
16
+ const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
17
+ const noRows = totalRowCount === 0 && pinnedRowsCount === 0;
16
18
  const loading = useGridSelector(apiRef, gridRowsLoadingSelector);
17
19
  const showNoRowsOverlay = !loading && noRows;
18
20
  const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
@@ -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
  };
@@ -55,4 +55,15 @@ export const gridSortColumnLookupSelector = createSelectorMemoized(gridSortModel
55
55
  return res;
56
56
  }, {});
57
57
  return result;
58
+ });
59
+
60
+ /**
61
+ * @category Sorting
62
+ * @ignore - do not document.
63
+ */
64
+ export const gridSortedRowIndexLookupSelector = createSelectorMemoized(gridSortedRowIdsSelector, sortedIds => {
65
+ return sortedIds.reduce((acc, id, index) => {
66
+ acc[id] = index;
67
+ return acc;
68
+ }, Object.create(null));
58
69
  });
@@ -1,2 +1,2 @@
1
- export * from "./gridSortingSelector.js";
1
+ export { gridSortedRowIdsSelector, gridSortedRowEntriesSelector, gridSortModelSelector, gridSortColumnLookupSelector } from "./gridSortingSelector.js";
2
2
  export { gridDateComparator, gridNumberComparator, gridStringOrNumberComparator } from "./gridSortingUtils.js";
@@ -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.1
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
@@ -46,6 +46,7 @@ export { calculatePinnedRowsHeight } from "../hooks/features/rows/gridRowsUtils.
46
46
  export { useGridRowSelection, rowSelectionStateInitializer } from "../hooks/features/rowSelection/useGridRowSelection.js";
47
47
  export { useGridRowSelectionPreProcessors } from "../hooks/features/rowSelection/useGridRowSelectionPreProcessors.js";
48
48
  export { useGridSorting, sortingStateInitializer } from "../hooks/features/sorting/useGridSorting.js";
49
+ export { gridSortedRowIndexLookupSelector } from "../hooks/features/sorting/gridSortingSelector.js";
49
50
  export { useGridScroll } from "../hooks/features/scroll/useGridScroll.js";
50
51
  export { useGridEvents } from "../hooks/features/events/useGridEvents.js";
51
52
  export { dimensionsStateInitializer, useGridDimensions } from "../hooks/features/dimensions/useGridDimensions.js";
@@ -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;