@mui/x-data-grid-premium 8.0.0-alpha.12 → 8.0.0-alpha.14

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 (117) hide show
  1. package/CHANGELOG.md +430 -0
  2. package/DataGridPremium/DataGridPremium.js +51 -39
  3. package/DataGridPremium/useDataGridPremiumProps.js +2 -2
  4. package/components/GridAggregationHeader.d.ts +1 -1
  5. package/components/GridAggregationHeader.js +7 -11
  6. package/components/GridColumnMenuAggregationItem.js +4 -4
  7. package/components/GridDataSourceGroupingCriteriaCell.js +5 -6
  8. package/components/GridFooterCell.js +5 -6
  9. package/components/GridGroupingColumnFooterCell.js +2 -1
  10. package/components/GridGroupingColumnLeafCell.js +3 -9
  11. package/components/GridGroupingCriteriaCell.js +3 -8
  12. package/components/GridPremiumToolbar.d.ts +3 -0
  13. package/components/GridPremiumToolbar.js +31 -0
  14. package/components/export/ExportExcel.d.ts +29 -0
  15. package/components/export/ExportExcel.js +198 -0
  16. package/components/export/index.d.ts +1 -0
  17. package/components/export/index.js +16 -0
  18. package/components/index.d.ts +2 -1
  19. package/components/index.js +13 -1
  20. package/components/promptControl/GridToolbarPromptControl.js +34 -32
  21. package/constants/dataGridPremiumDefaultSlotsComponents.js +3 -1
  22. package/esm/DataGridPremium/DataGridPremium.js +51 -39
  23. package/esm/DataGridPremium/useDataGridPremiumProps.js +2 -2
  24. package/esm/components/GridAggregationHeader.d.ts +1 -1
  25. package/esm/components/GridAggregationHeader.js +7 -11
  26. package/esm/components/GridColumnMenuAggregationItem.js +4 -4
  27. package/esm/components/GridDataSourceGroupingCriteriaCell.js +6 -7
  28. package/esm/components/GridFooterCell.js +5 -6
  29. package/esm/components/GridGroupingColumnFooterCell.js +2 -1
  30. package/esm/components/GridGroupingColumnLeafCell.js +3 -8
  31. package/esm/components/GridGroupingCriteriaCell.js +3 -8
  32. package/esm/components/GridPremiumToolbar.d.ts +3 -0
  33. package/esm/components/GridPremiumToolbar.js +23 -0
  34. package/esm/components/export/ExportExcel.d.ts +29 -0
  35. package/esm/components/export/ExportExcel.js +191 -0
  36. package/esm/components/export/index.d.ts +1 -0
  37. package/esm/components/export/index.js +1 -0
  38. package/esm/components/index.d.ts +2 -1
  39. package/esm/components/index.js +2 -1
  40. package/esm/components/promptControl/GridToolbarPromptControl.js +34 -32
  41. package/esm/constants/dataGridPremiumDefaultSlotsComponents.js +3 -1
  42. package/esm/hooks/features/aggregation/useGridAggregation.d.ts +1 -1
  43. package/esm/hooks/features/aggregation/useGridAggregation.js +6 -6
  44. package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
  45. package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +6 -6
  46. package/esm/hooks/features/clipboard/useGridClipboardImport.js +3 -3
  47. package/esm/hooks/features/dataSource/models.d.ts +1 -1
  48. package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +3 -3
  49. package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +2 -2
  50. package/esm/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +1 -1
  51. package/esm/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +3 -3
  52. package/esm/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  53. package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +4 -4
  54. package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +1 -1
  55. package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +5 -5
  56. package/esm/index.d.ts +0 -6
  57. package/esm/index.js +1 -7
  58. package/esm/models/dataGridPremiumProps.d.ts +7 -8
  59. package/esm/utils/releaseInfo.js +1 -1
  60. package/hooks/features/aggregation/useGridAggregation.d.ts +1 -1
  61. package/hooks/features/aggregation/useGridAggregation.js +6 -6
  62. package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
  63. package/hooks/features/aggregation/useGridAggregationPreProcessors.js +6 -6
  64. package/hooks/features/clipboard/useGridClipboardImport.js +2 -2
  65. package/hooks/features/dataSource/models.d.ts +1 -1
  66. package/hooks/features/dataSource/useGridDataSourcePremium.js +3 -3
  67. package/hooks/features/rowGrouping/gridRowGroupingUtils.js +1 -1
  68. package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +1 -1
  69. package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +3 -3
  70. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  71. package/hooks/features/rowGrouping/useGridRowGrouping.js +4 -4
  72. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +1 -1
  73. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +5 -5
  74. package/index.d.ts +0 -6
  75. package/index.js +2 -11
  76. package/models/dataGridPremiumProps.d.ts +7 -8
  77. package/modern/DataGridPremium/DataGridPremium.js +51 -39
  78. package/modern/DataGridPremium/useDataGridPremiumProps.js +2 -2
  79. package/modern/components/GridAggregationHeader.d.ts +1 -1
  80. package/modern/components/GridAggregationHeader.js +7 -11
  81. package/modern/components/GridColumnMenuAggregationItem.js +4 -4
  82. package/modern/components/GridDataSourceGroupingCriteriaCell.js +6 -7
  83. package/modern/components/GridFooterCell.js +5 -6
  84. package/modern/components/GridGroupingColumnFooterCell.js +2 -1
  85. package/modern/components/GridGroupingColumnLeafCell.js +3 -8
  86. package/modern/components/GridGroupingCriteriaCell.js +3 -8
  87. package/modern/components/GridPremiumToolbar.d.ts +3 -0
  88. package/modern/components/GridPremiumToolbar.js +23 -0
  89. package/modern/components/export/ExportExcel.d.ts +29 -0
  90. package/modern/components/export/ExportExcel.js +191 -0
  91. package/modern/components/export/index.d.ts +1 -0
  92. package/modern/components/export/index.js +1 -0
  93. package/modern/components/index.d.ts +2 -1
  94. package/modern/components/index.js +2 -1
  95. package/modern/components/promptControl/GridToolbarPromptControl.js +34 -32
  96. package/modern/constants/dataGridPremiumDefaultSlotsComponents.js +3 -1
  97. package/modern/hooks/features/aggregation/useGridAggregation.d.ts +1 -1
  98. package/modern/hooks/features/aggregation/useGridAggregation.js +6 -6
  99. package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
  100. package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +6 -6
  101. package/modern/hooks/features/clipboard/useGridClipboardImport.js +3 -3
  102. package/modern/hooks/features/dataSource/models.d.ts +1 -1
  103. package/modern/hooks/features/dataSource/useGridDataSourcePremium.js +3 -3
  104. package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +2 -2
  105. package/modern/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +1 -1
  106. package/modern/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.js +3 -3
  107. package/modern/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  108. package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +4 -4
  109. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +1 -1
  110. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +5 -5
  111. package/modern/index.d.ts +0 -6
  112. package/modern/index.js +1 -7
  113. package/modern/models/dataGridPremiumProps.d.ts +7 -8
  114. package/modern/utils/releaseInfo.js +1 -1
  115. package/package.json +5 -5
  116. package/tsconfig.build.tsbuildinfo +1 -1
  117. package/utils/releaseInfo.js +1 -1
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { useLicenseVerifier, Watermark } from '@mui/x-license';
7
7
  import { GridRoot, GridContextProvider } from '@mui/x-data-grid-pro';
