vccs 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -0
- package/dist/animation/Animate.d.ts +1 -1
- package/dist/cartesian/area/type.d.ts +3 -3
- package/dist/cartesian/bar/type.d.ts +1 -13
- package/dist/cartesian/brush/components/Slide.d.ts +1 -1
- package/dist/cartesian/brush/components/TravellerLayer.d.ts +1 -1
- package/dist/cartesian/brush/type.d.ts +2 -1
- package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +2 -1
- package/dist/cartesian/funnel/Funnel.d.ts +2 -0
- package/dist/cartesian/funnel/index.d.ts +2 -0
- package/dist/cartesian/funnel/type.d.ts +74 -6
- package/dist/cartesian/index.d.ts +2 -0
- package/dist/cartesian/line/Line.d.ts +7 -13
- package/dist/cartesian/line/type.d.ts +4 -17
- package/dist/cartesian/reference-area/ReferenceArea.d.ts +16 -16
- package/dist/cartesian/reference-dot/ReferenceDot.d.ts +143 -0
- package/dist/cartesian/reference-dot/index.d.ts +2 -0
- package/dist/cartesian/reference-line/ReferenceLine.d.ts +8 -8
- package/dist/cartesian/scatter/Scatter.d.ts +1 -1
- package/dist/chart/FunnelChart.d.ts +1 -0
- package/dist/chart/RechartsWrapper.d.ts +7 -3
- package/dist/chart/Surface.d.ts +2 -1
- package/dist/chart/Treemap.d.ts +237 -0
- package/dist/chart/generateCategoricalChart.d.ts +2 -1
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/treemapUtils.d.ts +22 -0
- package/dist/components/Customized.d.ts +23 -0
- package/dist/components/Text.d.ts +4 -4
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/label/Label.d.ts +3 -3
- package/dist/components/label/types.d.ts +1 -1
- package/dist/container/Surface.d.ts +3 -2
- package/dist/es/animation/Animate.mjs +48 -22
- package/dist/es/cartesian/GraphicalItemClipPath.mjs +16 -15
- package/dist/es/cartesian/area/ActivePoints.mjs +44 -40
- package/dist/es/cartesian/area/Area.mjs +42 -31
- package/dist/es/cartesian/area/ClipRect.mjs +79 -58
- package/dist/es/cartesian/area/RenderArea.mjs +142 -108
- package/dist/es/cartesian/area/hooks/useArea.mjs +71 -47
- package/dist/es/cartesian/area/type.mjs +13 -15
- package/dist/es/cartesian/area/utils.mjs +69 -49
- package/dist/es/cartesian/axis/XAxis.mjs +87 -73
- package/dist/es/cartesian/axis/YAxis.mjs +67 -56
- package/dist/es/cartesian/bar/Bar.mjs +78 -71
- package/dist/es/cartesian/bar/components/BarBackground.mjs +22 -19
- package/dist/es/cartesian/bar/components/BarRectangles.mjs +117 -80
- package/dist/es/cartesian/bar/hooks/useBar.mjs +49 -37
- package/dist/es/cartesian/bar/type.mjs +11 -25
- package/dist/es/cartesian/bar/utils.mjs +97 -70
- package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +165 -115
- package/dist/es/cartesian/cartesian-grid/Background.mjs +19 -16
- package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +116 -97
- package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +24 -23
- package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +24 -24
- package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +23 -22
- package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +24 -24
- package/dist/es/cartesian/cartesian-grid/const.mjs +317 -10
- package/dist/es/cartesian/cartesian-grid/utils.mjs +18 -13
- package/dist/es/cartesian/error-bar/ErrorBar.mjs +111 -83
- package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +13 -12
- package/dist/es/cartesian/funnel/Funnel.mjs +162 -0
- package/dist/es/cartesian/funnel/type.mjs +78 -0
- package/dist/es/cartesian/funnel/utils.mjs +102 -0
- package/dist/es/cartesian/line/ActivePoints.mjs +45 -41
- package/dist/es/cartesian/line/Line.mjs +41 -37
- package/dist/es/cartesian/line/StaticLine.mjs +191 -122
- package/dist/es/cartesian/line/hooks/useLine.mjs +60 -44
- package/dist/es/cartesian/line/type.mjs +13 -18
- package/dist/es/cartesian/line/utils.mjs +27 -26
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +79 -78
- package/dist/es/cartesian/reference-dot/ReferenceDot.mjs +134 -0
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +93 -84
- package/dist/es/cartesian/scatter/Scatter.mjs +168 -140
- package/dist/es/cartesian/scatter/hooks/useScatter.mjs +18 -14
- package/dist/es/cartesian/useNeedsClip.mjs +18 -9
- package/dist/es/cartesian/utils/get-ticks.mjs +103 -68
- package/dist/es/cartesian/z-axis/ZAxis.mjs +30 -28
- package/dist/es/chart/AreaChart.mjs +5 -5
- package/dist/es/chart/BarChart.mjs +5 -5
- package/dist/es/chart/ComposedChart.mjs +5 -5
- package/dist/es/chart/FunnelChart.mjs +11 -0
- package/dist/es/chart/LegendPortalContext.mjs +3 -3
- package/dist/es/chart/LineChart.mjs +5 -5
- package/dist/es/chart/PieChart.mjs +5 -5
- package/dist/es/chart/RadarChart.mjs +5 -5
- package/dist/es/chart/RadialBarChart.mjs +5 -5
- package/dist/es/chart/RechartsWrapper.mjs +113 -89
- package/dist/es/chart/ScatterChart.mjs +5 -5
- package/dist/es/chart/Surface.mjs +3 -3
- package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +51 -45
- package/dist/es/chart/TooltipPortalContext.mjs +3 -3
- package/dist/es/chart/Treemap.mjs +379 -0
- package/dist/es/chart/const.mjs +2 -2
- package/dist/es/chart/generateCategoricalChart.mjs +99 -89
- package/dist/es/chart/provideClipPathId.mjs +12 -7
- package/dist/es/chart/treemapUtils.mjs +32 -0
- package/dist/es/components/Cell.mjs +16 -4
- package/dist/es/components/Customized.mjs +43 -0
- package/dist/es/components/Text.mjs +3 -3
- package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +106 -69
- package/dist/es/components/Tooltip.mjs +274 -199
- package/dist/es/components/label/Label.mjs +30 -26
- package/dist/es/components/label/LabelList.mjs +45 -39
- package/dist/es/components/label/types.mjs +10 -6
- package/dist/es/components/label/utils.mjs +194 -162
- package/dist/es/components/legend/Legend.mjs +82 -71
- package/dist/es/components/legend/LegendSymbol.mjs +40 -38
- package/dist/es/components/legend/hooks/useLegend.mjs +71 -46
- package/dist/es/components/legend/hooks/useLegendContent.mjs +52 -31
- package/dist/es/components/legend/type.mjs +2 -2
- package/dist/es/components/legend/utils.mjs +19 -11
- package/dist/es/components/utils.mjs +35 -22
- package/dist/es/container/ClipPath.mjs +14 -14
- package/dist/es/container/Layer.mjs +9 -7
- package/dist/es/container/ResponsiveContainer.mjs +3 -3
- package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +109 -77
- package/dist/es/container/Surface.mjs +25 -23
- package/dist/es/container/useSizeContext.mjs +3 -3
- package/dist/es/context/ChartDataContextProvider.mjs +19 -13
- package/dist/es/context/PanoramaContextProvider.mjs +15 -10
- package/dist/es/context/accessibilityContext.mjs +3 -3
- package/dist/es/context/cartesianLabelListContext.mjs +3 -3
- package/dist/es/context/chartLayoutContext.mjs +33 -30
- package/dist/es/context/cursorLayerContext.mjs +3 -3
- package/dist/es/context/graphicalLayerContext.mjs +3 -3
- package/dist/es/context/labelLayerContext.mjs +3 -3
- package/dist/es/context/polarLabelViewBoxContext.mjs +5 -5
- package/dist/es/context/useTooltipAxis.mjs +14 -12
- package/dist/es/events/useChartSynchronisation.mjs +91 -66
- package/dist/es/hooks/publicHooks.mjs +207 -0
- package/dist/es/hooks/useIsAnimating.mjs +28 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
- package/dist/es/index.mjs +54 -42
- package/dist/es/polar/pie/Pie.mjs +131 -115
- package/dist/es/polar/pie/type.mjs +8 -10
- package/dist/es/polar/radar/PolarAngleAxis.mjs +103 -84
- package/dist/es/polar/radar/PolarGrid.mjs +72 -59
- package/dist/es/polar/radar/PolarRadiusAxis.mjs +90 -65
- package/dist/es/polar/radar/Radar.mjs +181 -145
- package/dist/es/polar/radial-bar/RadialBar.mjs +161 -140
- package/dist/es/polar/radial-bar/type.mjs +9 -9
- package/dist/es/shape/Cross.mjs +11 -10
- package/dist/es/shape/Curve.mjs +71 -44
- package/dist/es/shape/Dot.mjs +12 -11
- package/dist/es/shape/Polygon.mjs +19 -0
- package/dist/es/shape/Rectangle.mjs +41 -30
- package/dist/es/shape/Sector.mjs +105 -79
- package/dist/es/shape/Symbols.mjs +45 -34
- package/dist/es/shape/Trapezoid.mjs +50 -0
- package/dist/es/state/ReportChartProps.mjs +23 -24
- package/dist/es/state/ReportMainChartProps.mjs +26 -21
- package/dist/es/state/ReportPolarOptions.mjs +23 -22
- package/dist/es/state/SetGraphicalItem.mjs +42 -27
- package/dist/es/state/SetLegendPayload.mjs +17 -13
- package/dist/es/state/SetTooltipEntrySettings.mjs +14 -12
- package/dist/es/state/brushSlice.mjs +12 -8
- package/dist/es/state/cartesianAxisSlice.mjs +23 -17
- package/dist/es/state/chartDataSlice.mjs +18 -13
- package/dist/es/state/externalEventsMiddleware.mjs +25 -15
- package/dist/es/state/graphicalItemsSlice.mjs +29 -25
- package/dist/es/state/hooks.mjs +24 -3
- package/dist/es/state/keyboardEventsMiddleware.mjs +50 -42
- package/dist/es/state/layoutSlice.mjs +18 -12
- package/dist/es/state/legendSlice.mjs +19 -14
- package/dist/es/state/mouseEventsMiddleware.mjs +31 -24
- package/dist/es/state/optionsSlice.mjs +14 -11
- package/dist/es/state/polarAxisSlice.mjs +15 -13
- package/dist/es/state/polarOptionsSlice.mjs +8 -6
- package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +5 -3
- package/dist/es/state/referenceElementsSlice.mjs +21 -19
- package/dist/es/state/rootPropsSlice.mjs +20 -9
- package/dist/es/state/selectors/areaSelectors.mjs +65 -55
- package/dist/es/state/selectors/axisSelectors.mjs +784 -569
- package/dist/es/state/selectors/barSelectors.mjs +225 -162
- package/dist/es/state/selectors/brushSelectors.mjs +15 -14
- package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +6 -5
- package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +36 -27
- package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +5 -3
- package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +13 -11
- package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +26 -21
- package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +10 -6
- package/dist/es/state/selectors/common.mjs +2 -2
- package/dist/es/state/selectors/containerSelectors.mjs +5 -2
- package/dist/es/state/selectors/dataSelectors.mjs +28 -9
- package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
- package/dist/es/state/selectors/legendSelectors.mjs +7 -6
- package/dist/es/state/selectors/lineSelectors.mjs +54 -47
- package/dist/es/state/selectors/pickAxisId.mjs +2 -2
- package/dist/es/state/selectors/pickAxisType.mjs +2 -2
- package/dist/es/state/selectors/pieSelectors.mjs +116 -81
- package/dist/es/state/selectors/polarAxisSelectors.mjs +113 -94
- package/dist/es/state/selectors/polarGridSelectors.mjs +13 -11
- package/dist/es/state/selectors/polarScaleSelectors.mjs +49 -46
- package/dist/es/state/selectors/polarSelectors.mjs +79 -62
- package/dist/es/state/selectors/radarSelectors.mjs +111 -91
- package/dist/es/state/selectors/radialBarSelectors.mjs +230 -183
- package/dist/es/state/selectors/rootPropsSelectors.mjs +11 -5
- package/dist/es/state/selectors/scatterSelectors.mjs +111 -95
- package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +19 -17
- package/dist/es/state/selectors/selectAllAxes.mjs +8 -3
- package/dist/es/state/selectors/selectChartOffset.mjs +59 -50
- package/dist/es/state/selectors/selectChartOffsetInternal.mjs +55 -44
- package/dist/es/state/selectors/selectTooltipEventType.mjs +15 -14
- package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +3 -3
- package/dist/es/state/selectors/selectTooltipSettings.mjs +2 -2
- package/dist/es/state/selectors/selectTooltipState.mjs +2 -2
- package/dist/es/state/selectors/selectors.mjs +94 -75
- package/dist/es/state/selectors/tooltipSelectors.mjs +253 -204
- package/dist/es/state/selectors/touchSelectors.mjs +17 -14
- package/dist/es/state/store.mjs +46 -46
- package/dist/es/state/tooltipSlice.mjs +64 -37
- package/dist/es/state/touchEventsMiddleware.mjs +35 -29
- package/dist/es/state/utils/useReportScale.mjs +16 -13
- package/dist/es/synchronisation/syncSelectors.mjs +3 -3
- package/dist/es/synchronisation/useChartSynchronisation.mjs +33 -19
- package/dist/es/types/common.mjs +12 -0
- package/dist/es/types/event.mjs +164 -2
- package/dist/es/utils/ReduceCSSCalc.mjs +81 -49
- package/dist/es/utils/VueUtils.mjs +35 -14
- package/dist/es/utils/attrs.mjs +43 -26
- package/dist/es/utils/cartesian.mjs +47 -15
- package/dist/es/utils/cell.mjs +28 -0
- package/dist/es/utils/chart.mjs +298 -197
- package/dist/es/utils/const.mjs +30 -2
- package/dist/es/utils/createCategoricalInverse.mjs +46 -0
- package/dist/es/utils/createContext.mjs +28 -9
- package/dist/es/utils/data-utils.mjs +9 -8
- package/dist/es/utils/data.mjs +35 -21
- package/dist/es/utils/events.mjs +5 -3
- package/dist/es/utils/getLinearRegression.mjs +28 -11
- package/dist/es/utils/grid.mjs +20 -5
- package/dist/es/utils/isDomainSpecifiedByUser.mjs +105 -54
- package/dist/es/utils/legend.mjs +13 -12
- package/dist/es/utils/log.mjs +10 -7
- package/dist/es/utils/payload/getUniqPayload.mjs +6 -4
- package/dist/es/utils/polar.mjs +37 -30
- package/dist/es/utils/props.mjs +16 -10
- package/dist/es/utils/resolveDefaultProps.mjs +23 -4
- package/dist/es/utils/scale/getNiceTickValues.mjs +127 -49
- package/dist/es/utils/scale/utils/arithmetic.mjs +49 -19
- package/dist/es/utils/scale/utils/utils.mjs +43 -24
- package/dist/es/utils/scale.mjs +46 -0
- package/dist/es/utils/style.mjs +24 -13
- package/dist/es/utils/tick.mjs +34 -23
- package/dist/es/utils/tooltip/translate.mjs +63 -49
- package/dist/es/utils/validate.mjs +40 -29
- package/dist/hooks/publicHooks.d.ts +143 -0
- package/dist/hooks/useIsAnimating.d.ts +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/polar/pie/type.d.ts +2 -2
- package/dist/polar/radar/Radar.d.ts +4 -4
- package/dist/shape/Curve.d.ts +2 -1
- package/dist/shape/Polygon.d.ts +9 -0
- package/dist/shape/Rectangle.d.ts +0 -4
- package/dist/shape/Sector.d.ts +2 -2
- package/dist/shape/Symbols.d.ts +2 -1
- package/dist/shape/Trapezoid.d.ts +30 -0
- package/dist/shape/index.d.ts +2 -0
- package/dist/shape/types.d.ts +4 -5
- package/dist/state/ReportChartProps.d.ts +3 -3
- package/dist/state/graphicalItemsSlice.d.ts +1 -1
- package/dist/state/rootPropsSlice.d.ts +2 -2
- package/dist/state/selectors/axisSelectors.d.ts +5 -0
- package/dist/types/axis.d.ts +2 -2
- package/dist/types/bar.d.ts +2 -6
- package/dist/types/categorical.d.ts +2 -2
- package/dist/types/common.d.ts +7 -1
- package/dist/types/tooltip.d.ts +2 -2
- package/dist/utils/cell.d.ts +11 -0
- package/dist/utils/createCategoricalInverse.d.ts +16 -0
- package/dist/utils/scale.d.ts +23 -0
- package/package.json +2 -1
|
@@ -1,34 +1,49 @@
|
|
|
1
|
-
import { getNormalizedStackId
|
|
2
|
-
import { useAppDispatch
|
|
3
|
-
import { addCartesianGraphicalItem
|
|
4
|
-
import { onUnmounted
|
|
1
|
+
import { getNormalizedStackId } from "../utils/chart.mjs";
|
|
2
|
+
import { useAppDispatch } from "./hooks.mjs";
|
|
3
|
+
import { addCartesianGraphicalItem, addPolarGraphicalItem, removeCartesianGraphicalItem, removePolarGraphicalItem, replaceCartesianGraphicalItem, replacePolarGraphicalItem } from "./graphicalItemsSlice.mjs";
|
|
4
|
+
import { onUnmounted, unref, watchEffect } from "vue";
|
|
5
5
|
//#region src/state/SetGraphicalItem.ts
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
function SetCartesianGraphicalItem(_props) {
|
|
7
|
+
const dispatch = useAppDispatch();
|
|
8
|
+
let preSetting = null;
|
|
9
|
+
watchEffect(() => {
|
|
10
|
+
const props = unref(_props);
|
|
11
|
+
const settings = {
|
|
12
|
+
...props,
|
|
13
|
+
stackId: getNormalizedStackId(props.stackId)
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
if (preSetting === null) dispatch(addCartesianGraphicalItem(settings));
|
|
16
|
+
else if (preSetting !== settings) dispatch(replaceCartesianGraphicalItem({
|
|
17
|
+
prev: preSetting,
|
|
18
|
+
next: settings
|
|
19
|
+
}));
|
|
20
|
+
preSetting = settings;
|
|
21
|
+
});
|
|
22
|
+
onUnmounted(() => {
|
|
23
|
+
if (preSetting) {
|
|
24
|
+
dispatch(removeCartesianGraphicalItem(preSetting));
|
|
25
|
+
preSetting = null;
|
|
26
|
+
}
|
|
19
27
|
});
|
|
20
28
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
function SetPolarGraphicalItem(_props) {
|
|
30
|
+
const dispatch = useAppDispatch();
|
|
31
|
+
let preSetting = null;
|
|
32
|
+
watchEffect(() => {
|
|
33
|
+
const settings = unref(_props);
|
|
34
|
+
if (preSetting === null) dispatch(addPolarGraphicalItem(settings));
|
|
35
|
+
else if (preSetting !== settings) dispatch(replacePolarGraphicalItem({
|
|
36
|
+
prev: preSetting,
|
|
37
|
+
next: settings
|
|
38
|
+
}));
|
|
39
|
+
preSetting = settings;
|
|
40
|
+
});
|
|
41
|
+
onUnmounted(() => {
|
|
42
|
+
if (preSetting) {
|
|
43
|
+
dispatch(removePolarGraphicalItem(preSetting));
|
|
44
|
+
preSetting = null;
|
|
45
|
+
}
|
|
31
46
|
});
|
|
32
47
|
}
|
|
33
48
|
//#endregion
|
|
34
|
-
export {
|
|
49
|
+
export { SetCartesianGraphicalItem, SetPolarGraphicalItem };
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { useIsPanorama
|
|
2
|
-
import { useAppDispatch
|
|
3
|
-
import { addLegendPayload
|
|
4
|
-
import { unref
|
|
1
|
+
import { useIsPanorama } from "../context/PanoramaContextProvider.mjs";
|
|
2
|
+
import { useAppDispatch } from "./hooks.mjs";
|
|
3
|
+
import { addLegendPayload, removeLegendPayload } from "./legendSlice.mjs";
|
|
4
|
+
import { unref, watchEffect } from "vue";
|
|
5
5
|
//#region src/state/SetLegendPayload.ts
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
function SetLegendPayload(_legendPayload) {
|
|
7
|
+
const dispatch = useAppDispatch();
|
|
8
|
+
const isPanorama = useIsPanorama();
|
|
9
|
+
watchEffect((onCleanup) => {
|
|
10
|
+
const legendPayload = unref(_legendPayload);
|
|
11
|
+
if (isPanorama) return;
|
|
12
|
+
dispatch(addLegendPayload(legendPayload));
|
|
13
|
+
onCleanup(() => {
|
|
14
|
+
dispatch(removeLegendPayload(legendPayload));
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
return null;
|
|
14
18
|
}
|
|
15
19
|
//#endregion
|
|
16
|
-
export {
|
|
20
|
+
export { SetLegendPayload };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { useIsPanorama
|
|
2
|
-
import { addTooltipEntrySettings
|
|
3
|
-
import { useAppDispatch
|
|
4
|
-
import { watchEffect
|
|
1
|
+
import { useIsPanorama } from "../context/PanoramaContextProvider.mjs";
|
|
2
|
+
import { addTooltipEntrySettings, removeTooltipEntrySettings } from "./tooltipSlice.mjs";
|
|
3
|
+
import { useAppDispatch } from "./hooks.mjs";
|
|
4
|
+
import { watchEffect } from "vue";
|
|
5
5
|
//#region src/state/SetTooltipEntrySettings.tsx
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
function SetTooltipEntrySettings({ fn, args }) {
|
|
7
|
+
const dispatch = useAppDispatch();
|
|
8
|
+
const isPanorama = useIsPanorama();
|
|
9
|
+
watchEffect((onCleanup) => {
|
|
10
|
+
if (isPanorama) return;
|
|
11
|
+
const tooltipEntrySettings = fn(args.value);
|
|
12
|
+
dispatch(addTooltipEntrySettings(tooltipEntrySettings));
|
|
13
|
+
onCleanup(() => {
|
|
14
|
+
dispatch(removeTooltipEntrySettings(tooltipEntrySettings));
|
|
13
15
|
});
|
|
14
16
|
});
|
|
15
17
|
}
|
|
16
18
|
//#endregion
|
|
17
|
-
export {
|
|
19
|
+
export { SetTooltipEntrySettings };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createSlice
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
2
|
//#region src/state/brushSlice.ts
|
|
3
|
-
var
|
|
3
|
+
var initialState = {
|
|
4
4
|
x: 0,
|
|
5
5
|
y: 0,
|
|
6
6
|
width: 0,
|
|
@@ -11,12 +11,16 @@ var t = {
|
|
|
11
11
|
bottom: 0,
|
|
12
12
|
left: 0
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
|
+
var brushSlice = createSlice({
|
|
15
16
|
name: "brush",
|
|
16
|
-
initialState
|
|
17
|
-
reducers: { setBrushSettings(
|
|
18
|
-
|
|
17
|
+
initialState,
|
|
18
|
+
reducers: { setBrushSettings(_state, action) {
|
|
19
|
+
if (action.payload == null) return initialState;
|
|
20
|
+
return action.payload;
|
|
19
21
|
} }
|
|
20
|
-
})
|
|
22
|
+
});
|
|
23
|
+
var { setBrushSettings } = brushSlice.actions;
|
|
24
|
+
var brushReducer = brushSlice.reducer;
|
|
21
25
|
//#endregion
|
|
22
|
-
export {
|
|
26
|
+
export { brushReducer };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { createSlice
|
|
2
|
-
import { castDraft
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
import { castDraft } from "immer";
|
|
3
3
|
//#region src/state/cartesianAxisSlice.ts
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* This is the slice where each individual Axis element pushes its own configuration.
|
|
6
|
+
* Prefer to use this one instead of axisSlice.
|
|
7
|
+
*/
|
|
8
|
+
var cartesianAxisSlice = createSlice({
|
|
5
9
|
name: "cartesianAxis",
|
|
6
10
|
initialState: {
|
|
7
11
|
xAxis: {},
|
|
@@ -9,25 +13,27 @@ var n = e({
|
|
|
9
13
|
zAxis: {}
|
|
10
14
|
},
|
|
11
15
|
reducers: {
|
|
12
|
-
addXAxis(
|
|
13
|
-
|
|
16
|
+
addXAxis(state, action) {
|
|
17
|
+
state.xAxis[action.payload.id] = castDraft(action.payload);
|
|
14
18
|
},
|
|
15
|
-
removeXAxis(
|
|
16
|
-
delete
|
|
19
|
+
removeXAxis(state, action) {
|
|
20
|
+
delete state.xAxis[action.payload.id];
|
|
17
21
|
},
|
|
18
|
-
addYAxis(
|
|
19
|
-
|
|
22
|
+
addYAxis(state, action) {
|
|
23
|
+
state.yAxis[action.payload.id] = castDraft(action.payload);
|
|
20
24
|
},
|
|
21
|
-
removeYAxis(
|
|
22
|
-
delete
|
|
25
|
+
removeYAxis(state, action) {
|
|
26
|
+
delete state.yAxis[action.payload.id];
|
|
23
27
|
},
|
|
24
|
-
addZAxis(
|
|
25
|
-
|
|
28
|
+
addZAxis(state, action) {
|
|
29
|
+
state.zAxis[action.payload.id] = castDraft(action.payload);
|
|
26
30
|
},
|
|
27
|
-
removeZAxis(
|
|
28
|
-
delete
|
|
31
|
+
removeZAxis(state, action) {
|
|
32
|
+
delete state.zAxis[action.payload.id];
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
|
-
})
|
|
35
|
+
});
|
|
36
|
+
var { addXAxis, removeXAxis, addYAxis, removeYAxis, addZAxis, removeZAxis } = cartesianAxisSlice.actions;
|
|
37
|
+
var cartesianAxisReducer = cartesianAxisSlice.reducer;
|
|
32
38
|
//#endregion
|
|
33
|
-
export {
|
|
39
|
+
export { addXAxis, addYAxis, addZAxis, cartesianAxisReducer, removeXAxis, removeYAxis, removeZAxis };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createSlice
|
|
2
|
-
var
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
var chartDataSlice = createSlice({
|
|
3
3
|
name: "chartData",
|
|
4
4
|
initialState: {
|
|
5
5
|
chartData: void 0,
|
|
@@ -8,21 +8,26 @@ var t = e({
|
|
|
8
8
|
dataEndIndex: 0
|
|
9
9
|
},
|
|
10
10
|
reducers: {
|
|
11
|
-
setChartData(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
setChartData(state, action) {
|
|
12
|
+
state.chartData = action.payload;
|
|
13
|
+
if (action.payload == null) {
|
|
14
|
+
state.dataStartIndex = 0;
|
|
15
|
+
state.dataEndIndex = 0;
|
|
14
16
|
return;
|
|
15
17
|
}
|
|
16
|
-
|
|
18
|
+
if (action.payload.length > 0 && state.dataEndIndex !== action.payload.length - 1) state.dataEndIndex = action.payload.length - 1;
|
|
17
19
|
},
|
|
18
|
-
setComputedData(
|
|
19
|
-
|
|
20
|
+
setComputedData(state, action) {
|
|
21
|
+
state.computedData = action.payload;
|
|
20
22
|
},
|
|
21
|
-
setDataStartEndIndexes(
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
setDataStartEndIndexes(state, action) {
|
|
24
|
+
const { startIndex, endIndex } = action.payload;
|
|
25
|
+
if (startIndex != null) state.dataStartIndex = startIndex;
|
|
26
|
+
if (endIndex != null) state.dataEndIndex = endIndex;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
|
-
})
|
|
29
|
+
});
|
|
30
|
+
var { setChartData, setDataStartEndIndexes, setComputedData } = chartDataSlice.actions;
|
|
31
|
+
var chartDataReducer = chartDataSlice.reducer;
|
|
27
32
|
//#endregion
|
|
28
|
-
export {
|
|
33
|
+
export { chartDataReducer, setChartData, setDataStartEndIndexes };
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import { selectActiveLabel
|
|
2
|
-
import { createAction
|
|
1
|
+
import { selectActiveLabel, selectActiveTooltipCoordinate, selectActiveTooltipDataKey, selectActiveTooltipIndex, selectIsTooltipActive } from "./selectors/tooltipSelectors.mjs";
|
|
2
|
+
import { createAction } from "@reduxjs/toolkit";
|
|
3
3
|
//#region src/state/externalEventsMiddleware.ts
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
var externalEventAction = createAction("externalEvent");
|
|
5
|
+
/**
|
|
6
|
+
* Calls external event handlers (onMouseMove, onClick, etc.) synchronously within the dispatch
|
|
7
|
+
* call stack, while the native event's `currentTarget` is still valid.
|
|
8
|
+
*
|
|
9
|
+
* Using createListenerMiddleware would defer the call to a microtask, at which point the browser
|
|
10
|
+
* has already cleared `e.currentTarget` per the DOM spec, breaking coordinate-based handlers like
|
|
11
|
+
* DraggablePie that rely on `getRelativeCoordinate(e)`.
|
|
12
|
+
*/
|
|
13
|
+
var externalEventsMiddleware = (api) => (next) => (action) => {
|
|
14
|
+
const result = next(action);
|
|
15
|
+
if (externalEventAction.match(action) && action.payload.handler != null) {
|
|
16
|
+
const state = api.getState();
|
|
17
|
+
const nextState = {
|
|
18
|
+
activeCoordinate: selectActiveTooltipCoordinate(state),
|
|
19
|
+
activeDataKey: selectActiveTooltipDataKey(state),
|
|
20
|
+
activeIndex: selectActiveTooltipIndex(state),
|
|
21
|
+
activeLabel: selectActiveLabel(state),
|
|
22
|
+
activeTooltipIndex: selectActiveTooltipIndex(state),
|
|
23
|
+
isTooltipActive: selectIsTooltipActive(state)
|
|
14
24
|
};
|
|
15
|
-
|
|
25
|
+
action.payload.handler(nextState, action.payload.event);
|
|
16
26
|
}
|
|
17
|
-
return
|
|
27
|
+
return result;
|
|
18
28
|
};
|
|
19
29
|
//#endregion
|
|
20
|
-
export {
|
|
30
|
+
export { externalEventAction, externalEventsMiddleware };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createSlice
|
|
2
|
-
import { castDraft
|
|
1
|
+
import { createSlice, current } from "@reduxjs/toolkit";
|
|
2
|
+
import { castDraft } from "immer";
|
|
3
3
|
//#region src/state/graphicalItemsSlice.ts
|
|
4
|
-
var
|
|
4
|
+
var graphicalItemsSlice = createSlice({
|
|
5
5
|
name: "graphicalItems",
|
|
6
6
|
initialState: {
|
|
7
7
|
countOfBars: 0,
|
|
@@ -9,35 +9,39 @@ var r = e({
|
|
|
9
9
|
polarItems: []
|
|
10
10
|
},
|
|
11
11
|
reducers: {
|
|
12
|
-
addBar(
|
|
13
|
-
|
|
12
|
+
addBar(state) {
|
|
13
|
+
state.countOfBars += 1;
|
|
14
14
|
},
|
|
15
|
-
removeBar(
|
|
16
|
-
|
|
15
|
+
removeBar(state) {
|
|
16
|
+
state.countOfBars -= 1;
|
|
17
17
|
},
|
|
18
|
-
addCartesianGraphicalItem(
|
|
19
|
-
|
|
18
|
+
addCartesianGraphicalItem(state, action) {
|
|
19
|
+
state.cartesianItems.push(castDraft(action.payload));
|
|
20
20
|
},
|
|
21
|
-
replaceCartesianGraphicalItem(
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
replaceCartesianGraphicalItem(state, action) {
|
|
22
|
+
const { prev, next } = action.payload;
|
|
23
|
+
const index = current(state).cartesianItems.indexOf(castDraft(prev));
|
|
24
|
+
if (index > -1) state.cartesianItems[index] = castDraft(next);
|
|
24
25
|
},
|
|
25
|
-
removeCartesianGraphicalItem(
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
removeCartesianGraphicalItem(state, action) {
|
|
27
|
+
const index = current(state).cartesianItems.indexOf(castDraft(action.payload));
|
|
28
|
+
if (index > -1) state.cartesianItems.splice(index, 1);
|
|
28
29
|
},
|
|
29
|
-
addPolarGraphicalItem(
|
|
30
|
-
|
|
30
|
+
addPolarGraphicalItem(state, action) {
|
|
31
|
+
state.polarItems.push(castDraft(action.payload));
|
|
31
32
|
},
|
|
32
|
-
removePolarGraphicalItem(
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
removePolarGraphicalItem(state, action) {
|
|
34
|
+
const index = current(state).polarItems.indexOf(castDraft(action.payload));
|
|
35
|
+
if (index > -1) state.polarItems.splice(index, 1);
|
|
35
36
|
},
|
|
36
|
-
replacePolarGraphicalItem(
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
replacePolarGraphicalItem(state, action) {
|
|
38
|
+
const { prev, next } = action.payload;
|
|
39
|
+
const index = current(state).polarItems.indexOf(castDraft(prev));
|
|
40
|
+
if (index > -1) state.polarItems[index] = castDraft(next);
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
|
-
})
|
|
43
|
+
});
|
|
44
|
+
var { addBar, removeBar, addCartesianGraphicalItem, removeCartesianGraphicalItem, addPolarGraphicalItem, replaceCartesianGraphicalItem, removePolarGraphicalItem, replacePolarGraphicalItem } = graphicalItemsSlice.actions;
|
|
45
|
+
var graphicalItemsReducer = graphicalItemsSlice.reducer;
|
|
42
46
|
//#endregion
|
|
43
|
-
export {
|
|
47
|
+
export { addCartesianGraphicalItem, addPolarGraphicalItem, graphicalItemsReducer, removeCartesianGraphicalItem, removePolarGraphicalItem, replaceCartesianGraphicalItem, replacePolarGraphicalItem };
|
package/dist/es/state/hooks.mjs
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { selectActiveTooltipDataPoints } from "./selectors/tooltipSelectors.mjs";
|
|
2
|
+
import { useDispatch, useSelector } from "@reduxjs/vue-redux";
|
|
2
3
|
//#region src/state/hooks.ts
|
|
3
|
-
var
|
|
4
|
+
var useAppDispatch = useDispatch.withTypes();
|
|
5
|
+
var useAppSelector = useSelector.withTypes();
|
|
6
|
+
/**
|
|
7
|
+
* Returns the currently active data points being displayed in the Tooltip.
|
|
8
|
+
* Active means that it is currently visible; this hook will return `undefined` if there is no current interaction.
|
|
9
|
+
*
|
|
10
|
+
* This follows the `<Tooltip />` props, if the Tooltip element is present in the chart.
|
|
11
|
+
* If there is no `<Tooltip />` then this hook will follow the default Tooltip props.
|
|
12
|
+
*
|
|
13
|
+
* Data point is whatever you pass as an input to the chart using the `data={}` prop.
|
|
14
|
+
*
|
|
15
|
+
* This returns an array because a chart can have multiple graphical items in it (multiple Lines for example)
|
|
16
|
+
* and tooltip with `shared={true}` will display all items at the same time.
|
|
17
|
+
*
|
|
18
|
+
* Returns undefined when used outside a chart context.
|
|
19
|
+
*
|
|
20
|
+
* @returns Data points that are currently visible in a Tooltip
|
|
21
|
+
*/
|
|
22
|
+
function useActiveTooltipDataPoints() {
|
|
23
|
+
return useAppSelector(selectActiveTooltipDataPoints);
|
|
24
|
+
}
|
|
4
25
|
//#endregion
|
|
5
|
-
export {
|
|
26
|
+
export { useActiveTooltipDataPoints, useAppDispatch, useAppSelector };
|
|
@@ -1,55 +1,63 @@
|
|
|
1
|
-
import { selectChartDirection
|
|
2
|
-
import { setKeyboardInteraction
|
|
3
|
-
import { combineActiveTooltipIndex
|
|
4
|
-
import { selectTooltipAxisTicks
|
|
5
|
-
import { selectCoordinateForDefaultIndex
|
|
6
|
-
import { createAction
|
|
1
|
+
import { selectChartDirection } from "./selectors/axisSelectors.mjs";
|
|
2
|
+
import { setKeyboardInteraction } from "./tooltipSlice.mjs";
|
|
3
|
+
import { combineActiveTooltipIndex } from "./selectors/combiners/combineActiveTooltipIndex.mjs";
|
|
4
|
+
import { selectTooltipAxisTicks, selectTooltipDisplayedData } from "./selectors/tooltipSelectors.mjs";
|
|
5
|
+
import { selectCoordinateForDefaultIndex } from "./selectors/selectors.mjs";
|
|
6
|
+
import { createAction, createListenerMiddleware } from "@reduxjs/toolkit";
|
|
7
7
|
//#region src/state/keyboardEventsMiddleware.ts
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
var keyDownAction = createAction("keyDown");
|
|
9
|
+
var focusAction = createAction("focus");
|
|
10
|
+
var keyboardEventsMiddleware = createListenerMiddleware();
|
|
11
|
+
keyboardEventsMiddleware.startListening({
|
|
12
|
+
actionCreator: keyDownAction,
|
|
13
|
+
effect: (action, listenerApi) => {
|
|
14
|
+
const state = listenerApi.getState();
|
|
15
|
+
if (!(state.rootProps.accessibilityLayer !== false)) return;
|
|
16
|
+
const { keyboardInteraction } = state.tooltip;
|
|
17
|
+
const key = action.payload;
|
|
18
|
+
if (key !== "ArrowRight" && key !== "ArrowLeft" && key !== "Enter") return;
|
|
19
|
+
const currentIndex = Number(combineActiveTooltipIndex(keyboardInteraction, selectTooltipDisplayedData(state)));
|
|
20
|
+
const tooltipTicks = selectTooltipAxisTicks(state);
|
|
21
|
+
if (key === "Enter") {
|
|
22
|
+
const coordinate = selectCoordinateForDefaultIndex(state, "axis", "hover", String(keyboardInteraction.index));
|
|
23
|
+
listenerApi.dispatch(setKeyboardInteraction({
|
|
24
|
+
active: !keyboardInteraction.active,
|
|
25
|
+
activeIndex: keyboardInteraction.index,
|
|
26
|
+
activeDataKey: keyboardInteraction.dataKey,
|
|
27
|
+
activeCoordinate: coordinate
|
|
24
28
|
}));
|
|
25
29
|
return;
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const directionMultiplier = selectChartDirection(state) === "left-to-right" ? 1 : -1;
|
|
32
|
+
const nextIndex = currentIndex + (key === "ArrowRight" ? 1 : -1) * directionMultiplier;
|
|
33
|
+
if (nextIndex >= tooltipTicks.length || nextIndex < 0) return;
|
|
34
|
+
const coordinate = selectCoordinateForDefaultIndex(state, "axis", "hover", String(nextIndex));
|
|
35
|
+
listenerApi.dispatch(setKeyboardInteraction({
|
|
36
|
+
active: true,
|
|
37
|
+
activeIndex: nextIndex.toString(),
|
|
33
38
|
activeDataKey: void 0,
|
|
34
|
-
activeCoordinate:
|
|
39
|
+
activeCoordinate: coordinate
|
|
35
40
|
}));
|
|
36
41
|
}
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
});
|
|
43
|
+
keyboardEventsMiddleware.startListening({
|
|
44
|
+
actionCreator: focusAction,
|
|
45
|
+
effect: (_, listenerApi) => {
|
|
46
|
+
const state = listenerApi.getState();
|
|
47
|
+
if (!(state.rootProps.accessibilityLayer !== false)) return;
|
|
48
|
+
const { keyboardInteraction } = state.tooltip;
|
|
49
|
+
if (keyboardInteraction.active) return;
|
|
50
|
+
if (keyboardInteraction.index == null) {
|
|
51
|
+
const nextIndex = "0";
|
|
52
|
+
const coordinate = selectCoordinateForDefaultIndex(state, "axis", "hover", String(nextIndex));
|
|
53
|
+
listenerApi.dispatch(setKeyboardInteraction({
|
|
46
54
|
activeDataKey: void 0,
|
|
47
|
-
active:
|
|
48
|
-
activeIndex:
|
|
49
|
-
activeCoordinate:
|
|
55
|
+
active: true,
|
|
56
|
+
activeIndex: nextIndex,
|
|
57
|
+
activeCoordinate: coordinate
|
|
50
58
|
}));
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
});
|
|
54
62
|
//#endregion
|
|
55
|
-
export {
|
|
63
|
+
export { focusAction, keyDownAction, keyboardEventsMiddleware };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createSlice
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
2
|
//#region src/state/layoutSlice.ts
|
|
3
|
-
var
|
|
3
|
+
var chartLayoutSlice = createSlice({
|
|
4
4
|
name: "chartLayout",
|
|
5
5
|
initialState: {
|
|
6
6
|
layoutType: "horizontal",
|
|
@@ -15,19 +15,25 @@ var t = e({
|
|
|
15
15
|
scale: 1
|
|
16
16
|
},
|
|
17
17
|
reducers: {
|
|
18
|
-
setLayout(
|
|
19
|
-
|
|
18
|
+
setLayout(state, action) {
|
|
19
|
+
state.layoutType = action.payload;
|
|
20
20
|
},
|
|
21
|
-
setChartSize(
|
|
22
|
-
|
|
21
|
+
setChartSize(state, action) {
|
|
22
|
+
state.width = action.payload.width;
|
|
23
|
+
state.height = action.payload.height;
|
|
23
24
|
},
|
|
24
|
-
setMargin(
|
|
25
|
-
|
|
25
|
+
setMargin(state, action) {
|
|
26
|
+
state.margin.top = action.payload.top;
|
|
27
|
+
state.margin.right = action.payload.right;
|
|
28
|
+
state.margin.bottom = action.payload.bottom;
|
|
29
|
+
state.margin.left = action.payload.left;
|
|
26
30
|
},
|
|
27
|
-
setScale(
|
|
28
|
-
|
|
31
|
+
setScale(state, action) {
|
|
32
|
+
state.scale = action.payload;
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
|
-
})
|
|
35
|
+
});
|
|
36
|
+
var { setMargin, setLayout, setChartSize, setScale } = chartLayoutSlice.actions;
|
|
37
|
+
var chartLayoutReducer = chartLayoutSlice.reducer;
|
|
32
38
|
//#endregion
|
|
33
|
-
export {
|
|
39
|
+
export { chartLayoutReducer, setChartSize, setLayout, setMargin, setScale };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createSlice
|
|
2
|
-
import { castDraft
|
|
1
|
+
import { createSlice, current } from "@reduxjs/toolkit";
|
|
2
|
+
import { castDraft } from "immer";
|
|
3
3
|
//#region src/state/legendSlice.ts
|
|
4
|
-
var
|
|
4
|
+
var legendSlice = createSlice({
|
|
5
5
|
name: "legend",
|
|
6
6
|
initialState: {
|
|
7
7
|
settings: {
|
|
@@ -16,20 +16,25 @@ var r = e({
|
|
|
16
16
|
payload: []
|
|
17
17
|
},
|
|
18
18
|
reducers: {
|
|
19
|
-
setLegendSize(
|
|
20
|
-
|
|
19
|
+
setLegendSize(state, action) {
|
|
20
|
+
state.size.width = action.payload.width;
|
|
21
|
+
state.size.height = action.payload.height;
|
|
21
22
|
},
|
|
22
|
-
setLegendSettings(
|
|
23
|
-
|
|
23
|
+
setLegendSettings(state, action) {
|
|
24
|
+
state.settings.align = action.payload.align;
|
|
25
|
+
state.settings.layout = action.payload.layout;
|
|
26
|
+
state.settings.verticalAlign = action.payload.verticalAlign;
|
|
24
27
|
},
|
|
25
|
-
addLegendPayload(
|
|
26
|
-
|
|
28
|
+
addLegendPayload(state, action) {
|
|
29
|
+
state.payload.push(castDraft(action.payload));
|
|
27
30
|
},
|
|
28
|
-
removeLegendPayload(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
removeLegendPayload(state, action) {
|
|
32
|
+
const index = current(state).payload.indexOf(castDraft(action.payload));
|
|
33
|
+
if (index > -1) state.payload.splice(index, 1);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
})
|
|
36
|
+
});
|
|
37
|
+
var { setLegendSize, setLegendSettings, addLegendPayload, removeLegendPayload } = legendSlice.actions;
|
|
38
|
+
var legendReducer = legendSlice.reducer;
|
|
34
39
|
//#endregion
|
|
35
|
-
export {
|
|
40
|
+
export { addLegendPayload, legendReducer, removeLegendPayload, setLegendSettings, setLegendSize };
|