adverich-kun-ui 0.1.524 → 0.1.526
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as g, ref as v, useModel as D, provide as
|
|
1
|
+
import { mergeModels as g, ref as v, useModel as D, provide as b, computed as h, onUpdated as B, createElementBlock as E, openBlock as I, mergeProps as S, renderSlot as M } from "vue";
|
|
2
2
|
const R = {
|
|
3
3
|
__name: "KunList",
|
|
4
4
|
props: /* @__PURE__ */ g({
|
|
@@ -21,15 +21,15 @@ const R = {
|
|
|
21
21
|
selectedModifiers: {}
|
|
22
22
|
}),
|
|
23
23
|
emits: /* @__PURE__ */ g(["keyDown", "click:select", "update:selected"], ["update:selected"]),
|
|
24
|
-
setup(o, { expose:
|
|
25
|
-
const c = o, a =
|
|
26
|
-
|
|
24
|
+
setup(o, { expose: p, emit: w }) {
|
|
25
|
+
const c = o, a = w, f = v(null), s = v([]), i = D(o, "selected");
|
|
26
|
+
b("registerListItemRef", (e) => {
|
|
27
27
|
e ? e.isConnected && !s.value.includes(e) && (s.value.push(e), s.value.sort((t, n) => {
|
|
28
28
|
const r = t.id ?? "", l = n.id ?? "";
|
|
29
29
|
return r.localeCompare(l, void 0, { numeric: !0, sensitivity: "base" });
|
|
30
30
|
})) : s.value = s.value.filter((t) => t && t.isConnected);
|
|
31
31
|
});
|
|
32
|
-
const m =
|
|
32
|
+
const m = h(() => c.selectable && c.selectionMode === "multiple");
|
|
33
33
|
function y(e) {
|
|
34
34
|
if (!(!c.selectable || e == null))
|
|
35
35
|
if (m.value) {
|
|
@@ -38,20 +38,21 @@ const R = {
|
|
|
38
38
|
} else
|
|
39
39
|
i.value = e;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
B(() => {
|
|
42
42
|
s.value = s.value.filter((e) => e && e.isConnected);
|
|
43
43
|
});
|
|
44
|
-
function
|
|
44
|
+
function A(e) {
|
|
45
45
|
var t, n;
|
|
46
46
|
return !c.selectable || e == null ? !1 : m.value ? (n = (t = i.value) == null ? void 0 : t.includes) == null ? void 0 : n.call(t, e) : i.value === e;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
b("kunListContext", {
|
|
49
49
|
toggleItem: y,
|
|
50
|
-
isSelected:
|
|
50
|
+
isSelected: A
|
|
51
51
|
});
|
|
52
|
-
function
|
|
52
|
+
function k(e) {
|
|
53
53
|
var r;
|
|
54
|
-
a("keyDown", e)
|
|
54
|
+
if (a("keyDown", e), ["INPUT", "TEXTAREA"].includes(e.target.tagName) || e.target.isContentEditable)
|
|
55
|
+
return;
|
|
55
56
|
const t = e.key, n = s.value.filter((l) => l && l.isConnected);
|
|
56
57
|
if (!(!n.length || !["ArrowUp", "ArrowDown", "Enter"].includes(t))) {
|
|
57
58
|
if (t === "Enter") {
|
|
@@ -61,7 +62,7 @@ const R = {
|
|
|
61
62
|
}
|
|
62
63
|
if (t === "ArrowUp" || t === "ArrowDown") {
|
|
63
64
|
e.preventDefault();
|
|
64
|
-
const l = n.findIndex((
|
|
65
|
+
const l = n.findIndex((C) => C === document.activeElement);
|
|
65
66
|
let d = -1;
|
|
66
67
|
l === -1 ? d = t === "ArrowDown" ? 0 : n.length - 1 : t === "ArrowDown" ? d = (l + 1) % n.length : t === "ArrowUp" && (d = (l - 1 + n.length) % n.length);
|
|
67
68
|
const u = n[d];
|
|
@@ -70,17 +71,17 @@ const R = {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function x(e = "ArrowDown") {
|
|
74
75
|
var l;
|
|
75
76
|
const t = s.value.filter(Boolean);
|
|
76
77
|
if (!t.length) return;
|
|
77
78
|
const n = e === "ArrowDown" ? 0 : t.length - 1, r = t[n];
|
|
78
79
|
(l = r == null ? void 0 : r.focus) == null || l.call(r);
|
|
79
80
|
}
|
|
80
|
-
return
|
|
81
|
+
return p({ focusWithKey: x, focus: () => {
|
|
81
82
|
var e, t;
|
|
82
83
|
return (t = (e = f.value) == null ? void 0 : e.focus) == null ? void 0 : t.call(e);
|
|
83
|
-
} }), (e, t) => (
|
|
84
|
+
} }), (e, t) => (I(), E("ul", S({
|
|
84
85
|
ref_key: "ulRef",
|
|
85
86
|
ref: f,
|
|
86
87
|
role: "list",
|
|
@@ -95,10 +96,10 @@ const R = {
|
|
|
95
96
|
}
|
|
96
97
|
]],
|
|
97
98
|
tabindex: "-1",
|
|
98
|
-
onKeydown:
|
|
99
|
+
onKeydown: k,
|
|
99
100
|
onSelect: t[0] || (t[0] = (n) => a("click:select", n.detail))
|
|
100
101
|
}, e.$attrs), [
|
|
101
|
-
|
|
102
|
+
M(e.$slots, "default")
|
|
102
103
|
], 16));
|
|
103
104
|
}
|
|
104
105
|
};
|
|
@@ -1,247 +1,262 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { clamp as
|
|
3
|
-
function
|
|
4
|
-
const r =
|
|
1
|
+
import { ref as M, computed as p, watch as ee, nextTick as N } from "vue";
|
|
2
|
+
import { clamp as g, toRawNumberString as k, fromRawString as x } from "./numberFormatUtils.js";
|
|
3
|
+
function ue(n, c) {
|
|
4
|
+
const r = M(""), o = M(null), L = M(null), h = M(!1), S = M(0);
|
|
5
5
|
let a = "";
|
|
6
|
-
const
|
|
6
|
+
const $ = p(() => {
|
|
7
7
|
const e = Number(n.precision);
|
|
8
8
|
return e > 0 ? e + 1 : 1;
|
|
9
9
|
});
|
|
10
|
-
function b(e, t = 2, l = !
|
|
10
|
+
function b(e, t = 2, u = !1, l = !0) {
|
|
11
11
|
if (e == null || isNaN(e)) return "";
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
const m =
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
const D =
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
function
|
|
12
|
+
const f = Number(t), d = Number(e) < 0 ? "-" : "", i = Math.abs(Number(e));
|
|
13
|
+
let s = k(i, f);
|
|
14
|
+
const m = f + 1;
|
|
15
|
+
s.length < m && (s = s.padStart(m, "0"));
|
|
16
|
+
const w = s.slice(0, s.length - f) || "0";
|
|
17
|
+
let V = f > 0 ? s.slice(-f) : "";
|
|
18
|
+
f > 0 && u && (V = V.replace(/0+$/, ""));
|
|
19
|
+
const D = l ? w.replace(/\B(?=(\d{3})+(?!\d))/g, ".") : w;
|
|
20
|
+
return f === 0 || !V || V.length === 0 ? d + D : d + D + "," + V;
|
|
21
|
+
}
|
|
22
|
+
function y(e) {
|
|
23
23
|
if (e == null) return NaN;
|
|
24
24
|
let t = String(e).trim();
|
|
25
25
|
return t ? (t = t.replace(/\s+/g, ""), t = t.replace(/\./g, ""), t = t.replace(/,/g, "."), t = t.replace(/[^0-9\.\-]/g, ""), t === "" ? NaN : parseFloat(t)) : NaN;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const A = C((e) => {
|
|
28
|
+
c("update:modelValue", e);
|
|
29
|
+
}, 250);
|
|
30
|
+
function K(e) {
|
|
28
31
|
const t = o.value;
|
|
29
32
|
if (!t) return;
|
|
30
|
-
let
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
let i =
|
|
34
|
-
i = i.replace(/^0+(\d)/, "$1"), r.value = i,
|
|
33
|
+
let u = t.value;
|
|
34
|
+
const l = Number(n.precision), f = t.selectionStart || 0;
|
|
35
|
+
if (l === 0) {
|
|
36
|
+
let i = u.replace(/[^0-9\-]/g, "");
|
|
37
|
+
i = i.replace(/^0+(\d)/, "$1"), r.value = i, N(() => {
|
|
35
38
|
if (!o.value) return;
|
|
36
39
|
o.value.value = i;
|
|
37
|
-
const
|
|
38
|
-
o.value.setSelectionRange(
|
|
39
|
-
}),
|
|
40
|
+
const s = Math.min(i.length, f);
|
|
41
|
+
o.value.setSelectionRange(s, s);
|
|
42
|
+
}), c("input", i);
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
42
|
-
if (
|
|
43
|
-
const i =
|
|
44
|
-
|
|
45
|
+
if (u = u.replace(/\./g, ",").replace(/\s+/g, ""), u = u.replace(/[^0-9,\-]/g, ""), (u.match(/,/g) || []).length > 1) {
|
|
46
|
+
const i = u.split(","), s = i.shift() || "", m = i.join("");
|
|
47
|
+
u = s + (m.length ? "," + m : "");
|
|
45
48
|
}
|
|
46
|
-
if (
|
|
47
|
-
const [i,
|
|
48
|
-
|
|
49
|
+
if (u.includes(",")) {
|
|
50
|
+
const [i, s = ""] = u.split(","), m = s.slice(0, l);
|
|
51
|
+
u = i + (m.length ? "," + m : ",");
|
|
49
52
|
}
|
|
50
|
-
r.value =
|
|
53
|
+
r.value = u, N(E), N(() => {
|
|
51
54
|
const i = f;
|
|
52
55
|
t.setSelectionRange(i, i);
|
|
53
|
-
}),
|
|
56
|
+
}), c("input", u);
|
|
57
|
+
const d = y(u);
|
|
58
|
+
isNaN(d) || A(d);
|
|
54
59
|
}
|
|
55
|
-
function
|
|
60
|
+
function C(e, t = 250) {
|
|
61
|
+
let u;
|
|
62
|
+
return (...l) => {
|
|
63
|
+
clearTimeout(u), u = setTimeout(() => e(...l), t);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function E() {
|
|
56
67
|
o.value && (o.value.value = r.value);
|
|
57
68
|
}
|
|
58
|
-
function
|
|
59
|
-
if (
|
|
60
|
-
const t = Number(n.modelValue),
|
|
69
|
+
function H(e) {
|
|
70
|
+
if (h.value = !0, !o.value) return;
|
|
71
|
+
const t = Number(n.modelValue), u = Number(n.precision);
|
|
61
72
|
if (isNaN(t)) {
|
|
62
|
-
r.value = "",
|
|
73
|
+
r.value = "", c("focus");
|
|
63
74
|
return;
|
|
64
75
|
}
|
|
65
76
|
if (t === 0) {
|
|
66
|
-
r.value = "",
|
|
77
|
+
r.value = "", N(() => {
|
|
67
78
|
try {
|
|
68
79
|
o.value.setSelectionRange(0, 0);
|
|
69
80
|
} catch {
|
|
70
81
|
}
|
|
71
|
-
}),
|
|
82
|
+
}), c("focus");
|
|
72
83
|
return;
|
|
73
84
|
}
|
|
74
|
-
let
|
|
75
|
-
const f =
|
|
76
|
-
let
|
|
77
|
-
|
|
85
|
+
let l = k(Math.abs(t), u);
|
|
86
|
+
const f = l.slice(0, l.length - u) || "0";
|
|
87
|
+
let d = u > 0 ? l.slice(-u) : "";
|
|
88
|
+
u > 0 && (d = d.replace(/0+$/, "")), r.value = (t < 0 ? "-" : "") + f + (d.length ? "," + d : ""), N(() => {
|
|
78
89
|
try {
|
|
79
|
-
const
|
|
80
|
-
o.value.setSelectionRange(
|
|
90
|
+
const i = r.value.length;
|
|
91
|
+
o.value.setSelectionRange(i, i);
|
|
81
92
|
} catch {
|
|
82
93
|
}
|
|
83
|
-
}),
|
|
94
|
+
}), c("focus");
|
|
84
95
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
96
|
+
function j() {
|
|
97
|
+
h.value = !1;
|
|
87
98
|
let e = (r.value ?? "").toString().trim();
|
|
88
99
|
e || (e = "0");
|
|
89
|
-
let t =
|
|
90
|
-
isNaN(t) && (t = 0), t =
|
|
91
|
-
}
|
|
92
|
-
function
|
|
93
|
-
return Number(n.precision) === 0 ? e === "" ? "0" : e.replace(/^0+(\d)/, "$1") : e.padStart(
|
|
94
|
-
}
|
|
95
|
-
function
|
|
96
|
-
let
|
|
97
|
-
for (let
|
|
98
|
-
/\d/.test(e[
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
function
|
|
102
|
-
let
|
|
103
|
-
for (let
|
|
104
|
-
if (/\d/.test(e[
|
|
105
|
-
if (
|
|
106
|
-
|
|
100
|
+
let t = y(e);
|
|
101
|
+
isNaN(t) && (t = 0), t = g(t, n.min, n.max), r.value = b(t, Number(n.precision), !1), c("update:modelValue", t), c("blur");
|
|
102
|
+
}
|
|
103
|
+
function F(e) {
|
|
104
|
+
return Number(n.precision) === 0 ? e === "" ? "0" : e.replace(/^0+(\d)/, "$1") : e.padStart($.value, "0");
|
|
105
|
+
}
|
|
106
|
+
function T(e, t) {
|
|
107
|
+
let u = 0;
|
|
108
|
+
for (let l = 0; l < t; l++)
|
|
109
|
+
/\d/.test(e[l]) && u++;
|
|
110
|
+
return u;
|
|
111
|
+
}
|
|
112
|
+
function U(e, t) {
|
|
113
|
+
let u = 0;
|
|
114
|
+
for (let l = 0; l < e.length; l++)
|
|
115
|
+
if (/\d/.test(e[l])) {
|
|
116
|
+
if (u === t) return l;
|
|
117
|
+
u++;
|
|
107
118
|
}
|
|
108
|
-
for (let
|
|
109
|
-
if (/\d/.test(e[
|
|
119
|
+
for (let l = e.length - 1; l >= 0; l--)
|
|
120
|
+
if (/\d/.test(e[l])) return l + 1;
|
|
110
121
|
return e.length;
|
|
111
122
|
}
|
|
112
|
-
function
|
|
123
|
+
function B() {
|
|
113
124
|
const e = Number(n.precision) + 1;
|
|
114
125
|
a = String(a || "").padStart(e, "0");
|
|
115
|
-
const t = Math.max(1, a.length - Number(n.precision)),
|
|
116
|
-
a = k(
|
|
126
|
+
const t = Math.max(1, a.length - Number(n.precision)), u = a.slice(0, t) || "0", l = a.slice(t).padEnd(Number(n.precision), "0").slice(0, Number(n.precision)), f = `${u}.${l}`, d = parseFloat(f), i = g(d, n.min, n.max);
|
|
127
|
+
a = k(i, Number(n.precision)), r.value = b(i, Number(n.precision), !1), c("update:modelValue", i), c("input", i), N(() => {
|
|
117
128
|
if (o.value)
|
|
118
129
|
try {
|
|
119
|
-
const
|
|
120
|
-
let
|
|
121
|
-
for (;
|
|
122
|
-
o.value.setSelectionRange(
|
|
130
|
+
const s = r.value;
|
|
131
|
+
let m = U(s, S.value);
|
|
132
|
+
for (; m < s.length && !/\d/.test(s[m]); ) m++;
|
|
133
|
+
o.value.setSelectionRange(m, m);
|
|
123
134
|
} catch {
|
|
124
135
|
o.value.setSelectionRange(r.value.length, r.value.length);
|
|
125
136
|
}
|
|
126
137
|
});
|
|
127
138
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
const e =
|
|
131
|
-
a = k(t, Number(n.precision)), a =
|
|
139
|
+
function q() {
|
|
140
|
+
h.value = !1, a = F(a);
|
|
141
|
+
const e = x(a, Number(n.precision)), t = g(e, n.min, n.max);
|
|
142
|
+
a = k(t, Number(n.precision)), a = F(a), r.value = b(t, Number(n.precision), !1), c("update:modelValue", t), c("blur");
|
|
132
143
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
135
|
-
var
|
|
144
|
+
function z(e) {
|
|
145
|
+
h.value = !0, N(() => {
|
|
146
|
+
var u;
|
|
136
147
|
if (!o.value) return;
|
|
137
|
-
if ((e == null ? void 0 : e.relatedTarget) !== void 0 || ((
|
|
138
|
-
const
|
|
139
|
-
o.value.setSelectionRange(
|
|
148
|
+
if ((e == null ? void 0 : e.relatedTarget) !== void 0 || ((u = e == null ? void 0 : e.sourceCapabilities) == null ? void 0 : u.firesTouchEvents) === !1) {
|
|
149
|
+
const l = r.value.length;
|
|
150
|
+
o.value.setSelectionRange(l, l), S.value = r.value.replace(/\D/g, "").length;
|
|
140
151
|
} else {
|
|
141
|
-
const
|
|
142
|
-
|
|
152
|
+
const l = o.value.selectionStart || 0;
|
|
153
|
+
S.value = T(r.value, l);
|
|
143
154
|
}
|
|
144
|
-
}),
|
|
155
|
+
}), c("focus");
|
|
145
156
|
}
|
|
146
|
-
function
|
|
157
|
+
function G(e) {
|
|
147
158
|
var t;
|
|
148
159
|
(t = e.preventDefault) == null || t.call(e);
|
|
149
160
|
}
|
|
150
|
-
function
|
|
161
|
+
function J(e) {
|
|
151
162
|
if (n.formatMode !== "bank") return;
|
|
152
|
-
const { key: t, target:
|
|
163
|
+
const { key: t, target: u } = e, l = /^[0-9]$/.test(t), f = t === "Backspace", d = t === "Delete", i = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(t), s = e.ctrlKey || e.metaKey, m = t === "Home", w = t === "End";
|
|
153
164
|
if (t === "Tab") return;
|
|
154
|
-
if (
|
|
155
|
-
|
|
165
|
+
if (m) {
|
|
166
|
+
N(() => {
|
|
156
167
|
if (!o.value) return;
|
|
157
|
-
const
|
|
158
|
-
o.value.setSelectionRange(
|
|
168
|
+
const I = r.value.search(/\d/);
|
|
169
|
+
o.value.setSelectionRange(I, I);
|
|
159
170
|
});
|
|
160
171
|
return;
|
|
161
172
|
}
|
|
162
|
-
if (
|
|
163
|
-
|
|
173
|
+
if (w) {
|
|
174
|
+
N(() => {
|
|
164
175
|
if (!o.value) return;
|
|
165
176
|
const R = r.value;
|
|
166
177
|
o.value.setSelectionRange(R.length, R.length);
|
|
167
178
|
});
|
|
168
179
|
return;
|
|
169
180
|
}
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
181
|
+
if (i || s) return;
|
|
182
|
+
const D = (u == null ? void 0 : u.selectionStart) ?? 0, _ = r.value || "", v = T(_, D);
|
|
172
183
|
e.preventDefault();
|
|
173
|
-
const
|
|
174
|
-
for (; a.length <
|
|
175
|
-
if (
|
|
176
|
-
a = a.substring(0,
|
|
184
|
+
const P = Number(n.precision) + 1;
|
|
185
|
+
for (; a.length < P; ) a = "0" + a;
|
|
186
|
+
if (l)
|
|
187
|
+
a = a.substring(0, v) + t + a.substring(v), S.value = v + 1;
|
|
177
188
|
else if (f) {
|
|
178
|
-
if (
|
|
179
|
-
const R =
|
|
180
|
-
a = a.substring(0, R) + a.substring(R + 1),
|
|
189
|
+
if (v > 0) {
|
|
190
|
+
const R = v - 1;
|
|
191
|
+
a = a.substring(0, R) + a.substring(R + 1), S.value = R;
|
|
181
192
|
}
|
|
182
|
-
} else if (
|
|
183
|
-
|
|
193
|
+
} else if (d)
|
|
194
|
+
v < a.length && (a = a.substring(0, v) + a.substring(v + 1), S.value = v);
|
|
184
195
|
else return;
|
|
185
|
-
for (; a.length <
|
|
186
|
-
|
|
196
|
+
for (; a.length < P; ) a = "0" + a;
|
|
197
|
+
B();
|
|
187
198
|
}
|
|
188
|
-
function
|
|
199
|
+
function O() {
|
|
189
200
|
let e;
|
|
190
|
-
n.formatMode === "bank" ? (e =
|
|
201
|
+
n.formatMode === "bank" ? (e = x(a, Number(n.precision)) || 0, e = g(e + Number(n.step), n.min, n.max), a = k(e, Number(n.precision)), r.value = b(e, Number(n.precision), !1), c("update:modelValue", e), c("input", e)) : (e = Number(n.modelValue ?? 0) || 0, e = g(e + Number(n.step), n.min, n.max), r.value = b(e, Number(n.precision), !1), c("update:modelValue", e), c("input", e));
|
|
191
202
|
}
|
|
192
|
-
function
|
|
203
|
+
function Q() {
|
|
193
204
|
let e;
|
|
194
|
-
n.formatMode === "bank" ? (e =
|
|
205
|
+
n.formatMode === "bank" ? (e = x(a, Number(n.precision)) || 0, e = g(e - Number(n.step), n.min, n.max), a = k(e, Number(n.precision)), r.value = b(e, Number(n.precision), !1), c("update:modelValue", e), c("input", e)) : (e = Number(n.modelValue ?? 0) || 0, e = g(e - Number(n.step), n.min, n.max), r.value = b(e, Number(n.precision), !1), c("update:modelValue", e), c("input", e));
|
|
195
206
|
}
|
|
196
|
-
function
|
|
197
|
-
n.formatMode === "bank" ? (a = "0".repeat(Number(n.precision) + 1),
|
|
207
|
+
function W() {
|
|
208
|
+
n.formatMode === "bank" ? (a = "0".repeat(Number(n.precision) + 1), S.value = Number(n.precision) + 1, B(), N(() => {
|
|
198
209
|
var e, t;
|
|
199
210
|
return (t = (e = o.value) == null ? void 0 : e.focus) == null ? void 0 : t.call(e);
|
|
200
|
-
})) : (r.value = "",
|
|
211
|
+
})) : (r.value = "", c("update:modelValue", null), N(() => {
|
|
201
212
|
var e, t;
|
|
202
213
|
return (t = (e = o.value) == null ? void 0 : e.focus) == null ? void 0 : t.call(e);
|
|
203
214
|
}));
|
|
204
215
|
}
|
|
205
|
-
|
|
216
|
+
ee(
|
|
206
217
|
[() => n.modelValue, () => n.precision, () => n.formatMode],
|
|
207
|
-
([e, t,
|
|
208
|
-
if (
|
|
209
|
-
|
|
218
|
+
([e, t, u]) => {
|
|
219
|
+
if (u !== "bank") {
|
|
220
|
+
if (h.value) {
|
|
221
|
+
const l = Number(e ?? 0);
|
|
222
|
+
l === 0 ? r.value = "" : r.value = b(l, Number(t), !0, !1);
|
|
223
|
+
} else
|
|
224
|
+
r.value = b(Number(e ?? 0), Number(t), !1, !0);
|
|
210
225
|
return;
|
|
211
226
|
}
|
|
212
227
|
if (e == null || isNaN(e))
|
|
213
228
|
r.value = b(0, Number(t), !1), a = "0".repeat(Number(t) + 1);
|
|
214
229
|
else {
|
|
215
|
-
const
|
|
230
|
+
const l = Number(e), f = g(l, n.min, n.max);
|
|
216
231
|
a = k(f, Number(t)), a.length < Number(t) + 1 && (a = a.padStart(Number(t) + 1, "0")), r.value = b(f, Number(t), !1);
|
|
217
232
|
}
|
|
218
233
|
},
|
|
219
234
|
{ immediate: !0 }
|
|
220
235
|
);
|
|
221
|
-
function
|
|
222
|
-
return n.formatMode !== "bank" ?
|
|
236
|
+
function X(e) {
|
|
237
|
+
return n.formatMode !== "bank" ? K() : G(e);
|
|
223
238
|
}
|
|
224
|
-
function
|
|
225
|
-
return n.formatMode !== "bank" ?
|
|
239
|
+
function Y(e) {
|
|
240
|
+
return n.formatMode !== "bank" ? H() : z(e);
|
|
226
241
|
}
|
|
227
|
-
function
|
|
228
|
-
return n.formatMode !== "bank" ?
|
|
242
|
+
function Z(e) {
|
|
243
|
+
return n.formatMode !== "bank" ? j() : q();
|
|
229
244
|
}
|
|
230
245
|
return {
|
|
231
246
|
inputValue: r,
|
|
232
247
|
numberInput: o,
|
|
233
|
-
rootRef:
|
|
234
|
-
validateKey:
|
|
235
|
-
handleFocus:
|
|
236
|
-
handleBlur:
|
|
237
|
-
handleInput:
|
|
238
|
-
onIncrement:
|
|
239
|
-
onDecrement:
|
|
240
|
-
onClear:
|
|
241
|
-
isActive:
|
|
242
|
-
focus:
|
|
248
|
+
rootRef: L,
|
|
249
|
+
validateKey: J,
|
|
250
|
+
handleFocus: Y,
|
|
251
|
+
handleBlur: Z,
|
|
252
|
+
handleInput: X,
|
|
253
|
+
onIncrement: O,
|
|
254
|
+
onDecrement: Q,
|
|
255
|
+
onClear: W,
|
|
256
|
+
isActive: h,
|
|
257
|
+
focus: h
|
|
243
258
|
};
|
|
244
259
|
}
|
|
245
260
|
export {
|
|
246
|
-
|
|
261
|
+
ue as useKunNumberField
|
|
247
262
|
};
|