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