@wikicasa-dev/components 2.2.8-alpha.17 → 2.2.8-alpha.18
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/Swiper/autoplay.js +1 -1
- package/dist/Swiper/controller.js +1 -1
- package/dist/Swiper/keyboard.js +1 -1
- package/dist/Swiper/thumbs.js +1 -1
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.d.ts +5 -1
- package/dist/packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js +63 -61
- package/package.json +1 -1
- /package/dist/assets/{swiper-autoplay.css → swiper-thumbs.css} +0 -0
package/dist/Swiper/autoplay.js
CHANGED
package/dist/Swiper/keyboard.js
CHANGED
package/dist/Swiper/thumbs.js
CHANGED
|
@@ -9,7 +9,11 @@ export interface ClearableAutocompleteProps<TID extends string | number | undefi
|
|
|
9
9
|
inputWrapperClasses?: ClassTypeProp;
|
|
10
10
|
inputClasses?: ClassTypeProp;
|
|
11
11
|
dropdownClasses?: ClassTypeProp;
|
|
12
|
-
|
|
12
|
+
clearButton?: {
|
|
13
|
+
classes?: ClassTypeProp;
|
|
14
|
+
/** Space between the input element and the clear button */
|
|
15
|
+
offset?: number;
|
|
16
|
+
};
|
|
13
17
|
keepState?: Nullable<"closed" | "open">;
|
|
14
18
|
onInputChangeCb: (v: string) => Promise<AccessibleSelectOptions<TPayload, TID>[]>;
|
|
15
19
|
onOptionSelectedCb?: Nullable<(v: AccessibleSelectOptions<TPayload, TID>) => void>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as K, mergeModels as T, useModel as B, useTemplateRef as m, shallowRef as s, onBeforeMount as L, watch as b, nextTick as N, createBlock as M, openBlock as c, withCtx as y, createElementBlock as V, Fragment as W, renderList as I, renderSlot as f, createElementVNode as d, normalizeClass as v, withDirectives as A, createCommentVNode as H, vModelText as G, toDisplayString as P, withModifiers as X, normalizeStyle as j, createTextVNode as q } from "vue";
|
|
2
2
|
import J from "../BaseDropDown.vue.js";
|
|
3
3
|
import '../../../../../assets/BaseDropDown.css';/* empty css */
|
|
4
4
|
import Q from "../BaseSelect/SelectItem.vue.js";
|
|
5
5
|
import { debounce as Y } from "@wikicasa-dev/utilities";
|
|
6
|
-
const Z = ["readonly", "placeholder"], _ = ["innerHTML"],
|
|
6
|
+
const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ie = /* @__PURE__ */ K({
|
|
7
7
|
__name: "ClearableAutocomplete",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ T({
|
|
9
9
|
dataCy: {},
|
|
10
10
|
placeholder: {},
|
|
11
11
|
enableKeyboardController: { type: Boolean, default: !0 },
|
|
@@ -13,7 +13,7 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ae = /* @__PURE__ */ L
|
|
|
13
13
|
inputWrapperClasses: {},
|
|
14
14
|
inputClasses: {},
|
|
15
15
|
dropdownClasses: {},
|
|
16
|
-
|
|
16
|
+
clearButton: {},
|
|
17
17
|
keepState: {},
|
|
18
18
|
onInputChangeCb: { type: Function },
|
|
19
19
|
onOptionSelectedCb: { type: [Function, null] }
|
|
@@ -23,47 +23,49 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ae = /* @__PURE__ */ L
|
|
|
23
23
|
modelValue: { default: null },
|
|
24
24
|
modelModifiers: {}
|
|
25
25
|
}),
|
|
26
|
-
emits: /* @__PURE__ */
|
|
27
|
-
setup(l, { expose:
|
|
28
|
-
const u =
|
|
29
|
-
|
|
30
|
-
},
|
|
26
|
+
emits: /* @__PURE__ */ T(["click", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
|
|
27
|
+
setup(l, { expose: $, emit: F }) {
|
|
28
|
+
const u = B(l, "open"), a = B(l, "modelValue"), p = F, U = m("inputRef"), n = s(a.value?.label || ""), C = s(0), k = s(!1), w = s(null), i = s([]), O = m("dropdownRef"), h = m("hiddenSpan"), x = () => {
|
|
29
|
+
n.value = "", a.value = null, p("update:inputValue", "");
|
|
30
|
+
}, E = async (t) => {
|
|
31
31
|
if (p("update:inputValue", t), !t) {
|
|
32
32
|
i.value = [], u.value = !1;
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
i.value = await
|
|
36
|
-
},
|
|
35
|
+
i.value = await w.value?.(t) || [], k.value = !0, u.value = !!i.value.length;
|
|
36
|
+
}, g = (t = -1) => {
|
|
37
37
|
const e = i.value[t];
|
|
38
|
-
!e || e.id === a.value?.id || (l.onOptionSelectedCb?.(e),
|
|
39
|
-
},
|
|
40
|
-
|
|
38
|
+
!e || e.id === a.value?.id || (l.onOptionSelectedCb?.(e), n.value = e.label, u.value = !1, a.value = e, i.value = []);
|
|
39
|
+
}, R = () => {
|
|
40
|
+
U.value?.select();
|
|
41
41
|
};
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
}),
|
|
45
|
-
|
|
46
|
-
() => {
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
return L(() => {
|
|
43
|
+
w.value = Y({ delay: 300 }, l.onInputChangeCb);
|
|
44
|
+
}), b(
|
|
45
|
+
[n, () => h.value],
|
|
46
|
+
([t, e]) => {
|
|
47
|
+
e && N(() => {
|
|
48
|
+
e && (console.log("DEBUG:updating icon positioning", {
|
|
49
|
+
curInputValue: t
|
|
50
|
+
}), C.value = e.offsetWidth);
|
|
49
51
|
});
|
|
50
52
|
},
|
|
51
53
|
{ immediate: !0 }
|
|
52
|
-
),
|
|
53
|
-
() =>
|
|
54
|
+
), b(
|
|
55
|
+
() => O.value?.selectedIdx,
|
|
54
56
|
(t) => {
|
|
55
57
|
const e = t ?? -1;
|
|
56
|
-
e !== -1 &&
|
|
58
|
+
e !== -1 && g(e);
|
|
57
59
|
}
|
|
58
|
-
),
|
|
60
|
+
), b(
|
|
59
61
|
a,
|
|
60
62
|
(t, e) => {
|
|
61
|
-
t === e || t?.label ===
|
|
63
|
+
t === e || t?.label === n.value || (n.value = t?.label || "");
|
|
62
64
|
},
|
|
63
65
|
{ immediate: !0 }
|
|
64
|
-
),
|
|
65
|
-
select:
|
|
66
|
-
}), (t, e) => (c(),
|
|
66
|
+
), $({
|
|
67
|
+
select: R
|
|
68
|
+
}), (t, e) => (c(), M(J, {
|
|
67
69
|
ref: "dropdownRef",
|
|
68
70
|
class: "uikit-clearable-autocomplete",
|
|
69
71
|
"data-cy": l.dataCy,
|
|
@@ -73,77 +75,77 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ae = /* @__PURE__ */ L
|
|
|
73
75
|
"keep-state": !i.value.length || l.keepState === "closed" ? "closed" : "opened",
|
|
74
76
|
"activate-keyboard-controller": l.enableKeyboardController,
|
|
75
77
|
"reset-keyboard-controller": k.value,
|
|
76
|
-
"onUpdate:resetKeyboardController": e[2] || (e[2] = (
|
|
77
|
-
"onUpdate:dropdownState": e[3] || (e[3] = (
|
|
78
|
-
onClick: e[4] || (e[4] = (
|
|
78
|
+
"onUpdate:resetKeyboardController": e[2] || (e[2] = (o) => k.value = o),
|
|
79
|
+
"onUpdate:dropdownState": e[3] || (e[3] = (o) => u.value = o),
|
|
80
|
+
onClick: e[4] || (e[4] = (o) => p("click"))
|
|
79
81
|
}, {
|
|
80
82
|
btn_slot: y(() => [
|
|
81
83
|
d("div", {
|
|
82
|
-
class:
|
|
84
|
+
class: v(["uikit-text-16", l.triggerWrapperClasses])
|
|
83
85
|
}, [
|
|
84
|
-
|
|
86
|
+
f(t.$slots, "left-icon"),
|
|
85
87
|
d("div", {
|
|
86
|
-
class:
|
|
88
|
+
class: v(["uikit-relative", l.inputWrapperClasses])
|
|
87
89
|
}, [
|
|
88
|
-
|
|
90
|
+
A(d("input", {
|
|
89
91
|
ref: "inputRef",
|
|
90
92
|
"onUpdate:modelValue": [
|
|
91
|
-
e[0] || (e[0] = (
|
|
92
|
-
|
|
93
|
+
e[0] || (e[0] = (o) => n.value = o),
|
|
94
|
+
E
|
|
93
95
|
],
|
|
94
96
|
readonly: !!a.value?.label,
|
|
95
|
-
class:
|
|
97
|
+
class: v(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", l.inputClasses]),
|
|
96
98
|
style: {
|
|
97
99
|
font: "inherit",
|
|
98
100
|
fontSize: "inherit"
|
|
99
101
|
},
|
|
100
102
|
placeholder: l.placeholder,
|
|
101
|
-
onKeydown: e[1] || (e[1] = (
|
|
103
|
+
onKeydown: e[1] || (e[1] = (o) => p("keydown", o))
|
|
102
104
|
}, null, 42, Z), [
|
|
103
|
-
[
|
|
105
|
+
[G, n.value]
|
|
104
106
|
]),
|
|
105
107
|
d("span", {
|
|
106
108
|
ref_key: "hiddenSpan",
|
|
107
|
-
ref:
|
|
109
|
+
ref: h,
|
|
108
110
|
class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
|
|
109
111
|
style: {
|
|
110
112
|
font: "inherit",
|
|
111
113
|
fontSize: "inherit"
|
|
112
114
|
}
|
|
113
|
-
},
|
|
114
|
-
a.value?.label ? (c(),
|
|
115
|
+
}, P(n.value), 513),
|
|
116
|
+
a.value?.label ? (c(), V("button", {
|
|
115
117
|
key: 0,
|
|
116
118
|
type: "button",
|
|
117
|
-
class:
|
|
119
|
+
class: v(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButton?.classes]),
|
|
118
120
|
"aria-label": "Clear input",
|
|
119
|
-
style:
|
|
120
|
-
left: `${
|
|
121
|
+
style: j({
|
|
122
|
+
left: `${C.value + (l.clearButton?.offset || 10)}px`
|
|
121
123
|
}),
|
|
122
|
-
onClick:
|
|
124
|
+
onClick: X(x, ["stop"])
|
|
123
125
|
}, [
|
|
124
|
-
|
|
125
|
-
e[5] || (e[5] =
|
|
126
|
+
f(t.$slots, "clear-icon", {}, () => [
|
|
127
|
+
e[5] || (e[5] = q("X", -1))
|
|
126
128
|
])
|
|
127
|
-
], 6)) :
|
|
129
|
+
], 6)) : H("", !0)
|
|
128
130
|
], 2),
|
|
129
|
-
|
|
131
|
+
f(t.$slots, "right-icon")
|
|
130
132
|
], 2)
|
|
131
133
|
]),
|
|
132
|
-
default: y(({ activeIdx:
|
|
133
|
-
(c(!0),
|
|
134
|
+
default: y(({ activeIdx: o, setActiveIdx: z }) => [
|
|
135
|
+
(c(!0), V(W, null, I(i.value, (S, r) => (c(), M(Q, {
|
|
134
136
|
key: r,
|
|
135
|
-
active:
|
|
137
|
+
active: o === r,
|
|
136
138
|
class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
|
|
137
|
-
onClick: (
|
|
138
|
-
onMouseover: (
|
|
139
|
+
onClick: (D) => g(r),
|
|
140
|
+
onMouseover: (D) => z(r)
|
|
139
141
|
}, {
|
|
140
142
|
default: y(() => [
|
|
141
|
-
|
|
142
|
-
option:
|
|
143
|
+
f(t.$slots, "option-content", {
|
|
144
|
+
option: S,
|
|
143
145
|
idx: r
|
|
144
146
|
}, () => [
|
|
145
147
|
d("span", {
|
|
146
|
-
innerHTML:
|
|
148
|
+
innerHTML: S.label
|
|
147
149
|
}, null, 8, _)
|
|
148
150
|
])
|
|
149
151
|
]),
|
|
@@ -155,5 +157,5 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ae = /* @__PURE__ */ L
|
|
|
155
157
|
}
|
|
156
158
|
});
|
|
157
159
|
export {
|
|
158
|
-
|
|
160
|
+
ie as default
|
|
159
161
|
};
|
package/package.json
CHANGED
|
File without changes
|