@mui/x-data-grid-pro 5.13.1 โ†’ 5.14.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 (45) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/DataGridPro/useDataGridProComponent.js +1 -1
  3. package/components/GridRowReorderCell.d.ts +1 -1
  4. package/components/GridRowReorderCell.js +7 -0
  5. package/hooks/features/columnPinning/useGridColumnPinning.d.ts +1 -1
  6. package/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  7. package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  8. package/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  9. package/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  10. package/index.js +1 -1
  11. package/internals/index.d.ts +1 -0
  12. package/internals/index.js +1 -0
  13. package/legacy/DataGridPro/useDataGridProComponent.js +1 -1
  14. package/legacy/components/GridRowReorderCell.js +7 -0
  15. package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  16. package/legacy/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  17. package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  18. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  19. package/legacy/index.js +1 -1
  20. package/legacy/internals/index.js +1 -0
  21. package/legacy/utils/releaseInfo.js +1 -1
  22. package/legacy/utils/tree/sortRowTree.js +27 -14
  23. package/modern/DataGridPro/useDataGridProComponent.js +1 -1
  24. package/modern/components/GridRowReorderCell.js +5 -0
  25. package/modern/hooks/features/columnPinning/useGridColumnPinning.js +8 -3
  26. package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  27. package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  28. package/modern/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  29. package/modern/index.js +1 -1
  30. package/modern/internals/index.js +1 -0
  31. package/modern/utils/releaseInfo.js +1 -1
  32. package/modern/utils/tree/sortRowTree.js +26 -11
  33. package/node/DataGridPro/useDataGridProComponent.js +1 -1
  34. package/node/components/GridRowReorderCell.js +7 -0
  35. package/node/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  36. package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  37. package/node/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  38. package/node/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  39. package/node/index.js +1 -1
  40. package/node/internals/index.js +9 -0
  41. package/node/utils/releaseInfo.js +1 -1
  42. package/node/utils/tree/sortRowTree.js +26 -11
  43. package/package.json +3 -3
  44. package/utils/releaseInfo.js +1 -1
  45. package/utils/tree/sortRowTree.js +26 -11
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
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.14.0
7
+
8
+ _Jul 21, 2022_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights โœจ:
11
+
12
+ - ๐Ÿงช Export `GridBooleanCell` component from data grid (#5537) @cliedeman
13
+ - โš™๏ธ Improve accessibility of the Export menu (#5486) @nogalpaulina
14
+ - ๐ŸŒ Improvements to different locales
15
+ - ๐Ÿ“š Documentation improvements
16
+ - ๐Ÿž Bugfixes
17
+
18
+ ### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
19
+
20
+ #### Changes
21
+
22
+ - [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
23
+ - [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
24
+ - [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
25
+ - [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
26
+ - [DataGrid] Fix loading overlay position (#5558) @DanailH
27
+ - [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
28
+ - [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
29
+ - [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
30
+ - [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
31
+
32
+ ### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
33
+
34
+ #### Changes
35
+
36
+ - [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
37
+
38
+ ### Docs
39
+
40
+ - [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
41
+ - [docs] Remove blank line @oliviertassinari
42
+
43
+ ### Core
44
+
45
+ - [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
46
+ - [core] Polish on the bug issue template (#5525) @oliviertassinari
47
+ - [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
48
+
6
49
  ## 5.13.1
7
50
 
8
51
  _Jul 15, 2022_
@@ -1466,7 +1509,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
1466
1509
  - [core] Fix `yarn prettier` script (#3292) @oliviertassinari
1467
1510
  - [core] Improve tests for Tree Data (#3366) @flaviendelangle
1468
1511
  - [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
1469
- - [core] Transition to a new StackOverflow tag (#3308) @oliviertassinari
1512
+ - [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
1470
1513
  - [core] Update monorepo (#3370) @flaviendelangle
1471
1514
  - [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
1472
1515
  - [test] Replace `useFakeTimers` (#3323) @m4theushw
@@ -59,7 +59,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
59
59
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
60
60
  useGridEditing(apiRef, props);
61
61
  useGridFocus(apiRef, props);
62
- useGridPreferencesPanel(apiRef);
62
+ useGridPreferencesPanel(apiRef, props);
63
63
  useGridFilter(apiRef, props);
64
64
  useGridSorting(apiRef, props);
65
65
  useGridDensity(apiRef, props);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { GridRenderCellParams } from '@mui/x-data-grid';
3
- declare const GridRowReorderCell: (params: GridRenderCellParams) => JSX.Element;
3
+ declare const GridRowReorderCell: (params: GridRenderCellParams) => JSX.Element | null;
4
4
  export { GridRowReorderCell };
5
5
  export declare const renderRowReorderCell: (params: GridRenderCellParams) => JSX.Element;
@@ -19,6 +19,8 @@ const useUtilityClasses = ownerState => {
19
19
  };
20
20
 
21
21
  const GridRowReorderCell = params => {
22
+ var _params$rowNode$posit;
23
+
22
24
  const apiRef = useGridApiContext();
23
25
  const rootProps = useGridRootProps();
24
26
  const sortModel = useGridSelector(apiRef, gridSortModelSelector);
@@ -57,6 +59,11 @@ const GridRowReorderCell = params => {
57
59
  onDragOver: publish('rowDragOver'),
58
60
  onDragEnd: publish('rowDragEnd')
59
61
  } : null;
62
+
63
+ if (((_params$rowNode$posit = params.rowNode.position) != null ? _params$rowNode$posit : 'body') !== 'body') {
64
+ return null;
65
+ }
66
+
60
67
  return /*#__PURE__*/_jsxs("div", _extends({
61
68
  className: classes.root,
62
69
  draggable: isDraggable
@@ -3,4 +3,4 @@ import { GridStateInitializer } from '@mui/x-data-grid/internals';
3
3
  import { GridApiPro } from '../../../models/gridApiPro';
4
4
  import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
5
5
  export declare const columnPinningStateInitializer: GridStateInitializer<Pick<DataGridProProcessedProps, 'pinnedColumns' | 'initialState' | 'disableColumnPinning'>>;
6
- export declare const useGridColumnPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'disableColumnPinning' | 'pinnedColumns' | 'onPinnedColumnsChange'>) => void;
6
+ export declare const useGridColumnPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'disableColumnPinning' | 'initialState' | 'pinnedColumns' | 'onPinnedColumnsChange'>) => void;
@@ -43,6 +43,8 @@ const mergeStateWithPinnedColumns = pinnedColumns => state => _extends({}, state
43
43
  });
44
44
 
45
45
  export const useGridColumnPinning = (apiRef, props) => {
46
+ var _props$initialState4;
47
+
46
48
  const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector); // Each visible row (not to be confused with a filter result) is composed of a central .MuiDataGrid-row element
47
49
  // and up to two additional .MuiDataGrid-row's, one for the columns pinned to the left and another
48
50
  // for those on the right side. When hovering any of these elements, the :hover styles are applied only to
@@ -164,17 +166,24 @@ export const useGridColumnPinning = (apiRef, props) => {
164
166
 
165
167
  return initialValue;
166
168
  }, [apiRef, pinnedColumns]);
167
- const stateExportPreProcessing = React.useCallback(prevState => {
169
+ const stateExportPreProcessing = React.useCallback((prevState, context) => {
170
+ var _props$initialState3, _pinnedColumnsToExpor, _pinnedColumnsToExpor2;
171
+
168
172
  const pinnedColumnsToExport = gridPinnedColumnsSelector(apiRef.current.state);
173
+ const shouldExportPinnedColumns = // Always export if the `exportOnlyDirtyModels` property is activated
174
+ !context.exportOnlyDirtyModels || // Always export if the model is controlled
175
+ props.pinnedColumns != null || // Always export if the model has been initialized
176
+ ((_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.pinnedColumns) != null || // Export if the model is not empty
177
+ ((_pinnedColumnsToExpor = pinnedColumnsToExport.left) != null ? _pinnedColumnsToExpor : []).length > 0 || ((_pinnedColumnsToExpor2 = pinnedColumnsToExport.right) != null ? _pinnedColumnsToExpor2 : []).length > 0;
169
178
 
170
- if ((!pinnedColumnsToExport.left || pinnedColumnsToExport.left.length === 0) && (!pinnedColumnsToExport.right || pinnedColumnsToExport.right.length === 0)) {
179
+ if (!shouldExportPinnedColumns) {
171
180
  return prevState;
172
181
  }
173
182
 
174
183
  return _extends({}, prevState, {
175
184
  pinnedColumns: pinnedColumnsToExport
176
185
  });
177
- }, [apiRef]);
186
+ }, [apiRef, props.pinnedColumns, (_props$initialState4 = props.initialState) == null ? void 0 : _props$initialState4.pinnedColumns]);
178
187
  const stateRestorePreProcessing = React.useCallback((params, context) => {
179
188
  const newPinnedColumns = context.stateToRestore.pinnedColumns;
180
189
 
@@ -12,6 +12,8 @@ export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF
12
12
  sortable: false,
13
13
  filterable: false,
14
14
  resizable: false,
15
+ // @ts-ignore
16
+ aggregable: false,
15
17
  disableColumnMenu: true,
16
18
  disableReorder: true,
17
19
  disableExport: true,
@@ -13,6 +13,8 @@ export const GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
13
13
  disableExport: true,
14
14
  disableReorder: true,
15
15
  resizable: false,
16
+ // @ts-ignore
17
+ aggregable: false,
16
18
  renderHeader: () => ' ',
17
19
  renderCell: renderRowReorderCell
18
20
  });
@@ -62,11 +62,20 @@ export const filterRowTreeFromTreeData = params => {
62
62
  visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
63
63
  filteredRowsLookup[node.id] = shouldPassFilters;
64
64
 
65
+ if (node.footerId != null) {
66
+ visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
67
+ }
68
+
65
69
  if (!shouldPassFilters) {
66
70
  return 0;
67
71
  }
68
72
 
69
73
  filteredDescendantCountLookup[node.id] = filteredDescendantCount;
74
+
75
+ if (node.position === 'footer') {
76
+ return filteredDescendantCount;
77
+ }
78
+
70
79
  return filteredDescendantCount + 1;
71
80
  };
72
81
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.13.1
1
+ /** @license MUI v5.14.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.
@@ -12,6 +12,7 @@ export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorde
12
12
  export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
13
13
  export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
14
14
  export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
15
+ export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils';
15
16
  export type { GridExperimentalProFeatures, DataGridProPropsWithoutDefaultValue, DataGridProPropsWithDefaultValue, } from '../models/dataGridProProps';
16
17
  export { buildRowTree } from '../utils/tree/buildRowTree';
17
18
  export type { BuildRowTreeGroupingCriteria } from '../utils/tree/buildRowTree';
@@ -12,5 +12,6 @@ export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorde
12
12
  export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
13
13
  export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
14
14
  export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
15
+ export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils';
15
16
  export { buildRowTree } from '../utils/tree/buildRowTree';
16
17
  export { sortRowTree } from '../utils/tree/sortRowTree';
@@ -59,7 +59,7 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
59
59
  var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
60
60
  useGridEditing(apiRef, props);
61
61
  useGridFocus(apiRef, props);
62
- useGridPreferencesPanel(apiRef);
62
+ useGridPreferencesPanel(apiRef, props);
63
63
  useGridFilter(apiRef, props);
64
64
  useGridSorting(apiRef, props);
65
65
  useGridDensity(apiRef, props);
@@ -17,6 +17,8 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
17
17
  };
18
18
 
19
19
  var GridRowReorderCell = function GridRowReorderCell(params) {
20
+ var _params$rowNode$posit;
21
+
20
22
  var apiRef = useGridApiContext();
21
23
  var rootProps = useGridRootProps();
22
24
  var sortModel = useGridSelector(apiRef, gridSortModelSelector);
@@ -59,6 +61,11 @@ var GridRowReorderCell = function GridRowReorderCell(params) {
59
61
  onDragOver: publish('rowDragOver'),
60
62
  onDragEnd: publish('rowDragEnd')
61
63
  } : null;
64
+
65
+ if (((_params$rowNode$posit = params.rowNode.position) != null ? _params$rowNode$posit : 'body') !== 'body') {
66
+ return null;
67
+ }
68
+
62
69
  return /*#__PURE__*/_jsxs("div", _extends({
63
70
  className: classes.root,
64
71
  draggable: isDraggable
@@ -54,6 +54,8 @@ var mergeStateWithPinnedColumns = function mergeStateWithPinnedColumns(pinnedCol
54
54
  };
55
55
 
56
56
  export var useGridColumnPinning = function useGridColumnPinning(apiRef, props) {
57
+ var _props$initialState4;
58
+
57
59
  var pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector); // Each visible row (not to be confused with a filter result) is composed of a central .MuiDataGrid-row element
58
60
  // and up to two additional .MuiDataGrid-row's, one for the columns pinned to the left and another
59
61
  // for those on the right side. When hovering any of these elements, the :hover styles are applied only to
@@ -183,17 +185,24 @@ export var useGridColumnPinning = function useGridColumnPinning(apiRef, props) {
183
185
 
184
186
  return initialValue;
185
187
  }, [apiRef, pinnedColumns]);
186
- var stateExportPreProcessing = React.useCallback(function (prevState) {
188
+ var stateExportPreProcessing = React.useCallback(function (prevState, context) {
189
+ var _props$initialState3, _pinnedColumnsToExpor, _pinnedColumnsToExpor2;
190
+
187
191
  var pinnedColumnsToExport = gridPinnedColumnsSelector(apiRef.current.state);
192
+ var shouldExportPinnedColumns = // Always export if the `exportOnlyDirtyModels` property is activated
193
+ !context.exportOnlyDirtyModels || // Always export if the model is controlled
194
+ props.pinnedColumns != null || // Always export if the model has been initialized
195
+ ((_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.pinnedColumns) != null || // Export if the model is not empty
196
+ ((_pinnedColumnsToExpor = pinnedColumnsToExport.left) != null ? _pinnedColumnsToExpor : []).length > 0 || ((_pinnedColumnsToExpor2 = pinnedColumnsToExport.right) != null ? _pinnedColumnsToExpor2 : []).length > 0;
188
197
 
189
- if ((!pinnedColumnsToExport.left || pinnedColumnsToExport.left.length === 0) && (!pinnedColumnsToExport.right || pinnedColumnsToExport.right.length === 0)) {
198
+ if (!shouldExportPinnedColumns) {
190
199
  return prevState;
191
200
  }
192
201
 
193
202
  return _extends({}, prevState, {
194
203
  pinnedColumns: pinnedColumnsToExport
195
204
  });
196
- }, [apiRef]);
205
+ }, [apiRef, props.pinnedColumns, (_props$initialState4 = props.initialState) == null ? void 0 : _props$initialState4.pinnedColumns]);
197
206
  var stateRestorePreProcessing = React.useCallback(function (params, context) {
198
207
  var newPinnedColumns = context.stateToRestore.pinnedColumns;
199
208
 
@@ -12,6 +12,8 @@ export var GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF,
12
12
  sortable: false,
13
13
  filterable: false,
14
14
  resizable: false,
15
+ // @ts-ignore
16
+ aggregable: false,
15
17
  disableColumnMenu: true,
16
18
  disableReorder: true,
17
19
  disableExport: true,
@@ -13,6 +13,8 @@ export var GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
13
13
  disableExport: true,
14
14
  disableReorder: true,
15
15
  resizable: false,
16
+ // @ts-ignore
17
+ aggregable: false,
16
18
  renderHeader: function renderHeader() {
17
19
  return ' ';
18
20
  },
@@ -60,11 +60,20 @@ export var filterRowTreeFromTreeData = function filterRowTreeFromTreeData(params
60
60
  visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
61
61
  filteredRowsLookup[node.id] = shouldPassFilters;
62
62
 
63
+ if (node.footerId != null) {
64
+ visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
65
+ }
66
+
63
67
  if (!shouldPassFilters) {
64
68
  return 0;
65
69
  }
66
70
 
67
71
  filteredDescendantCountLookup[node.id] = filteredDescendantCount;
72
+
73
+ if (node.position === 'footer') {
74
+ return filteredDescendantCount;
75
+ }
76
+
68
77
  return filteredDescendantCount + 1;
69
78
  };
70
79
 
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.13.1
1
+ /** @license MUI v5.14.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.
@@ -12,5 +12,6 @@ export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorde
12
12
  export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
13
13
  export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
14
14
  export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
15
+ export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils';
15
16
  export { buildRowTree } from '../utils/tree/buildRowTree';
16
17
  export { sortRowTree } from '../utils/tree/sortRowTree';
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export var getReleaseInfo = function getReleaseInfo() {
3
- var releaseInfo = "MTY1Nzg1NDAwMDAwMA==";
3
+ var releaseInfo = "MTY1ODQ0MDgwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -6,7 +6,10 @@ export var sortRowTree = function sortRowTree(params) {
6
6
  sortRowList = params.sortRowList;
7
7
  var sortedRows = []; // Group the rows by parent
8
8
 
9
- var groupedByParentRows = new Map([[null, []]]);
9
+ var groupedByParentRows = new Map([[null, {
10
+ body: [],
11
+ footer: null
12
+ }]]);
10
13
 
11
14
  for (var i = 0; i < rowIds.length; i += 1) {
12
15
  var rowId = rowIds[i];
@@ -14,32 +17,42 @@ export var sortRowTree = function sortRowTree(params) {
14
17
  var group = groupedByParentRows.get(node.parent);
15
18
 
16
19
  if (!group) {
17
- group = [];
20
+ group = {
21
+ body: [],
22
+ footer: null
23
+ };
18
24
  groupedByParentRows.set(node.parent, group);
19
25
  }
20
26
 
21
- group.push(node);
27
+ if (node.position === 'footer') {
28
+ group.footer = node;
29
+ } else {
30
+ group.body.push(node);
31
+ }
22
32
  } // Apply the sorting to each list of children
23
33
 
24
34
 
25
35
  var sortedGroupedByParentRows = new Map();
26
- groupedByParentRows.forEach(function (rowList, parent) {
27
- if (rowList.length === 0) {
36
+ groupedByParentRows.forEach(function (group, parent) {
37
+ if (group.body.length === 0) {
28
38
  sortedGroupedByParentRows.set(parent, []);
29
39
  } else {
30
- var depth = rowList[0].depth;
40
+ var groupSortedRows;
41
+ var depth = group.body[0].depth;
31
42
 
32
- if (depth > 0 && disableChildrenSorting) {
33
- sortedGroupedByParentRows.set(parent, rowList.map(function (row) {
34
- return row.id;
35
- }));
36
- } else if (!sortRowList) {
37
- sortedGroupedByParentRows.set(parent, rowList.map(function (row) {
43
+ if (depth > 0 && disableChildrenSorting || !sortRowList) {
44
+ groupSortedRows = group.body.map(function (row) {
38
45
  return row.id;
39
- }));
46
+ });
40
47
  } else {
41
- sortedGroupedByParentRows.set(parent, sortRowList(rowList));
48
+ groupSortedRows = sortRowList(group.body);
42
49
  }
50
+
51
+ if (group.footer != null) {
52
+ groupSortedRows.push(group.footer.id);
53
+ }
54
+
55
+ sortedGroupedByParentRows.set(parent, groupSortedRows);
43
56
  }
44
57
  }); // Flatten the sorted lists to have children just after their parent
45
58
 
@@ -57,7 +57,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
57
57
  const useGridEditing = props.experimentalFeatures?.newEditingApi ? useGridEditing_new : useGridEditing_old;
58
58
  useGridEditing(apiRef, props);
59
59
  useGridFocus(apiRef, props);
60
- useGridPreferencesPanel(apiRef);
60
+ useGridPreferencesPanel(apiRef, props);
61
61
  useGridFilter(apiRef, props);
62
62
  useGridSorting(apiRef, props);
63
63
  useGridDensity(apiRef, props);
@@ -57,6 +57,11 @@ const GridRowReorderCell = params => {
57
57
  onDragOver: publish('rowDragOver'),
58
58
  onDragEnd: publish('rowDragEnd')
59
59
  } : null;
60
+
61
+ if ((params.rowNode.position ?? 'body') !== 'body') {
62
+ return null;
63
+ }
64
+
60
65
  return /*#__PURE__*/_jsxs("div", _extends({
61
66
  className: classes.root,
62
67
  draggable: isDraggable
@@ -158,17 +158,22 @@ export const useGridColumnPinning = (apiRef, props) => {
158
158
 
159
159
  return initialValue;
160
160
  }, [apiRef, pinnedColumns]);
161
- const stateExportPreProcessing = React.useCallback(prevState => {
161
+ const stateExportPreProcessing = React.useCallback((prevState, context) => {
162
162
  const pinnedColumnsToExport = gridPinnedColumnsSelector(apiRef.current.state);
163
+ const shouldExportPinnedColumns = // Always export if the `exportOnlyDirtyModels` property is activated
164
+ !context.exportOnlyDirtyModels || // Always export if the model is controlled
165
+ props.pinnedColumns != null || // Always export if the model has been initialized
166
+ props.initialState?.pinnedColumns != null || // Export if the model is not empty
167
+ (pinnedColumnsToExport.left ?? []).length > 0 || (pinnedColumnsToExport.right ?? []).length > 0;
163
168
 
164
- if ((!pinnedColumnsToExport.left || pinnedColumnsToExport.left.length === 0) && (!pinnedColumnsToExport.right || pinnedColumnsToExport.right.length === 0)) {
169
+ if (!shouldExportPinnedColumns) {
165
170
  return prevState;
166
171
  }
167
172
 
168
173
  return _extends({}, prevState, {
169
174
  pinnedColumns: pinnedColumnsToExport
170
175
  });
171
- }, [apiRef]);
176
+ }, [apiRef, props.pinnedColumns, props.initialState?.pinnedColumns]);
172
177
  const stateRestorePreProcessing = React.useCallback((params, context) => {
173
178
  const newPinnedColumns = context.stateToRestore.pinnedColumns;
174
179
 
@@ -12,6 +12,8 @@ export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF
12
12
  sortable: false,
13
13
  filterable: false,
14
14
  resizable: false,
15
+ // @ts-ignore
16
+ aggregable: false,
15
17
  disableColumnMenu: true,
16
18
  disableReorder: true,
17
19
  disableExport: true,
@@ -13,6 +13,8 @@ export const GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
13
13
  disableExport: true,
14
14
  disableReorder: true,
15
15
  resizable: false,
16
+ // @ts-ignore
17
+ aggregable: false,
16
18
  renderHeader: () => ' ',
17
19
  renderCell: renderRowReorderCell
18
20
  });
@@ -58,11 +58,20 @@ export const filterRowTreeFromTreeData = params => {
58
58
  visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
59
59
  filteredRowsLookup[node.id] = shouldPassFilters;
60
60
 
61
+ if (node.footerId != null) {
62
+ visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
63
+ }
64
+
61
65
  if (!shouldPassFilters) {
62
66
  return 0;
63
67
  }
64
68
 
65
69
  filteredDescendantCountLookup[node.id] = filteredDescendantCount;
70
+
71
+ if (node.position === 'footer') {
72
+ return filteredDescendantCount;
73
+ }
74
+
66
75
  return filteredDescendantCount + 1;
67
76
  };
68
77
 
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.13.1
1
+ /** @license MUI v5.14.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.
@@ -12,5 +12,6 @@ export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorde
12
12
  export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
13
13
  export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
14
14
  export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
15
+ export { TREE_DATA_STRATEGY } from '../hooks/features/treeData/gridTreeDataUtils';
15
16
  export { buildRowTree } from '../utils/tree/buildRowTree';
16
17
  export { sortRowTree } from '../utils/tree/sortRowTree';
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY1Nzg1NDAwMDAwMA==";
3
+ const releaseInfo = "MTY1ODQ0MDgwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -7,7 +7,10 @@ export const sortRowTree = params => {
7
7
  } = params;
8
8
  let sortedRows = []; // Group the rows by parent
9
9
 
10
- const groupedByParentRows = new Map([[null, []]]);
10
+ const groupedByParentRows = new Map([[null, {
11
+ body: [],
12
+ footer: null
13
+ }]]);
11
14
 
12
15
  for (let i = 0; i < rowIds.length; i += 1) {
13
16
  const rowId = rowIds[i];
@@ -15,28 +18,40 @@ export const sortRowTree = params => {
15
18
  let group = groupedByParentRows.get(node.parent);
16
19
 
17
20
  if (!group) {
18
- group = [];
21
+ group = {
22
+ body: [],
23
+ footer: null
24
+ };
19
25
  groupedByParentRows.set(node.parent, group);
20
26
  }
21
27
 
22
- group.push(node);
28
+ if (node.position === 'footer') {
29
+ group.footer = node;
30
+ } else {
31
+ group.body.push(node);
32
+ }
23
33
  } // Apply the sorting to each list of children
24
34
 
25
35
 
26
36
  const sortedGroupedByParentRows = new Map();
27
- groupedByParentRows.forEach((rowList, parent) => {
28
- if (rowList.length === 0) {
37
+ groupedByParentRows.forEach((group, parent) => {
38
+ if (group.body.length === 0) {
29
39
  sortedGroupedByParentRows.set(parent, []);
30
40
  } else {
31
- const depth = rowList[0].depth;
41
+ let groupSortedRows;
42
+ const depth = group.body[0].depth;
32
43
 
33
- if (depth > 0 && disableChildrenSorting) {
34
- sortedGroupedByParentRows.set(parent, rowList.map(row => row.id));
35
- } else if (!sortRowList) {
36
- sortedGroupedByParentRows.set(parent, rowList.map(row => row.id));
44
+ if (depth > 0 && disableChildrenSorting || !sortRowList) {
45
+ groupSortedRows = group.body.map(row => row.id);
37
46
  } else {
38
- sortedGroupedByParentRows.set(parent, sortRowList(rowList));
47
+ groupSortedRows = sortRowList(group.body);
39
48
  }
49
+
50
+ if (group.footer != null) {
51
+ groupSortedRows.push(group.footer.id);
52
+ }
53
+
54
+ sortedGroupedByParentRows.set(parent, groupSortedRows);
40
55
  }
41
56
  }); // Flatten the sorted lists to have children just after their parent
42
57
 
@@ -78,7 +78,7 @@ const useDataGridProComponent = (inputApiRef, props) => {
78
78
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? _internals.useGridEditing_new : _internals.useGridEditing_old;
79
79
  useGridEditing(apiRef, props);
80
80
  (0, _internals.useGridFocus)(apiRef, props);
81
- (0, _internals.useGridPreferencesPanel)(apiRef);
81
+ (0, _internals.useGridPreferencesPanel)(apiRef, props);
82
82
  (0, _internals.useGridFilter)(apiRef, props);
83
83
  (0, _internals.useGridSorting)(apiRef, props);
84
84
  (0, _internals.useGridDensity)(apiRef, props);
@@ -36,6 +36,8 @@ const useUtilityClasses = ownerState => {
36
36
  };
37
37
 
38
38
  const GridRowReorderCell = params => {
39
+ var _params$rowNode$posit;
40
+
39
41
  const apiRef = (0, _xDataGrid.useGridApiContext)();
40
42
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
41
43
  const sortModel = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridSortModelSelector);
@@ -74,6 +76,11 @@ const GridRowReorderCell = params => {
74
76
  onDragOver: publish('rowDragOver'),
75
77
  onDragEnd: publish('rowDragEnd')
76
78
  } : null;
79
+
80
+ if (((_params$rowNode$posit = params.rowNode.position) != null ? _params$rowNode$posit : 'body') !== 'body') {
81
+ return null;
82
+ }
83
+
77
84
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
78
85
  className: classes.root,
79
86
  draggable: isDraggable
@@ -67,6 +67,8 @@ const mergeStateWithPinnedColumns = pinnedColumns => state => (0, _extends2.defa
67
67
  });
68
68
 
69
69
  const useGridColumnPinning = (apiRef, props) => {
70
+ var _props$initialState4;
71
+
70
72
  const pinnedColumns = (0, _xDataGrid.useGridSelector)(apiRef, _gridColumnPinningSelector.gridPinnedColumnsSelector); // Each visible row (not to be confused with a filter result) is composed of a central .MuiDataGrid-row element
71
73
  // and up to two additional .MuiDataGrid-row's, one for the columns pinned to the left and another
72
74
  // for those on the right side. When hovering any of these elements, the :hover styles are applied only to
@@ -188,17 +190,24 @@ const useGridColumnPinning = (apiRef, props) => {
188
190
 
189
191
  return initialValue;
190
192
  }, [apiRef, pinnedColumns]);
191
- const stateExportPreProcessing = React.useCallback(prevState => {
193
+ const stateExportPreProcessing = React.useCallback((prevState, context) => {
194
+ var _props$initialState3, _pinnedColumnsToExpor, _pinnedColumnsToExpor2;
195
+
192
196
  const pinnedColumnsToExport = (0, _gridColumnPinningSelector.gridPinnedColumnsSelector)(apiRef.current.state);
197
+ const shouldExportPinnedColumns = // Always export if the `exportOnlyDirtyModels` property is activated
198
+ !context.exportOnlyDirtyModels || // Always export if the model is controlled
199
+ props.pinnedColumns != null || // Always export if the model has been initialized
200
+ ((_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.pinnedColumns) != null || // Export if the model is not empty
201
+ ((_pinnedColumnsToExpor = pinnedColumnsToExport.left) != null ? _pinnedColumnsToExpor : []).length > 0 || ((_pinnedColumnsToExpor2 = pinnedColumnsToExport.right) != null ? _pinnedColumnsToExpor2 : []).length > 0;
193
202
 
194
- if ((!pinnedColumnsToExport.left || pinnedColumnsToExport.left.length === 0) && (!pinnedColumnsToExport.right || pinnedColumnsToExport.right.length === 0)) {
203
+ if (!shouldExportPinnedColumns) {
195
204
  return prevState;
196
205
  }
197
206
 
198
207
  return (0, _extends2.default)({}, prevState, {
199
208
  pinnedColumns: pinnedColumnsToExport
200
209
  });
201
- }, [apiRef]);
210
+ }, [apiRef, props.pinnedColumns, (_props$initialState4 = props.initialState) == null ? void 0 : _props$initialState4.pinnedColumns]);
202
211
  const stateRestorePreProcessing = React.useCallback((params, context) => {
203
212
  const newPinnedColumns = context.stateToRestore.pinnedColumns;
204
213
 
@@ -32,6 +32,8 @@ const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = (0, _extends2.default)({}, _xDataGrid.G
32
32
  sortable: false,
33
33
  filterable: false,
34
34
  resizable: false,
35
+ // @ts-ignore
36
+ aggregable: false,
35
37
  disableColumnMenu: true,
36
38
  disableReorder: true,
37
39
  disableExport: true,
@@ -25,6 +25,8 @@ const GRID_REORDER_COL_DEF = (0, _extends2.default)({}, _xDataGrid.GRID_STRING_C
25
25
  disableExport: true,
26
26
  disableReorder: true,
27
27
  resizable: false,
28
+ // @ts-ignore
29
+ aggregable: false,
28
30
  renderHeader: () => ' ',
29
31
  renderCell: _GridRowReorderCell.renderRowReorderCell
30
32
  });
@@ -70,11 +70,20 @@ const filterRowTreeFromTreeData = params => {
70
70
  visibleRowsLookup[node.id] = shouldPassFilters && areAncestorsExpanded;
71
71
  filteredRowsLookup[node.id] = shouldPassFilters;
72
72
 
73
+ if (node.footerId != null) {
74
+ visibleRowsLookup[node.footerId] = shouldPassFilters && areAncestorsExpanded && !!node.childrenExpanded;
75
+ }
76
+
73
77
  if (!shouldPassFilters) {
74
78
  return 0;
75
79
  }
76
80
 
77
81
  filteredDescendantCountLookup[node.id] = filteredDescendantCount;
82
+
83
+ if (node.position === 'footer') {
84
+ return filteredDescendantCount;
85
+ }
86
+
78
87
  return filteredDescendantCount + 1;
79
88
  };
80
89
 
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.13.1
1
+ /** @license MUI v5.14.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.
@@ -21,6 +21,7 @@ var _exportNames = {
21
21
  useGridRowReorderPreProcessors: true,
22
22
  useGridTreeData: true,
23
23
  useGridTreeDataPreProcessors: true,
24
+ TREE_DATA_STRATEGY: true,
24
25
  buildRowTree: true,
25
26
  sortRowTree: true
26
27
  };
@@ -36,6 +37,12 @@ Object.defineProperty(exports, "DataGridProVirtualScroller", {
36
37
  return _DataGridProVirtualScroller.DataGridProVirtualScroller;
37
38
  }
38
39
  });
40
+ Object.defineProperty(exports, "TREE_DATA_STRATEGY", {
41
+ enumerable: true,
42
+ get: function () {
43
+ return _gridTreeDataUtils.TREE_DATA_STRATEGY;
44
+ }
45
+ });
39
46
  Object.defineProperty(exports, "buildRowTree", {
40
47
  enumerable: true,
41
48
  get: function () {
@@ -179,6 +186,8 @@ var _useGridTreeData = require("../hooks/features/treeData/useGridTreeData");
179
186
 
180
187
  var _useGridTreeDataPreProcessors = require("../hooks/features/treeData/useGridTreeDataPreProcessors");
181
188
 
189
+ var _gridTreeDataUtils = require("../hooks/features/treeData/gridTreeDataUtils");
190
+
182
191
  var _buildRowTree = require("../utils/tree/buildRowTree");
183
192
 
184
193
  var _sortRowTree = require("../utils/tree/sortRowTree");
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
8
8
  var _utils = require("@mui/utils");
9
9
 
10
10
  const getReleaseInfo = () => {
11
- const releaseInfo = "MTY1Nzg1NDAwMDAwMA==";
11
+ const releaseInfo = "MTY1ODQ0MDgwMDAwMA==";
12
12
 
13
13
  if (process.env.NODE_ENV !== 'production') {
14
14
  // A simple hack to set the value in the test environment (has no build step).
@@ -14,7 +14,10 @@ const sortRowTree = params => {
14
14
  } = params;
15
15
  let sortedRows = []; // Group the rows by parent
16
16
 
17
- const groupedByParentRows = new Map([[null, []]]);
17
+ const groupedByParentRows = new Map([[null, {
18
+ body: [],
19
+ footer: null
20
+ }]]);
18
21
 
19
22
  for (let i = 0; i < rowIds.length; i += 1) {
20
23
  const rowId = rowIds[i];
@@ -22,28 +25,40 @@ const sortRowTree = params => {
22
25
  let group = groupedByParentRows.get(node.parent);
23
26
 
24
27
  if (!group) {
25
- group = [];
28
+ group = {
29
+ body: [],
30
+ footer: null
31
+ };
26
32
  groupedByParentRows.set(node.parent, group);
27
33
  }
28
34
 
29
- group.push(node);
35
+ if (node.position === 'footer') {
36
+ group.footer = node;
37
+ } else {
38
+ group.body.push(node);
39
+ }
30
40
  } // Apply the sorting to each list of children
31
41
 
32
42
 
33
43
  const sortedGroupedByParentRows = new Map();
34
- groupedByParentRows.forEach((rowList, parent) => {
35
- if (rowList.length === 0) {
44
+ groupedByParentRows.forEach((group, parent) => {
45
+ if (group.body.length === 0) {
36
46
  sortedGroupedByParentRows.set(parent, []);
37
47
  } else {
38
- const depth = rowList[0].depth;
48
+ let groupSortedRows;
49
+ const depth = group.body[0].depth;
39
50
 
40
- if (depth > 0 && disableChildrenSorting) {
41
- sortedGroupedByParentRows.set(parent, rowList.map(row => row.id));
42
- } else if (!sortRowList) {
43
- sortedGroupedByParentRows.set(parent, rowList.map(row => row.id));
51
+ if (depth > 0 && disableChildrenSorting || !sortRowList) {
52
+ groupSortedRows = group.body.map(row => row.id);
44
53
  } else {
45
- sortedGroupedByParentRows.set(parent, sortRowList(rowList));
54
+ groupSortedRows = sortRowList(group.body);
46
55
  }
56
+
57
+ if (group.footer != null) {
58
+ groupSortedRows.push(group.footer.id);
59
+ }
60
+
61
+ sortedGroupedByParentRows.set(parent, groupSortedRows);
47
62
  }
48
63
  }); // Flatten the sorted lists to have children just after their parent
49
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "5.13.1",
3
+ "version": "5.14.0",
4
4
  "description": "The Pro plan edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -33,8 +33,8 @@
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.18.6",
35
35
  "@mui/utils": "^5.4.1",
36
- "@mui/x-data-grid": "5.13.1",
37
- "@mui/x-license-pro": "5.13.1",
36
+ "@mui/x-data-grid": "5.14.0",
37
+ "@mui/x-license-pro": "5.14.0",
38
38
  "@types/format-util": "^1.0.2",
39
39
  "clsx": "^1.2.1",
40
40
  "prop-types": "^15.8.1",
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY1Nzg1NDAwMDAwMA==";
3
+ const releaseInfo = "MTY1ODQ0MDgwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -7,7 +7,10 @@ export const sortRowTree = params => {
7
7
  } = params;
8
8
  let sortedRows = []; // Group the rows by parent
9
9
 
10
- const groupedByParentRows = new Map([[null, []]]);
10
+ const groupedByParentRows = new Map([[null, {
11
+ body: [],
12
+ footer: null
13
+ }]]);
11
14
 
12
15
  for (let i = 0; i < rowIds.length; i += 1) {
13
16
  const rowId = rowIds[i];
@@ -15,28 +18,40 @@ export const sortRowTree = params => {
15
18
  let group = groupedByParentRows.get(node.parent);
16
19
 
17
20
  if (!group) {
18
- group = [];
21
+ group = {
22
+ body: [],
23
+ footer: null
24
+ };
19
25
  groupedByParentRows.set(node.parent, group);
20
26
  }
21
27
 
22
- group.push(node);
28
+ if (node.position === 'footer') {
29
+ group.footer = node;
30
+ } else {
31
+ group.body.push(node);
32
+ }
23
33
  } // Apply the sorting to each list of children
24
34
 
25
35
 
26
36
  const sortedGroupedByParentRows = new Map();
27
- groupedByParentRows.forEach((rowList, parent) => {
28
- if (rowList.length === 0) {
37
+ groupedByParentRows.forEach((group, parent) => {
38
+ if (group.body.length === 0) {
29
39
  sortedGroupedByParentRows.set(parent, []);
30
40
  } else {
31
- const depth = rowList[0].depth;
41
+ let groupSortedRows;
42
+ const depth = group.body[0].depth;
32
43
 
33
- if (depth > 0 && disableChildrenSorting) {
34
- sortedGroupedByParentRows.set(parent, rowList.map(row => row.id));
35
- } else if (!sortRowList) {
36
- sortedGroupedByParentRows.set(parent, rowList.map(row => row.id));
44
+ if (depth > 0 && disableChildrenSorting || !sortRowList) {
45
+ groupSortedRows = group.body.map(row => row.id);
37
46
  } else {
38
- sortedGroupedByParentRows.set(parent, sortRowList(rowList));
47
+ groupSortedRows = sortRowList(group.body);
39
48
  }
49
+
50
+ if (group.footer != null) {
51
+ groupSortedRows.push(group.footer.id);
52
+ }
53
+
54
+ sortedGroupedByParentRows.set(parent, groupSortedRows);
40
55
  }
41
56
  }); // Flatten the sorted lists to have children just after their parent
42
57