@mui/x-data-grid-premium 8.0.0-alpha.4 → 8.0.0-alpha.6

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 (32) hide show
  1. package/CHANGELOG.md +182 -0
  2. package/DataGridPremium/DataGridPremium.js +7 -10
  3. package/DataGridPremium/useDataGridPremiumProps.js +2 -2
  4. package/components/GridColumnMenuAggregationItem.js +37 -42
  5. package/components/GridColumnMenuRowGroupItem.js +5 -11
  6. package/components/GridColumnMenuRowUngroupItem.js +10 -19
  7. package/components/GridDataSourceGroupingCriteriaCell.js +1 -2
  8. package/components/GridPremiumColumnMenu.d.ts +1 -1
  9. package/components/GridPremiumColumnMenu.js +5 -5
  10. package/esm/DataGridPremium/DataGridPremium.js +7 -10
  11. package/esm/DataGridPremium/useDataGridPremiumProps.js +3 -3
  12. package/esm/components/GridColumnMenuAggregationItem.js +37 -42
  13. package/esm/components/GridColumnMenuRowGroupItem.js +6 -11
  14. package/esm/components/GridColumnMenuRowUngroupItem.js +11 -19
  15. package/esm/components/GridDataSourceGroupingCriteriaCell.js +1 -2
  16. package/esm/components/GridPremiumColumnMenu.js +5 -5
  17. package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  18. package/esm/utils/releaseInfo.js +1 -1
  19. package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  20. package/index.js +1 -1
  21. package/modern/DataGridPremium/DataGridPremium.js +7 -10
  22. package/modern/DataGridPremium/useDataGridPremiumProps.js +3 -3
  23. package/modern/components/GridColumnMenuAggregationItem.js +37 -42
  24. package/modern/components/GridColumnMenuRowGroupItem.js +6 -11
  25. package/modern/components/GridColumnMenuRowUngroupItem.js +11 -19
  26. package/modern/components/GridDataSourceGroupingCriteriaCell.js +1 -2
  27. package/modern/components/GridPremiumColumnMenu.js +5 -5
  28. package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
  29. package/modern/index.js +1 -1
  30. package/modern/utils/releaseInfo.js +1 -1
  31. package/package.json +5 -5
  32. package/utils/releaseInfo.js +1 -1
@@ -4,8 +4,6 @@ import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useGridSelector } from '@mui/x-data-grid-pro';
7
- import ListItemIcon from '@mui/material/ListItemIcon';
8
- import ListItemText from '@mui/material/ListItemText';
9
7
  import FormControl from '@mui/material/FormControl';
10
8
  import InputLabel from '@mui/material/InputLabel';
11
9
  import { unstable_useId as useId } from '@mui/utils';
@@ -52,47 +50,44 @@ function GridColumnMenuAggregationItem(props) {
52
50
  apiRef.current.hideColumnMenu();
53
51
  };
54
52
  const label = apiRef.current.getLocaleText('aggregationMenuItemHeader');
