adverich-kun-ui 0.1.532 → 0.1.533
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,74 +1,72 @@
|
|
|
1
|
-
import { ref as h, computed as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
function
|
|
1
|
+
import { ref as h, computed as S, watch as w, nextTick as d } from "vue";
|
|
2
|
+
import { useRoute as V, useRouter as $ } from "vue-router";
|
|
3
|
+
function P(T) {
|
|
4
4
|
const {
|
|
5
5
|
modelValue: l,
|
|
6
|
-
emit:
|
|
6
|
+
emit: g,
|
|
7
7
|
tabsWrapper: a,
|
|
8
|
-
tabsContainer:
|
|
8
|
+
tabsContainer: z,
|
|
9
9
|
multiple: c = !1,
|
|
10
|
-
mandatory:
|
|
11
|
-
centerActive:
|
|
10
|
+
mandatory: v = !1,
|
|
11
|
+
centerActive: m = !1,
|
|
12
12
|
direction: s = "horizontal"
|
|
13
|
-
} =
|
|
14
|
-
$();
|
|
15
|
-
const
|
|
13
|
+
} = T, i = h(c ? [] : null), r = h([]);
|
|
14
|
+
V(), $();
|
|
15
|
+
const W = (t) => {
|
|
16
16
|
t && !r.value.includes(t) && r.value.push(t);
|
|
17
|
-
},
|
|
17
|
+
}, p = (t) => r.value.findIndex((e) => {
|
|
18
18
|
var o;
|
|
19
19
|
return ((o = e == null ? void 0 : e.dataset) == null ? void 0 : o.value) == t;
|
|
20
|
-
}),
|
|
20
|
+
}), A = () => {
|
|
21
21
|
if (c)
|
|
22
|
-
i.value = (Array.isArray(l) ? l : []).map(
|
|
22
|
+
i.value = (Array.isArray(l) ? l : []).map(p).filter((t) => t >= 0);
|
|
23
23
|
else {
|
|
24
|
-
const t =
|
|
25
|
-
i.value = t >= 0 ? t : null,
|
|
24
|
+
const t = p(l);
|
|
25
|
+
i.value = t >= 0 ? t : null, m && t >= 0 && x(t);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
27
|
+
}, x = (t) => d(() => {
|
|
28
28
|
const e = a.value, o = r.value[t];
|
|
29
29
|
if (e && o) {
|
|
30
30
|
const n = s === "horizontal" ? o.offsetLeft + o.offsetWidth / 2 - e.clientWidth / 2 : o.offsetTop + o.offsetHeight / 2 - e.clientHeight / 2;
|
|
31
31
|
s === "horizontal" ? e.scrollTo({ left: n, behavior: "smooth" }) : e.scrollTo({ top: n, behavior: "smooth" });
|
|
32
32
|
}
|
|
33
|
-
}),
|
|
33
|
+
}), B = S(() => {
|
|
34
34
|
if (c || i.value == null) return null;
|
|
35
35
|
const t = r.value[i.value];
|
|
36
36
|
return t ? s === "horizontal" ? { left: `${t.offsetLeft}px`, width: `${t.offsetWidth}px` } : { top: `${t.offsetTop}px`, height: `${t.offsetHeight}px`, width: "2px", left: "0" } : null;
|
|
37
|
-
}),
|
|
38
|
-
const t = a.value, e =
|
|
39
|
-
!t || !e || (
|
|
40
|
-
}, u = 100,
|
|
37
|
+
}), b = h(!1), y = h(!1), f = () => {
|
|
38
|
+
const t = a.value, e = z.value;
|
|
39
|
+
!t || !e || (b.value = s === "horizontal" ? t.scrollLeft > 0 : t.scrollTop > 0, y.value = s === "horizontal" ? e.scrollWidth > t.clientWidth + t.scrollLeft : e.scrollHeight > t.clientHeight + t.scrollTop);
|
|
40
|
+
}, u = 100, H = () => {
|
|
41
41
|
const t = a.value;
|
|
42
42
|
t && (s === "horizontal" ? t.scrollBy({ left: -u, behavior: "smooth" }) : t.scrollBy({ top: -u, behavior: "smooth" }), f());
|
|
43
|
-
},
|
|
43
|
+
}, I = () => {
|
|
44
44
|
const t = a.value;
|
|
45
45
|
t && (s === "horizontal" ? t.scrollBy({ left: u, behavior: "smooth" }) : t.scrollBy({ top: u, behavior: "smooth" }), f());
|
|
46
|
-
},
|
|
46
|
+
}, L = (t) => {
|
|
47
47
|
let e;
|
|
48
48
|
if (c) {
|
|
49
49
|
const o = Array.isArray(l) ? [...l] : [], n = o.indexOf(t);
|
|
50
|
-
n >= 0 ? (
|
|
51
|
-
} else if (e = t === l &&
|
|
52
|
-
const o =
|
|
53
|
-
o >= 0 &&
|
|
50
|
+
n >= 0 ? (v && o.length === 1 || o.splice(n, 1)) && (e = o) : o.push(t) && (e = o);
|
|
51
|
+
} else if (e = t === l && v ? l : t, m) {
|
|
52
|
+
const o = p(e);
|
|
53
|
+
o >= 0 && x(o);
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
g("update:modelValue", e);
|
|
56
56
|
};
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
}),
|
|
60
|
-
B(), m(f);
|
|
61
|
-
}, { immediate: !0 }), v(r, () => m(f), { deep: !0 }), {
|
|
57
|
+
return w(() => l, () => {
|
|
58
|
+
A(), d(f);
|
|
59
|
+
}, { immediate: !0 }), w(r, () => d(f), { deep: !0 }), {
|
|
62
60
|
activeIndexes: i,
|
|
63
|
-
sliderStyle:
|
|
64
|
-
registerTab:
|
|
65
|
-
showPrev:
|
|
66
|
-
showNext:
|
|
67
|
-
scrollNext:
|
|
68
|
-
scrollPrev:
|
|
69
|
-
select:
|
|
61
|
+
sliderStyle: B,
|
|
62
|
+
registerTab: W,
|
|
63
|
+
showPrev: b,
|
|
64
|
+
showNext: y,
|
|
65
|
+
scrollNext: I,
|
|
66
|
+
scrollPrev: H,
|
|
67
|
+
select: L
|
|
70
68
|
};
|
|
71
69
|
}
|
|
72
70
|
export {
|
|
73
|
-
|
|
71
|
+
P as useTabsGroup
|
|
74
72
|
};
|