@wikicasa-dev/components 2.2.8-alpha.17 → 2.2.8-alpha.19
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 +60 -56
- package/package.json +1 -1
- /package/dist/assets/{swiper-autoplay.css → swiper-keyboard.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 b, shallowRef as s, onBeforeMount as L, watch as y, nextTick as N, createBlock as M, openBlock as c, withCtx as C, 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,51 @@ 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 =
|
|
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, O = b("inputRef"), o = s(a.value?.label || ""), k = s(0), m = s(!1), w = s(null), i = s([]), U = b("dropdownRef"), h = b("hiddenSpan"), x = () => {
|
|
29
29
|
o.value = "", a.value = null, p("update:inputValue", "");
|
|
30
|
-
},
|
|
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) || [], m.value = !0, u.value = !!i.value.length;
|
|
36
|
+
}, g = (t = -1) => {
|
|
37
37
|
const e = i.value[t];
|
|
38
38
|
!e || e.id === a.value?.id || (l.onOptionSelectedCb?.(e), o.value = e.label, u.value = !1, a.value = e, i.value = []);
|
|
39
|
-
},
|
|
40
|
-
|
|
39
|
+
}, R = () => {
|
|
40
|
+
O.value?.select();
|
|
41
41
|
};
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
}),
|
|
45
|
-
o,
|
|
46
|
-
() => {
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
return L(() => {
|
|
43
|
+
w.value = Y({ delay: 300 }, l.onInputChangeCb);
|
|
44
|
+
}), y(
|
|
45
|
+
[o, () => h.value],
|
|
46
|
+
([t, e]) => {
|
|
47
|
+
e && N(() => {
|
|
48
|
+
if (!e) return;
|
|
49
|
+
const n = e.offsetWidth;
|
|
50
|
+
n !== k.value && (console.log("DEBUG:updating icon positioning", {
|
|
51
|
+
curInputValue: t
|
|
52
|
+
}), k.value = n);
|
|
49
53
|
});
|
|
50
54
|
},
|
|
51
55
|
{ immediate: !0 }
|
|
52
|
-
),
|
|
53
|
-
() =>
|
|
56
|
+
), y(
|
|
57
|
+
() => U.value?.selectedIdx,
|
|
54
58
|
(t) => {
|
|
55
59
|
const e = t ?? -1;
|
|
56
|
-
e !== -1 &&
|
|
60
|
+
e !== -1 && g(e);
|
|
57
61
|
}
|
|
58
|
-
),
|
|
62
|
+
), y(
|
|
59
63
|
a,
|
|
60
64
|
(t, e) => {
|
|
61
65
|
t === e || t?.label === o.value || (o.value = t?.label || "");
|
|
62
66
|
},
|
|
63
67
|
{ immediate: !0 }
|
|
64
|
-
),
|
|
65
|
-
select:
|
|
66
|
-
}), (t, e) => (c(),
|
|
68
|
+
), $({
|
|
69
|
+
select: R
|
|
70
|
+
}), (t, e) => (c(), M(J, {
|
|
67
71
|
ref: "dropdownRef",
|
|
68
72
|
class: "uikit-clearable-autocomplete",
|
|
69
73
|
"data-cy": l.dataCy,
|
|
@@ -72,27 +76,27 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ae = /* @__PURE__ */ L
|
|
|
72
76
|
"open-dropdown": u.value,
|
|
73
77
|
"keep-state": !i.value.length || l.keepState === "closed" ? "closed" : "opened",
|
|
74
78
|
"activate-keyboard-controller": l.enableKeyboardController,
|
|
75
|
-
"reset-keyboard-controller":
|
|
76
|
-
"onUpdate:resetKeyboardController": e[2] || (e[2] = (n) =>
|
|
79
|
+
"reset-keyboard-controller": m.value,
|
|
80
|
+
"onUpdate:resetKeyboardController": e[2] || (e[2] = (n) => m.value = n),
|
|
77
81
|
"onUpdate:dropdownState": e[3] || (e[3] = (n) => u.value = n),
|
|
78
82
|
onClick: e[4] || (e[4] = (n) => p("click"))
|
|
79
83
|
}, {
|
|
80
|
-
btn_slot:
|
|
84
|
+
btn_slot: C(() => [
|
|
81
85
|
d("div", {
|
|
82
|
-
class:
|
|
86
|
+
class: v(["uikit-text-16", l.triggerWrapperClasses])
|
|
83
87
|
}, [
|
|
84
|
-
|
|
88
|
+
f(t.$slots, "left-icon"),
|
|
85
89
|
d("div", {
|
|
86
|
-
class:
|
|
90
|
+
class: v(["uikit-relative", l.inputWrapperClasses])
|
|
87
91
|
}, [
|
|
88
|
-
|
|
92
|
+
A(d("input", {
|
|
89
93
|
ref: "inputRef",
|
|
90
94
|
"onUpdate:modelValue": [
|
|
91
95
|
e[0] || (e[0] = (n) => o.value = n),
|
|
92
|
-
|
|
96
|
+
E
|
|
93
97
|
],
|
|
94
98
|
readonly: !!a.value?.label,
|
|
95
|
-
class:
|
|
99
|
+
class: v(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", l.inputClasses]),
|
|
96
100
|
style: {
|
|
97
101
|
font: "inherit",
|
|
98
102
|
fontSize: "inherit"
|
|
@@ -100,50 +104,50 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ae = /* @__PURE__ */ L
|
|
|
100
104
|
placeholder: l.placeholder,
|
|
101
105
|
onKeydown: e[1] || (e[1] = (n) => p("keydown", n))
|
|
102
106
|
}, null, 42, Z), [
|
|
103
|
-
[
|
|
107
|
+
[G, o.value]
|
|
104
108
|
]),
|
|
105
109
|
d("span", {
|
|
106
110
|
ref_key: "hiddenSpan",
|
|
107
|
-
ref:
|
|
111
|
+
ref: h,
|
|
108
112
|
class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
|
|
109
113
|
style: {
|
|
110
114
|
font: "inherit",
|
|
111
115
|
fontSize: "inherit"
|
|
112
116
|
}
|
|
113
|
-
},
|
|
114
|
-
a.value?.label ? (c(),
|
|
117
|
+
}, P(o.value), 513),
|
|
118
|
+
a.value?.label ? (c(), V("button", {
|
|
115
119
|
key: 0,
|
|
116
120
|
type: "button",
|
|
117
|
-
class:
|
|
121
|
+
class: v(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButton?.classes]),
|
|
118
122
|
"aria-label": "Clear input",
|
|
119
|
-
style:
|
|
120
|
-
left: `${
|
|
123
|
+
style: j({
|
|
124
|
+
left: `${k.value + (l.clearButton?.offset || 10)}px`
|
|
121
125
|
}),
|
|
122
|
-
onClick:
|
|
126
|
+
onClick: X(x, ["stop"])
|
|
123
127
|
}, [
|
|
124
|
-
|
|
125
|
-
e[5] || (e[5] =
|
|
128
|
+
f(t.$slots, "clear-icon", {}, () => [
|
|
129
|
+
e[5] || (e[5] = q("X", -1))
|
|
126
130
|
])
|
|
127
|
-
], 6)) :
|
|
131
|
+
], 6)) : H("", !0)
|
|
128
132
|
], 2),
|
|
129
|
-
|
|
133
|
+
f(t.$slots, "right-icon")
|
|
130
134
|
], 2)
|
|
131
135
|
]),
|
|
132
|
-
default:
|
|
133
|
-
(c(!0),
|
|
136
|
+
default: C(({ activeIdx: n, setActiveIdx: z }) => [
|
|
137
|
+
(c(!0), V(W, null, I(i.value, (S, r) => (c(), M(Q, {
|
|
134
138
|
key: r,
|
|
135
139
|
active: n === r,
|
|
136
140
|
class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
|
|
137
|
-
onClick: (
|
|
138
|
-
onMouseover: (
|
|
141
|
+
onClick: (D) => g(r),
|
|
142
|
+
onMouseover: (D) => z(r)
|
|
139
143
|
}, {
|
|
140
|
-
default:
|
|
141
|
-
|
|
142
|
-
option:
|
|
144
|
+
default: C(() => [
|
|
145
|
+
f(t.$slots, "option-content", {
|
|
146
|
+
option: S,
|
|
143
147
|
idx: r
|
|
144
148
|
}, () => [
|
|
145
149
|
d("span", {
|
|
146
|
-
innerHTML:
|
|
150
|
+
innerHTML: S.label
|
|
147
151
|
}, null, 8, _)
|
|
148
152
|
])
|
|
149
153
|
]),
|
|
@@ -155,5 +159,5 @@ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ae = /* @__PURE__ */ L
|
|
|
155
159
|
}
|
|
156
160
|
});
|
|
157
161
|
export {
|
|
158
|
-
|
|
162
|
+
ie as default
|
|
159
163
|
};
|
package/package.json
CHANGED
|
File without changes
|