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,82 +1,93 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { LegendSymbol
|
|
6
|
-
import { Teleport
|
|
1
|
+
import Surface from "../../container/Surface.mjs";
|
|
2
|
+
import { LegendVueProps } from "./type.mjs";
|
|
3
|
+
import { useLegend } from "./hooks/useLegend.mjs";
|
|
4
|
+
import { useLegendContent } from "./hooks/useLegendContent.mjs";
|
|
5
|
+
import { LegendSymbol } from "./LegendSymbol.mjs";
|
|
6
|
+
import { Teleport, createVNode, defineComponent, isVNode, watchEffect } from "vue";
|
|
7
7
|
//#region src/components/legend/Legend.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 Legend_default = /* @__PURE__ */ defineComponent({
|
|
12
12
|
name: "Legend",
|
|
13
|
-
props:
|
|
14
|
-
setup(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
props: LegendVueProps,
|
|
14
|
+
setup(props, { slots }) {
|
|
15
|
+
const { legendRef, processedPayload, outerStyle, legendPortal, syncSettings, syncSize } = useLegend(props);
|
|
16
|
+
const { getItemStyle, getSvgStyle, formatValue, handleClick, handleMouseEnter, handleMouseLeave } = useLegendContent(props);
|
|
17
|
+
watchEffect(() => {
|
|
18
|
+
syncSettings();
|
|
19
|
+
syncSize();
|
|
18
20
|
});
|
|
19
|
-
|
|
20
|
-
if (!
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
margin: 0,
|
|
27
|
-
textAlign: t === "horizontal" ? n : "left"
|
|
28
|
-
}
|
|
29
|
-
}, [d.value.map((n, s) => n.type === "none" ? null : o("li", {
|
|
30
|
-
key: `legend-item-${s}`,
|
|
31
|
-
class: "v-charts-legend-item",
|
|
32
|
-
style: g(t),
|
|
33
|
-
tabindex: 0,
|
|
34
|
-
role: "button",
|
|
35
|
-
"aria-label": `Toggle ${v(n)} series`,
|
|
36
|
-
onClick: () => y(n, s),
|
|
37
|
-
onKeydown: (e) => {
|
|
38
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), y(n, s));
|
|
39
|
-
},
|
|
40
|
-
onMouseenter: () => b(n, s),
|
|
41
|
-
onMouseleave: () => x(n, s)
|
|
42
|
-
}, [o(r, {
|
|
43
|
-
width: a,
|
|
44
|
-
height: a,
|
|
45
|
-
viewBox: {
|
|
46
|
-
x: 0,
|
|
47
|
-
y: 0,
|
|
48
|
-
width: 32,
|
|
49
|
-
height: 32
|
|
50
|
-
},
|
|
51
|
-
style: _(),
|
|
52
|
-
"aria-label": `${v(n)} legend icon`
|
|
53
|
-
}, { default: () => [o(i, {
|
|
54
|
-
type: e.iconType ?? n.type,
|
|
55
|
-
color: n.inactive ? "#a3a3a3" : n.color,
|
|
56
|
-
size: a,
|
|
57
|
-
data: n
|
|
58
|
-
}, null)] }), o("span", {
|
|
59
|
-
class: "v-charts-legend-item-text",
|
|
60
|
-
style: { color: n.inactive ? "#a3a3a3" : n.color }
|
|
61
|
-
}, [v(n)])]))]);
|
|
62
|
-
}, C = () => {
|
|
63
|
-
if (!d.value || d.value.length === 0) return null;
|
|
64
|
-
let t = {
|
|
65
|
-
...e,
|
|
66
|
-
payload: d.value
|
|
21
|
+
const renderDefaultContent = () => {
|
|
22
|
+
if (!processedPayload.value || processedPayload.value.length === 0) return null;
|
|
23
|
+
const { layout = "horizontal", align = "center", iconSize = 14 } = props;
|
|
24
|
+
const finalStyle = {
|
|
25
|
+
padding: 0,
|
|
26
|
+
margin: 0,
|
|
27
|
+
textAlign: layout === "horizontal" ? align : "left"
|
|
67
28
|
};
|
|
68
|
-
return
|
|
29
|
+
return createVNode("ul", {
|
|
30
|
+
"class": "v-charts-default-legend",
|
|
31
|
+
"style": finalStyle
|
|
32
|
+
}, [processedPayload.value.map((entry, index) => {
|
|
33
|
+
if (entry.type === "none") return null;
|
|
34
|
+
return createVNode("li", {
|
|
35
|
+
"key": `legend-item-${index}`,
|
|
36
|
+
"class": "v-charts-legend-item",
|
|
37
|
+
"style": getItemStyle(layout),
|
|
38
|
+
"tabindex": 0,
|
|
39
|
+
"role": "button",
|
|
40
|
+
"aria-label": `Toggle ${formatValue(entry)} series`,
|
|
41
|
+
"onClick": () => handleClick(entry, index),
|
|
42
|
+
"onKeydown": (e) => {
|
|
43
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
handleClick(entry, index);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"onMouseenter": () => handleMouseEnter(entry, index),
|
|
49
|
+
"onMouseleave": () => handleMouseLeave(entry, index)
|
|
50
|
+
}, [createVNode(Surface, {
|
|
51
|
+
"width": iconSize,
|
|
52
|
+
"height": iconSize,
|
|
53
|
+
"viewBox": {
|
|
54
|
+
x: 0,
|
|
55
|
+
y: 0,
|
|
56
|
+
width: 32,
|
|
57
|
+
height: 32
|
|
58
|
+
},
|
|
59
|
+
"style": getSvgStyle(),
|
|
60
|
+
"aria-label": `${formatValue(entry)} legend icon`
|
|
61
|
+
}, { default: () => [createVNode(LegendSymbol, {
|
|
62
|
+
"type": props.iconType ?? entry.type,
|
|
63
|
+
"color": entry.inactive ? "#a3a3a3" : entry.color,
|
|
64
|
+
"size": iconSize,
|
|
65
|
+
"data": entry
|
|
66
|
+
}, null)] }), createVNode("span", {
|
|
67
|
+
"class": "v-charts-legend-item-text",
|
|
68
|
+
"style": { color: entry.inactive ? "#a3a3a3" : entry.color }
|
|
69
|
+
}, [formatValue(entry)])]);
|
|
70
|
+
})]);
|
|
71
|
+
};
|
|
72
|
+
const renderContent = () => {
|
|
73
|
+
if (!processedPayload.value || processedPayload.value.length === 0) return null;
|
|
74
|
+
const contentProps = {
|
|
75
|
+
...props,
|
|
76
|
+
payload: processedPayload.value
|
|
77
|
+
};
|
|
78
|
+
if (slots.content) return slots.content(contentProps);
|
|
79
|
+
return renderDefaultContent();
|
|
69
80
|
};
|
|
70
81
|
return () => {
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
class: "v-charts-legend-wrapper",
|
|
74
|
-
style:
|
|
75
|
-
ref:
|
|
76
|
-
}, [
|
|
77
|
-
return
|
|
82
|
+
if (legendPortal.value == null) return null;
|
|
83
|
+
const legendElement = createVNode("div", {
|
|
84
|
+
"class": "v-charts-legend-wrapper",
|
|
85
|
+
"style": outerStyle.value,
|
|
86
|
+
"ref": legendRef
|
|
87
|
+
}, [renderContent()]);
|
|
88
|
+
return createVNode("foreignObject", null, [createVNode(Teleport, { "to": legendPortal.value }, _isSlot(legendElement) ? legendElement : { default: () => [legendElement] })]);
|
|
78
89
|
};
|
|
79
90
|
}
|
|
80
91
|
});
|
|
81
92
|
//#endregion
|
|
82
|
-
export {
|
|
93
|
+
export { Legend_default as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Symbols
|
|
2
|
-
import { createVNode
|
|
3
|
-
var
|
|
1
|
+
import { Symbols } from "../../shape/Symbols.mjs";
|
|
2
|
+
import { createVNode, defineComponent } from "vue";
|
|
3
|
+
var LegendSymbol = /* @__PURE__ */ defineComponent({
|
|
4
4
|
name: "LegendSymbol",
|
|
5
5
|
props: {
|
|
6
6
|
type: String,
|
|
@@ -11,50 +11,52 @@ var r = /* @__PURE__ */ n({
|
|
|
11
11
|
},
|
|
12
12
|
data: { type: Object }
|
|
13
13
|
},
|
|
14
|
-
setup(
|
|
14
|
+
setup(props) {
|
|
15
15
|
return () => {
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const { type, color, data } = props;
|
|
17
|
+
if (type === "none") return null;
|
|
18
|
+
const halfSize = 32 / 2;
|
|
19
|
+
const thirdSize = 32 / 3;
|
|
20
|
+
const sixthSize = 32 / 6;
|
|
21
|
+
switch (type) {
|
|
22
|
+
case "line": return createVNode("path", {
|
|
21
23
|
"stroke-width": 4,
|
|
22
|
-
fill: "none",
|
|
23
|
-
stroke:
|
|
24
|
-
d: `M0
|
|
25
|
-
A${
|
|
26
|
-
H32M${2 *
|
|
27
|
-
A${
|
|
28
|
-
class: "v-charts-legend-icon"
|
|
24
|
+
"fill": "none",
|
|
25
|
+
"stroke": color,
|
|
26
|
+
"d": `M0,${halfSize}h${thirdSize}
|
|
27
|
+
A${sixthSize},${sixthSize},0,1,1,${2 * thirdSize},${halfSize}
|
|
28
|
+
H32M${2 * thirdSize},${halfSize}
|
|
29
|
+
A${sixthSize},${sixthSize},0,1,1,${thirdSize},${halfSize}`,
|
|
30
|
+
"class": "v-charts-legend-icon"
|
|
29
31
|
}, null);
|
|
30
|
-
case "plainline": return
|
|
32
|
+
case "plainline": return createVNode("line", {
|
|
31
33
|
"stroke-width": 4,
|
|
32
|
-
fill: "none",
|
|
33
|
-
stroke:
|
|
34
|
-
"stroke-dasharray":
|
|
35
|
-
x1: 0,
|
|
36
|
-
y1:
|
|
37
|
-
x2: 32,
|
|
38
|
-
y2:
|
|
39
|
-
class: "v-charts-legend-icon"
|
|
34
|
+
"fill": "none",
|
|
35
|
+
"stroke": color,
|
|
36
|
+
"stroke-dasharray": data?.payload?.strokeDasharray,
|
|
37
|
+
"x1": 0,
|
|
38
|
+
"y1": halfSize,
|
|
39
|
+
"x2": 32,
|
|
40
|
+
"y2": halfSize,
|
|
41
|
+
"class": "v-charts-legend-icon"
|
|
40
42
|
}, null);
|
|
41
|
-
case "rect": return
|
|
42
|
-
stroke: "none",
|
|
43
|
-
fill:
|
|
44
|
-
d: `M0,${32 / 8}h32v${96 / 4}h-32z`,
|
|
45
|
-
class: "v-charts-legend-icon"
|
|
43
|
+
case "rect": return createVNode("path", {
|
|
44
|
+
"stroke": "none",
|
|
45
|
+
"fill": color,
|
|
46
|
+
"d": `M0,${32 / 8}h32v${96 / 4}h-32z`,
|
|
47
|
+
"class": "v-charts-legend-icon"
|
|
46
48
|
}, null);
|
|
47
|
-
default: return
|
|
48
|
-
fill:
|
|
49
|
-
cx:
|
|
50
|
-
cy:
|
|
51
|
-
size: 32,
|
|
52
|
-
sizeType: "diameter",
|
|
53
|
-
type:
|
|
49
|
+
default: return createVNode(Symbols, {
|
|
50
|
+
"fill": color,
|
|
51
|
+
"cx": halfSize,
|
|
52
|
+
"cy": halfSize,
|
|
53
|
+
"size": 32,
|
|
54
|
+
"sizeType": "diameter",
|
|
55
|
+
"type": type
|
|
54
56
|
}, null);
|
|
55
57
|
}
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
});
|
|
59
61
|
//#endregion
|
|
60
|
-
export {
|
|
62
|
+
export { LegendSymbol };
|
|
@@ -1,52 +1,77 @@
|
|
|
1
|
-
import { selectLegendPayload
|
|
2
|
-
import { useAppDispatch
|
|
3
|
-
import { useChartHeight
|
|
4
|
-
import { setLegendSettings
|
|
5
|
-
import { useLegendPortal
|
|
6
|
-
import { getUniqPayload
|
|
7
|
-
import { defaultUniqBy
|
|
8
|
-
import { computed
|
|
9
|
-
import { sortBy
|
|
10
|
-
import { useElementBounding
|
|
1
|
+
import { selectLegendPayload } from "../../../state/selectors/legendSelectors.mjs";
|
|
2
|
+
import { useAppDispatch, useAppSelector } from "../../../state/hooks.mjs";
|
|
3
|
+
import { useChartHeight, useChartWidth, useMargin } from "../../../context/chartLayoutContext.mjs";
|
|
4
|
+
import { setLegendSettings, setLegendSize } from "../../../state/legendSlice.mjs";
|
|
5
|
+
import { useLegendPortal } from "../../../chart/LegendPortalContext.mjs";
|
|
6
|
+
import { getUniqPayload } from "../../../utils/payload/getUniqPayload.mjs";
|
|
7
|
+
import { defaultUniqBy, getDefaultPosition, getWidthOrHeight } from "../utils.mjs";
|
|
8
|
+
import { computed, ref } from "vue";
|
|
9
|
+
import { sortBy } from "es-toolkit/compat";
|
|
10
|
+
import { useElementBounding } from "@vueuse/core";
|
|
11
11
|
//#region src/components/legend/hooks/useLegend.ts
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
function useLegend(props) {
|
|
13
|
+
const dispatch = useAppDispatch();
|
|
14
|
+
const contextPayload = useAppSelector(selectLegendPayload);
|
|
15
|
+
const legendPortalFromContext = useLegendPortal();
|
|
16
|
+
const margin = useMargin();
|
|
17
|
+
const chartWidth = useChartWidth();
|
|
18
|
+
const chartHeight = useChartHeight();
|
|
19
|
+
const legendRef = ref();
|
|
20
|
+
const { width: boundingWidth, height: boundingHeight } = useElementBounding(legendRef);
|
|
21
|
+
const maxWidth = computed(() => chartWidth.value - (margin.value.left || 0) - (margin.value.right || 0));
|
|
22
|
+
const widthOrHeight = computed(() => getWidthOrHeight(props.layout, props.height, props.width, maxWidth.value));
|
|
23
|
+
const boundingBox = computed(() => ({
|
|
24
|
+
width: boundingWidth.value,
|
|
25
|
+
height: boundingHeight.value
|
|
16
26
|
}));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
let e = l(y.value, _.payloadUniqBy, u);
|
|
24
|
-
return _.itemSorter && (typeof _.itemSorter == "string" || typeof _.itemSorter == "function") && (e = h(e, _.itemSorter)), Array.from(e);
|
|
25
|
-
}),
|
|
26
|
-
outerStyle: p(() => {
|
|
27
|
-
if (_.portal) return _.wrapperStyle || {};
|
|
28
|
-
let e = {
|
|
29
|
-
position: "absolute",
|
|
30
|
-
width: O.value?.width ? `${O.value.width}px` : _.width ? `${_.width}px` : "auto",
|
|
31
|
-
height: O.value?.height ? `${O.value.height}px` : _.height ? `${_.height}px` : "auto"
|
|
32
|
-
}, t = d(_.wrapperStyle, _, x.value, S.value, C.value, k.value);
|
|
33
|
-
return Object.assign({}, e, t, _.wrapperStyle || {});
|
|
34
|
-
}),
|
|
35
|
-
legendPortal: p(() => _.portal ?? b?.value),
|
|
36
|
-
syncSettings: () => {
|
|
37
|
-
v(o({
|
|
38
|
-
layout: _.layout,
|
|
39
|
-
align: _.align,
|
|
40
|
-
verticalAlign: _.verticalAlign
|
|
41
|
-
}));
|
|
42
|
-
},
|
|
43
|
-
syncSize: () => {
|
|
44
|
-
v(s({
|
|
45
|
-
width: k.value.width,
|
|
46
|
-
height: k.value.height
|
|
47
|
-
}));
|
|
27
|
+
const processedPayload = computed(() => {
|
|
28
|
+
if (!contextPayload.value || contextPayload.value.length === 0) return [];
|
|
29
|
+
let finalPayload = getUniqPayload(contextPayload.value, props.payloadUniqBy, defaultUniqBy);
|
|
30
|
+
if (props.itemSorter) {
|
|
31
|
+
if (typeof props.itemSorter === "string") finalPayload = sortBy(finalPayload, props.itemSorter);
|
|
32
|
+
else if (typeof props.itemSorter === "function") finalPayload = sortBy(finalPayload, props.itemSorter);
|
|
48
33
|
}
|
|
34
|
+
return Array.from(finalPayload);
|
|
35
|
+
});
|
|
36
|
+
const outerStyle = computed(() => {
|
|
37
|
+
const userStyle = props.wrapperStyle ? { ...props.wrapperStyle } : {};
|
|
38
|
+
if (props.portal) return userStyle;
|
|
39
|
+
const baseStyle = {
|
|
40
|
+
position: "absolute",
|
|
41
|
+
width: widthOrHeight.value?.width ? `${widthOrHeight.value.width}px` : props.width ? `${props.width}px` : "auto",
|
|
42
|
+
height: widthOrHeight.value?.height ? `${widthOrHeight.value.height}px` : props.height ? `${props.height}px` : "auto"
|
|
43
|
+
};
|
|
44
|
+
const positionStyle = getDefaultPosition(userStyle, props, margin.value, chartWidth.value, chartHeight.value, boundingBox.value);
|
|
45
|
+
return {
|
|
46
|
+
...baseStyle,
|
|
47
|
+
...positionStyle,
|
|
48
|
+
...userStyle
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const legendPortal = computed(() => props.portal ?? legendPortalFromContext?.value);
|
|
52
|
+
const syncSettings = () => {
|
|
53
|
+
dispatch(setLegendSettings({
|
|
54
|
+
layout: props.layout,
|
|
55
|
+
align: props.align,
|
|
56
|
+
verticalAlign: props.verticalAlign
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
const syncSize = () => {
|
|
60
|
+
dispatch(setLegendSize({
|
|
61
|
+
width: boundingBox.value.width,
|
|
62
|
+
height: boundingBox.value.height
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
legendRef,
|
|
67
|
+
boundingBox,
|
|
68
|
+
widthOrHeight,
|
|
69
|
+
processedPayload,
|
|
70
|
+
outerStyle,
|
|
71
|
+
legendPortal,
|
|
72
|
+
syncSettings,
|
|
73
|
+
syncSize
|
|
49
74
|
};
|
|
50
75
|
}
|
|
51
76
|
//#endregion
|
|
52
|
-
export {
|
|
77
|
+
export { useLegend };
|
|
@@ -1,47 +1,68 @@
|
|
|
1
1
|
//#region src/components/legend/hooks/useLegendContent.ts
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
function useLegendContent(props) {
|
|
3
|
+
const getWrapperStyle = (layout = "horizontal", align = "center", verticalAlign = "bottom") => {
|
|
4
|
+
return {
|
|
5
5
|
display: "flex",
|
|
6
|
-
flexDirection:
|
|
7
|
-
justifyContent:
|
|
8
|
-
alignItems:
|
|
6
|
+
flexDirection: layout === "horizontal" ? "row" : "column",
|
|
7
|
+
justifyContent: align === "left" ? "flex-start" : align === "right" ? "flex-end" : "center",
|
|
8
|
+
alignItems: verticalAlign === "top" ? "flex-start" : verticalAlign === "bottom" ? "flex-end" : "center",
|
|
9
9
|
flexWrap: "wrap",
|
|
10
10
|
gap: "8px",
|
|
11
|
-
...
|
|
12
|
-
}
|
|
13
|
-
|
|
11
|
+
...props.wrapperStyle || {}
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const getContentStyle = (layout = "horizontal") => {
|
|
15
|
+
return {
|
|
14
16
|
display: "flex",
|
|
15
|
-
flexDirection:
|
|
16
|
-
gap:
|
|
17
|
-
...
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
flexDirection: layout === "horizontal" ? "row" : "column",
|
|
18
|
+
gap: layout === "horizontal" ? "16px" : "8px",
|
|
19
|
+
...props.contentStyle || {}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const getItemStyle = (layout = "horizontal") => {
|
|
23
|
+
return {
|
|
24
|
+
display: layout === "horizontal" ? "inline-block" : "block",
|
|
21
25
|
marginRight: "10px"
|
|
22
|
-
}
|
|
23
|
-
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const getViewBox = () => {
|
|
29
|
+
return {
|
|
24
30
|
x: 0,
|
|
25
31
|
y: 0,
|
|
26
32
|
width: 32,
|
|
27
33
|
height: 32
|
|
28
|
-
}
|
|
29
|
-
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const getSvgStyle = () => {
|
|
37
|
+
return {
|
|
30
38
|
display: "inline-block",
|
|
31
39
|
verticalAlign: "middle",
|
|
32
40
|
marginRight: "4px"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const formatValue = (entry) => {
|
|
44
|
+
return props.formatter ? props.formatter(entry.value, entry) : entry.value;
|
|
45
|
+
};
|
|
46
|
+
const handleClick = (entry, index) => {
|
|
47
|
+
props.onClick?.(entry, index);
|
|
48
|
+
};
|
|
49
|
+
const handleMouseEnter = (entry, index) => {
|
|
50
|
+
props.onMouseEnter?.(entry, index);
|
|
51
|
+
};
|
|
52
|
+
const handleMouseLeave = (entry, index) => {
|
|
53
|
+
props.onMouseLeave?.(entry, index);
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
getWrapperStyle,
|
|
57
|
+
getContentStyle,
|
|
58
|
+
getItemStyle,
|
|
59
|
+
getViewBox,
|
|
60
|
+
getSvgStyle,
|
|
61
|
+
formatValue,
|
|
62
|
+
handleClick,
|
|
63
|
+
handleMouseEnter,
|
|
64
|
+
handleMouseLeave
|
|
44
65
|
};
|
|
45
66
|
}
|
|
46
67
|
//#endregion
|
|
47
|
-
export {
|
|
68
|
+
export { useLegendContent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/legend/type.ts
|
|
2
|
-
var
|
|
2
|
+
var LegendVueProps = {
|
|
3
3
|
layout: {
|
|
4
4
|
type: String,
|
|
5
5
|
default: "horizontal"
|
|
@@ -38,4 +38,4 @@ var e = {
|
|
|
38
38
|
onBBoxUpdate: Function
|
|
39
39
|
};
|
|
40
40
|
//#endregion
|
|
41
|
-
export {
|
|
41
|
+
export { LegendVueProps };
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { isNumber
|
|
1
|
+
import { isNumber } from "../../utils/validate.mjs";
|
|
2
2
|
//#region src/components/legend/utils.ts
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
function getDefaultPosition(style, props, margin, chartWidth, chartHeight, box) {
|
|
4
|
+
const { layout, align, verticalAlign } = props;
|
|
5
|
+
let hPos = {};
|
|
6
|
+
let vPos = {};
|
|
7
|
+
if (!style || (style.left === void 0 || style.left === null) && (style.right === void 0 || style.right === null)) if (align === "center" && layout === "vertical") hPos = { left: `${((chartWidth || 0) - box.width) / 2}px` };
|
|
8
|
+
else hPos = align === "right" ? { right: `${margin?.right || 0}px` } : { left: `${margin?.left || 0}px` };
|
|
9
|
+
if (!style || (style.top === void 0 || style.top === null) && (style.bottom === void 0 || style.bottom === null)) if (verticalAlign === "middle") vPos = { top: `${((chartHeight || 0) - box.height) / 2}px` };
|
|
10
|
+
else vPos = verticalAlign === "bottom" ? { bottom: `${margin?.bottom || 0}px` } : { top: `${margin?.top || 0}px` };
|
|
11
|
+
return {
|
|
12
|
+
...hPos,
|
|
13
|
+
...vPos
|
|
8
14
|
};
|
|
9
15
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
16
|
+
function getWidthOrHeight(layout, height, width, maxWidth) {
|
|
17
|
+
if (layout === "vertical" && isNumber(height)) return { height };
|
|
18
|
+
if (layout === "horizontal") return { width: width || maxWidth };
|
|
19
|
+
return null;
|
|
12
20
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
21
|
+
function defaultUniqBy(entry) {
|
|
22
|
+
return entry.value;
|
|
15
23
|
}
|
|
16
24
|
//#endregion
|
|
17
|
-
export {
|
|
25
|
+
export { defaultUniqBy, getDefaultPosition, getWidthOrHeight };
|
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
import { polarToCartesian
|
|
1
|
+
import { polarToCartesian } from "../utils/polar.mjs";
|
|
2
2
|
//#region src/components/utils.ts
|
|
3
|
-
function
|
|
4
|
-
|
|
3
|
+
function getRadialCursorPoints(activeCoordinate) {
|
|
4
|
+
const { cx, cy, radius, startAngle, endAngle } = activeCoordinate;
|
|
5
5
|
return {
|
|
6
|
-
points: [
|
|
7
|
-
cx
|
|
8
|
-
cy
|
|
9
|
-
radius
|
|
10
|
-
startAngle
|
|
11
|
-
endAngle
|
|
6
|
+
points: [polarToCartesian(cx, cy, radius, startAngle), polarToCartesian(cx, cy, radius, endAngle)],
|
|
7
|
+
cx,
|
|
8
|
+
cy,
|
|
9
|
+
radius,
|
|
10
|
+
startAngle,
|
|
11
|
+
endAngle
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} else
|
|
14
|
+
function getCursorPoints(layout, activeCoordinate, offset) {
|
|
15
|
+
let x1, y1, x2, y2;
|
|
16
|
+
if (layout === "horizontal") {
|
|
17
|
+
x1 = activeCoordinate.x;
|
|
18
|
+
x2 = x1;
|
|
19
|
+
y1 = offset.top;
|
|
20
|
+
y2 = offset.top + offset.height;
|
|
21
|
+
} else if (layout === "vertical") {
|
|
22
|
+
y1 = activeCoordinate.y;
|
|
23
|
+
y2 = y1;
|
|
24
|
+
x1 = offset.left;
|
|
25
|
+
x2 = offset.left + offset.width;
|
|
26
|
+
} else if (activeCoordinate.cx != null && activeCoordinate.cy != null) if (layout === "centric") {
|
|
27
|
+
const { cx, cy, innerRadius, outerRadius, angle } = activeCoordinate;
|
|
28
|
+
const innerPoint = polarToCartesian(cx, cy, innerRadius, angle);
|
|
29
|
+
const outerPoint = polarToCartesian(cx, cy, outerRadius, angle);
|
|
30
|
+
x1 = innerPoint.x;
|
|
31
|
+
y1 = innerPoint.y;
|
|
32
|
+
x2 = outerPoint.x;
|
|
33
|
+
y2 = outerPoint.y;
|
|
34
|
+
} else return getRadialCursorPoints(activeCoordinate);
|
|
22
35
|
return [{
|
|
23
|
-
x:
|
|
24
|
-
y:
|
|
36
|
+
x: x1,
|
|
37
|
+
y: y1
|
|
25
38
|
}, {
|
|
26
|
-
x:
|
|
27
|
-
y:
|
|
39
|
+
x: x2,
|
|
40
|
+
y: y2
|
|
28
41
|
}];
|
|
29
42
|
}
|
|
30
43
|
//#endregion
|
|
31
|
-
export {
|
|
44
|
+
export { getCursorPoints };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { useOffset
|
|
2
|
-
import { createVNode
|
|
1
|
+
import { useOffset } from "../context/chartLayoutContext.mjs";
|
|
2
|
+
import { createVNode, defineComponent } from "vue";
|
|
3
3
|
//#region src/container/ClipPath.tsx
|
|
4
|
-
var
|
|
4
|
+
var ClipPath_default = /* @__PURE__ */ defineComponent({
|
|
5
5
|
name: "ClipPath",
|
|
6
6
|
props: { clipPathId: {
|
|
7
7
|
type: String,
|
|
8
|
-
required:
|
|
8
|
+
required: true
|
|
9
9
|
} },
|
|
10
|
-
setup(
|
|
11
|
-
|
|
10
|
+
setup(props) {
|
|
11
|
+
const offset = useOffset();
|
|
12
12
|
return () => {
|
|
13
|
-
if (!
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
x:
|
|
17
|
-
y:
|
|
18
|
-
height:
|
|
19
|
-
width:
|
|
13
|
+
if (!offset.value) return null;
|
|
14
|
+
const { left, top, height, width } = offset.value;
|
|
15
|
+
return createVNode("defs", null, [createVNode("clipPath", { "id": props.clipPathId }, [createVNode("rect", {
|
|
16
|
+
"x": left,
|
|
17
|
+
"y": top,
|
|
18
|
+
"height": height,
|
|
19
|
+
"width": width
|
|
20
20
|
}, null)])]);
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
//#endregion
|
|
25
|
-
export {
|
|
25
|
+
export { ClipPath_default as default };
|