adverich-kun-ui 0.1.512 → 0.1.513
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,32 +1,31 @@
|
|
|
1
|
-
import { useAttrs as
|
|
2
|
-
import { kunTextareaProps as
|
|
3
|
-
import
|
|
1
|
+
import { useAttrs as ee, ref as oe, getCurrentInstance as ne, computed as a, createElementBlock as l, openBlock as r, mergeProps as A, renderSlot as d, createElementVNode as i, createCommentVNode as u, normalizeClass as b, toDisplayString as g, normalizeProps as R, guardReactiveProps as z, unref as t, createBlock as y, resolveDynamicComponent as m, Fragment as re, renderList as te, withDirectives as se, vShow as le, createTextVNode as ae } from "vue";
|
|
2
|
+
import { kunTextareaProps as de } from "../composables/KunTextareaProps.js";
|
|
3
|
+
import ie from "../composables/useKunTextareaComposable.js";
|
|
4
4
|
import { renderIconSlot as h } from "../../../../utils/renderIcon.js";
|
|
5
|
-
|
|
6
|
-
const ce = { class: "relative" }, ve = {
|
|
5
|
+
const ue = { class: "relative" }, pe = {
|
|
7
6
|
key: 0,
|
|
8
7
|
class: "absolute left-2 top-2 flex items-center"
|
|
9
|
-
},
|
|
8
|
+
}, ce = {
|
|
10
9
|
key: 1,
|
|
11
10
|
class: "absolute left-2 top-2 ml-1"
|
|
12
|
-
},
|
|
11
|
+
}, ve = ["value", "rows", "disabled", "readonly", "placeholder"], fe = {
|
|
13
12
|
key: 3,
|
|
14
13
|
class: "absolute right-2 top-2 mr-1"
|
|
15
|
-
},
|
|
14
|
+
}, be = {
|
|
16
15
|
key: 4,
|
|
17
16
|
class: "absolute right-2 top-2 flex items-center"
|
|
18
|
-
},
|
|
17
|
+
}, ge = {
|
|
19
18
|
key: 5,
|
|
20
19
|
class: "mt-1"
|
|
21
|
-
},
|
|
20
|
+
}, ye = { class: "h-1 w-full bg-field-background rounded overflow-hidden" }, me = {
|
|
22
21
|
key: 7,
|
|
23
22
|
class: "text-xs text-right mt-1 text-gray-400"
|
|
24
|
-
},
|
|
23
|
+
}, he = { key: 0 }, $e = {
|
|
25
24
|
__name: "KunTextarea",
|
|
26
|
-
props: { ...
|
|
25
|
+
props: { ...de },
|
|
27
26
|
emits: ["update:modelValue", "click:clear", "click:control", "update:focused", "mousedown:control"],
|
|
28
|
-
setup(
|
|
29
|
-
const o =
|
|
27
|
+
setup(D, { expose: M, emit: F }) {
|
|
28
|
+
const o = D, k = F, G = ee(), p = oe(null), B = `textarea-${ne().uid}`, {
|
|
30
29
|
isFocused: c,
|
|
31
30
|
internalValue: v,
|
|
32
31
|
updateModel: P,
|
|
@@ -37,13 +36,12 @@ const ce = { class: "relative" }, ve = {
|
|
|
37
36
|
hasError: f,
|
|
38
37
|
displayedMessages: C,
|
|
39
38
|
adjustHeight: H
|
|
40
|
-
} =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, 100), K = () => {
|
|
39
|
+
} = ie(o, k, p), L = (e) => {
|
|
40
|
+
const n = e.target.value;
|
|
41
|
+
v.value = n, P(n), o.autoGrow && H();
|
|
42
|
+
}, j = () => {
|
|
45
43
|
c.value = !0, k("update:focused", !0);
|
|
46
|
-
},
|
|
44
|
+
}, K = () => {
|
|
47
45
|
c.value = !1, k("update:focused", !1);
|
|
48
46
|
}, V = a(() => c.value || !!v.value || o.dirty), w = a(() => typeof v.value == "string" ? v.value.length : 0), I = a(() => o.counter === !0 ? 25 : o.counter || null), q = a(() => o.persistentCounter || o.counter && c.value), J = a(() => ["relative w-full flex flex-col", o.class, o.wrapperClass]), O = a(
|
|
49
47
|
() => o.persistentClear ? "opacity-100" : "hover:opacity-100 opacity-0 transition-opacity duration-200"
|
|
@@ -61,9 +59,9 @@ const ce = { class: "relative" }, ve = {
|
|
|
61
59
|
default:
|
|
62
60
|
return "";
|
|
63
61
|
}
|
|
64
|
-
}),
|
|
62
|
+
}), U = a(
|
|
65
63
|
() => o.density === "compact" ? "p-1" : o.density === "comfortable" ? "p-2" : "p-3"
|
|
66
|
-
),
|
|
64
|
+
), W = a(() => [
|
|
67
65
|
"w-full resize-none p-2 transition-colors duration-150",
|
|
68
66
|
o.inputClass,
|
|
69
67
|
{
|
|
@@ -82,8 +80,8 @@ const ce = { class: "relative" }, ve = {
|
|
|
82
80
|
resize: !o.noResize && !o.autoGrow
|
|
83
81
|
},
|
|
84
82
|
Q.value,
|
|
85
|
-
|
|
86
|
-
]),
|
|
83
|
+
U.value
|
|
84
|
+
]), X = {
|
|
87
85
|
label: o.label,
|
|
88
86
|
isFocused: c,
|
|
89
87
|
isActive: V,
|
|
@@ -110,11 +108,11 @@ const ce = { class: "relative" }, ve = {
|
|
|
110
108
|
return (e = p.value) == null ? void 0 : e.blur();
|
|
111
109
|
},
|
|
112
110
|
props: o
|
|
113
|
-
},
|
|
111
|
+
}, Y = $, Z = $, x = a(() => {
|
|
114
112
|
const { class: e, ...n } = G;
|
|
115
113
|
return n;
|
|
116
114
|
});
|
|
117
|
-
return
|
|
115
|
+
return M({
|
|
118
116
|
validate: T,
|
|
119
117
|
reset: E,
|
|
120
118
|
resetValidation: N,
|
|
@@ -125,20 +123,20 @@ const ce = { class: "relative" }, ve = {
|
|
|
125
123
|
return (e = p.value) == null ? void 0 : e.focus();
|
|
126
124
|
},
|
|
127
125
|
rootRef: p
|
|
128
|
-
}), (e, n) => (r(), l("div",
|
|
126
|
+
}), (e, n) => (r(), l("div", A({
|
|
129
127
|
class: J.value,
|
|
130
128
|
ref: "rootRef"
|
|
131
|
-
},
|
|
132
|
-
d(e.$slots, "label",
|
|
129
|
+
}, x.value), [
|
|
130
|
+
d(e.$slots, "label", A({ for: B }, X), () => [
|
|
133
131
|
e.label ? (r(), l("label", {
|
|
134
132
|
key: 0,
|
|
135
133
|
for: B,
|
|
136
134
|
class: b(["absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10", V.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"])
|
|
137
135
|
}, g(e.label), 3)) : u("", !0)
|
|
138
136
|
]),
|
|
139
|
-
i("div",
|
|
140
|
-
e.prependIcon || e.$slots.prepend ? (r(), l("div",
|
|
141
|
-
d(e.$slots, "prepend", R(z(t(
|
|
137
|
+
i("div", ue, [
|
|
138
|
+
e.prependIcon || e.$slots.prepend ? (r(), l("div", pe, [
|
|
139
|
+
d(e.$slots, "prepend", R(z(t(Y))), () => [
|
|
142
140
|
i("div", {
|
|
143
141
|
onClick: n[0] || (n[0] = (s) => e.handleIconClick(s, "prepend"))
|
|
144
142
|
}, [
|
|
@@ -146,7 +144,7 @@ const ce = { class: "relative" }, ve = {
|
|
|
146
144
|
])
|
|
147
145
|
])
|
|
148
146
|
])) : u("", !0),
|
|
149
|
-
e.prependInnerIcon || e.$slots["prepend-inner"] ? (r(), l("div",
|
|
147
|
+
e.prependInnerIcon || e.$slots["prepend-inner"] ? (r(), l("div", ce, [
|
|
150
148
|
d(e.$slots, "prepend-inner", {}, () => [
|
|
151
149
|
i("div", {
|
|
152
150
|
onClick: n[1] || (n[1] = (s) => e.handleIconClick(s, "prependInner"))
|
|
@@ -164,13 +162,13 @@ const ce = { class: "relative" }, ve = {
|
|
|
164
162
|
readonly: e.readonly,
|
|
165
163
|
placeholder: e.placeholder,
|
|
166
164
|
onInput: L,
|
|
167
|
-
onFocus:
|
|
168
|
-
onBlur:
|
|
165
|
+
onFocus: j,
|
|
166
|
+
onBlur: K,
|
|
169
167
|
onClick: n[2] || (n[2] = (s) => e.$emit("click:control", s)),
|
|
170
168
|
onMousedown: n[3] || (n[3] = (s) => e.$emit("mousedown:control", s)),
|
|
171
|
-
class: b(["bg-field-background", [
|
|
169
|
+
class: b(["bg-field-background", [W.value]]),
|
|
172
170
|
style: { width: "100%", "box-sizing": "border-box", "overflow-y": "hidden" }
|
|
173
|
-
}, null, 42,
|
|
171
|
+
}, null, 42, ve),
|
|
174
172
|
e.clearable && t(v) ? (r(), l("div", {
|
|
175
173
|
key: 2,
|
|
176
174
|
class: b(["absolute right-2 top-2", O.value])
|
|
@@ -185,7 +183,7 @@ const ce = { class: "relative" }, ve = {
|
|
|
185
183
|
])
|
|
186
184
|
])
|
|
187
185
|
], 2)) : u("", !0),
|
|
188
|
-
e.appendInnerIcon || e.$slots["append-inner"] ? (r(), l("div",
|
|
186
|
+
e.appendInnerIcon || e.$slots["append-inner"] ? (r(), l("div", fe, [
|
|
189
187
|
d(e.$slots, "append-inner", {}, () => [
|
|
190
188
|
i("div", {
|
|
191
189
|
onClick: n[5] || (n[5] = (s) => e.handleIconClick(s, "appendInner"))
|
|
@@ -194,8 +192,8 @@ const ce = { class: "relative" }, ve = {
|
|
|
194
192
|
])
|
|
195
193
|
])
|
|
196
194
|
])) : u("", !0),
|
|
197
|
-
e.appendIcon || e.$slots.append ? (r(), l("div",
|
|
198
|
-
d(e.$slots, "append", R(z(t(
|
|
195
|
+
e.appendIcon || e.$slots.append ? (r(), l("div", be, [
|
|
196
|
+
d(e.$slots, "append", R(z(t(Z))), () => [
|
|
199
197
|
i("div", {
|
|
200
198
|
onClick: n[6] || (n[6] = (s) => e.handleIconClick(s, "append"))
|
|
201
199
|
}, [
|
|
@@ -203,12 +201,12 @@ const ce = { class: "relative" }, ve = {
|
|
|
203
201
|
])
|
|
204
202
|
])
|
|
205
203
|
])) : u("", !0),
|
|
206
|
-
e.loading ? (r(), l("div",
|
|
204
|
+
e.loading ? (r(), l("div", ge, [
|
|
207
205
|
d(e.$slots, "loader", {
|
|
208
206
|
color: e.loadingColor,
|
|
209
207
|
isActive: !0
|
|
210
208
|
}, () => [
|
|
211
|
-
i("div",
|
|
209
|
+
i("div", ye, [
|
|
212
210
|
i("div", {
|
|
213
211
|
class: b(["h-full transition-all duration-300", [e.loadingColor]]),
|
|
214
212
|
style: { width: "100%" }
|
|
@@ -221,8 +219,8 @@ const ce = { class: "relative" }, ve = {
|
|
|
221
219
|
class: b(["text-xs mt-1 space-y-1", { "text-red-500": t(f), "text-gray-500": !t(f) }])
|
|
222
220
|
}, [
|
|
223
221
|
d(e.$slots, "details", {}, () => [
|
|
224
|
-
t(f) ? (r(!0), l(
|
|
225
|
-
key:
|
|
222
|
+
t(f) ? (r(!0), l(re, { key: 0 }, te(t(C), (s, _) => d(e.$slots, "message", {
|
|
223
|
+
key: _,
|
|
226
224
|
message: s
|
|
227
225
|
}, () => [
|
|
228
226
|
i("div", null, g(s), 1)
|
|
@@ -230,20 +228,20 @@ const ce = { class: "relative" }, ve = {
|
|
|
230
228
|
key: 1,
|
|
231
229
|
hint: e.hint
|
|
232
230
|
}, () => [
|
|
233
|
-
|
|
234
|
-
[
|
|
231
|
+
se(i("div", null, g(e.hint), 513), [
|
|
232
|
+
[le, e.persistentHint || t(c)]
|
|
235
233
|
])
|
|
236
234
|
]) : u("", !0)
|
|
237
235
|
])
|
|
238
236
|
], 2)) : u("", !0),
|
|
239
|
-
q.value ? (r(), l("div",
|
|
237
|
+
q.value ? (r(), l("div", me, [
|
|
240
238
|
d(e.$slots, "counter", {
|
|
241
239
|
counter: w.value,
|
|
242
240
|
max: I.value,
|
|
243
241
|
value: w.value
|
|
244
242
|
}, () => [
|
|
245
|
-
|
|
246
|
-
I.value ? (r(), l("span",
|
|
243
|
+
ae(g(w.value), 1),
|
|
244
|
+
I.value ? (r(), l("span", he, " / " + g(I.value), 1)) : u("", !0)
|
|
247
245
|
])
|
|
248
246
|
])) : u("", !0)
|
|
249
247
|
])
|
|
@@ -251,5 +249,5 @@ const ce = { class: "relative" }, ve = {
|
|
|
251
249
|
}
|
|
252
250
|
};
|
|
253
251
|
export {
|
|
254
|
-
|
|
252
|
+
$e as default
|
|
255
253
|
};
|