x-next 1.8.4 → 1.10.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/AI_USAGE.md +67 -7
- package/CHANGELOG.md +44 -0
- package/dist/_styles/palette-aliases.d.ts +1 -0
- package/dist/_utils/chart/scale.d.ts +1 -1
- package/dist/components/_components/chart/axis-labels.d.ts +8 -0
- package/dist/components/link/Link.vue.d.ts +1 -1
- package/dist/components/link/index.d.ts +3 -3
- package/dist/components/virtual-list-v2/interface.d.ts +3 -0
- package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +336 -1
- package/dist/es/_hooks/use-component-ref.js +9 -9
- package/dist/es/_styles/palette-aliases.js +30 -1
- package/dist/es/_utils/chart/scale.js +44 -39
- package/dist/es/_utils/palette.js +37 -35
- package/dist/es/components/_components/chart/ChartAxis.js +61 -36
- package/dist/es/components/_components/chart/axis-labels.js +26 -0
- package/dist/es/components/button/Button.js +23 -23
- package/dist/es/components/form-select/Select.js +142 -141
- package/dist/es/components/trigger/Trigger.js +174 -183
- package/dist/es/components/virtual-list-v2/virtual-list.vue.js +22 -23
- package/dist/es/components/virtual-list-v2/virtual-list.vue2.js +67 -53
- package/dist/es/icons/icon.js +37 -36
- package/dist/es/icons/index.js +6 -8
- package/dist/es/icons/public/lucide-names.js +167 -0
- package/dist/es/icons/public/lucide.js +75 -188
- package/dist/es/index.js +152 -148
- package/dist/es/style.css +1 -1
- package/dist/icons/index.d.ts +3 -3
- package/dist/icons/names.d.ts +2 -2
- package/dist/icons/public/lucide-names.d.ts +32 -0
- package/dist/icons/public/lucide.d.ts +2 -2
- package/dist/index.cjs +3 -62
- package/dist/index.umd.js +3 -62
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/heatmap.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -2
|
@@ -248,7 +248,36 @@ const r = {
|
|
|
248
248
|
"--x-notification-color-accent-warning": "var(--x-color-warning-solid)",
|
|
249
249
|
"--x-notification-color-icon-bg-warning": "var(--x-color-warning-subtle)"
|
|
250
250
|
}
|
|
251
|
+
}, o = {
|
|
252
|
+
primary: {
|
|
253
|
+
"--x-color-primary-button-text": "var(--x-color-primary-7)",
|
|
254
|
+
"--x-color-primary-text": "var(--x-color-primary-7)",
|
|
255
|
+
"--x-heatmap-color-level-1": "var(--x-color-primary-3)",
|
|
256
|
+
"--x-heatmap-color-level-2": "var(--x-color-primary-4)",
|
|
257
|
+
"--x-heatmap-color-level-3": "var(--x-color-primary-5)",
|
|
258
|
+
"--x-heatmap-color-level-4": "var(--x-color-primary-6)",
|
|
259
|
+
"--x-heatmap-color-level-5": "var(--x-color-primary-7)",
|
|
260
|
+
"--x-tag-color-better-blue-bg": "rgb(28 47 89)",
|
|
261
|
+
"--x-tag-color-better-blue-border-hover": "rgb(37 59 109)"
|
|
262
|
+
},
|
|
263
|
+
success: {
|
|
264
|
+
"--x-color-success-button-text": "var(--x-color-success-7)",
|
|
265
|
+
"--x-color-success-text": "var(--x-color-success-7)"
|
|
266
|
+
},
|
|
267
|
+
danger: {
|
|
268
|
+
"--x-color-danger-button-text": "var(--x-color-danger-8)",
|
|
269
|
+
"--x-color-danger-text": "var(--x-color-danger-8)"
|
|
270
|
+
},
|
|
271
|
+
strong: {
|
|
272
|
+
"--x-color-strong-button-text": "var(--x-color-strong-7)",
|
|
273
|
+
"--x-color-strong-text": "var(--x-color-strong-7)"
|
|
274
|
+
},
|
|
275
|
+
warning: {
|
|
276
|
+
"--x-color-warning-button-text": "var(--x-color-warning-7)",
|
|
277
|
+
"--x-color-warning-text": "var(--x-color-warning-7)"
|
|
278
|
+
}
|
|
251
279
|
};
|
|
252
280
|
export {
|
|
253
|
-
r as PALETTE_ALIASES
|
|
281
|
+
r as PALETTE_ALIASES,
|
|
282
|
+
o as PALETTE_ALIASES_DARK
|
|
254
283
|
};
|
|
@@ -1,77 +1,82 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = (t) => Number(t.toPrecision(12)), g = (t) => Number(t.toFixed(4)), f = (t) => Math.max(2, Math.floor(t)), F = (t) => {
|
|
2
2
|
if (!Number.isFinite(t) || t <= 0) return 0;
|
|
3
|
-
const
|
|
4
|
-
return
|
|
5
|
-
}, x = (t,
|
|
3
|
+
const n = 10 ** Math.floor(Math.log10(t)), e = t / n;
|
|
4
|
+
return n * (e <= 1 ? 1 : e <= 2 ? 2 : e <= 5 ? 5 : 10);
|
|
5
|
+
}, x = (t, n = 4) => {
|
|
6
6
|
if (!Number.isFinite(t) || t <= 0)
|
|
7
7
|
return { max: 0, ticks: [0] };
|
|
8
|
-
const
|
|
8
|
+
const e = f(n) - 1, s = F(t / e), r = a(Math.ceil(t / s) * s), i = Math.round(r / s);
|
|
9
9
|
return {
|
|
10
10
|
max: r,
|
|
11
|
-
ticks: Array.from({ length:
|
|
11
|
+
ticks: Array.from({ length: i + 1 }, (o, c) => a(s * c))
|
|
12
12
|
};
|
|
13
|
-
},
|
|
14
|
-
const s = f(
|
|
15
|
-
if (Number.isFinite(
|
|
16
|
-
const r =
|
|
13
|
+
}, d = (t, n = 4, e) => {
|
|
14
|
+
const s = f(n);
|
|
15
|
+
if (Number.isFinite(e) && e > 0) {
|
|
16
|
+
const r = e, i = s - 1;
|
|
17
17
|
return {
|
|
18
18
|
max: r,
|
|
19
19
|
ticks: Array.from(
|
|
20
|
-
{ length:
|
|
21
|
-
(o, c) => g(r /
|
|
20
|
+
{ length: i + 1 },
|
|
21
|
+
(o, c) => g(r / i * c)
|
|
22
22
|
)
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
return x(t, s);
|
|
26
|
-
},
|
|
27
|
-
const s = Number.isFinite(t) ? t : 0, r = Number.isFinite(
|
|
28
|
-
if (
|
|
26
|
+
}, M = (t, n, e = 4) => {
|
|
27
|
+
const s = Number.isFinite(t) ? t : 0, r = Number.isFinite(n) ? n : 0, i = Math.min(0, s), o = Math.max(0, r);
|
|
28
|
+
if (i === 0 && o === 0)
|
|
29
29
|
return { min: 0, max: 0, ticks: [0] };
|
|
30
|
-
const c = f(
|
|
30
|
+
const c = f(e) - 1, u = F((o - i) / c), h = a(Math.floor(i / u) * u), m = a(Math.ceil(o / u) * u), l = Math.round((m - h) / u);
|
|
31
31
|
return {
|
|
32
|
-
min:
|
|
32
|
+
min: h,
|
|
33
33
|
max: m,
|
|
34
|
-
ticks: Array.from({ length:
|
|
34
|
+
ticks: Array.from({ length: l + 1 }, (N, b) => a(h + u * b))
|
|
35
35
|
};
|
|
36
|
-
}, A = (t,
|
|
37
|
-
const
|
|
36
|
+
}, A = (t, n, e = 4, s, r) => {
|
|
37
|
+
const i = f(e), o = Number.isFinite(s), c = Number.isFinite(r);
|
|
38
38
|
if (!o && !c)
|
|
39
|
-
return
|
|
40
|
-
const u = Math.min(0, Number.isFinite(t) ? t : 0),
|
|
41
|
-
let m = o ? s : u,
|
|
42
|
-
m >
|
|
43
|
-
const N =
|
|
39
|
+
return M(t, n, i);
|
|
40
|
+
const u = Math.min(0, Number.isFinite(t) ? t : 0), h = Math.max(0, Number.isFinite(n) ? n : 0);
|
|
41
|
+
let m = o ? s : u, l = c ? r : h;
|
|
42
|
+
m > l && ([m, l] = [l, m]);
|
|
43
|
+
const N = i - 1;
|
|
44
44
|
return {
|
|
45
45
|
min: m,
|
|
46
|
-
max:
|
|
46
|
+
max: l,
|
|
47
47
|
ticks: Array.from(
|
|
48
48
|
{ length: N + 1 },
|
|
49
|
-
(b,
|
|
49
|
+
(b, p) => g(m + (l - m) / N * p)
|
|
50
50
|
)
|
|
51
51
|
};
|
|
52
52
|
}, k = (t) => {
|
|
53
53
|
if (!Number.isFinite(t)) return "";
|
|
54
|
-
const
|
|
55
|
-
return `${
|
|
56
|
-
}, y = (t,
|
|
57
|
-
let
|
|
54
|
+
const n = Number(Number(t.toPrecision(12)).toFixed(4)), [e, s] = String(Math.abs(n)).split("."), r = e.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
55
|
+
return `${n < 0 ? "-" : ""}${r}${s ? `.${s}` : ""}`;
|
|
56
|
+
}, y = (t, n) => {
|
|
57
|
+
let e = 0;
|
|
58
58
|
for (const s of t)
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
}, S = (t,
|
|
59
|
+
e += s.charCodeAt(0) > 255 ? 1 : 0.6;
|
|
60
|
+
return e * n;
|
|
61
|
+
}, S = (t, n, e, s = 8) => {
|
|
62
62
|
if (t <= 0) return [];
|
|
63
|
-
const r = Math.max(1, Math.ceil((
|
|
63
|
+
const r = Math.max(1, Math.ceil((e + s) / Math.max(n, 1))), i = [];
|
|
64
64
|
for (let c = 0; c < t; c += r)
|
|
65
|
-
|
|
65
|
+
i.push(c);
|
|
66
66
|
const o = t - 1;
|
|
67
|
-
|
|
67
|
+
if (i[i.length - 1] !== o) {
|
|
68
|
+
for (; i.length && (o - i[i.length - 1]) * n < e + s; )
|
|
69
|
+
i.pop();
|
|
70
|
+
i.push(o);
|
|
71
|
+
}
|
|
72
|
+
return i;
|
|
68
73
|
};
|
|
69
74
|
export {
|
|
70
75
|
k as defaultValueFormatter,
|
|
71
76
|
y as estimateTextWidth,
|
|
72
77
|
A as getDomain,
|
|
73
|
-
|
|
78
|
+
M as getNiceDomain,
|
|
74
79
|
x as getNiceScale,
|
|
75
|
-
|
|
80
|
+
d as getScale,
|
|
76
81
|
S as pickLabelIndices
|
|
77
82
|
};
|
|
@@ -1,63 +1,65 @@
|
|
|
1
|
-
import { PALETTE_ALIASES as g } from "../_styles/palette-aliases.js";
|
|
2
|
-
const x = 2.05, d = 95.5, p = 22,
|
|
1
|
+
import { PALETTE_ALIASES as g, PALETTE_ALIASES_DARK as E } from "../_styles/palette-aliases.js";
|
|
2
|
+
const x = 2.05, d = 95.5, p = 22, A = [1, 0.8, 0.6, 0.4, 0.2], _ = [1 / 3, 2 / 3, 1], b = 90, y = 300, m = (s, a, i) => Math.min(i, Math.max(a, s)), $ = (s) => {
|
|
3
3
|
if (typeof s != "string") return null;
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
6
|
-
const t =
|
|
4
|
+
const a = s.trim();
|
|
5
|
+
if (a.startsWith("#")) {
|
|
6
|
+
const t = a.slice(1);
|
|
7
7
|
if (!/^(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
|
|
8
8
|
const c = t.length === 3 ? [...t].map((h) => h + h).join("") : t.length === 6 || t.length === 8 ? t.slice(0, 6) : null;
|
|
9
9
|
return c ? [0, 2, 4].map((h) => parseInt(c.slice(h, h + 2), 16)) : null;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
const o =
|
|
11
|
+
const i = a.match(/^rgba?\(([^)]+)\)$/i);
|
|
12
|
+
if (!i) return null;
|
|
13
|
+
const o = i[1].trim(), r = o.includes(",") ? o.split(",").map((t) => t.trim()) : o.split(/\s*\/\s*/)[0].split(/\s+/), e = o.includes(",") ? r[3] : o.includes("/") ? o.split("/")[1].trim() : void 0;
|
|
14
14
|
if (o.split("/").length > 2 || r.length < 3 || r.length > (o.includes(",") ? 4 : 3)) return null;
|
|
15
15
|
const n = /^[+-]?(?:\d+\.?\d*|\.\d+)%?$/;
|
|
16
16
|
if (r.slice(0, 3).some((t) => !n.test(t)) || e !== void 0 && !n.test(e)) return null;
|
|
17
17
|
const l = r.slice(0, 3).map((t) => t.endsWith("%") ? Math.round(parseFloat(t) / 100 * 255) : Number(t));
|
|
18
18
|
return l.some((t) => !Number.isFinite(t)) ? null : l.map((t) => m(Math.round(t), 0, 255));
|
|
19
|
-
},
|
|
20
|
-
const o = s / 255, r =
|
|
19
|
+
}, H = ([s, a, i]) => {
|
|
20
|
+
const o = s / 255, r = a / 255, e = i / 255, n = Math.max(o, r, e), l = Math.min(o, r, e), t = n - l, c = (n + l) / 2;
|
|
21
21
|
let h = 0, u = 0;
|
|
22
22
|
return t !== 0 && (u = c > 0.5 ? t / (2 - n - l) : t / (n + l), n === o ? h = (r - e) / t + (r < e ? 6 : 0) : n === r ? h = (e - o) / t + 2 : h = (o - r) / t + 4, h *= 60), { h, s: u * 100, l: c * 100 };
|
|
23
|
-
},
|
|
24
|
-
const o = m(
|
|
23
|
+
}, S = ({ h: s, s: a, l: i }) => {
|
|
24
|
+
const o = m(a, 0, 100) / 100, r = m(i, 0, 100) / 100, e = (s % 360 + 360) % 360, n = (1 - Math.abs(2 * r - 1)) * o, l = n * (1 - Math.abs(e / 60 % 2 - 1)), t = r - n / 2;
|
|
25
25
|
let c;
|
|
26
26
|
return e < 60 ? c = [n, l, 0] : e < 120 ? c = [l, n, 0] : e < 180 ? c = [0, n, l] : e < 240 ? c = [0, l, n] : e < 300 ? c = [l, 0, n] : c = [n, 0, l], c.map((h) => m(Math.round((h + t) * 255), 0, 255));
|
|
27
|
-
}, P = (s) => `#${s.map((
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
27
|
+
}, P = (s) => `#${s.map((a) => m(Math.round(a), 0, 255).toString(16).padStart(2, "0")).join("")}`, I = (s) => s <= b || s >= y ? 1 : -1, L = (s, a = {}) => {
|
|
28
|
+
const i = $(s);
|
|
29
|
+
if (!i)
|
|
30
30
|
throw new Error(`[x-next] generatePalette: 无法解析种子色 "${s}"`);
|
|
31
|
-
const { h: o, s: r, l: e } =
|
|
31
|
+
const { h: o, s: r, l: e } = H(i), n = I(o), { dark: l = !1 } = a, t = l ? Math.min(p, e) : Math.max(d, e), c = l ? Math.max(d, e) : Math.min(p, e), h = [];
|
|
32
32
|
for (let u = 0; u < 9; u += 1) {
|
|
33
33
|
let f;
|
|
34
|
-
u < 5 ? f = e + (t - e) *
|
|
35
|
-
const
|
|
36
|
-
h.push(P(
|
|
34
|
+
u < 5 ? f = e + (t - e) * A[u] : u === 5 ? f = e : f = e + (c - e) * _[u - 6];
|
|
35
|
+
const T = 5 - u, M = n * x * T * (l ? -1 : 1);
|
|
36
|
+
h.push(P(S({ h: o + M, s: r, l: m(f, 0, 100) })));
|
|
37
37
|
}
|
|
38
38
|
return h;
|
|
39
|
-
}, G = (s,
|
|
40
|
-
const { name:
|
|
39
|
+
}, G = (s, a = {}) => {
|
|
40
|
+
const { name: i = "primary", target: o, dark: r } = a, e = L(s, { dark: r }), n = o ?? (typeof document < "u" ? document.documentElement : null);
|
|
41
41
|
if (n) {
|
|
42
|
-
n.style.setProperty(`--x-color-${
|
|
43
|
-
n.style.setProperty(`--x-color-${
|
|
42
|
+
n.style.setProperty(`--x-color-${i}`, e[5]), e.forEach((t, c) => {
|
|
43
|
+
n.style.setProperty(`--x-color-${i}-${c + 1}`, t);
|
|
44
44
|
});
|
|
45
|
-
const l = g[
|
|
46
|
-
if (l)
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const l = g[i];
|
|
46
|
+
if (l) {
|
|
47
|
+
const t = r ? E[i] : void 0;
|
|
48
|
+
for (const [c, h] of Object.entries(l))
|
|
49
|
+
n.style.setProperty(c, (t == null ? void 0 : t[c]) ?? h);
|
|
50
|
+
}
|
|
49
51
|
}
|
|
50
52
|
return e;
|
|
51
|
-
},
|
|
52
|
-
const
|
|
53
|
-
return
|
|
53
|
+
}, W = (s = "primary") => {
|
|
54
|
+
const a = [`--x-color-${s}`, ...Array.from({ length: 9 }, (o, r) => `--x-color-${s}-${r + 1}`)], i = g[s];
|
|
55
|
+
return i ? [...a, ...Object.keys(i)] : a;
|
|
54
56
|
};
|
|
55
57
|
export {
|
|
56
58
|
G as applyThemeColor,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
L as generatePalette,
|
|
60
|
+
W as getThemeColorProperties,
|
|
61
|
+
S as hslToRgb,
|
|
62
|
+
$ as parseColor,
|
|
63
|
+
H as rgbToHsl,
|
|
62
64
|
P as toHex
|
|
63
65
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { getClassNameMixin as
|
|
3
|
-
|
|
1
|
+
import { defineComponent as x, ref as u, computed as h, onMounted as b, watchPostEffect as g, onBeforeUnmount as L, createVNode as n } from "vue";
|
|
2
|
+
import { getClassNameMixin as S } from "../../../_utils/config.js";
|
|
3
|
+
import { layoutAxisLabels as v } from "./axis-labels.js";
|
|
4
|
+
import { estimateTextWidth as z } from "../../../_utils/chart/scale.js";
|
|
5
|
+
const A = 6, w = 8, N = /* @__PURE__ */ x({
|
|
4
6
|
name: "ChartAxis",
|
|
5
7
|
props: {
|
|
6
8
|
plot: {
|
|
@@ -36,44 +38,67 @@ const y = 6, x = 8, c = /* @__PURE__ */ s({
|
|
|
36
38
|
default: !0
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
|
-
setup(
|
|
40
|
-
const
|
|
41
|
-
fontSize: `${
|
|
42
|
-
fill:
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
setup(t) {
|
|
42
|
+
const o = S("chart"), f = () => ({
|
|
43
|
+
fontSize: `${t.fontSize}px`,
|
|
44
|
+
fill: t.color
|
|
45
|
+
}), s = u(), d = u(), m = (e) => v(t.xLabels, t.plot.left, t.plot.right, t.fontSize * 0.6, e), y = h(() => d.value ?? m((e) => z(e, t.fontSize)));
|
|
46
|
+
let i = null, c = !0;
|
|
47
|
+
const a = () => {
|
|
48
|
+
if (!c || !s.value) return;
|
|
49
|
+
const e = getComputedStyle(s.value);
|
|
50
|
+
if (i) {
|
|
51
|
+
i.font = `${e.fontStyle} ${e.fontWeight} ${t.fontSize}px ${e.fontFamily}`;
|
|
52
|
+
const l = Number.parseFloat(e.letterSpacing) || 0;
|
|
53
|
+
d.value = m((r) => i.measureText(r).width + Math.max(0, Array.from(r).length - 1) * l);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return b(() => {
|
|
57
|
+
var e, l;
|
|
58
|
+
i = document.createElement("canvas").getContext("2d"), a(), (e = document.fonts) == null || e.addEventListener("loadingdone", a), (l = document.fonts) == null || l.ready.then(a);
|
|
59
|
+
}), g(() => {
|
|
60
|
+
t.xLabels, t.plot, t.fontSize, a();
|
|
61
|
+
}), L(() => {
|
|
62
|
+
var e;
|
|
63
|
+
c = !1, (e = document.fonts) == null || e.removeEventListener("loadingdone", a);
|
|
64
|
+
}), () => n("g", {
|
|
65
|
+
ref: s,
|
|
66
|
+
style: {
|
|
67
|
+
fontSize: `${t.fontSize}px`
|
|
68
|
+
}
|
|
69
|
+
}, [t.showHorizontalLines && n("g", {
|
|
70
|
+
class: o.element("grid")
|
|
71
|
+
}, [t.ticks.map((e, l) => n("line", {
|
|
72
|
+
key: l,
|
|
73
|
+
class: [o.element("grid-line"), {
|
|
74
|
+
[o.is("baseline")]: e.isBaseline
|
|
50
75
|
}],
|
|
51
|
-
x1:
|
|
52
|
-
x2:
|
|
53
|
-
y1:
|
|
54
|
-
y2:
|
|
55
|
-
}, null))]),
|
|
56
|
-
class:
|
|
57
|
-
}, [
|
|
58
|
-
key:
|
|
59
|
-
class:
|
|
60
|
-
x:
|
|
61
|
-
y:
|
|
76
|
+
x1: t.plot.left,
|
|
77
|
+
x2: t.plot.left + t.plot.width,
|
|
78
|
+
y1: e.y,
|
|
79
|
+
y2: e.y
|
|
80
|
+
}, null))]), t.showY && n("g", {
|
|
81
|
+
class: o.element("y-labels")
|
|
82
|
+
}, [t.ticks.map((e, l) => n("text", {
|
|
83
|
+
key: l,
|
|
84
|
+
class: o.element("axis-label"),
|
|
85
|
+
x: t.plot.left - A,
|
|
86
|
+
y: e.y,
|
|
62
87
|
"text-anchor": "end",
|
|
63
88
|
"dominant-baseline": "middle",
|
|
64
|
-
style:
|
|
65
|
-
}, [
|
|
66
|
-
class:
|
|
67
|
-
}, [
|
|
68
|
-
key:
|
|
69
|
-
class:
|
|
70
|
-
x:
|
|
71
|
-
y:
|
|
89
|
+
style: f()
|
|
90
|
+
}, [e.label]))]), t.showX && n("g", {
|
|
91
|
+
class: o.element("x-labels")
|
|
92
|
+
}, [y.value.map((e, l) => n("text", {
|
|
93
|
+
key: l,
|
|
94
|
+
class: o.element("axis-label"),
|
|
95
|
+
x: e.x,
|
|
96
|
+
y: t.plot.bottom + w + t.fontSize * 0.9,
|
|
72
97
|
"text-anchor": "middle",
|
|
73
|
-
style:
|
|
74
|
-
}, [
|
|
98
|
+
style: f()
|
|
99
|
+
}, [e.text, e.title && n("title", null, [e.title])]))])]);
|
|
75
100
|
}
|
|
76
101
|
});
|
|
77
102
|
export {
|
|
78
|
-
|
|
103
|
+
N as default
|
|
79
104
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const M = (h, f, d, u, i) => {
|
|
2
|
+
const n = Math.max(0, d - f);
|
|
3
|
+
if (n <= 0) return [];
|
|
4
|
+
const m = [];
|
|
5
|
+
let I = Number.POSITIVE_INFINITY;
|
|
6
|
+
for (let c = h.length - 1; c >= 0; c--) {
|
|
7
|
+
const l = h[c];
|
|
8
|
+
let e = l.text, t = i(e);
|
|
9
|
+
if (t > n) {
|
|
10
|
+
if (i("…") > n) continue;
|
|
11
|
+
const a = Array.from(e);
|
|
12
|
+
let o = 0, s = a.length;
|
|
13
|
+
for (; o < s; ) {
|
|
14
|
+
const r = Math.ceil((o + s) / 2);
|
|
15
|
+
i(`${a.slice(0, r).join("")}…`) <= n ? o = r : s = r - 1;
|
|
16
|
+
}
|
|
17
|
+
e = `${a.slice(0, o).join("")}…`, t = i(e);
|
|
18
|
+
}
|
|
19
|
+
const x = Math.max(f + t / 2, Math.min(l.x, d - t / 2));
|
|
20
|
+
x + t / 2 + u > I || (m.push({ x, text: e, width: t, ...e !== l.text ? { title: l.text } : {} }), I = x - t / 2);
|
|
21
|
+
}
|
|
22
|
+
return m.reverse();
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
M as layoutAxisLabels
|
|
26
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as O, getCurrentInstance as P, inject as
|
|
2
|
-
import { getClassNameMixin as
|
|
1
|
+
import { defineComponent as O, getCurrentInstance as P, inject as x, reactive as F, computed as t, withDirectives as T, createVNode as u, resolveDirective as L } from "vue";
|
|
2
|
+
import { getClassNameMixin as p } from "../../_utils/config.js";
|
|
3
3
|
import { buttonProps as A } from "./props.js";
|
|
4
4
|
import B from "../../icons/animation/animation-loading.js";
|
|
5
5
|
import I from "../../directives/wave.js";
|
|
@@ -18,51 +18,51 @@ const H = /* @__PURE__ */ O({
|
|
|
18
18
|
slots: l,
|
|
19
19
|
emit: h
|
|
20
20
|
}) {
|
|
21
|
-
const
|
|
21
|
+
const s = P(), a = x(K, void 0), {
|
|
22
22
|
mergedSize: k
|
|
23
23
|
} = N(void 0, {
|
|
24
24
|
defaultValue: "medium"
|
|
25
|
-
}), r =
|
|
25
|
+
}), r = F({
|
|
26
26
|
clicked: !1,
|
|
27
27
|
isDebounce: !1
|
|
28
|
-
}), i =
|
|
29
|
-
const d = (
|
|
28
|
+
}), i = p("button"), w = (n) => n.replace(/[A-Z]/g, (d) => `-${d.toLowerCase()}`), o = (n) => {
|
|
29
|
+
const d = (s == null ? void 0 : s.vnode.props) ?? {};
|
|
30
30
|
return Object.prototype.hasOwnProperty.call(d, n) || Object.prototype.hasOwnProperty.call(d, w(n));
|
|
31
|
-
},
|
|
31
|
+
}, m = t(() => o("type") ? e.type : (a == null ? void 0 : a.type) ?? e.type), v = t(() => o("size") ? e.size : (a == null ? void 0 : a.size) ?? k.value), b = t(() => o("status") ? e.status : (a == null ? void 0 : a.status) ?? e.status), g = t(() => o("shape") ? e.shape : (a == null ? void 0 : a.shape) ?? e.shape), f = t(() => o("disabled") ? e.disabled : (a == null ? void 0 : a.disabled) ?? e.disabled), D = t(() => [i.block, m.value && m.value !== "default" && i.modifier(m.value), v.value && i.modifier(v.value), b.value && i.modifier(b.value), f.value && i.is("disabled"), e.block && i.modifier("block"), e.plain && i.modifier("plain"), g.value && i.modifier(g.value), e.link && i.modifier("link"), !e.border && i.modifier("hide-border"), c.value && i.modifier("loading"), e.loadingFill && i.modifier("loading-fill"), e.narrow && i.modifier("narrow")]), z = () => {
|
|
32
32
|
e.debounce > 0 && !r.isDebounce && (r.isDebounce = !0, setTimeout(() => {
|
|
33
33
|
r.isDebounce = !1;
|
|
34
34
|
}, e.debounce));
|
|
35
|
-
},
|
|
35
|
+
}, c = t(() => e.loading || r.clicked || r.isDebounce), S = t(() => f.value || c.value || e.link || m.value === "text"), j = (n) => {
|
|
36
36
|
var d;
|
|
37
|
-
n.detail > 0 && ((d = n.currentTarget) == null || d.blur()), !(
|
|
37
|
+
n.detail > 0 && ((d = n.currentTarget) == null || d.blur()), !(f.value || c.value) && (z(), h("click", n));
|
|
38
38
|
};
|
|
39
39
|
return () => {
|
|
40
40
|
var n, d, y;
|
|
41
|
-
return T(
|
|
41
|
+
return T(u("button", {
|
|
42
42
|
class: D.value,
|
|
43
43
|
type: e.htmlType,
|
|
44
|
-
disabled:
|
|
45
|
-
"aria-busy":
|
|
44
|
+
disabled: f.value || c.value,
|
|
45
|
+
"aria-busy": c.value || void 0,
|
|
46
46
|
onClick: j
|
|
47
|
-
}, [
|
|
47
|
+
}, [u("span", {
|
|
48
48
|
class: i.element("loading"),
|
|
49
|
+
"aria-hidden": "true",
|
|
49
50
|
style: {
|
|
50
51
|
display: "flex",
|
|
51
|
-
opacity:
|
|
52
|
-
width:
|
|
53
|
-
marginRight:
|
|
54
|
-
overflow: "hidden"
|
|
55
|
-
transition: "all 0.3s ease"
|
|
52
|
+
opacity: c.value ? 1 : 0,
|
|
53
|
+
width: c.value ? e.loadingFill ? "100%" : "1em" : 0,
|
|
54
|
+
marginRight: c.value && !e.loadingFill ? "4px" : "0",
|
|
55
|
+
overflow: "hidden"
|
|
56
56
|
}
|
|
57
|
-
}, [
|
|
57
|
+
}, [c.value && u(B, null, null)]), !!l.prefix && u("span", {
|
|
58
58
|
class: i.element("prefix")
|
|
59
|
-
}, [(n = l.prefix) == null ? void 0 : n.call(l)]), l.icon &&
|
|
59
|
+
}, [(n = l.prefix) == null ? void 0 : n.call(l)]), l.icon && u("span", {
|
|
60
60
|
class: i.element("prefix")
|
|
61
|
-
}, [(d = l.icon) == null ? void 0 : d.call(l)]),
|
|
61
|
+
}, [(d = l.icon) == null ? void 0 : d.call(l)]), u("span", {
|
|
62
62
|
class: i.element("content")
|
|
63
|
-
}, [(y = l.default) == null ? void 0 : y.call(l)]), l.suffix &&
|
|
63
|
+
}, [(y = l.default) == null ? void 0 : y.call(l)]), l.suffix && u("span", {
|
|
64
64
|
class: i.element("suffix")
|
|
65
|
-
}, [l.suffix()])]), [[
|
|
65
|
+
}, [l.suffix()])]), [[L("wave"), {
|
|
66
66
|
disabled: S.value
|
|
67
67
|
}]]);
|
|
68
68
|
};
|