adverich-kun-ui 0.1.111 → 0.1.112
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,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as $, useModel as A, onMounted as
|
|
1
|
+
import { mergeModels as $, useModel as A, onMounted as le, ref as oe, watch as ne, createBlock as d, openBlock as a, unref as t, withModifiers as F, isRef as R, createSlots as re, withCtx as i, createElementBlock as U, createCommentVNode as y, createVNode as s, Fragment as ie, renderList as ae, createElementVNode as se, createTextVNode as C, toDisplayString as b, normalizeClass as ue } from "vue";
|
|
2
2
|
import { icons as m } from "../../../../icons/index.js";
|
|
3
3
|
import { isNotEmpty as de, isArray as z } from "../../../../utils/utils.js";
|
|
4
4
|
import ce from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
@@ -24,7 +24,7 @@ const be = {
|
|
|
24
24
|
items: { default: [], type: Array, required: !0 },
|
|
25
25
|
itemsModifiers: {}
|
|
26
26
|
}),
|
|
27
|
-
emits: /* @__PURE__ */ $(["createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
27
|
+
emits: /* @__PURE__ */ $(["selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
28
28
|
setup(g, { emit: E }) {
|
|
29
29
|
const r = A(g, "modelValue"), V = A(g, "items"), n = g, f = E, {
|
|
30
30
|
textFieldRef: p,
|
|
@@ -46,7 +46,7 @@ const be = {
|
|
|
46
46
|
placeholder: M,
|
|
47
47
|
hasCreateItem: G
|
|
48
48
|
} = ke(n, f, r, V);
|
|
49
|
-
|
|
49
|
+
le(() => {
|
|
50
50
|
n.focusOnRender && p.value.focus();
|
|
51
51
|
});
|
|
52
52
|
function J(e) {
|
|
@@ -54,9 +54,9 @@ const be = {
|
|
|
54
54
|
}
|
|
55
55
|
const v = oe(""), S = (e) => {
|
|
56
56
|
for (const o of n.rules) {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
return v.value =
|
|
57
|
+
const l = o(e);
|
|
58
|
+
if (l !== !0)
|
|
59
|
+
return v.value = l, f("validation", !1), !1;
|
|
60
60
|
}
|
|
61
61
|
return v.value = "", f("validation", !0), !0;
|
|
62
62
|
};
|
|
@@ -68,9 +68,9 @@ const be = {
|
|
|
68
68
|
u.value = !1, (e = p.value.inputField) == null || e.focus();
|
|
69
69
|
}
|
|
70
70
|
function X(e) {
|
|
71
|
-
var
|
|
71
|
+
var l, k;
|
|
72
72
|
const o = e.key;
|
|
73
|
-
["ArrowUp", "ArrowDown"].includes(o) && (u.value || K(), (k = (
|
|
73
|
+
["ArrowUp", "ArrowDown"].includes(o) && (u.value || K(), (k = (l = w.value) == null ? void 0 : l.focusWithKey) == null || k.call(l, o));
|
|
74
74
|
}
|
|
75
75
|
function Y(e) {
|
|
76
76
|
f("search", c);
|
|
@@ -81,12 +81,12 @@ const be = {
|
|
|
81
81
|
function ee(e) {
|
|
82
82
|
H(e);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function te() {
|
|
85
85
|
}
|
|
86
86
|
return (e, o) => (a(), d(he, {
|
|
87
|
-
modelValue:
|
|
87
|
+
modelValue: t(c),
|
|
88
88
|
"onUpdate:modelValue": [
|
|
89
|
-
o[2] || (o[2] = (
|
|
89
|
+
o[2] || (o[2] = (l) => R(c) ? c.value = l : null),
|
|
90
90
|
Y
|
|
91
91
|
],
|
|
92
92
|
label: e.label,
|
|
@@ -97,29 +97,29 @@ const be = {
|
|
|
97
97
|
ref: p,
|
|
98
98
|
autocomplete: "off",
|
|
99
99
|
onFocusInput: Z,
|
|
100
|
-
onHandleClick:
|
|
101
|
-
onBlur:
|
|
100
|
+
onHandleClick: t(T),
|
|
101
|
+
onBlur: te,
|
|
102
102
|
onKeyDown: F(X, ["prevent"]),
|
|
103
|
-
placeholder: n.multiple &&
|
|
103
|
+
placeholder: n.multiple && t(z)(r.value) && r.value.length ? "" : t(M),
|
|
104
104
|
error: !!v.value,
|
|
105
105
|
"error-messages": v.value
|
|
106
106
|
}, re({
|
|
107
107
|
default: i(() => [
|
|
108
|
-
|
|
109
|
-
(a(!0), U(ie, null, ae(r.value, (
|
|
110
|
-
key:
|
|
108
|
+
t(z)(r.value) ? (a(), U("div", be, [
|
|
109
|
+
(a(!0), U(ie, null, ae(r.value, (l) => (a(), d(Ce, {
|
|
110
|
+
key: l.id ?? l.name,
|
|
111
111
|
size: "small",
|
|
112
112
|
class: "ml-1"
|
|
113
113
|
}, {
|
|
114
114
|
default: i(() => [
|
|
115
115
|
se("div", Ve, [
|
|
116
|
-
C(b(
|
|
116
|
+
C(b(t(q)(l, e.itemTitle)) + " ", 1),
|
|
117
117
|
s(h, {
|
|
118
118
|
color: "error",
|
|
119
|
-
icon:
|
|
119
|
+
icon: t(m).close,
|
|
120
120
|
size: "small",
|
|
121
121
|
class: "ml-1",
|
|
122
|
-
onClick: (k) =>
|
|
122
|
+
onClick: (k) => t(L)(l)
|
|
123
123
|
}, null, 8, ["icon", "onClick"])
|
|
124
124
|
])
|
|
125
125
|
]),
|
|
@@ -128,11 +128,11 @@ const be = {
|
|
|
128
128
|
])) : y("", !0),
|
|
129
129
|
s(ve, {
|
|
130
130
|
transition: "fade",
|
|
131
|
-
"onClick:outside":
|
|
132
|
-
modelValue:
|
|
133
|
-
"onUpdate:modelValue": o[1] || (o[1] = (
|
|
131
|
+
"onClick:outside": t(I),
|
|
132
|
+
modelValue: t(u),
|
|
133
|
+
"onUpdate:modelValue": o[1] || (o[1] = (l) => R(u) ? u.value = l : null),
|
|
134
134
|
activator: "parent",
|
|
135
|
-
"parent-ref":
|
|
135
|
+
"parent-ref": t(p),
|
|
136
136
|
onHandleEscape: Q,
|
|
137
137
|
"close-on-content-click": e.closeOnSelect,
|
|
138
138
|
"max-height": e.maxHeight,
|
|
@@ -140,17 +140,17 @@ const be = {
|
|
|
140
140
|
}, {
|
|
141
141
|
default: i(() => [
|
|
142
142
|
s(me, {
|
|
143
|
-
"onUpdate:selected":
|
|
144
|
-
"onClick:select": o[0] || (o[0] = (
|
|
143
|
+
"onUpdate:selected": t(O),
|
|
144
|
+
"onClick:select": o[0] || (o[0] = (l) => t(I)()),
|
|
145
145
|
ref_key: "listRef",
|
|
146
146
|
ref: w,
|
|
147
147
|
onKeyDown: ee
|
|
148
148
|
}, {
|
|
149
149
|
default: i(() => [
|
|
150
|
-
|
|
150
|
+
t(G) ? (a(), d(B, { key: 0 }, {
|
|
151
151
|
default: i(() => [
|
|
152
152
|
s(ge, {
|
|
153
|
-
onClick:
|
|
153
|
+
onClick: t(P),
|
|
154
154
|
class: "w-full",
|
|
155
155
|
color: "bg-green-400"
|
|
156
156
|
}, {
|
|
@@ -165,33 +165,33 @@ const be = {
|
|
|
165
165
|
})) : y("", !0),
|
|
166
166
|
s(ce, {
|
|
167
167
|
items: V.value,
|
|
168
|
-
search:
|
|
168
|
+
search: t(c),
|
|
169
169
|
"searchable-keys": n.searchableKeys,
|
|
170
170
|
"items-per-intersection": 10,
|
|
171
|
-
enabled:
|
|
171
|
+
enabled: t(u),
|
|
172
172
|
virtual: !1,
|
|
173
173
|
"item-height": 48
|
|
174
174
|
}, {
|
|
175
|
-
default: i(({ item:
|
|
175
|
+
default: i(({ item: l, index: k }) => {
|
|
176
176
|
var D, x;
|
|
177
177
|
return [
|
|
178
178
|
(a(), d(B, {
|
|
179
|
-
value:
|
|
180
|
-
key: ((D =
|
|
181
|
-
disabled:
|
|
182
|
-
class: ue(J(
|
|
179
|
+
value: l,
|
|
180
|
+
key: ((D = l.id) == null ? void 0 : D.toString()) ?? l.name,
|
|
181
|
+
disabled: t(W)(l),
|
|
182
|
+
class: ue(J(l)),
|
|
183
183
|
density: e.density,
|
|
184
|
-
id: ((x =
|
|
184
|
+
id: ((x = l.id) == null ? void 0 : x.toString()) ?? l.name
|
|
185
185
|
}, {
|
|
186
186
|
default: i(() => [
|
|
187
187
|
s(fe, { class: "text-wrap" }, {
|
|
188
188
|
default: i(() => [
|
|
189
|
-
C(b(
|
|
189
|
+
C(b(t(_)(l, t(j), "hasDefault")), 1)
|
|
190
190
|
]),
|
|
191
191
|
_: 2
|
|
192
192
|
}, 1024),
|
|
193
193
|
s(pe, {
|
|
194
|
-
textContent: b(e.itemSubtitle ?
|
|
194
|
+
textContent: b(e.itemSubtitle ? t(_)(l, e.itemSubtitle) : "")
|
|
195
195
|
}, null, 8, ["textContent"])
|
|
196
196
|
]),
|
|
197
197
|
_: 2
|
|
@@ -214,25 +214,25 @@ const be = {
|
|
|
214
214
|
fn: i(() => [
|
|
215
215
|
e.clearable && r.value ? (a(), d(h, {
|
|
216
216
|
key: 0,
|
|
217
|
-
onClick:
|
|
217
|
+
onClick: t(N),
|
|
218
218
|
size: "small",
|
|
219
219
|
color: "error",
|
|
220
|
-
icon:
|
|
220
|
+
icon: t(m).close,
|
|
221
221
|
class: "mr-1 mt-1"
|
|
222
222
|
}, null, 8, ["onClick", "icon"])) : y("", !0),
|
|
223
223
|
s(h, {
|
|
224
224
|
color: "teal-darken-1",
|
|
225
225
|
size: "large",
|
|
226
226
|
class: "cursor-pointer",
|
|
227
|
-
icon:
|
|
228
|
-
onClick: F(
|
|
227
|
+
icon: t(u) ? t(m).menuUpOutline : t(m).menuDownOutline,
|
|
228
|
+
onClick: F(t(K), ["stop"])
|
|
229
229
|
}, null, 8, ["icon", "onClick"]),
|
|
230
230
|
e.required ? (a(), d(h, {
|
|
231
231
|
key: 1,
|
|
232
232
|
color: "teal-darken-1",
|
|
233
233
|
size: "x-small",
|
|
234
234
|
class: "mb-4",
|
|
235
|
-
icon:
|
|
235
|
+
icon: t(m).asterisk
|
|
236
236
|
}, null, 8, ["icon"])) : y("", !0)
|
|
237
237
|
]),
|
|
238
238
|
key: "0"
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ref as c, computed as
|
|
2
|
-
import { isArray as
|
|
3
|
-
function J(t,
|
|
4
|
-
const
|
|
1
|
+
import { ref as c, computed as m, watch as w } from "vue";
|
|
2
|
+
import { isArray as b, isObject as s } from "../../../../utils/utils.js";
|
|
3
|
+
function J(t, j, u, a, C) {
|
|
4
|
+
const i = c(null), v = c(null), g = c(null), f = c(!1), o = c(""), F = (e, n) => n.split(".").reduce((r, l) => r && r[l] !== void 0 ? r[l] : null, e), k = m(() => i.value ? b(i.value) ? i.value.length ? h(i.value, t.itemTitle, "hasDefault") : t.placeholderText : s(i.value) ? h(i.value, t.itemTitle, "hasDefault") : i.value.toString() : a.value.length ? t.placeholderText : t.textNoItems), B = m(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
|
|
5
5
|
function h(e, n, r) {
|
|
6
6
|
if (s(e)) {
|
|
7
7
|
if (n) {
|
|
8
|
-
if (
|
|
9
|
-
return n.map((
|
|
8
|
+
if (b(n))
|
|
9
|
+
return n.map((l) => e[l] ?? "No definido").join(" - ");
|
|
10
10
|
if (n.includes(","))
|
|
11
|
-
return n.split(",").map((
|
|
11
|
+
return n.split(",").map((l) => e[l]).join(" - ");
|
|
12
12
|
if (n.includes(".")) {
|
|
13
|
-
const
|
|
14
|
-
let
|
|
15
|
-
for (const z of
|
|
16
|
-
|
|
17
|
-
return
|
|
13
|
+
const l = n.split(".");
|
|
14
|
+
let d = e;
|
|
15
|
+
for (const z of l)
|
|
16
|
+
d = d[z];
|
|
17
|
+
return d;
|
|
18
18
|
}
|
|
19
19
|
return !t.returnObject && typeof e[n] == "number" || e[n] ? e[n].toString() : "";
|
|
20
20
|
}
|
|
21
21
|
if (r)
|
|
22
22
|
return Object.values(e)[0];
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return b(e) ? t.returnObject ? e.map((l) => l[n]).join(" - ") : e.map((l) => l).join(" - ") : r && typeof e != "number" && e.includes(",") ? e.split(",") : e;
|
|
25
25
|
}
|
|
26
26
|
function R(e) {
|
|
27
27
|
try {
|
|
28
|
-
x.value = !1,
|
|
28
|
+
x.value = !1, i.value = e, t.multiple ? (u.value || (u.value = []), y(e) ? e && S(e) : t.returnObject ? u.value.push(e) : s(e) ? t.itemValue ? u.value.push(e[t.itemValue]) : u.value.push(Object.values(e)[0]) : u.value.push(e)) : (t.returnObject ? u.value = e : s(e) ? t.itemValue ? u.value = e[t.itemValue] : u.value = Object.values(e)[0] : u.value = e, f.value = !1), j("selectedItem", i.value), t.clearOnSelect && M(), x.value = !0;
|
|
29
29
|
} catch (n) {
|
|
30
30
|
console.log(n);
|
|
31
31
|
} finally {
|
|
@@ -33,23 +33,23 @@ function J(t, w, u, a, C) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
const x = c(!0);
|
|
36
|
-
|
|
37
|
-
x.value && (
|
|
38
|
-
}, { immediate: !0 }),
|
|
39
|
-
|
|
36
|
+
w(() => u.value, (e) => {
|
|
37
|
+
x.value && (i.value = I(e));
|
|
38
|
+
}, { immediate: !0 }), w(() => a.value, () => {
|
|
39
|
+
i.value = I(u.value);
|
|
40
40
|
}, { immediate: !0 });
|
|
41
|
-
function g(e) {
|
|
42
|
-
return e ? t.returnObject ? e : t.multiple && Array.isArray(e) ? e.map((r) => a.value.find((i) => i[t.itemValue] === r)).filter(Boolean) : a.value.find((r) => r[t.itemValue] === e) || null : null;
|
|
43
|
-
}
|
|
44
41
|
function I(e) {
|
|
42
|
+
return e ? t.returnObject ? e : t.multiple && Array.isArray(e) ? e.map((r) => a.value.find((l) => l[t.itemValue] === r)).filter(Boolean) : a.value.find((r) => r[t.itemValue] === e) || null : null;
|
|
43
|
+
}
|
|
44
|
+
function y(e) {
|
|
45
45
|
return u.value === null ? !1 : e ? u.value.some(
|
|
46
46
|
(n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
|
|
47
47
|
) : !0;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function S(e) {
|
|
50
50
|
if (t.returnObject) {
|
|
51
51
|
const n = u.value.find(
|
|
52
|
-
(
|
|
52
|
+
(l) => l[t.itemValue] === e[t.itemValue]
|
|
53
53
|
), r = u.value.indexOf(n);
|
|
54
54
|
u.value.splice(r, 1);
|
|
55
55
|
} else {
|
|
@@ -60,42 +60,42 @@ function J(t, w, u, a, C) {
|
|
|
60
60
|
function D(e) {
|
|
61
61
|
t.clearSearchOnSelect && (o.value = ""), t.focusOnSelect && O();
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function T() {
|
|
64
64
|
f.value || (f.value = !0);
|
|
65
65
|
}
|
|
66
66
|
function N() {
|
|
67
67
|
f.value = !f.value;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function A(e) {
|
|
70
70
|
return e.length === 1 && e.match(/\w/);
|
|
71
71
|
}
|
|
72
72
|
function O() {
|
|
73
73
|
v.value.inputField.focus();
|
|
74
74
|
}
|
|
75
75
|
function E() {
|
|
76
|
-
f.value = !0,
|
|
76
|
+
f.value = !0, g.value && v.value.$el.focus();
|
|
77
77
|
}
|
|
78
78
|
function K(e) {
|
|
79
79
|
const n = e.key;
|
|
80
|
-
(
|
|
80
|
+
(A(n) || n === "Backspace") && (T(), O());
|
|
81
81
|
}
|
|
82
82
|
function P() {
|
|
83
|
-
f.value = !1,
|
|
83
|
+
f.value = !1, j("createItem");
|
|
84
84
|
}
|
|
85
85
|
function $(e) {
|
|
86
86
|
let n = u.value.indexOf(e);
|
|
87
87
|
u.value.splice(n, 1);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
o.value = "", u.value = null,
|
|
89
|
+
function M() {
|
|
90
|
+
o.value = "", u.value = null, i.value = null;
|
|
91
91
|
}
|
|
92
92
|
function q(e) {
|
|
93
93
|
return !!e.disabledItem;
|
|
94
94
|
}
|
|
95
95
|
return {
|
|
96
|
-
selectedItem:
|
|
96
|
+
selectedItem: i,
|
|
97
97
|
textFieldRef: v,
|
|
98
|
-
listRef:
|
|
98
|
+
listRef: g,
|
|
99
99
|
menuModel: f,
|
|
100
100
|
search: o,
|
|
101
101
|
getItemText: F,
|
|
@@ -103,18 +103,18 @@ function J(t, w, u, a, C) {
|
|
|
103
103
|
textArr: B,
|
|
104
104
|
itemToString: h,
|
|
105
105
|
getSelectedItem: R,
|
|
106
|
-
checkIfValueExist:
|
|
107
|
-
removeFromArray:
|
|
106
|
+
checkIfValueExist: y,
|
|
107
|
+
removeFromArray: S,
|
|
108
108
|
lightReset: D,
|
|
109
|
-
openMenu:
|
|
109
|
+
openMenu: T,
|
|
110
110
|
toggleMenu: N,
|
|
111
111
|
focusOnMenu: E,
|
|
112
112
|
onMenuKeydown: K,
|
|
113
113
|
createItem: P,
|
|
114
114
|
removeItem: $,
|
|
115
|
-
clearSelection:
|
|
115
|
+
clearSelection: M,
|
|
116
116
|
checkDisabled: q,
|
|
117
|
-
isAlphanumeric:
|
|
117
|
+
isAlphanumeric: A
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
export {
|