@mui/x-data-grid 6.0.0-beta.2 → 6.0.0-beta.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 (82) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/components/GridRow.js +2 -6
  3. package/components/cell/GridActionsCell.js +24 -13
  4. package/components/cell/GridActionsCellItem.js +6 -3
  5. package/components/columnHeaders/ColumnHeaderMenuIcon.js +5 -4
  6. package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +6 -6
  7. package/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -4
  8. package/components/panel/filterPanel/GridFilterForm.js +8 -8
  9. package/components/toolbar/GridToolbarFilterButton.js +10 -7
  10. package/components/toolbar/GridToolbarQuickFilter.js +6 -6
  11. package/constants/defaultGridSlotsComponents.js +2 -0
  12. package/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -3
  13. package/hooks/features/editing/useGridCellEditing.js +4 -1
  14. package/hooks/features/editing/useGridEditing.js +1 -1
  15. package/hooks/features/editing/useGridRowEditing.js +3 -0
  16. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +71 -10
  17. package/hooks/features/scroll/useGridScroll.js +7 -3
  18. package/hooks/features/virtualization/useGridVirtualScroller.js +20 -7
  19. package/index.js +1 -1
  20. package/legacy/components/GridRow.js +2 -6
  21. package/legacy/components/cell/GridActionsCell.js +28 -17
  22. package/legacy/components/cell/GridActionsCellItem.js +6 -3
  23. package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +5 -4
  24. package/legacy/components/columnHeaders/GridColumnHeaderFilterIconButton.js +6 -6
  25. package/legacy/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -4
  26. package/legacy/components/panel/filterPanel/GridFilterForm.js +8 -8
  27. package/legacy/components/toolbar/GridToolbarFilterButton.js +8 -2
  28. package/legacy/components/toolbar/GridToolbarQuickFilter.js +6 -6
  29. package/legacy/constants/defaultGridSlotsComponents.js +2 -0
  30. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -3
  31. package/legacy/hooks/features/editing/useGridCellEditing.js +4 -1
  32. package/legacy/hooks/features/editing/useGridEditing.js +1 -1
  33. package/legacy/hooks/features/editing/useGridRowEditing.js +3 -0
  34. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +69 -10
  35. package/legacy/hooks/features/scroll/useGridScroll.js +7 -3
  36. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +20 -7
  37. package/legacy/index.js +1 -1
  38. package/legacy/utils/domUtils.js +8 -6
  39. package/models/api/gridEditingApi.d.ts +2 -2
  40. package/models/gridFilterOperator.d.ts +6 -0
  41. package/models/gridSlotsComponent.d.ts +5 -0
  42. package/models/gridSlotsComponentsProps.d.ts +1 -0
  43. package/modern/components/GridRow.js +2 -6
  44. package/modern/components/cell/GridActionsCell.js +23 -13
  45. package/modern/components/cell/GridActionsCellItem.js +5 -3
  46. package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +4 -4
  47. package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +4 -4
  48. package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +4 -4
  49. package/modern/components/panel/filterPanel/GridFilterForm.js +4 -4
  50. package/modern/components/toolbar/GridToolbarFilterButton.js +7 -1
  51. package/modern/components/toolbar/GridToolbarQuickFilter.js +4 -4
  52. package/modern/constants/defaultGridSlotsComponents.js +2 -0
  53. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -3
  54. package/modern/hooks/features/editing/useGridCellEditing.js +4 -1
  55. package/modern/hooks/features/editing/useGridEditing.js +1 -1
  56. package/modern/hooks/features/editing/useGridRowEditing.js +3 -0
  57. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +71 -10
  58. package/modern/hooks/features/scroll/useGridScroll.js +7 -3
  59. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +20 -7
  60. package/modern/index.js +1 -1
  61. package/modern/utils/domUtils.js +8 -6
  62. package/node/components/GridRow.js +2 -6
  63. package/node/components/cell/GridActionsCell.js +23 -13
  64. package/node/components/cell/GridActionsCellItem.js +5 -3
  65. package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +4 -4
  66. package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +4 -4
  67. package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +4 -4
  68. package/node/components/panel/filterPanel/GridFilterForm.js +4 -4
  69. package/node/components/toolbar/GridToolbarFilterButton.js +7 -1
  70. package/node/components/toolbar/GridToolbarQuickFilter.js +4 -4
  71. package/node/constants/defaultGridSlotsComponents.js +2 -0
  72. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
  73. package/node/hooks/features/editing/useGridCellEditing.js +4 -1
  74. package/node/hooks/features/editing/useGridEditing.js +1 -1
  75. package/node/hooks/features/editing/useGridRowEditing.js +3 -0
  76. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +71 -10
  77. package/node/hooks/features/scroll/useGridScroll.js +7 -3
  78. package/node/hooks/features/virtualization/useGridVirtualScroller.js +20 -7
  79. package/node/index.js +1 -1
  80. package/node/utils/domUtils.js +8 -6
  81. package/package.json +3 -3
  82. package/utils/domUtils.js +8 -6
