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,41 @@
|
|
|
1
|
-
import { selectTooltipEventType
|
|
2
|
-
import { mouseLeaveChart
|
|
3
|
-
import { selectActivePropsFromChartPointer
|
|
4
|
-
import { createAction
|
|
1
|
+
import { selectTooltipEventType } from "./selectors/selectTooltipEventType.mjs";
|
|
2
|
+
import { mouseLeaveChart, setMouseClickAxisIndex, setMouseOverAxisIndex } from "./tooltipSlice.mjs";
|
|
3
|
+
import { selectActivePropsFromChartPointer } from "./selectors/selectActivePropsFromChartPointer.mjs";
|
|
4
|
+
import { createAction, createListenerMiddleware } from "@reduxjs/toolkit";
|
|
5
5
|
//#region src/state/mouseEventsMiddleware.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
var mouseClickAction = createAction("mouseClick");
|
|
7
|
+
var mouseClickMiddleware = createListenerMiddleware();
|
|
8
|
+
mouseClickMiddleware.startListening({
|
|
9
|
+
actionCreator: mouseClickAction,
|
|
10
|
+
effect: (action, listenerApi) => {
|
|
11
|
+
const chartPointer = action.payload;
|
|
12
|
+
const state = listenerApi.getState();
|
|
13
|
+
if (selectTooltipEventType(state, state.tooltip.settings.shared) === "axis") {
|
|
14
|
+
const activeProps = selectActivePropsFromChartPointer(state, chartPointer);
|
|
15
|
+
if (activeProps?.activeIndex != null) listenerApi.dispatch(setMouseClickAxisIndex({
|
|
16
|
+
activeIndex: activeProps.activeIndex,
|
|
15
17
|
activeDataKey: void 0,
|
|
16
|
-
activeCoordinate:
|
|
18
|
+
activeCoordinate: activeProps.activeCoordinate
|
|
17
19
|
}));
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
});
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
var mouseMoveAction = createAction("mouseMove");
|
|
24
|
+
var mouseMoveMiddleware = createListenerMiddleware();
|
|
25
|
+
mouseMoveMiddleware.startListening({
|
|
26
|
+
actionCreator: mouseMoveAction,
|
|
27
|
+
effect: (action, listenerApi) => {
|
|
28
|
+
const chartPointer = action.payload;
|
|
29
|
+
const state = listenerApi.getState();
|
|
30
|
+
const tooltipEventType = selectTooltipEventType(state, state.tooltip.settings.shared);
|
|
31
|
+
const activeProps = selectActivePropsFromChartPointer(state, chartPointer);
|
|
32
|
+
if (tooltipEventType === "axis") if (activeProps?.activeIndex != null) listenerApi.dispatch(setMouseOverAxisIndex({
|
|
33
|
+
activeIndex: activeProps.activeIndex,
|
|
28
34
|
activeDataKey: void 0,
|
|
29
|
-
activeCoordinate:
|
|
30
|
-
}))
|
|
35
|
+
activeCoordinate: activeProps.activeCoordinate
|
|
36
|
+
}));
|
|
37
|
+
else listenerApi.dispatch(mouseLeaveChart());
|
|
31
38
|
}
|
|
32
39
|
});
|
|
33
40
|
//#endregion
|
|
34
|
-
export {
|
|
41
|
+
export { mouseClickAction, mouseClickMiddleware, mouseMoveAction, mouseMoveMiddleware };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { isNan
|
|
2
|
-
import { createSlice
|
|
1
|
+
import { isNan } from "../utils/validate.mjs";
|
|
2
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
3
3
|
//#region src/state/optionsSlice.ts
|
|
4
|
-
function
|
|
5
|
-
if (!
|
|
6
|
-
|
|
7
|
-
if (
|
|
4
|
+
function arrayTooltipSearcher(data, strIndex) {
|
|
5
|
+
if (!strIndex) return void 0;
|
|
6
|
+
const numIndex = Number.parseInt(strIndex, 10);
|
|
7
|
+
if (isNan(numIndex)) return;
|
|
8
|
+
return data?.[numIndex];
|
|
8
9
|
}
|
|
9
|
-
var
|
|
10
|
+
var optionsSlice = createSlice({
|
|
10
11
|
name: "options",
|
|
11
12
|
initialState: {
|
|
12
13
|
chartName: "",
|
|
@@ -14,9 +15,11 @@ var r = t({
|
|
|
14
15
|
eventEmitter: void 0,
|
|
15
16
|
defaultTooltipEventType: "axis"
|
|
16
17
|
},
|
|
17
|
-
reducers: { createEventEmitter: (
|
|
18
|
-
|
|
18
|
+
reducers: { createEventEmitter: (state) => {
|
|
19
|
+
if (state.eventEmitter == null) state.eventEmitter = Symbol("rechartsEventEmitter");
|
|
19
20
|
} }
|
|
20
|
-
})
|
|
21
|
+
});
|
|
22
|
+
var optionsReducer = optionsSlice.reducer;
|
|
23
|
+
var { createEventEmitter } = optionsSlice.actions;
|
|
21
24
|
//#endregion
|
|
22
|
-
export {
|
|
25
|
+
export { arrayTooltipSearcher, createEventEmitter, optionsReducer };
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { createSlice
|
|
2
|
-
import { castDraft
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
import { castDraft } from "immer";
|
|
3
3
|
//#region src/state/polarAxisSlice.ts
|
|
4
|
-
var
|
|
4
|
+
var polarAxisSlice = createSlice({
|
|
5
5
|
name: "polarAxis",
|
|
6
6
|
initialState: {
|
|
7
7
|
radiusAxis: {},
|
|
8
8
|
angleAxis: {}
|
|
9
9
|
},
|
|
10
10
|
reducers: {
|
|
11
|
-
addRadiusAxis(
|
|
12
|
-
|
|
11
|
+
addRadiusAxis(state, action) {
|
|
12
|
+
state.radiusAxis[action.payload.id] = castDraft(action.payload);
|
|
13
13
|
},
|
|
14
|
-
removeRadiusAxis(
|
|
15
|
-
delete
|
|
14
|
+
removeRadiusAxis(state, action) {
|
|
15
|
+
delete state.radiusAxis[action.payload.id];
|
|
16
16
|
},
|
|
17
|
-
addAngleAxis(
|
|
18
|
-
|
|
17
|
+
addAngleAxis(state, action) {
|
|
18
|
+
state.angleAxis[action.payload.id] = castDraft(action.payload);
|
|
19
19
|
},
|
|
20
|
-
removeAngleAxis(
|
|
21
|
-
delete
|
|
20
|
+
removeAngleAxis(state, action) {
|
|
21
|
+
delete state.angleAxis[action.payload.id];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
})
|
|
24
|
+
});
|
|
25
|
+
var { addRadiusAxis, removeRadiusAxis, addAngleAxis, removeAngleAxis } = polarAxisSlice.actions;
|
|
26
|
+
var polarAxisReducer = polarAxisSlice.reducer;
|
|
25
27
|
//#endregion
|
|
26
|
-
export {
|
|
28
|
+
export { addAngleAxis, addRadiusAxis, polarAxisReducer, removeAngleAxis, removeRadiusAxis };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { createSlice
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
2
|
//#region src/state/polarOptionsSlice.ts
|
|
3
|
-
var
|
|
3
|
+
var polarOptionsSlice = createSlice({
|
|
4
4
|
name: "polarOptions",
|
|
5
5
|
initialState: null,
|
|
6
|
-
reducers: { updatePolarOptions(
|
|
7
|
-
return
|
|
6
|
+
reducers: { updatePolarOptions(_, action) {
|
|
7
|
+
return action.payload;
|
|
8
8
|
} }
|
|
9
|
-
})
|
|
9
|
+
});
|
|
10
|
+
var { updatePolarOptions } = polarOptionsSlice.actions;
|
|
11
|
+
var polarOptionsReducer = polarOptionsSlice.reducer;
|
|
10
12
|
//#endregion
|
|
11
|
-
export {
|
|
13
|
+
export { polarOptionsReducer, updatePolarOptions };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
//#region src/state/reduxDevtoolsJsonStringifyReplacer.ts
|
|
2
|
-
function
|
|
3
|
-
|
|
2
|
+
function reduxDevtoolsJsonStringifyReplacer(_key, value) {
|
|
3
|
+
if (value instanceof HTMLElement) return `HTMLElement <${value.tagName} class="${value.className}">`;
|
|
4
|
+
if (value === window) return "global.window";
|
|
5
|
+
return value;
|
|
4
6
|
}
|
|
5
7
|
//#endregion
|
|
6
|
-
export {
|
|
8
|
+
export { reduxDevtoolsJsonStringifyReplacer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createSlice
|
|
2
|
-
var
|
|
1
|
+
import { createSlice, current } from "@reduxjs/toolkit";
|
|
2
|
+
var referenceElementsSlice = createSlice({
|
|
3
3
|
name: "referenceElements",
|
|
4
4
|
initialState: {
|
|
5
5
|
dots: [],
|
|
@@ -7,28 +7,30 @@ var n = e({
|
|
|
7
7
|
lines: []
|
|
8
8
|
},
|
|
9
9
|
reducers: {
|
|
10
|
-
addDot: (
|
|
11
|
-
|
|
10
|
+
addDot: (state, action) => {
|
|
11
|
+
state.dots.push(action.payload);
|
|
12
12
|
},
|
|
13
|
-
removeDot: (
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
removeDot: (state, action) => {
|
|
14
|
+
const index = current(state).dots.findIndex((dot) => dot === action.payload);
|
|
15
|
+
if (index !== -1) state.dots.splice(index, 1);
|
|
16
16
|
},
|
|
17
|
-
addArea: (
|
|
18
|
-
|
|
17
|
+
addArea: (state, action) => {
|
|
18
|
+
state.areas.push(action.payload);
|
|
19
19
|
},
|
|
20
|
-
removeArea: (
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
removeArea: (state, action) => {
|
|
21
|
+
const index = current(state).areas.findIndex((area) => area === action.payload);
|
|
22
|
+
if (index !== -1) state.areas.splice(index, 1);
|
|
23
23
|
},
|
|
24
|
-
addLine: (
|
|
25
|
-
|
|
24
|
+
addLine: (state, action) => {
|
|
25
|
+
state.lines.push(action.payload);
|
|
26
26
|
},
|
|
27
|
-
removeLine: (
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
removeLine: (state, action) => {
|
|
28
|
+
const index = current(state).lines.findIndex((line) => line === action.payload);
|
|
29
|
+
if (index !== -1) state.lines.splice(index, 1);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
})
|
|
32
|
+
});
|
|
33
|
+
var { addDot, removeDot, addArea, removeArea, addLine, removeLine } = referenceElementsSlice.actions;
|
|
34
|
+
var referenceElementsReducer = referenceElementsSlice.reducer;
|
|
33
35
|
//#endregion
|
|
34
|
-
export {
|
|
36
|
+
export { addArea, addDot, addLine, referenceElementsReducer, removeArea, removeDot, removeLine };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createSlice
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
2
|
//#region src/state/rootPropsSlice.ts
|
|
3
|
-
var
|
|
4
|
-
accessibilityLayer:
|
|
3
|
+
var initialState = {
|
|
4
|
+
accessibilityLayer: true,
|
|
5
5
|
barCategoryGap: "10%",
|
|
6
6
|
barGap: 4,
|
|
7
7
|
barSize: void 0,
|
|
@@ -10,12 +10,23 @@ var t = {
|
|
|
10
10
|
stackOffset: "none",
|
|
11
11
|
syncId: void 0,
|
|
12
12
|
syncMethod: "index"
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
|
+
var rootPropsSlice = createSlice({
|
|
14
15
|
name: "rootProps",
|
|
15
|
-
initialState
|
|
16
|
-
reducers: { updateOptions: (
|
|
17
|
-
|
|
16
|
+
initialState,
|
|
17
|
+
reducers: { updateOptions: (state, action) => {
|
|
18
|
+
state.accessibilityLayer = action.payload.accessibilityLayer;
|
|
19
|
+
state.barCategoryGap = action.payload.barCategoryGap;
|
|
20
|
+
state.barGap = action.payload.barGap ?? initialState.barGap;
|
|
21
|
+
state.barSize = action.payload.barSize;
|
|
22
|
+
state.maxBarSize = action.payload.maxBarSize;
|
|
23
|
+
state.stackOffset = action.payload.stackOffset;
|
|
24
|
+
state.syncId = action.payload.syncId;
|
|
25
|
+
state.syncMethod = action.payload.syncMethod;
|
|
26
|
+
state.class = action.payload.class;
|
|
18
27
|
} }
|
|
19
|
-
})
|
|
28
|
+
});
|
|
29
|
+
var rootPropsReducer = rootPropsSlice.reducer;
|
|
30
|
+
var { updateOptions } = rootPropsSlice.actions;
|
|
20
31
|
//#endregion
|
|
21
|
-
export {
|
|
32
|
+
export { rootPropsReducer, updateOptions };
|
|
@@ -1,67 +1,77 @@
|
|
|
1
|
-
import { isCategoricalAxis
|
|
2
|
-
import { selectChartDataWithIndexesIfNotInPanorama
|
|
3
|
-
import { selectChartLayout
|
|
4
|
-
import { getBandSizeOfAxis
|
|
5
|
-
import { selectAxisWithScale
|
|
6
|
-
import { computeArea
|
|
7
|
-
import { createSelector
|
|
1
|
+
import { isCategoricalAxis } from "../../utils/validate.mjs";
|
|
2
|
+
import { selectChartDataWithIndexesIfNotInPanorama } from "./dataSelectors.mjs";
|
|
3
|
+
import { selectChartLayout } from "./common.mjs";
|
|
4
|
+
import { getBandSizeOfAxis, getNormalizedStackId } from "../../utils/chart.mjs";
|
|
5
|
+
import { selectAxisWithScale, selectStackGroups, selectTicksOfGraphicalItem, selectUnfilteredCartesianItems } from "./axisSelectors.mjs";
|
|
6
|
+
import { computeArea } from "../../cartesian/area/utils.mjs";
|
|
7
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
8
8
|
//#region src/state/selectors/areaSelectors.ts
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function selectXAxisWithScale(state, xAxisId, _yAxisId, isPanorama) {
|
|
10
|
+
return selectAxisWithScale(state, "xAxis", xAxisId, isPanorama);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function selectXAxisTicks(state, xAxisId, _yAxisId, isPanorama) {
|
|
13
|
+
return selectTicksOfGraphicalItem(state, "xAxis", xAxisId, isPanorama);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function selectYAxisWithScale(state, _xAxisId, yAxisId, isPanorama) {
|
|
16
|
+
return selectAxisWithScale(state, "yAxis", yAxisId, isPanorama);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function selectYAxisTicks(state, _xAxisId, yAxisId, isPanorama) {
|
|
19
|
+
return selectTicksOfGraphicalItem(state, "yAxis", yAxisId, isPanorama);
|
|
20
20
|
}
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
], (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
var selectBandSize = createSelector([
|
|
22
|
+
selectChartLayout,
|
|
23
|
+
selectXAxisWithScale,
|
|
24
|
+
selectYAxisWithScale,
|
|
25
|
+
selectXAxisTicks,
|
|
26
|
+
selectYAxisTicks
|
|
27
|
+
], (layout, xAxis, yAxis, xAxisTicks, yAxisTicks) => {
|
|
28
|
+
if (isCategoricalAxis(layout, "xAxis")) return getBandSizeOfAxis(xAxis, xAxisTicks, false);
|
|
29
|
+
return getBandSizeOfAxis(yAxis, yAxisTicks, false);
|
|
30
|
+
});
|
|
31
|
+
function selectGraphicalItemStackedData(state, xAxisId, yAxisId, isPanorama, areaSettings) {
|
|
32
|
+
const isXAxisCategorical = isCategoricalAxis(selectChartLayout(state), "xAxis");
|
|
33
|
+
let stackGroups;
|
|
34
|
+
if (isXAxisCategorical) stackGroups = selectStackGroups(state, "yAxis", yAxisId, isPanorama);
|
|
35
|
+
else stackGroups = selectStackGroups(state, "xAxis", xAxisId, isPanorama);
|
|
36
|
+
if (stackGroups == null) return;
|
|
37
|
+
const { dataKey, stackId } = areaSettings;
|
|
38
|
+
return (stackGroups[stackId]?.stackedData)?.find((v) => v.key === dataKey);
|
|
33
39
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
40
|
+
function pickAreaSettings(_state, _xAxisId, _yAxisId, _isPanorama, areaSettings) {
|
|
41
|
+
return areaSettings;
|
|
36
42
|
}
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
43
|
+
var selectArea = createSelector([
|
|
44
|
+
selectChartLayout,
|
|
45
|
+
selectXAxisWithScale,
|
|
46
|
+
selectYAxisWithScale,
|
|
47
|
+
selectXAxisTicks,
|
|
48
|
+
selectYAxisTicks,
|
|
49
|
+
selectGraphicalItemStackedData,
|
|
50
|
+
selectChartDataWithIndexesIfNotInPanorama,
|
|
51
|
+
selectBandSize,
|
|
52
|
+
createSelector([selectUnfilteredCartesianItems, pickAreaSettings], (graphicalItems, areaSettingsFromProps) => {
|
|
53
|
+
if (graphicalItems.some((cgis) => cgis.type === "area" && areaSettingsFromProps.dataKey === cgis.dataKey && getNormalizedStackId(areaSettingsFromProps.stackId) === cgis.stackId && areaSettingsFromProps.data === cgis.data)) return areaSettingsFromProps;
|
|
48
54
|
})
|
|
49
|
-
], (
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
], (layout, xAxis, yAxis, xAxisTicks, yAxisTicks, stackedData, { chartData, dataStartIndex, dataEndIndex }, bandSize, areaSettings) => {
|
|
56
|
+
if (areaSettings == null || layout !== "horizontal" && layout !== "vertical" || xAxis == null || yAxis == null || xAxisTicks == null || yAxisTicks == null || xAxisTicks.length === 0 || yAxisTicks.length === 0) return;
|
|
57
|
+
const { data } = areaSettings;
|
|
58
|
+
let displayedData;
|
|
59
|
+
if (data && data.length > 0) displayedData = data;
|
|
60
|
+
else displayedData = chartData?.slice(dataStartIndex, dataEndIndex + 1);
|
|
61
|
+
if (displayedData == null) return;
|
|
62
|
+
return computeArea({
|
|
63
|
+
layout,
|
|
64
|
+
xAxis,
|
|
65
|
+
yAxis,
|
|
66
|
+
xAxisTicks,
|
|
67
|
+
yAxisTicks,
|
|
68
|
+
dataStartIndex,
|
|
69
|
+
areaSettings,
|
|
70
|
+
stackedData,
|
|
71
|
+
displayedData,
|
|
62
72
|
chartBaseValue: void 0,
|
|
63
|
-
bandSize
|
|
73
|
+
bandSize
|
|
64
74
|
});
|
|
65
75
|
});
|
|
66
76
|
//#endregion
|
|
67
|
-
export {
|
|
77
|
+
export { selectArea };
|