adverich-kun-ui 0.1.120 → 0.1.122
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,179 @@
|
|
|
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
|
-
inputValue:
|
|
44
|
-
numberInput:
|
|
45
|
-
inputKey:
|
|
46
|
-
updateValue:
|
|
47
|
-
onIncrement:
|
|
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"], {
|
|
43
|
+
inputValue: c,
|
|
44
|
+
numberInput: K,
|
|
45
|
+
inputKey: B,
|
|
46
|
+
updateValue: M,
|
|
47
|
+
onIncrement: i,
|
|
48
48
|
onDecrement: a,
|
|
49
|
-
onClear:
|
|
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
|
-
class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
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),
|
|
49
|
+
onClear: k,
|
|
50
|
+
focus: f,
|
|
51
|
+
handleFocus: h,
|
|
52
|
+
isActive: N,
|
|
53
|
+
handleBlur: m
|
|
54
|
+
} = L(V, j);
|
|
55
|
+
return (e, s) => {
|
|
56
|
+
const v = z("KunIcon");
|
|
57
|
+
return o(), l("div", q, [
|
|
58
|
+
e.label ? (o(), l("label", {
|
|
59
|
+
key: 0,
|
|
60
|
+
for: b,
|
|
61
|
+
class: p([
|
|
62
|
+
e.labelColor,
|
|
63
|
+
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
64
|
+
t(N) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
65
|
+
])
|
|
66
|
+
}, u(e.label), 3)) : n("", !0),
|
|
67
|
+
d("div", E({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
68
|
+
d("div", {
|
|
69
|
+
class: p(["flex items-center w-full h-full border", [
|
|
70
|
+
e.bgInput,
|
|
71
|
+
e.rounded,
|
|
72
|
+
t(f) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
73
|
+
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
74
|
+
e.error ? "bg-red-200 dark:bg-red-900" : ""
|
|
75
|
+
]])
|
|
76
|
+
}, [
|
|
77
|
+
!e.noArrows && e.controlVariant === "split" ? (o(), l("div", G, [
|
|
122
78
|
d("button", {
|
|
123
79
|
type: "button",
|
|
124
|
-
class: "
|
|
125
|
-
onClick:
|
|
80
|
+
class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
81
|
+
onClick: s[0] || (s[0] = (...r) => t(a) && t(a)(...r)),
|
|
126
82
|
disabled: e.disabled || e.readonly
|
|
127
|
-
}, "
|
|
128
|
-
])) :
|
|
129
|
-
e.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
83
|
+
}, "−", 8, J)
|
|
84
|
+
])) : n("", !0),
|
|
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 })
|
|
88
|
+
])) : n("", !0),
|
|
89
|
+
(o(), l("input", {
|
|
90
|
+
id: b,
|
|
91
|
+
ref_key: "numberInput",
|
|
92
|
+
ref: K,
|
|
93
|
+
key: t(B),
|
|
94
|
+
type: "text",
|
|
95
|
+
value: t(c),
|
|
96
|
+
placeholder: e.placeholder,
|
|
97
|
+
readonly: e.readonly,
|
|
98
|
+
disabled: e.disabled,
|
|
99
|
+
maxlength: e.maxlength,
|
|
100
|
+
autocomplete: "off",
|
|
101
|
+
class: p(["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: s[1] || (s[1] = (r) => t(M)(r.target.value)),
|
|
104
|
+
onFocus: s[2] || (s[2] = (...r) => t(h) && t(h)(...r)),
|
|
105
|
+
onBlur: s[3] || (s[3] = (...r) => t(m) && t(m)(...r))
|
|
106
|
+
}, null, 42, R)),
|
|
107
|
+
e.clearable && t(c) != null ? (o(), l("button", {
|
|
108
|
+
key: 3,
|
|
109
|
+
type: "button",
|
|
110
|
+
onClick: s[4] || (s[4] = (...r) => t(k) && t(k)(...r)),
|
|
111
|
+
class: p(["ml-2", e.textColor]),
|
|
112
|
+
disabled: e.disabled || e.readonly
|
|
113
|
+
}, " × ", 10, T)) : n("", !0),
|
|
114
|
+
e.noArrows ? n("", !0) : (o(), l(C, { key: 4 }, [
|
|
115
|
+
e.controlVariant === "default" ? (o(), l("div", U, [
|
|
134
116
|
d("button", {
|
|
135
117
|
type: "button",
|
|
136
|
-
class: "
|
|
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: s[5] || (s[5] = (...r) => t(i) && t(i)(...r)),
|
|
137
120
|
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
|
-
}, [
|
|
121
|
+
}, " ▲ ", 8, W),
|
|
144
122
|
d("button", {
|
|
145
123
|
type: "button",
|
|
146
|
-
class: "
|
|
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",
|
|
125
|
+
onClick: s[6] || (s[6] = (...r) => t(a) && t(a)(...r)),
|
|
147
126
|
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
|
-
|
|
127
|
+
}, " ▼ ", 8, X)
|
|
128
|
+
])) : n("", !0),
|
|
129
|
+
e.controlVariant === "stacked" ? (o(), l("div", Y, [
|
|
130
|
+
d("div", {
|
|
131
|
+
class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
132
|
+
onClick: s[7] || (s[7] = (...r) => t(i) && t(i)(...r))
|
|
133
|
+
}, [
|
|
134
|
+
d("button", {
|
|
135
|
+
type: "button",
|
|
136
|
+
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
137
|
+
disabled: e.disabled || e.readonly
|
|
138
|
+
}, "▲", 8, Z)
|
|
139
|
+
]),
|
|
140
|
+
d("div", {
|
|
141
|
+
class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
|
|
142
|
+
onClick: s[8] || (s[8] = (...r) => t(a) && t(a)(...r))
|
|
143
|
+
}, [
|
|
144
|
+
d("button", {
|
|
145
|
+
type: "button",
|
|
146
|
+
class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
|
|
147
|
+
disabled: e.disabled || e.readonly
|
|
148
|
+
}, "▼", 8, _)
|
|
149
|
+
])
|
|
150
|
+
])) : n("", !0)
|
|
151
|
+
], 64)),
|
|
152
|
+
e.appendIcon || F ? (o(), l("div", ee, [
|
|
153
|
+
e.appendIcon ? (o(), g(v, { key: 0 })) : w(e.$slots, "append-icon", { key: 1 })
|
|
154
|
+
])) : n("", !0),
|
|
155
|
+
!e.noArrows && e.controlVariant === "split" ? (o(), l("div", te, [
|
|
156
|
+
d("button", {
|
|
157
|
+
type: "button",
|
|
158
|
+
class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
|
|
159
|
+
onClick: s[9] || (s[9] = (...r) => t(i) && t(i)(...r)),
|
|
160
|
+
disabled: e.disabled || e.readonly
|
|
161
|
+
}, "+", 8, oe)
|
|
162
|
+
])) : n("", !0),
|
|
163
|
+
e.suffix ? (o(), l("div", re, u(e.suffix), 1)) : n("", !0)
|
|
164
|
+
], 2),
|
|
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)
|
|
171
|
+
]))
|
|
172
|
+
], 16)
|
|
173
|
+
]);
|
|
174
|
+
};
|
|
176
175
|
}
|
|
177
176
|
};
|
|
178
177
|
export {
|
|
179
|
-
|
|
178
|
+
be as default
|
|
180
179
|
};
|