@mui/x-charts-pro 8.6.0 → 8.7.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 +104 -1
- package/ChartContainerPro/index.d.ts +7 -1
- package/ChartContainerPro/index.js +0 -11
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/ChartZoomSlider/index.d.ts +2 -1
- package/ChartZoomSlider/index.js +10 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +4 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +7 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +9 -1
- package/ChartZoomSlider/internals/chartAxisZoomSliderTrackClasses.d.ts +15 -0
- package/ChartZoomSlider/internals/chartAxisZoomSliderTrackClasses.js +31 -0
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +1 -1
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +1 -1
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +43 -33
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/{ChartContainerPro → context}/ChartProApi.d.ts +2 -3
- package/context/index.d.ts +2 -1
- package/context/index.js +4 -4
- package/context/useChartProApiContext.d.ts +9 -0
- package/context/{useChartApiContext.js → useChartProApiContext.js} +4 -4
- package/esm/ChartContainerPro/index.d.ts +7 -1
- package/esm/ChartContainerPro/index.js +4 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/ChartZoomSlider/index.d.ts +2 -1
- package/esm/ChartZoomSlider/index.js +2 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +4 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +8 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +10 -1
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderTrackClasses.d.ts +15 -0
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderTrackClasses.js +21 -0
- package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +2 -2
- package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +2 -2
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +43 -33
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/esm/{ChartContainerPro → context}/ChartProApi.d.ts +2 -3
- package/esm/context/index.d.ts +2 -1
- package/esm/context/index.js +2 -1
- package/esm/context/useChartProApiContext.d.ts +9 -0
- package/esm/context/{useChartApiContext.js → useChartProApiContext.js} +3 -3
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useChartProApiRef.d.ts +23 -0
- package/esm/hooks/useChartProApiRef.js +20 -0
- package/esm/index.d.ts +4 -2
- package/esm/index.js +3 -3
- package/esm/internals/plugins/allPlugins.d.ts +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +8 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +58 -0
- package/esm/internals/plugins/useChartProZoom/{useChartProZoom.utils.d.ts → gestureHooks/useZoom.utils.d.ts} +14 -10
- package/esm/internals/plugins/useChartProZoom/{useChartProZoom.utils.js → gestureHooks/useZoom.utils.js} +41 -31
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +8 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +59 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +8 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +79 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +15 -227
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +11 -0
- package/hooks/useChartProApiRef.d.ts +23 -0
- package/hooks/useChartProApiRef.js +28 -0
- package/index.d.ts +4 -2
- package/index.js +58 -22
- package/internals/plugins/allPlugins.d.ts +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +8 -0
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +65 -0
- package/internals/plugins/useChartProZoom/{useChartProZoom.utils.d.ts → gestureHooks/useZoom.utils.d.ts} +14 -10
- package/internals/plugins/useChartProZoom/{useChartProZoom.utils.js → gestureHooks/useZoom.utils.js} +43 -34
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +8 -0
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +66 -0
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +8 -0
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +86 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +14 -226
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
- package/package.json +5 -4
- package/context/useChartApiContext.d.ts +0 -9
- package/esm/context/useChartApiContext.d.ts +0 -9
- /package/{ChartContainerPro → context}/ChartProApi.js +0 -0
- /package/esm/{ChartContainerPro → context}/ChartProApi.js +0 -0
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts-pro v8.
|
|
2
|
+
* @mui/x-charts-pro v8.7.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,20 @@
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", {
|
|
11
11
|
value: true
|
|
12
12
|
});
|
|
13
|
+
var _exportNames = {
|
|
14
|
+
ChartContainerPro: true
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "ChartContainerPro", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _ChartContainerPro.ChartContainerPro;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
13
22
|
require("./typeOverloads/modules");
|
|
14
23
|
var _constants = require("@mui/x-charts/constants");
|
|
15
24
|
Object.keys(_constants).forEach(function (key) {
|
|
16
25
|
if (key === "default" || key === "__esModule") return;
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
17
27
|
if (key in exports && exports[key] === _constants[key]) return;
|
|
18
28
|
Object.defineProperty(exports, key, {
|
|
19
29
|
enumerable: true,
|
|
@@ -22,20 +32,10 @@ Object.keys(_constants).forEach(function (key) {
|
|
|
22
32
|
}
|
|
23
33
|
});
|
|
24
34
|
});
|
|
25
|
-
var _context = require("@mui/x-charts/context");
|
|
26
|
-
Object.keys(_context).forEach(function (key) {
|
|
27
|
-
if (key === "default" || key === "__esModule") return;
|
|
28
|
-
if (key in exports && exports[key] === _context[key]) return;
|
|
29
|
-
Object.defineProperty(exports, key, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return _context[key];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
35
|
var _hooks = require("@mui/x-charts/hooks");
|
|
37
36
|
Object.keys(_hooks).forEach(function (key) {
|
|
38
37
|
if (key === "default" || key === "__esModule") return;
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
39
39
|
if (key in exports && exports[key] === _hooks[key]) return;
|
|
40
40
|
Object.defineProperty(exports, key, {
|
|
41
41
|
enumerable: true,
|
|
@@ -47,6 +47,7 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
47
47
|
var _colorPalettes = require("@mui/x-charts/colorPalettes");
|
|
48
48
|
Object.keys(_colorPalettes).forEach(function (key) {
|
|
49
49
|
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
51
|
if (key in exports && exports[key] === _colorPalettes[key]) return;
|
|
51
52
|
Object.defineProperty(exports, key, {
|
|
52
53
|
enumerable: true,
|
|
@@ -58,6 +59,7 @@ Object.keys(_colorPalettes).forEach(function (key) {
|
|
|
58
59
|
var _models = require("@mui/x-charts/models");
|
|
59
60
|
Object.keys(_models).forEach(function (key) {
|
|
60
61
|
if (key === "default" || key === "__esModule") return;
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
61
63
|
if (key in exports && exports[key] === _models[key]) return;
|
|
62
64
|
Object.defineProperty(exports, key, {
|
|
63
65
|
enumerable: true,
|
|
@@ -69,6 +71,7 @@ Object.keys(_models).forEach(function (key) {
|
|
|
69
71
|
var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
70
72
|
Object.keys(_ChartsClipPath).forEach(function (key) {
|
|
71
73
|
if (key === "default" || key === "__esModule") return;
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
72
75
|
if (key in exports && exports[key] === _ChartsClipPath[key]) return;
|
|
73
76
|
Object.defineProperty(exports, key, {
|
|
74
77
|
enumerable: true,
|
|
@@ -80,6 +83,7 @@ Object.keys(_ChartsClipPath).forEach(function (key) {
|
|
|
80
83
|
var _ChartsReferenceLine = require("@mui/x-charts/ChartsReferenceLine");
|
|
81
84
|
Object.keys(_ChartsReferenceLine).forEach(function (key) {
|
|
82
85
|
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
83
87
|
if (key in exports && exports[key] === _ChartsReferenceLine[key]) return;
|
|
84
88
|
Object.defineProperty(exports, key, {
|
|
85
89
|
enumerable: true,
|
|
@@ -91,6 +95,7 @@ Object.keys(_ChartsReferenceLine).forEach(function (key) {
|
|
|
91
95
|
var _ChartsAxis = require("@mui/x-charts/ChartsAxis");
|
|
92
96
|
Object.keys(_ChartsAxis).forEach(function (key) {
|
|
93
97
|
if (key === "default" || key === "__esModule") return;
|
|
98
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
94
99
|
if (key in exports && exports[key] === _ChartsAxis[key]) return;
|
|
95
100
|
Object.defineProperty(exports, key, {
|
|
96
101
|
enumerable: true,
|
|
@@ -102,6 +107,7 @@ Object.keys(_ChartsAxis).forEach(function (key) {
|
|
|
102
107
|
var _ChartsXAxis = require("@mui/x-charts/ChartsXAxis");
|
|
103
108
|
Object.keys(_ChartsXAxis).forEach(function (key) {
|
|
104
109
|
if (key === "default" || key === "__esModule") return;
|
|
110
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
105
111
|
if (key in exports && exports[key] === _ChartsXAxis[key]) return;
|
|
106
112
|
Object.defineProperty(exports, key, {
|
|
107
113
|
enumerable: true,
|
|
@@ -113,6 +119,7 @@ Object.keys(_ChartsXAxis).forEach(function (key) {
|
|
|
113
119
|
var _ChartsYAxis = require("@mui/x-charts/ChartsYAxis");
|
|
114
120
|
Object.keys(_ChartsYAxis).forEach(function (key) {
|
|
115
121
|
if (key === "default" || key === "__esModule") return;
|
|
122
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
116
123
|
if (key in exports && exports[key] === _ChartsYAxis[key]) return;
|
|
117
124
|
Object.defineProperty(exports, key, {
|
|
118
125
|
enumerable: true,
|
|
@@ -124,6 +131,7 @@ Object.keys(_ChartsYAxis).forEach(function (key) {
|
|
|
124
131
|
var _ChartsGrid = require("@mui/x-charts/ChartsGrid");
|
|
125
132
|
Object.keys(_ChartsGrid).forEach(function (key) {
|
|
126
133
|
if (key === "default" || key === "__esModule") return;
|
|
134
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
127
135
|
if (key in exports && exports[key] === _ChartsGrid[key]) return;
|
|
128
136
|
Object.defineProperty(exports, key, {
|
|
129
137
|
enumerable: true,
|
|
@@ -135,6 +143,7 @@ Object.keys(_ChartsGrid).forEach(function (key) {
|
|
|
135
143
|
var _ChartsText = require("@mui/x-charts/ChartsText");
|
|
136
144
|
Object.keys(_ChartsText).forEach(function (key) {
|
|
137
145
|
if (key === "default" || key === "__esModule") return;
|
|
146
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
138
147
|
if (key in exports && exports[key] === _ChartsText[key]) return;
|
|
139
148
|
Object.defineProperty(exports, key, {
|
|
140
149
|
enumerable: true,
|
|
@@ -146,6 +155,7 @@ Object.keys(_ChartsText).forEach(function (key) {
|
|
|
146
155
|
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
147
156
|
Object.keys(_ChartsTooltip).forEach(function (key) {
|
|
148
157
|
if (key === "default" || key === "__esModule") return;
|
|
158
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
149
159
|
if (key in exports && exports[key] === _ChartsTooltip[key]) return;
|
|
150
160
|
Object.defineProperty(exports, key, {
|
|
151
161
|
enumerable: true,
|
|
@@ -157,6 +167,7 @@ Object.keys(_ChartsTooltip).forEach(function (key) {
|
|
|
157
167
|
var _ChartsLegend = require("@mui/x-charts/ChartsLegend");
|
|
158
168
|
Object.keys(_ChartsLegend).forEach(function (key) {
|
|
159
169
|
if (key === "default" || key === "__esModule") return;
|
|
170
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
160
171
|
if (key in exports && exports[key] === _ChartsLegend[key]) return;
|
|
161
172
|
Object.defineProperty(exports, key, {
|
|
162
173
|
enumerable: true,
|
|
@@ -168,6 +179,7 @@ Object.keys(_ChartsLegend).forEach(function (key) {
|
|
|
168
179
|
var _ChartsLocalizationProvider = require("@mui/x-charts/ChartsLocalizationProvider");
|
|
169
180
|
Object.keys(_ChartsLocalizationProvider).forEach(function (key) {
|
|
170
181
|
if (key === "default" || key === "__esModule") return;
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
171
183
|
if (key in exports && exports[key] === _ChartsLocalizationProvider[key]) return;
|
|
172
184
|
Object.defineProperty(exports, key, {
|
|
173
185
|
enumerable: true,
|
|
@@ -179,6 +191,7 @@ Object.keys(_ChartsLocalizationProvider).forEach(function (key) {
|
|
|
179
191
|
var _ChartsAxisHighlight = require("@mui/x-charts/ChartsAxisHighlight");
|
|
180
192
|
Object.keys(_ChartsAxisHighlight).forEach(function (key) {
|
|
181
193
|
if (key === "default" || key === "__esModule") return;
|
|
194
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
182
195
|
if (key in exports && exports[key] === _ChartsAxisHighlight[key]) return;
|
|
183
196
|
Object.defineProperty(exports, key, {
|
|
184
197
|
enumerable: true,
|
|
@@ -190,6 +203,7 @@ Object.keys(_ChartsAxisHighlight).forEach(function (key) {
|
|
|
190
203
|
var _BarChart = require("@mui/x-charts/BarChart");
|
|
191
204
|
Object.keys(_BarChart).forEach(function (key) {
|
|
192
205
|
if (key === "default" || key === "__esModule") return;
|
|
206
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
193
207
|
if (key in exports && exports[key] === _BarChart[key]) return;
|
|
194
208
|
Object.defineProperty(exports, key, {
|
|
195
209
|
enumerable: true,
|
|
@@ -201,6 +215,7 @@ Object.keys(_BarChart).forEach(function (key) {
|
|
|
201
215
|
var _LineChart = require("@mui/x-charts/LineChart");
|
|
202
216
|
Object.keys(_LineChart).forEach(function (key) {
|
|
203
217
|
if (key === "default" || key === "__esModule") return;
|
|
218
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
204
219
|
if (key in exports && exports[key] === _LineChart[key]) return;
|
|
205
220
|
Object.defineProperty(exports, key, {
|
|
206
221
|
enumerable: true,
|
|
@@ -212,6 +227,7 @@ Object.keys(_LineChart).forEach(function (key) {
|
|
|
212
227
|
var _PieChart = require("@mui/x-charts/PieChart");
|
|
213
228
|
Object.keys(_PieChart).forEach(function (key) {
|
|
214
229
|
if (key === "default" || key === "__esModule") return;
|
|
230
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
215
231
|
if (key in exports && exports[key] === _PieChart[key]) return;
|
|
216
232
|
Object.defineProperty(exports, key, {
|
|
217
233
|
enumerable: true,
|
|
@@ -223,6 +239,7 @@ Object.keys(_PieChart).forEach(function (key) {
|
|
|
223
239
|
var _ScatterChart = require("@mui/x-charts/ScatterChart");
|
|
224
240
|
Object.keys(_ScatterChart).forEach(function (key) {
|
|
225
241
|
if (key === "default" || key === "__esModule") return;
|
|
242
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
226
243
|
if (key in exports && exports[key] === _ScatterChart[key]) return;
|
|
227
244
|
Object.defineProperty(exports, key, {
|
|
228
245
|
enumerable: true,
|
|
@@ -234,6 +251,7 @@ Object.keys(_ScatterChart).forEach(function (key) {
|
|
|
234
251
|
var _SparkLineChart = require("@mui/x-charts/SparkLineChart");
|
|
235
252
|
Object.keys(_SparkLineChart).forEach(function (key) {
|
|
236
253
|
if (key === "default" || key === "__esModule") return;
|
|
254
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
237
255
|
if (key in exports && exports[key] === _SparkLineChart[key]) return;
|
|
238
256
|
Object.defineProperty(exports, key, {
|
|
239
257
|
enumerable: true,
|
|
@@ -245,6 +263,7 @@ Object.keys(_SparkLineChart).forEach(function (key) {
|
|
|
245
263
|
var _Gauge = require("@mui/x-charts/Gauge");
|
|
246
264
|
Object.keys(_Gauge).forEach(function (key) {
|
|
247
265
|
if (key === "default" || key === "__esModule") return;
|
|
266
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
248
267
|
if (key in exports && exports[key] === _Gauge[key]) return;
|
|
249
268
|
Object.defineProperty(exports, key, {
|
|
250
269
|
enumerable: true,
|
|
@@ -256,6 +275,7 @@ Object.keys(_Gauge).forEach(function (key) {
|
|
|
256
275
|
var _RadarChart = require("@mui/x-charts/RadarChart");
|
|
257
276
|
Object.keys(_RadarChart).forEach(function (key) {
|
|
258
277
|
if (key === "default" || key === "__esModule") return;
|
|
278
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
259
279
|
if (key in exports && exports[key] === _RadarChart[key]) return;
|
|
260
280
|
Object.defineProperty(exports, key, {
|
|
261
281
|
enumerable: true,
|
|
@@ -267,6 +287,7 @@ Object.keys(_RadarChart).forEach(function (key) {
|
|
|
267
287
|
var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
|
|
268
288
|
Object.keys(_ChartsSurface).forEach(function (key) {
|
|
269
289
|
if (key === "default" || key === "__esModule") return;
|
|
290
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
270
291
|
if (key in exports && exports[key] === _ChartsSurface[key]) return;
|
|
271
292
|
Object.defineProperty(exports, key, {
|
|
272
293
|
enumerable: true,
|
|
@@ -278,6 +299,7 @@ Object.keys(_ChartsSurface).forEach(function (key) {
|
|
|
278
299
|
var _ChartDataProvider = require("@mui/x-charts/ChartDataProvider");
|
|
279
300
|
Object.keys(_ChartDataProvider).forEach(function (key) {
|
|
280
301
|
if (key === "default" || key === "__esModule") return;
|
|
302
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
281
303
|
if (key in exports && exports[key] === _ChartDataProvider[key]) return;
|
|
282
304
|
Object.defineProperty(exports, key, {
|
|
283
305
|
enumerable: true,
|
|
@@ -289,6 +311,7 @@ Object.keys(_ChartDataProvider).forEach(function (key) {
|
|
|
289
311
|
var _ChartsLabel = require("@mui/x-charts/ChartsLabel");
|
|
290
312
|
Object.keys(_ChartsLabel).forEach(function (key) {
|
|
291
313
|
if (key === "default" || key === "__esModule") return;
|
|
314
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
292
315
|
if (key in exports && exports[key] === _ChartsLabel[key]) return;
|
|
293
316
|
Object.defineProperty(exports, key, {
|
|
294
317
|
enumerable: true,
|
|
@@ -297,9 +320,22 @@ Object.keys(_ChartsLabel).forEach(function (key) {
|
|
|
297
320
|
}
|
|
298
321
|
});
|
|
299
322
|
});
|
|
323
|
+
var _context = require("./context");
|
|
324
|
+
Object.keys(_context).forEach(function (key) {
|
|
325
|
+
if (key === "default" || key === "__esModule") return;
|
|
326
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
327
|
+
if (key in exports && exports[key] === _context[key]) return;
|
|
328
|
+
Object.defineProperty(exports, key, {
|
|
329
|
+
enumerable: true,
|
|
330
|
+
get: function () {
|
|
331
|
+
return _context[key];
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
});
|
|
300
335
|
var _hooks2 = require("./hooks");
|
|
301
336
|
Object.keys(_hooks2).forEach(function (key) {
|
|
302
337
|
if (key === "default" || key === "__esModule") return;
|
|
338
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
303
339
|
if (key in exports && exports[key] === _hooks2[key]) return;
|
|
304
340
|
Object.defineProperty(exports, key, {
|
|
305
341
|
enumerable: true,
|
|
@@ -311,6 +347,7 @@ Object.keys(_hooks2).forEach(function (key) {
|
|
|
311
347
|
var _Heatmap = require("./Heatmap");
|
|
312
348
|
Object.keys(_Heatmap).forEach(function (key) {
|
|
313
349
|
if (key === "default" || key === "__esModule") return;
|
|
350
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
314
351
|
if (key in exports && exports[key] === _Heatmap[key]) return;
|
|
315
352
|
Object.defineProperty(exports, key, {
|
|
316
353
|
enumerable: true,
|
|
@@ -320,19 +357,10 @@ Object.keys(_Heatmap).forEach(function (key) {
|
|
|
320
357
|
});
|
|
321
358
|
});
|
|
322
359
|
var _ChartContainerPro = require("./ChartContainerPro");
|
|
323
|
-
Object.keys(_ChartContainerPro).forEach(function (key) {
|
|
324
|
-
if (key === "default" || key === "__esModule") return;
|
|
325
|
-
if (key in exports && exports[key] === _ChartContainerPro[key]) return;
|
|
326
|
-
Object.defineProperty(exports, key, {
|
|
327
|
-
enumerable: true,
|
|
328
|
-
get: function () {
|
|
329
|
-
return _ChartContainerPro[key];
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
360
|
var _ChartDataProviderPro = require("./ChartDataProviderPro");
|
|
334
361
|
Object.keys(_ChartDataProviderPro).forEach(function (key) {
|
|
335
362
|
if (key === "default" || key === "__esModule") return;
|
|
363
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
336
364
|
if (key in exports && exports[key] === _ChartDataProviderPro[key]) return;
|
|
337
365
|
Object.defineProperty(exports, key, {
|
|
338
366
|
enumerable: true,
|
|
@@ -344,6 +372,7 @@ Object.keys(_ChartDataProviderPro).forEach(function (key) {
|
|
|
344
372
|
var _ScatterChartPro = require("./ScatterChartPro");
|
|
345
373
|
Object.keys(_ScatterChartPro).forEach(function (key) {
|
|
346
374
|
if (key === "default" || key === "__esModule") return;
|
|
375
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
347
376
|
if (key in exports && exports[key] === _ScatterChartPro[key]) return;
|
|
348
377
|
Object.defineProperty(exports, key, {
|
|
349
378
|
enumerable: true,
|
|
@@ -355,6 +384,7 @@ Object.keys(_ScatterChartPro).forEach(function (key) {
|
|
|
355
384
|
var _BarChartPro = require("./BarChartPro");
|
|
356
385
|
Object.keys(_BarChartPro).forEach(function (key) {
|
|
357
386
|
if (key === "default" || key === "__esModule") return;
|
|
387
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
358
388
|
if (key in exports && exports[key] === _BarChartPro[key]) return;
|
|
359
389
|
Object.defineProperty(exports, key, {
|
|
360
390
|
enumerable: true,
|
|
@@ -366,6 +396,7 @@ Object.keys(_BarChartPro).forEach(function (key) {
|
|
|
366
396
|
var _LineChartPro = require("./LineChartPro");
|
|
367
397
|
Object.keys(_LineChartPro).forEach(function (key) {
|
|
368
398
|
if (key === "default" || key === "__esModule") return;
|
|
399
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
369
400
|
if (key in exports && exports[key] === _LineChartPro[key]) return;
|
|
370
401
|
Object.defineProperty(exports, key, {
|
|
371
402
|
enumerable: true,
|
|
@@ -377,6 +408,7 @@ Object.keys(_LineChartPro).forEach(function (key) {
|
|
|
377
408
|
var _PieChartPro = require("./PieChartPro");
|
|
378
409
|
Object.keys(_PieChartPro).forEach(function (key) {
|
|
379
410
|
if (key === "default" || key === "__esModule") return;
|
|
411
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
380
412
|
if (key in exports && exports[key] === _PieChartPro[key]) return;
|
|
381
413
|
Object.defineProperty(exports, key, {
|
|
382
414
|
enumerable: true,
|
|
@@ -388,6 +420,7 @@ Object.keys(_PieChartPro).forEach(function (key) {
|
|
|
388
420
|
var _FunnelChart = require("./FunnelChart");
|
|
389
421
|
Object.keys(_FunnelChart).forEach(function (key) {
|
|
390
422
|
if (key === "default" || key === "__esModule") return;
|
|
423
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
391
424
|
if (key in exports && exports[key] === _FunnelChart[key]) return;
|
|
392
425
|
Object.defineProperty(exports, key, {
|
|
393
426
|
enumerable: true,
|
|
@@ -399,6 +432,7 @@ Object.keys(_FunnelChart).forEach(function (key) {
|
|
|
399
432
|
var _RadarChartPro = require("./RadarChartPro");
|
|
400
433
|
Object.keys(_RadarChartPro).forEach(function (key) {
|
|
401
434
|
if (key === "default" || key === "__esModule") return;
|
|
435
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
402
436
|
if (key in exports && exports[key] === _RadarChartPro[key]) return;
|
|
403
437
|
Object.defineProperty(exports, key, {
|
|
404
438
|
enumerable: true,
|
|
@@ -410,6 +444,7 @@ Object.keys(_RadarChartPro).forEach(function (key) {
|
|
|
410
444
|
var _ChartZoomSlider = require("./ChartZoomSlider");
|
|
411
445
|
Object.keys(_ChartZoomSlider).forEach(function (key) {
|
|
412
446
|
if (key === "default" || key === "__esModule") return;
|
|
447
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
413
448
|
if (key in exports && exports[key] === _ChartZoomSlider[key]) return;
|
|
414
449
|
Object.defineProperty(exports, key, {
|
|
415
450
|
enumerable: true,
|
|
@@ -421,6 +456,7 @@ Object.keys(_ChartZoomSlider).forEach(function (key) {
|
|
|
421
456
|
var _ChartsToolbarPro = require("./ChartsToolbarPro");
|
|
422
457
|
Object.keys(_ChartsToolbarPro).forEach(function (key) {
|
|
423
458
|
if (key === "default" || key === "__esModule") return;
|
|
459
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
424
460
|
if (key in exports && exports[key] === _ChartsToolbarPro[key]) return;
|
|
425
461
|
Object.defineProperty(exports, key, {
|
|
426
462
|
enumerable: true,
|
|
@@ -3,7 +3,7 @@ import { UseChartProExportSignature } from "./useChartProExport/index.js";
|
|
|
3
3
|
import { UseChartProZoomSignature } from "./useChartProZoom/index.js";
|
|
4
4
|
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
5
5
|
export type AllPluginsType<TSeries extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<AllPluginSignatures<TSeries>>;
|
|
6
|
-
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<
|
|
6
|
+
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartPolarAxisSignature<any>>)[];
|
|
7
7
|
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
8
8
|
export type DefaultPluginsType<TSeries extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<DefaultPluginSignatures<TSeries>>;
|
|
9
|
-
export declare const DEFAULT_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<
|
|
9
|
+
export declare const DEFAULT_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature>)[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartPlugin, ZoomData } from '@mui/x-charts/internals';
|
|
3
|
+
import { UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
|
+
export declare const usePanOnDrag: ({
|
|
5
|
+
store,
|
|
6
|
+
instance,
|
|
7
|
+
svgRef
|
|
8
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.usePanOnDrag = void 0;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _internals = require("@mui/x-charts/internals");
|
|
11
|
+
var _rafThrottle = require("@mui/x-internals/rafThrottle");
|
|
12
|
+
var _useZoom = require("./useZoom.utils");
|
|
13
|
+
const usePanOnDrag = ({
|
|
14
|
+
store,
|
|
15
|
+
instance,
|
|
16
|
+
svgRef
|
|
17
|
+
}, setZoomDataCallback) => {
|
|
18
|
+
const drawingArea = (0, _internals.useSelector)(store, _internals.selectorChartDrawingArea);
|
|
19
|
+
const optionsLookup = (0, _internals.useSelector)(store, _internals.selectorChartZoomOptionsLookup);
|
|
20
|
+
const startRef = React.useRef(null);
|
|
21
|
+
|
|
22
|
+
// Add event for chart panning
|
|
23
|
+
const isPanEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) || false, [optionsLookup]);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
const element = svgRef.current;
|
|
26
|
+
if (element === null || !isPanEnabled) {
|
|
27
|
+
return () => {};
|
|
28
|
+
}
|
|
29
|
+
const handlePanStart = event => {
|
|
30
|
+
if (!event.detail.target?.closest('[data-charts-zoom-slider]')) {
|
|
31
|
+
startRef.current = store.value.zoom.zoomData;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const handlePanEnd = () => {
|
|
35
|
+
startRef.current = null;
|
|
36
|
+
};
|
|
37
|
+
const throttledCallback = (0, _rafThrottle.rafThrottle)((event, zoomData) => {
|
|
38
|
+
const newZoomData = (0, _useZoom.translateZoom)(zoomData, {
|
|
39
|
+
x: event.detail.activeDeltaX,
|
|
40
|
+
y: -event.detail.activeDeltaY
|
|
41
|
+
}, {
|
|
42
|
+
width: drawingArea.width,
|
|
43
|
+
height: drawingArea.height
|
|
44
|
+
}, optionsLookup);
|
|
45
|
+
setZoomDataCallback(newZoomData);
|
|
46
|
+
});
|
|
47
|
+
const handlePan = event => {
|
|
48
|
+
const zoomData = startRef.current;
|
|
49
|
+
if (!zoomData) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
throttledCallback(event, zoomData);
|
|
53
|
+
};
|
|
54
|
+
const panHandler = instance.addInteractionListener('pan', handlePan);
|
|
55
|
+
const panStartHandler = instance.addInteractionListener('panStart', handlePanStart);
|
|
56
|
+
const panEndHandler = instance.addInteractionListener('panEnd', handlePanEnd);
|
|
57
|
+
return () => {
|
|
58
|
+
panStartHandler.cleanup();
|
|
59
|
+
panHandler.cleanup();
|
|
60
|
+
panEndHandler.cleanup();
|
|
61
|
+
throttledCallback.clear();
|
|
62
|
+
};
|
|
63
|
+
}, [instance, svgRef, isPanEnabled, optionsLookup, drawingArea.width, drawingArea.height, setZoomDataCallback, store, startRef]);
|
|
64
|
+
};
|
|
65
|
+
exports.usePanOnDrag = usePanOnDrag;
|
|
@@ -17,14 +17,6 @@ export declare function getWheelScaleRatio(event: WheelEvent, step: number): {
|
|
|
17
17
|
scaleRatio: number;
|
|
18
18
|
isZoomIn: boolean;
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
21
|
-
* Get the scale ratio and if it's a zoom in or out from a pinch gesture.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getPinchScaleRatio(curDiff: number, prevDiff: number, step: number): {
|
|
24
|
-
scaleRatio: number;
|
|
25
|
-
isZoomIn: boolean;
|
|
26
|
-
};
|
|
27
|
-
export declare function getDiff(eventCache: PointerEvent[]): number;
|
|
28
20
|
/**
|
|
29
21
|
* Get the ratio of the point in the horizontal center of the area.
|
|
30
22
|
*/
|
|
@@ -35,11 +27,23 @@ export declare function getHorizontalCenterRatio(point: {
|
|
|
35
27
|
left: number;
|
|
36
28
|
width: number;
|
|
37
29
|
}): number;
|
|
38
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Get the ratio of the point in the vertical center of the area.
|
|
32
|
+
*/
|
|
39
33
|
export declare function getVerticalCenterRatio(point: {
|
|
40
34
|
x: number;
|
|
41
35
|
y: number;
|
|
42
36
|
}, area: {
|
|
43
37
|
top: number;
|
|
44
38
|
height: number;
|
|
45
|
-
}): number;
|
|
39
|
+
}): number;
|
|
40
|
+
/**
|
|
41
|
+
* Translate the zoom data by a given movement.
|
|
42
|
+
*/
|
|
43
|
+
export declare function translateZoom(initialZoomData: readonly ZoomData[], movement: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}, drawingArea: {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
}, optionsLookup: Record<string | number, DefaultizedZoomOptions>): ZoomData[];
|
package/internals/plugins/useChartProZoom/{useChartProZoom.utils.js → gestureHooks/useZoom.utils.js}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.getDiff = getDiff;
|
|
7
7
|
exports.getHorizontalCenterRatio = getHorizontalCenterRatio;
|
|
8
|
-
exports.getPinchScaleRatio = getPinchScaleRatio;
|
|
9
8
|
exports.getVerticalCenterRatio = getVerticalCenterRatio;
|
|
10
9
|
exports.getWheelScaleRatio = getWheelScaleRatio;
|
|
11
10
|
exports.isSpanValid = isSpanValid;
|
|
12
|
-
exports.
|
|
11
|
+
exports.translateZoom = translateZoom;
|
|
13
12
|
exports.zoomAtPoint = void 0;
|
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
14
|
/**
|
|
15
15
|
* Helper to get the range (in percents of a reference range) corresponding to a given scale.
|
|
16
16
|
* @param centerRatio {number} The ratio of the point that should not move between the previous and next range.
|
|
@@ -90,34 +90,6 @@ function getWheelScaleRatio(event, step) {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
/**
|
|
94
|
-
* Get the scale ratio and if it's a zoom in or out from a pinch gesture.
|
|
95
|
-
*/
|
|
96
|
-
function getPinchScaleRatio(curDiff, prevDiff, step) {
|
|
97
|
-
const scaledStep = step / 1000;
|
|
98
|
-
let scaleRatio = 0;
|
|
99
|
-
let isZoomIn = false;
|
|
100
|
-
const hasMoved = prevDiff > 0;
|
|
101
|
-
if (hasMoved && curDiff > prevDiff) {
|
|
102
|
-
// The distance between the two pointers has increased
|
|
103
|
-
scaleRatio = 1 + scaledStep;
|
|
104
|
-
isZoomIn = true;
|
|
105
|
-
}
|
|
106
|
-
if (hasMoved && curDiff < prevDiff) {
|
|
107
|
-
// The distance between the two pointers has decreased
|
|
108
|
-
scaleRatio = 1 - scaledStep;
|
|
109
|
-
isZoomIn = false;
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
scaleRatio,
|
|
113
|
-
isZoomIn
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function getDiff(eventCache) {
|
|
117
|
-
const [firstEvent, secondEvent] = eventCache;
|
|
118
|
-
return Math.hypot(firstEvent.pageX - secondEvent.pageX, firstEvent.pageY - secondEvent.pageY);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
93
|
/**
|
|
122
94
|
* Get the ratio of the point in the horizontal center of the area.
|
|
123
95
|
*/
|
|
@@ -128,13 +100,50 @@ function getHorizontalCenterRatio(point, area) {
|
|
|
128
100
|
} = area;
|
|
129
101
|
return (point.x - left) / width;
|
|
130
102
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get the ratio of the point in the vertical center of the area.
|
|
106
|
+
*/
|
|
134
107
|
function getVerticalCenterRatio(point, area) {
|
|
135
108
|
const {
|
|
136
109
|
top,
|
|
137
110
|
height
|
|
138
111
|
} = area;
|
|
139
112
|
return (point.y - top) / height * -1 + 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Translate the zoom data by a given movement.
|
|
117
|
+
*/
|
|
118
|
+
function translateZoom(initialZoomData, movement, drawingArea, optionsLookup) {
|
|
119
|
+
return initialZoomData.map(zoom => {
|
|
120
|
+
const options = optionsLookup[zoom.axisId];
|
|
121
|
+
if (!options || !options.panning) {
|
|
122
|
+
return zoom;
|
|
123
|
+
}
|
|
124
|
+
const min = zoom.start;
|
|
125
|
+
const max = zoom.end;
|
|
126
|
+
const span = max - min;
|
|
127
|
+
const MIN_PERCENT = options.minStart;
|
|
128
|
+
const MAX_PERCENT = options.maxEnd;
|
|
129
|
+
const displacement = options.axisDirection === 'x' ? movement.x : movement.y;
|
|
130
|
+
const dimension = options.axisDirection === 'x' ? drawingArea.width : drawingArea.height;
|
|
131
|
+
let newMinPercent = min - displacement / dimension * span;
|
|
132
|
+
let newMaxPercent = max - displacement / dimension * span;
|
|
133
|
+
if (newMinPercent < MIN_PERCENT) {
|
|
134
|
+
newMinPercent = MIN_PERCENT;
|
|
135
|
+
newMaxPercent = newMinPercent + span;
|
|
136
|
+
}
|
|
137
|
+
if (newMaxPercent > MAX_PERCENT) {
|
|
138
|
+
newMaxPercent = MAX_PERCENT;
|
|
139
|
+
newMinPercent = newMaxPercent - span;
|
|
140
|
+
}
|
|
141
|
+
if (newMinPercent < MIN_PERCENT || newMaxPercent > MAX_PERCENT || span < options.minSpan || span > options.maxSpan) {
|
|
142
|
+
return zoom;
|
|
143
|
+
}
|
|
144
|
+
return (0, _extends2.default)({}, zoom, {
|
|
145
|
+
start: newMinPercent,
|
|
146
|
+
end: newMaxPercent
|
|
147
|
+
});
|
|
148
|
+
});
|
|
140
149
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartPlugin, ZoomData } from '@mui/x-charts/internals';
|
|
3
|
+
import { UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
|
+
export declare const useZoomOnPinch: ({
|
|
5
|
+
store,
|
|
6
|
+
instance,
|
|
7
|
+
svgRef
|
|
8
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useZoomOnPinch = void 0;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _internals = require("@mui/x-charts/internals");
|
|
11
|
+
var _rafThrottle = require("@mui/x-internals/rafThrottle");
|
|
12
|
+
var _useZoom = require("./useZoom.utils");
|
|
13
|
+
const useZoomOnPinch = ({
|
|
14
|
+
store,
|
|
15
|
+
instance,
|
|
16
|
+
svgRef
|
|
17
|
+
}, setZoomDataCallback) => {
|
|
18
|
+
const drawingArea = (0, _internals.useSelector)(store, _internals.selectorChartDrawingArea);
|
|
19
|
+
const optionsLookup = (0, _internals.useSelector)(store, _internals.selectorChartZoomOptionsLookup);
|
|
20
|
+
const isZoomEnabled = Object.keys(optionsLookup).length > 0;
|
|
21
|
+
|
|
22
|
+
// Zoom on pinch
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
const element = svgRef.current;
|
|
25
|
+
if (element === null || !isZoomEnabled) {
|
|
26
|
+
return () => {};
|
|
27
|
+
}
|
|
28
|
+
const rafThrottledCallback = (0, _rafThrottle.rafThrottle)(event => {
|
|
29
|
+
setZoomDataCallback(prev => {
|
|
30
|
+
return prev.map(zoom => {
|
|
31
|
+
const option = optionsLookup[zoom.axisId];
|
|
32
|
+
if (!option) {
|
|
33
|
+
return zoom;
|
|
34
|
+
}
|
|
35
|
+
const isZoomIn = event.detail.direction > 0;
|
|
36
|
+
const scaleRatio = 1 + event.detail.deltaScale;
|
|
37
|
+
|
|
38
|
+
// If the delta is 0, it means the pinch gesture is not valid.
|
|
39
|
+
if (event.detail.direction === 0) {
|
|
40
|
+
return zoom;
|
|
41
|
+
}
|
|
42
|
+
const point = (0, _internals.getSVGPoint)(element, {
|
|
43
|
+
clientX: event.detail.centroid.x,
|
|
44
|
+
clientY: event.detail.centroid.y
|
|
45
|
+
});
|
|
46
|
+
const centerRatio = option.axisDirection === 'x' ? (0, _useZoom.getHorizontalCenterRatio)(point, drawingArea) : (0, _useZoom.getVerticalCenterRatio)(point, drawingArea);
|
|
47
|
+
const [newMinRange, newMaxRange] = (0, _useZoom.zoomAtPoint)(centerRatio, scaleRatio, zoom, option);
|
|
48
|
+
if (!(0, _useZoom.isSpanValid)(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
49
|
+
return zoom;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
axisId: zoom.axisId,
|
|
53
|
+
start: newMinRange,
|
|
54
|
+
end: newMaxRange
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
const zoomHandler = instance.addInteractionListener('pinch', rafThrottledCallback);
|
|
60
|
+
return () => {
|
|
61
|
+
zoomHandler.cleanup();
|
|
62
|
+
rafThrottledCallback.clear();
|
|
63
|
+
};
|
|
64
|
+
}, [svgRef, drawingArea, isZoomEnabled, optionsLookup, store, instance, setZoomDataCallback]);
|
|
65
|
+
};
|
|
66
|
+
exports.useZoomOnPinch = useZoomOnPinch;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartPlugin, ZoomData } from '@mui/x-charts/internals';
|
|
3
|
+
import { UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
|
+
export declare const useZoomOnWheel: ({
|
|
5
|
+
store,
|
|
6
|
+
instance,
|
|
7
|
+
svgRef
|
|
8
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|