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