8
8
  import { propValidatorsDataGrid, propValidatorsDataGridPro, validateProps } from '@mui/x-data-grid-pro/internals';
9
+ import { useMaterialCSSVariables } from '@mui/x-data-grid/material';
9
10
  import { forwardRef } from '@mui/x-internals/forwardRef';
10
11
  import { useDataGridPremiumComponent } from "./useDataGridPremiumComponent.js";
11
12
  import { useDataGridPremiumProps } from "./useDataGridPremiumProps.js";
@@ -15,6 +16,7 @@ import { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaA
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  const configuration = {
17
18
  hooks: {
19
+ useCSSVariables: useMaterialCSSVariables,
18
20
  useGridAriaAttributes,
19
21
  useGridRowAriaAttributes
20
22
  }
@@ -56,7 +58,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
56
58
  // ----------------------------------------------------------------------
57
59
  /**
58
60
  * Aggregation functions available on the grid.
59
- * @default GRID_AGGREGATION_FUNCTIONS when `unstable_dataSource` is not provided, `{}` when `unstable_dataSource` is provided
61
+ * @default GRID_AGGREGATION_FUNCTIONS when `dataSource` is not provided, `{}` when `dataSource` is provided
60
62
  */
61
63
  aggregationFunctions: PropTypes.object,
62
64
  /**
@@ -173,6 +175,24 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
173
175
  * If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
174
176
  */
175
177
  columnVisibilityModel: PropTypes.object,
178
+ /**
179
+ * Data source object.
180
+ */
181
+ dataSource: PropTypes.shape({
182
+ getAggregatedValue: PropTypes.func,
183
+ getChildrenCount: PropTypes.func,
184
+ getGroupKey: PropTypes.func,
185
+ getRows: PropTypes.func.isRequired,
186
+ updateRow: PropTypes.func
187
+ }),
188
+ /**
189
+ * Data source cache object.
190
+ */
191
+ dataSourceCache: PropTypes.shape({
192
+ clear: PropTypes.func.isRequired,
193
+ get: PropTypes.func.isRequired,
194
+ set: PropTypes.func.isRequired
195
+ }),
176
196
  /**
177
197
  * If above 0, the row children will be expanded up to this depth.
178
198
  * If equal to -1, all the row children will be expanded.
@@ -487,6 +507,18 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
487
507
  * @default false
488
508
  */
489
509
  keepNonExistentRowsSelected: PropTypes.bool,
510
+ /**
511
+ * Used together with `dataSource` to enable lazy loading.
512
+ * If enabled, the grid stops adding `paginationModel` to the data requests (`getRows`)
513
+ * and starts sending `start` and `end` values depending on the loading mode and the scroll position.
514
+ * @default false
515
+ */
516
+ lazyLoading: PropTypes.bool,
517
+ /**
518
+ * If positive, the Data Grid will throttle data source requests on rendered rows interval change.
519
+ * @default 500
520
+ */
521
+ lazyLoadingRequestThrottleMs: PropTypes.number,
490
522
  /**
491
523
  * If `true`, a loading overlay is displayed.
492
524
  * @default false
@@ -663,6 +695,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
663
695
  * @param {GridCallbackDetails} details Additional details for this callback.
664
696
  */
665
697
  onColumnWidthChange: PropTypes.func,
698
+ /**
699
+ * Callback fired when a data source request fails.
700
+ * @param {GridGetRowsError | GridUpdateRowError} error The data source error object.
701
+ */
702
+ onDataSourceError: PropTypes.func,
666
703
  /**
667
704
  * Callback fired when the density changes.
668
705
  * @param {GridDensity} density New density value.
@@ -684,6 +721,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
684
721
  * @param {GridFetchRowsParams} params With all properties from [[GridFetchRowsParams]].
685
722
  * @param {MuiEvent<{}>} event The event object.
686
723
  * @param {GridCallbackDetails} details Additional details for this callback.
724
+ * @deprecated Use the {@link https://next.mui.com/x/react-data-grid/server-side-data/lazy-loading/#viewport-loading Server-side data-Viewport loading} instead.
687
725
  */
688
726
  onFetchRows: PropTypes.func,
689
727
  /**
@@ -811,6 +849,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
811
849
  * @param {GridRowScrollEndParams} params With all properties from [[GridRowScrollEndParams]].
812
850
  * @param {MuiEvent<{}>} event The event object.
813
851
  * @param {GridCallbackDetails} details Additional details for this callback.
852
+ * @deprecated Use the {@link https://next.mui.com/x/react-data-grid/server-side-data/lazy-loading/#infinite-loading Server-side data-Infinite loading} instead.
814
853
  */
815
854
  onRowsScrollEnd: PropTypes.func,
816
855
  /**
@@ -934,7 +973,10 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
934
973
  /**
935
974
  * Sets the row selection model of the Data Grid.
936
975
  */
937
- rowSelectionModel: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.string]),
976
+ rowSelectionModel: PropTypes /* @typescript-to-proptypes-ignore */.shape({
977
+ ids: PropTypes.instanceOf(Set).isRequired,
978
+ type: PropTypes.oneOf(['exclude', 'include']).isRequired
979
+ }),
938
980
  /**
939
981
  * When `rowSelectionPropagation.descendants` is set to `true`.
940
982
  * - Selecting a parent selects all its filtered descendants automatically.
@@ -956,6 +998,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
956
998
  * Set it to 'client' if you would like enable infnite loading.
957
999
  * Set it to 'server' if you would like to enable lazy loading.
958
1000
  * @default "client"
1001
+ * @deprecated Use the {@link https://next.mui.com/x/react-data-grid/server-side-data/lazy-loading/#viewport-loading Server-side data-Viewport loading} instead.
959
1002
  */
