@mui/x-charts-pro 8.13.1 → 8.14.1
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.js +49 -37
- package/CHANGELOG.md +204 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.js +38 -36
- package/Heatmap/Heatmap.js +0 -4
- package/LineChartPro/LineChartPro.js +49 -37
- package/SankeyChart/SankeyChart.d.ts +1 -1
- package/SankeyChart/SankeyChart.js +30 -0
- package/SankeyChart/SankeyChart.plugins.d.ts +3 -2
- package/SankeyChart/SankeyChart.plugins.js +2 -1
- package/SankeyChart/SankeyLinkElement.d.ts +1 -1
- package/SankeyChart/SankeyLinkElement.js +15 -2
- package/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/SankeyChart/SankeyNodeElement.js +16 -1
- package/SankeyChart/SankeyPlot.js +13 -1
- package/SankeyChart/plugins/index.d.ts +3 -0
- package/SankeyChart/plugins/index.js +49 -0
- package/SankeyChart/plugins/useSankeyHighlight.d.ts +7 -0
- package/SankeyChart/plugins/useSankeyHighlight.js +76 -0
- package/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +68 -0
- package/SankeyChart/plugins/useSankeyHighlight.selectors.js +126 -0
- package/SankeyChart/plugins/useSankeyHighlight.types.d.ts +55 -0
- package/SankeyChart/plugins/useSankeyHighlight.types.js +5 -0
- package/SankeyChart/sankey.highlight.types.d.ts +42 -0
- package/SankeyChart/sankey.highlight.types.js +6 -0
- package/SankeyChart/sankey.types.d.ts +3 -2
- package/SankeyChart/sankeyClasses.d.ts +1 -1
- package/SankeyChart/useSankeyChartProps.js +5 -5
- package/ScatterChartPro/ScatterChartPro.js +49 -37
- package/esm/BarChartPro/BarChartPro.js +49 -37
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/FunnelChart/funnelAxisPlugin/computeAxisValue.js +39 -37
- package/esm/Heatmap/Heatmap.js +0 -4
- package/esm/LineChartPro/LineChartPro.js +49 -37
- package/esm/SankeyChart/SankeyChart.d.ts +1 -1
- package/esm/SankeyChart/SankeyChart.js +30 -0
- package/esm/SankeyChart/SankeyChart.plugins.d.ts +3 -2
- package/esm/SankeyChart/SankeyChart.plugins.js +3 -4
- package/esm/SankeyChart/SankeyLinkElement.d.ts +1 -1
- package/esm/SankeyChart/SankeyLinkElement.js +16 -3
- package/esm/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/esm/SankeyChart/SankeyNodeElement.js +17 -2
- package/esm/SankeyChart/SankeyPlot.js +15 -3
- package/esm/SankeyChart/plugins/index.d.ts +3 -0
- package/esm/SankeyChart/plugins/index.js +3 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.d.ts +7 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.js +68 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +68 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.js +120 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.types.d.ts +55 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.types.js +1 -0
- package/esm/SankeyChart/sankey.highlight.types.d.ts +42 -0
- package/esm/SankeyChart/sankey.highlight.types.js +3 -0
- package/esm/SankeyChart/sankey.types.d.ts +3 -2
- package/esm/SankeyChart/sankeyClasses.d.ts +1 -1
- package/esm/SankeyChart/useSankeyChartProps.js +5 -5
- package/esm/ScatterChartPro/ScatterChartPro.js +49 -37
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -6
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +5 -1
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +8 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +73 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +2 -0
- package/index.js +1 -1
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -6
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +5 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +8 -0
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +80 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +2 -0
- package/package.json +7 -7
|
@@ -299,8 +299,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
299
299
|
ignoreTooltip: PropTypes.bool,
|
|
300
300
|
label: PropTypes.string,
|
|
301
301
|
labelStyle: PropTypes.object,
|
|
302
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
303
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
304
302
|
offset: PropTypes.number,
|
|
305
303
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
306
304
|
reverse: PropTypes.bool,
|
|
@@ -368,8 +366,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
368
366
|
ignoreTooltip: PropTypes.bool,
|
|
369
367
|
label: PropTypes.string,
|
|
370
368
|
labelStyle: PropTypes.object,
|
|
371
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
372
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
373
369
|
offset: PropTypes.number,
|
|
374
370
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
375
371
|
reverse: PropTypes.bool,
|
|
@@ -427,8 +423,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
427
423
|
ignoreTooltip: PropTypes.bool,
|
|
428
424
|
label: PropTypes.string,
|
|
429
425
|
labelStyle: PropTypes.object,
|
|
430
|
-
max: PropTypes.
|
|
431
|
-
min: PropTypes.
|
|
426
|
+
max: PropTypes.number,
|
|
427
|
+
min: PropTypes.number,
|
|
432
428
|
offset: PropTypes.number,
|
|
433
429
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
434
430
|
reverse: PropTypes.bool,
|
|
@@ -487,8 +483,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
487
483
|
ignoreTooltip: PropTypes.bool,
|
|
488
484
|
label: PropTypes.string,
|
|
489
485
|
labelStyle: PropTypes.object,
|
|
490
|
-
max: PropTypes.
|
|
491
|
-
min: PropTypes.
|
|
486
|
+
max: PropTypes.number,
|
|
487
|
+
min: PropTypes.number,
|
|
492
488
|
offset: PropTypes.number,
|
|
493
489
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
494
490
|
reverse: PropTypes.bool,
|
|
@@ -546,8 +542,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
546
542
|
ignoreTooltip: PropTypes.bool,
|
|
547
543
|
label: PropTypes.string,
|
|
548
544
|
labelStyle: PropTypes.object,
|
|
549
|
-
max: PropTypes.
|
|
550
|
-
min: PropTypes.
|
|
545
|
+
max: PropTypes.number,
|
|
546
|
+
min: PropTypes.number,
|
|
551
547
|
offset: PropTypes.number,
|
|
552
548
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
553
549
|
reverse: PropTypes.bool,
|
|
@@ -605,8 +601,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
605
601
|
ignoreTooltip: PropTypes.bool,
|
|
606
602
|
label: PropTypes.string,
|
|
607
603
|
labelStyle: PropTypes.object,
|
|
608
|
-
max: PropTypes.
|
|
609
|
-
min: PropTypes.
|
|
604
|
+
max: PropTypes.number,
|
|
605
|
+
min: PropTypes.number,
|
|
610
606
|
offset: PropTypes.number,
|
|
611
607
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
612
608
|
reverse: PropTypes.bool,
|
|
@@ -664,8 +660,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
664
660
|
ignoreTooltip: PropTypes.bool,
|
|
665
661
|
label: PropTypes.string,
|
|
666
662
|
labelStyle: PropTypes.object,
|
|
667
|
-
max: PropTypes.oneOfType([PropTypes.
|
|
668
|
-
|
|
663
|
+
max: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
664
|
+
valueOf: PropTypes.func.isRequired
|
|
665
|
+
})]),
|
|
666
|
+
min: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
667
|
+
valueOf: PropTypes.func.isRequired
|
|
668
|
+
})]),
|
|
669
669
|
offset: PropTypes.number,
|
|
670
670
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
671
671
|
reverse: PropTypes.bool,
|
|
@@ -723,8 +723,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
723
723
|
ignoreTooltip: PropTypes.bool,
|
|
724
724
|
label: PropTypes.string,
|
|
725
725
|
labelStyle: PropTypes.object,
|
|
726
|
-
max: PropTypes.oneOfType([PropTypes.
|
|
727
|
-
|
|
726
|
+
max: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
727
|
+
valueOf: PropTypes.func.isRequired
|
|
728
|
+
})]),
|
|
729
|
+
min: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
730
|
+
valueOf: PropTypes.func.isRequired
|
|
731
|
+
})]),
|
|
728
732
|
offset: PropTypes.number,
|
|
729
733
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
730
734
|
reverse: PropTypes.bool,
|
|
@@ -782,8 +786,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
782
786
|
ignoreTooltip: PropTypes.bool,
|
|
783
787
|
label: PropTypes.string,
|
|
784
788
|
labelStyle: PropTypes.object,
|
|
785
|
-
max: PropTypes.
|
|
786
|
-
min: PropTypes.
|
|
789
|
+
max: PropTypes.number,
|
|
790
|
+
min: PropTypes.number,
|
|
787
791
|
offset: PropTypes.number,
|
|
788
792
|
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
789
793
|
reverse: PropTypes.bool,
|
|
@@ -858,8 +862,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
858
862
|
ignoreTooltip: PropTypes.bool,
|
|
859
863
|
label: PropTypes.string,
|
|
860
864
|
labelStyle: PropTypes.object,
|
|
861
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
862
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
863
865
|
offset: PropTypes.number,
|
|
864
866
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
865
867
|
reverse: PropTypes.bool,
|
|
@@ -926,8 +928,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
926
928
|
ignoreTooltip: PropTypes.bool,
|
|
927
929
|
label: PropTypes.string,
|
|
928
930
|
labelStyle: PropTypes.object,
|
|
929
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
930
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
931
931
|
offset: PropTypes.number,
|
|
932
932
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
933
933
|
reverse: PropTypes.bool,
|
|
@@ -984,8 +984,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
984
984
|
ignoreTooltip: PropTypes.bool,
|
|
985
985
|
label: PropTypes.string,
|
|
986
986
|
labelStyle: PropTypes.object,
|
|
987
|
-
max: PropTypes.
|
|
988
|
-
min: PropTypes.
|
|
987
|
+
max: PropTypes.number,
|
|
988
|
+
min: PropTypes.number,
|
|
989
989
|
offset: PropTypes.number,
|
|
990
990
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
991
991
|
reverse: PropTypes.bool,
|
|
@@ -1043,8 +1043,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1043
1043
|
ignoreTooltip: PropTypes.bool,
|
|
1044
1044
|
label: PropTypes.string,
|
|
1045
1045
|
labelStyle: PropTypes.object,
|
|
1046
|
-
max: PropTypes.
|
|
1047
|
-
min: PropTypes.
|
|
1046
|
+
max: PropTypes.number,
|
|
1047
|
+
min: PropTypes.number,
|
|
1048
1048
|
offset: PropTypes.number,
|
|
1049
1049
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
1050
1050
|
reverse: PropTypes.bool,
|
|
@@ -1101,8 +1101,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1101
1101
|
ignoreTooltip: PropTypes.bool,
|
|
1102
1102
|
label: PropTypes.string,
|
|
1103
1103
|
labelStyle: PropTypes.object,
|
|
1104
|
-
max: PropTypes.
|
|
1105
|
-
min: PropTypes.
|
|
1104
|
+
max: PropTypes.number,
|
|
1105
|
+
min: PropTypes.number,
|
|
1106
1106
|
offset: PropTypes.number,
|
|
1107
1107
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
1108
1108
|
reverse: PropTypes.bool,
|
|
@@ -1159,8 +1159,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1159
1159
|
ignoreTooltip: PropTypes.bool,
|
|
1160
1160
|
label: PropTypes.string,
|
|
1161
1161
|
labelStyle: PropTypes.object,
|
|
1162
|
-
max: PropTypes.
|
|
1163
|
-
min: PropTypes.
|
|
1162
|
+
max: PropTypes.number,
|
|
1163
|
+
min: PropTypes.number,
|
|
1164
1164
|
offset: PropTypes.number,
|
|
1165
1165
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
1166
1166
|
reverse: PropTypes.bool,
|
|
@@ -1217,8 +1217,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1217
1217
|
ignoreTooltip: PropTypes.bool,
|
|
1218
1218
|
label: PropTypes.string,
|
|
1219
1219
|
labelStyle: PropTypes.object,
|
|
1220
|
-
max: PropTypes.oneOfType([PropTypes.
|
|
1221
|
-
|
|
1220
|
+
max: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
1221
|
+
valueOf: PropTypes.func.isRequired
|
|
1222
|
+
})]),
|
|
1223
|
+
min: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
1224
|
+
valueOf: PropTypes.func.isRequired
|
|
1225
|
+
})]),
|
|
1222
1226
|
offset: PropTypes.number,
|
|
1223
1227
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
1224
1228
|
reverse: PropTypes.bool,
|
|
@@ -1275,8 +1279,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1275
1279
|
ignoreTooltip: PropTypes.bool,
|
|
1276
1280
|
label: PropTypes.string,
|
|
1277
1281
|
labelStyle: PropTypes.object,
|
|
1278
|
-
max: PropTypes.oneOfType([PropTypes.
|
|
1279
|
-
|
|
1282
|
+
max: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
1283
|
+
valueOf: PropTypes.func.isRequired
|
|
1284
|
+
})]),
|
|
1285
|
+
min: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
1286
|
+
valueOf: PropTypes.func.isRequired
|
|
1287
|
+
})]),
|
|
1280
1288
|
offset: PropTypes.number,
|
|
1281
1289
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
1282
1290
|
reverse: PropTypes.bool,
|
|
@@ -1333,8 +1341,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1333
1341
|
ignoreTooltip: PropTypes.bool,
|
|
1334
1342
|
label: PropTypes.string,
|
|
1335
1343
|
labelStyle: PropTypes.object,
|
|
1336
|
-
max: PropTypes.
|
|
1337
|
-
min: PropTypes.
|
|
1344
|
+
max: PropTypes.number,
|
|
1345
|
+
min: PropTypes.number,
|
|
1338
1346
|
offset: PropTypes.number,
|
|
1339
1347
|
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
1340
1348
|
reverse: PropTypes.bool,
|
|
@@ -1406,10 +1414,14 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1406
1414
|
* Configuration for zoom interactions.
|
|
1407
1415
|
*/
|
|
1408
1416
|
zoomInteractionConfig: PropTypes.shape({
|
|
1409
|
-
pan: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(['drag']), PropTypes.shape({
|
|
1417
|
+
pan: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(['drag', 'pressAndDrag']), PropTypes.shape({
|
|
1410
1418
|
pointerMode: PropTypes.oneOf(['mouse', 'touch']),
|
|
1411
1419
|
requiredKeys: PropTypes.arrayOf(PropTypes.string),
|
|
1412
1420
|
type: PropTypes.oneOf(['drag']).isRequired
|
|
1421
|
+
}), PropTypes.shape({
|
|
1422
|
+
pointerMode: PropTypes.oneOf(['mouse', 'touch']),
|
|
1423
|
+
requiredKeys: PropTypes.arrayOf(PropTypes.string),
|
|
1424
|
+
type: PropTypes.oneOf(['pressAndDrag']).isRequired
|
|
1413
1425
|
})]).isRequired),
|
|
1414
1426
|
zoom: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(['pinch', 'tapAndDrag', 'wheel']), PropTypes.shape({
|
|
1415
1427
|
pointerMode: PropTypes.any,
|
package/esm/index.js
CHANGED
|
@@ -7,11 +7,7 @@ export declare const selectorZoomInteractionConfig: import("reselect").Selector<
|
|
|
7
7
|
};
|
|
8
8
|
pointerMode?: import("@mui/x-internal-gestures/core").PointerMode[];
|
|
9
9
|
}) | null, [interactionName: "wheel" | "pinch" | "tapAndDrag"]>;
|
|
10
|
-
export declare const selectorPanInteractionConfig: import("reselect").Selector<any, (Omit<{
|
|
11
|
-
type: "drag";
|
|
12
|
-
pointerMode?: import("./ZoomInteractionConfig.types.js").InteractionMode | undefined;
|
|
13
|
-
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
14
|
-
}, "pointerMode"> & {
|
|
10
|
+
export declare const selectorPanInteractionConfig: import("reselect").Selector<any, (Omit<import("./ZoomInteractionConfig.types.js").PanInteraction, "pointerMode"> & {
|
|
15
11
|
mouse: {
|
|
16
12
|
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[];
|
|
17
13
|
};
|
|
@@ -19,4 +15,4 @@ export declare const selectorPanInteractionConfig: import("reselect").Selector<a
|
|
|
19
15
|
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[];
|
|
20
16
|
};
|
|
21
17
|
pointerMode?: import("@mui/x-internal-gestures/core").PointerMode[];
|
|
22
|
-
}) | null, [interactionName: "drag"]>;
|
|
18
|
+
}) | null, [interactionName: "drag" | "pressAndDrag"]>;
|
|
@@ -12,6 +12,7 @@ export type ZoomInteractionConfig = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Defines the interactions that trigger panning.
|
|
14
14
|
* - `drag`: Pans the chart when dragged with the mouse.
|
|
15
|
+
* - `pressAndDrag`: Pans the chart by pressing and holding, then dragging. Useful for avoiding conflicts with selection gestures.
|
|
15
16
|
*
|
|
16
17
|
* @default ['drag']
|
|
17
18
|
*/
|
|
@@ -31,7 +32,7 @@ export type DefaultizedZoomInteractionConfig = {
|
|
|
31
32
|
pan: Entry<PanInteraction>;
|
|
32
33
|
};
|
|
33
34
|
export type ZoomInteraction = WheelInteraction | PinchInteraction | TapAndDragInteraction;
|
|
34
|
-
export type PanInteraction = DragInteraction;
|
|
35
|
+
export type PanInteraction = DragInteraction | PressAndDragInteraction;
|
|
35
36
|
export type ZoomInteractionName = ZoomInteraction['type'];
|
|
36
37
|
export type PanInteractionName = PanInteraction['type'];
|
|
37
38
|
export type InteractionMode = Exclude<PointerMode, 'pen'>;
|
|
@@ -75,6 +76,9 @@ export type DragInteraction = Unpack<{
|
|
|
75
76
|
export type TapAndDragInteraction = Unpack<{
|
|
76
77
|
type: 'tapAndDrag';
|
|
77
78
|
} & AllModeProp & AllKeysProp>;
|
|
79
|
+
export type PressAndDragInteraction = Unpack<{
|
|
80
|
+
type: 'pressAndDrag';
|
|
81
|
+
} & AllModeProp & AllKeysProp>;
|
|
78
82
|
export type AnyInteraction = {
|
|
79
83
|
type: string;
|
|
80
84
|
pointerMode?: InteractionMode;
|
|
@@ -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 usePanOnPressAndDrag: ({
|
|
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,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useSelector, selectorChartDrawingArea, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
5
|
+
import { rafThrottle } from '@mui/x-internals/rafThrottle';
|
|
6
|
+
import { translateZoom } from "./useZoom.utils.js";
|
|
7
|
+
import { selectorPanInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
8
|
+
export const usePanOnPressAndDrag = ({
|
|
9
|
+
store,
|
|
10
|
+
instance,
|
|
11
|
+
svgRef
|
|
12
|
+
}, setZoomDataCallback) => {
|
|
13
|
+
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
14
|
+
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
|
+
const startRef = React.useRef(null);
|
|
16
|
+
const config = useSelector(store, selectorPanInteractionConfig, ['pressAndDrag']);
|
|
17
|
+
const isPanOnPressAndDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && config || false, [optionsLookup, config]);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (!isPanOnPressAndDragEnabled) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
instance.updateZoomInteractionListeners('zoomPressAndDrag', {
|
|
23
|
+
requiredKeys: config.requiredKeys,
|
|
24
|
+
pointerMode: config.pointerMode,
|
|
25
|
+
pointerOptions: {
|
|
26
|
+
mouse: config.mouse,
|
|
27
|
+
touch: config.touch
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}, [isPanOnPressAndDragEnabled, config, instance]);
|
|
31
|
+
|
|
32
|
+
// Add event for chart panning with press and drag
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
const element = svgRef.current;
|
|
35
|
+
if (element === null || !isPanOnPressAndDragEnabled) {
|
|
36
|
+
return () => {};
|
|
37
|
+
}
|
|
38
|
+
const handlePressAndDragStart = event => {
|
|
39
|
+
if (!event.detail.target?.closest('[data-charts-zoom-slider]')) {
|
|
40
|
+
startRef.current = store.value.zoom.zoomData;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const handlePressAndDragEnd = () => {
|
|
44
|
+
startRef.current = null;
|
|
45
|
+
};
|
|
46
|
+
const throttledCallback = rafThrottle((event, zoomData) => {
|
|
47
|
+
const newZoomData = translateZoom(zoomData, {
|
|
48
|
+
x: event.detail.activeDeltaX,
|
|
49
|
+
y: -event.detail.activeDeltaY
|
|
50
|
+
}, {
|
|
51
|
+
width: drawingArea.width,
|
|
52
|
+
height: drawingArea.height
|
|
53
|
+
}, optionsLookup);
|
|
54
|
+
setZoomDataCallback(newZoomData);
|
|
55
|
+
});
|
|
56
|
+
const handlePressAndDrag = event => {
|
|
57
|
+
const zoomData = startRef.current;
|
|
58
|
+
if (!zoomData) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
throttledCallback(event, zoomData);
|
|
62
|
+
};
|
|
63
|
+
const pressAndDragHandler = instance.addInteractionListener('zoomPressAndDrag', handlePressAndDrag);
|
|
64
|
+
const pressAndDragStartHandler = instance.addInteractionListener('zoomPressAndDragStart', handlePressAndDragStart);
|
|
65
|
+
const pressAndDragEndHandler = instance.addInteractionListener('zoomPressAndDragEnd', handlePressAndDragEnd);
|
|
66
|
+
return () => {
|
|
67
|
+
pressAndDragStartHandler.cleanup();
|
|
68
|
+
pressAndDragHandler.cleanup();
|
|
69
|
+
pressAndDragEndHandler.cleanup();
|
|
70
|
+
throttledCallback.clear();
|
|
71
|
+
};
|
|
72
|
+
}, [instance, svgRef, isPanOnPressAndDragEnabled, optionsLookup, drawingArea.width, drawingArea.height, setZoomDataCallback, store, startRef]);
|
|
73
|
+
};
|
|
@@ -11,6 +11,7 @@ import { useZoomOnWheel } from "./gestureHooks/useZoomOnWheel.js";
|
|
|
11
11
|
import { useZoomOnPinch } from "./gestureHooks/useZoomOnPinch.js";
|
|
12
12
|
import { usePanOnDrag } from "./gestureHooks/usePanOnDrag.js";
|
|
13
13
|
import { useZoomOnTapAndDrag } from "./gestureHooks/useZoomOnTapAndDrag.js";
|
|
14
|
+
import { usePanOnPressAndDrag } from "./gestureHooks/usePanOnPressAndDrag.js";
|
|
14
15
|
import { initializeZoomInteractionConfig } from "./initializeZoomInteractionConfig.js";
|
|
15
16
|
import { initializeZoomData } from "./initializeZoomData.js";
|
|
16
17
|
export const useChartProZoom = pluginData => {
|
|
@@ -133,6 +134,7 @@ export const useChartProZoom = pluginData => {
|
|
|
133
134
|
|
|
134
135
|
// Add events
|
|
135
136
|
usePanOnDrag(pluginData, setZoomDataCallback);
|
|
137
|
+
usePanOnPressAndDrag(pluginData, setZoomDataCallback);
|
|
136
138
|
useZoomOnWheel(pluginData, setZoomDataCallback);
|
|
137
139
|
useZoomOnPinch(pluginData, setZoomDataCallback);
|
|
138
140
|
useZoomOnTapAndDrag(pluginData, setZoomDataCallback);
|
package/index.js
CHANGED
|
@@ -7,11 +7,7 @@ export declare const selectorZoomInteractionConfig: import("reselect").Selector<
|
|
|
7
7
|
};
|
|
8
8
|
pointerMode?: import("@mui/x-internal-gestures/core").PointerMode[];
|
|
9
9
|
}) | null, [interactionName: "wheel" | "pinch" | "tapAndDrag"]>;
|
|
10
|
-
export declare const selectorPanInteractionConfig: import("reselect").Selector<any, (Omit<{
|
|
11
|
-
type: "drag";
|
|
12
|
-
pointerMode?: import("./ZoomInteractionConfig.types.js").InteractionMode | undefined;
|
|
13
|
-
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
14
|
-
}, "pointerMode"> & {
|
|
10
|
+
export declare const selectorPanInteractionConfig: import("reselect").Selector<any, (Omit<import("./ZoomInteractionConfig.types.js").PanInteraction, "pointerMode"> & {
|
|
15
11
|
mouse: {
|
|
16
12
|
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[];
|
|
17
13
|
};
|
|
@@ -19,4 +15,4 @@ export declare const selectorPanInteractionConfig: import("reselect").Selector<a
|
|
|
19
15
|
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[];
|
|
20
16
|
};
|
|
21
17
|
pointerMode?: import("@mui/x-internal-gestures/core").PointerMode[];
|
|
22
|
-
}) | null, [interactionName: "drag"]>;
|
|
18
|
+
}) | null, [interactionName: "drag" | "pressAndDrag"]>;
|
|
@@ -12,6 +12,7 @@ export type ZoomInteractionConfig = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Defines the interactions that trigger panning.
|
|
14
14
|
* - `drag`: Pans the chart when dragged with the mouse.
|
|
15
|
+
* - `pressAndDrag`: Pans the chart by pressing and holding, then dragging. Useful for avoiding conflicts with selection gestures.
|
|
15
16
|
*
|
|
16
17
|
* @default ['drag']
|
|
17
18
|
*/
|
|
@@ -31,7 +32,7 @@ export type DefaultizedZoomInteractionConfig = {
|
|
|
31
32
|
pan: Entry<PanInteraction>;
|
|
32
33
|
};
|
|
33
34
|
export type ZoomInteraction = WheelInteraction | PinchInteraction | TapAndDragInteraction;
|
|
34
|
-
export type PanInteraction = DragInteraction;
|
|
35
|
+
export type PanInteraction = DragInteraction | PressAndDragInteraction;
|
|
35
36
|
export type ZoomInteractionName = ZoomInteraction['type'];
|
|
36
37
|
export type PanInteractionName = PanInteraction['type'];
|
|
37
38
|
export type InteractionMode = Exclude<PointerMode, 'pen'>;
|
|
@@ -75,6 +76,9 @@ export type DragInteraction = Unpack<{
|
|
|
75
76
|
export type TapAndDragInteraction = Unpack<{
|
|
76
77
|
type: 'tapAndDrag';
|
|
77
78
|
} & AllModeProp & AllKeysProp>;
|
|
79
|
+
export type PressAndDragInteraction = Unpack<{
|
|
80
|
+
type: 'pressAndDrag';
|
|
81
|
+
} & AllModeProp & AllKeysProp>;
|
|
78
82
|
export type AnyInteraction = {
|
|
79
83
|
type: string;
|
|
80
84
|
pointerMode?: InteractionMode;
|
|
@@ -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 usePanOnPressAndDrag: ({
|
|
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,80 @@
|
|
|
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.usePanOnPressAndDrag = 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
|
+
var _ZoomInteractionConfig = require("../ZoomInteractionConfig.selectors");
|
|
14
|
+
const usePanOnPressAndDrag = ({
|
|
15
|
+
store,
|
|
16
|
+
instance,
|
|
17
|
+
svgRef
|
|
18
|
+
}, setZoomDataCallback) => {
|
|
19
|
+
const drawingArea = (0, _internals.useSelector)(store, _internals.selectorChartDrawingArea);
|
|
20
|
+
const optionsLookup = (0, _internals.useSelector)(store, _internals.selectorChartZoomOptionsLookup);
|
|
21
|
+
const startRef = React.useRef(null);
|
|
22
|
+
const config = (0, _internals.useSelector)(store, _ZoomInteractionConfig.selectorPanInteractionConfig, ['pressAndDrag']);
|
|
23
|
+
const isPanOnPressAndDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && config || false, [optionsLookup, config]);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (!isPanOnPressAndDragEnabled) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
instance.updateZoomInteractionListeners('zoomPressAndDrag', {
|
|
29
|
+
requiredKeys: config.requiredKeys,
|
|
30
|
+
pointerMode: config.pointerMode,
|
|
31
|
+
pointerOptions: {
|
|
32
|
+
mouse: config.mouse,
|
|
33
|
+
touch: config.touch
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}, [isPanOnPressAndDragEnabled, config, instance]);
|
|
37
|
+
|
|
38
|
+
// Add event for chart panning with press and drag
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
const element = svgRef.current;
|
|
41
|
+
if (element === null || !isPanOnPressAndDragEnabled) {
|
|
42
|
+
return () => {};
|
|
43
|
+
}
|
|
44
|
+
const handlePressAndDragStart = event => {
|
|
45
|
+
if (!event.detail.target?.closest('[data-charts-zoom-slider]')) {
|
|
46
|
+
startRef.current = store.value.zoom.zoomData;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const handlePressAndDragEnd = () => {
|
|
50
|
+
startRef.current = null;
|
|
51
|
+
};
|
|
52
|
+
const throttledCallback = (0, _rafThrottle.rafThrottle)((event, zoomData) => {
|
|
53
|
+
const newZoomData = (0, _useZoom.translateZoom)(zoomData, {
|
|
54
|
+
x: event.detail.activeDeltaX,
|
|
55
|
+
y: -event.detail.activeDeltaY
|
|
56
|
+
}, {
|
|
57
|
+
width: drawingArea.width,
|
|
58
|
+
height: drawingArea.height
|
|
59
|
+
}, optionsLookup);
|
|
60
|
+
setZoomDataCallback(newZoomData);
|
|
61
|
+
});
|
|
62
|
+
const handlePressAndDrag = event => {
|
|
63
|
+
const zoomData = startRef.current;
|
|
64
|
+
if (!zoomData) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
throttledCallback(event, zoomData);
|
|
68
|
+
};
|
|
69
|
+
const pressAndDragHandler = instance.addInteractionListener('zoomPressAndDrag', handlePressAndDrag);
|
|
70
|
+
const pressAndDragStartHandler = instance.addInteractionListener('zoomPressAndDragStart', handlePressAndDragStart);
|
|
71
|
+
const pressAndDragEndHandler = instance.addInteractionListener('zoomPressAndDragEnd', handlePressAndDragEnd);
|
|
72
|
+
return () => {
|
|
73
|
+
pressAndDragStartHandler.cleanup();
|
|
74
|
+
pressAndDragHandler.cleanup();
|
|
75
|
+
pressAndDragEndHandler.cleanup();
|
|
76
|
+
throttledCallback.clear();
|
|
77
|
+
};
|
|
78
|
+
}, [instance, svgRef, isPanOnPressAndDragEnabled, optionsLookup, drawingArea.width, drawingArea.height, setZoomDataCallback, store, startRef]);
|
|
79
|
+
};
|
|
80
|
+
exports.usePanOnPressAndDrag = usePanOnPressAndDrag;
|
|
@@ -18,6 +18,7 @@ var _useZoomOnWheel = require("./gestureHooks/useZoomOnWheel");
|
|
|
18
18
|
var _useZoomOnPinch = require("./gestureHooks/useZoomOnPinch");
|
|
19
19
|
var _usePanOnDrag = require("./gestureHooks/usePanOnDrag");
|
|
20
20
|
var _useZoomOnTapAndDrag = require("./gestureHooks/useZoomOnTapAndDrag");
|
|
21
|
+
var _usePanOnPressAndDrag = require("./gestureHooks/usePanOnPressAndDrag");
|
|
21
22
|
var _initializeZoomInteractionConfig = require("./initializeZoomInteractionConfig");
|
|
22
23
|
var _initializeZoomData = require("./initializeZoomData");
|
|
23
24
|
const useChartProZoom = pluginData => {
|
|
@@ -140,6 +141,7 @@ const useChartProZoom = pluginData => {
|
|
|
140
141
|
|
|
141
142
|
// Add events
|
|
142
143
|
(0, _usePanOnDrag.usePanOnDrag)(pluginData, setZoomDataCallback);
|
|
144
|
+
(0, _usePanOnPressAndDrag.usePanOnPressAndDrag)(pluginData, setZoomDataCallback);
|
|
143
145
|
(0, _useZoomOnWheel.useZoomOnWheel)(pluginData, setZoomDataCallback);
|
|
144
146
|
(0, _useZoomOnPinch.useZoomOnPinch)(pluginData, setZoomDataCallback);
|
|
145
147
|
(0, _useZoomOnTapAndDrag.useZoomOnTapAndDrag)(pluginData, setZoomDataCallback);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts-pro",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Pro plan edition of the MUI X Charts components.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.28.4",
|
|
31
|
-
"@mui/utils": "^7.3.
|
|
31
|
+
"@mui/utils": "^7.3.3",
|
|
32
32
|
"clsx": "^2.1.1",
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
|
-
"@mui/x-charts": "8.
|
|
35
|
-
"@mui/x-charts-vendor": "8.
|
|
36
|
-
"@mui/x-internal-gestures": "0.3.
|
|
37
|
-
"@mui/x-internals": "8.
|
|
38
|
-
"@mui/x-license": "8.
|
|
34
|
+
"@mui/x-charts": "8.14.1",
|
|
35
|
+
"@mui/x-charts-vendor": "8.14.1",
|
|
36
|
+
"@mui/x-internal-gestures": "0.3.3",
|
|
37
|
+
"@mui/x-internals": "8.14.0",
|
|
38
|
+
"@mui/x-license": "8.14.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@emotion/react": "^11.9.0",
|