@mui/x-data-grid-premium 5.11.0 → 5.12.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 +237 -16
- package/DataGridPremium/DataGridPremium.js +26 -2
- package/LICENSE +3 -3
- package/README.md +3 -4
- package/hooks/features/export/serializer/excelSerializer.js +33 -5
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +6 -5
- package/hooks/features/rowGrouping/useGridRowGrouping.js +9 -11
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
- package/index.d.ts +0 -1
- package/index.js +1 -2
- package/legacy/DataGridPremium/DataGridPremium.js +26 -2
- package/legacy/hooks/features/export/serializer/excelSerializer.js +33 -5
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +9 -13
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -31
- package/legacy/index.js +1 -2
- package/legacy/typeOverloads/index.js +2 -1
- package/legacy/typeOverloads/modules.js +1 -33
- package/legacy/utils/releaseInfo.js +1 -1
- package/modern/DataGridPremium/DataGridPremium.js +26 -2
- package/modern/hooks/features/export/serializer/excelSerializer.js +33 -5
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +14 -14
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
- package/modern/index.js +1 -2
- package/modern/typeOverloads/index.js +2 -1
- package/modern/typeOverloads/modules.js +1 -33
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +26 -2
- package/node/hooks/features/export/serializer/excelSerializer.js +33 -5
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +8 -10
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -27
- package/node/index.js +1 -3
- package/node/typeOverloads/index.js +3 -1
- package/node/typeOverloads/modules.js +5 -34
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +13 -16
- package/typeOverloads/index.d.ts +1 -0
- package/typeOverloads/index.js +2 -1
- package/typeOverloads/modules.d.ts +34 -0
- package/typeOverloads/modules.js +1 -33
- package/utils/releaseInfo.js +1 -1
|
@@ -31,13 +31,15 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
31
31
|
|
|
32
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
33
|
|
|
34
|
-
const rowGroupingStateInitializer = (state, props) => {
|
|
34
|
+
const rowGroupingStateInitializer = (state, props, apiRef) => {
|
|
35
35
|
var _ref, _props$rowGroupingMod, _props$initialState, _props$initialState$r;
|
|
36
36
|
|
|
37
|
+
apiRef.current.unstable_caches.rowGrouping = {
|
|
38
|
+
sanitizedModelOnLastRowTreeCreation: []
|
|
39
|
+
};
|
|
37
40
|
return (0, _extends2.default)({}, state, {
|
|
38
41
|
rowGrouping: {
|
|
39
|
-
model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : []
|
|
40
|
-
unstable_sanitizedModelOnLastRowTreeCreation: []
|
|
42
|
+
model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : []
|
|
41
43
|
}
|
|
42
44
|
});
|
|
43
45
|
};
|
|
@@ -51,7 +53,7 @@ const rowGroupingStateInitializer = (state, props) => {
|
|
|
51
53
|
exports.rowGroupingStateInitializer = rowGroupingStateInitializer;
|
|
52
54
|
|
|
53
55
|
const useGridRowGrouping = (apiRef, props) => {
|
|
54
|
-
apiRef.current.
|
|
56
|
+
apiRef.current.unstable_registerControlState({
|
|
55
57
|
stateId: 'rowGrouping',
|
|
56
58
|
propModel: props.rowGroupingModel,
|
|
57
59
|
propOnChange: props.onRowGroupingModelChange,
|
|
@@ -194,14 +196,10 @@ const useGridRowGrouping = (apiRef, props) => {
|
|
|
194
196
|
}, [apiRef, props.rowGroupingColumnMode]);
|
|
195
197
|
const checkGroupingColumnsModelDiff = React.useCallback(() => {
|
|
196
198
|
const rowGroupingModel = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)(apiRef);
|
|
197
|
-
const lastGroupingColumnsModelApplied =
|
|
199
|
+
const lastGroupingColumnsModelApplied = apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation;
|
|
198
200
|
|
|
199
201
|
if (!(0, _internals.isDeepEqual)(lastGroupingColumnsModelApplied, rowGroupingModel)) {
|
|
200
|
-
apiRef.current.
|
|
201
|
-
rowGrouping: (0, _extends2.default)({}, state.rowGrouping, {
|
|
202
|
-
unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
|
|
203
|
-
})
|
|
204
|
-
}));
|
|
202
|
+
apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
|
|
205
203
|
apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
|
|
206
204
|
(0, _gridRowGroupingUtils.setStrategyAvailability)(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
|
|
207
205
|
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|
|
@@ -97,15 +97,7 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
97
97
|
const createRowTree = React.useCallback(params => {
|
|
98
98
|
const rowGroupingModel = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)(apiRef);
|
|
99
99
|
const columnsLookup = (0, _xDataGridPro.gridColumnLookupSelector)(apiRef);
|
|
100
|
-
apiRef.current.
|
|
101
|
-
rowGrouping: (0, _extends2.default)({}, state.rowGrouping, {
|
|
102
|
-
unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
|
|
103
|
-
})
|
|
104
|
-
}));
|
|
105
|
-
const distinctValues = Object.fromEntries(rowGroupingModel.map(groupingField => [groupingField, {
|
|
106
|
-
lookup: {},
|
|
107
|
-
list: []
|
|
108
|
-
}]));
|
|
100
|
+
apiRef.current.unstable_caches.rowGrouping.sanitizedModelOnLastRowTreeCreation = rowGroupingModel;
|
|
109
101
|
|
|
110
102
|
const getCellGroupingCriteria = ({
|
|
111
103
|
row,
|
|
@@ -137,24 +129,6 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
137
129
|
};
|
|
138
130
|
};
|
|
139
131
|
|
|
140
|
-
params.ids.forEach(rowId => {
|
|
141
|
-
const row = params.idRowsLookup[rowId];
|
|
142
|
-
rowGroupingModel.forEach(groupingCriteria => {
|
|
143
|
-
const {
|
|
144
|
-
key
|
|
145
|
-
} = getCellGroupingCriteria({
|
|
146
|
-
row,
|
|
147
|
-
id: rowId,
|
|
148
|
-
colDef: columnsLookup[groupingCriteria]
|
|
149
|
-
});
|
|
150
|
-
const groupingFieldsDistinctKeys = distinctValues[groupingCriteria];
|
|
151
|
-
|
|
152
|
-
if (key != null && !groupingFieldsDistinctKeys.lookup[key.toString()]) {
|
|
153
|
-
groupingFieldsDistinctKeys.lookup[key.toString()] = true;
|
|
154
|
-
groupingFieldsDistinctKeys.list.push(key);
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
132
|
const rows = params.ids.map(rowId => {
|
|
159
133
|
const row = params.idRowsLookup[rowId];
|
|
160
134
|
const parentPath = rowGroupingModel.map(groupingField => getCellGroupingCriteria({
|
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.12.1
|
|
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.
|
|
@@ -41,8 +41,6 @@ Object.defineProperty(exports, "useGridRootProps", {
|
|
|
41
41
|
|
|
42
42
|
require("./typeOverloads");
|
|
43
43
|
|
|
44
|
-
require("@mui/x-data-grid-pro/typeOverloads");
|
|
45
|
-
|
|
46
44
|
var _xLicensePro = require("@mui/x-license-pro");
|
|
47
45
|
|
|
48
46
|
var _components = require("@mui/x-data-grid/components");
|
|
@@ -1,34 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// export interface GridControlledStateEventLookupPremium {
|
|
7
|
-
// /**
|
|
8
|
-
// * Fired when the row grouping model changes.
|
|
9
|
-
// */
|
|
10
|
-
// rowGroupingModelChange: { params: GridRowGroupingModel };
|
|
11
|
-
// }
|
|
12
|
-
//
|
|
13
|
-
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
-
// export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
|
|
15
|
-
// /**
|
|
16
|
-
// * Function that transforms a complex cell value into a key that be used for grouping the rows.
|
|
17
|
-
// * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
|
|
18
|
-
// * @returns {GridKeyValue | null | undefined} The cell key.
|
|
19
|
-
// */
|
|
20
|
-
// groupingValueGetter?: (
|
|
21
|
-
// params: GridGroupingValueGetterParams<V, R>,
|
|
22
|
-
// ) => GridKeyValue | null | undefined;
|
|
23
|
-
// }
|
|
24
|
-
//
|
|
25
|
-
// declare module '@mui/x-data-grid-pro' {
|
|
26
|
-
// export interface GridColDef<R extends GridValidRowModel = any, V = any, F = V>
|
|
27
|
-
// extends GridColDefPremium<R, V, F> {}
|
|
28
|
-
//
|
|
29
|
-
// // TODO: Remove explicit augmentation of pro package
|
|
30
|
-
// interface GridControlledStateEventLookup
|
|
31
|
-
// extends GridControlledStateEventLookupPro,
|
|
32
|
-
// GridControlledStateEventLookupPremium {}
|
|
33
|
-
// }
|
|
34
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
|
|
|
8
8
|
var _utils = require("@mui/utils");
|
|
9
9
|
|
|
10
10
|
const getReleaseInfo = () => {
|
|
11
|
-
const releaseInfo = "
|
|
11
|
+
const releaseInfo = "MTY1NDgxMjAwMDAwMA==";
|
|
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).
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-premium",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.1",
|
|
4
4
|
"description": "The Premium plan edition of the data grid component (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
7
|
-
"license": "SEE LICENSE IN LICENSE
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/mui/mui-x/issues"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://mui.com/
|
|
11
|
+
"homepage": "https://mui.com/x/react-data-grid/",
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -31,25 +31,22 @@
|
|
|
31
31
|
"directory": "packages/grid/x-data-grid-premium"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@mui/
|
|
36
|
-
"@mui/x-data-grid
|
|
37
|
-
"@mui/x-
|
|
34
|
+
"@babel/runtime": "^7.17.2",
|
|
35
|
+
"@mui/utils": "^5.4.1",
|
|
36
|
+
"@mui/x-data-grid": "5.12.1",
|
|
37
|
+
"@mui/x-data-grid-pro": "5.12.1",
|
|
38
|
+
"@mui/x-license-pro": "5.12.1",
|
|
38
39
|
"@types/format-util": "^1.0.2",
|
|
39
40
|
"clsx": "^1.0.4",
|
|
41
|
+
"exceljs": "^4.3.0",
|
|
40
42
|
"prop-types": "^15.8.1",
|
|
41
43
|
"reselect": "^4.1.5"
|
|
42
44
|
},
|
|
43
45
|
"peerDependencies": {
|
|
44
|
-
"@mui/material": "^5.
|
|
45
|
-
"@mui/system": "^5.
|
|
46
|
-
"
|
|
47
|
-
"react": "^17.0.2"
|
|
48
|
-
},
|
|
49
|
-
"peerDependenciesMeta": {
|
|
50
|
-
"exceljs": {
|
|
51
|
-
"optional": true
|
|
52
|
-
}
|
|
46
|
+
"@mui/material": "^5.4.1",
|
|
47
|
+
"@mui/system": "^5.4.1",
|
|
48
|
+
"react": "^17.0.2 || ^18.0.0",
|
|
49
|
+
"react-dom": "^17.0.2 || ^18.0.0"
|
|
53
50
|
},
|
|
54
51
|
"setupFiles": [
|
|
55
52
|
"<rootDir>/src/setupTests.js"
|
package/typeOverloads/index.d.ts
CHANGED
package/typeOverloads/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import '@mui/x-data-grid-pro/typeOverloads';
|
|
1
|
+
import '@mui/x-data-grid-pro/typeOverloads';
|
|
2
|
+
import './modules';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GridKeyValue, GridValidRowModel } from '@mui/x-data-grid-pro';
|
|
2
|
+
import type { GridControlledStateEventLookupPro, GridApiCachesPro } from '@mui/x-data-grid-pro/typeOverloads';
|
|
3
|
+
import type { GridGroupingValueGetterParams } from '../models';
|
|
4
|
+
import type { GridRowGroupingModel } from '../hooks';
|
|
5
|
+
import { GridRowGroupingInternalCache } from '../hooks/features/rowGrouping/gridRowGroupingInterfaces';
|
|
6
|
+
export interface GridControlledStateEventLookupPremium {
|
|
7
|
+
/**
|
|
8
|
+
* Fired when the row grouping model changes.
|
|
9
|
+
*/
|
|
10
|
+
rowGroupingModelChange: {
|
|
11
|
+
params: GridRowGroupingModel;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
|
|
15
|
+
/**
|
|
16
|
+
* Function that transforms a complex cell value into a key that be used for grouping the rows.
|
|
17
|
+
* @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
|
|
18
|
+
* @returns {GridKeyValue | null | undefined} The cell key.
|
|
19
|
+
*/
|
|
20
|
+
groupingValueGetter?: (params: GridGroupingValueGetterParams<V, R>) => GridKeyValue | null | undefined;
|
|
21
|
+
}
|
|
22
|
+
export interface GridApiCachesPremium extends GridApiCachesPro {
|
|
23
|
+
rowGrouping: GridRowGroupingInternalCache;
|
|
24
|
+
}
|
|
25
|
+
declare module '@mui/x-data-grid-pro' {
|
|
26
|
+
interface GridColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridColDefPremium<R, V, F> {
|
|
27
|
+
}
|
|
28
|
+
interface GridControlledStateEventLookup extends GridControlledStateEventLookupPro, GridControlledStateEventLookupPremium {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
declare module '@mui/x-data-grid-pro/internals' {
|
|
32
|
+
interface GridApiCaches extends GridApiCachesPremium {
|
|
33
|
+
}
|
|
34
|
+
}
|
package/typeOverloads/modules.js
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// import type { GridControlledStateEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
|
|
3
|
-
// import type { GridGroupingValueGetterParams } from '../models';
|
|
4
|
-
// import type { GridRowGroupingModel } from '../hooks';
|
|
5
|
-
//
|
|
6
|
-
// export interface GridControlledStateEventLookupPremium {
|
|
7
|
-
// /**
|
|
8
|
-
// * Fired when the row grouping model changes.
|
|
9
|
-
// */
|
|
10
|
-
// rowGroupingModelChange: { params: GridRowGroupingModel };
|
|
11
|
-
// }
|
|
12
|
-
//
|
|
13
|
-
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
-
// export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
|
|
15
|
-
// /**
|
|
16
|
-
// * Function that transforms a complex cell value into a key that be used for grouping the rows.
|
|
17
|
-
// * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
|
|
18
|
-
// * @returns {GridKeyValue | null | undefined} The cell key.
|
|
19
|
-
// */
|
|
20
|
-
// groupingValueGetter?: (
|
|
21
|
-
// params: GridGroupingValueGetterParams<V, R>,
|
|
22
|
-
// ) => GridKeyValue | null | undefined;
|
|
23
|
-
// }
|
|
24
|
-
//
|
|
25
|
-
// declare module '@mui/x-data-grid-pro' {
|
|
26
|
-
// export interface GridColDef<R extends GridValidRowModel = any, V = any, F = V>
|
|
27
|
-
// extends GridColDefPremium<R, V, F> {}
|
|
28
|
-
//
|
|
29
|
-
// // TODO: Remove explicit augmentation of pro package
|
|
30
|
-
// interface GridControlledStateEventLookup
|
|
31
|
-
// extends GridControlledStateEventLookupPro,
|
|
32
|
-
// GridControlledStateEventLookupPremium {}
|
|
33
|
-
// }
|
|
1
|
+
export {};
|
package/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY1NDgxMjAwMDAwMA==";
|
|
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).
|