@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.
- package/CHANGELOG.md +182 -0
- package/DataGridPremium/DataGridPremium.js +7 -10
- package/DataGridPremium/useDataGridPremiumProps.js +2 -2
- package/components/GridColumnMenuAggregationItem.js +37 -42
- package/components/GridColumnMenuRowGroupItem.js +5 -11
- package/components/GridColumnMenuRowUngroupItem.js +10 -19
- package/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/components/GridPremiumColumnMenu.d.ts +1 -1
- package/components/GridPremiumColumnMenu.js +5 -5
- package/esm/DataGridPremium/DataGridPremium.js +7 -10
- package/esm/DataGridPremium/useDataGridPremiumProps.js +3 -3
- package/esm/components/GridColumnMenuAggregationItem.js +37 -42
- package/esm/components/GridColumnMenuRowGroupItem.js +6 -11
- package/esm/components/GridColumnMenuRowUngroupItem.js +11 -19
- package/esm/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/esm/components/GridPremiumColumnMenu.js +5 -5
- package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/index.js +1 -1
- package/modern/DataGridPremium/DataGridPremium.js +7 -10
- package/modern/DataGridPremium/useDataGridPremiumProps.js +3 -3
- package/modern/components/GridColumnMenuAggregationItem.js +37 -42
- package/modern/components/GridColumnMenuRowGroupItem.js +6 -11
- package/modern/components/GridColumnMenuRowUngroupItem.js +11 -19
- package/modern/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/modern/components/GridPremiumColumnMenu.js +5 -5
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +5 -5
- 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__*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
children:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
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__*/
|
|
24
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
27
25
|
onClick: ungroupColumn,
|
|
28
26
|
disabled: !groupedColumn.groupable,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
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__*/
|
|
29
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
32
30
|
onClick: ungroupColumn,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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__*/
|
|
37
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
43
38
|
onClick: groupColumn,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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(
|
|
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 =
|
|
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 (
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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]);
|
package/esm/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "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 (
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
@@ -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 =
|
|
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
|
-
|
|
42
|
-
|
|
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
|
|
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
|
|
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 =
|
|
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__*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
children:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
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__*/
|
|
24
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
27
25
|
onClick: ungroupColumn,
|
|
28
26
|
disabled: !groupedColumn.groupable,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
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__*/
|
|
29
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
32
30
|
onClick: ungroupColumn,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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__*/
|
|
37
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
43
38
|
onClick: groupColumn,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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(
|
|
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 =
|
|
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 (
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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]);
|