@wikicasa-dev/components 2.6.14-alpha.0 → 2.7.0
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/UIKit/Autocomplete/ClearableAutocomplete.d.ts +1 -0
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.vue.js +62 -61
- package/dist/lazyModules/Swiper/Autoplay/index.js +1 -1
- package/dist/lazyModules/Swiper/Controller/index.js +1 -1
- package/dist/lazyModules/Swiper/Keyboard/index.js +1 -1
- package/dist/lazyModules/Swiper/Thumbs/index.js +1 -1
- package/package.json +6 -6
- /package/dist/assets/{swiper-thumbs.css → swiper-controller.css} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import e from "../BaseSelect/SelectItem.js";
|
|
2
2
|
import t from "../BaseDropDown.js";
|
|
3
|
-
import { Fragment as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeMount as p, onMounted as m, onUnmounted as h, openBlock as g, renderList as
|
|
3
|
+
import { Fragment as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeMount as p, onMounted as m, onUnmounted as h, openBlock as g, renderList as _, renderSlot as v, shallowRef as y, toDisplayString as b, unref as x, useId as S, useModel as C, useTemplateRef as w, vModelText as T, vShow as ee, watch as E, withCtx as D, withDirectives as O, withModifiers as te } from "vue";
|
|
4
4
|
import { debounce as ne } from "@wikicasa-dev/utilities";
|
|
5
5
|
import '../../assets/ClearableAutocomplete.css';//#region lib/UIKit/Autocomplete/ClearableAutocomplete.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var re = [
|
|
7
7
|
"id",
|
|
8
8
|
"data-cy",
|
|
9
9
|
"placeholder"
|
|
10
|
-
], k = {
|
|
10
|
+
], k = ["data-cy"], A = {
|
|
11
11
|
key: 1,
|
|
12
12
|
name: "loading-state",
|
|
13
13
|
class: "uikit-progress-bar-track uikit-absolute uikit-left-0 uikit-top-0 uikit-w-full"
|
|
14
|
-
},
|
|
14
|
+
}, j = ["innerHTML"], M = /*@__PURE__*/ c({
|
|
15
15
|
__name: "ClearableAutocomplete",
|
|
16
16
|
props: /*@__PURE__*/ l({
|
|
17
17
|
dataCy: {},
|
|
@@ -54,24 +54,24 @@ var re = [
|
|
|
54
54
|
"update:modelValue",
|
|
55
55
|
"update:inputValue"
|
|
56
56
|
]),
|
|
57
|
-
setup(c, { expose: l, emit:
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
},
|
|
57
|
+
setup(c, { expose: l, emit: M }) {
|
|
58
|
+
let N = C(c, "open"), P = C(c, "modelValue"), F = C(c, "inputValue"), I = M, L = S(), R = w("inputRef"), z = y(0), B = y(!1), V = y(!1), H = y(-1), U = y(-1), W = y(null), G = y([]), ie = w("dropdownRef"), K = w("hiddenSpan"), q = w("inputWrapperRef"), J = w("clearButtonRef"), Y = () => {
|
|
59
|
+
H.value = -1, U.value = -1;
|
|
60
|
+
}, ae = () => {
|
|
61
|
+
F.value = "", P.value = null, B.value = !1, Y();
|
|
62
|
+
}, oe = async (e) => {
|
|
63
63
|
if (!e) {
|
|
64
|
-
|
|
64
|
+
G.value = [], N.value = !1, Y();
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
c.disableCb || (
|
|
68
|
-
},
|
|
69
|
-
|
|
67
|
+
c.disableCb || (V.value = !0, G.value = await W.value?.(e)?.catch(() => []) || [], Y(), V.value = !1, N.value = !!G.value.length);
|
|
68
|
+
}, se = (e) => {
|
|
69
|
+
I("input", e), B.value = !1;
|
|
70
70
|
}, X = (e = -1, t) => {
|
|
71
|
-
let n =
|
|
72
|
-
!n || n.id ===
|
|
71
|
+
let n = G.value[e];
|
|
72
|
+
!n || n.id === P.value?.id || (U.value = e, c.onOptionSelectedCb?.(n, { trigger: t }), F.value = n.label, N.value = !1, P.value = n, B.value = !0, G.value = []);
|
|
73
73
|
}, Z = (e) => {
|
|
74
|
-
if (!c.enableKeyboardController || !
|
|
74
|
+
if (!c.enableKeyboardController || !N.value || ![
|
|
75
75
|
"ArrowUp",
|
|
76
76
|
"ArrowDown",
|
|
77
77
|
"Enter",
|
|
@@ -82,11 +82,11 @@ var re = [
|
|
|
82
82
|
"End"
|
|
83
83
|
].includes(e.key)) return;
|
|
84
84
|
if (e.key === "Escape") {
|
|
85
|
-
|
|
85
|
+
H.value = U.value, N.value = !1, e.stopPropagation();
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
if (!
|
|
89
|
-
let t =
|
|
88
|
+
if (!G.value.length) return;
|
|
89
|
+
let t = G.value.length - 1;
|
|
90
90
|
if ([
|
|
91
91
|
"ArrowUp",
|
|
92
92
|
"ArrowDown",
|
|
@@ -94,27 +94,27 @@ var re = [
|
|
|
94
94
|
"Home",
|
|
95
95
|
"PageDown",
|
|
96
96
|
"End"
|
|
97
|
-
].includes(e.key) && e.preventDefault(), e.key === "ArrowUp")
|
|
98
|
-
else if (e.key === "ArrowDown")
|
|
97
|
+
].includes(e.key) && e.preventDefault(), e.key === "ArrowUp") H.value = H.value <= 0 ? t : H.value - 1;
|
|
98
|
+
else if (e.key === "ArrowDown") H.value = H.value >= t ? 0 : H.value + 1;
|
|
99
99
|
else if (e.key === "Enter") {
|
|
100
|
-
if (
|
|
101
|
-
e.preventDefault(), X(
|
|
102
|
-
} else e.key === "PageUp" || e.key === "Home" ?
|
|
100
|
+
if (H.value === -1) return;
|
|
101
|
+
e.preventDefault(), X(H.value, "enter");
|
|
102
|
+
} else e.key === "PageUp" || e.key === "Home" ? H.value = 0 : (e.key === "PageDown" || e.key === "End") && (H.value = t);
|
|
103
103
|
e.stopPropagation();
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
}, ce = () => {
|
|
107
|
-
L.value?.select();
|
|
104
|
+
}, ce = (e) => {
|
|
105
|
+
I("keydown", e), Z(e);
|
|
108
106
|
}, le = () => {
|
|
109
|
-
|
|
107
|
+
R.value?.select();
|
|
108
|
+
}, ue = () => {
|
|
109
|
+
R.value?.focus();
|
|
110
110
|
}, Q = null, $ = () => {
|
|
111
111
|
let e = K.value, t = q.value, n = J.value;
|
|
112
112
|
if (!e || !t) return;
|
|
113
113
|
let r = e.offsetWidth, i = t.offsetWidth, a = c.clearButton?.offset || 0, o = c.clearButton?.width || n?.offsetWidth || 0, s = i - a - o, l = Math.min(r, s);
|
|
114
|
-
l !==
|
|
114
|
+
l !== z.value && (z.value = l);
|
|
115
115
|
};
|
|
116
116
|
return p(() => {
|
|
117
|
-
|
|
117
|
+
W.value = ne({ delay: 300 }, async (e = "") => (N.value = !0, await c.onInputChangeCb(e)));
|
|
118
118
|
}), m(() => {
|
|
119
119
|
q.value && (Q = new ResizeObserver(() => {
|
|
120
120
|
$();
|
|
@@ -122,19 +122,19 @@ var re = [
|
|
|
122
122
|
}), h(() => {
|
|
123
123
|
Q?.disconnect();
|
|
124
124
|
}), E([
|
|
125
|
-
|
|
125
|
+
F,
|
|
126
126
|
K,
|
|
127
127
|
J
|
|
128
128
|
], () => {
|
|
129
129
|
u($);
|
|
130
|
-
}), E(
|
|
131
|
-
if (e?.label ===
|
|
130
|
+
}), E(P, (e) => {
|
|
131
|
+
if (e?.label === F.value) return;
|
|
132
132
|
let t = e?.label || "";
|
|
133
|
-
|
|
133
|
+
F.value = t, t && (B.value = !0);
|
|
134
134
|
}, { immediate: !0 }), l({
|
|
135
|
-
getRootElement: () =>
|
|
136
|
-
select:
|
|
137
|
-
focus:
|
|
135
|
+
getRootElement: () => ie.value?.getRootElement(),
|
|
136
|
+
select: le,
|
|
137
|
+
focus: ue
|
|
138
138
|
}), (l, u) => (g(), r(t, {
|
|
139
139
|
ref: "dropdownRef",
|
|
140
140
|
class: "uikit-clearable-autocomplete",
|
|
@@ -143,22 +143,22 @@ var re = [
|
|
|
143
143
|
"dropdown-classes": ["uikit-z-30", c.dropdownClasses],
|
|
144
144
|
"keep-state": c.keepState === "closed" ? "closed" : "opened",
|
|
145
145
|
"activate-keyboard-controller": !1,
|
|
146
|
-
open:
|
|
147
|
-
"onUpdate:open": u[3] ||= (e) =>
|
|
146
|
+
open: N.value,
|
|
147
|
+
"onUpdate:open": u[3] ||= (e) => N.value = e
|
|
148
148
|
}, {
|
|
149
149
|
btn_slot: D(() => [o("div", {
|
|
150
150
|
class: d(["uikit-text-16", c.triggerWrapperClasses]),
|
|
151
|
-
onClick: u[2] ||= (e) =>
|
|
151
|
+
onClick: u[2] ||= (e) => I("click", e)
|
|
152
152
|
}, [
|
|
153
|
-
|
|
153
|
+
v(l.$slots, "left-icon"),
|
|
154
154
|
o("div", {
|
|
155
155
|
ref: "inputWrapperRef",
|
|
156
156
|
class: d(["uikit-relative", c.inputWrapperClasses])
|
|
157
157
|
}, [
|
|
158
158
|
O(o("input", {
|
|
159
159
|
ref: "inputRef",
|
|
160
|
-
"onUpdate:modelValue": [u[0] ||= (e) =>
|
|
161
|
-
id:
|
|
160
|
+
"onUpdate:modelValue": [u[0] ||= (e) => F.value = e, oe],
|
|
161
|
+
id: x(L),
|
|
162
162
|
"data-cy": c.dataCy ? `ac_input_${c.dataCy}` : "",
|
|
163
163
|
type: "text",
|
|
164
164
|
autocomplete: "off",
|
|
@@ -168,12 +168,12 @@ var re = [
|
|
|
168
168
|
fontSize: "inherit"
|
|
169
169
|
},
|
|
170
170
|
placeholder: c.placeholder,
|
|
171
|
-
onKeydown:
|
|
172
|
-
onInput:
|
|
171
|
+
onKeydown: ce,
|
|
172
|
+
onInput: se,
|
|
173
173
|
onClick: u[1] ||= (e) => {
|
|
174
|
-
|
|
174
|
+
I("inputClick", e), R.value?.select();
|
|
175
175
|
}
|
|
176
|
-
}, null, 42, re), [[
|
|
176
|
+
}, null, 42, re), [[T, F.value]]),
|
|
177
177
|
o("span", {
|
|
178
178
|
ref_key: "hiddenSpan",
|
|
179
179
|
ref: K,
|
|
@@ -182,37 +182,38 @@ var re = [
|
|
|
182
182
|
font: "inherit",
|
|
183
183
|
fontSize: "inherit"
|
|
184
184
|
}
|
|
185
|
-
},
|
|
185
|
+
}, b(F.value), 3),
|
|
186
186
|
O(o("button", {
|
|
187
187
|
ref: "clearButtonRef",
|
|
188
188
|
type: "button",
|
|
189
189
|
class: d(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", c.clearButton?.classes]),
|
|
190
|
+
"data-cy": c.clearButton?.dataCy || "clear-btn",
|
|
190
191
|
"aria-label": "Clear input",
|
|
191
192
|
style: f({
|
|
192
|
-
left: `${
|
|
193
|
+
left: `${z.value + (c.clearButton?.offset || 0)}px`,
|
|
193
194
|
width: c.clearButton?.width ? `${c.clearButton.width}px` : "auto",
|
|
194
195
|
height: c.clearButton?.height ? `${c.clearButton.height}px` : "auto"
|
|
195
196
|
}),
|
|
196
|
-
onClick: te(
|
|
197
|
-
}, [
|
|
197
|
+
onClick: te(ae, ["stop"])
|
|
198
|
+
}, [v(l.$slots, "clear-icon", {}, () => [u[4] ||= s("X", -1)])], 14, k), [[ee, B.value && z.value]])
|
|
198
199
|
], 2),
|
|
199
|
-
|
|
200
|
+
v(l.$slots, "right-icon")
|
|
200
201
|
], 2)]),
|
|
201
202
|
default: D(() => [
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
V.value && !G.value.length ? v(l.$slots, "loading-state", { key: 0 }) : i("", !0),
|
|
204
|
+
V.value && G.value.length ? (g(), a("div", A, [...u[5] ||= [o("div", { class: "uikit-progress-bar-fill" }, null, -1)]])) : i("", !0),
|
|
205
|
+
G.value.length ? (g(!0), a(n, { key: 2 }, _(G.value, (t, n) => (g(), r(e, {
|
|
205
206
|
key: n,
|
|
206
|
-
active:
|
|
207
|
+
active: H.value === n,
|
|
207
208
|
class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
|
|
208
209
|
onClick: (e) => X(n, "click"),
|
|
209
210
|
onKeydown: Z,
|
|
210
|
-
onMouseover: (e) =>
|
|
211
|
+
onMouseover: (e) => H.value = n
|
|
211
212
|
}, {
|
|
212
|
-
default: D(() => [
|
|
213
|
+
default: D(() => [v(l.$slots, "option-content", {
|
|
213
214
|
option: t,
|
|
214
215
|
idx: n
|
|
215
|
-
}, () => [o("span", { innerHTML: t.label }, null, 8,
|
|
216
|
+
}, () => [o("span", { innerHTML: t.label }, null, 8, j)])]),
|
|
216
217
|
_: 2
|
|
217
218
|
}, 1032, [
|
|
218
219
|
"active",
|
|
@@ -230,4 +231,4 @@ var re = [
|
|
|
230
231
|
}
|
|
231
232
|
});
|
|
232
233
|
//#endregion
|
|
233
|
-
export {
|
|
234
|
+
export { M as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wikicasa-dev/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Wikicasa frontend components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
"vitest-browser-vue": "^2.1.0",
|
|
83
83
|
"vue-router": "^5.1.0",
|
|
84
84
|
"vue-tsc": "^3.3.3",
|
|
85
|
-
"@wikicasa-dev/eslint-config": "0.0.0",
|
|
86
|
-
"@wikicasa-dev/tsconfig": "0.0.0",
|
|
87
|
-
"@wikicasa-dev/svg-icons": "1.3.7",
|
|
88
85
|
"@wikicasa-dev/tailwind-plugins": "0.0.7",
|
|
86
|
+
"@wikicasa-dev/svg-icons": "1.3.7",
|
|
89
87
|
"@wikicasa-dev/types": "2.8.0",
|
|
90
|
-
"@wikicasa-dev/
|
|
91
|
-
"@wikicasa-dev/
|
|
88
|
+
"@wikicasa-dev/eslint-config": "0.0.0",
|
|
89
|
+
"@wikicasa-dev/tsconfig": "0.0.0",
|
|
90
|
+
"@wikicasa-dev/vue-composables": "0.2.0",
|
|
91
|
+
"@wikicasa-dev/utilities": "1.2.11"
|
|
92
92
|
},
|
|
93
93
|
"readme": "ERROR: No README data found!",
|
|
94
94
|
"scripts": {
|
|
File without changes
|