@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/CHANGELOG.md CHANGED
@@ -3,6 +3,135 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.23.3
7
+
8
+ _Dec 19, 2024_
9
+
10
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🌍 Improve Korean (ko-KR) locale on the Data Grid
13
+ - 🐞 Bugfixes
14
+
15
+ Special thanks go out to the community contributors who have helped make this release possible:
16
+ @k-rajat19, @good-jinu.
17
+ Following are all team members who have contributed to this release:
18
+ @KenanYusuf, @MBilalShafi, @arminmeh, @flaviendelangle.
19
+
20
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
21
+
22
+ ### Data Grid
23
+
24
+ #### `@mui/x-data-grid@7.23.3`
25
+
26
+ - [DataGrid] Allow passing custom props to `.main` element (#15919) @MBilalShafi
27
+ - [DataGrid] Consider `columnGroupHeaderHeight` prop in `getTotalHeaderHeight` method (#15927) @k-rajat19
28
+ - [DataGrid] Deprecate `indeterminateCheckboxAction` prop (#15862) @MBilalShafi
29
+ - [DataGrid] Fix `aria-label` value for group checkboxes (#15861) @MBilalShafi
30
+ - [DataGrid] Fix autosizing with virtualized columns (#15929) @k-rajat19
31
+ - [DataGrid] Round dimensions to avoid subpixel rendering error (#15873) @KenanYusuf
32
+ - [DataGrid] Toggle menu on click in `<GridActionsCell />` (#15871) @k-rajat19
33
+ - [DataGrid] Trigger row spanning computation on rows update (#15872) @MBilalShafi
34
+ - [l10n] Improve Korean (ko-KR) locale (#15906) @good-jinu
35
+
36
+ #### `@mui/x-data-grid-pro@7.23.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
37
+
38
+ Same changes as in `@mui/x-data-grid@7.23.3`.
39
+
40
+ #### `@mui/x-data-grid-premium@7.23.3` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
41
+
42
+ Same changes as in `@mui/x-data-grid-pro@7.23.3`.
43
+
44
+ ### Date and Time Pickers
45
+
46
+ #### `@mui/x-date-pickers@7.23.3`
47
+
48
+ - [pickers] Add verification to disable skipped hours in spring forward DST (#15918) @flaviendelangle
49
+
50
+ #### `@mui/x-date-pickers-pro@7.23.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
51
+
52
+ Same changes as in `@mui/x-date-pickers@7.23.3`.
53
+
54
+ ## 7.23.2
55
+
56
+ _Dec 12, 2024_
57
+
58
+ We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
59
+
60
+ - 🌍 Improve Romanian and Turkish locales on the Data Grid
61
+ - 🌍 Improve Romanian locale on the Pickers
62
+ - 📚 Documentation improvements
63
+ - 🐞 Bugfixes
64
+
65
+ Special thanks go out to the community contributors who have helped make this release possible:
66
+ @ihsanberkozcan, @k-rajat19, @lhilgert9, @nusr, @rares985.
67
+
68
+ Following are all team members who have contributed to this release:
69
+ @alexfauquette, @arminmeh, @flaviendelangle, @JCQuintas, @KenanYusuf, @LukasTy.
70
+
71
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
72
+
73
+ ### Data Grid
74
+
75
+ #### `@mui/x-data-grid@7.23.2`
76
+
77
+ - [DataGrid] Fix "No rows" displaying when all rows are pinned (#15851) @nusr
78
+ - [DataGrid] Use `columnsManagement` slot (#15821) @k-rajat19
79
+ - [l10n] Improve Romanian (ro-RO) locale (#15751) @rares985
80
+ - [l10n] Improve Turkish (tr-TR) locale (#15748) @ihsanberkozcan
81
+
82
+ #### `@mui/x-data-grid-pro@7.23.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
83
+
84
+ Same changes as in `@mui/x-data-grid@7.23.2`, plus:
85
+
86
+ - [DataGridPro] Make Row reordering work with pagination (#15782) @k-rajat19
87
+
88
+ #### `@mui/x-data-grid-premium@7.23.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
89
+
90
+ Same changes as in `@mui/x-data-grid-pro@7.23.2`, plus:
91
+
92
+ - [DataGridPremium] Fix group column ignoring `valueOptions` for `singleSelect` column type (#15754) @arminmeh
93
+
94
+ ### Date and Time Pickers
95
+
96
+ #### `@mui/x-date-pickers@7.23.2`
97
+
98
+ - [l10n] Improve Romanian (ro-RO) locale (#15751) @rares985
99
+
100
+ #### `@mui/x-date-pickers-pro@7.23.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
101
+
102
+ Same changes as in `@mui/x-date-pickers@7.23.2`.
103
+
104
+ ### Charts
105
+
106
+ #### `@mui/x-charts@7.23.2`
107
+
108
+ - [charts] Fix key generation for the ChartsGrid (#15864) @alexfauquette
109
+ - [charts] Fix scatter dataset with missing data (#15804) @alexfauquette
110
+
111
+ #### `@mui/x-charts-pro@7.23.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
112
+
113
+ Same changes as in `@mui/x-charts@7.23.2`.
114
+
115
+ #### `@mui/x-tree-view@v7.23.2`
116
+
117
+ No changes, releasing to keep the versions in sync.
118
+
119
+ #### `@mui/x-tree-view-pro@7.23.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
120
+
121
+ Releasing to benefit from license package fix (#15818).
122
+
123
+ ### Docs
124
+
125
+ - [docs] Fix typo in charts axis documentation (#15746) @JCQuintas
126
+ - [docs] Improve Pickers accessible DOM structure description (#15752) @LukasTy
127
+ - [docs] Use `updateRows` method for list view demos (#15824) @KenanYusuf
128
+ - [docs] Use date library version from package dev dependencies for sandboxes (#15767) @LukasTy
129
+
130
+ ### Core
131
+
132
+ - [core] Add `@mui/x-tree-view-pro` to `releaseChangelog` (#15747) @flaviendelangle
133
+ - [license] Use `console.log` for the error message on Codesandbox to avoid rendering error (#15818) @arminmeh
134
+
6
135
  ## 7.23.1
7
136
 
8
137
  _Dec 5, 2024_
@@ -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,
@@ -4,6 +4,7 @@ export declare const DEFAULT_GRID_AUTOSIZE_OPTIONS: {
4
4
  includeOutliers: boolean;
5
5
  outliersFactor: number;
6
6
  expand: boolean;
7
+ disableColumnVirtualization: boolean;
7
8
  };
8
9
  export type GridAutosizeOptions = {
9
10
  /**
@@ -30,6 +31,11 @@ export type GridAutosizeOptions = {
30
31
  * @default false
31
32
  */
32
33
  expand?: boolean;
34
+ /**
35
+ * If false, column virtualization is not disabled while resizing.
36
+ * @default true
37
+ */
38
+ disableColumnVirtualization?: boolean;
33
39
  };
34
40
  /**
35
41
  * The Resize API interface that is available in the grid `apiRef`.
@@ -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
  /**
@@ -7,4 +7,4 @@ export declare const columnResizeStateInitializer: GridStateInitializer;
7
7
  * @requires useGridColumns (method, event)
8
8
  * TODO: improve experience for last column
9
9
  */
10
- export declare const useGridColumnResize: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "autosizeOptions" | "autosizeOnMount" | "disableAutosize" | "onColumnResize" | "onColumnWidthChange">) => void;
10
+ export declare const useGridColumnResize: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "autosizeOptions" | "autosizeOnMount" | "disableAutosize" | "onColumnResize" | "onColumnWidthChange" | "disableVirtualization">) => void;
@@ -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
@@ -53,4 +53,4 @@ export declare function getFirstNonSpannedColumnToRender({ firstColumnToRender,
53
53
  lastRowToRender: number;
54
54
  visibleRows: GridRowEntry[];
55
55
  }): number;
56
- export declare function getTotalHeaderHeight(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'columnHeaderHeight' | 'headerFilterHeight' | 'unstable_listView'>): number;
56
+ export declare function getTotalHeaderHeight(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'columnHeaderHeight' | 'headerFilterHeight' | 'unstable_listView' | 'columnGroupHeaderHeight'>): number;
@@ -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
  };
@@ -1,11 +1,11 @@
1
1
  import { GridSortDirection, GridSortModel } from '../../../models/gridSortModel';
2
2
  import type { GridStateCommunity } from '../../../models/gridStateCommunity';
3
- import type { GridValidRowModel, GridRowEntry } from '../../../models/gridRows';
3
+ import type { GridValidRowModel, GridRowEntry, GridRowId } from '../../../models/gridRows';
4
4
  /**
5
5
  * Get the id of the rows after the sorting process.
6
6
  * @category Sorting
7
7
  */
8
- export declare const gridSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
8
+ export declare const gridSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, GridRowId[]>;
9
9
  /**
10
10
  * Get the id and the model of the rows after the sorting process.
11
11
  * @category Sorting
@@ -25,3 +25,8 @@ export type GridSortColumnLookup = Record<string, {
25
25
  * @ignore - do not document.
26
26
  */
27
27
  export declare const gridSortColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortColumnLookup>;
28
+ /**
29
+ * @category Sorting
30
+ * @ignore - do not document.
31
+ */
32
+ export declare const gridSortedRowIndexLookupSelector: import("../../..").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
@@ -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,3 +1,4 @@
1
- export * from './gridSortingSelector';
1
+ export { gridSortedRowIdsSelector, gridSortedRowEntriesSelector, gridSortModelSelector, gridSortColumnLookupSelector, } from './gridSortingSelector';
2
+ export type { GridSortColumnLookup } from './gridSortingSelector';
2
3
  export type { GridSortingState, GridSortingInitialState } from './gridSortingState';
3
4
  export { gridDateComparator, gridNumberComparator, gridStringOrNumberComparator, } from './gridSortingUtils';
@@ -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/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
@@ -57,6 +57,7 @@ export { useGridRowSelection, rowSelectionStateInitializer, } from '../hooks/fea
57
57
  export { useGridRowSelectionPreProcessors } from '../hooks/features/rowSelection/useGridRowSelectionPreProcessors';
58
58
  export { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
59
59
  export type { GridSortingModelApplier } from '../hooks/features/sorting/gridSortingState';
60
+ export { gridSortedRowIndexLookupSelector } from '../hooks/features/sorting/gridSortingSelector';
60
61
  export { useGridScroll } from '../hooks/features/scroll/useGridScroll';
61
62
  export { useGridEvents } from '../hooks/features/events/useGridEvents';
62
63
  export { dimensionsStateInitializer, useGridDimensions, } from '../hooks/features/dimensions/useGridDimensions';
@@ -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;