@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
|
@@ -26,7 +26,7 @@ const getFormattedValueOptions = (colDef, valueOptions, api) => {
|
|
|
26
26
|
}
|
|
27
27
|
return valueOptionsFormatted.map(option => typeof option === 'object' ? option.label : option);
|
|
28
28
|
};
|
|
29
|
-
const serializeRow = (id, columns, api, defaultValueOptionsFormulae) => {
|
|
29
|
+
export const serializeRow = (id, columns, api, defaultValueOptionsFormulae) => {
|
|
30
30
|
const row = {};
|
|
31
31
|
const dataValidation = {};
|
|
32
32
|
const mergedCells = [];
|
|
@@ -71,11 +71,13 @@ const serializeRow = (id, columns, api, defaultValueOptionsFormulae) => {
|
|
|
71
71
|
formulae: [`"${formattedValueOptions.map(x => x.toString().replaceAll(',', 'CHAR(44)')).join(',')}"`]
|
|
72
72
|
};
|
|
73
73
|
} else {
|
|
74
|
+
const address = defaultValueOptionsFormulae[column.field].address;
|
|
75
|
+
|
|
74
76
|
// If value option is defined for the column, refer to another sheet
|
|
75
77
|
dataValidation[castColumn.field] = {
|
|
76
78
|
type: 'list',
|
|
77
79
|
allowBlank: true,
|
|
78
|
-
formulae: [
|
|
80
|
+
formulae: [address]
|
|
79
81
|
};
|
|
80
82
|
}
|
|
81
83
|
const formattedValue = api.getCellParams(id, castColumn.field).formattedValue;
|
|
@@ -137,13 +139,14 @@ const defaultColumnsStyles = {
|
|
|
137
139
|
numFmt: 'dd.mm.yyyy hh:mm'
|
|
138
140
|
}
|
|
139
141
|
};
|
|
140
|
-
const serializeColumn = (column, columnsStyles) => {
|
|
142
|
+
export const serializeColumn = (column, columnsStyles) => {
|
|
141
143
|
const {
|
|
142
144
|
field,
|
|
143
145
|
type
|
|
144
146
|
} = column;
|
|
145
147
|
return {
|
|
146
148
|
key: field,
|
|
149
|
+
headerText: column.headerName ?? column.field,
|
|
147
150
|
// Excel width must stay between 0 and 255 (https://support.microsoft.com/en-us/office/change-the-column-width-and-row-height-72f5e3cc-994d-43e8-ae58-9774a0905f46)
|
|
148
151
|
// From the example of column width behavior (https://docs.microsoft.com/en-US/office/troubleshoot/excel/determine-column-widths#example-of-column-width-behavior)
|
|
149
152
|
// a value of 10 corresponds to 75px. This is an approximation, because column width depends on the the font-size
|
|
@@ -151,19 +154,18 @@ const serializeColumn = (column, columnsStyles) => {
|
|
|
151
154
|
style: _extends({}, type && defaultColumnsStyles?.[type], columnsStyles?.[field])
|
|
152
155
|
};
|
|
153
156
|
};
|
|
154
|
-
const addColumnGroupingHeaders = (worksheet, columns,
|
|
157
|
+
const addColumnGroupingHeaders = (worksheet, columns, columnGroupPaths, columnGroupDetails) => {
|
|
155
158
|
const maxDepth = Math.max(...columns.map(({
|
|
156
|
-
|
|
157
|
-
}) =>
|
|
159
|
+
key
|
|
160
|
+
}) => columnGroupPaths[key]?.length ?? 0));
|
|
158
161
|
if (maxDepth === 0) {
|
|
159
162
|
return;
|
|
160
163
|
}
|
|
161
|
-
const columnGroupDetails = api.unstable_getAllGroupDetails();
|
|
162
164
|
for (let rowIndex = 0; rowIndex < maxDepth; rowIndex += 1) {
|
|
163
165
|
const row = columns.map(({
|
|
164
|
-
|
|
166
|
+
key
|
|
165
167
|
}) => {
|
|
166
|
-
const groupingPath =
|
|
168
|
+
const groupingPath = columnGroupPaths[key];
|
|
167
169
|
if (groupingPath.length <= rowIndex) {
|
|
168
170
|
return {
|
|
169
171
|
groupId: null,
|
|
@@ -205,13 +207,75 @@ const addColumnGroupingHeaders = (worksheet, columns, api) => {
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
};
|
|
210
|
+
export function serializeColumns(columns, styles) {
|
|
211
|
+
return columns.map(column => serializeColumn(column, styles));
|
|
212
|
+
}
|
|
213
|
+
export async function getDataForValueOptionsSheet(columns, valueOptionsSheetName, api) {
|
|
214
|
+
const candidateColumns = columns.filter(column => isSingleSelectColDef(column) && Array.isArray(column.valueOptions));
|
|
215
|
+
|
|
216
|
+
// Creates a temp worksheet to obtain the column letters
|
|
217
|
+
const excelJS = await getExcelJs();
|
|
218
|
+
const workbook = new excelJS.Workbook();
|
|
219
|
+
const worksheet = workbook.addWorksheet('Sheet1');
|
|
220
|
+
worksheet.columns = candidateColumns.map(column => ({
|
|
221
|
+
key: column.field
|
|
222
|
+
}));
|
|
223
|
+
return candidateColumns.reduce((acc, column) => {
|
|
224
|
+
const singleSelectColumn = column;
|
|
225
|
+
const formattedValueOptions = getFormattedValueOptions(singleSelectColumn, singleSelectColumn.valueOptions, api);
|
|
226
|
+
const header = column.headerName ?? column.field;
|
|
227
|
+
const values = [header, ...formattedValueOptions];
|
|
228
|
+
const letter = worksheet.getColumn(column.field).letter;
|
|
229
|
+
const address = `${valueOptionsSheetName}!$${letter}$2:$${letter}$${values.length}`;
|
|
230
|
+
acc[column.field] = {
|
|
231
|
+
values,
|
|
232
|
+
address
|
|
233
|
+
};
|
|
234
|
+
return acc;
|
|
235
|
+
}, {});
|
|
236
|
+
}
|
|
237
|
+
function addSerializedRowToWorksheet(serializedRow, worksheet) {
|
|
238
|
+
const {
|
|
239
|
+
row,
|
|
240
|
+
dataValidation,
|
|
241
|
+
outlineLevel,
|
|
242
|
+
mergedCells
|
|
243
|
+
} = serializedRow;
|
|
244
|
+
const newRow = worksheet.addRow(row);
|
|
245
|
+
Object.keys(dataValidation).forEach(field => {
|
|
246
|
+
newRow.getCell(field).dataValidation = _extends({}, dataValidation[field]);
|
|
247
|
+
});
|
|
248
|
+
if (outlineLevel) {
|
|
249
|
+
newRow.outlineLevel = outlineLevel;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// use `rowCount`, since worksheet can have additional rows added in `exceljsPreProcess`
|
|
253
|
+
const lastRowIndex = newRow.worksheet.rowCount;
|
|
254
|
+
mergedCells.forEach(mergedCell => {
|
|
255
|
+
worksheet.mergeCells(lastRowIndex, mergedCell.leftIndex, lastRowIndex, mergedCell.rightIndex);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
async function createValueOptionsSheetIfNeeded(valueOptionsData, sheetName, workbook) {
|
|
259
|
+
if (Object.keys(valueOptionsData).length === 0) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const valueOptionsWorksheet = workbook.addWorksheet(sheetName);
|
|
263
|
+
valueOptionsWorksheet.columns = Object.keys(valueOptionsData).map(key => ({
|
|
264
|
+
key
|
|
265
|
+
}));
|
|
266
|
+
Object.entries(valueOptionsData).forEach(([field, {
|
|
267
|
+
values
|
|
268
|
+
}]) => {
|
|
269
|
+
valueOptionsWorksheet.getColumn(field).values = values;
|
|
270
|
+
});
|
|
271
|
+
}
|
|
208
272
|
export async function buildExcel(options, api) {
|
|
209
273
|
const {
|
|
210
274
|
columns,
|
|
211
275
|
rowIds,
|
|
212
276
|
includeHeaders,
|
|
213
277
|
includeColumnGroupsHeaders,
|
|
214
|
-
valueOptionsSheetName,
|
|
278
|
+
valueOptionsSheetName = 'Options',
|
|
215
279
|
exceljsPreProcess,
|
|
216
280
|
exceljsPostProcess,
|
|
217
281
|
columnsStyles = {}
|
|
@@ -219,7 +283,8 @@ export async function buildExcel(options, api) {
|
|
|
219
283
|
const excelJS = await getExcelJs();
|
|
220
284
|
const workbook = new excelJS.Workbook();
|
|
221
285
|
const worksheet = workbook.addWorksheet('Sheet1');
|
|
222
|
-
|
|
286
|
+
const serializedColumns = serializeColumns(columns, columnsStyles);
|
|
287
|
+
worksheet.columns = serializedColumns;
|
|
223
288
|
if (exceljsPreProcess) {
|
|
224
289
|
await exceljsPreProcess({
|
|
225
290
|
workbook,
|
|
@@ -227,47 +292,20 @@ export async function buildExcel(options, api) {
|
|
|
227
292
|
});
|
|
228
293
|
}
|
|
229
294
|
if (includeColumnGroupsHeaders) {
|
|
230
|
-
|
|
295
|
+
const columnGroupPaths = columns.reduce((acc, column) => {
|
|
296
|
+
acc[column.field] = api.unstable_getColumnGroupPath(column.field);
|
|
297
|
+
return acc;
|
|
298
|
+
}, {});
|
|
299
|
+
addColumnGroupingHeaders(worksheet, serializedColumns, columnGroupPaths, api.unstable_getAllGroupDetails());
|
|
231
300
|
}
|
|
232
301
|
if (includeHeaders) {
|
|
233
302
|
worksheet.addRow(columns.map(column => column.headerName ?? column.field));
|
|
234
303
|
}
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
if (columnsWithArrayValueOptions.length) {
|
|
238
|
-
const valueOptionsWorksheet = workbook.addWorksheet(valueOptionsSheetName);
|
|
239
|
-
valueOptionsWorksheet.columns = columnsWithArrayValueOptions.map(({
|
|
240
|
-
field
|
|
241
|
-
}) => ({
|
|
242
|
-
key: field
|
|
243
|
-
}));
|
|
244
|
-
columnsWithArrayValueOptions.forEach(column => {
|
|
245
|
-
const formattedValueOptions = getFormattedValueOptions(column, column.valueOptions, api);
|
|
246
|
-
valueOptionsWorksheet.getColumn(column.field).values = [column.headerName ?? column.field, ...formattedValueOptions];
|
|
247
|
-
const columnLetter = valueOptionsWorksheet.getColumn(column.field).letter;
|
|
248
|
-
defaultValueOptionsFormulae[column.field] = `${valueOptionsSheetName}!$${columnLetter}$2:$${columnLetter}$${1 + formattedValueOptions.length}`;
|
|
249
|
-
});
|
|
250
|
-
}
|
|
304
|
+
const valueOptionsData = await getDataForValueOptionsSheet(columns, valueOptionsSheetName, api);
|
|
305
|
+
createValueOptionsSheetIfNeeded(valueOptionsData, valueOptionsSheetName, workbook);
|
|
251
306
|
rowIds.forEach(id => {
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
dataValidation,
|
|
255
|
-
outlineLevel,
|
|
256
|
-
mergedCells
|
|
257
|
-
} = serializeRow(id, columns, api, defaultValueOptionsFormulae);
|
|
258
|
-
const newRow = worksheet.addRow(row);
|
|
259
|
-
Object.keys(dataValidation).forEach(field => {
|
|
260
|
-
newRow.getCell(field).dataValidation = _extends({}, dataValidation[field]);
|
|
261
|
-
});
|
|
262
|
-
if (outlineLevel) {
|
|
263
|
-
newRow.outlineLevel = outlineLevel;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// use `rowCount`, since worksheet can have additional rows added in `exceljsPreProcess`
|
|
267
|
-
const lastRowIndex = newRow.worksheet.rowCount;
|
|
268
|
-
mergedCells.forEach(mergedCell => {
|
|
269
|
-
worksheet.mergeCells(lastRowIndex, mergedCell.leftIndex, lastRowIndex, mergedCell.rightIndex);
|
|
270
|
-
});
|
|
307
|
+
const serializedRow = serializeRow(id, columns, api, valueOptionsData);
|
|
308
|
+
addSerializedRowToWorksheet(serializedRow, worksheet);
|
|
271
309
|
});
|
|
272
310
|
if (exceljsPostProcess) {
|
|
273
311
|
await exceljsPostProcess({
|
|
@@ -276,4 +314,50 @@ export async function buildExcel(options, api) {
|
|
|
276
314
|
});
|
|
277
315
|
}
|
|
278
316
|
return workbook;
|
|
317
|
+
}
|
|
318
|
+
export function setupExcelExportWebWorker(workerOptions = {}) {
|
|
319
|
+
// eslint-disable-next-line no-restricted-globals
|
|
320
|
+
addEventListener('message', async event => {
|
|
321
|
+
const {
|
|
322
|
+
serializedColumns,
|
|
323
|
+
serializedRows,
|
|
324
|
+
options,
|
|
325
|
+
valueOptionsSheetName,
|
|
326
|
+
valueOptionsData,
|
|
327
|
+
columnGroupDetails,
|
|
328
|
+
columnGroupPaths
|
|
329
|
+
} = event.data;
|
|
330
|
+
const {
|
|
331
|
+
exceljsPostProcess,
|
|
332
|
+
exceljsPreProcess
|
|
333
|
+
} = workerOptions;
|
|
334
|
+
const excelJS = await getExcelJs();
|
|
335
|
+
const workbook = new excelJS.Workbook();
|
|
336
|
+
const worksheet = workbook.addWorksheet('Sheet1');
|
|
337
|
+
worksheet.columns = serializedColumns;
|
|
338
|
+
if (exceljsPreProcess) {
|
|
339
|
+
await exceljsPreProcess({
|
|
340
|
+
workbook,
|
|
341
|
+
worksheet
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
if (options.includeColumnGroupsHeaders) {
|
|
345
|
+
addColumnGroupingHeaders(worksheet, serializedColumns, columnGroupPaths, columnGroupDetails);
|
|
346
|
+
}
|
|
347
|
+
const includeHeaders = options.includeHeaders ?? true;
|
|
348
|
+
if (includeHeaders) {
|
|
349
|
+
worksheet.addRow(serializedColumns.map(column => column.headerText));
|
|
350
|
+
}
|
|
351
|
+
createValueOptionsSheetIfNeeded(valueOptionsData, valueOptionsSheetName, workbook);
|
|
352
|
+
serializedRows.forEach(serializedRow => {
|
|
353
|
+
addSerializedRowToWorksheet(serializedRow, worksheet);
|
|
354
|
+
});
|
|
355
|
+
if (exceljsPostProcess) {
|
|
356
|
+
await exceljsPostProcess({
|
|
357
|
+
workbook,
|
|
358
|
+
worksheet
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
postMessage(await workbook.xlsx.writeBuffer());
|
|
362
|
+
});
|
|
279
363
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
const _excluded = ["worker", "exceljsPostProcess", "exceljsPreProcess", "columnsStyles", "includeHeaders", "getRowsToExport", "valueOptionsSheetName"];
|
|
1
3
|
import * as React from 'react';
|
|
2
|
-
import { useGridApiMethod, useGridLogger } from '@mui/x-data-grid';
|
|
4
|
+
import { useGridApiMethod, useGridLogger, useGridApiOptionHandler } from '@mui/x-data-grid';
|
|
3
5
|
import { useGridRegisterPipeProcessor, exportAs, getColumnsToExport, defaultGetRowsToExport } from '@mui/x-data-grid/internals';
|
|
4
|
-
import { buildExcel } from './serializer/excelSerializer';
|
|
6
|
+
import { buildExcel, getDataForValueOptionsSheet, serializeColumns, serializeRow } from './serializer/excelSerializer';
|
|
5
7
|
import { GridExcelExportMenuItem } from '../../../components';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -12,7 +14,7 @@ import { GridExcelExportMenuItem } from '../../../components';
|
|
|
12
14
|
* @requires useGridParamsApi (method)
|
|
13
15
|
*/
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
export const useGridExcelExport = apiRef => {
|
|
17
|
+
export const useGridExcelExport = (apiRef, props) => {
|
|
16
18
|
const logger = useGridLogger(apiRef, 'useGridExcelExport');
|
|
17
19
|
const getDataAsExcel = React.useCallback((options = {}) => {
|
|
18
20
|
logger.debug(`Get data as excel`);
|
|
@@ -35,18 +37,70 @@ export const useGridExcelExport = apiRef => {
|
|
|
35
37
|
exceljsPostProcess: options?.exceljsPostProcess
|
|
36
38
|
}, apiRef.current);
|
|
37
39
|
}, [logger, apiRef]);
|
|
38
|
-
const exportDataAsExcel = React.useCallback(async options => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const exportDataAsExcel = React.useCallback(async (options = {}) => {
|
|
41
|
+
const {
|
|
42
|
+
worker: workerFn,
|
|
43
|
+
exceljsPostProcess,
|
|
44
|
+
exceljsPreProcess,
|
|
45
|
+
getRowsToExport = defaultGetRowsToExport,
|
|
46
|
+
valueOptionsSheetName = 'Options'
|
|
47
|
+
} = options,
|
|
48
|
+
cloneableOptions = _objectWithoutPropertiesLoose(options, _excluded);
|
|
49
|
+
const sendExcelToUser = buffer => {
|
|
50
|
+
const blob = new Blob([buffer], {
|
|
51
|
+
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
52
|
+
});
|
|
53
|
+
exportAs(blob, 'xlsx', options?.fileName);
|
|
54
|
+
};
|
|
55
|
+
if (!workerFn) {
|
|
56
|
+
apiRef.current.publishEvent('excelExportStateChange', 'pending');
|
|
57
|
+
const workbook = await getDataAsExcel(options);
|
|
58
|
+
if (workbook === null) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const content = await workbook.xlsx.writeBuffer();
|
|
62
|
+
apiRef.current.publishEvent('excelExportStateChange', 'finished');
|
|
63
|
+
sendExcelToUser(content);
|
|
42
64
|
return;
|
|
43
65
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
if (exceljsPostProcess && process.env.NODE_ENV !== 'production') {
|
|
67
|
+
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'));
|
|
68
|
+
}
|
|
69
|
+
if (exceljsPreProcess && process.env.NODE_ENV !== 'production') {
|
|
70
|
+
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'));
|
|
71
|
+
}
|
|
72
|
+
const worker = workerFn();
|
|
73
|
+
apiRef.current.publishEvent('excelExportStateChange', 'pending');
|
|
74
|
+
worker.onmessage = async event => {
|
|
75
|
+
sendExcelToUser(event.data);
|
|
76
|
+
apiRef.current.publishEvent('excelExportStateChange', 'finished');
|
|
77
|
+
worker.terminate();
|
|
78
|
+
};
|
|
79
|
+
const exportedRowIds = getRowsToExport({
|
|
80
|
+
apiRef
|
|
81
|
+
});
|
|
82
|
+
const exportedColumns = getColumnsToExport({
|
|
83
|
+
apiRef,
|
|
84
|
+
options
|
|
47
85
|
});
|
|
48
|
-
|
|
49
|
-
|
|
86
|
+
const valueOptionsData = await getDataForValueOptionsSheet(exportedColumns, valueOptionsSheetName, apiRef.current);
|
|
87
|
+
const serializedColumns = serializeColumns(exportedColumns, options.columnsStyles || {});
|
|
88
|
+
const serializedRows = exportedRowIds.map(id => serializeRow(id, exportedColumns, apiRef.current, valueOptionsData));
|
|
89
|
+
const columnGroupPaths = exportedColumns.reduce((acc, column) => {
|
|
90
|
+
acc[column.field] = apiRef.current.unstable_getColumnGroupPath(column.field);
|
|
91
|
+
return acc;
|
|
92
|
+
}, {});
|
|
93
|
+
const message = {
|
|
94
|
+
serializedColumns,
|
|
95
|
+
serializedRows,
|
|
96
|
+
valueOptionsData,
|
|
97
|
+
columnGroupPaths,
|
|
98
|
+
columnGroupDetails: apiRef.current.unstable_getAllGroupDetails(),
|
|
99
|
+
options: cloneableOptions,
|
|
100
|
+
valueOptionsSheetName
|
|
101
|
+
};
|
|
102
|
+
worker.postMessage(message);
|
|
103
|
+
}, [apiRef, getDataAsExcel]);
|
|
50
104
|
const excelExportApi = {
|
|
51
105
|
getDataAsExcel,
|
|
52
106
|
exportDataAsExcel
|
|
@@ -68,4 +122,5 @@ export const useGridExcelExport = apiRef => {
|
|
|
68
122
|
}];
|
|
69
123
|
}, []);
|
|
70
124
|
useGridRegisterPipeProcessor(apiRef, 'exportMenu', addExportMenuButtons);
|
|
125
|
+
useGridApiOptionHandler(apiRef, 'excelExportStateChange', props.onExcelExportStateChange);
|
|
71
126
|
};
|
package/modern/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
|
+
const iconsSlots = {
|
|
4
|
+
ColumnMenuUngroupIcon: GridWorkspacesIcon,
|
|
5
|
+
ColumnMenuGroupIcon: GridGroupWorkIcon,
|
|
6
|
+
ColumnMenuAggregationIcon: GridFunctionsIcon
|
|
7
|
+
};
|
|
8
|
+
const materialSlots = _extends({}, iconsSlots);
|
|
9
|
+
export default materialSlots;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const 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
|
|
@@ -22,6 +22,7 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
|
|
|
22
22
|
const props = (0, _useDataGridPremiumProps.useDataGridPremiumProps)(inProps);
|
|
23
23
|
const privateApiRef = (0, _useDataGridPremiumComponent.useDataGridPremiumComponent)(props.apiRef, props);
|
|
24
24
|
(0, _xLicensePro.useLicenseVerifier)('x-data-grid-premium', releaseInfo);
|
|
25
|
+
const pinnedColumns = (0, _xDataGridPro.useGridSelector)(privateApiRef, _xDataGridPro.gridPinnedColumnsSelector);
|
|
25
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGridPro.GridContextProvider, {
|
|
26
27
|
privateApiRef: privateApiRef,
|
|
27
28
|
props: props,
|
|
@@ -31,8 +32,10 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
|
|
|
31
32
|
sx: props.sx,
|
|
32
33
|
ref: ref,
|
|
33
34
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGridPro.GridHeader, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGridPro.GridBody, {
|
|
34
|
-
ColumnHeadersComponent: _internals.DataGridProColumnHeaders,
|
|
35
35
|
VirtualScrollerComponent: _internals.DataGridProVirtualScroller,
|
|
36
|
+
ColumnHeadersProps: {
|
|
37
|
+
pinnedColumns
|
|
38
|
+
},
|
|
36
39
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicensePro.Watermark, {
|
|
37
40
|
packageName: "x-data-grid-premium",
|
|
38
41
|
releaseInfo: releaseInfo
|
|
@@ -139,10 +142,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
139
142
|
columnVisibilityModel: _propTypes.default.object,
|
|
140
143
|
/**
|
|
141
144
|
* Overrideable components.
|
|
145
|
+
* @deprecated Use the `slots` prop instead.
|
|
142
146
|
*/
|
|
143
147
|
components: _propTypes.default.object,
|
|
144
148
|
/**
|
|
145
149
|
* Overrideable components props dynamically passed to the component at rendering.
|
|
150
|
+
* @deprecated Use the `slotProps` prop instead.
|
|
146
151
|
*/
|
|
147
152
|
componentsProps: _propTypes.default.object,
|
|
148
153
|
/**
|
|
@@ -252,7 +257,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
252
257
|
experimentalFeatures: _propTypes.default.shape({
|
|
253
258
|
columnGrouping: _propTypes.default.bool,
|
|
254
259
|
lazyLoading: _propTypes.default.bool,
|
|
255
|
-
rowPinning: _propTypes.default.bool,
|
|
256
260
|
warnIfFocusStateIsNotSynced: _propTypes.default.bool
|
|
257
261
|
}),
|
|
258
262
|
/**
|
|
@@ -561,6 +565,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
561
565
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
562
566
|
*/
|
|
563
567
|
onDetailPanelExpandedRowIdsChange: _propTypes.default.func,
|
|
568
|
+
/**
|
|
569
|
+
* Callback fired when the state of the Excel export changes.
|
|
570
|
+
* @param {string} inProgress Indicates if the task is in progress.
|
|
571
|
+
*/
|
|
572
|
+
onExcelExportStateChange: _propTypes.default.func,
|
|
564
573
|
/**
|
|
565
574
|
* Callback fired when rowCount is set and the next batch of virtualized rows is rendered.
|
|
566
575
|
* @param {GridFetchRowsParams} params With all properties from [[GridFetchRowsParams]].
|
|
@@ -834,6 +843,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
834
843
|
* @default false
|
|
835
844
|
*/
|
|
836
845
|
showColumnVerticalBorder: _propTypes.default.bool,
|
|
846
|
+
/**
|
|
847
|
+
* Overrideable components props dynamically passed to the component at rendering.
|
|
848
|
+
*/
|
|
849
|
+
slotProps: _propTypes.default.object,
|
|
850
|
+
/**
|
|
851
|
+
* Overrideable components.
|
|
852
|
+
*/
|
|
853
|
+
slots: _propTypes.default.object,
|
|
837
854
|
/**
|
|
838
855
|
* Sorting can be processed on the server or client-side.
|
|
839
856
|
* Set it to 'client' if you would like to handle sorting on the client-side.
|
|
@@ -87,7 +87,7 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
87
87
|
(0, _internals.useGridColumnMenu)(privateApiRef);
|
|
88
88
|
(0, _internals.useGridCsvExport)(privateApiRef);
|
|
89
89
|
(0, _internals.useGridPrintExport)(privateApiRef, props);
|
|
90
|
-
(0, _useGridExcelExport.useGridExcelExport)(privateApiRef);
|
|
90
|
+
(0, _useGridExcelExport.useGridExcelExport)(privateApiRef, props);
|
|
91
91
|
(0, _internals.useGridClipboard)(privateApiRef);
|
|
92
92
|
(0, _internals.useGridDimensions)(privateApiRef, props);
|
|
93
93
|
(0, _internals.useGridEvents)(privateApiRef, props);
|
|
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useDataGridPremiumProps = exports.DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = void 0;
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var React = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _styles = require("@mui/material/styles");
|
|
11
12
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
13
|
+
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
12
14
|
var _aggregation = require("../hooks/features/aggregation");
|
|
13
15
|
var _dataGridPremiumDefaultSlotsComponents = require("../constants/dataGridPremiumDefaultSlotsComponents");
|
|
16
|
+
const _excluded = ["components", "componentsProps"];
|
|
14
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
18
|
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; }
|
|
16
19
|
/**
|
|
@@ -26,27 +29,28 @@ const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = (0, _extends2.default)({}, _xData
|
|
|
26
29
|
getAggregationPosition: groupNode => groupNode.depth === -1 ? 'footer' : 'inline'
|
|
27
30
|
});
|
|
28
31
|
exports.DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES;
|
|
32
|
+
const defaultSlots = (0, _internals.uncapitalizeObjectKeys)(_dataGridPremiumDefaultSlotsComponents.DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS);
|
|
29
33
|
const useDataGridPremiumProps = inProps => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const _useThemeProps = (0, _styles.useThemeProps)({
|
|
35
|
+
props: inProps,
|
|
36
|
+
name: 'MuiDataGrid'
|
|
37
|
+
}),
|
|
38
|
+
{
|
|
39
|
+
components,
|
|
40
|
+
componentsProps
|
|
41
|
+
} = _useThemeProps,
|
|
42
|
+
themedProps = (0, _objectWithoutPropertiesLoose2.default)(_useThemeProps, _excluded);
|
|
34
43
|
const localeText = React.useMemo(() => (0, _extends2.default)({}, _xDataGridPro.GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const mergedComponents = {};
|
|
41
|
-
Object.entries(_dataGridPremiumDefaultSlotsComponents.DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS).forEach(([key, defaultComponent]) => {
|
|
42
|
-
mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
|
|
43
|
-
});
|
|
44
|
-
return mergedComponents;
|
|
45
|
-
}, [themedProps.components]);
|
|
44
|
+
const slots = React.useMemo(() => (0, _internals.computeSlots)({
|
|
45
|
+
defaultSlots,
|
|
46
|
+
components,
|
|
47
|
+
slots: themedProps.slots
|
|
48
|
+
}), [components, themedProps.slots]);
|
|
46
49
|
return React.useMemo(() => (0, _extends2.default)({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
|
|
50
|
+
slotProps: themedProps.slotProps ?? componentsProps,
|
|
47
51
|
localeText,
|
|
48
|
-
|
|
52
|
+
slots,
|
|
49
53
|
signature: 'DataGridPremium'
|
|
50
|
-
}), [themedProps, localeText,
|
|
54
|
+
}), [themedProps, componentsProps, localeText, slots]);
|
|
51
55
|
};
|
|
52
56
|
exports.useDataGridPremiumProps = useDataGridPremiumProps;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.GridAggregationHeader = GridAggregationHeader;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var React = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _utils = require("@mui/utils");
|
|
10
11
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
@@ -64,10 +65,10 @@ function GridAggregationHeader(props) {
|
|
|
64
65
|
} = props;
|
|
65
66
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
66
67
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
67
|
-
const ownerState = {
|
|
68
|
+
const ownerState = (0, _extends2.default)({}, rootProps, {
|
|
68
69
|
classes: rootProps.classes,
|
|
69
70
|
colDef
|
|
70
|
-
};
|
|
71
|
+
});
|
|
71
72
|
const classes = useUtilityClasses(ownerState);
|
|
72
73
|
if (!aggregation) {
|
|
73
74
|
return null;
|
|
@@ -66,7 +66,7 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
66
66
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
|
67
67
|
disableRipple: true,
|
|
68
68
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
69
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
69
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnMenuAggregationIcon, {
|
|
70
70
|
fontSize: "small"
|
|
71
71
|
})
|
|
72
72
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
@@ -36,7 +36,7 @@ function GridColumnMenuRowGroupItem(props) {
|
|
|
36
36
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
|
37
37
|
onClick: ungroupColumn,
|
|
38
38
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
39
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
39
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnMenuUngroupIcon, {
|
|
40
40
|
fontSize: "small"
|
|
41
41
|
})
|
|
42
42
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
@@ -42,7 +42,7 @@ function GridColumnMenuRowUngroupItem(props) {
|
|
|
42
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
|
43
43
|
onClick: ungroupColumn,
|
|
44
44
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
45
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
45
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnMenuUngroupIcon, {
|
|
46
46
|
fontSize: "small"
|
|
47
47
|
})
|
|
48
48
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
@@ -53,7 +53,7 @@ function GridColumnMenuRowUngroupItem(props) {
|
|
|
53
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
|
54
54
|
onClick: groupColumn,
|
|
55
55
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
56
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
56
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnMenuGroupIcon, {
|
|
57
57
|
fontSize: "small"
|
|
58
58
|
})
|
|
59
59
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
@@ -48,6 +48,7 @@ process.env.NODE_ENV !== "production" ? GridExcelExportMenuItem.propTypes = {
|
|
|
48
48
|
getRowsToExport: _propTypes.default.func,
|
|
49
49
|
includeColumnGroupsHeaders: _propTypes.default.bool,
|
|
50
50
|
includeHeaders: _propTypes.default.bool,
|
|
51
|
-
valueOptionsSheetName: _propTypes.default.string
|
|
51
|
+
valueOptionsSheetName: _propTypes.default.string,
|
|
52
|
+
worker: _propTypes.default.func
|
|
52
53
|
})
|
|
53
54
|
} : void 0;
|
|
@@ -42,9 +42,7 @@ function GridFooterCell(props) {
|
|
|
42
42
|
} = props,
|
|
43
43
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
44
44
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
45
|
-
const ownerState =
|
|
46
|
-
classes: rootProps.classes
|
|
47
|
-
};
|
|
45
|
+
const ownerState = rootProps;
|
|
48
46
|
const classes = useUtilityClasses(ownerState);
|
|
49
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridFooterCellRoot, (0, _extends2.default)({
|
|
50
48
|
ownerState: ownerState,
|
|
@@ -41,7 +41,7 @@ function GridGroupingCriteriaCell(props) {
|
|
|
41
41
|
const classes = useUtilityClasses(ownerState);
|
|
42
42
|
const filteredDescendantCountLookup = (0, _xDataGridPro.useGridSelector)(apiRef, _xDataGridPro.gridFilteredDescendantCountLookupSelector);
|
|
43
43
|
const filteredDescendantCount = filteredDescendantCountLookup[rowNode.id] ?? 0;
|
|
44
|
-
const Icon = rowNode.childrenExpanded ? rootProps.
|
|
44
|
+
const Icon = rowNode.childrenExpanded ? rootProps.slots.groupingCriteriaCollapseIcon : rootProps.slots.groupingCriteriaExpandIcon;
|
|
45
45
|
const handleKeyDown = event => {
|
|
46
46
|
if (event.key === ' ') {
|
|
47
47
|
// We call event.stopPropagation to avoid unfolding the row and also scrolling to bottom
|
|
@@ -76,13 +76,13 @@ function GridGroupingCriteriaCell(props) {
|
|
|
76
76
|
},
|
|
77
77
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
78
78
|
className: classes.toggle,
|
|
79
|
-
children: filteredDescendantCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
79
|
+
children: filteredDescendantCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, (0, _extends2.default)({
|
|
80
80
|
size: "small",
|
|
81
81
|
onClick: handleClick,
|
|
82
82
|
onKeyDown: handleKeyDown,
|
|
83
83
|
tabIndex: -1,
|
|
84
84
|
"aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand')
|
|
85
|
-
}, rootProps.
|
|
85
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
86
86
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
|
|
87
87
|
fontSize: "inherit"
|
|
88
88
|
})
|
package/node/components/index.js
CHANGED
|
@@ -24,7 +24,7 @@ Object.keys(_GridExcelExportMenuItem).forEach(function (key) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
var _icons = require("
|
|
27
|
+
var _icons = require("../material/icons");
|
|
28
28
|
Object.keys(_icons).forEach(function (key) {
|
|
29
29
|
if (key === "default" || key === "__esModule") return;
|
|
30
30
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|