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