@mui/x-data-grid-premium 6.0.0-beta.4 → 6.0.0-beta.5

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/DataGridPremium/DataGridPremium.js +15 -0
  3. package/DataGridPremium/useDataGridPremiumComponent.js +1 -1
  4. package/DataGridPremium/useDataGridPremiumProps.js +26 -19
  5. package/components/GridAggregationHeader.js +3 -2
  6. package/components/GridColumnMenuAggregationItem.js +1 -1
  7. package/components/GridColumnMenuRowGroupItem.js +1 -1
  8. package/components/GridColumnMenuRowUngroupItem.js +2 -2
  9. package/components/GridExcelExportMenuItem.js +2 -1
  10. package/components/GridFooterCell.js +1 -3
  11. package/components/GridGroupingCriteriaCell.js +4 -4
  12. package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
  13. package/hooks/features/export/gridExcelExportInterface.d.ts +9 -0
  14. package/hooks/features/export/index.d.ts +1 -0
  15. package/hooks/features/export/index.js +2 -1
  16. package/hooks/features/export/serializer/excelSerializer.d.ts +52 -3
  17. package/hooks/features/export/serializer/excelSerializer.js +137 -51
  18. package/hooks/features/export/useGridExcelExport.d.ts +2 -1
  19. package/hooks/features/export/useGridExcelExport.js +67 -12
  20. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  21. package/index.js +1 -1
  22. package/legacy/DataGridPremium/DataGridPremium.js +15 -0
  23. package/legacy/DataGridPremium/useDataGridPremiumComponent.js +1 -1
  24. package/legacy/DataGridPremium/useDataGridPremiumProps.js +21 -20
  25. package/legacy/components/GridAggregationHeader.js +3 -2
  26. package/legacy/components/GridColumnMenuAggregationItem.js +1 -1
  27. package/legacy/components/GridColumnMenuRowGroupItem.js +1 -1
  28. package/legacy/components/GridColumnMenuRowUngroupItem.js +2 -2
  29. package/legacy/components/GridExcelExportMenuItem.js +2 -1
  30. package/legacy/components/GridFooterCell.js +1 -3
  31. package/legacy/components/GridGroupingCriteriaCell.js +4 -4
  32. package/legacy/hooks/features/export/index.js +2 -1
  33. package/legacy/hooks/features/export/serializer/excelSerializer.js +227 -72
  34. package/legacy/hooks/features/export/useGridExcelExport.js +125 -36
  35. package/legacy/index.js +1 -1
  36. package/legacy/utils/releaseInfo.js +1 -1
  37. package/models/dataGridPremiumProps.d.ts +13 -3
  38. package/models/gridPremiumSlotsComponent.d.ts +4 -1
  39. package/modern/DataGridPremium/DataGridPremium.js +15 -0
  40. package/modern/DataGridPremium/useDataGridPremiumComponent.js +1 -1
  41. package/modern/DataGridPremium/useDataGridPremiumProps.js +21 -17
  42. package/modern/components/GridAggregationHeader.js +3 -2
  43. package/modern/components/GridColumnMenuAggregationItem.js +1 -1
  44. package/modern/components/GridColumnMenuRowGroupItem.js +1 -1
  45. package/modern/components/GridColumnMenuRowUngroupItem.js +2 -2
  46. package/modern/components/GridExcelExportMenuItem.js +2 -1
  47. package/modern/components/GridFooterCell.js +1 -3
  48. package/modern/components/GridGroupingCriteriaCell.js +3 -3
  49. package/modern/hooks/features/export/index.js +2 -1
  50. package/modern/hooks/features/export/serializer/excelSerializer.js +131 -47
  51. package/modern/hooks/features/export/useGridExcelExport.js +67 -12
  52. package/modern/index.js +1 -1
  53. package/modern/utils/releaseInfo.js +1 -1
  54. package/node/DataGridPremium/DataGridPremium.js +15 -0
  55. package/node/DataGridPremium/useDataGridPremiumComponent.js +1 -1
  56. package/node/DataGridPremium/useDataGridPremiumProps.js +21 -17
  57. package/node/components/GridAggregationHeader.js +3 -2
  58. package/node/components/GridColumnMenuAggregationItem.js +1 -1
  59. package/node/components/GridColumnMenuRowGroupItem.js +1 -1
  60. package/node/components/GridColumnMenuRowUngroupItem.js +2 -2
  61. package/node/components/GridExcelExportMenuItem.js +2 -1
  62. package/node/components/GridFooterCell.js +1 -3
  63. package/node/components/GridGroupingCriteriaCell.js +3 -3
  64. package/node/hooks/features/export/index.js +12 -1
  65. package/node/hooks/features/export/serializer/excelSerializer.js +136 -45
  66. package/node/hooks/features/export/useGridExcelExport.js +66 -10
  67. package/node/index.js +1 -1
  68. package/node/utils/releaseInfo.js +1 -1
  69. package/package.json +3 -3
  70. package/typeOverloads/modules.d.ts +6 -0
  71. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,60 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.0.0-beta.5
