adverich-kun-ui 0.1.211 → 0.1.213
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,10 +1,10 @@
|
|
|
1
|
-
import { mergeModels as R, useModel as $, onMounted as ae, ref as B, watch as se, createElementBlock as V, openBlock as s, createVNode as a, unref as
|
|
1
|
+
import { mergeModels as R, useModel as $, onMounted as ae, ref as B, watch as se, createElementBlock as V, openBlock as s, createVNode as a, unref as t, isRef as F, createSlots as ue, withCtx as i, createCommentVNode as v, Fragment as de, renderList as ce, createBlock as d, createElementVNode as me, createTextVNode as y, toDisplayString as w, normalizeClass as fe, withModifiers as pe } from "vue";
|
|
2
2
|
import { icons as m } from "../../../../icons/index.js";
|
|
3
|
-
import { isNotEmpty as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { isNotEmpty as ke, isArray as T } from "../../../../utils/utils.js";
|
|
4
|
+
import ve from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
|
+
import ye from "../../../KunList/src/components/KunList.vue.js";
|
|
6
6
|
import _ from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
|
-
import
|
|
7
|
+
import E from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
8
|
import he from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
9
|
import ge from "../../../kunMenu/src/components/kunMenu.vue.js";
|
|
10
10
|
import { useAutocomplete as Ce } from "../composables/useAutocomplete.js";
|
|
@@ -24,15 +24,15 @@ const Ie = {
|
|
|
24
24
|
items: { default: [], type: Array, required: !0 },
|
|
25
25
|
itemsModifiers: {}
|
|
26
26
|
}),
|
|
27
|
-
emits: /* @__PURE__ */ R(["selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
28
|
-
setup(g, { emit:
|
|
29
|
-
const r = $(g, "modelValue"), I = $(g, "items"), n = g, f =
|
|
27
|
+
emits: /* @__PURE__ */ R(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
28
|
+
setup(g, { emit: L }) {
|
|
29
|
+
const r = $(g, "modelValue"), I = $(g, "items"), n = g, f = L, {
|
|
30
30
|
textFieldRef: C,
|
|
31
31
|
listRef: x,
|
|
32
32
|
menuModel: u,
|
|
33
33
|
search: c,
|
|
34
|
-
removeItem:
|
|
35
|
-
clearSelection:
|
|
34
|
+
removeItem: N,
|
|
35
|
+
clearSelection: U,
|
|
36
36
|
lightReset: H,
|
|
37
37
|
openMenu: b,
|
|
38
38
|
closeMenu: O,
|
|
@@ -57,29 +57,29 @@ const Ie = {
|
|
|
57
57
|
}
|
|
58
58
|
const p = B(""), D = (e) => {
|
|
59
59
|
for (const o of n.rules) {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
return p.value =
|
|
60
|
+
const l = o(e);
|
|
61
|
+
if (l !== !0)
|
|
62
|
+
return p.value = l, f("validation", !1), !1;
|
|
63
63
|
}
|
|
64
64
|
return p.value = "", f("validation", !0), !0;
|
|
65
65
|
};
|
|
66
66
|
se(() => r.value, (e, o) => {
|
|
67
|
-
|
|
67
|
+
ke(n.rules) && D(e);
|
|
68
68
|
});
|
|
69
69
|
function ee() {
|
|
70
70
|
var e;
|
|
71
71
|
u.value = !1, (e = C.value.inputField) == null || e.focus();
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
var
|
|
73
|
+
function le(e) {
|
|
74
|
+
var l, k;
|
|
75
75
|
const o = e.key;
|
|
76
76
|
if (o === "Tab" || o === "Shift") {
|
|
77
77
|
O();
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
(J(o) || o === "Backspace") && b(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), u.value || b(), (
|
|
80
|
+
(J(o) || o === "Backspace") && b(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), u.value || b(), (k = (l = x.value) == null ? void 0 : l.focusWithKey) == null || k.call(l, o));
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function te(e) {
|
|
83
83
|
f("search", c);
|
|
84
84
|
}
|
|
85
85
|
function oe() {
|
|
@@ -96,10 +96,10 @@ const Ie = {
|
|
|
96
96
|
ref: S
|
|
97
97
|
}, [
|
|
98
98
|
a(Ve, {
|
|
99
|
-
modelValue:
|
|
99
|
+
modelValue: t(c),
|
|
100
100
|
"onUpdate:modelValue": [
|
|
101
|
-
o[1] || (o[1] = (
|
|
102
|
-
|
|
101
|
+
o[1] || (o[1] = (l) => F(c) ? c.value = l : null),
|
|
102
|
+
te
|
|
103
103
|
],
|
|
104
104
|
label: e.label,
|
|
105
105
|
dirty: "",
|
|
@@ -109,41 +109,41 @@ const Ie = {
|
|
|
109
109
|
ref: C,
|
|
110
110
|
autocomplete: "off",
|
|
111
111
|
onFocusInput: oe,
|
|
112
|
-
onHandleClick:
|
|
113
|
-
rounded:
|
|
112
|
+
onHandleClick: t(j),
|
|
113
|
+
rounded: t(u) ? "rounded-t" : "rounded",
|
|
114
114
|
onBlur: ie,
|
|
115
|
-
onKeyDown:
|
|
116
|
-
placeholder: n.multiple &&
|
|
115
|
+
onKeyDown: le,
|
|
116
|
+
placeholder: n.multiple && t(T)(r.value) && r.value.length ? "" : t(M),
|
|
117
117
|
error: !!p.value,
|
|
118
118
|
"error-messages": p.value
|
|
119
119
|
}, ue({
|
|
120
120
|
default: i(() => [
|
|
121
|
-
|
|
122
|
-
(s(!0), V(de, null, ce(r.value, (
|
|
123
|
-
key:
|
|
121
|
+
t(T)(r.value) ? (s(), V("div", Ie, [
|
|
122
|
+
(s(!0), V(de, null, ce(r.value, (l) => (s(), d(_e, {
|
|
123
|
+
key: l.id ?? l.name,
|
|
124
124
|
size: "small",
|
|
125
125
|
class: "ml-1"
|
|
126
126
|
}, {
|
|
127
127
|
default: i(() => [
|
|
128
128
|
me("div", xe, [
|
|
129
|
-
|
|
129
|
+
y(w(t(G)(l, e.itemTitle)) + " ", 1),
|
|
130
130
|
a(h, {
|
|
131
131
|
color: "error",
|
|
132
|
-
icon:
|
|
132
|
+
icon: t(m).close,
|
|
133
133
|
size: "small",
|
|
134
134
|
class: "ml-1",
|
|
135
|
-
onClick: (
|
|
135
|
+
onClick: (k) => t(N)(l)
|
|
136
136
|
}, null, 8, ["icon", "onClick"])
|
|
137
137
|
])
|
|
138
138
|
]),
|
|
139
139
|
_: 2
|
|
140
140
|
}, 1024))), 128))
|
|
141
|
-
])) :
|
|
141
|
+
])) : v("", !0),
|
|
142
142
|
a(ge, {
|
|
143
143
|
transition: "fade",
|
|
144
|
-
"onClick:outside":
|
|
145
|
-
modelValue:
|
|
146
|
-
"onUpdate:modelValue": o[0] || (o[0] = (
|
|
144
|
+
"onClick:outside": t(H),
|
|
145
|
+
modelValue: t(u),
|
|
146
|
+
"onUpdate:modelValue": o[0] || (o[0] = (l) => F(u) ? u.value = l : null),
|
|
147
147
|
activator: "parent",
|
|
148
148
|
"z-index": e.zIndex,
|
|
149
149
|
"parent-ref": S.value,
|
|
@@ -155,58 +155,59 @@ const Ie = {
|
|
|
155
155
|
"hide-details": e.hideDetails
|
|
156
156
|
}, {
|
|
157
157
|
default: i(() => [
|
|
158
|
-
a(
|
|
159
|
-
"
|
|
158
|
+
a(ye, {
|
|
159
|
+
"onClick:select": t(P),
|
|
160
160
|
ref_key: "listRef",
|
|
161
161
|
ref: x,
|
|
162
|
-
onKeyDown: ne
|
|
162
|
+
onKeyDown: ne,
|
|
163
|
+
selectable: !0
|
|
163
164
|
}, {
|
|
164
165
|
default: i(() => [
|
|
165
|
-
|
|
166
|
+
t(Y) ? (s(), d(_, { key: 0 }, {
|
|
166
167
|
default: i(() => [
|
|
167
168
|
a(we, {
|
|
168
|
-
onClick:
|
|
169
|
+
onClick: t(Q),
|
|
169
170
|
class: "w-full",
|
|
170
171
|
color: "bg-green-400"
|
|
171
172
|
}, {
|
|
172
173
|
default: i(() => o[2] || (o[2] = [
|
|
173
|
-
|
|
174
|
+
y(" Crear item ")
|
|
174
175
|
])),
|
|
175
176
|
_: 1,
|
|
176
177
|
__: [2]
|
|
177
178
|
}, 8, ["onClick"])
|
|
178
179
|
]),
|
|
179
180
|
_: 1
|
|
180
|
-
})) :
|
|
181
|
-
a(
|
|
181
|
+
})) : v("", !0),
|
|
182
|
+
a(ve, {
|
|
182
183
|
items: I.value,
|
|
183
|
-
search:
|
|
184
|
+
search: t(c),
|
|
184
185
|
"searchable-keys": n.searchableKeys,
|
|
185
186
|
virtual: !1,
|
|
186
187
|
"items-per-intersection": 10,
|
|
187
|
-
enabled:
|
|
188
|
+
enabled: t(u),
|
|
188
189
|
"item-height": 48
|
|
189
190
|
}, {
|
|
190
|
-
default: i(({ item:
|
|
191
|
+
default: i(({ item: l, index: k, empty: re }) => {
|
|
191
192
|
var z, A;
|
|
192
193
|
return [
|
|
193
|
-
!re &&
|
|
194
|
-
value:
|
|
195
|
-
key: ((z =
|
|
196
|
-
disabled:
|
|
197
|
-
class: fe(Z(
|
|
194
|
+
!re && l ? (s(), d(_, {
|
|
195
|
+
value: l,
|
|
196
|
+
key: ((z = l.id) == null ? void 0 : z.toString()) ?? l.name,
|
|
197
|
+
disabled: t(X)(l),
|
|
198
|
+
class: fe(Z(l)),
|
|
198
199
|
density: e.density,
|
|
199
|
-
id: ((A =
|
|
200
|
+
id: ((A = l.id) == null ? void 0 : A.toString()) ?? l.name
|
|
200
201
|
}, {
|
|
201
202
|
default: i(() => [
|
|
202
|
-
a(
|
|
203
|
+
a(E, { class: "text-wrap" }, {
|
|
203
204
|
default: i(() => [
|
|
204
|
-
|
|
205
|
+
y(w(t(K)(l, e.itemTitle ?? t(W), "hasDefault")), 1)
|
|
205
206
|
]),
|
|
206
207
|
_: 2
|
|
207
208
|
}, 1024),
|
|
208
209
|
a(he, {
|
|
209
|
-
textContent: w(e.itemSubtitle ?
|
|
210
|
+
textContent: w(e.itemSubtitle ? t(K)(l, e.itemSubtitle) : "")
|
|
210
211
|
}, null, 8, ["textContent"])
|
|
211
212
|
]),
|
|
212
213
|
_: 2
|
|
@@ -215,9 +216,9 @@ const Ie = {
|
|
|
215
216
|
disabled: ""
|
|
216
217
|
}, {
|
|
217
218
|
default: i(() => [
|
|
218
|
-
a(
|
|
219
|
+
a(E, { class: "text-center w-full text-gray-500" }, {
|
|
219
220
|
default: i(() => o[3] || (o[3] = [
|
|
220
|
-
|
|
221
|
+
y(" No hay elementos disponibles ")
|
|
221
222
|
])),
|
|
222
223
|
_: 1,
|
|
223
224
|
__: [3]
|
|
@@ -231,7 +232,7 @@ const Ie = {
|
|
|
231
232
|
}, 8, ["items", "search", "searchable-keys", "enabled"])
|
|
232
233
|
]),
|
|
233
234
|
_: 1
|
|
234
|
-
}, 8, ["
|
|
235
|
+
}, 8, ["onClick:select"])
|
|
235
236
|
]),
|
|
236
237
|
_: 1
|
|
237
238
|
}, 8, ["onClick:outside", "modelValue", "z-index", "parent-ref", "close-on-content-click", "max-height", "hide-details"])
|
|
@@ -243,26 +244,26 @@ const Ie = {
|
|
|
243
244
|
fn: i(() => [
|
|
244
245
|
e.clearable && r.value ? (s(), d(h, {
|
|
245
246
|
key: 0,
|
|
246
|
-
onClick:
|
|
247
|
+
onClick: t(U),
|
|
247
248
|
size: "small",
|
|
248
249
|
color: "error",
|
|
249
|
-
icon:
|
|
250
|
+
icon: t(m).close,
|
|
250
251
|
class: "mr-1 mt-1"
|
|
251
|
-
}, null, 8, ["onClick", "icon"])) :
|
|
252
|
+
}, null, 8, ["onClick", "icon"])) : v("", !0),
|
|
252
253
|
a(h, {
|
|
253
254
|
color: "teal-darken-1",
|
|
254
255
|
size: "large",
|
|
255
256
|
class: "cursor-pointer",
|
|
256
|
-
icon:
|
|
257
|
-
onClick: pe(
|
|
257
|
+
icon: t(u) ? t(m).menuUpOutline : t(m).menuDownOutline,
|
|
258
|
+
onClick: pe(t(b), ["stop"])
|
|
258
259
|
}, null, 8, ["icon", "onClick"]),
|
|
259
260
|
e.required ? (s(), d(h, {
|
|
260
261
|
key: 1,
|
|
261
262
|
color: "teal-darken-1",
|
|
262
263
|
size: "x-small",
|
|
263
264
|
class: "mb-4",
|
|
264
|
-
icon:
|
|
265
|
-
}, null, 8, ["icon"])) :
|
|
265
|
+
icon: t(m).asterisk
|
|
266
|
+
}, null, 8, ["icon"])) : v("", !0)
|
|
266
267
|
]),
|
|
267
268
|
key: "0"
|
|
268
269
|
} : void 0
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as a, computed as M, watch as
|
|
1
|
+
import { ref as a, computed as M, watch as H, nextTick as w } from "vue";
|
|
2
2
|
import { isArray as O, isObject as v, fullCopy as J } from "../../../../utils/utils.js";
|
|
3
|
-
function Q(n,
|
|
4
|
-
const i = a(null), s = a(null),
|
|
5
|
-
function
|
|
3
|
+
function Q(n, h, c, o) {
|
|
4
|
+
const i = a(null), s = a(null), g = a(null), r = a(!1), d = a(""), F = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e), V = M(() => i.value ? O(i.value) ? i.value.length ? x(i.value, n.itemTitle, "hasDefault") : n.placeholderText : v(i.value) ? x(i.value, n.itemTitle, "hasDefault") : i.value.toString() : o.value.length ? n.placeholderText : n.textNoItems), B = M(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
|
|
5
|
+
function x(e, t, u) {
|
|
6
6
|
if (v(e)) {
|
|
7
7
|
if (t) {
|
|
8
8
|
if (O(t))
|
|
@@ -23,37 +23,39 @@ function Q(n, g, r, o) {
|
|
|
23
23
|
}
|
|
24
24
|
return O(e) ? n.returnObject ? e.map((l) => l[t]).join(" - ") : e.map((l) => l).join(" - ") : u && typeof e != "number" && e.includes(",") ? e.split(",") : e;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function R(e) {
|
|
27
27
|
try {
|
|
28
28
|
let t = null;
|
|
29
29
|
if (i.value = J(e), !n.multiple)
|
|
30
|
-
n.returnObject ? t = e : v(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e,
|
|
31
|
-
else if (
|
|
32
|
-
e &&
|
|
30
|
+
n.returnObject ? t = e : v(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e, r.value = !1;
|
|
31
|
+
else if (j(e))
|
|
32
|
+
e && y(e);
|
|
33
33
|
else {
|
|
34
34
|
const u = n.returnObject ? e : v(e) ? n.itemValue ? e[n.itemValue] : Object.values(e)[0] : e;
|
|
35
|
-
t = [...
|
|
35
|
+
t = [...c.value || [], u];
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
c.value === t ? h("update:modelValue", t) : c.value = t, h("selectedItem", i.value);
|
|
38
38
|
} catch (t) {
|
|
39
39
|
console.log(t);
|
|
40
40
|
} finally {
|
|
41
|
-
|
|
41
|
+
w(() => {
|
|
42
|
+
S();
|
|
43
|
+
});
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
|
-
|
|
45
|
-
i.value =
|
|
46
|
+
H(() => o.value, () => {
|
|
47
|
+
i.value = C(c.value);
|
|
46
48
|
}, { immediate: !0 });
|
|
47
|
-
function
|
|
49
|
+
function C(e) {
|
|
48
50
|
return e == null ? null : n.returnObject ? e : n.multiple && Array.isArray(e) ? e.map((u) => o.value.find((l) => l[n.itemValue] === u)).filter(Boolean) : o.value.find((u) => u[n.itemValue] === e) || null;
|
|
49
51
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
52
|
+
function j(e) {
|
|
53
|
+
return c.value === null ? !1 : e ? c.value.some(
|
|
52
54
|
(t) => n.returnObject ? t[n.itemValue] === e[n.itemValue] : t === e[n.itemValue]
|
|
53
55
|
) : !0;
|
|
54
56
|
}
|
|
55
|
-
function
|
|
56
|
-
let t =
|
|
57
|
+
function y(e) {
|
|
58
|
+
let t = c.value;
|
|
57
59
|
if (n.returnObject) {
|
|
58
60
|
const u = t.find(
|
|
59
61
|
(f) => f[n.itemValue] === e[n.itemValue]
|
|
@@ -64,30 +66,30 @@ function Q(n, g, r, o) {
|
|
|
64
66
|
t.splice(u, 1);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
function
|
|
68
|
-
n.clearSearchOnSelect && (d.value = ""), n.clearOnSelect && A(), n.focusOnSelect &&
|
|
69
|
+
function S(e) {
|
|
70
|
+
n.clearSearchOnSelect && (d.value = ""), n.clearOnSelect && A(), n.focusOnSelect && m();
|
|
69
71
|
}
|
|
70
72
|
function T() {
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
function C() {
|
|
74
|
-
c.value && (c.value = !1);
|
|
73
|
+
r.value || (r.value = !0);
|
|
75
74
|
}
|
|
76
75
|
function D() {
|
|
77
|
-
|
|
76
|
+
r.value && (r.value = !1);
|
|
77
|
+
}
|
|
78
|
+
function N() {
|
|
79
|
+
r.value = !r.value;
|
|
78
80
|
}
|
|
79
81
|
function I(e) {
|
|
80
82
|
return e.length === 1 && e.match(/\w/);
|
|
81
83
|
}
|
|
82
|
-
function
|
|
84
|
+
function m() {
|
|
83
85
|
s.value.inputField.focus();
|
|
84
86
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
+
function K() {
|
|
88
|
+
r.value = !0, g.value && s.value.$el.focus();
|
|
87
89
|
}
|
|
88
|
-
function
|
|
90
|
+
function $(e) {
|
|
89
91
|
const t = e.key;
|
|
90
|
-
(I(t) || t === "Backspace") && (T(),
|
|
92
|
+
(I(t) || t === "Backspace") && (T(), m(), w(() => {
|
|
91
93
|
var l;
|
|
92
94
|
const u = (l = s.value) == null ? void 0 : l.inputField;
|
|
93
95
|
if (u) {
|
|
@@ -96,42 +98,42 @@ function Q(n, g, r, o) {
|
|
|
96
98
|
}
|
|
97
99
|
}));
|
|
98
100
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
+
function q() {
|
|
102
|
+
r.value = !1, h("createItem");
|
|
101
103
|
}
|
|
102
|
-
function
|
|
103
|
-
let t =
|
|
104
|
-
|
|
104
|
+
function z(e) {
|
|
105
|
+
let t = c.value.indexOf(e);
|
|
106
|
+
c.value.splice(t, 1);
|
|
105
107
|
}
|
|
106
108
|
function A() {
|
|
107
|
-
d.value !== "" && (d.value = ""),
|
|
109
|
+
console.log(c.value), d.value !== "" && (d.value = ""), c.value !== null && (c.value = null), i.value !== null && (i.value = null);
|
|
108
110
|
}
|
|
109
|
-
function
|
|
111
|
+
function G(e) {
|
|
110
112
|
return !!e.disabled;
|
|
111
113
|
}
|
|
112
114
|
return {
|
|
113
115
|
selectedItem: i,
|
|
114
116
|
textFieldRef: s,
|
|
115
|
-
listRef:
|
|
116
|
-
menuModel:
|
|
117
|
+
listRef: g,
|
|
118
|
+
menuModel: r,
|
|
117
119
|
search: d,
|
|
118
|
-
getItemText:
|
|
119
|
-
placeholder:
|
|
120
|
-
textArr:
|
|
121
|
-
itemToString:
|
|
122
|
-
getSelectedItem:
|
|
123
|
-
checkIfValueExist:
|
|
124
|
-
removeFromArray:
|
|
125
|
-
lightReset:
|
|
120
|
+
getItemText: F,
|
|
121
|
+
placeholder: V,
|
|
122
|
+
textArr: B,
|
|
123
|
+
itemToString: x,
|
|
124
|
+
getSelectedItem: R,
|
|
125
|
+
checkIfValueExist: j,
|
|
126
|
+
removeFromArray: y,
|
|
127
|
+
lightReset: S,
|
|
126
128
|
openMenu: T,
|
|
127
|
-
closeMenu:
|
|
128
|
-
toggleMenu:
|
|
129
|
-
focusOnMenu:
|
|
130
|
-
onMenuKeydown:
|
|
131
|
-
createItem:
|
|
132
|
-
removeItem:
|
|
129
|
+
closeMenu: D,
|
|
130
|
+
toggleMenu: N,
|
|
131
|
+
focusOnMenu: K,
|
|
132
|
+
onMenuKeydown: $,
|
|
133
|
+
createItem: q,
|
|
134
|
+
removeItem: z,
|
|
133
135
|
clearSelection: A,
|
|
134
|
-
checkDisabled:
|
|
136
|
+
checkDisabled: G,
|
|
135
137
|
isAlphanumeric: I
|
|
136
138
|
};
|
|
137
139
|
}
|