@mui/x-data-grid 7.21.0 → 7.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/components/cell/GridBooleanCell.d.ts +3 -3
  3. package/components/cell/GridBooleanCell.js +11 -1
  4. package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -2
  5. package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
  6. package/components/containers/GridRootStyles.js +4 -2
  7. package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  8. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +2 -2
  9. package/components/panel/filterPanel/GridFilterInputValue.js +2 -2
  10. package/components/toolbar/GridToolbar.js +2 -3
  11. package/components/toolbar/GridToolbarExport.js +1 -13
  12. package/components/toolbar/GridToolbarFilterButton.js +1 -2
  13. package/components/virtualization/GridBottomContainer.js +0 -17
  14. package/components/virtualization/GridMainContainer.js +2 -1
  15. package/components/virtualization/GridVirtualScroller.js +2 -0
  16. package/constants/gridClasses.d.ts +5 -0
  17. package/constants/gridClasses.js +1 -1
  18. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -0
  19. package/hooks/features/columnMenu/useGridColumnMenuSlots.js +4 -3
  20. package/hooks/features/focus/useGridFocus.js +18 -3
  21. package/hooks/features/pagination/gridPaginationSelector.js +2 -1
  22. package/hooks/features/virtualization/useGridVirtualScroller.js +2 -1
  23. package/index.js +1 -1
  24. package/joy/joySlots.js +45 -27
  25. package/locales/daDK.js +5 -6
  26. package/locales/itIT.js +27 -28
  27. package/locales/ptBR.js +4 -4
  28. package/material/index.js +4 -0
  29. package/models/gridExport.d.ts +1 -1
  30. package/models/gridSlotsComponent.d.ts +10 -0
  31. package/models/gridSlotsComponentsProps.d.ts +9 -0
  32. package/modern/components/cell/GridBooleanCell.js +11 -1
  33. package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -2
  34. package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
  35. package/modern/components/containers/GridRootStyles.js +4 -2
  36. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  37. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +2 -2
  38. package/modern/components/panel/filterPanel/GridFilterInputValue.js +2 -2
  39. package/modern/components/toolbar/GridToolbar.js +2 -3
  40. package/modern/components/toolbar/GridToolbarExport.js +1 -13
  41. package/modern/components/toolbar/GridToolbarFilterButton.js +1 -2
  42. package/modern/components/virtualization/GridBottomContainer.js +0 -17
  43. package/modern/components/virtualization/GridMainContainer.js +2 -1
  44. package/modern/components/virtualization/GridVirtualScroller.js +2 -0
  45. package/modern/constants/gridClasses.js +1 -1
  46. package/modern/hooks/features/columnMenu/useGridColumnMenuSlots.js +4 -3
  47. package/modern/hooks/features/focus/useGridFocus.js +18 -3
  48. package/modern/hooks/features/pagination/gridPaginationSelector.js +2 -1
  49. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +2 -1
  50. package/modern/index.js +1 -1
  51. package/modern/joy/joySlots.js +45 -27
  52. package/modern/locales/daDK.js +5 -6
  53. package/modern/locales/itIT.js +27 -28
  54. package/modern/locales/ptBR.js +4 -4
  55. package/modern/material/index.js +4 -0
  56. package/node/components/cell/GridBooleanCell.js +11 -1
  57. package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -2
  58. package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
  59. package/node/components/containers/GridRootStyles.js +4 -2
  60. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  61. package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +2 -2
  62. package/node/components/panel/filterPanel/GridFilterInputValue.js +2 -2
  63. package/node/components/toolbar/GridToolbar.js +2 -3
  64. package/node/components/toolbar/GridToolbarExport.js +1 -13
  65. package/node/components/toolbar/GridToolbarFilterButton.js +1 -2
  66. package/node/components/virtualization/GridBottomContainer.js +0 -17
  67. package/node/components/virtualization/GridMainContainer.js +2 -1
  68. package/node/components/virtualization/GridVirtualScroller.js +2 -0
  69. package/node/constants/gridClasses.js +1 -1
  70. package/node/hooks/features/columnMenu/useGridColumnMenuSlots.js +4 -3
  71. package/node/hooks/features/focus/useGridFocus.js +18 -3
  72. package/node/hooks/features/pagination/gridPaginationSelector.js +3 -1
  73. package/node/hooks/features/virtualization/useGridVirtualScroller.js +2 -1
  74. package/node/index.js +1 -1
  75. package/node/joy/joySlots.js +45 -27
  76. package/node/locales/daDK.js +5 -6
  77. package/node/locales/itIT.js +27 -28
  78. package/node/locales/ptBR.js +4 -4
  79. package/node/material/index.js +4 -0
  80. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,86 @@
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.22.0
7
+
8
+ _Oct 25, 2024_
9
+
10
+ We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🛰 Introduce [server-side support for Data Grid row grouping](https://mui.com/x/react-data-grid/server-side-data/row-grouping/)
13
+ - 🐞 Bugfixes
14
+ - 📚 Documentation improvements
15
+ - 🌍 Improve Portuguese (pt-BR) locale on the Data Grid component
16
+
17
+ Special thanks go out to the community contributors who have helped make this release possible:
18
+ @clins1994, @GITPHLAP, @k-rajat19, @kalyan90, @merotosc, @yash49.
19
+ Following are all team members who have contributed to this release:
20
+ @cherniavskii, @flaviendelangle, @LukasTy, @MBilalShafi, @romgrk.
21
+
22
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
23
+
24
+ ### Data Grid
25
+
26
+ #### `@mui/x-data-grid@7.22.0`
27
+
28
+ - [DataGrid] Fix `GridPanelAnchor` positioning (#15022) @k-rajat19
29
+ - [DataGrid] Fix ugly prop-types for the `pageStyle` prop of the `GridPrintExportMenuItem` component (#15015) @flaviendelangle
30
+ - [DataGrid] Fix value type in filter model for number and boolean column type (#14733) @k-rajat19
31
+ - [DataGrid] Focus next row when the focused row is deleted (#15067) @cherniavskii
32
+ - [DataGrid] Remove some usages of `<Box />` and `<Badge />` (#15013) @romgrk
33
+ - [DataGrid] Fix number of rows to display for page size options with negative value (#14890) @kalyan90
34
+ - [l10n] Improve Portuguese (pt-BR) locale (#15021) @k-rajat19
35
+
36
+ #### `@mui/x-data-grid-pro@7.22.0` [![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.22.0`, plus:
39
+
40
+ - [DataGridPro] Fix column pinning layout (#15073) @cherniavskii
41
+
42
+ #### `@mui/x-data-grid-premium@7.22.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
43
+
44
+ Same changes as in `@mui/x-data-grid-pro@7.22.0`, plus:
45
+
46
+ - [DataGridPremium] Server-side data source with row grouping (#15109) @MBilalShafi
47
+
48
+ ### Date and Time Pickers
49
+
50
+ #### `@mui/x-date-pickers@7.22.0`
51
+
52
+ - [pickers] Fix `DateCalendar` timezone management (#15119) @LukasTy
53
+ - [pickers] Fix `DigitalClock` time options on a `DST` switch day (#15092) @LukasTy
54
+
55
+ #### `@mui/x-date-pickers-pro@7.22.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
56
+
57
+ Same changes as in `@mui/x-date-pickers@7.22.0`.
58
+
59
+ ### Charts
60
+
61
+ #### `@mui/x-charts@7.22.0`
62
+
63
+ - [charts] Export data type in `onAxisClick(_, data)` callback (#15038) @clins1994
64
+
65
+ #### `@mui/x-charts-pro@7.0.0-beta.6` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
66
+
67
+ Same changes as in `@mui/x-charts@7.22.0`.
68
+
69
+ ### Tree View
70
+
71
+ #### `@mui/x-tree-view@7.22.0`
72
+
73
+ - [TreeView] Make the cancellable event types public (#14992) @flaviendelangle
74
+
75
+ ### Docs
76
+
77
+ - [docs] Fix typo in Tree View docs (#15047) @yash49
78
+
79
+ ### Core
80
+
81
+ - [core] Adjust cherry-pick GH actions (#15101) @LukasTy
82
+ - [core] Update prettier target branch (#15100) @MBilalShafi
83
+ - [core] Update some `default-branch-switch` instances for `v7.x` (#15085) @MBilalShafi
84
+ - [test] Revert to using `fireEvent` instead of `userEvent` (#14927) @LukasTy
85
+
6
86
  ## 7.21.0
7
87
 
8
88
  _Oct 17, 2024_
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { SvgIconProps } from '@mui/material/SvgIcon';
3
- import { GridRenderCellParams } from '../../models/params/gridCellParams';
4
- import { GridColDef } from '../../models/colDef/gridColDef';
3
+ import type { GridColDef } from '../../models/colDef/gridColDef';
4
+ import type { GridRenderCellParams } from '../../models/params/gridCellParams';
5
5
  interface GridBooleanCellProps extends GridRenderCellParams, Omit<SvgIconProps, 'tabIndex' | 'id'> {
6
6
  hideDescendantCount?: boolean;
7
7
  }
8
- declare function GridBooleanCellRaw(props: GridBooleanCellProps): React.JSX.Element;
8
+ declare function GridBooleanCellRaw(props: GridBooleanCellProps): React.JSX.Element | null;
9
9
  declare namespace GridBooleanCellRaw {
10
10
  var propTypes: any;
11
11
  }
@@ -4,6 +4,8 @@ const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowN
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
+ import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
8
+ import { gridRowMaximumTreeDepthSelector } from "../../hooks/features/rows/gridRowsSelector.js";
7
9
  import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
8
10
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
9
11
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
@@ -20,7 +22,8 @@ const useUtilityClasses = ownerState => {
20
22
  };
21
23
  function GridBooleanCellRaw(props) {
22
24
  const {
23
- value
25
+ value,
26
+ rowNode
24
27
  } = props,
25
28
  other = _objectWithoutPropertiesLoose(props, _excluded);
26
29
  const apiRef = useGridApiContext();
@@ -29,7 +32,14 @@ function GridBooleanCellRaw(props) {
29
32
  classes: rootProps.classes
30
33
  };
31
34
  const classes = useUtilityClasses(ownerState);
35
+ const maxDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
36
+ const isServerSideRowGroupingRow =
37
+ // @ts-expect-error - Access tree data prop
38
+ maxDepth > 0 && rowNode.type === 'group' && rootProps.treeData === false;
32
39
  const Icon = React.useMemo(() => value ? rootProps.slots.booleanCellTrueIcon : rootProps.slots.booleanCellFalseIcon, [rootProps.slots.booleanCellFalseIcon, rootProps.slots.booleanCellTrueIcon, value]);
40
+ if (isServerSideRowGroupingRow && value === undefined) {
41
+ return null;
42
+ }
33
43
  return /*#__PURE__*/_jsx(Icon, _extends({
34
44
  fontSize: "small",
35
45
  className: classes.root,
@@ -2,7 +2,6 @@ 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 { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
5
- import Badge from '@mui/material/Badge';
6
5
  import { useGridSelector } from "../../hooks/index.js";
7
6
  import { gridPreferencePanelStateSelector } from "../../hooks/features/preferencesPanel/gridPreferencePanelSelector.js";
8
7
  import { GridPreferencePanelsValue } from "../../hooks/features/preferencesPanel/gridPreferencePanelsValue.js";
@@ -76,7 +75,7 @@ function GridColumnHeaderFilterIconButton(props) {
76
75
  enterDelay: 1000
77
76
  }, rootProps.slotProps?.baseTooltip, {
78
77
  children: /*#__PURE__*/_jsxs(GridIconButtonContainer, {
79
- children: [counter > 1 && /*#__PURE__*/_jsx(Badge, {
78
+ children: [counter > 1 && /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
80
79
  badgeContent: counter,
81
80
  color: "default",
82
81
  children: iconButton
@@ -4,7 +4,6 @@ const _excluded = ["direction", "index", "sortingOrder", "disabled"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
- import Badge from '@mui/material/Badge';
8
7
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
9
8
  import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
10
9
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
@@ -63,7 +62,7 @@ function GridColumnHeaderSortIconRaw(props) {
63
62
  children: iconElement
64
63
  }));
65
64
  return /*#__PURE__*/_jsxs(GridIconButtonContainer, {
66
- children: [index != null && /*#__PURE__*/_jsx(Badge, {
65
+ children: [index != null && /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
67
66
  badgeContent: index,
68
67
  color: "default",
69
68
  overlap: "circular",
@@ -152,6 +152,8 @@ export const GridRootStyles = styled('div', {
152
152
  [`& .${c.treeDataGroupingCellToggle}`]: styles.treeDataGroupingCellToggle
153
153
  }, {
154
154
  [`& .${c.treeDataGroupingCellLoadingContainer}`]: styles.treeDataGroupingCellLoadingContainer
155
+ }, {
156
+ [`& .${c.groupingCriteriaCellLoadingContainer}`]: styles.groupingCriteriaCellLoadingContainer
155
157
  }, {
156
158
  [`& .${c.detailPanelToggleCell}`]: styles.detailPanelToggleCell
157
159
  }, {
@@ -685,7 +687,7 @@ export const GridRootStyles = styled('div', {
685
687
  alignSelf: 'stretch',
686
688
  marginRight: t.spacing(2)
687
689
  },
688
- [`& .${c.treeDataGroupingCellLoadingContainer}`]: {
690
+ [`& .${c.treeDataGroupingCellLoadingContainer}, .${c.groupingCriteriaCellLoadingContainer}`]: {
689
691
  display: 'flex',
690
692
  alignItems: 'center',
691
693
  justifyContent: 'center',
@@ -718,7 +720,7 @@ export const GridRootStyles = styled('div', {
718
720
  }
719
721
  },
720
722
  [`& .${c.filler}`]: {
721
- flex: 1
723
+ flex: '1 0 auto'
722
724
  },
723
725
  [`& .${c['filler--borderBottom']}`]: {
724
726
  borderBottom: '1px solid var(--DataGrid-rowBorderColor)'
@@ -38,7 +38,7 @@ function GridFilterInputBoolean(props) {
38
38
  const value = event.target.value;
39
39
  setFilterValueState(value);
40
40
  applyValue(_extends({}, item, {
41
- value
41
+ value: Boolean(value)
42
42
  }));
43
43
  }, [applyValue, item]);
44
44
  React.useEffect(() => {
@@ -39,9 +39,9 @@ function GridFilterInputMultipleValue(props) {
39
39
  const handleChange = React.useCallback((event, value) => {
40
40
  setFilterValueState(value.map(String));
41
41
  applyValue(_extends({}, item, {
42
- value: [...value]
42
+ value: [...value.map(filterItemValue => type === 'number' ? Number(filterItemValue) : filterItemValue)]
43
43
  }));
44
- }, [applyValue, item]);
44
+ }, [applyValue, item, type]);
45
45
  return /*#__PURE__*/_jsx(Autocomplete, _extends({
46
46
  multiple: true,
47
47
  freeSolo: true,
@@ -34,13 +34,13 @@ function GridFilterInputValue(props) {
34
34
  setIsApplying(true);
35
35
  filterTimeout.start(rootProps.filterDebounceMs, () => {
36
36
  const newItem = _extends({}, item, {
37
- value,
37
+ value: type === 'number' ? Number(value) : value,
38
38
  fromInput: id
39
39
  });
40
40
  applyValue(newItem);
41
41
  setIsApplying(false);
42
42
  });
43
- }, [id, applyValue, item, rootProps.filterDebounceMs, filterTimeout]);
43
+ }, [filterTimeout, rootProps.filterDebounceMs, item, type, id, applyValue]);
44
44
  React.useEffect(() => {
45
45
  const itemPlusTag = item;
46
46
  if (itemPlusTag.fromInput !== id || item.value === undefined) {
@@ -3,7 +3,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["className", "csvOptions", "printOptions", "excelOptions", "showQuickFilter", "quickFilterProps"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import Box from '@mui/material/Box';
7
6
  import { GridToolbarContainer } from "../containers/GridToolbarContainer.js";
8
7
  import { GridToolbarColumnsButton } from "./GridToolbarColumnsButton.js";
9
8
  import { GridToolbarDensitySelector } from "./GridToolbarDensitySelector.js";
@@ -36,8 +35,8 @@ const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, re
36
35
  // TODO: remove the reference to excelOptions in community package
37
36
  ,
38
37
  excelOptions: excelOptions
39
- }), /*#__PURE__*/_jsx(Box, {
40
- sx: {
38
+ }), /*#__PURE__*/_jsx("div", {
39
+ style: {
41
40
  flex: 1
42
41
  }
43
42
  }), showQuickFilter && /*#__PURE__*/_jsx(GridToolbarQuickFilter, _extends({}, quickFilterProps))]
@@ -78,19 +78,7 @@ process.env.NODE_ENV !== "production" ? GridPrintExportMenuItem.propTypes = {
78
78
  hideFooter: PropTypes.bool,
79
79
  hideToolbar: PropTypes.bool,
80
80
  includeCheckboxes: PropTypes.bool,
81
- pageStyle: PropTypes.oneOfType([PropTypes.shape({
82
- '__@hasInstance@646': PropTypes.func.isRequired,
83
- '__@metadata@648': PropTypes.any,
84
- apply: PropTypes.func.isRequired,
85
- arguments: PropTypes.any.isRequired,
86
- bind: PropTypes.func.isRequired,
87
- call: PropTypes.func.isRequired,
88
- caller: PropTypes.object.isRequired,
89
- length: PropTypes.number.isRequired,
90
- name: PropTypes.string.isRequired,
91
- prototype: PropTypes.any.isRequired,
92
- toString: PropTypes.func.isRequired
93
- }), PropTypes.string])
81
+ pageStyle: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
94
82
  })
95
83
  } : void 0;
96
84
  const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExport(props, ref) {
@@ -3,7 +3,6 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize, unstable_useId as useId } from '@mui/utils';
6
- import Badge from '@mui/material/Badge';
7
6
  import { gridColumnLookupSelector } from "../../hooks/features/columns/gridColumnsSelector.js";
8
7
  import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
9
8
  import { gridFilterActiveItemsSelector } from "../../hooks/features/filter/gridFilterSelector.js";
@@ -104,7 +103,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
104
103
  "aria-controls": isOpen ? filterPanelId : undefined,
105
104
  "aria-expanded": isOpen,
106
105
  "aria-haspopup": true,
107
- startIcon: /*#__PURE__*/_jsx(Badge, {
106
+ startIcon: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
108
107
  badgeContent: activeFilters.length,
109
108
  color: "primary",
110
109
  children: /*#__PURE__*/_jsx(rootProps.slots.openFilterButtonIcon, {})
@@ -4,9 +4,6 @@ import clsx from 'clsx';
4
4
  import { styled } from '@mui/system';
5
5
  import composeClasses from '@mui/utils/composeClasses';
6
6
  import { gridClasses, getDataGridUtilityClass } from "../../constants/gridClasses.js";
7
- import { gridDimensionsSelector } from "../../hooks/features/dimensions/gridDimensionsSelectors.js";
8
- import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
9
- import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
10
7
  import { jsx as _jsx } from "react/jsx-runtime";
11
8
  const useUtilityClasses = () => {
12
9
  const slots = {
@@ -21,22 +18,8 @@ const Element = styled('div')({
21
18
  });
22
19
  export function GridBottomContainer(props) {
23
20
  const classes = useUtilityClasses();
24
- const apiRef = useGridApiContext();
25
- const {
26
- viewportOuterSize,
27
- minimumSize,
28
- hasScrollX,
29
- scrollbarSize
30
- } = useGridSelector(apiRef, gridDimensionsSelector);
31
- const scrollHeight = hasScrollX ? scrollbarSize : 0;
32
- const offset = Math.max(viewportOuterSize.height - minimumSize.height -
33
- // Subtract scroll height twice to account for GridVirtualScrollerFiller and horizontal scrollbar
34
- 2 * scrollHeight, 0);
35
21
  return /*#__PURE__*/_jsx(Element, _extends({}, props, {
36
22
  className: clsx(classes.root, gridClasses['container--bottom']),
37
- style: {
38
- transform: `translateY(${offset}px)`
39
- },
40
23
  role: "presentation"
41
24
  }));
42
25
  }
@@ -7,7 +7,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  const GridPanelAnchor = styled('div')({
8
8
  position: 'absolute',
9
9
  top: `var(--DataGrid-headersTotalHeight)`,
10
- left: 0
10
+ left: 0,
11
+ width: 'calc(100% - (var(--DataGrid-hasScrollY) * var(--DataGrid-scrollbarSize)))'
11
12
  });
12
13
  const Element = styled('div', {
13
14
  name: 'MuiDataGrid',
@@ -40,6 +40,8 @@ const Scroller = styled('div', {
40
40
  flexGrow: 1,
41
41
  overflow: 'scroll',
42
42
  scrollbarWidth: 'none' /* Firefox */,
43
+ display: 'flex',
44
+ flexDirection: 'column',
43
45
  '&::-webkit-scrollbar': {
44
46
  display: 'none' /* Safari and Chrome */
45
47
  },
@@ -625,6 +625,11 @@ export interface GridClasses {
625
625
  * Styles applied to the toggle of the grouping criteria cell
626
626
  */
627
627
  groupingCriteriaCellToggle: string;
628
+ /**
629
+ * Styles applied to the loading container of the grouping cell of the tree data.
630
+ * @ignore - do not document.
631
+ */
632
+ groupingCriteriaCellLoadingContainer: string;
628
633
  /**
629
634
  * Styles applied to the pinned rows container.
630
635
  */
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
2
2
  export function getDataGridUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiDataGrid', slot);
4
4
  }
5
- export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
5
+ export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
@@ -6,6 +6,7 @@ import { GridHydrateColumnsValue, GridPinnedColumnPosition } from '../../feature
6
6
  import { GridRowEntry, GridRowId } from '../../../models/gridRows';
7
7
  import { GridHydrateRowsValue } from '../../features/rows/gridRowsInterfaces';
8
8
  import { GridPreferencePanelsValue } from '../../features/preferencesPanel';
9
+ import { GridGetRowsParams } from '../../../models/gridDataSource';
9
10
  import { HeightEntry } from '../../features/rows/gridRowsMetaInterfaces';
10
11
  export type GridPipeProcessorGroup = keyof GridPipeProcessingLookup;
11
12
  export interface GridPipeProcessingLookup {
@@ -17,6 +18,9 @@ export interface GridPipeProcessingLookup {
17
18
  value: GridInitialStateCommunity;
18
19
  context: GridExportStateParams;
19
20
  };
21
+ getRowsParams: {
22
+ value: Partial<GridGetRowsParams>;
23
+ };
20
24
  hydrateColumns: {
21
25
  value: GridHydrateColumnsValue;
22
26
  };
@@ -2,10 +2,11 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["displayOrder"];
4
4
  import * as React from 'react';
5
- import Divider from '@mui/material/Divider';
5
+ import { useGridRootProps } from "../../utils/useGridRootProps.js";
6
6
  import { useGridPrivateApiContext } from "../../utils/useGridPrivateApiContext.js";
7
7
  const useGridColumnMenuSlots = props => {
8
8
  const apiRef = useGridPrivateApiContext();
9
+ const rootProps = useGridRootProps();
9
10
  const {
10
11
  defaultSlots,
11
12
  defaultSlotProps,
@@ -51,8 +52,8 @@ const useGridColumnMenuSlots = props => {
51
52
  const customProps = _objectWithoutPropertiesLoose(processedComponentProps, _excluded);
52
53
  itemProps = _extends({}, itemProps, customProps);
53
54
  }
54
- return addDividers && index !== sorted.length - 1 ? [...acc, [processedComponents[key], itemProps], [Divider, {}]] : [...acc, [processedComponents[key], itemProps]];
55
+ return addDividers && index !== sorted.length - 1 ? [...acc, [processedComponents[key], itemProps], [rootProps.slots.baseDivider, {}]] : [...acc, [processedComponents[key], itemProps]];
55
56
  }, []);
56
- }, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedSlotProps, userItems]);
57
+ }, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedSlotProps, userItems, rootProps.slots.baseDivider]);
57
58
  };
58
59
  export { useGridColumnMenuSlots };
@@ -323,18 +323,33 @@ export const useGridFocus = (apiRef, props) => {
323
323
  const handleRowSet = React.useCallback(() => {
324
324
  const cell = gridFocusCellSelector(apiRef);
325
325
 
326
- // If the focused cell is in a row which does not exist anymore, then remove the focus
326
+ // If the focused cell is in a row which does not exist anymore,
327
+ // focus previous row or remove the focus
327
328
  if (cell && !apiRef.current.getRow(cell.id)) {
329
+ const lastFocusedRowId = gridFocusCellSelector(apiRef)?.id;
330
+ let nextRowId = null;
331
+ if (typeof lastFocusedRowId !== 'undefined') {
332
+ const lastFocusedRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(lastFocusedRowId);
333
+ const currentPage = getVisibleRows(apiRef, {
334
+ pagination: props.pagination,
335
+ paginationMode: props.paginationMode
336
+ });
337
+ const nextRow = currentPage.rows[clamp(lastFocusedRowIndex, 0, currentPage.rows.length - 1)];
338
+ nextRowId = nextRow.id ?? null;
339
+ }
328
340
  apiRef.current.setState(state => _extends({}, state, {
329
341
  focus: {
330
- cell: null,
342
+ cell: nextRowId === null ? null : {
343
+ id: nextRowId,
344
+ field: cell.field
345
+ },
331
346
  columnHeader: null,
332
347
  columnHeaderFilter: null,
333
348
  columnGroupHeader: null
334
349
  }
335
350
  }));
336
351
  }
337
- }, [apiRef]);
352
+ }, [apiRef, props.pagination, props.paginationMode]);
338
353
  const handlePaginationModelChange = useEventcallback(() => {
339
354
  const currentFocusedCell = gridFocusCellSelector(apiRef);
340
355
  if (!currentFocusedCell) {
@@ -2,6 +2,7 @@ import { createSelector, createSelectorMemoized } from "../../../utils/createSel
2
2
  import { gridExpandedSortedRowEntriesSelector, gridExpandedSortedRowIdsSelector, gridFilteredSortedTopLevelRowEntriesSelector } from "../filter/gridFilterSelector.js";
3
3
  import { gridRowMaximumTreeDepthSelector, gridRowTreeSelector } from "../rows/gridRowsSelector.js";
4
4
  import { getPageCount } from "./gridPaginationUtils.js";
5
+ const ALL_RESULTS_PAGE_VALUE = -1;
5
6
 
6
7
  /**
7
8
  * @category Pagination
@@ -52,7 +53,7 @@ export const gridPageCountSelector = createSelector(gridPaginationModelSelector,
52
53
  export const gridPaginationRowRangeSelector = createSelectorMemoized(gridPaginationModelSelector, gridRowTreeSelector, gridRowMaximumTreeDepthSelector, gridExpandedSortedRowEntriesSelector, gridFilteredSortedTopLevelRowEntriesSelector, (paginationModel, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {
53
54
  const visibleTopLevelRowCount = visibleSortedTopLevelRowEntries.length;
54
55
  const topLevelFirstRowIndex = Math.min(paginationModel.pageSize * paginationModel.page, visibleTopLevelRowCount - 1);
55
- const topLevelLastRowIndex = Math.min(topLevelFirstRowIndex + paginationModel.pageSize - 1, visibleTopLevelRowCount - 1);
56
+ const topLevelLastRowIndex = paginationModel.pageSize === ALL_RESULTS_PAGE_VALUE ? visibleTopLevelRowCount - 1 : Math.min(topLevelFirstRowIndex + paginationModel.pageSize - 1, visibleTopLevelRowCount - 1);
56
57
 
57
58
  // The range contains no element
58
59
  if (topLevelFirstRowIndex === -1 || topLevelLastRowIndex === -1) {
@@ -378,7 +378,8 @@ export const useGridVirtualScroller = () => {
378
378
  const contentSize = React.useMemo(() => {
379
379
  const size = {
380
380
  width: needsHorizontalScrollbar ? columnsTotalWidth : 'auto',
381
- height: contentHeight
381
+ flexBasis: contentHeight,
382
+ flexShrink: 0
382
383
  };
383
384
  if (rootProps.autoHeight && currentPage.rows.length === 0) {
384
385
  size.height = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.21.0
2
+ * @mui/x-data-grid v7.22.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the