@wikicasa-dev/components 2.1.1 → 2.1.2-alpha.2
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/assets/SwiperCarousel.css +1 -1
- package/dist/assets/free-mode.css +1 -0
- package/dist/assets/navigation.css +1 -0
- package/dist/assets/pagination.css +1 -0
- package/dist/chunks/SwiperCarousel.BG9WKjrJ.js +757 -0
- package/dist/chunks/autoplay.BGHgUDoY.js +129 -0
- package/dist/chunks/controller.0x6YWuUP.js +101 -0
- package/dist/chunks/create-element-if-not-defined.42NcLnr9.js +12 -0
- package/dist/chunks/free-mode.DuU7N2XQ.js +125 -0
- package/dist/chunks/keyboard.DRVbxSum.js +66 -0
- package/dist/chunks/navigation.DN21unMg.js +127 -0
- package/dist/chunks/pagination.DiUF6O5_.js +229 -0
- package/dist/chunks/thumbs.0ifInQuA.js +120 -0
- package/dist/components/carousel/SwiperCarousel.js +3 -1593
- package/dist/index.js +1 -1
- package/package.json +1 -1
- /package/dist/{UIKit → lib/UIKit}/AccessibleSelect.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Accordion/BaseAccordion.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Accordion/BaseAccordionBtn.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Accordion/BaseAccordionContent.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Accordion/BaseAccordionItem.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseAlert.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseAutocomplete.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseBadge.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseBreadcrumb.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseButton.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseCard.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseComplexToggle.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseDropDown.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseFloatingLabel.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseIcon.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseInput.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseModal.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BasePagination.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BasePaper.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseSelect/SelectItem.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseSlider.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseSnackbar.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseTextarea.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseToggle.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseTooltip.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/BaseUploadFile.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Checkbox/CheckboxBtn.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Checkbox/CheckboxGroup.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Radio/RadioButton.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Radio/RadioGroup.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/ShimmerLoader/BaseShimmerLoader.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/ShimmerLoader/ShimmerMultiLine.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Slider/SimpleSlider.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/StaticSpinner.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Tab/BaseTab.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Tab/BaseTabList.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Tab/BaseTabPanel.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/Tab/BaseTabView.d.ts +0 -0
- /package/dist/{UIKit → lib/UIKit}/types.d.ts +0 -0
- /package/dist/{chart → lib/chart}/DoughnutChart.d.ts +0 -0
- /package/dist/{chart → lib/chart}/LineChart.d.ts +0 -0
- /package/dist/{chart → lib/chart}/composables/useChartjsModules.d.ts +0 -0
- /package/dist/{components → lib/components}/IntersectionObserver/IntersectionObservable.d.ts +0 -0
- /package/dist/{components → lib/components}/IntersectionObserver/IntersectionObserver.d.ts +0 -0
- /package/dist/{components → lib/components}/carousel/SwiperCarousel.d.ts +0 -0
- /package/dist/{components → lib/components}/carousel/SwiperSlide.d.ts +0 -0
- /package/dist/{composables → lib/composables}/useFloatingLabel.d.ts +0 -0
- /package/dist/{composables → lib/composables}/useValidator.d.ts +0 -0
- /package/dist/{index.d.ts → lib/index.d.ts} +0 -0
- /package/dist/{types.d.ts → lib/types.d.ts} +0 -0
- /package/dist/{utils.d.ts → lib/utils.d.ts} +0 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { c as F } from "./create-element-if-not-defined.42NcLnr9.js";
|
|
2
|
+
import { m, b as E, j as T, k as I } from "./SwiperCarousel.BG9WKjrJ.js";
|
|
3
|
+
import '../assets/pagination.css';function x(b) {
|
|
4
|
+
return b === void 0 && (b = ""), `.${b.trim().replace(/([\.:!+\/])/g, "\\$1").replace(/ /g, ".")}`;
|
|
5
|
+
}
|
|
6
|
+
function R(b) {
|
|
7
|
+
let {
|
|
8
|
+
swiper: e,
|
|
9
|
+
extendParams: H,
|
|
10
|
+
on: g,
|
|
11
|
+
emit: v
|
|
12
|
+
} = b;
|
|
13
|
+
const d = "swiper-pagination";
|
|
14
|
+
H({
|
|
15
|
+
pagination: {
|
|
16
|
+
el: null,
|
|
17
|
+
bulletElement: "span",
|
|
18
|
+
clickable: !1,
|
|
19
|
+
hideOnClick: !1,
|
|
20
|
+
renderBullet: null,
|
|
21
|
+
renderProgressbar: null,
|
|
22
|
+
renderFraction: null,
|
|
23
|
+
renderCustom: null,
|
|
24
|
+
progressbarOpposite: !1,
|
|
25
|
+
type: "bullets",
|
|
26
|
+
// 'bullets' or 'progressbar' or 'fraction' or 'custom'
|
|
27
|
+
dynamicBullets: !1,
|
|
28
|
+
dynamicMainBullets: 1,
|
|
29
|
+
formatFractionCurrent: (a) => a,
|
|
30
|
+
formatFractionTotal: (a) => a,
|
|
31
|
+
bulletClass: `${d}-bullet`,
|
|
32
|
+
bulletActiveClass: `${d}-bullet-active`,
|
|
33
|
+
modifierClass: `${d}-`,
|
|
34
|
+
currentClass: `${d}-current`,
|
|
35
|
+
totalClass: `${d}-total`,
|
|
36
|
+
hiddenClass: `${d}-hidden`,
|
|
37
|
+
progressbarFillClass: `${d}-progressbar-fill`,
|
|
38
|
+
progressbarOppositeClass: `${d}-progressbar-opposite`,
|
|
39
|
+
clickableClass: `${d}-clickable`,
|
|
40
|
+
lockClass: `${d}-lock`,
|
|
41
|
+
horizontalClass: `${d}-horizontal`,
|
|
42
|
+
verticalClass: `${d}-vertical`,
|
|
43
|
+
paginationDisabledClass: `${d}-disabled`
|
|
44
|
+
}
|
|
45
|
+
}), e.pagination = {
|
|
46
|
+
el: null,
|
|
47
|
+
bullets: []
|
|
48
|
+
};
|
|
49
|
+
let L, u = 0;
|
|
50
|
+
function A() {
|
|
51
|
+
return !e.params.pagination.el || !e.pagination.el || Array.isArray(e.pagination.el) && e.pagination.el.length === 0;
|
|
52
|
+
}
|
|
53
|
+
function B(a, s) {
|
|
54
|
+
const {
|
|
55
|
+
bulletActiveClass: i
|
|
56
|
+
} = e.params.pagination;
|
|
57
|
+
a && (a = a[`${s === "prev" ? "previous" : "next"}ElementSibling`], a && (a.classList.add(`${i}-${s}`), a = a[`${s === "prev" ? "previous" : "next"}ElementSibling`], a && a.classList.add(`${i}-${s}-${s}`)));
|
|
58
|
+
}
|
|
59
|
+
function O(a, s, i) {
|
|
60
|
+
if (a = a % i, s = s % i, s === a + 1)
|
|
61
|
+
return "next";
|
|
62
|
+
if (s === a - 1)
|
|
63
|
+
return "previous";
|
|
64
|
+
}
|
|
65
|
+
function P(a) {
|
|
66
|
+
const s = a.target.closest(x(e.params.pagination.bulletClass));
|
|
67
|
+
if (!s)
|
|
68
|
+
return;
|
|
69
|
+
a.preventDefault();
|
|
70
|
+
const i = I(s) * e.params.slidesPerGroup;
|
|
71
|
+
if (e.params.loop) {
|
|
72
|
+
if (e.realIndex === i) return;
|
|
73
|
+
const t = O(e.realIndex, i, e.slides.length);
|
|
74
|
+
t === "next" ? e.slideNext() : t === "previous" ? e.slidePrev() : e.slideToLoop(i);
|
|
75
|
+
} else
|
|
76
|
+
e.slideTo(i);
|
|
77
|
+
}
|
|
78
|
+
function h() {
|
|
79
|
+
const a = e.rtl, s = e.params.pagination;
|
|
80
|
+
if (A()) return;
|
|
81
|
+
let i = e.pagination.el;
|
|
82
|
+
i = m(i);
|
|
83
|
+
let t, p;
|
|
84
|
+
const C = e.virtual && e.params.virtual.enabled ? e.virtual.slides.length : e.slides.length, D = e.params.loop ? Math.ceil(C / e.params.slidesPerGroup) : e.snapGrid.length;
|
|
85
|
+
if (e.params.loop ? (p = e.previousRealIndex || 0, t = e.params.slidesPerGroup > 1 ? Math.floor(e.realIndex / e.params.slidesPerGroup) : e.realIndex) : typeof e.snapIndex < "u" ? (t = e.snapIndex, p = e.previousSnapIndex) : (p = e.previousIndex || 0, t = e.activeIndex || 0), s.type === "bullets" && e.pagination.bullets && e.pagination.bullets.length > 0) {
|
|
86
|
+
const l = e.pagination.bullets;
|
|
87
|
+
let f, c, $;
|
|
88
|
+
if (s.dynamicBullets && (L = T(l[0], e.isHorizontal() ? "width" : "height"), i.forEach((n) => {
|
|
89
|
+
n.style[e.isHorizontal() ? "width" : "height"] = `${L * (s.dynamicMainBullets + 4)}px`;
|
|
90
|
+
}), s.dynamicMainBullets > 1 && p !== void 0 && (u += t - (p || 0), u > s.dynamicMainBullets - 1 ? u = s.dynamicMainBullets - 1 : u < 0 && (u = 0)), f = Math.max(t - u, 0), c = f + (Math.min(l.length, s.dynamicMainBullets) - 1), $ = (c + f) / 2), l.forEach((n) => {
|
|
91
|
+
const r = [...["", "-next", "-next-next", "-prev", "-prev-prev", "-main"].map((o) => `${s.bulletActiveClass}${o}`)].map((o) => typeof o == "string" && o.includes(" ") ? o.split(" ") : o).flat();
|
|
92
|
+
n.classList.remove(...r);
|
|
93
|
+
}), i.length > 1)
|
|
94
|
+
l.forEach((n) => {
|
|
95
|
+
const r = I(n);
|
|
96
|
+
r === t ? n.classList.add(...s.bulletActiveClass.split(" ")) : e.isElement && n.setAttribute("part", "bullet"), s.dynamicBullets && (r >= f && r <= c && n.classList.add(...`${s.bulletActiveClass}-main`.split(" ")), r === f && B(n, "prev"), r === c && B(n, "next"));
|
|
97
|
+
});
|
|
98
|
+
else {
|
|
99
|
+
const n = l[t];
|
|
100
|
+
if (n && n.classList.add(...s.bulletActiveClass.split(" ")), e.isElement && l.forEach((r, o) => {
|
|
101
|
+
r.setAttribute("part", o === t ? "bullet-active" : "bullet");
|
|
102
|
+
}), s.dynamicBullets) {
|
|
103
|
+
const r = l[f], o = l[c];
|
|
104
|
+
for (let y = f; y <= c; y += 1)
|
|
105
|
+
l[y] && l[y].classList.add(...`${s.bulletActiveClass}-main`.split(" "));
|
|
106
|
+
B(r, "prev"), B(o, "next");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (s.dynamicBullets) {
|
|
110
|
+
const n = Math.min(l.length, s.dynamicMainBullets + 4), r = (L * n - L) / 2 - $ * L, o = a ? "right" : "left";
|
|
111
|
+
l.forEach((y) => {
|
|
112
|
+
y.style[e.isHorizontal() ? o : "top"] = `${r}px`;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
i.forEach((l, f) => {
|
|
117
|
+
if (s.type === "fraction" && (l.querySelectorAll(x(s.currentClass)).forEach((c) => {
|
|
118
|
+
c.textContent = s.formatFractionCurrent(t + 1);
|
|
119
|
+
}), l.querySelectorAll(x(s.totalClass)).forEach((c) => {
|
|
120
|
+
c.textContent = s.formatFractionTotal(D);
|
|
121
|
+
})), s.type === "progressbar") {
|
|
122
|
+
let c;
|
|
123
|
+
s.progressbarOpposite ? c = e.isHorizontal() ? "vertical" : "horizontal" : c = e.isHorizontal() ? "horizontal" : "vertical";
|
|
124
|
+
const $ = (t + 1) / D;
|
|
125
|
+
let n = 1, r = 1;
|
|
126
|
+
c === "horizontal" ? n = $ : r = $, l.querySelectorAll(x(s.progressbarFillClass)).forEach((o) => {
|
|
127
|
+
o.style.transform = `translate3d(0,0,0) scaleX(${n}) scaleY(${r})`, o.style.transitionDuration = `${e.params.speed}ms`;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
s.type === "custom" && s.renderCustom ? (l.innerHTML = s.renderCustom(e, t + 1, D), f === 0 && v("paginationRender", l)) : (f === 0 && v("paginationRender", l), v("paginationUpdate", l)), e.params.watchOverflow && e.enabled && l.classList[e.isLocked ? "add" : "remove"](s.lockClass);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function k() {
|
|
134
|
+
const a = e.params.pagination;
|
|
135
|
+
if (A()) return;
|
|
136
|
+
const s = e.virtual && e.params.virtual.enabled ? e.virtual.slides.length : e.grid && e.params.grid.rows > 1 ? e.slides.length / Math.ceil(e.params.grid.rows) : e.slides.length;
|
|
137
|
+
let i = e.pagination.el;
|
|
138
|
+
i = m(i);
|
|
139
|
+
let t = "";
|
|
140
|
+
if (a.type === "bullets") {
|
|
141
|
+
let p = e.params.loop ? Math.ceil(s / e.params.slidesPerGroup) : e.snapGrid.length;
|
|
142
|
+
e.params.freeMode && e.params.freeMode.enabled && p > s && (p = s);
|
|
143
|
+
for (let C = 0; C < p; C += 1)
|
|
144
|
+
a.renderBullet ? t += a.renderBullet.call(e, C, a.bulletClass) : t += `<${a.bulletElement} ${e.isElement ? 'part="bullet"' : ""} class="${a.bulletClass}"></${a.bulletElement}>`;
|
|
145
|
+
}
|
|
146
|
+
a.type === "fraction" && (a.renderFraction ? t = a.renderFraction.call(e, a.currentClass, a.totalClass) : t = `<span class="${a.currentClass}"></span> / <span class="${a.totalClass}"></span>`), a.type === "progressbar" && (a.renderProgressbar ? t = a.renderProgressbar.call(e, a.progressbarFillClass) : t = `<span class="${a.progressbarFillClass}"></span>`), e.pagination.bullets = [], i.forEach((p) => {
|
|
147
|
+
a.type !== "custom" && (p.innerHTML = t || ""), a.type === "bullets" && e.pagination.bullets.push(...p.querySelectorAll(x(a.bulletClass)));
|
|
148
|
+
}), a.type !== "custom" && v("paginationRender", i[0]);
|
|
149
|
+
}
|
|
150
|
+
function M() {
|
|
151
|
+
e.params.pagination = F(e, e.originalParams.pagination, e.params.pagination, {
|
|
152
|
+
el: "swiper-pagination"
|
|
153
|
+
});
|
|
154
|
+
const a = e.params.pagination;
|
|
155
|
+
if (!a.el) return;
|
|
156
|
+
let s;
|
|
157
|
+
typeof a.el == "string" && e.isElement && (s = e.el.querySelector(a.el)), !s && typeof a.el == "string" && (s = [...document.querySelectorAll(a.el)]), s || (s = a.el), !(!s || s.length === 0) && (e.params.uniqueNavElements && typeof a.el == "string" && Array.isArray(s) && s.length > 1 && (s = [...e.el.querySelectorAll(a.el)], s.length > 1 && (s = s.find((i) => E(i, ".swiper")[0] === e.el))), Array.isArray(s) && s.length === 1 && (s = s[0]), Object.assign(e.pagination, {
|
|
158
|
+
el: s
|
|
159
|
+
}), s = m(s), s.forEach((i) => {
|
|
160
|
+
a.type === "bullets" && a.clickable && i.classList.add(...(a.clickableClass || "").split(" ")), i.classList.add(a.modifierClass + a.type), i.classList.add(e.isHorizontal() ? a.horizontalClass : a.verticalClass), a.type === "bullets" && a.dynamicBullets && (i.classList.add(`${a.modifierClass}${a.type}-dynamic`), u = 0, a.dynamicMainBullets < 1 && (a.dynamicMainBullets = 1)), a.type === "progressbar" && a.progressbarOpposite && i.classList.add(a.progressbarOppositeClass), a.clickable && i.addEventListener("click", P), e.enabled || i.classList.add(a.lockClass);
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
function z() {
|
|
164
|
+
const a = e.params.pagination;
|
|
165
|
+
if (A()) return;
|
|
166
|
+
let s = e.pagination.el;
|
|
167
|
+
s && (s = m(s), s.forEach((i) => {
|
|
168
|
+
i.classList.remove(a.hiddenClass), i.classList.remove(a.modifierClass + a.type), i.classList.remove(e.isHorizontal() ? a.horizontalClass : a.verticalClass), a.clickable && (i.classList.remove(...(a.clickableClass || "").split(" ")), i.removeEventListener("click", P));
|
|
169
|
+
})), e.pagination.bullets && e.pagination.bullets.forEach((i) => i.classList.remove(...a.bulletActiveClass.split(" ")));
|
|
170
|
+
}
|
|
171
|
+
g("changeDirection", () => {
|
|
172
|
+
if (!e.pagination || !e.pagination.el) return;
|
|
173
|
+
const a = e.params.pagination;
|
|
174
|
+
let {
|
|
175
|
+
el: s
|
|
176
|
+
} = e.pagination;
|
|
177
|
+
s = m(s), s.forEach((i) => {
|
|
178
|
+
i.classList.remove(a.horizontalClass, a.verticalClass), i.classList.add(e.isHorizontal() ? a.horizontalClass : a.verticalClass);
|
|
179
|
+
});
|
|
180
|
+
}), g("init", () => {
|
|
181
|
+
e.params.pagination.enabled === !1 ? S() : (M(), k(), h());
|
|
182
|
+
}), g("activeIndexChange", () => {
|
|
183
|
+
typeof e.snapIndex > "u" && h();
|
|
184
|
+
}), g("snapIndexChange", () => {
|
|
185
|
+
h();
|
|
186
|
+
}), g("snapGridLengthChange", () => {
|
|
187
|
+
k(), h();
|
|
188
|
+
}), g("destroy", () => {
|
|
189
|
+
z();
|
|
190
|
+
}), g("enable disable", () => {
|
|
191
|
+
let {
|
|
192
|
+
el: a
|
|
193
|
+
} = e.pagination;
|
|
194
|
+
a && (a = m(a), a.forEach((s) => s.classList[e.enabled ? "remove" : "add"](e.params.pagination.lockClass)));
|
|
195
|
+
}), g("lock unlock", () => {
|
|
196
|
+
h();
|
|
197
|
+
}), g("click", (a, s) => {
|
|
198
|
+
const i = s.target, t = m(e.pagination.el);
|
|
199
|
+
if (e.params.pagination.el && e.params.pagination.hideOnClick && t && t.length > 0 && !i.classList.contains(e.params.pagination.bulletClass)) {
|
|
200
|
+
if (e.navigation && (e.navigation.nextEl && i === e.navigation.nextEl || e.navigation.prevEl && i === e.navigation.prevEl)) return;
|
|
201
|
+
const p = t[0].classList.contains(e.params.pagination.hiddenClass);
|
|
202
|
+
v(p === !0 ? "paginationShow" : "paginationHide"), t.forEach((C) => C.classList.toggle(e.params.pagination.hiddenClass));
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
const w = () => {
|
|
206
|
+
e.el.classList.remove(e.params.pagination.paginationDisabledClass);
|
|
207
|
+
let {
|
|
208
|
+
el: a
|
|
209
|
+
} = e.pagination;
|
|
210
|
+
a && (a = m(a), a.forEach((s) => s.classList.remove(e.params.pagination.paginationDisabledClass))), M(), k(), h();
|
|
211
|
+
}, S = () => {
|
|
212
|
+
e.el.classList.add(e.params.pagination.paginationDisabledClass);
|
|
213
|
+
let {
|
|
214
|
+
el: a
|
|
215
|
+
} = e.pagination;
|
|
216
|
+
a && (a = m(a), a.forEach((s) => s.classList.add(e.params.pagination.paginationDisabledClass))), z();
|
|
217
|
+
};
|
|
218
|
+
Object.assign(e.pagination, {
|
|
219
|
+
enable: w,
|
|
220
|
+
disable: S,
|
|
221
|
+
render: k,
|
|
222
|
+
update: h,
|
|
223
|
+
init: M,
|
|
224
|
+
destroy: z
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
export {
|
|
228
|
+
R as Pagination
|
|
229
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { g as S, i as I, e as g } from "./SwiperCarousel.BG9WKjrJ.js";
|
|
2
|
+
function P(h) {
|
|
3
|
+
let {
|
|
4
|
+
swiper: e,
|
|
5
|
+
extendParams: w,
|
|
6
|
+
on: m
|
|
7
|
+
} = h;
|
|
8
|
+
w({
|
|
9
|
+
thumbs: {
|
|
10
|
+
swiper: null,
|
|
11
|
+
multipleActiveThumbs: !0,
|
|
12
|
+
autoScrollOffset: 0,
|
|
13
|
+
slideThumbActiveClass: "swiper-slide-thumb-active",
|
|
14
|
+
thumbsContainerClass: "swiper-thumbs"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
let c = !1, b = !1;
|
|
18
|
+
e.thumbs = {
|
|
19
|
+
swiper: null
|
|
20
|
+
};
|
|
21
|
+
function x() {
|
|
22
|
+
const t = e.thumbs.swiper;
|
|
23
|
+
if (!t || t.destroyed) return;
|
|
24
|
+
const s = t.clickedIndex, r = t.clickedSlide;
|
|
25
|
+
if (r && r.classList.contains(e.params.thumbs.slideThumbActiveClass) || typeof s > "u" || s === null) return;
|
|
26
|
+
let a;
|
|
27
|
+
t.params.loop ? a = parseInt(t.clickedSlide.getAttribute("data-swiper-slide-index"), 10) : a = s, e.params.loop ? e.slideToLoop(a) : e.slideTo(a);
|
|
28
|
+
}
|
|
29
|
+
function p() {
|
|
30
|
+
const {
|
|
31
|
+
thumbs: t
|
|
32
|
+
} = e.params;
|
|
33
|
+
if (c) return !1;
|
|
34
|
+
c = !0;
|
|
35
|
+
const s = e.constructor;
|
|
36
|
+
if (t.swiper instanceof s) {
|
|
37
|
+
if (t.swiper.destroyed)
|
|
38
|
+
return c = !1, !1;
|
|
39
|
+
e.thumbs.swiper = t.swiper, Object.assign(e.thumbs.swiper.originalParams, {
|
|
40
|
+
watchSlidesProgress: !0,
|
|
41
|
+
slideToClickedSlide: !1
|
|
42
|
+
}), Object.assign(e.thumbs.swiper.params, {
|
|
43
|
+
watchSlidesProgress: !0,
|
|
44
|
+
slideToClickedSlide: !1
|
|
45
|
+
}), e.thumbs.swiper.update();
|
|
46
|
+
} else if (I(t.swiper)) {
|
|
47
|
+
const r = Object.assign({}, t.swiper);
|
|
48
|
+
Object.assign(r, {
|
|
49
|
+
watchSlidesProgress: !0,
|
|
50
|
+
slideToClickedSlide: !1
|
|
51
|
+
}), e.thumbs.swiper = new s(r), b = !0;
|
|
52
|
+
}
|
|
53
|
+
return e.thumbs.swiper.el.classList.add(e.params.thumbs.thumbsContainerClass), e.thumbs.swiper.on("tap", x), !0;
|
|
54
|
+
}
|
|
55
|
+
function o(t) {
|
|
56
|
+
const s = e.thumbs.swiper;
|
|
57
|
+
if (!s || s.destroyed) return;
|
|
58
|
+
const r = s.params.slidesPerView === "auto" ? s.slidesPerViewDynamic() : s.params.slidesPerView;
|
|
59
|
+
let a = 1;
|
|
60
|
+
const l = e.params.thumbs.slideThumbActiveClass;
|
|
61
|
+
if (e.params.slidesPerView > 1 && !e.params.centeredSlides && (a = e.params.slidesPerView), e.params.thumbs.multipleActiveThumbs || (a = 1), a = Math.floor(a), s.slides.forEach((i) => i.classList.remove(l)), s.params.loop || s.params.virtual && s.params.virtual.enabled)
|
|
62
|
+
for (let i = 0; i < a; i += 1)
|
|
63
|
+
g(s.slidesEl, `[data-swiper-slide-index="${e.realIndex + i}"]`).forEach((n) => {
|
|
64
|
+
n.classList.add(l);
|
|
65
|
+
});
|
|
66
|
+
else
|
|
67
|
+
for (let i = 0; i < a; i += 1)
|
|
68
|
+
s.slides[e.realIndex + i] && s.slides[e.realIndex + i].classList.add(l);
|
|
69
|
+
const d = e.params.thumbs.autoScrollOffset, u = d && !s.params.loop;
|
|
70
|
+
if (e.realIndex !== s.realIndex || u) {
|
|
71
|
+
const i = s.activeIndex;
|
|
72
|
+
let n, f;
|
|
73
|
+
if (s.params.loop) {
|
|
74
|
+
const T = s.slides.find((v) => v.getAttribute("data-swiper-slide-index") === `${e.realIndex}`);
|
|
75
|
+
n = s.slides.indexOf(T), f = e.activeIndex > e.previousIndex ? "next" : "prev";
|
|
76
|
+
} else
|
|
77
|
+
n = e.realIndex, f = n > e.previousIndex ? "next" : "prev";
|
|
78
|
+
u && (n += f === "next" ? d : -1 * d), s.visibleSlidesIndexes && s.visibleSlidesIndexes.indexOf(n) < 0 && (s.params.centeredSlides ? n > i ? n = n - Math.floor(r / 2) + 1 : n = n + Math.floor(r / 2) - 1 : n > i && s.params.slidesPerGroup, s.slideTo(n, t ? 0 : void 0));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
m("beforeInit", () => {
|
|
82
|
+
const {
|
|
83
|
+
thumbs: t
|
|
84
|
+
} = e.params;
|
|
85
|
+
if (!(!t || !t.swiper))
|
|
86
|
+
if (typeof t.swiper == "string" || t.swiper instanceof HTMLElement) {
|
|
87
|
+
const s = S(), r = () => {
|
|
88
|
+
const l = typeof t.swiper == "string" ? s.querySelector(t.swiper) : t.swiper;
|
|
89
|
+
if (l && l.swiper)
|
|
90
|
+
t.swiper = l.swiper, p(), o(!0);
|
|
91
|
+
else if (l) {
|
|
92
|
+
const d = `${e.params.eventsPrefix}init`, u = (i) => {
|
|
93
|
+
t.swiper = i.detail[0], l.removeEventListener(d, u), p(), o(!0), t.swiper.update(), e.update();
|
|
94
|
+
};
|
|
95
|
+
l.addEventListener(d, u);
|
|
96
|
+
}
|
|
97
|
+
return l;
|
|
98
|
+
}, a = () => {
|
|
99
|
+
if (e.destroyed) return;
|
|
100
|
+
r() || requestAnimationFrame(a);
|
|
101
|
+
};
|
|
102
|
+
requestAnimationFrame(a);
|
|
103
|
+
} else
|
|
104
|
+
p(), o(!0);
|
|
105
|
+
}), m("slideChange update resize observerUpdate", () => {
|
|
106
|
+
o();
|
|
107
|
+
}), m("setTransition", (t, s) => {
|
|
108
|
+
const r = e.thumbs.swiper;
|
|
109
|
+
!r || r.destroyed || r.setTransition(s);
|
|
110
|
+
}), m("beforeDestroy", () => {
|
|
111
|
+
const t = e.thumbs.swiper;
|
|
112
|
+
!t || t.destroyed || b && t.destroy();
|
|
113
|
+
}), Object.assign(e.thumbs, {
|
|
114
|
+
init: p,
|
|
115
|
+
update: o
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
P as Thumbs
|
|
120
|
+
};
|