adverich-kun-ui 0.1.30 → 0.1.32
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.
- package/dist/_virtual/_plugin-vue_export-helper.js +9 -1
- package/dist/components/KunAlert/src/components/KunAlert.vue.js +49 -1
- package/dist/components/KunAppbar/src/components/KunAppbar.vue.js +127 -1
- package/dist/components/KunAppbarTitle/src/components/KunAppbarTitle.vue.js +31 -1
- package/dist/components/KunAutocomplete/src/components/KunAutocomplete.vue.js +140 -1
- package/dist/components/KunAutocomplete/src/composables/KunAutocompleteProps.js +104 -1
- package/dist/components/KunAutocomplete/src/composables/useAutocomplete.js +119 -1
- package/dist/components/KunAutocomplete/src/utils/helpers.js +10 -1
- package/dist/components/KunBtn/src/components/KunBtn.vue.js +98 -1
- package/dist/components/KunBudge/src/components/KunBudge.vue.js +43 -1
- package/dist/components/KunCard/src/components/KunCard.vue.js +53 -1
- package/dist/components/KunCardText/src/components/KunCardText.vue.js +59 -1
- package/dist/components/KunCurrency/src/components/KunCurrency.vue.js +105 -1
- package/dist/components/KunIcon/src/components/KunIcon.vue.js +54 -1
- package/dist/components/KunList/src/components/KunList.vue.js +9 -1
- package/dist/components/KunSpacer/src/components/KunSpacer.vue.js +25 -1
- package/dist/components/KunTextField/src/components/KunTextField.vue.js +75 -1
- package/dist/components/KunTextField/src/composables/KunTextFieldProps.js +33 -1
- package/dist/components/KunToolbar/src/components/KunToolbar.vue.js +29 -1
- package/dist/index.js +51 -1
- package/package.json +1 -1
|
@@ -1 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
import { resolveComponent as i, createElementBlock as o, openBlock as n, createElementVNode as e, createVNode as d, createCommentVNode as a, toDisplayString as s } from "vue";
|
|
2
|
+
const c = {
|
|
3
|
+
class: "h-svh top-0 left-0 bg-grey-900 w-full overflow-y-auto opacity-90",
|
|
4
|
+
style: { position: "fixed", "z-index": "2500" }
|
|
5
|
+
}, r = { class: "rounded-lg px-16 py-14" }, u = { class: "flex justify-center py-4" }, m = { class: "rounded-full bg-red-200 p-6" }, _ = { class: "text-center flex flex-col justify-center items-center bg-red-500 rounded-lg p-4" }, f = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "my-4 text-center text-3xl font-semibold"
|
|
8
|
+
}, p = { class: "text-xl font-normal" }, v = {
|
|
9
|
+
__name: "KunAlert",
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: !1
|
|
14
|
+
},
|
|
15
|
+
title: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "Congratulation !!"
|
|
18
|
+
},
|
|
19
|
+
message: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "Your order have been taken and is being attended to"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
emits: ["update:modelValue"],
|
|
25
|
+
setup(t, { emit: x }) {
|
|
26
|
+
return (y, g) => {
|
|
27
|
+
const l = i("KunIcon");
|
|
28
|
+
return n(), o("div", c, [
|
|
29
|
+
e("div", r, [
|
|
30
|
+
e("div", u, [
|
|
31
|
+
e("div", m, [
|
|
32
|
+
d(l, {
|
|
33
|
+
icon: "exclamation",
|
|
34
|
+
size: "text-9xl"
|
|
35
|
+
})
|
|
36
|
+
])
|
|
37
|
+
]),
|
|
38
|
+
e("div", _, [
|
|
39
|
+
t.title ? (n(), o("div", f, s(t.title), 1)) : a("", !0),
|
|
40
|
+
e("div", p, s(t.message), 1)
|
|
41
|
+
])
|
|
42
|
+
])
|
|
43
|
+
]);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
v as default
|
|
49
|
+
};
|
|
@@ -1 +1,127 @@
|
|
|
1
|
-
|
|
1
|
+
import { computed as u, createElementBlock as o, openBlock as i, normalizeClass as m, createElementVNode as a, createCommentVNode as r, renderSlot as s, createBlock as h, createVNode as g } from "vue";
|
|
2
|
+
import d from "../../../KunAppbarTitle/src/components/KunAppbarTitle.vue.js";
|
|
3
|
+
const y = { class: "flex items-center gap-2" }, S = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "flex-1 flex justify-center"
|
|
6
|
+
}, w = {
|
|
7
|
+
key: 1,
|
|
8
|
+
class: "flex-1 flex justify-end"
|
|
9
|
+
}, x = { class: "flex items-center gap-2 ml-auto" }, z = {
|
|
10
|
+
__name: "KunAppbar",
|
|
11
|
+
props: {
|
|
12
|
+
bgColor: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "bg-green-700"
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
titleImage: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ""
|
|
23
|
+
},
|
|
24
|
+
titleSize: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "text-base"
|
|
27
|
+
},
|
|
28
|
+
titleWeight: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "font-medium"
|
|
31
|
+
},
|
|
32
|
+
titlePosition: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "center",
|
|
35
|
+
validator: (t) => ["left", "center", "right"].includes(t)
|
|
36
|
+
},
|
|
37
|
+
density: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "default"
|
|
40
|
+
},
|
|
41
|
+
elevation: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "md"
|
|
44
|
+
},
|
|
45
|
+
bordered: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
showDrawerButton: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: !0
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
setup(t) {
|
|
55
|
+
const l = t, f = u(() => {
|
|
56
|
+
switch (l.density) {
|
|
57
|
+
case "comfortable":
|
|
58
|
+
return "h-12 py-1";
|
|
59
|
+
case "compact":
|
|
60
|
+
return "h-10 py-0.5";
|
|
61
|
+
default:
|
|
62
|
+
return "h-14 py-2";
|
|
63
|
+
}
|
|
64
|
+
}), c = u(() => {
|
|
65
|
+
const e = ["sm", "md", "lg", "xl", "2xl"];
|
|
66
|
+
return l.elevation === "none" || !e.includes(l.elevation) ? "" : `shadow-${l.elevation}`;
|
|
67
|
+
});
|
|
68
|
+
return (e, n) => (i(), o("header", {
|
|
69
|
+
class: m(["flex items-center px-4 w-full", [f.value, t.bgColor, c.value, t.bordered ? "border-b border-gray-200" : ""]])
|
|
70
|
+
}, [
|
|
71
|
+
a("div", y, [
|
|
72
|
+
s(e.$slots, "appbarButton", {}, () => [
|
|
73
|
+
t.showDrawerButton ? (i(), o("button", {
|
|
74
|
+
key: 0,
|
|
75
|
+
class: "p-2 rounded-md hover:bg-white/10 transition",
|
|
76
|
+
onClick: n[0] || (n[0] = (v) => e.$emit("toggle-drawer"))
|
|
77
|
+
}, n[1] || (n[1] = [
|
|
78
|
+
a("svg", {
|
|
79
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
80
|
+
class: "h-5 w-5 text-white",
|
|
81
|
+
fill: "none",
|
|
82
|
+
viewBox: "0 0 24 24",
|
|
83
|
+
stroke: "currentColor"
|
|
84
|
+
}, [
|
|
85
|
+
a("path", {
|
|
86
|
+
"stroke-linecap": "round",
|
|
87
|
+
"stroke-linejoin": "round",
|
|
88
|
+
"stroke-width": "2",
|
|
89
|
+
d: "M4 6h16M4 12h16M4 18h16"
|
|
90
|
+
})
|
|
91
|
+
], -1)
|
|
92
|
+
]))) : r("", !0)
|
|
93
|
+
]),
|
|
94
|
+
s(e.$slots, "prepend"),
|
|
95
|
+
t.title && t.titlePosition === "left" ? (i(), h(d, {
|
|
96
|
+
key: 0,
|
|
97
|
+
title: t.title,
|
|
98
|
+
titleImage: t.titleImage,
|
|
99
|
+
textSize: t.titleSize,
|
|
100
|
+
fontWeight: t.titleWeight
|
|
101
|
+
}, null, 8, ["title", "titleImage", "textSize", "fontWeight"])) : r("", !0)
|
|
102
|
+
]),
|
|
103
|
+
t.title && t.titlePosition === "center" ? (i(), o("div", S, [
|
|
104
|
+
g(d, {
|
|
105
|
+
title: t.title,
|
|
106
|
+
titleImage: t.titleImage,
|
|
107
|
+
textSize: t.titleSize,
|
|
108
|
+
fontWeight: t.titleWeight
|
|
109
|
+
}, null, 8, ["title", "titleImage", "textSize", "fontWeight"])
|
|
110
|
+
])) : r("", !0),
|
|
111
|
+
t.title && t.titlePosition === "right" ? (i(), o("div", w, [
|
|
112
|
+
g(d, {
|
|
113
|
+
title: t.title,
|
|
114
|
+
titleImage: t.titleImage,
|
|
115
|
+
textSize: t.titleSize,
|
|
116
|
+
fontWeight: t.titleWeight
|
|
117
|
+
}, null, 8, ["title", "titleImage", "textSize", "fontWeight"])
|
|
118
|
+
])) : r("", !0),
|
|
119
|
+
a("div", x, [
|
|
120
|
+
s(e.$slots, "actions")
|
|
121
|
+
])
|
|
122
|
+
], 2));
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
export {
|
|
126
|
+
z as default
|
|
127
|
+
};
|
|
@@ -1 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import { createElementBlock as e, openBlock as i, normalizeClass as n, toDisplayString as a } from "vue";
|
|
2
|
+
const l = ["src"], c = { key: 1 }, m = {
|
|
3
|
+
__name: "KunAppbarTitle",
|
|
4
|
+
props: {
|
|
5
|
+
title: String,
|
|
6
|
+
titleImage: String,
|
|
7
|
+
textSize: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "text-base"
|
|
10
|
+
},
|
|
11
|
+
fontWeight: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "font-medium"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
setup(t) {
|
|
17
|
+
return (o, s) => (i(), e("div", {
|
|
18
|
+
class: n(["flex items-center min-w-0 truncate", [t.textSize, t.fontWeight]])
|
|
19
|
+
}, [
|
|
20
|
+
t.titleImage ? (i(), e("img", {
|
|
21
|
+
key: 0,
|
|
22
|
+
src: t.titleImage,
|
|
23
|
+
alt: "Logo",
|
|
24
|
+
class: "h-6 object-contain"
|
|
25
|
+
}, null, 8, l)) : (i(), e("span", c, a(t.title), 1))
|
|
26
|
+
], 2));
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
m as default
|
|
31
|
+
};
|
|
@@ -1 +1,140 @@
|
|
|
1
|
-
|
|
1
|
+
import { mergeModels as K, ref as $, useModel as g, watchEffect as D, resolveComponent as u, createElementBlock as x, openBlock as a, Fragment as H, createCommentVNode as f, createElementVNode as v, unref as e, createVNode as c, withDirectives as L, withKeys as U, isRef as j, createSlots as C, withCtx as m, createBlock as I, normalizeClass as q, createTextVNode as G, vShow as J } from "vue";
|
|
2
|
+
import Q from "../composables/KunAutocompleteProps.js";
|
|
3
|
+
import { useAutocomplete as W } from "../composables/useAutocomplete.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import X from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
+
const Y = { class: "relative" }, Z = ["close-on-content-click", "max-height"], ee = { class: "w-full px-2 py-1" }, te = {
|
|
7
|
+
__name: "KunAutocomplete",
|
|
8
|
+
props: /* @__PURE__ */ K(Q, {
|
|
9
|
+
modelValue: { default: null },
|
|
10
|
+
modelModifiers: {},
|
|
11
|
+
items: { default: [], type: Array },
|
|
12
|
+
itemsModifiers: {}
|
|
13
|
+
}),
|
|
14
|
+
emits: /* @__PURE__ */ K(["createItem"], ["update:modelValue", "update:items"]),
|
|
15
|
+
setup(d, { emit: b }) {
|
|
16
|
+
const V = d;
|
|
17
|
+
$(0);
|
|
18
|
+
const l = g(d, "modelValue"), y = g(d, "items"), w = b, {
|
|
19
|
+
selectedItem: n,
|
|
20
|
+
textFieldRef: E,
|
|
21
|
+
menuModel: s,
|
|
22
|
+
search: r,
|
|
23
|
+
isCloseOnSelect: M,
|
|
24
|
+
setSelectedItemValue: N,
|
|
25
|
+
placeholder: S,
|
|
26
|
+
openMenu: _,
|
|
27
|
+
closeMenu: h,
|
|
28
|
+
focusOnMenu: k,
|
|
29
|
+
createItem: B,
|
|
30
|
+
clearSelection: F
|
|
31
|
+
} = W(V, w, l, y);
|
|
32
|
+
D(() => {
|
|
33
|
+
isObject(l.value) && !isNotEmpty(l.value) && (n.value = {}), isArray(l.value) && !isNotEmpty(l.value) && (n.value = []), l.value === null && (n.value = null), N();
|
|
34
|
+
});
|
|
35
|
+
function z(t) {
|
|
36
|
+
r.value = "", l.value = t, h();
|
|
37
|
+
}
|
|
38
|
+
return (t, o) => {
|
|
39
|
+
const p = u("KunIcon"), A = u("KunTextField"), O = u("KunBtn"), P = u("KunListItem"), R = u("KunVirtualScroller");
|
|
40
|
+
return a(), x(H, null, [
|
|
41
|
+
e(s) ? (a(), x("div", {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "fixed opacity-10 w-svw inset-0 h-svh",
|
|
44
|
+
onClick: o[0] || (o[0] = (i) => s.value = !1)
|
|
45
|
+
})) : f("", !0),
|
|
46
|
+
v("div", Y, [
|
|
47
|
+
c(A, {
|
|
48
|
+
modelValue: e(r),
|
|
49
|
+
"onUpdate:modelValue": o[2] || (o[2] = (i) => j(r) ? r.value = i : null),
|
|
50
|
+
ref_key: "textFieldRef",
|
|
51
|
+
ref: E,
|
|
52
|
+
placeholder: t.isArray(e(n)) && e(n).length ? "" : e(S),
|
|
53
|
+
onKeyup: U(e(k), ["down"]),
|
|
54
|
+
onClickInput: e(_),
|
|
55
|
+
onPressEsc: e(h),
|
|
56
|
+
onChange: o[3] || (o[3] = (i) => console.log("change")),
|
|
57
|
+
onFocusInput: e(k)
|
|
58
|
+
}, C({ _: 2 }, [
|
|
59
|
+
t.hasIcons ? {
|
|
60
|
+
name: "append-inner",
|
|
61
|
+
fn: m(() => [
|
|
62
|
+
t.clearable && e(n) ? (a(), I(p, {
|
|
63
|
+
key: 0,
|
|
64
|
+
onClick: e(F),
|
|
65
|
+
size: "text-xl",
|
|
66
|
+
color: "text-error",
|
|
67
|
+
icon: "close",
|
|
68
|
+
class: q(["mr-1", t.isNotEmpty(e(n)) ? "cursor-pointer" : "cursor-default"]),
|
|
69
|
+
disabled: !t.isNotEmpty(e(n))
|
|
70
|
+
}, null, 8, ["onClick", "class", "disabled"])) : f("", !0),
|
|
71
|
+
c(p, {
|
|
72
|
+
color: "text-accent-button",
|
|
73
|
+
size: "text-xl",
|
|
74
|
+
class: "cursor-pointer",
|
|
75
|
+
icon: e(s) ? "menuUp" : "menuDown",
|
|
76
|
+
onClick: o[1] || (o[1] = (i) => s.value = !e(s))
|
|
77
|
+
}, null, 8, ["icon"]),
|
|
78
|
+
t.required ? (a(), I(p, {
|
|
79
|
+
key: 1,
|
|
80
|
+
color: "text-red-900",
|
|
81
|
+
size: "text-lg",
|
|
82
|
+
class: "mb-3",
|
|
83
|
+
icon: "asterisk"
|
|
84
|
+
})) : f("", !0)
|
|
85
|
+
]),
|
|
86
|
+
key: "0"
|
|
87
|
+
} : void 0
|
|
88
|
+
]), 1032, ["modelValue", "placeholder", "onKeyup", "onClickInput", "onPressEsc", "onFocusInput"]),
|
|
89
|
+
L(v("div", {
|
|
90
|
+
class: "absolute h-fit left-0 w-full z-50 bg-surface rounded-b border border-field-border-focus ring-1 focus:ring-field-ring-focus",
|
|
91
|
+
"close-on-content-click": e(M),
|
|
92
|
+
"max-height": t.maxHeight
|
|
93
|
+
}, [
|
|
94
|
+
c(R, {
|
|
95
|
+
items: y.value,
|
|
96
|
+
search: e(r),
|
|
97
|
+
searchBy: "name",
|
|
98
|
+
maxHeight: 250
|
|
99
|
+
}, C({
|
|
100
|
+
default: m(({ item: i, itemKey: T }) => [
|
|
101
|
+
c(P, {
|
|
102
|
+
item: i,
|
|
103
|
+
itemKey: T,
|
|
104
|
+
title: "name",
|
|
105
|
+
cursor: "cursor-pointer",
|
|
106
|
+
onSelect: z
|
|
107
|
+
}, null, 8, ["item", "itemKey"])
|
|
108
|
+
]),
|
|
109
|
+
_: 2
|
|
110
|
+
}, [
|
|
111
|
+
t.hasCreateItem ? {
|
|
112
|
+
name: "topButton",
|
|
113
|
+
fn: m(() => [
|
|
114
|
+
v("div", ee, [
|
|
115
|
+
c(O, {
|
|
116
|
+
onClick: e(B),
|
|
117
|
+
class: "w-full rounded-md bg-accent-button",
|
|
118
|
+
size: "xs"
|
|
119
|
+
}, {
|
|
120
|
+
default: m(() => o[4] || (o[4] = [
|
|
121
|
+
G("Crear item")
|
|
122
|
+
])),
|
|
123
|
+
_: 1
|
|
124
|
+
}, 8, ["onClick"])
|
|
125
|
+
])
|
|
126
|
+
]),
|
|
127
|
+
key: "0"
|
|
128
|
+
} : void 0
|
|
129
|
+
]), 1032, ["items", "search"])
|
|
130
|
+
], 8, Z), [
|
|
131
|
+
[J, e(s)]
|
|
132
|
+
])
|
|
133
|
+
])
|
|
134
|
+
], 64);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}, re = /* @__PURE__ */ X(te, [["__scopeId", "data-v-c3a2b846"]]);
|
|
138
|
+
export {
|
|
139
|
+
re as default
|
|
140
|
+
};
|
|
@@ -1 +1,104 @@
|
|
|
1
|
-
|
|
1
|
+
const e = {
|
|
2
|
+
label: {
|
|
3
|
+
type: String
|
|
4
|
+
},
|
|
5
|
+
itemValue: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: ""
|
|
8
|
+
},
|
|
9
|
+
itemTitle: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
itemText: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
itemSubtitle: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
returnObject: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: !1
|
|
24
|
+
},
|
|
25
|
+
searchableKeys: {
|
|
26
|
+
type: Array,
|
|
27
|
+
default: []
|
|
28
|
+
},
|
|
29
|
+
focusOnSelect: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !1
|
|
32
|
+
},
|
|
33
|
+
clearable: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !1
|
|
36
|
+
},
|
|
37
|
+
clearOnSelect: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: !1
|
|
40
|
+
},
|
|
41
|
+
clearSearchOnSelect: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !0
|
|
44
|
+
},
|
|
45
|
+
closeOnSelect: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !0
|
|
48
|
+
},
|
|
49
|
+
startEmtpy: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: !1
|
|
52
|
+
},
|
|
53
|
+
placeholderText: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "Seleccionar"
|
|
56
|
+
},
|
|
57
|
+
textNoItems: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "No hay elementos"
|
|
60
|
+
},
|
|
61
|
+
hasCreateItem: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: !1
|
|
64
|
+
},
|
|
65
|
+
multiple: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: !1
|
|
68
|
+
},
|
|
69
|
+
required: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: !1
|
|
72
|
+
},
|
|
73
|
+
// ***** STYLE ***** //
|
|
74
|
+
maxHeight: {
|
|
75
|
+
default: 500
|
|
76
|
+
},
|
|
77
|
+
density: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "comfortable"
|
|
80
|
+
},
|
|
81
|
+
hideDetails: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: !0
|
|
84
|
+
},
|
|
85
|
+
hasIcons: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: !0
|
|
88
|
+
},
|
|
89
|
+
bgItemListColor: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: "bg-transparent"
|
|
92
|
+
},
|
|
93
|
+
selectedColor: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: "bg-primary"
|
|
96
|
+
},
|
|
97
|
+
attach: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: !1
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
e as default
|
|
104
|
+
};
|
|
@@ -1 +1,119 @@
|
|
|
1
|
-
|
|
1
|
+
import { ref as O, computed as r } from "vue";
|
|
2
|
+
import { isArray as b, isObject as i } from "../utils/helpers.js";
|
|
3
|
+
function J(t, T, l, h) {
|
|
4
|
+
const n = O(null), o = O(null), y = O(null), v = O(!1), f = O(""), I = r(() => !t.searchableKeys.length), j = r(() => t.clearOnSelect);
|
|
5
|
+
r(() => t.clearSearchOnSelect), r(() => t.focusOnSelect);
|
|
6
|
+
const m = r(() => t.closeOnSelect);
|
|
7
|
+
function d() {
|
|
8
|
+
b(l.value) && (l.value.length ? n.value = h.value.filter(
|
|
9
|
+
(e) => i(e) ? l.value.some(
|
|
10
|
+
(u) => u[t.itemTitle].includes(e[t.itemTitle])
|
|
11
|
+
) : l.value.some((u) => u.includes(e))
|
|
12
|
+
) : n.value = []), (i(l.value) && Object.keys(l.value).length || typeof l.value == "number" && l.value || typeof l.value == "string" && l.value || typeof l.value == "boolean") && (n.value = h.value.find(
|
|
13
|
+
(e) => i(e) ? t.returnObject ? t.itemValue ? e[t.itemValue] === l.value[t.itemValue] : e[t.itemTitle] === l.value[t.itemTitle] : e[t.itemValue] === l.value : e === l.value
|
|
14
|
+
));
|
|
15
|
+
}
|
|
16
|
+
const C = r(() => n.value ? b(n.value) ? n.value.length ? S(n.value, t.itemTitle, "hasDefault") : t.placeholderText : i(n.value) ? S(n.value, t.itemTitle, "hasDefault") : n.value.toString() : h.value.length ? t.placeholderText : t.textNoItems), K = r(() => t.startEmtpy && f.value.length < 3 ? [] : h.value.filter((u) => {
|
|
17
|
+
if (i(u)) {
|
|
18
|
+
const s = Object.values(u).filter((c) => {
|
|
19
|
+
if (!i(c) && !b(c))
|
|
20
|
+
return c;
|
|
21
|
+
}), a = [u].reduce((c, B) => t.searchableKeys.map((q) => B[q]), []), x = I.value ? s : a;
|
|
22
|
+
return x ? x.some(
|
|
23
|
+
(c) => c ? c.toString().toLowerCase().includes(f.value.toLowerCase()) : ""
|
|
24
|
+
) : f.value ? u == f.value : u;
|
|
25
|
+
}
|
|
26
|
+
return u.toString().toLowerCase().includes(f.value.toLowerCase());
|
|
27
|
+
}).slice(0, currentBatchStep.value)), k = r(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
|
|
28
|
+
function S(e, u, s) {
|
|
29
|
+
if (i(e)) {
|
|
30
|
+
if (u)
|
|
31
|
+
return b(u) ? u.map((a) => e[a] ?? "No definido").join(" - ") : u.includes(",") ? u.split(",").map((a) => e[a]).join(" - ") : !t.returnObject && typeof e[u] == "number" || e[u] ? e[u].toString() : "";
|
|
32
|
+
if (s)
|
|
33
|
+
return Object.values(e)[0];
|
|
34
|
+
}
|
|
35
|
+
return b(e) ? t.returnObject ? e.map((a) => a[u]).join(" - ") : e.map((a) => a).join(" - ") : s && typeof e != "number" && e.includes(",") ? e.split(",") : e;
|
|
36
|
+
}
|
|
37
|
+
function w(e) {
|
|
38
|
+
let u = e[0];
|
|
39
|
+
if (!t.multiple)
|
|
40
|
+
n.value = e[0], t.returnObject && (l.value = u), !t.returnObject && i(u) && (t.itemValue ? l.value = u[t.itemValue] : l.value = Object.values(u)[0]), i(u) || (l.value = u), v.value = !1;
|
|
41
|
+
else if (n.value || (n.value = []), A(u))
|
|
42
|
+
F(u), l.value = n.value;
|
|
43
|
+
else {
|
|
44
|
+
if (t.returnObject && n.value.push(u), !t.returnObject && i(u))
|
|
45
|
+
if (t.itemValue)
|
|
46
|
+
n.value.push(u[t.itemValue]);
|
|
47
|
+
else {
|
|
48
|
+
l.value = n.value.push(Object.values(u)[0]);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
l.value = n.value;
|
|
52
|
+
}
|
|
53
|
+
j.value && g(), o.value.focus();
|
|
54
|
+
}
|
|
55
|
+
function A(e) {
|
|
56
|
+
return n.value === null ? !1 : n.value.some(
|
|
57
|
+
(u) => t.returnObject ? u[t.itemValue] === e[t.itemValue] : u === e[t.itemValue]
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function F(e) {
|
|
61
|
+
if (t.returnObject) {
|
|
62
|
+
let u = n.value.find(
|
|
63
|
+
(a) => a[t.itemValue] === e[t.itemValue]
|
|
64
|
+
), s = n.value.indexOf(u);
|
|
65
|
+
n.value.splice(s, 1);
|
|
66
|
+
} else {
|
|
67
|
+
let u = n.value.indexOf(e[t.itemValue]);
|
|
68
|
+
n.value.splice(u, 1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function L(e) {
|
|
72
|
+
e.key !== "Tab" && (v.value = !0);
|
|
73
|
+
}
|
|
74
|
+
function M(e) {
|
|
75
|
+
j.value && (v.value = !1);
|
|
76
|
+
}
|
|
77
|
+
function E() {
|
|
78
|
+
v.value = !0, y.value && y.value.focus();
|
|
79
|
+
}
|
|
80
|
+
function D() {
|
|
81
|
+
v.value = !1, T("createItem");
|
|
82
|
+
}
|
|
83
|
+
function N(e) {
|
|
84
|
+
let u = n.value.indexOf(e);
|
|
85
|
+
n.value.splice(u, 1), l.value = n.value;
|
|
86
|
+
}
|
|
87
|
+
function g() {
|
|
88
|
+
f.value = "", b(l.value) && (n.value = []), i(l.value) && (n.value = {}), typeof l.value == "number" && l.value && (n.value = 0), typeof l.value == "string" && l.value && (n.value = ""), typeof l.value == "boolean" && (n.value = !1), l.value = n.value;
|
|
89
|
+
}
|
|
90
|
+
function R(e) {
|
|
91
|
+
if (!e.disabledItem) return !1;
|
|
92
|
+
if (e.disabledItem) return !0;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
selectedItem: n,
|
|
96
|
+
textFieldRef: o,
|
|
97
|
+
listRef: y,
|
|
98
|
+
menuModel: v,
|
|
99
|
+
search: f,
|
|
100
|
+
isCloseOnSelect: m,
|
|
101
|
+
isClearOnSelect: j,
|
|
102
|
+
setSelectedItemValue: d,
|
|
103
|
+
placeholder: C,
|
|
104
|
+
filteredItems: K,
|
|
105
|
+
textArr: k,
|
|
106
|
+
itemToString: S,
|
|
107
|
+
getSelectedItem: w,
|
|
108
|
+
openMenu: L,
|
|
109
|
+
closeMenu: M,
|
|
110
|
+
focusOnMenu: E,
|
|
111
|
+
createItem: D,
|
|
112
|
+
removeItem: N,
|
|
113
|
+
clearSelection: g,
|
|
114
|
+
isDisabled: R
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
J as useAutocomplete
|
|
119
|
+
};
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
function t(r) {
|
|
2
|
+
return r !== null && typeof r == "object" && !Array.isArray(r);
|
|
3
|
+
}
|
|
4
|
+
function n(r) {
|
|
5
|
+
return Array.isArray(r);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
n as isArray,
|
|
9
|
+
t as isObject
|
|
10
|
+
};
|