@mui/x-charts-pro 8.5.2 → 8.6.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 +203 -11
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +1 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +20 -31
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +1 -8
- package/ChartZoomSlider/internals/zoom-utils.d.ts +3 -1
- package/ChartZoomSlider/internals/zoom-utils.js +19 -8
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.d.ts +27 -0
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +77 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.d.ts +33 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +75 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +16 -3
- package/ChartsToolbarPro/ChartsToolbarPro.js +118 -8
- package/ChartsToolbarPro/index.d.ts +3 -1
- package/ChartsToolbarPro/index.js +22 -0
- package/ChartsToolbarPro/internals/ChartsMenu.d.ts +14 -0
- package/ChartsToolbarPro/internals/ChartsMenu.js +73 -0
- package/ChartsToolbarPro/internals/ChartsToolbarDivider.d.ts +5 -0
- package/ChartsToolbarPro/internals/ChartsToolbarDivider.js +47 -0
- package/FunnelChart/FunnelPlot.js +56 -40
- package/FunnelChart/FunnelSection.js +2 -0
- package/FunnelChart/curves/bump.d.ts +3 -3
- package/FunnelChart/curves/bump.js +3 -0
- package/FunnelChart/curves/curve.types.d.ts +14 -1
- package/FunnelChart/curves/getFunnelCurve.d.ts +7 -2
- package/FunnelChart/curves/linear.d.ts +3 -3
- package/FunnelChart/curves/linear.js +23 -18
- package/FunnelChart/curves/pyramid.d.ts +3 -3
- package/FunnelChart/curves/pyramid.js +17 -12
- package/FunnelChart/curves/step-pyramid.d.ts +5 -5
- package/FunnelChart/curves/step-pyramid.js +20 -18
- package/FunnelChart/curves/step.d.ts +3 -3
- package/FunnelChart/curves/step.js +14 -12
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +18 -1444
- package/FunnelChart/labelUtils.d.ts +4 -12
- package/FunnelChart/labelUtils.js +43 -44
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +21 -32
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +1 -8
- package/esm/ChartZoomSlider/internals/zoom-utils.d.ts +3 -1
- package/esm/ChartZoomSlider/internals/zoom-utils.js +19 -9
- package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.d.ts +27 -0
- package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +70 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.d.ts +33 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +68 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +16 -3
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +120 -8
- package/esm/ChartsToolbarPro/index.d.ts +3 -1
- package/esm/ChartsToolbarPro/index.js +3 -1
- package/esm/ChartsToolbarPro/internals/ChartsMenu.d.ts +14 -0
- package/esm/ChartsToolbarPro/internals/ChartsMenu.js +67 -0
- package/esm/ChartsToolbarPro/internals/ChartsToolbarDivider.d.ts +5 -0
- package/esm/ChartsToolbarPro/internals/ChartsToolbarDivider.js +40 -0
- package/esm/FunnelChart/FunnelPlot.js +56 -40
- package/esm/FunnelChart/FunnelSection.js +2 -0
- package/esm/FunnelChart/curves/bump.d.ts +3 -3
- package/esm/FunnelChart/curves/bump.js +3 -0
- package/esm/FunnelChart/curves/curve.types.d.ts +14 -1
- package/esm/FunnelChart/curves/getFunnelCurve.d.ts +7 -2
- package/esm/FunnelChart/curves/linear.d.ts +3 -3
- package/esm/FunnelChart/curves/linear.js +23 -18
- package/esm/FunnelChart/curves/pyramid.d.ts +3 -3
- package/esm/FunnelChart/curves/pyramid.js +17 -12
- package/esm/FunnelChart/curves/step-pyramid.d.ts +5 -5
- package/esm/FunnelChart/curves/step-pyramid.js +20 -18
- package/esm/FunnelChart/curves/step.d.ts +3 -3
- package/esm/FunnelChart/curves/step.js +14 -12
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +18 -1444
- package/esm/FunnelChart/labelUtils.d.ts +4 -12
- package/esm/FunnelChart/labelUtils.js +43 -44
- package/esm/index.d.ts +2 -1
- package/esm/index.js +1 -1
- package/esm/internals/material/components/BaseMenuItem.d.ts +3 -0
- package/esm/internals/material/components/BaseMenuItem.js +27 -0
- package/esm/internals/material/components/BasePopper.d.ts +3 -0
- package/esm/internals/material/components/BasePopper.js +122 -0
- package/esm/internals/material/icons.d.ts +2 -1
- package/esm/internals/material/icons.js +4 -1
- package/esm/internals/material/index.d.ts +1 -0
- package/esm/internals/material/index.js +12 -3
- package/esm/internals/plugins/useChartProExport/print.js +1 -1
- package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +7 -6
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +16 -595
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +2 -2
- package/esm/internals/slots/chartBaseSlotProps.d.ts +50 -3
- package/esm/internals/slots/chartsBaseSlots.d.ts +5 -1
- package/esm/internals/slots/chartsIconSlots.d.ts +5 -0
- package/index.d.ts +2 -1
- package/index.js +1 -1
- package/internals/material/components/BaseMenuItem.d.ts +3 -0
- package/internals/material/components/BaseMenuItem.js +35 -0
- package/internals/material/components/BasePopper.d.ts +3 -0
- package/internals/material/components/BasePopper.js +130 -0
- package/internals/material/icons.d.ts +2 -1
- package/internals/material/icons.js +5 -2
- package/internals/material/index.d.ts +1 -0
- package/internals/material/index.js +11 -2
- package/internals/plugins/useChartProExport/print.js +1 -1
- package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +7 -6
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +16 -595
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +2 -2
- package/internals/slots/chartBaseSlotProps.d.ts +50 -3
- package/internals/slots/chartsBaseSlots.d.ts +5 -1
- package/internals/slots/chartsIconSlots.d.ts +5 -0
- package/package.json +5 -5
- package/FunnelChart/positionGetter.d.ts +0 -1
- package/FunnelChart/positionGetter.js +0 -5
- package/esm/FunnelChart/positionGetter.d.ts +0 -1
- package/esm/FunnelChart/positionGetter.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { FunnelLabelOptions } from "./funnel.types.js";
|
|
2
|
+
import { Point } from "./curves/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* It tries to keep the label inside the bounds of the section based on the position.
|
|
5
5
|
*
|
|
@@ -24,19 +24,11 @@ export declare const alignLabel: ({
|
|
|
24
24
|
export declare const positionLabel: ({
|
|
25
25
|
position,
|
|
26
26
|
offset,
|
|
27
|
-
xPosition,
|
|
28
|
-
yPosition,
|
|
29
27
|
isHorizontal,
|
|
30
|
-
values
|
|
31
|
-
dataIndex,
|
|
32
|
-
baseScaleData
|
|
28
|
+
values
|
|
33
29
|
}: Omit<FunnelLabelOptions, "textAnchor" | "dominantBaseline"> & {
|
|
34
|
-
xPosition: PositionGetter;
|
|
35
|
-
yPosition: PositionGetter;
|
|
36
30
|
isHorizontal: boolean;
|
|
37
|
-
values: readonly
|
|
38
|
-
dataIndex: number;
|
|
39
|
-
baseScaleData: readonly number[];
|
|
31
|
+
values: readonly Point[];
|
|
40
32
|
}) => {
|
|
41
33
|
x: number;
|
|
42
34
|
y: number;
|
|
@@ -39,17 +39,21 @@ export const alignLabel = ({
|
|
|
39
39
|
export const positionLabel = ({
|
|
40
40
|
position,
|
|
41
41
|
offset,
|
|
42
|
-
xPosition,
|
|
43
|
-
yPosition,
|
|
44
42
|
isHorizontal,
|
|
45
|
-
values
|
|
46
|
-
dataIndex,
|
|
47
|
-
baseScaleData
|
|
43
|
+
values
|
|
48
44
|
}) => {
|
|
49
45
|
const vertical = position?.vertical ?? 'middle';
|
|
50
46
|
const horizontal = position?.horizontal ?? 'center';
|
|
51
47
|
let x = 0;
|
|
52
48
|
let y = 0;
|
|
49
|
+
|
|
50
|
+
// The min/max values are due to the sections possibly being sloped.
|
|
51
|
+
// Importance of values differs from the horizontal and vertical sections.
|
|
52
|
+
// Example (vertical):
|
|
53
|
+
// MaxL MaxT MaxR
|
|
54
|
+
// \ /
|
|
55
|
+
// \ /
|
|
56
|
+
// MinL MaxB MinR
|
|
53
57
|
let minTop = 0;
|
|
54
58
|
let maxTop = 0;
|
|
55
59
|
let minBottom = 0;
|
|
@@ -58,56 +62,51 @@ export const positionLabel = ({
|
|
|
58
62
|
let maxLeft = 0;
|
|
59
63
|
let minRight = 0;
|
|
60
64
|
let maxRight = 0;
|
|
61
|
-
let center = 0;
|
|
62
|
-
let leftCenter = 0;
|
|
63
|
-
let rightCenter = 0;
|
|
64
65
|
let middle = 0;
|
|
65
|
-
let
|
|
66
|
-
let bottomMiddle = 0;
|
|
66
|
+
let center = 0;
|
|
67
67
|
const mv = typeof offset === 'number' ? offset : offset?.y ?? 0;
|
|
68
68
|
const mh = typeof offset === 'number' ? offset : offset?.x ?? 0;
|
|
69
|
-
|
|
69
|
+
|
|
70
|
+
// Min ... Max
|
|
71
|
+
const Ys = values.map(v => v.y).toSorted((a, b) => a - b);
|
|
72
|
+
const Xs = values.map(v => v.x).toSorted((a, b) => a - b);
|
|
73
|
+
|
|
74
|
+
// Visualization of the points in a hierarchical order:
|
|
75
|
+
// MaxT
|
|
76
|
+
// MinT
|
|
77
|
+
// MaxL MinL Cent/Mid MinR MaxR
|
|
78
|
+
// MinB
|
|
79
|
+
// MaxB
|
|
70
80
|
if (isHorizontal) {
|
|
71
|
-
maxTop =
|
|
72
|
-
minTop =
|
|
73
|
-
minBottom =
|
|
74
|
-
maxBottom =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
leftCenter = 0;
|
|
81
|
-
rightCenter = 0;
|
|
82
|
-
middle = yPosition(0, dataIndex, baseScaleData[dataIndex], stackOffset) - mv;
|
|
83
|
-
topMiddle = yPosition(values[0].y - (values[0].y - values[1].y) / 2, dataIndex, baseScaleData[dataIndex], stackOffset) - mv;
|
|
84
|
-
bottomMiddle = yPosition(values[3].y - (values[3].y - values[2].y) / 2, dataIndex, baseScaleData[dataIndex], stackOffset) + mv;
|
|
81
|
+
maxTop = Ys.at(0) - mv;
|
|
82
|
+
minTop = Ys.at(1) - mv;
|
|
83
|
+
minBottom = Ys.at(2) + mv;
|
|
84
|
+
maxBottom = (Ys.at(3) ?? Ys.at(2)) + mv;
|
|
85
|
+
maxRight = (Xs.at(3) ?? Xs.at(2)) + mh;
|
|
86
|
+
// We don't need (minRight/minLeft) for horizontal
|
|
87
|
+
maxLeft = Xs.at(0) + mh;
|
|
88
|
+
center = (maxRight + maxLeft) / 2;
|
|
89
|
+
middle = (maxBottom + maxTop) / 2;
|
|
85
90
|
} else {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
rightCenter = xPosition(values[0].x - (values[0].x - values[1].x) / 2, dataIndex, baseScaleData[dataIndex], stackOffset) + mh;
|
|
96
|
-
leftCenter = xPosition(values[3].x - (values[3].x - values[2].x) / 2, dataIndex, baseScaleData[dataIndex], stackOffset) - mh;
|
|
97
|
-
middle = yPosition(values[0].y - (values[0].y - values[1].y) / 2, dataIndex, baseScaleData[dataIndex], stackOffset);
|
|
98
|
-
middle = maxTop - (maxTop - maxBottom) / 2;
|
|
99
|
-
topMiddle = 0;
|
|
100
|
-
bottomMiddle = 0;
|
|
91
|
+
maxTop = Ys.at(0) - mv;
|
|
92
|
+
// We don't need (minTop/minBottom) for vertical
|
|
93
|
+
maxBottom = (Ys.at(3) ?? Ys.at(2)) - mv;
|
|
94
|
+
maxRight = (Xs.at(3) ?? Xs.at(2)) + mh;
|
|
95
|
+
minRight = Xs.at(2) + mh;
|
|
96
|
+
minLeft = Xs.at(1) - mh;
|
|
97
|
+
maxLeft = Xs.at(0) - mh;
|
|
98
|
+
center = (maxRight + maxLeft) / 2;
|
|
99
|
+
middle = (maxBottom + maxTop) / 2;
|
|
101
100
|
}
|
|
102
101
|
if (isHorizontal) {
|
|
103
102
|
if (horizontal === 'center') {
|
|
104
103
|
x = center;
|
|
105
104
|
if (vertical === 'top') {
|
|
106
|
-
y =
|
|
105
|
+
y = (maxTop + minTop) / 2;
|
|
107
106
|
} else if (vertical === 'middle') {
|
|
108
107
|
y = middle;
|
|
109
108
|
} else if (vertical === 'bottom') {
|
|
110
|
-
y =
|
|
109
|
+
y = (maxBottom + minBottom) / 2;
|
|
111
110
|
}
|
|
112
111
|
} else if (horizontal === 'start') {
|
|
113
112
|
x = maxLeft;
|
|
@@ -133,11 +132,11 @@ export const positionLabel = ({
|
|
|
133
132
|
if (vertical === 'middle') {
|
|
134
133
|
y = middle;
|
|
135
134
|
if (horizontal === 'start') {
|
|
136
|
-
x =
|
|
135
|
+
x = (maxLeft + minLeft) / 2;
|
|
137
136
|
} else if (horizontal === 'center') {
|
|
138
137
|
x = center;
|
|
139
138
|
} else if (horizontal === 'end') {
|
|
140
|
-
x =
|
|
139
|
+
x = (maxRight + minRight) / 2;
|
|
141
140
|
}
|
|
142
141
|
} else if (vertical === 'top') {
|
|
143
142
|
y = maxTop;
|
package/esm/index.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ export * from "./PieChartPro/index.js";
|
|
|
37
37
|
export * from "./FunnelChart/index.js";
|
|
38
38
|
export * from "./RadarChartPro/index.js";
|
|
39
39
|
export * from "./ChartZoomSlider/index.js";
|
|
40
|
-
export * from "./ChartsToolbarPro/index.js";
|
|
40
|
+
export * from "./ChartsToolbarPro/index.js";
|
|
41
|
+
export type { ChartImageExportOptions, ChartPrintExportOptions } from "./internals/plugins/useChartProExport/index.js";
|
package/esm/index.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["inert", "iconStart", "iconEnd", "children"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
6
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
7
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export function BaseMenuItem(props) {
|
|
10
|
+
const {
|
|
11
|
+
inert,
|
|
12
|
+
iconStart,
|
|
13
|
+
iconEnd,
|
|
14
|
+
children
|
|
15
|
+
} = props,
|
|
16
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
17
|
+
return /*#__PURE__*/_jsxs(MenuItem, _extends({}, other, {
|
|
18
|
+
disableRipple: inert ? true : other.disableRipple,
|
|
19
|
+
children: [iconStart && /*#__PURE__*/_jsx(ListItemIcon, {
|
|
20
|
+
children: iconStart
|
|
21
|
+
}, "1"), /*#__PURE__*/_jsx(ListItemText, {
|
|
22
|
+
children: children
|
|
23
|
+
}, "2"), iconEnd && /*#__PURE__*/_jsx(ListItemIcon, {
|
|
24
|
+
children: iconEnd
|
|
25
|
+
}, "3")]
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["ref", "open", "children", "className", "clickAwayTouchEvent", "clickAwayMouseEvent", "flip", "focusTrap", "onExited", "onClickAway", "onDidShow", "onDidHide", "id", "target", "transition", "placement"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import Popper from '@mui/material/Popper';
|
|
6
|
+
import MUIFocusTrap from '@mui/material/Unstable_TrapFocus';
|
|
7
|
+
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
8
|
+
import Grow from '@mui/material/Grow';
|
|
9
|
+
import Paper from '@mui/material/Paper';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
function clickAwayWrapper(props, content) {
|
|
12
|
+
if (props.onClickAway === undefined) {
|
|
13
|
+
return content;
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/_jsx(ClickAwayListener, {
|
|
16
|
+
onClickAway: props.onClickAway,
|
|
17
|
+
touchEvent: props.clickAwayTouchEvent,
|
|
18
|
+
mouseEvent: props.clickAwayMouseEvent,
|
|
19
|
+
children: content
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function focusTrapWrapper(props, content) {
|
|
23
|
+
if (props.focusTrap === undefined) {
|
|
24
|
+
return content;
|
|
25
|
+
}
|
|
26
|
+
return /*#__PURE__*/_jsx(MUIFocusTrap, {
|
|
27
|
+
open: true,
|
|
28
|
+
disableEnforceFocus: true,
|
|
29
|
+
disableAutoFocus: true,
|
|
30
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
31
|
+
tabIndex: -1,
|
|
32
|
+
children: content
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function wrappers(props, content) {
|
|
37
|
+
return focusTrapWrapper(props, clickAwayWrapper(props, content));
|
|
38
|
+
}
|
|
39
|
+
const transformOrigin = {
|
|
40
|
+
'bottom-start': 'top left',
|
|
41
|
+
'bottom-end': 'top right'
|
|
42
|
+
};
|
|
43
|
+
export function BasePopper(props) {
|
|
44
|
+
const {
|
|
45
|
+
open,
|
|
46
|
+
children,
|
|
47
|
+
className,
|
|
48
|
+
flip,
|
|
49
|
+
onExited,
|
|
50
|
+
onDidShow,
|
|
51
|
+
onDidHide,
|
|
52
|
+
id,
|
|
53
|
+
target,
|
|
54
|
+
transition,
|
|
55
|
+
placement
|
|
56
|
+
} = props,
|
|
57
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
58
|
+
const modifiers = React.useMemo(() => {
|
|
59
|
+
const result = [{
|
|
60
|
+
name: 'preventOverflow',
|
|
61
|
+
options: {
|
|
62
|
+
padding: 8
|
|
63
|
+
}
|
|
64
|
+
}];
|
|
65
|
+
if (flip) {
|
|
66
|
+
result.push({
|
|
67
|
+
name: 'flip',
|
|
68
|
+
enabled: true,
|
|
69
|
+
options: {
|
|
70
|
+
rootBoundary: 'document'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (onDidShow || onDidHide) {
|
|
75
|
+
result.push({
|
|
76
|
+
name: 'isPlaced',
|
|
77
|
+
enabled: true,
|
|
78
|
+
phase: 'main',
|
|
79
|
+
fn: () => {
|
|
80
|
+
onDidShow?.();
|
|
81
|
+
},
|
|
82
|
+
effect: () => () => {
|
|
83
|
+
onDidHide?.();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}, [flip, onDidShow, onDidHide]);
|
|
89
|
+
let content;
|
|
90
|
+
if (!transition) {
|
|
91
|
+
content = wrappers(props, children);
|
|
92
|
+
} else {
|
|
93
|
+
const handleExited = popperOnExited => node => {
|
|
94
|
+
if (popperOnExited) {
|
|
95
|
+
popperOnExited();
|
|
96
|
+
}
|
|
97
|
+
if (onExited) {
|
|
98
|
+
onExited(node);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
content = p => wrappers(props, /*#__PURE__*/_jsx(Grow, _extends({}, p.TransitionProps, {
|
|
102
|
+
style: {
|
|
103
|
+
transformOrigin: transformOrigin[p.placement]
|
|
104
|
+
},
|
|
105
|
+
onExited: handleExited(p.TransitionProps?.onExited),
|
|
106
|
+
children: /*#__PURE__*/_jsx(Paper, {
|
|
107
|
+
children: children
|
|
108
|
+
})
|
|
109
|
+
})));
|
|
110
|
+
}
|
|
111
|
+
return /*#__PURE__*/_jsx(Popper, _extends({
|
|
112
|
+
id: id,
|
|
113
|
+
className: className,
|
|
114
|
+
open: open,
|
|
115
|
+
anchorEl: target,
|
|
116
|
+
transition: transition,
|
|
117
|
+
placement: placement,
|
|
118
|
+
modifiers: modifiers
|
|
119
|
+
}, rest, {
|
|
120
|
+
children: content
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export declare const ChartsZoomInIcon: (props: import("@mui/x-charts").ChartBaseIconProps) => React.ReactNode;
|
|
3
|
-
export declare const ChartsZoomOutIcon: (props: import("@mui/x-charts").ChartBaseIconProps) => React.ReactNode;
|
|
3
|
+
export declare const ChartsZoomOutIcon: (props: import("@mui/x-charts").ChartBaseIconProps) => React.ReactNode;
|
|
4
|
+
export declare const ChartsExportIcon: (props: import("@mui/x-charts").ChartBaseIconProps) => React.ReactNode;
|
|
@@ -10,4 +10,7 @@ export const ChartsZoomInIcon = createSvgIcon(/*#__PURE__*/_jsxs(React.Fragment,
|
|
|
10
10
|
}), 'ZoomIn');
|
|
11
11
|
export const ChartsZoomOutIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
|
|
12
12
|
d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"
|
|
13
|
-
}), 'ZoomOut');
|
|
13
|
+
}), 'ZoomOut');
|
|
14
|
+
export const ChartsExportIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
|
|
15
|
+
d: "M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z"
|
|
16
|
+
}), 'Export');
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import Tooltip from '@mui/material/Tooltip';
|
|
3
|
+
import MenuList from '@mui/material/MenuList';
|
|
4
|
+
import Divider from '@mui/material/Divider';
|
|
3
5
|
import { defaultSlotsMaterial as communityDefaultSlotsMaterial } from '@mui/x-charts/internals';
|
|
4
|
-
import {
|
|
6
|
+
import { BaseMenuItem } from "./components/BaseMenuItem.js";
|
|
7
|
+
import { BasePopper } from "./components/BasePopper.js";
|
|
8
|
+
import { ChartsExportIcon, ChartsZoomInIcon, ChartsZoomOutIcon } from "./icons.js";
|
|
5
9
|
const baseSlots = {
|
|
6
|
-
baseTooltip: Tooltip
|
|
10
|
+
baseTooltip: Tooltip,
|
|
11
|
+
basePopper: BasePopper,
|
|
12
|
+
baseMenuList: MenuList,
|
|
13
|
+
baseMenuItem: BaseMenuItem,
|
|
14
|
+
baseDivider: Divider
|
|
7
15
|
};
|
|
8
16
|
const iconSlots = {
|
|
9
17
|
zoomInIcon: ChartsZoomInIcon,
|
|
10
|
-
zoomOutIcon: ChartsZoomOutIcon
|
|
18
|
+
zoomOutIcon: ChartsZoomOutIcon,
|
|
19
|
+
exportIcon: ChartsExportIcon
|
|
11
20
|
};
|
|
12
21
|
export const defaultSlotsMaterial = _extends({}, communityDefaultSlotsMaterial, baseSlots, iconSlots);
|
|
@@ -15,7 +15,6 @@ export function printChart(element, {
|
|
|
15
15
|
const rootCandidate = element.getRootNode();
|
|
16
16
|
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
17
17
|
await Promise.all(loadStyleSheets(printDoc, root));
|
|
18
|
-
printWindow.contentWindow.print();
|
|
19
18
|
const mediaQueryList = printWindow.contentWindow.matchMedia('print');
|
|
20
19
|
mediaQueryList.addEventListener('change', mql => {
|
|
21
20
|
const isAfterPrint = mql.matches === false;
|
|
@@ -23,6 +22,7 @@ export function printChart(element, {
|
|
|
23
22
|
doc.body.removeChild(printWindow);
|
|
24
23
|
}
|
|
25
24
|
});
|
|
25
|
+
printWindow.contentWindow.print();
|
|
26
26
|
};
|
|
27
27
|
doc.body.appendChild(printWindow);
|
|
28
28
|
}
|
|
@@ -7,29 +7,30 @@ export interface UseChartProExportState {
|
|
|
7
7
|
/**
|
|
8
8
|
* The options to apply on the Print export.
|
|
9
9
|
* @demos
|
|
10
|
-
* - [Print export](/x/react-charts/export/#print-export-as-pdf)
|
|
10
|
+
* - [Print export](https://mui.com/x/react-charts/export/#print-export-as-pdf)
|
|
11
11
|
*/
|
|
12
12
|
export interface ChartPrintExportOptions {
|
|
13
13
|
/**
|
|
14
|
-
* The
|
|
15
|
-
* @default The title of the
|
|
14
|
+
* The name of the file without the extension.
|
|
15
|
+
* @default The title of the document the chart belongs to
|
|
16
16
|
*/
|
|
17
17
|
fileName?: string;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* The options to apply on the image export.
|
|
21
21
|
* @demos
|
|
22
|
-
* - [Image export](/x/react-charts/export/#export-as-image)
|
|
22
|
+
* - [Image export](https://mui.com/x/react-charts/export/#export-as-image)
|
|
23
23
|
*/
|
|
24
24
|
export interface ChartImageExportOptions {
|
|
25
25
|
/**
|
|
26
|
-
* The
|
|
27
|
-
* @default The title of the
|
|
26
|
+
* The name of the file without the extension.
|
|
27
|
+
* @default The title of the document the chart belongs to
|
|
28
28
|
*/
|
|
29
29
|
fileName?: string;
|
|
30
30
|
/**
|
|
31
31
|
* The format of the image to be exported.
|
|
32
32
|
* Browsers are required to support 'image/png'. Some browsers also support 'image/jpeg' and 'image/webp'.
|
|
33
|
+
* If the provided `type` is not supported by the browser, it will default to 'image/png'.
|
|
33
34
|
* @default 'image/png'
|
|
34
35
|
*/
|
|
35
36
|
type?: 'image/png' | string;
|