@mui/x-charts-pro 9.3.0 → 9.5.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.js +33 -3
- package/BarChartPro/BarChartPro.mjs +34 -4
- package/CHANGELOG.md +296 -0
- package/ChartsDataProviderPro/ChartsDataProviderPro.js +2 -2
- package/ChartsDataProviderPro/ChartsDataProviderPro.mjs +2 -2
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +1 -0
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.mjs +1 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.mts +1 -1
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +1 -1
- package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.d.mts +1 -1
- package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.d.ts +1 -1
- package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.js +35 -38
- package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.mjs +37 -40
- package/ChartsToolbarPro/Toolbar.types.d.mts +3 -2
- package/ChartsToolbarPro/Toolbar.types.d.ts +3 -2
- package/ChartsToolbarPro/rangeButtonValueToZoom.d.mts +18 -2
- package/ChartsToolbarPro/rangeButtonValueToZoom.d.ts +18 -2
- package/ChartsToolbarPro/rangeButtonValueToZoom.js +73 -10
- package/ChartsToolbarPro/rangeButtonValueToZoom.mjs +72 -10
- package/ChartsZoomSlider/internals/chartsAxisZoomSliderThumbClasses.js +9 -2
- package/ChartsZoomSlider/internals/chartsAxisZoomSliderThumbClasses.mjs +9 -2
- package/ChartsZoomSlider/internals/previews/ScatterPreviewPlot.js +2 -1
- package/ChartsZoomSlider/internals/previews/ScatterPreviewPlot.mjs +2 -1
- package/FunnelChart/funnel.types.d.mts +1 -1
- package/FunnelChart/funnel.types.d.ts +1 -1
- package/FunnelChart/funnelPlotSlots.types.d.mts +5 -4
- package/FunnelChart/funnelPlotSlots.types.d.ts +5 -4
- package/Heatmap/Heatmap.d.mts +3 -2
- package/Heatmap/Heatmap.d.ts +3 -2
- package/Heatmap/Heatmap.js +32 -2
- package/Heatmap/Heatmap.mjs +32 -2
- package/Heatmap/HeatmapItem.d.mts +3 -2
- package/Heatmap/HeatmapItem.d.ts +3 -2
- package/Heatmap/HeatmapItem.js +2 -0
- package/Heatmap/HeatmapItem.mjs +2 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.mts +3 -2
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +3 -2
- package/LineChartPro/LineChartPro.js +33 -3
- package/LineChartPro/LineChartPro.mjs +34 -4
- package/PieChartPro/PieChartPro.js +1 -1
- package/PieChartPro/PieChartPro.mjs +2 -2
- package/RadarChartPro/RadarChartPro.js +1 -1
- package/RadarChartPro/RadarChartPro.mjs +2 -2
- package/ScatterChartPro/ScatterChartPro.d.mts +2 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -1
- package/ScatterChartPro/ScatterChartPro.js +40 -6
- package/ScatterChartPro/ScatterChartPro.mjs +41 -7
- package/ScatterChartPro/ScatterChartPro.plugins.d.mts +2 -2
- package/ScatterChartPro/ScatterChartPro.plugins.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.plugins.js +1 -1
- package/ScatterChartPro/ScatterChartPro.plugins.mjs +2 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/plugins/allPlugins.d.mts +5 -5
- package/internals/plugins/allPlugins.d.ts +5 -5
- package/internals/plugins/allPlugins.js +2 -2
- package/internals/plugins/allPlugins.mjs +3 -3
- package/internals/plugins/useChartProExport/exportImage.js +8 -2
- package/internals/plugins/useChartProExport/exportImage.mjs +8 -2
- package/internals/plugins/useChartProExport/print.js +1 -0
- package/internals/plugins/useChartProExport/print.mjs +1 -0
- package/internals/plugins/useChartProExport/useChartProExport.types.d.mts +6 -0
- package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +6 -0
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.mts +36 -4
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +36 -4
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.js +2 -4
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.mjs +1 -3
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.mts +11 -11
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +11 -11
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.mts +0 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +0 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +9 -65
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.mjs +9 -64
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.mts +0 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +0 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +9 -69
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.mjs +9 -68
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.mts +0 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +0 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +9 -39
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.mjs +10 -39
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.mts +0 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +0 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +9 -58
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.mjs +10 -58
- package/internals/plugins/useChartProZoom/useChartProZoom.js +77 -14
- package/internals/plugins/useChartProZoom/useChartProZoom.mjs +79 -15
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.mts +0 -3
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +0 -3
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +1 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.mjs +0 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.mts +28 -11
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +28 -11
- package/internals/plugins/zoomGestures/index.d.mts +5 -0
- package/internals/plugins/zoomGestures/index.d.ts +5 -0
- package/internals/plugins/zoomGestures/index.js +33 -0
- package/internals/plugins/zoomGestures/index.mjs +4 -0
- package/internals/plugins/zoomGestures/useDragGesture.d.mts +30 -0
- package/internals/plugins/zoomGestures/useDragGesture.d.ts +30 -0
- package/internals/plugins/zoomGestures/useDragGesture.js +105 -0
- package/internals/plugins/zoomGestures/useDragGesture.mjs +99 -0
- package/internals/plugins/zoomGestures/useDragOnPressGesture.d.mts +30 -0
- package/internals/plugins/zoomGestures/useDragOnPressGesture.d.ts +30 -0
- package/internals/plugins/zoomGestures/useDragOnPressGesture.js +105 -0
- package/internals/plugins/zoomGestures/useDragOnPressGesture.mjs +99 -0
- package/internals/plugins/zoomGestures/usePinchGesture.d.mts +22 -0
- package/internals/plugins/zoomGestures/usePinchGesture.d.ts +22 -0
- package/internals/plugins/zoomGestures/usePinchGesture.js +77 -0
- package/internals/plugins/zoomGestures/usePinchGesture.mjs +71 -0
- package/internals/plugins/zoomGestures/useWheelGesture.d.mts +21 -0
- package/internals/plugins/zoomGestures/useWheelGesture.d.ts +21 -0
- package/internals/plugins/zoomGestures/useWheelGesture.js +78 -0
- package/internals/plugins/zoomGestures/useWheelGesture.mjs +72 -0
- package/internals/plugins/zoomGestures/zoomGestures.types.d.mts +29 -0
- package/internals/plugins/zoomGestures/zoomGestures.types.d.ts +29 -0
- package/internals/plugins/zoomGestures/zoomGestures.types.js +5 -0
- package/internals/plugins/zoomGestures/zoomGestures.types.mjs +1 -0
- package/internals/slots/chartsBaseSlots.d.mts +6 -5
- package/internals/slots/chartsBaseSlots.d.ts +6 -5
- package/internals/slots/chartsIconSlots.d.mts +4 -3
- package/internals/slots/chartsIconSlots.d.ts +4 -3
- package/models/chartsSlotsComponentsPropsPro.d.mts +11 -0
- package/models/chartsSlotsComponentsPropsPro.d.ts +11 -0
- package/models/chartsSlotsComponentsPropsPro.js +5 -0
- package/models/chartsSlotsComponentsPropsPro.mjs +1 -0
- package/models/index.d.mts +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +12 -0
- package/models/index.mjs +1 -0
- package/models/seriesType/heatmap.d.mts +1 -1
- package/models/seriesType/heatmap.d.ts +1 -1
- package/package.json +5 -5
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
9
9
|
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
10
|
-
import { ScatterPlot } from '@mui/x-charts/ScatterChart';
|
|
10
|
+
import { FocusedScatterMark, ScatterPlot } from '@mui/x-charts/ScatterChart';
|
|
11
11
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
12
12
|
import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
|
|
13
13
|
import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
|
|
@@ -76,7 +76,7 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
76
76
|
children: [/*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsZoomSlider, {}), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
77
77
|
"data-drawing-container": true,
|
|
78
78
|
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
79
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), /*#__PURE__*/_jsx(ChartsBrushOverlay, {}), children]
|
|
79
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), /*#__PURE__*/_jsx(FocusedScatterMark, {}), /*#__PURE__*/_jsx(ChartsBrushOverlay, {}), children]
|
|
80
80
|
})), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({
|
|
81
81
|
trigger: "item"
|
|
82
82
|
}, props.slotProps?.tooltip))]
|
|
@@ -165,7 +165,9 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
165
165
|
/**
|
|
166
166
|
* Options to enable features planned for the next major.
|
|
167
167
|
*/
|
|
168
|
-
experimentalFeatures: PropTypes.
|
|
168
|
+
experimentalFeatures: PropTypes.shape({
|
|
169
|
+
progressiveRendering: PropTypes.bool
|
|
170
|
+
}),
|
|
169
171
|
/**
|
|
170
172
|
* Option to display a cartesian grid in the background.
|
|
171
173
|
*/
|
|
@@ -266,12 +268,21 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
266
268
|
/**
|
|
267
269
|
* The list of zoom data related to each axis.
|
|
268
270
|
* Used to initialize the zoom in a specific configuration without controlling it.
|
|
271
|
+
*
|
|
272
|
+
* Each entry is either explicit zoom percentages (`{ axisId, start, end }`) or a
|
|
273
|
+
* range value (`{ axisId, value }`) resolved against the axis domain.
|
|
269
274
|
*/
|
|
270
|
-
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
275
|
+
initialZoom: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
|
|
271
276
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
272
277
|
end: PropTypes.number.isRequired,
|
|
273
278
|
start: PropTypes.number.isRequired
|
|
274
|
-
})
|
|
279
|
+
}), PropTypes.shape({
|
|
280
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
281
|
+
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.instanceOf(Date).isRequired), PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func, PropTypes.shape({
|
|
282
|
+
step: PropTypes.number,
|
|
283
|
+
unit: PropTypes.oneOf(['day', 'hour', 'microsecond', 'millisecond', 'minute', 'month', 'second', 'week', 'year']).isRequired
|
|
284
|
+
})])
|
|
285
|
+
})]).isRequired),
|
|
275
286
|
/**
|
|
276
287
|
* If `true`, a loading overlay is displayed.
|
|
277
288
|
* @default false
|
|
@@ -339,13 +350,15 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
339
350
|
onZoomChange: PropTypes.func,
|
|
340
351
|
/**
|
|
341
352
|
* The type of renderer to use for the scatter plot.
|
|
342
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
353
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
354
|
+
* - `svg-progressive`: Renders every scatter item in a `<circle />` element, in progressive batches that paint over several animation frames to keep the main thread responsive.
|
|
343
355
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
344
356
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
345
357
|
*
|
|
358
|
+
* When not set, defaults to `svg-single`. Enable the `progressiveRendering` experimental feature to auto-select `svg-progressive` above an internal point-count threshold; this will become the default in the next major version.
|
|
346
359
|
* @default 'svg-single'
|
|
347
360
|
*/
|
|
348
|
-
renderer: PropTypes.oneOf(['svg-batch', 'svg-single']),
|
|
361
|
+
renderer: PropTypes.oneOf(['svg-batch', 'svg-progressive', 'svg-single']),
|
|
349
362
|
/**
|
|
350
363
|
* The series to display in the scatter chart.
|
|
351
364
|
* An array of [[ScatterSeries]] objects.
|
|
@@ -438,6 +451,27 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
438
451
|
id: PropTypes.string,
|
|
439
452
|
max: PropTypes.number,
|
|
440
453
|
min: PropTypes.number,
|
|
454
|
+
sizeMap: PropTypes.oneOfType([PropTypes.shape({
|
|
455
|
+
interpolator: PropTypes.oneOf(['linear', 'log', 'sqrt']),
|
|
456
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
457
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
458
|
+
size: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired,
|
|
459
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
460
|
+
}), PropTypes.shape({
|
|
461
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
462
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
463
|
+
size: PropTypes.func.isRequired,
|
|
464
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
465
|
+
}), PropTypes.shape({
|
|
466
|
+
sizes: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
467
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
468
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
469
|
+
}), PropTypes.shape({
|
|
470
|
+
sizes: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
471
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
472
|
+
unknownSize: PropTypes.number,
|
|
473
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
474
|
+
})]),
|
|
441
475
|
valueGetter: PropTypes.func
|
|
442
476
|
})),
|
|
443
477
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type UseChartZAxisSignature, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartHighlightSignature, type UseChartClosestPointSignature, type UseChartKeyboardNavigationSignature, type UseChartBrushSignature, type ConvertSignaturesIntoPlugins, type UseChartVisibilityManagerSignature } from '@mui/x-charts/internals';
|
|
1
|
+
import { type UseChartZAxisSignature, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartHighlightSignature, type UseChartClosestPointSignature, type UseChartKeyboardNavigationSignature, type UseChartBrushSignature, type ConvertSignaturesIntoPlugins, type UseChartVisibilityManagerSignature, type UseProgressiveRenderingSignature } from '@mui/x-charts/internals';
|
|
2
2
|
import { type UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.mjs";
|
|
3
3
|
import { type UseChartProZoomSignature } from "../internals/plugins/useChartProZoom/index.mjs";
|
|
4
|
-
export type ScatterChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<'scatter'>, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature<'scatter'>, UseChartVisibilityManagerSignature<'scatter'>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
4
|
+
export type ScatterChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<'scatter'>, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature<'scatter'>, UseChartVisibilityManagerSignature<'scatter'>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature, UseProgressiveRenderingSignature];
|
|
5
5
|
export declare const SCATTER_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartProPluginSignatures>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type UseChartZAxisSignature, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartHighlightSignature, type UseChartClosestPointSignature, type UseChartKeyboardNavigationSignature, type UseChartBrushSignature, type ConvertSignaturesIntoPlugins, type UseChartVisibilityManagerSignature } from '@mui/x-charts/internals';
|
|
1
|
+
import { type UseChartZAxisSignature, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartHighlightSignature, type UseChartClosestPointSignature, type UseChartKeyboardNavigationSignature, type UseChartBrushSignature, type ConvertSignaturesIntoPlugins, type UseChartVisibilityManagerSignature, type UseProgressiveRenderingSignature } from '@mui/x-charts/internals';
|
|
2
2
|
import { type UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
|
|
3
3
|
import { type UseChartProZoomSignature } from "../internals/plugins/useChartProZoom/index.js";
|
|
4
|
-
export type ScatterChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<'scatter'>, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature<'scatter'>, UseChartVisibilityManagerSignature<'scatter'>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
4
|
+
export type ScatterChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<'scatter'>, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature<'scatter'>, UseChartVisibilityManagerSignature<'scatter'>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature, UseProgressiveRenderingSignature];
|
|
5
5
|
export declare const SCATTER_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartProPluginSignatures>;
|
|
@@ -7,4 +7,4 @@ exports.SCATTER_CHART_PRO_PLUGINS = void 0;
|
|
|
7
7
|
var _internals = require("@mui/x-charts/internals");
|
|
8
8
|
var _useChartProExport = require("../internals/plugins/useChartProExport");
|
|
9
9
|
var _useChartProZoom = require("../internals/plugins/useChartProZoom");
|
|
10
|
-
const SCATTER_CHART_PRO_PLUGINS = exports.SCATTER_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartTooltip, _internals.useChartInteraction, _internals.useChartCartesianAxis, _internals.useChartHighlight, _internals.useChartVisibilityManager, _internals.useChartClosestPoint, _internals.useChartKeyboardNavigation, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
|
|
10
|
+
const SCATTER_CHART_PRO_PLUGINS = exports.SCATTER_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartTooltip, _internals.useChartInteraction, _internals.useChartCartesianAxis, _internals.useChartHighlight, _internals.useChartVisibilityManager, _internals.useChartClosestPoint, _internals.useChartKeyboardNavigation, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport, _internals.useProgressiveRendering];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useChartZAxis, useChartCartesianAxis, useChartTooltip, useChartInteraction, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation, useChartBrush, useChartVisibilityManager } from '@mui/x-charts/internals';
|
|
1
|
+
import { useChartZAxis, useChartCartesianAxis, useChartTooltip, useChartInteraction, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation, useChartBrush, useChartVisibilityManager, useProgressiveRendering } from '@mui/x-charts/internals';
|
|
2
2
|
import { useChartProExport } from "../internals/plugins/useChartProExport/index.mjs";
|
|
3
3
|
import { useChartProZoom } from "../internals/plugins/useChartProZoom/index.mjs";
|
|
4
|
-
export const SCATTER_CHART_PRO_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartClosestPoint, useChartKeyboardNavigation, useChartProZoom, useChartProExport];
|
|
4
|
+
export const SCATTER_CHART_PRO_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartClosestPoint, useChartKeyboardNavigation, useChartProZoom, useChartProExport, useProgressiveRendering];
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type ChartSeriesType, type ConvertSignaturesIntoPlugins, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartZAxisSignature, type UseChartHighlightSignature, type UseChartPolarAxisSignature, type UseChartBrushSignature, type UseChartVisibilityManagerSignature } from '@mui/x-charts/internals';
|
|
1
|
+
import { type ChartSeriesType, type ConvertSignaturesIntoPlugins, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartZAxisSignature, type UseChartHighlightSignature, type UseChartPolarAxisSignature, type UseChartBrushSignature, type UseChartVisibilityManagerSignature, type UseProgressiveRenderingSignature } from '@mui/x-charts/internals';
|
|
2
2
|
import { type UseChartProExportSignature } from "./useChartProExport/index.mjs";
|
|
3
3
|
import { type UseChartProZoomSignature } from "./useChartProZoom/index.mjs";
|
|
4
|
-
export type AllPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType
|
|
4
|
+
export type AllPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType>, UseProgressiveRenderingSignature];
|
|
5
5
|
export type AllPluginsType<SeriesType extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<AllPluginSignatures<SeriesType>>;
|
|
6
|
-
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartPolarAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
7
|
-
export type DefaultPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType
|
|
6
|
+
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseProgressiveRenderingSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartPolarAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
7
|
+
export type DefaultPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType>, UseProgressiveRenderingSignature];
|
|
8
8
|
export type DefaultPluginsType<SeriesType extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<DefaultPluginSignatures<SeriesType>>;
|
|
9
|
-
export declare const DEFAULT_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
9
|
+
export declare const DEFAULT_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseProgressiveRenderingSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type ChartSeriesType, type ConvertSignaturesIntoPlugins, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartZAxisSignature, type UseChartHighlightSignature, type UseChartPolarAxisSignature, type UseChartBrushSignature, type UseChartVisibilityManagerSignature } from '@mui/x-charts/internals';
|
|
1
|
+
import { type ChartSeriesType, type ConvertSignaturesIntoPlugins, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartZAxisSignature, type UseChartHighlightSignature, type UseChartPolarAxisSignature, type UseChartBrushSignature, type UseChartVisibilityManagerSignature, type UseProgressiveRenderingSignature } from '@mui/x-charts/internals';
|
|
2
2
|
import { type UseChartProExportSignature } from "./useChartProExport/index.js";
|
|
3
3
|
import { type UseChartProZoomSignature } from "./useChartProZoom/index.js";
|
|
4
|
-
export type AllPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType
|
|
4
|
+
export type AllPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType>, UseProgressiveRenderingSignature];
|
|
5
5
|
export type AllPluginsType<SeriesType extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<AllPluginSignatures<SeriesType>>;
|
|
6
|
-
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartPolarAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
7
|
-
export type DefaultPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType
|
|
6
|
+
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseProgressiveRenderingSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartPolarAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
7
|
+
export type DefaultPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType>, UseProgressiveRenderingSignature];
|
|
8
8
|
export type DefaultPluginsType<SeriesType extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<DefaultPluginSignatures<SeriesType>>;
|
|
9
|
-
export declare const DEFAULT_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
9
|
+
export declare const DEFAULT_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseProgressiveRenderingSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
@@ -9,5 +9,5 @@ var _useChartProExport = require("./useChartProExport");
|
|
|
9
9
|
var _useChartProZoom = require("./useChartProZoom");
|
|
10
10
|
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
11
11
|
|
|
12
|
-
const ALL_PLUGINS = exports.ALL_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartTooltip, _internals.useChartInteraction, _internals.useChartCartesianAxis, _internals.useChartPolarAxis, _internals.useChartHighlight, _internals.useChartVisibilityManager, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport, _internals.useChartVisibilityManager];
|
|
13
|
-
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartTooltip, _internals.useChartInteraction, _internals.useChartCartesianAxis, _internals.useChartHighlight, _internals.useChartVisibilityManager, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport, _internals.useChartVisibilityManager];
|
|
12
|
+
const ALL_PLUGINS = exports.ALL_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartTooltip, _internals.useChartInteraction, _internals.useChartCartesianAxis, _internals.useChartPolarAxis, _internals.useChartHighlight, _internals.useChartVisibilityManager, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport, _internals.useChartVisibilityManager, _internals.useProgressiveRendering];
|
|
13
|
+
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartTooltip, _internals.useChartInteraction, _internals.useChartCartesianAxis, _internals.useChartHighlight, _internals.useChartVisibilityManager, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport, _internals.useChartVisibilityManager, _internals.useProgressiveRendering];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
2
2
|
|
|
3
|
-
import { useChartCartesianAxis, useChartTooltip, useChartInteraction, useChartZAxis, useChartHighlight, useChartPolarAxis, useChartBrush, useChartVisibilityManager } from '@mui/x-charts/internals';
|
|
3
|
+
import { useChartCartesianAxis, useChartTooltip, useChartInteraction, useChartZAxis, useChartHighlight, useChartPolarAxis, useChartBrush, useChartVisibilityManager, useProgressiveRendering } from '@mui/x-charts/internals';
|
|
4
4
|
import { useChartProExport } from "./useChartProExport/index.mjs";
|
|
5
5
|
import { useChartProZoom } from "./useChartProZoom/index.mjs";
|
|
6
|
-
export const ALL_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartPolarAxis, useChartHighlight, useChartVisibilityManager, useChartProZoom, useChartProExport, useChartVisibilityManager];
|
|
7
|
-
export const DEFAULT_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartProZoom, useChartProExport, useChartVisibilityManager];
|
|
6
|
+
export const ALL_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartPolarAxis, useChartHighlight, useChartVisibilityManager, useChartProZoom, useChartProExport, useChartVisibilityManager, useProgressiveRendering];
|
|
7
|
+
export const DEFAULT_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartProZoom, useChartProExport, useChartVisibilityManager, useProgressiveRendering];
|
|
@@ -10,6 +10,7 @@ var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/form
|
|
|
10
10
|
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
11
11
|
var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"));
|
|
12
12
|
var _export = require("@mui/x-internals/export");
|
|
13
|
+
var _warning = require("@mui/x-internals/warning");
|
|
13
14
|
var _common = require("./common");
|
|
14
15
|
var _defaults = require("./defaults");
|
|
15
16
|
const getDrawDocument = async () => {
|
|
@@ -30,11 +31,15 @@ async function exportImage(element, svg, params) {
|
|
|
30
31
|
quality = 0.9,
|
|
31
32
|
onBeforeExport = _defaults.defaultOnBeforeExport,
|
|
32
33
|
copyStyles = true,
|
|
33
|
-
nonce
|
|
34
|
+
nonce,
|
|
35
|
+
pixelRatio
|
|
34
36
|
} = params ?? {};
|
|
37
|
+
if (process.env.NODE_ENV !== 'production' && pixelRatio !== undefined && (!Number.isFinite(pixelRatio) || pixelRatio <= 0)) {
|
|
38
|
+
(0, _warning.warnOnce)('MUI X Charts: `pixelRatio` must be a finite number greater than 0 when exporting a chart as an image.', 'error');
|
|
39
|
+
}
|
|
35
40
|
const drawDocumentPromise = getDrawDocument();
|
|
36
41
|
const doc = (0, _ownerDocument.default)(element);
|
|
37
|
-
const ratio = Math.max(window.devicePixelRatio || 1, 1);
|
|
42
|
+
const ratio = pixelRatio ?? Math.max(window.devicePixelRatio || 1, 1);
|
|
38
43
|
const iframe = (0, _common.createExportIframe)(fileName);
|
|
39
44
|
/* We apply the min/max width and height to ensure the SVG doesn't resize in the export.
|
|
40
45
|
* We apply to the original SVG so that the cloned tree will contain the styles and revert these
|
|
@@ -49,6 +54,7 @@ async function exportImage(element, svg, params) {
|
|
|
49
54
|
iframe.onload = async () => {
|
|
50
55
|
const exportDoc = iframe.contentDocument;
|
|
51
56
|
const elementClone = element.cloneNode(true);
|
|
57
|
+
elementClone.querySelectorAll('[data-hide-on-export]').forEach(el => el.remove());
|
|
52
58
|
(0, _common.applyStyles)(svg, previousStyles);
|
|
53
59
|
exportDoc.body.replaceChildren(elementClone);
|
|
54
60
|
exportDoc.body.style.margin = '0px';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
|
|
2
2
|
import ownerDocument from '@mui/utils/ownerDocument';
|
|
3
3
|
import { loadStyleSheets } from '@mui/x-internals/export';
|
|
4
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
4
5
|
import { applyStyles, copyCanvasesContent, createExportIframe } from "./common.mjs";
|
|
5
6
|
import { defaultOnBeforeExport } from "./defaults.mjs";
|
|
6
7
|
export const getDrawDocument = async () => {
|
|
@@ -20,11 +21,15 @@ export async function exportImage(element, svg, params) {
|
|
|
20
21
|
quality = 0.9,
|
|
21
22
|
onBeforeExport = defaultOnBeforeExport,
|
|
22
23
|
copyStyles = true,
|
|
23
|
-
nonce
|
|
24
|
+
nonce,
|
|
25
|
+
pixelRatio
|
|
24
26
|
} = params ?? {};
|
|
27
|
+
if (process.env.NODE_ENV !== 'production' && pixelRatio !== undefined && (!Number.isFinite(pixelRatio) || pixelRatio <= 0)) {
|
|
28
|
+
warnOnce('MUI X Charts: `pixelRatio` must be a finite number greater than 0 when exporting a chart as an image.', 'error');
|
|
29
|
+
}
|
|
25
30
|
const drawDocumentPromise = getDrawDocument();
|
|
26
31
|
const doc = ownerDocument(element);
|
|
27
|
-
const ratio = Math.max(window.devicePixelRatio || 1, 1);
|
|
32
|
+
const ratio = pixelRatio ?? Math.max(window.devicePixelRatio || 1, 1);
|
|
28
33
|
const iframe = createExportIframe(fileName);
|
|
29
34
|
/* We apply the min/max width and height to ensure the SVG doesn't resize in the export.
|
|
30
35
|
* We apply to the original SVG so that the cloned tree will contain the styles and revert these
|
|
@@ -39,6 +44,7 @@ export async function exportImage(element, svg, params) {
|
|
|
39
44
|
iframe.onload = async () => {
|
|
40
45
|
const exportDoc = iframe.contentDocument;
|
|
41
46
|
const elementClone = element.cloneNode(true);
|
|
47
|
+
elementClone.querySelectorAll('[data-hide-on-export]').forEach(el => el.remove());
|
|
42
48
|
applyStyles(svg, previousStyles);
|
|
43
49
|
exportDoc.body.replaceChildren(elementClone);
|
|
44
50
|
exportDoc.body.style.margin = '0px';
|
|
@@ -20,6 +20,7 @@ function printChart(element, {
|
|
|
20
20
|
printWindow.onload = async () => {
|
|
21
21
|
const printDoc = printWindow.contentDocument;
|
|
22
22
|
const elementClone = element.cloneNode(true);
|
|
23
|
+
elementClone.querySelectorAll('[data-hide-on-export]').forEach(el => el.remove());
|
|
23
24
|
printDoc.body.replaceChildren(elementClone);
|
|
24
25
|
printDoc.body.style.margin = '0px';
|
|
25
26
|
const rootCandidate = element.getRootNode();
|
|
@@ -13,6 +13,7 @@ export function printChart(element, {
|
|
|
13
13
|
printWindow.onload = async () => {
|
|
14
14
|
const printDoc = printWindow.contentDocument;
|
|
15
15
|
const elementClone = element.cloneNode(true);
|
|
16
|
+
elementClone.querySelectorAll('[data-hide-on-export]').forEach(el => el.remove());
|
|
16
17
|
printDoc.body.replaceChildren(elementClone);
|
|
17
18
|
printDoc.body.style.margin = '0px';
|
|
18
19
|
const rootCandidate = element.getRootNode();
|
|
@@ -55,6 +55,12 @@ export interface ChartImageExportOptions extends ChartExportOptions {
|
|
|
55
55
|
* @default 0.9
|
|
56
56
|
*/
|
|
57
57
|
quality?: number;
|
|
58
|
+
/**
|
|
59
|
+
* The pixel ratio used when rasterizing the chart to a canvas. Higher values produce
|
|
60
|
+
* sharper images at the cost of a larger file size.
|
|
61
|
+
* @default The larger of `window.devicePixelRatio` and `1`
|
|
62
|
+
*/
|
|
63
|
+
pixelRatio?: number;
|
|
58
64
|
}
|
|
59
65
|
export interface UseChartProExportPublicApi {
|
|
60
66
|
/**
|
|
@@ -55,6 +55,12 @@ export interface ChartImageExportOptions extends ChartExportOptions {
|
|
|
55
55
|
* @default 0.9
|
|
56
56
|
*/
|
|
57
57
|
quality?: number;
|
|
58
|
+
/**
|
|
59
|
+
* The pixel ratio used when rasterizing the chart to a canvas. Higher values produce
|
|
60
|
+
* sharper images at the cost of a larger file size.
|
|
61
|
+
* @default The larger of `window.devicePixelRatio` and `1`
|
|
62
|
+
*/
|
|
63
|
+
pixelRatio?: number;
|
|
58
64
|
}
|
|
59
65
|
export interface UseChartProExportPublicApi {
|
|
60
66
|
/**
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
export declare const selectorZoomInteractionConfig: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.mjs").UseChartProZoomState & Partial<{}> & {
|
|
2
2
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
3
|
-
}, interactionName: "wheel" | "pinch" | "tapAndDrag" | "doubleTapReset" | "brush") => (Omit<
|
|
3
|
+
}, interactionName: "wheel" | "pinch" | "tapAndDrag" | "doubleTapReset" | "brush") => (Omit<{
|
|
4
|
+
type: "wheel";
|
|
5
|
+
pointerMode?: any;
|
|
6
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
7
|
+
} | {
|
|
8
|
+
type: "pinch";
|
|
9
|
+
pointerMode?: any;
|
|
10
|
+
requiredKeys?: any[] | undefined;
|
|
11
|
+
} | {
|
|
12
|
+
type: "tapAndDrag";
|
|
13
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
14
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
15
|
+
} | {
|
|
16
|
+
type: "doubleTapReset";
|
|
17
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
18
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
19
|
+
} | {
|
|
20
|
+
type: "brush";
|
|
21
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
22
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
23
|
+
}, "pointerMode"> & {
|
|
4
24
|
mouse: {
|
|
5
25
|
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[];
|
|
6
26
|
};
|
|
@@ -12,7 +32,20 @@ export declare const selectorZoomInteractionConfig: (args_0: import("@mui/x-char
|
|
|
12
32
|
}) | null;
|
|
13
33
|
export declare const selectorPanInteractionConfig: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.mjs").UseChartProZoomState & Partial<{}> & {
|
|
14
34
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
15
|
-
}, interactionName: "wheel" | "drag" | "pressAndDrag") => (Omit<
|
|
35
|
+
}, interactionName: "wheel" | "drag" | "pressAndDrag") => (Omit<{
|
|
36
|
+
type: "drag";
|
|
37
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
38
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
39
|
+
} | {
|
|
40
|
+
type: "pressAndDrag";
|
|
41
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
42
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
43
|
+
} | {
|
|
44
|
+
type: "wheel";
|
|
45
|
+
allowedDirection?: "x" | "y" | "xy" | undefined;
|
|
46
|
+
pointerMode?: any;
|
|
47
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
48
|
+
}, "pointerMode"> & {
|
|
16
49
|
mouse: {
|
|
17
50
|
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[];
|
|
18
51
|
};
|
|
@@ -21,5 +54,4 @@ export declare const selectorPanInteractionConfig: (args_0: import("@mui/x-chart
|
|
|
21
54
|
};
|
|
22
55
|
pointerMode?: import("@mui/x-internal-gestures/core").PointerMode[];
|
|
23
56
|
allowedDirection?: "x" | "y" | "xy";
|
|
24
|
-
}) | null;
|
|
25
|
-
export declare const selectorIsZoomBrushEnabled: (args_0: {}, zoomInteractionConfig: any) => any;
|
|
57
|
+
}) | null;
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
export declare const selectorZoomInteractionConfig: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
2
2
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
3
|
-
}, interactionName: "wheel" | "pinch" | "tapAndDrag" | "doubleTapReset" | "brush") => (Omit<
|
|
3
|
+
}, interactionName: "wheel" | "pinch" | "tapAndDrag" | "doubleTapReset" | "brush") => (Omit<{
|
|
4
|
+
type: "wheel";
|
|
5
|
+
pointerMode?: any;
|
|
6
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
7
|
+
} | {
|
|
8
|
+
type: "pinch";
|
|
9
|
+
pointerMode?: any;
|
|
10
|
+
requiredKeys?: any[] | undefined;
|
|
11
|
+
} | {
|
|
12
|
+
type: "tapAndDrag";
|
|
13
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
14
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
15
|
+
} | {
|
|
16
|
+
type: "doubleTapReset";
|
|
17
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
18
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
19
|
+
} | {
|
|
20
|
+
type: "brush";
|
|
21
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
22
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
23
|
+
}, "pointerMode"> & {
|
|
4
24
|
mouse: {
|
|
5
25
|
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[];
|
|
6
26
|
};
|
|
@@ -12,7 +32,20 @@ export declare const selectorZoomInteractionConfig: (args_0: import("@mui/x-char
|
|
|
12
32
|
}) | null;
|
|
13
33
|
export declare const selectorPanInteractionConfig: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
14
34
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
15
|
-
}, interactionName: "wheel" | "drag" | "pressAndDrag") => (Omit<
|
|
35
|
+
}, interactionName: "wheel" | "drag" | "pressAndDrag") => (Omit<{
|
|
36
|
+
type: "drag";
|
|
37
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
38
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
39
|
+
} | {
|
|
40
|
+
type: "pressAndDrag";
|
|
41
|
+
pointerMode?: ("mouse" | "touch") | undefined;
|
|
42
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
43
|
+
} | {
|
|
44
|
+
type: "wheel";
|
|
45
|
+
allowedDirection?: "x" | "y" | "xy" | undefined;
|
|
46
|
+
pointerMode?: any;
|
|
47
|
+
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[] | undefined;
|
|
48
|
+
}, "pointerMode"> & {
|
|
16
49
|
mouse: {
|
|
17
50
|
requiredKeys?: import("@mui/x-internal-gestures/core").KeyboardKey[];
|
|
18
51
|
};
|
|
@@ -21,5 +54,4 @@ export declare const selectorPanInteractionConfig: (args_0: import("@mui/x-chart
|
|
|
21
54
|
};
|
|
22
55
|
pointerMode?: import("@mui/x-internal-gestures/core").PointerMode[];
|
|
23
56
|
allowedDirection?: "x" | "y" | "xy";
|
|
24
|
-
}) | null;
|
|
25
|
-
export declare const selectorIsZoomBrushEnabled: (args_0: {}, zoomInteractionConfig: any) => any;
|
|
57
|
+
}) | null;
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectorZoomInteractionConfig = exports.selectorPanInteractionConfig =
|
|
6
|
+
exports.selectorZoomInteractionConfig = exports.selectorPanInteractionConfig = void 0;
|
|
7
7
|
var _store = require("@mui/x-internals/store");
|
|
8
|
-
var _internals = require("@mui/x-charts/internals");
|
|
9
8
|
var _useChartProZoom = require("./useChartProZoom.selectors");
|
|
10
9
|
const selectorZoomInteractionConfig = exports.selectorZoomInteractionConfig = (0, _store.createSelector)(_useChartProZoom.selectorChartZoomState, (zoomState, interactionName) => zoomState.zoomInteractionConfig.zoom[interactionName] ?? null);
|
|
11
|
-
const selectorPanInteractionConfig = exports.selectorPanInteractionConfig = (0, _store.createSelector)(_useChartProZoom.selectorChartZoomState, (zoomState, interactionName) => zoomState.zoomInteractionConfig.pan[interactionName] ?? null);
|
|
12
|
-
const selectorIsZoomBrushEnabled = exports.selectorIsZoomBrushEnabled = (0, _store.createSelector)(_internals.selectorChartZoomOptionsLookup, state => selectorZoomInteractionConfig(state, 'brush'), (zoomOptions, zoomInteractionConfig) => Object.keys(zoomOptions).length > 0 && zoomInteractionConfig || false);
|
|
10
|
+
const selectorPanInteractionConfig = exports.selectorPanInteractionConfig = (0, _store.createSelector)(_useChartProZoom.selectorChartZoomState, (zoomState, interactionName) => zoomState.zoomInteractionConfig.pan[interactionName] ?? null);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { createSelector } from '@mui/x-internals/store';
|
|
2
|
-
import { selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
3
2
|
import { selectorChartZoomState } from "./useChartProZoom.selectors.mjs";
|
|
4
3
|
export const selectorZoomInteractionConfig = createSelector(selectorChartZoomState, (zoomState, interactionName) => zoomState.zoomInteractionConfig.zoom[interactionName] ?? null);
|
|
5
|
-
export const selectorPanInteractionConfig = createSelector(selectorChartZoomState, (zoomState, interactionName) => zoomState.zoomInteractionConfig.pan[interactionName] ?? null);
|
|
6
|
-
export const selectorIsZoomBrushEnabled = createSelector(selectorChartZoomOptionsLookup, state => selectorZoomInteractionConfig(state, 'brush'), (zoomOptions, zoomInteractionConfig) => Object.keys(zoomOptions).length > 0 && zoomInteractionConfig || false);
|
|
4
|
+
export const selectorPanInteractionConfig = createSelector(selectorChartZoomState, (zoomState, interactionName) => zoomState.zoomInteractionConfig.pan[interactionName] ?? null);
|
|
@@ -35,11 +35,11 @@ export type DefaultizedZoomInteractionConfig = {
|
|
|
35
35
|
zoom: Entry<ZoomInteraction>;
|
|
36
36
|
pan: Entry<PanInteraction>;
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
type ZoomInteraction = WheelInteraction | PinchInteraction | TapAndDragInteraction | DoubleTapResetInteraction | BrushInteraction;
|
|
39
|
+
type PanInteraction = DragInteraction | PressAndDragInteraction | WheelPanInteraction;
|
|
40
40
|
export type ZoomInteractionName = ZoomInteraction['type'];
|
|
41
41
|
export type PanInteractionName = PanInteraction['type'];
|
|
42
|
-
|
|
42
|
+
type InteractionMode = Exclude<PointerMode, 'pen'>;
|
|
43
43
|
type AllKeysProp = {
|
|
44
44
|
/**
|
|
45
45
|
* The keys that must be pressed to trigger the interaction.
|
|
@@ -68,22 +68,22 @@ type NoModeProp = {
|
|
|
68
68
|
pointerMode?: any;
|
|
69
69
|
};
|
|
70
70
|
type Unpack<T> = { [K in keyof T]: T[K] extends object ? Unpack<T[K]> : T[K] };
|
|
71
|
-
|
|
71
|
+
type WheelInteraction = Unpack<{
|
|
72
72
|
type: 'wheel';
|
|
73
73
|
} & NoModeProp & AllKeysProp>;
|
|
74
|
-
|
|
74
|
+
type PinchInteraction = Unpack<{
|
|
75
75
|
type: 'pinch';
|
|
76
76
|
} & NoModeProp & NoKeysProp>;
|
|
77
|
-
|
|
77
|
+
type DragInteraction = Unpack<{
|
|
78
78
|
type: 'drag';
|
|
79
79
|
} & AllModeProp & AllKeysProp>;
|
|
80
|
-
|
|
80
|
+
type TapAndDragInteraction = Unpack<{
|
|
81
81
|
type: 'tapAndDrag';
|
|
82
82
|
} & AllModeProp & AllKeysProp>;
|
|
83
|
-
|
|
83
|
+
type PressAndDragInteraction = Unpack<{
|
|
84
84
|
type: 'pressAndDrag';
|
|
85
85
|
} & AllModeProp & AllKeysProp>;
|
|
86
|
-
|
|
86
|
+
type WheelPanInteraction = Unpack<{
|
|
87
87
|
type: 'wheel';
|
|
88
88
|
/**
|
|
89
89
|
* Defines which axes are affected by pan on wheel.
|
|
@@ -94,10 +94,10 @@ export type WheelPanInteraction = Unpack<{
|
|
|
94
94
|
*/
|
|
95
95
|
allowedDirection?: 'x' | 'y' | 'xy';
|
|
96
96
|
} & NoModeProp & AllKeysProp>;
|
|
97
|
-
|
|
97
|
+
type DoubleTapResetInteraction = Unpack<{
|
|
98
98
|
type: 'doubleTapReset';
|
|
99
99
|
} & AllModeProp & AllKeysProp>;
|
|
100
|
-
|
|
100
|
+
type BrushInteraction = Unpack<{
|
|
101
101
|
type: 'brush';
|
|
102
102
|
} & AllModeProp & AllKeysProp>;
|
|
103
103
|
export type AnyInteraction = {
|
|
@@ -35,11 +35,11 @@ export type DefaultizedZoomInteractionConfig = {
|
|
|
35
35
|
zoom: Entry<ZoomInteraction>;
|
|
36
36
|
pan: Entry<PanInteraction>;
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
type ZoomInteraction = WheelInteraction | PinchInteraction | TapAndDragInteraction | DoubleTapResetInteraction | BrushInteraction;
|
|
39
|
+
type PanInteraction = DragInteraction | PressAndDragInteraction | WheelPanInteraction;
|
|
40
40
|
export type ZoomInteractionName = ZoomInteraction['type'];
|
|
41
41
|
export type PanInteractionName = PanInteraction['type'];
|
|
42
|
-
|
|
42
|
+
type InteractionMode = Exclude<PointerMode, 'pen'>;
|
|
43
43
|
type AllKeysProp = {
|
|
44
44
|
/**
|
|
45
45
|
* The keys that must be pressed to trigger the interaction.
|
|
@@ -68,22 +68,22 @@ type NoModeProp = {
|
|
|
68
68
|
pointerMode?: any;
|
|
69
69
|
};
|
|
70
70
|
type Unpack<T> = { [K in keyof T]: T[K] extends object ? Unpack<T[K]> : T[K] };
|
|
71
|
-
|
|
71
|
+
type WheelInteraction = Unpack<{
|
|
72
72
|
type: 'wheel';
|
|
73
73
|
} & NoModeProp & AllKeysProp>;
|
|
74
|
-
|
|
74
|
+
type PinchInteraction = Unpack<{
|
|
75
75
|
type: 'pinch';
|
|
76
76
|
} & NoModeProp & NoKeysProp>;
|
|
77
|
-
|
|
77
|
+
type DragInteraction = Unpack<{
|
|
78
78
|
type: 'drag';
|
|
79
79
|
} & AllModeProp & AllKeysProp>;
|
|
80
|
-
|
|
80
|
+
type TapAndDragInteraction = Unpack<{
|
|
81
81
|
type: 'tapAndDrag';
|
|
82
82
|
} & AllModeProp & AllKeysProp>;
|
|
83
|
-
|
|
83
|
+
type PressAndDragInteraction = Unpack<{
|
|
84
84
|
type: 'pressAndDrag';
|
|
85
85
|
} & AllModeProp & AllKeysProp>;
|
|
86
|
-
|
|
86
|
+
type WheelPanInteraction = Unpack<{
|
|
87
87
|
type: 'wheel';
|
|
88
88
|
/**
|
|
89
89
|
* Defines which axes are affected by pan on wheel.
|
|
@@ -94,10 +94,10 @@ export type WheelPanInteraction = Unpack<{
|
|
|
94
94
|
*/
|
|
95
95
|
allowedDirection?: 'x' | 'y' | 'xy';
|
|
96
96
|
} & NoModeProp & AllKeysProp>;
|
|
97
|
-
|
|
97
|
+
type DoubleTapResetInteraction = Unpack<{
|
|
98
98
|
type: 'doubleTapReset';
|
|
99
99
|
} & AllModeProp & AllKeysProp>;
|
|
100
|
-
|
|
100
|
+
type BrushInteraction = Unpack<{
|
|
101
101
|
type: 'brush';
|
|
102
102
|
} & AllModeProp & AllKeysProp>;
|
|
103
103
|
export type AnyInteraction = {
|