@mui/x-data-grid-premium 8.11.2 → 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 +231 -0
- 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/components/promptField/PromptFieldControl.js +1 -1
- 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/components/promptField/PromptFieldControl.js +1 -1
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridColumnMenuProps, GridColumnMenuItemProps } from '@mui/x-data-grid-pro';
|
|
3
|
-
import { GridColumnMenuAggregationItem } from "./GridColumnMenuAggregationItem.js";
|
|
4
|
-
import {
|
|
3
|
+
import { GridColumnMenuAggregationItem } from "./columnMenu/menuItems/GridColumnMenuAggregationItem.js";
|
|
4
|
+
import { GridColumnMenuManagePanelItem } from "./columnMenu/menuItems/GridColumnMenuManagePanelItem.js";
|
|
5
5
|
export declare function GridColumnMenuGroupingItem(props: GridColumnMenuItemProps): React.JSX.Element;
|
|
6
6
|
export declare const GRID_COLUMN_MENU_SLOTS_PREMIUM: {
|
|
7
7
|
columnMenuAggregationItem: typeof GridColumnMenuAggregationItem;
|
|
8
8
|
columnMenuGroupingItem: typeof GridColumnMenuGroupingItem;
|
|
9
|
-
|
|
9
|
+
columnMenuManagePanelItem: typeof GridColumnMenuManagePanelItem;
|
|
10
10
|
columnMenuPinningItem: typeof import("@mui/x-data-grid-pro").GridColumnMenuPinningItem;
|
|
11
11
|
columnMenuSortItem: typeof import("@mui/x-data-grid").GridColumnMenuSortItem;
|
|
12
12
|
columnMenuFilterItem: typeof import("@mui/x-data-grid").GridColumnMenuFilterItem;
|
|
@@ -19,7 +19,7 @@ export declare const GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM: {
|
|
|
19
19
|
columnMenuGroupingItem: {
|
|
20
20
|
displayOrder: number;
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
columnMenuManagePanelItem: {
|
|
23
23
|
displayOrder: number;
|
|
24
24
|
};
|
|
25
25
|
columnMenuPinningItem: {
|
|
@@ -2,11 +2,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { GridGenericColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from '@mui/x-data-grid-pro';
|
|
4
4
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
5
|
-
import { GridColumnMenuAggregationItem } from "./GridColumnMenuAggregationItem.js";
|
|
5
|
+
import { GridColumnMenuAggregationItem } from "./columnMenu/menuItems/GridColumnMenuAggregationItem.js";
|
|
6
6
|
import { isGroupingColumn } from "../hooks/features/rowGrouping/index.js";
|
|
7
|
-
import { GridColumnMenuRowGroupItem } from "./GridColumnMenuRowGroupItem.js";
|
|
8
|
-
import { GridColumnMenuRowUngroupItem } from "./GridColumnMenuRowUngroupItem.js";
|
|
9
|
-
import {
|
|
7
|
+
import { GridColumnMenuRowGroupItem } from "./columnMenu/menuItems/GridColumnMenuRowGroupItem.js";
|
|
8
|
+
import { GridColumnMenuRowUngroupItem } from "./columnMenu/menuItems/GridColumnMenuRowUngroupItem.js";
|
|
9
|
+
import { GridColumnMenuManagePanelItem } from "./columnMenu/menuItems/GridColumnMenuManagePanelItem.js";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
export function GridColumnMenuGroupingItem(props) {
|
|
12
12
|
const {
|
|
@@ -20,7 +20,7 @@ export function GridColumnMenuGroupingItem(props) {
|
|
|
20
20
|
export const GRID_COLUMN_MENU_SLOTS_PREMIUM = _extends({}, GRID_COLUMN_MENU_SLOTS, {
|
|
21
21
|
columnMenuAggregationItem: GridColumnMenuAggregationItem,
|
|
22
22
|
columnMenuGroupingItem: GridColumnMenuGroupingItem,
|
|
23
|
-
|
|
23
|
+
columnMenuManagePanelItem: GridColumnMenuManagePanelItem
|
|
24
24
|
});
|
|
25
25
|
export const GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM = _extends({}, GRID_COLUMN_MENU_SLOT_PROPS, {
|
|
26
26
|
columnMenuAggregationItem: {
|
|
@@ -29,7 +29,7 @@ export const GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM = _extends({}, GRID_COLUMN_MENU
|
|
|
29
29
|
columnMenuGroupingItem: {
|
|
30
30
|
displayOrder: 27
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
columnMenuManagePanelItem: {
|
|
33
33
|
displayOrder: 28
|
|
34
34
|
}
|
|
35
35
|
});
|
|
@@ -10,6 +10,7 @@ import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
|
10
10
|
import { PivotPanelTrigger } from "./pivotPanel/PivotPanelTrigger.js";
|
|
11
11
|
import { isPivotingAvailable } from "../hooks/features/pivoting/utils.js";
|
|
12
12
|
import { AiAssistantPanelTrigger } from "./aiAssistantPanel/index.js";
|
|
13
|
+
import { ChartsPanelTrigger } from "./chartsPanel/ChartsPanelTrigger.js";
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
export function GridPremiumToolbar(props) {
|
|
15
16
|
const rootProps = useGridRootProps();
|
|
@@ -26,6 +27,16 @@ export function GridPremiumToolbar(props) {
|
|
|
26
27
|
})
|
|
27
28
|
}))
|
|
28
29
|
})
|
|
30
|
+
}), rootProps.experimentalFeatures?.charts && rootProps.chartsIntegration && /*#__PURE__*/_jsx(ChartsPanelTrigger, {
|
|
31
|
+
render: triggerProps => /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
32
|
+
title: apiRef.current.getLocaleText('toolbarCharts'),
|
|
33
|
+
children: /*#__PURE__*/_jsx(ToolbarButton, _extends({}, triggerProps, {
|
|
34
|
+
color: "default",
|
|
35
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.chartsIcon, {
|
|
36
|
+
fontSize: "small"
|
|
37
|
+
})
|
|
38
|
+
}))
|
|
39
|
+
})
|
|
29
40
|
}), rootProps.aiAssistant && /*#__PURE__*/_jsx(AiAssistantPanelTrigger, {
|
|
30
41
|
render: triggerProps => /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
31
42
|
title: apiRef.current.getLocaleText('toolbarAssistant'),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RenderProp } from '@mui/x-data-grid-pro/internals';
|
|
3
|
+
import { GridSlotProps } from '@mui/x-data-grid-pro';
|
|
4
|
+
export interface ChartsPanelState {
|
|
5
|
+
/**
|
|
6
|
+
* If `true`, the charts integration panel is open.
|
|
7
|
+
*/
|
|
8
|
+
open: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type ChartsPanelTriggerProps = Omit<GridSlotProps['baseButton'], 'className'> & {
|
|
11
|
+
/**
|
|
12
|
+
* A function to customize rendering of the component.
|
|
13
|
+
*/
|
|
14
|
+
render?: RenderProp<GridSlotProps['baseButton'], ChartsPanelState>;
|
|
15
|
+
/**
|
|
16
|
+
* A function to customize rendering of the component.
|
|
17
|
+
*/
|
|
18
|
+
className?: string | ((state: ChartsPanelState) => string);
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A button that opens and closes the charts integration panel.
|
|
22
|
+
* It renders the `baseButton` slot.
|
|
23
|
+
*
|
|
24
|
+
* Demos:
|
|
25
|
+
*
|
|
26
|
+
* - [Charts Panel](https://mui.com/x/react-data-grid/components/charts-panel/)
|
|
27
|
+
*
|
|
28
|
+
* API:
|
|
29
|
+
*
|
|
30
|
+
* - [ChartsPanelTrigger API](https://mui.com/x/api/data-grid/charts-panel-trigger/)
|
|
31
|
+
*/
|
|
32
|
+
declare const ChartsPanelTrigger: React.ForwardRefExoticComponent<ChartsPanelTriggerProps> | React.ForwardRefExoticComponent<Omit<ChartsPanelTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
+
export { ChartsPanelTrigger };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["render", "className", "onClick", "onPointerUp"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import useId from '@mui/utils/useId';
|
|
7
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
|
+
import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
|
|
9
|
+
import { useGridSelector } from '@mui/x-data-grid-pro';
|
|
10
|
+
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
11
|
+
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
12
|
+
import { gridChartsPanelOpenSelector } from "../../hooks/features/chartsIntegration/gridChartsIntegrationSelectors.js";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
/**
|
|
15
|
+
* A button that opens and closes the charts integration panel.
|
|
16
|
+
* It renders the `baseButton` slot.
|
|
17
|
+
*
|
|
18
|
+
* Demos:
|
|
19
|
+
*
|
|
20
|
+
* - [Charts Panel](https://mui.com/x/react-data-grid/components/charts-panel/)
|
|
21
|
+
*
|
|
22
|
+
* API:
|
|
23
|
+
*
|
|
24
|
+
* - [ChartsPanelTrigger API](https://mui.com/x/api/data-grid/charts-panel-trigger/)
|
|
25
|
+
*/
|
|
26
|
+
const ChartsPanelTrigger = forwardRef(function ChartsPanelTrigger(props, ref) {
|
|
27
|
+
const {
|
|
28
|
+
render,
|
|
29
|
+
className,
|
|
30
|
+
onClick
|
|
31
|
+
} = props,
|
|
32
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
33
|
+
const rootProps = useGridRootProps();
|
|
34
|
+
const buttonId = useId();
|
|
35
|
+
const panelId = useId();
|
|
36
|
+
const apiRef = useGridApiContext();
|
|
37
|
+
const open = useGridSelector(apiRef, gridChartsPanelOpenSelector);
|
|
38
|
+
const state = {
|
|
39
|
+
open
|
|
40
|
+
};
|
|
41
|
+
const resolvedClassName = typeof className === 'function' ? className(state) : className;
|
|
42
|
+
const handleClick = event => {
|
|
43
|
+
apiRef.current.setChartsPanelOpen(!open);
|
|
44
|
+
onClick?.(event);
|
|
45
|
+
};
|
|
46
|
+
const element = useComponentRenderer(rootProps.slots.baseButton, render, _extends({}, rootProps.slotProps?.baseButton, {
|
|
47
|
+
id: buttonId,
|
|
48
|
+
// TODO: Hook up the panel/trigger IDs to the charts configuration panel
|
|
49
|
+
'aria-haspopup': 'true',
|
|
50
|
+
'aria-expanded': open ? 'true' : undefined,
|
|
51
|
+
'aria-controls': open ? panelId : undefined,
|
|
52
|
+
onClick: handleClick,
|
|
53
|
+
className: resolvedClassName
|
|
54
|
+
}, other, {
|
|
55
|
+
ref
|
|
56
|
+
}), state);
|
|
57
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
58
|
+
children: element
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
if (process.env.NODE_ENV !== "production") ChartsPanelTrigger.displayName = "ChartsPanelTrigger";
|
|
62
|
+
process.env.NODE_ENV !== "production" ? ChartsPanelTrigger.propTypes = {
|
|
63
|
+
// ----------------------------- Warning --------------------------------
|
|
64
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
65
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
66
|
+
// ----------------------------------------------------------------------
|
|
67
|
+
/**
|
|
68
|
+
* A function to customize rendering of the component.
|
|
69
|
+
*/
|
|
70
|
+
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
71
|
+
disabled: PropTypes.bool,
|
|
72
|
+
id: PropTypes.string,
|
|
73
|
+
/**
|
|
74
|
+
* A function to customize rendering of the component.
|
|
75
|
+
*/
|
|
76
|
+
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
77
|
+
role: PropTypes.string,
|
|
78
|
+
size: PropTypes.oneOf(['large', 'medium', 'small']),
|
|
79
|
+
startIcon: PropTypes.node,
|
|
80
|
+
style: PropTypes.object,
|
|
81
|
+
tabIndex: PropTypes.number,
|
|
82
|
+
title: PropTypes.string,
|
|
83
|
+
touchRippleRef: PropTypes.any
|
|
84
|
+
} : void 0;
|
|
85
|
+
export { ChartsPanelTrigger };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GridChartsConfigurationOptions } from '@mui/x-internals/types';
|
|
3
|
+
export interface GridChartsPanelProps {
|
|
4
|
+
/**
|
|
5
|
+
* The schema of the charts configuration.
|
|
6
|
+
* @type {GridChartsConfigurationOptions}
|
|
7
|
+
* @default {}
|
|
8
|
+
*/
|
|
9
|
+
schema?: GridChartsConfigurationOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Override the default column name generation logic. Use field in combination with the grid state to determine the name of the column that will be shown to the user.
|
|
12
|
+
* @param {string} field The field name
|
|
13
|
+
* @returns {string | undefined} The name of the column or undefined if the column name should be determined by the grid
|
|
14
|
+
*/
|
|
15
|
+
getColumnName?: (field: string) => string | undefined;
|
|
16
|
+
}
|
|
17
|
+
declare function GridChartsPanel(props: GridChartsPanelProps): React.JSX.Element;
|
|
18
|
+
declare namespace GridChartsPanel {
|
|
19
|
+
var propTypes: any;
|
|
20
|
+
}
|
|
21
|
+
export { GridChartsPanel };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { styled } from '@mui/system';
|
|
7
|
+
import useId from '@mui/utils/useId';
|
|
8
|
+
import { useGridSelector, vars } from '@mui/x-data-grid-pro/internals';
|
|
9
|
+
import { GridMenu, GridOverlay } from '@mui/x-data-grid-pro';
|
|
10
|
+
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
11
|
+
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
12
|
+
import { GridChartsPanelChart } from "./chart/GridChartsPanelChart.js";
|
|
13
|
+
import { GridChartsPanelCustomize } from "./customize/GridChartsPanelCustomize.js";
|
|
14
|
+
import { gridChartsIntegrationActiveChartIdSelector } from "../../hooks/features/chartsIntegration/gridChartsIntegrationSelectors.js";
|
|
15
|
+
import { useGridChartsIntegrationContext } from "../../hooks/utils/useGridChartIntegration.js";
|
|
16
|
+
import { GridChartsPanelData } from "./data/GridChartsPanelData.js";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
const GridChartsPanelHeader = styled('div', {
|
|
19
|
+
name: 'MuiDataGrid',
|
|
20
|
+
slot: 'ChartsPanelHeader'
|
|
21
|
+
})({
|
|
22
|
+
display: 'flex',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
gap: vars.spacing(0.25),
|
|
25
|
+
padding: vars.spacing(1, 0.5, 0, 0.75),
|
|
26
|
+
boxSizing: 'border-box'
|
|
27
|
+
});
|
|
28
|
+
const GridChartsPanelTitle = styled('div', {
|
|
29
|
+
name: 'MuiDataGrid',
|
|
30
|
+
slot: 'ChartsPanelTitle'
|
|
31
|
+
})({
|
|
32
|
+
font: vars.typography.font.large,
|
|
33
|
+
fontWeight: vars.typography.fontWeight.medium,
|
|
34
|
+
marginLeft: vars.spacing(0.5),
|
|
35
|
+
marginRight: 'auto'
|
|
36
|
+
});
|
|
37
|
+
const GridChartsPanelChartSelection = styled('button', {
|
|
38
|
+
name: 'MuiDataGrid',
|
|
39
|
+
slot: 'ChartsPanelChartSelection'
|
|
40
|
+
})({
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
gap: vars.spacing(0.25),
|
|
44
|
+
padding: vars.spacing(0.75, 0.5),
|
|
45
|
+
borderRadius: vars.radius.base,
|
|
46
|
+
font: vars.typography.font.large,
|
|
47
|
+
fontWeight: vars.typography.fontWeight.medium,
|
|
48
|
+
cursor: 'pointer',
|
|
49
|
+
border: 'none',
|
|
50
|
+
background: 'none',
|
|
51
|
+
outline: 'none',
|
|
52
|
+
marginRight: 'auto',
|
|
53
|
+
'&:hover, &:focus-visible': {
|
|
54
|
+
backgroundColor: vars.colors.interactive.hover
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
function GridChartsPanelChartSelector(props) {
|
|
58
|
+
const apiRef = useGridApiContext();
|
|
59
|
+
const rootProps = useGridRootProps();
|
|
60
|
+
const {
|
|
61
|
+
activeChartId,
|
|
62
|
+
chartEntries
|
|
63
|
+
} = props;
|
|
64
|
+
const triggerRef = React.useRef(null);
|
|
65
|
+
const [open, setOpen] = React.useState(false);
|
|
66
|
+
const menuId = useId();
|
|
67
|
+
const triggerId = useId();
|
|
68
|
+
const activeChart = chartEntries.find(([chartId]) => chartId === activeChartId);
|
|
69
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
70
|
+
children: [/*#__PURE__*/_jsxs(GridChartsPanelChartSelection, {
|
|
71
|
+
id: triggerId,
|
|
72
|
+
"aria-haspopup": "true",
|
|
73
|
+
"aria-controls": open ? menuId : undefined,
|
|
74
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
75
|
+
ownerState: rootProps,
|
|
76
|
+
onClick: () => setOpen(!open),
|
|
77
|
+
ref: triggerRef,
|
|
78
|
+
children: [activeChart?.[1]?.label, /*#__PURE__*/_jsx(rootProps.slots.promptChangesToggleIcon, {
|
|
79
|
+
fontSize: "small"
|
|
80
|
+
})]
|
|
81
|
+
}), /*#__PURE__*/_jsx(GridMenu, {
|
|
82
|
+
open: open,
|
|
83
|
+
target: triggerRef.current,
|
|
84
|
+
onClose: () => setOpen(false),
|
|
85
|
+
position: "bottom-start",
|
|
86
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseMenuList, _extends({
|
|
87
|
+
id: menuId,
|
|
88
|
+
"aria-labelledby": triggerId,
|
|
89
|
+
autoFocusItem: true
|
|
90
|
+
}, rootProps.slotProps?.baseMenuList, {
|
|
91
|
+
children: chartEntries.map(([chartId, chartState]) => /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({
|
|
92
|
+
value: chartId,
|
|
93
|
+
onClick: () => {
|
|
94
|
+
apiRef.current.setActiveChartId(chartId);
|
|
95
|
+
setOpen(false);
|
|
96
|
+
},
|
|
97
|
+
selected: chartId === activeChartId
|
|
98
|
+
}, rootProps.slotProps?.baseMenuItem, {
|
|
99
|
+
children: chartState.label || chartId
|
|
100
|
+
}), chartId))
|
|
101
|
+
}))
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
process.env.NODE_ENV !== "production" ? GridChartsPanelChartSelector.propTypes = {
|
|
106
|
+
// ----------------------------- Warning --------------------------------
|
|
107
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
108
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
109
|
+
// ----------------------------------------------------------------------
|
|
110
|
+
activeChartId: PropTypes.string.isRequired,
|
|
111
|
+
chartEntries: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
|
|
112
|
+
configuration: PropTypes.object.isRequired,
|
|
113
|
+
dimensions: PropTypes.arrayOf(PropTypes.shape({
|
|
114
|
+
data: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])).isRequired,
|
|
115
|
+
id: PropTypes.string.isRequired,
|
|
116
|
+
label: PropTypes.string.isRequired
|
|
117
|
+
})).isRequired,
|
|
118
|
+
dimensionsLabel: PropTypes.string,
|
|
119
|
+
label: PropTypes.string,
|
|
120
|
+
maxDimensions: PropTypes.number,
|
|
121
|
+
maxValues: PropTypes.number,
|
|
122
|
+
synced: PropTypes.bool.isRequired,
|
|
123
|
+
type: PropTypes.string.isRequired,
|
|
124
|
+
values: PropTypes.arrayOf(PropTypes.shape({
|
|
125
|
+
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
126
|
+
id: PropTypes.string.isRequired,
|
|
127
|
+
label: PropTypes.string.isRequired
|
|
128
|
+
})).isRequired,
|
|
129
|
+
valuesLabel: PropTypes.string
|
|
130
|
+
}), PropTypes.string]).isRequired)).isRequired
|
|
131
|
+
} : void 0;
|
|
132
|
+
function GridChartsPanel(props) {
|
|
133
|
+
const apiRef = useGridApiContext();
|
|
134
|
+
const rootProps = useGridRootProps();
|
|
135
|
+
const {
|
|
136
|
+
schema = {}
|
|
137
|
+
} = props;
|
|
138
|
+
const activeChartId = useGridSelector(apiRef, gridChartsIntegrationActiveChartIdSelector);
|
|
139
|
+
const {
|
|
140
|
+
chartStateLookup
|
|
141
|
+
} = useGridChartsIntegrationContext();
|
|
142
|
+
const [activeTab, setActiveTab] = React.useState('chart');
|
|
143
|
+
const chartEntries = React.useMemo(() => Object.entries(chartStateLookup), [chartStateLookup]);
|
|
144
|
+
const activeChartType = React.useMemo(() => chartStateLookup[activeChartId]?.type || '', [chartStateLookup, activeChartId]);
|
|
145
|
+
const currentChartConfiguration = React.useMemo(() => {
|
|
146
|
+
return schema[activeChartType] || {};
|
|
147
|
+
}, [schema, activeChartType]);
|
|
148
|
+
const handleChartSyncChange = React.useCallback(newSyncState => {
|
|
149
|
+
apiRef.current.setChartSynchronizationState(activeChartId, newSyncState);
|
|
150
|
+
}, [apiRef, activeChartId]);
|
|
151
|
+
const handleChartTypeChange = React.useCallback(type => {
|
|
152
|
+
apiRef.current.setChartType(activeChartId, type);
|
|
153
|
+
}, [apiRef, activeChartId]);
|
|
154
|
+
const tabItems = React.useMemo(() => [{
|
|
155
|
+
value: 'chart',
|
|
156
|
+
label: apiRef.current.getLocaleText('chartsTabChart'),
|
|
157
|
+
children: /*#__PURE__*/_jsx(GridChartsPanelChart, {
|
|
158
|
+
schema: schema,
|
|
159
|
+
selectedChartType: chartStateLookup[activeChartId]?.type,
|
|
160
|
+
onChartTypeChange: handleChartTypeChange
|
|
161
|
+
})
|
|
162
|
+
}, {
|
|
163
|
+
value: 'data',
|
|
164
|
+
label: apiRef.current.getLocaleText('chartsTabFields'),
|
|
165
|
+
children: /*#__PURE__*/_jsx(GridChartsPanelData, {})
|
|
166
|
+
}, {
|
|
167
|
+
value: 'customize',
|
|
168
|
+
label: apiRef.current.getLocaleText('chartsTabCustomize'),
|
|
169
|
+
children: /*#__PURE__*/_jsx(GridChartsPanelCustomize, {
|
|
170
|
+
activeChartId: activeChartId,
|
|
171
|
+
sections: currentChartConfiguration.customization || []
|
|
172
|
+
})
|
|
173
|
+
}], [apiRef, activeChartId, chartStateLookup, handleChartTypeChange, schema, currentChartConfiguration]);
|
|
174
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
175
|
+
children: [/*#__PURE__*/_jsxs(GridChartsPanelHeader, {
|
|
176
|
+
ownerState: rootProps,
|
|
177
|
+
children: [chartEntries.length > 1 ? /*#__PURE__*/_jsx(GridChartsPanelChartSelector, {
|
|
178
|
+
activeChartId: activeChartId,
|
|
179
|
+
chartEntries: chartEntries
|
|
180
|
+
}) : /*#__PURE__*/_jsx(GridChartsPanelTitle, {
|
|
181
|
+
ownerState: rootProps,
|
|
182
|
+
children: "Charts"
|
|
183
|
+
}), chartEntries.length > 0 && /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
184
|
+
title: rootProps.localeText.chartsSyncButtonLabel,
|
|
185
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseToggleButton, {
|
|
186
|
+
value: "sync",
|
|
187
|
+
"aria-label": rootProps.localeText.chartsSyncButtonLabel,
|
|
188
|
+
selected: chartStateLookup[activeChartId]?.synced,
|
|
189
|
+
onClick: () => {
|
|
190
|
+
handleChartSyncChange(!chartStateLookup[activeChartId]?.synced);
|
|
191
|
+
},
|
|
192
|
+
children: chartStateLookup[activeChartId]?.synced ? /*#__PURE__*/_jsx(rootProps.slots.chartsSyncIcon, {
|
|
193
|
+
fontSize: "small"
|
|
194
|
+
}) : /*#__PURE__*/_jsx(rootProps.slots.chartsSyncDisabledIcon, {
|
|
195
|
+
fontSize: "small"
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
}), /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
199
|
+
onClick: () => {
|
|
200
|
+
apiRef.current.setChartsPanelOpen(false);
|
|
201
|
+
},
|
|
202
|
+
"aria-label": apiRef.current.getLocaleText('chartsCloseButton')
|
|
203
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
204
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.sidebarCloseIcon, {
|
|
205
|
+
fontSize: "small"
|
|
206
|
+
})
|
|
207
|
+
}))]
|
|
208
|
+
}), chartEntries.length > 0 ? /*#__PURE__*/_jsx(rootProps.slots.baseTabs, _extends({
|
|
209
|
+
items: tabItems,
|
|
210
|
+
value: activeTab,
|
|
211
|
+
onChange: (_event, value) => {
|
|
212
|
+
setActiveTab(value);
|
|
213
|
+
}
|
|
214
|
+
}, rootProps.slotProps?.baseTabs)) : /*#__PURE__*/_jsx(GridOverlay, {
|
|
215
|
+
children: apiRef.current.getLocaleText('chartsNoCharts')
|
|
216
|
+
})]
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
process.env.NODE_ENV !== "production" ? GridChartsPanel.propTypes = {
|
|
220
|
+
// ----------------------------- Warning --------------------------------
|
|
221
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
222
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
223
|
+
// ----------------------------------------------------------------------
|
|
224
|
+
/**
|
|
225
|
+
* Override the default column name generation logic. Use field in combination with the grid state to determine the name of the column that will be shown to the user.
|
|
226
|
+
* @param {string} field The field name
|
|
227
|
+
* @returns {string | undefined} The name of the column or undefined if the column name should be determined by the grid
|
|
228
|
+
*/
|
|
229
|
+
getColumnName: PropTypes.func,
|
|
230
|
+
/**
|
|
231
|
+
* The schema of the charts configuration.
|
|
232
|
+
* @type {GridChartsConfigurationOptions}
|
|
233
|
+
* @default {}
|
|
234
|
+
*/
|
|
235
|
+
schema: PropTypes.object
|
|
236
|
+
} : void 0;
|
|
237
|
+
export { GridChartsPanel };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GridChartsConfigurationOptions } from '@mui/x-internals/types';
|
|
3
|
+
export interface GridChartsPanelChartProps {
|
|
4
|
+
schema: GridChartsConfigurationOptions;
|
|
5
|
+
selectedChartType: string;
|
|
6
|
+
onChartTypeChange: (type: string) => void;
|
|
7
|
+
}
|
|
8
|
+
declare function GridChartsPanelChart(props: GridChartsPanelChartProps): React.JSX.Element;
|
|
9
|
+
declare namespace GridChartsPanelChart {
|
|
10
|
+
var propTypes: any;
|
|
11
|
+
}
|
|
12
|
+
export { GridChartsPanelChart };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { styled } from '@mui/system';
|
|
5
|
+
import { getDataGridUtilityClass } from '@mui/x-data-grid-pro';
|
|
6
|
+
import { vars } from '@mui/x-data-grid-pro/internals';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const useUtilityClasses = ownerState => {
|
|
11
|
+
const {
|
|
12
|
+
classes
|
|
13
|
+
} = ownerState;
|
|
14
|
+
const slots = {
|
|
15
|
+
root: ['chartsManagement'],
|
|
16
|
+
chartTypeRoot: ['chartTypeRoot'],
|
|
17
|
+
button: ['chartTypeSelectorButton']
|
|
18
|
+
};
|
|
19
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
20
|
+
};
|
|
21
|
+
const GridChartsManagementRoot = styled('div', {
|
|
22
|
+
name: 'MuiDataGrid',
|
|
23
|
+
slot: 'ChartsManagement'
|
|
24
|
+
})({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
justifyContent: 'space-between',
|
|
28
|
+
height: '100%'
|
|
29
|
+
});
|
|
30
|
+
const GridChartTypeRoot = styled('div', {
|
|
31
|
+
name: 'MuiDataGrid',
|
|
32
|
+
slot: 'ChartTypeRoot'
|
|
33
|
+
})({
|
|
34
|
+
display: 'grid',
|
|
35
|
+
gridTemplateColumns: '1fr 1fr 1fr',
|
|
36
|
+
gap: vars.spacing(1),
|
|
37
|
+
padding: vars.spacing(1)
|
|
38
|
+
});
|
|
39
|
+
const GridChartTypeButton = styled('button', {
|
|
40
|
+
name: 'MuiDataGrid',
|
|
41
|
+
slot: 'ChartTypeSelectorButton',
|
|
42
|
+
shouldForwardProp: prop => prop !== 'isSelected'
|
|
43
|
+
})(({
|
|
44
|
+
isSelected
|
|
45
|
+
}) => {
|
|
46
|
+
return {
|
|
47
|
+
backgroundColor: isSelected ? `color-mix(in srgb, ${vars.colors.interactive.selected} calc(${vars.colors.interactive.selectedOpacity} * 100%), ${vars.colors.background.base})` : vars.colors.background.base,
|
|
48
|
+
color: isSelected ? vars.colors.interactive.selected : vars.colors.foreground.muted,
|
|
49
|
+
cursor: 'pointer',
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flexDirection: 'column',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
gap: vars.spacing(0.5),
|
|
55
|
+
padding: vars.spacing(1.5, 1, 1),
|
|
56
|
+
border: `1px solid ${isSelected ? vars.colors.interactive.selected : vars.colors.border.base}`,
|
|
57
|
+
font: vars.typography.font.small,
|
|
58
|
+
fontWeight: vars.typography.fontWeight.medium,
|
|
59
|
+
borderRadius: vars.radius.base,
|
|
60
|
+
transition: vars.transition(['border-color', 'background-color', 'color'], {
|
|
61
|
+
duration: vars.transitions.duration.short,
|
|
62
|
+
easing: vars.transitions.easing.easeInOut
|
|
63
|
+
}),
|
|
64
|
+
'&:hover': {
|
|
65
|
+
backgroundColor: isSelected ? `color-mix(in srgb, ${vars.colors.interactive.selected} calc(${vars.colors.interactive.selectedOpacity} * 100%), ${vars.colors.background.base})` : vars.colors.interactive.hover
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
function GridChartsPanelChart(props) {
|
|
70
|
+
const {
|
|
71
|
+
schema,
|
|
72
|
+
selectedChartType,
|
|
73
|
+
onChartTypeChange
|
|
74
|
+
} = props;
|
|
75
|
+
const rootProps = useGridRootProps();
|
|
76
|
+
const classes = useUtilityClasses(rootProps);
|
|
77
|
+
return /*#__PURE__*/_jsx(GridChartsManagementRoot, {
|
|
78
|
+
ownerState: rootProps,
|
|
79
|
+
className: classes.root,
|
|
80
|
+
children: /*#__PURE__*/_jsx(GridChartTypeRoot, {
|
|
81
|
+
className: classes.chartTypeRoot,
|
|
82
|
+
children: Object.entries(schema).map(([type, config]) => /*#__PURE__*/_jsxs(GridChartTypeButton, _extends({
|
|
83
|
+
className: classes.button,
|
|
84
|
+
isSelected: type === selectedChartType,
|
|
85
|
+
onClick: () => onChartTypeChange(type)
|
|
86
|
+
}, rootProps.slotProps?.baseButton, {
|
|
87
|
+
children: [/*#__PURE__*/_jsx(config.icon, {
|
|
88
|
+
style: {
|
|
89
|
+
width: 32,
|
|
90
|
+
height: 32
|
|
91
|
+
}
|
|
92
|
+
}), config.label]
|
|
93
|
+
}), type))
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
process.env.NODE_ENV !== "production" ? GridChartsPanelChart.propTypes = {
|
|
98
|
+
// ----------------------------- Warning --------------------------------
|
|
99
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
100
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
101
|
+
// ----------------------------------------------------------------------
|
|
102
|
+
schema: PropTypes.object
|
|
103
|
+
} : void 0;
|
|
104
|
+
export { GridChartsPanelChart };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GridChartsConfigurationSection } from '@mui/x-internals/types';
|
|
3
|
+
interface GridChartsPanelCustomizeProps {
|
|
4
|
+
activeChartId: string;
|
|
5
|
+
sections: GridChartsConfigurationSection[];
|
|
6
|
+
}
|
|
7
|
+
export declare function GridChartsPanelCustomize(props: GridChartsPanelCustomizeProps): React.JSX.Element;
|
|
8
|
+
export {};
|