vccs 0.1.0 → 0.2.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/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 -5
- package/dist/cartesian/index.d.ts +1 -0
- package/dist/chart/FunnelChart.d.ts +1 -0
- package/dist/chart/index.d.ts +1 -0
- 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 +11 -11
- 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 +93 -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 +9 -9
- 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 +177 -0
- package/dist/es/cartesian/funnel/type.mjs +80 -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 +11 -11
- package/dist/es/cartesian/line/utils.mjs +27 -26
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +86 -69
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +99 -77
- 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 +111 -88
- 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/const.mjs +2 -2
- package/dist/es/chart/generateCategoricalChart.mjs +97 -88
- package/dist/es/chart/provideClipPathId.mjs +12 -7
- package/dist/es/components/Cell.mjs +16 -4
- 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 +8 -5
- 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 +66 -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 +23 -19
- 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/useIsAnimating.mjs +28 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
- package/dist/es/index.mjs +46 -42
- package/dist/es/polar/pie/Pie.mjs +131 -115
- package/dist/es/polar/pie/type.mjs +6 -6
- 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 +69 -43
- package/dist/es/shape/Dot.mjs +12 -11
- package/dist/es/shape/Rectangle.mjs +41 -26
- package/dist/es/shape/Sector.mjs +103 -75
- package/dist/es/shape/Symbols.mjs +45 -34
- package/dist/es/shape/Trapezoid.mjs +52 -0
- package/dist/es/state/ReportChartProps.mjs +21 -20
- 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 +4 -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 +755 -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/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/chart.mjs +298 -197
- package/dist/es/utils/const.mjs +30 -2
- 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/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/useIsAnimating.d.ts +14 -0
- package/dist/shape/Trapezoid.d.ts +31 -0
- package/dist/shape/index.d.ts +1 -0
- package/dist/state/graphicalItemsSlice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { FunnelPropsWithSVG } from './type';
|
|
2
|
+
export declare const Funnel: import('vue').DefineComponent<FunnelPropsWithSVG, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FunnelPropsWithSVG> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { AnimationOptions } from 'motion-v';
|
|
2
|
+
import { PropType } from 'vue';
|
|
1
3
|
import { ViewBox } from '../type';
|
|
2
4
|
import { TrapezoidProps } from '../../shape';
|
|
3
|
-
import { Coordinate, DataKey, TooltipType } from '../../types';
|
|
4
|
-
import { AnimationEasing } from '../../types/bar';
|
|
5
|
+
import { Coordinate, DataKey, TooltipType, WithSVGProps } from '../../types';
|
|
5
6
|
import { LegendType } from '../../types/legend';
|
|
6
7
|
export interface FunnelTrapezoidItem extends TrapezoidProps {
|
|
7
8
|
value?: number | string;
|
|
@@ -12,15 +13,13 @@ export interface FunnelTrapezoidItem extends TrapezoidProps {
|
|
|
12
13
|
labelViewBox?: ViewBox;
|
|
13
14
|
}
|
|
14
15
|
export interface FunnelProps {
|
|
15
|
-
animationBegin?: number;
|
|
16
|
-
animationDuration?: number;
|
|
17
|
-
animationEasing?: AnimationEasing;
|
|
18
16
|
className?: string;
|
|
19
17
|
data?: any[];
|
|
20
18
|
dataKey: DataKey<any>;
|
|
21
19
|
hide?: boolean;
|
|
22
20
|
id?: string;
|
|
23
21
|
isAnimationActive?: boolean;
|
|
22
|
+
transition?: AnimationOptions;
|
|
24
23
|
lastShapeType?: 'triangle' | 'rectangle';
|
|
25
24
|
legendType?: LegendType;
|
|
26
25
|
nameKey?: DataKey<any>;
|
|
@@ -29,6 +28,76 @@ export interface FunnelProps {
|
|
|
29
28
|
reversed?: boolean;
|
|
30
29
|
tooltipType?: TooltipType;
|
|
31
30
|
}
|
|
31
|
+
export declare const FunnelVueProps: {
|
|
32
|
+
data: {
|
|
33
|
+
type: PropType<Array<Record<string, unknown>>>;
|
|
34
|
+
default: any;
|
|
35
|
+
};
|
|
36
|
+
dataKey: {
|
|
37
|
+
type: PropType<DataKey<any>>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
nameKey: {
|
|
41
|
+
type: PropType<DataKey<any>>;
|
|
42
|
+
default: string;
|
|
43
|
+
};
|
|
44
|
+
lastShapeType: {
|
|
45
|
+
type: PropType<"triangle" | "rectangle">;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
reversed: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
fill: {
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
stroke: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
legendType: {
|
|
61
|
+
type: PropType<LegendType>;
|
|
62
|
+
default: string;
|
|
63
|
+
};
|
|
64
|
+
tooltipType: {
|
|
65
|
+
type: PropType<TooltipType>;
|
|
66
|
+
default: any;
|
|
67
|
+
};
|
|
68
|
+
hide: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
isAnimationActive: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: boolean;
|
|
75
|
+
};
|
|
76
|
+
transition: {
|
|
77
|
+
type: PropType<AnimationOptions>;
|
|
78
|
+
default: () => {
|
|
79
|
+
duration: number;
|
|
80
|
+
ease: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
onAnimationStart: {
|
|
84
|
+
type: PropType<() => void>;
|
|
85
|
+
default: any;
|
|
86
|
+
};
|
|
87
|
+
onAnimationEnd: {
|
|
88
|
+
type: PropType<() => void>;
|
|
89
|
+
default: any;
|
|
90
|
+
};
|
|
91
|
+
className: {
|
|
92
|
+
type: StringConstructor;
|
|
93
|
+
default: any;
|
|
94
|
+
};
|
|
95
|
+
width: {
|
|
96
|
+
type: PropType<number | string>;
|
|
97
|
+
default: any;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export type FunnelPropsWithSVG = WithSVGProps<typeof FunnelVueProps>;
|
|
32
101
|
type RealFunnelData = any;
|
|
33
102
|
export type FunnelComposedData = {
|
|
34
103
|
trapezoids: ReadonlyArray<FunnelTrapezoidItem>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FunnelChart: import('vue').DefineComponent<import('./generateCategoricalChart').CategoricalChartProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('./generateCategoricalChart').CategoricalChartProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
import { animate
|
|
3
|
-
import { usePreferredReducedMotion
|
|
1
|
+
import { defineComponent, onUnmounted, ref, watch } from "vue";
|
|
2
|
+
import { animate } from "motion-v";
|
|
3
|
+
import { usePreferredReducedMotion } from "@vueuse/core";
|
|
4
4
|
//#region src/animation/Animate.tsx
|
|
5
|
-
var
|
|
5
|
+
var DEFAULT_TRANSITION = {
|
|
6
6
|
duration: .4,
|
|
7
7
|
ease: "easeOut"
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
|
+
var Animate = /* @__PURE__ */ defineComponent({
|
|
9
10
|
name: "Animate",
|
|
10
11
|
props: {
|
|
11
12
|
isActive: {
|
|
12
13
|
type: Boolean,
|
|
13
|
-
default:
|
|
14
|
+
default: true
|
|
14
15
|
},
|
|
15
16
|
transition: {
|
|
16
17
|
type: Object,
|
|
@@ -37,27 +38,52 @@ var o = {
|
|
|
37
38
|
default: 1
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
|
-
setup(
|
|
41
|
-
let
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
setup(props, { slots }) {
|
|
42
|
+
let animationControls = null;
|
|
43
|
+
const currentValue = ref(0);
|
|
44
|
+
const reducedMotion = usePreferredReducedMotion();
|
|
45
|
+
const startAnimation = () => {
|
|
46
|
+
if (animationControls) animationControls.stop();
|
|
47
|
+
if (props.onAnimationStart) props.onAnimationStart();
|
|
48
|
+
animationControls = animate(props.from, props.to, {
|
|
49
|
+
...DEFAULT_TRANSITION,
|
|
50
|
+
...props.transition,
|
|
51
|
+
onUpdate: (latest) => {
|
|
52
|
+
currentValue.value = latest;
|
|
53
|
+
if (props.onUpdate) props.onUpdate(latest);
|
|
47
54
|
},
|
|
48
55
|
onComplete: () => {
|
|
49
|
-
|
|
56
|
+
currentValue.value = 1;
|
|
57
|
+
if (props.onAnimationEnd) props.onAnimationEnd();
|
|
50
58
|
}
|
|
51
59
|
});
|
|
52
|
-
}, f = () => {
|
|
53
|
-
c &&= (c.stop(), null);
|
|
54
60
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
const stopAnimation = () => {
|
|
62
|
+
if (animationControls) {
|
|
63
|
+
animationControls.stop();
|
|
64
|
+
animationControls = null;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
watch([() => props.isActive, reducedMotion], ([isActive, motion]) => {
|
|
68
|
+
if (isActive) if (motion === "reduce") {
|
|
69
|
+
stopAnimation();
|
|
70
|
+
if (props.onAnimationStart) props.onAnimationStart();
|
|
71
|
+
currentValue.value = props.to;
|
|
72
|
+
if (props.onAnimationEnd) props.onAnimationEnd();
|
|
73
|
+
} else startAnimation();
|
|
74
|
+
else {
|
|
75
|
+
stopAnimation();
|
|
76
|
+
currentValue.value = props.to;
|
|
77
|
+
}
|
|
78
|
+
}, { immediate: true });
|
|
79
|
+
onUnmounted(() => {
|
|
80
|
+
stopAnimation();
|
|
81
|
+
});
|
|
82
|
+
return () => {
|
|
83
|
+
if (!slots.default) return null;
|
|
84
|
+
return slots.default(currentValue.value);
|
|
85
|
+
};
|
|
60
86
|
}
|
|
61
87
|
});
|
|
62
88
|
//#endregion
|
|
63
|
-
export {
|
|
89
|
+
export { Animate };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useOffset
|
|
2
|
-
import { useNeedsClip
|
|
3
|
-
import { createVNode
|
|
1
|
+
import { useOffset } from "../context/chartLayoutContext.mjs";
|
|
2
|
+
import { useNeedsClip } from "./useNeedsClip.mjs";
|
|
3
|
+
import { createVNode, defineComponent } from "vue";
|
|
4
4
|
//#region src/cartesian/GraphicalItemClipPath.tsx
|
|
5
|
-
var
|
|
5
|
+
var GraphicalItemClipPath = /* @__PURE__ */ defineComponent({
|
|
6
6
|
name: "GraphicalItemClipPath",
|
|
7
7
|
props: {
|
|
8
8
|
xAxisId: {
|
|
@@ -15,22 +15,23 @@ var i = /* @__PURE__ */ r({
|
|
|
15
15
|
},
|
|
16
16
|
clipPathId: {
|
|
17
17
|
type: String,
|
|
18
|
-
required:
|
|
18
|
+
required: true
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
setup(
|
|
22
|
-
|
|
21
|
+
setup(props) {
|
|
22
|
+
const offset = useOffset();
|
|
23
|
+
const { needClipX, needClipY, needClip } = useNeedsClip(props.xAxisId, props.yAxisId);
|
|
23
24
|
return () => {
|
|
24
|
-
if (!
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
x:
|
|
28
|
-
y:
|
|
29
|
-
width:
|
|
30
|
-
height:
|
|
25
|
+
if (!needClip) return null;
|
|
26
|
+
const { left, top, width, height } = offset.value;
|
|
27
|
+
return createVNode("clipPath", { "id": `clipPath-${props.clipPathId}` }, [createVNode("rect", {
|
|
28
|
+
"x": needClipX ? left : left - width / 2,
|
|
29
|
+
"y": needClipY ? top : top - height / 2,
|
|
30
|
+
"width": needClipX ? width : width * 2,
|
|
31
|
+
"height": needClipY ? height : height * 2
|
|
31
32
|
}, null)]);
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
//#endregion
|
|
36
|
-
export {
|
|
37
|
+
export { GraphicalItemClipPath };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { isNullish
|
|
2
|
-
import { selectActiveTooltipIndex
|
|
3
|
-
import { useAppSelector
|
|
4
|
-
import { Layer
|
|
5
|
-
import { Dot
|
|
6
|
-
import { createVNode
|
|
1
|
+
import { isNullish } from "../../utils/validate.mjs";
|
|
2
|
+
import { selectActiveTooltipIndex } from "../../state/selectors/tooltipSelectors.mjs";
|
|
3
|
+
import { useAppSelector } from "../../state/hooks.mjs";
|
|
4
|
+
import { Layer } from "../../container/Layer.mjs";
|
|
5
|
+
import { Dot } from "../../shape/Dot.mjs";
|
|
6
|
+
import { createVNode, defineComponent, isVNode } from "vue";
|
|
7
7
|
//#region src/cartesian/area/ActivePoints.tsx
|
|
8
|
-
function
|
|
9
|
-
return typeof
|
|
8
|
+
function _isSlot(s) {
|
|
9
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
10
10
|
}
|
|
11
|
-
var
|
|
11
|
+
var ActivePoints = /* @__PURE__ */ defineComponent({
|
|
12
12
|
name: "ActivePoints",
|
|
13
13
|
props: {
|
|
14
14
|
points: {
|
|
15
15
|
type: Array,
|
|
16
|
-
required:
|
|
16
|
+
required: true
|
|
17
17
|
},
|
|
18
18
|
mainColor: {
|
|
19
19
|
type: String,
|
|
20
|
-
required:
|
|
20
|
+
required: true
|
|
21
21
|
},
|
|
22
22
|
itemDataKey: {
|
|
23
23
|
type: [
|
|
@@ -25,7 +25,7 @@ var l = /* @__PURE__ */ o({
|
|
|
25
25
|
Number,
|
|
26
26
|
Function
|
|
27
27
|
],
|
|
28
|
-
required:
|
|
28
|
+
required: true
|
|
29
29
|
},
|
|
30
30
|
activeDot: {
|
|
31
31
|
type: [
|
|
@@ -33,42 +33,46 @@ var l = /* @__PURE__ */ o({
|
|
|
33
33
|
Boolean,
|
|
34
34
|
Function
|
|
35
35
|
],
|
|
36
|
-
required:
|
|
36
|
+
required: true
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
slots: Object,
|
|
40
|
-
setup(
|
|
41
|
-
|
|
40
|
+
setup(props, { slots }) {
|
|
41
|
+
const activeTooltipIndex = useAppSelector(selectActiveTooltipIndex);
|
|
42
42
|
return () => {
|
|
43
|
-
|
|
44
|
-
if (!
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
const { points } = props;
|
|
44
|
+
if (!points?.length || isNullish(activeTooltipIndex.value)) return null;
|
|
45
|
+
const activePoint = points[Number(activeTooltipIndex.value)];
|
|
46
|
+
if (isNullish(activePoint)) return null;
|
|
47
|
+
return renderActivePoint({
|
|
48
|
+
point: activePoint,
|
|
49
|
+
childIndex: Number(activeTooltipIndex.value),
|
|
50
|
+
mainColor: props.mainColor,
|
|
51
|
+
dataKey: props.itemDataKey,
|
|
52
|
+
activeDot: props.activeDot,
|
|
53
|
+
slots
|
|
53
54
|
});
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
|
-
function
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
index:
|
|
61
|
-
dataKey
|
|
62
|
-
cx:
|
|
63
|
-
cy:
|
|
64
|
-
r: 4,
|
|
65
|
-
fill:
|
|
58
|
+
function renderActivePoint({ point, childIndex, mainColor, activeDot, dataKey, slots }) {
|
|
59
|
+
if (activeDot === false) return null;
|
|
60
|
+
const dotProps = {
|
|
61
|
+
"index": childIndex,
|
|
62
|
+
dataKey,
|
|
63
|
+
"cx": point.x,
|
|
64
|
+
"cy": point.y,
|
|
65
|
+
"r": 4,
|
|
66
|
+
"fill": mainColor,
|
|
66
67
|
"stroke-width": 2,
|
|
67
|
-
stroke: "#fff",
|
|
68
|
-
payload:
|
|
69
|
-
value:
|
|
70
|
-
}
|
|
71
|
-
|
|
68
|
+
"stroke": "#fff",
|
|
69
|
+
"payload": point.payload,
|
|
70
|
+
"value": point.value
|
|
71
|
+
};
|
|
72
|
+
let dot;
|
|
73
|
+
if (slots.activeDot) dot = slots.activeDot(dotProps);
|
|
74
|
+
else dot = createVNode(Dot, dotProps, null);
|
|
75
|
+
return createVNode(Layer, { "class": "v-charts-active-dot" }, _isSlot(dot) ? dot : { default: () => [dot] });
|
|
72
76
|
}
|
|
73
77
|
//#endregion
|
|
74
|
-
export {
|
|
78
|
+
export { ActivePoints };
|
|
@@ -1,41 +1,52 @@
|
|
|
1
|
-
import { AreaVueProps
|
|
2
|
-
import { useArea
|
|
3
|
-
import { Layer
|
|
4
|
-
import { StaticArea
|
|
5
|
-
import { ClipRect
|
|
6
|
-
import { ActivePoints
|
|
7
|
-
import { useSetupGraphicalItem
|
|
8
|
-
import { useGraphicalLayerRef
|
|
9
|
-
import { Fragment
|
|
1
|
+
import { AreaVueProps } from "./type.mjs";
|
|
2
|
+
import { useArea } from "./hooks/useArea.mjs";
|
|
3
|
+
import { Layer } from "../../container/Layer.mjs";
|
|
4
|
+
import { StaticArea } from "./RenderArea.mjs";
|
|
5
|
+
import { ClipRect } from "./ClipRect.mjs";
|
|
6
|
+
import { ActivePoints } from "./ActivePoints.mjs";
|
|
7
|
+
import { useSetupGraphicalItem } from "../../hooks/useSetupGraphicalItem.mjs";
|
|
8
|
+
import { useGraphicalLayerRef } from "../../context/graphicalLayerContext.mjs";
|
|
9
|
+
import { Fragment, Teleport, createVNode, defineComponent, isVNode } from "vue";
|
|
10
10
|
//#region src/cartesian/area/Area.tsx
|
|
11
|
-
function
|
|
12
|
-
return typeof
|
|
11
|
+
function _isSlot(s) {
|
|
12
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Type-safe Area component with slot types preserved in .d.ts output.
|
|
16
|
+
* The `new () => { $slots }` pattern ensures Volar picks up slot types
|
|
17
|
+
* even when consuming from compiled declarations.
|
|
18
|
+
*/
|
|
19
|
+
var Area = /* @__PURE__ */ defineComponent({
|
|
15
20
|
name: "Area",
|
|
16
|
-
props:
|
|
17
|
-
inheritAttrs:
|
|
21
|
+
props: AreaVueProps,
|
|
22
|
+
inheritAttrs: false,
|
|
18
23
|
slots: Object,
|
|
19
|
-
setup(
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
setup(props, { attrs, slots }) {
|
|
25
|
+
useSetupGraphicalItem(props, "area");
|
|
26
|
+
const { shouldRender, areaData, points, clipPathId, shouldShowAnimation } = useArea(props, attrs, slots.dot);
|
|
27
|
+
const graphicalLayerRef = useGraphicalLayerRef(null);
|
|
22
28
|
return () => {
|
|
23
|
-
let
|
|
24
|
-
if (!
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
let _slot;
|
|
30
|
+
if (!shouldRender.value) return null;
|
|
31
|
+
let activeDot;
|
|
32
|
+
if (slots.activeDot) activeDot = { activeDot: slots.activeDot };
|
|
33
|
+
const renderAreaContent = () => {
|
|
34
|
+
if (shouldShowAnimation.value) return createVNode(Layer, { "key": "area-with-animation" }, { default: () => [createVNode("defs", null, [createVNode("clipPath", { "id": `animationClipPath-${clipPathId.value}` }, [createVNode(ClipRect, null, null)])]), createVNode(Layer, { "clip-path": `url(#animationClipPath-${clipPathId.value})` }, { default: () => [createVNode(StaticArea, null, null)] })] });
|
|
35
|
+
return createVNode(StaticArea, { "key": "static-area" }, null);
|
|
36
|
+
};
|
|
37
|
+
const areaContent = createVNode(Fragment, null, [createVNode(Layer, { "class": ["v-charts-area", attrs.class] }, _isSlot(_slot = renderAreaContent()) ? _slot : { default: () => [_slot] }), createVNode(ActivePoints, {
|
|
38
|
+
"points": areaData.value?.points ?? [],
|
|
39
|
+
"mainColor": getLegendItemColor(attrs.stroke, props.fill),
|
|
40
|
+
"itemDataKey": props.dataKey,
|
|
41
|
+
"activeDot": props.activeDot
|
|
42
|
+
}, _isSlot(activeDot) ? activeDot : { default: () => [activeDot] })]);
|
|
43
|
+
if (graphicalLayerRef?.value) return createVNode(Teleport, { "to": graphicalLayerRef.value }, _isSlot(areaContent) ? areaContent : { default: () => [areaContent] });
|
|
44
|
+
return areaContent;
|
|
34
45
|
};
|
|
35
46
|
}
|
|
36
47
|
});
|
|
37
|
-
function
|
|
38
|
-
return
|
|
48
|
+
function getLegendItemColor(stroke, fill) {
|
|
49
|
+
return stroke && stroke !== "none" ? stroke : fill;
|
|
39
50
|
}
|
|
40
51
|
//#endregion
|
|
41
|
-
export {
|
|
52
|
+
export { Area };
|