vlite3 1.4.18 → 1.4.20
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/CategoryManager/CategoryManager.vue2.js +3 -3
- package/components/Chart/BarChart.vue.d.ts +2 -0
- package/components/Chart/BarChart.vue.js +165 -150
- package/components/Chart/types.d.ts +2 -0
- package/components/Chart/utils.js +45 -41
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/RichTextEditor/RichTextEditor.vue.js +4 -4
- package/components/RichTextEditor/RichTextLinkPopover.vue3.js +2 -2
- package/components/RichTextEditor/RichTextToolbar.vue3.js +2 -2
- package/components/Screen/ScreenFilter.vue.js +3 -3
- package/components/Stats/StatItem.vue.js +122 -122
- package/components/Stats/Stats.vue.js +47 -47
- package/components/Stats/components/StatIconBox.vue.js +1 -1
- package/components/Stats/components/StatTrend.vue.js +17 -17
- package/components/Stats/types.d.ts +1 -1
- package/components/Tabes/Tabes.vue.js +1 -1
- package/components/Tabes/Tabes.vue2.js +29 -29
- package/package.json +1 -1
- package/style.css +1 -1
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
- /package/components/RichTextEditor/{RichTextLinkPopover.vue2.js → RichTextLinkPopover.vue.js} +0 -0
- /package/components/RichTextEditor/{RichTextToolbar.vue2.js → RichTextToolbar.vue.js} +0 -0
|
@@ -17,13 +17,13 @@ import "v-datepicker-lite";
|
|
|
17
17
|
import "v-datepicker-lite/style.css";
|
|
18
18
|
import "@jaames/iro";
|
|
19
19
|
import "@vueuse/core";
|
|
20
|
-
/* empty css
|
|
20
|
+
/* empty css */
|
|
21
21
|
import qe from "../IconPicker.vue.js";
|
|
22
22
|
/* empty css */
|
|
23
23
|
/* empty css */
|
|
24
24
|
/* empty css */
|
|
25
|
-
/* empty css
|
|
26
|
-
/* empty css
|
|
25
|
+
/* empty css */
|
|
26
|
+
/* empty css */
|
|
27
27
|
import "../../core/config.js";
|
|
28
28
|
/* empty css */
|
|
29
29
|
/* empty css */
|
|
@@ -25,6 +25,8 @@ export interface BarChartProps {
|
|
|
25
25
|
gridOpacity?: number;
|
|
26
26
|
/** Opacity of axis border lines (0–1) */
|
|
27
27
|
axisOpacity?: number;
|
|
28
|
+
/** Fixed width for Y-axis labels (horizontal mode) */
|
|
29
|
+
yLabelWidth?: number;
|
|
28
30
|
}
|
|
29
31
|
declare const _default: import('vue').DefineComponent<BarChartProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BarChartProps> & Readonly<{}>, {
|
|
30
32
|
animate: boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { CHART_COLORS as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as ie, ref as S, computed as f, onMounted as ce, watch as ve, onUnmounted as de, openBlock as n, createElementBlock as u, Fragment as d, renderList as h, createElementVNode as w, normalizeStyle as U, createTextVNode as he, toDisplayString as k, createCommentVNode as m, unref as M, withDirectives as fe, vShow as me, createBlock as ye, Teleport as xe } from "vue";
|
|
2
|
+
import { CHART_COLORS as ge, getColor as J, formatNumber as X, niceYTicks as $e, animateProgress as be } from "./utils.js";
|
|
3
|
+
const pe = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "flex flex-wrap gap-x-4 gap-y-1 mb-3 pl-14"
|
|
6
|
-
},
|
|
6
|
+
}, ke = ["width", "height"], Me = ["id"], Le = ["stop-color"], we = ["stop-color"], Ve = ["id"], Ce = ["stop-color"], Be = ["stop-color"], Re = ["transform"], Xe = ["y1", "x2", "y2", "stroke-opacity"], Ye = ["y"], ze = ["d", "fill"], Oe = ["x", "y"], Se = ["x", "y", "text-anchor", "transform"], Ae = ["y1", "x2", "y2", "stroke-opacity"], We = ["y2", "stroke-opacity"], Ge = ["transform"], Te = ["x1", "x2", "y2", "stroke-opacity"], Pe = ["x"], He = ["x", "y"], Ne = ["d", "fill"], Qe = ["x", "y"], Ze = ["y2", "stroke-opacity"], De = ["y1", "x2", "y2", "stroke-opacity"], Ee = { class: "font-medium text-xs mb-1.5" }, Fe = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "text-muted-foreground"
|
|
9
|
-
},
|
|
9
|
+
}, Ie = { class: "font-semibold" }, je = /* @__PURE__ */ ie({
|
|
10
10
|
__name: "BarChart",
|
|
11
11
|
props: {
|
|
12
12
|
data: {},
|
|
@@ -19,7 +19,7 @@ const be = {
|
|
|
19
19
|
showLegend: { type: Boolean, default: !0 },
|
|
20
20
|
showTooltip: { type: Boolean, default: !0 },
|
|
21
21
|
showValues: { type: Boolean, default: !1 },
|
|
22
|
-
colors: { default: () =>
|
|
22
|
+
colors: { default: () => ge },
|
|
23
23
|
animate: { type: Boolean, default: !0 },
|
|
24
24
|
formatValue: {},
|
|
25
25
|
showXAxis: { type: Boolean, default: !0 },
|
|
@@ -27,10 +27,11 @@ const be = {
|
|
|
27
27
|
showXLabels: { type: Boolean, default: !0 },
|
|
28
28
|
showYLabels: { type: Boolean, default: !0 },
|
|
29
29
|
gridOpacity: { default: 0.07 },
|
|
30
|
-
axisOpacity: { default: 0.1 }
|
|
30
|
+
axisOpacity: { default: 0.1 },
|
|
31
|
+
yLabelWidth: {}
|
|
31
32
|
},
|
|
32
33
|
setup(i) {
|
|
33
|
-
const s = i,
|
|
34
|
+
const s = i, A = S(), C = S(600), b = f(() => s.datasets?.length ? s.datasets.map((l, e) => ({
|
|
34
35
|
label: l.label,
|
|
35
36
|
color: l.color ?? J(s.colors, e),
|
|
36
37
|
values: l.data
|
|
@@ -41,123 +42,137 @@ const be = {
|
|
|
41
42
|
// will use per-bar color from data
|
|
42
43
|
values: (s.data ?? []).map((l) => l.value)
|
|
43
44
|
}
|
|
44
|
-
]),
|
|
45
|
+
]), p = f(() => b.value.length > 1 || !!s.datasets?.length), v = f(() => s.labels?.length ? s.labels : s.datasets?.length ? b.value[0]?.values.map((t, l) => String(l + 1)) ?? [] : (s.data ?? []).map((t) => t.label)), z = f(() => {
|
|
45
46
|
if (s.orientation !== "vertical" || !s.showXLabels || v.value.length === 0) return !1;
|
|
46
|
-
const t = Math.max(2, Math.floor(
|
|
47
|
+
const t = Math.max(2, Math.floor(C.value / 65));
|
|
47
48
|
return v.value.length > t;
|
|
48
|
-
}),
|
|
49
|
-
|
|
49
|
+
}), K = (t, l) => {
|
|
50
|
+
if (!t) return "";
|
|
51
|
+
const e = Math.max(1, Math.floor(l / 6));
|
|
52
|
+
return t.length > e ? t.slice(0, Math.max(1, e - 2)) + "..." : t;
|
|
53
|
+
}, g = f(() => {
|
|
54
|
+
const t = (a) => String(a).length;
|
|
50
55
|
if (s.orientation === "horizontal") {
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
let a = 8;
|
|
57
|
+
if (s.showYLabels)
|
|
58
|
+
if (s.yLabelWidth !== void 0)
|
|
59
|
+
a = s.yLabelWidth;
|
|
60
|
+
else {
|
|
61
|
+
const L = Math.max(2, ...v.value.map((x) => t(x))) * 6, y = Math.max(40, C.value * 0.4);
|
|
62
|
+
a = Math.min(y, Math.max(24, L + 16));
|
|
63
|
+
}
|
|
64
|
+
let r = 16;
|
|
53
65
|
if (s.showValues) {
|
|
54
|
-
const
|
|
55
|
-
|
|
66
|
+
const L = b.value.flatMap((x) => x.values), y = Math.max(2, ...L.map((x) => t(s.formatValue ? s.formatValue(x) : X(x)))) * 6.5;
|
|
67
|
+
r = Math.max(16, y + 8);
|
|
56
68
|
}
|
|
57
69
|
return {
|
|
58
70
|
// top holds the value-tick labels that float above; collapse when hidden
|
|
59
71
|
top: s.showXLabels ? 16 : 4,
|
|
60
|
-
right:
|
|
72
|
+
right: r,
|
|
61
73
|
bottom: 0,
|
|
62
|
-
left:
|
|
74
|
+
left: a
|
|
63
75
|
};
|
|
64
76
|
}
|
|
65
|
-
const l = s.showYLabels ? Math.max(2, ...B.value.map((
|
|
66
|
-
let
|
|
67
|
-
return s.showXLabels && z.value && (
|
|
77
|
+
const l = s.showYLabels ? Math.max(2, ...B.value.map((a) => t(s.formatValue ? s.formatValue(a) : X(a)))) * 6.5 : 0, e = s.showYLabels ? Math.max(24, l + 12) : 8;
|
|
78
|
+
let o = s.showXLabels ? 24 : 6;
|
|
79
|
+
return s.showXLabels && z.value && (o = Math.max(2, ...v.value.map((r) => String(r).length)) * 6.5 * 0.7 + 16), {
|
|
68
80
|
top: 24,
|
|
69
81
|
right: 0,
|
|
70
|
-
bottom:
|
|
82
|
+
bottom: o,
|
|
71
83
|
left: e
|
|
72
84
|
};
|
|
73
|
-
}),
|
|
85
|
+
}), $ = f(() => Math.max(0, C.value - g.value.left - g.value.right)), c = f(() => Math.max(0, s.height - g.value.top - g.value.bottom)), N = f(() => {
|
|
74
86
|
if (s.orientation !== "vertical") return 1;
|
|
75
|
-
const t = z.value ? 25 : 65, l = Math.max(2, Math.floor(
|
|
87
|
+
const t = z.value ? 25 : 65, l = Math.max(2, Math.floor($.value / t));
|
|
76
88
|
return Math.ceil(v.value.length / l);
|
|
77
|
-
}),
|
|
89
|
+
}), ee = (t) => {
|
|
78
90
|
if (s.orientation !== "vertical") return !0;
|
|
79
91
|
const l = v.value.length;
|
|
80
|
-
return
|
|
81
|
-
},
|
|
92
|
+
return N.value <= 1 || t === 0 || t === l - 1 ? !0 : l - 1 - t < N.value * 0.7 ? !1 : t % N.value === 0;
|
|
93
|
+
}, W = f(
|
|
82
94
|
() => (s.data ?? []).map((t, l) => t.color ?? J(s.colors, l))
|
|
83
|
-
),
|
|
84
|
-
|
|
95
|
+
), te = f(() => b.value.flatMap((t) => t.values)), _ = f(() => Math.max(...te.value) || 1), B = f(() => {
|
|
96
|
+
const t = s.orientation === "vertical" ? s.height : C.value, l = Math.max(2, Math.floor(t / 80));
|
|
97
|
+
return $e(0, _.value, Math.min(5, l));
|
|
98
|
+
}), V = f(() => B.value[B.value.length - 1] || _.value), G = S(s.animate ? 0 : 1);
|
|
99
|
+
let Q = null;
|
|
85
100
|
function j() {
|
|
86
|
-
|
|
101
|
+
Q?.(), G.value = 0, Q = be(800, (t) => G.value = t);
|
|
87
102
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}),
|
|
103
|
+
ce(() => {
|
|
104
|
+
le(), s.animate && j();
|
|
105
|
+
}), ve(() => [s.data, s.datasets], () => {
|
|
91
106
|
s.animate && j();
|
|
92
|
-
}, { deep: !0 }),
|
|
93
|
-
|
|
107
|
+
}, { deep: !0 }), de(() => {
|
|
108
|
+
Q?.(), Z?.disconnect();
|
|
94
109
|
});
|
|
95
|
-
let
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}),
|
|
110
|
+
let Z = null;
|
|
111
|
+
function le() {
|
|
112
|
+
A.value && (Z = new ResizeObserver((t) => {
|
|
113
|
+
C.value = t[0].contentRect.width || 600;
|
|
114
|
+
}), Z.observe(A.value), C.value = A.value.clientWidth || 600);
|
|
100
115
|
}
|
|
101
|
-
const
|
|
116
|
+
const ae = f(() => {
|
|
102
117
|
const t = v.value.length;
|
|
103
118
|
if (t === 0) return [];
|
|
104
|
-
const l =
|
|
105
|
-
return v.value.map((
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
return { val:
|
|
119
|
+
const l = $.value / t, e = b.value.length, o = l * 0.2, a = l - o * 2, r = p.value ? a / e : a;
|
|
120
|
+
return v.value.map((L, y) => {
|
|
121
|
+
const x = y * l + o, D = b.value.map((T, P) => {
|
|
122
|
+
const H = T.values[y] ?? 0, O = H / V.value * c.value * G.value, E = x + P * r, F = c.value - O, I = p.value ? T.color : W.value[y];
|
|
123
|
+
return { val: H, bh: O, x: E, y: F, w: r - (p.value ? 2 : 0), color: I };
|
|
109
124
|
});
|
|
110
|
-
return { label:
|
|
125
|
+
return { label: L, bars: D };
|
|
111
126
|
});
|
|
112
|
-
}),
|
|
127
|
+
}), oe = f(() => {
|
|
113
128
|
const t = v.value.length;
|
|
114
129
|
if (t === 0) return [];
|
|
115
|
-
const l = c.value / t, e =
|
|
116
|
-
return v.value.map((y,
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
return { val:
|
|
130
|
+
const l = c.value / t, e = b.value.length, o = l * 0.2, a = l - o * 2, r = p.value ? a / e : a, L = V.value;
|
|
131
|
+
return v.value.map((y, x) => {
|
|
132
|
+
const D = x * l + o, T = b.value.map((P, H) => {
|
|
133
|
+
const O = P.values[x] ?? 0, E = O / L * $.value * G.value, F = D + H * r, I = p.value ? P.color : W.value[x];
|
|
134
|
+
return { val: O, bw: E, x: 0, y: F, h: r - (p.value ? 2 : 0), color: I };
|
|
120
135
|
});
|
|
121
|
-
return { label: y, bars:
|
|
136
|
+
return { label: y, bars: T };
|
|
122
137
|
});
|
|
123
|
-
}),
|
|
124
|
-
function
|
|
138
|
+
}), R = S(null), q = S(null);
|
|
139
|
+
function ne(t) {
|
|
125
140
|
if (!s.showTooltip) return;
|
|
126
|
-
const l = t.currentTarget.getBoundingClientRect(), e = t.clientX - l.left -
|
|
127
|
-
if (
|
|
141
|
+
const l = t.currentTarget.getBoundingClientRect(), e = t.clientX - l.left - g.value.left, o = t.clientY - l.top - g.value.top, a = v.value.length;
|
|
142
|
+
if (a === 0) return;
|
|
128
143
|
let r;
|
|
129
|
-
s.orientation === "vertical" ? r = Math.floor(e /
|
|
130
|
-
const
|
|
131
|
-
color:
|
|
144
|
+
s.orientation === "vertical" ? r = Math.floor(e / $.value * a) : r = Math.floor(o / c.value * a), r = Math.max(0, Math.min(a - 1, r)), q.value = r;
|
|
145
|
+
const L = b.value.map((y, x) => ({
|
|
146
|
+
color: p.value ? y.color : W.value[r],
|
|
132
147
|
label: y.label,
|
|
133
|
-
value: s.formatValue ? s.formatValue(y.values[r]) :
|
|
148
|
+
value: s.formatValue ? s.formatValue(y.values[r]) : X(y.values[r])
|
|
134
149
|
}));
|
|
135
|
-
|
|
150
|
+
R.value = {
|
|
136
151
|
x: t.clientX,
|
|
137
152
|
y: t.clientY,
|
|
138
153
|
label: v.value[r],
|
|
139
|
-
items:
|
|
154
|
+
items: L
|
|
140
155
|
};
|
|
141
156
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
157
|
+
function ue() {
|
|
158
|
+
R.value = null, q.value = null;
|
|
144
159
|
}
|
|
145
|
-
function
|
|
146
|
-
const r = Math.min(
|
|
147
|
-
return r <= 0 ||
|
|
160
|
+
function re(t, l, e, o, a) {
|
|
161
|
+
const r = Math.min(a, e / 2, o / 2);
|
|
162
|
+
return r <= 0 || o <= 0 ? `M${t},${l + o} L${t},${l} L${t + e},${l} L${t + e},${l + o} Z` : `M${t},${l + o} L${t},${l + r} Q${t},${l} ${t + r},${l} L${t + e - r},${l} Q${t + e},${l} ${t + e},${l + r} L${t + e},${l + o} Z`;
|
|
148
163
|
}
|
|
149
|
-
function
|
|
150
|
-
const r = Math.min(
|
|
151
|
-
return r <= 0 || e <= 0 ? `M${t},${l} L${t + e},${l} L${t + e},${l +
|
|
164
|
+
function se(t, l, e, o, a) {
|
|
165
|
+
const r = Math.min(a, e / 2, o / 2);
|
|
166
|
+
return r <= 0 || e <= 0 ? `M${t},${l} L${t + e},${l} L${t + e},${l + o} L${t},${l + o} Z` : `M${t},${l} L${t + e - r},${l} Q${t + e},${l} ${t + e},${l + r} L${t + e},${l + o - r} Q${t + e},${l + o} ${t + e - r},${l + o} L${t},${l + o} Z`;
|
|
152
167
|
}
|
|
153
|
-
const
|
|
168
|
+
const Y = Math.random().toString(36).slice(2, 7);
|
|
154
169
|
return (t, l) => (n(), u("div", {
|
|
155
170
|
ref_key: "containerRef",
|
|
156
|
-
ref:
|
|
171
|
+
ref: A,
|
|
157
172
|
class: "vlite-bar-chart w-full select-none"
|
|
158
173
|
}, [
|
|
159
|
-
i.showLegend &&
|
|
160
|
-
(n(!0), u(d, null, h(
|
|
174
|
+
i.showLegend && p.value ? (n(), u("div", pe, [
|
|
175
|
+
(n(!0), u(d, null, h(b.value, (e) => (n(), u("div", {
|
|
161
176
|
key: e.label,
|
|
162
177
|
class: "flex items-center gap-1.5 text-xs text-muted-foreground"
|
|
163
178
|
}, [
|
|
@@ -165,22 +180,22 @@ const be = {
|
|
|
165
180
|
class: "w-2.5 h-2.5 rounded-sm inline-block",
|
|
166
181
|
style: U({ backgroundColor: e.color })
|
|
167
182
|
}, null, 4),
|
|
168
|
-
|
|
183
|
+
he(" " + k(e.label), 1)
|
|
169
184
|
]))), 128))
|
|
170
185
|
])) : m("", !0),
|
|
171
186
|
(n(), u("svg", {
|
|
172
|
-
width:
|
|
187
|
+
width: C.value,
|
|
173
188
|
height: i.height,
|
|
174
189
|
role: "img",
|
|
175
190
|
"aria-label": "Bar chart",
|
|
176
191
|
class: "overflow-visible",
|
|
177
|
-
onMousemove:
|
|
178
|
-
onMouseleave:
|
|
192
|
+
onMousemove: ne,
|
|
193
|
+
onMouseleave: ue
|
|
179
194
|
}, [
|
|
180
195
|
w("defs", null, [
|
|
181
|
-
(n(!0), u(d, null, h(
|
|
182
|
-
key:
|
|
183
|
-
id: `bgrad-${
|
|
196
|
+
(n(!0), u(d, null, h(b.value, (e, o) => (n(), u("linearGradient", {
|
|
197
|
+
key: o,
|
|
198
|
+
id: `bgrad-${M(Y)}-${o}`,
|
|
184
199
|
x1: "0",
|
|
185
200
|
y1: "0",
|
|
186
201
|
x2: "0",
|
|
@@ -190,16 +205,16 @@ const be = {
|
|
|
190
205
|
offset: "0%",
|
|
191
206
|
"stop-color": e.color,
|
|
192
207
|
"stop-opacity": "1"
|
|
193
|
-
}, null, 8,
|
|
208
|
+
}, null, 8, Le),
|
|
194
209
|
w("stop", {
|
|
195
210
|
offset: "100%",
|
|
196
211
|
"stop-color": e.color,
|
|
197
212
|
"stop-opacity": "0.7"
|
|
198
|
-
}, null, 8,
|
|
199
|
-
], 8,
|
|
200
|
-
(n(!0), u(d, null, h(
|
|
201
|
-
key: `sc-${
|
|
202
|
-
id: `bgrad-single-${
|
|
213
|
+
}, null, 8, we)
|
|
214
|
+
], 8, Me))), 128)),
|
|
215
|
+
(n(!0), u(d, null, h(W.value, (e, o) => (n(), u("linearGradient", {
|
|
216
|
+
key: `sc-${o}`,
|
|
217
|
+
id: `bgrad-single-${M(Y)}-${o}`,
|
|
203
218
|
x1: "0",
|
|
204
219
|
y1: "0",
|
|
205
220
|
x2: "0",
|
|
@@ -209,74 +224,74 @@ const be = {
|
|
|
209
224
|
offset: "0%",
|
|
210
225
|
"stop-color": e,
|
|
211
226
|
"stop-opacity": "1"
|
|
212
|
-
}, null, 8,
|
|
227
|
+
}, null, 8, Ce),
|
|
213
228
|
w("stop", {
|
|
214
229
|
offset: "100%",
|
|
215
230
|
"stop-color": e,
|
|
216
231
|
"stop-opacity": "0.7"
|
|
217
|
-
}, null, 8,
|
|
218
|
-
], 8,
|
|
232
|
+
}, null, 8, Be)
|
|
233
|
+
], 8, Ve))), 128))
|
|
219
234
|
]),
|
|
220
235
|
i.orientation === "vertical" ? (n(), u("g", {
|
|
221
236
|
key: 0,
|
|
222
|
-
transform: `translate(${
|
|
237
|
+
transform: `translate(${g.value.left},${g.value.top})`
|
|
223
238
|
}, [
|
|
224
239
|
i.showGrid ? (n(!0), u(d, { key: 0 }, h(B.value, (e) => (n(), u("line", {
|
|
225
240
|
key: e,
|
|
226
241
|
x1: 0,
|
|
227
|
-
y1: c.value - e /
|
|
228
|
-
x2:
|
|
229
|
-
y2: c.value - e /
|
|
242
|
+
y1: c.value - e / V.value * c.value,
|
|
243
|
+
x2: $.value,
|
|
244
|
+
y2: c.value - e / V.value * c.value,
|
|
230
245
|
stroke: "currentColor",
|
|
231
246
|
"stroke-opacity": i.gridOpacity,
|
|
232
247
|
"stroke-width": "1"
|
|
233
|
-
}, null, 8,
|
|
248
|
+
}, null, 8, Xe))), 128)) : m("", !0),
|
|
234
249
|
i.showYLabels ? (n(!0), u(d, { key: 1 }, h(B.value, (e) => (n(), u("text", {
|
|
235
250
|
key: `yt-${e}`,
|
|
236
251
|
x: -10,
|
|
237
|
-
y: c.value - e /
|
|
252
|
+
y: c.value - e / V.value * c.value,
|
|
238
253
|
"text-anchor": "end",
|
|
239
254
|
"dominant-baseline": "middle",
|
|
240
255
|
"font-size": "11",
|
|
241
256
|
class: "fill-muted-foreground"
|
|
242
|
-
},
|
|
243
|
-
(n(!0), u(d, null, h(
|
|
244
|
-
(n(!0), u(d, null, h(e.bars, (
|
|
257
|
+
}, k(i.formatValue ? i.formatValue(e) : M(X)(e)), 9, Ye))), 128)) : m("", !0),
|
|
258
|
+
(n(!0), u(d, null, h(ae.value, (e, o) => (n(), u("g", { key: o }, [
|
|
259
|
+
(n(!0), u(d, null, h(e.bars, (a, r) => (n(), u("path", {
|
|
245
260
|
key: r,
|
|
246
|
-
d:
|
|
247
|
-
fill:
|
|
261
|
+
d: re(a.x, a.y, a.w, a.bh, i.barRadius),
|
|
262
|
+
fill: p.value ? `url(#bgrad-${M(Y)}-${r})` : `url(#bgrad-single-${M(Y)}-${o})`,
|
|
248
263
|
class: "transition-opacity duration-150"
|
|
249
|
-
}, null, 8,
|
|
250
|
-
i.showValues ? (n(!0), u(d, { key: 0 }, h(e.bars, (
|
|
264
|
+
}, null, 8, ze))), 128)),
|
|
265
|
+
i.showValues ? (n(!0), u(d, { key: 0 }, h(e.bars, (a, r) => (n(), u("text", {
|
|
251
266
|
key: `vl-${r}`,
|
|
252
|
-
x:
|
|
253
|
-
y:
|
|
267
|
+
x: a.x + a.w / 2,
|
|
268
|
+
y: a.y - 6,
|
|
254
269
|
"text-anchor": "middle",
|
|
255
270
|
"font-size": "10",
|
|
256
271
|
"font-weight": "600",
|
|
257
272
|
class: "fill-foreground"
|
|
258
|
-
},
|
|
273
|
+
}, k(i.formatValue ? i.formatValue(a.val) : M(X)(a.val)), 9, Oe))), 128)) : m("", !0)
|
|
259
274
|
]))), 128)),
|
|
260
|
-
i.showXLabels ? (n(!0), u(d, { key: 2 }, h(v.value, (e,
|
|
261
|
-
key: `xl-${
|
|
262
|
-
x: (
|
|
275
|
+
i.showXLabels ? (n(!0), u(d, { key: 2 }, h(v.value, (e, o) => fe((n(), u("text", {
|
|
276
|
+
key: `xl-${o}`,
|
|
277
|
+
x: (o + 0.5) * ($.value / v.value.length),
|
|
263
278
|
y: c.value + (z.value ? 12 : 16),
|
|
264
279
|
"text-anchor": z.value ? "end" : "middle",
|
|
265
|
-
transform: z.value ? `rotate(-45, ${(
|
|
280
|
+
transform: z.value ? `rotate(-45, ${(o + 0.5) * ($.value / v.value.length)}, ${c.value + 12})` : void 0,
|
|
266
281
|
"font-size": "11",
|
|
267
282
|
class: "fill-muted-foreground"
|
|
268
|
-
},
|
|
269
|
-
[
|
|
283
|
+
}, k(e), 9, Se)), [
|
|
284
|
+
[me, ee(o)]
|
|
270
285
|
])), 128)) : m("", !0),
|
|
271
286
|
i.showXAxis ? (n(), u("line", {
|
|
272
287
|
key: 3,
|
|
273
288
|
x1: 0,
|
|
274
289
|
y1: c.value,
|
|
275
|
-
x2:
|
|
290
|
+
x2: $.value,
|
|
276
291
|
y2: c.value,
|
|
277
292
|
stroke: "currentColor",
|
|
278
293
|
"stroke-opacity": i.axisOpacity
|
|
279
|
-
}, null, 8,
|
|
294
|
+
}, null, 8, Ae)) : m("", !0),
|
|
280
295
|
i.showYAxis ? (n(), u("line", {
|
|
281
296
|
key: 4,
|
|
282
297
|
x1: 0,
|
|
@@ -285,16 +300,16 @@ const be = {
|
|
|
285
300
|
y2: c.value,
|
|
286
301
|
stroke: "currentColor",
|
|
287
302
|
"stroke-opacity": i.axisOpacity
|
|
288
|
-
}, null, 8,
|
|
289
|
-
], 8,
|
|
303
|
+
}, null, 8, We)) : m("", !0)
|
|
304
|
+
], 8, Re)) : (n(), u("g", {
|
|
290
305
|
key: 1,
|
|
291
|
-
transform: `translate(${
|
|
306
|
+
transform: `translate(${g.value.left},${g.value.top})`
|
|
292
307
|
}, [
|
|
293
308
|
i.showGrid ? (n(!0), u(d, { key: 0 }, h(B.value, (e) => (n(), u("line", {
|
|
294
309
|
key: e,
|
|
295
|
-
x1: e /
|
|
310
|
+
x1: e / V.value * $.value,
|
|
296
311
|
y1: 0,
|
|
297
|
-
x2: e /
|
|
312
|
+
x2: e / V.value * $.value,
|
|
298
313
|
y2: c.value,
|
|
299
314
|
stroke: "currentColor",
|
|
300
315
|
"stroke-opacity": i.gridOpacity,
|
|
@@ -302,37 +317,37 @@ const be = {
|
|
|
302
317
|
}, null, 8, Te))), 128)) : m("", !0),
|
|
303
318
|
i.showXLabels ? (n(!0), u(d, { key: 1 }, h(B.value, (e) => (n(), u("text", {
|
|
304
319
|
key: `xt-${e}`,
|
|
305
|
-
x: e /
|
|
320
|
+
x: e / V.value * $.value,
|
|
306
321
|
y: -8,
|
|
307
322
|
"text-anchor": "middle",
|
|
308
323
|
"font-size": "11",
|
|
309
324
|
class: "fill-muted-foreground"
|
|
310
|
-
},
|
|
311
|
-
i.showYLabels ? (n(!0), u(d, { key: 2 }, h(v.value, (e,
|
|
312
|
-
key: `yl-${
|
|
313
|
-
x: -
|
|
314
|
-
y: (
|
|
315
|
-
"text-anchor": "
|
|
325
|
+
}, k(i.formatValue ? i.formatValue(e) : M(X)(e)), 9, Pe))), 128)) : m("", !0),
|
|
326
|
+
i.showYLabels ? (n(!0), u(d, { key: 2 }, h(v.value, (e, o) => (n(), u("text", {
|
|
327
|
+
key: `yl-${o}`,
|
|
328
|
+
x: -g.value.left + 4,
|
|
329
|
+
y: (o + 0.5) * (c.value / v.value.length),
|
|
330
|
+
"text-anchor": "start",
|
|
316
331
|
"dominant-baseline": "middle",
|
|
317
332
|
"font-size": "11",
|
|
318
333
|
class: "fill-muted-foreground"
|
|
319
|
-
},
|
|
320
|
-
(n(!0), u(d, null, h(
|
|
321
|
-
(n(!0), u(d, null, h(e.bars, (
|
|
334
|
+
}, k(K(String(e), g.value.left - 12)), 9, He))), 128)) : m("", !0),
|
|
335
|
+
(n(!0), u(d, null, h(oe.value, (e, o) => (n(), u("g", { key: o }, [
|
|
336
|
+
(n(!0), u(d, null, h(e.bars, (a, r) => (n(), u("path", {
|
|
322
337
|
key: r,
|
|
323
|
-
d:
|
|
324
|
-
fill:
|
|
338
|
+
d: se(a.x, a.y, a.bw, a.h, i.barRadius),
|
|
339
|
+
fill: p.value ? `url(#bgrad-${M(Y)}-${r})` : `url(#bgrad-single-${M(Y)}-${o})`,
|
|
325
340
|
class: "transition-opacity duration-150"
|
|
326
|
-
}, null, 8,
|
|
327
|
-
i.showValues ? (n(!0), u(d, { key: 0 }, h(e.bars, (
|
|
341
|
+
}, null, 8, Ne))), 128)),
|
|
342
|
+
i.showValues ? (n(!0), u(d, { key: 0 }, h(e.bars, (a, r) => (n(), u("text", {
|
|
328
343
|
key: `hvl-${r}`,
|
|
329
|
-
x:
|
|
330
|
-
y:
|
|
344
|
+
x: a.bw + 6,
|
|
345
|
+
y: a.y + a.h / 2,
|
|
331
346
|
"dominant-baseline": "middle",
|
|
332
347
|
"font-size": "10",
|
|
333
348
|
"font-weight": "600",
|
|
334
349
|
class: "fill-foreground"
|
|
335
|
-
},
|
|
350
|
+
}, k(i.formatValue ? i.formatValue(a.val) : M(X)(a.val)), 9, Qe))), 128)) : m("", !0)
|
|
336
351
|
]))), 128)),
|
|
337
352
|
i.showYAxis ? (n(), u("line", {
|
|
338
353
|
key: 3,
|
|
@@ -342,26 +357,26 @@ const be = {
|
|
|
342
357
|
y2: c.value,
|
|
343
358
|
stroke: "currentColor",
|
|
344
359
|
"stroke-opacity": i.axisOpacity
|
|
345
|
-
}, null, 8,
|
|
360
|
+
}, null, 8, Ze)) : m("", !0),
|
|
346
361
|
i.showXAxis ? (n(), u("line", {
|
|
347
362
|
key: 4,
|
|
348
363
|
x1: 0,
|
|
349
364
|
y1: c.value,
|
|
350
|
-
x2:
|
|
365
|
+
x2: $.value,
|
|
351
366
|
y2: c.value,
|
|
352
367
|
stroke: "currentColor",
|
|
353
368
|
"stroke-opacity": i.axisOpacity
|
|
354
|
-
}, null, 8,
|
|
369
|
+
}, null, 8, De)) : m("", !0)
|
|
355
370
|
], 8, Ge))
|
|
356
|
-
], 40,
|
|
357
|
-
(n(),
|
|
358
|
-
|
|
371
|
+
], 40, ke)),
|
|
372
|
+
(n(), ye(xe, { to: "body" }, [
|
|
373
|
+
R.value ? (n(), u("div", {
|
|
359
374
|
key: 0,
|
|
360
375
|
class: "vlite-chart-tooltip",
|
|
361
|
-
style: U({ left: `${
|
|
376
|
+
style: U({ left: `${R.value.x + 12}px`, top: `${R.value.y - 10}px` })
|
|
362
377
|
}, [
|
|
363
|
-
w("div",
|
|
364
|
-
(n(!0), u(d, null, h(
|
|
378
|
+
w("div", Ee, k(R.value.label), 1),
|
|
379
|
+
(n(!0), u(d, null, h(R.value.items, (e) => (n(), u("div", {
|
|
365
380
|
key: e.label,
|
|
366
381
|
class: "flex items-center gap-1.5 text-xs"
|
|
367
382
|
}, [
|
|
@@ -369,8 +384,8 @@ const be = {
|
|
|
369
384
|
class: "w-2 h-2 rounded-sm shrink-0",
|
|
370
385
|
style: U({ backgroundColor: e.color })
|
|
371
386
|
}, null, 4),
|
|
372
|
-
e.label ? (n(), u("span",
|
|
373
|
-
w("span",
|
|
387
|
+
e.label ? (n(), u("span", Fe, k(e.label) + ":", 1)) : m("", !0),
|
|
388
|
+
w("span", Ie, k(e.value), 1)
|
|
374
389
|
]))), 128))
|
|
375
390
|
], 4)) : m("", !0)
|
|
376
391
|
]))
|
|
@@ -378,5 +393,5 @@ const be = {
|
|
|
378
393
|
}
|
|
379
394
|
});
|
|
380
395
|
export {
|
|
381
|
-
|
|
396
|
+
je as default
|
|
382
397
|
};
|
|
@@ -73,6 +73,8 @@ export interface BarChartProps {
|
|
|
73
73
|
animate?: boolean;
|
|
74
74
|
/** Custom value formatter */
|
|
75
75
|
formatValue?: (v: number) => string;
|
|
76
|
+
/** Fixed width for Y-axis labels (horizontal mode) */
|
|
77
|
+
yLabelWidth?: number;
|
|
76
78
|
}
|
|
77
79
|
export type PieLabelMode = 'percent' | 'value' | 'label' | 'none' | 'outside';
|
|
78
80
|
export type LegendPosition = 'right' | 'bottom';
|