@mui/x-charts-pro 8.1.0 → 8.3.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/BarChartPro/BarChartPro.d.ts +7 -1
- package/BarChartPro/BarChartPro.js +62 -5
- package/CHANGELOG.md +233 -7
- package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -2
- package/ChartZoomSlider/ChartZoomSlider.d.ts +5 -0
- package/ChartZoomSlider/ChartZoomSlider.js +47 -0
- package/ChartZoomSlider/index.d.ts +2 -0
- package/ChartZoomSlider/index.js +27 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +23 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +348 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +12 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +92 -0
- package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +17 -0
- package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.js +27 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -0
- package/ChartsToolbarPro/ChartsToolbarPro.js +31 -0
- package/ChartsToolbarPro/index.d.ts +1 -0
- package/ChartsToolbarPro/index.js +16 -0
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +13 -0
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +36 -0
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +13 -0
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +36 -0
- package/FunnelChart/FunnelChart.js +9 -8
- package/FunnelChart/FunnelPlot.d.ts +5 -0
- package/FunnelChart/FunnelPlot.js +36 -18
- package/FunnelChart/FunnelSection.d.ts +1 -0
- package/FunnelChart/FunnelSection.js +12 -7
- package/FunnelChart/curves/borderRadiusPolygon.d.ts +8 -0
- package/FunnelChart/curves/borderRadiusPolygon.js +42 -0
- package/FunnelChart/curves/bump.d.ts +27 -0
- package/FunnelChart/curves/bump.js +81 -0
- package/FunnelChart/curves/curve.types.d.ts +38 -0
- package/FunnelChart/curves/curve.types.js +5 -0
- package/FunnelChart/curves/getFunnelCurve.d.ts +3 -0
- package/FunnelChart/curves/getFunnelCurve.js +30 -0
- package/FunnelChart/curves/index.d.ts +2 -0
- package/FunnelChart/curves/index.js +27 -0
- package/FunnelChart/curves/linear.d.ts +32 -0
- package/FunnelChart/curves/linear.js +88 -0
- package/FunnelChart/curves/pyramid.d.ts +34 -0
- package/FunnelChart/curves/pyramid.js +127 -0
- package/FunnelChart/curves/step-pyramid.d.ts +31 -0
- package/FunnelChart/curves/step-pyramid.js +107 -0
- package/FunnelChart/curves/step.d.ts +32 -0
- package/FunnelChart/curves/step.js +88 -0
- package/FunnelChart/curves/utils.d.ts +4 -0
- package/FunnelChart/curves/utils.js +29 -0
- package/FunnelChart/funnel.types.d.ts +25 -4
- package/FunnelChart/funnelPlotSlots.types.d.ts +1 -1
- package/FunnelChart/funnelSectionClasses.d.ts +6 -2
- package/FunnelChart/funnelSectionClasses.js +5 -2
- package/FunnelChart/index.d.ts +3 -2
- package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +1 -0
- package/FunnelChart/useFunnelChartProps.d.ts +1 -6
- package/FunnelChart/useFunnelChartProps.js +7 -15
- package/Heatmap/Heatmap.d.ts +3 -3
- package/Heatmap/Heatmap.js +3 -21
- package/LineChartPro/LineChartPro.d.ts +7 -1
- package/LineChartPro/LineChartPro.js +62 -5
- package/ScatterChartPro/ScatterChartPro.d.ts +7 -1
- package/ScatterChartPro/ScatterChartPro.js +62 -5
- package/esm/BarChartPro/BarChartPro.d.ts +7 -1
- package/esm/BarChartPro/BarChartPro.js +62 -5
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -2
- package/esm/ChartZoomSlider/ChartZoomSlider.d.ts +5 -0
- package/esm/ChartZoomSlider/ChartZoomSlider.js +41 -0
- package/esm/ChartZoomSlider/index.d.ts +2 -0
- package/esm/ChartZoomSlider/index.js +2 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +23 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +339 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +12 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +85 -0
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +17 -0
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.js +17 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +24 -0
- package/esm/ChartsToolbarPro/index.d.ts +1 -0
- package/esm/ChartsToolbarPro/index.js +1 -0
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +13 -0
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +29 -0
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +13 -0
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +29 -0
- package/esm/FunnelChart/FunnelChart.js +9 -8
- package/esm/FunnelChart/FunnelPlot.d.ts +5 -0
- package/esm/FunnelChart/FunnelPlot.js +37 -19
- package/esm/FunnelChart/FunnelSection.d.ts +1 -0
- package/esm/FunnelChart/FunnelSection.js +12 -7
- package/esm/FunnelChart/curves/borderRadiusPolygon.d.ts +8 -0
- package/esm/FunnelChart/curves/borderRadiusPolygon.js +36 -0
- package/esm/FunnelChart/curves/bump.d.ts +27 -0
- package/esm/FunnelChart/curves/bump.js +74 -0
- package/esm/FunnelChart/curves/curve.types.d.ts +38 -0
- package/esm/FunnelChart/curves/curve.types.js +1 -0
- package/esm/FunnelChart/curves/getFunnelCurve.d.ts +3 -0
- package/esm/FunnelChart/curves/getFunnelCurve.js +23 -0
- package/esm/FunnelChart/curves/index.d.ts +2 -0
- package/esm/FunnelChart/curves/index.js +2 -0
- package/esm/FunnelChart/curves/linear.d.ts +32 -0
- package/esm/FunnelChart/curves/linear.js +82 -0
- package/esm/FunnelChart/curves/pyramid.d.ts +34 -0
- package/esm/FunnelChart/curves/pyramid.js +121 -0
- package/esm/FunnelChart/curves/step-pyramid.d.ts +31 -0
- package/esm/FunnelChart/curves/step-pyramid.js +101 -0
- package/esm/FunnelChart/curves/step.d.ts +32 -0
- package/esm/FunnelChart/curves/step.js +82 -0
- package/esm/FunnelChart/curves/utils.d.ts +4 -0
- package/esm/FunnelChart/curves/utils.js +19 -0
- package/esm/FunnelChart/funnel.types.d.ts +25 -4
- package/esm/FunnelChart/funnelPlotSlots.types.d.ts +1 -1
- package/esm/FunnelChart/funnelSectionClasses.d.ts +6 -2
- package/esm/FunnelChart/funnelSectionClasses.js +5 -2
- package/esm/FunnelChart/index.d.ts +3 -2
- package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +1 -0
- package/esm/FunnelChart/useFunnelChartProps.d.ts +1 -6
- package/esm/FunnelChart/useFunnelChartProps.js +7 -15
- package/esm/Heatmap/Heatmap.d.ts +3 -3
- package/esm/Heatmap/Heatmap.js +3 -21
- package/esm/LineChartPro/LineChartPro.d.ts +7 -1
- package/esm/LineChartPro/LineChartPro.js +62 -5
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +7 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +62 -5
- package/esm/index.d.ts +4 -1
- package/esm/index.js +5 -2
- package/esm/internals/material/icons.d.ts +3 -0
- package/esm/internals/material/icons.js +13 -0
- package/esm/internals/material/index.d.ts +4 -0
- package/esm/internals/material/index.js +12 -0
- package/esm/internals/plugins/useChartProExport/common.d.ts +1 -0
- package/esm/internals/plugins/useChartProExport/common.js +8 -0
- package/esm/internals/plugins/useChartProExport/exportImage.d.ts +3 -0
- package/esm/internals/plugins/useChartProExport/exportImage.js +85 -0
- package/esm/internals/plugins/useChartProExport/print.js +6 -50
- package/esm/internals/plugins/useChartProExport/useChartProExport.js +22 -2
- package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +32 -0
- package/esm/internals/plugins/useChartProZoom/calculateZoom.d.ts +23 -0
- package/esm/internals/plugins/useChartProZoom/calculateZoom.js +32 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.d.ts +1 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +46 -4
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +84 -32
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +3 -2
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +17 -2
- package/esm/internals/slots/chartBaseSlotProps.d.ts +10 -0
- package/esm/internals/slots/chartBaseSlotProps.js +1 -0
- package/esm/internals/slots/chartsBaseSlots.d.ts +6 -0
- package/esm/internals/slots/chartsBaseSlots.js +1 -0
- package/esm/internals/slots/chartsIconSlots.d.ts +14 -0
- package/esm/internals/slots/chartsIconSlots.js +1 -0
- package/esm/themeAugmentation/components.d.ts +0 -4
- package/esm/themeAugmentation/components.js +1 -0
- package/esm/themeAugmentation/index.d.ts +3 -3
- package/esm/themeAugmentation/overrides.d.ts +0 -3
- package/esm/themeAugmentation/overrides.js +2 -0
- package/esm/themeAugmentation/props.d.ts +0 -6
- package/esm/themeAugmentation/props.js +2 -0
- package/esm/typeOverloads/modules.d.ts +1 -1
- package/index.d.ts +4 -1
- package/index.js +90 -1
- package/internals/material/icons.d.ts +3 -0
- package/internals/material/icons.js +20 -0
- package/internals/material/index.d.ts +4 -0
- package/internals/material/index.js +19 -0
- package/internals/plugins/useChartProExport/common.d.ts +1 -0
- package/internals/plugins/useChartProExport/common.js +14 -0
- package/internals/plugins/useChartProExport/exportImage.d.ts +3 -0
- package/internals/plugins/useChartProExport/exportImage.js +95 -0
- package/internals/plugins/useChartProExport/print.js +6 -50
- package/internals/plugins/useChartProExport/useChartProExport.js +22 -2
- package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +32 -0
- package/internals/plugins/useChartProZoom/calculateZoom.d.ts +23 -0
- package/internals/plugins/useChartProZoom/calculateZoom.js +39 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.js +45 -3
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +84 -32
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +3 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +17 -2
- package/internals/slots/chartBaseSlotProps.d.ts +10 -0
- package/internals/slots/chartBaseSlotProps.js +5 -0
- package/internals/slots/chartsBaseSlots.d.ts +6 -0
- package/internals/slots/chartsBaseSlots.js +5 -0
- package/internals/slots/chartsIconSlots.d.ts +14 -0
- package/internals/slots/chartsIconSlots.js +5 -0
- package/package.json +10 -7
- package/themeAugmentation/components.d.ts +0 -4
- package/themeAugmentation/components.js +5 -0
- package/themeAugmentation/index.d.ts +3 -3
- package/themeAugmentation/overrides.d.ts +0 -3
- package/themeAugmentation/overrides.js +5 -0
- package/themeAugmentation/props.d.ts +0 -6
- package/themeAugmentation/props.js +5 -0
- package/typeOverloads/modules.d.ts +1 -1
- package/FunnelChart/funnelStepCurve.d.ts +0 -4
- package/FunnelChart/funnelStepCurve.js +0 -74
- package/esm/FunnelChart/funnelStepCurve.d.ts +0 -4
- package/esm/FunnelChart/funnelStepCurve.js +0 -67
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts-pro v8.
|
|
2
|
+
* @mui/x-charts-pro v8.3.0
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -10,10 +10,41 @@
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", {
|
|
11
11
|
value: true
|
|
12
12
|
});
|
|
13
|
+
var _exportNames = {
|
|
14
|
+
ZoomData: true,
|
|
15
|
+
ZoomFilterMode: true,
|
|
16
|
+
ZoomOptions: true,
|
|
17
|
+
ZoomSliderOptions: true
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "ZoomData", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _internals.ZoomData;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "ZoomFilterMode", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _internals.ZoomFilterMode;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "ZoomOptions", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _internals.ZoomOptions;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "ZoomSliderOptions", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _internals.ZoomSliderOptions;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
13
43
|
require("./typeOverloads/modules");
|
|
14
44
|
var _constants = require("@mui/x-charts/constants");
|
|
15
45
|
Object.keys(_constants).forEach(function (key) {
|
|
16
46
|
if (key === "default" || key === "__esModule") return;
|
|
47
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
17
48
|
if (key in exports && exports[key] === _constants[key]) return;
|
|
18
49
|
Object.defineProperty(exports, key, {
|
|
19
50
|
enumerable: true,
|
|
@@ -25,6 +56,7 @@ Object.keys(_constants).forEach(function (key) {
|
|
|
25
56
|
var _context = require("@mui/x-charts/context");
|
|
26
57
|
Object.keys(_context).forEach(function (key) {
|
|
27
58
|
if (key === "default" || key === "__esModule") return;
|
|
59
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
60
|
if (key in exports && exports[key] === _context[key]) return;
|
|
29
61
|
Object.defineProperty(exports, key, {
|
|
30
62
|
enumerable: true,
|
|
@@ -36,6 +68,7 @@ Object.keys(_context).forEach(function (key) {
|
|
|
36
68
|
var _hooks = require("@mui/x-charts/hooks");
|
|
37
69
|
Object.keys(_hooks).forEach(function (key) {
|
|
38
70
|
if (key === "default" || key === "__esModule") return;
|
|
71
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
39
72
|
if (key in exports && exports[key] === _hooks[key]) return;
|
|
40
73
|
Object.defineProperty(exports, key, {
|
|
41
74
|
enumerable: true,
|
|
@@ -47,6 +80,7 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
47
80
|
var _colorPalettes = require("@mui/x-charts/colorPalettes");
|
|
48
81
|
Object.keys(_colorPalettes).forEach(function (key) {
|
|
49
82
|
if (key === "default" || key === "__esModule") return;
|
|
83
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
84
|
if (key in exports && exports[key] === _colorPalettes[key]) return;
|
|
51
85
|
Object.defineProperty(exports, key, {
|
|
52
86
|
enumerable: true,
|
|
@@ -58,6 +92,7 @@ Object.keys(_colorPalettes).forEach(function (key) {
|
|
|
58
92
|
var _models = require("@mui/x-charts/models");
|
|
59
93
|
Object.keys(_models).forEach(function (key) {
|
|
60
94
|
if (key === "default" || key === "__esModule") return;
|
|
95
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
61
96
|
if (key in exports && exports[key] === _models[key]) return;
|
|
62
97
|
Object.defineProperty(exports, key, {
|
|
63
98
|
enumerable: true,
|
|
@@ -69,6 +104,7 @@ Object.keys(_models).forEach(function (key) {
|
|
|
69
104
|
var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
70
105
|
Object.keys(_ChartsClipPath).forEach(function (key) {
|
|
71
106
|
if (key === "default" || key === "__esModule") return;
|
|
107
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
72
108
|
if (key in exports && exports[key] === _ChartsClipPath[key]) return;
|
|
73
109
|
Object.defineProperty(exports, key, {
|
|
74
110
|
enumerable: true,
|
|
@@ -80,6 +116,7 @@ Object.keys(_ChartsClipPath).forEach(function (key) {
|
|
|
80
116
|
var _ChartsReferenceLine = require("@mui/x-charts/ChartsReferenceLine");
|
|
81
117
|
Object.keys(_ChartsReferenceLine).forEach(function (key) {
|
|
82
118
|
if (key === "default" || key === "__esModule") return;
|
|
119
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
83
120
|
if (key in exports && exports[key] === _ChartsReferenceLine[key]) return;
|
|
84
121
|
Object.defineProperty(exports, key, {
|
|
85
122
|
enumerable: true,
|
|
@@ -91,6 +128,7 @@ Object.keys(_ChartsReferenceLine).forEach(function (key) {
|
|
|
91
128
|
var _ChartsAxis = require("@mui/x-charts/ChartsAxis");
|
|
92
129
|
Object.keys(_ChartsAxis).forEach(function (key) {
|
|
93
130
|
if (key === "default" || key === "__esModule") return;
|
|
131
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
94
132
|
if (key in exports && exports[key] === _ChartsAxis[key]) return;
|
|
95
133
|
Object.defineProperty(exports, key, {
|
|
96
134
|
enumerable: true,
|
|
@@ -102,6 +140,7 @@ Object.keys(_ChartsAxis).forEach(function (key) {
|
|
|
102
140
|
var _ChartsXAxis = require("@mui/x-charts/ChartsXAxis");
|
|
103
141
|
Object.keys(_ChartsXAxis).forEach(function (key) {
|
|
104
142
|
if (key === "default" || key === "__esModule") return;
|
|
143
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
105
144
|
if (key in exports && exports[key] === _ChartsXAxis[key]) return;
|
|
106
145
|
Object.defineProperty(exports, key, {
|
|
107
146
|
enumerable: true,
|
|
@@ -113,6 +152,7 @@ Object.keys(_ChartsXAxis).forEach(function (key) {
|
|
|
113
152
|
var _ChartsYAxis = require("@mui/x-charts/ChartsYAxis");
|
|
114
153
|
Object.keys(_ChartsYAxis).forEach(function (key) {
|
|
115
154
|
if (key === "default" || key === "__esModule") return;
|
|
155
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
116
156
|
if (key in exports && exports[key] === _ChartsYAxis[key]) return;
|
|
117
157
|
Object.defineProperty(exports, key, {
|
|
118
158
|
enumerable: true,
|
|
@@ -124,6 +164,7 @@ Object.keys(_ChartsYAxis).forEach(function (key) {
|
|
|
124
164
|
var _ChartsGrid = require("@mui/x-charts/ChartsGrid");
|
|
125
165
|
Object.keys(_ChartsGrid).forEach(function (key) {
|
|
126
166
|
if (key === "default" || key === "__esModule") return;
|
|
167
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
127
168
|
if (key in exports && exports[key] === _ChartsGrid[key]) return;
|
|
128
169
|
Object.defineProperty(exports, key, {
|
|
129
170
|
enumerable: true,
|
|
@@ -135,6 +176,7 @@ Object.keys(_ChartsGrid).forEach(function (key) {
|
|
|
135
176
|
var _ChartsText = require("@mui/x-charts/ChartsText");
|
|
136
177
|
Object.keys(_ChartsText).forEach(function (key) {
|
|
137
178
|
if (key === "default" || key === "__esModule") return;
|
|
179
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
138
180
|
if (key in exports && exports[key] === _ChartsText[key]) return;
|
|
139
181
|
Object.defineProperty(exports, key, {
|
|
140
182
|
enumerable: true,
|
|
@@ -146,6 +188,7 @@ Object.keys(_ChartsText).forEach(function (key) {
|
|
|
146
188
|
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
147
189
|
Object.keys(_ChartsTooltip).forEach(function (key) {
|
|
148
190
|
if (key === "default" || key === "__esModule") return;
|
|
191
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
149
192
|
if (key in exports && exports[key] === _ChartsTooltip[key]) return;
|
|
150
193
|
Object.defineProperty(exports, key, {
|
|
151
194
|
enumerable: true,
|
|
@@ -157,6 +200,7 @@ Object.keys(_ChartsTooltip).forEach(function (key) {
|
|
|
157
200
|
var _ChartsLegend = require("@mui/x-charts/ChartsLegend");
|
|
158
201
|
Object.keys(_ChartsLegend).forEach(function (key) {
|
|
159
202
|
if (key === "default" || key === "__esModule") return;
|
|
203
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
160
204
|
if (key in exports && exports[key] === _ChartsLegend[key]) return;
|
|
161
205
|
Object.defineProperty(exports, key, {
|
|
162
206
|
enumerable: true,
|
|
@@ -168,6 +212,7 @@ Object.keys(_ChartsLegend).forEach(function (key) {
|
|
|
168
212
|
var _ChartsLocalizationProvider = require("@mui/x-charts/ChartsLocalizationProvider");
|
|
169
213
|
Object.keys(_ChartsLocalizationProvider).forEach(function (key) {
|
|
170
214
|
if (key === "default" || key === "__esModule") return;
|
|
215
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
171
216
|
if (key in exports && exports[key] === _ChartsLocalizationProvider[key]) return;
|
|
172
217
|
Object.defineProperty(exports, key, {
|
|
173
218
|
enumerable: true,
|
|
@@ -179,6 +224,7 @@ Object.keys(_ChartsLocalizationProvider).forEach(function (key) {
|
|
|
179
224
|
var _ChartsAxisHighlight = require("@mui/x-charts/ChartsAxisHighlight");
|
|
180
225
|
Object.keys(_ChartsAxisHighlight).forEach(function (key) {
|
|
181
226
|
if (key === "default" || key === "__esModule") return;
|
|
227
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
182
228
|
if (key in exports && exports[key] === _ChartsAxisHighlight[key]) return;
|
|
183
229
|
Object.defineProperty(exports, key, {
|
|
184
230
|
enumerable: true,
|
|
@@ -190,6 +236,7 @@ Object.keys(_ChartsAxisHighlight).forEach(function (key) {
|
|
|
190
236
|
var _BarChart = require("@mui/x-charts/BarChart");
|
|
191
237
|
Object.keys(_BarChart).forEach(function (key) {
|
|
192
238
|
if (key === "default" || key === "__esModule") return;
|
|
239
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
193
240
|
if (key in exports && exports[key] === _BarChart[key]) return;
|
|
194
241
|
Object.defineProperty(exports, key, {
|
|
195
242
|
enumerable: true,
|
|
@@ -201,6 +248,7 @@ Object.keys(_BarChart).forEach(function (key) {
|
|
|
201
248
|
var _LineChart = require("@mui/x-charts/LineChart");
|
|
202
249
|
Object.keys(_LineChart).forEach(function (key) {
|
|
203
250
|
if (key === "default" || key === "__esModule") return;
|
|
251
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
204
252
|
if (key in exports && exports[key] === _LineChart[key]) return;
|
|
205
253
|
Object.defineProperty(exports, key, {
|
|
206
254
|
enumerable: true,
|
|
@@ -212,6 +260,7 @@ Object.keys(_LineChart).forEach(function (key) {
|
|
|
212
260
|
var _PieChart = require("@mui/x-charts/PieChart");
|
|
213
261
|
Object.keys(_PieChart).forEach(function (key) {
|
|
214
262
|
if (key === "default" || key === "__esModule") return;
|
|
263
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
215
264
|
if (key in exports && exports[key] === _PieChart[key]) return;
|
|
216
265
|
Object.defineProperty(exports, key, {
|
|
217
266
|
enumerable: true,
|
|
@@ -223,6 +272,7 @@ Object.keys(_PieChart).forEach(function (key) {
|
|
|
223
272
|
var _ScatterChart = require("@mui/x-charts/ScatterChart");
|
|
224
273
|
Object.keys(_ScatterChart).forEach(function (key) {
|
|
225
274
|
if (key === "default" || key === "__esModule") return;
|
|
275
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
226
276
|
if (key in exports && exports[key] === _ScatterChart[key]) return;
|
|
227
277
|
Object.defineProperty(exports, key, {
|
|
228
278
|
enumerable: true,
|
|
@@ -234,6 +284,7 @@ Object.keys(_ScatterChart).forEach(function (key) {
|
|
|
234
284
|
var _SparkLineChart = require("@mui/x-charts/SparkLineChart");
|
|
235
285
|
Object.keys(_SparkLineChart).forEach(function (key) {
|
|
236
286
|
if (key === "default" || key === "__esModule") return;
|
|
287
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
237
288
|
if (key in exports && exports[key] === _SparkLineChart[key]) return;
|
|
238
289
|
Object.defineProperty(exports, key, {
|
|
239
290
|
enumerable: true,
|
|
@@ -245,6 +296,7 @@ Object.keys(_SparkLineChart).forEach(function (key) {
|
|
|
245
296
|
var _Gauge = require("@mui/x-charts/Gauge");
|
|
246
297
|
Object.keys(_Gauge).forEach(function (key) {
|
|
247
298
|
if (key === "default" || key === "__esModule") return;
|
|
299
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
248
300
|
if (key in exports && exports[key] === _Gauge[key]) return;
|
|
249
301
|
Object.defineProperty(exports, key, {
|
|
250
302
|
enumerable: true,
|
|
@@ -256,6 +308,7 @@ Object.keys(_Gauge).forEach(function (key) {
|
|
|
256
308
|
var _RadarChart = require("@mui/x-charts/RadarChart");
|
|
257
309
|
Object.keys(_RadarChart).forEach(function (key) {
|
|
258
310
|
if (key === "default" || key === "__esModule") return;
|
|
311
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
259
312
|
if (key in exports && exports[key] === _RadarChart[key]) return;
|
|
260
313
|
Object.defineProperty(exports, key, {
|
|
261
314
|
enumerable: true,
|
|
@@ -267,6 +320,7 @@ Object.keys(_RadarChart).forEach(function (key) {
|
|
|
267
320
|
var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
|
|
268
321
|
Object.keys(_ChartsSurface).forEach(function (key) {
|
|
269
322
|
if (key === "default" || key === "__esModule") return;
|
|
323
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
270
324
|
if (key in exports && exports[key] === _ChartsSurface[key]) return;
|
|
271
325
|
Object.defineProperty(exports, key, {
|
|
272
326
|
enumerable: true,
|
|
@@ -278,6 +332,7 @@ Object.keys(_ChartsSurface).forEach(function (key) {
|
|
|
278
332
|
var _ChartDataProvider = require("@mui/x-charts/ChartDataProvider");
|
|
279
333
|
Object.keys(_ChartDataProvider).forEach(function (key) {
|
|
280
334
|
if (key === "default" || key === "__esModule") return;
|
|
335
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
281
336
|
if (key in exports && exports[key] === _ChartDataProvider[key]) return;
|
|
282
337
|
Object.defineProperty(exports, key, {
|
|
283
338
|
enumerable: true,
|
|
@@ -289,6 +344,7 @@ Object.keys(_ChartDataProvider).forEach(function (key) {
|
|
|
289
344
|
var _ChartsLabel = require("@mui/x-charts/ChartsLabel");
|
|
290
345
|
Object.keys(_ChartsLabel).forEach(function (key) {
|
|
291
346
|
if (key === "default" || key === "__esModule") return;
|
|
347
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
292
348
|
if (key in exports && exports[key] === _ChartsLabel[key]) return;
|
|
293
349
|
Object.defineProperty(exports, key, {
|
|
294
350
|
enumerable: true,
|
|
@@ -297,9 +353,11 @@ Object.keys(_ChartsLabel).forEach(function (key) {
|
|
|
297
353
|
}
|
|
298
354
|
});
|
|
299
355
|
});
|
|
356
|
+
var _internals = require("@mui/x-charts/internals");
|
|
300
357
|
var _hooks2 = require("./hooks");
|
|
301
358
|
Object.keys(_hooks2).forEach(function (key) {
|
|
302
359
|
if (key === "default" || key === "__esModule") return;
|
|
360
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
303
361
|
if (key in exports && exports[key] === _hooks2[key]) return;
|
|
304
362
|
Object.defineProperty(exports, key, {
|
|
305
363
|
enumerable: true,
|
|
@@ -311,6 +369,7 @@ Object.keys(_hooks2).forEach(function (key) {
|
|
|
311
369
|
var _Heatmap = require("./Heatmap");
|
|
312
370
|
Object.keys(_Heatmap).forEach(function (key) {
|
|
313
371
|
if (key === "default" || key === "__esModule") return;
|
|
372
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
314
373
|
if (key in exports && exports[key] === _Heatmap[key]) return;
|
|
315
374
|
Object.defineProperty(exports, key, {
|
|
316
375
|
enumerable: true,
|
|
@@ -322,6 +381,7 @@ Object.keys(_Heatmap).forEach(function (key) {
|
|
|
322
381
|
var _ChartContainerPro = require("./ChartContainerPro");
|
|
323
382
|
Object.keys(_ChartContainerPro).forEach(function (key) {
|
|
324
383
|
if (key === "default" || key === "__esModule") return;
|
|
384
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
325
385
|
if (key in exports && exports[key] === _ChartContainerPro[key]) return;
|
|
326
386
|
Object.defineProperty(exports, key, {
|
|
327
387
|
enumerable: true,
|
|
@@ -333,6 +393,7 @@ Object.keys(_ChartContainerPro).forEach(function (key) {
|
|
|
333
393
|
var _ChartDataProviderPro = require("./ChartDataProviderPro");
|
|
334
394
|
Object.keys(_ChartDataProviderPro).forEach(function (key) {
|
|
335
395
|
if (key === "default" || key === "__esModule") return;
|
|
396
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
336
397
|
if (key in exports && exports[key] === _ChartDataProviderPro[key]) return;
|
|
337
398
|
Object.defineProperty(exports, key, {
|
|
338
399
|
enumerable: true,
|
|
@@ -344,6 +405,7 @@ Object.keys(_ChartDataProviderPro).forEach(function (key) {
|
|
|
344
405
|
var _ScatterChartPro = require("./ScatterChartPro");
|
|
345
406
|
Object.keys(_ScatterChartPro).forEach(function (key) {
|
|
346
407
|
if (key === "default" || key === "__esModule") return;
|
|
408
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
347
409
|
if (key in exports && exports[key] === _ScatterChartPro[key]) return;
|
|
348
410
|
Object.defineProperty(exports, key, {
|
|
349
411
|
enumerable: true,
|
|
@@ -355,6 +417,7 @@ Object.keys(_ScatterChartPro).forEach(function (key) {
|
|
|
355
417
|
var _BarChartPro = require("./BarChartPro");
|
|
356
418
|
Object.keys(_BarChartPro).forEach(function (key) {
|
|
357
419
|
if (key === "default" || key === "__esModule") return;
|
|
420
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
358
421
|
if (key in exports && exports[key] === _BarChartPro[key]) return;
|
|
359
422
|
Object.defineProperty(exports, key, {
|
|
360
423
|
enumerable: true,
|
|
@@ -366,6 +429,7 @@ Object.keys(_BarChartPro).forEach(function (key) {
|
|
|
366
429
|
var _LineChartPro = require("./LineChartPro");
|
|
367
430
|
Object.keys(_LineChartPro).forEach(function (key) {
|
|
368
431
|
if (key === "default" || key === "__esModule") return;
|
|
432
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
369
433
|
if (key in exports && exports[key] === _LineChartPro[key]) return;
|
|
370
434
|
Object.defineProperty(exports, key, {
|
|
371
435
|
enumerable: true,
|
|
@@ -377,6 +441,7 @@ Object.keys(_LineChartPro).forEach(function (key) {
|
|
|
377
441
|
var _FunnelChart = require("./FunnelChart");
|
|
378
442
|
Object.keys(_FunnelChart).forEach(function (key) {
|
|
379
443
|
if (key === "default" || key === "__esModule") return;
|
|
444
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
380
445
|
if (key in exports && exports[key] === _FunnelChart[key]) return;
|
|
381
446
|
Object.defineProperty(exports, key, {
|
|
382
447
|
enumerable: true,
|
|
@@ -384,4 +449,28 @@ Object.keys(_FunnelChart).forEach(function (key) {
|
|
|
384
449
|
return _FunnelChart[key];
|
|
385
450
|
}
|
|
386
451
|
});
|
|
452
|
+
});
|
|
453
|
+
var _ChartZoomSlider = require("./ChartZoomSlider");
|
|
454
|
+
Object.keys(_ChartZoomSlider).forEach(function (key) {
|
|
455
|
+
if (key === "default" || key === "__esModule") return;
|
|
456
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
457
|
+
if (key in exports && exports[key] === _ChartZoomSlider[key]) return;
|
|
458
|
+
Object.defineProperty(exports, key, {
|
|
459
|
+
enumerable: true,
|
|
460
|
+
get: function () {
|
|
461
|
+
return _ChartZoomSlider[key];
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
var _ChartsToolbarPro = require("./ChartsToolbarPro");
|
|
466
|
+
Object.keys(_ChartsToolbarPro).forEach(function (key) {
|
|
467
|
+
if (key === "default" || key === "__esModule") return;
|
|
468
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
469
|
+
if (key in exports && exports[key] === _ChartsToolbarPro[key]) return;
|
|
470
|
+
Object.defineProperty(exports, key, {
|
|
471
|
+
enumerable: true,
|
|
472
|
+
get: function () {
|
|
473
|
+
return _ChartsToolbarPro[key];
|
|
474
|
+
}
|
|
475
|
+
});
|
|
387
476
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ChartsZoomOutIcon = exports.ChartsZoomInIcon = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _internals = require("@mui/x-charts/internals");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
const ChartsZoomInIcon = exports.ChartsZoomInIcon = (0, _internals.createSvgIcon)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
12
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
13
|
+
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 14"
|
|
14
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
15
|
+
d: "M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"
|
|
16
|
+
})]
|
|
17
|
+
}), 'ZoomIn');
|
|
18
|
+
const ChartsZoomOutIcon = exports.ChartsZoomOutIcon = (0, _internals.createSvgIcon)(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
19
|
+
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"
|
|
20
|
+
}), 'ZoomOut');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.defaultSlotsMaterial = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
10
|
+
var _internals = require("@mui/x-charts/internals");
|
|
11
|
+
var _icons = require("./icons");
|
|
12
|
+
const baseSlots = {
|
|
13
|
+
baseTooltip: _Tooltip.default
|
|
14
|
+
};
|
|
15
|
+
const iconSlots = {
|
|
16
|
+
zoomInIcon: _icons.ChartsZoomInIcon,
|
|
17
|
+
zoomOutIcon: _icons.ChartsZoomOutIcon
|
|
18
|
+
};
|
|
19
|
+
const defaultSlotsMaterial = exports.defaultSlotsMaterial = (0, _extends2.default)({}, _internals.defaultSlotsMaterial, baseSlots, iconSlots);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createExportIframe(title?: string): HTMLIFrameElement;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createExportIframe = createExportIframe;
|
|
7
|
+
function createExportIframe(title) {
|
|
8
|
+
const iframeEl = document.createElement('iframe');
|
|
9
|
+
iframeEl.style.position = 'absolute';
|
|
10
|
+
iframeEl.style.width = '0px';
|
|
11
|
+
iframeEl.style.height = '0px';
|
|
12
|
+
iframeEl.title = title || document.title;
|
|
13
|
+
return iframeEl;
|
|
14
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ChartImageExportOptions } from "./useChartProExport.types.js";
|
|
2
|
+
export declare const getDrawDocument: () => Promise<typeof import("rasterizehtml").drawDocument>;
|
|
3
|
+
export declare function exportImage(element: HTMLElement | SVGElement, params?: ChartImageExportOptions): Promise<void>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.exportImage = exportImage;
|
|
8
|
+
exports.getDrawDocument = void 0;
|
|
9
|
+
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
10
|
+
var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"));
|
|
11
|
+
var _export = require("@mui/x-internals/export");
|
|
12
|
+
var _common = require("./common");
|
|
13
|
+
const getDrawDocument = async () => {
|
|
14
|
+
try {
|
|
15
|
+
const module = await Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require('rasterizehtml')));
|
|
16
|
+
return module.drawDocument;
|
|
17
|
+
} catch (error) {
|
|
18
|
+
throw new Error(`MUI X Charts: Failed to import 'rasterizehtml' module. This dependency is mandatory when exporting a chart as an image. Make sure you have it installed as a dependency.`, {
|
|
19
|
+
cause: error
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.getDrawDocument = getDrawDocument;
|
|
24
|
+
async function exportImage(element, params) {
|
|
25
|
+
const {
|
|
26
|
+
fileName,
|
|
27
|
+
type = 'image/png',
|
|
28
|
+
quality = 0.9
|
|
29
|
+
} = params ?? {};
|
|
30
|
+
const drawDocumentPromise = getDrawDocument();
|
|
31
|
+
const {
|
|
32
|
+
width,
|
|
33
|
+
height
|
|
34
|
+
} = element.getBoundingClientRect();
|
|
35
|
+
const doc = (0, _ownerDocument.default)(element);
|
|
36
|
+
const canvas = document.createElement('canvas');
|
|
37
|
+
const ratio = window.devicePixelRatio || 1;
|
|
38
|
+
canvas.width = width * ratio;
|
|
39
|
+
canvas.height = height * ratio;
|
|
40
|
+
canvas.style.width = `${width}px`;
|
|
41
|
+
canvas.style.height = `${height}px`;
|
|
42
|
+
const iframe = (0, _common.createExportIframe)(fileName);
|
|
43
|
+
let resolve;
|
|
44
|
+
const iframeLoadPromise = new Promise(res => {
|
|
45
|
+
resolve = res;
|
|
46
|
+
});
|
|
47
|
+
iframe.onload = async () => {
|
|
48
|
+
const exportDoc = iframe.contentDocument;
|
|
49
|
+
const elementClone = element.cloneNode(true);
|
|
50
|
+
const container = document.createElement('div');
|
|
51
|
+
container.appendChild(elementClone);
|
|
52
|
+
exportDoc.body.innerHTML = container.innerHTML;
|
|
53
|
+
exportDoc.body.style.margin = '0px';
|
|
54
|
+
const rootCandidate = element.getRootNode();
|
|
55
|
+
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
56
|
+
await Promise.all((0, _export.loadStyleSheets)(exportDoc, root));
|
|
57
|
+
resolve();
|
|
58
|
+
};
|
|
59
|
+
doc.body.appendChild(iframe);
|
|
60
|
+
const [drawDocument] = await Promise.all([drawDocumentPromise, iframeLoadPromise]);
|
|
61
|
+
try {
|
|
62
|
+
await drawDocument(iframe.contentDocument, canvas, {
|
|
63
|
+
// Handle retina displays: https://github.com/cburgmer/rasterizeHTML.js/blob/262b3404d1c469ce4a7750a2976dec09b8ae2d6c/examples/retina.html#L71
|
|
64
|
+
zoom: ratio
|
|
65
|
+
});
|
|
66
|
+
} finally {
|
|
67
|
+
doc.body.removeChild(iframe);
|
|
68
|
+
}
|
|
69
|
+
let resolveBlobPromise;
|
|
70
|
+
const blobPromise = new Promise(res => {
|
|
71
|
+
resolveBlobPromise = res;
|
|
72
|
+
});
|
|
73
|
+
canvas.toBlob(blob => resolveBlobPromise(blob), type, quality);
|
|
74
|
+
let blob;
|
|
75
|
+
try {
|
|
76
|
+
blob = await blobPromise;
|
|
77
|
+
} catch (error) {
|
|
78
|
+
throw new Error('MUI X Charts: Failed to create blob from canvas.', {
|
|
79
|
+
cause: error
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (!blob) {
|
|
83
|
+
throw new Error('MUI X Charts: Failed to create blob from canvas.');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const url = URL.createObjectURL(blob);
|
|
87
|
+
triggerDownload(url, fileName || document.title);
|
|
88
|
+
URL.revokeObjectURL(url);
|
|
89
|
+
}
|
|
90
|
+
function triggerDownload(url, name) {
|
|
91
|
+
const a = document.createElement('a');
|
|
92
|
+
a.href = url;
|
|
93
|
+
a.download = name;
|
|
94
|
+
a.click();
|
|
95
|
+
}
|
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.printChart = printChart;
|
|
8
8
|
var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"));
|
|
9
|
+
var _export = require("@mui/x-internals/export");
|
|
10
|
+
var _common = require("./common");
|
|
9
11
|
function printChart(element, {
|
|
10
12
|
fileName
|
|
11
13
|
} = {}) {
|
|
12
|
-
const printWindow =
|
|
14
|
+
const printWindow = (0, _common.createExportIframe)(fileName);
|
|
13
15
|
const doc = (0, _ownerDocument.default)(element);
|
|
14
16
|
printWindow.onload = async () => {
|
|
15
17
|
const printDoc = printWindow.contentDocument;
|
|
@@ -17,7 +19,9 @@ function printChart(element, {
|
|
|
17
19
|
const container = document.createElement('div');
|
|
18
20
|
container.appendChild(elementClone);
|
|
19
21
|
printDoc.body.innerHTML = container.innerHTML;
|
|
20
|
-
|
|
22
|
+
const rootCandidate = element.getRootNode();
|
|
23
|
+
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
24
|
+
await Promise.all((0, _export.loadStyleSheets)(printDoc, root));
|
|
21
25
|
printWindow.contentWindow.print();
|
|
22
26
|
const mediaQueryList = printWindow.contentWindow.matchMedia('print');
|
|
23
27
|
mediaQueryList.addEventListener('change', mql => {
|
|
@@ -28,52 +32,4 @@ function printChart(element, {
|
|
|
28
32
|
});
|
|
29
33
|
};
|
|
30
34
|
doc.body.appendChild(printWindow);
|
|
31
|
-
}
|
|
32
|
-
function buildPrintWindow(title) {
|
|
33
|
-
const iframeEl = document.createElement('iframe');
|
|
34
|
-
iframeEl.style.position = 'absolute';
|
|
35
|
-
iframeEl.style.width = '0px';
|
|
36
|
-
iframeEl.style.height = '0px';
|
|
37
|
-
iframeEl.title = title || document.title;
|
|
38
|
-
return iframeEl;
|
|
39
|
-
}
|
|
40
|
-
function loadStyleSheets(printDoc, element) {
|
|
41
|
-
const stylesheetLoadPromises = [];
|
|
42
|
-
const doc = (0, _ownerDocument.default)(element);
|
|
43
|
-
const rootCandidate = element.getRootNode();
|
|
44
|
-
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
45
|
-
const headStyleElements = root.querySelectorAll("style, link[rel='stylesheet']");
|
|
46
|
-
for (let i = 0; i < headStyleElements.length; i += 1) {
|
|
47
|
-
const node = headStyleElements[i];
|
|
48
|
-
if (node.tagName === 'STYLE') {
|
|
49
|
-
const newHeadStyleElements = printDoc.createElement(node.tagName);
|
|
50
|
-
const sheet = node.sheet;
|
|
51
|
-
if (sheet) {
|
|
52
|
-
let styleCSS = '';
|
|
53
|
-
// NOTE: for-of is not supported by IE
|
|
54
|
-
for (let j = 0; j < sheet.cssRules.length; j += 1) {
|
|
55
|
-
if (typeof sheet.cssRules[j].cssText === 'string') {
|
|
56
|
-
styleCSS += `${sheet.cssRules[j].cssText}\r\n`;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
newHeadStyleElements.appendChild(printDoc.createTextNode(styleCSS));
|
|
60
|
-
printDoc.head.appendChild(newHeadStyleElements);
|
|
61
|
-
}
|
|
62
|
-
} else if (node.getAttribute('href')) {
|
|
63
|
-
// If `href` tag is empty, avoid loading these links
|
|
64
|
-
|
|
65
|
-
const newHeadStyleElements = printDoc.createElement(node.tagName);
|
|
66
|
-
for (let j = 0; j < node.attributes.length; j += 1) {
|
|
67
|
-
const attr = node.attributes[j];
|
|
68
|
-
if (attr) {
|
|
69
|
-
newHeadStyleElements.setAttribute(attr.nodeName, attr.nodeValue || '');
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
stylesheetLoadPromises.push(new Promise(resolve => {
|
|
73
|
-
newHeadStyleElements.addEventListener('load', () => resolve());
|
|
74
|
-
}));
|
|
75
|
-
printDoc.head.appendChild(newHeadStyleElements);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return Promise.all(stylesheetLoadPromises);
|
|
79
35
|
}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useChartProExport = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _print = require("./print");
|
|
10
|
+
var _exportImage = require("./exportImage");
|
|
10
11
|
function waitForAnimationFrame() {
|
|
11
12
|
let resolve;
|
|
12
13
|
const promise = new Promise(res => {
|
|
@@ -29,6 +30,23 @@ const useChartProExport = ({
|
|
|
29
30
|
// Wait for animation frame to ensure the animation finished
|
|
30
31
|
await waitForAnimationFrame();
|
|
31
32
|
(0, _print.printChart)(chartRoot, options);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('MUI X Charts: Error exporting chart as print:', error);
|
|
35
|
+
} finally {
|
|
36
|
+
enableAnimation();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const exportAsImage = async options => {
|
|
41
|
+
const chartRoot = chartRootRef.current;
|
|
42
|
+
if (chartRoot) {
|
|
43
|
+
const enableAnimation = instance.disableAnimation();
|
|
44
|
+
try {
|
|
45
|
+
// Wait for animation frame to ensure the animation finished
|
|
46
|
+
await waitForAnimationFrame();
|
|
47
|
+
await (0, _exportImage.exportImage)(chartRoot, options);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('MUI X Charts: Error exporting chart as image:', error);
|
|
32
50
|
} finally {
|
|
33
51
|
enableAnimation();
|
|
34
52
|
}
|
|
@@ -36,10 +54,12 @@ const useChartProExport = ({
|
|
|
36
54
|
};
|
|
37
55
|
return {
|
|
38
56
|
publicAPI: {
|
|
39
|
-
exportAsPrint
|
|
57
|
+
exportAsPrint,
|
|
58
|
+
exportAsImage
|
|
40
59
|
},
|
|
41
60
|
instance: {
|
|
42
|
-
exportAsPrint
|
|
61
|
+
exportAsPrint,
|
|
62
|
+
exportAsImage
|
|
43
63
|
}
|
|
44
64
|
};
|
|
45
65
|
};
|
|
@@ -16,6 +16,30 @@ export interface ChartPrintExportOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
fileName?: string;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The options to apply on the image export.
|
|
21
|
+
* @demos
|
|
22
|
+
* - [Image export](/x/react-charts/export/#export-as-image)
|
|
23
|
+
*/
|
|
24
|
+
export interface ChartImageExportOptions {
|
|
25
|
+
/**
|
|
26
|
+
* The value to be used as the print window title.
|
|
27
|
+
* @default The title of the page.
|
|
28
|
+
*/
|
|
29
|
+
fileName?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The format of the image to be exported.
|
|
32
|
+
* Browsers are required to support 'image/png'. Some browsers also support 'image/jpeg' and 'image/webp'.
|
|
33
|
+
* @default 'image/png'
|
|
34
|
+
*/
|
|
35
|
+
type?: 'image/png' | string;
|
|
36
|
+
/**
|
|
37
|
+
* The quality of the image to be exported between 0 and 1. This is only applicable for lossy formats, such as
|
|
38
|
+
* 'image/jpeg' and 'image/webp'. 'image/png' does not support this option.
|
|
39
|
+
* @default 0.9
|
|
40
|
+
*/
|
|
41
|
+
quality?: number;
|
|
42
|
+
}
|
|
19
43
|
export interface UseChartProExportPublicApi {
|
|
20
44
|
/**
|
|
21
45
|
* Opens the browser's print dialog, which can be used to print the chart or export it as PDF.
|
|
@@ -23,6 +47,14 @@ export interface UseChartProExportPublicApi {
|
|
|
23
47
|
* @returns {void}
|
|
24
48
|
*/
|
|
25
49
|
exportAsPrint: (options?: ChartPrintExportOptions) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Exports the chart as an image.
|
|
52
|
+
* If the provided `type` is not supported by the browser, it will default to `image/png`.
|
|
53
|
+
*
|
|
54
|
+
* @param {ChartPrintExportOptions} options Options to customize the print export.
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
exportAsImage: (options?: ChartImageExportOptions) => void;
|
|
26
58
|
}
|
|
27
59
|
export interface UseChartProExportInstance extends UseChartProExportPublicApi {}
|
|
28
60
|
export type UseChartProExportSignature = ChartPluginSignature<{
|