@ptcwebops/ptcw-design 1.6.7 → 1.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/{esm/core-1c9d4889.js → cjs/core-5a811549.js} +26 -1
- package/dist/cjs/{icon-asset_17.cjs.entry.js → icon-asset_16.cjs.entry.js} +44 -38
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ptc-case-studies-slider.cjs.entry.js +1685 -0
- package/dist/cjs/ptc-image-download-strip.cjs.entry.js +29 -0
- package/dist/cjs/ptc-jumbotron.cjs.entry.js +1 -1
- package/dist/cjs/ptc-news.cjs.entry.js +28 -0
- package/dist/cjs/ptc-pricing-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ptc-progress-bar_2.cjs.entry.js +11 -1
- package/dist/cjs/ptc-readmore.cjs.entry.js +2 -2
- package/dist/cjs/ptc-slit-card.cjs.entry.js +36 -0
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/cjs/sequential-bundle-example.cjs.entry.js +1 -1
- package/dist/cjs/sequential-bundle.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/icon-asset/media/designer.svg +33 -3
- package/dist/collection/components/ptc-button/ptc-button.css +18 -0
- package/dist/collection/components/ptc-button/ptc-button.js +20 -1
- package/dist/collection/components/ptc-case-studies-slider/ptc-case-studies-slider.css +831 -0
- package/dist/collection/components/ptc-case-studies-slider/ptc-case-studies-slider.js +91 -0
- package/dist/collection/components/ptc-image-download-strip/ptc-image-download-strip.css +49 -0
- package/dist/collection/components/ptc-image-download-strip/ptc-image-download-strip.js +51 -0
- package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +0 -17
- package/dist/collection/components/ptc-news/ptc-news.css +47 -0
- package/dist/collection/components/ptc-news/ptc-news.js +169 -0
- package/dist/collection/components/ptc-para/ptc-para.css +8 -0
- package/dist/collection/components/ptc-para/ptc-para.js +2 -2
- package/dist/collection/components/ptc-pricing-tabs/ptc-pricing-tabs.css +0 -17
- package/dist/collection/components/ptc-product-card/ptc-product-card.css +22 -1
- package/dist/collection/components/ptc-product-card/ptc-product-card.js +3 -2
- package/dist/collection/components/ptc-product-list/ptc-product-list.js +23 -0
- package/dist/collection/components/ptc-product-sidebar/ptc-product-sidebar.css +6 -1
- package/dist/collection/components/ptc-product-sidebar/ptc-product-sidebar.js +18 -2
- package/dist/collection/components/ptc-readmore/ptc-readmore.js +2 -2
- package/dist/collection/components/ptc-social-share/ptc-social-share.js +32 -4
- package/dist/collection/stories/ReadMore.stories.js +100 -0
- package/dist/collection/stories/Tooltip.stories.js +112 -0
- package/dist/custom-elements/index.d.ts +18 -0
- package/dist/custom-elements/index.js +9666 -7875
- package/dist/{cjs/core-fd18b67a.js → esm/core-2af05469.js} +14 -3
- package/dist/esm/{icon-asset_17.entry.js → icon-asset_16.entry.js} +45 -38
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ptc-case-studies-slider.entry.js +1681 -0
- package/dist/esm/ptc-image-download-strip.entry.js +25 -0
- package/dist/esm/ptc-jumbotron.entry.js +1 -1
- package/dist/esm/ptc-news.entry.js +24 -0
- package/dist/esm/ptc-pricing-tabs.entry.js +1 -1
- package/dist/esm/ptc-progress-bar_2.entry.js +11 -1
- package/dist/esm/ptc-readmore.entry.js +2 -2
- package/dist/esm/ptc-slit-card.entry.js +32 -0
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/esm/sequential-bundle-example.entry.js +1 -1
- package/dist/esm/sequential-bundle.entry.js +1 -1
- package/dist/ptcw-design/media/designer.svg +33 -3
- package/dist/ptcw-design/{p-9e23fa0e.entry.js → p-1cea4b9e.entry.js} +1 -1
- package/dist/ptcw-design/p-4e551e25.entry.js +1 -0
- package/dist/ptcw-design/p-5507ef4b.entry.js +1 -0
- package/dist/ptcw-design/p-575de112.js +1 -0
- package/dist/ptcw-design/{p-b1a63c48.entry.js → p-7753a23d.entry.js} +1 -1
- package/dist/ptcw-design/p-aa942e3b.entry.js +1 -0
- package/dist/ptcw-design/p-b5d7c48e.entry.js +1 -0
- package/dist/ptcw-design/p-c5fadad0.entry.js +1 -0
- package/dist/ptcw-design/{p-9cb33f7d.entry.js → p-d9f4813a.entry.js} +1 -1
- package/dist/ptcw-design/{p-48c53295.entry.js → p-f1f1b19d.entry.js} +1 -1
- package/dist/ptcw-design/p-fe438f03.entry.js +1 -0
- package/dist/ptcw-design/ptcw-design.css +1 -1
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/ptc-button/ptc-button.d.ts +4 -0
- package/dist/types/components/ptc-case-studies-slider/ptc-case-studies-slider.d.ts +14 -0
- package/dist/types/components/ptc-image-download-strip/ptc-image-download-strip.d.ts +9 -0
- package/dist/types/components/ptc-news/ptc-news.d.ts +35 -0
- package/dist/types/components/ptc-para/ptc-para.d.ts +1 -1
- package/dist/types/components/ptc-product-list/ptc-product-list.d.ts +1 -0
- package/dist/types/components/ptc-product-sidebar/ptc-product-sidebar.d.ts +1 -0
- package/dist/types/components/ptc-social-share/ptc-social-share.d.ts +5 -1
- package/dist/types/components.d.ts +135 -8
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/ptcw-design/p-2c23c489.entry.js +0 -1
- package/dist/ptcw-design/p-69dddd51.js +0 -1
- package/dist/ptcw-design/p-c26920ef.entry.js +0 -1
|
@@ -0,0 +1,1685 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-88135a6b.js');
|
|
6
|
+
const core = require('./core-5a811549.js');
|
|
7
|
+
|
|
8
|
+
function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
|
|
9
|
+
if (swiper.params.createElements) {
|
|
10
|
+
Object.keys(checkProps).forEach(key => {
|
|
11
|
+
if (!params[key] && params.auto === true) {
|
|
12
|
+
let element = core.elementChildren(swiper.el, `.${checkProps[key]}`)[0];
|
|
13
|
+
if (!element) {
|
|
14
|
+
element = core.createElement('div', checkProps[key]);
|
|
15
|
+
element.className = checkProps[key];
|
|
16
|
+
swiper.el.append(element);
|
|
17
|
+
}
|
|
18
|
+
params[key] = element;
|
|
19
|
+
originalParams[key] = element;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return params;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function Navigation({
|
|
27
|
+
swiper,
|
|
28
|
+
extendParams,
|
|
29
|
+
on,
|
|
30
|
+
emit
|
|
31
|
+
}) {
|
|
32
|
+
extendParams({
|
|
33
|
+
navigation: {
|
|
34
|
+
nextEl: null,
|
|
35
|
+
prevEl: null,
|
|
36
|
+
hideOnClick: false,
|
|
37
|
+
disabledClass: 'swiper-button-disabled',
|
|
38
|
+
hiddenClass: 'swiper-button-hidden',
|
|
39
|
+
lockClass: 'swiper-button-lock',
|
|
40
|
+
navigationDisabledClass: 'swiper-navigation-disabled'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
swiper.navigation = {
|
|
44
|
+
nextEl: null,
|
|
45
|
+
prevEl: null
|
|
46
|
+
};
|
|
47
|
+
const makeElementsArray = el => {
|
|
48
|
+
if (!Array.isArray(el)) el = [el].filter(e => !!e);
|
|
49
|
+
return el;
|
|
50
|
+
};
|
|
51
|
+
function getEl(el) {
|
|
52
|
+
let res;
|
|
53
|
+
if (el && typeof el === 'string' && swiper.isElement) {
|
|
54
|
+
res = swiper.el.shadowRoot.querySelector(el);
|
|
55
|
+
if (res) return res;
|
|
56
|
+
}
|
|
57
|
+
if (el) {
|
|
58
|
+
if (typeof el === 'string') res = [...document.querySelectorAll(el)];
|
|
59
|
+
if (swiper.params.uniqueNavElements && typeof el === 'string' && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
|
|
60
|
+
res = swiper.el.querySelector(el);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (el && !res) return el;
|
|
64
|
+
// if (Array.isArray(res) && res.length === 1) res = res[0];
|
|
65
|
+
return res;
|
|
66
|
+
}
|
|
67
|
+
function toggleEl(el, disabled) {
|
|
68
|
+
const params = swiper.params.navigation;
|
|
69
|
+
el = makeElementsArray(el);
|
|
70
|
+
el.forEach(subEl => {
|
|
71
|
+
if (subEl) {
|
|
72
|
+
subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));
|
|
73
|
+
if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;
|
|
74
|
+
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
75
|
+
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function update() {
|
|
81
|
+
// Update Navigation Buttons
|
|
82
|
+
const {
|
|
83
|
+
nextEl,
|
|
84
|
+
prevEl
|
|
85
|
+
} = swiper.navigation;
|
|
86
|
+
if (swiper.params.loop) {
|
|
87
|
+
toggleEl(prevEl, false);
|
|
88
|
+
toggleEl(nextEl, false);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);
|
|
92
|
+
toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);
|
|
93
|
+
}
|
|
94
|
+
function onPrevClick(e) {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;
|
|
97
|
+
swiper.slidePrev();
|
|
98
|
+
emit('navigationPrev');
|
|
99
|
+
}
|
|
100
|
+
function onNextClick(e) {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;
|
|
103
|
+
swiper.slideNext();
|
|
104
|
+
emit('navigationNext');
|
|
105
|
+
}
|
|
106
|
+
function init() {
|
|
107
|
+
const params = swiper.params.navigation;
|
|
108
|
+
swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
|
|
109
|
+
nextEl: 'swiper-button-next',
|
|
110
|
+
prevEl: 'swiper-button-prev'
|
|
111
|
+
});
|
|
112
|
+
if (!(params.nextEl || params.prevEl)) return;
|
|
113
|
+
let nextEl = getEl(params.nextEl);
|
|
114
|
+
let prevEl = getEl(params.prevEl);
|
|
115
|
+
Object.assign(swiper.navigation, {
|
|
116
|
+
nextEl,
|
|
117
|
+
prevEl
|
|
118
|
+
});
|
|
119
|
+
nextEl = makeElementsArray(nextEl);
|
|
120
|
+
prevEl = makeElementsArray(prevEl);
|
|
121
|
+
const initButton = (el, dir) => {
|
|
122
|
+
if (el) {
|
|
123
|
+
el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
|
|
124
|
+
}
|
|
125
|
+
if (!swiper.enabled && el) {
|
|
126
|
+
el.classList.add(...params.lockClass.split(' '));
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
nextEl.forEach(el => initButton(el, 'next'));
|
|
130
|
+
prevEl.forEach(el => initButton(el, 'prev'));
|
|
131
|
+
}
|
|
132
|
+
function destroy() {
|
|
133
|
+
let {
|
|
134
|
+
nextEl,
|
|
135
|
+
prevEl
|
|
136
|
+
} = swiper.navigation;
|
|
137
|
+
nextEl = makeElementsArray(nextEl);
|
|
138
|
+
prevEl = makeElementsArray(prevEl);
|
|
139
|
+
const destroyButton = (el, dir) => {
|
|
140
|
+
el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
|
|
141
|
+
el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));
|
|
142
|
+
};
|
|
143
|
+
nextEl.forEach(el => destroyButton(el, 'next'));
|
|
144
|
+
prevEl.forEach(el => destroyButton(el, 'prev'));
|
|
145
|
+
}
|
|
146
|
+
on('init', () => {
|
|
147
|
+
if (swiper.params.navigation.enabled === false) {
|
|
148
|
+
// eslint-disable-next-line
|
|
149
|
+
disable();
|
|
150
|
+
} else {
|
|
151
|
+
init();
|
|
152
|
+
update();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
on('toEdge fromEdge lock unlock', () => {
|
|
156
|
+
update();
|
|
157
|
+
});
|
|
158
|
+
on('destroy', () => {
|
|
159
|
+
destroy();
|
|
160
|
+
});
|
|
161
|
+
on('enable disable', () => {
|
|
162
|
+
let {
|
|
163
|
+
nextEl,
|
|
164
|
+
prevEl
|
|
165
|
+
} = swiper.navigation;
|
|
166
|
+
nextEl = makeElementsArray(nextEl);
|
|
167
|
+
prevEl = makeElementsArray(prevEl);
|
|
168
|
+
[...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.navigation.lockClass));
|
|
169
|
+
});
|
|
170
|
+
on('click', (_s, e) => {
|
|
171
|
+
let {
|
|
172
|
+
nextEl,
|
|
173
|
+
prevEl
|
|
174
|
+
} = swiper.navigation;
|
|
175
|
+
nextEl = makeElementsArray(nextEl);
|
|
176
|
+
prevEl = makeElementsArray(prevEl);
|
|
177
|
+
const targetEl = e.target;
|
|
178
|
+
if (swiper.params.navigation.hideOnClick && !prevEl.includes(targetEl) && !nextEl.includes(targetEl)) {
|
|
179
|
+
if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
|
|
180
|
+
let isHidden;
|
|
181
|
+
if (nextEl.length) {
|
|
182
|
+
isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);
|
|
183
|
+
} else if (prevEl.length) {
|
|
184
|
+
isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);
|
|
185
|
+
}
|
|
186
|
+
if (isHidden === true) {
|
|
187
|
+
emit('navigationShow');
|
|
188
|
+
} else {
|
|
189
|
+
emit('navigationHide');
|
|
190
|
+
}
|
|
191
|
+
[...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
const enable = () => {
|
|
195
|
+
swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));
|
|
196
|
+
init();
|
|
197
|
+
update();
|
|
198
|
+
};
|
|
199
|
+
const disable = () => {
|
|
200
|
+
swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));
|
|
201
|
+
destroy();
|
|
202
|
+
};
|
|
203
|
+
Object.assign(swiper.navigation, {
|
|
204
|
+
enable,
|
|
205
|
+
disable,
|
|
206
|
+
update,
|
|
207
|
+
init,
|
|
208
|
+
destroy
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function classesToSelector(classes = '') {
|
|
213
|
+
return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line
|
|
214
|
+
.replace(/ /g, '.')}`;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function Pagination({
|
|
218
|
+
swiper,
|
|
219
|
+
extendParams,
|
|
220
|
+
on,
|
|
221
|
+
emit
|
|
222
|
+
}) {
|
|
223
|
+
const pfx = 'swiper-pagination';
|
|
224
|
+
extendParams({
|
|
225
|
+
pagination: {
|
|
226
|
+
el: null,
|
|
227
|
+
bulletElement: 'span',
|
|
228
|
+
clickable: false,
|
|
229
|
+
hideOnClick: false,
|
|
230
|
+
renderBullet: null,
|
|
231
|
+
renderProgressbar: null,
|
|
232
|
+
renderFraction: null,
|
|
233
|
+
renderCustom: null,
|
|
234
|
+
progressbarOpposite: false,
|
|
235
|
+
type: 'bullets',
|
|
236
|
+
// 'bullets' or 'progressbar' or 'fraction' or 'custom'
|
|
237
|
+
dynamicBullets: false,
|
|
238
|
+
dynamicMainBullets: 1,
|
|
239
|
+
formatFractionCurrent: number => number,
|
|
240
|
+
formatFractionTotal: number => number,
|
|
241
|
+
bulletClass: `${pfx}-bullet`,
|
|
242
|
+
bulletActiveClass: `${pfx}-bullet-active`,
|
|
243
|
+
modifierClass: `${pfx}-`,
|
|
244
|
+
currentClass: `${pfx}-current`,
|
|
245
|
+
totalClass: `${pfx}-total`,
|
|
246
|
+
hiddenClass: `${pfx}-hidden`,
|
|
247
|
+
progressbarFillClass: `${pfx}-progressbar-fill`,
|
|
248
|
+
progressbarOppositeClass: `${pfx}-progressbar-opposite`,
|
|
249
|
+
clickableClass: `${pfx}-clickable`,
|
|
250
|
+
lockClass: `${pfx}-lock`,
|
|
251
|
+
horizontalClass: `${pfx}-horizontal`,
|
|
252
|
+
verticalClass: `${pfx}-vertical`,
|
|
253
|
+
paginationDisabledClass: `${pfx}-disabled`
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
swiper.pagination = {
|
|
257
|
+
el: null,
|
|
258
|
+
bullets: []
|
|
259
|
+
};
|
|
260
|
+
let bulletSize;
|
|
261
|
+
let dynamicBulletIndex = 0;
|
|
262
|
+
const makeElementsArray = el => {
|
|
263
|
+
if (!Array.isArray(el)) el = [el].filter(e => !!e);
|
|
264
|
+
return el;
|
|
265
|
+
};
|
|
266
|
+
function isPaginationDisabled() {
|
|
267
|
+
return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
|
|
268
|
+
}
|
|
269
|
+
function setSideBullets(bulletEl, position) {
|
|
270
|
+
const {
|
|
271
|
+
bulletActiveClass
|
|
272
|
+
} = swiper.params.pagination;
|
|
273
|
+
if (!bulletEl) return;
|
|
274
|
+
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
275
|
+
if (bulletEl) {
|
|
276
|
+
bulletEl.classList.add(`${bulletActiveClass}-${position}`);
|
|
277
|
+
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
278
|
+
if (bulletEl) {
|
|
279
|
+
bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function onBulletClick(e) {
|
|
284
|
+
const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
|
|
285
|
+
if (!bulletEl) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
const index = core.elementIndex(bulletEl) * swiper.params.slidesPerGroup;
|
|
290
|
+
if (swiper.params.loop) {
|
|
291
|
+
if (swiper.realIndex === index) return;
|
|
292
|
+
if (index < swiper.loopedSlides || index > swiper.slides.length - swiper.loopedSlides) {
|
|
293
|
+
swiper.loopFix({
|
|
294
|
+
direction: index < swiper.loopedSlides ? 'prev' : 'next',
|
|
295
|
+
activeSlideIndex: index,
|
|
296
|
+
slideTo: false
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
swiper.slideToLoop(index);
|
|
300
|
+
} else {
|
|
301
|
+
swiper.slideTo(index);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function update() {
|
|
305
|
+
// Render || Update Pagination bullets/items
|
|
306
|
+
const rtl = swiper.rtl;
|
|
307
|
+
const params = swiper.params.pagination;
|
|
308
|
+
if (isPaginationDisabled()) return;
|
|
309
|
+
let el = swiper.pagination.el;
|
|
310
|
+
el = makeElementsArray(el);
|
|
311
|
+
// Current/Total
|
|
312
|
+
let current;
|
|
313
|
+
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
314
|
+
const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
315
|
+
if (swiper.params.loop) {
|
|
316
|
+
current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;
|
|
317
|
+
} else if (typeof swiper.snapIndex !== 'undefined') {
|
|
318
|
+
current = swiper.snapIndex;
|
|
319
|
+
} else {
|
|
320
|
+
current = swiper.activeIndex || 0;
|
|
321
|
+
}
|
|
322
|
+
// Types
|
|
323
|
+
if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
|
|
324
|
+
const bullets = swiper.pagination.bullets;
|
|
325
|
+
let firstIndex;
|
|
326
|
+
let lastIndex;
|
|
327
|
+
let midIndex;
|
|
328
|
+
if (params.dynamicBullets) {
|
|
329
|
+
bulletSize = core.elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true);
|
|
330
|
+
el.forEach(subEl => {
|
|
331
|
+
subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;
|
|
332
|
+
});
|
|
333
|
+
if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) {
|
|
334
|
+
dynamicBulletIndex += current - (swiper.previousIndex || 0);
|
|
335
|
+
if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
|
|
336
|
+
dynamicBulletIndex = params.dynamicMainBullets - 1;
|
|
337
|
+
} else if (dynamicBulletIndex < 0) {
|
|
338
|
+
dynamicBulletIndex = 0;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
firstIndex = Math.max(current - dynamicBulletIndex, 0);
|
|
342
|
+
lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
|
|
343
|
+
midIndex = (lastIndex + firstIndex) / 2;
|
|
344
|
+
}
|
|
345
|
+
bullets.forEach(bulletEl => {
|
|
346
|
+
const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat();
|
|
347
|
+
bulletEl.classList.remove(...classesToRemove);
|
|
348
|
+
});
|
|
349
|
+
if (el.length > 1) {
|
|
350
|
+
bullets.forEach(bullet => {
|
|
351
|
+
const bulletIndex = core.elementIndex(bullet);
|
|
352
|
+
if (bulletIndex === current) {
|
|
353
|
+
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
354
|
+
}
|
|
355
|
+
if (params.dynamicBullets) {
|
|
356
|
+
if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
|
|
357
|
+
bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
358
|
+
}
|
|
359
|
+
if (bulletIndex === firstIndex) {
|
|
360
|
+
setSideBullets(bullet, 'prev');
|
|
361
|
+
}
|
|
362
|
+
if (bulletIndex === lastIndex) {
|
|
363
|
+
setSideBullets(bullet, 'next');
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
} else {
|
|
368
|
+
const bullet = bullets[current];
|
|
369
|
+
if (bullet) {
|
|
370
|
+
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
371
|
+
}
|
|
372
|
+
if (params.dynamicBullets) {
|
|
373
|
+
const firstDisplayedBullet = bullets[firstIndex];
|
|
374
|
+
const lastDisplayedBullet = bullets[lastIndex];
|
|
375
|
+
for (let i = firstIndex; i <= lastIndex; i += 1) {
|
|
376
|
+
if (bullets[i]) {
|
|
377
|
+
bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
setSideBullets(firstDisplayedBullet, 'prev');
|
|
381
|
+
setSideBullets(lastDisplayedBullet, 'next');
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (params.dynamicBullets) {
|
|
385
|
+
const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
|
|
386
|
+
const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
|
|
387
|
+
const offsetProp = rtl ? 'right' : 'left';
|
|
388
|
+
bullets.forEach(bullet => {
|
|
389
|
+
bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
el.forEach((subEl, subElIndex) => {
|
|
394
|
+
if (params.type === 'fraction') {
|
|
395
|
+
subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {
|
|
396
|
+
fractionEl.textContent = params.formatFractionCurrent(current + 1);
|
|
397
|
+
});
|
|
398
|
+
subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {
|
|
399
|
+
totalEl.textContent = params.formatFractionTotal(total);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
if (params.type === 'progressbar') {
|
|
403
|
+
let progressbarDirection;
|
|
404
|
+
if (params.progressbarOpposite) {
|
|
405
|
+
progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
|
|
406
|
+
} else {
|
|
407
|
+
progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
|
|
408
|
+
}
|
|
409
|
+
const scale = (current + 1) / total;
|
|
410
|
+
let scaleX = 1;
|
|
411
|
+
let scaleY = 1;
|
|
412
|
+
if (progressbarDirection === 'horizontal') {
|
|
413
|
+
scaleX = scale;
|
|
414
|
+
} else {
|
|
415
|
+
scaleY = scale;
|
|
416
|
+
}
|
|
417
|
+
subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {
|
|
418
|
+
progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;
|
|
419
|
+
progressEl.style.transitionDuration = `${swiper.params.speed}ms`;
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
if (params.type === 'custom' && params.renderCustom) {
|
|
423
|
+
subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
|
|
424
|
+
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
425
|
+
} else {
|
|
426
|
+
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
427
|
+
emit('paginationUpdate', subEl);
|
|
428
|
+
}
|
|
429
|
+
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
430
|
+
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
function render() {
|
|
435
|
+
// Render Container
|
|
436
|
+
const params = swiper.params.pagination;
|
|
437
|
+
if (isPaginationDisabled()) return;
|
|
438
|
+
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
439
|
+
let el = swiper.pagination.el;
|
|
440
|
+
el = makeElementsArray(el);
|
|
441
|
+
let paginationHTML = '';
|
|
442
|
+
if (params.type === 'bullets') {
|
|
443
|
+
let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
444
|
+
if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {
|
|
445
|
+
numberOfBullets = slidesLength;
|
|
446
|
+
}
|
|
447
|
+
for (let i = 0; i < numberOfBullets; i += 1) {
|
|
448
|
+
if (params.renderBullet) {
|
|
449
|
+
paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
|
|
450
|
+
} else {
|
|
451
|
+
paginationHTML += `<${params.bulletElement} class="${params.bulletClass}"></${params.bulletElement}>`;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (params.type === 'fraction') {
|
|
456
|
+
if (params.renderFraction) {
|
|
457
|
+
paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
|
|
458
|
+
} else {
|
|
459
|
+
paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (params.type === 'progressbar') {
|
|
463
|
+
if (params.renderProgressbar) {
|
|
464
|
+
paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
|
|
465
|
+
} else {
|
|
466
|
+
paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
swiper.pagination.bullets = [];
|
|
470
|
+
el.forEach(subEl => {
|
|
471
|
+
if (params.type !== 'custom') {
|
|
472
|
+
subEl.innerHTML = paginationHTML || '';
|
|
473
|
+
}
|
|
474
|
+
if (params.type === 'bullets') {
|
|
475
|
+
swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
if (params.type !== 'custom') {
|
|
479
|
+
emit('paginationRender', el[0]);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
function init() {
|
|
483
|
+
swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
|
|
484
|
+
el: 'swiper-pagination'
|
|
485
|
+
});
|
|
486
|
+
const params = swiper.params.pagination;
|
|
487
|
+
if (!params.el) return;
|
|
488
|
+
let el;
|
|
489
|
+
if (typeof params.el === 'string' && swiper.isElement) {
|
|
490
|
+
el = swiper.el.shadowRoot.querySelector(params.el);
|
|
491
|
+
}
|
|
492
|
+
if (!el && typeof params.el === 'string') {
|
|
493
|
+
el = [...document.querySelectorAll(params.el)];
|
|
494
|
+
}
|
|
495
|
+
if (!el) {
|
|
496
|
+
el = params.el;
|
|
497
|
+
}
|
|
498
|
+
if (!el || el.length === 0) return;
|
|
499
|
+
if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {
|
|
500
|
+
el = [...swiper.el.querySelectorAll(params.el)];
|
|
501
|
+
// check if it belongs to another nested Swiper
|
|
502
|
+
if (el.length > 1) {
|
|
503
|
+
el = el.filter(subEl => {
|
|
504
|
+
if (core.elementParents(subEl, '.swiper')[0] !== swiper.el) return false;
|
|
505
|
+
return true;
|
|
506
|
+
})[0];
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (Array.isArray(el) && el.length === 1) el = el[0];
|
|
510
|
+
Object.assign(swiper.pagination, {
|
|
511
|
+
el
|
|
512
|
+
});
|
|
513
|
+
el = makeElementsArray(el);
|
|
514
|
+
el.forEach(subEl => {
|
|
515
|
+
if (params.type === 'bullets' && params.clickable) {
|
|
516
|
+
subEl.classList.add(params.clickableClass);
|
|
517
|
+
}
|
|
518
|
+
subEl.classList.add(params.modifierClass + params.type);
|
|
519
|
+
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
520
|
+
if (params.type === 'bullets' && params.dynamicBullets) {
|
|
521
|
+
subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);
|
|
522
|
+
dynamicBulletIndex = 0;
|
|
523
|
+
if (params.dynamicMainBullets < 1) {
|
|
524
|
+
params.dynamicMainBullets = 1;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (params.type === 'progressbar' && params.progressbarOpposite) {
|
|
528
|
+
subEl.classList.add(params.progressbarOppositeClass);
|
|
529
|
+
}
|
|
530
|
+
if (params.clickable) {
|
|
531
|
+
subEl.addEventListener('click', onBulletClick);
|
|
532
|
+
}
|
|
533
|
+
if (!swiper.enabled) {
|
|
534
|
+
subEl.classList.add(params.lockClass);
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function destroy() {
|
|
539
|
+
const params = swiper.params.pagination;
|
|
540
|
+
if (isPaginationDisabled()) return;
|
|
541
|
+
let el = swiper.pagination.el;
|
|
542
|
+
if (el) {
|
|
543
|
+
el = makeElementsArray(el);
|
|
544
|
+
el.forEach(subEl => {
|
|
545
|
+
subEl.classList.remove(params.hiddenClass);
|
|
546
|
+
subEl.classList.remove(params.modifierClass + params.type);
|
|
547
|
+
subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
548
|
+
if (params.clickable) {
|
|
549
|
+
subEl.removeEventListener('click', onBulletClick);
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));
|
|
554
|
+
}
|
|
555
|
+
on('init', () => {
|
|
556
|
+
if (swiper.params.pagination.enabled === false) {
|
|
557
|
+
// eslint-disable-next-line
|
|
558
|
+
disable();
|
|
559
|
+
} else {
|
|
560
|
+
init();
|
|
561
|
+
render();
|
|
562
|
+
update();
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
on('activeIndexChange', () => {
|
|
566
|
+
if (typeof swiper.snapIndex === 'undefined') {
|
|
567
|
+
update();
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
on('snapIndexChange', () => {
|
|
571
|
+
update();
|
|
572
|
+
});
|
|
573
|
+
on('snapGridLengthChange', () => {
|
|
574
|
+
render();
|
|
575
|
+
update();
|
|
576
|
+
});
|
|
577
|
+
on('destroy', () => {
|
|
578
|
+
destroy();
|
|
579
|
+
});
|
|
580
|
+
on('enable disable', () => {
|
|
581
|
+
let {
|
|
582
|
+
el
|
|
583
|
+
} = swiper.pagination;
|
|
584
|
+
if (el) {
|
|
585
|
+
el = makeElementsArray(el);
|
|
586
|
+
el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
on('lock unlock', () => {
|
|
590
|
+
update();
|
|
591
|
+
});
|
|
592
|
+
on('click', (_s, e) => {
|
|
593
|
+
const targetEl = e.target;
|
|
594
|
+
let {
|
|
595
|
+
el
|
|
596
|
+
} = swiper.pagination;
|
|
597
|
+
if (!Array.isArray(el)) el = [el].filter(element => !!element);
|
|
598
|
+
if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {
|
|
599
|
+
if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
|
|
600
|
+
const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);
|
|
601
|
+
if (isHidden === true) {
|
|
602
|
+
emit('paginationShow');
|
|
603
|
+
} else {
|
|
604
|
+
emit('paginationHide');
|
|
605
|
+
}
|
|
606
|
+
el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
const enable = () => {
|
|
610
|
+
swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);
|
|
611
|
+
let {
|
|
612
|
+
el
|
|
613
|
+
} = swiper.pagination;
|
|
614
|
+
if (el) {
|
|
615
|
+
el = makeElementsArray(el);
|
|
616
|
+
el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));
|
|
617
|
+
}
|
|
618
|
+
init();
|
|
619
|
+
render();
|
|
620
|
+
update();
|
|
621
|
+
};
|
|
622
|
+
const disable = () => {
|
|
623
|
+
swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);
|
|
624
|
+
let {
|
|
625
|
+
el
|
|
626
|
+
} = swiper.pagination;
|
|
627
|
+
if (el) {
|
|
628
|
+
el = makeElementsArray(el);
|
|
629
|
+
el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));
|
|
630
|
+
}
|
|
631
|
+
destroy();
|
|
632
|
+
};
|
|
633
|
+
Object.assign(swiper.pagination, {
|
|
634
|
+
enable,
|
|
635
|
+
disable,
|
|
636
|
+
render,
|
|
637
|
+
update,
|
|
638
|
+
init,
|
|
639
|
+
destroy
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/* eslint no-underscore-dangle: "off" */
|
|
644
|
+
function Autoplay({
|
|
645
|
+
swiper,
|
|
646
|
+
extendParams,
|
|
647
|
+
on,
|
|
648
|
+
emit,
|
|
649
|
+
params
|
|
650
|
+
}) {
|
|
651
|
+
swiper.autoplay = {
|
|
652
|
+
running: false,
|
|
653
|
+
paused: false,
|
|
654
|
+
timeLeft: 0
|
|
655
|
+
};
|
|
656
|
+
extendParams({
|
|
657
|
+
autoplay: {
|
|
658
|
+
enabled: false,
|
|
659
|
+
delay: 3000,
|
|
660
|
+
waitForTransition: true,
|
|
661
|
+
disableOnInteraction: true,
|
|
662
|
+
stopOnLastSlide: false,
|
|
663
|
+
reverseDirection: false,
|
|
664
|
+
pauseOnMouseEnter: false
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
let timeout;
|
|
668
|
+
let raf;
|
|
669
|
+
let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000;
|
|
670
|
+
let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000;
|
|
671
|
+
let autoplayTimeLeft;
|
|
672
|
+
let autoplayStartTime = new Date().getTime;
|
|
673
|
+
let wasPaused;
|
|
674
|
+
let isTouched;
|
|
675
|
+
let pausedByTouch;
|
|
676
|
+
let touchStartTimeout;
|
|
677
|
+
let slideChanged;
|
|
678
|
+
let pausedByInteraction;
|
|
679
|
+
function onTransitionEnd(e) {
|
|
680
|
+
if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
|
|
681
|
+
if (e.target !== swiper.wrapperEl) return;
|
|
682
|
+
swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd);
|
|
683
|
+
resume();
|
|
684
|
+
}
|
|
685
|
+
const calcTimeLeft = () => {
|
|
686
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
687
|
+
if (swiper.autoplay.paused) {
|
|
688
|
+
wasPaused = true;
|
|
689
|
+
} else if (wasPaused) {
|
|
690
|
+
autoplayDelayCurrent = autoplayTimeLeft;
|
|
691
|
+
wasPaused = false;
|
|
692
|
+
}
|
|
693
|
+
const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime();
|
|
694
|
+
swiper.autoplay.timeLeft = timeLeft;
|
|
695
|
+
emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal);
|
|
696
|
+
raf = requestAnimationFrame(() => {
|
|
697
|
+
calcTimeLeft();
|
|
698
|
+
});
|
|
699
|
+
};
|
|
700
|
+
const getSlideDelay = () => {
|
|
701
|
+
let activeSlideEl;
|
|
702
|
+
if (swiper.virtual && swiper.params.virtual.enabled) {
|
|
703
|
+
activeSlideEl = swiper.slides.filter(slideEl => slideEl.classList.contains('swiper-slide-active'))[0];
|
|
704
|
+
} else {
|
|
705
|
+
activeSlideEl = swiper.slides[swiper.activeIndex];
|
|
706
|
+
}
|
|
707
|
+
if (!activeSlideEl) return undefined;
|
|
708
|
+
const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10);
|
|
709
|
+
return currentSlideDelay;
|
|
710
|
+
};
|
|
711
|
+
const run = delayForce => {
|
|
712
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
713
|
+
cancelAnimationFrame(raf);
|
|
714
|
+
calcTimeLeft();
|
|
715
|
+
let delay = typeof delayForce === 'undefined' ? swiper.params.autoplay.delay : delayForce;
|
|
716
|
+
autoplayDelayTotal = swiper.params.autoplay.delay;
|
|
717
|
+
autoplayDelayCurrent = swiper.params.autoplay.delay;
|
|
718
|
+
const currentSlideDelay = getSlideDelay();
|
|
719
|
+
if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === 'undefined') {
|
|
720
|
+
delay = currentSlideDelay;
|
|
721
|
+
autoplayDelayTotal = currentSlideDelay;
|
|
722
|
+
autoplayDelayCurrent = currentSlideDelay;
|
|
723
|
+
}
|
|
724
|
+
autoplayTimeLeft = delay;
|
|
725
|
+
const speed = swiper.params.speed;
|
|
726
|
+
const proceed = () => {
|
|
727
|
+
if (!swiper || swiper.destroyed) return;
|
|
728
|
+
if (swiper.params.autoplay.reverseDirection) {
|
|
729
|
+
if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) {
|
|
730
|
+
swiper.slidePrev(speed, true, true);
|
|
731
|
+
emit('autoplay');
|
|
732
|
+
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
|
733
|
+
swiper.slideTo(swiper.slides.length - 1, speed, true, true);
|
|
734
|
+
emit('autoplay');
|
|
735
|
+
}
|
|
736
|
+
} else {
|
|
737
|
+
if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) {
|
|
738
|
+
swiper.slideNext(speed, true, true);
|
|
739
|
+
emit('autoplay');
|
|
740
|
+
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
|
741
|
+
swiper.slideTo(0, speed, true, true);
|
|
742
|
+
emit('autoplay');
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
if (swiper.params.cssMode) {
|
|
746
|
+
autoplayStartTime = new Date().getTime();
|
|
747
|
+
requestAnimationFrame(() => {
|
|
748
|
+
run();
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
if (delay > 0) {
|
|
753
|
+
clearTimeout(timeout);
|
|
754
|
+
timeout = setTimeout(() => {
|
|
755
|
+
proceed();
|
|
756
|
+
}, delay);
|
|
757
|
+
} else {
|
|
758
|
+
requestAnimationFrame(() => {
|
|
759
|
+
proceed();
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// eslint-disable-next-line
|
|
764
|
+
return delay;
|
|
765
|
+
};
|
|
766
|
+
const start = () => {
|
|
767
|
+
swiper.autoplay.running = true;
|
|
768
|
+
run();
|
|
769
|
+
emit('autoplayStart');
|
|
770
|
+
};
|
|
771
|
+
const stop = () => {
|
|
772
|
+
swiper.autoplay.running = false;
|
|
773
|
+
clearTimeout(timeout);
|
|
774
|
+
cancelAnimationFrame(raf);
|
|
775
|
+
emit('autoplayStop');
|
|
776
|
+
};
|
|
777
|
+
const pause = (internal, reset) => {
|
|
778
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
779
|
+
clearTimeout(timeout);
|
|
780
|
+
if (!internal) {
|
|
781
|
+
pausedByInteraction = true;
|
|
782
|
+
}
|
|
783
|
+
const proceed = () => {
|
|
784
|
+
emit('autoplayPause');
|
|
785
|
+
if (swiper.params.autoplay.waitForTransition) {
|
|
786
|
+
swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd);
|
|
787
|
+
} else {
|
|
788
|
+
resume();
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
swiper.autoplay.paused = true;
|
|
792
|
+
if (reset) {
|
|
793
|
+
if (slideChanged) {
|
|
794
|
+
autoplayTimeLeft = swiper.params.autoplay.delay;
|
|
795
|
+
}
|
|
796
|
+
slideChanged = false;
|
|
797
|
+
proceed();
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
const delay = autoplayTimeLeft || swiper.params.autoplay.delay;
|
|
801
|
+
autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime);
|
|
802
|
+
if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return;
|
|
803
|
+
if (autoplayTimeLeft < 0) autoplayTimeLeft = 0;
|
|
804
|
+
proceed();
|
|
805
|
+
};
|
|
806
|
+
const resume = () => {
|
|
807
|
+
if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return;
|
|
808
|
+
autoplayStartTime = new Date().getTime();
|
|
809
|
+
if (pausedByInteraction) {
|
|
810
|
+
pausedByInteraction = false;
|
|
811
|
+
run(autoplayTimeLeft);
|
|
812
|
+
} else {
|
|
813
|
+
run();
|
|
814
|
+
}
|
|
815
|
+
swiper.autoplay.paused = false;
|
|
816
|
+
emit('autoplayResume');
|
|
817
|
+
};
|
|
818
|
+
const onVisibilityChange = () => {
|
|
819
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
820
|
+
const document = core.getDocument();
|
|
821
|
+
if (document.visibilityState === 'hidden') {
|
|
822
|
+
pausedByInteraction = true;
|
|
823
|
+
pause(true);
|
|
824
|
+
}
|
|
825
|
+
if (document.visibilityState === 'visible') {
|
|
826
|
+
resume();
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
const onPointerEnter = e => {
|
|
830
|
+
if (e.pointerType !== 'mouse') return;
|
|
831
|
+
pausedByInteraction = true;
|
|
832
|
+
pause(true);
|
|
833
|
+
};
|
|
834
|
+
const onPointerLeave = e => {
|
|
835
|
+
if (e.pointerType !== 'mouse') return;
|
|
836
|
+
if (swiper.autoplay.paused) {
|
|
837
|
+
resume();
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
const attachMouseEvents = () => {
|
|
841
|
+
if (swiper.params.autoplay.pauseOnMouseEnter) {
|
|
842
|
+
swiper.el.addEventListener('pointerenter', onPointerEnter);
|
|
843
|
+
swiper.el.addEventListener('pointerleave', onPointerLeave);
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
const detachMouseEvents = () => {
|
|
847
|
+
swiper.el.removeEventListener('pointerenter', onPointerEnter);
|
|
848
|
+
swiper.el.removeEventListener('pointerleave', onPointerLeave);
|
|
849
|
+
};
|
|
850
|
+
const attachDocumentEvents = () => {
|
|
851
|
+
const document = core.getDocument();
|
|
852
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
853
|
+
};
|
|
854
|
+
const detachDocumentEvents = () => {
|
|
855
|
+
const document = core.getDocument();
|
|
856
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
857
|
+
};
|
|
858
|
+
on('init', () => {
|
|
859
|
+
if (swiper.params.autoplay.enabled) {
|
|
860
|
+
attachMouseEvents();
|
|
861
|
+
attachDocumentEvents();
|
|
862
|
+
autoplayStartTime = new Date().getTime();
|
|
863
|
+
start();
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
on('destroy', () => {
|
|
867
|
+
detachMouseEvents();
|
|
868
|
+
detachDocumentEvents();
|
|
869
|
+
if (swiper.autoplay.running) {
|
|
870
|
+
stop();
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
on('beforeTransitionStart', (_s, speed, internal) => {
|
|
874
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
875
|
+
if (internal || !swiper.params.autoplay.disableOnInteraction) {
|
|
876
|
+
pause(true, true);
|
|
877
|
+
} else {
|
|
878
|
+
stop();
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
on('sliderFirstMove', () => {
|
|
882
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
883
|
+
if (swiper.params.autoplay.disableOnInteraction) {
|
|
884
|
+
stop();
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
isTouched = true;
|
|
888
|
+
pausedByTouch = false;
|
|
889
|
+
pausedByInteraction = false;
|
|
890
|
+
touchStartTimeout = setTimeout(() => {
|
|
891
|
+
pausedByInteraction = true;
|
|
892
|
+
pausedByTouch = true;
|
|
893
|
+
pause(true);
|
|
894
|
+
}, 200);
|
|
895
|
+
});
|
|
896
|
+
on('touchEnd', () => {
|
|
897
|
+
if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return;
|
|
898
|
+
clearTimeout(touchStartTimeout);
|
|
899
|
+
clearTimeout(timeout);
|
|
900
|
+
if (swiper.params.autoplay.disableOnInteraction) {
|
|
901
|
+
pausedByTouch = false;
|
|
902
|
+
isTouched = false;
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
if (pausedByTouch && swiper.params.cssMode) resume();
|
|
906
|
+
pausedByTouch = false;
|
|
907
|
+
isTouched = false;
|
|
908
|
+
});
|
|
909
|
+
on('slideChange', () => {
|
|
910
|
+
if (swiper.destroyed || !swiper.autoplay.running) return;
|
|
911
|
+
slideChanged = true;
|
|
912
|
+
});
|
|
913
|
+
Object.assign(swiper.autoplay, {
|
|
914
|
+
start,
|
|
915
|
+
stop,
|
|
916
|
+
pause,
|
|
917
|
+
resume
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
function Thumb({
|
|
922
|
+
swiper,
|
|
923
|
+
extendParams,
|
|
924
|
+
on
|
|
925
|
+
}) {
|
|
926
|
+
extendParams({
|
|
927
|
+
thumbs: {
|
|
928
|
+
swiper: null,
|
|
929
|
+
multipleActiveThumbs: true,
|
|
930
|
+
autoScrollOffset: 0,
|
|
931
|
+
slideThumbActiveClass: 'swiper-slide-thumb-active',
|
|
932
|
+
thumbsContainerClass: 'swiper-thumbs'
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
let initialized = false;
|
|
936
|
+
let swiperCreated = false;
|
|
937
|
+
swiper.thumbs = {
|
|
938
|
+
swiper: null
|
|
939
|
+
};
|
|
940
|
+
function onThumbClick() {
|
|
941
|
+
const thumbsSwiper = swiper.thumbs.swiper;
|
|
942
|
+
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
|
|
943
|
+
const clickedIndex = thumbsSwiper.clickedIndex;
|
|
944
|
+
const clickedSlide = thumbsSwiper.clickedSlide;
|
|
945
|
+
if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return;
|
|
946
|
+
if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;
|
|
947
|
+
let slideToIndex;
|
|
948
|
+
if (thumbsSwiper.params.loop) {
|
|
949
|
+
slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
|
|
950
|
+
} else {
|
|
951
|
+
slideToIndex = clickedIndex;
|
|
952
|
+
}
|
|
953
|
+
if (swiper.params.loop) {
|
|
954
|
+
swiper.slideToLoop(slideToIndex);
|
|
955
|
+
} else {
|
|
956
|
+
swiper.slideTo(slideToIndex);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
function init() {
|
|
960
|
+
const {
|
|
961
|
+
thumbs: thumbsParams
|
|
962
|
+
} = swiper.params;
|
|
963
|
+
if (initialized) return false;
|
|
964
|
+
initialized = true;
|
|
965
|
+
const SwiperClass = swiper.constructor;
|
|
966
|
+
if (thumbsParams.swiper instanceof SwiperClass) {
|
|
967
|
+
swiper.thumbs.swiper = thumbsParams.swiper;
|
|
968
|
+
Object.assign(swiper.thumbs.swiper.originalParams, {
|
|
969
|
+
watchSlidesProgress: true,
|
|
970
|
+
slideToClickedSlide: false
|
|
971
|
+
});
|
|
972
|
+
Object.assign(swiper.thumbs.swiper.params, {
|
|
973
|
+
watchSlidesProgress: true,
|
|
974
|
+
slideToClickedSlide: false
|
|
975
|
+
});
|
|
976
|
+
swiper.thumbs.swiper.update();
|
|
977
|
+
} else if (core.isObject(thumbsParams.swiper)) {
|
|
978
|
+
const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper);
|
|
979
|
+
Object.assign(thumbsSwiperParams, {
|
|
980
|
+
watchSlidesProgress: true,
|
|
981
|
+
slideToClickedSlide: false
|
|
982
|
+
});
|
|
983
|
+
swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams);
|
|
984
|
+
swiperCreated = true;
|
|
985
|
+
}
|
|
986
|
+
swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass);
|
|
987
|
+
swiper.thumbs.swiper.on('tap', onThumbClick);
|
|
988
|
+
return true;
|
|
989
|
+
}
|
|
990
|
+
function update(initial) {
|
|
991
|
+
const thumbsSwiper = swiper.thumbs.swiper;
|
|
992
|
+
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
|
|
993
|
+
const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView;
|
|
994
|
+
|
|
995
|
+
// Activate thumbs
|
|
996
|
+
let thumbsToActivate = 1;
|
|
997
|
+
const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
|
|
998
|
+
if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
|
|
999
|
+
thumbsToActivate = swiper.params.slidesPerView;
|
|
1000
|
+
}
|
|
1001
|
+
if (!swiper.params.thumbs.multipleActiveThumbs) {
|
|
1002
|
+
thumbsToActivate = 1;
|
|
1003
|
+
}
|
|
1004
|
+
thumbsToActivate = Math.floor(thumbsToActivate);
|
|
1005
|
+
thumbsSwiper.slides.forEach(slideEl => slideEl.classList.remove(thumbActiveClass));
|
|
1006
|
+
if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {
|
|
1007
|
+
for (let i = 0; i < thumbsToActivate; i += 1) {
|
|
1008
|
+
core.elementChildren(thumbsSwiper.slidesEl, `[data-swiper-slide-index="${swiper.realIndex + i}"]`).forEach(slideEl => {
|
|
1009
|
+
slideEl.classList.add(thumbActiveClass);
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
} else {
|
|
1013
|
+
for (let i = 0; i < thumbsToActivate; i += 1) {
|
|
1014
|
+
if (thumbsSwiper.slides[swiper.realIndex + i]) {
|
|
1015
|
+
thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
const autoScrollOffset = swiper.params.thumbs.autoScrollOffset;
|
|
1020
|
+
const useOffset = autoScrollOffset && !thumbsSwiper.params.loop;
|
|
1021
|
+
if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {
|
|
1022
|
+
const currentThumbsIndex = thumbsSwiper.activeIndex;
|
|
1023
|
+
let newThumbsIndex;
|
|
1024
|
+
let direction;
|
|
1025
|
+
if (thumbsSwiper.params.loop) {
|
|
1026
|
+
const newThumbsSlide = thumbsSwiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') === `${swiper.realIndex}`)[0];
|
|
1027
|
+
newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide);
|
|
1028
|
+
direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';
|
|
1029
|
+
} else {
|
|
1030
|
+
newThumbsIndex = swiper.realIndex;
|
|
1031
|
+
direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';
|
|
1032
|
+
}
|
|
1033
|
+
if (useOffset) {
|
|
1034
|
+
newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;
|
|
1035
|
+
}
|
|
1036
|
+
if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
|
|
1037
|
+
if (thumbsSwiper.params.centeredSlides) {
|
|
1038
|
+
if (newThumbsIndex > currentThumbsIndex) {
|
|
1039
|
+
newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
|
|
1040
|
+
} else {
|
|
1041
|
+
newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
on('beforeInit', () => {
|
|
1049
|
+
const {
|
|
1050
|
+
thumbs
|
|
1051
|
+
} = swiper.params;
|
|
1052
|
+
if (!thumbs || !thumbs.swiper) return;
|
|
1053
|
+
if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) {
|
|
1054
|
+
const document = core.getDocument();
|
|
1055
|
+
const getThumbsElementAndInit = () => {
|
|
1056
|
+
const thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper;
|
|
1057
|
+
if (thumbsElement && thumbsElement.swiper) {
|
|
1058
|
+
thumbs.swiper = thumbsElement.swiper;
|
|
1059
|
+
init();
|
|
1060
|
+
update(true);
|
|
1061
|
+
} else if (thumbsElement) {
|
|
1062
|
+
const onThumbsSwiper = e => {
|
|
1063
|
+
thumbs.swiper = e.detail[0];
|
|
1064
|
+
thumbsElement.removeEventListener('init', onThumbsSwiper);
|
|
1065
|
+
init();
|
|
1066
|
+
update(true);
|
|
1067
|
+
thumbs.swiper.update();
|
|
1068
|
+
swiper.update();
|
|
1069
|
+
};
|
|
1070
|
+
thumbsElement.addEventListener('init', onThumbsSwiper);
|
|
1071
|
+
}
|
|
1072
|
+
return thumbsElement;
|
|
1073
|
+
};
|
|
1074
|
+
const watchForThumbsToAppear = () => {
|
|
1075
|
+
if (swiper.destroyed) return;
|
|
1076
|
+
const thumbsElement = getThumbsElementAndInit();
|
|
1077
|
+
if (!thumbsElement) {
|
|
1078
|
+
requestAnimationFrame(watchForThumbsToAppear);
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
requestAnimationFrame(watchForThumbsToAppear);
|
|
1082
|
+
} else {
|
|
1083
|
+
init();
|
|
1084
|
+
update(true);
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
on('slideChange update resize observerUpdate', () => {
|
|
1088
|
+
update();
|
|
1089
|
+
});
|
|
1090
|
+
on('setTransition', (_s, duration) => {
|
|
1091
|
+
const thumbsSwiper = swiper.thumbs.swiper;
|
|
1092
|
+
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
|
|
1093
|
+
thumbsSwiper.setTransition(duration);
|
|
1094
|
+
});
|
|
1095
|
+
on('beforeDestroy', () => {
|
|
1096
|
+
const thumbsSwiper = swiper.thumbs.swiper;
|
|
1097
|
+
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
|
|
1098
|
+
if (swiperCreated) {
|
|
1099
|
+
thumbsSwiper.destroy();
|
|
1100
|
+
}
|
|
1101
|
+
});
|
|
1102
|
+
Object.assign(swiper.thumbs, {
|
|
1103
|
+
init,
|
|
1104
|
+
update
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
function freeMode({
|
|
1109
|
+
swiper,
|
|
1110
|
+
extendParams,
|
|
1111
|
+
emit,
|
|
1112
|
+
once
|
|
1113
|
+
}) {
|
|
1114
|
+
extendParams({
|
|
1115
|
+
freeMode: {
|
|
1116
|
+
enabled: false,
|
|
1117
|
+
momentum: true,
|
|
1118
|
+
momentumRatio: 1,
|
|
1119
|
+
momentumBounce: true,
|
|
1120
|
+
momentumBounceRatio: 1,
|
|
1121
|
+
momentumVelocityRatio: 1,
|
|
1122
|
+
sticky: false,
|
|
1123
|
+
minimumVelocity: 0.02
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
function onTouchStart() {
|
|
1127
|
+
const translate = swiper.getTranslate();
|
|
1128
|
+
swiper.setTranslate(translate);
|
|
1129
|
+
swiper.setTransition(0);
|
|
1130
|
+
swiper.touchEventsData.velocities.length = 0;
|
|
1131
|
+
swiper.freeMode.onTouchEnd({
|
|
1132
|
+
currentPos: swiper.rtl ? swiper.translate : -swiper.translate
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
function onTouchMove() {
|
|
1136
|
+
const {
|
|
1137
|
+
touchEventsData: data,
|
|
1138
|
+
touches
|
|
1139
|
+
} = swiper;
|
|
1140
|
+
// Velocity
|
|
1141
|
+
if (data.velocities.length === 0) {
|
|
1142
|
+
data.velocities.push({
|
|
1143
|
+
position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
|
|
1144
|
+
time: data.touchStartTime
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
data.velocities.push({
|
|
1148
|
+
position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
|
|
1149
|
+
time: core.now()
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
function onTouchEnd({
|
|
1153
|
+
currentPos
|
|
1154
|
+
}) {
|
|
1155
|
+
const {
|
|
1156
|
+
params,
|
|
1157
|
+
wrapperEl,
|
|
1158
|
+
rtlTranslate: rtl,
|
|
1159
|
+
snapGrid,
|
|
1160
|
+
touchEventsData: data
|
|
1161
|
+
} = swiper;
|
|
1162
|
+
// Time diff
|
|
1163
|
+
const touchEndTime = core.now();
|
|
1164
|
+
const timeDiff = touchEndTime - data.touchStartTime;
|
|
1165
|
+
if (currentPos < -swiper.minTranslate()) {
|
|
1166
|
+
swiper.slideTo(swiper.activeIndex);
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
if (currentPos > -swiper.maxTranslate()) {
|
|
1170
|
+
if (swiper.slides.length < snapGrid.length) {
|
|
1171
|
+
swiper.slideTo(snapGrid.length - 1);
|
|
1172
|
+
} else {
|
|
1173
|
+
swiper.slideTo(swiper.slides.length - 1);
|
|
1174
|
+
}
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
if (params.freeMode.momentum) {
|
|
1178
|
+
if (data.velocities.length > 1) {
|
|
1179
|
+
const lastMoveEvent = data.velocities.pop();
|
|
1180
|
+
const velocityEvent = data.velocities.pop();
|
|
1181
|
+
const distance = lastMoveEvent.position - velocityEvent.position;
|
|
1182
|
+
const time = lastMoveEvent.time - velocityEvent.time;
|
|
1183
|
+
swiper.velocity = distance / time;
|
|
1184
|
+
swiper.velocity /= 2;
|
|
1185
|
+
if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {
|
|
1186
|
+
swiper.velocity = 0;
|
|
1187
|
+
}
|
|
1188
|
+
// this implies that the user stopped moving a finger then released.
|
|
1189
|
+
// There would be no events with distance zero, so the last event is stale.
|
|
1190
|
+
if (time > 150 || core.now() - lastMoveEvent.time > 300) {
|
|
1191
|
+
swiper.velocity = 0;
|
|
1192
|
+
}
|
|
1193
|
+
} else {
|
|
1194
|
+
swiper.velocity = 0;
|
|
1195
|
+
}
|
|
1196
|
+
swiper.velocity *= params.freeMode.momentumVelocityRatio;
|
|
1197
|
+
data.velocities.length = 0;
|
|
1198
|
+
let momentumDuration = 1000 * params.freeMode.momentumRatio;
|
|
1199
|
+
const momentumDistance = swiper.velocity * momentumDuration;
|
|
1200
|
+
let newPosition = swiper.translate + momentumDistance;
|
|
1201
|
+
if (rtl) newPosition = -newPosition;
|
|
1202
|
+
let doBounce = false;
|
|
1203
|
+
let afterBouncePosition;
|
|
1204
|
+
const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;
|
|
1205
|
+
let needsLoopFix;
|
|
1206
|
+
if (newPosition < swiper.maxTranslate()) {
|
|
1207
|
+
if (params.freeMode.momentumBounce) {
|
|
1208
|
+
if (newPosition + swiper.maxTranslate() < -bounceAmount) {
|
|
1209
|
+
newPosition = swiper.maxTranslate() - bounceAmount;
|
|
1210
|
+
}
|
|
1211
|
+
afterBouncePosition = swiper.maxTranslate();
|
|
1212
|
+
doBounce = true;
|
|
1213
|
+
data.allowMomentumBounce = true;
|
|
1214
|
+
} else {
|
|
1215
|
+
newPosition = swiper.maxTranslate();
|
|
1216
|
+
}
|
|
1217
|
+
if (params.loop && params.centeredSlides) needsLoopFix = true;
|
|
1218
|
+
} else if (newPosition > swiper.minTranslate()) {
|
|
1219
|
+
if (params.freeMode.momentumBounce) {
|
|
1220
|
+
if (newPosition - swiper.minTranslate() > bounceAmount) {
|
|
1221
|
+
newPosition = swiper.minTranslate() + bounceAmount;
|
|
1222
|
+
}
|
|
1223
|
+
afterBouncePosition = swiper.minTranslate();
|
|
1224
|
+
doBounce = true;
|
|
1225
|
+
data.allowMomentumBounce = true;
|
|
1226
|
+
} else {
|
|
1227
|
+
newPosition = swiper.minTranslate();
|
|
1228
|
+
}
|
|
1229
|
+
if (params.loop && params.centeredSlides) needsLoopFix = true;
|
|
1230
|
+
} else if (params.freeMode.sticky) {
|
|
1231
|
+
let nextSlide;
|
|
1232
|
+
for (let j = 0; j < snapGrid.length; j += 1) {
|
|
1233
|
+
if (snapGrid[j] > -newPosition) {
|
|
1234
|
+
nextSlide = j;
|
|
1235
|
+
break;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
|
|
1239
|
+
newPosition = snapGrid[nextSlide];
|
|
1240
|
+
} else {
|
|
1241
|
+
newPosition = snapGrid[nextSlide - 1];
|
|
1242
|
+
}
|
|
1243
|
+
newPosition = -newPosition;
|
|
1244
|
+
}
|
|
1245
|
+
if (needsLoopFix) {
|
|
1246
|
+
once('transitionEnd', () => {
|
|
1247
|
+
swiper.loopFix();
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
// Fix duration
|
|
1251
|
+
if (swiper.velocity !== 0) {
|
|
1252
|
+
if (rtl) {
|
|
1253
|
+
momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
|
|
1254
|
+
} else {
|
|
1255
|
+
momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
|
|
1256
|
+
}
|
|
1257
|
+
if (params.freeMode.sticky) {
|
|
1258
|
+
// If freeMode.sticky is active and the user ends a swipe with a slow-velocity
|
|
1259
|
+
// event, then durations can be 20+ seconds to slide one (or zero!) slides.
|
|
1260
|
+
// It's easy to see this when simulating touch with mouse events. To fix this,
|
|
1261
|
+
// limit single-slide swipes to the default slide duration. This also has the
|
|
1262
|
+
// nice side effect of matching slide speed if the user stopped moving before
|
|
1263
|
+
// lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
|
|
1264
|
+
// For faster swipes, also apply limits (albeit higher ones).
|
|
1265
|
+
const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
|
|
1266
|
+
const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
|
|
1267
|
+
if (moveDistance < currentSlideSize) {
|
|
1268
|
+
momentumDuration = params.speed;
|
|
1269
|
+
} else if (moveDistance < 2 * currentSlideSize) {
|
|
1270
|
+
momentumDuration = params.speed * 1.5;
|
|
1271
|
+
} else {
|
|
1272
|
+
momentumDuration = params.speed * 2.5;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
} else if (params.freeMode.sticky) {
|
|
1276
|
+
swiper.slideToClosest();
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
if (params.freeMode.momentumBounce && doBounce) {
|
|
1280
|
+
swiper.updateProgress(afterBouncePosition);
|
|
1281
|
+
swiper.setTransition(momentumDuration);
|
|
1282
|
+
swiper.setTranslate(newPosition);
|
|
1283
|
+
swiper.transitionStart(true, swiper.swipeDirection);
|
|
1284
|
+
swiper.animating = true;
|
|
1285
|
+
core.elementTransitionEnd(wrapperEl, () => {
|
|
1286
|
+
if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
|
|
1287
|
+
emit('momentumBounce');
|
|
1288
|
+
swiper.setTransition(params.speed);
|
|
1289
|
+
setTimeout(() => {
|
|
1290
|
+
swiper.setTranslate(afterBouncePosition);
|
|
1291
|
+
core.elementTransitionEnd(wrapperEl, () => {
|
|
1292
|
+
if (!swiper || swiper.destroyed) return;
|
|
1293
|
+
swiper.transitionEnd();
|
|
1294
|
+
});
|
|
1295
|
+
}, 0);
|
|
1296
|
+
});
|
|
1297
|
+
} else if (swiper.velocity) {
|
|
1298
|
+
emit('_freeModeNoMomentumRelease');
|
|
1299
|
+
swiper.updateProgress(newPosition);
|
|
1300
|
+
swiper.setTransition(momentumDuration);
|
|
1301
|
+
swiper.setTranslate(newPosition);
|
|
1302
|
+
swiper.transitionStart(true, swiper.swipeDirection);
|
|
1303
|
+
if (!swiper.animating) {
|
|
1304
|
+
swiper.animating = true;
|
|
1305
|
+
core.elementTransitionEnd(wrapperEl, () => {
|
|
1306
|
+
if (!swiper || swiper.destroyed) return;
|
|
1307
|
+
swiper.transitionEnd();
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
} else {
|
|
1311
|
+
swiper.updateProgress(newPosition);
|
|
1312
|
+
}
|
|
1313
|
+
swiper.updateActiveIndex();
|
|
1314
|
+
swiper.updateSlidesClasses();
|
|
1315
|
+
} else if (params.freeMode.sticky) {
|
|
1316
|
+
swiper.slideToClosest();
|
|
1317
|
+
return;
|
|
1318
|
+
} else if (params.freeMode) {
|
|
1319
|
+
emit('_freeModeNoMomentumRelease');
|
|
1320
|
+
}
|
|
1321
|
+
if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {
|
|
1322
|
+
swiper.updateProgress();
|
|
1323
|
+
swiper.updateActiveIndex();
|
|
1324
|
+
swiper.updateSlidesClasses();
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
Object.assign(swiper, {
|
|
1328
|
+
freeMode: {
|
|
1329
|
+
onTouchStart,
|
|
1330
|
+
onTouchMove,
|
|
1331
|
+
onTouchEnd
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
function Grid({
|
|
1337
|
+
swiper,
|
|
1338
|
+
extendParams
|
|
1339
|
+
}) {
|
|
1340
|
+
extendParams({
|
|
1341
|
+
grid: {
|
|
1342
|
+
rows: 1,
|
|
1343
|
+
fill: 'column'
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
let slidesNumberEvenToRows;
|
|
1347
|
+
let slidesPerRow;
|
|
1348
|
+
let numFullColumns;
|
|
1349
|
+
const initSlides = slidesLength => {
|
|
1350
|
+
const {
|
|
1351
|
+
slidesPerView
|
|
1352
|
+
} = swiper.params;
|
|
1353
|
+
const {
|
|
1354
|
+
rows,
|
|
1355
|
+
fill
|
|
1356
|
+
} = swiper.params.grid;
|
|
1357
|
+
slidesPerRow = slidesNumberEvenToRows / rows;
|
|
1358
|
+
numFullColumns = Math.floor(slidesLength / rows);
|
|
1359
|
+
if (Math.floor(slidesLength / rows) === slidesLength / rows) {
|
|
1360
|
+
slidesNumberEvenToRows = slidesLength;
|
|
1361
|
+
} else {
|
|
1362
|
+
slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows;
|
|
1363
|
+
}
|
|
1364
|
+
if (slidesPerView !== 'auto' && fill === 'row') {
|
|
1365
|
+
slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows);
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
const updateSlide = (i, slide, slidesLength, getDirectionLabel) => {
|
|
1369
|
+
const {
|
|
1370
|
+
slidesPerGroup,
|
|
1371
|
+
spaceBetween
|
|
1372
|
+
} = swiper.params;
|
|
1373
|
+
const {
|
|
1374
|
+
rows,
|
|
1375
|
+
fill
|
|
1376
|
+
} = swiper.params.grid;
|
|
1377
|
+
// Set slides order
|
|
1378
|
+
let newSlideOrderIndex;
|
|
1379
|
+
let column;
|
|
1380
|
+
let row;
|
|
1381
|
+
if (fill === 'row' && slidesPerGroup > 1) {
|
|
1382
|
+
const groupIndex = Math.floor(i / (slidesPerGroup * rows));
|
|
1383
|
+
const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex;
|
|
1384
|
+
const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup);
|
|
1385
|
+
row = Math.floor(slideIndexInGroup / columnsInGroup);
|
|
1386
|
+
column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup;
|
|
1387
|
+
newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows;
|
|
1388
|
+
slide.style.order = newSlideOrderIndex;
|
|
1389
|
+
} else if (fill === 'column') {
|
|
1390
|
+
column = Math.floor(i / rows);
|
|
1391
|
+
row = i - column * rows;
|
|
1392
|
+
if (column > numFullColumns || column === numFullColumns && row === rows - 1) {
|
|
1393
|
+
row += 1;
|
|
1394
|
+
if (row >= rows) {
|
|
1395
|
+
row = 0;
|
|
1396
|
+
column += 1;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
} else {
|
|
1400
|
+
row = Math.floor(i / slidesPerRow);
|
|
1401
|
+
column = i - row * slidesPerRow;
|
|
1402
|
+
}
|
|
1403
|
+
slide.style[getDirectionLabel('margin-top')] = row !== 0 ? spaceBetween && `${spaceBetween}px` : '';
|
|
1404
|
+
};
|
|
1405
|
+
const updateWrapperSize = (slideSize, snapGrid, getDirectionLabel) => {
|
|
1406
|
+
const {
|
|
1407
|
+
spaceBetween,
|
|
1408
|
+
centeredSlides,
|
|
1409
|
+
roundLengths
|
|
1410
|
+
} = swiper.params;
|
|
1411
|
+
const {
|
|
1412
|
+
rows
|
|
1413
|
+
} = swiper.params.grid;
|
|
1414
|
+
swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows;
|
|
1415
|
+
swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween;
|
|
1416
|
+
swiper.wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
|
|
1417
|
+
if (centeredSlides) {
|
|
1418
|
+
const newSlidesGrid = [];
|
|
1419
|
+
for (let i = 0; i < snapGrid.length; i += 1) {
|
|
1420
|
+
let slidesGridItem = snapGrid[i];
|
|
1421
|
+
if (roundLengths) slidesGridItem = Math.floor(slidesGridItem);
|
|
1422
|
+
if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);
|
|
1423
|
+
}
|
|
1424
|
+
snapGrid.splice(0, snapGrid.length);
|
|
1425
|
+
snapGrid.push(...newSlidesGrid);
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
swiper.grid = {
|
|
1429
|
+
initSlides,
|
|
1430
|
+
updateSlide,
|
|
1431
|
+
updateWrapperSize
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
function effectInit(params) {
|
|
1436
|
+
const {
|
|
1437
|
+
effect,
|
|
1438
|
+
swiper,
|
|
1439
|
+
on,
|
|
1440
|
+
setTranslate,
|
|
1441
|
+
setTransition,
|
|
1442
|
+
overwriteParams,
|
|
1443
|
+
perspective,
|
|
1444
|
+
recreateShadows,
|
|
1445
|
+
getEffectParams
|
|
1446
|
+
} = params;
|
|
1447
|
+
on('beforeInit', () => {
|
|
1448
|
+
if (swiper.params.effect !== effect) return;
|
|
1449
|
+
swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`);
|
|
1450
|
+
if (perspective && perspective()) {
|
|
1451
|
+
swiper.classNames.push(`${swiper.params.containerModifierClass}3d`);
|
|
1452
|
+
}
|
|
1453
|
+
const overwriteParamsResult = overwriteParams ? overwriteParams() : {};
|
|
1454
|
+
Object.assign(swiper.params, overwriteParamsResult);
|
|
1455
|
+
Object.assign(swiper.originalParams, overwriteParamsResult);
|
|
1456
|
+
});
|
|
1457
|
+
on('setTranslate', () => {
|
|
1458
|
+
if (swiper.params.effect !== effect) return;
|
|
1459
|
+
setTranslate();
|
|
1460
|
+
});
|
|
1461
|
+
on('setTransition', (_s, duration) => {
|
|
1462
|
+
if (swiper.params.effect !== effect) return;
|
|
1463
|
+
setTransition(duration);
|
|
1464
|
+
});
|
|
1465
|
+
on('transitionEnd', () => {
|
|
1466
|
+
if (swiper.params.effect !== effect) return;
|
|
1467
|
+
if (recreateShadows) {
|
|
1468
|
+
if (!getEffectParams || !getEffectParams().slideShadows) return;
|
|
1469
|
+
// remove shadows
|
|
1470
|
+
swiper.slides.forEach(slideEl => {
|
|
1471
|
+
slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => shadowEl.remove());
|
|
1472
|
+
});
|
|
1473
|
+
// create new one
|
|
1474
|
+
recreateShadows();
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
let requireUpdateOnVirtual;
|
|
1478
|
+
on('virtualUpdate', () => {
|
|
1479
|
+
if (swiper.params.effect !== effect) return;
|
|
1480
|
+
if (!swiper.slides.length) {
|
|
1481
|
+
requireUpdateOnVirtual = true;
|
|
1482
|
+
}
|
|
1483
|
+
requestAnimationFrame(() => {
|
|
1484
|
+
if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) {
|
|
1485
|
+
setTranslate();
|
|
1486
|
+
requireUpdateOnVirtual = false;
|
|
1487
|
+
}
|
|
1488
|
+
});
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
function effectTarget(effectParams, slideEl) {
|
|
1493
|
+
const transformEl = core.getSlideTransformEl(slideEl);
|
|
1494
|
+
if (transformEl !== slideEl) {
|
|
1495
|
+
transformEl.style.backfaceVisibility = 'hidden';
|
|
1496
|
+
transformEl.style['-webkit-backface-visibility'] = 'hidden';
|
|
1497
|
+
}
|
|
1498
|
+
return transformEl;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
function effectVirtualTransitionEnd({
|
|
1502
|
+
swiper,
|
|
1503
|
+
duration,
|
|
1504
|
+
transformElements,
|
|
1505
|
+
allSlides
|
|
1506
|
+
}) {
|
|
1507
|
+
const {
|
|
1508
|
+
activeIndex
|
|
1509
|
+
} = swiper;
|
|
1510
|
+
const getSlide = el => {
|
|
1511
|
+
if (!el.parentElement) {
|
|
1512
|
+
// assume shadow root
|
|
1513
|
+
const slide = swiper.slides.filter(slideEl => slideEl.shadowEl && slideEl.shadowEl === el.parentNode)[0];
|
|
1514
|
+
return slide;
|
|
1515
|
+
}
|
|
1516
|
+
return el.parentElement;
|
|
1517
|
+
};
|
|
1518
|
+
if (swiper.params.virtualTranslate && duration !== 0) {
|
|
1519
|
+
let eventTriggered = false;
|
|
1520
|
+
let transitionEndTarget;
|
|
1521
|
+
if (allSlides) {
|
|
1522
|
+
transitionEndTarget = transformElements;
|
|
1523
|
+
} else {
|
|
1524
|
+
transitionEndTarget = transformElements.filter(transformEl => {
|
|
1525
|
+
const el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl;
|
|
1526
|
+
return swiper.getSlideIndex(el) === activeIndex;
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
transitionEndTarget.forEach(el => {
|
|
1530
|
+
core.elementTransitionEnd(el, () => {
|
|
1531
|
+
if (eventTriggered) return;
|
|
1532
|
+
if (!swiper || swiper.destroyed) return;
|
|
1533
|
+
eventTriggered = true;
|
|
1534
|
+
swiper.animating = false;
|
|
1535
|
+
const evt = new window.CustomEvent('transitionend', {
|
|
1536
|
+
bubbles: true,
|
|
1537
|
+
cancelable: true
|
|
1538
|
+
});
|
|
1539
|
+
swiper.wrapperEl.dispatchEvent(evt);
|
|
1540
|
+
});
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
function EffectFade({
|
|
1546
|
+
swiper,
|
|
1547
|
+
extendParams,
|
|
1548
|
+
on
|
|
1549
|
+
}) {
|
|
1550
|
+
extendParams({
|
|
1551
|
+
fadeEffect: {
|
|
1552
|
+
crossFade: false
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
const setTranslate = () => {
|
|
1556
|
+
const {
|
|
1557
|
+
slides
|
|
1558
|
+
} = swiper;
|
|
1559
|
+
const params = swiper.params.fadeEffect;
|
|
1560
|
+
for (let i = 0; i < slides.length; i += 1) {
|
|
1561
|
+
const slideEl = swiper.slides[i];
|
|
1562
|
+
const offset = slideEl.swiperSlideOffset;
|
|
1563
|
+
let tx = -offset;
|
|
1564
|
+
if (!swiper.params.virtualTranslate) tx -= swiper.translate;
|
|
1565
|
+
let ty = 0;
|
|
1566
|
+
if (!swiper.isHorizontal()) {
|
|
1567
|
+
ty = tx;
|
|
1568
|
+
tx = 0;
|
|
1569
|
+
}
|
|
1570
|
+
const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs(slideEl.progress), 0) : 1 + Math.min(Math.max(slideEl.progress, -1), 0);
|
|
1571
|
+
const targetEl = effectTarget(params, slideEl);
|
|
1572
|
+
targetEl.style.opacity = slideOpacity;
|
|
1573
|
+
targetEl.style.transform = `translate3d(${tx}px, ${ty}px, 0px)`;
|
|
1574
|
+
}
|
|
1575
|
+
};
|
|
1576
|
+
const setTransition = duration => {
|
|
1577
|
+
const transformElements = swiper.slides.map(slideEl => core.getSlideTransformEl(slideEl));
|
|
1578
|
+
transformElements.forEach(el => {
|
|
1579
|
+
el.style.transitionDuration = `${duration}ms`;
|
|
1580
|
+
});
|
|
1581
|
+
effectVirtualTransitionEnd({
|
|
1582
|
+
swiper,
|
|
1583
|
+
duration,
|
|
1584
|
+
transformElements,
|
|
1585
|
+
allSlides: true
|
|
1586
|
+
});
|
|
1587
|
+
};
|
|
1588
|
+
effectInit({
|
|
1589
|
+
effect: 'fade',
|
|
1590
|
+
swiper,
|
|
1591
|
+
on,
|
|
1592
|
+
setTranslate,
|
|
1593
|
+
setTransition,
|
|
1594
|
+
overwriteParams: () => ({
|
|
1595
|
+
slidesPerView: 1,
|
|
1596
|
+
slidesPerGroup: 1,
|
|
1597
|
+
watchSlidesProgress: true,
|
|
1598
|
+
spaceBetween: 0,
|
|
1599
|
+
virtualTranslate: !swiper.params.cssMode
|
|
1600
|
+
})
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
const ptcCaseStudiesSliderCss = "@font-face{font-family:'swiper-icons';src:url('data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA');font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff;}.swiper,swiper-container{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-wrapper{transform:translate3d(0px, 0, 0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide,swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform, height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0, 0, 0, 0.15)}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-horizontal.swiper-css-mode>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-vertical.swiper-css-mode>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-centered>.swiper-wrapper::before{content:'';flex-shrink:0;order:9999}.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,swiper-container:not(.swiper-watch-progress) .swiper-lazy-preloader,.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@keyframes swiper-preloader-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.swiper-virtual .swiper-slide{-webkit-backface-visibility:hidden;transform:translateZ(0)}.swiper-virtual.swiper-css-mode .swiper-wrapper::after{content:'';position:absolute;left:0;top:0;pointer-events:none}.swiper-virtual.swiper-css-mode.swiper-horizontal .swiper-wrapper::after{height:1px;width:var(--swiper-virtual-size)}.swiper-virtual.swiper-css-mode.swiper-vertical .swiper-wrapper::after{width:1px;height:var(--swiper-virtual-size)}:root{--swiper-navigation-size:44px;}.swiper-button-prev,.swiper-button-next{position:absolute;top:var(--swiper-navigation-top-offset, 50%);width:calc(var(--swiper-navigation-size) / 44 * 27);height:var(--swiper-navigation-size);margin-top:calc(0px - (var(--swiper-navigation-size) / 2));z-index:10;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--swiper-navigation-color, var(--swiper-theme-color))}.swiper-button-prev.swiper-button-disabled,.swiper-button-next.swiper-button-disabled{opacity:0.35;cursor:auto;pointer-events:none}.swiper-button-prev.swiper-button-hidden,.swiper-button-next.swiper-button-hidden{opacity:0;cursor:auto;pointer-events:none}.swiper-navigation-disabled .swiper-button-prev,.swiper-navigation-disabled .swiper-button-next{display:none !important}.swiper-button-prev:after,.swiper-button-next:after{font-family:swiper-icons;font-size:var(--swiper-navigation-size);text-transform:none !important;letter-spacing:0;font-variant:initial;line-height:1}.swiper-button-prev,.swiper-rtl .swiper-button-next{left:var(--swiper-navigation-sides-offset, 10px);right:auto}.swiper-button-prev:after,.swiper-rtl .swiper-button-next:after{content:'prev'}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:var(--swiper-navigation-sides-offset, 10px);left:auto}.swiper-button-next:after,.swiper-rtl .swiper-button-prev:after{content:'next'}.swiper-button-lock{display:none}:root{}.swiper-pagination{position:absolute;text-align:center;transition:300ms opacity;transform:translate3d(0, 0, 0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-pagination-disabled>.swiper-pagination,.swiper-pagination.swiper-pagination-disabled{display:none !important}.swiper-pagination-fraction,.swiper-pagination-custom,.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-bullets.swiper-pagination-horizontal{bottom:var(--swiper-pagination-bottom, 8px);top:var(--swiper-pagination-top, auto);left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transform:scale(0.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{transform:scale(0.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{transform:scale(0.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{transform:scale(0.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{transform:scale(0.33)}.swiper-pagination-bullet{width:var(--swiper-pagination-bullet-width, var(--swiper-pagination-bullet-size, 8px));height:var(--swiper-pagination-bullet-height, var(--swiper-pagination-bullet-size, 8px));display:inline-block;border-radius:var(--swiper-pagination-bullet-border-radius, 50%);background:var(--swiper-pagination-bullet-inactive-color, #000);opacity:var(--swiper-pagination-bullet-inactive-opacity, 0.2)}button.swiper-pagination-bullet{border:none;margin:0;padding:0;box-shadow:none;-webkit-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet:only-child{display:none !important}.swiper-pagination-bullet-active{opacity:var(--swiper-pagination-bullet-opacity, 1);background:var(--swiper-pagination-color, var(--swiper-theme-color))}.swiper-vertical>.swiper-pagination-bullets,.swiper-pagination-vertical.swiper-pagination-bullets{right:var(--swiper-pagination-right, 8px);left:var(--swiper-pagination-left, auto);top:50%;transform:translate3d(0px, -50%, 0)}.swiper-vertical>.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-pagination-vertical.swiper-pagination-bullets .swiper-pagination-bullet{margin:var(--swiper-pagination-bullet-vertical-gap, 6px) 0;display:block}.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;transform:translateY(-50%);width:8px}.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;transition:200ms transform, 200ms top}.swiper-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 var(--swiper-pagination-bullet-horizontal-gap, 4px)}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;transform:translateX(-50%);white-space:nowrap}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:200ms transform, 200ms left}.swiper-horizontal.swiper-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,:host(.swiper-horizontal.swiper-rtl) .swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:200ms transform, 200ms right}.swiper-pagination-fraction{color:var(--swiper-pagination-fraction-color, inherit)}.swiper-pagination-progressbar{background:var(--swiper-pagination-progressbar-bg-color, rgba(0, 0, 0, 0.25));position:absolute;}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:var(--swiper-pagination-color, var(--swiper-theme-color));position:absolute;left:0;top:0;width:100%;height:100%;transform:scale(0);transform-origin:left top}.swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{transform-origin:right top}.swiper-horizontal>.swiper-pagination-progressbar,.swiper-pagination-progressbar.swiper-pagination-horizontal,.swiper-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite{width:100%;height:var(--swiper-pagination-progressbar-size, 4px);left:0;top:0}.swiper-vertical>.swiper-pagination-progressbar,.swiper-pagination-progressbar.swiper-pagination-vertical,.swiper-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite{width:var(--swiper-pagination-progressbar-size, 4px);height:100%;left:0;top:0}.swiper-pagination-lock{display:none}:root{}.swiper-scrollbar{border-radius:var(--swiper-scrollbar-border-radius, 10px);position:relative;-ms-touch-action:none;background:var(--swiper-scrollbar-bg-color, rgba(0, 0, 0, 0.1))}.swiper-scrollbar-disabled>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-disabled{display:none !important}.swiper-horizontal>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-horizontal{position:absolute;left:var(--swiper-scrollbar-sides-offset, 1%);bottom:var(--swiper-scrollbar-bottom, 4px);top:var(--swiper-scrollbar-top, auto);z-index:50;height:var(--swiper-scrollbar-size, 4px);width:calc(100% - 2 * var(--swiper-scrollbar-sides-offset, 1%))}.swiper-vertical>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-vertical{position:absolute;left:var(--swiper-scrollbar-left, auto);right:var(--swiper-scrollbar-right, 4px);top:var(--swiper-scrollbar-sides-offset, 1%);z-index:50;width:var(--swiper-scrollbar-size, 4px);height:calc(100% - 2 * var(--swiper-scrollbar-sides-offset, 1%))}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:var(--swiper-scrollbar-drag-bg-color, rgba(0, 0, 0, 0.5));border-radius:var(--swiper-scrollbar-border-radius, 10px);left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center}.swiper-zoom-container>img,.swiper-zoom-container>svg,.swiper-zoom-container>canvas{max-width:100%;max-height:100%;object-fit:contain}.swiper-slide-zoomed{cursor:move;touch-action:none}.swiper .swiper-notification,swiper-container .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-free-mode>.swiper-wrapper{transition-timing-function:ease-out;margin:0 auto}.swiper-grid>.swiper-wrapper{flex-wrap:wrap}.swiper-grid-column>.swiper-wrapper{flex-wrap:wrap;flex-direction:column}.swiper-fade.swiper-free-mode .swiper-slide{transition-timing-function:ease-out}.swiper-fade .swiper-slide{pointer-events:none;transition-property:opacity}.swiper-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-fade .swiper-slide-active,.swiper-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-cube{overflow:visible}.swiper-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;transform-origin:0 0;width:100%;height:100%}.swiper-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-cube.swiper-rtl .swiper-slide{transform-origin:100% 0}.swiper-cube .swiper-slide-active,.swiper-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-cube .swiper-slide-active,.swiper-cube .swiper-slide-next,.swiper-cube .swiper-slide-prev,.swiper-cube .swiper-slide-next+.swiper-slide{pointer-events:auto;visibility:visible}.swiper-cube .swiper-slide-shadow-top,.swiper-cube .swiper-slide-shadow-bottom,.swiper-cube .swiper-slide-shadow-left,.swiper-cube .swiper-slide-shadow-right{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0px;width:100%;height:100%;opacity:0.6;z-index:0}.swiper-cube .swiper-cube-shadow:before{content:'';background:#000;position:absolute;left:0;top:0;bottom:0;right:0;filter:blur(50px)}.swiper-flip{overflow:visible}.swiper-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-flip .swiper-slide-active,.swiper-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-flip .swiper-slide-shadow-top,.swiper-flip .swiper-slide-shadow-bottom,.swiper-flip .swiper-slide-shadow-left,.swiper-flip .swiper-slide-shadow-right{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-creative .swiper-slide{-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden;transition-property:transform, opacity, height}.swiper-cards{overflow:visible}.swiper-cards .swiper-slide{transform-origin:center bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden}:host{display:block;overflow:hidden}:host *{box-sizing:border-box}:host .hide{display:none}:host .case-studies-slides{height:80%;width:100%;padding-bottom:20px;position:relative}@media only screen and (min-width: 768px){:host .case-studies-slides{padding-bottom:0px}}:host .case-studies-slides .swiper-slide{visibility:hidden;display:flex;justify-content:center;align-items:center;padding-bottom:30px}:host .case-studies-slides .swiper-slide.swiper-slide-prev{visibility:hidden}:host .case-studies-slides .swiper-slide.swiper-slide-visible{visibility:visible}:host .case-studies-slides ptc-text-copy-with-background ptc-title .sc-ptc-title-s .sc-ptc-title-s::before,:host .case-studies-slides ptc-text-copy-with-background ptc-title .sc-ptc-title-s .sc-ptc-title-s::after{display:none}:host .case-studies-thumbs{height:20%;box-sizing:border-box;padding:10px 0;background-color:transparent}@media only screen and (min-width: 992px){:host .case-studies-thumbs{display:flex;justify-content:center}}@media only screen and (min-width: 992px){:host .case-studies-thumbs .swiper-wrapper{transform:none !important;justify-content:center}}:host .case-studies-thumbs .swiper-slide{width:auto;height:auto;max-width:8.75rem;opacity:0.4;display:flex;justify-items:center;align-items:center;padding:0 10px}@media only screen and (min-width: 992px){:host .case-studies-thumbs .swiper-slide{max-width:12.5rem}}:host .case-studies-thumbs .swiper-slide img{display:block;width:100%}@-moz-document url-prefix(){:host .case-studies-thumbs .swiper-slide img{min-width:140px}}:host .case-studies-thumbs .swiper-slide::after{content:\"\";height:7.5px;width:100%;position:absolute;bottom:-10px;left:0}:host .case-studies-thumbs .swiper-slide.swiper-slide-thumb-active{opacity:1}:host .case-studies-thumbs .swiper-slide.swiper-slide-thumb-active::after{background-color:var(--color-green-07)}:host .swiper-button-prev,:host .swiper-button-next{display:none}:host .swiper-pagination{display:block;bottom:5px}@media only screen and (min-width: 768px){:host .swiper-pagination{display:none}}:host .swiper-pagination .swiper-pagination-bullet{background:transparent;display:inline-block;height:1rem;width:1rem;outline:none;line-height:0;font-size:0;border:1px solid var(--color-gray-10);padding:5px;cursor:pointer;margin-right:32px !important;position:relative;opacity:1}:host .swiper-pagination .swiper-pagination-bullet::after{content:\"\";display:block;position:absolute;width:37px;height:2px;background-color:var(--color-gray-10);margin-left:10px;margin-top:1px}:host .swiper-pagination .swiper-pagination-bullet:last-child::after{display:none}:host .swiper-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active{background:var(--color-orange-07)}";
|
|
1605
|
+
|
|
1606
|
+
const PtcCaseStudiesSlider = class {
|
|
1607
|
+
constructor(hostRef) {
|
|
1608
|
+
index.registerInstance(this, hostRef);
|
|
1609
|
+
// SLider List
|
|
1610
|
+
this.caseStudiesThumbs = null;
|
|
1611
|
+
this.caseStudiesSlides = null;
|
|
1612
|
+
}
|
|
1613
|
+
componentDidLoad() {
|
|
1614
|
+
this.initSlider();
|
|
1615
|
+
this.slideChangeHandler();
|
|
1616
|
+
this.renderSlides('swiper-slide-thumb', 'swiper-wrapper-thumbs');
|
|
1617
|
+
this.renderSlides('swiper-slide-content', 'swiper-wrapper-content');
|
|
1618
|
+
}
|
|
1619
|
+
initSlider() {
|
|
1620
|
+
this.caseStudiesThumbs = new core.Swiper(this.caeStudiesThumbRef, {
|
|
1621
|
+
modules: [Navigation, Pagination, freeMode, Grid],
|
|
1622
|
+
loop: false,
|
|
1623
|
+
slidesPerView: 'auto',
|
|
1624
|
+
freeMode: true,
|
|
1625
|
+
watchSlidesProgress: true,
|
|
1626
|
+
centerInsufficientSlides: true,
|
|
1627
|
+
breakpoints: {
|
|
1628
|
+
992: {
|
|
1629
|
+
slidesPerView: 7,
|
|
1630
|
+
},
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
this.caseStudiesSlides = new core.Swiper(this.caseStudiesSlidesRef, {
|
|
1634
|
+
modules: [Navigation, Pagination, Thumb, Autoplay, EffectFade],
|
|
1635
|
+
loop: false,
|
|
1636
|
+
grabCursor: true,
|
|
1637
|
+
effect: 'fade',
|
|
1638
|
+
autoplay: {
|
|
1639
|
+
delay: 10000,
|
|
1640
|
+
disableOnInteraction: false,
|
|
1641
|
+
waitForTransition: true,
|
|
1642
|
+
},
|
|
1643
|
+
thumbs: {
|
|
1644
|
+
swiper: this.caseStudiesThumbs,
|
|
1645
|
+
},
|
|
1646
|
+
pagination: {
|
|
1647
|
+
el: this.paginationRef,
|
|
1648
|
+
clickable: true,
|
|
1649
|
+
},
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
slideChangeHandler() {
|
|
1653
|
+
this.caseStudiesSlides.on('slideChange', () => {
|
|
1654
|
+
const visibleSlide = this.caseStudiesSlides.slides[this.caseStudiesSlides.activeIndex];
|
|
1655
|
+
const tagName = visibleSlide.querySelector('ptc-text-copy-with-background').shadowRoot;
|
|
1656
|
+
const content = tagName.querySelector('.card-wrap');
|
|
1657
|
+
const parent = tagName.querySelector('.card-wrap').parentNode;
|
|
1658
|
+
parent.removeChild(content);
|
|
1659
|
+
parent.appendChild(content);
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
renderSlides(slideName, wrapperName) {
|
|
1663
|
+
const slidesList = Array.from(this.hostElement.querySelectorAll('.' + slideName));
|
|
1664
|
+
if (slidesList.length > 0) {
|
|
1665
|
+
const swiperWrapper = this.hostElement.shadowRoot.querySelector('.' + wrapperName);
|
|
1666
|
+
slidesList.forEach((node, index) => {
|
|
1667
|
+
const cloneNode = node.cloneNode(true);
|
|
1668
|
+
swiperWrapper.appendChild(cloneNode);
|
|
1669
|
+
const imageElement = node.querySelector('img');
|
|
1670
|
+
if (imageElement) {
|
|
1671
|
+
imageElement.addEventListener('click', () => {
|
|
1672
|
+
this.caseStudiesSlides.slideTo(index); // Change the slide to the corresponding index
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
render() {
|
|
1679
|
+
return (index.h(index.Host, null, index.h("div", { class: "case-studies-thumbs", ref: el => this.caeStudiesThumbRef = el }, index.h("span", { class: "hide" }, index.h("slot", { name: 'thumb-slides' })), index.h("div", { class: 'swiper-wrapper swiper-wrapper-thumbs' })), index.h("div", { class: "case-studies-slides", ref: el => this.caseStudiesSlidesRef = el }, index.h("span", { class: "hide" }, index.h("slot", { name: 'content-slides' })), index.h("div", { class: 'swiper-wrapper swiper-wrapper-content' }), index.h("div", { class: "swiper-pagination", ref: el => this.paginationRef = el }))));
|
|
1680
|
+
}
|
|
1681
|
+
get hostElement() { return index.getElement(this); }
|
|
1682
|
+
};
|
|
1683
|
+
PtcCaseStudiesSlider.style = ptcCaseStudiesSliderCss;
|
|
1684
|
+
|
|
1685
|
+
exports.ptc_case_studies_slider = PtcCaseStudiesSlider;
|