@mui/x-data-grid-pro 5.9.0 → 5.11.1

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 (161) hide show
  1. package/CHANGELOG.md +284 -10
  2. package/DataGridPro/DataGridPro.d.ts +1 -1
  3. package/DataGridPro/DataGridPro.js +50 -2
  4. package/DataGridPro/useDataGridProComponent.js +6 -2
  5. package/DataGridPro/useDataGridProProps.js +20 -5
  6. package/LICENSE +4 -4
  7. package/README.md +5 -4
  8. package/components/DataGridProColumnHeaders.js +2 -2
  9. package/components/DataGridProVirtualScroller.js +7 -4
  10. package/components/GridGroupingCriteriaCell.js +2 -2
  11. package/components/GridRowReorderCell.d.ts +5 -0
  12. package/components/GridRowReorderCell.js +72 -0
  13. package/components/GridTreeDataGroupingCell.js +2 -2
  14. package/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
  15. package/hooks/features/columnReorder/useGridColumnReorder.d.ts +0 -1
  16. package/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
  17. package/hooks/features/columnResize/useGridColumnResize.d.ts +0 -1
  18. package/hooks/features/columnResize/useGridColumnResize.js +13 -14
  19. package/hooks/features/detailPanel/useGridDetailPanel.js +4 -4
  20. package/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
  21. package/hooks/features/index.d.ts +1 -1
  22. package/hooks/features/index.js +1 -1
  23. package/hooks/features/infiniteLoader/useGridInfiniteLoader.d.ts +0 -1
  24. package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
  25. package/hooks/features/rowGrouping/createGroupingColDef.d.ts +1 -1
  26. package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +1 -1
  27. package/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
  28. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +0 -2
  29. package/hooks/features/rowGrouping/useGridRowGrouping.js +6 -8
  30. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
  31. package/hooks/features/rowReorder/gridRowReorderColDef.d.ts +2 -0
  32. package/hooks/features/rowReorder/gridRowReorderColDef.js +18 -0
  33. package/hooks/features/rowReorder/index.d.ts +1 -0
  34. package/hooks/features/rowReorder/index.js +1 -0
  35. package/hooks/features/rowReorder/useGridRowReorder.d.ts +8 -0
  36. package/hooks/features/rowReorder/useGridRowReorder.js +111 -0
  37. package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +4 -0
  38. package/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +51 -0
  39. package/hooks/features/treeData/useGridTreeData.d.ts +0 -3
  40. package/hooks/features/treeData/useGridTreeData.js +2 -6
  41. package/index.d.ts +6 -1
  42. package/index.js +7 -3
  43. package/internals/index.d.ts +19 -0
  44. package/internals/index.js +17 -0
  45. package/internals/package.json +6 -0
  46. package/legacy/DataGridPro/DataGridPro.js +50 -2
  47. package/legacy/DataGridPro/useDataGridProComponent.js +6 -2
  48. package/legacy/DataGridPro/useDataGridProProps.js +20 -5
  49. package/legacy/components/DataGridProColumnHeaders.js +2 -2
  50. package/legacy/components/DataGridProVirtualScroller.js +7 -4
  51. package/legacy/components/GridGroupingCriteriaCell.js +2 -2
  52. package/legacy/components/GridRowReorderCell.js +74 -0
  53. package/legacy/components/GridTreeDataGroupingCell.js +2 -2
  54. package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
  55. package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
  56. package/legacy/hooks/features/columnResize/useGridColumnResize.js +13 -14
  57. package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +4 -4
  58. package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
  59. package/legacy/hooks/features/index.js +1 -1
  60. package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
  61. package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -5
  62. package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +6 -8
  63. package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
  64. package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +20 -0
  65. package/legacy/hooks/features/rowReorder/index.js +1 -0
  66. package/legacy/hooks/features/rowReorder/useGridRowReorder.js +115 -0
  67. package/legacy/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +52 -0
  68. package/legacy/hooks/features/treeData/useGridTreeData.js +2 -6
  69. package/legacy/index.js +7 -3
  70. package/legacy/internals/index.js +17 -0
  71. package/legacy/models/gridRowOrderChangeParams.js +1 -0
  72. package/legacy/models/index.js +1 -2
  73. package/legacy/typeOverloads/index.js +1 -0
  74. package/legacy/utils/index.js +1 -0
  75. package/legacy/utils/releaseInfo.js +1 -1
  76. package/legacy/utils/tree/buildRowTree.js +11 -4
  77. package/legacy/utils/tree/index.js +1 -0
  78. package/models/dataGridProProps.d.ts +36 -24
  79. package/models/gridApiPro.d.ts +3 -2
  80. package/models/gridRowOrderChangeParams.d.ts +18 -0
  81. package/models/gridRowOrderChangeParams.js +1 -0
  82. package/models/gridStatePro.d.ts +4 -3
  83. package/models/index.d.ts +1 -2
  84. package/models/index.js +1 -2
  85. package/modern/DataGridPro/DataGridPro.js +50 -2
  86. package/modern/DataGridPro/useDataGridProComponent.js +6 -2
  87. package/modern/DataGridPro/useDataGridProProps.js +16 -3
  88. package/modern/components/DataGridProColumnHeaders.js +2 -2
  89. package/modern/components/DataGridProVirtualScroller.js +7 -4
  90. package/modern/components/GridGroupingCriteriaCell.js +2 -2
  91. package/modern/components/GridRowReorderCell.js +72 -0
  92. package/modern/components/GridTreeDataGroupingCell.js +2 -2
  93. package/modern/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
  94. package/modern/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
  95. package/modern/hooks/features/columnResize/useGridColumnResize.js +13 -14
  96. package/modern/hooks/features/detailPanel/useGridDetailPanel.js +4 -4
  97. package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
  98. package/modern/hooks/features/index.js +1 -1
  99. package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
  100. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
  101. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +6 -8
  102. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
  103. package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +18 -0
  104. package/modern/hooks/features/rowReorder/index.js +1 -0
  105. package/modern/hooks/features/rowReorder/useGridRowReorder.js +111 -0
  106. package/modern/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +51 -0
  107. package/modern/hooks/features/treeData/useGridTreeData.js +2 -6
  108. package/modern/index.js +7 -3
  109. package/modern/internals/index.js +17 -0
  110. package/modern/models/gridRowOrderChangeParams.js +1 -0
  111. package/modern/models/index.js +1 -2
  112. package/modern/typeOverloads/index.js +1 -0
  113. package/modern/utils/index.js +1 -0
  114. package/modern/utils/releaseInfo.js +1 -1
  115. package/modern/utils/tree/buildRowTree.js +9 -2
  116. package/modern/utils/tree/index.js +1 -0
  117. package/node/DataGridPro/DataGridPro.js +50 -2
  118. package/node/DataGridPro/useDataGridProComponent.js +10 -4
  119. package/node/DataGridPro/useDataGridProProps.js +21 -5
  120. package/node/components/DataGridProColumnHeaders.js +1 -1
  121. package/node/components/DataGridProVirtualScroller.js +6 -3
  122. package/node/components/GridGroupingCriteriaCell.js +1 -1
  123. package/node/components/GridRowReorderCell.js +92 -0
  124. package/node/components/GridTreeDataGroupingCell.js +1 -1
  125. package/node/hooks/features/columnPinning/useGridColumnPinning.js +3 -3
  126. package/node/hooks/features/columnReorder/useGridColumnReorder.js +7 -8
  127. package/node/hooks/features/columnResize/useGridColumnResize.js +12 -13
  128. package/node/hooks/features/detailPanel/useGridDetailPanel.js +3 -3
  129. package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
  130. package/node/hooks/features/index.js +4 -4
  131. package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +3 -4
  132. package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
  133. package/node/hooks/features/rowGrouping/useGridRowGrouping.js +5 -7
  134. package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +4 -4
  135. package/node/hooks/features/rowReorder/gridRowReorderColDef.js +31 -0
  136. package/node/hooks/features/rowReorder/index.js +18 -0
  137. package/node/hooks/features/rowReorder/useGridRowReorder.js +126 -0
  138. package/node/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +70 -0
  139. package/node/hooks/features/treeData/useGridTreeData.js +1 -4
  140. package/node/index.js +45 -3
  141. package/node/internals/index.js +193 -0
  142. package/node/models/gridRowOrderChangeParams.js +5 -0
  143. package/node/models/index.js +4 -4
  144. package/node/typeOverloads/index.js +18 -0
  145. package/node/utils/index.js +18 -0
  146. package/node/utils/releaseInfo.js +1 -1
  147. package/node/utils/tree/buildRowTree.js +12 -2
  148. package/node/utils/tree/index.js +13 -0
  149. package/package.json +6 -5
  150. package/typeOverloads/index.d.ts +1 -0
  151. package/typeOverloads/index.js +1 -0
  152. package/typeOverloads/modules.d.ts +41 -15
  153. package/typeOverloads/package.json +6 -0
  154. package/utils/index.d.ts +1 -0
  155. package/utils/index.js +1 -0
  156. package/utils/package.json +6 -0
  157. package/utils/releaseInfo.js +1 -1
  158. package/utils/tree/buildRowTree.d.ts +1 -0
  159. package/utils/tree/buildRowTree.js +9 -2
  160. package/utils/tree/index.d.ts +1 -0
  161. package/utils/tree/index.js +1 -0
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "getGroupRowIdFromPath", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _buildRowTree.getGroupRowIdFromPath;
10
+ }
11
+ });
12
+
13
+ var _buildRowTree = require("./buildRowTree");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "5.9.0",
4
- "description": "The commercial edition of the data grid component (MUI X).",
3
+ "version": "5.11.1",
4
+ "description": "The Pro plan edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
7
7
  "license": "SEE LICENSE IN LICENSE",