55
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
56
- disableRipple: true,
57
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
58
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
59
- fontSize: "small"
60
- })
61
- }), /*#__PURE__*/_jsx(ListItemText, {
62
- children: /*#__PURE__*/_jsxs(FormControl, {
63
- size: "small",
53
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
54
+ inert: true,
55
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
56
+ fontSize: "small"
57
+ }),
58
+ children: /*#__PURE__*/_jsxs(FormControl, {
59
+ size: "small",
60
+ fullWidth: true,
61
+ sx: {
62
+ minWidth: 150
63
+ },
64
+ children: [/*#__PURE__*/_jsx(InputLabel, {
65
+ id: `${id}-label`,
66
+ children: label
67
+ }), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, {
68
+ labelId: `${id}-label`,
69
+ id: `${id}-input`,
70
+ value: selectedAggregationRule,
71
+ label: label,
72
+ color: "primary",
73
+ onChange: handleAggregationItemChange,
74
+ onBlur: event => event.stopPropagation(),
64
75
  fullWidth: true,
65
- sx: {
66
- minWidth: 150
67
- },
68
- children: [/*#__PURE__*/_jsx(InputLabel, {
69
- id: `${id}-label`,
70
- children: label
71
- }), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, {
72
- labelId: `${id}-label`,
73
- id: `${id}-input`,
74
- value: selectedAggregationRule,
75
- label: label,
76
- color: "primary",
77
- onChange: handleAggregationItemChange,
78
- onBlur: event => event.stopPropagation(),
79
- fullWidth: true,
80
- children: [/*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
81
- value: "",
82
- children: "..."
83
- }), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
84
- value: aggFunc,
85
- children: getAggregationFunctionLabel({
86
- apiRef,
87
- aggregationRule: {
88
- aggregationFunctionName: aggFunc,
89
- aggregationFunction: rootProps.aggregationFunctions[aggFunc]
90
- }
91
- })
92
- }, aggFunc))]
93
- })]
94
- })
95
- })]
76
+ children: [/*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
77
+ value: "",
78
+ children: "..."
79
+ }), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
80
+ value: aggFunc,
81
+ children: getAggregationFunctionLabel({
82
+ apiRef,
83
+ aggregationRule: {
84
+ aggregationFunctionName: aggFunc,
85
+ aggregationFunction: rootProps.aggregationFunctions[aggFunc]
86
+ }
87
+ })
88
+ }, aggFunc))]
89
+ })]
90
+ })
96
91
  });
97
92
  }
98
93
  process.env.NODE_ENV !== "production" ? GridColumnMenuAggregationItem.propTypes = {
@@ -1,12 +1,10 @@
1
1
  import * as React from 'react';
2
- import ListItemIcon from '@mui/material/ListItemIcon';
3
- import ListItemText from '@mui/material/ListItemText';
4
2
  import { useGridSelector, gridColumnLookupSelector } from '@mui/x-data-grid-pro';
5
3
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
6
4
  import { gridRowGroupingSanitizedModelSelector } from "../hooks/features/rowGrouping/gridRowGroupingSelector.js";
7
5
  import { getRowGroupingCriteriaFromGroupingField, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, isGroupingColumn } from "../hooks/features/rowGrouping/gridRowGroupingUtils.js";
8
6
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
10
8
  export function GridColumnMenuRowGroupItem(props) {
11
9
  const {
12
10
  colDef,
@@ -23,16 +21,13 @@ export function GridColumnMenuRowGroupItem(props) {
23
21
  };
24
22
  const groupedColumn = columnsLookup[field];
25
23
  const name = groupedColumn.headerName ?? field;
26
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
24
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
27
25
  onClick: ungroupColumn,
28
26
  disabled: !groupedColumn.groupable,
29
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
30
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
31
- fontSize: "small"
32
- })
33
- }), /*#__PURE__*/_jsx(ListItemText, {
34
- children: apiRef.current.getLocaleText('unGroupColumn')(name)
35
- })]
27
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
28
+ fontSize: "small"
29
+ }),
30
+ children: apiRef.current.getLocaleText('unGroupColumn')(name)
36
31
  }, field);
37
32
  };
38
33
  if (!colDef || !isGroupingColumn(colDef.field)) {
@@ -1,11 +1,9 @@
1
1
  import * as React from 'react';
2
- import ListItemIcon from '@mui/material/ListItemIcon';
3
- import ListItemText from '@mui/material/ListItemText';
4
2
  import { gridColumnLookupSelector, useGridSelector } from '@mui/x-data-grid-pro';
5
3
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
6
4
  import { gridRowGroupingSanitizedModelSelector } from "../hooks/features/rowGrouping/gridRowGroupingSelector.js";
7
5
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
8
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
9
7
  export function GridColumnMenuRowUngroupItem(props) {
10
8
  const {
11
9
  colDef,
@@ -28,25 +26,19 @@ export function GridColumnMenuRowUngroupItem(props) {
28
26
  };
29
27
  const name = columnsLookup[colDef.field].headerName ?? colDef.field;
30
28
  if (rowGroupingModel.includes(colDef.field)) {
31
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
29
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
32
30
  onClick: ungroupColumn,
33
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
34
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
35
- fontSize: "small"
36
- })
37
- }), /*#__PURE__*/_jsx(ListItemText, {
38
- children: apiRef.current.getLocaleText('unGroupColumn')(name)
39
- })]
31
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
32
+ fontSize: "small"
33
+ }),
34
+ children: apiRef.current.getLocaleText('unGroupColumn')(name)
40
35
  });
