adverich-kun-ui 0.1.352 → 0.1.353
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/dist/components/KunNumberField/src/components/KunNumberField.vue.js +5 -5
- package/dist/components/KunNumberField/src/composables/useKunNumberFieldComposable.js +31 -31
- package/dist/components/KunTextField/src/components/KunTextField.vue.js +23 -23
- package/dist/components/KunTextField/src/composables/useKunTextFieldComposable.js +24 -23
- package/package.json +1 -1
|
@@ -40,8 +40,8 @@ const G = {
|
|
|
40
40
|
props: L,
|
|
41
41
|
emits: [
|
|
42
42
|
"update:modelValue",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
43
|
+
"focus",
|
|
44
|
+
"blur",
|
|
45
45
|
"handleClick",
|
|
46
46
|
"keyDown",
|
|
47
47
|
"keyUp"
|
|
@@ -123,9 +123,9 @@ const G = {
|
|
|
123
123
|
autocomplete: "off",
|
|
124
124
|
class: p(["w-full h-full bg-transparent rounded focus:outline-none", [$.value, e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
|
|
125
125
|
"aria-invalid": e.error ? "true" : "false",
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
onBlur: r[1] || (r[1] = (...t) => o(C) && o(C)(...t)),
|
|
127
|
+
onFocus: r[2] || (r[2] = (...t) => o(g) && o(g)(...t)),
|
|
128
|
+
onInput: r[3] || (r[3] = (t) => o(N)(t.target.value)),
|
|
129
129
|
onKeydown: r[4] || (r[4] = (t) => y("keyDown", t)),
|
|
130
130
|
onKeyup: r[5] || (r[5] = (t) => y("keyUp", t))
|
|
131
131
|
}, null, 42, T)),
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as t, computed as p, watch as g, nextTick as y } from "vue";
|
|
2
2
|
import { normalizeNumber as z } from "./numberFormatUtils.js";
|
|
3
|
-
function N(e,
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
|
|
3
|
+
function N(e, a) {
|
|
4
|
+
const u = t(e.modelValue), r = t(null), m = t(null), f = t(0);
|
|
5
|
+
function c(n) {
|
|
6
|
+
const l = z(n, e.separator).split(e.separator);
|
|
7
|
+
if (l.length > 2) {
|
|
8
|
+
d();
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
const i =
|
|
13
|
-
i ===
|
|
11
|
+
l.length === 2 && l[1].length > e.precision && (l[1] = l[1].slice(0, e.precision));
|
|
12
|
+
const i = l.join(e.separator);
|
|
13
|
+
i === u.value ? d() : u.value = i, a("update:modelValue", i);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function d() {
|
|
16
16
|
f.value++, y(() => {
|
|
17
|
-
var
|
|
18
|
-
(
|
|
17
|
+
var n;
|
|
18
|
+
(n = r.value) == null || n.focus();
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function s() {
|
|
22
|
-
o((n.value || 0) + e.step);
|
|
23
|
-
}
|
|
24
21
|
function v() {
|
|
25
|
-
|
|
22
|
+
c((u.value || 0) + e.step);
|
|
23
|
+
}
|
|
24
|
+
function s() {
|
|
25
|
+
c((u.value || 0) - e.step);
|
|
26
26
|
}
|
|
27
27
|
function V() {
|
|
28
|
-
|
|
28
|
+
u.value = null, a("update:modelValue", null);
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const o = t(!1);
|
|
31
31
|
function h() {
|
|
32
|
-
|
|
32
|
+
o.value = !0, u.value || (u.value = ""), a("focus");
|
|
33
33
|
}
|
|
34
34
|
function I() {
|
|
35
|
-
|
|
35
|
+
o.value = !1, u.value || (u.value = 0), a("blur");
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
return g(() => e.modelValue, (
|
|
39
|
-
|
|
37
|
+
const b = p(() => o.value || !!e.modelValue || e.dirty);
|
|
38
|
+
return g(() => e.modelValue, (n) => {
|
|
39
|
+
u.value = n;
|
|
40
40
|
}), {
|
|
41
|
-
inputValue:
|
|
41
|
+
inputValue: u,
|
|
42
42
|
numberInput: r,
|
|
43
|
-
rootRef:
|
|
43
|
+
rootRef: m,
|
|
44
44
|
inputKey: f,
|
|
45
|
-
updateValue:
|
|
46
|
-
onIncrement:
|
|
47
|
-
onDecrement:
|
|
45
|
+
updateValue: c,
|
|
46
|
+
onIncrement: v,
|
|
47
|
+
onDecrement: s,
|
|
48
48
|
onClear: V,
|
|
49
|
-
focus:
|
|
49
|
+
focus: o,
|
|
50
50
|
handleFocus: h,
|
|
51
|
-
isActive:
|
|
51
|
+
isActive: b,
|
|
52
52
|
handleBlur: I
|
|
53
53
|
};
|
|
54
54
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCurrentInstance as U, computed as d, useSlots as H, ref as q, createElementBlock as
|
|
1
|
+
import { getCurrentInstance as U, computed as d, useSlots as H, ref as q, createElementBlock as n, openBlock as o, createCommentVNode as r, createElementVNode as h, normalizeClass as u, toDisplayString as i, mergeProps as G, unref as t, renderSlot as k, withModifiers as J, createVNode as L } from "vue";
|
|
2
2
|
import { icons as P } from "../../../../icons/index.js";
|
|
3
3
|
import Q from "../composables/KunTextFieldProps.js";
|
|
4
4
|
import W from "../composables/useKunTextFieldComposable.js";
|
|
@@ -15,7 +15,7 @@ const Y = {
|
|
|
15
15
|
}, le = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "h-[1.25rem]"
|
|
18
|
-
},
|
|
18
|
+
}, se = ["id"], ne = {
|
|
19
19
|
key: 1,
|
|
20
20
|
class: "text-xs text-center"
|
|
21
21
|
}, oe = {
|
|
@@ -26,8 +26,8 @@ const Y = {
|
|
|
26
26
|
props: { ...Q },
|
|
27
27
|
emits: [
|
|
28
28
|
"update:modelValue",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"focus",
|
|
30
|
+
"blur",
|
|
31
31
|
"handleClick",
|
|
32
32
|
"keyDown",
|
|
33
33
|
"keyUp"
|
|
@@ -66,12 +66,12 @@ const Y = {
|
|
|
66
66
|
const M = d(() => a.type === "password" ? v.value ? "text" : "password" : a.type), R = d(() => a.density === "compact" ? "p-1" : a.density === "comfortable" ? "p-2" : "p-3");
|
|
67
67
|
return (e, l) => {
|
|
68
68
|
var F;
|
|
69
|
-
return o(),
|
|
69
|
+
return o(), n("div", {
|
|
70
70
|
class: "w-full flex flex-col relative",
|
|
71
71
|
ref_key: "rootRef",
|
|
72
72
|
ref: w
|
|
73
73
|
}, [
|
|
74
|
-
e.label ? (o(),
|
|
74
|
+
e.label ? (o(), n("label", {
|
|
75
75
|
key: 0,
|
|
76
76
|
for: m,
|
|
77
77
|
class: u([
|
|
@@ -90,8 +90,8 @@ const Y = {
|
|
|
90
90
|
t(y) ? "bg-red-200 dark:bg-red-900" : ""
|
|
91
91
|
]])
|
|
92
92
|
}, [
|
|
93
|
-
e.prefix ? (o(),
|
|
94
|
-
N.value ? (o(),
|
|
93
|
+
e.prefix ? (o(), n("div", Y, i(e.prefix), 1)) : r("", !0),
|
|
94
|
+
N.value ? (o(), n("div", {
|
|
95
95
|
key: 1,
|
|
96
96
|
class: u([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
|
|
97
97
|
}, [
|
|
@@ -111,42 +111,42 @@ const Y = {
|
|
|
111
111
|
class: u(["w-full h-full bg-transparent focus:outline-none", [R.value, e.textColor, e.placeholderColor, e.rounded, e.textCenter ? "text-center" : ""]]),
|
|
112
112
|
"aria-invalid": t(y) ? "true" : "false",
|
|
113
113
|
"aria-describedby": t(y) ? `error-${m}` : null,
|
|
114
|
-
onInput: l[0] || (l[0] = (...
|
|
115
|
-
onBlur: l[1] || (l[1] = (...
|
|
116
|
-
onFocus: l[2] || (l[2] = (...
|
|
117
|
-
onClick: l[3] || (l[3] = J((
|
|
118
|
-
onKeydown: l[4] || (l[4] = (
|
|
119
|
-
onKeyup: l[5] || (l[5] = (
|
|
114
|
+
onInput: l[0] || (l[0] = (...s) => t(g) && t(g)(...s)),
|
|
115
|
+
onBlur: l[1] || (l[1] = (...s) => t(C) && t(C)(...s)),
|
|
116
|
+
onFocus: l[2] || (l[2] = (...s) => t(I) && t(I)(...s)),
|
|
117
|
+
onClick: l[3] || (l[3] = J((s) => p("handleClick"), ["stop"])),
|
|
118
|
+
onKeydown: l[4] || (l[4] = (s) => p("keyDown", s)),
|
|
119
|
+
onKeyup: l[5] || (l[5] = (s) => p("keyUp", s))
|
|
120
120
|
}, null, 42, Z),
|
|
121
|
-
e.clearable && t(f) ? (o(),
|
|
121
|
+
e.clearable && t(f) ? (o(), n("button", {
|
|
122
122
|
key: 2,
|
|
123
123
|
type: "button",
|
|
124
|
-
onClick: l[6] || (l[6] = (...
|
|
124
|
+
onClick: l[6] || (l[6] = (...s) => t($) && t($)(...s)),
|
|
125
125
|
class: u(["ml-2", e.textColor]),
|
|
126
126
|
disabled: e.disabled || e.readonly
|
|
127
127
|
}, " × ", 10, _)) : r("", !0),
|
|
128
128
|
k(e.$slots, "default"),
|
|
129
|
-
e.type === "password" && e.showPasswordToggle ? (o(),
|
|
129
|
+
e.type === "password" && e.showPasswordToggle ? (o(), n("div", ee, [
|
|
130
130
|
L(X, {
|
|
131
131
|
icon: z.value,
|
|
132
132
|
onClick: A
|
|
133
133
|
}, null, 8, ["icon"])
|
|
134
134
|
])) : r("", !0),
|
|
135
|
-
O.value ? (o(),
|
|
135
|
+
O.value ? (o(), n("div", {
|
|
136
136
|
key: 4,
|
|
137
137
|
class: u([e.appendInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
|
|
138
138
|
}, [
|
|
139
139
|
k(e.$slots, "append-inner")
|
|
140
140
|
], 2)) : r("", !0),
|
|
141
|
-
e.suffix ? (o(),
|
|
141
|
+
e.suffix ? (o(), n("div", te, i(e.suffix), 1)) : r("", !0)
|
|
142
142
|
], 2),
|
|
143
|
-
e.hideDetails ? r("", !0) : (o(),
|
|
144
|
-
t(y) ? (o(),
|
|
143
|
+
e.hideDetails ? r("", !0) : (o(), n("div", le, [
|
|
144
|
+
t(y) ? (o(), n("div", {
|
|
145
145
|
key: 0,
|
|
146
146
|
id: `error-${m}`,
|
|
147
147
|
class: "text-red-500 text-sm text-center"
|
|
148
|
-
}, i(t(B) || e.errorMessage), 9,
|
|
149
|
-
e.counter && e.maxlength ? (o(),
|
|
148
|
+
}, i(t(B) || e.errorMessage), 9, se)) : e.hint && (e.persistentHint || t(b)) ? (o(), n("div", ne, i(e.hint), 1)) : r("", !0),
|
|
149
|
+
e.counter && e.maxlength ? (o(), n("div", oe, i(((F = t(f)) == null ? void 0 : F.length) || 0) + " / " + i(e.maxlength), 1)) : r("", !0)
|
|
150
150
|
]))
|
|
151
151
|
], 16)
|
|
152
152
|
], 512);
|
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
import { ref as a, inject as V, computed as E, watch as F, onUnmounted as T } from "vue";
|
|
2
2
|
import { debounce as j } from "../../../../utils/utils.js";
|
|
3
3
|
function R(u, r) {
|
|
4
|
-
const
|
|
4
|
+
const l = a(u.modelValue), o = a(!1), t = a(""), n = a(!1), g = a(null), h = a(null), s = a(!1), d = V("registerField", null), v = V("unregisterField", null), y = E(() => u.error || !!t.value && n.value), c = async () => {
|
|
5
5
|
for (const e of u.rules) {
|
|
6
|
-
const m = await Promise.resolve(e(
|
|
6
|
+
const m = await Promise.resolve(e(l.value));
|
|
7
7
|
if (m !== !0) return m;
|
|
8
8
|
}
|
|
9
9
|
return !0;
|
|
10
10
|
}, f = j(async () => {
|
|
11
11
|
const e = await c();
|
|
12
|
-
|
|
12
|
+
t.value = e === !0 ? "" : e;
|
|
13
13
|
}, u.debounce ?? 300);
|
|
14
14
|
F(() => u.modelValue, (e) => {
|
|
15
|
-
e !==
|
|
16
|
-
}), F(
|
|
15
|
+
e !== l.value && (s.value = !0, l.value = e);
|
|
16
|
+
}), F(l, () => {
|
|
17
17
|
if (s.value) {
|
|
18
18
|
s.value = !1;
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
n.value = !0, r("update:modelValue",
|
|
21
|
+
n.value = !0, r("update:modelValue", l.value), u.validateOnBlur || f();
|
|
22
22
|
});
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
if (o.value = !1,
|
|
23
|
+
const b = (e) => {
|
|
24
|
+
l.value = e.target.value;
|
|
25
|
+
}, w = async () => {
|
|
26
|
+
if (o.value = !1, u.validateOnBlur) {
|
|
27
27
|
const e = await c();
|
|
28
|
-
|
|
28
|
+
t.value = e === !0 ? "" : e;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
o.value = !0, r("focusInput");
|
|
30
|
+
r("blur");
|
|
32
31
|
}, B = () => {
|
|
33
|
-
|
|
32
|
+
o.value = !0, r("focus");
|
|
33
|
+
}, I = () => {
|
|
34
|
+
l.value = "", r("update:modelValue", ""), n.value = !0, u.validateOnBlur || f();
|
|
34
35
|
}, i = async () => {
|
|
35
36
|
n.value = !0;
|
|
36
37
|
const e = await c();
|
|
37
|
-
return
|
|
38
|
+
return t.value = e === !0 ? "" : e, e === !0;
|
|
38
39
|
}, O = () => {
|
|
39
|
-
|
|
40
|
+
l.value = u.modelValue, n.value = !1, t.value = "";
|
|
40
41
|
}, x = () => {
|
|
41
|
-
n.value = !1,
|
|
42
|
+
n.value = !1, t.value = "";
|
|
42
43
|
};
|
|
43
44
|
return d && d({ validate: i }), T(() => {
|
|
44
45
|
v && v({ validate: i });
|
|
45
46
|
}), {
|
|
46
47
|
inputField: g,
|
|
47
|
-
inputValue:
|
|
48
|
+
inputValue: l,
|
|
48
49
|
rootRef: h,
|
|
49
50
|
inputFocused: o,
|
|
50
|
-
validationError:
|
|
51
|
+
validationError: t,
|
|
51
52
|
hasError: y,
|
|
52
|
-
handleInput:
|
|
53
|
-
handleBlur:
|
|
54
|
-
focusInput:
|
|
53
|
+
handleInput: b,
|
|
54
|
+
handleBlur: w,
|
|
55
|
+
focusInput: B,
|
|
55
56
|
validate: i,
|
|
56
57
|
reset: O,
|
|
57
58
|
resetValidation: x,
|
|
58
|
-
clearInput:
|
|
59
|
+
clearInput: I
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
export {
|