vlite3 1.1.8 → 1.1.9
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/components/Chart/BarChart.vue.js +369 -0
- package/components/Chart/BarChart.vue2.js +4 -0
- package/components/Chart/CircleChart.vue.js +137 -0
- package/components/Chart/CircleChart.vue2.js +4 -0
- package/components/Chart/GaugeChart.vue.js +443 -0
- package/components/Chart/GaugeChart.vue2.js +4 -0
- package/components/Chart/LineChart.vue.js +7 -0
- package/components/Chart/LineChart.vue2.js +313 -0
- package/components/Chart/PieChart.vue.js +203 -0
- package/components/Chart/PieChart.vue2.js +4 -0
- package/components/Chart/utils.js +90 -0
- package/components/Footer/Footer.vue.js +35 -0
- package/components/Footer/Footer.vue2.js +4 -0
- package/components/Footer/Variant1.vue.js +178 -0
- package/components/Footer/Variant1.vue2.js +4 -0
- package/components/Footer/Variant2.vue.js +177 -0
- package/components/Footer/Variant2.vue2.js +4 -0
- package/components/Footer/Variant3.vue.js +82 -0
- package/components/Footer/Variant3.vue2.js +4 -0
- package/components/RichTextEditor/RichTextEditor.vue.js +332 -0
- package/components/RichTextEditor/RichTextEditor.vue3.js +5 -0
- package/components/RichTextEditor/RichTextLinkPopover.vue.js +107 -0
- package/components/RichTextEditor/RichTextLinkPopover.vue3.js +5 -0
- package/components/RichTextEditor/RichTextReader.vue.js +7 -0
- package/components/RichTextEditor/RichTextReader.vue2.js +19 -0
- package/components/RichTextEditor/RichTextToolbar.vue.js +330 -0
- package/components/RichTextEditor/RichTextToolbar.vue3.js +5 -0
- package/components/RichTextEditor/composables/useRichTextImageUpload.js +77 -0
- package/components/RichTextEditor/composables/useRichTextLinks.js +120 -0
- package/core/config.d.ts +2 -2
- package/index.d.ts +3 -0
- package/index.js +332 -315
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { defineComponent as ee, ref as R, computed as r, onMounted as te, watch as le, onUnmounted as ae, openBlock as l, createElementBlock as a, Fragment as y, renderList as x, createElementVNode as c, normalizeStyle as T, createTextVNode as oe, toDisplayString as m, createCommentVNode as i, unref as k, createBlock as ne, Teleport as ue } from "vue";
|
|
2
|
+
import { CHART_COLORS as se, formatNumber as S, getColor as D, niceYTicks as re, smoothPath as ie, linearPath as ce, animateProgress as de } from "./utils.js";
|
|
3
|
+
const he = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "flex flex-wrap gap-x-4 gap-y-1 mb-3 pl-14"
|
|
6
|
+
}, ve = ["width", "height"], fe = ["id"], ye = ["width", "height"], xe = ["id"], me = ["stop-color"], pe = ["stop-color"], ge = ["transform"], be = ["y1", "x2", "y2", "stroke-opacity"], ke = ["y"], we = ["x", "y"], Me = ["y1", "x2", "y2", "stroke-opacity"], Le = ["y2", "stroke-opacity"], Be = ["x1", "x2", "y2"], $e = ["d", "fill", "clip-path"], Ce = ["d", "stroke", "stroke-width", "clip-path"], _e = ["cx", "cy", "r", "fill", "opacity", "clip-path"], Re = ["x", "y"], Ve = ["x", "y"], Xe = { class: "font-medium text-xs mb-1.5" }, Ye = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "text-muted-foreground"
|
|
9
|
+
}, Oe = { class: "font-semibold" }, Ae = /* @__PURE__ */ ee({
|
|
10
|
+
__name: "LineChart",
|
|
11
|
+
props: {
|
|
12
|
+
data: {},
|
|
13
|
+
datasets: {},
|
|
14
|
+
labels: {},
|
|
15
|
+
height: { default: 300 },
|
|
16
|
+
smooth: { type: Boolean, default: !0 },
|
|
17
|
+
fill: { type: Boolean, default: !0 },
|
|
18
|
+
showDots: { type: Boolean, default: !0 },
|
|
19
|
+
showGrid: { type: Boolean, default: !0 },
|
|
20
|
+
showLegend: { type: Boolean, default: !0 },
|
|
21
|
+
showTooltip: { type: Boolean, default: !0 },
|
|
22
|
+
colors: { default: () => se },
|
|
23
|
+
animate: { type: Boolean, default: !0 },
|
|
24
|
+
xLabel: {},
|
|
25
|
+
yLabel: {},
|
|
26
|
+
formatValue: {},
|
|
27
|
+
yMin: {},
|
|
28
|
+
yMax: {},
|
|
29
|
+
showXAxis: { type: Boolean, default: !0 },
|
|
30
|
+
showYAxis: { type: Boolean, default: !0 },
|
|
31
|
+
showXLabels: { type: Boolean, default: !0 },
|
|
32
|
+
showYLabels: { type: Boolean, default: !0 },
|
|
33
|
+
gridOpacity: { default: 0.07 },
|
|
34
|
+
axisOpacity: { default: 0.1 },
|
|
35
|
+
lineWidth: { default: 2.5 }
|
|
36
|
+
},
|
|
37
|
+
setup(u) {
|
|
38
|
+
const t = u, w = R(), V = R(600), d = r(() => {
|
|
39
|
+
const o = (s) => String(s).length, n = t.showYLabels ? Math.max(2, ...M.value.map((s) => o(t.formatValue ? t.formatValue(s) : S(s)))) * 6.5 : 0, e = t.showYLabels ? Math.max(24, n + 12) : 8;
|
|
40
|
+
return {
|
|
41
|
+
top: 16,
|
|
42
|
+
right: 16,
|
|
43
|
+
// Collapse bottom padding when X labels are hidden
|
|
44
|
+
bottom: t.showXLabels ? 24 : 6,
|
|
45
|
+
left: e + (t.yLabel ? 20 : 0)
|
|
46
|
+
};
|
|
47
|
+
}), v = r(() => Math.max(0, V.value - d.value.left - d.value.right)), h = r(() => Math.max(0, t.height - d.value.top - d.value.bottom)), p = r(() => {
|
|
48
|
+
if (t.datasets?.length)
|
|
49
|
+
return t.datasets.map((n, e) => ({
|
|
50
|
+
label: n.label,
|
|
51
|
+
color: n.color ?? D(t.colors, e),
|
|
52
|
+
values: n.data
|
|
53
|
+
}));
|
|
54
|
+
const o = t.data ?? [];
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
label: "",
|
|
58
|
+
color: D(t.colors, 0),
|
|
59
|
+
values: o.map((n) => n.value)
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
}), X = r(() => t.labels?.length ? t.labels : t.datasets?.length ? t.datasets[0].data.map((o, n) => String(n + 1)) : (t.data ?? []).map((o) => o.label)), W = r(() => p.value.flatMap((o) => o.values)), G = r(() => t.yMin ?? Math.min(0, ...W.value)), E = r(() => t.yMax ?? (Math.max(...W.value) || 1)), M = r(() => re(G.value, E.value, 5)), P = r(() => M.value[0]), H = r(() => M.value[M.value.length - 1]), j = r(() => H.value - P.value || 1);
|
|
63
|
+
function L(o) {
|
|
64
|
+
return h.value - (o - P.value) / j.value * h.value;
|
|
65
|
+
}
|
|
66
|
+
function _(o) {
|
|
67
|
+
const n = X.value.length;
|
|
68
|
+
return n < 2 ? v.value / 2 : o / (n - 1) * v.value;
|
|
69
|
+
}
|
|
70
|
+
const Y = R(t.animate ? 0 : 1);
|
|
71
|
+
let z = null;
|
|
72
|
+
function F(o) {
|
|
73
|
+
return o.map((n, e) => [_(e), L(n)]);
|
|
74
|
+
}
|
|
75
|
+
const I = r(
|
|
76
|
+
() => p.value.map((o) => {
|
|
77
|
+
const n = F(o.values), e = t.smooth ? ie(n) : ce(n), s = n[0]?.[0] ?? 0, C = n[n.length - 1]?.[0] ?? v.value, b = L(Math.max(0, P.value)), f = e + ` L ${C},${b} L ${s},${b} Z`;
|
|
78
|
+
return { line: e, fillPath: f, pts: n, color: o.color, label: o.label };
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
function N() {
|
|
82
|
+
z?.(), Y.value = 0, z = de(900, (o) => {
|
|
83
|
+
Y.value = o;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
te(() => {
|
|
87
|
+
U(), t.animate && N();
|
|
88
|
+
}), le(
|
|
89
|
+
() => [t.data, t.datasets],
|
|
90
|
+
() => {
|
|
91
|
+
t.animate && N();
|
|
92
|
+
},
|
|
93
|
+
{ deep: !0 }
|
|
94
|
+
), ae(() => {
|
|
95
|
+
z?.(), A?.disconnect();
|
|
96
|
+
});
|
|
97
|
+
let A = null;
|
|
98
|
+
function U() {
|
|
99
|
+
w.value && (A = new ResizeObserver((o) => {
|
|
100
|
+
V.value = o[0].contentRect.width || 600;
|
|
101
|
+
}), A.observe(w.value), V.value = w.value.clientWidth || 600);
|
|
102
|
+
}
|
|
103
|
+
const g = R(null), B = R(null);
|
|
104
|
+
function Z(o) {
|
|
105
|
+
if (!t.showTooltip) return;
|
|
106
|
+
const n = o.currentTarget.getBoundingClientRect(), e = o.clientX - n.left - d.value.left, s = X.value.length;
|
|
107
|
+
if (s === 0) return;
|
|
108
|
+
const C = s < 2 ? v.value : v.value / (s - 1), b = Math.round(e / C), f = Math.max(0, Math.min(s - 1, b));
|
|
109
|
+
B.value = f;
|
|
110
|
+
const J = p.value.map((O) => ({
|
|
111
|
+
color: O.color,
|
|
112
|
+
label: O.label,
|
|
113
|
+
value: t.formatValue ? t.formatValue(O.values[f]) : S(O.values[f])
|
|
114
|
+
})), K = _(f) + d.value.left, Q = L(p.value[0].values[f]) + d.value.top;
|
|
115
|
+
g.value = {
|
|
116
|
+
x: K,
|
|
117
|
+
y: Q,
|
|
118
|
+
label: X.value[f],
|
|
119
|
+
items: J
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function q() {
|
|
123
|
+
g.value = null, B.value = null;
|
|
124
|
+
}
|
|
125
|
+
const $ = Math.random().toString(36).slice(2, 7);
|
|
126
|
+
return (o, n) => (l(), a("div", {
|
|
127
|
+
ref_key: "containerRef",
|
|
128
|
+
ref: w,
|
|
129
|
+
class: "vlite-line-chart w-full select-none"
|
|
130
|
+
}, [
|
|
131
|
+
u.showLegend && p.value.length > 1 ? (l(), a("div", he, [
|
|
132
|
+
(l(!0), a(y, null, x(p.value, (e) => (l(), a("div", {
|
|
133
|
+
key: e.label,
|
|
134
|
+
class: "flex items-center gap-1.5 text-xs text-muted-foreground"
|
|
135
|
+
}, [
|
|
136
|
+
c("span", {
|
|
137
|
+
class: "w-3 h-0.5 rounded-full inline-block",
|
|
138
|
+
style: T({ backgroundColor: e.color })
|
|
139
|
+
}, null, 4),
|
|
140
|
+
oe(" " + m(e.label), 1)
|
|
141
|
+
]))), 128))
|
|
142
|
+
])) : i("", !0),
|
|
143
|
+
(l(), a("svg", {
|
|
144
|
+
width: V.value,
|
|
145
|
+
height: u.height,
|
|
146
|
+
role: "img",
|
|
147
|
+
"aria-label": "Line chart",
|
|
148
|
+
class: "overflow-visible",
|
|
149
|
+
onMousemove: Z,
|
|
150
|
+
onMouseleave: q
|
|
151
|
+
}, [
|
|
152
|
+
c("defs", null, [
|
|
153
|
+
c("clipPath", {
|
|
154
|
+
id: `clip-${k($)}`
|
|
155
|
+
}, [
|
|
156
|
+
c("rect", {
|
|
157
|
+
x: 0,
|
|
158
|
+
y: -10,
|
|
159
|
+
width: v.value * Y.value,
|
|
160
|
+
height: h.value + 20
|
|
161
|
+
}, null, 8, ye)
|
|
162
|
+
], 8, fe),
|
|
163
|
+
(l(!0), a(y, null, x(p.value, (e, s) => (l(), a("linearGradient", {
|
|
164
|
+
key: s,
|
|
165
|
+
id: `grad-${k($)}-${s}`,
|
|
166
|
+
x1: "0",
|
|
167
|
+
y1: "0",
|
|
168
|
+
x2: "0",
|
|
169
|
+
y2: "1"
|
|
170
|
+
}, [
|
|
171
|
+
c("stop", {
|
|
172
|
+
offset: "0%",
|
|
173
|
+
"stop-color": e.color,
|
|
174
|
+
"stop-opacity": "0.25"
|
|
175
|
+
}, null, 8, me),
|
|
176
|
+
c("stop", {
|
|
177
|
+
offset: "100%",
|
|
178
|
+
"stop-color": e.color,
|
|
179
|
+
"stop-opacity": "0.02"
|
|
180
|
+
}, null, 8, pe)
|
|
181
|
+
], 8, xe))), 128))
|
|
182
|
+
]),
|
|
183
|
+
c("g", {
|
|
184
|
+
transform: `translate(${d.value.left},${d.value.top})`
|
|
185
|
+
}, [
|
|
186
|
+
u.showGrid ? (l(!0), a(y, { key: 0 }, x(M.value, (e) => (l(), a("line", {
|
|
187
|
+
key: e,
|
|
188
|
+
x1: 0,
|
|
189
|
+
y1: L(e),
|
|
190
|
+
x2: v.value,
|
|
191
|
+
y2: L(e),
|
|
192
|
+
stroke: "currentColor",
|
|
193
|
+
"stroke-opacity": u.gridOpacity,
|
|
194
|
+
"stroke-width": "1"
|
|
195
|
+
}, null, 8, be))), 128)) : i("", !0),
|
|
196
|
+
u.showYLabels ? (l(!0), a(y, { key: 1 }, x(M.value, (e) => (l(), a("text", {
|
|
197
|
+
key: `yt-${e}`,
|
|
198
|
+
x: -10,
|
|
199
|
+
y: L(e),
|
|
200
|
+
"text-anchor": "end",
|
|
201
|
+
"dominant-baseline": "middle",
|
|
202
|
+
class: "fill-muted-foreground text-[10px]",
|
|
203
|
+
"font-size": "11"
|
|
204
|
+
}, m(u.formatValue ? u.formatValue(e) : k(S)(e)), 9, ke))), 128)) : i("", !0),
|
|
205
|
+
u.showXLabels ? (l(!0), a(y, { key: 2 }, x(X.value, (e, s) => (l(), a("text", {
|
|
206
|
+
key: `xl-${s}`,
|
|
207
|
+
x: _(s),
|
|
208
|
+
y: h.value + 16,
|
|
209
|
+
"text-anchor": "middle",
|
|
210
|
+
class: "fill-muted-foreground",
|
|
211
|
+
"font-size": "11"
|
|
212
|
+
}, m(e), 9, we))), 128)) : i("", !0),
|
|
213
|
+
u.showXAxis ? (l(), a("line", {
|
|
214
|
+
key: 3,
|
|
215
|
+
x1: 0,
|
|
216
|
+
y1: h.value,
|
|
217
|
+
x2: v.value,
|
|
218
|
+
y2: h.value,
|
|
219
|
+
stroke: "currentColor",
|
|
220
|
+
"stroke-opacity": u.axisOpacity
|
|
221
|
+
}, null, 8, Me)) : i("", !0),
|
|
222
|
+
u.showYAxis ? (l(), a("line", {
|
|
223
|
+
key: 4,
|
|
224
|
+
x1: 0,
|
|
225
|
+
y1: 0,
|
|
226
|
+
x2: 0,
|
|
227
|
+
y2: h.value,
|
|
228
|
+
stroke: "currentColor",
|
|
229
|
+
"stroke-opacity": u.axisOpacity
|
|
230
|
+
}, null, 8, Le)) : i("", !0),
|
|
231
|
+
B.value !== null ? (l(), a("line", {
|
|
232
|
+
key: 5,
|
|
233
|
+
x1: _(B.value),
|
|
234
|
+
y1: 0,
|
|
235
|
+
x2: _(B.value),
|
|
236
|
+
y2: h.value,
|
|
237
|
+
stroke: "currentColor",
|
|
238
|
+
"stroke-opacity": "0.12",
|
|
239
|
+
"stroke-width": "1",
|
|
240
|
+
"stroke-dasharray": "4 3"
|
|
241
|
+
}, null, 8, Be)) : i("", !0),
|
|
242
|
+
(l(!0), a(y, null, x(I.value, (e, s) => (l(), a("g", { key: s }, [
|
|
243
|
+
u.fill ? (l(), a("path", {
|
|
244
|
+
key: 0,
|
|
245
|
+
d: e.fillPath,
|
|
246
|
+
fill: `url(#grad-${k($)}-${s})`,
|
|
247
|
+
"clip-path": `url(#clip-${k($)})`
|
|
248
|
+
}, null, 8, $e)) : i("", !0),
|
|
249
|
+
c("path", {
|
|
250
|
+
d: e.line,
|
|
251
|
+
fill: "none",
|
|
252
|
+
stroke: e.color,
|
|
253
|
+
"stroke-width": u.lineWidth,
|
|
254
|
+
"stroke-linejoin": "round",
|
|
255
|
+
"stroke-linecap": "round",
|
|
256
|
+
"clip-path": `url(#clip-${k($)})`
|
|
257
|
+
}, null, 8, Ce),
|
|
258
|
+
u.showDots ? (l(!0), a(y, { key: 1 }, x(e.pts, (C, b) => (l(), a("circle", {
|
|
259
|
+
key: b,
|
|
260
|
+
cx: C[0],
|
|
261
|
+
cy: C[1],
|
|
262
|
+
r: B.value === b ? 5 : 3.5,
|
|
263
|
+
fill: e.color,
|
|
264
|
+
class: "transition-[r] duration-150",
|
|
265
|
+
opacity: Y.value > 0 ? 1 : 0,
|
|
266
|
+
"clip-path": `url(#clip-${k($)})`
|
|
267
|
+
}, null, 8, _e))), 128)) : i("", !0)
|
|
268
|
+
]))), 128)),
|
|
269
|
+
u.yLabel ? (l(), a("text", {
|
|
270
|
+
key: 6,
|
|
271
|
+
x: -(h.value / 2),
|
|
272
|
+
y: -(d.value.left - 10),
|
|
273
|
+
"text-anchor": "middle",
|
|
274
|
+
transform: "rotate(-90)",
|
|
275
|
+
"font-size": "11",
|
|
276
|
+
class: "fill-muted-foreground font-medium"
|
|
277
|
+
}, m(u.yLabel), 9, Re)) : i("", !0),
|
|
278
|
+
u.xLabel ? (l(), a("text", {
|
|
279
|
+
key: 7,
|
|
280
|
+
x: v.value / 2,
|
|
281
|
+
y: h.value + 40,
|
|
282
|
+
"text-anchor": "middle",
|
|
283
|
+
"font-size": "11",
|
|
284
|
+
class: "fill-muted-foreground"
|
|
285
|
+
}, m(u.xLabel), 9, Ve)) : i("", !0)
|
|
286
|
+
], 8, ge)
|
|
287
|
+
], 40, ve)),
|
|
288
|
+
(l(), ne(ue, { to: "body" }, [
|
|
289
|
+
g.value ? (l(), a("div", {
|
|
290
|
+
key: 0,
|
|
291
|
+
class: "vlite-chart-tooltip",
|
|
292
|
+
style: T({ left: `${g.value.x + (w.value?.getBoundingClientRect().left ?? 0)}px`, top: `${g.value.y + (w.value?.getBoundingClientRect().top ?? 0) - 10}px` })
|
|
293
|
+
}, [
|
|
294
|
+
c("div", Xe, m(g.value.label), 1),
|
|
295
|
+
(l(!0), a(y, null, x(g.value.items, (e) => (l(), a("div", {
|
|
296
|
+
key: e.label,
|
|
297
|
+
class: "flex items-center gap-1.5 text-xs"
|
|
298
|
+
}, [
|
|
299
|
+
c("span", {
|
|
300
|
+
class: "w-2 h-2 rounded-full shrink-0",
|
|
301
|
+
style: T({ backgroundColor: e.color })
|
|
302
|
+
}, null, 4),
|
|
303
|
+
e.label ? (l(), a("span", Ye, m(e.label) + ":", 1)) : i("", !0),
|
|
304
|
+
c("span", Oe, m(e.value), 1)
|
|
305
|
+
]))), 128))
|
|
306
|
+
], 4)) : i("", !0)
|
|
307
|
+
]))
|
|
308
|
+
], 512));
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
export {
|
|
312
|
+
Ae as default
|
|
313
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { defineComponent as se, ref as E, onMounted as ie, watch as ue, onUnmounted as re, computed as h, openBlock as s, createElementBlock as i, normalizeClass as I, createElementVNode as u, unref as M, Fragment as w, renderList as $, createCommentVNode as m, toDisplayString as d, renderSlot as de, normalizeStyle as O, createBlock as ce, Teleport as ve, createTextVNode as fe } from "vue";
|
|
2
|
+
import { CHART_COLORS as he, getColor as _, arcPath as me, formatNumber as z, animateProgress as xe } from "./utils.js";
|
|
3
|
+
const ye = { class: "shrink-0" }, ge = ["width", "height"], be = ["id"], Me = ["filter"], ke = ["d", "fill", "transform", "onMouseenter"], pe = {
|
|
4
|
+
key: 0,
|
|
5
|
+
style: { "pointer-events": "none" }
|
|
6
|
+
}, we = ["d", "opacity"], $e = ["x", "y", "text-anchor", "font-size", "font-weight", "fill", "opacity"], ze = { key: 2 }, Le = ["x", "y"], Ae = ["x", "y"], Pe = ["onMouseenter"], Ce = { class: "min-w-0" }, Re = { class: "text-xs font-medium text-foreground truncate" }, Se = { class: "text-[10px] text-muted-foreground" }, Be = { class: "flex items-center gap-1.5 mb-1" }, Ve = { class: "text-xs font-semibold" }, Te = { class: "text-xs text-muted-foreground" }, De = { class: "font-medium text-foreground ml-1" }, Oe = /* @__PURE__ */ se({
|
|
7
|
+
__name: "PieChart",
|
|
8
|
+
props: {
|
|
9
|
+
data: {},
|
|
10
|
+
donut: { type: Boolean, default: !1 },
|
|
11
|
+
innerRadius: { default: 60 },
|
|
12
|
+
size: { default: 280 },
|
|
13
|
+
startAngle: { default: -90 },
|
|
14
|
+
showLegend: { type: Boolean, default: !0 },
|
|
15
|
+
legendPosition: { default: "right" },
|
|
16
|
+
labelMode: { default: "percent" },
|
|
17
|
+
colors: { default: () => he },
|
|
18
|
+
animate: { type: Boolean, default: !0 },
|
|
19
|
+
showTooltip: { type: Boolean, default: !0 },
|
|
20
|
+
centerLabel: {},
|
|
21
|
+
centerValue: {}
|
|
22
|
+
},
|
|
23
|
+
setup(e) {
|
|
24
|
+
const o = e, j = Math.random().toString(36).slice(2, 7), L = E(o.animate ? 0 : 1);
|
|
25
|
+
let A = null;
|
|
26
|
+
function X() {
|
|
27
|
+
A?.(), L.value = 0, A = xe(1e3, (a) => L.value = a);
|
|
28
|
+
}
|
|
29
|
+
ie(() => {
|
|
30
|
+
o.animate && X();
|
|
31
|
+
}), ue(() => o.data, () => {
|
|
32
|
+
o.animate && X();
|
|
33
|
+
}, { deep: !0 }), re(() => A?.());
|
|
34
|
+
const Y = h(() => o.labelMode === "outside"), x = h(() => o.size / 2), v = h(() => o.size / 2), y = h(() => o.size / 2 - (Y.value ? 36 : 4)), F = h(() => o.donut ? y.value * (o.innerRadius / 100) : 0), P = h(() => o.data.reduce((a, n) => a + n.value, 0) || 1), k = h(() => {
|
|
35
|
+
let a = o.startAngle;
|
|
36
|
+
return o.data.map((n, t) => {
|
|
37
|
+
const l = n.value / P.value, c = l * 360 * L.value, C = n.color ?? _(o.colors, t), g = a, R = a + c;
|
|
38
|
+
a += l * 360;
|
|
39
|
+
const H = (g + R) / 2 * (Math.PI / 180), p = Math.cos(H), S = Math.sin(H), B = p >= 0, U = y.value * 0.65 + F.value * 0.35;
|
|
40
|
+
let q = x.value + U * p, G = v.value + U * S, J = "middle", K = 0, Q = 0, V = 0, T = 0, D = 0, N = 0, W = "";
|
|
41
|
+
if (Y.value) {
|
|
42
|
+
const Z = y.value + 20, ae = 14;
|
|
43
|
+
K = x.value + y.value * p, Q = v.value + y.value * S, V = x.value + Z * p, T = v.value + Z * S, D = V + ae * (B ? 1 : -1), N = T, W = `M ${K},${Q} L ${V},${T} L ${D},${N}`, q = D + 5 * (B ? 1 : -1), G = N, J = B ? "start" : "end";
|
|
44
|
+
}
|
|
45
|
+
const ne = me(x.value, v.value, y.value, g, R, F.value);
|
|
46
|
+
let b = "";
|
|
47
|
+
return o.labelMode === "percent" ? b = `${Math.round(l * 100)}%` : o.labelMode === "value" ? b = z(n.value) : o.labelMode === "label" ? b = n.label : o.labelMode === "outside" && (b = `${z(n.value)} (${Math.round(l * 100)}%)`), { d: n, path: ne, color: C, lx: q, ly: G, label: b, pct: l, startA: g, endA: R, leaderPath: W, textAnchor: J };
|
|
48
|
+
});
|
|
49
|
+
}), f = E(null), r = E(null);
|
|
50
|
+
function ee(a, n) {
|
|
51
|
+
f.value = n, o.showTooltip && (r.value = { x: a.clientX, y: a.clientY, item: k.value[n] });
|
|
52
|
+
}
|
|
53
|
+
function te(a) {
|
|
54
|
+
r.value && (r.value = { ...r.value, x: a.clientX, y: a.clientY });
|
|
55
|
+
}
|
|
56
|
+
function le() {
|
|
57
|
+
f.value = null, r.value = null;
|
|
58
|
+
}
|
|
59
|
+
function oe(a, n, t) {
|
|
60
|
+
if (f.value !== a) return "";
|
|
61
|
+
const l = (n + t) / 2 * (Math.PI / 180), c = 8, C = Math.cos(l) * c, g = Math.sin(l) * c;
|
|
62
|
+
return `translate(${C}, ${g})`;
|
|
63
|
+
}
|
|
64
|
+
return (a, n) => (s(), i("div", {
|
|
65
|
+
class: I(["vlite-pie-chart inline-flex gap-6 select-none", e.legendPosition === "bottom" ? "flex-col items-center" : "flex-row items-center"])
|
|
66
|
+
}, [
|
|
67
|
+
u("div", ye, [
|
|
68
|
+
(s(), i("svg", {
|
|
69
|
+
width: e.size,
|
|
70
|
+
height: e.size,
|
|
71
|
+
role: "img",
|
|
72
|
+
"aria-label": "Pie chart",
|
|
73
|
+
class: "overflow-visible"
|
|
74
|
+
}, [
|
|
75
|
+
u("defs", null, [
|
|
76
|
+
u("filter", {
|
|
77
|
+
id: `shadow-${M(j)}`,
|
|
78
|
+
x: "-20%",
|
|
79
|
+
y: "-20%",
|
|
80
|
+
width: "140%",
|
|
81
|
+
height: "140%"
|
|
82
|
+
}, [...n[1] || (n[1] = [
|
|
83
|
+
u("feDropShadow", {
|
|
84
|
+
dx: "0",
|
|
85
|
+
dy: "2",
|
|
86
|
+
stdDeviation: "3",
|
|
87
|
+
"flood-opacity": "0.12"
|
|
88
|
+
}, null, -1)
|
|
89
|
+
])], 8, be)
|
|
90
|
+
]),
|
|
91
|
+
u("g", {
|
|
92
|
+
filter: `url(#shadow-${M(j)})`
|
|
93
|
+
}, [
|
|
94
|
+
(s(!0), i(w, null, $(k.value, (t, l) => (s(), i("path", {
|
|
95
|
+
key: l,
|
|
96
|
+
d: t.path,
|
|
97
|
+
fill: t.color,
|
|
98
|
+
transform: oe(l, t.startA, t.endA),
|
|
99
|
+
class: "cursor-pointer transition-transform duration-200",
|
|
100
|
+
stroke: "var(--color-background)",
|
|
101
|
+
"stroke-width": "2",
|
|
102
|
+
onMouseenter: (c) => ee(c, l),
|
|
103
|
+
onMousemove: te,
|
|
104
|
+
onMouseleave: le
|
|
105
|
+
}, null, 40, ke))), 128))
|
|
106
|
+
], 8, Me),
|
|
107
|
+
e.labelMode === "outside" ? (s(), i("g", pe, [
|
|
108
|
+
(s(!0), i(w, null, $(k.value, (t, l) => (s(), i("path", {
|
|
109
|
+
key: `leader-${l}`,
|
|
110
|
+
d: t.leaderPath,
|
|
111
|
+
fill: "none",
|
|
112
|
+
stroke: "var(--color-muted-foreground)",
|
|
113
|
+
"stroke-width": "1",
|
|
114
|
+
"stroke-linecap": "round",
|
|
115
|
+
"stroke-linejoin": "round",
|
|
116
|
+
opacity: t.pct > 0.02 ? 0.5 : 0
|
|
117
|
+
}, null, 8, we))), 128))
|
|
118
|
+
])) : m("", !0),
|
|
119
|
+
e.labelMode !== "none" ? (s(!0), i(w, { key: 1 }, $(k.value, (t, l) => (s(), i("text", {
|
|
120
|
+
key: `lbl-${l}`,
|
|
121
|
+
x: t.lx,
|
|
122
|
+
y: t.ly,
|
|
123
|
+
"text-anchor": e.labelMode === "outside" ? t.textAnchor : "middle",
|
|
124
|
+
"dominant-baseline": "middle",
|
|
125
|
+
"font-size": e.labelMode === "outside" ? 11.5 : 11,
|
|
126
|
+
"font-weight": e.labelMode === "outside" ? "500" : "600",
|
|
127
|
+
fill: e.labelMode === "outside" ? "var(--color-foreground)" : "white",
|
|
128
|
+
opacity: t.pct > 0.04 ? 1 : 0
|
|
129
|
+
}, d(t.label), 9, $e))), 128)) : m("", !0),
|
|
130
|
+
e.donut ? (s(), i("g", ze, [
|
|
131
|
+
de(a.$slots, "center", {
|
|
132
|
+
total: P.value,
|
|
133
|
+
data: e.data
|
|
134
|
+
}, () => [
|
|
135
|
+
e.centerValue ? (s(), i("text", {
|
|
136
|
+
key: 0,
|
|
137
|
+
x: x.value,
|
|
138
|
+
y: e.centerLabel ? v.value - 8 : v.value,
|
|
139
|
+
"text-anchor": "middle",
|
|
140
|
+
"dominant-baseline": "central",
|
|
141
|
+
"font-size": "22",
|
|
142
|
+
"font-weight": "700",
|
|
143
|
+
class: "fill-foreground"
|
|
144
|
+
}, d(e.centerValue), 9, Le)) : m("", !0),
|
|
145
|
+
e.centerLabel ? (s(), i("text", {
|
|
146
|
+
key: 1,
|
|
147
|
+
x: x.value,
|
|
148
|
+
y: v.value + (e.centerValue ? 14 : 0),
|
|
149
|
+
"text-anchor": "middle",
|
|
150
|
+
"dominant-baseline": "middle",
|
|
151
|
+
"font-size": "12",
|
|
152
|
+
class: "fill-muted-foreground"
|
|
153
|
+
}, d(e.centerLabel), 9, Ae)) : m("", !0)
|
|
154
|
+
])
|
|
155
|
+
])) : m("", !0)
|
|
156
|
+
], 8, ge))
|
|
157
|
+
]),
|
|
158
|
+
e.showLegend ? (s(), i("div", {
|
|
159
|
+
key: 0,
|
|
160
|
+
class: I(["flex flex-col gap-2 min-w-[120px]", e.legendPosition === "bottom" ? "flex-row flex-wrap justify-center" : ""])
|
|
161
|
+
}, [
|
|
162
|
+
(s(!0), i(w, null, $(e.data, (t, l) => (s(), i("div", {
|
|
163
|
+
key: l,
|
|
164
|
+
class: I(["flex items-center gap-2 cursor-pointer", f.value !== null && f.value !== l ? "opacity-40" : ""]),
|
|
165
|
+
style: { transition: "opacity 0.15s" },
|
|
166
|
+
onMouseenter: (c) => f.value = l,
|
|
167
|
+
onMouseleave: n[0] || (n[0] = (c) => f.value = null)
|
|
168
|
+
}, [
|
|
169
|
+
u("span", {
|
|
170
|
+
class: "w-2.5 h-2.5 rounded-sm shrink-0",
|
|
171
|
+
style: O({ backgroundColor: t.color ?? M(_)(e.colors, l) })
|
|
172
|
+
}, null, 4),
|
|
173
|
+
u("div", Ce, [
|
|
174
|
+
u("div", Re, d(t.label), 1),
|
|
175
|
+
u("div", Se, d(M(z)(t.value)) + " (" + d(Math.round(t.value / P.value * 100)) + "%) ", 1)
|
|
176
|
+
])
|
|
177
|
+
], 42, Pe))), 128))
|
|
178
|
+
], 2)) : m("", !0),
|
|
179
|
+
(s(), ce(ve, { to: "body" }, [
|
|
180
|
+
r.value ? (s(), i("div", {
|
|
181
|
+
key: 0,
|
|
182
|
+
class: "vlite-chart-tooltip",
|
|
183
|
+
style: O({ left: `${r.value.x + 12}px`, top: `${r.value.y - 10}px` })
|
|
184
|
+
}, [
|
|
185
|
+
u("div", Be, [
|
|
186
|
+
u("span", {
|
|
187
|
+
class: "w-2.5 h-2.5 rounded-sm shrink-0",
|
|
188
|
+
style: O({ backgroundColor: r.value.item.color })
|
|
189
|
+
}, null, 4),
|
|
190
|
+
u("span", Ve, d(r.value.item.d.label), 1)
|
|
191
|
+
]),
|
|
192
|
+
u("div", Te, [
|
|
193
|
+
fe(d(M(z)(r.value.item.d.value)) + " ", 1),
|
|
194
|
+
u("span", De, " (" + d(Math.round(r.value.item.pct * 100)) + "%) ", 1)
|
|
195
|
+
])
|
|
196
|
+
], 4)) : m("", !0)
|
|
197
|
+
]))
|
|
198
|
+
], 2));
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
export {
|
|
202
|
+
Oe as default
|
|
203
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const b = [
|
|
2
|
+
"var(--color-chart-1)",
|
|
3
|
+
"var(--color-chart-2)",
|
|
4
|
+
"var(--color-chart-3)",
|
|
5
|
+
"var(--color-chart-4)",
|
|
6
|
+
"var(--color-chart-5)",
|
|
7
|
+
"var(--color-chart-6)"
|
|
8
|
+
];
|
|
9
|
+
function x(t) {
|
|
10
|
+
return {
|
|
11
|
+
primary: "var(--color-primary)",
|
|
12
|
+
success: "var(--color-success)",
|
|
13
|
+
warning: "var(--color-warning)",
|
|
14
|
+
danger: "var(--color-danger)",
|
|
15
|
+
info: "var(--color-info)",
|
|
16
|
+
purple: "#8b5cf6",
|
|
17
|
+
teal: "#14b8a6",
|
|
18
|
+
orange: "#f97316",
|
|
19
|
+
pink: "#ec4899",
|
|
20
|
+
cyan: "#06b6d4"
|
|
21
|
+
}[t] ?? t;
|
|
22
|
+
}
|
|
23
|
+
function F(t, r) {
|
|
24
|
+
return t[r % t.length];
|
|
25
|
+
}
|
|
26
|
+
function A(t) {
|
|
27
|
+
return Math.abs(t) >= 1e6 ? (t / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : Math.abs(t) >= 1e3 ? (t / 1e3).toFixed(1).replace(/\.0$/, "") + "k" : String(t);
|
|
28
|
+
}
|
|
29
|
+
function C(t, r, o) {
|
|
30
|
+
return Math.max(r, Math.min(o, t));
|
|
31
|
+
}
|
|
32
|
+
function k(t) {
|
|
33
|
+
if (t.length < 2) return "";
|
|
34
|
+
if (t.length === 2)
|
|
35
|
+
return `M ${t[0][0]},${t[0][1]} L ${t[1][0]},${t[1][1]}`;
|
|
36
|
+
const r = [`M ${t[0][0]},${t[0][1]}`];
|
|
37
|
+
for (let o = 0; o < t.length - 1; o++) {
|
|
38
|
+
const e = t[Math.max(0, o - 1)], n = t[o], a = t[o + 1], h = t[Math.min(t.length - 1, o + 2)], c = n[0] + (a[0] - e[0]) / 6, s = n[1] + (a[1] - e[1]) / 6, i = a[0] - (h[0] - n[0]) / 6, u = a[1] - (h[1] - n[1]) / 6;
|
|
39
|
+
r.push(`C ${c},${s} ${i},${u} ${a[0]},${a[1]}`);
|
|
40
|
+
}
|
|
41
|
+
return r.join(" ");
|
|
42
|
+
}
|
|
43
|
+
function w(t) {
|
|
44
|
+
return t.length === 0 ? "" : t.map(([r, o], e) => `${e === 0 ? "M" : "L"} ${r},${o}`).join(" ");
|
|
45
|
+
}
|
|
46
|
+
function y(t, r, o, e, n, a = 0) {
|
|
47
|
+
const h = (v) => v * Math.PI / 180, c = h(e), s = h(n), i = n - e > 180 ? 1 : 0, u = t + o * Math.cos(c), $ = r + o * Math.sin(c), l = t + o * Math.cos(s), f = r + o * Math.sin(s);
|
|
48
|
+
if (a <= 0)
|
|
49
|
+
return `M ${t},${r} L ${u},${$} A ${o},${o} 0 ${i} 1 ${l},${f} Z`;
|
|
50
|
+
const M = t + a * Math.cos(s), m = r + a * Math.sin(s), g = t + a * Math.cos(c), p = r + a * Math.sin(c);
|
|
51
|
+
return [
|
|
52
|
+
`M ${u},${$}`,
|
|
53
|
+
`A ${o},${o} 0 ${i} 1 ${l},${f}`,
|
|
54
|
+
`L ${M},${m}`,
|
|
55
|
+
`A ${a},${a} 0 ${i} 0 ${g},${p}`,
|
|
56
|
+
"Z"
|
|
57
|
+
].join(" ");
|
|
58
|
+
}
|
|
59
|
+
function L(t, r, o = 5) {
|
|
60
|
+
const n = (r - t || 1) / (o - 1), a = Math.pow(10, Math.floor(Math.log10(n))), c = ([1, 2, 2.5, 5, 10].find(($) => $ * a >= n) ?? 10) * a, s = Math.floor(t / c) * c, i = [];
|
|
61
|
+
let u = s;
|
|
62
|
+
for (; i.push(parseFloat(u.toFixed(10))), !(u >= r); )
|
|
63
|
+
u += c;
|
|
64
|
+
return i;
|
|
65
|
+
}
|
|
66
|
+
function d(t) {
|
|
67
|
+
return 1 - Math.pow(1 - t, 3);
|
|
68
|
+
}
|
|
69
|
+
function P(t, r, o) {
|
|
70
|
+
let e = null, n;
|
|
71
|
+
const a = (h) => {
|
|
72
|
+
e === null && (e = h);
|
|
73
|
+
const c = h - e, s = d(Math.min(c / t, 1));
|
|
74
|
+
r(s), c < t && (n = requestAnimationFrame(a));
|
|
75
|
+
};
|
|
76
|
+
return n = requestAnimationFrame(a), () => cancelAnimationFrame(n);
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
b as CHART_COLORS,
|
|
80
|
+
P as animateProgress,
|
|
81
|
+
y as arcPath,
|
|
82
|
+
C as clamp,
|
|
83
|
+
d as easeOutCubic,
|
|
84
|
+
A as formatNumber,
|
|
85
|
+
F as getColor,
|
|
86
|
+
w as linearPath,
|
|
87
|
+
L as niceYTicks,
|
|
88
|
+
x as resolveColor,
|
|
89
|
+
k as smoothPath
|
|
90
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent as s, computed as n, openBlock as i, createBlock as c, resolveDynamicComponent as l } from "vue";
|
|
2
|
+
import { getComponentConfig as m } from "../../utils/configUtils.js";
|
|
3
|
+
import p from "./Variant1.vue.js";
|
|
4
|
+
import f from "./Variant2.vue.js";
|
|
5
|
+
import u from "./Variant3.vue.js";
|
|
6
|
+
const $ = /* @__PURE__ */ s({
|
|
7
|
+
__name: "Footer",
|
|
8
|
+
props: {
|
|
9
|
+
data: {},
|
|
10
|
+
variant: {},
|
|
11
|
+
labels: {},
|
|
12
|
+
containerClass: {}
|
|
13
|
+
},
|
|
14
|
+
setup(r) {
|
|
15
|
+
const a = r, e = m("footer") || {}, t = n(() => a.variant ?? e.variant ?? "Variant1"), o = n(() => {
|
|
16
|
+
switch (t.value) {
|
|
17
|
+
case "Variant2":
|
|
18
|
+
return f;
|
|
19
|
+
case "Variant3":
|
|
20
|
+
return u;
|
|
21
|
+
default:
|
|
22
|
+
return p;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return (_, v) => (i(), c(l(o.value), {
|
|
26
|
+
data: a.data,
|
|
27
|
+
variant: t.value,
|
|
28
|
+
labels: a.labels,
|
|
29
|
+
"container-class": a.containerClass
|
|
30
|
+
}, null, 8, ["data", "variant", "labels", "container-class"]));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
$ as default
|
|
35
|
+
};
|