@wikicasa-dev/components 2.1.4-alpha.16 → 2.1.4-alpha.17
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.
|
@@ -35,6 +35,10 @@ declare const _default: <T, LabelID extends string | number | undefined, TCompon
|
|
|
35
35
|
attrs: any;
|
|
36
36
|
slots: {
|
|
37
37
|
leftIcon?(_: {}): any;
|
|
38
|
+
dropdown?(_: {
|
|
39
|
+
options: import('@vue/reactivity').UnwrapRefSimple<AccessibleSelectOptions<T, LabelID, TComponent>>[];
|
|
40
|
+
toggleDropdown: () => void;
|
|
41
|
+
}): any;
|
|
38
42
|
};
|
|
39
43
|
emit: (((evt: "click") => void) & ((evt: "update:dropdownState", args_0: boolean) => void) & ((evt: "keydown", args_0: KeyboardEvent) => void) & ((evt: "keydownEnterPressed") => void) & ((evt: "changedValue", args_0: string) => void)) & ((evt: "update:modelValue", value: Optional<AccessibleSelectOptions<T, LabelID, TComponent>>) => void);
|
|
40
44
|
}>) => import('vue').VNode & {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as H, mergeModels as g, useModel as K, ref as r, computed as $, onBeforeMount as N, watch as C, createBlock as w, openBlock as v, normalizeClass as U, withCtx as f, renderSlot as B, createElementBlock as A, Fragment as F, renderList as T, unref as S, createCommentVNode as j, createElementVNode as V, resolveDynamicComponent as W, createVNode as X, createSlots as q, withDirectives as G, vShow as J } from "vue";
|
|
2
|
+
import Q from "./BaseInput.vue.js";
|
|
3
3
|
import '../../assets/lib/UIKit/BaseInput.css';/* empty css */
|
|
4
|
-
import
|
|
5
|
-
import { debounce as
|
|
6
|
-
import
|
|
7
|
-
import { useKeyboardController as
|
|
8
|
-
const
|
|
4
|
+
import R from "./BaseDropDown.vue.js";
|
|
5
|
+
import { debounce as Y } from "../../node_modules/@wikicasa-dev/utilities/dist/utils/FunctionUtils.js";
|
|
6
|
+
import Z from "./BaseSelect/SelectItem.vue.js";
|
|
7
|
+
import { useKeyboardController as x } from "../../node_modules/@wikicasa-dev/vue-composables/dist/useKeyboardController.js";
|
|
8
|
+
const _ = ["onClick"], ee = ["innerHTML"], se = /* @__PURE__ */ H({
|
|
9
9
|
__name: "BaseAutocomplete",
|
|
10
|
-
props: /* @__PURE__ */
|
|
10
|
+
props: /* @__PURE__ */ g({
|
|
11
11
|
isValid: { default: null },
|
|
12
12
|
disableCb: { type: Boolean, default: !1 },
|
|
13
13
|
onInputChangeCb: { type: Function },
|
|
@@ -30,74 +30,67 @@ const x = ["onClick"], _ = ["innerHTML"], ue = /* @__PURE__ */ P({
|
|
|
30
30
|
},
|
|
31
31
|
modelModifiers: {}
|
|
32
32
|
}),
|
|
33
|
-
emits: /* @__PURE__ */
|
|
34
|
-
setup(o, { expose: D, emit:
|
|
35
|
-
const u =
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
emits: /* @__PURE__ */ g(["update:dropdownState", "changedValue", "click", "keydown", "keydownEnterPressed"], ["update:modelValue"]),
|
|
34
|
+
setup(o, { expose: D, emit: I }) {
|
|
35
|
+
const u = K(o, "modelValue"), s = I, i = r(""), a = r([]), c = r(null), n = r(!1), b = r(null), O = $(() => a.value.length);
|
|
36
|
+
N(() => {
|
|
37
|
+
c.value = Y({ delay: 300 }, o.onInputChangeCb);
|
|
38
38
|
});
|
|
39
|
-
const { activeIdx:
|
|
40
|
-
optionsLength:
|
|
39
|
+
const { activeIdx: m, selectedIdx: d } = x({
|
|
40
|
+
optionsLength: O,
|
|
41
41
|
isDropdownOpen: n,
|
|
42
42
|
disableSpaceHandler: !0
|
|
43
|
-
}),
|
|
43
|
+
}), y = $(() => d.value !== -1), M = async (e) => {
|
|
44
44
|
if (i.value !== e && (s("changedValue", e), i.value = e, !!o.onInputChangeCb)) {
|
|
45
|
-
if (!e ||
|
|
46
|
-
a.value = [],
|
|
45
|
+
if (!e || y.value) {
|
|
46
|
+
a.value = [], d.value = -1, m.value = -1, u.value && (u.value.label = ""), n.value = !1, await c.value?.("");
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
o.disableCb || !
|
|
50
|
-
disableCb: o.disableCb,
|
|
51
|
-
cb: d.value,
|
|
52
|
-
length: a.value.length,
|
|
53
|
-
open: !!a.value.length
|
|
54
|
-
}), n.value = !!a.value.length);
|
|
49
|
+
o.disableCb || !c.value || (a.value = await c.value(e), n.value = !!a.value.length);
|
|
55
50
|
}
|
|
56
|
-
},
|
|
57
|
-
o.onOptionSelectedCb && o.onOptionSelectedCb(e), o.cleanupOnClose && (a.value = []), i.value = e.label, u.value = e, n.value = !1,
|
|
58
|
-
},
|
|
51
|
+
}, h = (e, t) => {
|
|
52
|
+
o.onOptionSelectedCb && o.onOptionSelectedCb(e), o.cleanupOnClose && (a.value = []), i.value = e.label, u.value = e, n.value = !1, d.value = t;
|
|
53
|
+
}, E = () => {
|
|
59
54
|
a.value.length && o.keepState !== "closed" && (n.value = !0);
|
|
60
55
|
};
|
|
61
|
-
|
|
56
|
+
C(
|
|
62
57
|
u,
|
|
63
58
|
(e, t) => {
|
|
64
59
|
e === t || e?.label === i.value || (i.value = e?.label || "");
|
|
65
60
|
},
|
|
66
61
|
{ immediate: !0 }
|
|
67
|
-
),
|
|
62
|
+
), C(d, (e) => {
|
|
68
63
|
if (e === -1 || !a.value.length) return;
|
|
69
64
|
const t = a.value[e];
|
|
70
|
-
|
|
71
|
-
}),
|
|
65
|
+
y.value && t.label === u.value?.label || h(t, e);
|
|
66
|
+
}), C(
|
|
72
67
|
n,
|
|
73
68
|
(e) => {
|
|
74
|
-
|
|
69
|
+
s("update:dropdownState", e);
|
|
75
70
|
},
|
|
76
71
|
{ immediate: !0 }
|
|
77
72
|
);
|
|
78
|
-
const
|
|
73
|
+
const P = () => {
|
|
79
74
|
b.value?.select();
|
|
80
|
-
},
|
|
81
|
-
s("click"),
|
|
82
|
-
"options.value.length": a.value.length
|
|
83
|
-
}), a.value.length && (n.value = !0);
|
|
75
|
+
}, L = () => {
|
|
76
|
+
s("click"), E(), a.value.length && (n.value = !0);
|
|
84
77
|
};
|
|
85
78
|
return D({
|
|
86
|
-
select:
|
|
87
|
-
}), (e, t) => (v(),
|
|
79
|
+
select: P
|
|
80
|
+
}), (e, t) => (v(), w(R, {
|
|
88
81
|
open: n.value,
|
|
89
82
|
"onUpdate:open": t[3] || (t[3] = (l) => n.value = l),
|
|
90
|
-
class:
|
|
83
|
+
class: U(e.$attrs["root-classes"]),
|
|
91
84
|
"data-cy": e.dataCy ? e.dataCy : `ac_${e.$attrs.id}`,
|
|
92
85
|
"dropdown-element": "ul",
|
|
93
86
|
"dropdown-classes": ["!uikit-max-h-[210px] uikit-z-30", e.dropdownClasses],
|
|
94
87
|
"close-when-clicked-outside": e.closeDropdownOnBodyPressed,
|
|
95
88
|
"activate-keyboard-controller": !1,
|
|
96
89
|
"onUpdate:dropdownState": t[4] || (t[4] = (l) => n.value = l),
|
|
97
|
-
onClick:
|
|
90
|
+
onClick: L
|
|
98
91
|
}, {
|
|
99
|
-
btn_slot:
|
|
100
|
-
|
|
92
|
+
btn_slot: f(() => [
|
|
93
|
+
X(Q, {
|
|
101
94
|
id: e.$attrs.id ? `ac_input_${e.$attrs.id}` : "",
|
|
102
95
|
ref_key: "baseInput",
|
|
103
96
|
ref: b,
|
|
@@ -109,52 +102,57 @@ const x = ["onClick"], _ = ["innerHTML"], ue = /* @__PURE__ */ P({
|
|
|
109
102
|
"input-class": [e.inputClasses, "!uikit-text"],
|
|
110
103
|
"fieldset-classes": [e.fieldsetClasses],
|
|
111
104
|
"with-border": e.withBorder,
|
|
112
|
-
"onUpdate:modelValue": t[0] || (t[0] = (l) =>
|
|
105
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => M(l === void 0 ? "" : `${l}`)),
|
|
113
106
|
onKeydown: t[1] || (t[1] = (l) => s("keydown", l)),
|
|
114
107
|
onKeydownEnterPressed: t[2] || (t[2] = () => s("keydownEnterPressed"))
|
|
115
|
-
},
|
|
108
|
+
}, q({ _: 2 }, [
|
|
116
109
|
e.$slots.leftIcon ? {
|
|
117
110
|
name: "leftIcon",
|
|
118
|
-
fn:
|
|
119
|
-
|
|
111
|
+
fn: f(() => [
|
|
112
|
+
B(e.$slots, "leftIcon")
|
|
120
113
|
]),
|
|
121
114
|
key: "0"
|
|
122
115
|
} : void 0,
|
|
123
116
|
e.withCleanBtn ? {
|
|
124
117
|
name: "rightIcon",
|
|
125
|
-
fn:
|
|
126
|
-
|
|
118
|
+
fn: f(({ handleClean: l }) => [
|
|
119
|
+
G(V("span", {
|
|
127
120
|
class: "text-input-icon right uikit-flex uikit-size-md uikit-cursor-pointer uikit-items-center uikit-justify-center uikit-rounded-full uikit-bg-w-lightgray uikit-text uikit-font-semibold uikit-text-white",
|
|
128
121
|
onClick: l
|
|
129
|
-
}, "X", 8,
|
|
130
|
-
[
|
|
122
|
+
}, "X", 8, _), [
|
|
123
|
+
[J, S(d) !== -1]
|
|
131
124
|
])
|
|
132
125
|
]),
|
|
133
126
|
key: "1"
|
|
134
127
|
} : void 0
|
|
135
128
|
]), 1032, ["id", "data-cy", "model-value", "is-valid", "disabled", "placeholder", "input-class", "fieldset-classes", "with-border"])
|
|
136
129
|
]),
|
|
137
|
-
default:
|
|
138
|
-
(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
130
|
+
default: f(({ toggleDropdown: l }) => [
|
|
131
|
+
B(e.$slots, "dropdown", {
|
|
132
|
+
options: a.value,
|
|
133
|
+
toggleDropdown: l
|
|
134
|
+
}, () => [
|
|
135
|
+
(v(!0), A(F, null, T(a.value, (p, k) => (v(), w(Z, {
|
|
136
|
+
key: k,
|
|
137
|
+
active: S(m) === k,
|
|
138
|
+
class: "uikit-relative uikit-flex uikit-gap-x-xs uikit-rounded-[5px] uikit-p-md uikit-py-xs uikit-text after:uikit-absolute after:uikit-bottom-0 after:uikit-left-1/2 after:uikit-h-[1px] after:uikit-w-[95%] after:-uikit-translate-x-1/2 after:uikit-bg-w-lightgray after:uikit-content-[''] after:last:uikit-hidden hover:uikit-cursor-pointer",
|
|
139
|
+
onClick: (z) => h(p, k),
|
|
140
|
+
onMouseover: (z) => m.value = k
|
|
141
|
+
}, {
|
|
142
|
+
default: f(() => [
|
|
143
|
+
p.icon ? (v(), w(W(p.icon), { key: 0 })) : j("", !0),
|
|
144
|
+
V("span", {
|
|
145
|
+
innerHTML: p.label
|
|
146
|
+
}, null, 8, ee)
|
|
147
|
+
]),
|
|
148
|
+
_: 2
|
|
149
|
+
}, 1032, ["active", "onClick", "onMouseover"]))), 128))
|
|
150
|
+
])
|
|
153
151
|
]),
|
|
154
152
|
_: 3
|
|
155
153
|
}, 8, ["open", "class", "data-cy", "dropdown-classes", "close-when-clicked-outside"]));
|
|
156
154
|
}
|
|
157
155
|
});
|
|
158
156
|
export {
|
|
159
|
-
|
|
157
|
+
se as default
|
|
160
158
|
};
|