@mui/x-data-grid-premium 8.11.3 → 8.12.1
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 +175 -6
- package/DataGridPremium/DataGridPremium.js +29 -1
- package/DataGridPremium/useDataGridPremiumComponent.d.ts +1 -1
- package/DataGridPremium/useDataGridPremiumComponent.js +5 -2
- package/DataGridPremium/useDataGridPremiumProps.js +2 -1
- package/components/GridPremiumColumnMenu.d.ts +4 -4
- package/components/GridPremiumColumnMenu.js +6 -6
- package/components/GridPremiumToolbar.js +11 -0
- package/components/chartsIntegration/GridChartsIntegrationContext.d.ts +2 -0
- package/components/chartsIntegration/GridChartsIntegrationContext.js +11 -0
- package/components/chartsPanel/ChartsPanelTrigger.d.ts +33 -0
- package/components/chartsPanel/ChartsPanelTrigger.js +92 -0
- package/components/chartsPanel/GridChartsPanel.d.ts +21 -0
- package/components/chartsPanel/GridChartsPanel.js +243 -0
- package/components/chartsPanel/chart/GridChartsPanelChart.d.ts +12 -0
- package/components/chartsPanel/chart/GridChartsPanelChart.js +111 -0
- package/components/chartsPanel/customize/GridChartsPanelCustomize.d.ts +8 -0
- package/components/chartsPanel/customize/GridChartsPanelCustomize.js +147 -0
- package/components/chartsPanel/data/GridChartsPanelData.d.ts +4 -0
- package/components/chartsPanel/data/GridChartsPanelData.js +23 -0
- package/components/chartsPanel/data/GridChartsPanelDataBody.d.ts +12 -0
- package/components/chartsPanel/data/GridChartsPanelDataBody.js +380 -0
- package/components/chartsPanel/data/GridChartsPanelDataField.d.ts +25 -0
- package/components/chartsPanel/data/GridChartsPanelDataField.js +334 -0
- package/components/chartsPanel/data/GridChartsPanelDataFieldMenu.d.ts +11 -0
- package/components/chartsPanel/data/GridChartsPanelDataFieldMenu.js +179 -0
- package/components/chartsPanel/data/GridChartsPanelDataHeader.d.ts +7 -0
- package/components/chartsPanel/data/GridChartsPanelDataHeader.js +24 -0
- package/components/chartsPanel/data/GridChartsPanelDataSearch.d.ts +7 -0
- package/components/chartsPanel/data/GridChartsPanelDataSearch.js +80 -0
- package/components/chartsPanel/index.d.ts +2 -0
- package/components/chartsPanel/index.js +27 -0
- package/components/collapsible/Collapsible.d.ts +3 -1
- package/components/collapsible/Collapsible.js +4 -3
- package/components/{GridColumnMenuAggregationItem.js → columnMenu/menuItems/GridColumnMenuAggregationItem.js} +4 -4
- package/components/columnMenu/menuItems/GridColumnMenuChartsItem.d.ts +3 -0
- package/components/columnMenu/menuItems/GridColumnMenuChartsItem.js +36 -0
- package/components/columnMenu/menuItems/GridColumnMenuManagePanelItem.d.ts +4 -0
- package/components/columnMenu/menuItems/GridColumnMenuManagePanelItem.js +18 -0
- package/{esm/components → components/columnMenu/menuItems}/GridColumnMenuPivotItem.d.ts +1 -1
- package/components/{GridColumnMenuPivotItem.js → columnMenu/menuItems/GridColumnMenuPivotItem.js} +7 -4
- package/components/{GridColumnMenuRowGroupItem.js → columnMenu/menuItems/GridColumnMenuRowGroupItem.js} +4 -4
- package/components/{GridColumnMenuRowUngroupItem.js → columnMenu/menuItems/GridColumnMenuRowUngroupItem.js} +3 -3
- package/components/index.d.ts +3 -2
- package/components/index.js +13 -1
- package/components/pivotPanel/GridPivotPanelField.js +14 -2
- package/components/pivotPanel/GridPivotPanelHeader.js +1 -0
- package/components/pivotPanel/GridPivotPanelSearch.js +3 -0
- package/constants/columnGroups.d.ts +1 -0
- package/constants/columnGroups.js +7 -0
- package/constants/dataGridPremiumDefaultSlotsComponents.js +1 -0
- package/context/GridChartsIntegrationContextProvider.d.ts +7 -0
- package/context/GridChartsIntegrationContextProvider.js +35 -0
- package/context/GridChartsRendererProxy.d.ts +34 -0
- package/context/GridChartsRendererProxy.js +77 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +27 -0
- package/esm/DataGridPremium/DataGridPremium.js +30 -2
- package/esm/DataGridPremium/useDataGridPremiumComponent.d.ts +1 -1
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +5 -2
- package/esm/DataGridPremium/useDataGridPremiumProps.js +2 -1
- package/esm/components/GridPremiumColumnMenu.d.ts +4 -4
- package/esm/components/GridPremiumColumnMenu.js +6 -6
- package/esm/components/GridPremiumToolbar.js +11 -0
- package/esm/components/chartsIntegration/GridChartsIntegrationContext.d.ts +2 -0
- package/esm/components/chartsIntegration/GridChartsIntegrationContext.js +5 -0
- package/esm/components/chartsPanel/ChartsPanelTrigger.d.ts +33 -0
- package/esm/components/chartsPanel/ChartsPanelTrigger.js +85 -0
- package/esm/components/chartsPanel/GridChartsPanel.d.ts +21 -0
- package/esm/components/chartsPanel/GridChartsPanel.js +237 -0
- package/esm/components/chartsPanel/chart/GridChartsPanelChart.d.ts +12 -0
- package/esm/components/chartsPanel/chart/GridChartsPanelChart.js +104 -0
- package/esm/components/chartsPanel/customize/GridChartsPanelCustomize.d.ts +8 -0
- package/esm/components/chartsPanel/customize/GridChartsPanelCustomize.js +139 -0
- package/esm/components/chartsPanel/data/GridChartsPanelData.d.ts +4 -0
- package/esm/components/chartsPanel/data/GridChartsPanelData.js +18 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataBody.d.ts +12 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataBody.js +374 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataField.d.ts +25 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataField.js +327 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataFieldMenu.d.ts +11 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataFieldMenu.js +173 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataHeader.d.ts +7 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataHeader.js +18 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataSearch.d.ts +7 -0
- package/esm/components/chartsPanel/data/GridChartsPanelDataSearch.js +73 -0
- package/esm/components/chartsPanel/index.d.ts +2 -0
- package/esm/components/chartsPanel/index.js +2 -0
- package/esm/components/collapsible/Collapsible.d.ts +3 -1
- package/esm/components/collapsible/Collapsible.js +4 -3
- package/esm/components/{GridColumnMenuAggregationItem.js → columnMenu/menuItems/GridColumnMenuAggregationItem.js} +4 -4
- package/esm/components/columnMenu/menuItems/GridColumnMenuChartsItem.d.ts +3 -0
- package/esm/components/columnMenu/menuItems/GridColumnMenuChartsItem.js +29 -0
- package/esm/components/columnMenu/menuItems/GridColumnMenuManagePanelItem.d.ts +4 -0
- package/esm/components/columnMenu/menuItems/GridColumnMenuManagePanelItem.js +11 -0
- package/{components → esm/components/columnMenu/menuItems}/GridColumnMenuPivotItem.d.ts +1 -1
- package/esm/components/{GridColumnMenuPivotItem.js → columnMenu/menuItems/GridColumnMenuPivotItem.js} +7 -4
- package/esm/components/{GridColumnMenuRowGroupItem.js → columnMenu/menuItems/GridColumnMenuRowGroupItem.js} +4 -4
- package/esm/components/{GridColumnMenuRowUngroupItem.js → columnMenu/menuItems/GridColumnMenuRowUngroupItem.js} +3 -3
- package/esm/components/index.d.ts +3 -2
- package/esm/components/index.js +3 -2
- package/esm/components/pivotPanel/GridPivotPanelField.js +15 -3
- package/esm/components/pivotPanel/GridPivotPanelHeader.js +1 -0
- package/esm/components/pivotPanel/GridPivotPanelSearch.js +3 -0
- package/esm/constants/columnGroups.d.ts +1 -0
- package/esm/constants/columnGroups.js +1 -0
- package/esm/constants/dataGridPremiumDefaultSlotsComponents.js +1 -0
- package/esm/context/GridChartsIntegrationContextProvider.d.ts +7 -0
- package/esm/context/GridChartsIntegrationContextProvider.js +28 -0
- package/esm/context/GridChartsRendererProxy.d.ts +34 -0
- package/esm/context/GridChartsRendererProxy.js +71 -0
- package/esm/context/index.d.ts +2 -0
- package/esm/context/index.js +2 -0
- package/esm/hooks/features/aggregation/createAggregationLookup.js +5 -3
- package/esm/hooks/features/aggregation/gridAggregationInterfaces.d.ts +1 -0
- package/esm/hooks/features/aggregation/gridAggregationSelectors.d.ts +1 -0
- package/esm/hooks/features/aggregation/gridAggregationSelectors.js +3 -0
- package/esm/hooks/features/aggregation/useGridAggregation.js +13 -1
- package/esm/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +2 -1
- package/esm/hooks/features/aggregation/wrapColumnWithAggregation.js +1 -45
- package/esm/hooks/features/chartsIntegration/gridChartsIntegrationInterfaces.d.ts +65 -0
- package/esm/hooks/features/chartsIntegration/gridChartsIntegrationInterfaces.js +1 -0
- package/esm/hooks/features/chartsIntegration/gridChartsIntegrationSelectors.d.ts +17 -0
- package/esm/hooks/features/chartsIntegration/gridChartsIntegrationSelectors.js +24 -0
- package/esm/hooks/features/chartsIntegration/useGridChartsIntegration.d.ts +8 -0
- package/esm/hooks/features/chartsIntegration/useGridChartsIntegration.js +528 -0
- package/esm/hooks/features/chartsIntegration/utils.d.ts +5 -0
- package/esm/hooks/features/chartsIntegration/utils.js +32 -0
- package/esm/hooks/features/pivoting/useGridPivoting.js +1 -1
- package/esm/hooks/features/pivoting/utils.js +9 -7
- package/esm/hooks/features/rowGrouping/createGroupingColDef.js +3 -1
- package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +1 -0
- package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +3 -2
- package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -0
- package/esm/hooks/features/sidebar/gridSidebarInterfaces.d.ts +1 -0
- package/esm/hooks/features/sidebar/gridSidebarInterfaces.js +1 -0
- package/esm/hooks/utils/index.d.ts +2 -1
- package/esm/hooks/utils/index.js +2 -1
- package/esm/hooks/utils/useGridChartIntegration.d.ts +2 -0
- package/esm/hooks/utils/useGridChartIntegration.js +9 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/material/icons.d.ts +4 -1
- package/esm/material/icons.js +16 -2
- package/esm/material/index.d.ts +11 -0
- package/esm/material/index.js +13 -2
- package/esm/models/dataGridPremiumProps.d.ts +22 -1
- package/esm/models/gridApiPremium.d.ts +3 -2
- package/esm/models/gridChartsIntegration.d.ts +17 -0
- package/esm/models/gridChartsIntegration.js +1 -0
- package/esm/models/gridPremiumIconSlotsComponent.d.ts +55 -0
- package/esm/models/gridPremiumSlotProps.d.ts +8 -0
- package/esm/models/gridPremiumSlotProps.js +1 -0
- package/esm/models/gridPremiumSlotsComponent.d.ts +6 -0
- package/esm/models/gridStatePremium.d.ts +5 -2
- package/esm/typeOverloads/modules.d.ts +20 -0
- package/hooks/features/aggregation/createAggregationLookup.js +5 -3
- package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +1 -0
- package/hooks/features/aggregation/gridAggregationSelectors.d.ts +1 -0
- package/hooks/features/aggregation/gridAggregationSelectors.js +3 -0
- package/hooks/features/aggregation/useGridAggregation.js +12 -0
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +2 -1
- package/hooks/features/aggregation/wrapColumnWithAggregation.js +0 -44
- package/hooks/features/chartsIntegration/gridChartsIntegrationInterfaces.d.ts +65 -0
- package/hooks/features/chartsIntegration/gridChartsIntegrationInterfaces.js +5 -0
- package/hooks/features/chartsIntegration/gridChartsIntegrationSelectors.d.ts +17 -0
- package/hooks/features/chartsIntegration/gridChartsIntegrationSelectors.js +30 -0
- package/hooks/features/chartsIntegration/useGridChartsIntegration.d.ts +8 -0
- package/hooks/features/chartsIntegration/useGridChartsIntegration.js +537 -0
- package/hooks/features/chartsIntegration/utils.d.ts +5 -0
- package/hooks/features/chartsIntegration/utils.js +40 -0
- package/hooks/features/pivoting/useGridPivoting.js +1 -1
- package/hooks/features/pivoting/utils.js +9 -7
- package/hooks/features/rowGrouping/createGroupingColDef.js +3 -1
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +1 -0
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +3 -2
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -0
- package/hooks/features/sidebar/gridSidebarInterfaces.d.ts +1 -0
- package/hooks/features/sidebar/gridSidebarInterfaces.js +1 -0
- package/hooks/utils/index.d.ts +2 -1
- package/hooks/utils/index.js +11 -0
- package/hooks/utils/useGridChartIntegration.d.ts +2 -0
- package/hooks/utils/useGridChartIntegration.js +17 -0
- package/index.d.ts +1 -0
- package/index.js +13 -1
- package/material/icons.d.ts +4 -1
- package/material/icons.js +16 -2
- package/material/index.d.ts +11 -0
- package/material/index.js +12 -1
- package/models/dataGridPremiumProps.d.ts +22 -1
- package/models/gridApiPremium.d.ts +3 -2
- package/models/gridChartsIntegration.d.ts +17 -0
- package/models/gridChartsIntegration.js +5 -0
- package/models/gridPremiumIconSlotsComponent.d.ts +55 -0
- package/models/gridPremiumSlotProps.d.ts +8 -0
- package/models/gridPremiumSlotProps.js +5 -0
- package/models/gridPremiumSlotsComponent.d.ts +6 -0
- package/models/gridStatePremium.d.ts +5 -2
- package/package.json +5 -5
- package/typeOverloads/modules.d.ts +20 -0
- /package/components/{GridColumnMenuAggregationItem.d.ts → columnMenu/menuItems/GridColumnMenuAggregationItem.d.ts} +0 -0
- /package/components/{GridColumnMenuRowGroupItem.d.ts → columnMenu/menuItems/GridColumnMenuRowGroupItem.d.ts} +0 -0
- /package/components/{GridColumnMenuRowUngroupItem.d.ts → columnMenu/menuItems/GridColumnMenuRowUngroupItem.d.ts} +0 -0
- /package/esm/components/{GridColumnMenuAggregationItem.d.ts → columnMenu/menuItems/GridColumnMenuAggregationItem.d.ts} +0 -0
- /package/esm/components/{GridColumnMenuRowGroupItem.d.ts → columnMenu/menuItems/GridColumnMenuRowGroupItem.d.ts} +0 -0
- /package/esm/components/{GridColumnMenuRowUngroupItem.d.ts → columnMenu/menuItems/GridColumnMenuRowUngroupItem.d.ts} +0 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { styled } from '@mui/system';
|
|
6
|
+
import { getDataGridUtilityClass, GridMenu, useGridSelector } from '@mui/x-data-grid-pro';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import { gridPivotActiveSelector, NotRendered, vars } from '@mui/x-data-grid-pro/internals';
|
|
9
|
+
import { useGridApiContext } from "../../../hooks/utils/useGridApiContext.js";
|
|
10
|
+
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
11
|
+
import { useGridPrivateApiContext } from "../../../hooks/utils/useGridPrivateApiContext.js";
|
|
12
|
+
import { GridChartsPanelDataFieldMenu } from "./GridChartsPanelDataFieldMenu.js";
|
|
13
|
+
import { gridAggregationModelSelector } from "../../../hooks/features/aggregation/index.js";
|
|
14
|
+
import { gridRowGroupingSanitizedModelSelector } from "../../../hooks/features/rowGrouping/gridRowGroupingSelector.js";
|
|
15
|
+
import { getAggregationFunctionLabel, getAvailableAggregationFunctions } from "../../../hooks/features/aggregation/gridAggregationUtils.js";
|
|
16
|
+
import { COLUMN_GROUP_ID_SEPARATOR } from "../../../constants/columnGroups.js";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
const AGGREGATION_FUNCTION_NONE = 'none';
|
|
19
|
+
const useUtilityClasses = ownerState => {
|
|
20
|
+
const {
|
|
21
|
+
classes
|
|
22
|
+
} = ownerState;
|
|
23
|
+
const slots = {
|
|
24
|
+
root: ['chartsPanelDataField'],
|
|
25
|
+
name: ['chartsPanelDataFieldName'],
|
|
26
|
+
actionContainer: ['chartsPanelDataFieldActionContainer'],
|
|
27
|
+
dragIcon: ['chartsPanelDataFieldDragIcon'],
|
|
28
|
+
checkbox: ['chartsPanelDataFieldCheckbox']
|
|
29
|
+
};
|
|
30
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
31
|
+
};
|
|
32
|
+
const GridChartsPanelDataFieldRoot = styled('div', {
|
|
33
|
+
name: 'MuiDataGrid',
|
|
34
|
+
slot: 'ChartsPanelDataField'
|
|
35
|
+
})(({
|
|
36
|
+
disabled
|
|
37
|
+
}) => ({
|
|
38
|
+
flexShrink: 0,
|
|
39
|
+
position: 'relative',
|
|
40
|
+
padding: vars.spacing(0, 1, 0, 2),
|
|
41
|
+
height: 32,
|
|
42
|
+
display: 'flex',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
gap: vars.spacing(0.5),
|
|
45
|
+
borderWidth: 0,
|
|
46
|
+
borderTopWidth: 2,
|
|
47
|
+
borderBottomWidth: 2,
|
|
48
|
+
borderStyle: 'solid',
|
|
49
|
+
borderColor: 'transparent',
|
|
50
|
+
margin: '-1px 0',
|
|
51
|
+
// collapse vertical borders
|
|
52
|
+
cursor: disabled ? 'not-allowed' : 'grab',
|
|
53
|
+
opacity: disabled ? 0.5 : 1,
|
|
54
|
+
variants: [{
|
|
55
|
+
props: {
|
|
56
|
+
dropPosition: 'top'
|
|
57
|
+
},
|
|
58
|
+
style: {
|
|
59
|
+
borderTopColor: vars.colors.interactive.selected
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
props: {
|
|
63
|
+
dropPosition: 'bottom'
|
|
64
|
+
},
|
|
65
|
+
style: {
|
|
66
|
+
borderBottomColor: vars.colors.interactive.selected
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
props: {
|
|
70
|
+
section: null
|
|
71
|
+
},
|
|
72
|
+
style: {
|
|
73
|
+
borderTopColor: 'transparent',
|
|
74
|
+
borderBottomColor: 'transparent'
|
|
75
|
+
}
|
|
76
|
+
}],
|
|
77
|
+
'&:hover': {
|
|
78
|
+
backgroundColor: vars.colors.interactive.hover
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
const GridChartsPanelDataFieldName = styled('span', {
|
|
82
|
+
name: 'MuiDataGrid',
|
|
83
|
+
slot: 'ChartsPanelDataFieldName'
|
|
84
|
+
})({
|
|
85
|
+
flex: 1,
|
|
86
|
+
overflow: 'hidden',
|
|
87
|
+
textOverflow: 'ellipsis',
|
|
88
|
+
whiteSpace: 'nowrap'
|
|
89
|
+
});
|
|
90
|
+
const GridChartsPanelDataFieldActionContainer = styled('div', {
|
|
91
|
+
name: 'MuiDataGrid',
|
|
92
|
+
slot: 'ChartsPanelDataFieldActionContainer'
|
|
93
|
+
})({
|
|
94
|
+
display: 'flex',
|
|
95
|
+
alignItems: 'center'
|
|
96
|
+
});
|
|
97
|
+
const GridChartsPanelDataFieldDragIcon = styled('div', {
|
|
98
|
+
name: 'MuiDataGrid',
|
|
99
|
+
slot: 'ChartsPanelDataFieldDragIcon'
|
|
100
|
+
})({
|
|
101
|
+
position: 'absolute',
|
|
102
|
+
left: -1,
|
|
103
|
+
width: 16,
|
|
104
|
+
display: 'flex',
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
color: vars.colors.foreground.base,
|
|
107
|
+
opacity: 0,
|
|
108
|
+
'[draggable="true"]:hover > &': {
|
|
109
|
+
opacity: 0.3
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const GridChartsPanelDataFieldCheckbox = styled(NotRendered, {
|
|
113
|
+
name: 'MuiDataGrid',
|
|
114
|
+
slot: 'ChartsPanelDataFieldCheckbox'
|
|
115
|
+
})({
|
|
116
|
+
flex: 1,
|
|
117
|
+
position: 'relative',
|
|
118
|
+
margin: vars.spacing(0, 0, 0, -1),
|
|
119
|
+
cursor: 'grab'
|
|
120
|
+
});
|
|
121
|
+
export function AggregationSelect({
|
|
122
|
+
aggFunc,
|
|
123
|
+
field
|
|
124
|
+
}) {
|
|
125
|
+
const rootProps = useGridRootProps();
|
|
126
|
+
const [aggregationMenuOpen, setAggregationMenuOpen] = React.useState(false);
|
|
127
|
+
const aggregationMenuTriggerRef = React.useRef(null);
|
|
128
|
+
const aggregationMenuTriggerId = React.useId();
|
|
129
|
+
const aggregationMenuId = React.useId();
|
|
130
|
+
const apiRef = useGridApiContext();
|
|
131
|
+
const aggregationModel = gridAggregationModelSelector(apiRef);
|
|
132
|
+
const pivotActive = gridPivotActiveSelector(apiRef);
|
|
133
|
+
const getActualFieldName = React.useCallback(fieldName => pivotActive ? fieldName.split(COLUMN_GROUP_ID_SEPARATOR).slice(-1)[0] : fieldName, [pivotActive]);
|
|
134
|
+
const colDef = React.useCallback(fieldName => apiRef.current.getColumn(getActualFieldName(fieldName)), [apiRef, getActualFieldName]);
|
|
135
|
+
const availableAggregationFunctions = React.useMemo(() => [...(pivotActive ? [] : [AGGREGATION_FUNCTION_NONE]), ...getAvailableAggregationFunctions({
|
|
136
|
+
aggregationFunctions: rootProps.aggregationFunctions,
|
|
137
|
+
colDef: colDef(field),
|
|
138
|
+
isDataSource: !!rootProps.dataSource
|
|
139
|
+
})], [colDef, field, pivotActive, rootProps.aggregationFunctions, rootProps.dataSource]);
|
|
140
|
+
const handleClick = React.useCallback(func => {
|
|
141
|
+
if (pivotActive) {
|
|
142
|
+
const fieldName = getActualFieldName(field);
|
|
143
|
+
apiRef.current.setPivotModel(prev => _extends({}, prev, {
|
|
144
|
+
values: prev.values.map(col => {
|
|
145
|
+
if (col.field === fieldName) {
|
|
146
|
+
return _extends({}, col, {
|
|
147
|
+
aggFunc: func
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return col;
|
|
151
|
+
})
|
|
152
|
+
}));
|
|
153
|
+
} else if (func === AGGREGATION_FUNCTION_NONE) {
|
|
154
|
+
const updatedAggregationModel = _extends({}, aggregationModel);
|
|
155
|
+
delete updatedAggregationModel[field];
|
|
156
|
+
apiRef.current.setAggregationModel(updatedAggregationModel);
|
|
157
|
+
} else {
|
|
158
|
+
apiRef.current.setAggregationModel(_extends({}, aggregationModel, {
|
|
159
|
+
[field]: func
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
setAggregationMenuOpen(false);
|
|
163
|
+
}, [apiRef, field, getActualFieldName, pivotActive, aggregationModel, setAggregationMenuOpen]);
|
|
164
|
+
return availableAggregationFunctions.length > 0 ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
165
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseChip, {
|
|
166
|
+
label: getAggregationFunctionLabel({
|
|
167
|
+
apiRef,
|
|
168
|
+
aggregationRule: {
|
|
169
|
+
aggregationFunctionName: aggFunc,
|
|
170
|
+
aggregationFunction: rootProps.aggregationFunctions[aggFunc] || {}
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
size: "small",
|
|
174
|
+
variant: "outlined",
|
|
175
|
+
ref: aggregationMenuTriggerRef,
|
|
176
|
+
id: aggregationMenuTriggerId,
|
|
177
|
+
"aria-haspopup": "true",
|
|
178
|
+
"aria-controls": aggregationMenuOpen ? aggregationMenuId : undefined,
|
|
179
|
+
"aria-expanded": aggregationMenuOpen ? 'true' : undefined,
|
|
180
|
+
onClick: () => setAggregationMenuOpen(!aggregationMenuOpen)
|
|
181
|
+
}), /*#__PURE__*/_jsx(GridMenu, {
|
|
182
|
+
open: aggregationMenuOpen,
|
|
183
|
+
onClose: () => setAggregationMenuOpen(false),
|
|
184
|
+
target: aggregationMenuTriggerRef.current,
|
|
185
|
+
position: "bottom-start",
|
|
186
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseMenuList, _extends({
|
|
187
|
+
id: aggregationMenuId,
|
|
188
|
+
"aria-labelledby": aggregationMenuTriggerId,
|
|
189
|
+
autoFocusItem: true
|
|
190
|
+
}, rootProps.slotProps?.baseMenuList, {
|
|
191
|
+
children: availableAggregationFunctions.map(func => /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({
|
|
192
|
+
selected: aggFunc === func,
|
|
193
|
+
onClick: () => handleClick(func)
|
|
194
|
+
}, rootProps.slotProps?.baseMenuItem, {
|
|
195
|
+
children: getAggregationFunctionLabel({
|
|
196
|
+
apiRef,
|
|
197
|
+
aggregationRule: {
|
|
198
|
+
aggregationFunctionName: func,
|
|
199
|
+
aggregationFunction: rootProps.aggregationFunctions[func] || {}
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
}), func))
|
|
203
|
+
}))
|
|
204
|
+
})]
|
|
205
|
+
}) : null;
|
|
206
|
+
}
|
|
207
|
+
function GridChartsPanelDataField(props) {
|
|
208
|
+
const {
|
|
209
|
+
children,
|
|
210
|
+
field,
|
|
211
|
+
section,
|
|
212
|
+
blockedSections,
|
|
213
|
+
dimensionsLabel,
|
|
214
|
+
valuesLabel,
|
|
215
|
+
selected,
|
|
216
|
+
disabled,
|
|
217
|
+
onChange,
|
|
218
|
+
onDragStart,
|
|
219
|
+
onDragEnd
|
|
220
|
+
} = props;
|
|
221
|
+
const rootProps = useGridRootProps();
|
|
222
|
+
const [dropPosition, setDropPosition] = React.useState(null);
|
|
223
|
+
const ownerState = _extends({}, props, {
|
|
224
|
+
classes: rootProps.classes,
|
|
225
|
+
dropPosition,
|
|
226
|
+
section
|
|
227
|
+
});
|
|
228
|
+
const classes = useUtilityClasses(ownerState);
|
|
229
|
+
const apiRef = useGridPrivateApiContext();
|
|
230
|
+
const aggregationModel = useGridSelector(apiRef, gridAggregationModelSelector);
|
|
231
|
+
const rowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector);
|
|
232
|
+
const isRowGroupingEnabled = React.useMemo(() => rowGroupingModel.length > 0, [rowGroupingModel]);
|
|
233
|
+
const handleDragStart = React.useCallback(event => {
|
|
234
|
+
const data = {
|
|
235
|
+
field,
|
|
236
|
+
section
|
|
237
|
+
};
|
|
238
|
+
event.dataTransfer.setData('text/plain', JSON.stringify(data));
|
|
239
|
+
event.dataTransfer.dropEffect = 'move';
|
|
240
|
+
onDragStart(field, section);
|
|
241
|
+
}, [field, onDragStart, section]);
|
|
242
|
+
const getDropPosition = React.useCallback(event => {
|
|
243
|
+
const rect = event.target.getBoundingClientRect();
|
|
244
|
+
const y = event.clientY - rect.top;
|
|
245
|
+
if (y < rect.height / 2) {
|
|
246
|
+
return 'top';
|
|
247
|
+
}
|
|
248
|
+
return 'bottom';
|
|
249
|
+
}, []);
|
|
250
|
+
const handleDragOver = React.useCallback(event => {
|
|
251
|
+
if (disabled) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
255
|
+
setDropPosition(getDropPosition(event));
|
|
256
|
+
}
|
|
257
|
+
}, [disabled, getDropPosition]);
|
|
258
|
+
const handleDragLeave = React.useCallback(event => {
|
|
259
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
260
|
+
setDropPosition(null);
|
|
261
|
+
}
|
|
262
|
+
}, []);
|
|
263
|
+
const handleDrop = React.useCallback(event => {
|
|
264
|
+
setDropPosition(null);
|
|
265
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
const position = getDropPosition(event);
|
|
268
|
+
const {
|
|
269
|
+
field: droppedField,
|
|
270
|
+
section: originSection
|
|
271
|
+
} = JSON.parse(event.dataTransfer.getData('text/plain'));
|
|
272
|
+
apiRef.current.chartsIntegration.updateDataReference(droppedField, originSection, section, field, position || undefined);
|
|
273
|
+
}
|
|
274
|
+
}, [getDropPosition, apiRef, field, section]);
|
|
275
|
+
const hideable = section !== null;
|
|
276
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
277
|
+
title: disabled ? apiRef.current.getLocaleText('chartsFieldBlocked') : undefined,
|
|
278
|
+
enterDelay: 1000
|
|
279
|
+
}, rootProps.slotProps?.baseTooltip, {
|
|
280
|
+
children: /*#__PURE__*/_jsxs(GridChartsPanelDataFieldRoot, {
|
|
281
|
+
ownerState: ownerState,
|
|
282
|
+
className: classes.root,
|
|
283
|
+
onDragOver: handleDragOver,
|
|
284
|
+
onDragLeave: handleDragLeave,
|
|
285
|
+
onDrop: handleDrop,
|
|
286
|
+
onDragStart: handleDragStart,
|
|
287
|
+
onDragEnd: onDragEnd,
|
|
288
|
+
draggable: !disabled,
|
|
289
|
+
disabled: !!disabled,
|
|
290
|
+
children: [/*#__PURE__*/_jsx(GridChartsPanelDataFieldDragIcon, {
|
|
291
|
+
ownerState: ownerState,
|
|
292
|
+
className: classes.dragIcon,
|
|
293
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.columnReorderIcon, {
|
|
294
|
+
fontSize: "small"
|
|
295
|
+
})
|
|
296
|
+
}), hideable ? /*#__PURE__*/_jsx(GridChartsPanelDataFieldCheckbox, _extends({
|
|
297
|
+
ownerState: ownerState,
|
|
298
|
+
className: classes.checkbox,
|
|
299
|
+
as: rootProps.slots.baseCheckbox,
|
|
300
|
+
size: "small",
|
|
301
|
+
density: "compact"
|
|
302
|
+
}, rootProps.slotProps?.baseCheckbox, {
|
|
303
|
+
checked: selected || false,
|
|
304
|
+
onChange: () => onChange && onChange(field, section),
|
|
305
|
+
label: children
|
|
306
|
+
})) : /*#__PURE__*/_jsx(GridChartsPanelDataFieldName, {
|
|
307
|
+
ownerState: ownerState,
|
|
308
|
+
className: classes.name,
|
|
309
|
+
children: children
|
|
310
|
+
}), /*#__PURE__*/_jsxs(GridChartsPanelDataFieldActionContainer, {
|
|
311
|
+
ownerState: ownerState,
|
|
312
|
+
className: classes.actionContainer,
|
|
313
|
+
children: [isRowGroupingEnabled && section === 'values' && /*#__PURE__*/_jsx(AggregationSelect, {
|
|
314
|
+
aggFunc: aggregationModel[field] ?? AGGREGATION_FUNCTION_NONE,
|
|
315
|
+
field: field
|
|
316
|
+
}), /*#__PURE__*/_jsx(GridChartsPanelDataFieldMenu, {
|
|
317
|
+
field: field,
|
|
318
|
+
section: section,
|
|
319
|
+
blockedSections: blockedSections,
|
|
320
|
+
dimensionsLabel: dimensionsLabel,
|
|
321
|
+
valuesLabel: valuesLabel
|
|
322
|
+
})]
|
|
323
|
+
})]
|
|
324
|
+
})
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
export { GridChartsPanelDataField };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FieldTransferObject } from "./GridChartsPanelDataBody.js";
|
|
3
|
+
interface GridChartsPanelDataFieldMenuProps {
|
|
4
|
+
field: string;
|
|
5
|
+
section: FieldTransferObject['section'];
|
|
6
|
+
blockedSections?: string[];
|
|
7
|
+
dimensionsLabel: string;
|
|
8
|
+
valuesLabel: string;
|
|
9
|
+
}
|
|
10
|
+
declare function GridChartsPanelDataFieldMenu(props: GridChartsPanelDataFieldMenuProps): React.JSX.Element | null;
|
|
11
|
+
export { GridChartsPanelDataFieldMenu };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { GridMenu, useGridSelector } from '@mui/x-data-grid-pro';
|
|
6
|
+
import useId from '@mui/utils/useId';
|
|
7
|
+
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
8
|
+
import { useGridPrivateApiContext } from "../../../hooks/utils/useGridPrivateApiContext.js";
|
|
9
|
+
import { gridChartsDimensionsSelector, gridChartsIntegrationActiveChartIdSelector, gridChartsValuesSelector } from "../../../hooks/features/chartsIntegration/gridChartsIntegrationSelectors.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function GridChartsPanelDataFieldMenu(props) {
|
|
12
|
+
const {
|
|
13
|
+
field,
|
|
14
|
+
section,
|
|
15
|
+
blockedSections,
|
|
16
|
+
dimensionsLabel,
|
|
17
|
+
valuesLabel
|
|
18
|
+
} = props;
|
|
19
|
+
const rootProps = useGridRootProps();
|
|
20
|
+
const [open, setOpen] = React.useState(false);
|
|
21
|
+
const apiRef = useGridPrivateApiContext();
|
|
22
|
+
const activeChartId = useGridSelector(apiRef, gridChartsIntegrationActiveChartIdSelector);
|
|
23
|
+
const dimensions = useGridSelector(apiRef, gridChartsDimensionsSelector, activeChartId);
|
|
24
|
+
const values = useGridSelector(apiRef, gridChartsValuesSelector, activeChartId);
|
|
25
|
+
const isAvailableField = section === null;
|
|
26
|
+
const fieldIndexInModel = !isAvailableField ? (section === 'dimensions' ? dimensions : values).findIndex(item => item.field === field) : -1;
|
|
27
|
+
const modelLength = !isAvailableField ? (section === 'dimensions' ? dimensions : values).length : 0;
|
|
28
|
+
const canMoveUp = fieldIndexInModel > 0;
|
|
29
|
+
const canMoveDown = !isAvailableField && fieldIndexInModel < modelLength - 1;
|
|
30
|
+
const menuId = useId();
|
|
31
|
+
const triggerId = useId();
|
|
32
|
+
const triggerRef = React.useRef(null);
|
|
33
|
+
const menuItems = React.useMemo(() => {
|
|
34
|
+
if (isAvailableField) {
|
|
35
|
+
return [{
|
|
36
|
+
key: 'dimensions',
|
|
37
|
+
label: apiRef.current.getLocaleText('chartsMenuAddToDimensions')(dimensionsLabel)
|
|
38
|
+
}, {
|
|
39
|
+
key: 'values',
|
|
40
|
+
label: apiRef.current.getLocaleText('chartsMenuAddToValues')(valuesLabel)
|
|
41
|
+
}].filter(item => !blockedSections?.includes(item.key));
|
|
42
|
+
}
|
|
43
|
+
const moveMenuItems = [{
|
|
44
|
+
key: 'up',
|
|
45
|
+
label: apiRef.current.getLocaleText('chartsMenuMoveUp'),
|
|
46
|
+
icon: /*#__PURE__*/_jsx(rootProps.slots.chartsMenuMoveUpIcon, {}),
|
|
47
|
+
disabled: !canMoveUp
|
|
48
|
+
}, {
|
|
49
|
+
key: 'down',
|
|
50
|
+
label: apiRef.current.getLocaleText('chartsMenuMoveDown'),
|
|
51
|
+
icon: /*#__PURE__*/_jsx(rootProps.slots.chartsMenuMoveDownIcon, {}),
|
|
52
|
+
disabled: !canMoveDown
|
|
53
|
+
}, {
|
|
54
|
+
divider: true
|
|
55
|
+
}, {
|
|
56
|
+
key: 'top',
|
|
57
|
+
label: apiRef.current.getLocaleText('chartsMenuMoveToTop'),
|
|
58
|
+
icon: /*#__PURE__*/_jsx(rootProps.slots.chartsMenuMoveToTopIcon, {}),
|
|
59
|
+
disabled: !canMoveUp
|
|
60
|
+
}, {
|
|
61
|
+
key: 'bottom',
|
|
62
|
+
label: apiRef.current.getLocaleText('chartsMenuMoveToBottom'),
|
|
63
|
+
icon: /*#__PURE__*/_jsx(rootProps.slots.chartsMenuMoveToBottomIcon, {}),
|
|
64
|
+
disabled: !canMoveDown
|
|
65
|
+
}, {
|
|
66
|
+
divider: true
|
|
67
|
+
}];
|
|
68
|
+
const removeMenuItem = [{
|
|
69
|
+
key: null,
|
|
70
|
+
label: apiRef.current.getLocaleText('chartsMenuRemove'),
|
|
71
|
+
icon: /*#__PURE__*/_jsx(rootProps.slots.chartsMenuRemoveIcon, {})
|
|
72
|
+
}];
|
|
73
|
+
const addToSectionMenuItems = [{
|
|
74
|
+
key: 'dimensions',
|
|
75
|
+
label: apiRef.current.getLocaleText('chartsMenuAddToDimensions')(dimensionsLabel),
|
|
76
|
+
icon: /*#__PURE__*/_jsx("span", {})
|
|
77
|
+
}, {
|
|
78
|
+
key: 'values',
|
|
79
|
+
label: apiRef.current.getLocaleText('chartsMenuAddToValues')(valuesLabel),
|
|
80
|
+
icon: /*#__PURE__*/_jsx("span", {})
|
|
81
|
+
}].filter(item => item.key !== section && !blockedSections?.includes(item.key));
|
|
82
|
+
if (addToSectionMenuItems.length > 0) {
|
|
83
|
+
addToSectionMenuItems.push({
|
|
84
|
+
divider: true
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return [...moveMenuItems, ...addToSectionMenuItems, ...removeMenuItem];
|
|
88
|
+
}, [isAvailableField, apiRef, rootProps, canMoveUp, canMoveDown, section, blockedSections, dimensionsLabel, valuesLabel]);
|
|
89
|
+
if (menuItems.length === 0) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const handleClick = () => {
|
|
93
|
+
setOpen(!open);
|
|
94
|
+
};
|
|
95
|
+
const handleClose = () => {
|
|
96
|
+
setOpen(false);
|
|
97
|
+
};
|
|
98
|
+
const handleMove = to => {
|
|
99
|
+
handleClose();
|
|
100
|
+
|
|
101
|
+
// Do nothing if the field is already in the target section
|
|
102
|
+
if (to === section) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const items = section === 'dimensions' ? dimensions : values;
|
|
106
|
+
let targetField;
|
|
107
|
+
let targetFieldPosition = null;
|
|
108
|
+
let targetSection = section;
|
|
109
|
+
switch (to) {
|
|
110
|
+
case 'up':
|
|
111
|
+
targetField = items[fieldIndexInModel - 1].field;
|
|
112
|
+
targetFieldPosition = 'top';
|
|
113
|
+
break;
|
|
114
|
+
case 'down':
|
|
115
|
+
targetField = items[fieldIndexInModel + 1].field;
|
|
116
|
+
targetFieldPosition = 'bottom';
|
|
117
|
+
break;
|
|
118
|
+
case 'top':
|
|
119
|
+
targetField = items[0].field;
|
|
120
|
+
targetFieldPosition = 'top';
|
|
121
|
+
break;
|
|
122
|
+
case 'bottom':
|
|
123
|
+
targetField = items[modelLength - 1].field;
|
|
124
|
+
targetFieldPosition = 'bottom';
|
|
125
|
+
break;
|
|
126
|
+
case 'dimensions':
|
|
127
|
+
case 'values':
|
|
128
|
+
case null:
|
|
129
|
+
targetSection = to;
|
|
130
|
+
break;
|
|
131
|
+
default:
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
apiRef.current.chartsIntegration.updateDataReference(field, section, targetSection, targetField, targetFieldPosition || undefined);
|
|
135
|
+
};
|
|
136
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
137
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
138
|
+
size: "small"
|
|
139
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
140
|
+
id: triggerId,
|
|
141
|
+
"aria-haspopup": "true",
|
|
142
|
+
"aria-controls": open ? menuId : undefined,
|
|
143
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
144
|
+
"aria-label": apiRef.current.getLocaleText('chartsMenuOptions'),
|
|
145
|
+
onClick: handleClick,
|
|
146
|
+
ref: triggerRef,
|
|
147
|
+
children: isAvailableField ? /*#__PURE__*/_jsx(rootProps.slots.chartsMenuAddIcon, {
|
|
148
|
+
fontSize: "small"
|
|
149
|
+
}) : /*#__PURE__*/_jsx(rootProps.slots.columnMenuIcon, {
|
|
150
|
+
fontSize: "small"
|
|
151
|
+
})
|
|
152
|
+
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
153
|
+
target: triggerRef.current,
|
|
154
|
+
open: open,
|
|
155
|
+
onClose: handleClose,
|
|
156
|
+
position: "bottom-start",
|
|
157
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseMenuList, _extends({
|
|
158
|
+
id: menuId,
|
|
159
|
+
"aria-labelledby": triggerId,
|
|
160
|
+
autoFocusItem: true
|
|
161
|
+
}, rootProps.slotProps?.baseMenuList, {
|
|
162
|
+
children: menuItems.map((item, index) => 'divider' in item ? /*#__PURE__*/_jsx(rootProps.slots.baseDivider, {}, `divider-${index}`) : /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({
|
|
163
|
+
disabled: item.disabled,
|
|
164
|
+
onClick: () => handleMove(item.key),
|
|
165
|
+
iconStart: item.icon
|
|
166
|
+
}, rootProps.slotProps?.baseMenuItem, {
|
|
167
|
+
children: item.label
|
|
168
|
+
}), item.key))
|
|
169
|
+
}))
|
|
170
|
+
})]
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
export { GridChartsPanelDataFieldMenu };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface GridChartsPanelDataHeaderProps {
|
|
3
|
+
searchValue: string;
|
|
4
|
+
onSearchValueChange: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
declare function GridChartsPanelDataHeader(props: GridChartsPanelDataHeaderProps): React.JSX.Element;
|
|
7
|
+
export { GridChartsPanelDataHeader };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SidebarHeader } from "../../sidebar/index.js";
|
|
3
|
+
import { GridChartsPanelDataSearch } from "./GridChartsPanelDataSearch.js";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
function GridChartsPanelDataHeader(props) {
|
|
6
|
+
const {
|
|
7
|
+
searchValue,
|
|
8
|
+
onSearchValueChange
|
|
9
|
+
} = props;
|
|
10
|
+
return /*#__PURE__*/_jsx(SidebarHeader, {
|
|
11
|
+
children: /*#__PURE__*/_jsx(GridChartsPanelDataSearch, {
|
|
12
|
+
value: searchValue,
|
|
13
|
+
onClear: () => onSearchValueChange(''),
|
|
14
|
+
onChange: event => onSearchValueChange(event.target.value)
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { GridChartsPanelDataHeader };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridSlotProps } from '@mui/x-data-grid-pro';
|
|
3
|
+
export type GridChartsPanelDataSearchProps = Pick<GridSlotProps['baseTextField'], 'value' | 'onChange'> & {
|
|
4
|
+
onClear: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare function GridChartsPanelDataSearch(props: GridChartsPanelDataSearchProps): React.JSX.Element;
|
|
7
|
+
export { GridChartsPanelDataSearch };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { getDataGridUtilityClass } from '@mui/x-data-grid-pro';
|
|
4
|
+
import { styled } from '@mui/system';
|
|
5
|
+
import { vars } from '@mui/x-data-grid-pro/internals';
|
|
6
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import { useGridApiContext } from "../../../hooks/utils/useGridApiContext.js";
|
|
8
|
+
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const useUtilityClasses = ownerState => {
|
|
11
|
+
const {
|
|
12
|
+
classes
|
|
13
|
+
} = ownerState;
|
|
14
|
+
const slots = {
|
|
15
|
+
container: ['chartsPanelDataSearchContainer']
|
|
16
|
+
};
|
|
17
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
18
|
+
};
|
|
19
|
+
const GridChartsPanelDataSearchContainer = styled('div', {
|
|
20
|
+
name: 'MuiDataGrid',
|
|
21
|
+
slot: 'ChartsPanelDataSearchContainer'
|
|
22
|
+
})({
|
|
23
|
+
padding: vars.spacing(1)
|
|
24
|
+
});
|
|
25
|
+
function GridChartsPanelDataSearch(props) {
|
|
26
|
+
const {
|
|
27
|
+
onClear,
|
|
28
|
+
value,
|
|
29
|
+
onChange
|
|
30
|
+
} = props;
|
|
31
|
+
const rootProps = useGridRootProps();
|
|
32
|
+
const apiRef = useGridApiContext();
|
|
33
|
+
const classes = useUtilityClasses(rootProps);
|
|
34
|
+
const handleKeyDown = event => {
|
|
35
|
+
if (event.key === 'Escape') {
|
|
36
|
+
onClear();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/_jsx(GridChartsPanelDataSearchContainer, {
|
|
40
|
+
ownerState: rootProps,
|
|
41
|
+
className: classes.container,
|
|
42
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
43
|
+
size: "small",
|
|
44
|
+
"aria-label": apiRef.current.getLocaleText('chartsSearchLabel'),
|
|
45
|
+
placeholder: apiRef.current.getLocaleText('chartsSearchPlaceholder'),
|
|
46
|
+
onKeyDown: handleKeyDown,
|
|
47
|
+
fullWidth: true,
|
|
48
|
+
slotProps: {
|
|
49
|
+
input: {
|
|
50
|
+
startAdornment: /*#__PURE__*/_jsx(rootProps.slots.chartsSearchIcon, {
|
|
51
|
+
fontSize: "small"
|
|
52
|
+
}),
|
|
53
|
+
endAdornment: value ? /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, {
|
|
54
|
+
edge: "end",
|
|
55
|
+
size: "small",
|
|
56
|
+
onClick: onClear,
|
|
57
|
+
"aria-label": apiRef.current.getLocaleText('chartsSearchClear'),
|
|
58
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.chartsSearchClearIcon, {
|
|
59
|
+
fontSize: "small"
|
|
60
|
+
})
|
|
61
|
+
}) : null
|
|
62
|
+
},
|
|
63
|
+
htmlInput: {
|
|
64
|
+
role: 'searchbox'
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, rootProps.slotProps?.baseTextField, {
|
|
68
|
+
value: value,
|
|
69
|
+
onChange: onChange
|
|
70
|
+
}))
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export { GridChartsPanelDataSearch };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
type CollapsibleProps = React.HTMLAttributes<HTMLDivElement
|
|
2
|
+
type CollapsibleProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
initiallyOpen?: boolean;
|
|
4
|
+
};
|
|
3
5
|
declare function Collapsible(props: CollapsibleProps): React.JSX.Element;
|
|
4
6
|
export { Collapsible };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["className", "children"];
|
|
5
|
+
const _excluded = ["className", "children", "initiallyOpen"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { styled } from '@mui/system';
|
|
8
8
|
import { vars } from '@mui/x-data-grid-pro/internals';
|
|
@@ -36,10 +36,11 @@ const CollapsibleRoot = styled('div', {
|
|
|
36
36
|
function Collapsible(props) {
|
|
37
37
|
const {
|
|
38
38
|
className,
|
|
39
|
-
children
|
|
39
|
+
children,
|
|
40
|
+
initiallyOpen = true
|
|
40
41
|
} = props,
|
|
41
42
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
42
|
-
const [open, setOpen] = React.useState(
|
|
43
|
+
const [open, setOpen] = React.useState(initiallyOpen);
|
|
43
44
|
const panelId = useId();
|
|
44
45
|
const rootProps = useGridRootProps();
|
|
45
46
|
const ownerState = {
|
|
@@ -6,10 +6,10 @@ import * as React from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useGridSelector } from '@mui/x-data-grid-pro';
|
|
8
8
|
import useId from '@mui/utils/useId';
|
|
9
|
-
import { useGridApiContext } from "
|
|
10
|
-
import { useGridRootProps } from "
|
|
11
|
-
import { canColumnHaveAggregationFunction, getAggregationFunctionLabel, getAvailableAggregationFunctions } from "
|
|
12
|
-
import { gridAggregationModelSelector } from "
|
|
9
|
+
import { useGridApiContext } from "../../../hooks/utils/useGridApiContext.js";
|
|
10
|
+
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
11
|
+
import { canColumnHaveAggregationFunction, getAggregationFunctionLabel, getAvailableAggregationFunctions } from "../../../hooks/features/aggregation/gridAggregationUtils.js";
|
|
12
|
+
import { gridAggregationModelSelector } from "../../../hooks/features/aggregation/gridAggregationSelectors.js";
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { createElement as _createElement } from "react";
|
|
15
15
|
function GridColumnMenuAggregationItem(props) {
|