@@ -31,9 +31,10 @@
31
31
  "directory": "packages/grid/x-data-grid-pro"
32
32
  },
33
33
  "dependencies": {
34
- "@mui/utils": "^5.6.0",
35
- "@mui/x-data-grid": "5.9.0",
36
- "@mui/x-license-pro": "5.9.0",
34
+ "@babel/runtime": "^7.17.2",
35
+ "@mui/utils": "^5.7.0",
36
+ "@mui/x-data-grid": "5.11.1",
37
+ "@mui/x-license-pro": "5.11.1",
37
38
  "@types/format-util": "^1.0.2",
38
39
  "clsx": "^1.0.4",
39
40
  "prop-types": "^15.8.1",
@@ -0,0 +1 @@
1
+ export * from './modules';
@@ -0,0 +1 @@
1
+ export * from './modules';
@@ -1,19 +1,53 @@
1
- import { GridKeyValue, GridValidRowModel } from '@mui/x-data-grid';
2
- import type { GridRowScrollEndParams, GridGroupingValueGetterParams } from '../models';
3
- import type { GridPinnedColumns, GridRowGroupingModel } from '../hooks';
1
+ import { GridKeyValue, GridRowId, GridValidRowModel } from '@mui/x-data-grid';
2
+ import type { GridRowScrollEndParams, GridRowOrderChangeParams } from '../models';
3
+ import type { GridPinnedColumns } from '../hooks';
4
4
  import type { GridCanBeReorderedPreProcessingContext } from '../hooks/features/columnReorder/columnReorderInterfaces';
5
+ import { GridGroupingValueGetterParams } from '../models/gridGroupingValueGetterParams';
6
+ import { GridRowGroupingModel } from '../hooks/features/rowGrouping';
5
7
  export interface GridControlledStateEventLookupPro {
6
- rowGroupingModelChange: {
7
- params: GridRowGroupingModel;
8
+ /**
9
+ * Fired when the open detail panels are changed.
10
+ * @ignore - do not document.
11
+ */
12
+ detailPanelsExpandedRowIdsChange: {
13
+ params: GridRowId[];
8
14
  };
15
+ /**
16
+ * Fired when the pinned columns is changed.
17
+ * @ignore - do not document.
18
+ */
9
19
  pinnedColumnsChange: {
10
20
  params: GridPinnedColumns;
11
21
  };
22
+ /**
23
+ * Fired when the row grouping model changes.
24
+ * TODO: Add back on premium when removing it from pro
25
+ */
26
+ rowGroupingModelChange: {
27
+ params: GridRowGroupingModel;
28
+ };
29
+ }
30
+ export interface GridColDefPro<R extends GridValidRowModel = any, V = any, F = V> {
31
+ /**
32
+ * Function that transforms a complex cell value into a key that be used for grouping the rows.
33
+ * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
34
+ * @returns {GridKeyValue | null | undefined} The cell key.
35
+ */
36
+ groupingValueGetter?: (params: GridGroupingValueGetterParams<V, R>) => GridKeyValue | null | undefined;
12
37
  }
13
38
  export interface GridEventLookupPro {
39
+ /**
40
+ * Fired when scrolling to the bottom of the grid viewport.
41
+ */
14
42
  rowsScrollEnd: {
15
43
  params: GridRowScrollEndParams;
16
44
  };
45
+ /**
46
+ * Fired when the user ends reordering a row.
47
+ */
48
+ rowOrderChange: {
49
+ params: GridRowOrderChangeParams;
50
+ };
17
51
  }
18
52
  export interface GridPipeProcessingLookupPro {
19
53
  canBeReordered: {
@@ -21,19 +55,11 @@ export interface GridPipeProcessingLookupPro {
21
55
  context: GridCanBeReorderedPreProcessingContext;
22
56
  };
23
57
  }
24
- export interface GridColDefPro<R extends GridValidRowModel = any, V = any, F = V> {
25
- /**
26
- * Function that transforms a complex cell value into a key that be used for grouping the rows.
27
- * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
28
- * @returns {GridKeyValue | null | undefined} The cell key.
29
- */
30
- groupingValueGetter?: (params: GridGroupingValueGetterParams<V, R>) => GridKeyValue | null | undefined;
31
- }
32
58
  declare module '@mui/x-data-grid' {
33
- interface GridColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridColDefPro<R, V, F> {
34
- }
35
59
  interface GridEventLookup extends GridEventLookupPro {
36
60
  }
61
+ interface GridColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridColDefPro<R, V, F> {
62
+ }
37
63
  interface GridControlledStateEventLookup extends GridControlledStateEventLookupPro {
38
64
  }
39
65
  interface GridPipeProcessingLookup extends GridPipeProcessingLookupPro {
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/typeOverloads/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1 @@
1
+ export * from './tree';
package/utils/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './tree';
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/utils/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY0OTg4NzIwMDAwMA==";
3
+ const releaseInfo = "MTY1Mjk5NzYwMDAwMA==";
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).
@@ -14,6 +14,7 @@ interface BuildRowTreeParams extends GridRowTreeCreationParams {
14
14
  groupingName: string;
15
15
  onDuplicatePath?: (firstId: GridRowId, secondId: GridRowId, path: BuildRowTreeGroupingCriteria[]) => void;
16
16
  }
17
+ export declare const getGroupRowIdFromPath: (path: BuildRowTreeGroupingCriteria[]) => string;
17
18
  /**
18
19
  * Transform a list of rows into a tree structure where each row references its parent and children.
19
20
  * If a row have a parent which does not exist in the input rows, creates an auto generated row
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
-
2
+ export const getGroupRowIdFromPath = path => {
3
+ const pathStr = path.map(groupingCriteria => `${groupingCriteria.field}/${groupingCriteria.key}`).join('-');
4
+ return `auto-generated-row-${pathStr}`;
5
+ };
3
6
  /**
4
7
  * Transform a list of rows into a tree structure where each row references its parent and children.
5
8
  * If a row have a parent which does not exist in the input rows, creates an auto generated row
@@ -29,6 +32,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
29
32
  }
30
33
  ```
31
34
  */
35
+
32
36
  export const buildRowTree = params => {
33
37
  // During the build, we store the children as a Record to avoid linear complexity when checking if a children is already defined.
34
38
  const tempTree = {};
@@ -37,6 +41,8 @@ export const buildRowTree = params => {
37
41
 
38
42
  const idRowsLookup = _extends({}, params.idRowsLookup);
39
43
 
44
+ const idToIdLookup = _extends({}, params.idToIdLookup);
45
+
40
46
  const groupingCriteriaToIdTree = {};
41
47
 
42
48
  const isGroupExpandedByDefault = node => {
@@ -92,7 +98,7 @@ export const buildRowTree = params => {
92
98
  if (depth === row.path.length - 1) {
93
99
  nodeId = row.id;
94
100
  } else {
95
- nodeId = `auto-generated-row-${row.path.map(groupingCriteria => `${groupingCriteria.field}/${groupingCriteria.key}`).slice(0, depth + 1).join('-')}`;
101
+ nodeId = getGroupRowIdFromPath(row.path.slice(0, depth + 1));
96
102
  }
97
103
 
98
104
  keyConfig = {
@@ -174,6 +180,7 @@ export const buildRowTree = params => {
174
180
  treeDepth,
175
181
  ids,
176
182
  idRowsLookup,
183
+ idToIdLookup,
177
184
  groupingName: params.groupingName
178
185
  };
179
186
  };
@@ -0,0 +1 @@
1
+ export { getGroupRowIdFromPath } from './buildRowTree';
@@ -0,0 +1 @@
1
+ export { getGroupRowIdFromPath } from './buildRowTree';