7
+
8
+ _Feb 23, 2023_
9
+
10
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - ⚡️ Add web worker support for Excel export (#7770) @m4theushw
13
+ - 🎁 Add a button to remove all filters on the data grid filter panel (#7326) @MBilalShafi
14
+ - ⚙️ Allow to customize options label and value in the data grid `singleSelect` column (#7684) @m4theushw
15
+ - 📚 Documentation improvements
16
+ - 🐞 Bugfixes
17
+
18
+ ### `@mui/x-data-grid@v6.0.0-beta.5` / `@mui/x-data-grid-pro@v6.0.0-beta.5` / `@mui/x-data-grid-premium@v6.0.0-beta.5`
19
+
20
+ #### Changes
21
+
22
+ - [DataGrid] Allow to customize label and value for `singleSelect` (#7684) @m4theushw
23
+ - [DataGrid] Fix `ownerState` being `undefined` in theme style overrides (#7964) @lolaignatova
24
+ - [DataGrid] Introduce `slots` and deprecate `components` (#7882) @MBilalShafi
25
+ - [DataGridPro] Add `Remove All` option in filter panel (#7326) @MBilalShafi
26
+ - [DataGridPremium] Add web worker support for Excel export (#7770) @m4theushw
27
+
28
+ ### `@mui/x-date-pickers@v6.0.0-beta.5` / `@mui/x-date-pickers-pro@v6.0.0-beta.5`
29
+
30
+ #### Breaking changes
31
+
32
+ - The `MuiDateSectionName` type was renamed to `FieldSectionType`
33
+
34
+ #### Changes
35
+
36
+ - [fields] Fix multi input range fields validation when uncontrolled (#8002) @LukasTy
37
+ - [fields] Fix single input time range fields slot props (#7988) @LukasTy
38
+ - [fields] Make the `ArrowUp` / `ArrowDown` edition only impact the active section (#7993) @flaviendelangle
39
+ - [fields] Fix single input range fields clearing (#7995) @flaviendelangle
40
+ - [fields] Clean the section object (#8009) @flaviendelangle
41
+ - [pickers] Fix `textField` slot `error` prop propagation (#7987) @LukasTy
42
+
43
+ ### `@mui/x-codemod@v6.0.0-beta.5`
44
+
45
+ #### Changes
46
+
47
+ - [codemod] Add `apiRef.current.getRowIndex` to `DataGrid` renaming codemod (#8001) @MBilalShafi
48
+
49
+ ### Docs
50
+
51
+ - [docs] Fine tune range fields demos (#7992) @LukasTy
52
+ - [docs] Fix a few scroll issues on mobile (#7900) @oliviertassinari
53
+ - [docs] Fix inconsistency in the data grid migration guide (#7963) @MBilalShafi
54
+
55
+ ### Core
56
+
57
+ - [core] Fix `moment` locale on adapter tests (#8020) @flaviendelangle
58
+ - [test] Support all adapters on the field tests about the formats (#7996) @flaviendelangle
59
+
6
60
  ## 6.0.0-beta.4
7
61
 
8
62
  _Feb 16, 2023_
@@ -2179,6 +2233,26 @@ You can find more information about the new api, including how to set those tran
2179
2233
  - [test] Skip tests for column pinning and dynamic row height (#5997) @m4theushw
2180
2234
  - [website] Improve security header @oliviertassinari
2181
2235
 
2236
+ ## 5.17.25
2237
+
2238
+ _Feb 23, 2023_
2239
+
2240
+ We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
2241
+
2242
+ - 🐞 Bugfixes
2243
+
2244
+ ### `@mui/x-data-grid@v5.17.25` / `@mui/x-data-grid-pro@v5.17.25` / `@mui/x-data-grid-premium@v5.17.25`
2245
+
2246
+ #### Changes
2247
+
2248
+ - [DataGrid] Fix `ownerState` being `undefined` in theme style overrides (#7757) @lolaignatova
2249
+
2250
+ ### `@mui/x-date-pickers@v5.0.20` / `@mui/x-date-pickers-pro@v5.0.20`
2251
+
2252
+ #### Changes
2253
+
2254
+ - [DateTimePicker] Ensure toolbar `viewType` is correctly updated (#7942) @LukasTy
2255
+
2182
2256
  ## 5.17.24
2183
2257
 
2184
2258
  _Feb 16, 2023_
@@ -130,10 +130,12 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
130
130
  columnVisibilityModel: PropTypes.object,
131
131
  /**
132
132
  * Overrideable components.
133
+ * @deprecated Use the `slots` prop instead.
133
134
  */
134
135
  components: PropTypes.object,
135
136
  /**
136
137
  * Overrideable components props dynamically passed to the component at rendering.
138
+ * @deprecated Use the `slotProps` prop instead.
137
139
  */
138
140
  componentsProps: PropTypes.object,
139
141
  /**
@@ -552,6 +554,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
552
554
  * @param {GridCallbackDetails} details Additional details for this callback.
553
555
  */
554
556
  onDetailPanelExpandedRowIdsChange: PropTypes.func,
557
+ /**
558
+ * Callback fired when the state of the Excel export changes.
559
+ * @param {string} inProgress Indicates if the task is in progress.
560
+ */
561
+ onExcelExportStateChange: PropTypes.func,
555
562
  /**
556
563
  * Callback fired when rowCount is set and the next batch of virtualized rows is rendered.
557
564
  * @param {GridFetchRowsParams} params With all properties from [[GridFetchRowsParams]].
@@ -825,6 +832,14 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
825
832
  * @default false
826
833
  */
827
834
  showColumnVerticalBorder: PropTypes.bool,
835
+ /**
836
+ * Overrideable components props dynamically passed to the component at rendering.
837
+ */
838
+ slotProps: PropTypes.object,
839
+ /**
840
+ * Overrideable components.
841
+ */
842
+ slots: PropTypes.object,
828
843
  /**
829
844
  * Sorting can be processed on the server or client-side.
830
845
  * 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,30 @@ 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 themedProps = useThemeProps({
22
- props: inProps,
23
- name: 'MuiDataGrid'
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 components = React.useMemo(() => {
27
- const overrides = themedProps.components;
28
- if (!overrides) {
29
- return _extends({}, DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS);
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]);
37
- return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
38
- localeText,
35
+ const slots = React.useMemo(() => computeSlots({
36
+ defaultSlots,
39
37
  components,
40
- signature: 'DataGridPremium'
41
- }), [themedProps, localeText, components]);
38
+ slots: themedProps.slots
39
+ }), [components, themedProps.slots]);
40
+ return React.useMemo(() => {
41
+ var _themedProps$slotProp;
42
+ return _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps, {
43
+ slotProps: (_themedProps$slotProp = themedProps.slotProps) != null ? _themedProps$slotProp : componentsProps,
44
+ localeText,
45
+ slots,
46
+ signature: 'DataGridPremium'
47
+ });
48
+ }, [themedProps, componentsProps, localeText, slots]);
42
49
  };
@@ -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';
@@ -57,10 +58,10 @@ function GridAggregationHeader(props) {
57
58
  } = props;
58
59
  const apiRef = useGridApiContext();
59
60
  const rootProps = useGridRootProps();
60
- const ownerState = {
61
+ const ownerState = _extends({}, rootProps, {
61
62
  classes: rootProps.classes,
62
63
  colDef
63
- };
64
+ });
64
65
  const classes = useUtilityClasses(ownerState);
65
66
  if (!aggregation) {
66
67
  return null;
@@ -59,7 +59,7 @@ function GridColumnMenuAggregationItem(props) {
59
59
  return /*#__PURE__*/_jsxs(MenuItem, {
60
60
  disableRipple: true,
61
61
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
62
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuAggregationIcon, {
62
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
63
63
  fontSize: "small"
64
64
  })
65
65
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -29,7 +29,7 @@ function GridColumnMenuRowGroupItem(props) {
29
29
  return /*#__PURE__*/_jsxs(MenuItem, {
30
30
  onClick: ungroupColumn,
31
31
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
32
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuUngroupIcon, {
32
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
33
33
  fontSize: "small"
34
34
  })
35
35
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -35,7 +35,7 @@ function GridColumnMenuRowUngroupItem(props) {
35
35
  return /*#__PURE__*/_jsxs(MenuItem, {
36
36
  onClick: ungroupColumn,
37
37
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
38
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuUngroupIcon, {
38
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
39
39
  fontSize: "small"
40
40
  })
41
41
  }), /*#__PURE__*/_jsx(ListItemText, {
@@ -46,7 +46,7 @@ function GridColumnMenuRowUngroupItem(props) {
46
46
  return /*#__PURE__*/_jsxs(MenuItem, {
47
47
  onClick: groupColumn,
48
48
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
49
- children: /*#__PURE__*/_jsx(rootProps.components.ColumnMenuGroupIcon, {
49
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
50
50
  fontSize: "small"
51
51
  })
52
52
  }), /*#__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,
@@ -18,7 +18,7 @@ const useUtilityClasses = ownerState => {
18
18
  return composeClasses(slots, getDataGridUtilityClass, classes);
19
19
  };
20
20
  export function GridGroupingCriteriaCell(props) {
21
- var _filteredDescendantCo, _rootProps$components;
21
+ var _filteredDescendantCo, _rootProps$slotProps;
22
22
  const {
23
23
  id,
24
24
  field,
@@ -34,7 +34,7 @@ export function GridGroupingCriteriaCell(props) {
34
34
  const classes = useUtilityClasses(ownerState);
35
35
  const filteredDescendantCountLookup = useGridSelector(apiRef, gridFilteredDescendantCountLookupSelector);
36
36
  const filteredDescendantCount = (_filteredDescendantCo = filteredDescendantCountLookup[rowNode.id]) != null ? _filteredDescendantCo : 0;
37
- const Icon = rowNode.childrenExpanded ? rootProps.components.GroupingCriteriaCollapseIcon : rootProps.components.GroupingCriteriaExpandIcon;
37
+ const Icon = rowNode.childrenExpanded ? rootProps.slots.groupingCriteriaCollapseIcon : rootProps.slots.groupingCriteriaExpandIcon;
38
38
  const handleKeyDown = event => {
39
39
  if (event.key === ' ') {
40
40
  // We call event.stopPropagation to avoid unfolding the row and also scrolling to bottom
@@ -69,13 +69,13 @@ export function GridGroupingCriteriaCell(props) {
69
69
  },
70
70
  children: [/*#__PURE__*/_jsx("div", {
71
71
  className: classes.toggle,
72
- children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(rootProps.components.BaseIconButton, _extends({
72
+ children: filteredDescendantCount > 0 && /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
73
73
  size: "small",
74
74
  onClick: handleClick,
75
75
  onKeyDown: handleKeyDown,
76
76
  tabIndex: -1,
77
77
  "aria-label": rowNode.childrenExpanded ? apiRef.current.getLocaleText('treeDataCollapse') : apiRef.current.getLocaleText('treeDataExpand')
78
- }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseIconButton, {
78
+ }, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseIconButton, {
79
79
  children: /*#__PURE__*/_jsx(Icon, {
80
80
  fontSize: "inherit"
81
81
  })
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
3
3
  import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
4
- export declare const useGridAggregationPreProcessors: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, 'aggregationFunctions' | 'disableAggregation' | 'getAggregationPosition' | 'componentsProps' | 'components'>) => void;
4
+ export declare const useGridAggregationPreProcessors: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, 'aggregationFunctions' | 'disableAggregation' | 'getAggregationPosition' | 'slotProps' | 'slots'>) => void;
@@ -13,6 +13,11 @@ export interface ColumnsStylesInterface {
13
13
  * The options to apply on the Excel export.
14
14
  */
15
15
  export interface GridExcelExportOptions extends GridFileExportOptions {
16
+ /**
17
+ * Function to return the Worker instance to be called.
18
+ * @returns {() => Worker} A Worker instance.
19
+ */
20
+ worker?: () => Worker;
16
21
  /**
17
22
  * Name given to the worksheet containing the columns valueOptions.
18
23
  * valueOptions are added to this worksheet if they are provided as an array.
@@ -20,12 +25,16 @@ export interface GridExcelExportOptions extends GridFileExportOptions {
20
25
  valueOptionsSheetName?: string;
21
26
  /**
22
27
  * Method called before adding the rows to the workbook.
28
+ * Not supported when `worker` is set.
29
+ * To use with web workers, use the option in `setupExcelExportWebWorker`.
23
30
  * @param {GridExceljsProcessInput} processInput object containing the workbook and the worksheet.
24
31
  * @returns {Promise<void>} A promise which resolves after processing the input.
25
32
  * */
26
33
  exceljsPreProcess?: (processInput: GridExceljsProcessInput) => Promise<void>;
27
34
  /**
28
35
  * Method called after adding the rows to the workbook.
36
+ * Not supported when `worker` is set.
37
+ * To use with web workers, use the option in `setupExcelExportWebWorker`.
29
38
  * @param {GridExceljsProcessInput} processInput object containing the workbook and the worksheet.
30
39
  * @returns {Promise<void>} A promise which resolves after processing the input.
31
40
  * */
@@ -1 +1,2 @@
1
1
  export * from './gridExcelExportInterface';
2
+ export { setupExcelExportWebWorker } from './serializer/excelSerializer';
@@ -1 +1,2 @@
1
- export * from './gridExcelExportInterface';
1
+ export * from './gridExcelExportInterface';
2
+ export { setupExcelExportWebWorker } from './serializer/excelSerializer';
@@ -1,8 +1,47 @@
1
1
  import type * as Excel from 'exceljs';
2
- import { GridRowId } from '@mui/x-data-grid-pro';
3
- import { GridStateColDef } from '@mui/x-data-grid/internals';
4
- import { GridExceljsProcessInput, ColumnsStylesInterface } from '../gridExcelExportInterface';
2
+ import { GridRowId, GridColDef } from '@mui/x-data-grid-pro';
3
+ import { GridStateColDef, GridColumnGroupLookup } from '@mui/x-data-grid/internals';
4
+ import { GridExceljsProcessInput, ColumnsStylesInterface, GridExcelExportOptions } from '../gridExcelExportInterface';
5
5
  import { GridPrivateApiPremium } from '../../../../models/gridApiPremium';
6
+ interface SerializedRow {
7
+ row: Record<string, undefined | number | boolean | string | Date>;
8
+ dataValidation: Record<string, Excel.DataValidation>;
9
+ outlineLevel: number;
10
+ mergedCells: {
11
+ leftIndex: number;
12
+ rightIndex: number;
13
+ }[];
14
+ }
15
+ export declare const serializeRow: (id: GridRowId, columns: GridStateColDef[], api: GridPrivateApiPremium, defaultValueOptionsFormulae: {
16
+ [field: string]: {
17
+ address: string;
18
+ };
19
+ }) => SerializedRow;
20
+ export declare const serializeColumn: (column: GridColDef, columnsStyles: ColumnsStylesInterface) => {
21
+ key: string;
22
+ headerText: string;
23
+ width: number;
24
+ style: {
25
+ numFmt: string;
26
+ font: Partial<Excel.Font>;
27
+ alignment: Partial<Excel.Alignment>;
28
+ protection: Partial<Excel.Protection>;
29
+ border: Partial<Excel.Borders>;
30
+ fill: Excel.Fill;
31
+ };
32
+ };
33
+ type SerializedColumns = Array<{
34
+ key: string;
35
+ width: number;
36
+ style: Excel.Style;
37
+ headerText: string;
38
+ }>;
39
+ export declare function serializeColumns(columns: GridStateColDef[], styles: ColumnsStylesInterface): SerializedColumns;
40
+ type ValueOptionsData = Record<string, {
41
+ values: (string | number)[];
42
+ address: string;
43
+ }>;
44
+ export declare function getDataForValueOptionsSheet(columns: GridStateColDef[], valueOptionsSheetName: string, api: GridPrivateApiPremium): Promise<ValueOptionsData>;
6
45
  interface BuildExcelOptions {
7
46
  columns: GridStateColDef[];
8
47
  rowIds: GridRowId[];
@@ -14,4 +53,14 @@ interface BuildExcelOptions {
14
53
  columnsStyles?: ColumnsStylesInterface;
15
54
  }
16
55
  export declare function buildExcel(options: BuildExcelOptions, api: GridPrivateApiPremium): Promise<Excel.Workbook>;
56
+ export interface ExcelExportInitEvent {
57
+ serializedColumns: SerializedColumns;
58
+ serializedRows: SerializedRow[];
59
+ valueOptionsSheetName: string;
60
+ columnGroupPaths: Record<string, string[]>;
61
+ columnGroupDetails: GridColumnGroupLookup;
62
+ valueOptionsData: ValueOptionsData;
63
+ options: Omit<GridExcelExportOptions, 'exceljsPreProcess' | 'exceljsPostProcess' | 'columnsStyles' | 'valueOptionsSheetName'>;
64
+ }
65
+ export declare function setupExcelExportWebWorker(workerOptions?: Pick<GridExcelExportOptions, 'exceljsPostProcess' | 'exceljsPreProcess'>): void;
17
66
  export {};