adverich-kun-ui 0.1.121 → 0.1.123
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,5 +1,5 @@
|
|
|
1
|
-
import { ref as l, provide as s, createElementBlock as
|
|
2
|
-
const
|
|
1
|
+
import { ref as l, provide as s, createElementBlock as h, openBlock as y, mergeProps as x, withModifiers as S, renderSlot as w } from "vue";
|
|
2
|
+
const b = {
|
|
3
3
|
__name: "KunForm",
|
|
4
4
|
props: {
|
|
5
5
|
gap: {
|
|
@@ -15,12 +15,13 @@ const w = {
|
|
|
15
15
|
default: "max-w-full"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
emits: ["submit"],
|
|
19
|
+
setup(o, { expose: u, emit: d }) {
|
|
20
|
+
const i = o, c = d, t = l([]), r = l(!0);
|
|
21
|
+
function f(e) {
|
|
21
22
|
t.value.push(e);
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function p(e) {
|
|
24
25
|
t.value = t.value.filter((a) => a !== e);
|
|
25
26
|
}
|
|
26
27
|
async function n() {
|
|
@@ -29,34 +30,34 @@ const w = {
|
|
|
29
30
|
);
|
|
30
31
|
return r.value = e.every((a) => a === !0), { valid: r.value };
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function m() {
|
|
33
34
|
t.value.forEach((e) => {
|
|
34
35
|
e.reset && e.reset();
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function v() {
|
|
38
39
|
t.value.forEach((e) => {
|
|
39
40
|
e.resetValidation && e.resetValidation();
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function g() {
|
|
43
44
|
n().then(({ valid: e }) => {
|
|
44
|
-
e &&
|
|
45
|
+
e && c("submit");
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
|
-
return s("registerField",
|
|
48
|
+
return s("registerField", f), s("unregisterField", p), u({
|
|
48
49
|
validate: n,
|
|
49
|
-
reset:
|
|
50
|
-
resetValidation:
|
|
51
|
-
}), (e, a) => (
|
|
52
|
-
onSubmit:
|
|
50
|
+
reset: m,
|
|
51
|
+
resetValidation: v
|
|
52
|
+
}), (e, a) => (y(), h("form", x({
|
|
53
|
+
onSubmit: S(g, ["prevent"]),
|
|
53
54
|
novalidate: "",
|
|
54
55
|
class: `flex flex-col w-full ${i.gap} ${i.padding} ${i.maxWidth}`
|
|
55
56
|
}, e.$attrs), [
|
|
56
|
-
|
|
57
|
+
w(e.$slots, "default")
|
|
57
58
|
], 16));
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
+
b as default
|
|
62
63
|
};
|
|
@@ -1,98 +1,96 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { KunNumberFieldProps as
|
|
3
|
-
import { useKunNumberField as
|
|
4
|
-
const
|
|
1
|
+
import { getCurrentInstance as $, useSlots as D, resolveComponent as z, createElementBlock as l, openBlock as o, createCommentVNode as n, createElementVNode as d, normalizeClass as p, unref as t, toDisplayString as u, mergeProps as E, createBlock as g, renderSlot as w, Fragment as C, renderList as P } from "vue";
|
|
2
|
+
import { KunNumberFieldProps as H } from "../composables/KunNumberFieldProps.js";
|
|
3
|
+
import { useKunNumberField as L } from "../composables/useKunNumberFieldComposable.js";
|
|
4
|
+
const q = { class: "w-full flex flex-col relative" }, G = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "h-full"
|
|
7
|
-
},
|
|
7
|
+
}, J = ["disabled"], O = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "mr-2"
|
|
10
|
-
},
|
|
10
|
+
}, Q = {
|
|
11
11
|
key: 2,
|
|
12
12
|
class: "flex items-center justify-center min-w-[32px] h-full px-1"
|
|
13
|
-
},
|
|
13
|
+
}, R = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], T = ["disabled"], U = {
|
|
14
14
|
key: 0,
|
|
15
15
|
class: "flex items-center h-full"
|
|
16
|
-
},
|
|
16
|
+
}, W = ["disabled"], X = ["disabled"], Y = {
|
|
17
17
|
key: 1,
|
|
18
18
|
class: "flex flex-col items-center justify-center border-l border-slate-600"
|
|
19
|
-
},
|
|
19
|
+
}, Z = ["disabled"], _ = ["disabled"], ee = {
|
|
20
20
|
key: 5,
|
|
21
|
-
class: "flex items-center justify-center min-w-[32px] h-full px-1
|
|
22
|
-
},
|
|
21
|
+
class: "flex items-center justify-center min-w-[32px] h-full px-1"
|
|
22
|
+
}, te = {
|
|
23
23
|
key: 6,
|
|
24
24
|
class: "h-full"
|
|
25
|
-
},
|
|
25
|
+
}, oe = ["disabled"], re = {
|
|
26
26
|
key: 7,
|
|
27
27
|
class: "ml-2"
|
|
28
|
-
},
|
|
28
|
+
}, se = {
|
|
29
29
|
key: 0,
|
|
30
30
|
class: "h-[1.25rem]"
|
|
31
|
-
},
|
|
31
|
+
}, le = {
|
|
32
32
|
key: 0,
|
|
33
33
|
class: "text-red-500 text-sm text-center"
|
|
34
|
-
},
|
|
34
|
+
}, ne = { key: 0 }, de = { key: 1 }, ie = {
|
|
35
35
|
key: 1,
|
|
36
36
|
class: "text-xs text-center"
|
|
37
|
-
},
|
|
37
|
+
}, be = {
|
|
38
38
|
__name: "KunNumberField",
|
|
39
|
-
props:
|
|
39
|
+
props: H,
|
|
40
40
|
emits: ["update:modelValue"],
|
|
41
|
-
setup(
|
|
42
|
-
const
|
|
43
|
-
y["append-icon"];
|
|
44
|
-
const {
|
|
41
|
+
setup(I, { emit: x }) {
|
|
42
|
+
const V = I, j = x, b = `number-input-${$().uid}`, y = D(), A = !!y["prepend-icon"], F = !!y["append-icon"], {
|
|
45
43
|
inputValue: c,
|
|
46
|
-
numberInput:
|
|
47
|
-
inputKey:
|
|
48
|
-
updateValue:
|
|
49
|
-
onIncrement:
|
|
44
|
+
numberInput: K,
|
|
45
|
+
inputKey: B,
|
|
46
|
+
updateValue: M,
|
|
47
|
+
onIncrement: i,
|
|
50
48
|
onDecrement: a,
|
|
51
|
-
onClear:
|
|
52
|
-
focus:
|
|
49
|
+
onClear: k,
|
|
50
|
+
focus: f,
|
|
53
51
|
handleFocus: h,
|
|
54
|
-
isActive:
|
|
52
|
+
isActive: N,
|
|
55
53
|
handleBlur: m
|
|
56
|
-
} =
|
|
54
|
+
} = L(V, j);
|
|
57
55
|
return (e, s) => {
|
|
58
|
-
const
|
|
59
|
-
return o(), l("div",
|
|
56
|
+
const v = z("KunIcon");
|
|
57
|
+
return o(), l("div", q, [
|
|
60
58
|
e.label ? (o(), l("label", {
|
|
61
59
|
key: 0,
|
|
62
60
|
for: b,
|
|
63
61
|
class: p([
|
|
64
62
|
e.labelColor,
|
|
65
63
|
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
66
|
-
t(
|
|
64
|
+
t(N) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
67
65
|
])
|
|
68
66
|
}, u(e.label), 3)) : n("", !0),
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
d("div", E({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
68
|
+
d("div", {
|
|
71
69
|
class: p(["flex items-center w-full h-full border", [
|
|
72
70
|
e.bgInput,
|
|
73
71
|
e.rounded,
|
|
74
|
-
t(
|
|
72
|
+
t(f) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
75
73
|
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
76
74
|
e.error ? "bg-red-200 dark:bg-red-900" : ""
|
|
77
75
|
]])
|
|
78
76
|
}, [
|
|
79
|
-
!e.noArrows && e.controlVariant === "split" ? (o(), l("div",
|
|
80
|
-
|
|
77
|
+
!e.noArrows && e.controlVariant === "split" ? (o(), l("div", G, [
|
|
78
|
+
d("button", {
|
|
81
79
|
type: "button",
|
|
82
80
|
class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
83
81
|
onClick: s[0] || (s[0] = (...r) => t(a) && t(a)(...r)),
|
|
84
82
|
disabled: e.disabled || e.readonly
|
|
85
|
-
}, "−", 8,
|
|
83
|
+
}, "−", 8, J)
|
|
86
84
|
])) : n("", !0),
|
|
87
|
-
e.prefix ? (o(), l("div",
|
|
88
|
-
e.prependIcon ||
|
|
89
|
-
e.prependIcon ? (o(),
|
|
85
|
+
e.prefix ? (o(), l("div", O, u(e.prefix), 1)) : n("", !0),
|
|
86
|
+
e.prependIcon || A ? (o(), l("div", Q, [
|
|
87
|
+
e.prependIcon ? (o(), g(v, { key: 0 })) : w(e.$slots, "prepend-icon", { key: 1 })
|
|
90
88
|
])) : n("", !0),
|
|
91
89
|
(o(), l("input", {
|
|
92
90
|
id: b,
|
|
93
91
|
ref_key: "numberInput",
|
|
94
|
-
ref:
|
|
95
|
-
key: t(
|
|
92
|
+
ref: K,
|
|
93
|
+
key: t(B),
|
|
96
94
|
type: "text",
|
|
97
95
|
value: t(c),
|
|
98
96
|
placeholder: e.placeholder,
|
|
@@ -102,76 +100,74 @@ const L = { class: "w-full flex flex-col relative" }, q = {
|
|
|
102
100
|
autocomplete: "off",
|
|
103
101
|
class: p(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
|
|
104
102
|
"aria-invalid": e.error ? "true" : "false",
|
|
105
|
-
onInput: s[1] || (s[1] = (r) => t(
|
|
103
|
+
onInput: s[1] || (s[1] = (r) => t(M)(r.target.value)),
|
|
106
104
|
onFocus: s[2] || (s[2] = (...r) => t(h) && t(h)(...r)),
|
|
107
105
|
onBlur: s[3] || (s[3] = (...r) => t(m) && t(m)(...r))
|
|
108
|
-
}, null, 42,
|
|
106
|
+
}, null, 42, R)),
|
|
109
107
|
e.clearable && t(c) != null ? (o(), l("button", {
|
|
110
108
|
key: 3,
|
|
111
109
|
type: "button",
|
|
112
|
-
onClick: s[4] || (s[4] = (...r) => t(
|
|
110
|
+
onClick: s[4] || (s[4] = (...r) => t(k) && t(k)(...r)),
|
|
113
111
|
class: p(["ml-2", e.textColor]),
|
|
114
112
|
disabled: e.disabled || e.readonly
|
|
115
|
-
}, " × ", 10,
|
|
116
|
-
e.noArrows ? n("", !0) : (o(), l(
|
|
117
|
-
e.controlVariant === "default" ? (o(), l("div",
|
|
118
|
-
|
|
113
|
+
}, " × ", 10, T)) : n("", !0),
|
|
114
|
+
e.noArrows ? n("", !0) : (o(), l(C, { key: 4 }, [
|
|
115
|
+
e.controlVariant === "default" ? (o(), l("div", U, [
|
|
116
|
+
d("button", {
|
|
119
117
|
type: "button",
|
|
120
118
|
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
121
|
-
onClick: s[5] || (s[5] = (...r) => t(
|
|
119
|
+
onClick: s[5] || (s[5] = (...r) => t(i) && t(i)(...r)),
|
|
122
120
|
disabled: e.disabled || e.readonly
|
|
123
|
-
}, " ▲ ", 8,
|
|
124
|
-
|
|
121
|
+
}, " ▲ ", 8, W),
|
|
122
|
+
d("button", {
|
|
125
123
|
type: "button",
|
|
126
124
|
class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
127
125
|
onClick: s[6] || (s[6] = (...r) => t(a) && t(a)(...r)),
|
|
128
126
|
disabled: e.disabled || e.readonly
|
|
129
|
-
}, " ▼ ", 8,
|
|
127
|
+
}, " ▼ ", 8, X)
|
|
130
128
|
])) : n("", !0),
|
|
131
|
-
e.controlVariant === "stacked" ? (o(), l("div",
|
|
132
|
-
|
|
129
|
+
e.controlVariant === "stacked" ? (o(), l("div", Y, [
|
|
130
|
+
d("div", {
|
|
133
131
|
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
134
|
-
onClick: s[7] || (s[7] = (...r) => t(
|
|
132
|
+
onClick: s[7] || (s[7] = (...r) => t(i) && t(i)(...r))
|
|
135
133
|
}, [
|
|
136
|
-
|
|
134
|
+
d("button", {
|
|
137
135
|
type: "button",
|
|
138
136
|
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
139
137
|
disabled: e.disabled || e.readonly
|
|
140
|
-
}, "▲", 8,
|
|
138
|
+
}, "▲", 8, Z)
|
|
141
139
|
]),
|
|
142
|
-
|
|
140
|
+
d("div", {
|
|
143
141
|
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
144
142
|
onClick: s[8] || (s[8] = (...r) => t(a) && t(a)(...r))
|
|
145
143
|
}, [
|
|
146
|
-
|
|
144
|
+
d("button", {
|
|
147
145
|
type: "button",
|
|
148
146
|
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
149
147
|
disabled: e.disabled || e.readonly
|
|
150
|
-
}, "▼", 8,
|
|
148
|
+
}, "▼", 8, _)
|
|
151
149
|
])
|
|
152
150
|
])) : n("", !0)
|
|
153
151
|
], 64)),
|
|
154
|
-
e.appendIcon ? (o(), l("div",
|
|
155
|
-
|
|
156
|
-
class: p(e.appendIcon)
|
|
157
|
-
}, null, 2)
|
|
152
|
+
e.appendIcon || F ? (o(), l("div", ee, [
|
|
153
|
+
e.appendIcon ? (o(), g(v, { key: 0 })) : w(e.$slots, "append-icon", { key: 1 })
|
|
158
154
|
])) : n("", !0),
|
|
159
|
-
!e.noArrows && e.controlVariant === "split" ? (o(), l("div",
|
|
160
|
-
|
|
155
|
+
!e.noArrows && e.controlVariant === "split" ? (o(), l("div", te, [
|
|
156
|
+
d("button", {
|
|
161
157
|
type: "button",
|
|
162
158
|
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
163
|
-
onClick: s[9] || (s[9] = (...r) => t(
|
|
159
|
+
onClick: s[9] || (s[9] = (...r) => t(i) && t(i)(...r)),
|
|
164
160
|
disabled: e.disabled || e.readonly
|
|
165
|
-
}, "+", 8,
|
|
161
|
+
}, "+", 8, oe)
|
|
166
162
|
])) : n("", !0),
|
|
167
163
|
e.suffix ? (o(), l("div", re, u(e.suffix), 1)) : n("", !0)
|
|
168
164
|
], 2),
|
|
169
|
-
e.hideDetails ? n("", !0) : (o(), l("div",
|
|
170
|
-
e.error || e.errorMessages ? (o(), l("div",
|
|
171
|
-
Array.isArray(e.errorMessages) ? (o(), l("div",
|
|
172
|
-
(o(!0), l(
|
|
173
|
-
])) : typeof e.errorMessages == "string" ? (o(), l("div",
|
|
174
|
-
])) : e.hint && (e.persistentHint || t(
|
|
165
|
+
e.hideDetails ? n("", !0) : (o(), l("div", se, [
|
|
166
|
+
e.error || e.errorMessages ? (o(), l("div", le, [
|
|
167
|
+
Array.isArray(e.errorMessages) ? (o(), l("div", ne, [
|
|
168
|
+
(o(!0), l(C, null, P(e.errorMessages, (r, S) => (o(), l("div", { key: S }, u(r), 1))), 128))
|
|
169
|
+
])) : typeof e.errorMessages == "string" ? (o(), l("div", de, u(e.errorMessages), 1)) : n("", !0)
|
|
170
|
+
])) : e.hint && (e.persistentHint || t(f)) ? (o(), l("div", ie, u(e.hint), 1)) : n("", !0)
|
|
175
171
|
]))
|
|
176
172
|
], 16)
|
|
177
173
|
]);
|
|
@@ -179,5 +175,5 @@ const L = { class: "w-full flex flex-col relative" }, q = {
|
|
|
179
175
|
}
|
|
180
176
|
};
|
|
181
177
|
export {
|
|
182
|
-
|
|
178
|
+
be as default
|
|
183
179
|
};
|