@mui/x-data-grid-premium 8.10.2 → 8.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.
- package/CHANGELOG.md +214 -13
- package/DataGridPremium/DataGridPremium.js +6 -4
- package/DataGridPremium/useDataGridPremiumComponent.d.ts +2 -1
- package/DataGridPremium/useDataGridPremiumComponent.js +2 -2
- package/esm/DataGridPremium/DataGridPremium.js +6 -4
- package/esm/DataGridPremium/useDataGridPremiumComponent.d.ts +2 -1
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +2 -2
- package/esm/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +1 -0
- package/esm/hooks/features/clipboard/useGridClipboardImport.js +1 -1
- package/esm/hooks/features/export/serializer/setupExcelExportWebWorker.js +1 -2
- package/esm/hooks/features/rowGrouping/createGroupingColDef.d.ts +2 -1
- package/esm/hooks/features/rowGrouping/createGroupingColDef.js +31 -7
- package/esm/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +1 -0
- package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
- package/esm/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
- package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +48 -2
- package/esm/hooks/features/rowReorder/operations.d.ts +40 -0
- package/esm/hooks/features/rowReorder/operations.js +535 -0
- package/esm/hooks/features/rowReorder/reorderExecutor.d.ts +15 -0
- package/esm/hooks/features/rowReorder/reorderExecutor.js +25 -0
- package/esm/hooks/features/rowReorder/reorderValidator.d.ts +16 -0
- package/esm/hooks/features/rowReorder/reorderValidator.js +116 -0
- package/esm/hooks/features/rowReorder/types.d.ts +42 -0
- package/esm/hooks/features/rowReorder/types.js +1 -0
- package/esm/hooks/features/rowReorder/utils.d.ts +127 -0
- package/esm/hooks/features/rowReorder/utils.js +343 -0
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +7 -0
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +52 -0
- package/esm/index.js +1 -1
- package/esm/models/gridGroupingValueSetter.d.ts +14 -0
- package/esm/models/gridGroupingValueSetter.js +1 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/typeOverloads/modules.d.ts +7 -1
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +1 -0
- package/hooks/features/clipboard/useGridClipboardImport.js +1 -1
- package/hooks/features/export/serializer/setupExcelExportWebWorker.js +1 -2
- package/hooks/features/rowGrouping/createGroupingColDef.d.ts +2 -1
- package/hooks/features/rowGrouping/createGroupingColDef.js +31 -7
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +1 -0
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -1
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
- package/hooks/features/rowGrouping/useGridRowGrouping.js +46 -0
- package/hooks/features/rowReorder/operations.d.ts +40 -0
- package/hooks/features/rowReorder/operations.js +546 -0
- package/hooks/features/rowReorder/reorderExecutor.d.ts +15 -0
- package/hooks/features/rowReorder/reorderExecutor.js +31 -0
- package/hooks/features/rowReorder/reorderValidator.d.ts +16 -0
- package/hooks/features/rowReorder/reorderValidator.js +122 -0
- package/hooks/features/rowReorder/types.d.ts +42 -0
- package/hooks/features/rowReorder/types.js +5 -0
- package/hooks/features/rowReorder/utils.d.ts +127 -0
- package/hooks/features/rowReorder/utils.js +360 -0
- package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +7 -0
- package/hooks/features/rows/useGridRowsOverridableMethods.js +60 -0
- package/index.js +1 -1
- package/models/gridGroupingValueSetter.d.ts +14 -0
- package/models/gridGroupingValueSetter.js +5 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/package.json +14 -14
- package/typeOverloads/modules.d.ts +7 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useGridRowsOverridableMethods = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
10
|
+
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
11
|
+
var _reorderExecutor = require("../rowReorder/reorderExecutor");
|
|
12
|
+
const useGridRowsOverridableMethods = (apiRef, props) => {
|
|
13
|
+
const {
|
|
14
|
+
processRowUpdate,
|
|
15
|
+
onProcessRowUpdateError
|
|
16
|
+
} = props;
|
|
17
|
+
const setRowIndex = React.useCallback(async (sourceRowId, targetOriginalIndex) => {
|
|
18
|
+
const sortedFilteredRowIds = (0, _xDataGridPro.gridExpandedSortedRowIdsSelector)(apiRef);
|
|
19
|
+
const sortedFilteredRowIndexLookup = (0, _internals.gridExpandedSortedRowIndexLookupSelector)(apiRef);
|
|
20
|
+
const rowTree = (0, _xDataGridPro.gridRowTreeSelector)(apiRef);
|
|
21
|
+
const sourceNode = (0, _xDataGridPro.gridRowNodeSelector)(apiRef, sourceRowId);
|
|
22
|
+
if (!sourceNode) {
|
|
23
|
+
throw new Error(`MUI X: No row with id #${sourceRowId} found.`);
|
|
24
|
+
}
|
|
25
|
+
if (sourceNode.type === 'footer') {
|
|
26
|
+
throw new Error(`MUI X: The row reordering do not support reordering of footer rows.`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Row Grouping Reordering Use Cases
|
|
31
|
+
* =================================
|
|
32
|
+
*
|
|
33
|
+
* | Case | Source Node | Target Node | Parent Relationship | Action |
|
|
34
|
+
* | :--- | :---------- | :---------- | :------------------------ | :-------------------------------------------------------------------------- |
|
|
35
|
+
* | A ✅ | Leaf | Leaf | Same parent | Swap positions (similar to flat tree structure) |
|
|
36
|
+
* | B ✅ | Group | Group | Same parent | Swap positions (along with their descendants) |
|
|
37
|
+
* | C ✅ | Leaf | Leaf | Different parents | Make source node a child of target's parent and update parent nodes in tree |
|
|
38
|
+
* | D ✅ | Leaf | Group | Different parents | Make source a child of target, only allowed at same depth as source.parent |
|
|
39
|
+
* | E ❌ | Leaf | Group | Target is source's parent | Not allowed, will have no difference |
|
|
40
|
+
* | F ❌ | Group | Leaf | Any | Not allowed, will break the row grouping criteria |
|
|
41
|
+
* | G ✅ | Group | Group | Different parents | Only allowed at same depth to preserve grouping criteria |
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
const executionContext = {
|
|
45
|
+
sourceRowId,
|
|
46
|
+
placeholderIndex: targetOriginalIndex,
|
|
47
|
+
sortedFilteredRowIds,
|
|
48
|
+
sortedFilteredRowIndexLookup,
|
|
49
|
+
rowTree,
|
|
50
|
+
apiRef,
|
|
51
|
+
processRowUpdate,
|
|
52
|
+
onProcessRowUpdateError
|
|
53
|
+
};
|
|
54
|
+
await _reorderExecutor.rowGroupingReorderExecutor.execute(executionContext);
|
|
55
|
+
}, [apiRef, processRowUpdate, onProcessRowUpdateError]);
|
|
56
|
+
return {
|
|
57
|
+
setRowIndex
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
exports.useGridRowsOverridableMethods = useGridRowsOverridableMethods;
|
package/index.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
+
import { GridValidRowModel, GridColDef, GridKeyValue } from '@mui/x-data-grid-pro';
|
|
3
|
+
import { GridApiPremium } from "./gridApiPremium.js";
|
|
4
|
+
/**
|
|
5
|
+
* Function signature for setting a grouping value on a row.
|
|
6
|
+
* This is the inverse operation of GridGroupingValueGetter.
|
|
7
|
+
*
|
|
8
|
+
* @param {GridKeyValue | null | undefined} groupingValue The grouping value to set
|
|
9
|
+
* @param {R} row The row to update
|
|
10
|
+
* @param {GridColDef<R>} column The column definition
|
|
11
|
+
* @param {RefObject<GridApiPremium>} apiRef Reference to the grid API
|
|
12
|
+
* @returns {R} The updated row with the new grouping value applied
|
|
13
|
+
*/
|
|
14
|
+
export type GridGroupingValueSetter<R extends GridValidRowModel = GridValidRowModel> = (groupingValue: GridKeyValue | null | undefined, row: R, column: GridColDef<R>, apiRef: RefObject<GridApiPremium>) => R;
|
package/models/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./gridApiPremium.js";
|
|
2
2
|
export * from "./gridGroupingValueGetter.js";
|
|
3
|
+
export * from "./gridGroupingValueSetter.js";
|
|
3
4
|
export * from "./gridPremiumIconSlotsComponent.js";
|
|
4
5
|
export * from "./gridPremiumSlotsComponent.js";
|
|
5
6
|
export * from "./gridPastedValueParser.js";
|
package/models/index.js
CHANGED
|
@@ -25,6 +25,17 @@ Object.keys(_gridGroupingValueGetter).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
+
var _gridGroupingValueSetter = require("./gridGroupingValueSetter");
|
|
29
|
+
Object.keys(_gridGroupingValueSetter).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _gridGroupingValueSetter[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _gridGroupingValueSetter[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
28
39
|
var _gridPremiumIconSlotsComponent = require("./gridPremiumIconSlotsComponent");
|
|
29
40
|
Object.keys(_gridPremiumIconSlotsComponent).forEach(function (key) {
|
|
30
41
|
if (key === "default" || key === "__esModule") return;
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-premium",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Premium plan edition of the MUI X Data Grid Components.",
|
|
6
|
-
"main": "./index.js",
|
|
7
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
7
|
"bugs": {
|
|
9
8
|
"url": "https://github.com/mui/mui-x/issues"
|
|
@@ -40,10 +39,10 @@
|
|
|
40
39
|
"clsx": "^2.1.1",
|
|
41
40
|
"exceljs": "^4.4.0",
|
|
42
41
|
"prop-types": "^15.8.1",
|
|
43
|
-
"@mui/x-data-grid
|
|
44
|
-
"@mui/x-
|
|
45
|
-
"@mui/x-
|
|
46
|
-
"@mui/x-license": "8.
|
|
42
|
+
"@mui/x-data-grid": "8.11.1",
|
|
43
|
+
"@mui/x-internals": "8.11.1",
|
|
44
|
+
"@mui/x-data-grid-pro": "8.11.1",
|
|
45
|
+
"@mui/x-license": "8.11.1"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
48
|
"@emotion/react": "^11.9.0",
|
|
@@ -65,27 +64,28 @@
|
|
|
65
64
|
"node": ">=14.0.0"
|
|
66
65
|
},
|
|
67
66
|
"type": "commonjs",
|
|
67
|
+
"main": "./index.js",
|
|
68
68
|
"types": "./index.d.ts",
|
|
69
69
|
"exports": {
|
|
70
70
|
"./package.json": "./package.json",
|
|
71
71
|
".": {
|
|
72
|
-
"import": {
|
|
73
|
-
"types": "./esm/index.d.ts",
|
|
74
|
-
"default": "./esm/index.js"
|
|
75
|
-
},
|
|
76
72
|
"require": {
|
|
77
73
|
"types": "./index.d.ts",
|
|
78
74
|
"default": "./index.js"
|
|
75
|
+
},
|
|
76
|
+
"default": {
|
|
77
|
+
"types": "./esm/index.d.ts",
|
|
78
|
+
"default": "./esm/index.js"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"./*": {
|
|
82
|
-
"import": {
|
|
83
|
-
"types": "./esm/*/index.d.ts",
|
|
84
|
-
"default": "./esm/*/index.js"
|
|
85
|
-
},
|
|
86
82
|
"require": {
|
|
87
83
|
"types": "./*/index.d.ts",
|
|
88
84
|
"default": "./*/index.js"
|
|
85
|
+
},
|
|
86
|
+
"default": {
|
|
87
|
+
"types": "./esm/*/index.d.ts",
|
|
88
|
+
"default": "./esm/*/index.js"
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"./esm": null
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GridExportDisplayOptions, GridValidRowModel } from '@mui/x-data-grid-pro';
|
|
2
2
|
import type { GridPipeProcessingLookupPro, GridControlledStateEventLookupPro, GridApiCachesPro, GridEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
|
|
3
|
-
import type { GridGroupingValueGetter, GridPastedValueParser } from "../models/index.js";
|
|
3
|
+
import type { GridGroupingValueGetter, GridGroupingValueSetter, GridPastedValueParser } from "../models/index.js";
|
|
4
4
|
import type { GridRowGroupingModel, GridAggregationModel, GridAggregationCellMeta, GridAggregationHeaderMeta, GridCellSelectionModel, Conversation } from "../hooks/index.js";
|
|
5
5
|
import { GridRowGroupingInternalCache } from "../hooks/features/rowGrouping/gridRowGroupingInterfaces.js";
|
|
6
6
|
import { GridAggregationInternalCache } from "../hooks/features/aggregation/gridAggregationInterfaces.js";
|
|
@@ -107,6 +107,12 @@ export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F
|
|
|
107
107
|
* @returns {GridKeyValue | null | undefined} The cell key.
|
|
108
108
|
*/
|
|
109
109
|
groupingValueGetter?: GridGroupingValueGetter<R>;
|
|
110
|
+
/**
|
|
111
|
+
* Function that takes a grouping value and updates the row data accordingly.
|
|
112
|
+
* This is the inverse operation of `groupingValueGetter`.
|
|
113
|
+
* @returns {R} The updated row.
|
|
114
|
+
*/
|
|
115
|
+
groupingValueSetter?: GridGroupingValueSetter<R>;
|
|
110
116
|
/**
|
|
111
117
|
* Function that takes the clipboard-pasted value and converts it to a value used internally.
|
|
112
118
|
* @returns {V} The converted value.
|