@mui/x-data-grid-pro 6.5.0 → 6.7.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 (123) hide show
  1. package/CHANGELOG.md +150 -2
  2. package/DataGridPro/DataGridPro.js +10 -3
  3. package/README.md +2 -2
  4. package/components/DataGridProVirtualScroller.js +12 -12
  5. package/components/GridColumnHeaders.js +9 -3
  6. package/components/GridColumnMenuPinningItem.d.ts +2 -2
  7. package/components/GridDetailPanel.d.ts +1 -1
  8. package/components/GridDetailPanelToggleCell.d.ts +2 -2
  9. package/components/GridRowReorderCell.d.ts +3 -3
  10. package/components/GridScrollArea.d.ts +10 -0
  11. package/components/GridScrollArea.js +140 -0
  12. package/components/GridTreeDataGroupingCell.d.ts +2 -2
  13. package/components/headerFiltering/GridHeaderFilterCell.d.ts +0 -1
  14. package/components/headerFiltering/GridHeaderFilterCell.js +36 -23
  15. package/components/headerFiltering/GridHeaderFilterClearButton.d.ts +2 -2
  16. package/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
  17. package/components/headerFiltering/GridHeaderFilterMenu.d.ts +5 -2
  18. package/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
  19. package/components/headerFiltering/{GridHeaderFilterAdornment.d.ts → GridHeaderFilterMenuContainer.d.ts} +4 -4
  20. package/{modern/components/headerFiltering/GridHeaderFilterAdornment.js → components/headerFiltering/GridHeaderFilterMenuContainer.js} +23 -24
  21. package/components/headerFiltering/index.d.ts +2 -1
  22. package/components/headerFiltering/index.js +3 -2
  23. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +3 -3
  24. package/hooks/features/columnHeaders/useGridColumnHeaders.js +16 -8
  25. package/hooks/features/columnResize/useGridColumnResize.js +11 -12
  26. package/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
  27. package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
  28. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
  29. package/hooks/features/treeData/gridTreeDataUtils.js +0 -8
  30. package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -0
  31. package/index.js +1 -1
  32. package/internals/index.d.ts +1 -1
  33. package/internals/index.js +1 -1
  34. package/legacy/DataGridPro/DataGridPro.js +10 -3
  35. package/legacy/components/DataGridProVirtualScroller.js +12 -12
  36. package/legacy/components/GridColumnHeaders.js +9 -3
  37. package/legacy/components/GridScrollArea.js +143 -0
  38. package/legacy/components/headerFiltering/GridHeaderFilterCell.js +39 -27
  39. package/legacy/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
  40. package/legacy/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
  41. package/legacy/components/headerFiltering/{GridHeaderFilterAdornment.js → GridHeaderFilterMenuContainer.js} +23 -25
  42. package/legacy/components/headerFiltering/index.js +3 -2
  43. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +14 -8
  44. package/legacy/hooks/features/columnResize/useGridColumnResize.js +11 -12
  45. package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
  46. package/legacy/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
  47. package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
  48. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +0 -8
  49. package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -0
  50. package/legacy/index.js +1 -1
  51. package/legacy/internals/index.js +1 -1
  52. package/legacy/material/icons.js +1 -4
  53. package/legacy/material/index.js +2 -3
  54. package/legacy/utils/releaseInfo.js +1 -1
  55. package/legacy/utils/tree/insertDataRowInTree.js +8 -24
  56. package/legacy/utils/tree/sortRowTree.js +78 -18
  57. package/legacy/utils/tree/utils.js +55 -37
  58. package/material/icons.d.ts +0 -3
  59. package/material/icons.js +1 -4
  60. package/material/index.d.ts +0 -1
  61. package/material/index.js +2 -3
  62. package/models/gridProIconSlotsComponent.d.ts +0 -5
  63. package/modern/DataGridPro/DataGridPro.js +10 -3
  64. package/modern/components/DataGridProVirtualScroller.js +12 -12
  65. package/modern/components/GridColumnHeaders.js +9 -3
  66. package/modern/components/GridScrollArea.js +140 -0
  67. package/modern/components/headerFiltering/GridHeaderFilterCell.js +36 -23
  68. package/modern/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
  69. package/modern/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
  70. package/{components/headerFiltering/GridHeaderFilterAdornment.js → modern/components/headerFiltering/GridHeaderFilterMenuContainer.js} +22 -25
  71. package/modern/components/headerFiltering/index.js +3 -2
  72. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +16 -8
  73. package/modern/hooks/features/columnResize/useGridColumnResize.js +11 -12
  74. package/modern/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
  75. package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
  76. package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
  77. package/modern/hooks/features/treeData/gridTreeDataUtils.js +0 -8
  78. package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -0
  79. package/modern/index.js +1 -1
  80. package/modern/internals/index.js +1 -1
  81. package/modern/material/icons.js +1 -4
  82. package/modern/material/index.js +2 -3
  83. package/modern/utils/releaseInfo.js +1 -1
  84. package/modern/utils/tree/insertDataRowInTree.js +8 -24
  85. package/modern/utils/tree/sortRowTree.js +64 -18
  86. package/modern/utils/tree/utils.js +43 -26
  87. package/node/DataGridPro/DataGridPro.js +10 -3
  88. package/node/components/DataGridProVirtualScroller.js +12 -12
  89. package/node/components/GridColumnHeaders.js +8 -3
  90. package/node/components/GridScrollArea.js +149 -0
  91. package/node/components/headerFiltering/GridHeaderFilterCell.js +36 -23
  92. package/node/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
  93. package/node/components/headerFiltering/GridHeaderFilterMenu.js +36 -14
  94. package/node/components/headerFiltering/{GridHeaderFilterAdornment.js → GridHeaderFilterMenuContainer.js} +22 -24
  95. package/node/components/headerFiltering/index.js +15 -4
  96. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +15 -7
  97. package/node/hooks/features/columnResize/useGridColumnResize.js +11 -12
  98. package/node/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
  99. package/node/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
  100. package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
  101. package/node/hooks/features/treeData/gridTreeDataUtils.js +0 -8
  102. package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -0
  103. package/node/index.js +1 -1
  104. package/node/internals/index.js +8 -1
  105. package/node/material/icons.js +2 -6
  106. package/node/material/index.js +1 -2
  107. package/node/utils/releaseInfo.js +1 -1
  108. package/node/utils/tree/insertDataRowInTree.js +7 -23
  109. package/node/utils/tree/sortRowTree.js +64 -18
  110. package/node/utils/tree/utils.js +46 -28
  111. package/package.json +6 -6
  112. package/themeAugmentation/overrides.d.ts +1 -1
  113. package/typeOverloads/modules.d.ts +6 -6
  114. package/utils/releaseInfo.js +1 -1
  115. package/utils/tree/insertDataRowInTree.js +8 -24
  116. package/utils/tree/sortRowTree.js +64 -18
  117. package/utils/tree/utils.d.ts +7 -38
  118. package/utils/tree/utils.js +43 -26
  119. package/components/headerFiltering/constants.d.ts +0 -3
  120. package/components/headerFiltering/constants.js +0 -30
  121. package/legacy/components/headerFiltering/constants.js +0 -30
  122. package/modern/components/headerFiltering/constants.js +0 -30
  123. package/node/components/headerFiltering/constants.js +0 -37
