vue-composable-ui 1.1.3 → 1.1.5
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.
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as i, inject as r, useModel as m, watch as p, withDirectives as d, openBlock as s, createElementBlock as f, mergeProps as v, unref as n, vModelDynamic as c } from "vue";
|
|
2
2
|
import { injectCombobox as b } from "./composable-ui19.js";
|
|
3
|
-
const y = /* @__PURE__ */
|
|
3
|
+
const y = /* @__PURE__ */ i({
|
|
4
4
|
__name: "comboboxInput",
|
|
5
5
|
props: {
|
|
6
6
|
modelValue: {},
|
|
7
7
|
modelModifiers: {}
|
|
8
8
|
},
|
|
9
9
|
emits: ["update:modelValue"],
|
|
10
|
-
setup(
|
|
11
|
-
const e =
|
|
10
|
+
setup(a) {
|
|
11
|
+
const e = r(b);
|
|
12
12
|
if (!e)
|
|
13
13
|
throw new Error("Combobox injectable context is not provided");
|
|
14
|
-
const l = m(
|
|
14
|
+
const l = m(a, "modelValue");
|
|
15
15
|
function u() {
|
|
16
16
|
l.value = e.displayValue.value;
|
|
17
17
|
}
|
|
18
18
|
return p(e.displayValue, u, { immediate: !0 }), (w, o) => d((s(), f("input", v({
|
|
19
19
|
"onUpdate:modelValue": o[0] || (o[0] = (t) => l.value = t)
|
|
20
|
-
}, n(e).activatorAttrs, {
|
|
20
|
+
}, n(e).activatorAttrs.value, {
|
|
21
21
|
onClick: o[1] || (o[1] = (t) => n(e).open({ focus: !1 })),
|
|
22
22
|
onKeydown: o[2] || (o[2] = //@ts-ignore
|
|
23
23
|
(...t) => n(e).activatorOnKeyDown && n(e).activatorOnKeyDown(...t)),
|
package/dist/composable-ui.js
CHANGED
|
@@ -18,7 +18,7 @@ import { _ as y } from "./menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js";
|
|
|
18
18
|
import { _ as A } from "./menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js";
|
|
19
19
|
import { _ as G } from "./menuItem.vue_vue_type_script_setup_true_lang-IZgj64N4.js";
|
|
20
20
|
import { _ as K } from "./combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js";
|
|
21
|
-
import { _ as Q } from "./comboboxInput.vue_vue_type_script_setup_true_lang-
|
|
21
|
+
import { _ as Q } from "./comboboxInput.vue_vue_type_script_setup_true_lang-BTDqx7mj.js";
|
|
22
22
|
import { _ as S } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js";
|
|
23
23
|
import { _ as W } from "./comboboxOption.vue_vue_type_script_setup_true_lang-DmF_EaqI.js";
|
|
24
24
|
export {
|
package/dist/composable-ui23.js
CHANGED
|
@@ -1,90 +1,95 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useHTMLElement as
|
|
3
|
-
function G(
|
|
1
|
+
import { ref as _, watch as F, nextTick as y, onBeforeMount as U, onMounted as V, onBeforeUnmount as j, toValue as z } from "vue";
|
|
2
|
+
import { useHTMLElement as A } from "./composable-ui24.js";
|
|
3
|
+
function G(L, B, {
|
|
4
4
|
direction: c = "down",
|
|
5
5
|
align: u = "left",
|
|
6
|
-
position:
|
|
7
|
-
closeOnOutsideClick:
|
|
8
|
-
closeOnInsideClick:
|
|
6
|
+
position: C = "fixed",
|
|
7
|
+
closeOnOutsideClick: M = !0,
|
|
8
|
+
closeOnInsideClick: O = !1
|
|
9
9
|
} = {}) {
|
|
10
|
-
const s =
|
|
10
|
+
const s = _(!1);
|
|
11
11
|
function v() {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
|
|
12
|
+
const e = A(L);
|
|
13
|
+
if (!e.value)
|
|
14
|
+
throw new Error(
|
|
15
|
+
"Activator element is undefined: " + z(L)
|
|
16
|
+
);
|
|
17
|
+
return e.value;
|
|
15
18
|
}
|
|
16
19
|
function $() {
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
19
|
-
|
|
20
|
+
const e = A(B);
|
|
21
|
+
if (!e.value)
|
|
22
|
+
throw new Error("Popover element is undefined: " + z(B));
|
|
23
|
+
return e.value;
|
|
20
24
|
}
|
|
21
|
-
function
|
|
22
|
-
s.value = !0,
|
|
25
|
+
function P({ focus: e = !0 } = {}) {
|
|
26
|
+
s.value = !0, e && y(() => {
|
|
23
27
|
$().focus();
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
|
-
function E({ focus:
|
|
27
|
-
s.value = !1,
|
|
30
|
+
function E({ focus: e = !0 } = {}) {
|
|
31
|
+
s.value = !1, e && v().focus();
|
|
28
32
|
}
|
|
29
|
-
function
|
|
30
|
-
s.value ? E(
|
|
33
|
+
function R(e) {
|
|
34
|
+
s.value ? E(e) : P(e);
|
|
31
35
|
}
|
|
32
36
|
function h() {
|
|
33
37
|
if (!s.value) return;
|
|
34
|
-
const
|
|
35
|
-
r.style.position =
|
|
38
|
+
const e = v(), r = $();
|
|
39
|
+
r.style.position = C;
|
|
36
40
|
const {
|
|
37
41
|
top: f,
|
|
38
42
|
right: l,
|
|
39
43
|
bottom: w,
|
|
40
|
-
left:
|
|
44
|
+
left: a,
|
|
41
45
|
width: m,
|
|
42
46
|
height: W
|
|
43
|
-
} =
|
|
47
|
+
} = e.getBoundingClientRect(), p = r.offsetHeight, d = r.offsetWidth, x = document.documentElement.clientHeight, b = document.documentElement.clientWidth;
|
|
44
48
|
let i = c;
|
|
45
|
-
c == "up" ? f -
|
|
49
|
+
c == "up" ? f - p < 0 && (i = "down") : c == "down" ? w + p > x && (i = "up") : c == "right" ? l + d > b && (i = "left") : c == "left" && a - d < 0 && (i = "right");
|
|
46
50
|
let o = u;
|
|
47
|
-
u == "left" ?
|
|
48
|
-
const
|
|
51
|
+
u == "left" ? a + d > b && (o = "right") : u == "right" ? l - d < 0 && (o = "left") : u == "top" ? f + p > x && (o = "bottom") : u == "bottom" && w - p < 0 && (o = "top");
|
|
52
|
+
const t = {
|
|
49
53
|
top: "auto",
|
|
50
54
|
bottom: "auto",
|
|
51
55
|
left: "auto",
|
|
52
56
|
right: "auto",
|
|
53
57
|
width: "auto"
|
|
54
|
-
}, n =
|
|
55
|
-
i == "up" ?
|
|
56
|
-
for (const
|
|
57
|
-
r.style[
|
|
58
|
+
}, n = C === "fixed";
|
|
59
|
+
i == "up" ? t.bottom = `${W + (n ? x - w : 0)}px` : i == "down" ? t.top = `${W + (n ? f : 0)}px` : i == "right" ? t.left = `${m + (n ? a : 0)}px` : i == "left" && (t.right = `${m + (n ? b - l : 0)}px`), ["up", "down"].includes(i) ? o == "right" ? t.right = `${n ? b - l : 0}px` : o == "left" || o == "stretch" ? t.left = `${n ? a : 0}px` : o == "center" && (t.left = `${(n ? a : 0) - (d - m) / 2}px`) : o == "bottom" ? t.bottom = `${n ? x - w : 0}px` : o == "top" ? t.top = `${n ? f : 0}px` : o == "center" && (t.top = `${(n ? f : 0) - (p - W) / 2}px`), ["up", "down"].includes(i) && o === "stretch" && (t.width = m + "px");
|
|
60
|
+
for (const k in t)
|
|
61
|
+
r.style[k] = t[k];
|
|
58
62
|
}
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
F(
|
|
64
|
+
s,
|
|
65
|
+
(e) => {
|
|
66
|
+
e && y(() => {
|
|
67
|
+
h();
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
{ flush: "pre" }
|
|
71
|
+
);
|
|
72
|
+
function T(e) {
|
|
73
|
+
const r = e.target;
|
|
61
74
|
if (!v().contains(r))
|
|
62
75
|
try {
|
|
63
|
-
$().contains(r) ?
|
|
76
|
+
$().contains(r) ? O && E() : M && (s.value = !1);
|
|
64
77
|
} catch {
|
|
65
78
|
}
|
|
66
79
|
}
|
|
67
80
|
let H;
|
|
68
81
|
const g = new AbortController();
|
|
69
|
-
return
|
|
82
|
+
return U(() => {
|
|
70
83
|
H = new ResizeObserver(h);
|
|
71
|
-
}),
|
|
72
|
-
|
|
73
|
-
s,
|
|
74
|
-
(t) => {
|
|
75
|
-
t && P(() => {
|
|
76
|
-
h();
|
|
77
|
-
});
|
|
78
|
-
},
|
|
79
|
-
{ flush: "post" }
|
|
80
|
-
), window.addEventListener("resize", h, {
|
|
84
|
+
}), V(() => {
|
|
85
|
+
window.addEventListener("resize", h, {
|
|
81
86
|
passive: !0,
|
|
82
87
|
signal: g.signal
|
|
83
88
|
}), window.addEventListener("scroll", h, {
|
|
84
89
|
passive: !0,
|
|
85
90
|
//capture: true,
|
|
86
91
|
signal: g.signal
|
|
87
|
-
}), window.addEventListener("click",
|
|
92
|
+
}), window.addEventListener("click", T, {
|
|
88
93
|
passive: !0,
|
|
89
94
|
signal: g.signal
|
|
90
95
|
}), H.observe(v());
|
|
@@ -92,9 +97,9 @@ function G(y, z, {
|
|
|
92
97
|
g.abort(), H.disconnect();
|
|
93
98
|
}), {
|
|
94
99
|
isOpen: s,
|
|
95
|
-
open:
|
|
100
|
+
open: P,
|
|
96
101
|
close: E,
|
|
97
|
-
toggle:
|
|
102
|
+
toggle: R
|
|
98
103
|
};
|
|
99
104
|
}
|
|
100
105
|
export {
|
package/dist/composable-ui4.js
CHANGED