960
1003
  rowsLoadingMode: PropTypes.oneOf(['client', 'server']),
961
1004
  /**
@@ -974,7 +1017,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
974
1017
  scrollbarSize: PropTypes.number,
975
1018
  /**
976
1019
  * Set the area in `px` at the bottom of the grid viewport where onRowsScrollEnd is called.
977
- * If combined with `unstable_lazyLoading`, it defines the area where the next data request is triggered.
1020
+ * If combined with `lazyLoading`, it defines the area where the next data request is triggered.
978
1021
  * @default 80
979
1022
  */
980
1023
  scrollEndThreshold: PropTypes.number,
@@ -988,6 +1031,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
988
1031
  * @default false
989
1032
  */
990
1033
  showColumnVerticalBorder: PropTypes.bool,
1034
+ /**
1035
+ * If `true`, the toolbar is displayed.
1036
+ * @default false
1037
+ */
1038
+ showToolbar: PropTypes.bool,
991
1039
  /**
992
1040
  * Overridable components props dynamically passed to the component at rendering.
993
1041
  */
@@ -1037,36 +1085,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
1037
1085
  * @default false
1038
1086
  */
1039
1087
  treeData: PropTypes.bool,
1040
- /**
1041
- * Data source object.
1042
- */
1043
- unstable_dataSource: PropTypes.shape({
1044
- getAggregatedValue: PropTypes.func,
1045
- getChildrenCount: PropTypes.func,
1046
- getGroupKey: PropTypes.func,
1047
- getRows: PropTypes.func.isRequired,
1048
- updateRow: PropTypes.func
1049
- }),
1050
- /**
1051
- * Data source cache object.
1052
- */
1053
- unstable_dataSourceCache: PropTypes.shape({
1054
- clear: PropTypes.func.isRequired,
1055
- get: PropTypes.func.isRequired,
1056
- set: PropTypes.func.isRequired
1057
- }),
1058
- /**
1059
- * Used together with `unstable_dataSource` to enable lazy loading.
1060
- * If enabled, the grid stops adding `paginationModel` to the data requests (`getRows`)
1061
- * and starts sending `start` and `end` values depending on the loading mode and the scroll position.
1062
- * @default false
1063
- */
1064
- unstable_lazyLoading: PropTypes.bool,
1065
- /**
1066
- * If positive, the Data Grid will throttle data source requests on rendered rows interval change.
1067
- * @default 500
1068
- */
1069
- unstable_lazyLoadingRequestThrottleMs: PropTypes.number,
1070
1088
  /**
1071
1089
  * Definition of the column rendered when the `unstable_listView` prop is enabled.
1072
1090
  */
