@salla.sa/twilight-components 2.9.49 → 2.10.1
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/cjs/{index-7b85482c.js → app-globals-0a1abeac.js} +31 -2
- package/dist/cjs/index-1d2b3370.js +0 -4
- package/dist/cjs/loader.cjs.js +3 -2
- package/dist/cjs/salla-add-product-button.cjs.entry.js +7 -3
- package/dist/cjs/salla-button_35.cjs.entry.js +614 -1947
- package/dist/cjs/twilight.cjs.js +3 -2
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +9 -5
- package/dist/collection/components/salla-button/salla-button.js +5 -1
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +9 -8
- package/dist/collection/components/salla-gifting/salla-gifting.js +16 -15
- package/dist/collection/components/salla-loyalty/salla-loyalty.js +5 -3
- package/dist/collection/components/salla-map/salla-map.css +1 -56
- package/dist/collection/components/salla-map/salla-map.js +6 -6
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +17 -16
- package/dist/collection/components/salla-quick-order/salla-quick-order.css +0 -71
- package/dist/collection/components/salla-quick-order/salla-quick-order.js +65 -102
- package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +14 -10
- package/dist/collection/components/salla-slider/salla-slider.css +242 -0
- package/dist/collection/components/salla-slider/salla-slider.js +461 -109
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -2
- package/dist/collection/global/app-dev.js +2 -1
- package/dist/collection/global/app.js +15 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +31 -3
- package/dist/components/salla-add-product-button.js +7 -3
- package/dist/components/salla-button2.js +5 -1
- package/dist/components/salla-file-upload2.js +249 -3
- package/dist/components/salla-gifting.js +24 -17
- package/dist/components/salla-loyalty.js +3 -3
- package/dist/components/salla-map.js +4 -4
- package/dist/components/salla-offer-modal.js +10 -9
- package/dist/components/salla-quick-order.js +58 -95
- package/dist/components/salla-rating-stars2.js +8 -4
- package/dist/components/salla-slider2.js +253 -1805
- package/dist/components/salla-tel-input2.js +2 -2
- package/dist/esm/{index-adc28dc8.js → app-globals-d3b05078.js} +31 -2
- package/dist/esm/index-f1d446ac.js +0 -4
- package/dist/esm/loader.js +3 -2
- package/dist/esm/salla-add-product-button.entry.js +7 -3
- package/dist/esm/salla-button_35.entry.js +613 -1946
- package/dist/esm/twilight.js +3 -2
- package/dist/esm-es5/{index-adc28dc8.js → app-globals-d3b05078.js} +2 -2
- package/dist/esm-es5/index-f1d446ac.js +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-add-product-button.entry.js +1 -1
- package/dist/esm-es5/salla-button_35.entry.js +11 -5
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/p-1b14dc52.js +24 -0
- package/dist/twilight/{p-486ce499.system.entry.js → p-5a1197bb.system.entry.js} +1 -1
- package/dist/twilight/p-6bb79b61.entry.js +30 -0
- package/dist/twilight/p-70235d2a.system.js +24 -0
- package/dist/twilight/p-97f66179.system.js +4 -0
- package/dist/twilight/{p-6f41faf8.entry.js → p-dbb379ce.entry.js} +1 -1
- package/dist/twilight/p-ec1b297c.system.entry.js +47 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-quick-order/salla-quick-order.d.ts +4 -7
- package/dist/types/components/salla-slider/salla-slider.d.ts +87 -14
- package/dist/types/components.d.ts +99 -60
- package/dist/types/global/app-dev.d.ts +0 -1
- package/package.json +6 -4
- package/dist/cjs/core-c7a9fb22.js +0 -4982
- package/dist/cjs/salla-swiper.cjs.entry.js +0 -62
- package/dist/collection/components/salla-swiper/salla-swiper.css +0 -177
- package/dist/collection/components/salla-swiper/salla-swiper.js +0 -152
- package/dist/components/arrow-left.js +0 -11
- package/dist/components/core.js +0 -4959
- package/dist/components/salla-swiper.d.ts +0 -11
- package/dist/components/salla-swiper.js +0 -92
- package/dist/esm/core-572aabd0.js +0 -4973
- package/dist/esm/salla-swiper.entry.js +0 -58
- package/dist/esm-es5/core-572aabd0.js +0 -4
- package/dist/esm-es5/salla-swiper.entry.js +0 -4
- package/dist/twilight/p-00e66d1a.system.js +0 -4
- package/dist/twilight/p-684a004a.system.entry.js +0 -4
- package/dist/twilight/p-6ed7d3a2.js +0 -4
- package/dist/twilight/p-7234a2a2.entry.js +0 -30
- package/dist/twilight/p-a84812f4.system.js +0 -4
- package/dist/twilight/p-d3daf7a7.system.entry.js +0 -41
- package/dist/twilight/p-e55e8d3d.js +0 -24
- package/dist/twilight/p-e8c3c209.entry.js +0 -4
- package/dist/twilight/p-ea021b56.system.js +0 -24
- package/dist/types/components/salla-swiper/salla-swiper.d.ts +0 -31
- package/dist/types/index.d.ts +0 -7
|
@@ -2,1721 +2,9 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { g as getDocument, $, a as getWindow, n as nextTick, i as isObject, S as Swiper } from './core.js';
|
|
6
5
|
import { K as KeyboardArrowRightIcon } from './keyboard_arrow_right.js';
|
|
7
6
|
import { d as defineCustomElement$1 } from './salla-button2.js';
|
|
8
7
|
|
|
9
|
-
function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
|
|
10
|
-
const document = getDocument();
|
|
11
|
-
|
|
12
|
-
if (swiper.params.createElements) {
|
|
13
|
-
Object.keys(checkProps).forEach(key => {
|
|
14
|
-
if (!params[key] && params.auto === true) {
|
|
15
|
-
let element = swiper.$el.children(`.${checkProps[key]}`)[0];
|
|
16
|
-
|
|
17
|
-
if (!element) {
|
|
18
|
-
element = document.createElement('div');
|
|
19
|
-
element.className = checkProps[key];
|
|
20
|
-
swiper.$el.append(element);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
params[key] = element;
|
|
24
|
-
originalParams[key] = element;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return params;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function Navigation(_ref) {
|
|
33
|
-
let {
|
|
34
|
-
swiper,
|
|
35
|
-
extendParams,
|
|
36
|
-
on,
|
|
37
|
-
emit
|
|
38
|
-
} = _ref;
|
|
39
|
-
extendParams({
|
|
40
|
-
navigation: {
|
|
41
|
-
nextEl: null,
|
|
42
|
-
prevEl: null,
|
|
43
|
-
hideOnClick: false,
|
|
44
|
-
disabledClass: 'swiper-button-disabled',
|
|
45
|
-
hiddenClass: 'swiper-button-hidden',
|
|
46
|
-
lockClass: 'swiper-button-lock',
|
|
47
|
-
navigationDisabledClass: 'swiper-navigation-disabled'
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
swiper.navigation = {
|
|
51
|
-
nextEl: null,
|
|
52
|
-
$nextEl: null,
|
|
53
|
-
prevEl: null,
|
|
54
|
-
$prevEl: null
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
function getEl(el) {
|
|
58
|
-
let $el;
|
|
59
|
-
|
|
60
|
-
if (el) {
|
|
61
|
-
$el = $(el);
|
|
62
|
-
|
|
63
|
-
if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) {
|
|
64
|
-
$el = swiper.$el.find(el);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return $el;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function toggleEl($el, disabled) {
|
|
72
|
-
const params = swiper.params.navigation;
|
|
73
|
-
|
|
74
|
-
if ($el && $el.length > 0) {
|
|
75
|
-
$el[disabled ? 'addClass' : 'removeClass'](params.disabledClass);
|
|
76
|
-
if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled;
|
|
77
|
-
|
|
78
|
-
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
79
|
-
$el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function update() {
|
|
85
|
-
// Update Navigation Buttons
|
|
86
|
-
if (swiper.params.loop) return;
|
|
87
|
-
const {
|
|
88
|
-
$nextEl,
|
|
89
|
-
$prevEl
|
|
90
|
-
} = swiper.navigation;
|
|
91
|
-
toggleEl($prevEl, swiper.isBeginning && !swiper.params.rewind);
|
|
92
|
-
toggleEl($nextEl, swiper.isEnd && !swiper.params.rewind);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function onPrevClick(e) {
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;
|
|
98
|
-
swiper.slidePrev();
|
|
99
|
-
emit('navigationPrev');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function onNextClick(e) {
|
|
103
|
-
e.preventDefault();
|
|
104
|
-
if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;
|
|
105
|
-
swiper.slideNext();
|
|
106
|
-
emit('navigationNext');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function init() {
|
|
110
|
-
const params = swiper.params.navigation;
|
|
111
|
-
swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
|
|
112
|
-
nextEl: 'swiper-button-next',
|
|
113
|
-
prevEl: 'swiper-button-prev'
|
|
114
|
-
});
|
|
115
|
-
if (!(params.nextEl || params.prevEl)) return;
|
|
116
|
-
const $nextEl = getEl(params.nextEl);
|
|
117
|
-
const $prevEl = getEl(params.prevEl);
|
|
118
|
-
|
|
119
|
-
if ($nextEl && $nextEl.length > 0) {
|
|
120
|
-
$nextEl.on('click', onNextClick);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if ($prevEl && $prevEl.length > 0) {
|
|
124
|
-
$prevEl.on('click', onPrevClick);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
Object.assign(swiper.navigation, {
|
|
128
|
-
$nextEl,
|
|
129
|
-
nextEl: $nextEl && $nextEl[0],
|
|
130
|
-
$prevEl,
|
|
131
|
-
prevEl: $prevEl && $prevEl[0]
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
if (!swiper.enabled) {
|
|
135
|
-
if ($nextEl) $nextEl.addClass(params.lockClass);
|
|
136
|
-
if ($prevEl) $prevEl.addClass(params.lockClass);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function destroy() {
|
|
141
|
-
const {
|
|
142
|
-
$nextEl,
|
|
143
|
-
$prevEl
|
|
144
|
-
} = swiper.navigation;
|
|
145
|
-
|
|
146
|
-
if ($nextEl && $nextEl.length) {
|
|
147
|
-
$nextEl.off('click', onNextClick);
|
|
148
|
-
$nextEl.removeClass(swiper.params.navigation.disabledClass);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if ($prevEl && $prevEl.length) {
|
|
152
|
-
$prevEl.off('click', onPrevClick);
|
|
153
|
-
$prevEl.removeClass(swiper.params.navigation.disabledClass);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
on('init', () => {
|
|
158
|
-
if (swiper.params.navigation.enabled === false) {
|
|
159
|
-
// eslint-disable-next-line
|
|
160
|
-
disable();
|
|
161
|
-
} else {
|
|
162
|
-
init();
|
|
163
|
-
update();
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
on('toEdge fromEdge lock unlock', () => {
|
|
167
|
-
update();
|
|
168
|
-
});
|
|
169
|
-
on('destroy', () => {
|
|
170
|
-
destroy();
|
|
171
|
-
});
|
|
172
|
-
on('enable disable', () => {
|
|
173
|
-
const {
|
|
174
|
-
$nextEl,
|
|
175
|
-
$prevEl
|
|
176
|
-
} = swiper.navigation;
|
|
177
|
-
|
|
178
|
-
if ($nextEl) {
|
|
179
|
-
$nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if ($prevEl) {
|
|
183
|
-
$prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
on('click', (_s, e) => {
|
|
187
|
-
const {
|
|
188
|
-
$nextEl,
|
|
189
|
-
$prevEl
|
|
190
|
-
} = swiper.navigation;
|
|
191
|
-
const targetEl = e.target;
|
|
192
|
-
|
|
193
|
-
if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) {
|
|
194
|
-
if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
|
|
195
|
-
let isHidden;
|
|
196
|
-
|
|
197
|
-
if ($nextEl) {
|
|
198
|
-
isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);
|
|
199
|
-
} else if ($prevEl) {
|
|
200
|
-
isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (isHidden === true) {
|
|
204
|
-
emit('navigationShow');
|
|
205
|
-
} else {
|
|
206
|
-
emit('navigationHide');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if ($nextEl) {
|
|
210
|
-
$nextEl.toggleClass(swiper.params.navigation.hiddenClass);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if ($prevEl) {
|
|
214
|
-
$prevEl.toggleClass(swiper.params.navigation.hiddenClass);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
const enable = () => {
|
|
220
|
-
swiper.$el.removeClass(swiper.params.navigation.navigationDisabledClass);
|
|
221
|
-
init();
|
|
222
|
-
update();
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
const disable = () => {
|
|
226
|
-
swiper.$el.addClass(swiper.params.navigation.navigationDisabledClass);
|
|
227
|
-
destroy();
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
Object.assign(swiper.navigation, {
|
|
231
|
-
enable,
|
|
232
|
-
disable,
|
|
233
|
-
update,
|
|
234
|
-
init,
|
|
235
|
-
destroy
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function classesToSelector(classes) {
|
|
240
|
-
if (classes === void 0) {
|
|
241
|
-
classes = '';
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return `.${classes.trim().replace(/([\.:!\/])/g, '\\$1') // eslint-disable-line
|
|
245
|
-
.replace(/ /g, '.')}`;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function Pagination(_ref) {
|
|
249
|
-
let {
|
|
250
|
-
swiper,
|
|
251
|
-
extendParams,
|
|
252
|
-
on,
|
|
253
|
-
emit
|
|
254
|
-
} = _ref;
|
|
255
|
-
const pfx = 'swiper-pagination';
|
|
256
|
-
extendParams({
|
|
257
|
-
pagination: {
|
|
258
|
-
el: null,
|
|
259
|
-
bulletElement: 'span',
|
|
260
|
-
clickable: false,
|
|
261
|
-
hideOnClick: false,
|
|
262
|
-
renderBullet: null,
|
|
263
|
-
renderProgressbar: null,
|
|
264
|
-
renderFraction: null,
|
|
265
|
-
renderCustom: null,
|
|
266
|
-
progressbarOpposite: false,
|
|
267
|
-
type: 'bullets',
|
|
268
|
-
// 'bullets' or 'progressbar' or 'fraction' or 'custom'
|
|
269
|
-
dynamicBullets: false,
|
|
270
|
-
dynamicMainBullets: 1,
|
|
271
|
-
formatFractionCurrent: number => number,
|
|
272
|
-
formatFractionTotal: number => number,
|
|
273
|
-
bulletClass: `${pfx}-bullet`,
|
|
274
|
-
bulletActiveClass: `${pfx}-bullet-active`,
|
|
275
|
-
modifierClass: `${pfx}-`,
|
|
276
|
-
currentClass: `${pfx}-current`,
|
|
277
|
-
totalClass: `${pfx}-total`,
|
|
278
|
-
hiddenClass: `${pfx}-hidden`,
|
|
279
|
-
progressbarFillClass: `${pfx}-progressbar-fill`,
|
|
280
|
-
progressbarOppositeClass: `${pfx}-progressbar-opposite`,
|
|
281
|
-
clickableClass: `${pfx}-clickable`,
|
|
282
|
-
lockClass: `${pfx}-lock`,
|
|
283
|
-
horizontalClass: `${pfx}-horizontal`,
|
|
284
|
-
verticalClass: `${pfx}-vertical`,
|
|
285
|
-
paginationDisabledClass: `${pfx}-disabled`
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
swiper.pagination = {
|
|
289
|
-
el: null,
|
|
290
|
-
$el: null,
|
|
291
|
-
bullets: []
|
|
292
|
-
};
|
|
293
|
-
let bulletSize;
|
|
294
|
-
let dynamicBulletIndex = 0;
|
|
295
|
-
|
|
296
|
-
function isPaginationDisabled() {
|
|
297
|
-
return !swiper.params.pagination.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function setSideBullets($bulletEl, position) {
|
|
301
|
-
const {
|
|
302
|
-
bulletActiveClass
|
|
303
|
-
} = swiper.params.pagination;
|
|
304
|
-
$bulletEl[position]().addClass(`${bulletActiveClass}-${position}`)[position]().addClass(`${bulletActiveClass}-${position}-${position}`);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function update() {
|
|
308
|
-
// Render || Update Pagination bullets/items
|
|
309
|
-
const rtl = swiper.rtl;
|
|
310
|
-
const params = swiper.params.pagination;
|
|
311
|
-
if (isPaginationDisabled()) return;
|
|
312
|
-
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
313
|
-
const $el = swiper.pagination.$el; // Current/Total
|
|
314
|
-
|
|
315
|
-
let current;
|
|
316
|
-
const total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
317
|
-
|
|
318
|
-
if (swiper.params.loop) {
|
|
319
|
-
current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup);
|
|
320
|
-
|
|
321
|
-
if (current > slidesLength - 1 - swiper.loopedSlides * 2) {
|
|
322
|
-
current -= slidesLength - swiper.loopedSlides * 2;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (current > total - 1) current -= total;
|
|
326
|
-
if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current;
|
|
327
|
-
} else if (typeof swiper.snapIndex !== 'undefined') {
|
|
328
|
-
current = swiper.snapIndex;
|
|
329
|
-
} else {
|
|
330
|
-
current = swiper.activeIndex || 0;
|
|
331
|
-
} // Types
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
|
|
335
|
-
const bullets = swiper.pagination.bullets;
|
|
336
|
-
let firstIndex;
|
|
337
|
-
let lastIndex;
|
|
338
|
-
let midIndex;
|
|
339
|
-
|
|
340
|
-
if (params.dynamicBullets) {
|
|
341
|
-
bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true);
|
|
342
|
-
$el.css(swiper.isHorizontal() ? 'width' : 'height', `${bulletSize * (params.dynamicMainBullets + 4)}px`);
|
|
343
|
-
|
|
344
|
-
if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) {
|
|
345
|
-
dynamicBulletIndex += current - (swiper.previousIndex - swiper.loopedSlides || 0);
|
|
346
|
-
|
|
347
|
-
if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
|
|
348
|
-
dynamicBulletIndex = params.dynamicMainBullets - 1;
|
|
349
|
-
} else if (dynamicBulletIndex < 0) {
|
|
350
|
-
dynamicBulletIndex = 0;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
firstIndex = Math.max(current - dynamicBulletIndex, 0);
|
|
355
|
-
lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
|
|
356
|
-
midIndex = (lastIndex + firstIndex) / 2;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
bullets.removeClass(['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`).join(' '));
|
|
360
|
-
|
|
361
|
-
if ($el.length > 1) {
|
|
362
|
-
bullets.each(bullet => {
|
|
363
|
-
const $bullet = $(bullet);
|
|
364
|
-
const bulletIndex = $bullet.index();
|
|
365
|
-
|
|
366
|
-
if (bulletIndex === current) {
|
|
367
|
-
$bullet.addClass(params.bulletActiveClass);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
if (params.dynamicBullets) {
|
|
371
|
-
if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
|
|
372
|
-
$bullet.addClass(`${params.bulletActiveClass}-main`);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
if (bulletIndex === firstIndex) {
|
|
376
|
-
setSideBullets($bullet, 'prev');
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
if (bulletIndex === lastIndex) {
|
|
380
|
-
setSideBullets($bullet, 'next');
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
} else {
|
|
385
|
-
const $bullet = bullets.eq(current);
|
|
386
|
-
const bulletIndex = $bullet.index();
|
|
387
|
-
$bullet.addClass(params.bulletActiveClass);
|
|
388
|
-
|
|
389
|
-
if (params.dynamicBullets) {
|
|
390
|
-
const $firstDisplayedBullet = bullets.eq(firstIndex);
|
|
391
|
-
const $lastDisplayedBullet = bullets.eq(lastIndex);
|
|
392
|
-
|
|
393
|
-
for (let i = firstIndex; i <= lastIndex; i += 1) {
|
|
394
|
-
bullets.eq(i).addClass(`${params.bulletActiveClass}-main`);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
if (swiper.params.loop) {
|
|
398
|
-
if (bulletIndex >= bullets.length) {
|
|
399
|
-
for (let i = params.dynamicMainBullets; i >= 0; i -= 1) {
|
|
400
|
-
bullets.eq(bullets.length - i).addClass(`${params.bulletActiveClass}-main`);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(`${params.bulletActiveClass}-prev`);
|
|
404
|
-
} else {
|
|
405
|
-
setSideBullets($firstDisplayedBullet, 'prev');
|
|
406
|
-
setSideBullets($lastDisplayedBullet, 'next');
|
|
407
|
-
}
|
|
408
|
-
} else {
|
|
409
|
-
setSideBullets($firstDisplayedBullet, 'prev');
|
|
410
|
-
setSideBullets($lastDisplayedBullet, 'next');
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (params.dynamicBullets) {
|
|
416
|
-
const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
|
|
417
|
-
const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
|
|
418
|
-
const offsetProp = rtl ? 'right' : 'left';
|
|
419
|
-
bullets.css(swiper.isHorizontal() ? offsetProp : 'top', `${bulletsOffset}px`);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
if (params.type === 'fraction') {
|
|
424
|
-
$el.find(classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1));
|
|
425
|
-
$el.find(classesToSelector(params.totalClass)).text(params.formatFractionTotal(total));
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
if (params.type === 'progressbar') {
|
|
429
|
-
let progressbarDirection;
|
|
430
|
-
|
|
431
|
-
if (params.progressbarOpposite) {
|
|
432
|
-
progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
|
|
433
|
-
} else {
|
|
434
|
-
progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
const scale = (current + 1) / total;
|
|
438
|
-
let scaleX = 1;
|
|
439
|
-
let scaleY = 1;
|
|
440
|
-
|
|
441
|
-
if (progressbarDirection === 'horizontal') {
|
|
442
|
-
scaleX = scale;
|
|
443
|
-
} else {
|
|
444
|
-
scaleY = scale;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
$el.find(classesToSelector(params.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`).transition(swiper.params.speed);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (params.type === 'custom' && params.renderCustom) {
|
|
451
|
-
$el.html(params.renderCustom(swiper, current + 1, total));
|
|
452
|
-
emit('paginationRender', $el[0]);
|
|
453
|
-
} else {
|
|
454
|
-
emit('paginationUpdate', $el[0]);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
458
|
-
$el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
function render() {
|
|
463
|
-
// Render Container
|
|
464
|
-
const params = swiper.params.pagination;
|
|
465
|
-
if (isPaginationDisabled()) return;
|
|
466
|
-
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
467
|
-
const $el = swiper.pagination.$el;
|
|
468
|
-
let paginationHTML = '';
|
|
469
|
-
|
|
470
|
-
if (params.type === 'bullets') {
|
|
471
|
-
let numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
472
|
-
|
|
473
|
-
if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.loop && numberOfBullets > slidesLength) {
|
|
474
|
-
numberOfBullets = slidesLength;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
for (let i = 0; i < numberOfBullets; i += 1) {
|
|
478
|
-
if (params.renderBullet) {
|
|
479
|
-
paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
|
|
480
|
-
} else {
|
|
481
|
-
paginationHTML += `<${params.bulletElement} class="${params.bulletClass}"></${params.bulletElement}>`;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
$el.html(paginationHTML);
|
|
486
|
-
swiper.pagination.bullets = $el.find(classesToSelector(params.bulletClass));
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
if (params.type === 'fraction') {
|
|
490
|
-
if (params.renderFraction) {
|
|
491
|
-
paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
|
|
492
|
-
} else {
|
|
493
|
-
paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
$el.html(paginationHTML);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
if (params.type === 'progressbar') {
|
|
500
|
-
if (params.renderProgressbar) {
|
|
501
|
-
paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
|
|
502
|
-
} else {
|
|
503
|
-
paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
$el.html(paginationHTML);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
if (params.type !== 'custom') {
|
|
510
|
-
emit('paginationRender', swiper.pagination.$el[0]);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
function init() {
|
|
515
|
-
swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
|
|
516
|
-
el: 'swiper-pagination'
|
|
517
|
-
});
|
|
518
|
-
const params = swiper.params.pagination;
|
|
519
|
-
if (!params.el) return;
|
|
520
|
-
let $el = $(params.el);
|
|
521
|
-
if ($el.length === 0) return;
|
|
522
|
-
|
|
523
|
-
if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) {
|
|
524
|
-
$el = swiper.$el.find(params.el); // check if it belongs to another nested Swiper
|
|
525
|
-
|
|
526
|
-
if ($el.length > 1) {
|
|
527
|
-
$el = $el.filter(el => {
|
|
528
|
-
if ($(el).parents('.swiper')[0] !== swiper.el) return false;
|
|
529
|
-
return true;
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
if (params.type === 'bullets' && params.clickable) {
|
|
535
|
-
$el.addClass(params.clickableClass);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
$el.addClass(params.modifierClass + params.type);
|
|
539
|
-
$el.addClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
540
|
-
|
|
541
|
-
if (params.type === 'bullets' && params.dynamicBullets) {
|
|
542
|
-
$el.addClass(`${params.modifierClass}${params.type}-dynamic`);
|
|
543
|
-
dynamicBulletIndex = 0;
|
|
544
|
-
|
|
545
|
-
if (params.dynamicMainBullets < 1) {
|
|
546
|
-
params.dynamicMainBullets = 1;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
if (params.type === 'progressbar' && params.progressbarOpposite) {
|
|
551
|
-
$el.addClass(params.progressbarOppositeClass);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
if (params.clickable) {
|
|
555
|
-
$el.on('click', classesToSelector(params.bulletClass), function onClick(e) {
|
|
556
|
-
e.preventDefault();
|
|
557
|
-
let index = $(this).index() * swiper.params.slidesPerGroup;
|
|
558
|
-
if (swiper.params.loop) index += swiper.loopedSlides;
|
|
559
|
-
swiper.slideTo(index);
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
Object.assign(swiper.pagination, {
|
|
564
|
-
$el,
|
|
565
|
-
el: $el[0]
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
if (!swiper.enabled) {
|
|
569
|
-
$el.addClass(params.lockClass);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
function destroy() {
|
|
574
|
-
const params = swiper.params.pagination;
|
|
575
|
-
if (isPaginationDisabled()) return;
|
|
576
|
-
const $el = swiper.pagination.$el;
|
|
577
|
-
$el.removeClass(params.hiddenClass);
|
|
578
|
-
$el.removeClass(params.modifierClass + params.type);
|
|
579
|
-
$el.removeClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
580
|
-
if (swiper.pagination.bullets && swiper.pagination.bullets.removeClass) swiper.pagination.bullets.removeClass(params.bulletActiveClass);
|
|
581
|
-
|
|
582
|
-
if (params.clickable) {
|
|
583
|
-
$el.off('click', classesToSelector(params.bulletClass));
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
on('init', () => {
|
|
588
|
-
if (swiper.params.pagination.enabled === false) {
|
|
589
|
-
// eslint-disable-next-line
|
|
590
|
-
disable();
|
|
591
|
-
} else {
|
|
592
|
-
init();
|
|
593
|
-
render();
|
|
594
|
-
update();
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
on('activeIndexChange', () => {
|
|
598
|
-
if (swiper.params.loop) {
|
|
599
|
-
update();
|
|
600
|
-
} else if (typeof swiper.snapIndex === 'undefined') {
|
|
601
|
-
update();
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
on('snapIndexChange', () => {
|
|
605
|
-
if (!swiper.params.loop) {
|
|
606
|
-
update();
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
on('slidesLengthChange', () => {
|
|
610
|
-
if (swiper.params.loop) {
|
|
611
|
-
render();
|
|
612
|
-
update();
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
on('snapGridLengthChange', () => {
|
|
616
|
-
if (!swiper.params.loop) {
|
|
617
|
-
render();
|
|
618
|
-
update();
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
on('destroy', () => {
|
|
622
|
-
destroy();
|
|
623
|
-
});
|
|
624
|
-
on('enable disable', () => {
|
|
625
|
-
const {
|
|
626
|
-
$el
|
|
627
|
-
} = swiper.pagination;
|
|
628
|
-
|
|
629
|
-
if ($el) {
|
|
630
|
-
$el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.pagination.lockClass);
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
on('lock unlock', () => {
|
|
634
|
-
update();
|
|
635
|
-
});
|
|
636
|
-
on('click', (_s, e) => {
|
|
637
|
-
const targetEl = e.target;
|
|
638
|
-
const {
|
|
639
|
-
$el
|
|
640
|
-
} = swiper.pagination;
|
|
641
|
-
|
|
642
|
-
if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && $el && $el.length > 0 && !$(targetEl).hasClass(swiper.params.pagination.bulletClass)) {
|
|
643
|
-
if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
|
|
644
|
-
const isHidden = $el.hasClass(swiper.params.pagination.hiddenClass);
|
|
645
|
-
|
|
646
|
-
if (isHidden === true) {
|
|
647
|
-
emit('paginationShow');
|
|
648
|
-
} else {
|
|
649
|
-
emit('paginationHide');
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
$el.toggleClass(swiper.params.pagination.hiddenClass);
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
const enable = () => {
|
|
657
|
-
swiper.$el.removeClass(swiper.params.pagination.paginationDisabledClass);
|
|
658
|
-
|
|
659
|
-
if (swiper.pagination.$el) {
|
|
660
|
-
swiper.pagination.$el.removeClass(swiper.params.pagination.paginationDisabledClass);
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
init();
|
|
664
|
-
render();
|
|
665
|
-
update();
|
|
666
|
-
};
|
|
667
|
-
|
|
668
|
-
const disable = () => {
|
|
669
|
-
swiper.$el.addClass(swiper.params.pagination.paginationDisabledClass);
|
|
670
|
-
|
|
671
|
-
if (swiper.pagination.$el) {
|
|
672
|
-
swiper.pagination.$el.addClass(swiper.params.pagination.paginationDisabledClass);
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
destroy();
|
|
676
|
-
};
|
|
677
|
-
|
|
678
|
-
Object.assign(swiper.pagination, {
|
|
679
|
-
enable,
|
|
680
|
-
disable,
|
|
681
|
-
render,
|
|
682
|
-
update,
|
|
683
|
-
init,
|
|
684
|
-
destroy
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
function Parallax(_ref) {
|
|
689
|
-
let {
|
|
690
|
-
swiper,
|
|
691
|
-
extendParams,
|
|
692
|
-
on
|
|
693
|
-
} = _ref;
|
|
694
|
-
extendParams({
|
|
695
|
-
parallax: {
|
|
696
|
-
enabled: false
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
const setTransform = (el, progress) => {
|
|
701
|
-
const {
|
|
702
|
-
rtl
|
|
703
|
-
} = swiper;
|
|
704
|
-
const $el = $(el);
|
|
705
|
-
const rtlFactor = rtl ? -1 : 1;
|
|
706
|
-
const p = $el.attr('data-swiper-parallax') || '0';
|
|
707
|
-
let x = $el.attr('data-swiper-parallax-x');
|
|
708
|
-
let y = $el.attr('data-swiper-parallax-y');
|
|
709
|
-
const scale = $el.attr('data-swiper-parallax-scale');
|
|
710
|
-
const opacity = $el.attr('data-swiper-parallax-opacity');
|
|
711
|
-
|
|
712
|
-
if (x || y) {
|
|
713
|
-
x = x || '0';
|
|
714
|
-
y = y || '0';
|
|
715
|
-
} else if (swiper.isHorizontal()) {
|
|
716
|
-
x = p;
|
|
717
|
-
y = '0';
|
|
718
|
-
} else {
|
|
719
|
-
y = p;
|
|
720
|
-
x = '0';
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
if (x.indexOf('%') >= 0) {
|
|
724
|
-
x = `${parseInt(x, 10) * progress * rtlFactor}%`;
|
|
725
|
-
} else {
|
|
726
|
-
x = `${x * progress * rtlFactor}px`;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
if (y.indexOf('%') >= 0) {
|
|
730
|
-
y = `${parseInt(y, 10) * progress}%`;
|
|
731
|
-
} else {
|
|
732
|
-
y = `${y * progress}px`;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
if (typeof opacity !== 'undefined' && opacity !== null) {
|
|
736
|
-
const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress));
|
|
737
|
-
$el[0].style.opacity = currentOpacity;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
if (typeof scale === 'undefined' || scale === null) {
|
|
741
|
-
$el.transform(`translate3d(${x}, ${y}, 0px)`);
|
|
742
|
-
} else {
|
|
743
|
-
const currentScale = scale - (scale - 1) * (1 - Math.abs(progress));
|
|
744
|
-
$el.transform(`translate3d(${x}, ${y}, 0px) scale(${currentScale})`);
|
|
745
|
-
}
|
|
746
|
-
};
|
|
747
|
-
|
|
748
|
-
const setTranslate = () => {
|
|
749
|
-
const {
|
|
750
|
-
$el,
|
|
751
|
-
slides,
|
|
752
|
-
progress,
|
|
753
|
-
snapGrid
|
|
754
|
-
} = swiper;
|
|
755
|
-
$el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(el => {
|
|
756
|
-
setTransform(el, progress);
|
|
757
|
-
});
|
|
758
|
-
slides.each((slideEl, slideIndex) => {
|
|
759
|
-
let slideProgress = slideEl.progress;
|
|
760
|
-
|
|
761
|
-
if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') {
|
|
762
|
-
slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1);
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
slideProgress = Math.min(Math.max(slideProgress, -1), 1);
|
|
766
|
-
$(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(el => {
|
|
767
|
-
setTransform(el, slideProgress);
|
|
768
|
-
});
|
|
769
|
-
});
|
|
770
|
-
};
|
|
771
|
-
|
|
772
|
-
const setTransition = function (duration) {
|
|
773
|
-
if (duration === void 0) {
|
|
774
|
-
duration = swiper.params.speed;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
const {
|
|
778
|
-
$el
|
|
779
|
-
} = swiper;
|
|
780
|
-
$el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(parallaxEl => {
|
|
781
|
-
const $parallaxEl = $(parallaxEl);
|
|
782
|
-
let parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration;
|
|
783
|
-
if (duration === 0) parallaxDuration = 0;
|
|
784
|
-
$parallaxEl.transition(parallaxDuration);
|
|
785
|
-
});
|
|
786
|
-
};
|
|
787
|
-
|
|
788
|
-
on('beforeInit', () => {
|
|
789
|
-
if (!swiper.params.parallax.enabled) return;
|
|
790
|
-
swiper.params.watchSlidesProgress = true;
|
|
791
|
-
swiper.originalParams.watchSlidesProgress = true;
|
|
792
|
-
});
|
|
793
|
-
on('init', () => {
|
|
794
|
-
if (!swiper.params.parallax.enabled) return;
|
|
795
|
-
setTranslate();
|
|
796
|
-
});
|
|
797
|
-
on('setTranslate', () => {
|
|
798
|
-
if (!swiper.params.parallax.enabled) return;
|
|
799
|
-
setTranslate();
|
|
800
|
-
});
|
|
801
|
-
on('setTransition', (_swiper, duration) => {
|
|
802
|
-
if (!swiper.params.parallax.enabled) return;
|
|
803
|
-
setTransition(duration);
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
function Lazy(_ref) {
|
|
808
|
-
let {
|
|
809
|
-
swiper,
|
|
810
|
-
extendParams,
|
|
811
|
-
on,
|
|
812
|
-
emit
|
|
813
|
-
} = _ref;
|
|
814
|
-
extendParams({
|
|
815
|
-
lazy: {
|
|
816
|
-
checkInView: false,
|
|
817
|
-
enabled: false,
|
|
818
|
-
loadPrevNext: false,
|
|
819
|
-
loadPrevNextAmount: 1,
|
|
820
|
-
loadOnTransitionStart: false,
|
|
821
|
-
scrollingElement: '',
|
|
822
|
-
elementClass: 'swiper-lazy',
|
|
823
|
-
loadingClass: 'swiper-lazy-loading',
|
|
824
|
-
loadedClass: 'swiper-lazy-loaded',
|
|
825
|
-
preloaderClass: 'swiper-lazy-preloader'
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
swiper.lazy = {};
|
|
829
|
-
let scrollHandlerAttached = false;
|
|
830
|
-
let initialImageLoaded = false;
|
|
831
|
-
|
|
832
|
-
function loadInSlide(index, loadInDuplicate) {
|
|
833
|
-
if (loadInDuplicate === void 0) {
|
|
834
|
-
loadInDuplicate = true;
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
const params = swiper.params.lazy;
|
|
838
|
-
if (typeof index === 'undefined') return;
|
|
839
|
-
if (swiper.slides.length === 0) return;
|
|
840
|
-
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
841
|
-
const $slideEl = isVirtual ? swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-swiper-slide-index="${index}"]`) : swiper.slides.eq(index);
|
|
842
|
-
const $images = $slideEl.find(`.${params.elementClass}:not(.${params.loadedClass}):not(.${params.loadingClass})`);
|
|
843
|
-
|
|
844
|
-
if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) {
|
|
845
|
-
$images.push($slideEl[0]);
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
if ($images.length === 0) return;
|
|
849
|
-
$images.each(imageEl => {
|
|
850
|
-
const $imageEl = $(imageEl);
|
|
851
|
-
$imageEl.addClass(params.loadingClass);
|
|
852
|
-
const background = $imageEl.attr('data-background');
|
|
853
|
-
const src = $imageEl.attr('data-src');
|
|
854
|
-
const srcset = $imageEl.attr('data-srcset');
|
|
855
|
-
const sizes = $imageEl.attr('data-sizes');
|
|
856
|
-
const $pictureEl = $imageEl.parent('picture');
|
|
857
|
-
swiper.loadImage($imageEl[0], src || background, srcset, sizes, false, () => {
|
|
858
|
-
if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper && !swiper.params || swiper.destroyed) return;
|
|
859
|
-
|
|
860
|
-
if (background) {
|
|
861
|
-
$imageEl.css('background-image', `url("${background}")`);
|
|
862
|
-
$imageEl.removeAttr('data-background');
|
|
863
|
-
} else {
|
|
864
|
-
if (srcset) {
|
|
865
|
-
$imageEl.attr('srcset', srcset);
|
|
866
|
-
$imageEl.removeAttr('data-srcset');
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
if (sizes) {
|
|
870
|
-
$imageEl.attr('sizes', sizes);
|
|
871
|
-
$imageEl.removeAttr('data-sizes');
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
if ($pictureEl.length) {
|
|
875
|
-
$pictureEl.children('source').each(sourceEl => {
|
|
876
|
-
const $source = $(sourceEl);
|
|
877
|
-
|
|
878
|
-
if ($source.attr('data-srcset')) {
|
|
879
|
-
$source.attr('srcset', $source.attr('data-srcset'));
|
|
880
|
-
$source.removeAttr('data-srcset');
|
|
881
|
-
}
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
if (src) {
|
|
886
|
-
$imageEl.attr('src', src);
|
|
887
|
-
$imageEl.removeAttr('data-src');
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
$imageEl.addClass(params.loadedClass).removeClass(params.loadingClass);
|
|
892
|
-
$slideEl.find(`.${params.preloaderClass}`).remove();
|
|
893
|
-
|
|
894
|
-
if (swiper.params.loop && loadInDuplicate) {
|
|
895
|
-
const slideOriginalIndex = $slideEl.attr('data-swiper-slide-index');
|
|
896
|
-
|
|
897
|
-
if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) {
|
|
898
|
-
const originalSlide = swiper.$wrapperEl.children(`[data-swiper-slide-index="${slideOriginalIndex}"]:not(.${swiper.params.slideDuplicateClass})`);
|
|
899
|
-
loadInSlide(originalSlide.index(), false);
|
|
900
|
-
} else {
|
|
901
|
-
const duplicatedSlide = swiper.$wrapperEl.children(`.${swiper.params.slideDuplicateClass}[data-swiper-slide-index="${slideOriginalIndex}"]`);
|
|
902
|
-
loadInSlide(duplicatedSlide.index(), false);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
emit('lazyImageReady', $slideEl[0], $imageEl[0]);
|
|
907
|
-
|
|
908
|
-
if (swiper.params.autoHeight) {
|
|
909
|
-
swiper.updateAutoHeight();
|
|
910
|
-
}
|
|
911
|
-
});
|
|
912
|
-
emit('lazyImageLoad', $slideEl[0], $imageEl[0]);
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
function load() {
|
|
917
|
-
const {
|
|
918
|
-
$wrapperEl,
|
|
919
|
-
params: swiperParams,
|
|
920
|
-
slides,
|
|
921
|
-
activeIndex
|
|
922
|
-
} = swiper;
|
|
923
|
-
const isVirtual = swiper.virtual && swiperParams.virtual.enabled;
|
|
924
|
-
const params = swiperParams.lazy;
|
|
925
|
-
let slidesPerView = swiperParams.slidesPerView;
|
|
926
|
-
|
|
927
|
-
if (slidesPerView === 'auto') {
|
|
928
|
-
slidesPerView = 0;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
function slideExist(index) {
|
|
932
|
-
if (isVirtual) {
|
|
933
|
-
if ($wrapperEl.children(`.${swiperParams.slideClass}[data-swiper-slide-index="${index}"]`).length) {
|
|
934
|
-
return true;
|
|
935
|
-
}
|
|
936
|
-
} else if (slides[index]) return true;
|
|
937
|
-
|
|
938
|
-
return false;
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
function slideIndex(slideEl) {
|
|
942
|
-
if (isVirtual) {
|
|
943
|
-
return $(slideEl).attr('data-swiper-slide-index');
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
return $(slideEl).index();
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
if (!initialImageLoaded) initialImageLoaded = true;
|
|
950
|
-
|
|
951
|
-
if (swiper.params.watchSlidesProgress) {
|
|
952
|
-
$wrapperEl.children(`.${swiperParams.slideVisibleClass}`).each(slideEl => {
|
|
953
|
-
const index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index();
|
|
954
|
-
loadInSlide(index);
|
|
955
|
-
});
|
|
956
|
-
} else if (slidesPerView > 1) {
|
|
957
|
-
for (let i = activeIndex; i < activeIndex + slidesPerView; i += 1) {
|
|
958
|
-
if (slideExist(i)) loadInSlide(i);
|
|
959
|
-
}
|
|
960
|
-
} else {
|
|
961
|
-
loadInSlide(activeIndex);
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
if (params.loadPrevNext) {
|
|
965
|
-
if (slidesPerView > 1 || params.loadPrevNextAmount && params.loadPrevNextAmount > 1) {
|
|
966
|
-
const amount = params.loadPrevNextAmount;
|
|
967
|
-
const spv = Math.ceil(slidesPerView);
|
|
968
|
-
const maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length);
|
|
969
|
-
const minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); // Next Slides
|
|
970
|
-
|
|
971
|
-
for (let i = activeIndex + spv; i < maxIndex; i += 1) {
|
|
972
|
-
if (slideExist(i)) loadInSlide(i);
|
|
973
|
-
} // Prev Slides
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
for (let i = minIndex; i < activeIndex; i += 1) {
|
|
977
|
-
if (slideExist(i)) loadInSlide(i);
|
|
978
|
-
}
|
|
979
|
-
} else {
|
|
980
|
-
const nextSlide = $wrapperEl.children(`.${swiperParams.slideNextClass}`);
|
|
981
|
-
if (nextSlide.length > 0) loadInSlide(slideIndex(nextSlide));
|
|
982
|
-
const prevSlide = $wrapperEl.children(`.${swiperParams.slidePrevClass}`);
|
|
983
|
-
if (prevSlide.length > 0) loadInSlide(slideIndex(prevSlide));
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
function checkInViewOnLoad() {
|
|
989
|
-
const window = getWindow();
|
|
990
|
-
if (!swiper || swiper.destroyed) return;
|
|
991
|
-
const $scrollElement = swiper.params.lazy.scrollingElement ? $(swiper.params.lazy.scrollingElement) : $(window);
|
|
992
|
-
const isWindow = $scrollElement[0] === window;
|
|
993
|
-
const scrollElementWidth = isWindow ? window.innerWidth : $scrollElement[0].offsetWidth;
|
|
994
|
-
const scrollElementHeight = isWindow ? window.innerHeight : $scrollElement[0].offsetHeight;
|
|
995
|
-
const swiperOffset = swiper.$el.offset();
|
|
996
|
-
const {
|
|
997
|
-
rtlTranslate: rtl
|
|
998
|
-
} = swiper;
|
|
999
|
-
let inView = false;
|
|
1000
|
-
if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft;
|
|
1001
|
-
const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiper.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiper.height], [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height]];
|
|
1002
|
-
|
|
1003
|
-
for (let i = 0; i < swiperCoord.length; i += 1) {
|
|
1004
|
-
const point = swiperCoord[i];
|
|
1005
|
-
|
|
1006
|
-
if (point[0] >= 0 && point[0] <= scrollElementWidth && point[1] >= 0 && point[1] <= scrollElementHeight) {
|
|
1007
|
-
if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
|
|
1008
|
-
|
|
1009
|
-
inView = true;
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
const passiveListener = swiper.touchEvents.start === 'touchstart' && swiper.support.passiveListener && swiper.params.passiveListeners ? {
|
|
1014
|
-
passive: true,
|
|
1015
|
-
capture: false
|
|
1016
|
-
} : false;
|
|
1017
|
-
|
|
1018
|
-
if (inView) {
|
|
1019
|
-
load();
|
|
1020
|
-
$scrollElement.off('scroll', checkInViewOnLoad, passiveListener);
|
|
1021
|
-
} else if (!scrollHandlerAttached) {
|
|
1022
|
-
scrollHandlerAttached = true;
|
|
1023
|
-
$scrollElement.on('scroll', checkInViewOnLoad, passiveListener);
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
on('beforeInit', () => {
|
|
1028
|
-
if (swiper.params.lazy.enabled && swiper.params.preloadImages) {
|
|
1029
|
-
swiper.params.preloadImages = false;
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1032
|
-
on('init', () => {
|
|
1033
|
-
if (swiper.params.lazy.enabled) {
|
|
1034
|
-
if (swiper.params.lazy.checkInView) {
|
|
1035
|
-
checkInViewOnLoad();
|
|
1036
|
-
} else {
|
|
1037
|
-
load();
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
});
|
|
1041
|
-
on('scroll', () => {
|
|
1042
|
-
if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.freeMode.sticky) {
|
|
1043
|
-
load();
|
|
1044
|
-
}
|
|
1045
|
-
});
|
|
1046
|
-
on('scrollbarDragMove resize _freeModeNoMomentumRelease', () => {
|
|
1047
|
-
if (swiper.params.lazy.enabled) {
|
|
1048
|
-
if (swiper.params.lazy.checkInView) {
|
|
1049
|
-
checkInViewOnLoad();
|
|
1050
|
-
} else {
|
|
1051
|
-
load();
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
});
|
|
1055
|
-
on('transitionStart', () => {
|
|
1056
|
-
if (swiper.params.lazy.enabled) {
|
|
1057
|
-
if (swiper.params.lazy.loadOnTransitionStart || !swiper.params.lazy.loadOnTransitionStart && !initialImageLoaded) {
|
|
1058
|
-
if (swiper.params.lazy.checkInView) {
|
|
1059
|
-
checkInViewOnLoad();
|
|
1060
|
-
} else {
|
|
1061
|
-
load();
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
});
|
|
1066
|
-
on('transitionEnd', () => {
|
|
1067
|
-
if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) {
|
|
1068
|
-
if (swiper.params.lazy.checkInView) {
|
|
1069
|
-
checkInViewOnLoad();
|
|
1070
|
-
} else {
|
|
1071
|
-
load();
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
1075
|
-
on('slideChange', () => {
|
|
1076
|
-
const {
|
|
1077
|
-
lazy,
|
|
1078
|
-
cssMode,
|
|
1079
|
-
watchSlidesProgress,
|
|
1080
|
-
touchReleaseOnEdges,
|
|
1081
|
-
resistanceRatio
|
|
1082
|
-
} = swiper.params;
|
|
1083
|
-
|
|
1084
|
-
if (lazy.enabled && (cssMode || watchSlidesProgress && (touchReleaseOnEdges || resistanceRatio === 0))) {
|
|
1085
|
-
load();
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
on('destroy', () => {
|
|
1089
|
-
if (!swiper.$el) return;
|
|
1090
|
-
swiper.$el.find(`.${swiper.params.lazy.loadingClass}`).removeClass(swiper.params.lazy.loadingClass);
|
|
1091
|
-
});
|
|
1092
|
-
Object.assign(swiper.lazy, {
|
|
1093
|
-
load,
|
|
1094
|
-
loadInSlide
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
/* eslint no-bitwise: ["error", { "allow": [">>"] }] */
|
|
1099
|
-
function Controller(_ref) {
|
|
1100
|
-
let {
|
|
1101
|
-
swiper,
|
|
1102
|
-
extendParams,
|
|
1103
|
-
on
|
|
1104
|
-
} = _ref;
|
|
1105
|
-
extendParams({
|
|
1106
|
-
controller: {
|
|
1107
|
-
control: undefined,
|
|
1108
|
-
inverse: false,
|
|
1109
|
-
by: 'slide' // or 'container'
|
|
1110
|
-
|
|
1111
|
-
}
|
|
1112
|
-
});
|
|
1113
|
-
swiper.controller = {
|
|
1114
|
-
control: undefined
|
|
1115
|
-
};
|
|
1116
|
-
|
|
1117
|
-
function LinearSpline(x, y) {
|
|
1118
|
-
const binarySearch = function search() {
|
|
1119
|
-
let maxIndex;
|
|
1120
|
-
let minIndex;
|
|
1121
|
-
let guess;
|
|
1122
|
-
return (array, val) => {
|
|
1123
|
-
minIndex = -1;
|
|
1124
|
-
maxIndex = array.length;
|
|
1125
|
-
|
|
1126
|
-
while (maxIndex - minIndex > 1) {
|
|
1127
|
-
guess = maxIndex + minIndex >> 1;
|
|
1128
|
-
|
|
1129
|
-
if (array[guess] <= val) {
|
|
1130
|
-
minIndex = guess;
|
|
1131
|
-
} else {
|
|
1132
|
-
maxIndex = guess;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
return maxIndex;
|
|
1137
|
-
};
|
|
1138
|
-
}();
|
|
1139
|
-
|
|
1140
|
-
this.x = x;
|
|
1141
|
-
this.y = y;
|
|
1142
|
-
this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value:
|
|
1143
|
-
// (x1,y1) is the known point before given value,
|
|
1144
|
-
// (x3,y3) is the known point after given value.
|
|
1145
|
-
|
|
1146
|
-
let i1;
|
|
1147
|
-
let i3;
|
|
1148
|
-
|
|
1149
|
-
this.interpolate = function interpolate(x2) {
|
|
1150
|
-
if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2):
|
|
1151
|
-
|
|
1152
|
-
i3 = binarySearch(this.x, x2);
|
|
1153
|
-
i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already:
|
|
1154
|
-
// y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
|
|
1155
|
-
|
|
1156
|
-
return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
|
|
1157
|
-
};
|
|
1158
|
-
|
|
1159
|
-
return this;
|
|
1160
|
-
} // xxx: for now i will just save one spline function to to
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
function getInterpolateFunction(c) {
|
|
1164
|
-
if (!swiper.controller.spline) {
|
|
1165
|
-
swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
function setTranslate(_t, byController) {
|
|
1170
|
-
const controlled = swiper.controller.control;
|
|
1171
|
-
let multiplier;
|
|
1172
|
-
let controlledTranslate;
|
|
1173
|
-
const Swiper = swiper.constructor;
|
|
1174
|
-
|
|
1175
|
-
function setControlledTranslate(c) {
|
|
1176
|
-
// this will create an Interpolate function based on the snapGrids
|
|
1177
|
-
// x is the Grid of the scrolled scroller and y will be the controlled scroller
|
|
1178
|
-
// it makes sense to create this only once and recall it for the interpolation
|
|
1179
|
-
// the function does a lot of value caching for performance
|
|
1180
|
-
const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate;
|
|
1181
|
-
|
|
1182
|
-
if (swiper.params.controller.by === 'slide') {
|
|
1183
|
-
getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
|
|
1184
|
-
// but it did not work out
|
|
1185
|
-
|
|
1186
|
-
controlledTranslate = -swiper.controller.spline.interpolate(-translate);
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
if (!controlledTranslate || swiper.params.controller.by === 'container') {
|
|
1190
|
-
multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
|
|
1191
|
-
controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
if (swiper.params.controller.inverse) {
|
|
1195
|
-
controlledTranslate = c.maxTranslate() - controlledTranslate;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
c.updateProgress(controlledTranslate);
|
|
1199
|
-
c.setTranslate(controlledTranslate, swiper);
|
|
1200
|
-
c.updateActiveIndex();
|
|
1201
|
-
c.updateSlidesClasses();
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
if (Array.isArray(controlled)) {
|
|
1205
|
-
for (let i = 0; i < controlled.length; i += 1) {
|
|
1206
|
-
if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
|
|
1207
|
-
setControlledTranslate(controlled[i]);
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
} else if (controlled instanceof Swiper && byController !== controlled) {
|
|
1211
|
-
setControlledTranslate(controlled);
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
function setTransition(duration, byController) {
|
|
1216
|
-
const Swiper = swiper.constructor;
|
|
1217
|
-
const controlled = swiper.controller.control;
|
|
1218
|
-
let i;
|
|
1219
|
-
|
|
1220
|
-
function setControlledTransition(c) {
|
|
1221
|
-
c.setTransition(duration, swiper);
|
|
1222
|
-
|
|
1223
|
-
if (duration !== 0) {
|
|
1224
|
-
c.transitionStart();
|
|
1225
|
-
|
|
1226
|
-
if (c.params.autoHeight) {
|
|
1227
|
-
nextTick(() => {
|
|
1228
|
-
c.updateAutoHeight();
|
|
1229
|
-
});
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
c.$wrapperEl.transitionEnd(() => {
|
|
1233
|
-
if (!controlled) return;
|
|
1234
|
-
|
|
1235
|
-
if (c.params.loop && swiper.params.controller.by === 'slide') {
|
|
1236
|
-
c.loopFix();
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
c.transitionEnd();
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
if (Array.isArray(controlled)) {
|
|
1245
|
-
for (i = 0; i < controlled.length; i += 1) {
|
|
1246
|
-
if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
|
|
1247
|
-
setControlledTransition(controlled[i]);
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
} else if (controlled instanceof Swiper && byController !== controlled) {
|
|
1251
|
-
setControlledTransition(controlled);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
function removeSpline() {
|
|
1256
|
-
if (!swiper.controller.control) return;
|
|
1257
|
-
|
|
1258
|
-
if (swiper.controller.spline) {
|
|
1259
|
-
swiper.controller.spline = undefined;
|
|
1260
|
-
delete swiper.controller.spline;
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
on('beforeInit', () => {
|
|
1265
|
-
swiper.controller.control = swiper.params.controller.control;
|
|
1266
|
-
});
|
|
1267
|
-
on('update', () => {
|
|
1268
|
-
removeSpline();
|
|
1269
|
-
});
|
|
1270
|
-
on('resize', () => {
|
|
1271
|
-
removeSpline();
|
|
1272
|
-
});
|
|
1273
|
-
on('observerUpdate', () => {
|
|
1274
|
-
removeSpline();
|
|
1275
|
-
});
|
|
1276
|
-
on('setTranslate', (_s, translate, byController) => {
|
|
1277
|
-
if (!swiper.controller.control) return;
|
|
1278
|
-
swiper.controller.setTranslate(translate, byController);
|
|
1279
|
-
});
|
|
1280
|
-
on('setTransition', (_s, duration, byController) => {
|
|
1281
|
-
if (!swiper.controller.control) return;
|
|
1282
|
-
swiper.controller.setTransition(duration, byController);
|
|
1283
|
-
});
|
|
1284
|
-
Object.assign(swiper.controller, {
|
|
1285
|
-
setTranslate,
|
|
1286
|
-
setTransition
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
/* eslint no-underscore-dangle: "off" */
|
|
1291
|
-
function Autoplay(_ref) {
|
|
1292
|
-
let {
|
|
1293
|
-
swiper,
|
|
1294
|
-
extendParams,
|
|
1295
|
-
on,
|
|
1296
|
-
emit
|
|
1297
|
-
} = _ref;
|
|
1298
|
-
let timeout;
|
|
1299
|
-
swiper.autoplay = {
|
|
1300
|
-
running: false,
|
|
1301
|
-
paused: false
|
|
1302
|
-
};
|
|
1303
|
-
extendParams({
|
|
1304
|
-
autoplay: {
|
|
1305
|
-
enabled: false,
|
|
1306
|
-
delay: 3000,
|
|
1307
|
-
waitForTransition: true,
|
|
1308
|
-
disableOnInteraction: true,
|
|
1309
|
-
stopOnLastSlide: false,
|
|
1310
|
-
reverseDirection: false,
|
|
1311
|
-
pauseOnMouseEnter: false
|
|
1312
|
-
}
|
|
1313
|
-
});
|
|
1314
|
-
|
|
1315
|
-
function run() {
|
|
1316
|
-
if (!swiper.size) {
|
|
1317
|
-
swiper.autoplay.running = false;
|
|
1318
|
-
swiper.autoplay.paused = false;
|
|
1319
|
-
return;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
const $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
|
|
1323
|
-
let delay = swiper.params.autoplay.delay;
|
|
1324
|
-
|
|
1325
|
-
if ($activeSlideEl.attr('data-swiper-autoplay')) {
|
|
1326
|
-
delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
clearTimeout(timeout);
|
|
1330
|
-
timeout = nextTick(() => {
|
|
1331
|
-
let autoplayResult;
|
|
1332
|
-
|
|
1333
|
-
if (swiper.params.autoplay.reverseDirection) {
|
|
1334
|
-
if (swiper.params.loop) {
|
|
1335
|
-
swiper.loopFix();
|
|
1336
|
-
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
|
|
1337
|
-
emit('autoplay');
|
|
1338
|
-
} else if (!swiper.isBeginning) {
|
|
1339
|
-
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
|
|
1340
|
-
emit('autoplay');
|
|
1341
|
-
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
|
1342
|
-
autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
|
|
1343
|
-
emit('autoplay');
|
|
1344
|
-
} else {
|
|
1345
|
-
stop();
|
|
1346
|
-
}
|
|
1347
|
-
} else if (swiper.params.loop) {
|
|
1348
|
-
swiper.loopFix();
|
|
1349
|
-
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
|
|
1350
|
-
emit('autoplay');
|
|
1351
|
-
} else if (!swiper.isEnd) {
|
|
1352
|
-
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
|
|
1353
|
-
emit('autoplay');
|
|
1354
|
-
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
|
1355
|
-
autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
|
|
1356
|
-
emit('autoplay');
|
|
1357
|
-
} else {
|
|
1358
|
-
stop();
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) {
|
|
1362
|
-
run();
|
|
1363
|
-
}
|
|
1364
|
-
}, delay);
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
function start() {
|
|
1368
|
-
if (typeof timeout !== 'undefined') return false;
|
|
1369
|
-
if (swiper.autoplay.running) return false;
|
|
1370
|
-
swiper.autoplay.running = true;
|
|
1371
|
-
emit('autoplayStart');
|
|
1372
|
-
run();
|
|
1373
|
-
return true;
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
function stop() {
|
|
1377
|
-
if (!swiper.autoplay.running) return false;
|
|
1378
|
-
if (typeof timeout === 'undefined') return false;
|
|
1379
|
-
|
|
1380
|
-
if (timeout) {
|
|
1381
|
-
clearTimeout(timeout);
|
|
1382
|
-
timeout = undefined;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
swiper.autoplay.running = false;
|
|
1386
|
-
emit('autoplayStop');
|
|
1387
|
-
return true;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
function pause(speed) {
|
|
1391
|
-
if (!swiper.autoplay.running) return;
|
|
1392
|
-
if (swiper.autoplay.paused) return;
|
|
1393
|
-
if (timeout) clearTimeout(timeout);
|
|
1394
|
-
swiper.autoplay.paused = true;
|
|
1395
|
-
|
|
1396
|
-
if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
|
|
1397
|
-
swiper.autoplay.paused = false;
|
|
1398
|
-
run();
|
|
1399
|
-
} else {
|
|
1400
|
-
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
|
1401
|
-
swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd);
|
|
1402
|
-
});
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
function onVisibilityChange() {
|
|
1407
|
-
const document = getDocument();
|
|
1408
|
-
|
|
1409
|
-
if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
|
|
1410
|
-
pause();
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
|
|
1414
|
-
run();
|
|
1415
|
-
swiper.autoplay.paused = false;
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
function onTransitionEnd(e) {
|
|
1420
|
-
if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
|
|
1421
|
-
if (e.target !== swiper.$wrapperEl[0]) return;
|
|
1422
|
-
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
|
1423
|
-
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
|
|
1424
|
-
});
|
|
1425
|
-
swiper.autoplay.paused = false;
|
|
1426
|
-
|
|
1427
|
-
if (!swiper.autoplay.running) {
|
|
1428
|
-
stop();
|
|
1429
|
-
} else {
|
|
1430
|
-
run();
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
function onMouseEnter() {
|
|
1435
|
-
if (swiper.params.autoplay.disableOnInteraction) {
|
|
1436
|
-
stop();
|
|
1437
|
-
} else {
|
|
1438
|
-
emit('autoplayPause');
|
|
1439
|
-
pause();
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
|
1443
|
-
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
|
|
1444
|
-
});
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
function onMouseLeave() {
|
|
1448
|
-
if (swiper.params.autoplay.disableOnInteraction) {
|
|
1449
|
-
return;
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
swiper.autoplay.paused = false;
|
|
1453
|
-
emit('autoplayResume');
|
|
1454
|
-
run();
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
function attachMouseEvents() {
|
|
1458
|
-
if (swiper.params.autoplay.pauseOnMouseEnter) {
|
|
1459
|
-
swiper.$el.on('mouseenter', onMouseEnter);
|
|
1460
|
-
swiper.$el.on('mouseleave', onMouseLeave);
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
function detachMouseEvents() {
|
|
1465
|
-
swiper.$el.off('mouseenter', onMouseEnter);
|
|
1466
|
-
swiper.$el.off('mouseleave', onMouseLeave);
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
on('init', () => {
|
|
1470
|
-
if (swiper.params.autoplay.enabled) {
|
|
1471
|
-
start();
|
|
1472
|
-
const document = getDocument();
|
|
1473
|
-
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
1474
|
-
attachMouseEvents();
|
|
1475
|
-
}
|
|
1476
|
-
});
|
|
1477
|
-
on('beforeTransitionStart', (_s, speed, internal) => {
|
|
1478
|
-
if (swiper.autoplay.running) {
|
|
1479
|
-
if (internal || !swiper.params.autoplay.disableOnInteraction) {
|
|
1480
|
-
swiper.autoplay.pause(speed);
|
|
1481
|
-
} else {
|
|
1482
|
-
stop();
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
});
|
|
1486
|
-
on('sliderFirstMove', () => {
|
|
1487
|
-
if (swiper.autoplay.running) {
|
|
1488
|
-
if (swiper.params.autoplay.disableOnInteraction) {
|
|
1489
|
-
stop();
|
|
1490
|
-
} else {
|
|
1491
|
-
pause();
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
});
|
|
1495
|
-
on('touchEnd', () => {
|
|
1496
|
-
if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) {
|
|
1497
|
-
run();
|
|
1498
|
-
}
|
|
1499
|
-
});
|
|
1500
|
-
on('destroy', () => {
|
|
1501
|
-
detachMouseEvents();
|
|
1502
|
-
|
|
1503
|
-
if (swiper.autoplay.running) {
|
|
1504
|
-
stop();
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
const document = getDocument();
|
|
1508
|
-
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
1509
|
-
});
|
|
1510
|
-
Object.assign(swiper.autoplay, {
|
|
1511
|
-
pause,
|
|
1512
|
-
run,
|
|
1513
|
-
start,
|
|
1514
|
-
stop
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
function Thumb(_ref) {
|
|
1519
|
-
let {
|
|
1520
|
-
swiper,
|
|
1521
|
-
extendParams,
|
|
1522
|
-
on
|
|
1523
|
-
} = _ref;
|
|
1524
|
-
extendParams({
|
|
1525
|
-
thumbs: {
|
|
1526
|
-
swiper: null,
|
|
1527
|
-
multipleActiveThumbs: true,
|
|
1528
|
-
autoScrollOffset: 0,
|
|
1529
|
-
slideThumbActiveClass: 'swiper-slide-thumb-active',
|
|
1530
|
-
thumbsContainerClass: 'swiper-thumbs'
|
|
1531
|
-
}
|
|
1532
|
-
});
|
|
1533
|
-
let initialized = false;
|
|
1534
|
-
let swiperCreated = false;
|
|
1535
|
-
swiper.thumbs = {
|
|
1536
|
-
swiper: null
|
|
1537
|
-
};
|
|
1538
|
-
|
|
1539
|
-
function onThumbClick() {
|
|
1540
|
-
const thumbsSwiper = swiper.thumbs.swiper;
|
|
1541
|
-
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
|
|
1542
|
-
const clickedIndex = thumbsSwiper.clickedIndex;
|
|
1543
|
-
const clickedSlide = thumbsSwiper.clickedSlide;
|
|
1544
|
-
if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return;
|
|
1545
|
-
if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;
|
|
1546
|
-
let slideToIndex;
|
|
1547
|
-
|
|
1548
|
-
if (thumbsSwiper.params.loop) {
|
|
1549
|
-
slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10);
|
|
1550
|
-
} else {
|
|
1551
|
-
slideToIndex = clickedIndex;
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
if (swiper.params.loop) {
|
|
1555
|
-
let currentIndex = swiper.activeIndex;
|
|
1556
|
-
|
|
1557
|
-
if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) {
|
|
1558
|
-
swiper.loopFix(); // eslint-disable-next-line
|
|
1559
|
-
|
|
1560
|
-
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
|
|
1561
|
-
currentIndex = swiper.activeIndex;
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
const prevIndex = swiper.slides.eq(currentIndex).prevAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index();
|
|
1565
|
-
const nextIndex = swiper.slides.eq(currentIndex).nextAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index();
|
|
1566
|
-
if (typeof prevIndex === 'undefined') slideToIndex = nextIndex;else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex;else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex;else slideToIndex = prevIndex;
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
swiper.slideTo(slideToIndex);
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
function init() {
|
|
1573
|
-
const {
|
|
1574
|
-
thumbs: thumbsParams
|
|
1575
|
-
} = swiper.params;
|
|
1576
|
-
if (initialized) return false;
|
|
1577
|
-
initialized = true;
|
|
1578
|
-
const SwiperClass = swiper.constructor;
|
|
1579
|
-
|
|
1580
|
-
if (thumbsParams.swiper instanceof SwiperClass) {
|
|
1581
|
-
swiper.thumbs.swiper = thumbsParams.swiper;
|
|
1582
|
-
Object.assign(swiper.thumbs.swiper.originalParams, {
|
|
1583
|
-
watchSlidesProgress: true,
|
|
1584
|
-
slideToClickedSlide: false
|
|
1585
|
-
});
|
|
1586
|
-
Object.assign(swiper.thumbs.swiper.params, {
|
|
1587
|
-
watchSlidesProgress: true,
|
|
1588
|
-
slideToClickedSlide: false
|
|
1589
|
-
});
|
|
1590
|
-
} else if (isObject(thumbsParams.swiper)) {
|
|
1591
|
-
const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper);
|
|
1592
|
-
Object.assign(thumbsSwiperParams, {
|
|
1593
|
-
watchSlidesProgress: true,
|
|
1594
|
-
slideToClickedSlide: false
|
|
1595
|
-
});
|
|
1596
|
-
swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams);
|
|
1597
|
-
swiperCreated = true;
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass);
|
|
1601
|
-
swiper.thumbs.swiper.on('tap', onThumbClick);
|
|
1602
|
-
return true;
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
function update(initial) {
|
|
1606
|
-
const thumbsSwiper = swiper.thumbs.swiper;
|
|
1607
|
-
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
|
|
1608
|
-
const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; // Activate thumbs
|
|
1609
|
-
|
|
1610
|
-
let thumbsToActivate = 1;
|
|
1611
|
-
const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
|
|
1612
|
-
|
|
1613
|
-
if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
|
|
1614
|
-
thumbsToActivate = swiper.params.slidesPerView;
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
if (!swiper.params.thumbs.multipleActiveThumbs) {
|
|
1618
|
-
thumbsToActivate = 1;
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
thumbsToActivate = Math.floor(thumbsToActivate);
|
|
1622
|
-
thumbsSwiper.slides.removeClass(thumbActiveClass);
|
|
1623
|
-
|
|
1624
|
-
if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {
|
|
1625
|
-
for (let i = 0; i < thumbsToActivate; i += 1) {
|
|
1626
|
-
thumbsSwiper.$wrapperEl.children(`[data-swiper-slide-index="${swiper.realIndex + i}"]`).addClass(thumbActiveClass);
|
|
1627
|
-
}
|
|
1628
|
-
} else {
|
|
1629
|
-
for (let i = 0; i < thumbsToActivate; i += 1) {
|
|
1630
|
-
thumbsSwiper.slides.eq(swiper.realIndex + i).addClass(thumbActiveClass);
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
const autoScrollOffset = swiper.params.thumbs.autoScrollOffset;
|
|
1635
|
-
const useOffset = autoScrollOffset && !thumbsSwiper.params.loop;
|
|
1636
|
-
|
|
1637
|
-
if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {
|
|
1638
|
-
let currentThumbsIndex = thumbsSwiper.activeIndex;
|
|
1639
|
-
let newThumbsIndex;
|
|
1640
|
-
let direction;
|
|
1641
|
-
|
|
1642
|
-
if (thumbsSwiper.params.loop) {
|
|
1643
|
-
if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) {
|
|
1644
|
-
thumbsSwiper.loopFix(); // eslint-disable-next-line
|
|
1645
|
-
|
|
1646
|
-
thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft;
|
|
1647
|
-
currentThumbsIndex = thumbsSwiper.activeIndex;
|
|
1648
|
-
} // Find actual thumbs index to slide to
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
const prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index();
|
|
1652
|
-
const nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index();
|
|
1653
|
-
|
|
1654
|
-
if (typeof prevThumbsIndex === 'undefined') {
|
|
1655
|
-
newThumbsIndex = nextThumbsIndex;
|
|
1656
|
-
} else if (typeof nextThumbsIndex === 'undefined') {
|
|
1657
|
-
newThumbsIndex = prevThumbsIndex;
|
|
1658
|
-
} else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) {
|
|
1659
|
-
newThumbsIndex = thumbsSwiper.params.slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex;
|
|
1660
|
-
} else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) {
|
|
1661
|
-
newThumbsIndex = nextThumbsIndex;
|
|
1662
|
-
} else {
|
|
1663
|
-
newThumbsIndex = prevThumbsIndex;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';
|
|
1667
|
-
} else {
|
|
1668
|
-
newThumbsIndex = swiper.realIndex;
|
|
1669
|
-
direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
if (useOffset) {
|
|
1673
|
-
newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
|
|
1677
|
-
if (thumbsSwiper.params.centeredSlides) {
|
|
1678
|
-
if (newThumbsIndex > currentThumbsIndex) {
|
|
1679
|
-
newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
|
|
1680
|
-
} else {
|
|
1681
|
-
newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
on('beforeInit', () => {
|
|
1691
|
-
const {
|
|
1692
|
-
thumbs
|
|
1693
|
-
} = swiper.params;
|
|
1694
|
-
if (!thumbs || !thumbs.swiper) return;
|
|
1695
|
-
init();
|
|
1696
|
-
update(true);
|
|
1697
|
-
});
|
|
1698
|
-
on('slideChange update resize observerUpdate', () => {
|
|
1699
|
-
update();
|
|
1700
|
-
});
|
|
1701
|
-
on('setTransition', (_s, duration) => {
|
|
1702
|
-
const thumbsSwiper = swiper.thumbs.swiper;
|
|
1703
|
-
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
|
|
1704
|
-
thumbsSwiper.setTransition(duration);
|
|
1705
|
-
});
|
|
1706
|
-
on('beforeDestroy', () => {
|
|
1707
|
-
const thumbsSwiper = swiper.thumbs.swiper;
|
|
1708
|
-
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
|
|
1709
|
-
|
|
1710
|
-
if (swiperCreated) {
|
|
1711
|
-
thumbsSwiper.destroy();
|
|
1712
|
-
}
|
|
1713
|
-
});
|
|
1714
|
-
Object.assign(swiper.thumbs, {
|
|
1715
|
-
init,
|
|
1716
|
-
update
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
8
|
const ArrowLeftIcon = `<!-- Generated by IcoMoon.io -->
|
|
1721
9
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
1722
10
|
<title>keyboard_arrow_left</title>
|
|
@@ -1724,7 +12,7 @@ const ArrowLeftIcon = `<!-- Generated by IcoMoon.io -->
|
|
|
1724
12
|
</svg>
|
|
1725
13
|
`;
|
|
1726
14
|
|
|
1727
|
-
const sallaSliderCss = "@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\") format(\"woff\");font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-vertical>.swiper-wrapper{-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform;-webkit-box-sizing:content-box;box-sizing:content-box}.swiper-android .swiper-slide,.swiper-wrapper{-webkit-transform:translate3d(0px, 0, 0);transform:translate3d(0px, 0, 0)}.swiper-pointer-events{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-pointer-events.swiper-vertical{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-slide{-ms-flex-negative:0;flex-shrink:0;width:100%;height:100%;position:relative;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height, -webkit-transform;transition-property:height, -webkit-transform;transition-property:transform, height;transition-property:transform, height, -webkit-transform}.swiper-backface-hidden .swiper-slide{-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d,.swiper-3d.swiper-css-mode .swiper-wrapper{-webkit-perspective:1200px;perspective:1200px}.swiper-3d .swiper-wrapper,.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{-webkit-transform-style:preserve-3d;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:-webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));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:-webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));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:-webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));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:-webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));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{-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory}.swiper-vertical.swiper-css-mode>.swiper-wrapper{-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory}.swiper-centered>.swiper-wrapper::before{content:\"\";-ms-flex-negative:0;flex-shrink:0;-ms-flex-order:9999;order:9999}.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{-webkit-margin-start:var(--swiper-centered-offset-before);margin-inline-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;width:var(--swiper-centered-offset-after)}.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{-webkit-margin-before:var(--swiper-centered-offset-before);margin-block-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;height:var(--swiper-centered-offset-after)}.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center}";
|
|
15
|
+
const sallaSliderCss = "@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\") format(\"woff\");font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-vertical>.swiper-wrapper{-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform;-webkit-box-sizing:content-box;box-sizing:content-box}.swiper-android .swiper-slide,.swiper-wrapper{-webkit-transform:translate3d(0px, 0, 0);transform:translate3d(0px, 0, 0)}.swiper-pointer-events{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-pointer-events.swiper-vertical{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-slide{-ms-flex-negative:0;flex-shrink:0;width:100%;height:100%;position:relative;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height, -webkit-transform;transition-property:height, -webkit-transform;transition-property:transform, height;transition-property:transform, height, -webkit-transform}.swiper-backface-hidden .swiper-slide{-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d,.swiper-3d.swiper-css-mode .swiper-wrapper{-webkit-perspective:1200px;perspective:1200px}.swiper-3d .swiper-wrapper,.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{-webkit-transform-style:preserve-3d;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:-webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));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:-webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));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:-webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));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:-webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));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{-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory}.swiper-vertical.swiper-css-mode>.swiper-wrapper{-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory}.swiper-centered>.swiper-wrapper::before{content:\"\";-ms-flex-negative:0;flex-shrink:0;-ms-flex-order:9999;order:9999}.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{-webkit-margin-start:var(--swiper-centered-offset-before);margin-inline-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;width:var(--swiper-centered-offset-after)}.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{-webkit-margin-before:var(--swiper-centered-offset-before);margin-block-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;height:var(--swiper-centered-offset-after)}.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center}:root{}.swiper-pagination{position:absolute;text-align:center;-webkit-transition:300ms opacity;transition:300ms opacity;-webkit-transform:translate3d(0, 0, 0);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:10px;left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transform:scale(0.33);transform:scale(0.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active{-webkit-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{-webkit-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{-webkit-transform:scale(0.66);transform:scale(0.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{-webkit-transform:scale(0.33);transform:scale(0.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{-webkit-transform:scale(0.66);transform:scale(0.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{-webkit-transform:scale(0.33);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: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;-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none;-moz-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:10px;top:50%;-webkit-transform:translate3d(0px, -50%, 0);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%;-webkit-transform:translateY(-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;-webkit-transition:200ms top, 200ms -webkit-transform;transition:200ms top, 200ms -webkit-transform;transition:200ms transform, 200ms top;transition:200ms transform, 200ms top, 200ms -webkit-transform}.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%;-webkit-transform:translateX(-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{-webkit-transition:200ms left, 200ms -webkit-transform;transition:200ms left, 200ms -webkit-transform;transition:200ms transform, 200ms left;transition:200ms transform, 200ms left, 200ms -webkit-transform}.swiper-horizontal.swiper-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:200ms right, 200ms -webkit-transform;transition:200ms right, 200ms -webkit-transform;transition:200ms transform, 200ms right;transition:200ms transform, 200ms right, 200ms -webkit-transform}.swiper-pagination-progressbar{background: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%;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:left top;transform-origin:left top}.swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{-webkit-transform-origin:right top;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: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:4px;height:100%;left:0;top:0}.swiper-pagination-lock{display:none}:root{--swiper-navigation-size:44px;}.swiper-button-prev,.swiper-button-next{position:absolute;top: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:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack: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:10px;right:auto}.swiper-button-prev:after,.swiper-rtl .swiper-button-next:after{content:\"prev\"}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:10px;left:auto}.swiper-button-next:after,.swiper-rtl .swiper-button-prev:after{content:\"next\"}.swiper-button-lock{display:none}";
|
|
1728
16
|
|
|
1729
17
|
const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
1730
18
|
constructor() {
|
|
@@ -1745,14 +33,54 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1745
33
|
this.touchSliderStart = createEvent(this, "touchSliderStart", 7);
|
|
1746
34
|
this.sliderTransitionEnd = createEvent(this, "sliderTransitionEnd", 7);
|
|
1747
35
|
this.sliderTransitionStart = createEvent(this, "sliderTransitionStart", 7);
|
|
36
|
+
/**
|
|
37
|
+
* Show/hide slider block title
|
|
38
|
+
*/
|
|
39
|
+
this.blockTitle = '';
|
|
40
|
+
/**
|
|
41
|
+
* Show/hide slider block sub title
|
|
42
|
+
*/
|
|
43
|
+
this.blockSubtitle = '';
|
|
44
|
+
/**
|
|
45
|
+
* Show/hide display all button beside arrows
|
|
46
|
+
*/
|
|
47
|
+
this.displayAllUrl = '';
|
|
48
|
+
/**
|
|
49
|
+
* Vertical or Horizontal thumbs slider
|
|
50
|
+
*/
|
|
51
|
+
this.verticalThumbs = false;
|
|
1748
52
|
/**
|
|
1749
53
|
* Show/hide arrows
|
|
1750
54
|
*/
|
|
1751
55
|
this.showControls = true;
|
|
56
|
+
/**
|
|
57
|
+
* Show/hide arrows
|
|
58
|
+
*/
|
|
59
|
+
this.controlsOuter = false;
|
|
1752
60
|
/**
|
|
1753
61
|
* Show/hide thumbs slider arrows
|
|
1754
62
|
*/
|
|
1755
63
|
this.showThumbsControls = true;
|
|
64
|
+
/**
|
|
65
|
+
* Enable autoplay - working with `type="carousel" only`
|
|
66
|
+
*/
|
|
67
|
+
this.autoPlay = false;
|
|
68
|
+
/**
|
|
69
|
+
* slidesPerView
|
|
70
|
+
*/
|
|
71
|
+
this.slidesPerView = "auto";
|
|
72
|
+
/**
|
|
73
|
+
* Enable pagination
|
|
74
|
+
*/
|
|
75
|
+
this.pagination = false;
|
|
76
|
+
/**
|
|
77
|
+
* Enable center mode - working with `type="carousel" only`
|
|
78
|
+
*/
|
|
79
|
+
this.centered = false;
|
|
80
|
+
/**
|
|
81
|
+
* Run slider in loop, Don't use it for slides with custom components inside it, because it may cause re-render issue
|
|
82
|
+
*/
|
|
83
|
+
this.loop = false;
|
|
1756
84
|
/**
|
|
1757
85
|
* Set the type of the slider
|
|
1758
86
|
* Default: ''
|
|
@@ -1771,22 +99,57 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1771
99
|
*/
|
|
1772
100
|
this.sliderConfig = {};
|
|
1773
101
|
/**
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
102
|
+
* Thumbs Slider Configs refer to https://swiperjs.com/swiper-api#parameters and pass the entire config object
|
|
103
|
+
* @example
|
|
104
|
+
* let slider = document.querySelector('salla-slider');
|
|
105
|
+
* slider.thumbsConfig = {
|
|
106
|
+
* slidesPerView: 1,
|
|
107
|
+
* spaceBetween : 30,
|
|
108
|
+
* lazy: true,
|
|
109
|
+
* }
|
|
110
|
+
*
|
|
111
|
+
*/
|
|
1784
112
|
this.thumbsConfig = {};
|
|
1785
113
|
// States
|
|
1786
114
|
this.currentIndex = undefined;
|
|
1787
115
|
this.isEnd = false;
|
|
1788
116
|
this.isBeginning = true;
|
|
1789
117
|
this.isRTL = document.documentElement.dir === 'rtl';
|
|
118
|
+
this.pre_defined_config = {
|
|
119
|
+
carousel: {
|
|
120
|
+
speed: 300,
|
|
121
|
+
slidesPerView: 'auto',
|
|
122
|
+
spaceBetween: 0,
|
|
123
|
+
},
|
|
124
|
+
fullscreen: {
|
|
125
|
+
speed: 750,
|
|
126
|
+
parallax: true,
|
|
127
|
+
autoplay: {
|
|
128
|
+
delay: 5000,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
testimonials: {
|
|
132
|
+
draggable: true,
|
|
133
|
+
slidesPerView: 1,
|
|
134
|
+
breakpoints: { 1024: { slidesPerView: 2 } }
|
|
135
|
+
},
|
|
136
|
+
blog: {
|
|
137
|
+
slidesPerView: 1,
|
|
138
|
+
centeredSlides: true,
|
|
139
|
+
spaceBetween: 30,
|
|
140
|
+
effect: "fade",
|
|
141
|
+
breakpoints: {
|
|
142
|
+
320: { spaceBetween: 10 },
|
|
143
|
+
768: { spaceBetween: 15 },
|
|
144
|
+
980: { paceBetween: 30 },
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
thumbs: {
|
|
148
|
+
slidesPerView: 1,
|
|
149
|
+
spaceBetween: 30,
|
|
150
|
+
autoHeight: true
|
|
151
|
+
}
|
|
152
|
+
};
|
|
1790
153
|
}
|
|
1791
154
|
// Methods
|
|
1792
155
|
/**
|
|
@@ -1797,7 +160,7 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1797
160
|
* @param {boolean} runCallbacks - Set it to false (by default it is true) and transition will not produce transition events.
|
|
1798
161
|
* **/
|
|
1799
162
|
async slideTo(index, speed, runCallbacks) {
|
|
1800
|
-
this.slider.slideTo(index, speed, runCallbacks);
|
|
163
|
+
return this.slider.slideTo(index, speed, runCallbacks);
|
|
1801
164
|
}
|
|
1802
165
|
/**
|
|
1803
166
|
* Run transition to the next slide.
|
|
@@ -1806,7 +169,8 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1806
169
|
* @param {boolean} runCallbacks - Set it to false (by default it is true) and transition will not produce transition events.
|
|
1807
170
|
* **/
|
|
1808
171
|
async slideNext(speed, runCallbacks) {
|
|
1809
|
-
|
|
172
|
+
var _a;
|
|
173
|
+
(_a = this.slider) === null || _a === void 0 ? void 0 : _a.slideNext(speed, runCallbacks);
|
|
1810
174
|
}
|
|
1811
175
|
/**
|
|
1812
176
|
* Run transition to the previous slide.
|
|
@@ -1815,7 +179,8 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1815
179
|
* @param {boolean} runCallbacks - Set it to false (by default it is true) and transition will not produce transition events.
|
|
1816
180
|
* **/
|
|
1817
181
|
async slidePrev(speed, runCallbacks) {
|
|
1818
|
-
|
|
182
|
+
var _a;
|
|
183
|
+
(_a = this.slider) === null || _a === void 0 ? void 0 : _a.slidePrev(speed, runCallbacks);
|
|
1819
184
|
}
|
|
1820
185
|
/**
|
|
1821
186
|
* Does the same as .slideTo but for the case when used with enabled loop. So this method will slide to slides with realIndex matching to passed index
|
|
@@ -1862,7 +227,7 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1862
227
|
this.slider.slideToClosest(speed, runCallbacks);
|
|
1863
228
|
}
|
|
1864
229
|
/**
|
|
1865
|
-
*
|
|
230
|
+
* You should call it after you add/remove slides manually, or after you hide/show it, or do any custom DOM modifications with Swiper This method also includes subcall of the following methods which you can use separately:
|
|
1866
231
|
* **/
|
|
1867
232
|
async update() {
|
|
1868
233
|
this.slider.update();
|
|
@@ -1892,106 +257,186 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1892
257
|
async updateSlidesClasses() {
|
|
1893
258
|
this.slider.updateSlidesClasses();
|
|
1894
259
|
}
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
}
|
|
1902
|
-
this.initSlider();
|
|
260
|
+
/**
|
|
261
|
+
* Get slider slides
|
|
262
|
+
* **/
|
|
263
|
+
async getSlides() {
|
|
264
|
+
var _a;
|
|
265
|
+
return await ((_a = this.slider) === null || _a === void 0 ? void 0 : _a.slides);
|
|
1903
266
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
267
|
+
componentWillLoad() {
|
|
268
|
+
salla.lang.onLoaded(() => {
|
|
269
|
+
this.displayAllTitle = salla.lang.get('blocks.home.display_all');
|
|
270
|
+
});
|
|
271
|
+
return new Promise((resolve, reject) => {
|
|
272
|
+
// @ts-ignore
|
|
273
|
+
if (typeof Swiper !== 'undefined') {
|
|
274
|
+
return resolve(true);
|
|
275
|
+
}
|
|
276
|
+
if (document.getElementById('swiper-script')) {
|
|
277
|
+
let interval = setInterval(() => {
|
|
278
|
+
// @ts-ignore
|
|
279
|
+
if (typeof Swiper !== 'undefined') {
|
|
280
|
+
clearInterval(interval);
|
|
281
|
+
resolve(true);
|
|
282
|
+
}
|
|
283
|
+
}, 5);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
// ? There is an issue with stencil bundling it breaks the swiper import, so we need to import it manually by swiperjs rerendered file
|
|
287
|
+
// ! IT'S NOT A GOOD SOLUTION, BUT IT WORKS, WE NEED TO FIND A BETTER SOLUTION
|
|
288
|
+
this.swiperScript = document.createElement('script');
|
|
289
|
+
this.swiperScript.onload = () => {
|
|
290
|
+
resolve(true);
|
|
291
|
+
salla.event.emit('swiper::loaded');
|
|
292
|
+
};
|
|
293
|
+
this.swiperScript.onerror = (error) => {
|
|
294
|
+
salla.logger.warn('failed load swiper bundle', error);
|
|
295
|
+
reject(true);
|
|
296
|
+
};
|
|
297
|
+
this.swiperScript.src = 'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js';
|
|
298
|
+
this.swiperScript.setAttribute('id', 'swiper-script');
|
|
299
|
+
document.body.appendChild(this.swiperScript);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
getSwiperConfig() {
|
|
304
|
+
let pre_defined_config = {
|
|
305
|
+
loop: this.loop,
|
|
306
|
+
autoplay: this.autoPlay,
|
|
307
|
+
centeredSlides: this.centered,
|
|
308
|
+
slidesPerView: this.slidesPerView,
|
|
309
|
+
lazy: true,
|
|
310
|
+
on: {
|
|
311
|
+
// todo:: find better way for this workaround to show lazyLoad for duplicated slides, for some reason they are loaded but class not added.
|
|
312
|
+
afterInit: (slider) => this.loop && slider.slides.map(slide => {
|
|
313
|
+
var _a;
|
|
314
|
+
(_a = document.lazyLoadInstance) === null || _a === void 0 ? void 0 : _a.update();
|
|
315
|
+
if (!slide.classList.contains('swiper-slide-duplicate')) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
slide.querySelectorAll('img.lazy:not(.loaded)').forEach(img => img.classList.add('loaded'));
|
|
319
|
+
}),
|
|
320
|
+
},
|
|
321
|
+
pagination: this.pagination ? {
|
|
322
|
+
el: this.host.id ? `#${this.host.id} .swiper-pagination` : '',
|
|
323
|
+
clickable: true,
|
|
324
|
+
} : false,
|
|
325
|
+
navigation: this.showControls ? {
|
|
326
|
+
nextEl: this.host.id ? `#${this.host.id} .s-slider-next` : '',
|
|
327
|
+
prevEl: this.host.id ? `#${this.host.id} .s-slider-prev` : ''
|
|
328
|
+
} : false,
|
|
329
|
+
breakpoints: {
|
|
330
|
+
768: {
|
|
331
|
+
direction: this.verticalThumbs ? "vertical" : "horizontal",
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
pre_defined_config = Object.assign(Object.assign({}, pre_defined_config), (this.pre_defined_config[this.type] || {}));
|
|
336
|
+
if (this.type == 'thumbs') {
|
|
1920
337
|
for (const slide of this.thumbsSliderWrapper.children) {
|
|
1921
338
|
//todo:: use `s-slider-slide`
|
|
1922
339
|
slide.classList.add('swiper-slide');
|
|
1923
340
|
}
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
341
|
+
// @ts-ignore
|
|
342
|
+
this.thumbsSlider = new Swiper(this.thumbsSliderContainer, {
|
|
343
|
+
freeMode: false,
|
|
344
|
+
watchSlidesProgress: true,
|
|
345
|
+
slidesPerView: 4,
|
|
346
|
+
spaceBetween: 10,
|
|
347
|
+
watchOverflow: true,
|
|
348
|
+
watchSlidesVisibility: true,
|
|
349
|
+
breakpoints: {
|
|
350
|
+
768: {
|
|
351
|
+
direction: this.verticalThumbs ? "vertical" : "horizontal",
|
|
352
|
+
spaceBetween: 16,
|
|
353
|
+
},
|
|
1930
354
|
},
|
|
1931
355
|
});
|
|
356
|
+
// @ts-ignore
|
|
357
|
+
pre_defined_config.thumbs = {
|
|
358
|
+
swiper: this.thumbsSlider,
|
|
359
|
+
};
|
|
1932
360
|
}
|
|
1933
|
-
|
|
1934
|
-
|
|
361
|
+
pre_defined_config = Object.assign(Object.assign({}, pre_defined_config), this.sliderConfig);
|
|
362
|
+
return pre_defined_config;
|
|
363
|
+
}
|
|
364
|
+
initSlider() {
|
|
365
|
+
for (const slide of this.sliderWrapper.children) {
|
|
366
|
+
//todo:: use `s-slider-slide`
|
|
367
|
+
slide.classList.add('swiper-slide');
|
|
1935
368
|
}
|
|
369
|
+
// @ts-ignore
|
|
370
|
+
this.slider = new Swiper(this.sliderContainer, this.getSwiperConfig());
|
|
1936
371
|
// Expose slider events
|
|
1937
372
|
this.slider.on('slideChange', (slider) => {
|
|
373
|
+
//todo:: it doesn't change when loop is active, always will be false
|
|
1938
374
|
this.isBeginning = slider.isBeginning;
|
|
1939
375
|
this.isEnd = slider.isEnd;
|
|
1940
376
|
this.slideChange.emit(slider);
|
|
1941
377
|
});
|
|
1942
|
-
this.slider.on('reachBeginning', (slider) =>
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
this.slider.on('
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
this.slider.on('
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
this.slider.on('
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
this.slider.on('slideNextTransitionEnd', (slider) => {
|
|
1957
|
-
this.slideNextTransitionEnd.emit(slider);
|
|
1958
|
-
});
|
|
1959
|
-
this.slider.on('slideNextTransitionStart', (slider) => {
|
|
1960
|
-
this.slideNextTransitionStart.emit(slider);
|
|
1961
|
-
});
|
|
1962
|
-
this.slider.on('slidePrevTransitionEnd', (slider) => {
|
|
1963
|
-
this.slidePrevTransitionEnd.emit(slider);
|
|
1964
|
-
});
|
|
1965
|
-
this.slider.on('slidePrevTransitionStart', (slider) => {
|
|
1966
|
-
this.slidePrevTransitionStart.emit(slider);
|
|
1967
|
-
});
|
|
1968
|
-
this.slider.on('sliderMove', (slider) => {
|
|
1969
|
-
this.sliderMove.emit(slider);
|
|
1970
|
-
});
|
|
1971
|
-
this.slider.on('touchEnd', (slider) => {
|
|
1972
|
-
this.touchSliderEnd.emit(slider);
|
|
1973
|
-
});
|
|
1974
|
-
this.slider.on('touchMove', (slider) => {
|
|
1975
|
-
this.touchSliderMove.emit(slider);
|
|
1976
|
-
});
|
|
1977
|
-
this.slider.on('touchStart', (slider) => {
|
|
1978
|
-
this.touchSliderStart.emit(slider);
|
|
1979
|
-
});
|
|
1980
|
-
this.slider.on('transitionEnd', (slider) => {
|
|
1981
|
-
this.sliderTransitionEnd.emit(slider);
|
|
1982
|
-
});
|
|
1983
|
-
this.slider.on('transitionStart', (slider) => {
|
|
1984
|
-
this.sliderTransitionStart.emit(slider);
|
|
1985
|
-
});
|
|
378
|
+
this.slider.on('reachBeginning', (slider) => this.reachBeginning.emit(slider));
|
|
379
|
+
this.slider.on('reachEnd', (slider) => this.reachEnd.emit(slider));
|
|
380
|
+
this.slider.on('slideChangeTransitionEnd', (slider) => this.slideChangeTransitionEnd.emit(slider));
|
|
381
|
+
this.slider.on('slideChangeTransitionStart', (slider) => this.slideChangeTransitionStart.emit(slider));
|
|
382
|
+
this.slider.on('slideNextTransitionEnd', (slider) => this.slideNextTransitionEnd.emit(slider));
|
|
383
|
+
this.slider.on('slideNextTransitionStart', (slider) => this.slideNextTransitionStart.emit(slider));
|
|
384
|
+
this.slider.on('slidePrevTransitionEnd', (slider) => this.slidePrevTransitionEnd.emit(slider));
|
|
385
|
+
this.slider.on('slidePrevTransitionStart', (slider) => this.slidePrevTransitionStart.emit(slider));
|
|
386
|
+
this.slider.on('sliderMove', (slider) => this.sliderMove.emit(slider));
|
|
387
|
+
this.slider.on('touchEnd', (slider) => this.touchSliderEnd.emit(slider));
|
|
388
|
+
this.slider.on('touchMove', (slider) => this.touchSliderMove.emit(slider));
|
|
389
|
+
this.slider.on('touchStart', (slider) => this.touchSliderStart.emit(slider));
|
|
390
|
+
this.slider.on('transitionEnd', (slider) => this.sliderTransitionEnd.emit(slider));
|
|
391
|
+
this.slider.on('transitionStart', (slider) => this.sliderTransitionStart.emit(slider));
|
|
1986
392
|
}
|
|
1987
393
|
render() {
|
|
1988
394
|
var _a, _b, _c, _d;
|
|
1989
|
-
|
|
395
|
+
let classes = this.type ? this.type + '-slider ' : '';
|
|
396
|
+
classes += this.controlsOuter ? ' s-slider-controls-outer ' : '';
|
|
397
|
+
classes += this.blockTitle == '' ? ' s-slider-has-notitle s-slider-v-centered ' : '';
|
|
398
|
+
classes += this.verticalThumbs ? ' s-slider-vertical ' : ' s-slider-horizontal';
|
|
399
|
+
return (h(Host, { class: 's-slider-wrapper ' + classes }, this.blockTitle || this.showControls ?
|
|
400
|
+
h("div", { class: "s-slider-block__title" }, this.blockTitle ?
|
|
401
|
+
h("div", { class: "s-slider-block__title-right" }, h("h2", null, this.blockTitle), this.blockSubtitle ? h("p", { innerHTML: this.blockSubtitle }) : '')
|
|
402
|
+
: '', h("div", { class: "s-slider-block__title-left" }, this.displayAllUrl ?
|
|
403
|
+
h("a", { href: this.displayAllUrl, class: "s-slider-block__display-all" }, this.displayAllTitle)
|
|
404
|
+
: '', this.showControls ?
|
|
405
|
+
h("div", { class: "s-slider-block__title-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? KeyboardArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? ArrowLeftIcon : KeyboardArrowRightIcon })))
|
|
406
|
+
: ''))
|
|
407
|
+
: '', h("div", { class: "swiper s-slider-container", ref: el => this.sliderContainer = el }, h("slot", null), h("div", { class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el }, h("slot", { name: 'items' })), this.pagination ? h("div", { class: "swiper-pagination" }) : ''), this.type == 'thumbs' ? h("div", { class: "s-slider-thumbs" }, h("div", { class: "swiper s-slider-thumbs-container", ref: el => this.thumbsSliderContainer = el }, h("div", { class: "s-slider-swiper-wrapper swiper-wrapper", ref: el => this.thumbsSliderWrapper = el }, h("slot", { name: "thumbs" })), this.showThumbsControls ? [h("div", { class: "s-slider-button s-slider-button-prev" }, h("salla-button", { disabled: this.isRTL ? (_a = this.thumbsSlider) === null || _a === void 0 ? void 0 : _a.isEnd : (_b = this.thumbsSlider) === null || _b === void 0 ? void 0 : _b.isBeginning, shape: "icon", color: "light", onClick: () => this.isRTL ? this.thumbsSlider.slideNext() : this.thumbsSlider.slidePrev() }, h("span", { class: "s-slider-button-icon", innerHTML: salla.config.get('theme.is_rtl') ? ArrowLeftIcon : KeyboardArrowRightIcon }))), h("div", { class: "s-slider-button s-slider-button-next" }, h("salla-button", { disabled: this.isRTL ? (_c = this.thumbsSlider) === null || _c === void 0 ? void 0 : _c.isBeginning : (_d = this.thumbsSlider) === null || _d === void 0 ? void 0 : _d.isEnd, shape: "icon", color: "light", onClick: () => this.isRTL ? this.thumbsSlider.slidePrev() : this.thumbsSlider.slideNext() }, h("span", { class: "s-slider-button-icon", innerHTML: salla.config.get('theme.is_rtl') ? KeyboardArrowRightIcon : ArrowLeftIcon })))] : '')) : ''));
|
|
408
|
+
}
|
|
409
|
+
componentDidLoad() {
|
|
410
|
+
let itemsSlot = this.sliderWrapper.querySelector('div[slot="items"]');
|
|
411
|
+
!!itemsSlot ? itemsSlot.replaceWith(...itemsSlot.children) : null;
|
|
412
|
+
if (this.type == 'thumbs') {
|
|
413
|
+
let thumbsSlot = this.thumbsSliderWrapper.querySelector('div[slot="thumbs"]');
|
|
414
|
+
!!thumbsSlot ? thumbsSlot.replaceWith(...thumbsSlot.children) : null;
|
|
415
|
+
}
|
|
416
|
+
// if swiper is not loaded, lets relay on event
|
|
417
|
+
// @ts-ignore
|
|
418
|
+
if (typeof Swiper === 'undefined') {
|
|
419
|
+
salla.event.once('swiper::loaded', () => this.initSlider());
|
|
420
|
+
}
|
|
421
|
+
else { // if swiper is loaded lets init our slider
|
|
422
|
+
this.initSlider();
|
|
423
|
+
}
|
|
1990
424
|
}
|
|
425
|
+
get host() { return this; }
|
|
1991
426
|
static get style() { return sallaSliderCss; }
|
|
1992
427
|
}, [4, "salla-slider", {
|
|
428
|
+
"blockTitle": [513, "block-title"],
|
|
429
|
+
"blockSubtitle": [513, "block-subtitle"],
|
|
430
|
+
"displayAllUrl": [513, "display-all-url"],
|
|
431
|
+
"verticalThumbs": [516, "vertical-thumbs"],
|
|
1993
432
|
"showControls": [516, "show-controls"],
|
|
433
|
+
"controlsOuter": [516, "controls-outer"],
|
|
1994
434
|
"showThumbsControls": [4, "show-thumbs-controls"],
|
|
435
|
+
"autoPlay": [4, "auto-play"],
|
|
436
|
+
"slidesPerView": [1, "slides-per-view"],
|
|
437
|
+
"pagination": [4],
|
|
438
|
+
"centered": [4],
|
|
439
|
+
"loop": [4],
|
|
1995
440
|
"type": [1],
|
|
1996
441
|
"sliderConfig": [520, "slider-config"],
|
|
1997
442
|
"thumbsConfig": [520, "thumbs-config"],
|
|
@@ -1999,6 +444,8 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1999
444
|
"isEnd": [32],
|
|
2000
445
|
"isBeginning": [32],
|
|
2001
446
|
"isRTL": [32],
|
|
447
|
+
"swiperScript": [32],
|
|
448
|
+
"displayAllTitle": [32],
|
|
2002
449
|
"slideTo": [64],
|
|
2003
450
|
"slideNext": [64],
|
|
2004
451
|
"slidePrev": [64],
|
|
@@ -2011,7 +458,8 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
2011
458
|
"updateAutoHeight": [64],
|
|
2012
459
|
"updateSlides": [64],
|
|
2013
460
|
"updateProgress": [64],
|
|
2014
|
-
"updateSlidesClasses": [64]
|
|
461
|
+
"updateSlidesClasses": [64],
|
|
462
|
+
"getSlides": [64]
|
|
2015
463
|
}]);
|
|
2016
464
|
function defineCustomElement() {
|
|
2017
465
|
if (typeof customElements === "undefined") {
|