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