@@ -1082,12 +1100,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
1082
1100
  * Use in combination with `unstable_listColumn`.
1083
1101
  */
1084
1102
  unstable_listView: PropTypes.bool,
1085
- /**
1086
- * Callback fired when the data source request fails.
1087
- * @param {Error} error The error object.
1088
- * @param {GridGetRowsParams} params With all properties from [[GridGetRowsParams]].
1089
- */
1090
- unstable_onDataSourceError: PropTypes.func,
1091
1103
  /**
1092
1104
  * If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
1093
1105
  * By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
@@ -7,7 +7,7 @@ import { GRID_AGGREGATION_FUNCTIONS } from "../hooks/features/aggregation/index.
7
7
  import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from "../constants/dataGridPremiumDefaultSlotsComponents.js";
8
8
  const getDataGridPremiumForcedProps = themedProps => _extends({
9
9
  signature: GridSignature.DataGridPremium
10
- }, themedProps.unstable_dataSource ? {
10
+ }, themedProps.dataSource ? {
11
11
  filterMode: 'server',
12
12
  sortingMode: 'server',
13
13
  paginationMode: 'server'
@@ -45,7 +45,7 @@ export const useDataGridPremiumProps = inProps => {
45
45
  defaultSlots,
46
46
  slots: themedProps.slots
47
47
  }), [themedProps.slots]);
48
- return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps.unstable_dataSource ? {
48
+ return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps.dataSource ? {
49
49
  aggregationFunctions: {}
50
50
  } : {}, themedProps, {
51
51
  localeText,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { GridColumnHeaderParams } from '@mui/x-data-grid';
3
- import type { GridBaseColDef } from '@mui/x-data-grid/internals';
3
+ import { type GridBaseColDef } from '@mui/x-data-grid/internals';
4
4
  declare function GridAggregationHeader(props: GridColumnHeaderParams & {
5
5
  renderHeader: GridBaseColDef['renderHeader'];
6
6
  }): React.JSX.Element | null;
@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
  import composeClasses from '@mui/utils/composeClasses';
6
6
  import { styled } from '@mui/material/styles';
7
7
  import { getDataGridUtilityClass, gridClasses, GridColumnHeaderTitle } from '@mui/x-data-grid';
8
+ import { vars } from '@mui/x-data-grid/internals';
8
9
  import { getAggregationFunctionLabel } from "../hooks/features/aggregation/gridAggregationUtils.js";
9
10
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
10
11
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
@@ -30,17 +31,12 @@ const GridAggregationHeaderRoot = styled('div', {
30
31
  });
31
32
  const GridAggregationFunctionLabel = styled('div', {
32
33
  name: 'MuiDataGrid',
33
- slot: 'AggregationColumnHeaderLabel',
34
- overridesResolver: (_, styles) => styles.aggregationColumnHeaderLabel
35
- })(({
36
- theme
37
- }) => {
38
- return {
39
- fontSize: theme.typography.caption.fontSize,
40
- lineHeight: 'normal',
41
- color: theme.palette.text.secondary,
42
- marginTop: -1
43
- };
34
+ slot: 'AggregationColumnHeaderLabel'
35
+ })({
36
+ fontSize: vars.typography.small.fontSize,
37
+ lineHeight: 'normal',
38
+ color: vars.colors.foreground.muted,
39
+ marginTop: -1
44
40
  });
45
41
  const useUtilityClasses = ownerState => {
46
42
  const {
@@ -24,8 +24,8 @@ function GridColumnMenuAggregationItem(props) {
24
24
  const availableAggregationFunctions = React.useMemo(() => getAvailableAggregationFunctions({
25
25
  aggregationFunctions: rootProps.aggregationFunctions,
26
26
  colDef,
27
- isDataSource: !!rootProps.unstable_dataSource
28
- }), [colDef, rootProps.aggregationFunctions, rootProps.unstable_dataSource]);
27
+ isDataSource: !!rootProps.dataSource
28
+ }), [colDef, rootProps.aggregationFunctions, rootProps.dataSource]);
29
29
  const _ref = rootProps.slotProps?.baseSelect || {},
30
30
  {
31
31
  native: isBaseSelectNative = false
@@ -41,12 +41,12 @@ function GridColumnMenuAggregationItem(props) {
41
41
  colDef,
42
42
  aggregationFunctionName,
43
43
  aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName],
44
- isDataSource: !!rootProps.unstable_dataSource
44
+ isDataSource: !!rootProps.dataSource
45
45
  })) {
46
46
  return aggregationFunctionName;
47
47
  }
48
48
  return '';
49
- }, [rootProps.aggregationFunctions, rootProps.unstable_dataSource, aggregationModel, colDef]);
49
+ }, [rootProps.aggregationFunctions, rootProps.dataSource, aggregationModel, colDef]);
50
50
  const handleAggregationItemChange = event => {
51
51
  const newAggregationItem = event.target?.value || undefined;
52
52
  const currentModel = gridAggregationModelSelector(apiRef);
@@ -1,8 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
4
- import Box from '@mui/material/Box';
5
- import { useGridPrivateApiContext, gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector, gridRowSelector } from '@mui/x-data-grid-pro/internals';
4
+ import { useGridPrivateApiContext, gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector, gridRowSelector, vars } from '@mui/x-data-grid-pro/internals';
6
5
  import { useGridSelector, getDataGridUtilityClass } from '@mui/x-data-grid-pro';
7
6
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
8
7
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
@@ -33,7 +32,7 @@ function GridGroupingCriteriaCellIcon(props) {
33
32
  const handleClick = event => {
34
33
  if (!rowNode.childrenExpanded) {
35
34
  // always fetch/get from cache the children when the node is expanded
36
- apiRef.current.unstable_dataSource.fetchRows(id);
35
+ apiRef.current.dataSource.fetchRows(id);
37
36
  } else {
38
37
  apiRef.current.setRowChildrenExpansion(id, !rowNode.childrenExpanded);
39
38
  }
@@ -83,7 +82,7 @@ export function GridDataSourceGroupingCriteriaCell(props) {
83
82
  const classes = useUtilityClasses(rootProps);
84
83
  let descendantCount = 0;
85
84
  if (row) {
86
- descendantCount = Math.max(rootProps.unstable_dataSource?.getChildrenCount?.(row) ?? 0, 0);
85
+ descendantCount = Math.max(rootProps.dataSource?.getChildrenCount?.(row) ?? 0, 0);
87
86
  }
88
87
  let cellContent;
89
88
  const colDef = apiRef.current.getColumn(rowNode.groupingField);
@@ -98,10 +97,10 @@ export function GridDataSourceGroupingCriteriaCell(props) {
98
97
  children: rowNode.groupingKey
99
98
  });
100
99
  }
101
- return /*#__PURE__*/_jsxs(Box, {
100
+ return /*#__PURE__*/_jsxs("div", {
102
101
  className: classes.root,
103
- sx: {
104
- ml: rootProps.rowGroupingColumnMode === 'multiple' ? 0 : theme => `calc(var(--DataGrid-cellOffsetMultiplier) * ${theme.spacing(rowNode.depth)})`
102
+ style: {
103
+ marginLeft: rootProps.rowGroupingColumnMode === 'multiple' ? 0 : `calc(var(--DataGrid-cellOffsetMultiplier) * ${vars.spacing(rowNode.depth)})`
105
104
  },
106
105
  children: [/*#__PURE__*/_jsx("div", {
107
106
  className: classes.toggle,
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["formattedValue", "colDef", "cellMode", "row", "api", "id", "value", "rowNode", "field", "focusElementRef", "hasFocus", "tabIndex", "isEditable"];
4
4
  import * as React from 'react';
5
5
  import { getDataGridUtilityClass } from '@mui/x-data-grid';
6
+ import { vars } from '@mui/x-data-grid/internals';
6
7
  import { styled } from '@mui/material/styles';
7
8
  import composeClasses from '@mui/utils/composeClasses';
8
9
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
@@ -11,12 +12,10 @@ const GridFooterCellRoot = styled('div', {
11
12
  name: 'MuiDataGrid',
12
13
  slot: 'FooterCell',
13
14
  overridesResolver: (_, styles) => styles.footerCell
14
- })(({
15
- theme
16
- }) => ({
17
- fontWeight: theme.typography.fontWeightMedium,
18
- color: (theme.vars || theme).palette.primary.dark
19
- }));
15
+ })({
16
+ fontWeight: vars.typography.fontWeight.medium,
17
+ color: vars.colors.foreground.accent
18
+ });
20
19
  const useUtilityClasses = ownerState => {
21
20
  const {
22
21
  classes
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { vars } from '@mui/x-data-grid/internals';
3
4
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
4
5
  import { GridFooterCell } from "./GridFooterCell.js";
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -13,7 +14,7 @@ function GridGroupingColumnFooterCell(props) {
13
14
  } else if (rootProps.rowGroupingColumnMode === 'multiple') {
14
15
  sx.ml = 2;
15
16
  } else {
16
- sx.ml = theme => `calc(var(--DataGrid-cellOffsetMultiplier) * ${theme.spacing(props.rowNode.depth)})`;
17
+ sx.ml = `calc(var(--DataGrid-cellOffsetMultiplier) * ${vars.spacing(props.rowNode.depth)})`;
17
18
  }
18
19
  return /*#__PURE__*/_jsx(GridFooterCell, _extends({
19
20
  sx: sx
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import Box from '@mui/material/Box';
2
+ import { vars } from '@mui/x-data-grid/internals';
3
3
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  function GridGroupingColumnLeafCell(props) {
@@ -7,14 +7,9 @@ function GridGroupingColumnLeafCell(props) {
7
7
  rowNode
8
8
  } = props;
9
9
  const rootProps = useGridRootProps();
10
- return /*#__PURE__*/_jsx(Box, {
11
- sx: [rootProps.rowGroupingColumnMode === 'multiple' ? {
12
- ml: 1
13
- } : theme => ({
14
- ml: `calc(var(--DataGrid-cellOffsetMultiplier) * var(--depth) * ${theme.spacing(1)})`
15
- })],
10
+ return /*#__PURE__*/_jsx("div", {
16
11
  style: {
17
- '--depth': rowNode.depth
12
+ marginLeft: rootProps.rowGroupingColumnMode === 'multiple' ? vars.spacing(1) : `calc(var(--DataGrid-cellOffsetMultiplier) * ${vars.spacing(rowNode.depth)})`
18
13
  },
19
14
  children: props.formattedValue ?? props.value
20
15
  });
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import composeClasses from '@mui/utils/composeClasses';
4
- import Box from '@mui/material/Box';
4
+ import { vars } from '@mui/x-data-grid/internals';
5
5
  import { useGridSelector, gridFilteredDescendantCountLookupSelector, getDataGridUtilityClass } from '@mui/x-data-grid-pro';
6
6
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
7
7
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
@@ -59,15 +59,10 @@ export function GridGroupingCriteriaCell(props) {
59
59
  children: rowNode.groupingKey
60
60
  });
61
61
  }
62
- return /*#__PURE__*/_jsxs(Box, {
62
+ return /*#__PURE__*/_jsxs("div", {
63
63
  className: classes.root,
64
- sx: [rootProps.rowGroupingColumnMode === 'multiple' ? {
65
- ml: 0
66
- } : theme => ({
67
- ml: `calc(var(--DataGrid-cellOffsetMultiplier) * var(--depth) * ${theme.spacing(1)})`
68
- })],
69
64
  style: {
70
- '--depth': rowNode.depth
65
+ marginLeft: rootProps.rowGroupingColumnMode === 'multiple' ? 0 : `calc(var(--DataGrid-cellOffsetMultiplier) * ${rowNode.depth} * ${vars.spacing(1)})`
71
66
  },
72
67
  children: [/*#__PURE__*/_jsx("div", {
73
68
  className: classes.toggle,
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { GridToolbarProps } from '@mui/x-data-grid/internals';
3
+ export declare function GridPremiumToolbar(props: GridToolbarProps): React.JSX.Element;
@@ -0,0 +1,23 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["excelOptions"];
4
+ import * as React from 'react';
5
+ import { GridToolbar } from '@mui/x-data-grid/internals';
6
+ import { ExportExcel } from "./export/index.js";
7
+ import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
8
+ import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ export function GridPremiumToolbar(props) {
11
+ const rootProps = useGridRootProps();
12
+ const apiRef = useGridApiContext();
13
+ const other = _objectWithoutPropertiesLoose(props, _excluded);
14
+ const additionalExportMenuItems = !props.excelOptions?.disableToolbarButton ? onMenuItemClick => /*#__PURE__*/_jsx(ExportExcel, {
15
+ render: /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({}, rootProps.slotProps?.baseMenuItem)),
16
+ options: props.excelOptions,
17
+ onClick: onMenuItemClick,
18
+ children: apiRef.current.getLocaleText('toolbarExportExcel')
19
+ }) : undefined;
20
+ return /*#__PURE__*/_jsx(GridToolbar, _extends({}, other, {
21
+ additionalExportMenuItems: additionalExportMenuItems
22
+ }));
23
+ }
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import { GridSlotProps, RenderProp } from '@mui/x-data-grid';
3
+ import { GridExcelExportOptions } from "../../hooks/features/export/index.js";
4
+ export type ExportExcelProps = GridSlotProps['baseButton'] & {
5
+ /**
6
+ * A function to customize rendering of the component.
7
+ */
8
+ render?: RenderProp<GridSlotProps['baseButton']>;
9
+ /**
10
+ * The options to apply on the Excel export.
11
+ * @demos
12
+ * - [Excel export](/x/react-data-grid/export/#excel-export)
13
+ */
14
+ options?: GridExcelExportOptions;
15
+ };
16
+ /**
17
+ * A button that triggers an Excel export.
18
+ * It renders the `baseButton` slot.
19
+ *
20
+ * Demos:
21
+ *
22
+ * - [Export](https://mui.com/x/react-data-grid/components/export/)
23
+ *
24
+ * API:
25
+ *
26
+ * - [ExportExcel API](https://mui.com/x/api/data-grid/export-excel/)
27
+ */
28
+ declare const ExportExcel: React.ForwardRefExoticComponent<ExportExcelProps> | React.ForwardRefExoticComponent<Omit<ExportExcelProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
29
+ export { ExportExcel };
@@ -0,0 +1,191 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["render", "options", "onClick"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { useGridComponentRenderer } from '@mui/x-data-grid/internals';
7
+ import { forwardRef } from '@mui/x-internals/forwardRef';
8
+ import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
9
+ import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ /**
12
+ * A button that triggers an Excel export.
13
+ * It renders the `baseButton` slot.
14
+ *
15
+ * Demos:
16
+ *
17
+ * - [Export](https://mui.com/x/react-data-grid/components/export/)
18
+ *
19
+ * API:
20
+ *
21
+ * - [ExportExcel API](https://mui.com/x/api/data-grid/export-excel/)
22
+ */
23
+ const ExportExcel = forwardRef(function ExportExcel(props, ref) {
24
+ const {
25
+ render,
26
+ options,
27
+ onClick
28
+ } = props,
29
+ other = _objectWithoutPropertiesLoose(props, _excluded);
30
+ const rootProps = useGridRootProps();
31
+ const apiRef = useGridApiContext();
32
+ const handleClick = event => {
33
+ apiRef.current.exportDataAsExcel(options);
34
+ onClick?.(event);
35
+ };
36
+ const element = useGridComponentRenderer(rootProps.slots.baseButton, render, _extends({
37
+ onClick: handleClick
38
+ }, rootProps.slotProps?.baseButton, other, {
39
+ ref
40
+ }));
41
+ return /*#__PURE__*/_jsx(React.Fragment, {
42
+ children: element
43
+ });
44
+ });
45
+ process.env.NODE_ENV !== "production" ? ExportExcel.propTypes = {
46
+ // ----------------------------- Warning --------------------------------
47
+ // | These PropTypes are generated from the TypeScript type definitions |
48
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
49
+ // ----------------------------------------------------------------------
50
+ /**
51
+ * A ref for imperative actions.
52
+ * It currently only supports `focusVisible()` action.
53
+ */
54
+ action: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
55
+ current: PropTypes.shape({
56
+ focusVisible: PropTypes.func.isRequired
57
+ })
58
+ })]),
59
+ /**
60
+ * If `true`, the ripples are centered.
61
+ * They won't start at the cursor interaction position.
62
+ * @default false
63
+ */
64
+ centerRipple: PropTypes.bool,
65
+ className: PropTypes.string,
66
+ /**
67
+ * The color of the component.
68
+ * It supports both default and custom theme colors, which can be added as shown in the
69
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
70
+ * @default 'primary'
71
+ */
72
+ color: PropTypes.oneOf(['error', 'info', 'inherit', 'primary', 'secondary', 'success', 'warning']),
73
+ component: PropTypes.elementType,
74
+ /**
75
+ * If `true`, the component is disabled.
76
+ */
77
+ disabled: PropTypes.bool,
78
+ /**
79
+ * If `true`, no elevation is used.
80
+ * @default false
81
+ */
82
+ disableElevation: PropTypes.bool,
83
+ /**
84
+ * If `true`, the keyboard focus ripple is disabled.
85
+ * @default false
86
+ */
87
+ disableFocusRipple: PropTypes.bool,
88
+ /**
89
+ * If `true`, the ripple effect is disabled.
90
+ *
91
+ * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
92
+ * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
93
+ * @default false
94
+ */
95
+ disableRipple: PropTypes.bool,
96
+ /**
97
+ * If `true`, the touch ripple effect is disabled.
98
+ * @default false
99
+ */
100
+ disableTouchRipple: PropTypes.bool,
101
+ /**
102
+ * Element placed after the children.
103
+ */
104
+ endIcon: PropTypes.node,
105
+ /**
106
+ * If `true`, the base button will have a keyboard focus ripple.
107
+ * @default false
108
+ */
109
+ focusRipple: PropTypes.bool,
110
+ /**
111
+ * This prop can help identify which element has keyboard focus.
112
+ * The class name will be applied when the element gains the focus through keyboard interaction.
113
+ * It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
114
+ * The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
115
+ * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
116
+ * if needed.
117
+ */
118
+ focusVisibleClassName: PropTypes.string,
119
+ /**
120
+ * If `true`, the button will take up the full width of its container.
121
+ * @default false
122
+ */
123
+ fullWidth: PropTypes.bool,
124
+ /**
125
+ * The URL to link to when the button is clicked.
126
+ * If defined, an `a` element will be used as the root node.
127
+ */
128
+ href: PropTypes.string,
129
+ /**
130
+ * The component used to render a link when the `href` prop is provided.
131
+ * @default 'a'
132
+ */
133
+ LinkComponent: PropTypes.elementType,
134
+ /**
135
+ * Callback fired when the component is focused with a keyboard.
136
+ * We trigger a `onFocus` callback too.
137
+ */
138
+ onFocusVisible: PropTypes.func,
139
+ /**
140
+ * The options to apply on the Excel export.
141
+ * @demos
142
+ * - [Excel export](/x/react-data-grid/export/#excel-export)
143
+ */
144
+ options: PropTypes.shape({
145
+ allColumns: PropTypes.bool,
146
+ columnsStyles: PropTypes.object,
147
+ escapeFormulas: PropTypes.bool,
148
+ exceljsPostProcess: PropTypes.func,
149
+ exceljsPreProcess: PropTypes.func,
150
+ fields: PropTypes.arrayOf(PropTypes.string),
151
+ fileName: PropTypes.string,
152
+ getRowsToExport: PropTypes.func,
153
+ includeColumnGroupsHeaders: PropTypes.bool,
154
+ includeHeaders: PropTypes.bool,
155
+ valueOptionsSheetName: PropTypes.string,
156
+ worker: PropTypes.func
157
+ }),
158
+ /**
159
+ * A function to customize rendering of the component.
160
+ */
161
+ render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
162
+ /**
163
+ * The size of the component.
164
+ * `small` is equivalent to the dense button styling.
165
+ */
166
+ size: PropTypes.oneOf(['large', 'medium', 'small']),
167
+ /**
168
+ * Element placed before the children.
169
+ */
170
+ startIcon: PropTypes.node,
171
+ style: PropTypes.object,
172
+ /**
173
+ * The system prop that allows defining system overrides as well as additional CSS styles.
174
+ */
175
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
176
+ tabIndex: PropTypes.number,
177
+ /**
178
+ * Props applied to the `TouchRipple` element.
179
+ */
180
+ TouchRippleProps: PropTypes.object,
181
+ /**
182
+ * A ref that points to the `TouchRipple` element.
183
+ */
184
+ touchRippleRef: PropTypes.any,
185
+ /**
186
+ * The variant to use.
187
+ * @default 'text'
188
+ */
189
+ variant: PropTypes.oneOf(['contained', 'outlined', 'text'])
190
+ } : void 0;
191
+ export { ExportExcel };
@@ -0,0 +1 @@
1
+ export * from "./ExportExcel.js";
@@ -0,0 +1 @@
1
+ export * from "./ExportExcel.js";