@mui/x-data-grid-premium 6.0.0-beta.4 → 6.0.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.
- package/CHANGELOG.md +204 -29
- package/DataGridPremium/DataGridPremium.js +21 -4
- package/DataGridPremium/useDataGridPremiumComponent.js +1 -1
- package/DataGridPremium/useDataGridPremiumProps.js +26 -19
- package/components/GridAggregationHeader.js +3 -2
- package/components/GridColumnMenuAggregationItem.js +1 -1
- package/components/GridColumnMenuRowGroupItem.js +1 -1
- package/components/GridColumnMenuRowUngroupItem.js +2 -2
- package/components/GridExcelExportMenuItem.js +2 -1
- package/components/GridFooterCell.js +1 -3
- package/components/GridGroupingCriteriaCell.js +4 -4
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/constants/dataGridPremiumDefaultSlotsComponents.d.ts +1 -2
- package/constants/dataGridPremiumDefaultSlotsComponents.js +2 -7
- package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +2 -0
- package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
- package/hooks/features/export/gridExcelExportInterface.d.ts +11 -0
- package/hooks/features/export/index.d.ts +1 -0
- package/hooks/features/export/index.js +2 -1
- package/hooks/features/export/serializer/excelSerializer.d.ts +52 -3
- package/hooks/features/export/serializer/excelSerializer.js +137 -51
- package/hooks/features/export/useGridExcelExport.d.ts +2 -1
- package/hooks/features/export/useGridExcelExport.js +67 -12
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/legacy/DataGridPremium/DataGridPremium.js +21 -4
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +1 -1
- package/legacy/DataGridPremium/useDataGridPremiumProps.js +21 -20
- package/legacy/components/GridAggregationHeader.js +3 -2
- package/legacy/components/GridColumnMenuAggregationItem.js +1 -1
- package/legacy/components/GridColumnMenuRowGroupItem.js +1 -1
- package/legacy/components/GridColumnMenuRowUngroupItem.js +2 -2
- package/legacy/components/GridExcelExportMenuItem.js +2 -1
- package/legacy/components/GridFooterCell.js +1 -3
- package/legacy/components/GridGroupingCriteriaCell.js +4 -4
- package/legacy/components/index.js +1 -1
- package/legacy/constants/dataGridPremiumDefaultSlotsComponents.js +2 -7
- package/legacy/hooks/features/export/index.js +2 -1
- package/legacy/hooks/features/export/serializer/excelSerializer.js +227 -72
- package/legacy/hooks/features/export/useGridExcelExport.js +125 -36
- package/legacy/index.js +2 -1
- package/legacy/material/index.js +9 -0
- package/legacy/utils/releaseInfo.js +1 -1
- package/material/index.d.ts +7 -0
- package/material/index.js +9 -0
- package/material/package.json +6 -0
- package/models/dataGridPremiumProps.d.ts +13 -3
- package/models/gridPremiumSlotsComponent.d.ts +4 -1
- package/modern/DataGridPremium/DataGridPremium.js +21 -4
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +1 -1
- package/modern/DataGridPremium/useDataGridPremiumProps.js +21 -17
- package/modern/components/GridAggregationHeader.js +3 -2
- package/modern/components/GridColumnMenuAggregationItem.js +1 -1
- package/modern/components/GridColumnMenuRowGroupItem.js +1 -1
- package/modern/components/GridColumnMenuRowUngroupItem.js +2 -2
- package/modern/components/GridExcelExportMenuItem.js +2 -1
- package/modern/components/GridFooterCell.js +1 -3
- package/modern/components/GridGroupingCriteriaCell.js +3 -3
- package/modern/components/index.js +1 -1
- package/modern/constants/dataGridPremiumDefaultSlotsComponents.js +2 -7
- package/modern/hooks/features/export/index.js +2 -1
- package/modern/hooks/features/export/serializer/excelSerializer.js +131 -47
- package/modern/hooks/features/export/useGridExcelExport.js +67 -12
- package/modern/index.js +2 -1
- package/modern/material/index.js +9 -0
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +19 -2
- package/node/DataGridPremium/useDataGridPremiumComponent.js +1 -1
- package/node/DataGridPremium/useDataGridPremiumProps.js +21 -17
- package/node/components/GridAggregationHeader.js +3 -2
- package/node/components/GridColumnMenuAggregationItem.js +1 -1
- package/node/components/GridColumnMenuRowGroupItem.js +1 -1
- package/node/components/GridColumnMenuRowUngroupItem.js +2 -2
- package/node/components/GridExcelExportMenuItem.js +2 -1
- package/node/components/GridFooterCell.js +1 -3
- package/node/components/GridGroupingCriteriaCell.js +3 -3
- package/node/components/index.js +1 -1
- package/node/constants/dataGridPremiumDefaultSlotsComponents.js +3 -9
- package/node/hooks/features/export/index.js +12 -1
- package/node/hooks/features/export/serializer/excelSerializer.js +136 -45
- package/node/hooks/features/export/useGridExcelExport.js +66 -10
- package/node/index.js +9 -1
- package/node/material/index.js +17 -0
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +4 -4
- package/typeOverloads/modules.d.ts +6 -0
- package/utils/releaseInfo.js +1 -1
- /package/legacy/{components → material}/icons.js +0 -0
- /package/{components → material}/icons.d.ts +0 -0
- /package/{components → material}/icons.js +0 -0
- /package/modern/{components → material}/icons.js +0 -0
- /package/node/{components → material}/icons.js +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
var _excluded = ["worker", "exceljsPostProcess", "exceljsPreProcess", "columnsStyles", "includeHeaders", "getRowsToExport", "valueOptionsSheetName"];
|
|
3
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
6
|
import * as React from 'react';
|
|
5
|
-
import { useGridApiMethod, useGridLogger } from '@mui/x-data-grid';
|
|
7
|
+
import { useGridApiMethod, useGridLogger, useGridApiOptionHandler } from '@mui/x-data-grid';
|
|
6
8
|
import { useGridRegisterPipeProcessor, exportAs, getColumnsToExport, defaultGetRowsToExport } from '@mui/x-data-grid/internals';
|
|
7
|
-
import { buildExcel } from './serializer/excelSerializer';
|
|
9
|
+
import { buildExcel, getDataForValueOptionsSheet, serializeColumns, serializeRow } from './serializer/excelSerializer';
|
|
8
10
|
import { GridExcelExportMenuItem } from '../../../components';
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -15,7 +17,7 @@ import { GridExcelExportMenuItem } from '../../../components';
|
|
|
15
17
|
* @requires useGridParamsApi (method)
|
|
16
18
|
*/
|
|
17
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
-
export var useGridExcelExport = function useGridExcelExport(apiRef) {
|
|
20
|
+
export var useGridExcelExport = function useGridExcelExport(apiRef, props) {
|
|
19
21
|
var logger = useGridLogger(apiRef, 'useGridExcelExport');
|
|
20
22
|
var getDataAsExcel = React.useCallback(function () {
|
|
21
23
|
var _options$getRowsToExp, _options$includeHeade, _options$includeColum;
|
|
@@ -40,43 +42,129 @@ export var useGridExcelExport = function useGridExcelExport(apiRef) {
|
|
|
40
42
|
exceljsPostProcess: options == null ? void 0 : options.exceljsPostProcess
|
|
41
43
|
}, apiRef.current);
|
|
42
44
|
}, [logger, apiRef]);
|
|
43
|
-
var exportDataAsExcel = React.useCallback( /*#__PURE__*/function () {
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
45
|
+
var exportDataAsExcel = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
46
|
+
var options,
|
|
47
|
+
workerFn,
|
|
48
|
+
exceljsPostProcess,
|
|
49
|
+
exceljsPreProcess,
|
|
50
|
+
columnsStyles,
|
|
51
|
+
includeHeaders,
|
|
52
|
+
_options$getRowsToExp2,
|
|
53
|
+
getRowsToExport,
|
|
54
|
+
_options$valueOptions,
|
|
55
|
+
valueOptionsSheetName,
|
|
56
|
+
cloneableOptions,
|
|
57
|
+
sendExcelToUser,
|
|
58
|
+
workbook,
|
|
59
|
+
content,
|
|
60
|
+
worker,
|
|
61
|
+
exportedRowIds,
|
|
62
|
+
exportedColumns,
|
|
63
|
+
valueOptionsData,
|
|
64
|
+
serializedColumns,
|
|
65
|
+
serializedRows,
|
|
66
|
+
columnGroupPaths,
|
|
67
|
+
message,
|
|
68
|
+
_args2 = arguments;
|
|
69
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
70
|
+
while (1) {
|
|
71
|
+
switch (_context2.prev = _context2.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
74
|
+
workerFn = options.worker, exceljsPostProcess = options.exceljsPostProcess, exceljsPreProcess = options.exceljsPreProcess, columnsStyles = options.columnsStyles, includeHeaders = options.includeHeaders, _options$getRowsToExp2 = options.getRowsToExport, getRowsToExport = _options$getRowsToExp2 === void 0 ? defaultGetRowsToExport : _options$getRowsToExp2, _options$valueOptions = options.valueOptionsSheetName, valueOptionsSheetName = _options$valueOptions === void 0 ? 'Options' : _options$valueOptions, cloneableOptions = _objectWithoutProperties(options, _excluded);
|
|
75
|
+
sendExcelToUser = function sendExcelToUser(buffer) {
|
|
76
|
+
var blob = new Blob([buffer], {
|
|
66
77
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
67
78
|
});
|
|
68
79
|
exportAs(blob, 'xlsx', options == null ? void 0 : options.fileName);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
};
|
|
81
|
+
if (workerFn) {
|
|
82
|
+
_context2.next = 16;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
apiRef.current.publishEvent('excelExportStateChange', 'pending');
|
|
86
|
+
_context2.next = 7;
|
|
87
|
+
return getDataAsExcel(options);
|
|
88
|
+
case 7:
|
|
89
|
+
workbook = _context2.sent;
|
|
90
|
+
if (!(workbook === null)) {
|
|
91
|
+
_context2.next = 10;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
return _context2.abrupt("return");
|
|
95
|
+
case 10:
|
|
96
|
+
_context2.next = 12;
|
|
97
|
+
return workbook.xlsx.writeBuffer();
|
|
98
|
+
case 12:
|
|
99
|
+
content = _context2.sent;
|
|
100
|
+
apiRef.current.publishEvent('excelExportStateChange', 'finished');
|
|
101
|
+
sendExcelToUser(content);
|
|
102
|
+
return _context2.abrupt("return");
|
|
103
|
+
case 16:
|
|
104
|
+
if (exceljsPostProcess && process.env.NODE_ENV !== 'production') {
|
|
105
|
+
console.warn(["MUI: The exceljsPostProcess option is not supported when a web worker is used.", 'As alternative, pass the callback to the same option in setupExcelExportWebWorker.'].join('\n'));
|
|
106
|
+
}
|
|
107
|
+
if (exceljsPreProcess && process.env.NODE_ENV !== 'production') {
|
|
108
|
+
console.warn(["MUI: The exceljsPreProcess option is not supported when a web worker is used.", 'As alternative, pass the callback to the same option in setupExcelExportWebWorker.'].join('\n'));
|
|
109
|
+
}
|
|
110
|
+
worker = workerFn();
|
|
111
|
+
apiRef.current.publishEvent('excelExportStateChange', 'pending');
|
|
112
|
+
worker.onmessage = /*#__PURE__*/function () {
|
|
113
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
114
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
115
|
+
while (1) {
|
|
116
|
+
switch (_context.prev = _context.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
sendExcelToUser(event.data);
|
|
119
|
+
apiRef.current.publishEvent('excelExportStateChange', 'finished');
|
|
120
|
+
worker.terminate();
|
|
121
|
+
case 3:
|
|
122
|
+
case "end":
|
|
123
|
+
return _context.stop();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}, _callee);
|
|
127
|
+
}));
|
|
128
|
+
return function (_x) {
|
|
129
|
+
return _ref2.apply(this, arguments);
|
|
130
|
+
};
|
|
131
|
+
}();
|
|
132
|
+
exportedRowIds = getRowsToExport({
|
|
133
|
+
apiRef: apiRef
|
|
134
|
+
});
|
|
135
|
+
exportedColumns = getColumnsToExport({
|
|
136
|
+
apiRef: apiRef,
|
|
137
|
+
options: options
|
|
138
|
+
});
|
|
139
|
+
_context2.next = 25;
|
|
140
|
+
return getDataForValueOptionsSheet(exportedColumns, valueOptionsSheetName, apiRef.current);
|
|
141
|
+
case 25:
|
|
142
|
+
valueOptionsData = _context2.sent;
|
|
143
|
+
serializedColumns = serializeColumns(exportedColumns, options.columnsStyles || {});
|
|
144
|
+
serializedRows = exportedRowIds.map(function (id) {
|
|
145
|
+
return serializeRow(id, exportedColumns, apiRef.current, valueOptionsData);
|
|
146
|
+
});
|
|
147
|
+
columnGroupPaths = exportedColumns.reduce(function (acc, column) {
|
|
148
|
+
acc[column.field] = apiRef.current.unstable_getColumnGroupPath(column.field);
|
|
149
|
+
return acc;
|
|
150
|
+
}, {});
|
|
151
|
+
message = {
|
|
152
|
+
serializedColumns: serializedColumns,
|
|
153
|
+
serializedRows: serializedRows,
|
|
154
|
+
valueOptionsData: valueOptionsData,
|
|
155
|
+
columnGroupPaths: columnGroupPaths,
|
|
156
|
+
columnGroupDetails: apiRef.current.unstable_getAllGroupDetails(),
|
|
157
|
+
options: cloneableOptions,
|
|
158
|
+
valueOptionsSheetName: valueOptionsSheetName
|
|
159
|
+
};
|
|
160
|
+
worker.postMessage(message);
|
|
161
|
+
case 31:
|
|
162
|
+
case "end":
|
|
163
|
+
return _context2.stop();
|
|
73
164
|
}
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
return _ref.apply(this, arguments);
|
|
78
|
-
};
|
|
79
|
-
}(), [logger, getDataAsExcel]);
|
|
165
|
+
}
|
|
166
|
+
}, _callee2);
|
|
167
|
+
})), [apiRef, getDataAsExcel]);
|
|
80
168
|
var excelExportApi = {
|
|
81
169
|
getDataAsExcel: getDataAsExcel,
|
|
82
170
|
exportDataAsExcel: exportDataAsExcel
|
|
@@ -99,4 +187,5 @@ export var useGridExcelExport = function useGridExcelExport(apiRef) {
|
|
|
99
187
|
}]);
|
|
100
188
|
}, []);
|
|
101
189
|
useGridRegisterPipeProcessor(apiRef, 'exportMenu', addExportMenuButtons);
|
|
190
|
+
useGridApiOptionHandler(apiRef, 'excelExportStateChange', props.onExcelExportStateChange);
|
|
102
191
|
};
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid-premium v6.0.0
|
|
2
|
+
* @mui/x-data-grid-premium v6.0.0
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -23,5 +23,6 @@ export * from './DataGridPremium';
|
|
|
23
23
|
export * from './hooks';
|
|
24
24
|
export * from './models';
|
|
25
25
|
export * from './components';
|
|
26
|
+
export { GridColumnHeaders } from '@mui/x-data-grid-pro';
|
|
26
27
|
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
27
28
|
export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexports';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon } from './icons';
|
|
3
|
+
var iconsSlots = {
|
|
4
|
+
ColumnMenuUngroupIcon: GridWorkspacesIcon,
|
|
5
|
+
ColumnMenuGroupIcon: GridGroupWorkIcon,
|
|
6
|
+
ColumnMenuAggregationIcon: GridFunctionsIcon
|
|
7
|
+
};
|
|
8
|
+
var materialSlots = _extends({}, iconsSlots);
|
|
9
|
+
export default materialSlots;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export var getReleaseInfo = function getReleaseInfo() {
|
|
3
|
-
var releaseInfo = "
|
|
3
|
+
var releaseInfo = "MTY3Nzc5ODAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const materialSlots: {
|
|
3
|
+
ColumnMenuUngroupIcon: import("react").JSXElementConstructor<any>;
|
|
4
|
+
ColumnMenuGroupIcon: import("react").JSXElementConstructor<any>;
|
|
5
|
+
ColumnMenuAggregationIcon: import("react").JSXElementConstructor<any>;
|
|
6
|
+
};
|
|
7
|
+
export default materialSlots;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon } from './icons';
|
|
3
|
+
const iconsSlots = {
|
|
4
|
+
ColumnMenuUngroupIcon: GridWorkspacesIcon,
|
|
5
|
+
ColumnMenuGroupIcon: GridGroupWorkIcon,
|
|
6
|
+
ColumnMenuAggregationIcon: GridFunctionsIcon
|
|
7
|
+
};
|
|
8
|
+
const materialSlots = _extends({}, iconsSlots);
|
|
9
|
+
export default materialSlots;
|
|
@@ -3,7 +3,7 @@ import { GridCallbackDetails, GridValidRowModel, GridGroupNode } from '@mui/x-da
|
|
|
3
3
|
import { GridExperimentalProFeatures, DataGridProPropsWithDefaultValue, DataGridProPropsWithoutDefaultValue, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing } from '@mui/x-data-grid-pro/internals';
|
|
4
4
|
import type { GridRowGroupingModel } from '../hooks/features/rowGrouping';
|
|
5
5
|
import type { GridAggregationModel, GridAggregationFunction, GridAggregationPosition } from '../hooks/features/aggregation';
|
|
6
|
-
import { GridPremiumSlotsComponent } from './gridPremiumSlotsComponent';
|
|
6
|
+
import { GridPremiumSlotsComponent, UncapitalizedGridPremiumSlotsComponent } from './gridPremiumSlotsComponent';
|
|
7
7
|
import { GridInitialStatePremium } from './gridStatePremium';
|
|
8
8
|
import { GridApiPremium } from './gridApiPremium';
|
|
9
9
|
import { GridCellSelectionModel } from '../hooks/features/cellSelection';
|
|
@@ -12,8 +12,13 @@ export interface GridExperimentalPremiumFeatures extends GridExperimentalProFeat
|
|
|
12
12
|
export interface DataGridPremiumPropsWithComplexDefaultValueBeforeProcessing extends Pick<DataGridPropsWithComplexDefaultValueBeforeProcessing, 'localeText'> {
|
|
13
13
|
/**
|
|
14
14
|
* Overrideable components.
|
|
15
|
+
* @deprecated Use the `slots` prop instead.
|
|
15
16
|
*/
|
|
16
17
|
components?: Partial<GridPremiumSlotsComponent>;
|
|
18
|
+
/**
|
|
19
|
+
* Overrideable components.
|
|
20
|
+
*/
|
|
21
|
+
slots?: Partial<UncapitalizedGridPremiumSlotsComponent>;
|
|
17
22
|
}
|
|
18
23
|
/**
|
|
19
24
|
* The props users can give to the `DataGridPremiumProps` component.
|
|
@@ -26,12 +31,12 @@ export interface DataGridPremiumProps<R extends GridValidRowModel = any> extends
|
|
|
26
31
|
experimentalFeatures?: Partial<GridExperimentalPremiumFeatures>;
|
|
27
32
|
}
|
|
28
33
|
export interface DataGridPremiumPropsWithComplexDefaultValueAfterProcessing extends Pick<DataGridPropsWithComplexDefaultValueAfterProcessing, 'localeText'> {
|
|
29
|
-
|
|
34
|
+
slots: UncapitalizedGridPremiumSlotsComponent;
|
|
30
35
|
}
|
|
31
36
|
/**
|
|
32
37
|
* The props of the `DataGridPremium` component after the pre-processing phase.
|
|
33
38
|
*/
|
|
34
|
-
export interface DataGridPremiumProcessedProps extends DataGridPremiumPropsWithDefaultValue, DataGridPremiumPropsWithComplexDefaultValueAfterProcessing, DataGridPremiumPropsWithoutDefaultValue {
|
|
39
|
+
export interface DataGridPremiumProcessedProps extends DataGridPremiumPropsWithDefaultValue, DataGridPremiumPropsWithComplexDefaultValueAfterProcessing, Omit<DataGridPremiumPropsWithoutDefaultValue, 'componentsProps'> {
|
|
35
40
|
}
|
|
36
41
|
export type DataGridPremiumForcedPropsKey = 'signature';
|
|
37
42
|
/**
|
|
@@ -122,4 +127,9 @@ export interface DataGridPremiumPropsWithoutDefaultValue<R extends GridValidRowM
|
|
|
122
127
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
123
128
|
*/
|
|
124
129
|
unstable_onCellSelectionModelChange?: (cellSelectionModel: GridCellSelectionModel, details: GridCallbackDetails) => void;
|
|
130
|
+
/**
|
|
131
|
+
* Callback fired when the state of the Excel export changes.
|
|
132
|
+
* @param {string} inProgress Indicates if the task is in progress.
|
|
133
|
+
*/
|
|
134
|
+
onExcelExportStateChange?: (inProgress: 'pending' | 'finished') => void;
|
|
125
135
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GridProSlotsComponent } from '@mui/x-data-grid-pro';
|
|
1
|
+
import { GridProSlotsComponent, UncapitalizedGridProSlotsComponent } from '@mui/x-data-grid-pro';
|
|
2
|
+
import { UncapitalizeObjectKeys } from '@mui/x-data-grid-pro/internals';
|
|
2
3
|
import { GridPremiumIconSlotsComponent } from './gridPremiumIconSlotsComponent';
|
|
3
4
|
/**
|
|
4
5
|
* Grid components React prop interface containing all the overridable components
|
|
@@ -6,3 +7,5 @@ import { GridPremiumIconSlotsComponent } from './gridPremiumIconSlotsComponent';
|
|
|
6
7
|
*/
|
|
7
8
|
export interface GridPremiumSlotsComponent extends GridProSlotsComponent, GridPremiumIconSlotsComponent {
|
|
8
9
|
}
|
|
10
|
+
export interface UncapitalizedGridPremiumSlotsComponent extends UncapitalizedGridProSlotsComponent, UncapitalizeObjectKeys<GridPremiumIconSlotsComponent> {
|
|
11
|
+
}
|
|
@@ -2,8 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
|
|
4
4
|
import { chainPropTypes } from '@mui/utils';
|
|
5
|
-
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider } from '@mui/x-data-grid-pro';
|
|
6
|
-
import { DataGridProVirtualScroller
|
|
5
|
+
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider, useGridSelector, gridPinnedColumnsSelector } from '@mui/x-data-grid-pro';
|
|
6
|
+
import { DataGridProVirtualScroller } from '@mui/x-data-grid-pro/internals';
|
|
7
7
|
import { useDataGridPremiumComponent } from './useDataGridPremiumComponent';
|
|
8
8
|
import { useDataGridPremiumProps } from './useDataGridPremiumProps';
|
|
9
9
|
import { getReleaseInfo } from '../utils/releaseInfo';
|
|
@@ -14,6 +14,7 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
|
|
|
14
14
|
const props = useDataGridPremiumProps(inProps);
|
|
15
15
|
const privateApiRef = useDataGridPremiumComponent(props.apiRef, props);
|
|
16
16
|
useLicenseVerifier('x-data-grid-premium', releaseInfo);
|
|
17
|
+
const pinnedColumns = useGridSelector(privateApiRef, gridPinnedColumnsSelector);
|
|
17
18
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
18
19
|
privateApiRef: privateApiRef,
|
|
19
20
|
props: props,
|
|
@@ -23,8 +24,10 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
|
|
|
23
24
|
sx: props.sx,
|
|
24
25
|
ref: ref,
|
|
25
26
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
26
|
-
ColumnHeadersComponent: DataGridProColumnHeaders,
|
|
27
27
|
VirtualScrollerComponent: DataGridProVirtualScroller,
|
|
28
|
+
ColumnHeadersProps: {
|
|
29
|
+
pinnedColumns
|
|
30
|
+
},
|
|
28
31
|
children: /*#__PURE__*/_jsx(Watermark, {
|
|
29
32
|
packageName: "x-data-grid-premium",
|
|
30
33
|
releaseInfo: releaseInfo
|
|
@@ -130,10 +133,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
130
133
|
columnVisibilityModel: PropTypes.object,
|
|
131
134
|
/**
|
|
132
135
|
* Overrideable components.
|
|
136
|
+
* @deprecated Use the `slots` prop instead.
|
|
133
137
|
*/
|
|
134
138
|
components: PropTypes.object,
|
|
135
139
|
/**
|
|
136
140
|
* Overrideable components props dynamically passed to the component at rendering.
|
|
141
|
+
* @deprecated Use the `slotProps` prop instead.
|
|
137
142
|
*/
|
|
138
143
|
componentsProps: PropTypes.object,
|
|
139
144
|
/**
|
|
@@ -243,7 +248,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
243
248
|
experimentalFeatures: PropTypes.shape({
|
|
244
249
|
columnGrouping: PropTypes.bool,
|
|
245
250
|
lazyLoading: PropTypes.bool,
|
|
246
|
-
rowPinning: PropTypes.bool,
|
|
247
251
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
248
252
|
}),
|
|
249
253
|
/**
|
|
@@ -552,6 +556,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
552
556
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
553
557
|
*/
|
|
554
558
|
onDetailPanelExpandedRowIdsChange: PropTypes.func,
|
|
559
|
+
/**
|
|
560
|
+
* Callback fired when the state of the Excel export changes.
|
|
561
|
+
* @param {string} inProgress Indicates if the task is in progress.
|
|
562
|
+
*/
|
|
563
|
+
onExcelExportStateChange: PropTypes.func,
|
|
555
564
|
/**
|
|
556
565
|
* Callback fired when rowCount is set and the next batch of virtualized rows is rendered.
|
|
557
566
|
* @param {GridFetchRowsParams} params With all properties from [[GridFetchRowsParams]].
|
|
@@ -825,6 +834,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
825
834
|
* @default false
|
|
826
835
|
*/
|
|
827
836
|
showColumnVerticalBorder: PropTypes.bool,
|
|
837
|
+
/**
|
|
838
|
+
* Overrideable components props dynamically passed to the component at rendering.
|
|
839
|
+
*/
|
|
840
|
+
slotProps: PropTypes.object,
|
|
841
|
+
/**
|
|
842
|
+
* Overrideable components.
|
|
843
|
+
*/
|
|
844
|
+
slots: PropTypes.object,
|
|
828
845
|
/**
|
|
829
846
|
* Sorting can be processed on the server or client-side.
|
|
830
847
|
* Set it to 'client' if you would like to handle sorting on the client-side.
|
|
@@ -80,7 +80,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
80
80
|
useGridColumnMenu(privateApiRef);
|
|
81
81
|
useGridCsvExport(privateApiRef);
|
|
82
82
|
useGridPrintExport(privateApiRef, props);
|
|
83
|
-
useGridExcelExport(privateApiRef);
|
|
83
|
+
useGridExcelExport(privateApiRef, props);
|
|
84
84
|
useGridClipboard(privateApiRef);
|
|
85
85
|
useGridDimensions(privateApiRef, props);
|
|
86
86
|
useGridEvents(privateApiRef, props);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["components", "componentsProps"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { useThemeProps } from '@mui/material/styles';
|
|
4
6
|
import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT } from '@mui/x-data-grid-pro';
|
|
7
|
+
import { computeSlots, uncapitalizeObjectKeys } from '@mui/x-data-grid-pro/internals';
|
|
5
8
|
import { GRID_AGGREGATION_FUNCTIONS } from '../hooks/features/aggregation';
|
|
6
9
|
import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridPremiumDefaultSlotsComponents';
|
|
7
10
|
|
|
@@ -17,26 +20,27 @@ export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO
|
|
|
17
20
|
aggregationRowsScope: 'filtered',
|
|
18
21
|
getAggregationPosition: groupNode => groupNode.depth === -1 ? 'footer' : 'inline'
|
|
19
22
|
});
|
|
23
|
+
const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS);
|
|
20
24
|
export const useDataGridPremiumProps = inProps => {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const _useThemeProps = useThemeProps({
|
|
26
|
+
props: inProps,
|
|
27
|
+
name: 'MuiDataGrid'
|
|
28
|
+
}),
|
|
29
|
+
{
|
|
30
|
+
components,
|
|
31
|
+
componentsProps
|
|
32
|
+
} = _useThemeProps,
|
|
33
|
+
themedProps = _objectWithoutPropertiesLoose(_useThemeProps, _excluded);
|
|
25
34
|
const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const mergedComponents = {};
|
|
32
|
-
Object.entries(DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS).forEach(([key, defaultComponent]) => {
|
|
33
|
-
mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
|
|
34
|
-
});
|
|
35
|
-
return mergedComponents;
|
|
36
|
-
}, [themedProps.components]);
|
|
35
|
+
const slots = React.useMemo(() => computeSlots({
|
|
36
|
+
defaultSlots,
|
|
37
|
+
components,
|
|
38
|
+
slots: themedProps.slots
|
|
39
|
+
}), [components, themedProps.slots]);
|
|
37
40
|
return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
|
|
41
|
+
slotProps: themedProps.slotProps ?? componentsProps,
|
|
38
42
|
localeText,
|
|
39
|
-
|
|
43
|
+
slots,
|
|
40
44
|
signature: 'DataGridPremium'
|
|
41
|
-
}), [themedProps, localeText,
|
|
45
|
+
}), [themedProps, componentsProps, localeText, slots]);
|
|
42
46
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
3
4
|
import Box from '@mui/material/Box';
|
|
@@ -56,10 +57,10 @@ function GridAggregationHeader(props) {
|
|
|
56
57
|
} = props;
|
|
57
58
|
const apiRef = useGridApiContext();
|
|
58
59
|
const rootProps = useGridRootProps();
|
|
59
|
-
const ownerState = {
|
|
60
|
+
const ownerState = _extends({}, rootProps, {
|
|
60
61
|
classes: rootProps.classes,
|
|
61
62
|
colDef
|
|
62
|
-
};
|
|
63
|
+
});
|
|
63
64
|
const classes = useUtilityClasses(ownerState);
|
|
64
65
|
if (!aggregation) {
|
|
65
66
|
return null;
|
|
@@ -58,7 +58,7 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
58
58
|
return /*#__PURE__*/_jsxs(MenuItem, {
|
|
59
59
|
disableRipple: true,
|
|
60
60
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
61
|
-
children: /*#__PURE__*/_jsx(rootProps.
|
|
61
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
|
|
62
62
|
fontSize: "small"
|
|
63
63
|
})
|
|
64
64
|
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
@@ -28,7 +28,7 @@ function GridColumnMenuRowGroupItem(props) {
|
|
|
28
28
|
return /*#__PURE__*/_jsxs(MenuItem, {
|
|
29
29
|
onClick: ungroupColumn,
|
|
30
30
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
31
|
-
children: /*#__PURE__*/_jsx(rootProps.
|
|
31
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
|
|
32
32
|
fontSize: "small"
|
|
33
33
|
})
|
|
34
34
|
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
@@ -34,7 +34,7 @@ function GridColumnMenuRowUngroupItem(props) {
|
|
|
34
34
|
return /*#__PURE__*/_jsxs(MenuItem, {
|
|
35
35
|
onClick: ungroupColumn,
|
|
36
36
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
37
|
-
children: /*#__PURE__*/_jsx(rootProps.
|
|
37
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
|
|
38
38
|
fontSize: "small"
|
|
39
39
|
})
|
|
40
40
|
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
@@ -45,7 +45,7 @@ function GridColumnMenuRowUngroupItem(props) {
|
|
|
45
45
|
return /*#__PURE__*/_jsxs(MenuItem, {
|
|
46
46
|
onClick: groupColumn,
|
|
47
47
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
48
|
-
children: /*#__PURE__*/_jsx(rootProps.
|
|
48
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
|
|
49
49
|
fontSize: "small"
|
|
50
50
|
})
|
|
51
51
|
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
@@ -39,7 +39,8 @@ process.env.NODE_ENV !== "production" ? GridExcelExportMenuItem.propTypes = {
|
|
|
39
39
|
getRowsToExport: PropTypes.func,
|
|
40
40
|
includeColumnGroupsHeaders: PropTypes.bool,
|
|
41
41
|
includeHeaders: PropTypes.bool,
|
|
42
|
-
valueOptionsSheetName: PropTypes.string
|
|
42
|
+
valueOptionsSheetName: PropTypes.string,
|
|
43
|
+
worker: PropTypes.func
|
|
43
44
|
})
|
|
44
45
|
} : void 0;
|
|
45
46
|
export { GridExcelExportMenuItem };
|
|
@@ -33,9 +33,7 @@ function GridFooterCell(props) {
|
|
|
33
33
|
} = props,
|
|
34
34
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
35
35
|
const rootProps = useGridRootProps();
|
|
36
|
-
const ownerState =
|
|
37
|
-
classes: rootProps.classes
|
|
38
|
-
};
|
|
36
|
+
const ownerState = rootProps;
|
|
39
37
|
const classes = useUtilityClasses(ownerState);
|
|
40
38
|
return /*#__PURE__*/_jsx(GridFooterCellRoot, _extends({
|
|
41
39
|
ownerState: ownerState,
|
|
@@ -33,7 +33,7 @@ export function GridGroupingCriteriaCell(props) {
|
|
|
33
33
|
const classes = useUtilityClasses(ownerState);
|
|
34
34
|
const filteredDescendantCountLookup = useGridSelector(apiRef, gridFilteredDescendantCountLookupSelector);
|
|
35
35
|
const filteredDescendantCount = filteredDescendantCountLookup[rowNode.id] ?? 0;
|
|
36
|
-
const Icon = rowNode.childrenExpanded ? rootProps.
|
|
36
|
+
const Icon = rowNode.childrenExpanded ? rootProps.slots.groupingCriteriaCollapseIcon : rootProps.slots.groupingCriteriaExpandIcon;
|
|
37
37
|
const handleKeyDown = event => {
|
|
38
38
|
if (event.key === ' ') {
|
|
39
39
|
// We call event.stopPropagation to avoid unfolding the row and also scrolling to bottom
|
|
@@ -68,13 +68,13 @@ export function GridGroupingCriteriaCell(props) {
|
|
|
68
68
|
},
|
|
69
69
|
children: [/*#__PURE__*/_jsx("div", {
|
|
70
70
|
className: classes.toggle,
|
|
71
|
-
children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(rootProps.
|
|
71
|
+
children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
72
72
|
size: "small",
|
|
73
73
|
onClick: handleClick,
|
|
74
74
|
onKeyDown: handleKeyDown,
|
|
75
75
|
tabIndex: -1,
|
|
76
76
|
"aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand')
|
|
77
|
-
}, rootProps.
|
|
77
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
78
78
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
79
79
|
fontSize: "inherit"
|
|
80
80
|
})
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '@mui/x-data-grid-pro/internals';
|
|
3
|
-
import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon } from '../components';
|
|
4
3
|
import { GridPremiumColumnMenu } from '../components/GridPremiumColumnMenu';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ColumnMenuGroupIcon: GridGroupWorkIcon,
|
|
8
|
-
ColumnMenuAggregationIcon: GridFunctionsIcon
|
|
9
|
-
};
|
|
10
|
-
export const DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS, DEFAULT_GRID_PREMIUM_ICON_SLOTS_COMPONENTS, {
|
|
4
|
+
import materialSlots from '../material';
|
|
5
|
+
export const DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS, materialSlots, {
|
|
11
6
|
ColumnMenu: GridPremiumColumnMenu
|
|
12
7
|
});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './gridExcelExportInterface';
|
|
1
|
+
export * from './gridExcelExportInterface';
|
|
2
|
+
export { setupExcelExportWebWorker } from './serializer/excelSerializer';
|