41
36
  }
42
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
37
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
43
38
  onClick: groupColumn,
44
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
45
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
46
- fontSize: "small"
47
- })
48
- }), /*#__PURE__*/_jsx(ListItemText, {
49
- children: apiRef.current.getLocaleText('groupColumn')(name)
50
- })]
39
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
40
+ fontSize: "small"
41
+ }),
42
+ children: apiRef.current.getLocaleText('groupColumn')(name)
51
43
  });
52
44
  }
@@ -2,7 +2,6 @@ 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
4
  import Box from '@mui/material/Box';
5
- import CircularProgress from '@mui/material/CircularProgress';
6
5
  import { useGridPrivateApiContext } from '@mui/x-data-grid-pro/internals';
7
6
  import { useGridSelector, getDataGridUtilityClass } from '@mui/x-data-grid-pro';
8
7
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
@@ -47,7 +46,7 @@ function GridGroupingCriteriaCellIcon(props) {
47
46
  if (isDataLoading) {
48
47
  return /*#__PURE__*/_jsx("div", {
49
48
  className: classes.loadingContainer,
50
- children: /*#__PURE__*/_jsx(CircularProgress, {
49
+ children: /*#__PURE__*/_jsx(rootProps.slots.baseCircularProgress, {
51
50
  size: "1rem",
52
51
  color: "inherit"
53
52
  })
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { GridGenericColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from '@mui/x-data-grid-pro';
4
+ import { forwardRef } from '@mui/x-internals/forwardRef';
4
5
  import { GridColumnMenuAggregationItem } from "./GridColumnMenuAggregationItem.js";
5
6
  import { isGroupingColumn } from "../hooks/features/rowGrouping/index.js";
6
7
  import { GridColumnMenuRowGroupItem } from "./GridColumnMenuRowGroupItem.js";
@@ -27,11 +28,10 @@ export const GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM = _extends({}, GRID_COLUMN_MENU
27
28
  displayOrder: 27
28
29
  }
29
30
  });
30
- export const GridPremiumColumnMenu = /*#__PURE__*/React.forwardRef(function GridPremiumColumnMenuSimple(props, ref) {
31
- return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({
32
- ref: ref
33
- }, props, {
31
+ export const GridPremiumColumnMenu = forwardRef(function GridPremiumColumnMenuSimple(props, ref) {
32
+ return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({}, props, {
34
33
  defaultSlots: GRID_COLUMN_MENU_SLOTS_PREMIUM,
35
- defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM
34
+ defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM,
35
+ ref: ref
36
36
  }));
37
37
  });
@@ -48,10 +48,13 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
48
48
  const groupingColDefs = getGroupingColDefs(columnsState);
49
49
  let newColumnFields = [];
50
50
  const newColumnsLookup = {};
51
+ const prevGroupingfields = [];
51
52
 
52
53
  // We only keep the non-grouping columns
53
54
  columnsState.orderedFields.forEach(field => {
54
- if (!isGroupingColumn(field)) {
55
+ if (isGroupingColumn(field)) {
56
+ prevGroupingfields.push(field);
57
+ } else {
55
58
  newColumnFields.push(field);
56
59
  newColumnsLookup[field] = columnsState.lookup[field];
57
60
  }
@@ -66,9 +69,11 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
66
69
  }
67
70
  newColumnsLookup[groupingColDef.field] = groupingColDef;
68
71
  });
69
- const startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
70
- newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
71
- columnsState.orderedFields = newColumnFields;
72
+ if (prevGroupingfields.length !== groupingColDefs.length) {
73
+ const startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
74
+ newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
75
+ columnsState.orderedFields = newColumnFields;
76
+ }
72
77
  columnsState.lookup = newColumnsLookup;
73
78
  return columnsState;
74
79
  }, [getGroupingColDefs]);
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczNDA0MDgwMDAwMA==";
3
+ const releaseInfo = "MTczNTE2NDAwMDAwMA==";
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
@@ -55,10 +55,13 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
55
55
  const groupingColDefs = getGroupingColDefs(columnsState);
56
56
  let newColumnFields = [];
57
57
  const newColumnsLookup = {};
58
+ const prevGroupingfields = [];
58
59
 
59
60
  // We only keep the non-grouping columns
60
61
  columnsState.orderedFields.forEach(field => {
61
- if (!(0, _gridRowGroupingUtils.isGroupingColumn)(field)) {
62
+ if ((0, _gridRowGroupingUtils.isGroupingColumn)(field)) {
63
+ prevGroupingfields.push(field);
64
+ } else {
62
65
  newColumnFields.push(field);
63
66
  newColumnsLookup[field] = columnsState.lookup[field];
64
67
  }
@@ -73,9 +76,11 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
73
76
  }
74
77
  newColumnsLookup[groupingColDef.field] = groupingColDef;
75
78
  });
76
- const startIndex = newColumnFields[0] === _xDataGridPro.GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
77
- newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
78
- columnsState.orderedFields = newColumnFields;
79
+ if (prevGroupingfields.length !== groupingColDefs.length) {
80
+ const startIndex = newColumnFields[0] === _xDataGridPro.GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
81
+ newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
82
+ columnsState.orderedFields = newColumnFields;
83
+ }
79
84
  columnsState.lookup = newColumnsLookup;
80
85
  return columnsState;
81
86
  }, [getGroupingColDefs]);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-premium v8.0.0-alpha.4
2
+ * @mui/x-data-grid-premium v8.0.0-alpha.6
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { useLicenseVerifier, Watermark } from '@mui/x-license';
7
7
  import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider } from '@mui/x-data-grid-pro';
8
8
  import { propValidatorsDataGrid, propValidatorsDataGridPro, validateProps } from '@mui/x-data-grid-pro/internals';
9
+ import { forwardRef } from '@mui/x-internals/forwardRef';
9
10
  import { useDataGridPremiumComponent } from "./useDataGridPremiumComponent.js";
10
11
  import { useDataGridPremiumProps } from "./useDataGridPremiumProps.js";
11
12
  import { getReleaseInfo } from "../utils/releaseInfo.js";
@@ -23,7 +24,7 @@ let dataGridPremiumPropValidators;
23
24
  if (process.env.NODE_ENV !== 'production') {
24
25
  dataGridPremiumPropValidators = [...propValidatorsDataGrid, ...propValidatorsDataGridPro];
25
26
  }
26
- const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremium(inProps, ref) {
27
+ const DataGridPremiumRaw = forwardRef(function DataGridPremium(inProps, ref) {
27
28
  const props = useDataGridPremiumProps(inProps);
28
29
  const privateApiRef = useDataGridPremiumComponent(props.apiRef, props);
29
30
  useLicenseVerifier('x-data-grid-premium', releaseInfo);
@@ -37,9 +38,9 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
37
38
  children: /*#__PURE__*/_jsxs(GridRoot, _extends({
38
39
  className: props.className,
39
40
  style: props.style,
40
- sx: props.sx,
41
- ref: ref
42
- }, props.forwardedProps, {
41
+ sx: props.sx
42
+ }, props.slotProps?.root, {
43
+ ref: ref,
43
44
  children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
44
45
  children: /*#__PURE__*/_jsx(Watermark, {
45
46
  packageName: "x-data-grid-premium",
@@ -109,6 +110,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
109
110
  */
110
111
  autosizeOptions: PropTypes.shape({
111
112
  columns: PropTypes.arrayOf(PropTypes.string),
113
+ disableColumnVirtualization: PropTypes.bool,
112
114
  expand: PropTypes.bool,
113
115
  includeHeaders: PropTypes.bool,
114
116
  includeOutliers: PropTypes.bool,
@@ -186,7 +188,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
186
188
  /**
187
189
  * The row ids to show the detail panel.
188
190
  */
189
- detailPanelExpandedRowIds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired),
191
+ detailPanelExpandedRowIds: PropTypes /* @typescript-to-proptypes-ignore */.instanceOf(Set),
190
192
  /**
191
193
  * If `true`, aggregation is disabled.
192
194
  * @default false
@@ -332,11 +334,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
332
334
  quickFilterLogicOperator: PropTypes.oneOf(['and', 'or']),
333
335
  quickFilterValues: PropTypes.array
334
336
  }),
335
- /**
336
- * Forwarded props for the Data Grid root element.
337
- * @ignore - do not document.
338
- */
339
- forwardedProps: PropTypes.object,
340
337
  /**
341
338
  * Determines the position of an aggregated value.
342
339
  * @param {GridGroupNode} groupNode The current group.
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
4
  import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT, GridSignature } from '@mui/x-data-grid-pro';
5
- import { computeSlots, useProps } from '@mui/x-data-grid-pro/internals';
5
+ import { computeSlots } from '@mui/x-data-grid-pro/internals';
6
6
  import { GRID_AGGREGATION_FUNCTIONS } from "../hooks/features/aggregation/index.js";
7
7
  import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from "../constants/dataGridPremiumDefaultSlotsComponents.js";
8
8
  const getDataGridPremiumForcedProps = themedProps => _extends({
@@ -34,12 +34,12 @@ export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO
34
34
  });
35
35
  const defaultSlots = DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS;
36
36
  export const useDataGridPremiumProps = inProps => {
37
- const themedProps = useProps(
37
+ const themedProps =
38
38
  // eslint-disable-next-line material-ui/mui-name-matches-component-name
39
39
  useThemeProps({
40
40
  props: inProps,
41
41
  name: 'MuiDataGrid'
42
- }));
42
+ });
43
43
  const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
44
44
  const slots = React.useMemo(() => computeSlots({
45
45
  defaultSlots,
@@ -4,8 +4,6 @@ import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useGridSelector } from '@mui/x-data-grid-pro';
7
- import ListItemIcon from '@mui/material/ListItemIcon';
8
- import ListItemText from '@mui/material/ListItemText';
9
7
  import FormControl from '@mui/material/FormControl';
10
8
  import InputLabel from '@mui/material/InputLabel';
11
9
  import { unstable_useId as useId } from '@mui/utils';
@@ -52,47 +50,44 @@ function GridColumnMenuAggregationItem(props) {
52
50
  apiRef.current.hideColumnMenu();
53
51
  };
54
52
  const label = apiRef.current.getLocaleText('aggregationMenuItemHeader');
55
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
56
- disableRipple: true,
57
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
58
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
59
- fontSize: "small"
60
- })
61
- }), /*#__PURE__*/_jsx(ListItemText, {
62
- children: /*#__PURE__*/_jsxs(FormControl, {
63
- size: "small",
53
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
54
+ inert: true,
55
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
56
+ fontSize: "small"
57
+ }),
58
+ children: /*#__PURE__*/_jsxs(FormControl, {
59
+ size: "small",
60
+ fullWidth: true,
61
+ sx: {
62
+ minWidth: 150
63
+ },
64
+ children: [/*#__PURE__*/_jsx(InputLabel, {
65
+ id: `${id}-label`,
66
+ children: label
67
+ }), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, {
68
+ labelId: `${id}-label`,
69
+ id: `${id}-input`,
70
+ value: selectedAggregationRule,
71
+ label: label,
72
+ color: "primary",
73
+ onChange: handleAggregationItemChange,
74
+ onBlur: event => event.stopPropagation(),
64
75
  fullWidth: true,
65
- sx: {
66
- minWidth: 150
67
- },
68
- children: [/*#__PURE__*/_jsx(InputLabel, {
69
- id: `${id}-label`,
70
- children: label
71
- }), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, {
72
- labelId: `${id}-label`,
73
- id: `${id}-input`,
74
- value: selectedAggregationRule,
75
- label: label,
76
- color: "primary",
77
- onChange: handleAggregationItemChange,
78
- onBlur: event => event.stopPropagation(),
79
- fullWidth: true,
80
- children: [/*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
81
- value: "",
82
- children: "..."
83
- }), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
84
- value: aggFunc,
85
- children: getAggregationFunctionLabel({
86
- apiRef,
87
- aggregationRule: {
88
- aggregationFunctionName: aggFunc,
89
- aggregationFunction: rootProps.aggregationFunctions[aggFunc]
90
- }
91
- })
92
- }, aggFunc))]
93
- })]
94
- })
95
- })]
76
+ children: [/*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
77
+ value: "",
78
+ children: "..."
79
+ }), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
80
+ value: aggFunc,
81
+ children: getAggregationFunctionLabel({
82
+ apiRef,
83
+ aggregationRule: {
84
+ aggregationFunctionName: aggFunc,
85
+ aggregationFunction: rootProps.aggregationFunctions[aggFunc]
86
+ }
87
+ })
88
+ }, aggFunc))]
89
+ })]
90
+ })
96
91
  });
97
92
  }
98
93
  process.env.NODE_ENV !== "production" ? GridColumnMenuAggregationItem.propTypes = {
@@ -1,12 +1,10 @@
1
1
  import * as React from 'react';
2
- import ListItemIcon from '@mui/material/ListItemIcon';
3
- import ListItemText from '@mui/material/ListItemText';
4
2
  import { useGridSelector, gridColumnLookupSelector } from '@mui/x-data-grid-pro';
5
3
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
6
4
  import { gridRowGroupingSanitizedModelSelector } from "../hooks/features/rowGrouping/gridRowGroupingSelector.js";
7
5
  import { getRowGroupingCriteriaFromGroupingField, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, isGroupingColumn } from "../hooks/features/rowGrouping/gridRowGroupingUtils.js";
8
6
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
10
8
  export function GridColumnMenuRowGroupItem(props) {
11
9
  const {
12
10
  colDef,
@@ -23,16 +21,13 @@ export function GridColumnMenuRowGroupItem(props) {
23
21
  };
24
22
  const groupedColumn = columnsLookup[field];
25
23
  const name = groupedColumn.headerName ?? field;
26
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
24
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
27
25
  onClick: ungroupColumn,
28
26
  disabled: !groupedColumn.groupable,
29
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
30
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
31
- fontSize: "small"
32
- })
33
- }), /*#__PURE__*/_jsx(ListItemText, {
34
- children: apiRef.current.getLocaleText('unGroupColumn')(name)
35
- })]
27
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
28
+ fontSize: "small"
29
+ }),
30
+ children: apiRef.current.getLocaleText('unGroupColumn')(name)
36
31
  }, field);
37
32
  };
38
33
  if (!colDef || !isGroupingColumn(colDef.field)) {
@@ -1,11 +1,9 @@
1
1
  import * as React from 'react';
2
- import ListItemIcon from '@mui/material/ListItemIcon';
3
- import ListItemText from '@mui/material/ListItemText';
4
2
  import { gridColumnLookupSelector, useGridSelector } from '@mui/x-data-grid-pro';
5
3
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
6
4
  import { gridRowGroupingSanitizedModelSelector } from "../hooks/features/rowGrouping/gridRowGroupingSelector.js";
7
5
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
8
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
9
7
  export function GridColumnMenuRowUngroupItem(props) {
10
8
  const {
11
9
  colDef,
@@ -28,25 +26,19 @@ export function GridColumnMenuRowUngroupItem(props) {
28
26
  };
29
27
  const name = columnsLookup[colDef.field].headerName ?? colDef.field;
30
28
  if (rowGroupingModel.includes(colDef.field)) {
31
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
29
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
32
30
  onClick: ungroupColumn,
33
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
34
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
35
- fontSize: "small"
36
- })
37
- }), /*#__PURE__*/_jsx(ListItemText, {
38
- children: apiRef.current.getLocaleText('unGroupColumn')(name)
39
- })]
31
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
32
+ fontSize: "small"
33
+ }),
34
+ children: apiRef.current.getLocaleText('unGroupColumn')(name)
40
35
  });
41
36
  }
42
- return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
37
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
43
38
  onClick: groupColumn,
44
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
45
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
46
- fontSize: "small"
47
- })
48
- }), /*#__PURE__*/_jsx(ListItemText, {
49
- children: apiRef.current.getLocaleText('groupColumn')(name)
50
- })]
39
+ iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
40
+ fontSize: "small"
41
+ }),
42
+ children: apiRef.current.getLocaleText('groupColumn')(name)
51
43
  });