@@ -22,11 +22,7 @@ export const getNodePathInTree = ({
22
22
  path.reverse();
23
23
  return path;
24
24
  };
25
- export const addGroupDefaultExpansion = ({
26
- node,
27
- isGroupExpandedByDefault,
28
- defaultGroupingExpansionDepth
29
- }) => {
25
+ export const updateGroupDefaultExpansion = (node, defaultGroupingExpansionDepth, isGroupExpandedByDefault) => {
30
26
  let childrenExpanded;
31
27
  if (node.id === GRID_ROOT_GROUP_ID) {
32
28
  childrenExpanded = true;
@@ -35,20 +31,14 @@ export const addGroupDefaultExpansion = ({
35
31
  } else {
36
32
  childrenExpanded = defaultGroupingExpansionDepth === -1 || defaultGroupingExpansionDepth > node.depth;
37
33
  }
38
- return _extends({}, node, {
39
- childrenExpanded
40
- });
34
+ node.childrenExpanded = childrenExpanded;
35
+ return node;
41
36
  };
42
37
 
43
38
  /**
44
39
  * Insert a node in the tree
45
40
  */
46
- export const insertNodeInTree = ({
47
- node,
48
- previousTree,
49
- tree,
50
- treeDepths
51
- }) => {
41
+ export const insertNodeInTree = (node, tree, treeDepths, previousTree) => {
52
42
  var _treeDepths$node$dept;
53
43
  // 1. Insert node in the tree.
54
44
  tree[node.id] = node;
@@ -58,11 +48,7 @@ export const insertNodeInTree = ({
58
48
 
59
49
  // 3. Register the new node in its parent.
60
50
  const parentNode = tree[node.parent];
61
- if (node.type === 'footer') {
62
- // For footers,
63
- // Register the node from its parent `footerId` property.
64
- parentNode.footerId = node.id;
65
- } else if (node.type === 'group' || node.type === 'leaf') {
51
+ if (node.type === 'group' || node.type === 'leaf') {
66
52
  var _groupingField, _groupingKey, _parentNode$childrenF;
67
53
  // For groups and leaves,
68
54
  // Register the node from its parents `children` and `childrenFromPath` properties.
@@ -81,6 +67,10 @@ export const insertNodeInTree = ({
81
67
  } else {
82
68
  groupingField[groupingKeyName.toString()] = node.id;
83
69
  }
70
+ } else if (node.type === 'footer') {
71
+ // For footers,
72
+ // Register the node from its parent `footerId` property.
73
+ parentNode.footerId = node.id;
84
74
  }
85
75
  };
86
76
 
@@ -164,12 +154,7 @@ export const updateGroupNodeIdAndAutoGenerated = ({
164
154
 
165
155
  // 3. Add the new group in the tree
166
156
  const groupNode = _extends({}, node, updatedNode);
167
- insertNodeInTree({
168
- previousTree,
169
- node: groupNode,
170
- tree,
171
- treeDepths
172
- });
157
+ insertNodeInTree(groupNode, tree, treeDepths, previousTree);
173
158
  };
174
159
  export const createUpdatedGroupsManager = () => ({
175
160
  value: {},
@@ -179,4 +164,36 @@ export const createUpdatedGroupsManager = () => ({
179
164
  }
180
165
  this.value[groupId][action] = true;
181
166
  }
182
- });
167
+ });
168
+ export const getVisibleRowsLookup = ({
169
+ tree,
170
+ filteredRowsLookup
171
+ }) => {
172
+ if (!filteredRowsLookup) {
173
+ return {};
174
+ }
175
+ const visibleRowsLookup = {};
176
+ const handleTreeNode = (node, areAncestorsExpanded) => {
177
+ const isPassingFiltering = filteredRowsLookup[node.id];
178
+ if (node.type === 'group') {
179
+ node.children.forEach(childId => {
180
+ const childNode = tree[childId];
181
+ handleTreeNode(childNode, areAncestorsExpanded && !!node.childrenExpanded);
182
+ });
183
+ }
184
+ visibleRowsLookup[node.id] = isPassingFiltering && areAncestorsExpanded;
185
+
186
+ // TODO rows v6: Should we keep storing the visibility status of footer independently or rely on the group visibility in the selector ?
187
+ if (node.type === 'group' && node.footerId != null) {
188
+ visibleRowsLookup[node.footerId] = isPassingFiltering && areAncestorsExpanded && !!node.childrenExpanded;
189
+ }
190
+ };
191
+ const nodes = Object.values(tree);
192
+ for (let i = 0; i < nodes.length; i += 1) {
193
+ const node = nodes[i];
194
+ if (node.depth === 0) {
195
+ handleTreeNode(node, true);
196
+ }
197
+ }
198
+ return visibleRowsLookup;
199
+ };
@@ -1,3 +0,0 @@
1
- export declare const OPERATOR_SYMBOL_MAPPING: {
2
- [key: string]: string;
3
- };
@@ -1,30 +0,0 @@
1
- export const OPERATOR_SYMBOL_MAPPING = {
2
- contains: '∋',
3
- equals: '=',
4
- '=': '=',
5
- '!=': '≠',
6
- '>': '>',
7
- '>=': '≥',
8
- '<': '<',
9
- '<=': '≤',
10
- startsWith: '⊃',
11
- endsWith: '⊂',
12
- is: '=',
13
- not: '≠',
14
- isNot: '≠',
15
- isEmpty: '∅',
16
- isNotEmpty: '∉',
17
- isIn: '∈',
18
- isNotIn: '∉',
19
- isLessThan: '<',
20
- isLessThanOrEqual: '≤',
21
- isGreaterThan: '>',
22
- isGreaterThanOrEqual: '≥',
23
- isBetween: '∈',
24
- isNotBetween: '∉',
25
- isAnyOf: '∈',
26
- after: '>',
27
- onOrAfter: '≥',
28
- before: '<',
29
- onOrBefore: '≤'
30
- };
@@ -1,30 +0,0 @@
1
- export var OPERATOR_SYMBOL_MAPPING = {
2
- contains: '∋',
3
- equals: '=',
4
- '=': '=',
5
- '!=': '≠',
6
- '>': '>',
7
- '>=': '≥',
8
- '<': '<',
9
- '<=': '≤',
10
- startsWith: '⊃',
11
- endsWith: '⊂',
12
- is: '=',
13
- not: '≠',
14
- isNot: '≠',
15
- isEmpty: '∅',
16
- isNotEmpty: '∉',
17
- isIn: '∈',
18
- isNotIn: '∉',
19
- isLessThan: '<',
20
- isLessThanOrEqual: '≤',
21
- isGreaterThan: '>',
22
- isGreaterThanOrEqual: '≥',
23
- isBetween: '∈',
24
- isNotBetween: '∉',
25
- isAnyOf: '∈',
26
- after: '>',
27
- onOrAfter: '≥',
28
- before: '<',
29
- onOrBefore: '≤'
30
- };
@@ -1,30 +0,0 @@
1
- export const OPERATOR_SYMBOL_MAPPING = {
2
- contains: '∋',
3
- equals: '=',
4
- '=': '=',
5
- '!=': '≠',
6
- '>': '>',
7
- '>=': '≥',
8
- '<': '<',
9
- '<=': '≤',
10
- startsWith: '⊃',
11
- endsWith: '⊂',
12
- is: '=',
13
- not: '≠',
14
- isNot: '≠',
15
- isEmpty: '∅',
16
- isNotEmpty: '∉',
17
- isIn: '∈',
18
- isNotIn: '∉',
19
- isLessThan: '<',
20
- isLessThanOrEqual: '≤',
21
- isGreaterThan: '>',
22
- isGreaterThanOrEqual: '≥',
23
- isBetween: '∈',
24
- isNotBetween: '∉',
25
- isAnyOf: '∈',
26
- after: '>',
27
- onOrAfter: '≥',
28
- before: '<',
29
- onOrBefore: '≤'
30
- };
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.OPERATOR_SYMBOL_MAPPING = void 0;
7
- const OPERATOR_SYMBOL_MAPPING = {
8
- contains: '∋',
9
- equals: '=',
10
- '=': '=',
11
- '!=': '≠',
12
- '>': '>',
13
- '>=': '≥',
14
- '<': '<',
15
- '<=': '≤',
16
- startsWith: '⊃',
17
- endsWith: '⊂',
18
- is: '=',
19
- not: '≠',
20
- isNot: '≠',
21
- isEmpty: '∅',
22
- isNotEmpty: '∉',
23
- isIn: '∈',
24
- isNotIn: '∉',
25
- isLessThan: '<',
26
- isLessThanOrEqual: '≤',
27
- isGreaterThan: '>',
28
- isGreaterThanOrEqual: '≥',
29
- isBetween: '∈',
30
- isNotBetween: '∉',
31
- isAnyOf: '∈',
32
- after: '>',
33
- onOrAfter: '≥',
34
- before: '<',
35
- onOrBefore: '≤'
36
- };
37
- exports.OPERATOR_SYMBOL_MAPPING = OPERATOR_SYMBOL_MAPPING;