@mui/x-data-grid-pro 5.15.1 → 5.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/DataGridPro/DataGridPro.js +4 -2
  3. package/DataGridPro/useDataGridProComponent.js +4 -1
  4. package/README.md +2 -1
  5. package/components/DataGridProColumnHeaders.js +25 -13
  6. package/hooks/features/columnReorder/useGridColumnReorder.js +95 -3
  7. package/hooks/features/columnResize/useGridColumnResize.js +10 -7
  8. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +4 -4
  9. package/hooks/features/treeData/gridTreeDataUtils.d.ts +2 -1
  10. package/hooks/features/treeData/gridTreeDataUtils.js +7 -2
  11. package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  12. package/index.js +1 -1
  13. package/legacy/DataGridPro/DataGridPro.js +4 -2
  14. package/legacy/DataGridPro/useDataGridProComponent.js +4 -1
  15. package/legacy/components/DataGridProColumnHeaders.js +25 -13
  16. package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +99 -3
  17. package/legacy/hooks/features/columnResize/useGridColumnResize.js +11 -7
  18. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +7 -2
  19. package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  20. package/legacy/index.js +1 -1
  21. package/legacy/utils/domUtils.js +5 -0
  22. package/legacy/utils/releaseInfo.js +1 -1
  23. package/modern/DataGridPro/DataGridPro.js +4 -2
  24. package/modern/DataGridPro/useDataGridProComponent.js +4 -1
  25. package/modern/components/DataGridProColumnHeaders.js +25 -13
  26. package/modern/hooks/features/columnReorder/useGridColumnReorder.js +83 -3
  27. package/modern/hooks/features/columnResize/useGridColumnResize.js +5 -2
  28. package/modern/hooks/features/treeData/gridTreeDataUtils.js +7 -2
  29. package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  30. package/modern/index.js +1 -1
  31. package/modern/utils/domUtils.js +3 -0
  32. package/modern/utils/releaseInfo.js +1 -1
  33. package/node/DataGridPro/DataGridPro.js +4 -2
  34. package/node/DataGridPro/useDataGridProComponent.js +3 -0
  35. package/node/components/DataGridProColumnHeaders.js +25 -12
  36. package/node/hooks/features/columnReorder/useGridColumnReorder.js +95 -3
  37. package/node/hooks/features/columnResize/useGridColumnResize.js +9 -6
  38. package/node/hooks/features/treeData/gridTreeDataUtils.js +9 -2
  39. package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  40. package/node/index.js +1 -1
  41. package/node/utils/domUtils.js +7 -0
  42. package/node/utils/releaseInfo.js +1 -1
  43. package/package.json +5 -5
  44. package/utils/domUtils.d.ts +1 -0
  45. package/utils/domUtils.js +5 -0
  46. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,148 @@
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
+ ## 5.16.0
7
+
8
+ _Aug 25, 2022_
9
+
10
+ We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Introduce column grouping for data grid (#5133) @alexfauquette
13
+
14
+ You can now group columns using the `columnGroupingModel` prop. This lets you to display more structured data.
15
+
16
+ <img src="https://user-images.githubusercontent.com/45398769/186178366-4fba66b2-bf90-4c7a-9d83-940a7fc78704.png" width="800" />
17
+
18
+ To enable this feature, add `experimentalFeatures={{ columnGrouping: true }}`.
19
+ The grouping header can be fully customized.
20
+ See the [documentation](https://mui.com/x/react-data-grid/column-groups/) to explore everything it has to offer.
21
+
22
+ - 🐞 Bugfixes
23
+ - 🌏 New locales for pickers thanks to @tesseractjh and @drastus
24
+
25
+ ### `@mui/x-data-grid@v5.16.0` / `@mui/x-data-grid-pro@v5.16.0` / `@mui/x-data-grid-premium@v5.16.0`
26
+
27
+ #### Changes
28
+
29
+ - [DataGrid] Implement column grouping (#5133) @alexfauquette
30
+ - [DataGrid] Handle `disableVirtualization` prop change (#5889) @cherniavskii
31
+ - [DataGrid] Improve `GridRowModel` typing (#5734) @cherniavskii
32
+ - [DataGrid] Update deprecation note for `GridColDef` `hide` property (#5886) @cherniavskii
33
+
34
+ ### `@mui/x-date-pickers@v5.0.0-beta.7` / `@mui/x-date-pickers-pro@v5.0.0-beta.7`
35
+
36
+ #### Changes
37
+
38
+ - [DatePicker] Fix to pass down `className` prop provided on DatePicker to `renderInput` (#5471) @CruseCtrl
39
+ - [DatePicker] Improve `a11y` support (#5809) @LukasTy
40
+ - [pickers] Add `PaperContent` component slot (#5801) @LukasTy
41
+ - [pickers] Add a breaking change section in the migration guide (#5805) @alexfauquette
42
+ - [pickers] Add new translations to `localeText` (#5143) @alexfauquette
43
+ - [pickers] Document components slots (#4657) @flaviendelangle
44
+ - [pickers] Add new unstable field components (#5504) @flaviendelangle
45
+ - [pickers] Fallback to default `minDate` / `maxDate` when `null` value is passed (#5397) @flaviendelangle
46
+ - [l10n] Add Korean (ko-KR) locale (#5854) @tesseractjh
47
+ - [l10n] Add Polish (pl-PL) locale (#5833) @drastus
48
+
49
+ ### Docs
50
+
51
+ - [docs] Fix typo in `migration from lab` (#5277) @chuckwired
52
+ - [docs] Use `dayjs` instead of `date-fns` in doc examples (#5481) @flaviendelangle
53
+
54
+ ### Core
55
+
56
+ - [core] Clarify the scope of the license key used for tests and documentation (#5824) @oliviertassinari
57
+ - [core] Fix Typescript error on field hooks (#5892) @flaviendelangle
58
+ - [core] Memoize `columns` in `useDemoData` hook (#5848) @cherniavskii
59
+ - [core] Remove Firefox from the BrowserStack list (#5874) @DanailH
60
+ - [core] Small changes to the release script (#5840) @m4theushw
61
+
62
+ ## 5.15.3
63
+
64
+ _Aug 18, 2022_
65
+
66
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
67
+
68
+ - 📚 Documentation improvements
69
+ - 🐞 Bugfixes
70
+
71
+ ### `@mui/x-data-grid@v5.15.3` / `@mui/x-data-grid-pro@v5.15.3` / `@mui/x-data-grid-premium@v5.15.3`
72
+
73
+ #### Changes
74
+
75
+ - [DataGrid] Fix <kbd>Enter</kbd> causing Select to re-open when commiting value (#5756) @m4theushw
76
+ - [DataGrid] Fix `GridOverlays` bypassing pointer events (#5674) @philjones88
77
+
78
+ ### `@mui/x-date-pickers@v5.0.0-beta.6` / `@mui/x-date-picker-pro@v5.0.0-beta.6`
79
+
80
+ #### Changes
81
+
82
+ - [DatePicker] Support click on day outside of current month (#5768) @alexfauquette
83
+ - [pickers] Extend `PickersActionBarProps` with `DialogActionProps` (#5798) @LukasTy
84
+
85
+ ### Docs
86
+
87
+ - [docs] Fix API anchor link scroll top (#5795) @oliviertassinari
88
+ - [docs] Fix contradiction in the free trial clause (#5732) @oliviertassinari
89
+ - [docs] Fix default value of the DataGrid `logLevel` prop to false (#5784) @HwangTaehyun
90
+ - [docs] Fix typo on the row height page (#5772) @flaviendelangle
91
+ - [docs] Improve "upgrading plans" documentation. (#5683) @joserodolfofreitas
92
+ - [docs] Link the license docs before pricing (#5726) @oliviertassinari
93
+ - [docs] Update packages README files (#5835) @cherniavskii
94
+ - [docs] Use `InputBase` for pickers inputs (#5597) @cherniavskii
95
+
96
+ ### Core
97
+
98
+ - [core] Upgrade monorepo (#5771, #5797) @cherniavskii
99
+ - [core] Various TS improvements (#5556) @flaviendelangle
100
+ - [license] Give more context in the missing license (#5731) @oliviertassinari
101
+ - [license] Only log an error type once (#5730) @oliviertassinari
102
+ - [test] Increase timeout to take print screenshot (#5799) @m4theushw
103
+
104
+ ## 5.15.2
105
+
106
+ _Aug 11, 2022_
107
+
108
+ We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
109
+
110
+ - ✨ Improve quick filtering with row grouping (#5701) @alexfauquette
111
+ - 📚 Documentation improvements
112
+ - 🐞 Bugfixes
113
+
114
+ ### `@mui/x-data-grid@v5.15.2` / `@mui/x-data-grid-pro@v5.15.2` / `@mui/x-data-grid-premium@v5.15.2`
115
+
116
+ #### Changes
117
+
118
+ - [DataGrid] Catch errors if rows freezing is not supported (#5711) @cherniavskii
119
+ - [DataGrid] Preserve cell mode when entering edit mode while commiting (#5686) @m4theushw
120
+ - [DataGridPremium] Let quick filter search in row grouping children (#5701) @alexfauquette
121
+
122
+ ### `@mui/x-date-pickers@v5.0.0-beta.5` / `@mui/x-date-picker-pro@5.0.0-beta.5`
123
+
124
+ #### Changes
125
+
126
+ - [pickers] Add `react-dom` to peerDependencies (#5752) @cherniavskii
127
+ - [TimePicker] Set clock focus outline to `none` (#5758) @LukasTy
128
+ - [pickers] Fix theme augmentation with TypeScript (#5596) @alexfauquette
129
+ - [pickers] Reset input value when locale is modified (#5310) @alexfauquette
130
+ - [pickers] Support `disableHighlightToday` on `MonthPicker` and `YearPicker` (#5562) @flaviendelangle
131
+ - [pickers] Fallback to desktop mode when `matchMedia` is unavailable (#5684) @LukasTy
132
+ - [pickers] Trigger `onChange` when clearing or accepting `Invalid date` (#5740) @LukasTy
133
+
134
+ ### Docs
135
+
136
+ - [docs] Add RFC GH issue template (#5739) @bytasv
137
+ - [docs] Add description to the `GridExportStateParams` page (#5654) @oliviertassinari
138
+ - [docs] Improve the Events page (#5413) @flaviendelangle
139
+ - [docs] Use new editing API in the introduction demos (#5728) @oliviertassinari
140
+
141
+ ### Core
142
+
143
+ - [core] Remove duplicated `FUNDING.yml` file (#5656) @oliviertassinari
144
+ - [core] Remove outdated Next.js options (#5727) @oliviertassinari
145
+ - [core] Update tooling to run with React 18 (#4155) @m4theushw
146
+ - [test] Fix failing dynamic row height tests on Edge (#5707) @m4theushw
147
+
6
148
  ## 5.15.1
7
149
 
8
150
  _Aug 4, 2022_
@@ -106,6 +106,7 @@ DataGridProRaw.propTypes = {
106
106
  * @default 3
107
107
  */
108
108
  columnBuffer: PropTypes.number,
109
+ columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
109
110
 
110
111
  /**
111
112
  * Set of columns of type [[GridColumns]].
@@ -274,6 +275,7 @@ DataGridProRaw.propTypes = {
274
275
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
275
276
  */
276
277
  experimentalFeatures: PropTypes.shape({
278
+ columnGrouping: PropTypes.bool,
277
279
  newEditingApi: PropTypes.bool,
278
280
  preventCommitWhileValidating: PropTypes.bool,
279
281
  rowPinning: PropTypes.bool,
@@ -478,7 +480,7 @@ DataGridProRaw.propTypes = {
478
480
 
479
481
  /**
480
482
  * Allows to pass the logging level or false to turn off logging.
481
- * @default "debug"
483
+ * @default "error" ("warn" in dev mode)
482
484
  */
483
485
  logLevel: PropTypes.oneOf(['debug', 'error', 'info', 'warn', false]),
484
486
 
@@ -822,7 +824,7 @@ DataGridProRaw.propTypes = {
822
824
  * @param {GridState} state The new state.
823
825
  * @param {MuiEvent<{}>} event The event object.
824
826
  * @param {GridCallbackDetails} details Additional details for this callback.
825
- * @internal
827
+ * @ignore - do not document.
826
828
  */
827
829
  onStateChange: PropTypes.func,
828
830
 
@@ -1,4 +1,4 @@
1
- import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer } from '@mui/x-data-grid/internals';
1
+ import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridColumnGroupingPreProcessors } from '@mui/x-data-grid/internals';
2
2
  // Pro-only features
3
3
  import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
4
4
  import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
@@ -21,6 +21,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
21
21
  * Register all pre-processors called during state initialization here.
22
22
  */
23
23
 
24
+ useGridColumnGroupingPreProcessors(apiRef, props);
24
25
  useGridSelectionPreProcessors(apiRef, props);
25
26
  useGridRowReorderPreProcessors(apiRef, props);
26
27
  useGridTreeDataPreProcessors(apiRef, props);
@@ -51,6 +52,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
51
52
  useGridInitializeState(paginationStateInitializer, apiRef, props);
52
53
  useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
53
54
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
55
+ useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
54
56
  useGridTreeData(apiRef);
55
57
  useGridKeyboardNavigation(apiRef, props);
56
58
  useGridSelection(apiRef, props);
@@ -61,6 +63,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
61
63
  useGridParamsApi(apiRef);
62
64
  useGridDetailPanel(apiRef, props);
63
65
  useGridColumnSpanning(apiRef);
66
+ useGridColumnGrouping(apiRef, props);
64
67
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
65
68
  useGridEditing(apiRef, props);
66
69
  useGridFocus(apiRef, props);
package/README.md CHANGED
@@ -21,7 +21,8 @@ This component has the following peer dependencies that you will need to install
21
21
  "peerDependencies": {
22
22
  "@mui/material": "^5.4.1",
23
23
  "@mui/system": "^5.4.1",
24
- "react": "^17.0.2 || ^18.0.0"
24
+ "react": "^17.0.2 || ^18.0.0",
25
+ "react-dom": "^17.0.2 || ^18.0.0"
25
26
  },
26
27
  ```
27
28
 
@@ -11,7 +11,6 @@ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
11
11
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
12
12
  import { gridPinnedColumnsSelector, GridPinnedPosition } from '../hooks/features/columnPinning';
13
13
  import { filterColumns } from './DataGridProVirtualScroller';
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
15
 
17
16
  const useUtilityClasses = ownerState => {
@@ -57,6 +56,7 @@ const GridColumnHeadersPinnedColumnHeaders = styled('div', {
57
56
  height: '100%',
58
57
  zIndex: 1,
59
58
  display: 'flex',
59
+ flexDirection: 'column',
60
60
  boxShadow: theme.shadows[2],
61
61
  backgroundColor: theme.palette.background.default
62
62
  }, theme.palette.mode === 'dark' && {
@@ -98,7 +98,8 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
98
98
  renderContext,
99
99
  getRootProps,
100
100
  getInnerProps,
101
- getColumns
101
+ getColumnHeaders,
102
+ getColumnGroupHeaders
102
103
  } = useGridColumnHeaders({
103
104
  innerRef,
104
105
  minColumnIndex: leftPinnedColumns.length
@@ -119,35 +120,42 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
119
120
  }) : null;
120
121
  const innerProps = getInnerProps();
121
122
  const pinnedColumnHeadersProps = {
122
- role: innerProps.role,
123
- 'aria-rowindex': innerProps['aria-rowindex']
123
+ role: innerProps.role
124
124
  };
125
125
  return /*#__PURE__*/_jsxs(GridColumnHeaders, _extends({
126
126
  ref: ref,
127
127
  className: className
128
128
  }, getRootProps(other), {
129
- children: [leftRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, _extends({
129
+ children: [leftRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
130
130
  className: classes.leftPinnedColumns,
131
131
  ownerState: {
132
132
  side: GridPinnedPosition.left
133
133
  }
134
134
  }, pinnedColumnHeadersProps, {
135
- children: getColumns({
135
+ children: [getColumnGroupHeaders({
136
+ renderContext: leftRenderContext,
137
+ minFirstColumn: leftRenderContext.firstColumnIndex,
138
+ maxLastColumn: leftRenderContext.lastColumnIndex
139
+ }), getColumnHeaders({
136
140
  renderContext: leftRenderContext,
137
141
  minFirstColumn: leftRenderContext.firstColumnIndex,
138
142
  maxLastColumn: leftRenderContext.lastColumnIndex
139
143
  }, {
140
144
  disableReorder: true
141
- })
142
- })), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
145
+ })]
146
+ })), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
143
147
  isDragging: isDragging
144
148
  }, innerProps, {
145
- children: getColumns({
149
+ children: [getColumnGroupHeaders({
146
150
  renderContext,
147
151
  minFirstColumn: leftPinnedColumns.length,
148
152
  maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
149
- })
150
- })), rightRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, _extends({
153
+ }), getColumnHeaders({
154
+ renderContext,
155
+ minFirstColumn: leftPinnedColumns.length,
156
+ maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
157
+ })]
158
+ })), rightRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
151
159
  ownerState: {
152
160
  side: GridPinnedPosition.right
153
161
  },
@@ -156,14 +164,18 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
156
164
  paddingRight: scrollbarSize
157
165
  }
158
166
  }, pinnedColumnHeadersProps, {
159
- children: getColumns({
167
+ children: [getColumnGroupHeaders({
168
+ renderContext: rightRenderContext,
169
+ minFirstColumn: rightRenderContext.firstColumnIndex,
170
+ maxLastColumn: rightRenderContext.lastColumnIndex
171
+ }), getColumnHeaders({
160
172
  renderContext: rightRenderContext,
161
173
  minFirstColumn: rightRenderContext.firstColumnIndex,
162
174
  maxLastColumn: rightRenderContext.lastColumnIndex
163
175
  }, {
164
176
  disableReorder: true,
165
177
  separatorSide: GridColumnHeaderSeparatorSides.Left
166
- })
178
+ })]
167
179
  }))]
168
180
  }));
169
181
  });
@@ -39,6 +39,7 @@ export const useGridColumnReorder = (apiRef, props) => {
39
39
  y: 0
40
40
  });
41
41
  const originColumnIndex = React.useRef(null);
42
+ const forbiddenIndexes = React.useRef({});
42
43
  const removeDnDStylesTimeout = React.useRef();
43
44
  const ownerState = {
44
45
  classes: props.classes
@@ -70,6 +71,69 @@ export const useGridColumnReorder = (apiRef, props) => {
70
71
  dragColNode.current.classList.remove(classes.columnHeaderDragging);
71
72
  });
72
73
  originColumnIndex.current = apiRef.current.getColumnIndex(params.field, false);
74
+ const draggingColumnGroupPath = apiRef.current.unstable_getColumnGroupPath(params.field);
75
+ const columnIndex = originColumnIndex.current;
76
+ const allColumns = apiRef.current.getAllColumns();
77
+ const groupsLookup = apiRef.current.unstable_getAllGroupDetails(); // The limitingGroupId is the id of the group from which the dragged column should not escape
78
+
79
+ let limitingGroupId = null;
80
+ draggingColumnGroupPath.forEach(groupId => {
81
+ var _groupsLookup$groupId;
82
+
83
+ if (!((_groupsLookup$groupId = groupsLookup[groupId]) != null && _groupsLookup$groupId.freeReordering)) {
84
+ var _allColumns$groupPath, _allColumns$groupPath2;
85
+
86
+ // Only consider group that are made of more than one column
87
+ if (columnIndex > 0 && (_allColumns$groupPath = allColumns[columnIndex - 1].groupPath) != null && _allColumns$groupPath.includes(groupId)) {
88
+ limitingGroupId = groupId;
89
+ } else if (columnIndex + 1 < allColumns.length && (_allColumns$groupPath2 = allColumns[columnIndex + 1].groupPath) != null && _allColumns$groupPath2.includes(groupId)) {
90
+ limitingGroupId = groupId;
91
+ }
92
+ }
93
+ });
94
+ forbiddenIndexes.current = {};
95
+
96
+ for (let indexToForbid = 0; indexToForbid < allColumns.length; indexToForbid += 1) {
97
+ const leftIndex = indexToForbid <= columnIndex ? indexToForbid - 1 : indexToForbid;
98
+ const rightIndex = indexToForbid < columnIndex ? indexToForbid : indexToForbid + 1;
99
+
100
+ if (limitingGroupId !== null) {
101
+ var _allColumns$leftIndex, _allColumns$rightInde;
102
+
103
+ // verify this indexToForbid will be linked to the limiting group. Otherwise forbid it
104
+ let allowIndex = false;
105
+
106
+ if (leftIndex >= 0 && (_allColumns$leftIndex = allColumns[leftIndex].groupPath) != null && _allColumns$leftIndex.includes(limitingGroupId)) {
107
+ allowIndex = true;
108
+ } else if (rightIndex < allColumns.length && (_allColumns$rightInde = allColumns[rightIndex].groupPath) != null && _allColumns$rightInde.includes(limitingGroupId)) {
109
+ allowIndex = true;
110
+ }
111
+
112
+ if (!allowIndex) {
113
+ forbiddenIndexes.current[indexToForbid] = true;
114
+ }
115
+ } // Verify we are not splitting another group
116
+
117
+
118
+ if (leftIndex >= 0 && rightIndex < allColumns.length) {
119
+ var _allColumns$rightInde2, _allColumns$rightInde3;
120
+
121
+ (_allColumns$rightInde2 = allColumns[rightIndex]) == null ? void 0 : (_allColumns$rightInde3 = _allColumns$rightInde2.groupPath) == null ? void 0 : _allColumns$rightInde3.forEach(groupId => {
122
+ var _allColumns$leftIndex2;
123
+
124
+ if ((_allColumns$leftIndex2 = allColumns[leftIndex].groupPath) != null && _allColumns$leftIndex2.includes(groupId)) {
125
+ if (!draggingColumnGroupPath.includes(groupId)) {
126
+ var _groupsLookup$groupId2;
127
+
128
+ // moving here split the group groupId in two distincts chunks
129
+ if (!((_groupsLookup$groupId2 = groupsLookup[groupId]) != null && _groupsLookup$groupId2.freeReordering)) {
130
+ forbiddenIndexes.current[indexToForbid] = true;
131
+ }
132
+ }
133
+ }
134
+ });
135
+ }
136
+ }
73
137
  }, [props.disableColumnReorder, classes.columnHeaderDragging, logger, apiRef]);
74
138
  const handleDragEnter = React.useCallback((params, event) => {
75
139
  event.preventDefault(); // Prevent drag events propagation.
@@ -100,19 +164,47 @@ export const useGridColumnReorder = (apiRef, props) => {
100
164
  const targetCol = apiRef.current.getColumn(params.field);
101
165
  const dragColIndex = apiRef.current.getColumnIndex(dragColField, false);
102
166
  const visibleColumns = apiRef.current.getVisibleColumns();
167
+ const allColumns = apiRef.current.getAllColumns();
103
168
  const cursorMoveDirectionX = getCursorMoveDirectionX(cursorPosition.current, coordinates);
104
169
  const hasMovedLeft = cursorMoveDirectionX === CURSOR_MOVE_DIRECTION_LEFT && targetColIndex < dragColIndex;
105
170
  const hasMovedRight = cursorMoveDirectionX === CURSOR_MOVE_DIRECTION_RIGHT && dragColIndex < targetColIndex;
106
171
 
107
172
  if (hasMovedLeft || hasMovedRight) {
108
173
  let canBeReordered;
174
+ let indexOffsetInHiddenColumns = 0;
109
175
 
110
176
  if (!targetCol.disableReorder) {
111
177
  canBeReordered = true;
112
178
  } else if (hasMovedLeft) {
113
- canBeReordered = targetColIndex > 0 && !visibleColumns[targetColIndex - 1].disableReorder;
179
+ canBeReordered = targetColVisibleIndex > 0 && !visibleColumns[targetColVisibleIndex - 1].disableReorder;
114
180
  } else {
115
- canBeReordered = targetColIndex < visibleColumns.length - 1 && !visibleColumns[targetColIndex + 1].disableReorder;
181
+ canBeReordered = targetColVisibleIndex < visibleColumns.length - 1 && !visibleColumns[targetColVisibleIndex + 1].disableReorder;
182
+ }
183
+
184
+ if (forbiddenIndexes.current[targetColIndex]) {
185
+ let nextVisibleColumnField;
186
+ let indexWithOffset = targetColIndex + indexOffsetInHiddenColumns;
187
+
188
+ if (hasMovedLeft) {
189
+ nextVisibleColumnField = targetColVisibleIndex > 0 ? visibleColumns[targetColVisibleIndex - 1].field : null;
190
+
191
+ while (indexWithOffset > 0 && allColumns[indexWithOffset].field !== nextVisibleColumnField && forbiddenIndexes.current[indexWithOffset]) {
192
+ indexOffsetInHiddenColumns -= 1;
193
+ indexWithOffset = targetColIndex + indexOffsetInHiddenColumns;
194
+ }
195
+ } else {
196
+ nextVisibleColumnField = targetColVisibleIndex + 1 < visibleColumns.length ? visibleColumns[targetColVisibleIndex + 1].field : null;
197
+
198
+ while (indexWithOffset < allColumns.length - 1 && allColumns[indexWithOffset].field !== nextVisibleColumnField && forbiddenIndexes.current[indexWithOffset]) {
199
+ indexOffsetInHiddenColumns += 1;
200
+ indexWithOffset = targetColIndex + indexOffsetInHiddenColumns;
201
+ }
202
+ }
203
+
204
+ if (forbiddenIndexes.current[indexWithOffset] || allColumns[indexWithOffset].field === nextVisibleColumnField) {
205
+ // If we ended up on a visible column, or a forbidden one, we can not do the reorder
206
+ canBeReordered = false;
207
+ }
116
208
  }
117
209
 
118
210
  const canBeReorderedProcessed = apiRef.current.unstable_applyPipeProcessors('canBeReordered', canBeReordered, {
@@ -120,7 +212,7 @@ export const useGridColumnReorder = (apiRef, props) => {
120
212
  });
121
213
 
122
214
  if (canBeReorderedProcessed) {
123
- apiRef.current.setColumnIndex(dragColField, targetColIndex);
215
+ apiRef.current.setColumnIndex(dragColField, targetColIndex + indexOffsetInHiddenColumns);
124
216
  }
125
217
  }
126
218
 
@@ -4,7 +4,7 @@ import { ownerDocument, useEventCallback } from '@mui/material/utils';
4
4
  import { gridClasses, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
5
5
  import { clamp, findParentElementFromClassName } from '@mui/x-data-grid/internals';
6
6
  import { useTheme } from '@mui/material/styles';
7
- import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField } from '../../../utils/domUtils';
7
+ import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField, findGroupHeaderElementsFromField } from '../../../utils/domUtils';
8
8
  // TODO: remove support for Safari < 13.
9
9
  // https://caniuse.com/#search=touch-action
10
10
  //
@@ -104,6 +104,7 @@ export const useGridColumnResize = (apiRef, props) => {
104
104
  const logger = useGridLogger(apiRef, 'useGridColumnResize');
105
105
  const colDefRef = React.useRef();
106
106
  const colElementRef = React.useRef();
107
+ const colGroupingElementRef = React.useRef();
107
108
  const colCellElementsRef = React.useRef();
108
109
  const theme = useTheme(); // To improve accessibility, the separator has padding on both sides.
109
110
  // Clicking inside the padding area should be treated as a click in the separator.
@@ -124,7 +125,7 @@ export const useGridColumnResize = (apiRef, props) => {
124
125
  colElementRef.current.style.width = `${newWidth}px`;
125
126
  colElementRef.current.style.minWidth = `${newWidth}px`;
126
127
  colElementRef.current.style.maxWidth = `${newWidth}px`;
127
- colCellElementsRef.current.forEach(element => {
128
+ [...colCellElementsRef.current, ...colGroupingElementRef.current].forEach(element => {
128
129
  const div = element;
129
130
  let finalWidth;
130
131
 
@@ -182,7 +183,7 @@ export const useGridColumnResize = (apiRef, props) => {
182
183
  const handleColumnResizeMouseDown = useEventCallback(({
183
184
  colDef
184
185
  }, event) => {
185
- var _apiRef$current$colum;
186
+ var _apiRef$current$colum, _apiRef$current$colum2;
186
187
 
187
188
  // Only handle left clicks
188
189
  if (event.button !== 0) {
@@ -202,6 +203,7 @@ export const useGridColumnResize = (apiRef, props) => {
202
203
  }, event);
203
204
  colDefRef.current = colDef;
204
205
  colElementRef.current = (_apiRef$current$colum = apiRef.current.columnHeadersContainerElementRef) == null ? void 0 : _apiRef$current$colum.current.querySelector(`[data-field="${colDef.field}"]`);
206
+ colGroupingElementRef.current = findGroupHeaderElementsFromField((_apiRef$current$colum2 = apiRef.current.columnHeadersContainerElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
205
207
  colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
206
208
  const doc = ownerDocument(apiRef.current.rootElementRef.current);
207
209
  doc.body.style.cursor = 'col-resize';
@@ -250,7 +252,7 @@ export const useGridColumnResize = (apiRef, props) => {
250
252
  apiRef.current.publishEvent('columnResize', params, nativeEvent);
251
253
  });
252
254
  const handleTouchStart = useEventCallback(event => {
253
- var _apiRef$current$colum2;
255
+ var _apiRef$current$colum3, _apiRef$current$colum4;
254
256
 
255
257
  const cellSeparator = findParentElementFromClassName(event.target, gridClasses['columnSeparator--resizable']); // Let the event bubble if the target is not a col separator
256
258
 
@@ -273,12 +275,13 @@ export const useGridColumnResize = (apiRef, props) => {
273
275
  colElementRef.current = findParentElementFromClassName(event.target, gridClasses.columnHeader);
274
276
  const field = getFieldFromHeaderElem(colElementRef.current);
275
277
  const colDef = apiRef.current.getColumn(field);
278
+ colGroupingElementRef.current = findGroupHeaderElementsFromField((_apiRef$current$colum3 = apiRef.current.columnHeadersContainerElementRef) == null ? void 0 : _apiRef$current$colum3.current, field);
276
279
  logger.debug(`Start Resize on col ${colDef.field}`);
277
280
  apiRef.current.publishEvent('columnResizeStart', {
278
281
  field
279
282
  }, event);
280
283
  colDefRef.current = colDef;
281
- colElementRef.current = findHeaderElementFromField((_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
284
+ colElementRef.current = findHeaderElementFromField((_apiRef$current$colum4 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum4.current, colDef.field);
282
285
  colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
283
286
  resizeDirection.current = getResizeDirection(event.target, theme.direction);
284
287
  initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
@@ -319,9 +322,9 @@ export const useGridColumnResize = (apiRef, props) => {
319
322
  };
320
323
  }, [apiRef, handleTouchStart, stopListening]);
321
324
  useGridNativeEventListener(apiRef, () => {
322
- var _apiRef$current$colum3;
325
+ var _apiRef$current$colum5;
323
326
 
324
- return (_apiRef$current$colum3 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum3.current;
327
+ return (_apiRef$current$colum5 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum5.current;
325
328
  }, 'touchstart', handleTouchStart, {
326
329
  passive: doesSupportTouchActionNone()
327
330
  });
@@ -12,8 +12,8 @@ export declare function addPinnedRow({ groupingParams, rowModel, rowId, position
12
12
  apiRef: React.MutableRefObject<GridApiPro>;
13
13
  }): {
14
14
  idRowsLookup: {
15
- [x: string]: any;
16
- [x: number]: any;
15
+ [x: string]: import("@mui/x-data-grid").GridValidRowModel;
16
+ [x: number]: import("@mui/x-data-grid").GridValidRowModel;
17
17
  };
18
18
  tree: {
19
19
  [x: string]: import("@mui/x-data-grid").GridRowTreeNodeConfig;
@@ -21,8 +21,8 @@ export declare function addPinnedRow({ groupingParams, rowModel, rowId, position
21
21
  };
22
22
  additionalRowGroups: {
23
23
  pinnedRows: {
24
- top?: GridRowEntry<any>[] | undefined;
25
- bottom?: GridRowEntry<any>[] | undefined;
24
+ top?: GridRowEntry<import("@mui/x-data-grid").GridValidRowModel>[] | undefined;
25
+ bottom?: GridRowEntry<import("@mui/x-data-grid").GridValidRowModel>[] | undefined;
26
26
  };
27
27
  };
28
28
  groupingName: string;
@@ -1,9 +1,10 @@
1
- import { GridRowTreeConfig, GridFilterState } from '@mui/x-data-grid';
1
+ import { GridRowTreeConfig, GridFilterState, GridFilterModel } from '@mui/x-data-grid';
2
2
  import { GridAggregatedFilterItemApplier } from '@mui/x-data-grid/internals';
3
3
  interface FilterRowTreeFromTreeDataParams {
4
4
  rowTree: GridRowTreeConfig;
5
5
  disableChildrenFiltering: boolean;
6
6
  isRowMatchingFilters: GridAggregatedFilterItemApplier | null;
7
+ filterModel: GridFilterModel;
7
8
  }
8
9
  export declare const TREE_DATA_STRATEGY = "tree-data";
9
10
  /**
@@ -1,3 +1,4 @@
1
+ import { passFilterLogic } from '@mui/x-data-grid/internals';
1
2
  export const TREE_DATA_STRATEGY = 'tree-data';
2
3
  /**
3
4
  * A node is visible if one of the following criteria is met:
@@ -23,10 +24,14 @@ export const filterRowTreeFromTreeData = params => {
23
24
 
24
25
  if (shouldSkipFilters) {
25
26
  isMatchingFilters = null;
26
- } else if (!isRowMatchingFilters) {
27
+ } else if (!isRowMatchingFilters || node.position === 'footer') {
27
28
  isMatchingFilters = true;
28
29
  } else {
29
- isMatchingFilters = isRowMatchingFilters(node.id);
30
+ const {
31
+ passingFilterItems,
32
+ passingQuickFilterValues
33
+ } = isRowMatchingFilters(node.id);
34
+ isMatchingFilters = passFilterLogic([passingFilterItems], [passingQuickFilterValues], params.filterModel);
30
35
  }
31
36
 
32
37
  let filteredDescendantCount = 0;
@@ -99,7 +99,8 @@ export const useGridTreeDataPreProcessors = (apiRef, props) => {
99
99
  return filterRowTreeFromTreeData({
100
100
  rowTree,
101
101
  isRowMatchingFilters: params.isRowMatchingFilters,
102
- disableChildrenFiltering: props.disableChildrenFiltering
102
+ disableChildrenFiltering: props.disableChildrenFiltering,
103
+ filterModel: params.filterModel
103
104
  });
104
105
  }, [apiRef, props.disableChildrenFiltering]);
105
106
  const sortRows = React.useCallback(params => {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.15.1
1
+ /** @license MUI v5.16.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -106,6 +106,7 @@ DataGridProRaw.propTypes = {
106
106
  * @default 3
107
107
  */
108
108
  columnBuffer: PropTypes.number,
109
+ columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
109
110
 
110
111
  /**
111
112
  * Set of columns of type [[GridColumns]].
@@ -274,6 +275,7 @@ DataGridProRaw.propTypes = {
274
275
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
275
276
  */
276
277
  experimentalFeatures: PropTypes.shape({
278
+ columnGrouping: PropTypes.bool,
277
279
  newEditingApi: PropTypes.bool,
278
280
  preventCommitWhileValidating: PropTypes.bool,
279
281
  rowPinning: PropTypes.bool,
@@ -478,7 +480,7 @@ DataGridProRaw.propTypes = {
478
480
 
479
481
  /**
480
482
  * Allows to pass the logging level or false to turn off logging.
481
- * @default "debug"
483
+ * @default "error" ("warn" in dev mode)
482
484
  */
483
485
  logLevel: PropTypes.oneOf(['debug', 'error', 'info', 'warn', false]),
484
486
 
@@ -822,7 +824,7 @@ DataGridProRaw.propTypes = {
822
824
  * @param {GridState} state The new state.
823
825
  * @param {MuiEvent<{}>} event The event object.
824
826
  * @param {GridCallbackDetails} details Additional details for this callback.
825
- * @internal
827
+ * @ignore - do not document.
826
828
  */
827
829
  onStateChange: PropTypes.func,
828
830