52
44
  }
@@ -2,7 +2,6 @@ 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
4
  import Box from '@mui/material/Box';
5
- import CircularProgress from '@mui/material/CircularProgress';
6
5
  import { useGridPrivateApiContext } from '@mui/x-data-grid-pro/internals';
7
6
  import { useGridSelector, getDataGridUtilityClass } from '@mui/x-data-grid-pro';
8
7
  import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
@@ -47,7 +46,7 @@ function GridGroupingCriteriaCellIcon(props) {
47
46
  if (isDataLoading) {
48
47
  return /*#__PURE__*/_jsx("div", {
49
48
  className: classes.loadingContainer,
50
- children: /*#__PURE__*/_jsx(CircularProgress, {
49
+ children: /*#__PURE__*/_jsx(rootProps.slots.baseCircularProgress, {
51
50
  size: "1rem",
52
51
  color: "inherit"
53
52
  })
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { GridGenericColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from '@mui/x-data-grid-pro';
4
+ import { forwardRef } from '@mui/x-internals/forwardRef';
4
5
  import { GridColumnMenuAggregationItem } from "./GridColumnMenuAggregationItem.js";
5
6
  import { isGroupingColumn } from "../hooks/features/rowGrouping/index.js";
6
7
  import { GridColumnMenuRowGroupItem } from "./GridColumnMenuRowGroupItem.js";
@@ -27,11 +28,10 @@ export const GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM = _extends({}, GRID_COLUMN_MENU
27
28
  displayOrder: 27
28
29
  }
29
30
  });
30
- export const GridPremiumColumnMenu = /*#__PURE__*/React.forwardRef(function GridPremiumColumnMenuSimple(props, ref) {
31
- return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({
32
- ref: ref
33
- }, props, {
31
+ export const GridPremiumColumnMenu = forwardRef(function GridPremiumColumnMenuSimple(props, ref) {
32
+ return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({}, props, {
34
33
  defaultSlots: GRID_COLUMN_MENU_SLOTS_PREMIUM,
35
- defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM
34
+ defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM,
35
+ ref: ref
36
36
  }));
37
37
  });
@@ -48,10 +48,13 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
48
48
  const groupingColDefs = getGroupingColDefs(columnsState);
49
49
  let newColumnFields = [];
50
50
  const newColumnsLookup = {};
51
+ const prevGroupingfields = [];
51
52
 
52
53
  // We only keep the non-grouping columns
53
54
  columnsState.orderedFields.forEach(field => {
54
- if (!isGroupingColumn(field)) {
55
+ if (isGroupingColumn(field)) {
56
+ prevGroupingfields.push(field);
57
+ } else {
55
58
  newColumnFields.push(field);
56
59
  newColumnsLookup[field] = columnsState.lookup[field];
57
60
  }
@@ -66,9 +69,11 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
66
69
  }
67
70
  newColumnsLookup[groupingColDef.field] = groupingColDef;
68
71
  });
69
- const startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
70
- newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
71
- columnsState.orderedFields = newColumnFields;
72
+ if (prevGroupingfields.length !== groupingColDefs.length) {
73
+ const startIndex = newColumnFields[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
74
+ newColumnFields = [...newColumnFields.slice(0, startIndex), ...groupingColDefs.map(colDef => colDef.field), ...newColumnFields.slice(startIndex)];
75
+ columnsState.orderedFields = newColumnFields;
76
+ }
72
77
  columnsState.lookup = newColumnsLookup;
73
78
  return columnsState;
74
79
  }, [getGroupingColDefs]);