@mui/x-data-grid 6.19.2 β†’ 6.19.4

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 (41) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/components/GridPagination.d.ts +1 -1
  3. package/components/GridPagination.js +8 -1
  4. package/components/cell/GridActionsCell.js +3 -3
  5. package/components/cell/GridActionsCellItem.d.ts +13 -1
  6. package/components/cell/GridActionsCellItem.js +27 -15
  7. package/components/containers/GridRootStyles.js +6 -0
  8. package/hooks/features/export/useGridPrintExport.js +3 -1
  9. package/hooks/features/filter/gridFilterUtils.js +15 -22
  10. package/index.js +1 -1
  11. package/legacy/components/GridPagination.js +8 -1
  12. package/legacy/components/cell/GridActionsCell.js +3 -3
  13. package/legacy/components/cell/GridActionsCellItem.js +30 -17
  14. package/legacy/components/containers/GridRootStyles.js +5 -1
  15. package/legacy/hooks/features/export/useGridPrintExport.js +11 -7
  16. package/legacy/hooks/features/filter/gridFilterUtils.js +11 -14
  17. package/legacy/index.js +1 -1
  18. package/legacy/locales/daDK.js +12 -12
  19. package/legacy/locales/heIL.js +7 -8
  20. package/locales/daDK.js +12 -12
  21. package/locales/heIL.js +7 -8
  22. package/models/props/DataGridProps.d.ts +1 -1
  23. package/modern/components/GridPagination.js +8 -1
  24. package/modern/components/cell/GridActionsCell.js +3 -3
  25. package/modern/components/cell/GridActionsCellItem.js +27 -15
  26. package/modern/components/containers/GridRootStyles.js +6 -0
  27. package/modern/hooks/features/export/useGridPrintExport.js +3 -1
  28. package/modern/hooks/features/filter/gridFilterUtils.js +15 -22
  29. package/modern/index.js +1 -1
  30. package/modern/locales/daDK.js +12 -12
  31. package/modern/locales/heIL.js +7 -8
  32. package/node/components/GridPagination.js +8 -1
  33. package/node/components/cell/GridActionsCell.js +3 -3
  34. package/node/components/cell/GridActionsCellItem.js +27 -15
  35. package/node/components/containers/GridRootStyles.js +6 -0
  36. package/node/hooks/features/export/useGridPrintExport.js +3 -1
  37. package/node/hooks/features/filter/gridFilterUtils.js +15 -21
  38. package/node/index.js +1 -1
  39. package/node/locales/daDK.js +12 -12
  40. package/node/locales/heIL.js +7 -8
  41. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,111 @@
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
+ ## v6.19.4
7
+
8
+ _Feb 9, 2024_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🌍 Improve Danish (da-DK) locale on the Data Grid (#11972) @ShahrazH
13
+ - 🐞 Bugfixes
14
+ - πŸ“š Documentation improvements
15
+
16
+ ### Data Grid
17
+
18
+ #### `@mui/x-data-grid@v6.19.4`
19
+
20
+ - [DataGrid] Add support for dialogs in menu actions (#11937) @cherniavskii
21
+ - [DataGrid] Allow passing readonly arrays to `pageSizeOptions` prop (#11992) @pcorpet
22
+ - [DataGrid] Fix row reorder with cell selection (#11878) @PEsteves8
23
+ - [DataGrid] Replace `eval` with `new Function` (#11962) @cherniavskii
24
+ - [l10n] Improve Danish (da-DK) locale (#11972) @ShahrazH
25
+
26
+ #### `@mui/x-data-grid-pro@v6.19.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
27
+
28
+ Same changes as in `@mui/x-data-grid@v6.19.4`.
29
+
30
+ #### `@mui/x-data-grid-premium@v6.19.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
31
+
32
+ Same changes as in `@mui/x-data-grid-pro@v6.19.4`, plus:
33
+
34
+ - [DataGridPremium] Fix autosize grouping cell (#11990) @romgrk
35
+ - [DataGridPremium] Fix error after closing print export (#11889) @cherniavskii
36
+
37
+ ### Date Pickers
38
+
39
+ #### `@mui/x-date-pickers@v6.19.4`
40
+
41
+ - [pickers] Avoid relying on locale in Luxon `isWithinRange` method (#11940) @LukasTy
42
+
43
+ #### `@mui/x-date-pickers-pro@v6.19.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
44
+
45
+ Same changes as in `@mui/x-date-pickers@v6.19.4`.
46
+
47
+ ### Charts / `@mui/x-charts@v6.19.4`
48
+
49
+ - [charts] Add `reverse` property to axes (#11959) @alexfauquette
50
+ - [charts] Allow series ids to be numbers (#11960) @alexfauquette
51
+ - [charts] Fix Proptypes error by supporting string values for axes (#11953) @alexfauquette
52
+
53
+ ### Docs
54
+
55
+ - [docs] Add a note about `AdapterDateFnsV3` on the Getting Started page (#11987) @flaviendelangle
56
+ - [docs] Avoid the use of MUIΒ Core @oliviertassinari
57
+ - [docs] Fix API links (#11930) @alexfauquette
58
+ - [docs] Fix `ChartsTooltip` typo (#11967) @thisisharsh7
59
+ - [docs] Refactor `Localization` documentation sections (#11997) @LukasTy
60
+ - [code] Simplify bug reproduction (#11932) @alexfauquette
61
+
62
+ ## 6.19.3
63
+
64
+ _Feb 1, 2024_
65
+
66
+ We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
67
+
68
+ - 🌍 Improve Hebrew (he-IL) locale (#11831) @danielmishan85
69
+ - 🐞 Bugfixes
70
+ - πŸ“š Documentation improvements
71
+
72
+ ### Data Grid
73
+
74
+ #### `@mui/x-data-grid@6.19.3`
75
+
76
+ - [l10n] Improve Hebrew (he-IL) locale (@danielmishan85) (#11831)
77
+
78
+ #### `@mui/x-data-grid-pro@6.19.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
79
+
80
+ Same changes as in `@mui/x-data-grid@6.19.3`.
81
+
82
+ #### `@mui/x-data-grid-premium@6.19.3` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
83
+
84
+ Same changes as in `@mui/x-data-grid-pro@6.19.3`.
85
+
86
+ ### Date Pickers
87
+
88
+ #### `@mui/x-date-pickers@6.19.3`
89
+
90
+ - [TimePicker] Add missing toolbar classes descriptions (#11862) @LukasTy
91
+
92
+ #### `@mui/x-date-pickers-pro@6.19.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
93
+
94
+ Same changes as in `@mui/x-date-pickers@6.19.3`.
95
+
96
+ ### Charts / `@mui/x-charts@6.19.3`
97
+
98
+ - [charts] Document how to modify color according to values (#11854) @alexfauquette
99
+
100
+ ### Docs
101
+
102
+ - [docs] Add a general uplift to the whats new page (#11883) @danilo-leal
103
+ - [docs] Fix 404 (#11852) @alexfauquette
104
+ - [docs] Fix <title> generation (#11825) @alexfauquette
105
+ - [docs] Fix docs:api when typo in slots typing (#11861) @alexfauquette
106
+ - [docs] Improve Support page (#11556) @oliviertassinari
107
+ - [docs] Sync support page with core @oliviertassinari
108
+ - [docs] These API don't exist in MUI X v6 @oliviertassinari
109
+ - [docs] Update whats new page with v7 Beta blogpost content (#11886) @joserodolfofreitas
110
+
6
111
  ## 6.19.2
7
112
 
8
113
  _Jan 25, 2024_
@@ -3,4 +3,4 @@ export declare const GridPagination: React.ForwardRefExoticComponent<(Omit<Parti
3
3
  component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
4
4
  }>, "ref"> | Omit<Partial<import("@mui/material/TablePagination").TablePaginationOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("@mui/material/TablePagination").TablePaginationBaseProps, "ref"> & React.RefAttributes<React.Component<any, any, any>>, "hidden" | "color" | "page" | "content" | "size" | "style" | "height" | "translate" | "width" | "padding" | "disabled" | "abbr" | "slot" | "title" | "ref" | "colSpan" | "headers" | "rowSpan" | "scope" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "valign" | "sx" | "classes" | "variant" | "slotProps" | "slots" | "count" | "getItemAriaLabel" | "onPageChange" | "rowsPerPage" | "showFirstButton" | "showLastButton" | "labelDisplayedRows" | "labelRowsPerPage" | "onRowsPerPageChange" | "rowsPerPageOptions" | "backIconButtonProps" | "nextIconButtonProps" | "sortDirection" | "ActionsComponent" | "SelectProps"> & {
5
5
  component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
6
- }>, "ref">) & React.RefAttributes<HTMLDivElement>>;
6
+ }>, "ref">) & React.RefAttributes<unknown>>;
@@ -24,6 +24,9 @@ const GridPaginationRoot = styled(TablePagination)(({
24
24
  }
25
25
  }
26
26
  }));
27
+
28
+ // A mutable version of a readonly array.
29
+
27
30
  export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
28
31
  const apiRef = useGridApiContext();
29
32
  const rootProps = useGridRootProps();
@@ -69,7 +72,11 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
69
72
  ref: ref,
70
73
  component: "div",
71
74
  count: rowCount,
72
- page: paginationModel.page <= lastPage ? paginationModel.page : lastPage,
75
+ page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
76
+ // TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
77
+ // for x-data-grid is past the fix.
78
+ // Note that Material UI will not mutate the array, so this is safe.
79
+ ,
73
80
  rowsPerPageOptions: pageSizeOptions,
74
81
  rowsPerPage: paginationModel.pageSize,
75
82
  onPageChange: handlePageChange,
@@ -138,7 +138,7 @@ function GridActionsCell(props) {
138
138
  if (event.key === 'Tab') {
139
139
  event.preventDefault();
140
140
  }
141
- if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
141
+ if (['Tab', 'Escape'].includes(event.key)) {
142
142
  hideMenu();
143
143
  }
144
144
  };
@@ -175,7 +175,6 @@ function GridActionsCell(props) {
175
175
  target: buttonRef.current,
176
176
  position: position,
177
177
  onClose: hideMenu,
178
- onClick: hideMenu,
179
178
  children: /*#__PURE__*/_jsx(MenuList, {
180
179
  id: menuId,
181
180
  className: gridClasses.menuList,
@@ -184,7 +183,8 @@ function GridActionsCell(props) {
184
183
  variant: "menu",
185
184
  autoFocusItem: true,
186
185
  children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
187
- key: index
186
+ key: index,
187
+ closeMenu: hideMenu
188
188
  }))
189
189
  })
190
190
  })]
@@ -11,6 +11,12 @@ export type GridActionsCellItemProps = {
11
11
  icon: React.ReactElement;
12
12
  } & IconButtonProps) | ({
13
13
  showInMenu: true;
14
+ /**
15
+ * If false, the menu will not close when this item is clicked.
16
+ * @default true
17
+ */
18
+ closeMenuOnClick?: boolean;
19
+ closeMenu?: () => void;
14
20
  } & MenuItemProps));
15
21
  declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Omit<{
16
22
  label: string;
@@ -31,9 +37,15 @@ declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Omit<{
31
37
  component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
32
38
  } & {
33
39
  showInMenu: true;
40
+ /**
41
+ * If false, the menu will not close when this item is clicked.
42
+ * @default true
43
+ */
44
+ closeMenuOnClick?: boolean | undefined;
45
+ closeMenu?: (() => void) | undefined;
34
46
  } & import("@mui/material/MenuItem").MenuItemOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
35
47
  ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
36
48
  }, "style" | "dense" | "disabled" | "action" | "selected" | "autoFocus" | "className" | "tabIndex" | "children" | "sx" | "classes" | "disableGutters" | "divider" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & {
37
49
  component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
38
- }, "ref">) & React.RefAttributes<HTMLButtonElement>>;
50
+ }, "ref">) & React.RefAttributes<HTMLElement>>;
39
51
  export { GridActionsCellItem };
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["label", "icon", "showInMenu", "onClick"];
3
+ const _excluded = ["label", "icon", "showInMenu", "onClick"],
4
+ _excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import MenuItem from '@mui/material/MenuItem';
@@ -9,21 +10,18 @@ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
12
  const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
12
- const {
13
- label,
14
- icon,
15
- showInMenu,
16
- onClick
17
- } = props,
18
- other = _objectWithoutPropertiesLoose(props, _excluded);
19
13
  const rootProps = useGridRootProps();
20
- const handleClick = event => {
21
- if (onClick) {
22
- onClick(event);
23
- }
24
- };
25
- if (!showInMenu) {
14
+ if (!props.showInMenu) {
26
15
  var _rootProps$slotProps;
16
+ const {
17
+ label,
18
+ icon,
19
+ onClick
20
+ } = props,
21
+ other = _objectWithoutPropertiesLoose(props, _excluded);
22
+ const handleClick = event => {
23
+ onClick == null || onClick(event);
24
+ };
27
25
  return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
28
26
  ref: ref,
29
27
  size: "small",
@@ -37,10 +35,24 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
37
35
  })
38
36
  }));
39
37
  }
38
+ const {
39
+ label,
40
+ icon,
41
+ onClick,
42
+ closeMenuOnClick = true,
43
+ closeMenu
44
+ } = props,
45
+ other = _objectWithoutPropertiesLoose(props, _excluded2);
46
+ const handleClick = event => {
47
+ onClick == null || onClick(event);
48
+ if (closeMenuOnClick) {
49
+ closeMenu == null || closeMenu();
50
+ }
51
+ };
40
52
  return /*#__PURE__*/_jsxs(MenuItem, _extends({
41
53
  ref: ref
42
54
  }, other, {
43
- onClick: onClick,
55
+ onClick: handleClick,
44
56
  children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
45
57
  children: icon
46
58
  }), label]
@@ -193,6 +193,12 @@ export const GridRootStyles = styled('div', {
193
193
  [`& .${gridClasses.cell} > *`]: {
194
194
  overflow: 'visible !important',
195
195
  whiteSpace: 'nowrap'
196
+ },
197
+ [`& .${gridClasses.groupingCriteriaCell}`]: {
198
+ width: 'unset'
199
+ },
200
+ [`& .${gridClasses.treeDataGroupingCell}`]: {
201
+ width: 'unset'
196
202
  }
197
203
  },
198
204
  [`& .${gridClasses['virtualScrollerContent--overflowed']} .${gridClasses['row--lastVisible']} .${gridClasses.cell}`]: {
@@ -13,6 +13,7 @@ import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
13
13
  import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
14
14
  import { getTotalHeaderHeight } from '../columns/gridColumnsUtils';
15
15
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../colDef/gridCheckboxSelectionColDef';
16
+ import { gridDataRowIdsSelector, gridRowsLookupSelector } from '../rows/gridRowsSelector';
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  function raf() {
18
19
  return new Promise(resolve => {
@@ -217,7 +218,8 @@ export const useGridPrintExport = (apiRef, props) => {
217
218
  previousGridState.current = apiRef.current.exportState();
218
219
  // It appends that the visibility model is not exported, especially if columnVisibility is not controlled
219
220
  previousColumnVisibility.current = gridColumnVisibilityModelSelector(apiRef);
220
- previousRows.current = apiRef.current.getSortedRows();
221
+ const gridRowsLookup = gridRowsLookupSelector(apiRef);
222
+ previousRows.current = gridDataRowIdsSelector(apiRef).map(rowId => gridRowsLookup[rowId]);
221
223
  if (props.pagination) {
222
224
  const visibleRowCount = gridExpandedRowCountSelector(apiRef);
223
225
  const paginationModel = {
@@ -5,22 +5,18 @@ import { getDefaultGridFilterModel } from './gridFilterState';
5
5
  import { buildWarning } from '../../../utils/warning';
6
6
  import { getPublicApiRef } from '../../../utils/getPublicApiRef';
7
7
  import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
8
-
9
- // Fixes https://github.com/mui/mui-x/issues/10056
10
- const globalScope = typeof window === 'undefined' ? globalThis : window;
11
- const evalCode = globalScope[atob('ZXZhbA==')];
12
8
  let hasEval;
13
- const getHasEval = () => {
9
+ function getHasEval() {
14
10
  if (hasEval !== undefined) {
15
11
  return hasEval;
16
12
  }
17
13
  try {
18
- hasEval = evalCode('true');
14
+ hasEval = new Function('return true')();
19
15
  } catch (_) {
20
16
  hasEval = false;
21
17
  }
22
18
  return hasEval;
23
- };
19
+ }
24
20
  /**
25
21
  * Adds default values to the optional fields of a filter items.
26
22
  * @param {GridFilterItem} item The raw filter item.
@@ -184,25 +180,22 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
184
180
  };
185
181
  }
186
182
 
187
- // We generate a new function with `eval()` to avoid expensive patterns for JS engines
183
+ // We generate a new function with `new Function()` to avoid expensive patterns for JS engines
188
184
  // such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
189
- const filterItemTemplate = `(function filterItem$$(getRowId, appliers, row, shouldApplyFilter) {
190
- ${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
185
+ const filterItemCore = new Function('getRowId', 'appliers', 'row', 'shouldApplyFilter', `"use strict";
186
+ ${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
191
187
 
192
- const result$$ = {
193
- ${appliers.map((applier, i) => `${JSON.stringify(String(applier.item.id))}:
194
- !shouldApply${i} ?
195
- false :
196
- ${applier.v7 ? `appliers[${i}].fn(row)` : `appliers[${i}].fn(getRowId(row))`},
197
- `).join('\n')}};
188
+ const result$$ = {
189
+ ${appliers.map((applier, i) => ` ${JSON.stringify(String(applier.item.id))}: !shouldApply${i}
190
+ ? false
191
+ : ${applier.v7 ? `appliers[${i}].fn(row)` : `appliers[${i}].fn(getRowId(row))`},`).join('\n')}
192
+ };
198
193
 
199
- return result$$;
200
- })`;
201
- const filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
202
- const filterItem = (row, shouldApplyItem) => {
203
- return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
204
- };
194
+ return result$$;`.replaceAll('$$', String(filterItemsApplierId)));
205
195
  filterItemsApplierId += 1;
196
+
197
+ // Assign to the arrow function a name to help debugging
198
+ const filterItem = (row, shouldApplyItem) => filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
206
199
  return filterItem;
207
200
  };
208
201
 
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.19.2
2
+ * @mui/x-data-grid v6.19.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -21,6 +21,9 @@ var GridPaginationRoot = styled(TablePagination)(function (_ref) {
21
21
  display: 'inline-flex'
22
22
  }));
23
23
  });
24
+
25
+ // A mutable version of a readonly array.
26
+
24
27
  export var GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
25
28
  var apiRef = useGridApiContext();
26
29
  var rootProps = useGridRootProps();
@@ -68,7 +71,11 @@ export var GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginatio
68
71
  ref: ref,
69
72
  component: "div",
70
73
  count: rowCount,
71
- page: paginationModel.page <= lastPage ? paginationModel.page : lastPage,
74
+ page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
75
+ // TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
76
+ // for x-data-grid is past the fix.
77
+ // Note that Material UI will not mutate the array, so this is safe.
78
+ ,
72
79
  rowsPerPageOptions: pageSizeOptions,
73
80
  rowsPerPage: paginationModel.pageSize,
74
81
  onPageChange: handlePageChange,
@@ -169,7 +169,7 @@ function GridActionsCell(props) {
169
169
  if (event.key === 'Tab') {
170
170
  event.preventDefault();
171
171
  }
172
- if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
172
+ if (['Tab', 'Escape'].includes(event.key)) {
173
173
  hideMenu();
174
174
  }
175
175
  };
@@ -208,7 +208,6 @@ function GridActionsCell(props) {
208
208
  target: buttonRef.current,
209
209
  position: position,
210
210
  onClose: hideMenu,
211
- onClick: hideMenu,
212
211
  children: /*#__PURE__*/_jsx(MenuList, {
213
212
  id: menuId,
214
213
  className: gridClasses.menuList,
@@ -218,7 +217,8 @@ function GridActionsCell(props) {
218
217
  autoFocusItem: true,
219
218
  children: menuButtons.map(function (button, index) {
220
219
  return /*#__PURE__*/React.cloneElement(button, {
221
- key: index
220
+ key: index,
221
+ closeMenu: hideMenu
222
222
  });
223
223
  })
224
224
  })
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["label", "icon", "showInMenu", "onClick"];
3
+ var _excluded = ["label", "icon", "showInMenu", "onClick"],
4
+ _excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import MenuItem from '@mui/material/MenuItem';
@@ -9,36 +10,48 @@ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
12
  var GridActionsCellItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
12
- var label = props.label,
13
- icon = props.icon,
14
- showInMenu = props.showInMenu,
15
- onClick = props.onClick,
16
- other = _objectWithoutProperties(props, _excluded);
17
13
  var rootProps = useGridRootProps();
18
- var handleClick = function handleClick(event) {
19
- if (onClick) {
20
- onClick(event);
21
- }
22
- };
23
- if (!showInMenu) {
14
+ if (!props.showInMenu) {
24
15
  var _rootProps$slotProps;
16
+ var _label = props.label,
17
+ _icon = props.icon,
18
+ _showInMenu = props.showInMenu,
19
+ _onClick = props.onClick,
20
+ _other = _objectWithoutProperties(props, _excluded);
21
+ var _handleClick = function _handleClick(event) {
22
+ _onClick == null || _onClick(event);
23
+ };
25
24
  return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
26
25
  ref: ref,
27
26
  size: "small",
28
27
  role: "menuitem",
29
- "aria-label": label
30
- }, other, {
31
- onClick: handleClick
28
+ "aria-label": _label
29
+ }, _other, {
30
+ onClick: _handleClick
32
31
  }, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseIconButton, {
33
- children: /*#__PURE__*/React.cloneElement(icon, {
32
+ children: /*#__PURE__*/React.cloneElement(_icon, {
34
33
  fontSize: 'small'
35
34
  })
36
35
  }));
37
36
  }
37
+ var label = props.label,
38
+ icon = props.icon,
39
+ showInMenu = props.showInMenu,
40
+ onClick = props.onClick,
41
+ _props$closeMenuOnCli = props.closeMenuOnClick,
42
+ closeMenuOnClick = _props$closeMenuOnCli === void 0 ? true : _props$closeMenuOnCli,
43
+ closeMenu = props.closeMenu,
44
+ other = _objectWithoutProperties(props, _excluded2);
45
+ var handleClick = function handleClick(event) {
46
+ onClick == null || onClick(event);
47
+ if (closeMenuOnClick) {
48
+ closeMenu == null || closeMenu();
49
+ }
50
+ };
38
51
  return /*#__PURE__*/_jsxs(MenuItem, _extends({
39
52
  ref: ref
40
53
  }, other, {
41
- onClick: onClick,
54
+ onClick: handleClick,
42
55
  children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
43
56
  children: icon
44
57
  }), label]
@@ -60,11 +60,15 @@ export var GridRootStyles = styled('div', {
60
60
  height: 'auto'
61
61
  }, "& .".concat(gridClasses['row--lastVisible'], " .").concat(gridClasses.cell), {
62
62
  borderBottomColor: 'transparent'
63
- })), "&.".concat(gridClasses.autosizing), _defineProperty(_defineProperty({}, "& .".concat(gridClasses.columnHeaderTitleContainerContent, " > *"), {
63
+ })), "&.".concat(gridClasses.autosizing), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "& .".concat(gridClasses.columnHeaderTitleContainerContent, " > *"), {
64
64
  overflow: 'visible !important'
65
65
  }), "& .".concat(gridClasses.cell, " > *"), {
66
66
  overflow: 'visible !important',
67
67
  whiteSpace: 'nowrap'
68
+ }), "& .".concat(gridClasses.groupingCriteriaCell), {
69
+ width: 'unset'
70
+ }), "& .".concat(gridClasses.treeDataGroupingCell), {
71
+ width: 'unset'
68
72
  })), "& .".concat(gridClasses['virtualScrollerContent--overflowed'], " .").concat(gridClasses['row--lastVisible'], " .").concat(gridClasses.cell), {
69
73
  borderBottomColor: 'transparent'
70
74
  }), "& .".concat(gridClasses.columnHeader, ", & .").concat(gridClasses.cell), {
@@ -16,6 +16,7 @@ import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
16
16
  import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
17
17
  import { getTotalHeaderHeight } from '../columns/gridColumnsUtils';
18
18
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../colDef/gridCheckboxSelectionColDef';
19
+ import { gridDataRowIdsSelector, gridRowsLookupSelector } from '../rows/gridRowsSelector';
19
20
  import { jsx as _jsx } from "react/jsx-runtime";
20
21
  function raf() {
21
22
  return new Promise(function (resolve) {
@@ -226,7 +227,7 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
226
227
  }, [apiRef]);
227
228
  var exportDataAsPrint = React.useCallback( /*#__PURE__*/function () {
228
229
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
229
- var visibleRowCount, paginationModel, printWindow;
230
+ var gridRowsLookup, visibleRowCount, paginationModel, printWindow;
230
231
  return _regeneratorRuntime.wrap(function _callee$(_context) {
231
232
  while (1) switch (_context.prev = _context.next) {
232
233
  case 0:
@@ -240,7 +241,10 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
240
241
  previousGridState.current = apiRef.current.exportState();
241
242
  // It appends that the visibility model is not exported, especially if columnVisibility is not controlled
242
243
  previousColumnVisibility.current = gridColumnVisibilityModelSelector(apiRef);
243
- previousRows.current = apiRef.current.getSortedRows();
244
+ gridRowsLookup = gridRowsLookupSelector(apiRef);
245
+ previousRows.current = gridDataRowIdsSelector(apiRef).map(function (rowId) {
246
+ return gridRowsLookup[rowId];
247
+ });
244
248
  if (props.pagination) {
245
249
  visibleRowCount = gridExpandedRowCountSelector(apiRef);
246
250
  paginationModel = {
@@ -252,16 +256,16 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
252
256
  mergeStateWithPaginationModel(visibleRowCount, 'DataGridPro', paginationModel));
253
257
  apiRef.current.forceUpdate();
254
258
  }
255
- _context.next = 9;
259
+ _context.next = 10;
256
260
  return updateGridColumnsForPrint(options == null ? void 0 : options.fields, options == null ? void 0 : options.allColumns, options == null ? void 0 : options.includeCheckboxes);
257
- case 9:
261
+ case 10:
258
262
  if (options != null && options.getRowsToExport) {
259
263
  updateGridRowsForPrint(options.getRowsToExport);
260
264
  }
261
265
  apiRef.current.unstable_setVirtualization(false);
262
- _context.next = 13;
266
+ _context.next = 14;
263
267
  return raf();
264
- case 13:
268
+ case 14:
265
269
  // wait for the state changes to take action
266
270
  printWindow = buildPrintWindow(options == null ? void 0 : options.fileName);
267
271
  if (process.env.NODE_ENV === 'test') {
@@ -282,7 +286,7 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
282
286
  };
283
287
  doc.current.body.appendChild(printWindow);
284
288
  }
285
- case 15:
289
+ case 16:
286
290
  case "end":
287
291
  return _context.stop();
288
292
  }
@@ -5,22 +5,18 @@ import { getDefaultGridFilterModel } from './gridFilterState';
5
5
  import { buildWarning } from '../../../utils/warning';
6
6
  import { getPublicApiRef } from '../../../utils/getPublicApiRef';
7
7
  import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
8
-
9
- // Fixes https://github.com/mui/mui-x/issues/10056
10
- var globalScope = typeof window === 'undefined' ? globalThis : window;
11
- var evalCode = globalScope[atob('ZXZhbA==')];
12
8
  var hasEval;
13
- var getHasEval = function getHasEval() {
9
+ function getHasEval() {
14
10
  if (hasEval !== undefined) {
15
11
  return hasEval;
16
12
  }
17
13
  try {
18
- hasEval = evalCode('true');
14
+ hasEval = new Function('return true')();
19
15
  } catch (_) {
20
16
  hasEval = false;
21
17
  }
22
18
  return hasEval;
23
- };
19
+ }
24
20
  /**
25
21
  * Adds default values to the optional fields of a filter items.
26
22
  * @param {GridFilterItem} item The raw filter item.
@@ -198,18 +194,19 @@ var buildAggregatedFilterItemsApplier = function buildAggregatedFilterItemsAppli
198
194
  };
199
195
  }
200
196
 
201
- // We generate a new function with `eval()` to avoid expensive patterns for JS engines
197
+ // We generate a new function with `new Function()` to avoid expensive patterns for JS engines
202
198
  // such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
203
- var filterItemTemplate = "(function filterItem$$(getRowId, appliers, row, shouldApplyFilter) {\n ".concat(appliers.map(function (applier, i) {
199
+ var filterItemCore = new Function('getRowId', 'appliers', 'row', 'shouldApplyFilter', "\"use strict\";\n".concat(appliers.map(function (applier, i) {
204
200
  return "const shouldApply".concat(i, " = !shouldApplyFilter || shouldApplyFilter(").concat(JSON.stringify(applier.item.field), ");");
205
- }).join('\n'), "\n\n const result$$ = {\n ").concat(appliers.map(function (applier, i) {
206
- return "".concat(JSON.stringify(String(applier.item.id)), ":\n !shouldApply").concat(i, " ?\n false :\n ").concat(applier.v7 ? "appliers[".concat(i, "].fn(row)") : "appliers[".concat(i, "].fn(getRowId(row))"), ",\n ");
207
- }).join('\n'), "};\n\n return result$$;\n })");
208
- var filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
201
+ }).join('\n'), "\n\nconst result$$ = {\n").concat(appliers.map(function (applier, i) {
202
+ return " ".concat(JSON.stringify(String(applier.item.id)), ": !shouldApply").concat(i, "\n ? false\n : ").concat(applier.v7 ? "appliers[".concat(i, "].fn(row)") : "appliers[".concat(i, "].fn(getRowId(row))"), ",");
203
+ }).join('\n'), "\n};\n\nreturn result$$;").replaceAll('$$', String(filterItemsApplierId)));
204
+ filterItemsApplierId += 1;
205
+
206
+ // Assign to the arrow function a name to help debugging
209
207
  var filterItem = function filterItem(row, shouldApplyItem) {
210
208
  return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
211
209
  };
212
- filterItemsApplierId += 1;
213
210
  return filterItem;
214
211
  };
215
212
 
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.19.2
2
+ * @mui/x-data-grid v6.19.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the