@mui/x-data-grid-premium 8.11.3 → 8.12.0
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 +151 -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 +525 -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 +534 -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,139 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { styled } from '@mui/system';
|
|
4
|
+
import { vars } from '@mui/x-data-grid-pro/internals';
|
|
5
|
+
import { GridOverlay, GridShadowScrollArea } from '@mui/x-data-grid-pro';
|
|
6
|
+
import { useGridApiContext } from "../../../hooks/utils/useGridApiContext.js";
|
|
7
|
+
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
8
|
+
import { useGridChartsIntegrationContext } from "../../../hooks/utils/useGridChartIntegration.js";
|
|
9
|
+
import { Collapsible } from "../../collapsible/Collapsible.js";
|
|
10
|
+
import { CollapsibleTrigger } from "../../collapsible/CollapsibleTrigger.js";
|
|
11
|
+
import { CollapsiblePanel } from "../../collapsible/CollapsiblePanel.js";
|
|
12
|
+
import { EMPTY_CHART_INTEGRATION_CONTEXT_STATE } from "../../../hooks/features/chartsIntegration/useGridChartsIntegration.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const GridChartsPanelCustomizeRoot = styled(GridShadowScrollArea)({
|
|
15
|
+
height: '100%'
|
|
16
|
+
});
|
|
17
|
+
const GridChartsPanelCustomizeSection = styled(Collapsible, {
|
|
18
|
+
name: 'MuiDataGrid',
|
|
19
|
+
slot: 'ChartsPanelCustomizeSection'
|
|
20
|
+
})({
|
|
21
|
+
margin: vars.spacing(0.5, 1)
|
|
22
|
+
});
|
|
23
|
+
const GridChartsPanelCustomizePanel = styled(CollapsiblePanel, {
|
|
24
|
+
name: 'MuiDataGrid',
|
|
25
|
+
slot: 'chartsPanelSection'
|
|
26
|
+
})({
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
padding: vars.spacing(2, 1.5),
|
|
30
|
+
gap: vars.spacing(3)
|
|
31
|
+
});
|
|
32
|
+
const GridChartsPanelCustomizePanelTitle = styled('div', {
|
|
33
|
+
name: 'MuiDataGrid',
|
|
34
|
+
slot: 'ChartsPanelCustomizePanelTitle'
|
|
35
|
+
})({
|
|
36
|
+
font: vars.typography.font.body,
|
|
37
|
+
fontWeight: vars.typography.fontWeight.medium
|
|
38
|
+
});
|
|
39
|
+
export function GridChartsPanelCustomize(props) {
|
|
40
|
+
const {
|
|
41
|
+
activeChartId,
|
|
42
|
+
sections
|
|
43
|
+
} = props;
|
|
44
|
+
const apiRef = useGridApiContext();
|
|
45
|
+
const rootProps = useGridRootProps();
|
|
46
|
+
const {
|
|
47
|
+
chartStateLookup,
|
|
48
|
+
setChartState
|
|
49
|
+
} = useGridChartsIntegrationContext();
|
|
50
|
+
const {
|
|
51
|
+
type: chartType,
|
|
52
|
+
configuration,
|
|
53
|
+
dimensions,
|
|
54
|
+
values
|
|
55
|
+
} = chartStateLookup[activeChartId] ?? EMPTY_CHART_INTEGRATION_CONTEXT_STATE;
|
|
56
|
+
const handleChange = (field, value) => {
|
|
57
|
+
setChartState(activeChartId, _extends({}, configuration, {
|
|
58
|
+
configuration: _extends({}, configuration, {
|
|
59
|
+
[field]: value
|
|
60
|
+
})
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
if (chartType === '') {
|
|
64
|
+
return /*#__PURE__*/_jsx(GridOverlay, {
|
|
65
|
+
children: apiRef.current.getLocaleText('chartsChartNotSelected')
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/_jsx(GridChartsPanelCustomizeRoot, {
|
|
69
|
+
children: sections.map((section, index) => /*#__PURE__*/_jsxs(GridChartsPanelCustomizeSection, {
|
|
70
|
+
initiallyOpen: index === 0,
|
|
71
|
+
ownerState: rootProps,
|
|
72
|
+
children: [/*#__PURE__*/_jsx(CollapsibleTrigger, {
|
|
73
|
+
children: /*#__PURE__*/_jsx(GridChartsPanelCustomizePanelTitle, {
|
|
74
|
+
ownerState: rootProps,
|
|
75
|
+
children: section.label
|
|
76
|
+
})
|
|
77
|
+
}), /*#__PURE__*/_jsx(GridChartsPanelCustomizePanel, {
|
|
78
|
+
ownerState: rootProps,
|
|
79
|
+
children: Object.entries(section.controls).map(([key, optRaw]) => {
|
|
80
|
+
const opt = optRaw;
|
|
81
|
+
const context = {
|
|
82
|
+
configuration,
|
|
83
|
+
dimensions,
|
|
84
|
+
values
|
|
85
|
+
};
|
|
86
|
+
const isHidden = opt.isHidden?.(context) ?? false;
|
|
87
|
+
if (isHidden) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const isDisabled = opt.isDisabled?.(context) ?? false;
|
|
91
|
+
if (opt.type === 'boolean') {
|
|
92
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseSwitch, _extends({
|
|
93
|
+
checked: Boolean(configuration[key] ?? opt.default),
|
|
94
|
+
onChange: event => handleChange(key, event.target.checked),
|
|
95
|
+
size: "small",
|
|
96
|
+
label: opt.label,
|
|
97
|
+
disabled: isDisabled
|
|
98
|
+
}, rootProps.slotProps?.baseSwitch), key);
|
|
99
|
+
}
|
|
100
|
+
if (opt.type === 'select') {
|
|
101
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
|
|
102
|
+
fullWidth: true,
|
|
103
|
+
size: "small",
|
|
104
|
+
label: opt.label,
|
|
105
|
+
value: configuration[key] ?? opt.default,
|
|
106
|
+
onChange: event => handleChange(key, event.target.value),
|
|
107
|
+
disabled: isDisabled,
|
|
108
|
+
slotProps: {
|
|
109
|
+
htmlInput: _extends({}, opt.htmlAttributes)
|
|
110
|
+
}
|
|
111
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
112
|
+
children: (opt.options || []).map(option => /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, {
|
|
113
|
+
value: option.value,
|
|
114
|
+
native: false,
|
|
115
|
+
children: option.content
|
|
116
|
+
}, option.value))
|
|
117
|
+
}), key);
|
|
118
|
+
}
|
|
119
|
+
// string or number
|
|
120
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
121
|
+
"aria-label": opt.label,
|
|
122
|
+
placeholder: opt.label,
|
|
123
|
+
label: opt.label,
|
|
124
|
+
type: opt.type === 'number' ? 'number' : 'text',
|
|
125
|
+
size: "small",
|
|
126
|
+
fullWidth: true,
|
|
127
|
+
disabled: isDisabled,
|
|
128
|
+
slotProps: {
|
|
129
|
+
htmlInput: _extends({}, opt.htmlAttributes)
|
|
130
|
+
}
|
|
131
|
+
}, rootProps.slotProps?.baseTextField, {
|
|
132
|
+
value: (configuration[key] ?? opt.default ?? '').toString(),
|
|
133
|
+
onChange: event => handleChange(key, opt.type === 'number' ? Number(event.target.value) : event.target.value)
|
|
134
|
+
}), key);
|
|
135
|
+
})
|
|
136
|
+
})]
|
|
137
|
+
}, section.id))
|
|
138
|
+
});
|
|
139
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { GridChartsPanelDataBody } from "./GridChartsPanelDataBody.js";
|
|
5
|
+
import { GridChartsPanelDataHeader } from "./GridChartsPanelDataHeader.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
function GridChartsPanelData() {
|
|
8
|
+
const [searchValue, setSearchValue] = React.useState('');
|
|
9
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
10
|
+
children: [/*#__PURE__*/_jsx(GridChartsPanelDataHeader, {
|
|
11
|
+
searchValue: searchValue,
|
|
12
|
+
onSearchValueChange: setSearchValue
|
|
13
|
+
}), /*#__PURE__*/_jsx(GridChartsPanelDataBody, {
|
|
14
|
+
searchValue: searchValue
|
|
15
|
+
})]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export { GridChartsPanelData };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GridChartsIntegrationSection } from "../../../hooks/features/chartsIntegration/gridChartsIntegrationInterfaces.js";
|
|
3
|
+
export interface FieldTransferObject {
|
|
4
|
+
field: string;
|
|
5
|
+
section: GridChartsIntegrationSection;
|
|
6
|
+
}
|
|
7
|
+
export type DropPosition = 'top' | 'bottom' | null;
|
|
8
|
+
interface GridChartsPanelDataBodyProps {
|
|
9
|
+
searchValue: string;
|
|
10
|
+
}
|
|
11
|
+
declare function GridChartsPanelDataBody(props: GridChartsPanelDataBodyProps): React.JSX.Element;
|
|
12
|
+
export { GridChartsPanelDataBody };
|
|
@@ -0,0 +1,374 @@
|
|
|
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 { gridPivotActiveSelector, vars } from '@mui/x-data-grid-pro/internals';
|
|
7
|
+
import { getDataGridUtilityClass, GridShadowScrollArea, useGridSelector } from '@mui/x-data-grid-pro';
|
|
8
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
+
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
10
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "../../collapsible/index.js";
|
|
11
|
+
import { ResizablePanel, ResizablePanelHandle } from "../../resizablePanel/index.js";
|
|
12
|
+
import { GridChartsPanelDataField } from "./GridChartsPanelDataField.js";
|
|
13
|
+
import { gridChartableColumnsSelector, gridChartsDimensionsSelector, gridChartsIntegrationActiveChartIdSelector, gridChartsValuesSelector } from "../../../hooks/features/chartsIntegration/gridChartsIntegrationSelectors.js";
|
|
14
|
+
import { useGridPrivateApiContext } from "../../../hooks/utils/useGridPrivateApiContext.js";
|
|
15
|
+
import { useGridChartsIntegrationContext } from "../../../hooks/utils/useGridChartIntegration.js";
|
|
16
|
+
import { getBlockedSections } from "../../../hooks/features/chartsIntegration/utils.js";
|
|
17
|
+
import { gridRowGroupingSanitizedModelSelector } from "../../../hooks/features/rowGrouping/gridRowGroupingSelector.js";
|
|
18
|
+
import { gridPivotModelSelector } from "../../../hooks/features/pivoting/gridPivotingSelectors.js";
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
const useUtilityClasses = ownerState => {
|
|
21
|
+
const {
|
|
22
|
+
classes
|
|
23
|
+
} = ownerState;
|
|
24
|
+
const slots = {
|
|
25
|
+
root: ['chartsPanelDataBody'],
|
|
26
|
+
availableFields: ['chartsPanelDataAvailableFields'],
|
|
27
|
+
sections: ['chartsPanelDataSections'],
|
|
28
|
+
scrollArea: ['chartsPanelDataScrollArea'],
|
|
29
|
+
section: ['chartsPanelDataSection'],
|
|
30
|
+
sectionTitle: ['chartsPanelDataSectionTitle'],
|
|
31
|
+
fieldList: ['chartsPanelDataFieldList'],
|
|
32
|
+
placeholder: ['chartsPanelDataPlaceholder']
|
|
33
|
+
};
|
|
34
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
35
|
+
};
|
|
36
|
+
const GridChartsPanelDataBodyRoot = styled('div', {
|
|
37
|
+
name: 'MuiDataGrid',
|
|
38
|
+
slot: 'ChartsPanelDataBody'
|
|
39
|
+
})({
|
|
40
|
+
flex: 1,
|
|
41
|
+
display: 'flex',
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
overflow: 'hidden'
|
|
44
|
+
});
|
|
45
|
+
const GridChartsPanelDataAvailableFields = styled(GridShadowScrollArea, {
|
|
46
|
+
name: 'MuiDataGrid',
|
|
47
|
+
slot: 'ChartsPanelDataAvailableFields'
|
|
48
|
+
})({
|
|
49
|
+
flex: 1,
|
|
50
|
+
minHeight: 84,
|
|
51
|
+
transition: vars.transition(['background-color'], {
|
|
52
|
+
duration: vars.transitions.duration.short,
|
|
53
|
+
easing: vars.transitions.easing.easeInOut
|
|
54
|
+
}),
|
|
55
|
+
'&[data-drag-over="true"]': {
|
|
56
|
+
backgroundColor: vars.colors.interactive.hover
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const GridChartsPanelDataSections = styled(ResizablePanel, {
|
|
60
|
+
name: 'MuiDataGrid',
|
|
61
|
+
slot: 'ChartsPanelDataSections'
|
|
62
|
+
})({
|
|
63
|
+
position: 'relative',
|
|
64
|
+
minHeight: 158,
|
|
65
|
+
overflow: 'hidden',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'column'
|
|
68
|
+
});
|
|
69
|
+
const GridChartsPanelDataScrollArea = styled(GridShadowScrollArea, {
|
|
70
|
+
name: 'MuiDataGrid',
|
|
71
|
+
slot: 'ChartsPanelDataScrollArea'
|
|
72
|
+
})({
|
|
73
|
+
height: '100%'
|
|
74
|
+
});
|
|
75
|
+
const GridChartsPanelDataSection = styled(Collapsible, {
|
|
76
|
+
name: 'MuiDataGrid',
|
|
77
|
+
slot: 'ChartsPanelDataSection',
|
|
78
|
+
shouldForwardProp: prop => prop !== 'disabled'
|
|
79
|
+
})(({
|
|
80
|
+
disabled
|
|
81
|
+
}) => ({
|
|
82
|
+
opacity: disabled ? 0.5 : 1,
|
|
83
|
+
margin: vars.spacing(0.5, 1),
|
|
84
|
+
transition: vars.transition(['border-color', 'background-color'], {
|
|
85
|
+
duration: vars.transitions.duration.short,
|
|
86
|
+
easing: vars.transitions.easing.easeInOut
|
|
87
|
+
}),
|
|
88
|
+
'&[data-drag-over="true"]': {
|
|
89
|
+
backgroundColor: vars.colors.interactive.hover,
|
|
90
|
+
outline: `2px solid ${vars.colors.interactive.selected}`
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
const GridChartsPanelDataSectionTitle = styled('div', {
|
|
94
|
+
name: 'MuiDataGrid',
|
|
95
|
+
slot: 'ChartsPanelDataSectionTitle'
|
|
96
|
+
})({
|
|
97
|
+
flex: 1,
|
|
98
|
+
marginRight: vars.spacing(1.75),
|
|
99
|
+
display: 'flex',
|
|
100
|
+
justifyContent: 'space-between',
|
|
101
|
+
alignItems: 'center',
|
|
102
|
+
gap: vars.spacing(1),
|
|
103
|
+
font: vars.typography.font.body,
|
|
104
|
+
fontWeight: vars.typography.fontWeight.medium
|
|
105
|
+
});
|
|
106
|
+
const GridChartsPanelDataFieldList = styled('div', {
|
|
107
|
+
name: 'MuiDataGrid',
|
|
108
|
+
slot: 'ChartsPanelDataFieldList'
|
|
109
|
+
})({
|
|
110
|
+
flex: 1,
|
|
111
|
+
display: 'flex',
|
|
112
|
+
flexDirection: 'column',
|
|
113
|
+
padding: vars.spacing(0.5, 0)
|
|
114
|
+
});
|
|
115
|
+
const GridChartsPanelDataPlaceholder = styled('div', {
|
|
116
|
+
name: 'MuiDataGrid',
|
|
117
|
+
slot: 'ChartsPanelDataPlaceholder'
|
|
118
|
+
})({
|
|
119
|
+
flex: 1,
|
|
120
|
+
display: 'flex',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
justifyContent: 'center',
|
|
123
|
+
textWrap: 'balance',
|
|
124
|
+
textAlign: 'center',
|
|
125
|
+
minHeight: 38,
|
|
126
|
+
height: '100%',
|
|
127
|
+
padding: vars.spacing(0, 1),
|
|
128
|
+
color: vars.colors.foreground.muted,
|
|
129
|
+
font: vars.typography.font.body
|
|
130
|
+
});
|
|
131
|
+
const INITIAL_DRAG_STATE = {
|
|
132
|
+
active: false,
|
|
133
|
+
field: null,
|
|
134
|
+
dropSection: null,
|
|
135
|
+
initialSection: null
|
|
136
|
+
};
|
|
137
|
+
// dimensions and values
|
|
138
|
+
const SECTION_COUNT = 2;
|
|
139
|
+
function GridChartsPanelDataBody(props) {
|
|
140
|
+
const {
|
|
141
|
+
searchValue
|
|
142
|
+
} = props;
|
|
143
|
+
const apiRef = useGridPrivateApiContext();
|
|
144
|
+
const rootProps = useGridRootProps();
|
|
145
|
+
const rowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector);
|
|
146
|
+
const pivotActive = useGridSelector(apiRef, gridPivotActiveSelector);
|
|
147
|
+
const pivotModel = useGridSelector(apiRef, gridPivotModelSelector);
|
|
148
|
+
const activeChartId = useGridSelector(apiRef, gridChartsIntegrationActiveChartIdSelector);
|
|
149
|
+
const {
|
|
150
|
+
chartStateLookup
|
|
151
|
+
} = useGridChartsIntegrationContext();
|
|
152
|
+
const dimensions = useGridSelector(apiRef, gridChartsDimensionsSelector, activeChartId);
|
|
153
|
+
const values = useGridSelector(apiRef, gridChartsValuesSelector, activeChartId);
|
|
154
|
+
const classes = useUtilityClasses(rootProps);
|
|
155
|
+
const chartableColumns = useGridSelector(apiRef, gridChartableColumnsSelector);
|
|
156
|
+
const dimensionsLabel = React.useMemo(() => chartStateLookup[activeChartId]?.dimensionsLabel || apiRef.current.getLocaleText('chartsCategories'), [chartStateLookup, activeChartId, apiRef]);
|
|
157
|
+
const valuesLabel = React.useMemo(() => chartStateLookup[activeChartId]?.valuesLabel || apiRef.current.getLocaleText('chartsSeries'), [chartStateLookup, activeChartId, apiRef]);
|
|
158
|
+
const fullSections = React.useMemo(() => {
|
|
159
|
+
const sections = [];
|
|
160
|
+
if (chartStateLookup[activeChartId]?.maxDimensions && dimensions.length >= chartStateLookup[activeChartId]?.maxDimensions) {
|
|
161
|
+
sections.push('dimensions');
|
|
162
|
+
}
|
|
163
|
+
if (chartStateLookup[activeChartId]?.maxValues && values.length >= chartStateLookup[activeChartId]?.maxValues) {
|
|
164
|
+
sections.push('values');
|
|
165
|
+
}
|
|
166
|
+
return sections;
|
|
167
|
+
}, [dimensions, values, chartStateLookup, activeChartId]);
|
|
168
|
+
const blockedSectionsLookup = React.useMemo(() => new Map(Object.values(chartableColumns).map(column => [column.field, Array.from(new Set([...getBlockedSections(column, rowGroupingModel, pivotActive ? pivotModel : undefined), ...fullSections]))])), [rowGroupingModel, chartableColumns, pivotActive, pivotModel, fullSections]);
|
|
169
|
+
const availableFields = React.useMemo(() => {
|
|
170
|
+
const notUsedFields = Object.keys(chartableColumns).filter(field => !dimensions.some(dimension => dimension.field === field) && !values.some(value => value.field === field));
|
|
171
|
+
if (searchValue) {
|
|
172
|
+
return notUsedFields.filter(field => {
|
|
173
|
+
const fieldName = apiRef.current.chartsIntegration.getColumnName(field);
|
|
174
|
+
return fieldName.toLowerCase().includes(searchValue.toLowerCase());
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Fields with all sections blocked should be at the end
|
|
179
|
+
return notUsedFields.sort((a, b) => {
|
|
180
|
+
const aBlockedSections = blockedSectionsLookup.get(a).length;
|
|
181
|
+
const bBlockedSections = blockedSectionsLookup.get(b).length;
|
|
182
|
+
return (aBlockedSections >= SECTION_COUNT ? 1 : 0) - (bBlockedSections >= SECTION_COUNT ? 1 : 0);
|
|
183
|
+
});
|
|
184
|
+
}, [apiRef, searchValue, chartableColumns, dimensions, values, blockedSectionsLookup]);
|
|
185
|
+
const [drag, setDrag] = React.useState(INITIAL_DRAG_STATE);
|
|
186
|
+
const disabledSections = React.useMemo(() => {
|
|
187
|
+
if (!drag.field) {
|
|
188
|
+
return new Set();
|
|
189
|
+
}
|
|
190
|
+
return new Set(blockedSectionsLookup.get(drag.field));
|
|
191
|
+
}, [blockedSectionsLookup, drag.field]);
|
|
192
|
+
const handleDragStart = (field, section) => {
|
|
193
|
+
setDrag({
|
|
194
|
+
active: true,
|
|
195
|
+
field,
|
|
196
|
+
initialSection: section,
|
|
197
|
+
dropSection: null
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const handleDragEnd = () => {
|
|
201
|
+
setDrag(INITIAL_DRAG_STATE);
|
|
202
|
+
};
|
|
203
|
+
const handleDrop = event => {
|
|
204
|
+
setDrag(INITIAL_DRAG_STATE);
|
|
205
|
+
|
|
206
|
+
// The drop event was already handled by a child
|
|
207
|
+
if (event.defaultPrevented) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
const {
|
|
212
|
+
field,
|
|
213
|
+
section: originSection
|
|
214
|
+
} = JSON.parse(event.dataTransfer.getData('text/plain'));
|
|
215
|
+
const targetSection = event.currentTarget.getAttribute('data-section');
|
|
216
|
+
if (originSection === targetSection) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
apiRef.current.chartsIntegration.updateDataReference(field, originSection, targetSection);
|
|
220
|
+
};
|
|
221
|
+
const handleDragOver = React.useCallback(event => {
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
event.dataTransfer.dropEffect = 'move';
|
|
224
|
+
}, []);
|
|
225
|
+
const handleDragEnter = React.useCallback(event => {
|
|
226
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
227
|
+
const dropSection = event.currentTarget.getAttribute('data-section');
|
|
228
|
+
setDrag(v => _extends({}, v, {
|
|
229
|
+
active: true,
|
|
230
|
+
dropSection
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
}, []);
|
|
234
|
+
const handleDragLeave = React.useCallback(event => {
|
|
235
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
236
|
+
setDrag(v => _extends({}, v, {
|
|
237
|
+
active: true,
|
|
238
|
+
dropSection: v.initialSection
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
}, []);
|
|
242
|
+
const handleChange = React.useCallback((field, section) => {
|
|
243
|
+
const apiMethod = section === 'dimensions' ? apiRef.current.updateChartDimensionsData : apiRef.current.updateChartValuesData;
|
|
244
|
+
apiMethod(activeChartId, currentItems => currentItems.map(item => item.field === field ? _extends({}, item, {
|
|
245
|
+
hidden: item.hidden !== true
|
|
246
|
+
}) : item));
|
|
247
|
+
}, [apiRef, activeChartId]);
|
|
248
|
+
return /*#__PURE__*/_jsxs(GridChartsPanelDataBodyRoot, {
|
|
249
|
+
ownerState: rootProps,
|
|
250
|
+
className: classes.root,
|
|
251
|
+
"data-dragging": drag.active,
|
|
252
|
+
onDragLeave: handleDragLeave,
|
|
253
|
+
children: [/*#__PURE__*/_jsxs(GridChartsPanelDataAvailableFields, {
|
|
254
|
+
ownerState: rootProps,
|
|
255
|
+
className: classes.availableFields,
|
|
256
|
+
onDrop: handleDrop,
|
|
257
|
+
onDragEnter: handleDragEnter,
|
|
258
|
+
onDragOver: handleDragOver,
|
|
259
|
+
"data-section": null,
|
|
260
|
+
"data-drag-over": drag.active && drag.dropSection === null,
|
|
261
|
+
children: [availableFields.length === 0 && /*#__PURE__*/_jsx(GridChartsPanelDataPlaceholder, {
|
|
262
|
+
ownerState: rootProps,
|
|
263
|
+
className: classes.placeholder,
|
|
264
|
+
children: apiRef.current.getLocaleText('chartsNoFields')
|
|
265
|
+
}), availableFields.length > 0 && /*#__PURE__*/_jsx(GridChartsPanelDataFieldList, {
|
|
266
|
+
ownerState: rootProps,
|
|
267
|
+
className: classes.fieldList,
|
|
268
|
+
children: availableFields.map(field => /*#__PURE__*/_jsx(GridChartsPanelDataField, {
|
|
269
|
+
field: field,
|
|
270
|
+
section: null,
|
|
271
|
+
disabled: blockedSectionsLookup.get(field).length >= SECTION_COUNT,
|
|
272
|
+
blockedSections: blockedSectionsLookup.get(field),
|
|
273
|
+
dimensionsLabel: dimensionsLabel,
|
|
274
|
+
valuesLabel: valuesLabel,
|
|
275
|
+
onDragStart: handleDragStart,
|
|
276
|
+
onDragEnd: handleDragEnd,
|
|
277
|
+
children: apiRef.current.chartsIntegration.getColumnName(field)
|
|
278
|
+
}, field))
|
|
279
|
+
})]
|
|
280
|
+
}), /*#__PURE__*/_jsxs(GridChartsPanelDataSections, {
|
|
281
|
+
ownerState: rootProps,
|
|
282
|
+
className: classes.sections,
|
|
283
|
+
direction: "vertical",
|
|
284
|
+
children: [/*#__PURE__*/_jsx(ResizablePanelHandle, {}), /*#__PURE__*/_jsxs(GridChartsPanelDataScrollArea, {
|
|
285
|
+
ownerState: rootProps,
|
|
286
|
+
className: classes.scrollArea,
|
|
287
|
+
children: [/*#__PURE__*/_jsxs(GridChartsPanelDataSection, {
|
|
288
|
+
ownerState: rootProps,
|
|
289
|
+
className: classes.section,
|
|
290
|
+
onDrop: handleDrop,
|
|
291
|
+
onDragEnter: handleDragEnter,
|
|
292
|
+
onDragOver: handleDragOver,
|
|
293
|
+
disabled: disabledSections.has('dimensions'),
|
|
294
|
+
"data-section": "dimensions",
|
|
295
|
+
"data-drag-over": !disabledSections.has('dimensions') && drag.dropSection === 'dimensions',
|
|
296
|
+
children: [/*#__PURE__*/_jsx(CollapsibleTrigger, {
|
|
297
|
+
"aria-label": dimensionsLabel,
|
|
298
|
+
children: /*#__PURE__*/_jsxs(GridChartsPanelDataSectionTitle, {
|
|
299
|
+
ownerState: rootProps,
|
|
300
|
+
className: classes.sectionTitle,
|
|
301
|
+
children: [dimensionsLabel, (chartStateLookup[activeChartId]?.maxDimensions || dimensions.length > 0) && /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
302
|
+
badgeContent: chartStateLookup[activeChartId]?.maxDimensions ? `${dimensions.length}/${chartStateLookup[activeChartId]?.maxDimensions}` : dimensions.length
|
|
303
|
+
})]
|
|
304
|
+
})
|
|
305
|
+
}), /*#__PURE__*/_jsxs(CollapsiblePanel, {
|
|
306
|
+
children: [dimensions.length === 0 && /*#__PURE__*/_jsx(GridChartsPanelDataPlaceholder, {
|
|
307
|
+
ownerState: rootProps,
|
|
308
|
+
className: classes.placeholder,
|
|
309
|
+
children: apiRef.current.getLocaleText('chartsDragToDimensions')(dimensionsLabel)
|
|
310
|
+
}), dimensions.length > 0 && /*#__PURE__*/_jsx(GridChartsPanelDataFieldList, {
|
|
311
|
+
ownerState: rootProps,
|
|
312
|
+
className: classes.fieldList,
|
|
313
|
+
children: dimensions.map(dimension => /*#__PURE__*/_jsx(GridChartsPanelDataField, {
|
|
314
|
+
field: dimension.field,
|
|
315
|
+
selected: dimension.hidden !== true,
|
|
316
|
+
onChange: handleChange,
|
|
317
|
+
section: "dimensions",
|
|
318
|
+
blockedSections: blockedSectionsLookup.get(dimension.field),
|
|
319
|
+
dimensionsLabel: dimensionsLabel,
|
|
320
|
+
valuesLabel: valuesLabel,
|
|
321
|
+
disabled: disabledSections.has('dimensions'),
|
|
322
|
+
onDragStart: handleDragStart,
|
|
323
|
+
onDragEnd: handleDragEnd,
|
|
324
|
+
children: apiRef.current.chartsIntegration.getColumnName(dimension.field)
|
|
325
|
+
}, dimension.field))
|
|
326
|
+
})]
|
|
327
|
+
})]
|
|
328
|
+
}), /*#__PURE__*/_jsxs(GridChartsPanelDataSection, {
|
|
329
|
+
ownerState: rootProps,
|
|
330
|
+
className: classes.section,
|
|
331
|
+
onDrop: handleDrop,
|
|
332
|
+
onDragEnter: handleDragEnter,
|
|
333
|
+
onDragOver: handleDragOver,
|
|
334
|
+
disabled: disabledSections.has('values'),
|
|
335
|
+
"data-section": "values",
|
|
336
|
+
"data-drag-over": !disabledSections.has('values') && drag.dropSection === 'values',
|
|
337
|
+
children: [/*#__PURE__*/_jsx(CollapsibleTrigger, {
|
|
338
|
+
"aria-label": valuesLabel,
|
|
339
|
+
children: /*#__PURE__*/_jsxs(GridChartsPanelDataSectionTitle, {
|
|
340
|
+
ownerState: rootProps,
|
|
341
|
+
className: classes.sectionTitle,
|
|
342
|
+
children: [valuesLabel, (chartStateLookup[activeChartId]?.maxValues || values.length > 0) && /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
343
|
+
badgeContent: chartStateLookup[activeChartId]?.maxValues ? `${values.length}/${chartStateLookup[activeChartId]?.maxValues}` : values.length
|
|
344
|
+
})]
|
|
345
|
+
})
|
|
346
|
+
}), /*#__PURE__*/_jsxs(CollapsiblePanel, {
|
|
347
|
+
children: [values.length === 0 && /*#__PURE__*/_jsx(GridChartsPanelDataPlaceholder, {
|
|
348
|
+
ownerState: rootProps,
|
|
349
|
+
className: classes.placeholder,
|
|
350
|
+
children: apiRef.current.getLocaleText('chartsDragToValues')(valuesLabel)
|
|
351
|
+
}), values.length > 0 && /*#__PURE__*/_jsx(GridChartsPanelDataFieldList, {
|
|
352
|
+
ownerState: rootProps,
|
|
353
|
+
className: classes.fieldList,
|
|
354
|
+
children: values.map(value => /*#__PURE__*/_jsx(GridChartsPanelDataField, {
|
|
355
|
+
field: value.field,
|
|
356
|
+
selected: value.hidden !== true,
|
|
357
|
+
onChange: handleChange,
|
|
358
|
+
section: "values",
|
|
359
|
+
blockedSections: blockedSectionsLookup.get(value.field),
|
|
360
|
+
dimensionsLabel: dimensionsLabel,
|
|
361
|
+
valuesLabel: valuesLabel,
|
|
362
|
+
disabled: disabledSections.has('values'),
|
|
363
|
+
onDragStart: handleDragStart,
|
|
364
|
+
onDragEnd: handleDragEnd,
|
|
365
|
+
children: apiRef.current.chartsIntegration.getColumnName(value.field)
|
|
366
|
+
}, value.field))
|
|
367
|
+
})]
|
|
368
|
+
})]
|
|
369
|
+
})]
|
|
370
|
+
})]
|
|
371
|
+
})]
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
export { GridChartsPanelDataBody };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FieldTransferObject } from "./GridChartsPanelDataBody.js";
|
|
3
|
+
import type { GridChartsIntegrationSection } from "../../../hooks/features/chartsIntegration/gridChartsIntegrationInterfaces.js";
|
|
4
|
+
type GridChartsPanelDataFieldProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
field: string;
|
|
7
|
+
section: GridChartsIntegrationSection;
|
|
8
|
+
blockedSections?: string[];
|
|
9
|
+
dimensionsLabel: string;
|
|
10
|
+
valuesLabel: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
onChange?: (field: string, section: GridChartsIntegrationSection) => void;
|
|
14
|
+
onDragStart: (field: string, section: GridChartsIntegrationSection) => void;
|
|
15
|
+
onDragEnd: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function AggregationSelect({
|
|
18
|
+
aggFunc,
|
|
19
|
+
field
|
|
20
|
+
}: {
|
|
21
|
+
aggFunc: string;
|
|
22
|
+
field: FieldTransferObject['field'];
|
|
23
|
+
}): React.JSX.Element | null;
|
|
24
|
+
declare function GridChartsPanelDataField(props: GridChartsPanelDataFieldProps): React.JSX.Element;
|
|
25
|
+
export { GridChartsPanelDataField };
|