@wikicasa-dev/components 2.1.4-alpha.15 → 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.
|
@@ -26,6 +26,8 @@ declare const _default: <T, LabelID extends string | number | undefined, TCompon
|
|
|
26
26
|
fieldsetClasses?: ClassTypeProp;
|
|
27
27
|
placeholder?: string;
|
|
28
28
|
dataCy?: string;
|
|
29
|
+
withBorder?: boolean;
|
|
30
|
+
withCleanBtn?: boolean;
|
|
29
31
|
}) & Partial<{}>> & import('vue').PublicProps;
|
|
30
32
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
31
33
|
select: () => void;
|
|
@@ -33,6 +35,10 @@ declare const _default: <T, LabelID extends string | number | undefined, TCompon
|
|
|
33
35
|
attrs: any;
|
|
34
36
|
slots: {
|
|
35
37
|
leftIcon?(_: {}): any;
|
|
38
|
+
dropdown?(_: {
|
|
39
|
+
options: import('@vue/reactivity').UnwrapRefSimple<AccessibleSelectOptions<T, LabelID, TComponent>>[];
|
|
40
|
+
toggleDropdown: () => void;
|
|
41
|
+
}): any;
|
|
36
42
|
};
|
|
37
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);
|
|
38
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 },
|
|
@@ -19,7 +19,9 @@ const x = ["onClick"], _ = ["innerHTML"], ue = /* @__PURE__ */ P({
|
|
|
19
19
|
inputClasses: {},
|
|
20
20
|
fieldsetClasses: {},
|
|
21
21
|
placeholder: { default: "" },
|
|
22
|
-
dataCy: { default: "" }
|
|
22
|
+
dataCy: { default: "" },
|
|
23
|
+
withBorder: { type: Boolean, default: !0 },
|
|
24
|
+
withCleanBtn: { type: Boolean, default: !0 }
|
|
23
25
|
}, {
|
|
24
26
|
modelValue: {
|
|
25
27
|
default() {
|
|
@@ -28,74 +30,67 @@ const x = ["onClick"], _ = ["innerHTML"], ue = /* @__PURE__ */ P({
|
|
|
28
30
|
},
|
|
29
31
|
modelModifiers: {}
|
|
30
32
|
}),
|
|
31
|
-
emits: /* @__PURE__ */
|
|
32
|
-
setup(o, { expose: D, emit:
|
|
33
|
-
const u =
|
|
34
|
-
|
|
35
|
-
|
|
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);
|
|
36
38
|
});
|
|
37
|
-
const { activeIdx:
|
|
38
|
-
optionsLength:
|
|
39
|
+
const { activeIdx: m, selectedIdx: d } = x({
|
|
40
|
+
optionsLength: O,
|
|
39
41
|
isDropdownOpen: n,
|
|
40
42
|
disableSpaceHandler: !0
|
|
41
|
-
}),
|
|
43
|
+
}), y = $(() => d.value !== -1), M = async (e) => {
|
|
42
44
|
if (i.value !== e && (s("changedValue", e), i.value = e, !!o.onInputChangeCb)) {
|
|
43
|
-
if (!e ||
|
|
44
|
-
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?.("");
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
|
-
o.disableCb || !
|
|
48
|
-
disableCb: o.disableCb,
|
|
49
|
-
cb: d.value,
|
|
50
|
-
length: a.value.length,
|
|
51
|
-
open: !!a.value.length
|
|
52
|
-
}), n.value = !!a.value.length);
|
|
49
|
+
o.disableCb || !c.value || (a.value = await c.value(e), n.value = !!a.value.length);
|
|
53
50
|
}
|
|
54
|
-
},
|
|
55
|
-
o.onOptionSelectedCb && o.onOptionSelectedCb(e), o.cleanupOnClose && (a.value = []), i.value = e.label, u.value = e, n.value = !1,
|
|
56
|
-
},
|
|
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 = () => {
|
|
57
54
|
a.value.length && o.keepState !== "closed" && (n.value = !0);
|
|
58
55
|
};
|
|
59
|
-
|
|
56
|
+
C(
|
|
60
57
|
u,
|
|
61
58
|
(e, t) => {
|
|
62
59
|
e === t || e?.label === i.value || (i.value = e?.label || "");
|
|
63
60
|
},
|
|
64
61
|
{ immediate: !0 }
|
|
65
|
-
),
|
|
62
|
+
), C(d, (e) => {
|
|
66
63
|
if (e === -1 || !a.value.length) return;
|
|
67
64
|
const t = a.value[e];
|
|
68
|
-
|
|
69
|
-
}),
|
|
65
|
+
y.value && t.label === u.value?.label || h(t, e);
|
|
66
|
+
}), C(
|
|
70
67
|
n,
|
|
71
68
|
(e) => {
|
|
72
|
-
|
|
69
|
+
s("update:dropdownState", e);
|
|
73
70
|
},
|
|
74
71
|
{ immediate: !0 }
|
|
75
72
|
);
|
|
76
|
-
const
|
|
73
|
+
const P = () => {
|
|
77
74
|
b.value?.select();
|
|
78
|
-
},
|
|
79
|
-
s("click"),
|
|
80
|
-
"options.value.length": a.value.length
|
|
81
|
-
}), a.value.length && (n.value = !0);
|
|
75
|
+
}, L = () => {
|
|
76
|
+
s("click"), E(), a.value.length && (n.value = !0);
|
|
82
77
|
};
|
|
83
78
|
return D({
|
|
84
|
-
select:
|
|
85
|
-
}), (e, t) => (v(),
|
|
79
|
+
select: P
|
|
80
|
+
}), (e, t) => (v(), w(R, {
|
|
86
81
|
open: n.value,
|
|
87
82
|
"onUpdate:open": t[3] || (t[3] = (l) => n.value = l),
|
|
88
|
-
class:
|
|
83
|
+
class: U(e.$attrs["root-classes"]),
|
|
89
84
|
"data-cy": e.dataCy ? e.dataCy : `ac_${e.$attrs.id}`,
|
|
90
85
|
"dropdown-element": "ul",
|
|
91
86
|
"dropdown-classes": ["!uikit-max-h-[210px] uikit-z-30", e.dropdownClasses],
|
|
92
87
|
"close-when-clicked-outside": e.closeDropdownOnBodyPressed,
|
|
93
88
|
"activate-keyboard-controller": !1,
|
|
94
89
|
"onUpdate:dropdownState": t[4] || (t[4] = (l) => n.value = l),
|
|
95
|
-
onClick:
|
|
90
|
+
onClick: L
|
|
96
91
|
}, {
|
|
97
|
-
btn_slot:
|
|
98
|
-
|
|
92
|
+
btn_slot: f(() => [
|
|
93
|
+
X(Q, {
|
|
99
94
|
id: e.$attrs.id ? `ac_input_${e.$attrs.id}` : "",
|
|
100
95
|
ref_key: "baseInput",
|
|
101
96
|
ref: b,
|
|
@@ -106,50 +101,58 @@ const x = ["onClick"], _ = ["innerHTML"], ue = /* @__PURE__ */ P({
|
|
|
106
101
|
placeholder: e.placeholder,
|
|
107
102
|
"input-class": [e.inputClasses, "!uikit-text"],
|
|
108
103
|
"fieldset-classes": [e.fieldsetClasses],
|
|
109
|
-
"
|
|
104
|
+
"with-border": e.withBorder,
|
|
105
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => M(l === void 0 ? "" : `${l}`)),
|
|
110
106
|
onKeydown: t[1] || (t[1] = (l) => s("keydown", l)),
|
|
111
107
|
onKeydownEnterPressed: t[2] || (t[2] = () => s("keydownEnterPressed"))
|
|
112
|
-
},
|
|
113
|
-
rightIcon: p(({ handleClean: l }) => [
|
|
114
|
-
W(B("span", {
|
|
115
|
-
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",
|
|
116
|
-
onClick: l
|
|
117
|
-
}, "X", 8, x), [
|
|
118
|
-
[X, $(r) !== -1]
|
|
119
|
-
])
|
|
120
|
-
]),
|
|
121
|
-
_: 2
|
|
122
|
-
}, [
|
|
108
|
+
}, q({ _: 2 }, [
|
|
123
109
|
e.$slots.leftIcon ? {
|
|
124
110
|
name: "leftIcon",
|
|
125
|
-
fn:
|
|
126
|
-
|
|
111
|
+
fn: f(() => [
|
|
112
|
+
B(e.$slots, "leftIcon")
|
|
127
113
|
]),
|
|
128
114
|
key: "0"
|
|
115
|
+
} : void 0,
|
|
116
|
+
e.withCleanBtn ? {
|
|
117
|
+
name: "rightIcon",
|
|
118
|
+
fn: f(({ handleClean: l }) => [
|
|
119
|
+
G(V("span", {
|
|
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",
|
|
121
|
+
onClick: l
|
|
122
|
+
}, "X", 8, _), [
|
|
123
|
+
[J, S(d) !== -1]
|
|
124
|
+
])
|
|
125
|
+
]),
|
|
126
|
+
key: "1"
|
|
129
127
|
} : void 0
|
|
130
|
-
]), 1032, ["id", "data-cy", "model-value", "is-valid", "disabled", "placeholder", "input-class", "fieldset-classes"])
|
|
128
|
+
]), 1032, ["id", "data-cy", "model-value", "is-valid", "disabled", "placeholder", "input-class", "fieldset-classes", "with-border"])
|
|
131
129
|
]),
|
|
132
|
-
default:
|
|
133
|
-
(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
+
])
|
|
148
151
|
]),
|
|
149
152
|
_: 3
|
|
150
153
|
}, 8, ["open", "class", "data-cy", "dropdown-classes", "close-when-clicked-outside"]));
|
|
151
154
|
}
|
|
152
155
|
});
|
|
153
156
|
export {
|
|
154
|
-
|
|
157
|
+
se as default
|
|
155
158
|
};
|