@mui/x-data-grid 7.0.0-alpha.3 → 7.0.0-alpha.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 (86) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/colDef/gridCheckboxSelectionColDef.js +1 -1
  3. package/colDef/gridDefaultColumnTypes.d.ts +2 -2
  4. package/colDef/gridDefaultColumnTypes.js +2 -2
  5. package/components/GridRow.js +7 -2
  6. package/components/base/GridOverlays.js +0 -2
  7. package/components/cell/GridActionsCell.js +0 -1
  8. package/components/cell/GridCell.js +0 -2
  9. package/components/virtualization/GridVirtualScroller.js +0 -1
  10. package/hooks/features/editing/useGridCellEditing.js +0 -2
  11. package/hooks/features/editing/useGridRowEditing.js +0 -1
  12. package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -2
  13. package/hooks/features/focus/gridFocusStateSelector.js +2 -6
  14. package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
  15. package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -4
  16. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +7 -5
  17. package/hooks/features/rows/useGridRowsMeta.js +0 -1
  18. package/hooks/features/virtualization/useGridVirtualScroller.js +0 -1
  19. package/index.js +1 -1
  20. package/internals/index.d.ts +1 -1
  21. package/internals/index.js +1 -1
  22. package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -1
  23. package/legacy/colDef/gridDefaultColumnTypes.js +2 -2
  24. package/legacy/components/GridRow.js +7 -2
  25. package/legacy/components/base/GridOverlays.js +0 -2
  26. package/legacy/components/cell/GridActionsCell.js +0 -1
  27. package/legacy/components/cell/GridCell.js +0 -2
  28. package/legacy/components/virtualization/GridVirtualScroller.js +0 -1
  29. package/legacy/hooks/features/editing/useGridCellEditing.js +0 -2
  30. package/legacy/hooks/features/editing/useGridRowEditing.js +0 -1
  31. package/legacy/hooks/features/focus/gridFocusStateSelector.js +2 -6
  32. package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -4
  33. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +7 -5
  34. package/legacy/hooks/features/rows/useGridRowsMeta.js +0 -1
  35. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +0 -1
  36. package/legacy/index.js +1 -1
  37. package/legacy/internals/index.js +1 -1
  38. package/legacy/locales/coreLocales.js +1 -0
  39. package/legacy/locales/daDK.js +37 -39
  40. package/legacy/locales/plPL.js +0 -1
  41. package/legacy/utils/utils.js +0 -1
  42. package/locales/coreLocales.js +1 -0
  43. package/locales/daDK.js +37 -39
  44. package/locales/plPL.js +0 -1
  45. package/models/colDef/gridColType.d.ts +2 -4
  46. package/modern/colDef/gridCheckboxSelectionColDef.js +1 -1
  47. package/modern/colDef/gridDefaultColumnTypes.js +2 -2
  48. package/modern/components/GridRow.js +7 -2
  49. package/modern/components/base/GridOverlays.js +0 -2
  50. package/modern/components/cell/GridActionsCell.js +0 -1
  51. package/modern/components/cell/GridCell.js +0 -2
  52. package/modern/components/virtualization/GridVirtualScroller.js +0 -1
  53. package/modern/hooks/features/editing/useGridCellEditing.js +0 -2
  54. package/modern/hooks/features/editing/useGridRowEditing.js +0 -1
  55. package/modern/hooks/features/focus/gridFocusStateSelector.js +2 -6
  56. package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -4
  57. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +7 -5
  58. package/modern/hooks/features/rows/useGridRowsMeta.js +0 -1
  59. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +0 -1
  60. package/modern/index.js +1 -1
  61. package/modern/internals/index.js +1 -1
  62. package/modern/locales/coreLocales.js +1 -0
  63. package/modern/locales/daDK.js +37 -39
  64. package/modern/locales/plPL.js +0 -1
  65. package/modern/utils/utils.js +0 -1
  66. package/node/colDef/gridCheckboxSelectionColDef.js +1 -1
  67. package/node/colDef/gridDefaultColumnTypes.js +2 -2
  68. package/node/components/GridRow.js +7 -2
  69. package/node/components/base/GridOverlays.js +0 -2
  70. package/node/components/cell/GridActionsCell.js +0 -1
  71. package/node/components/cell/GridCell.js +0 -2
  72. package/node/components/virtualization/GridVirtualScroller.js +0 -1
  73. package/node/hooks/features/editing/useGridCellEditing.js +0 -2
  74. package/node/hooks/features/editing/useGridRowEditing.js +0 -1
  75. package/node/hooks/features/focus/gridFocusStateSelector.js +3 -7
  76. package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -7
  77. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +6 -4
  78. package/node/hooks/features/rows/useGridRowsMeta.js +0 -1
  79. package/node/hooks/features/virtualization/useGridVirtualScroller.js +0 -1
  80. package/node/index.js +1 -1
  81. package/node/internals/index.js +14 -14
  82. package/node/locales/daDK.js +37 -39
  83. package/node/locales/plPL.js +0 -1
  84. package/node/utils/utils.js +0 -1
  85. package/package.json +4 -4
  86. package/utils/utils.js +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,89 @@
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.0.0-alpha.4
7
+
8
+ _Dec 8, 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
+ - 🚀 The scatter charts now use voronoi to trigger items
13
+
14
+ Users needed to hover the item to highlight the scatter item or show the tooltip.
15
+ Now they can interact with data by triggering the closest element. See the [docs page](https://next.mui.com/x/react-charts/scatter/#interaction) for more info.
16
+
17
+ - 📚 Add [Pickers FAQ page](https://next.mui.com/x/react-date-pickers/faq/)
18
+ - 🎉 The Data Grid Header filters feature is now stable
19
+ - 🌍 Improve Danish (da-DK) locale on Data Grid
20
+ - 🐞 Bugfixes
21
+
22
+ ### Data Grid
23
+
24
+ #### Breaking changes
25
+
26
+ - The header filters feature is now stable. `unstable_` prefix is removed from prop `headerFilters` and related exports.
27
+ See [migration docs](https://next.mui.com/x/migration/migration-data-grid-v6/#filtering) for more details.
28
+
29
+ - The `GridColDef['type']` has been narrowed down to only accept the built-in column types.
30
+ TypeScript users need to use the `GridColDef` interface when defining columns:
31
+
32
+ ```tsx
33
+ // 🛑 `type` is inferred as `string` and is too wide
34
+ const columns = [{ type: 'number', field: 'id' }];
35
+ <DataGrid columns={columns} />;
36
+
37
+ // ✅ `type` is `'number'`
38
+ const columns: GridColDef[] = [{ type: 'number', field: 'id' }];
39
+ <DataGrid columns={columns} />;
40
+
41
+ // ✅ Alternalively, `as const` can be used to narrow down the type
42
+ const columns = [{ type: 'number' as const, field: 'id' }];
43
+ <DataGrid columns={columns} />;
44
+ ```
45
+
46
+ #### `@mui/x-data-grid@7.0.0-alpha.4`
47
+
48
+ - [DataGrid] Added a guard for reorder cells (#11159) @michelengelen
49
+ - [DataGrid] Narrow down `GridColDef['type']` (#11270) @cherniavskii
50
+ - [l10n] Improve Danish (da-DK) locale (#11304) @goibon
51
+
52
+ #### `@mui/x-data-grid-pro@7.0.0-alpha.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
53
+
54
+ Same changes as in `@mui/x-data-grid@7.0.0-alpha.4`, plus:
55
+
56
+ - [DataGridPro] Make header filters feature stable (#11243) @MBilalShafi
57
+
58
+ #### `@mui/x-data-grid-premium@7.0.0-alpha.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
59
+
60
+ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.4`.
61
+
62
+ ### Date Pickers
63
+
64
+ #### `@mui/x-date-pickers@7.0.0-alpha.4`
65
+
66
+ - [fields] Rework `PickersTextField` (#11258) @flaviendelangle
67
+ - [pickers] Fix `MultiSectionDigitalClock` issues (#11305) @LukasTy
68
+ - [pickers] Fix views height consistency (#11337) @LukasTy
69
+
70
+ #### `@mui/x-date-pickers-pro@7.0.0-alpha.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
71
+
72
+ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.4`.
73
+
74
+ ### Charts / `@mui/x-charts@7.0.0-alpha.4`
75
+
76
+ - [charts] Remove animation on sparkline (#11311) @oliviertassinari
77
+ - [charts] Use voronoi cells to trigger interaction with scatter items (#10981) @alexfauquette
78
+ - [charts] Add `@mui/utils` as a dependency (#11351) @michelengelen
79
+
80
+ ### Docs
81
+
82
+ - [docs] Add FAQ page (#11271) @noraleonte
83
+ - [docs] Add a doc section on how to override the start of the week with each adapter (#11223) @flaviendelangle
84
+ - [docs] Added params to `onPaginationModelChange` docs (#10191) @JFBenzs
85
+ - [docs] Fix typo (#11324) @cadam11
86
+ - [docs] Improve `DemoContainer` styling coverage (#11315) @LukasTy
87
+ - [docs] General revision of the Charts docs (#11249) @danilo-leal
88
+
6
89
  ## 7.0.0-alpha.3
7
90
 
8
91
  _Dec 4, 2023_
@@ -866,6 +949,46 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
866
949
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
867
950
  - [license] Correctly throw errors (#10924) @oliviertassinari
868
951
 
952
+ ## 6.18.4
953
+
954
+ _Dec 8, 2023_
955
+
956
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
957
+
958
+ - 📚 Add [Pickers FAQ page](https://mui.com/x/react-date-pickers/faq/)
959
+ - 🌍 Improve Danish (da-DK) locale on Data Grid
960
+ - 🐞 Bugfixes
961
+
962
+ ### Data Grid
963
+
964
+ #### `@mui/x-data-grid@6.18.4`
965
+
966
+ - [DataGrid] Fix cell slot style override (#11215) @oliviertassinari
967
+ - [l10n] Improve Danish (da-DK) locale (#11346) @goibon
968
+
969
+ #### `@mui/x-data-grid-pro@6.18.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
970
+
971
+ Same changes as in `@mui/x-data-grid@6.18.4`.
972
+
973
+ #### `@mui/x-data-grid-premium@6.18.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
974
+
975
+ Same changes as in `@mui/x-data-grid-pro@6.18.4`.
976
+
977
+ ### Date Pickers
978
+
979
+ #### `@mui/x-date-pickers@6.18.4`
980
+
981
+ - [pickers] Fix `MultiSectionDigitalClock` issues (#11308) @LukasTy
982
+
983
+ #### `@mui/x-date-pickers-pro@6.18.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
984
+
985
+ Same changes as in `@mui/x-date-pickers@6.18.4`.
986
+
987
+ ### Docs
988
+
989
+ - [docs] Fix typo (#11323) @cadam11
990
+ - [docs] Add FAQ page (#11347) @noraleonte
991
+
869
992
  ## 6.18.3
870
993
 
871
994
  _Dec 4, 2023_
@@ -7,8 +7,8 @@ import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export const GRID_CHECKBOX_SELECTION_FIELD = '__check__';
9
9
  export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF, {
10
+ type: 'custom',
10
11
  field: GRID_CHECKBOX_SELECTION_FIELD,
11
- type: 'checkboxSelection',
12
12
  width: 50,
13
13
  resizable: false,
14
14
  sortable: false,
@@ -1,3 +1,3 @@
1
- import { GridColumnTypesRecord } from '../models/colDef/gridColumnTypesRecord';
2
- export declare const DEFAULT_GRID_COL_TYPE_KEY = "__default__";
1
+ import type { GridColumnTypesRecord } from '../models/colDef/gridColumnTypesRecord';
2
+ export declare const DEFAULT_GRID_COL_TYPE_KEY = "string";
3
3
  export declare const getGridDefaultColumnTypes: () => GridColumnTypesRecord;
@@ -4,7 +4,7 @@ import { GRID_DATE_COL_DEF, GRID_DATETIME_COL_DEF } from './gridDateColDef';
4
4
  import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
5
5
  import { GRID_SINGLE_SELECT_COL_DEF } from './gridSingleSelectColDef';
6
6
  import { GRID_ACTIONS_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from './gridActionsColDef';
7
- export const DEFAULT_GRID_COL_TYPE_KEY = '__default__';
7
+ export const DEFAULT_GRID_COL_TYPE_KEY = 'string';
8
8
  export const getGridDefaultColumnTypes = () => {
9
9
  const nativeColumnTypes = {
10
10
  string: GRID_STRING_COL_DEF,
@@ -14,7 +14,7 @@ export const getGridDefaultColumnTypes = () => {
14
14
  boolean: GRID_BOOLEAN_COL_DEF,
15
15
  singleSelect: GRID_SINGLE_SELECT_COL_DEF,
16
16
  [GRID_ACTIONS_COLUMN_TYPE]: GRID_ACTIONS_COL_DEF,
17
- [DEFAULT_GRID_COL_TYPE_KEY]: GRID_STRING_COL_DEF
17
+ custom: GRID_STRING_COL_DEF
18
18
  };
19
19
  return nativeColumnTypes;
20
20
  };
@@ -53,7 +53,6 @@ function EmptyCell({
53
53
  style: style
54
54
  }); // TODO change to .MuiDataGrid-emptyCell or .MuiDataGrid-rowFiller
55
55
  }
56
-
57
56
  const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
58
57
  const {
59
58
  selected,
@@ -194,7 +193,13 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
194
193
  const rowReordering = rootProps.rowReordering;
195
194
  const getCell = (column, cellProps) => {
196
195
  var _editRowsState$rowId$, _editRowsState$rowId;
197
- const disableDragEvents = disableColumnReorder && column.disableReorder || !rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
196
+ // when the cell is a reorder cell we are not allowing to reorder the col
197
+ // fixes https://github.com/mui/mui-x/issues/11126
198
+ const isReorderCell = column.field === '__reorder__';
199
+ const isEditingRows = Object.keys(editRowsState).length > 0;
200
+ const canReorderColumn = !(disableColumnReorder || column.disableReorder);
201
+ const canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
202
+ const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
198
203
  const editCellState = (_editRowsState$rowId$ = (_editRowsState$rowId = editRowsState[rowId]) == null ? void 0 : _editRowsState$rowId[column.field]) != null ? _editRowsState$rowId$ : null;
199
204
  let cellIsNotVisible = false;
200
205
  if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
@@ -31,7 +31,6 @@ const GridOverlayWrapperRoot = styled('div', {
31
31
  zIndex: overlayType === 'loadingOverlay' ? 5 // Should be above pinned columns, pinned rows, and detail panel
32
32
  : 4 // Should be above pinned columns and detail panel
33
33
  }));
34
-
35
34
  const GridOverlayWrapperInner = styled('div', {
36
35
  name: 'MuiDataGrid',
37
36
  slot: 'OverlayWrapperInner',
@@ -67,7 +66,6 @@ function GridOverlayWrapper(props) {
67
66
  if (rootProps.autoHeight && height === 0) {
68
67
  height = getMinimalContentHeight(apiRef, rootProps.rowHeight); // Give room to show the overlay when there no rows.
69
68
  }
70
-
71
69
  const classes = useUtilityClasses(_extends({}, props, {
72
70
  classes: rootProps.classes
73
71
  }));
@@ -128,7 +128,6 @@ function GridActionsCell(props) {
128
128
  if (newIndex < 0 || newIndex >= numberOfButtons) {
129
129
  return; // We're already in the first or last item = do nothing and let the grid listen the event
130
130
  }
131
-
132
131
  if (newIndex !== focusedButtonIndex) {
133
132
  event.preventDefault(); // Prevent scrolling
134
133
  event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
@@ -243,7 +243,6 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
243
243
  minHeight: height,
244
244
  maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
245
245
  };
246
-
247
246
  return cellStyle;
248
247
  }, [width, height, isNotVisible]);
249
248
  React.useEffect(() => {
@@ -512,7 +511,6 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
512
511
  minHeight: height,
513
512
  maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
514
513
  };
515
-
516
514
  return cellStyle;
517
515
  }, [width, height, isNotVisible]);
518
516
  React.useEffect(() => {
@@ -29,7 +29,6 @@ const VirtualScrollerRoot = styled('div', {
29
29
  },
30
30
  zIndex: 0 // See https://github.com/mui/mui-x/issues/10547
31
31
  });
32
-
33
32
  const GridVirtualScroller = /*#__PURE__*/React.forwardRef(function GridVirtualScroller(props, ref) {
34
33
  const rootProps = useGridRootProps();
35
34
  const classes = useUtilityClasses(rootProps);
@@ -81,7 +81,6 @@ export const useGridCellEditing = (apiRef, props) => {
81
81
  reason = event.shiftKey ? GridCellEditStopReasons.shiftTabKeyDown : GridCellEditStopReasons.tabKeyDown;
82
82
  event.preventDefault(); // Prevent going to the next element in the tab sequence
83
83
  }
84
-
85
84
  if (reason) {
86
85
  const newParams = _extends({}, params, {
87
86
  reason
@@ -175,7 +174,6 @@ export const useGridCellEditing = (apiRef, props) => {
175
174
  if (props.cellModesModel && isNewModelDifferentFromProp) {
176
175
  return; // The prop always win
177
176
  }
178
-
179
177
  setCellModesModel(newModel);
180
178
  cellModesModelRef.current = newModel;
181
179
  apiRef.current.publishEvent('cellModesModelChange', newModel);
@@ -240,7 +240,6 @@ export const useGridRowEditing = (apiRef, props) => {
240
240
  if (props.rowModesModel && isNewModelDifferentFromProp) {
241
241
  return; // The prop always win
242
242
  }
243
-
244
243
  setRowModesModel(newModel);
245
244
  rowModesModelRef.current = newModel;
246
245
  apiRef.current.publishEvent('rowModesModelChange', newModel);
@@ -3,10 +3,10 @@ import { GridFocusState, GridTabIndexState } from './gridFocusState';
3
3
  export declare const gridFocusStateSelector: (state: GridStateCommunity) => GridFocusState;
4
4
  export declare const gridFocusCellSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridCellCoordinates | null>;
5
5
  export declare const gridFocusColumnHeaderSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
6
- export declare const unstable_gridFocusColumnHeaderFilterSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
6
+ export declare const gridFocusColumnHeaderFilterSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
7
7
  export declare const unstable_gridFocusColumnGroupHeaderSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnGroupIdentifier | null>;
8
8
  export declare const gridTabIndexStateSelector: (state: GridStateCommunity) => GridTabIndexState;
9
9
  export declare const gridTabIndexCellSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridCellCoordinates | null>;
10
10
  export declare const gridTabIndexColumnHeaderSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
11
- export declare const unstable_gridTabIndexColumnHeaderFilterSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
11
+ export declare const gridTabIndexColumnHeaderFilterSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnIdentifier | null>;
12
12
  export declare const unstable_gridTabIndexColumnGroupHeaderSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridFocusState").GridColumnGroupIdentifier | null>;
@@ -2,18 +2,14 @@ import { createSelector } from '../../../utils/createSelector';
2
2
  export const gridFocusStateSelector = state => state.focus;
3
3
  export const gridFocusCellSelector = createSelector(gridFocusStateSelector, focusState => focusState.cell);
4
4
  export const gridFocusColumnHeaderSelector = createSelector(gridFocusStateSelector, focusState => focusState.columnHeader);
5
-
6
- // eslint-disable-next-line @typescript-eslint/naming-convention
7
- export const unstable_gridFocusColumnHeaderFilterSelector = createSelector(gridFocusStateSelector, focusState => focusState.columnHeaderFilter);
5
+ export const gridFocusColumnHeaderFilterSelector = createSelector(gridFocusStateSelector, focusState => focusState.columnHeaderFilter);
8
6
 
9
7
  // eslint-disable-next-line @typescript-eslint/naming-convention
10
8
  export const unstable_gridFocusColumnGroupHeaderSelector = createSelector(gridFocusStateSelector, focusState => focusState.columnGroupHeader);
11
9
  export const gridTabIndexStateSelector = state => state.tabIndex;
12
10
  export const gridTabIndexCellSelector = createSelector(gridTabIndexStateSelector, state => state.cell);
13
11
  export const gridTabIndexColumnHeaderSelector = createSelector(gridTabIndexStateSelector, state => state.columnHeader);
14
-
15
- // eslint-disable-next-line @typescript-eslint/naming-convention
16
- export const unstable_gridTabIndexColumnHeaderFilterSelector = createSelector(gridTabIndexStateSelector, state => state.columnHeaderFilter);
12
+ export const gridTabIndexColumnHeaderFilterSelector = createSelector(gridTabIndexStateSelector, state => state.columnHeaderFilter);
17
13
 
18
14
  // eslint-disable-next-line @typescript-eslint/naming-convention
19
15
  export const unstable_gridTabIndexColumnGroupHeaderSelector = createSelector(gridTabIndexStateSelector, state => state.columnGroupHeader);
@@ -1,4 +1,4 @@
1
1
  import { GridStateCommunity } from '../../../models/gridStateCommunity';
2
- export declare const unstable_gridHeaderFilteringStateSelector: (state: GridStateCommunity) => import("../../../models/gridHeaderFilteringModel").GridHeaderFilteringState;
3
- export declare const unstable_gridHeaderFilteringEditFieldSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, string | null>;
4
- export declare const unstable_gridHeaderFilteringMenuSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, string | null>;
2
+ export declare const gridHeaderFilteringStateSelector: (state: GridStateCommunity) => import("../../../models/gridHeaderFilteringModel").GridHeaderFilteringState;
3
+ export declare const gridHeaderFilteringEditFieldSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, string | null>;
4
+ export declare const gridHeaderFilteringMenuSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, string | null>;
@@ -1,5 +1,4 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  import { createSelector } from '../../../utils/createSelector';
3
- export const unstable_gridHeaderFilteringStateSelector = state => state.headerFiltering;
4
- export const unstable_gridHeaderFilteringEditFieldSelector = createSelector(unstable_gridHeaderFilteringStateSelector, headerFilteringState => headerFilteringState.editing);
5
- export const unstable_gridHeaderFilteringMenuSelector = createSelector(unstable_gridHeaderFilteringStateSelector, headerFilteringState => headerFilteringState.menuOpen);
2
+ export const gridHeaderFilteringStateSelector = state => state.headerFiltering;
3
+ export const gridHeaderFilteringEditFieldSelector = createSelector(gridHeaderFilteringStateSelector, headerFilteringState => headerFilteringState.editing);
4
+ export const gridHeaderFilteringMenuSelector = createSelector(gridHeaderFilteringStateSelector, headerFilteringState => headerFilteringState.menuOpen);
@@ -13,7 +13,7 @@ import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPan
13
13
  import { gridPinnedRowsSelector } from '../rows/gridRowsSelector';
14
14
  import { unstable_gridFocusColumnGroupHeaderSelector } from '../focus';
15
15
  import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
16
- import { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
16
+ import { gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
17
17
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
18
18
  import { isEventTargetInPortal } from '../../../utils/domUtils';
19
19
  function enrichPageRowsWithPinnedRows(apiRef, rows) {
@@ -71,7 +71,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
71
71
  const currentPageRows = React.useMemo(() => enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows), [apiRef, initialCurrentPageRows]);
72
72
  const headerFilteringEnabled =
73
73
  // @ts-expect-error // TODO move relevant code to the `DataGridPro`
74
- props.signature !== 'DataGrid' && props.unstable_headerFilters;
74
+ props.signature !== 'DataGrid' && props.headerFilters;
75
75
 
76
76
  /**
77
77
  * @param {number} colIndex Index of the column to focus
@@ -238,8 +238,8 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
238
238
  if (!dimensions) {
239
239
  return;
240
240
  }
241
- const isEditing = unstable_gridHeaderFilteringEditFieldSelector(apiRef) === params.field;
242
- const isHeaderMenuOpen = unstable_gridHeaderFilteringMenuSelector(apiRef) === params.field;
241
+ const isEditing = gridHeaderFilteringEditFieldSelector(apiRef) === params.field;
242
+ const isHeaderMenuOpen = gridHeaderFilteringMenuSelector(apiRef) === params.field;
243
243
  if (isEditing || isHeaderMenuOpen || !isNavigationKey(event.key)) {
244
244
  return;
245
245
  }
@@ -507,7 +507,9 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
507
507
  break;
508
508
  }
509
509
  const colDef = params.colDef;
510
- if (colDef && colDef.type === 'treeDataGroup') {
510
+ if (colDef &&
511
+ // `GRID_TREE_DATA_GROUPING_FIELD` from the Pro package
512
+ colDef.field === '__tree_data_group__') {
511
513
  break;
512
514
  }
513
515
  if (!event.shiftKey && rowIndexBefore < lastRowIndexInPage) {
@@ -68,7 +68,6 @@ export const useGridRowsMeta = (apiRef, props) => {
68
68
  needsFirstMeasurement: true // Assume all rows will need to be measured by default
69
69
  };
70
70
  }
71
-
72
71
  const {
73
72
  isResized,
74
73
  needsFirstMeasurement,
@@ -555,7 +555,6 @@ export const useGridVirtualScroller = props => {
555
555
  if (rootProps.autoHeight && currentPage.rows.length === 0) {
556
556
  size.height = getMinimalContentHeight(apiRef, rootProps.rowHeight); // Give room to show the overlay when there no rows.
557
557
  }
558
-
559
558
  return size;
560
559
  }, [apiRef, rootRef, columnsTotalWidth, rowsMeta.currentPageTotalHeight, needsHorizontalScrollbar, rootProps.autoHeight, rootProps.rowHeight, currentPage.rows.length]);
561
560
  React.useEffect(() => {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.0.0-alpha.3
2
+ * @mui/x-data-grid v7.0.0-alpha.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -14,7 +14,7 @@ export { useGridInitialization } from '../hooks/core/useGridInitialization';
14
14
  export { unwrapPrivateAPI } from '../hooks/core/useGridApiInitialization';
15
15
  export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
16
16
  export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
17
- export { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector, } from '../hooks/features/headerFiltering/gridHeaderFilteringSelectors';
17
+ export { gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector, } from '../hooks/features/headerFiltering/gridHeaderFilteringSelectors';
18
18
  export type { GridSlotsComponentsProps } from '../models/gridSlotsComponentsProps';
19
19
  export type { UseGridColumnHeadersProps, GetHeadersParams, } from '../hooks/features/columnHeaders/useGridColumnHeaders';
20
20
  export { useGridColumnMenu, columnMenuStateInitializer, } from '../hooks/features/columnMenu/useGridColumnMenu';
@@ -11,7 +11,7 @@ export { useGridInitialization } from '../hooks/core/useGridInitialization';
11
11
  export { unwrapPrivateAPI } from '../hooks/core/useGridApiInitialization';
12
12
  export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
13
13
  export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
14
- export { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../hooks/features/headerFiltering/gridHeaderFilteringSelectors';
14
+ export { gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector } from '../hooks/features/headerFiltering/gridHeaderFilteringSelectors';
15
15
  export { useGridColumnMenu, columnMenuStateInitializer } from '../hooks/features/columnMenu/useGridColumnMenu';
16
16
  export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
17
17
  export { getTotalHeaderHeight } from '../hooks/features/columns/gridColumnsUtils';
@@ -7,8 +7,8 @@ import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export var GRID_CHECKBOX_SELECTION_FIELD = '__check__';
9
9
  export var GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF, {
10
+ type: 'custom',
10
11
  field: GRID_CHECKBOX_SELECTION_FIELD,
11
- type: 'checkboxSelection',
12
12
  width: 50,
13
13
  resizable: false,
14
14
  sortable: false,
@@ -5,7 +5,7 @@ import { GRID_DATE_COL_DEF, GRID_DATETIME_COL_DEF } from './gridDateColDef';
5
5
  import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
6
6
  import { GRID_SINGLE_SELECT_COL_DEF } from './gridSingleSelectColDef';
7
7
  import { GRID_ACTIONS_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from './gridActionsColDef';
8
- export var DEFAULT_GRID_COL_TYPE_KEY = '__default__';
8
+ export var DEFAULT_GRID_COL_TYPE_KEY = 'string';
9
9
  export var getGridDefaultColumnTypes = function getGridDefaultColumnTypes() {
10
10
  var nativeColumnTypes = _defineProperty(_defineProperty({
11
11
  string: GRID_STRING_COL_DEF,
@@ -14,6 +14,6 @@ export var getGridDefaultColumnTypes = function getGridDefaultColumnTypes() {
14
14
  dateTime: GRID_DATETIME_COL_DEF,
15
15
  boolean: GRID_BOOLEAN_COL_DEF,
16
16
  singleSelect: GRID_SINGLE_SELECT_COL_DEF
17
- }, GRID_ACTIONS_COLUMN_TYPE, GRID_ACTIONS_COL_DEF), DEFAULT_GRID_COL_TYPE_KEY, GRID_STRING_COL_DEF);
17
+ }, GRID_ACTIONS_COLUMN_TYPE, GRID_ACTIONS_COL_DEF), "custom", GRID_STRING_COL_DEF);
18
18
  return nativeColumnTypes;
19
19
  };
@@ -52,7 +52,6 @@ function EmptyCell(_ref) {
52
52
  style: style
53
53
  }); // TODO change to .MuiDataGrid-emptyCell or .MuiDataGrid-rowFiller
54
54
  }
55
-
56
55
  var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
57
56
  var selected = props.selected,
58
57
  hovered = props.hovered,
@@ -197,7 +196,13 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
197
196
  var rowReordering = rootProps.rowReordering;
198
197
  var getCell = function getCell(column, cellProps) {
199
198
  var _editRowsState$rowId$, _editRowsState$rowId;
200
- var disableDragEvents = disableColumnReorder && column.disableReorder || !rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
199
+ // when the cell is a reorder cell we are not allowing to reorder the col
200
+ // fixes https://github.com/mui/mui-x/issues/11126
201
+ var isReorderCell = column.field === '__reorder__';
202
+ var isEditingRows = Object.keys(editRowsState).length > 0;
203
+ var canReorderColumn = !(disableColumnReorder || column.disableReorder);
204
+ var canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
205
+ var disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
201
206
  var editCellState = (_editRowsState$rowId$ = (_editRowsState$rowId = editRowsState[rowId]) == null ? void 0 : _editRowsState$rowId[column.field]) != null ? _editRowsState$rowId$ : null;
202
207
  var cellIsNotVisible = false;
203
208
  if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
@@ -37,7 +37,6 @@ var GridOverlayWrapperRoot = styled('div', {
37
37
  : 4 // Should be above pinned columns and detail panel
38
38
  };
39
39
  });
40
-
41
40
  var GridOverlayWrapperInner = styled('div', {
42
41
  name: 'MuiDataGrid',
43
42
  slot: 'OverlayWrapperInner',
@@ -78,7 +77,6 @@ function GridOverlayWrapper(props) {
78
77
  if (rootProps.autoHeight && height === 0) {
79
78
  height = getMinimalContentHeight(apiRef, rootProps.rowHeight); // Give room to show the overlay when there no rows.
80
79
  }
81
-
82
80
  var classes = useUtilityClasses(_extends({}, props, {
83
81
  classes: rootProps.classes
84
82
  }));
@@ -159,7 +159,6 @@ function GridActionsCell(props) {
159
159
  if (newIndex < 0 || newIndex >= numberOfButtons) {
160
160
  return; // We're already in the first or last item = do nothing and let the grid listen the event
161
161
  }
162
-
163
162
  if (newIndex !== focusedButtonIndex) {
164
163
  event.preventDefault(); // Prevent scrolling
165
164
  event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
@@ -244,7 +244,6 @@ var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
244
244
  minHeight: height,
245
245
  maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
246
246
  };
247
-
248
247
  return cellStyle;
249
248
  }, [width, height, isNotVisible]);
250
249
  React.useEffect(function () {
@@ -520,7 +519,6 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
520
519
  minHeight: height,
521
520
  maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
522
521
  };
523
-
524
522
  return cellStyle;
525
523
  }, [width, height, isNotVisible]);
526
524
  React.useEffect(function () {
@@ -29,7 +29,6 @@ var VirtualScrollerRoot = styled('div', {
29
29
  },
30
30
  zIndex: 0 // See https://github.com/mui/mui-x/issues/10547
31
31
  });
32
-
33
32
  var GridVirtualScroller = /*#__PURE__*/React.forwardRef(function GridVirtualScroller(props, ref) {
34
33
  var rootProps = useGridRootProps();
35
34
  var classes = useUtilityClasses(rootProps);
@@ -88,7 +88,6 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
88
88
  reason = event.shiftKey ? GridCellEditStopReasons.shiftTabKeyDown : GridCellEditStopReasons.tabKeyDown;
89
89
  event.preventDefault(); // Prevent going to the next element in the tab sequence
90
90
  }
91
-
92
91
  if (reason) {
93
92
  var newParams = _extends({}, params, {
94
93
  reason: reason
@@ -178,7 +177,6 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
178
177
  if (props.cellModesModel && isNewModelDifferentFromProp) {
179
178
  return; // The prop always win
180
179
  }
181
-
182
180
  setCellModesModel(newModel);
183
181
  cellModesModelRef.current = newModel;
184
182
  apiRef.current.publishEvent('cellModesModelChange', newModel);
@@ -243,7 +243,6 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
243
243
  if (props.rowModesModel && isNewModelDifferentFromProp) {
244
244
  return; // The prop always win
245
245
  }
246
-
247
246
  setRowModesModel(newModel);
248
247
  rowModesModelRef.current = newModel;
249
248
  apiRef.current.publishEvent('rowModesModelChange', newModel);
@@ -8,9 +8,7 @@ export var gridFocusCellSelector = createSelector(gridFocusStateSelector, functi
8
8
  export var gridFocusColumnHeaderSelector = createSelector(gridFocusStateSelector, function (focusState) {
9
9
  return focusState.columnHeader;
10
10
  });
11
-
12
- // eslint-disable-next-line @typescript-eslint/naming-convention
13
- export var unstable_gridFocusColumnHeaderFilterSelector = createSelector(gridFocusStateSelector, function (focusState) {
11
+ export var gridFocusColumnHeaderFilterSelector = createSelector(gridFocusStateSelector, function (focusState) {
14
12
  return focusState.columnHeaderFilter;
15
13
  });
16
14
 
@@ -27,9 +25,7 @@ export var gridTabIndexCellSelector = createSelector(gridTabIndexStateSelector,
27
25
  export var gridTabIndexColumnHeaderSelector = createSelector(gridTabIndexStateSelector, function (state) {
28
26
  return state.columnHeader;
29
27
  });
30
-
31
- // eslint-disable-next-line @typescript-eslint/naming-convention
32
- export var unstable_gridTabIndexColumnHeaderFilterSelector = createSelector(gridTabIndexStateSelector, function (state) {
28
+ export var gridTabIndexColumnHeaderFilterSelector = createSelector(gridTabIndexStateSelector, function (state) {
33
29
  return state.columnHeaderFilter;
34
30
  });
35
31
 
@@ -1,11 +1,10 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  import { createSelector } from '../../../utils/createSelector';
3
- export var unstable_gridHeaderFilteringStateSelector = function unstable_gridHeaderFilteringStateSelector(state) {
2
+ export var gridHeaderFilteringStateSelector = function gridHeaderFilteringStateSelector(state) {
4
3
  return state.headerFiltering;
5
4
  };
6
- export var unstable_gridHeaderFilteringEditFieldSelector = createSelector(unstable_gridHeaderFilteringStateSelector, function (headerFilteringState) {
5
+ export var gridHeaderFilteringEditFieldSelector = createSelector(gridHeaderFilteringStateSelector, function (headerFilteringState) {
7
6
  return headerFilteringState.editing;
8
7
  });
9
- export var unstable_gridHeaderFilteringMenuSelector = createSelector(unstable_gridHeaderFilteringStateSelector, function (headerFilteringState) {
8
+ export var gridHeaderFilteringMenuSelector = createSelector(gridHeaderFilteringStateSelector, function (headerFilteringState) {
10
9
  return headerFilteringState.menuOpen;
11
10
  });