adverich-kun-ui 0.1.514 → 0.1.516
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,12 +1,12 @@
|
|
|
1
|
-
import { mergeModels as z, useModel as A, onMounted as se, ref as E, watch as ue, nextTick as x, createElementBlock as
|
|
1
|
+
import { mergeModels as z, useModel as A, onMounted as se, ref as E, watch as ue, nextTick as x, createElementBlock as g, openBlock as c, createVNode as s, unref as t, withKeys as de, withModifiers as F, isRef as O, createSlots as ce, withCtx as r, createCommentVNode as h, normalizeClass as fe, createTextVNode as C, toDisplayString as D, createBlock as p, Fragment as me, renderList as pe, createElementVNode as ve } from "vue";
|
|
2
2
|
import { icons as v } from "../../../../icons/index.js";
|
|
3
|
-
import { isNotEmpty as
|
|
3
|
+
import { isNotEmpty as R, isArray as B } from "../../../../utils/utils.js";
|
|
4
4
|
import ke from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
5
|
import ye from "../../../KunList/src/components/KunList.vue.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import N from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
|
+
import T from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
|
+
import ge from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
|
+
import he from "../../../KunMenu/src/components/KunMenu.vue.js";
|
|
10
10
|
import { useAutocomplete as Ce } from "../composables/useAutocomplete.js";
|
|
11
11
|
import { KunAutocompleteProps as be } from "../composables/KunAutocompleteProps.js";
|
|
12
12
|
import we from "../../../KunTextField/src/components/KunTextField.vue.js";
|
|
@@ -26,11 +26,11 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
26
26
|
}),
|
|
27
27
|
emits: /* @__PURE__ */ z(["update:modelValue", "selectedItem", "createItem", "validation", "search", "keyDown", "keyDownEnter"], ["update:modelValue", "update:items"]),
|
|
28
28
|
setup(w, { expose: _, emit: U }) {
|
|
29
|
-
const
|
|
29
|
+
const u = A(w, "modelValue"), m = A(w, "items"), a = w, f = U, {
|
|
30
30
|
textFieldRef: k,
|
|
31
31
|
listRef: I,
|
|
32
|
-
menuModel:
|
|
33
|
-
search:
|
|
32
|
+
menuModel: d,
|
|
33
|
+
search: n,
|
|
34
34
|
removeItem: j,
|
|
35
35
|
clearSelection: H,
|
|
36
36
|
lightReset: q,
|
|
@@ -46,58 +46,58 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
46
46
|
checkDisabled: Y,
|
|
47
47
|
itemToString: L,
|
|
48
48
|
placeholder: Z
|
|
49
|
-
} = Ce(
|
|
49
|
+
} = Ce(a, f, u, m);
|
|
50
50
|
se(() => {
|
|
51
|
-
|
|
51
|
+
a.focusOnRender && k.value.focus();
|
|
52
52
|
});
|
|
53
53
|
const M = E(null), y = E(""), $ = (e) => {
|
|
54
|
-
for (const o of
|
|
54
|
+
for (const o of a.rules) {
|
|
55
55
|
const l = o(e);
|
|
56
56
|
if (l !== !0)
|
|
57
|
-
return y.value = l,
|
|
57
|
+
return y.value = l, f("validation", !1), !1;
|
|
58
58
|
}
|
|
59
|
-
return y.value = "",
|
|
59
|
+
return y.value = "", f("validation", !0), !0;
|
|
60
60
|
};
|
|
61
|
-
ue(() =>
|
|
62
|
-
|
|
61
|
+
ue(() => u.value, (e, o) => {
|
|
62
|
+
R(a.rules) && $(e);
|
|
63
63
|
});
|
|
64
64
|
function ee() {
|
|
65
65
|
var e;
|
|
66
|
-
|
|
66
|
+
d.value = !1, (e = k.value.inputField) == null || e.focus();
|
|
67
67
|
}
|
|
68
68
|
function le(e) {
|
|
69
69
|
var l, i;
|
|
70
70
|
const o = e.key;
|
|
71
71
|
if (o === "Tab" || o === "Shift" || o === "Escape") {
|
|
72
|
-
P(),
|
|
72
|
+
P(), f("keyDown", o);
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
(Q(o) || o === "Backspace") && S(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(),
|
|
75
|
+
(Q(o) || o === "Backspace") && S(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), d.value || S(), (i = (l = I.value) == null ? void 0 : l.focusWithKey) == null || i.call(l, o));
|
|
76
76
|
}
|
|
77
77
|
function te(e) {
|
|
78
|
-
|
|
78
|
+
f("search", n);
|
|
79
79
|
}
|
|
80
80
|
function oe() {
|
|
81
|
-
$(
|
|
81
|
+
$(u);
|
|
82
82
|
}
|
|
83
83
|
function ne(e) {
|
|
84
84
|
W(e);
|
|
85
85
|
}
|
|
86
86
|
function re() {
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
if (!
|
|
88
|
+
function ae(e) {
|
|
89
|
+
if (console.log(e), !n.value) return;
|
|
90
90
|
let o = null;
|
|
91
|
-
|
|
91
|
+
a.returnObject ? o = m.value.find(
|
|
92
92
|
(l) => Object.values(l).some(
|
|
93
|
-
(i) => String(i).toLowerCase() === String(
|
|
93
|
+
(i) => String(i).toLowerCase() === String(n.value).toLowerCase()
|
|
94
94
|
)
|
|
95
|
-
) :
|
|
96
|
-
(l) => String(l[
|
|
97
|
-
) : o =
|
|
98
|
-
(l) => typeof l == "object" ? Object.values(l).some((i) => String(i).toLowerCase() === String(
|
|
99
|
-
), o
|
|
100
|
-
|
|
95
|
+
) : a.itemValue ? o = m.value.find(
|
|
96
|
+
(l) => String(l[a.itemValue]).toLowerCase() === String(n.value).toLowerCase()
|
|
97
|
+
) : o = m.value.find(
|
|
98
|
+
(l) => typeof l == "object" ? Object.values(l).some((i) => String(i).toLowerCase() === String(n.value).toLowerCase()) : String(l).toLowerCase() === String(n.value).toLowerCase()
|
|
99
|
+
), o ? K(o) : (f("notFound", n.value), a.clearOnNotFound && (n.value = "", d.value = !1)), x(() => {
|
|
100
|
+
f("keyDownEnter", e);
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
return _({
|
|
@@ -105,15 +105,15 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
105
105
|
var e;
|
|
106
106
|
return (e = k.value) == null ? void 0 : e.focus();
|
|
107
107
|
})
|
|
108
|
-
}), (e, o) => (
|
|
108
|
+
}), (e, o) => (c(), g("div", {
|
|
109
109
|
class: "w-full h-fit",
|
|
110
110
|
ref_key: "parentRef",
|
|
111
111
|
ref: M
|
|
112
112
|
}, [
|
|
113
|
-
|
|
114
|
-
modelValue: t(
|
|
113
|
+
s(we, {
|
|
114
|
+
modelValue: t(n),
|
|
115
115
|
"onUpdate:modelValue": [
|
|
116
|
-
o[2] || (o[2] = (l) => O(
|
|
116
|
+
o[2] || (o[2] = (l) => O(n) ? n.value = l : null),
|
|
117
117
|
te
|
|
118
118
|
],
|
|
119
119
|
label: e.label,
|
|
@@ -125,31 +125,31 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
125
125
|
autocomplete: "off",
|
|
126
126
|
onFocusInput: oe,
|
|
127
127
|
onHandleClick: t(V),
|
|
128
|
-
rounded: t(
|
|
128
|
+
rounded: t(d) ? "rounded-t" : "rounded",
|
|
129
129
|
onBlur: re,
|
|
130
130
|
onKeyDown: [
|
|
131
131
|
le,
|
|
132
|
-
de(
|
|
132
|
+
de(F(ae, ["prevent"]), ["enter"])
|
|
133
133
|
],
|
|
134
|
-
placeholder:
|
|
134
|
+
placeholder: a.multiple && t(B)(u.value) && u.value.length ? "" : t(Z),
|
|
135
135
|
error: !!y.value,
|
|
136
136
|
"error-messages": y.value
|
|
137
137
|
}, ce({
|
|
138
|
-
"prepend-input-content":
|
|
139
|
-
t(
|
|
138
|
+
"prepend-input-content": r(() => [
|
|
139
|
+
t(B)(u.value) && t(R)(u.value) ? (c(), g("div", {
|
|
140
140
|
key: 0,
|
|
141
141
|
class: "flex flex-nowrap items-center space-x-1 min-w-[calc(100%-56px)] overflow-x-auto overflow-y-hidden",
|
|
142
142
|
onClick: o[0] || (o[0] = (...l) => t(V) && t(V)(...l))
|
|
143
143
|
}, [
|
|
144
|
-
(
|
|
144
|
+
(c(!0), g(me, null, pe(u.value, (l) => (c(), p(Ve, {
|
|
145
145
|
key: l.id ?? l.name,
|
|
146
146
|
size: "small",
|
|
147
147
|
variant: "pill"
|
|
148
148
|
}, {
|
|
149
|
-
default:
|
|
149
|
+
default: r(() => [
|
|
150
150
|
ve("div", De, [
|
|
151
151
|
C(D(t(J)(l)) + " ", 1),
|
|
152
|
-
|
|
152
|
+
s(b, {
|
|
153
153
|
color: "error",
|
|
154
154
|
icon: t(v).close,
|
|
155
155
|
size: "small",
|
|
@@ -160,14 +160,14 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
160
160
|
]),
|
|
161
161
|
_: 2
|
|
162
162
|
}, 1024))), 128))
|
|
163
|
-
])) :
|
|
163
|
+
])) : h("", !0)
|
|
164
164
|
]),
|
|
165
|
-
default:
|
|
166
|
-
|
|
165
|
+
default: r(() => [
|
|
166
|
+
s(he, {
|
|
167
167
|
transition: "fade",
|
|
168
168
|
"onClick:outside": t(q),
|
|
169
|
-
modelValue: t(
|
|
170
|
-
"onUpdate:modelValue": o[1] || (o[1] = (l) => O(
|
|
169
|
+
modelValue: t(d),
|
|
170
|
+
"onUpdate:modelValue": o[1] || (o[1] = (l) => O(d) ? d.value = l : null),
|
|
171
171
|
activator: "parent",
|
|
172
172
|
"z-index": e.zIndex,
|
|
173
173
|
"parent-ref": M.value,
|
|
@@ -179,38 +179,38 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
179
179
|
"max-height": e.maxHeight,
|
|
180
180
|
"hide-details": e.hideDetails
|
|
181
181
|
}, {
|
|
182
|
-
default:
|
|
183
|
-
e.hasCreateItem ? (
|
|
184
|
-
|
|
182
|
+
default: r(() => [
|
|
183
|
+
e.hasCreateItem ? (c(), g("div", Ie, [
|
|
184
|
+
s(Se, {
|
|
185
185
|
onClick: t(X),
|
|
186
186
|
bgColor: e.btnCreateBg,
|
|
187
|
-
class:
|
|
187
|
+
class: fe(e.btnCreateClass)
|
|
188
188
|
}, {
|
|
189
|
-
default:
|
|
189
|
+
default: r(() => [
|
|
190
190
|
C(D(e.btnCreateText), 1)
|
|
191
191
|
]),
|
|
192
192
|
_: 1
|
|
193
193
|
}, 8, ["onClick", "bgColor", "class"])
|
|
194
|
-
])) :
|
|
195
|
-
|
|
194
|
+
])) : h("", !0),
|
|
195
|
+
s(ye, {
|
|
196
196
|
"onClick:select": t(K),
|
|
197
197
|
ref_key: "listRef",
|
|
198
198
|
ref: I,
|
|
199
199
|
onKeyDown: ne,
|
|
200
200
|
selectable: !0
|
|
201
201
|
}, {
|
|
202
|
-
default:
|
|
203
|
-
|
|
204
|
-
items:
|
|
205
|
-
search: t(
|
|
206
|
-
"searchable-keys":
|
|
202
|
+
default: r(() => [
|
|
203
|
+
s(ke, {
|
|
204
|
+
items: m.value,
|
|
205
|
+
search: t(n),
|
|
206
|
+
"searchable-keys": a.searchableKeys,
|
|
207
207
|
virtual: !1,
|
|
208
208
|
"items-per-intersection": 10,
|
|
209
|
-
enabled: t(
|
|
209
|
+
enabled: t(d),
|
|
210
210
|
"item-height": 48
|
|
211
211
|
}, {
|
|
212
|
-
default:
|
|
213
|
-
!
|
|
212
|
+
default: r(({ item: l, index: i, empty: ie }) => [
|
|
213
|
+
!ie && l != null ? (c(), p(N, {
|
|
214
214
|
value: l,
|
|
215
215
|
key: `kun-list-${i + 1}`,
|
|
216
216
|
id: `kun-item-${i + 1}`,
|
|
@@ -221,25 +221,25 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
221
221
|
density: e.density,
|
|
222
222
|
selectable: !0
|
|
223
223
|
}, {
|
|
224
|
-
default:
|
|
225
|
-
|
|
226
|
-
default:
|
|
224
|
+
default: r(() => [
|
|
225
|
+
s(T, { class: "text-wrap" }, {
|
|
226
|
+
default: r(() => [
|
|
227
227
|
C(D(t(L)(l, e.itemTitle ?? t(G), "hasDefault")), 1)
|
|
228
228
|
]),
|
|
229
229
|
_: 2
|
|
230
230
|
}, 1024),
|
|
231
|
-
|
|
231
|
+
s(ge, {
|
|
232
232
|
text: e.itemSubtitle ? t(L)(l, e.itemSubtitle) : ""
|
|
233
233
|
}, null, 8, ["text"])
|
|
234
234
|
]),
|
|
235
235
|
_: 2
|
|
236
|
-
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (
|
|
236
|
+
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (c(), p(N, {
|
|
237
237
|
key: 1,
|
|
238
238
|
disabled: ""
|
|
239
239
|
}, {
|
|
240
|
-
default:
|
|
241
|
-
|
|
242
|
-
default:
|
|
240
|
+
default: r(() => [
|
|
241
|
+
s(T, { class: "text-center w-full text-gray-500" }, {
|
|
242
|
+
default: r(() => o[3] || (o[3] = [
|
|
243
243
|
C(" No hay elementos disponibles ")
|
|
244
244
|
])),
|
|
245
245
|
_: 1,
|
|
@@ -262,29 +262,29 @@ const De = { class: "flex items-center" }, Ie = {
|
|
|
262
262
|
}, [
|
|
263
263
|
e.hasIcons ? {
|
|
264
264
|
name: "append-inner",
|
|
265
|
-
fn:
|
|
266
|
-
e.clearable &&
|
|
265
|
+
fn: r(() => [
|
|
266
|
+
e.clearable && u.value ? (c(), p(b, {
|
|
267
267
|
key: 0,
|
|
268
268
|
onClick: t(H),
|
|
269
269
|
size: "small",
|
|
270
270
|
color: "error",
|
|
271
271
|
icon: t(v).close,
|
|
272
272
|
class: "mr-1 mt-1"
|
|
273
|
-
}, null, 8, ["onClick", "icon"])) :
|
|
274
|
-
|
|
273
|
+
}, null, 8, ["onClick", "icon"])) : h("", !0),
|
|
274
|
+
s(b, {
|
|
275
275
|
color: "teal-darken-1",
|
|
276
276
|
size: "large",
|
|
277
277
|
class: "cursor-pointer",
|
|
278
|
-
icon: t(
|
|
279
|
-
onClick:
|
|
278
|
+
icon: t(d) ? t(v).menuUpOutline : t(v).menuDownOutline,
|
|
279
|
+
onClick: F(t(S), ["stop"])
|
|
280
280
|
}, null, 8, ["icon", "onClick"]),
|
|
281
|
-
e.required ? (
|
|
281
|
+
e.required ? (c(), p(b, {
|
|
282
282
|
key: 1,
|
|
283
283
|
color: "teal-darken-1",
|
|
284
284
|
size: "x-small",
|
|
285
285
|
class: "mb-4",
|
|
286
286
|
icon: t(v).asterisk
|
|
287
|
-
}, null, 8, ["icon"])) :
|
|
287
|
+
}, null, 8, ["icon"])) : h("", !0)
|
|
288
288
|
]),
|
|
289
289
|
key: "0"
|
|
290
290
|
} : void 0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as i, computed as h, watch as O, nextTick as
|
|
1
|
+
import { ref as i, computed as h, watch as O, nextTick as g, onMounted as A, onBeforeUnmount as F } from "vue";
|
|
2
2
|
function $(t, H, l) {
|
|
3
|
-
const s = i(""),
|
|
4
|
-
function
|
|
3
|
+
const s = i(""), m = i(t.modelValue), x = i(!1), a = i([]), c = h(() => t.formatModel === "json" || t.formatModel === "auto" && typeof t.modelValue == "object");
|
|
4
|
+
function v(e) {
|
|
5
5
|
if (c.value && e != null)
|
|
6
6
|
try {
|
|
7
7
|
return JSON.stringify(e, null, 2);
|
|
@@ -15,18 +15,18 @@ function $(t, H, l) {
|
|
|
15
15
|
try {
|
|
16
16
|
return JSON.parse(e);
|
|
17
17
|
} catch {
|
|
18
|
-
return
|
|
18
|
+
return e;
|
|
19
19
|
}
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
22
|
function I(e) {
|
|
23
23
|
const u = y(e);
|
|
24
|
-
|
|
24
|
+
m.value = u, H("update:modelValue", u);
|
|
25
25
|
}
|
|
26
26
|
O(
|
|
27
27
|
() => t.modelValue,
|
|
28
28
|
(e) => {
|
|
29
|
-
|
|
29
|
+
m.value = e, s.value = v(e), t.autoGrow && g(() => d());
|
|
30
30
|
},
|
|
31
31
|
{ immediate: !0, deep: !0 }
|
|
32
32
|
);
|
|
@@ -48,13 +48,13 @@ function $(t, H, l) {
|
|
|
48
48
|
const n = u.selectionStart, o = s.value, r = " ", f = o.slice(0, n), E = o.slice(n), N = f.lastIndexOf(`
|
|
49
49
|
`) + 1, w = `
|
|
50
50
|
${((V = f.slice(N).match(/^\s*/)) == null ? void 0 : V[0]) ?? ""}${r}`;
|
|
51
|
-
s.value = f + w + E,
|
|
51
|
+
s.value = f + w + E, g(() => {
|
|
52
52
|
const S = n + w.length;
|
|
53
53
|
u.setSelectionRange(S, S);
|
|
54
54
|
}), e.preventDefault();
|
|
55
55
|
}
|
|
56
56
|
A(() => {
|
|
57
|
-
s.value =
|
|
57
|
+
s.value = v(t.modelValue), g(() => {
|
|
58
58
|
t.autoGrow && d();
|
|
59
59
|
});
|
|
60
60
|
}), F(() => {
|