@wikicasa-dev/components 2.2.8-alpha.15 → 2.2.8-alpha.16
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 { defineComponent as L, mergeModels as V, useModel as M, useTemplateRef as
|
|
1
|
+
import { defineComponent as L, mergeModels as V, useModel as M, useTemplateRef as b, shallowRef as s, onBeforeMount as N, watch as C, nextTick as O, createBlock as $, openBlock as c, withCtx as y, createElementBlock as B, Fragment as U, renderList as D, renderSlot as v, createElementVNode as d, normalizeClass as f, withDirectives as H, createCommentVNode as A, vModelText as P, toDisplayString as X, normalizeStyle as j, createTextVNode as q } from "vue";
|
|
2
2
|
import G from "../BaseDropDown.vue.js";
|
|
3
3
|
import '../../../../../assets/BaseDropDown.css';/* empty css */
|
|
4
4
|
import J from "../BaseSelect/SelectItem.vue.js";
|
|
@@ -25,34 +25,38 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], oe = /* @__PURE__ */ L
|
|
|
25
25
|
}),
|
|
26
26
|
emits: /* @__PURE__ */ V(["click", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
|
|
27
27
|
setup(l, { expose: x, emit: R }) {
|
|
28
|
-
const u = M(l, "open"),
|
|
29
|
-
o.value = "",
|
|
28
|
+
const u = M(l, "open"), a = M(l, "modelValue"), p = R, T = b("inputRef"), o = s(a.value?.label || ""), w = s(0), k = s(!1), h = s(null), i = s([]), z = b("dropdownRef"), m = b("hiddenSpan"), K = () => {
|
|
29
|
+
o.value = "", a.value = null, p("update:inputValue", "");
|
|
30
30
|
}, W = async (t) => {
|
|
31
31
|
if (p("update:inputValue", t), !t) {
|
|
32
|
-
|
|
32
|
+
i.value = [], u.value = !1;
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
i.value = await h.value?.(t) || [], k.value = !0, u.value = !!i.value.length;
|
|
36
36
|
}, S = (t = -1) => {
|
|
37
|
-
const e =
|
|
38
|
-
!e || e.id ===
|
|
37
|
+
const e = i.value[t];
|
|
38
|
+
!e || e.id === a.value?.id || (l.onOptionSelectedCb?.(e), o.value = e.label, u.value = !1, a.value = e, i.value = []);
|
|
39
39
|
}, I = () => {
|
|
40
40
|
T.value?.select();
|
|
41
41
|
};
|
|
42
42
|
return N(() => {
|
|
43
43
|
h.value = Q({ delay: 300 }, l.onInputChangeCb);
|
|
44
|
-
}),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
}), C(
|
|
45
|
+
o,
|
|
46
|
+
() => {
|
|
47
|
+
O(() => {
|
|
48
|
+
m.value && (w.value = m.value.offsetWidth);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
{ immediate: !0 }
|
|
52
|
+
), C(
|
|
49
53
|
() => z.value?.selectedIdx,
|
|
50
54
|
(t) => {
|
|
51
55
|
const e = t ?? -1;
|
|
52
56
|
e !== -1 && S(e);
|
|
53
57
|
}
|
|
54
|
-
),
|
|
55
|
-
|
|
58
|
+
), C(
|
|
59
|
+
a,
|
|
56
60
|
(t, e) => {
|
|
57
61
|
t === e || t?.label === o.value || (o.value = t?.label || "");
|
|
58
62
|
},
|
|
@@ -66,7 +70,7 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], oe = /* @__PURE__ */ L
|
|
|
66
70
|
"dropdown-element": "ul",
|
|
67
71
|
"dropdown-classes": ["uikit-z-30", l.dropdownClasses],
|
|
68
72
|
"open-dropdown": u.value,
|
|
69
|
-
"keep-state": !
|
|
73
|
+
"keep-state": !i.value.length || l.keepState === "closed" ? "closed" : "opened",
|
|
70
74
|
"activate-keyboard-controller": l.enableKeyboardController,
|
|
71
75
|
"reset-keyboard-controller": k.value,
|
|
72
76
|
"onUpdate:resetKeyboardController": e[2] || (e[2] = (n) => k.value = n),
|
|
@@ -87,7 +91,7 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], oe = /* @__PURE__ */ L
|
|
|
87
91
|
e[0] || (e[0] = (n) => o.value = n),
|
|
88
92
|
W
|
|
89
93
|
],
|
|
90
|
-
readonly: !!
|
|
94
|
+
readonly: !!a.value?.label,
|
|
91
95
|
class: f(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", l.inputClasses]),
|
|
92
96
|
style: {
|
|
93
97
|
font: "inherit",
|
|
@@ -107,7 +111,7 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], oe = /* @__PURE__ */ L
|
|
|
107
111
|
fontSize: "inherit"
|
|
108
112
|
}
|
|
109
113
|
}, X(o.value), 513),
|
|
110
|
-
|
|
114
|
+
a.value?.label ? (c(), B("button", {
|
|
111
115
|
key: 0,
|
|
112
116
|
type: "button",
|
|
113
117
|
class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButtonClasses]),
|
|
@@ -126,7 +130,7 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], oe = /* @__PURE__ */ L
|
|
|
126
130
|
], 2)
|
|
127
131
|
]),
|
|
128
132
|
default: y(({ activeIdx: n, setActiveIdx: E }) => [
|
|
129
|
-
(c(!0), B(U, null, D(
|
|
133
|
+
(c(!0), B(U, null, D(i.value, (g, r) => (c(), $(J, {
|
|
130
134
|
key: r,
|
|
131
135
|
active: n === r,
|
|
132
136
|
class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
|