package/CHANGELOG.md CHANGED
@@ -3,6 +3,65 @@
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
+ ## 6.0.0-beta.3
7
+
8
+ _Feb 9, 2023_
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
+ - ⬅️ Add right-to-left support for the data grid (#6580) @yaredtsy
13
+ - ⚡️ Improve grid resize performance (#7864) @cherniavskii
14
+ - ✨ New codemods for migrating to v6 @MBilalShafi
15
+ - 📚 Documentation improvements
16
+ - 🐞 Bugfixes
17
+
18
+ ### `@mui/x-data-grid@v6.0.0-beta.3` / `@mui/x-data-grid-pro@v6.0.0-beta.3` / `@mui/x-data-grid-premium@v6.0.0-beta.3`
19
+
20
+ #### Changes
21
+
22
+ - [DataGrid] Add `BaseIconButton` component slot (#7329) @123joshuawu
23
+ - [DataGrid] Allow to customize the value displayed in the filter button tooltip (#6956) @ithrforu
24
+ - [DataGrid] Improve grid resize performance (#7864) @cherniavskii
25
+ - [DataGrid] Make `apiRef.current.getRowWithUpdatedValues` stable (#7788) @m4theushw
26
+ - [DataGrid] Support RTL (#6580) @yaredtsy
27
+ - [DataGrid] Improve query selectors for selecting cell element (#7354) @yaredtsy
28
+ - [l10n] Improve Brazilian Portuguese (pt-BR) locale (#7854) @ed-ateixeira
29
+
30
+ ### `@mui/x-date-pickers@v6.0.0-beta.3` / `@mui/x-date-pickers-pro@v6.0.0-beta.3`
31
+
32
+ #### Changes
33
+
34
+ - [fields] Allow to select year 2000 on 2-digit year section (#7858) @flaviendelangle
35
+ - [fields] Fix year editing on `day.js` (#7862) @flaviendelangle
36
+ - [fields] Fix year editing on valid date (#7834) @flaviendelangle
37
+ - [fields] Reset query when pressing `Backspace` or `Delete` (#7855) @flaviendelangle
38
+ - [pickers] Clean Popper position on new pickers (#7445) @flaviendelangle
39
+ - [pickers] Ditch pickers `skipLibCheck` (#7808) @LukasTy
40
+ - [pickers] Improve JSDoc and resulting API docs pages (#7847) @LukasTy
41
+
42
+ ### `@mui/x-codemod@v6.0.0-beta.3`
43
+
44
+ #### Changes
45
+
46
+ - [codemod] Add more cases to `rename-selectors-and-events` codemod (#7856) @MBilalShafi
47
+ - [codemod] Add warning message to the codemods and migration guide (#7813) @MBilalShafi
48
+ - [codemod] Add codemod to remove unnecessary `experimentalFeatures` flag (#7836) @MBilalShafi
49
+ - [codemod] Rename `GridFilterItem` props (#7483) @MBilalShafi
50
+ - [codemod] Rename `linkOperators` to `logicOperators` (#7707) @MBilalShafi
51
+ - [codemod] Replace `onCellFocusOut` prop for Data Grid (#7786) @MBilalShafi
52
+
53
+ ### Docs
54
+
55
+ - [docs] Add a "Whats new in v6" page linked on the sidebar (#7820) @joserodolfofreitas
56
+ - [docs] Fix hydration crash in pickers (#7734) @oliviertassinari
57
+ - [docs] Remove no longer relevant range shortcuts section (#7840) @LukasTy
58
+ - [docs] Use `@next` tag in grid and pickers installation instructions (#7814) @cherniavskii
59
+
60
+ ### Core
61
+
62
+ - [core] Remove `tslint` package leftovers (#7841) @LukasTy
63
+ - [test] Use `createDescribes` for `describeValue` and `describeValidation` (#7866) @flaviendelangle
64
+
6
65
  ## 6.0.0-beta.2
7
66
 
8
67
  We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
@@ -2073,6 +2132,40 @@ You can find more information about the new api, including how to set those tran
2073
2132
  - [test] Skip tests for column pinning and dynamic row height (#5997) @m4theushw
2074
2133
  - [website] Improve security header @oliviertassinari
2075
2134
 
2135
+ ## 5.17.23
2136
+
2137
+ _Feb 9, 2023_
2138
+
2139
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
2140
+
2141
+ - 🌍 Improve Brazilian Portuguese (pt-BR) locale
2142
+ - 🎉 Add banner and callouts to inform about MUI X v6 beta
2143
+ - 🐞 Bugfixes
2144
+
2145
+ ### `@mui/x-data-grid@v5.17.23` / `@mui/x-data-grid-pro@v5.17.23` / `@mui/x-data-grid-premium@v5.17.23`
2146
+
2147
+ #### Changes
2148
+
2149
+ - [DataGrid] Allow to customize the value displayed in the filter button tooltip (#7816) @ithrforu
2150
+ - [DataGrid] Fix `getCellElement` method not working with pinned columns (#7844) @yaredtsy
2151
+ - [DataGrid] Fix stale rows issue in `unstable_replaceRows` (#7694) @MBilalShafi
2152
+ - [l10n] Improve Brazilian Portuguese (pt-BR) locale (#7850) @ed-ateixeira
2153
+
2154
+ ### `@mui/x-date-pickers@v_5.0.18` / `@mui/x-date-pickers-pro@v_5.0.18`
2155
+
2156
+ #### Changes
2157
+
2158
+ - [pickers] Update pickers when new value has a distinct timezone (#7853) @alexfauquette
2159
+
2160
+ ### Docs
2161
+
2162
+ - [docs] Add messages in v5 doc to inform people about v6 (#7838) @flaviendelangle
2163
+ - [docs] Fix 301 link @oliviertassinari
2164
+
2165
+ ### Core
2166
+
2167
+ - [core] Upgrade monorepo (#7849) @cherniavskii
2168
+
2076
2169
  ## 5.17.22
2077
2170
 
2078
2171
  _Feb 2, 2023_
@@ -202,11 +202,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
202
202
  }
203
203
  if (editCellState != null && column.renderEditCell) {
204
204
  var _rootProps$classes2;
205
- let updatedRow = row;
206
- if (apiRef.current.unstable_getRowWithUpdatedValues) {
207
- // Only the new editing API has this method
208
- updatedRow = apiRef.current.unstable_getRowWithUpdatedValues(rowId, column.field);
209
- }
205
+ const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
210
206
  const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded2);
211
207
  const params = _extends({}, cellParams, {
212
208
  row: updatedRow
@@ -248,7 +244,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
248
244
  }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
249
245
  children: content
250
246
  }), column.field);
251
- }, [apiRef, cellTabIndex, editRowsState, cellFocus, rootProps, row, rowHeight, rowId, treeDepth, sortModel.length]);
247
+ }, [apiRef, cellTabIndex, editRowsState, cellFocus, rootProps, rowHeight, rowId, treeDepth, sortModel.length]);
252
248
  const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
253
249
  let minHeight = rowHeight;
254
250
  if (minHeight === 'auto' && sizes) {
@@ -3,8 +3,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "focusElementRef"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import IconButton from '@mui/material/IconButton';
7
6
  import MenuList from '@mui/material/MenuList';
7
+ import { useTheme } from '@mui/material/styles';
8
8
  import { unstable_useId as useId } from '@mui/utils';
9
9
  import { gridClasses } from '../../constants/gridClasses';
10
10
  import { GridMenu } from '../menu/GridMenu';
@@ -14,6 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  const hasActions = colDef => typeof colDef.getActions === 'function';
16
16
  function GridActionsCell(props) {
17
+ var _rootProps$components;
17
18
  const {
18
19
  colDef,
19
20
  id,
@@ -30,9 +31,17 @@ function GridActionsCell(props) {
30
31
  const buttonRef = React.useRef(null);
31
32
  const ignoreCallToFocus = React.useRef(false);
32
33
  const touchRippleRefs = React.useRef({});
34
+ const theme = useTheme();
33
35
  const menuId = useId();
34
36
  const buttonId = useId();
35
37
  const rootProps = useGridRootProps();
38
+ if (!hasActions(colDef)) {
39
+ throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
40
+ }
41
+ const options = colDef.getActions(apiRef.current.getRowParams(id));
42
+ const iconButtons = options.filter(option => !option.props.showInMenu);
43
+ const menuButtons = options.filter(option => option.props.showInMenu);
44
+ const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
36
45
  React.useLayoutEffect(() => {
37
46
  if (!hasFocus) {
38
47
  Object.entries(touchRippleRefs.current).forEach(([index, ref]) => {
@@ -68,13 +77,6 @@ function GridActionsCell(props) {
68
77
  }
69
78
  }
70
79
  }), []);
71
- if (!hasActions(colDef)) {
72
- throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
73
- }
74
- const options = colDef.getActions(apiRef.current.getRowParams(id));
75
- const iconButtons = options.filter(option => !option.props.showInMenu);
76
- const menuButtons = options.filter(option => option.props.showInMenu);
77
- const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
78
80
  React.useEffect(() => {
79
81
  if (focusedButtonIndex >= numberOfButtons) {
80
82
  setFocusedButtonIndex(numberOfButtons - 1);
@@ -104,9 +106,17 @@ function GridActionsCell(props) {
104
106
  }
105
107
  let newIndex = focusedButtonIndex;
106
108
  if (event.key === 'ArrowRight') {
107
- newIndex += 1;
109
+ if (theme.direction === 'rtl') {
110
+ newIndex -= 1;
111
+ } else {
112
+ newIndex += 1;
113
+ }
108
114
  } else if (event.key === 'ArrowLeft') {
109
- newIndex -= 1;
115
+ if (theme.direction === 'rtl') {
116
+ newIndex += 1;
117
+ } else {
118
+ newIndex -= 1;
119
+ }
110
120
  }
111
121
  if (newIndex < 0 || newIndex >= numberOfButtons) {
112
122
  return; // We're already in the first or last item = do nothing and let the grid listen the event
@@ -138,7 +148,7 @@ function GridActionsCell(props) {
138
148
  touchRippleRef: handleTouchRippleRef(index),
139
149
  onClick: handleButtonClick(index, button.props.onClick),
140
150
  tabIndex: focusedButtonIndex === index ? tabIndex : -1
141
- })), menuButtons.length > 0 && buttonId && /*#__PURE__*/_jsx(IconButton, {
151
+ })), menuButtons.length > 0 && buttonId && /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
142
152
  ref: buttonRef,
143
153
  id: buttonId,
144
154
  "aria-label": apiRef.current.getLocaleText('actionsCellMore'),
@@ -149,11 +159,12 @@ function GridActionsCell(props) {
149
159
  size: "small",
150
160
  onClick: showMenu,
151
161
  touchRippleRef: handleTouchRippleRef(buttonId),
152
- tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1,
162
+ tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
163
+ }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseIconButton, {
153
164
  children: /*#__PURE__*/_jsx(rootProps.components.MoreActionsIcon, {
154
165
  fontSize: "small"
155
166
  })
156
- }), menuButtons.length > 0 && /*#__PURE__*/_jsx(GridMenu, {
167
+ })), menuButtons.length > 0 && /*#__PURE__*/_jsx(GridMenu, {
157
168
  onClickAway: hideMenu,
158
169
  onClick: hideMenu,
159
170
  open: open,
@@ -3,9 +3,9 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["label", "icon", "showInMenu", "onClick"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import IconButton from '@mui/material/IconButton';
7
6
  import MenuItem from '@mui/material/MenuItem';
8
7
  import ListItemIcon from '@mui/material/ListItemIcon';
8
+ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
@@ -16,19 +16,22 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
16
16
  onClick
17
17
  } = props,
18
18
  other = _objectWithoutPropertiesLoose(props, _excluded);
19
+ const rootProps = useGridRootProps();
19
20
  const handleClick = event => {
20
21
  if (onClick) {
21
22
  onClick(event);
22
23
  }
23
24
  };
24
25
  if (!showInMenu) {
25
- return /*#__PURE__*/_jsx(IconButton, _extends({
26
+ var _rootProps$components;
27
+ return /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
26
28
  ref: ref,
27
29
  size: "small",
28
30
  role: "menuitem",
29
31
  "aria-label": label
30
32
  }, other, {
31
- onClick: handleClick,
33
+ onClick: handleClick
34
+ }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseIconButton, {
32
35
  children: /*#__PURE__*/React.cloneElement(icon, {
33
36
  fontSize: 'small'
34
37
  })
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
4
- import IconButton from '@mui/material/IconButton';
5
4
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
6
5
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
7
6
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
@@ -18,6 +17,7 @@ const useUtilityClasses = ownerState => {
18
17
  return composeClasses(slots, getDataGridUtilityClass, classes);
19
18
  };
20
19
  export const ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(props => {
20
+ var _rootProps$components;
21
21
  const {
22
22
  colDef,
23
23
  open,
@@ -38,7 +38,7 @@ export const ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(props => {
38
38
  }, [apiRef, colDef.field]);
39
39
  return /*#__PURE__*/_jsx("div", {
40
40
  className: classes.root,
41
- children: /*#__PURE__*/_jsx(IconButton, {
41
+ children: /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
42
42
  ref: iconButtonRef,
43
43
  tabIndex: -1,
44
44
  className: classes.button,
@@ -49,10 +49,11 @@ export const ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(props => {
49
49
  "aria-expanded": open ? 'true' : undefined,
50
50
  "aria-haspopup": "true",
51
51
  "aria-controls": columnMenuId,
52
- id: columnMenuButtonId,
52
+ id: columnMenuButtonId
53
+ }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseIconButton, {
53
54
  children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuIcon, {
54
55
  fontSize: "small"
55
56
  })
56
- })
57
+ }))
57
58
  });
58
59
  });
@@ -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 } from '@mui/utils';
5
- import IconButton from '@mui/material/IconButton';
6
5
  import Badge from '@mui/material/Badge';
7
6
  import { gridPreferencePanelStateSelector } from '../../hooks/features/preferencesPanel/gridPreferencePanelSelector';
8
7
  import { GridPreferencePanelsValue } from '../../hooks/features/preferencesPanel/gridPreferencePanelsValue';
@@ -22,7 +21,7 @@ const useUtilityClasses = ownerState => {
22
21
  return composeClasses(slots, getDataGridUtilityClass, classes);
23
22
  };
24
23
  function GridColumnHeaderFilterIconButton(props) {
25
- var _rootProps$components;
24
+ var _rootProps$components, _rootProps$components2;
26
25
  const {
27
26
  counter,
28
27
  field,
@@ -53,21 +52,22 @@ function GridColumnHeaderFilterIconButton(props) {
53
52
  if (!counter) {
54
53
  return null;
55
54
  }
56
- const iconButton = /*#__PURE__*/_jsx(IconButton, {
55
+ const iconButton = /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
57
56
  onClick: toggleFilter,
58
57
  color: "default",
59
58
  "aria-label": apiRef.current.getLocaleText('columnHeaderFiltersLabel'),
60
59
  size: "small",
61
- tabIndex: -1,
60
+ tabIndex: -1
61
+ }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseIconButton, {
62
62
  children: /*#__PURE__*/_jsx(rootProps.components.ColumnFilteredIcon, {
63
63
  className: classes.icon,
64
64
  fontSize: "small"
65
65
  })
66
- });
66
+ }));
67
67
  return /*#__PURE__*/_jsx(rootProps.components.BaseTooltip, _extends({
68
68
  title: apiRef.current.getLocaleText('columnHeaderFiltersTooltipActive')(counter),
69
69
  enterDelay: 1000
70
- }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTooltip, {
70
+ }, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseTooltip, {
71
71
  children: /*#__PURE__*/_jsxs(GridIconButtonContainer, {
72
72
  children: [counter > 1 && /*#__PURE__*/_jsx(Badge, {
73
73
  badgeContent: counter,
@@ -3,7 +3,6 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
5
5
  import Badge from '@mui/material/Badge';
6
- import IconButton from '@mui/material/IconButton';
7
6
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
8
7
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
9
8
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
@@ -36,6 +35,7 @@ function getIcon(icons, direction, className, sortingOrder) {
36
35
  }, iconProps)) : null;
37
36
  }
38
37
  function GridColumnHeaderSortIconRaw(props) {
38
+ var _rootProps$components;
39
39
  const {
40
40
  direction,
41
41
  index,
@@ -51,13 +51,14 @@ function GridColumnHeaderSortIconRaw(props) {
51
51
  if (!iconElement) {
52
52
  return null;
53
53
  }
54
- const iconButton = /*#__PURE__*/_jsx(IconButton, {
54
+ const iconButton = /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
55
55
  tabIndex: -1,
56
56
  "aria-label": apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
57
57
  title: apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
58
- size: "small",
58
+ size: "small"
59
+ }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseIconButton, {
59
60
  children: iconElement
60
- });
61
+ }));
61
62
  return /*#__PURE__*/_jsxs(GridIconButtonContainer, {
62
63
  children: [index != null && /*#__PURE__*/_jsx(Badge, {
63
64
  badgeContent: index,
@@ -5,7 +5,6 @@ const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterCha
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { unstable_composeClasses as composeClasses, unstable_useId as useId, unstable_capitalize as capitalize } from '@mui/utils';
8
- import IconButton from '@mui/material/IconButton';
9
8
  import MenuItem from '@mui/material/MenuItem';
10
9
  import InputLabel from '@mui/material/InputLabel';
11
10
  import FormControl from '@mui/material/FormControl';
@@ -99,7 +98,7 @@ const getLogicOperatorLocaleKey = logicOperator => {
99
98
  const getColumnLabel = col => col.headerName || col.field;
100
99
  const collator = new Intl.Collator();
101
100
  const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props, ref) {
102
- var _rootProps$components, _rootProps$components2, _baseSelectProps$nati, _rootProps$components3, _rootProps$components4, _rootProps$components5, _currentColumn$filter2;
101
+ var _rootProps$components, _rootProps$components2, _baseSelectProps$nati, _rootProps$components3, _rootProps$components4, _rootProps$components5, _rootProps$components6, _currentColumn$filter2;
103
102
  const {
104
103
  item,
105
104
  hasMultipleFilters,
@@ -238,15 +237,16 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
238
237
  as: rootProps.components.BaseFormControl
239
238
  }, baseFormControlProps, deleteIconProps, {
240
239
  className: clsx(classes.deleteIcon, baseFormControlProps.className, deleteIconProps.className),
241
- children: /*#__PURE__*/_jsx(IconButton, {
240
+ children: /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
242
241
  "aria-label": apiRef.current.getLocaleText('filterPanelDeleteIconLabel'),
243
242
  title: apiRef.current.getLocaleText('filterPanelDeleteIconLabel'),
244
243
  onClick: handleDeleteFilter,
245
- size: "small",
244
+ size: "small"
245
+ }, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseIconButton, {
246
246
  children: /*#__PURE__*/_jsx(rootProps.components.FilterPanelDeleteIcon, {
247
247
  fontSize: "small"
248
248
  })
249
- })
249
+ }))
250
250
  })), /*#__PURE__*/_jsx(FilterFormLogicOperatorInput, _extends({
251
251
  variant: "standard",
252
252
  as: rootProps.components.BaseFormControl
@@ -264,7 +264,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
264
264
  onChange: changeLogicOperator,
265
265
  disabled: !!disableMultiFilterOperator || logicOperators.length === 1,
266
266
  native: isBaseSelectNative
267
- }, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseSelect, {
267
+ }, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseSelect, {
268
268
  children: logicOperators.map(logicOperator => /*#__PURE__*/_jsx(OptionComponent, {
269
269
  value: logicOperator.toString(),
270
270
  children: apiRef.current.getLocaleText(getLogicOperatorLocaleKey(logicOperator))
@@ -286,7 +286,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
286
286
  value: item.field || '',
287
287
  onChange: changeColumn,
288
288
  native: isBaseSelectNative
289
- }, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseSelect, {
289
+ }, (_rootProps$components5 = rootProps.componentsProps) == null ? void 0 : _rootProps$components5.baseSelect, {
290
290
  children: sortedFilteredColumns.map(col => /*#__PURE__*/_jsx(OptionComponent, {
291
291
  value: col.field,
292
292
  children: getColumnLabel(col)
@@ -309,7 +309,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
309
309
  onChange: changeOperator,
310
310
  native: isBaseSelectNative,
311
311
  inputRef: filterSelectorRef
312
- }, (_rootProps$components5 = rootProps.componentsProps) == null ? void 0 : _rootProps$components5.baseSelect, {
312
+ }, (_rootProps$components6 = rootProps.componentsProps) == null ? void 0 : _rootProps$components6.baseSelect, {
313
313
  children: currentColumn == null ? void 0 : (_currentColumn$filter2 = currentColumn.filterOperators) == null ? void 0 : _currentColumn$filter2.map(operator => /*#__PURE__*/_jsx(OptionComponent, {
314
314
  value: operator.value,
315
315
  children: operator.label || apiRef.current.getLocaleText(`filterOperator${capitalize(operator.value)}`)
@@ -59,17 +59,20 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
59
59
  return apiRef.current.getLocaleText('toolbarFiltersTooltipShow');
60
60
  }
61
61
  const getOperatorLabel = item => lookup[item.field].filterOperators.find(operator => operator.value === item.operator).label || apiRef.current.getLocaleText(`filterOperator${capitalize(item.operator)}`).toString();
62
+ const getFilterItemValue = item => {
63
+ const {
64
+ getValueAsString
65
+ } = lookup[item.field].filterOperators.find(operator => operator.value === item.operator);
66
+ return getValueAsString ? getValueAsString(item.value) : item.value;
67
+ };
62
68
  return /*#__PURE__*/_jsxs("div", {
63
69
  children: [apiRef.current.getLocaleText('toolbarFiltersTooltipActive')(activeFilters.length), /*#__PURE__*/_jsx(GridToolbarFilterListRoot, {
64
70
  className: classes.root,
65
- children: activeFilters.map((item, index) => {
66
- var _item$value;
67
- return _extends({}, lookup[item.field] && /*#__PURE__*/_jsx("li", {
68
- children: `${lookup[item.field].headerName || item.field}
71
+ children: activeFilters.map((item, index) => _extends({}, lookup[item.field] && /*#__PURE__*/_jsx("li", {
72
+ children: `${lookup[item.field].headerName || item.field}
69
73
  ${getOperatorLabel(item)}
70
- ${(_item$value = item.value) != null ? _item$value : ''}`
71
- }, index));
72
- })
74
+ ${item.value ? getFilterItemValue(item) : ''}`
75
+ }, index)))
73
76
  })]
74
77
  });
75
78
  }, [apiRef, preferencePanel.open, activeFilters, lookup, classes]);
@@ -4,7 +4,6 @@ const _excluded = ["quickFilterParser", "quickFilterFormatter", "debounceMs"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import TextField from '@mui/material/TextField';
7
- import IconButton from '@mui/material/IconButton';
8
7
  import { styled } from '@mui/material/styles';
9
8
  import { unstable_debounce as debounce } from '@mui/utils';
10
9
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
@@ -46,7 +45,7 @@ const GridToolbarQuickFilterRoot = styled(TextField, {
46
45
  const defaultSearchValueParser = searchText => searchText.split(' ').filter(word => word !== '');
47
46
  const defaultSearchValueFormatter = values => values.join(' ');
48
47
  function GridToolbarQuickFilter(props) {
49
- var _rootProps$components;
48
+ var _rootProps$components, _rootProps$components2;
50
49
  const {
51
50
  quickFilterParser = defaultSearchValueParser,
52
51
  quickFilterFormatter = defaultSearchValueFormatter,
@@ -92,19 +91,20 @@ function GridToolbarQuickFilter(props) {
92
91
  startAdornment: /*#__PURE__*/_jsx(rootProps.components.QuickFilterIcon, {
93
92
  fontSize: "small"
94
93
  }),
95
- endAdornment: /*#__PURE__*/_jsx(IconButton, {
94
+ endAdornment: /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
96
95
  "aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
97
96
  size: "small",
98
97
  sx: {
99
98
  visibility: searchValue ? 'visible' : 'hidden'
100
99
  },
101
- onClick: handleSearchReset,
100
+ onClick: handleSearchReset
101
+ }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseIconButton, {
102
102
  children: /*#__PURE__*/_jsx(rootProps.components.QuickFilterClearIcon, {
103
103
  fontSize: "small"
104
104
  })
105
- })
105
+ }))
106
106
  }
107
- }, other, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
107
+ }, other, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseTextField));
108
108
  }
109
109
  process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
110
110
  // ----------------------------- Warning --------------------------------
@@ -5,6 +5,7 @@ import MUIFormControl from '@mui/material/FormControl';
5
5
  import MUISelect from '@mui/material/Select';
6
6
  import MUISwitch from '@mui/material/Switch';
7
7
  import MUIButton from '@mui/material/Button';
8
+ import MUIIconButton from '@mui/material/IconButton';
8
9
  import MUITooltip from '@mui/material/Tooltip';
9
10
  import MUIPopper from '@mui/material/Popper';
10
11
  import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridSkeletonCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon, GridDragIcon, GridColumnHeaderFilterIconButton, GridSearchIcon, GridVisibilityOffIcon, GridViewColumnIcon, GridClearIcon } from '../components';
@@ -51,6 +52,7 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, DEFAULT_GRID_ICON
51
52
  BaseSelect: MUISelect,
52
53
  BaseSwitch: MUISwitch,
53
54
  BaseButton: MUIButton,
55
+ BaseIconButton: MUIIconButton,
54
56
  BaseTooltip: MUITooltip,
55
57
  BasePopper: MUIPopper,
56
58
  Cell: GridCell,
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import * as ReactDOM from 'react-dom';
4
4
  import { unstable_useForkRef as useForkRef } from '@mui/utils';
5
- import { styled } from '@mui/material/styles';
5
+ import { styled, useTheme } from '@mui/material/styles';
6
6
  import { defaultMemoize } from 'reselect';
7
7
  import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
8
8
  import { useGridSelector } from '../../utils/useGridSelector';
@@ -36,6 +36,7 @@ export const useGridColumnHeaders = props => {
36
36
  innerRef: innerRefProp,
37
37
  minColumnIndex = 0
38
38
  } = props;
39
+ const theme = useTheme();
39
40
  const [dragCol, setDragCol] = React.useState('');
40
41
  const [resizeCol, setResizeCol] = React.useState('');
41
42
  const apiRef = useGridPrivateApiContext();
@@ -87,9 +88,10 @@ export const useGridColumnHeaders = props => {
87
88
  apiRef,
88
89
  visibleRows: currentPage.rows
89
90
  });
90
- const offset = firstColumnToRender > 0 ? prevScrollLeft.current - columnPositions[firstColumnToRender] : prevScrollLeft.current;
91
+ const direction = theme.direction === 'ltr' ? 1 : -1;
92
+ const offset = firstColumnToRender > 0 ? prevScrollLeft.current - direction * columnPositions[firstColumnToRender] : prevScrollLeft.current;
91
93
  innerRef.current.style.transform = `translate3d(${-offset}px, 0px, 0px)`;
92
- }, [columnPositions, minColumnIndex, rootProps.columnBuffer, apiRef, currentPage.rows, rootProps.rowBuffer]);
94
+ }, [columnPositions, minColumnIndex, rootProps.columnBuffer, apiRef, currentPage.rows, rootProps.rowBuffer, theme.direction]);
93
95
  React.useLayoutEffect(() => {
94
96
  if (renderContext) {
95
97
  updateInnerPosition(renderContext);
@@ -383,10 +383,13 @@ export const useGridCellEditing = (apiRef, props) => {
383
383
  const getRowWithUpdatedValuesFromCellEditing = React.useCallback((id, field) => {
384
384
  const column = apiRef.current.getColumn(field);
385
385
  const editingState = gridEditRowsStateSelector(apiRef.current.state);
386
+ const row = apiRef.current.getRow(id);
387
+ if (!editingState[id] || !editingState[id][field]) {
388
+ return apiRef.current.getRow(id);
389
+ }
386
390
  const {
387
391
  value
388
392
  } = editingState[id][field];
389
- const row = apiRef.current.getRow(id);
390
393
  return column.valueSetter ? column.valueSetter({
391
394
  value,
392
395
  row
@@ -117,7 +117,7 @@ export const useGridEditing = (apiRef, props) => {
117
117
  const editingSharedApi = {
118
118
  isCellEditable,
119
119
  setEditCellValue,
120
- unstable_getRowWithUpdatedValues: getRowWithUpdatedValues,
120
+ getRowWithUpdatedValues,
121
121
  unstable_getEditCellMeta: getEditCellMeta
122
122
  };
123
123
  const editingSharedPrivateApi = {
@@ -504,6 +504,9 @@ export const useGridRowEditing = (apiRef, props) => {
504
504
  const getRowWithUpdatedValuesFromRowEditing = React.useCallback(id => {
505
505
  const editingState = gridEditRowsStateSelector(apiRef.current.state);
506
506
  const row = apiRef.current.getRow(id);
507
+ if (!editingState[id]) {
508
+ return apiRef.current.getRow(id);
509
+ }
507
510
  let rowUpdate = _extends({}, row);
508
511
  Object.entries(editingState[id]).forEach(([field, fieldProps]) => {
509
512
  const column = apiRef.current.getColumn(field);