@mui/x-data-grid-premium 8.0.0-alpha.3 → 8.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +377 -0
- package/DataGridPremium/DataGridPremium.js +8 -12
- package/DataGridPremium/useDataGridPremiumProps.js +2 -2
- package/README.md +1 -1
- package/components/GridColumnMenuAggregationItem.js +37 -42
- package/components/GridColumnMenuRowGroupItem.js +5 -11
- package/components/GridColumnMenuRowUngroupItem.js +10 -19
- package/esm/DataGridPremium/DataGridPremium.js +8 -12
- 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/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/aggregation/gridAggregationSelectors.d.ts +2 -2
- package/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/hooks/features/rowGrouping/gridRowGroupingSelector.d.ts +2 -2
- package/index.js +1 -1
- package/modern/DataGridPremium/DataGridPremium.js +8 -12
- 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/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +5 -5
- package/utils/releaseInfo.js +1 -1
|
@@ -39,7 +39,7 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
|
|
|
39
39
|
style: props.style,
|
|
40
40
|
sx: props.sx,
|
|
41
41
|
ref: ref
|
|
42
|
-
}, props.
|
|
42
|
+
}, props.slotProps?.root, {
|
|
43
43
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
44
44
|
children: /*#__PURE__*/_jsx(Watermark, {
|
|
45
45
|
packageName: "x-data-grid-premium",
|
|
@@ -109,6 +109,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
109
109
|
*/
|
|
110
110
|
autosizeOptions: PropTypes.shape({
|
|
111
111
|
columns: PropTypes.arrayOf(PropTypes.string),
|
|
112
|
+
disableColumnVirtualization: PropTypes.bool,
|
|
112
113
|
expand: PropTypes.bool,
|
|
113
114
|
includeHeaders: PropTypes.bool,
|
|
114
115
|
includeOutliers: PropTypes.bool,
|
|
@@ -186,7 +187,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
186
187
|
/**
|
|
187
188
|
* The row ids to show the detail panel.
|
|
188
189
|
*/
|
|
189
|
-
detailPanelExpandedRowIds: PropTypes
|
|
190
|
+
detailPanelExpandedRowIds: PropTypes /* @typescript-to-proptypes-ignore */.instanceOf(Set),
|
|
190
191
|
/**
|
|
191
192
|
* If `true`, aggregation is disabled.
|
|
192
193
|
* @default false
|
|
@@ -332,11 +333,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
332
333
|
quickFilterLogicOperator: PropTypes.oneOf(['and', 'or']),
|
|
333
334
|
quickFilterValues: PropTypes.array
|
|
334
335
|
}),
|
|
335
|
-
/**
|
|
336
|
-
* Forwarded props for the Data Grid root element.
|
|
337
|
-
* @ignore - do not document.
|
|
338
|
-
*/
|
|
339
|
-
forwardedProps: PropTypes.object,
|
|
340
336
|
/**
|
|
341
337
|
* Determines the position of an aggregated value.
|
|
342
338
|
* @param {GridGroupNode} groupNode The current group.
|
|
@@ -965,6 +961,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
965
961
|
* @default "margin"
|
|
966
962
|
*/
|
|
967
963
|
rowSpacingType: PropTypes.oneOf(['border', 'margin']),
|
|
964
|
+
/**
|
|
965
|
+
* If `true`, the Data Grid will auto span the cells over the rows having the same value.
|
|
966
|
+
* @default false
|
|
967
|
+
*/
|
|
968
|
+
rowSpanning: PropTypes.bool,
|
|
968
969
|
/**
|
|
969
970
|
* Override the height/width of the Data Grid inner scrollbar.
|
|
970
971
|
*/
|
|
@@ -1073,11 +1074,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
1073
1074
|
*/
|
|
1074
1075
|
unstable_listView: PropTypes.bool,
|
|
1075
1076
|
unstable_onDataSourceError: PropTypes.func,
|
|
1076
|
-
/**
|
|
1077
|
-
* If `true`, the Data Grid will auto span the cells over the rows having the same value.
|
|
1078
|
-
* @default false
|
|
1079
|
-
*/
|
|
1080
|
-
unstable_rowSpanning: PropTypes.bool,
|
|
1081
1077
|
/**
|
|
1082
1078
|
* If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
|
|
1083
1079
|
* By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
|
|
@@ -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
|
}
|
|
@@ -32,7 +32,9 @@ const GROUPING_COL_DEF_FORCED_PROPERTIES_DATA_SOURCE = _extends({}, GROUPING_COL
|
|
|
32
32
|
* TODO: Make this index comparator depth invariant, the logic should not be inverted when sorting in the "desc" direction (but the current return format of `sortComparator` does not support this behavior).
|
|
33
33
|
*/
|
|
34
34
|
const groupingFieldIndexComparator = (v1, v2, cellParams1, cellParams2) => {
|
|
35
|
-
const model = gridRowGroupingSanitizedModelSelector(
|
|
35
|
+
const model = gridRowGroupingSanitizedModelSelector({
|
|
36
|
+
current: cellParams1.api
|
|
37
|
+
});
|
|
36
38
|
const groupingField1 = cellParams1.rowNode.groupingField ?? null;
|
|
37
39
|
const groupingField2 = cellParams2.rowNode.groupingField ?? null;
|
|
38
40
|
if (groupingField1 === groupingField2) {
|
|
@@ -63,10 +65,12 @@ const getLeafProperties = leafColDef => ({
|
|
|
63
65
|
return groupingFieldIndexComparator(v1, v2, cellParams1, cellParams2);
|
|
64
66
|
}
|
|
65
67
|
});
|
|
68
|
+
const groupedByColValueFormatter = groupedByColDef => (value, row, _, apiRef) => groupedByColDef.valueFormatter(value, row, groupedByColDef, apiRef);
|
|
66
69
|
const getGroupingCriteriaProperties = (groupedByColDef, applyHeaderName) => {
|
|
67
70
|
const properties = {
|
|
68
71
|
sortable: groupedByColDef.sortable,
|
|
69
72
|
filterable: groupedByColDef.filterable,
|
|
73
|
+
valueFormatter: groupedByColDef.valueFormatter ? groupedByColValueFormatter(groupedByColDef) : undefined,
|
|
70
74
|
valueOptions: isSingleSelectColDef(groupedByColDef) ? groupedByColDef.valueOptions : undefined,
|
|
71
75
|
sortComparator: (v1, v2, cellParams1, cellParams2) => {
|
|
72
76
|
// We only want to sort the groups of the current grouping criteria
|
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 = "MTczNDU2NjQwMDAwMA==";
|
|
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
|
|
@@ -5,9 +5,9 @@ export declare const gridAggregationStateSelector: (state: GridStatePremium) =>
|
|
|
5
5
|
* If a column is not in the model, it is not aggregated.
|
|
6
6
|
* @category Aggregation
|
|
7
7
|
*/
|
|
8
|
-
export declare const gridAggregationModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationModel>;
|
|
8
|
+
export declare const gridAggregationModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationState, import("./gridAggregationInterfaces").GridAggregationModel>;
|
|
9
9
|
/**
|
|
10
10
|
* Get the aggregation results as a lookup.
|
|
11
11
|
* @category Aggregation
|
|
12
12
|
*/
|
|
13
|
-
export declare const gridAggregationLookupSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationLookup>;
|
|
13
|
+
export declare const gridAggregationLookupSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationState, import("./gridAggregationInterfaces").GridAggregationLookup>;
|
|
@@ -40,7 +40,9 @@ const GROUPING_COL_DEF_FORCED_PROPERTIES_DATA_SOURCE = (0, _extends2.default)({}
|
|
|
40
40
|
* TODO: Make this index comparator depth invariant, the logic should not be inverted when sorting in the "desc" direction (but the current return format of `sortComparator` does not support this behavior).
|
|
41
41
|
*/
|
|
42
42
|
const groupingFieldIndexComparator = (v1, v2, cellParams1, cellParams2) => {
|
|
43
|
-
const model = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)(
|
|
43
|
+
const model = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)({
|
|
44
|
+
current: cellParams1.api
|
|
45
|
+
});
|
|
44
46
|
const groupingField1 = cellParams1.rowNode.groupingField ?? null;
|
|
45
47
|
const groupingField2 = cellParams2.rowNode.groupingField ?? null;
|
|
46
48
|
if (groupingField1 === groupingField2) {
|
|
@@ -71,10 +73,12 @@ const getLeafProperties = leafColDef => ({
|
|
|
71
73
|
return groupingFieldIndexComparator(v1, v2, cellParams1, cellParams2);
|
|
72
74
|
}
|
|
73
75
|
});
|
|
76
|
+
const groupedByColValueFormatter = groupedByColDef => (value, row, _, apiRef) => groupedByColDef.valueFormatter(value, row, groupedByColDef, apiRef);
|
|
74
77
|
const getGroupingCriteriaProperties = (groupedByColDef, applyHeaderName) => {
|
|
75
78
|
const properties = {
|
|
76
79
|
sortable: groupedByColDef.sortable,
|
|
77
80
|
filterable: groupedByColDef.filterable,
|
|
81
|
+
valueFormatter: groupedByColDef.valueFormatter ? groupedByColValueFormatter(groupedByColDef) : undefined,
|
|
78
82
|
valueOptions: (0, _internals.isSingleSelectColDef)(groupedByColDef) ? groupedByColDef.valueOptions : undefined,
|
|
79
83
|
sortComparator: (v1, v2, cellParams1, cellParams2) => {
|
|
80
84
|
// We only want to sort the groups of the current grouping criteria
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GridStatePremium } from '../../../models/gridStatePremium';
|
|
2
|
-
export declare const gridRowGroupingModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridRowGroupingInterfaces").GridRowGroupingModel>;
|
|
3
|
-
export declare const gridRowGroupingSanitizedModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, string[]>;
|
|
2
|
+
export declare const gridRowGroupingModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridRowGroupingInterfaces").GridRowGroupingState, import("./gridRowGroupingInterfaces").GridRowGroupingModel>;
|
|
3
|
+
export declare const gridRowGroupingSanitizedModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("@mui/x-data-grid").GridColumnLookup, string[]>;
|
package/index.js
CHANGED
|
@@ -39,7 +39,7 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
|
|
|
39
39
|
style: props.style,
|
|
40
40
|
sx: props.sx,
|
|
41
41
|
ref: ref
|
|
42
|
-
}, props.
|
|
42
|
+
}, props.slotProps?.root, {
|
|
43
43
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
44
44
|
children: /*#__PURE__*/_jsx(Watermark, {
|
|
45
45
|
packageName: "x-data-grid-premium",
|
|
@@ -109,6 +109,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
109
109
|
*/
|
|
110
110
|
autosizeOptions: PropTypes.shape({
|
|
111
111
|
columns: PropTypes.arrayOf(PropTypes.string),
|
|
112
|
+
disableColumnVirtualization: PropTypes.bool,
|
|
112
113
|
expand: PropTypes.bool,
|
|
113
114
|
includeHeaders: PropTypes.bool,
|
|
114
115
|
includeOutliers: PropTypes.bool,
|
|
@@ -186,7 +187,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
186
187
|
/**
|
|
187
188
|
* The row ids to show the detail panel.
|
|
188
189
|
*/
|
|
189
|
-
detailPanelExpandedRowIds: PropTypes
|
|
190
|
+
detailPanelExpandedRowIds: PropTypes /* @typescript-to-proptypes-ignore */.instanceOf(Set),
|
|
190
191
|
/**
|
|
191
192
|
* If `true`, aggregation is disabled.
|
|
192
193
|
* @default false
|
|
@@ -332,11 +333,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
332
333
|
quickFilterLogicOperator: PropTypes.oneOf(['and', 'or']),
|
|
333
334
|
quickFilterValues: PropTypes.array
|
|
334
335
|
}),
|
|
335
|
-
/**
|
|
336
|
-
* Forwarded props for the Data Grid root element.
|
|
337
|
-
* @ignore - do not document.
|
|
338
|
-
*/
|
|
339
|
-
forwardedProps: PropTypes.object,
|
|
340
336
|
/**
|
|
341
337
|
* Determines the position of an aggregated value.
|
|
342
338
|
* @param {GridGroupNode} groupNode The current group.
|
|
@@ -965,6 +961,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
965
961
|
* @default "margin"
|
|
966
962
|
*/
|
|
967
963
|
rowSpacingType: PropTypes.oneOf(['border', 'margin']),
|
|
964
|
+
/**
|
|
965
|
+
* If `true`, the Data Grid will auto span the cells over the rows having the same value.
|
|
966
|
+
* @default false
|
|
967
|
+
*/
|
|
968
|
+
rowSpanning: PropTypes.bool,
|
|
968
969
|
/**
|
|
969
970
|
* Override the height/width of the Data Grid inner scrollbar.
|
|
970
971
|
*/
|
|
@@ -1073,11 +1074,6 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
1073
1074
|
*/
|
|
1074
1075
|
unstable_listView: PropTypes.bool,
|
|
1075
1076
|
unstable_onDataSourceError: PropTypes.func,
|
|
1076
|
-
/**
|
|
1077
|
-
* If `true`, the Data Grid will auto span the cells over the rows having the same value.
|
|
1078
|
-
* @default false
|
|
1079
|
-
*/
|
|
1080
|
-
unstable_rowSpanning: PropTypes.bool,
|
|
1081
1077
|
/**
|
|
1082
1078
|
* If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
|
|
1083
1079
|
* By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
|
|
@@ -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
|
}
|
|
@@ -32,7 +32,9 @@ const GROUPING_COL_DEF_FORCED_PROPERTIES_DATA_SOURCE = _extends({}, GROUPING_COL
|
|
|
32
32
|
* TODO: Make this index comparator depth invariant, the logic should not be inverted when sorting in the "desc" direction (but the current return format of `sortComparator` does not support this behavior).
|
|
33
33
|
*/
|
|
34
34
|
const groupingFieldIndexComparator = (v1, v2, cellParams1, cellParams2) => {
|
|
35
|
-
const model = gridRowGroupingSanitizedModelSelector(
|
|
35
|
+
const model = gridRowGroupingSanitizedModelSelector({
|
|
36
|
+
current: cellParams1.api
|
|
37
|
+
});
|
|
36
38
|
const groupingField1 = cellParams1.rowNode.groupingField ?? null;
|
|
37
39
|
const groupingField2 = cellParams2.rowNode.groupingField ?? null;
|
|
38
40
|
if (groupingField1 === groupingField2) {
|
|
@@ -63,10 +65,12 @@ const getLeafProperties = leafColDef => ({
|
|
|
63
65
|
return groupingFieldIndexComparator(v1, v2, cellParams1, cellParams2);
|
|
64
66
|
}
|
|
65
67
|
});
|
|
68
|
+
const groupedByColValueFormatter = groupedByColDef => (value, row, _, apiRef) => groupedByColDef.valueFormatter(value, row, groupedByColDef, apiRef);
|
|
66
69
|
const getGroupingCriteriaProperties = (groupedByColDef, applyHeaderName) => {
|
|
67
70
|
const properties = {
|
|
68
71
|
sortable: groupedByColDef.sortable,
|
|
69
72
|
filterable: groupedByColDef.filterable,
|
|
73
|
+
valueFormatter: groupedByColDef.valueFormatter ? groupedByColValueFormatter(groupedByColDef) : undefined,
|
|
70
74
|
valueOptions: isSingleSelectColDef(groupedByColDef) ? groupedByColDef.valueOptions : undefined,
|
|
71
75
|
sortComparator: (v1, v2, cellParams1, cellParams2) => {
|
|
72
76
|
// We only want to sort the groups of the current grouping criteria
|