@mui/x-data-grid-premium 7.26.0 → 7.27.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 +115 -0
- package/DataGridPremium/DataGridPremium.js +8 -0
- package/DataGridPremium/useDataGridPremiumComponent.js +2 -1
- package/esm/DataGridPremium/DataGridPremium.js +8 -0
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +3 -2
- package/esm/hooks/features/aggregation/createAggregationLookup.js +1 -1
- package/esm/hooks/features/aggregation/wrapColumnWithAggregation.js +6 -4
- package/esm/hooks/features/clipboard/useGridClipboardImport.js +2 -2
- package/esm/hooks/features/export/index.js +1 -1
- package/esm/hooks/features/export/serializer/excelSerializer.js +69 -180
- package/esm/hooks/features/export/serializer/setupExcelExportWebWorker.js +53 -0
- package/esm/hooks/features/export/serializer/utils.js +93 -0
- package/esm/hooks/features/export/useGridExcelExport.js +11 -5
- package/esm/hooks/features/rowGrouping/createGroupingColDef.js +5 -5
- package/esm/setupExcelExportWebWorker.js +1 -0
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/aggregation/createAggregationLookup.js +1 -1
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +2 -2
- package/hooks/features/aggregation/wrapColumnWithAggregation.js +6 -4
- package/hooks/features/clipboard/useGridClipboardImport.js +2 -2
- package/hooks/features/export/index.d.ts +1 -1
- package/hooks/features/export/index.js +2 -2
- package/hooks/features/export/serializer/excelSerializer.d.ts +3 -31
- package/hooks/features/export/serializer/excelSerializer.js +74 -187
- package/hooks/features/export/serializer/setupExcelExportWebWorker.d.ts +2 -0
- package/hooks/features/export/serializer/setupExcelExportWebWorker.js +59 -0
- package/hooks/features/export/serializer/utils.d.ts +36 -0
- package/hooks/features/export/serializer/utils.js +106 -0
- package/hooks/features/export/useGridExcelExport.js +10 -3
- package/hooks/features/rowGrouping/createGroupingColDef.js +4 -4
- package/index.js +1 -1
- package/modern/DataGridPremium/DataGridPremium.js +8 -0
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +3 -2
- package/modern/hooks/features/aggregation/createAggregationLookup.js +1 -1
- package/modern/hooks/features/aggregation/wrapColumnWithAggregation.js +6 -4
- package/modern/hooks/features/clipboard/useGridClipboardImport.js +2 -2
- package/modern/hooks/features/export/index.js +1 -1
- package/modern/hooks/features/export/serializer/excelSerializer.js +69 -180
- package/modern/hooks/features/export/serializer/setupExcelExportWebWorker.js +53 -0
- package/modern/hooks/features/export/serializer/utils.js +93 -0
- package/modern/hooks/features/export/useGridExcelExport.js +11 -5
- package/modern/hooks/features/rowGrouping/createGroupingColDef.js +5 -5
- package/modern/index.js +1 -1
- package/modern/setupExcelExportWebWorker.js +1 -0
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +5 -5
- package/setupExcelExportWebWorker.d.ts +1 -0
- package/setupExcelExportWebWorker.js +12 -0
- package/utils/releaseInfo.js +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { addColumnGroupingHeaders, addSerializedRowToWorksheet, createValueOptionsSheetIfNeeded, getExcelJs } from "./utils.js";
|
|
2
|
+
export function setupExcelExportWebWorker(workerOptions = {}) {
|
|
3
|
+
// eslint-disable-next-line no-restricted-globals
|
|
4
|
+
addEventListener('message', async event => {
|
|
5
|
+
const {
|
|
6
|
+
namespace,
|
|
7
|
+
serializedColumns,
|
|
8
|
+
serializedRows,
|
|
9
|
+
options,
|
|
10
|
+
valueOptionsSheetName,
|
|
11
|
+
valueOptionsData,
|
|
12
|
+
columnGroupDetails,
|
|
13
|
+
columnGroupPaths
|
|
14
|
+
} = event.data;
|
|
15
|
+
|
|
16
|
+
// workers share the pub-sub channel namespace. Use this property to filter out messages.
|
|
17
|
+
if (namespace !== 'mui-x-data-grid-export') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const {
|
|
21
|
+
exceljsPostProcess,
|
|
22
|
+
exceljsPreProcess
|
|
23
|
+
} = workerOptions;
|
|
24
|
+
const excelJS = await getExcelJs();
|
|
25
|
+
const workbook = new excelJS.Workbook();
|
|
26
|
+
const worksheet = workbook.addWorksheet('Sheet1');
|
|
27
|
+
worksheet.columns = serializedColumns;
|
|
28
|
+
if (exceljsPreProcess) {
|
|
29
|
+
await exceljsPreProcess({
|
|
30
|
+
workbook,
|
|
31
|
+
worksheet
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (options.includeColumnGroupsHeaders) {
|
|
35
|
+
addColumnGroupingHeaders(worksheet, serializedColumns, columnGroupPaths, columnGroupDetails);
|
|
36
|
+
}
|
|
37
|
+
const includeHeaders = options.includeHeaders ?? true;
|
|
38
|
+
if (includeHeaders) {
|
|
39
|
+
worksheet.addRow(serializedColumns.map(column => column.headerText));
|
|
40
|
+
}
|
|
41
|
+
createValueOptionsSheetIfNeeded(valueOptionsData, valueOptionsSheetName, workbook);
|
|
42
|
+
serializedRows.forEach(serializedRow => {
|
|
43
|
+
addSerializedRowToWorksheet(serializedRow, worksheet);
|
|
44
|
+
});
|
|
45
|
+
if (exceljsPostProcess) {
|
|
46
|
+
await exceljsPostProcess({
|
|
47
|
+
workbook,
|
|
48
|
+
worksheet
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
postMessage(await workbook.xlsx.writeBuffer());
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
export const getExcelJs = async () => {
|
|
3
|
+
const excelJsModule = await import('exceljs');
|
|
4
|
+
return excelJsModule.default ?? excelJsModule;
|
|
5
|
+
};
|
|
6
|
+
export const addColumnGroupingHeaders = (worksheet, columns, columnGroupPaths, columnGroupDetails) => {
|
|
7
|
+
const maxDepth = Math.max(...columns.map(({
|
|
8
|
+
key
|
|
9
|
+
}) => columnGroupPaths[key]?.length ?? 0));
|
|
10
|
+
if (maxDepth === 0) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
for (let rowIndex = 0; rowIndex < maxDepth; rowIndex += 1) {
|
|
14
|
+
const row = columns.map(({
|
|
15
|
+
key
|
|
16
|
+
}) => {
|
|
17
|
+
const groupingPath = columnGroupPaths[key];
|
|
18
|
+
if (groupingPath.length <= rowIndex) {
|
|
19
|
+
return {
|
|
20
|
+
groupId: null,
|
|
21
|
+
parents: groupingPath
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return _extends({}, columnGroupDetails[groupingPath[rowIndex]], {
|
|
25
|
+
parents: groupingPath.slice(0, rowIndex)
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
const newRow = worksheet.addRow(row.map(group => group.groupId === null ? null : group?.headerName ?? group.groupId));
|
|
29
|
+
|
|
30
|
+
// use `rowCount`, since worksheet can have additional rows added in `exceljsPreProcess`
|
|
31
|
+
const lastRowIndex = newRow.worksheet.rowCount;
|
|
32
|
+
let leftIndex = 0;
|
|
33
|
+
let rightIndex = 1;
|
|
34
|
+
while (rightIndex < columns.length) {
|
|
35
|
+
const {
|
|
36
|
+
groupId: leftGroupId,
|
|
37
|
+
parents: leftParents
|
|
38
|
+
} = row[leftIndex];
|
|
39
|
+
const {
|
|
40
|
+
groupId: rightGroupId,
|
|
41
|
+
parents: rightParents
|
|
42
|
+
} = row[rightIndex];
|
|
43
|
+
const areInSameGroup = leftGroupId === rightGroupId && leftParents.length === rightParents.length && leftParents.every((leftParent, index) => rightParents[index] === leftParent);
|
|
44
|
+
if (areInSameGroup) {
|
|
45
|
+
rightIndex += 1;
|
|
46
|
+
} else {
|
|
47
|
+
if (rightIndex - leftIndex > 1) {
|
|
48
|
+
worksheet.mergeCells(lastRowIndex, leftIndex + 1, lastRowIndex, rightIndex);
|
|
49
|
+
}
|
|
50
|
+
leftIndex = rightIndex;
|
|
51
|
+
rightIndex += 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (rightIndex - leftIndex > 1) {
|
|
55
|
+
worksheet.mergeCells(lastRowIndex, leftIndex + 1, lastRowIndex, rightIndex);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
export function addSerializedRowToWorksheet(serializedRow, worksheet) {
|
|
60
|
+
const {
|
|
61
|
+
row,
|
|
62
|
+
dataValidation,
|
|
63
|
+
outlineLevel,
|
|
64
|
+
mergedCells
|
|
65
|
+
} = serializedRow;
|
|
66
|
+
const newRow = worksheet.addRow(row);
|
|
67
|
+
Object.keys(dataValidation).forEach(field => {
|
|
68
|
+
newRow.getCell(field).dataValidation = _extends({}, dataValidation[field]);
|
|
69
|
+
});
|
|
70
|
+
if (outlineLevel) {
|
|
71
|
+
newRow.outlineLevel = outlineLevel;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// use `rowCount`, since worksheet can have additional rows added in `exceljsPreProcess`
|
|
75
|
+
const lastRowIndex = newRow.worksheet.rowCount;
|
|
76
|
+
mergedCells.forEach(mergedCell => {
|
|
77
|
+
worksheet.mergeCells(lastRowIndex, mergedCell.leftIndex, lastRowIndex, mergedCell.rightIndex);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export async function createValueOptionsSheetIfNeeded(valueOptionsData, sheetName, workbook) {
|
|
81
|
+
if (Object.keys(valueOptionsData).length === 0) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const valueOptionsWorksheet = workbook.addWorksheet(sheetName);
|
|
85
|
+
valueOptionsWorksheet.columns = Object.keys(valueOptionsData).map(key => ({
|
|
86
|
+
key
|
|
87
|
+
}));
|
|
88
|
+
Object.entries(valueOptionsData).forEach(([field, {
|
|
89
|
+
values
|
|
90
|
+
}]) => {
|
|
91
|
+
valueOptionsWorksheet.getColumn(field).values = values;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -5,7 +5,7 @@ import { useGridApiMethod, useGridLogger, useGridApiOptionHandler } from '@mui/x
|
|
|
5
5
|
import { useGridRegisterPipeProcessor, exportAs, getColumnsToExport, defaultGetRowsToExport } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { buildExcel, getDataForValueOptionsSheet, serializeColumns, serializeRowUnsafe } from "./serializer/excelSerializer.js";
|
|
7
7
|
import { GridExcelExportMenuItem } from "../../../components/index.js";
|
|
8
|
-
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
/**
|
|
10
10
|
* @requires useGridColumns (state)
|
|
11
11
|
* @requires useGridFilter (state)
|
|
@@ -13,7 +13,6 @@ import { GridExcelExportMenuItem } from "../../../components/index.js";
|
|
|
13
13
|
* @requires useGridSelection (state)
|
|
14
14
|
* @requires useGridParamsApi (method)
|
|
15
15
|
*/
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
16
|
export const useGridExcelExport = (apiRef, props) => {
|
|
18
17
|
const logger = useGridLogger(apiRef, 'useGridExcelExport');
|
|
19
18
|
const getDataAsExcel = React.useCallback((options = {}) => {
|
|
@@ -89,15 +88,22 @@ export const useGridExcelExport = (apiRef, props) => {
|
|
|
89
88
|
const valueOptionsData = await getDataForValueOptionsSheet(exportedColumns, valueOptionsSheetName, apiRef.current);
|
|
90
89
|
const serializedColumns = serializeColumns(exportedColumns, options.columnsStyles || {});
|
|
91
90
|
apiRef.current.resetColSpan();
|
|
92
|
-
const serializedRows =
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
const serializedRows = [];
|
|
92
|
+
for (let i = 0; i < exportedRowIds.length; i += 1) {
|
|
93
|
+
const id = exportedRowIds[i];
|
|
94
|
+
const serializedRow = serializeRowUnsafe(id, exportedColumns, apiRef, valueOptionsData, {
|
|
95
|
+
escapeFormulas: options.escapeFormulas ?? true
|
|
96
|
+
});
|
|
97
|
+
serializedRows.push(serializedRow);
|
|
98
|
+
}
|
|
95
99
|
apiRef.current.resetColSpan();
|
|
96
100
|
const columnGroupPaths = exportedColumns.reduce((acc, column) => {
|
|
97
101
|
acc[column.field] = apiRef.current.getColumnGroupPath(column.field);
|
|
98
102
|
return acc;
|
|
99
103
|
}, {});
|
|
100
104
|
const message = {
|
|
105
|
+
// workers share the pub-sub channel namespace. Use this property to filter out messages.
|
|
106
|
+
namespace: 'mui-x-data-grid-export',
|
|
101
107
|
serializedColumns,
|
|
102
108
|
serializedRows,
|
|
103
109
|
valueOptionsData,
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["leafField", "mainGroupingCriteria", "hideDescendantCount"],
|
|
4
4
|
_excluded2 = ["leafField", "mainGroupingCriteria", "hideDescendantCount"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid-pro';
|
|
6
|
+
import { GRID_STRING_COL_DEF, gridRowIdSelector, gridRowTreeSelector } from '@mui/x-data-grid-pro';
|
|
7
7
|
import { isSingleSelectColDef } from '@mui/x-data-grid-pro/internals';
|
|
8
8
|
import { GridGroupingColumnFooterCell } from "../../../components/GridGroupingColumnFooterCell.js";
|
|
9
9
|
import { GridGroupingCriteriaCell } from "../../../components/GridGroupingCriteriaCell.js";
|
|
@@ -138,8 +138,8 @@ export const createGroupingColDefForOneGroupingCriteria = ({
|
|
|
138
138
|
return '';
|
|
139
139
|
},
|
|
140
140
|
valueGetter: (value, row, column, apiRef) => {
|
|
141
|
-
const rowId = apiRef.current.
|
|
142
|
-
const rowNode = apiRef
|
|
141
|
+
const rowId = gridRowIdSelector(apiRef.current.state, row);
|
|
142
|
+
const rowNode = gridRowTreeSelector(apiRef)[rowId];
|
|
143
143
|
if (!rowNode || rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
144
144
|
return undefined;
|
|
145
145
|
}
|
|
@@ -230,8 +230,8 @@ export const createGroupingColDefForAllGroupingCriteria = ({
|
|
|
230
230
|
}));
|
|
231
231
|
},
|
|
232
232
|
valueGetter: (value, row) => {
|
|
233
|
-
const rowId = apiRef.current.
|
|
234
|
-
const rowNode = apiRef
|
|
233
|
+
const rowId = gridRowIdSelector(apiRef.current.state, row);
|
|
234
|
+
const rowNode = gridRowTreeSelector(apiRef)[rowId];
|
|
235
235
|
if (!rowNode || rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
236
236
|
return undefined;
|
|
237
237
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setupExcelExportWebWorker } from "./hooks/features/export/serializer/setupExcelExportWebWorker.js";
|
package/esm/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 = "MTc0MDQzODAwMDAwMA==";
|
|
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
|
|
@@ -32,7 +32,7 @@ const getAggregationCellValue = ({
|
|
|
32
32
|
// A.B.A
|
|
33
33
|
// A.B.B
|
|
34
34
|
const rowNode = apiRef.current.getRowNode(rowId);
|
|
35
|
-
if (rowNode
|
|
35
|
+
if (rowNode?.type === 'group') {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
if (typeof aggregationFunction.getCellValue === 'function') {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RefObject } from '@mui/x-internals/types';
|
|
3
3
|
import { GridColDef, GridFilterOperator } from '@mui/x-data-grid-pro';
|
|
4
|
-
import { GridBaseColDef } from '@mui/x-data-grid-pro/internals';
|
|
4
|
+
import { type GridBaseColDef } from '@mui/x-data-grid-pro/internals';
|
|
5
5
|
import { GridApiPremium } from '../../../models/gridApiPremium';
|
|
6
|
-
import { GridAggregationRule } from './gridAggregationInterfaces';
|
|
6
|
+
import type { GridAggregationRule } from './gridAggregationInterfaces';
|
|
7
7
|
declare const AGGREGATION_WRAPPABLE_PROPERTIES: readonly ["valueGetter", "valueFormatter", "renderCell", "renderHeader", "filterOperators"];
|
|
8
8
|
type WrappableColumnProperty = (typeof AGGREGATION_WRAPPABLE_PROPERTIES)[number];
|
|
9
9
|
interface GridColDefWithAggregationWrappers extends GridBaseColDef {
|
|
@@ -9,6 +9,7 @@ exports.wrapColumnWithAggregationValue = exports.unwrapColumnFromAggregation = v
|
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
12
13
|
var _gridAggregationSelectors = require("./gridAggregationSelectors");
|
|
13
14
|
var _GridFooterCell = require("../../../components/GridFooterCell");
|
|
14
15
|
var _GridAggregationHeader = require("../../../components/GridAggregationHeader");
|
|
@@ -20,7 +21,7 @@ const getAggregationValueWrappedValueGetter = ({
|
|
|
20
21
|
getCellAggregationResult
|
|
21
22
|
}) => {
|
|
22
23
|
const wrappedValueGetter = (value, row, column, apiRef) => {
|
|
23
|
-
const rowId = apiRef.current.
|
|
24
|
+
const rowId = (0, _xDataGridPro.gridRowIdSelector)(apiRef.current.state, row);
|
|
24
25
|
const cellAggregationResult = rowId ? getCellAggregationResult(rowId, column.field) : null;
|
|
25
26
|
if (cellAggregationResult != null) {
|
|
26
27
|
return cellAggregationResult?.value ?? null;
|
|
@@ -43,7 +44,7 @@ const getAggregationValueWrappedValueFormatter = ({
|
|
|
43
44
|
return valueFormatter;
|
|
44
45
|
}
|
|
45
46
|
const wrappedValueFormatter = (value, row, column, apiRef) => {
|
|
46
|
-
const rowId = apiRef.current.
|
|
47
|
+
const rowId = (0, _xDataGridPro.gridRowIdSelector)(apiRef.current.state, row);
|
|
47
48
|
if (rowId != null) {
|
|
48
49
|
const cellAggregationResult = getCellAggregationResult(rowId, column.field);
|
|
49
50
|
if (cellAggregationResult != null) {
|
|
@@ -102,7 +103,8 @@ const getWrappedFilterOperators = ({
|
|
|
102
103
|
return null;
|
|
103
104
|
}
|
|
104
105
|
return (value, row, column, api) => {
|
|
105
|
-
|
|
106
|
+
const rowId = (0, _xDataGridPro.gridRowIdSelector)(apiRef.current.state, row);
|
|
107
|
+
if (getCellAggregationResult(rowId, column.field) != null) {
|
|
106
108
|
return true;
|
|
107
109
|
}
|
|
108
110
|
return filterFn(value, row, column, api);
|
|
@@ -141,7 +143,7 @@ const wrapColumnWithAggregationValue = ({
|
|
|
141
143
|
}) => {
|
|
142
144
|
const getCellAggregationResult = (id, field) => {
|
|
143
145
|
let cellAggregationPosition = null;
|
|
144
|
-
const rowNode =
|
|
146
|
+
const rowNode = (0, _xDataGridPro.gridRowTreeSelector)(apiRef)[id];
|
|
145
147
|
if (rowNode.type === 'group') {
|
|
146
148
|
cellAggregationPosition = 'inline';
|
|
147
149
|
} else if (id.toString().startsWith('auto-generated-group-footer-')) {
|
|
@@ -263,7 +263,6 @@ const useGridClipboardImport = (apiRef, props) => {
|
|
|
263
263
|
const onProcessRowUpdateError = props.onProcessRowUpdateError;
|
|
264
264
|
const getRowId = props.getRowId;
|
|
265
265
|
const enableClipboardPaste = !props.disableClipboardPaste;
|
|
266
|
-
const rootEl = apiRef.current.rootElementRef?.current;
|
|
267
266
|
const logger = (0, _internals.useGridLogger)(apiRef, 'useGridClipboardImport');
|
|
268
267
|
const splitClipboardPastedText = props.splitClipboardPastedText;
|
|
269
268
|
const {
|
|
@@ -286,6 +285,7 @@ const useGridClipboardImport = (apiRef, props) => {
|
|
|
286
285
|
return;
|
|
287
286
|
}
|
|
288
287
|
}
|
|
288
|
+
const rootEl = apiRef.current.rootElementRef?.current;
|
|
289
289
|
if (!rootEl) {
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
@@ -326,7 +326,7 @@ const useGridClipboardImport = (apiRef, props) => {
|
|
|
326
326
|
paginationMode
|
|
327
327
|
});
|
|
328
328
|
cellUpdater.applyUpdates();
|
|
329
|
-
}, [apiRef, processRowUpdate, onProcessRowUpdateError, getRowId, enableClipboardPaste,
|
|
329
|
+
}, [apiRef, processRowUpdate, onProcessRowUpdateError, getRowId, enableClipboardPaste, splitClipboardPastedText, pagination, paginationMode, onBeforeClipboardPasteStart, logger]);
|
|
330
330
|
const checkIfCanStartEditing = React.useCallback((initialValue, {
|
|
331
331
|
event
|
|
332
332
|
}) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './gridExcelExportInterface';
|
|
2
|
-
export { setupExcelExportWebWorker } from './serializer/
|
|
2
|
+
export { setupExcelExportWebWorker } from './serializer/setupExcelExportWebWorker';
|
|
@@ -9,7 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
Object.defineProperty(exports, "setupExcelExportWebWorker", {
|
|
10
10
|
enumerable: true,
|
|
11
11
|
get: function () {
|
|
12
|
-
return
|
|
12
|
+
return _setupExcelExportWebWorker.setupExcelExportWebWorker;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
var _gridExcelExportInterface = require("./gridExcelExportInterface");
|
|
@@ -24,4 +24,4 @@ Object.keys(_gridExcelExportInterface).forEach(function (key) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
var
|
|
27
|
+
var _setupExcelExportWebWorker = require("./serializer/setupExcelExportWebWorker");
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import type * as Excel from 'exceljs';
|
|
2
2
|
import { RefObject } from '@mui/x-internals/types';
|
|
3
3
|
import { GridRowId, GridColDef } from '@mui/x-data-grid-pro';
|
|
4
|
-
import { GridStateColDef
|
|
4
|
+
import { GridStateColDef } from '@mui/x-data-grid/internals';
|
|
5
5
|
import { ColumnsStylesInterface, GridExcelExportOptions } from '../gridExcelExportInterface';
|
|
6
6
|
import { GridPrivateApiPremium } from '../../../../models/gridApiPremium';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
dataValidation: Record<string, Excel.DataValidation>;
|
|
10
|
-
outlineLevel: number;
|
|
11
|
-
mergedCells: {
|
|
12
|
-
leftIndex: number;
|
|
13
|
-
rightIndex: number;
|
|
14
|
-
}[];
|
|
15
|
-
}
|
|
7
|
+
import { SerializedColumns, SerializedRow, ValueOptionsData } from './utils';
|
|
8
|
+
export type { ExcelExportInitEvent } from './utils';
|
|
16
9
|
/**
|
|
17
10
|
* FIXME: This function mutates the colspan info, but colspan info assumes that the columns
|
|
18
11
|
* passed to it are always consistent. In this case, the exported columns may differ from the
|
|
@@ -37,17 +30,7 @@ export declare const serializeColumn: (column: GridColDef, columnsStyles: Column
|
|
|
37
30
|
fill?: Excel.Fill | undefined;
|
|
38
31
|
};
|
|
39
32
|
};
|
|
40
|
-
type SerializedColumns = Array<{
|
|
41
|
-
key: string;
|
|
42
|
-
width: number;
|
|
43
|
-
style: Partial<Excel.Style>;
|
|
44
|
-
headerText: string;
|
|
45
|
-
}>;
|
|
46
33
|
export declare function serializeColumns(columns: GridStateColDef[], styles: ColumnsStylesInterface): SerializedColumns;
|
|
47
|
-
type ValueOptionsData = Record<string, {
|
|
48
|
-
values: (string | number)[];
|
|
49
|
-
address: string;
|
|
50
|
-
}>;
|
|
51
34
|
export declare function getDataForValueOptionsSheet(columns: GridStateColDef[], valueOptionsSheetName: string, api: GridPrivateApiPremium): Promise<ValueOptionsData>;
|
|
52
35
|
interface BuildExcelOptions extends Pick<GridExcelExportOptions, 'exceljsPreProcess' | 'exceljsPostProcess'>, Pick<Required<GridExcelExportOptions>, 'valueOptionsSheetName' | 'includeHeaders' | 'includeColumnGroupsHeaders' | 'escapeFormulas'> {
|
|
53
36
|
columns: GridStateColDef[];
|
|
@@ -55,14 +38,3 @@ interface BuildExcelOptions extends Pick<GridExcelExportOptions, 'exceljsPreProc
|
|
|
55
38
|
columnsStyles?: ColumnsStylesInterface;
|
|
56
39
|
}
|
|
57
40
|
export declare function buildExcel(options: BuildExcelOptions, apiRef: RefObject<GridPrivateApiPremium>): Promise<Excel.Workbook>;
|
|
58
|
-
export interface ExcelExportInitEvent {
|
|
59
|
-
serializedColumns: SerializedColumns;
|
|
60
|
-
serializedRows: SerializedRow[];
|
|
61
|
-
valueOptionsSheetName: string;
|
|
62
|
-
columnGroupPaths: Record<string, string[]>;
|
|
63
|
-
columnGroupDetails: GridColumnGroupLookup;
|
|
64
|
-
valueOptionsData: ValueOptionsData;
|
|
65
|
-
options: Omit<GridExcelExportOptions, 'exceljsPreProcess' | 'exceljsPostProcess' | 'columnsStyles' | 'valueOptionsSheetName'>;
|
|
66
|
-
}
|
|
67
|
-
export declare function setupExcelExportWebWorker(workerOptions?: Pick<GridExcelExportOptions, 'exceljsPostProcess' | 'exceljsPreProcess'>): void;
|
|
68
|
-
export {};
|