@wikicasa-dev/components 2.2.9-alpha.0 → 2.2.9-alpha.1
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.
|
@@ -24,9 +24,9 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ie = /* @__PURE__ */ K
|
|
|
24
24
|
modelModifiers: {}
|
|
25
25
|
}),
|
|
26
26
|
emits: /* @__PURE__ */ B(["click", "inputClick", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
|
|
27
|
-
setup(
|
|
28
|
-
const r = M(
|
|
29
|
-
|
|
27
|
+
setup(o, { expose: $, emit: E }) {
|
|
28
|
+
const r = M(o, "open"), a = M(o, "modelValue"), s = E, O = m("inputRef"), n = p(a.value?.label || ""), v = p(0), k = p(!1), w = p(null), i = p([]), g = m("dropdownRef"), h = m("hiddenSpan"), R = () => {
|
|
29
|
+
n.value = "", a.value = null, s("update:inputValue", "");
|
|
30
30
|
}, U = async (t) => {
|
|
31
31
|
if (s("update:inputValue", t), !t) {
|
|
32
32
|
i.value = [], r.value = !1;
|
|
@@ -35,14 +35,14 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ie = /* @__PURE__ */ K
|
|
|
35
35
|
i.value = await w.value?.(t) || [], k.value = !0, r.value = !!i.value.length;
|
|
36
36
|
}, S = (t = -1) => {
|
|
37
37
|
const e = i.value[t];
|
|
38
|
-
!e || e.id === a.value?.id || (
|
|
38
|
+
!e || e.id === a.value?.id || (o.onOptionSelectedCb?.(e), n.value = e.label, r.value = !1, a.value = e, i.value = []);
|
|
39
39
|
}, x = () => {
|
|
40
40
|
O.value?.select();
|
|
41
41
|
};
|
|
42
42
|
return L(() => {
|
|
43
|
-
w.value = Y({ delay: 300 },
|
|
43
|
+
w.value = Y({ delay: 300 }, o.onInputChangeCb);
|
|
44
44
|
}), b(
|
|
45
|
-
[
|
|
45
|
+
[n, () => h.value],
|
|
46
46
|
([t, e]) => {
|
|
47
47
|
e && W(() => {
|
|
48
48
|
if (!e) return;
|
|
@@ -62,7 +62,7 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ie = /* @__PURE__ */ K
|
|
|
62
62
|
), b(
|
|
63
63
|
a,
|
|
64
64
|
(t, e) => {
|
|
65
|
-
t === e || t?.label ===
|
|
65
|
+
t === e || t?.label === n.value || (n.value = t?.label || "");
|
|
66
66
|
},
|
|
67
67
|
{ immediate: !0 }
|
|
68
68
|
), $({
|
|
@@ -71,42 +71,44 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ie = /* @__PURE__ */ K
|
|
|
71
71
|
}), (t, e) => (C(), V(J, {
|
|
72
72
|
ref: "dropdownRef",
|
|
73
73
|
class: "uikit-clearable-autocomplete",
|
|
74
|
-
"data-cy":
|
|
74
|
+
"data-cy": o.dataCy,
|
|
75
75
|
"dropdown-element": "ul",
|
|
76
|
-
"dropdown-classes": ["uikit-z-30",
|
|
76
|
+
"dropdown-classes": ["uikit-z-30", o.dropdownClasses],
|
|
77
77
|
"open-dropdown": r.value,
|
|
78
|
-
"keep-state": !i.value.length ||
|
|
79
|
-
"activate-keyboard-controller":
|
|
78
|
+
"keep-state": !i.value.length || o.keepState === "closed" ? "closed" : "opened",
|
|
79
|
+
"activate-keyboard-controller": o.enableKeyboardController,
|
|
80
80
|
"reset-keyboard-controller": k.value,
|
|
81
81
|
"onUpdate:resetKeyboardController": e[4] || (e[4] = (l) => k.value = l),
|
|
82
82
|
"onUpdate:dropdownState": e[5] || (e[5] = (l) => r.value = l)
|
|
83
83
|
}, {
|
|
84
84
|
btn_slot: y(() => [
|
|
85
85
|
u("div", {
|
|
86
|
-
class: f(["uikit-text-16",
|
|
86
|
+
class: f(["uikit-text-16", o.triggerWrapperClasses]),
|
|
87
87
|
onClick: e[3] || (e[3] = (l) => s("click", l))
|
|
88
88
|
}, [
|
|
89
89
|
c(t.$slots, "left-icon"),
|
|
90
90
|
u("div", {
|
|
91
|
-
class: f(["uikit-relative",
|
|
91
|
+
class: f(["uikit-relative", o.inputWrapperClasses])
|
|
92
92
|
}, [
|
|
93
93
|
F(u("input", {
|
|
94
94
|
ref: "inputRef",
|
|
95
95
|
"onUpdate:modelValue": [
|
|
96
|
-
e[0] || (e[0] = (l) =>
|
|
96
|
+
e[0] || (e[0] = (l) => n.value = l),
|
|
97
97
|
U
|
|
98
98
|
],
|
|
99
99
|
readonly: !!a.value?.label,
|
|
100
|
-
|
|
100
|
+
type: "text",
|
|
101
|
+
autocomplete: "off",
|
|
102
|
+
class: f(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", o.inputClasses]),
|
|
101
103
|
style: {
|
|
102
104
|
font: "inherit",
|
|
103
105
|
fontSize: "inherit"
|
|
104
106
|
},
|
|
105
|
-
placeholder:
|
|
107
|
+
placeholder: o.placeholder,
|
|
106
108
|
onKeydown: e[1] || (e[1] = (l) => s("keydown", l)),
|
|
107
109
|
onClick: e[2] || (e[2] = (l) => s("inputClick", l))
|
|
108
110
|
}, null, 42, Z), [
|
|
109
|
-
[H,
|
|
111
|
+
[H, n.value]
|
|
110
112
|
]),
|
|
111
113
|
u("span", {
|
|
112
114
|
ref_key: "hiddenSpan",
|
|
@@ -116,13 +118,13 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ie = /* @__PURE__ */ K
|
|
|
116
118
|
font: "inherit",
|
|
117
119
|
fontSize: "inherit"
|
|
118
120
|
}
|
|
119
|
-
}, G(
|
|
121
|
+
}, G(n.value), 513),
|
|
120
122
|
F(u("button", {
|
|
121
123
|
type: "button",
|
|
122
|
-
class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none",
|
|
124
|
+
class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", o.clearButton?.classes]),
|
|
123
125
|
"aria-label": "Clear input",
|
|
124
126
|
style: X({
|
|
125
|
-
left: `${v.value + (
|
|
127
|
+
left: `${v.value + (o.clearButton?.offset || 10)}px`
|
|
126
128
|
}),
|
|
127
129
|
onClick: P(R, ["stop"])
|
|
128
130
|
}, [
|