x-next 1.9.0 → 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 +24 -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/_utils/chart/scale.js +44 -39
- 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.css +1 -1
- package/package.json +3 -2
|
@@ -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,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
|
};
|