adverich-kun-ui 0.1.330 → 0.1.331
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,45 +1,46 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { kunTextareaProps as
|
|
3
|
-
import { useKunTextarea as
|
|
1
|
+
import { ref as q, computed as p, createElementBlock as l, openBlock as s, normalizeClass as m, renderSlot as i, createElementVNode as a, normalizeProps as y, guardReactiveProps as k, unref as t, createCommentVNode as d, toDisplayString as b, createBlock as h, resolveDynamicComponent as C, Fragment as J, renderList as O, withDirectives as Q, vShow as U, createTextVNode as W } from "vue";
|
|
2
|
+
import { kunTextareaProps as X } from "../composables/KunTextareaProps.js";
|
|
3
|
+
import { useKunTextarea as Y } from "../composables/useKunTextareaComposable.js";
|
|
4
4
|
import { renderIconSlot as $ } from "../../../../utils/renderIcon.js";
|
|
5
|
-
const
|
|
5
|
+
const Z = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "block text-sm font-medium mb-1"
|
|
8
|
-
},
|
|
8
|
+
}, x = { class: "relative" }, _ = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "absolute left-2 top-2 flex items-center"
|
|
11
|
-
},
|
|
11
|
+
}, ee = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "absolute left-2 top-2 ml-1"
|
|
14
|
-
},
|
|
14
|
+
}, oe = ["value", "rows", "disabled", "readonly", "placeholder"], re = {
|
|
15
15
|
key: 3,
|
|
16
16
|
class: "absolute right-2 top-2 mr-1"
|
|
17
|
-
},
|
|
17
|
+
}, te = {
|
|
18
18
|
key: 4,
|
|
19
19
|
class: "absolute right-2 top-2 flex items-center"
|
|
20
|
-
},
|
|
20
|
+
}, ne = {
|
|
21
21
|
key: 5,
|
|
22
22
|
class: "mt-1"
|
|
23
|
-
},
|
|
23
|
+
}, se = { class: "h-1 w-full bg-gray-200 rounded overflow-hidden" }, le = {
|
|
24
24
|
key: 7,
|
|
25
25
|
class: "text-xs text-right mt-1 text-gray-400"
|
|
26
|
-
},
|
|
26
|
+
}, ae = { key: 0 }, ce = {
|
|
27
27
|
__name: "KunTextarea",
|
|
28
|
-
props:
|
|
28
|
+
props: X,
|
|
29
29
|
emits: ["update:modelValue", "click:clear", "click:control", "update:focused", "mousedown:control"],
|
|
30
|
-
setup(
|
|
31
|
-
const o =
|
|
30
|
+
setup(B, { expose: S, emit: D }) {
|
|
31
|
+
const o = B, R = D, u = q(null), {
|
|
32
32
|
isFocused: v,
|
|
33
33
|
internalValue: c,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
rootRef: V,
|
|
35
|
+
updateValue: F,
|
|
36
|
+
handleClear: z,
|
|
37
|
+
adjustHeight: M,
|
|
38
|
+
validate: T,
|
|
39
|
+
reset: A,
|
|
40
|
+
resetValidation: E,
|
|
40
41
|
hasError: f,
|
|
41
42
|
displayedMessages: w
|
|
42
|
-
} =
|
|
43
|
+
} = Y(o, R, u), G = p(() => {
|
|
43
44
|
const e = !!o.bgColor;
|
|
44
45
|
switch (o.variant) {
|
|
45
46
|
case "filled":
|
|
@@ -59,7 +60,7 @@ const Y = {
|
|
|
59
60
|
default:
|
|
60
61
|
return "";
|
|
61
62
|
}
|
|
62
|
-
}),
|
|
63
|
+
}), N = p(() => {
|
|
63
64
|
switch (o.density) {
|
|
64
65
|
case "comfortable":
|
|
65
66
|
return "py-2";
|
|
@@ -68,7 +69,7 @@ const Y = {
|
|
|
68
69
|
default:
|
|
69
70
|
return "";
|
|
70
71
|
}
|
|
71
|
-
}),
|
|
72
|
+
}), P = p(() => [
|
|
72
73
|
"w-full resize-none p-2 transition-colors duration-150",
|
|
73
74
|
o.inputClass,
|
|
74
75
|
{
|
|
@@ -86,28 +87,29 @@ const Y = {
|
|
|
86
87
|
"resize-none": o.noResize || o.autoGrow,
|
|
87
88
|
resize: !o.noResize && !o.autoGrow
|
|
88
89
|
}
|
|
89
|
-
]),
|
|
90
|
+
]), H = p(() => [
|
|
90
91
|
"relative w-full",
|
|
91
92
|
o.class,
|
|
92
93
|
o.wrapperClass
|
|
93
|
-
]), I = p(() => o.counter === !0 ? 25 : typeof o.counter == "number" || typeof o.counter == "string" ? o.counter : null),
|
|
94
|
+
]), I = p(() => o.counter === !0 ? 25 : typeof o.counter == "number" || typeof o.counter == "string" ? o.counter : null), K = p(() => o.persistentCounter ? !0 : !!o.counter && v.value), j = p(() => typeof o.clearIcon == "string" ? o.clearIcon : "i-heroicons-x-mark-20-solid");
|
|
94
95
|
function g(e, n) {
|
|
95
96
|
R(`click:${n}`, e);
|
|
96
97
|
}
|
|
97
|
-
return
|
|
98
|
-
validate:
|
|
99
|
-
reset:
|
|
100
|
-
resetValidation:
|
|
98
|
+
return S({
|
|
99
|
+
validate: T,
|
|
100
|
+
reset: A,
|
|
101
|
+
resetValidation: E,
|
|
101
102
|
errorMessages: w,
|
|
102
103
|
isValid: p(() => !f.value),
|
|
103
|
-
rootRef,
|
|
104
|
+
rootRef: V,
|
|
104
105
|
focus: () => {
|
|
105
106
|
var e;
|
|
106
107
|
return (e = u.value) == null ? void 0 : e.focus();
|
|
107
108
|
}
|
|
108
109
|
}), (e, n) => (s(), l("div", {
|
|
109
|
-
class: m(
|
|
110
|
-
|
|
110
|
+
class: m(H.value),
|
|
111
|
+
ref_key: "rootRef",
|
|
112
|
+
ref: V
|
|
111
113
|
}, [
|
|
112
114
|
i(e.$slots, "label", y(k({ label: e.label, isFocused: t(v), isActive: !!t(c), controlRef: u.value, focus: () => {
|
|
113
115
|
var r;
|
|
@@ -116,10 +118,10 @@ const Y = {
|
|
|
116
118
|
var r;
|
|
117
119
|
return (r = u.value) == null ? void 0 : r.blur();
|
|
118
120
|
}, props: o })), () => [
|
|
119
|
-
e.label ? (s(), l("label",
|
|
121
|
+
e.label ? (s(), l("label", Z, b(e.label), 1)) : d("", !0)
|
|
120
122
|
]),
|
|
121
|
-
a("div",
|
|
122
|
-
e.prependIcon || e.$slots.prepend ? (s(), l("div",
|
|
123
|
+
a("div", x, [
|
|
124
|
+
e.prependIcon || e.$slots.prepend ? (s(), l("div", _, [
|
|
123
125
|
i(e.$slots, "prepend", y(k(e.prependSlotBindings)), () => [
|
|
124
126
|
a("div", {
|
|
125
127
|
onClick: n[0] || (n[0] = (r) => g(r, "prepend"))
|
|
@@ -128,7 +130,7 @@ const Y = {
|
|
|
128
130
|
])
|
|
129
131
|
])
|
|
130
132
|
])) : d("", !0),
|
|
131
|
-
e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div",
|
|
133
|
+
e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div", ee, [
|
|
132
134
|
i(e.$slots, "prepend-inner", {}, () => [
|
|
133
135
|
a("div", {
|
|
134
136
|
onClick: n[1] || (n[1] = (r) => g(r, "prependInner"))
|
|
@@ -146,7 +148,7 @@ const Y = {
|
|
|
146
148
|
readonly: e.readonly,
|
|
147
149
|
placeholder: e.placeholder,
|
|
148
150
|
onInput: n[2] || (n[2] = (r) => {
|
|
149
|
-
t(
|
|
151
|
+
t(F)(r.target.value), e.autoGrow && t(M)();
|
|
150
152
|
}),
|
|
151
153
|
onFocus: n[3] || (n[3] = (r) => {
|
|
152
154
|
v.value = !0, e.$emit("update:focused", !0);
|
|
@@ -156,8 +158,8 @@ const Y = {
|
|
|
156
158
|
}),
|
|
157
159
|
onClick: n[5] || (n[5] = (r) => e.$emit("click:control", r)),
|
|
158
160
|
onMousedown: n[6] || (n[6] = (r) => e.$emit("mousedown:control", r)),
|
|
159
|
-
class: m([
|
|
160
|
-
}, null, 42,
|
|
161
|
+
class: m([G.value, N.value, P.value])
|
|
162
|
+
}, null, 42, oe),
|
|
161
163
|
e.clearable && t(c) ? (s(), l("div", {
|
|
162
164
|
key: 2,
|
|
163
165
|
class: m(["absolute right-2 top-2", { "opacity-100": e.persistentClear, "hover:opacity-100 opacity-0 transition-opacity duration-200": !e.persistentClear }])
|
|
@@ -171,16 +173,16 @@ const Y = {
|
|
|
171
173
|
}, props: o })), () => [
|
|
172
174
|
a("button", {
|
|
173
175
|
type: "button",
|
|
174
|
-
onClick: n[7] || (n[7] = (...r) => t(
|
|
176
|
+
onClick: n[7] || (n[7] = (...r) => t(z) && t(z)(...r)),
|
|
175
177
|
class: "text-gray-500 hover:text-gray-700"
|
|
176
178
|
}, [
|
|
177
179
|
a("span", {
|
|
178
|
-
class: m(
|
|
180
|
+
class: m(j.value)
|
|
179
181
|
}, null, 2)
|
|
180
182
|
])
|
|
181
183
|
])
|
|
182
184
|
], 2)) : d("", !0),
|
|
183
|
-
e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div",
|
|
185
|
+
e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div", re, [
|
|
184
186
|
i(e.$slots, "append-inner", {}, () => [
|
|
185
187
|
a("div", {
|
|
186
188
|
onClick: n[8] || (n[8] = (r) => g(r, "appendInner"))
|
|
@@ -189,7 +191,7 @@ const Y = {
|
|
|
189
191
|
])
|
|
190
192
|
])
|
|
191
193
|
])) : d("", !0),
|
|
192
|
-
e.appendIcon || e.$slots.append ? (s(), l("div",
|
|
194
|
+
e.appendIcon || e.$slots.append ? (s(), l("div", te, [
|
|
193
195
|
i(e.$slots, "append", y(k(e.appendSlotBindings)), () => [
|
|
194
196
|
a("div", {
|
|
195
197
|
onClick: n[9] || (n[9] = (r) => g(r, "append"))
|
|
@@ -198,12 +200,12 @@ const Y = {
|
|
|
198
200
|
])
|
|
199
201
|
])
|
|
200
202
|
])) : d("", !0),
|
|
201
|
-
e.loading ? (s(), l("div",
|
|
203
|
+
e.loading ? (s(), l("div", ne, [
|
|
202
204
|
i(e.$slots, "loader", {
|
|
203
205
|
color: e.loadingColor,
|
|
204
206
|
isActive: !0
|
|
205
207
|
}, () => [
|
|
206
|
-
a("div",
|
|
208
|
+
a("div", se, [
|
|
207
209
|
a("div", {
|
|
208
210
|
class: m(["h-full transition-all duration-300", [`${e.loadingColor}`]]),
|
|
209
211
|
style: { width: "100%" }
|
|
@@ -216,8 +218,8 @@ const Y = {
|
|
|
216
218
|
class: m(["text-xs mt-1 space-y-1", { "text-red-500": t(f), "text-gray-500": !t(f) }])
|
|
217
219
|
}, [
|
|
218
220
|
i(e.$slots, "details", {}, () => [
|
|
219
|
-
t(f) ? (s(!0), l(
|
|
220
|
-
key:
|
|
221
|
+
t(f) ? (s(!0), l(J, { key: 0 }, O(t(w), (r, L) => i(e.$slots, "message", {
|
|
222
|
+
key: L,
|
|
221
223
|
message: r
|
|
222
224
|
}, () => [
|
|
223
225
|
a("div", null, b(r), 1)
|
|
@@ -225,20 +227,20 @@ const Y = {
|
|
|
225
227
|
key: 1,
|
|
226
228
|
hint: e.hint
|
|
227
229
|
}, () => [
|
|
228
|
-
|
|
229
|
-
[
|
|
230
|
+
Q(a("div", null, b(e.hint), 513), [
|
|
231
|
+
[U, e.persistentHint || t(v)]
|
|
230
232
|
])
|
|
231
233
|
]) : d("", !0)
|
|
232
234
|
])
|
|
233
235
|
], 2)) : d("", !0),
|
|
234
|
-
|
|
236
|
+
K.value ? (s(), l("div", le, [
|
|
235
237
|
i(e.$slots, "counter", {
|
|
236
238
|
counter: t(c).length,
|
|
237
239
|
max: I.value,
|
|
238
240
|
value: t(c).length
|
|
239
241
|
}, () => [
|
|
240
|
-
|
|
241
|
-
I.value ? (s(), l("span",
|
|
242
|
+
W(b(t(c).length), 1),
|
|
243
|
+
I.value ? (s(), l("span", ae, " / " + b(I.value), 1)) : d("", !0)
|
|
242
244
|
])
|
|
243
245
|
])) : d("", !0)
|
|
244
246
|
])
|
|
@@ -246,5 +248,5 @@ const Y = {
|
|
|
246
248
|
}
|
|
247
249
|
};
|
|
248
250
|
export {
|
|
249
|
-
|
|
251
|
+
ce as default
|
|
250
252
|
};
|