adverich-kun-ui 0.1.331 → 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,48 +1,48 @@
|
|
|
1
|
-
import { ref as q, computed as p, createElementBlock as l, openBlock as s,
|
|
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
|
-
}, oe = ["value", "rows", "disabled", "readonly", "placeholder"],
|
|
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
30
|
setup(B, { expose: S, emit: D }) {
|
|
31
|
-
const
|
|
31
|
+
const r = B, R = D, u = q(null), {
|
|
32
32
|
isFocused: v,
|
|
33
33
|
internalValue: c,
|
|
34
34
|
rootRef: V,
|
|
35
35
|
updateValue: F,
|
|
36
36
|
handleClear: z,
|
|
37
37
|
adjustHeight: M,
|
|
38
|
-
validate:
|
|
39
|
-
reset:
|
|
40
|
-
resetValidation:
|
|
38
|
+
validate: P,
|
|
39
|
+
reset: T,
|
|
40
|
+
resetValidation: A,
|
|
41
41
|
hasError: f,
|
|
42
42
|
displayedMessages: w
|
|
43
|
-
} =
|
|
44
|
-
const e = !!
|
|
45
|
-
switch (
|
|
43
|
+
} = Z(r, R, u), E = p(() => {
|
|
44
|
+
const e = !!r.bgColor;
|
|
45
|
+
switch (r.variant) {
|
|
46
46
|
case "filled":
|
|
47
47
|
return [
|
|
48
48
|
e ? "" : "bg-gray-100 dark:bg-gray-900",
|
|
@@ -60,8 +60,8 @@ const Z = {
|
|
|
60
60
|
default:
|
|
61
61
|
return "";
|
|
62
62
|
}
|
|
63
|
-
}),
|
|
64
|
-
switch (
|
|
63
|
+
}), G = p(() => {
|
|
64
|
+
switch (r.density) {
|
|
65
65
|
case "comfortable":
|
|
66
66
|
return "py-2";
|
|
67
67
|
case "compact":
|
|
@@ -69,36 +69,36 @@ const Z = {
|
|
|
69
69
|
default:
|
|
70
70
|
return "";
|
|
71
71
|
}
|
|
72
|
-
}),
|
|
72
|
+
}), N = p(() => [
|
|
73
73
|
"w-full resize-none p-2 transition-colors duration-150",
|
|
74
|
-
|
|
74
|
+
r.inputClass,
|
|
75
75
|
{
|
|
76
|
-
"rounded-md": !
|
|
77
|
-
"rounded-none":
|
|
78
|
-
[`rounded-${
|
|
79
|
-
"shadow-md":
|
|
80
|
-
"shadow-none":
|
|
81
|
-
[`text-${
|
|
82
|
-
[`${
|
|
83
|
-
"text-gray-500 bg-gray-200":
|
|
84
|
-
"focus:outline-none focus:ring-2": !
|
|
85
|
-
[`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,
|
|
86
86
|
"border-red-500 ring-red-500 focus:ring-red-500": f.value,
|
|
87
|
-
"resize-none":
|
|
88
|
-
resize: !
|
|
87
|
+
"resize-none": r.noResize || r.autoGrow,
|
|
88
|
+
resize: !r.noResize && !r.autoGrow
|
|
89
89
|
}
|
|
90
90
|
]), H = p(() => [
|
|
91
91
|
"relative w-full",
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
]), I = p(() =>
|
|
95
|
-
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) {
|
|
96
96
|
R(`click:${n}`, e);
|
|
97
97
|
}
|
|
98
98
|
return S({
|
|
99
|
-
validate:
|
|
100
|
-
reset:
|
|
101
|
-
resetValidation:
|
|
99
|
+
validate: P,
|
|
100
|
+
reset: T,
|
|
101
|
+
resetValidation: A,
|
|
102
102
|
errorMessages: w,
|
|
103
103
|
isValid: p(() => !f.value),
|
|
104
104
|
rootRef: V,
|
|
@@ -106,34 +106,34 @@ const Z = {
|
|
|
106
106
|
var e;
|
|
107
107
|
return (e = u.value) == null ? void 0 : e.focus();
|
|
108
108
|
}
|
|
109
|
-
}), (e, n) => (s(), l("div", {
|
|
110
|
-
class:
|
|
109
|
+
}), (e, n) => (s(), l("div", J({
|
|
110
|
+
class: H.value,
|
|
111
111
|
ref_key: "rootRef",
|
|
112
112
|
ref: V
|
|
113
|
-
}, [
|
|
113
|
+
}, e.$attrs), [
|
|
114
114
|
i(e.$slots, "label", y(k({ label: e.label, isFocused: t(v), isActive: !!t(c), controlRef: u.value, focus: () => {
|
|
115
|
-
var
|
|
116
|
-
return (
|
|
115
|
+
var o;
|
|
116
|
+
return (o = u.value) == null ? void 0 : o.focus();
|
|
117
117
|
}, blur: () => {
|
|
118
|
-
var
|
|
119
|
-
return (
|
|
120
|
-
}, props:
|
|
121
|
-
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)
|
|
122
122
|
]),
|
|
123
|
-
a("div",
|
|
124
|
-
e.prependIcon || e.$slots.prepend ? (s(), l("div",
|
|
123
|
+
a("div", _, [
|
|
124
|
+
e.prependIcon || e.$slots.prepend ? (s(), l("div", ee, [
|
|
125
125
|
i(e.$slots, "prepend", y(k(e.prependSlotBindings)), () => [
|
|
126
126
|
a("div", {
|
|
127
|
-
onClick: n[0] || (n[0] = (
|
|
127
|
+
onClick: n[0] || (n[0] = (o) => b(o, "prepend"))
|
|
128
128
|
}, [
|
|
129
129
|
(s(), h(C(t($)(e.prependIcon))))
|
|
130
130
|
])
|
|
131
131
|
])
|
|
132
132
|
])) : d("", !0),
|
|
133
|
-
e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div",
|
|
133
|
+
e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div", re, [
|
|
134
134
|
i(e.$slots, "prepend-inner", {}, () => [
|
|
135
135
|
a("div", {
|
|
136
|
-
onClick: n[1] || (n[1] = (
|
|
136
|
+
onClick: n[1] || (n[1] = (o) => b(o, "prependInner"))
|
|
137
137
|
}, [
|
|
138
138
|
(s(), h(C(t($)(e.prependInnerIcon))))
|
|
139
139
|
])
|
|
@@ -147,67 +147,67 @@ const Z = {
|
|
|
147
147
|
disabled: e.disabled,
|
|
148
148
|
readonly: e.readonly,
|
|
149
149
|
placeholder: e.placeholder,
|
|
150
|
-
onInput: n[2] || (n[2] = (
|
|
151
|
-
t(F)(
|
|
150
|
+
onInput: n[2] || (n[2] = (o) => {
|
|
151
|
+
t(F)(o.target.value), e.autoGrow && t(M)();
|
|
152
152
|
}),
|
|
153
|
-
onFocus: n[3] || (n[3] = (
|
|
153
|
+
onFocus: n[3] || (n[3] = (o) => {
|
|
154
154
|
v.value = !0, e.$emit("update:focused", !0);
|
|
155
155
|
}),
|
|
156
|
-
onBlur: n[4] || (n[4] = (
|
|
156
|
+
onBlur: n[4] || (n[4] = (o) => {
|
|
157
157
|
v.value = !1, e.$emit("update:focused", !1);
|
|
158
158
|
}),
|
|
159
|
-
onClick: n[5] || (n[5] = (
|
|
160
|
-
onMousedown: n[6] || (n[6] = (
|
|
161
|
-
class:
|
|
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
162
|
}, null, 42, oe),
|
|
163
163
|
e.clearable && t(c) ? (s(), l("div", {
|
|
164
164
|
key: 2,
|
|
165
|
-
class:
|
|
165
|
+
class: g(["absolute right-2 top-2", { "opacity-100": e.persistentClear, "hover:opacity-100 opacity-0 transition-opacity duration-200": !e.persistentClear }])
|
|
166
166
|
}, [
|
|
167
167
|
i(e.$slots, "clear", y(k({ isActive: !!t(c), isFocused: t(v), controlRef: u.value, focus: () => {
|
|
168
|
-
var
|
|
169
|
-
return (
|
|
168
|
+
var o;
|
|
169
|
+
return (o = u.value) == null ? void 0 : o.focus();
|
|
170
170
|
}, blur: () => {
|
|
171
|
-
var
|
|
172
|
-
return (
|
|
173
|
-
}, props:
|
|
171
|
+
var o;
|
|
172
|
+
return (o = u.value) == null ? void 0 : o.blur();
|
|
173
|
+
}, props: r })), () => [
|
|
174
174
|
a("button", {
|
|
175
175
|
type: "button",
|
|
176
|
-
onClick: n[7] || (n[7] = (...
|
|
176
|
+
onClick: n[7] || (n[7] = (...o) => t(z) && t(z)(...o)),
|
|
177
177
|
class: "text-gray-500 hover:text-gray-700"
|
|
178
178
|
}, [
|
|
179
179
|
a("span", {
|
|
180
|
-
class:
|
|
180
|
+
class: g(j.value)
|
|
181
181
|
}, null, 2)
|
|
182
182
|
])
|
|
183
183
|
])
|
|
184
184
|
], 2)) : d("", !0),
|
|
185
|
-
e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div",
|
|
185
|
+
e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div", te, [
|
|
186
186
|
i(e.$slots, "append-inner", {}, () => [
|
|
187
187
|
a("div", {
|
|
188
|
-
onClick: n[8] || (n[8] = (
|
|
188
|
+
onClick: n[8] || (n[8] = (o) => b(o, "appendInner"))
|
|
189
189
|
}, [
|
|
190
190
|
(s(), h(C(t($)(e.appendInnerIcon))))
|
|
191
191
|
])
|
|
192
192
|
])
|
|
193
193
|
])) : d("", !0),
|
|
194
|
-
e.appendIcon || e.$slots.append ? (s(), l("div",
|
|
194
|
+
e.appendIcon || e.$slots.append ? (s(), l("div", ne, [
|
|
195
195
|
i(e.$slots, "append", y(k(e.appendSlotBindings)), () => [
|
|
196
196
|
a("div", {
|
|
197
|
-
onClick: n[9] || (n[9] = (
|
|
197
|
+
onClick: n[9] || (n[9] = (o) => b(o, "append"))
|
|
198
198
|
}, [
|
|
199
199
|
(s(), h(C(t($)(e.appendIcon))))
|
|
200
200
|
])
|
|
201
201
|
])
|
|
202
202
|
])) : d("", !0),
|
|
203
|
-
e.loading ? (s(), l("div",
|
|
203
|
+
e.loading ? (s(), l("div", se, [
|
|
204
204
|
i(e.$slots, "loader", {
|
|
205
205
|
color: e.loadingColor,
|
|
206
206
|
isActive: !0
|
|
207
207
|
}, () => [
|
|
208
|
-
a("div",
|
|
208
|
+
a("div", le, [
|
|
209
209
|
a("div", {
|
|
210
|
-
class:
|
|
210
|
+
class: g(["h-full transition-all duration-300", [`${e.loadingColor}`]]),
|
|
211
211
|
style: { width: "100%" }
|
|
212
212
|
}, null, 2)
|
|
213
213
|
])
|
|
@@ -215,38 +215,38 @@ const Z = {
|
|
|
215
215
|
])) : d("", !0),
|
|
216
216
|
!e.hideDetails || e.hideDetails === "auto" && (t(w).length || e.hint) ? (s(), l("div", {
|
|
217
217
|
key: 6,
|
|
218
|
-
class:
|
|
218
|
+
class: g(["text-xs mt-1 space-y-1", { "text-red-500": t(f), "text-gray-500": !t(f) }])
|
|
219
219
|
}, [
|
|
220
220
|
i(e.$slots, "details", {}, () => [
|
|
221
|
-
t(f) ? (s(!0), l(
|
|
221
|
+
t(f) ? (s(!0), l(O, { key: 0 }, Q(t(w), (o, L) => i(e.$slots, "message", {
|
|
222
222
|
key: L,
|
|
223
|
-
message:
|
|
223
|
+
message: o
|
|
224
224
|
}, () => [
|
|
225
|
-
a("div", null,
|
|
225
|
+
a("div", null, m(o), 1)
|
|
226
226
|
])), 128)) : e.hint ? i(e.$slots, "hint", {
|
|
227
227
|
key: 1,
|
|
228
228
|
hint: e.hint
|
|
229
229
|
}, () => [
|
|
230
|
-
|
|
231
|
-
[
|
|
230
|
+
U(a("div", null, m(e.hint), 513), [
|
|
231
|
+
[W, e.persistentHint || t(v)]
|
|
232
232
|
])
|
|
233
233
|
]) : d("", !0)
|
|
234
234
|
])
|
|
235
235
|
], 2)) : d("", !0),
|
|
236
|
-
K.value ? (s(), l("div",
|
|
236
|
+
K.value ? (s(), l("div", ae, [
|
|
237
237
|
i(e.$slots, "counter", {
|
|
238
238
|
counter: t(c).length,
|
|
239
239
|
max: I.value,
|
|
240
240
|
value: t(c).length
|
|
241
241
|
}, () => [
|
|
242
|
-
|
|
243
|
-
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)
|
|
244
244
|
])
|
|
245
245
|
])) : d("", !0)
|
|
246
246
|
])
|
|
247
|
-
],
|
|
247
|
+
], 16));
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
export {
|
|
251
|
-
|
|
251
|
+
ve as default
|
|
252
252
|
};
|