1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,1048 +0,0 @@ |
1 |
-import { Directive, TemplateRef, Input, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, NgZone, ElementRef, ChangeDetectorRef, Inject, PLATFORM_ID, Output, ViewChild, ContentChildren, HostBinding, NgModule } from '@angular/core'; |
|
2 |
-import { isPlatformBrowser, CommonModule } from '@angular/common'; |
|
3 |
-import Swiper from 'swiper/core'; |
|
4 |
-import { Subject, of } from 'rxjs'; |
|
5 |
- |
|
6 |
-function isObject(o) { |
|
7 |
- return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object; |
|
8 |
-} |
|
9 |
-function extend(target, src) { |
|
10 |
- Object.keys(src).forEach((key) => { |
|
11 |
- if (typeof target[key] === 'undefined') { |
|
12 |
- target[key] = src[key]; |
|
13 |
- return; |
|
14 |
- } |
|
15 |
- if (target[key] && !src[key]) { |
|
16 |
- return; |
|
17 |
- } |
|
18 |
- if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) { |
|
19 |
- extend(target[key], src[key]); |
|
20 |
- } |
|
21 |
- else { |
|
22 |
- target[key] = src[key]; |
|
23 |
- } |
|
24 |
- }); |
|
25 |
-} |
|
26 |
-function coerceBooleanProperty(value) { |
|
27 |
- return value != null && `${value}` !== 'false'; |
|
28 |
-} |
|
29 |
-const ignoreNgOnChanges = ['pagination', 'navigation', 'scrollbar', 'virtual']; |
|
30 |
-function setProperty(val, obj = {}) { |
|
31 |
- if (isObject(val)) { |
|
32 |
- return val; |
|
33 |
- } |
|
34 |
- const newValue = coerceBooleanProperty(val); |
|
35 |
- if (newValue === true) { |
|
36 |
- return obj; |
|
37 |
- } |
|
38 |
- return newValue; |
|
39 |
-} |
|
40 |
- |
|
41 |
-/* underscore in name -> watch for changes */ |
|
42 |
-const paramsList = [ |
|
43 |
- 'init', |
|
44 |
- '_direction', |
|
45 |
- 'touchEventsTarget', |
|
46 |
- 'initialSlide', |
|
47 |
- '_speed', |
|
48 |
- 'cssMode', |
|
49 |
- 'updateOnWindowResize', |
|
50 |
- 'resizeObserver', |
|
51 |
- 'nested', |
|
52 |
- '_width', |
|
53 |
- '_height', |
|
54 |
- 'preventInteractionOnTransition', |
|
55 |
- 'userAgent', |
|
56 |
- 'url', |
|
57 |
- '_edgeSwipeDetection', |
|
58 |
- '_edgeSwipeThreshold', |
|
59 |
- '_freeMode', |
|
60 |
- '_freeModeMomentum', |
|
61 |
- '_freeModeMomentumRatio', |
|
62 |
- '_freeModeMomentumBounce', |
|
63 |
- '_freeModeMomentumBounceRatio', |
|
64 |
- '_freeModeMomentumVelocityRatio', |
|
65 |
- '_freeModeSticky', |
|
66 |
- '_freeModeMinimumVelocity', |
|
67 |
- '_autoHeight', |
|
68 |
- 'setWrapperSize', |
|
69 |
- 'virtualTranslate', |
|
70 |
- '_effect', |
|
71 |
- 'breakpoints', |
|
72 |
- '_spaceBetween', |
|
73 |
- '_slidesPerView', |
|
74 |
- '_slidesPerColumn', |
|
75 |
- '_slidesPerColumnFill', |
|
76 |
- '_slidesPerGroup', |
|
77 |
- '_slidesPerGroupSkip', |
|
78 |
- '_centeredSlides', |
|
79 |
- '_centeredSlidesBounds', |
|
80 |
- '_slidesOffsetBefore', |
|
81 |
- '_slidesOffsetAfter', |
|
82 |
- 'normalizeSlideIndex', |
|
83 |
- '_centerInsufficientSlides', |
|
84 |
- '_watchOverflow', |
|
85 |
- 'roundLengths', |
|
86 |
- 'touchRatio', |
|
87 |
- 'touchAngle', |
|
88 |
- 'simulateTouch', |
|
89 |
- '_shortSwipes', |
|
90 |
- '_longSwipes', |
|
91 |
- 'longSwipesRatio', |
|
92 |
- 'longSwipesMs', |
|
93 |
- '_followFinger', |
|
94 |
- 'allowTouchMove', |
|
95 |
- '_threshold', |
|
96 |
- 'touchMoveStopPropagation', |
|
97 |
- 'touchStartPreventDefault', |
|
98 |
- 'touchStartForcePreventDefault', |
|
99 |
- 'touchReleaseOnEdges', |
|
100 |
- 'uniqueNavElements', |
|
101 |
- '_resistance', |
|
102 |
- '_resistanceRatio', |
|
103 |
- '_watchSlidesProgress', |
|
104 |
- '_watchSlidesVisibility', |
|
105 |
- '_grabCursor', |
|
106 |
- 'preventClicks', |
|
107 |
- 'preventClicksPropagation', |
|
108 |
- '_slideToClickedSlide', |
|
109 |
- '_preloadImages', |
|
110 |
- 'updateOnImagesReady', |
|
111 |
- '_loop', |
|
112 |
- '_loopAdditionalSlides', |
|
113 |
- '_loopedSlides', |
|
114 |
- '_loopFillGroupWithBlank', |
|
115 |
- 'loopPreventsSlide', |
|
116 |
- '_allowSlidePrev', |
|
117 |
- '_allowSlideNext', |
|
118 |
- '_swipeHandler', |
|
119 |
- '_noSwiping', |
|
120 |
- 'noSwipingClass', |
|
121 |
- 'noSwipingSelector', |
|
122 |
- 'passiveListeners', |
|
123 |
- 'containerModifierClass', |
|
124 |
- 'slideClass', |
|
125 |
- 'slideBlankClass', |
|
126 |
- 'slideActiveClass', |
|
127 |
- 'slideDuplicateActiveClass', |
|
128 |
- 'slideVisibleClass', |
|
129 |
- 'slideDuplicateClass', |
|
130 |
- 'slideNextClass', |
|
131 |
- 'slideDuplicateNextClass', |
|
132 |
- 'slidePrevClass', |
|
133 |
- 'slideDuplicatePrevClass', |
|
134 |
- 'wrapperClass', |
|
135 |
- 'runCallbacksOnInit', |
|
136 |
- 'observer', |
|
137 |
- 'observeParents', |
|
138 |
- 'observeSlideChildren', |
|
139 |
- // modules |
|
140 |
- 'a11y', |
|
141 |
- 'autoplay', |
|
142 |
- '_controller', |
|
143 |
- 'coverflowEffect', |
|
144 |
- 'cubeEffect', |
|
145 |
- 'fadeEffect', |
|
146 |
- 'flipEffect', |
|
147 |
- 'hashNavigation', |
|
148 |
- 'history', |
|
149 |
- 'keyboard', |
|
150 |
- 'lazy', |
|
151 |
- 'mousewheel', |
|
152 |
- '_navigation', |
|
153 |
- '_pagination', |
|
154 |
- 'parallax', |
|
155 |
- '_scrollbar', |
|
156 |
- '_thumbs', |
|
157 |
- 'virtual', |
|
158 |
- 'zoom', |
|
159 |
-]; |
|
160 |
- |
|
161 |
-// eslint-disable-next-line |
|
162 |
-const ɵ0 = (key) => key.replace(/_/, ''); |
|
163 |
-const allowedParams = paramsList.map(ɵ0); |
|
164 |
-function getParams(obj = {}) { |
|
165 |
- const params = { |
|
166 |
- on: {}, |
|
167 |
- }; |
|
168 |
- const passedParams = {}; |
|
169 |
- extend(params, Swiper.defaults); |
|
170 |
- extend(params, Swiper.extendedDefaults); |
|
171 |
- params._emitClasses = true; |
|
172 |
- const rest = {}; |
|
173 |
- Object.keys(obj).forEach((key) => { |
|
174 |
- const _key = key.replace(/^_/, ''); |
|
175 |
- if (typeof obj[_key] === 'undefined') |
|
176 |
- return; |
|
177 |
- if (allowedParams.indexOf(_key) >= 0) { |
|
178 |
- if (isObject(obj[_key])) { |
|
179 |
- params[_key] = {}; |
|
180 |
- passedParams[_key] = {}; |
|
181 |
- extend(params[_key], obj[_key]); |
|
182 |
- extend(passedParams[_key], obj[_key]); |
|
183 |
- } |
|
184 |
- else { |
|
185 |
- params[_key] = obj[_key]; |
|
186 |
- passedParams[_key] = obj[_key]; |
|
187 |
- } |
|
188 |
- } |
|
189 |
- else { |
|
190 |
- rest[_key] = obj[_key]; |
|
191 |
- } |
|
192 |
- }); |
|
193 |
- return { params, passedParams, rest }; |
|
194 |
-} |
|
195 |
- |
|
196 |
-class SwiperSlideDirective { |
|
197 |
- constructor(template) { |
|
198 |
- this.template = template; |
|
199 |
- this.class = ''; |
|
200 |
- this.slideData = { |
|
201 |
- isActive: false, |
|
202 |
- isPrev: false, |
|
203 |
- isNext: false, |
|
204 |
- isVisible: false, |
|
205 |
- isDuplicate: false, |
|
206 |
- }; |
|
207 |
- } |
|
208 |
- set zoom(val) { |
|
209 |
- this._zoom = coerceBooleanProperty(val); |
|
210 |
- } |
|
211 |
- get zoom() { |
|
212 |
- return this._zoom; |
|
213 |
- } |
|
214 |
- get classNames() { |
|
215 |
- return this._classNames; |
|
216 |
- } |
|
217 |
- set classNames(val) { |
|
218 |
- if (this._classNames === val) { |
|
219 |
- return; |
|
220 |
- } |
|
221 |
- this._classNames = val; |
|
222 |
- this.slideData = { |
|
223 |
- isActive: this._hasClass(['swiper-slide-active', 'swiper-slide-duplicate-active']), |
|
224 |
- isVisible: this._hasClass(['swiper-slide-visible']), |
|
225 |
- isDuplicate: this._hasClass(['swiper-slide-duplicate']), |
|
226 |
- isPrev: this._hasClass(['swiper-slide-prev', 'swiper-slide-duplicate-prev']), |
|
227 |
- isNext: this._hasClass(['swiper-slide-next', 'swiper-slide-duplicate-next']), |
|
228 |
- }; |
|
229 |
- } |
|
230 |
- _hasClass(classNames) { |
|
231 |
- return classNames.some((className) => this._classNames.indexOf(className) >= 0); |
|
232 |
- } |
|
233 |
-} |
|
234 |
-SwiperSlideDirective.decorators = [ |
|
235 |
- { type: Directive, args: [{ |
|
236 |
- selector: 'ng-template[swiperSlide]', |
|
237 |
- },] } |
|
238 |
-]; |
|
239 |
-SwiperSlideDirective.ctorParameters = () => [ |
|
240 |
- { type: TemplateRef } |
|
241 |
-]; |
|
242 |
-SwiperSlideDirective.propDecorators = { |
|
243 |
- virtualIndex: [{ type: Input }], |
|
244 |
- class: [{ type: Input }], |
|
245 |
- zoom: [{ type: Input }] |
|
246 |
-}; |
|
247 |
- |
|
248 |
-class SwiperComponent { |
|
249 |
- constructor(_ngZone, elementRef, _changeDetectorRef, _platformId) { |
|
250 |
- this._ngZone = _ngZone; |
|
251 |
- this.elementRef = elementRef; |
|
252 |
- this._changeDetectorRef = _changeDetectorRef; |
|
253 |
- this._platformId = _platformId; |
|
254 |
- this.slideClass = 'swiper-slide'; |
|
255 |
- this.wrapperClass = 'swiper-wrapper'; |
|
256 |
- this.showNavigation = true; |
|
257 |
- this.showPagination = true; |
|
258 |
- this.showScrollbar = true; |
|
259 |
- // prettier-ignore |
|
260 |
- this.s__beforeBreakpoint = new EventEmitter(); |
|
261 |
- // prettier-ignore |
|
262 |
- this.s__containerClasses = new EventEmitter(); |
|
263 |
- // prettier-ignore |
|
264 |
- this.s__slideClass = new EventEmitter(); |
|
265 |
- // prettier-ignore |
|
266 |
- this.s__swiper = new EventEmitter(); |
|
267 |
- // prettier-ignore |
|
268 |
- this.s_activeIndexChange = new EventEmitter(); |
|
269 |
- // prettier-ignore |
|
270 |
- this.s_afterInit = new EventEmitter(); |
|
271 |
- // prettier-ignore |
|
272 |
- this.s_autoplay = new EventEmitter(); |
|
273 |
- // prettier-ignore |
|
274 |
- this.s_autoplayStart = new EventEmitter(); |
|
275 |
- // prettier-ignore |
|
276 |
- this.s_autoplayStop = new EventEmitter(); |
|
277 |
- // prettier-ignore |
|
278 |
- this.s_beforeDestroy = new EventEmitter(); |
|
279 |
- // prettier-ignore |
|
280 |
- this.s_beforeInit = new EventEmitter(); |
|
281 |
- // prettier-ignore |
|
282 |
- this.s_beforeLoopFix = new EventEmitter(); |
|
283 |
- // prettier-ignore |
|
284 |
- this.s_beforeResize = new EventEmitter(); |
|
285 |
- // prettier-ignore |
|
286 |
- this.s_beforeSlideChangeStart = new EventEmitter(); |
|
287 |
- // prettier-ignore |
|
288 |
- this.s_beforeTransitionStart = new EventEmitter(); |
|
289 |
- // prettier-ignore |
|
290 |
- this.s_breakpoint = new EventEmitter(); |
|
291 |
- // prettier-ignore |
|
292 |
- this.s_changeDirection = new EventEmitter(); |
|
293 |
- // prettier-ignore |
|
294 |
- this.s_click = new EventEmitter(); |
|
295 |
- // prettier-ignore |
|
296 |
- this.s_doubleTap = new EventEmitter(); |
|
297 |
- // prettier-ignore |
|
298 |
- this.s_doubleClick = new EventEmitter(); |
|
299 |
- // prettier-ignore |
|
300 |
- this.s_destroy = new EventEmitter(); |
|
301 |
- // prettier-ignore |
|
302 |
- this.s_fromEdge = new EventEmitter(); |
|
303 |
- // prettier-ignore |
|
304 |
- this.s_hashChange = new EventEmitter(); |
|
305 |
- // prettier-ignore |
|
306 |
- this.s_hashSet = new EventEmitter(); |
|
307 |
- // prettier-ignore |
|
308 |
- this.s_imagesReady = new EventEmitter(); |
|
309 |
- // prettier-ignore |
|
310 |
- this.s_init = new EventEmitter(); |
|
311 |
- // prettier-ignore |
|
312 |
- this.s_keyPress = new EventEmitter(); |
|
313 |
- // prettier-ignore |
|
314 |
- this.s_lazyImageLoad = new EventEmitter(); |
|
315 |
- // prettier-ignore |
|
316 |
- this.s_lazyImageReady = new EventEmitter(); |
|
317 |
- // prettier-ignore |
|
318 |
- this.s_loopFix = new EventEmitter(); |
|
319 |
- // prettier-ignore |
|
320 |
- this.s_momentumBounce = new EventEmitter(); |
|
321 |
- // prettier-ignore |
|
322 |
- this.s_navigationHide = new EventEmitter(); |
|
323 |
- // prettier-ignore |
|
324 |
- this.s_navigationShow = new EventEmitter(); |
|
325 |
- // prettier-ignore |
|
326 |
- this.s_observerUpdate = new EventEmitter(); |
|
327 |
- // prettier-ignore |
|
328 |
- this.s_orientationchange = new EventEmitter(); |
|
329 |
- // prettier-ignore |
|
330 |
- this.s_paginationHide = new EventEmitter(); |
|
331 |
- // prettier-ignore |
|
332 |
- this.s_paginationRender = new EventEmitter(); |
|
333 |
- // prettier-ignore |
|
334 |
- this.s_paginationShow = new EventEmitter(); |
|
335 |
- // prettier-ignore |
|
336 |
- this.s_paginationUpdate = new EventEmitter(); |
|
337 |
- // prettier-ignore |
|
338 |
- this.s_progress = new EventEmitter(); |
|
339 |
- // prettier-ignore |
|
340 |
- this.s_reachBeginning = new EventEmitter(); |
|
341 |
- // prettier-ignore |
|
342 |
- this.s_reachEnd = new EventEmitter(); |
|
343 |
- // prettier-ignore |
|
344 |
- this.s_realIndexChange = new EventEmitter(); |
|
345 |
- // prettier-ignore |
|
346 |
- this.s_resize = new EventEmitter(); |
|
347 |
- // prettier-ignore |
|
348 |
- this.s_scroll = new EventEmitter(); |
|
349 |
- // prettier-ignore |
|
350 |
- this.s_scrollbarDragEnd = new EventEmitter(); |
|
351 |
- // prettier-ignore |
|
352 |
- this.s_scrollbarDragMove = new EventEmitter(); |
|
353 |
- // prettier-ignore |
|
354 |
- this.s_scrollbarDragStart = new EventEmitter(); |
|
355 |
- // prettier-ignore |
|
356 |
- this.s_setTransition = new EventEmitter(); |
|
357 |
- // prettier-ignore |
|
358 |
- this.s_setTranslate = new EventEmitter(); |
|
359 |
- // prettier-ignore |
|
360 |
- this.s_slideChange = new EventEmitter(); |
|
361 |
- // prettier-ignore |
|
362 |
- this.s_slideChangeTransitionEnd = new EventEmitter(); |
|
363 |
- // prettier-ignore |
|
364 |
- this.s_slideChangeTransitionStart = new EventEmitter(); |
|
365 |
- // prettier-ignore |
|
366 |
- this.s_slideNextTransitionEnd = new EventEmitter(); |
|
367 |
- // prettier-ignore |
|
368 |
- this.s_slideNextTransitionStart = new EventEmitter(); |
|
369 |
- // prettier-ignore |
|
370 |
- this.s_slidePrevTransitionEnd = new EventEmitter(); |
|
371 |
- // prettier-ignore |
|
372 |
- this.s_slidePrevTransitionStart = new EventEmitter(); |
|
373 |
- // prettier-ignore |
|
374 |
- this.s_slideResetTransitionStart = new EventEmitter(); |
|
375 |
- // prettier-ignore |
|
376 |
- this.s_slideResetTransitionEnd = new EventEmitter(); |
|
377 |
- // prettier-ignore |
|
378 |
- this.s_sliderMove = new EventEmitter(); |
|
379 |
- // prettier-ignore |
|
380 |
- this.s_sliderFirstMove = new EventEmitter(); |
|
381 |
- // prettier-ignore |
|
382 |
- this.s_slidesLengthChange = new EventEmitter(); |
|
383 |
- // prettier-ignore |
|
384 |
- this.s_slidesGridLengthChange = new EventEmitter(); |
|
385 |
- // prettier-ignore |
|
386 |
- this.s_snapGridLengthChange = new EventEmitter(); |
|
387 |
- // prettier-ignore |
|
388 |
- this.s_snapIndexChange = new EventEmitter(); |
|
389 |
- // prettier-ignore |
|
390 |
- this.s_tap = new EventEmitter(); |
|
391 |
- // prettier-ignore |
|
392 |
- this.s_toEdge = new EventEmitter(); |
|
393 |
- // prettier-ignore |
|
394 |
- this.s_touchEnd = new EventEmitter(); |
|
395 |
- // prettier-ignore |
|
396 |
- this.s_touchMove = new EventEmitter(); |
|
397 |
- // prettier-ignore |
|
398 |
- this.s_touchMoveOpposite = new EventEmitter(); |
|
399 |
- // prettier-ignore |
|
400 |
- this.s_touchStart = new EventEmitter(); |
|
401 |
- // prettier-ignore |
|
402 |
- this.s_transitionEnd = new EventEmitter(); |
|
403 |
- // prettier-ignore |
|
404 |
- this.s_transitionStart = new EventEmitter(); |
|
405 |
- // prettier-ignore |
|
406 |
- this.s_update = new EventEmitter(); |
|
407 |
- // prettier-ignore |
|
408 |
- this.s_zoomChange = new EventEmitter(); |
|
409 |
- // prettier-ignore |
|
410 |
- this.s_swiper = new EventEmitter(); |
|
411 |
- this.indexChange = new EventEmitter(); |
|
412 |
- this._activeSlides = new Subject(); |
|
413 |
- this.containerClasses = 'swiper-container'; |
|
414 |
- this.slidesChanges = (val) => { |
|
415 |
- this.slides = val.map((slide, index) => { |
|
416 |
- slide.slideIndex = index; |
|
417 |
- slide.classNames = this.slideClass; |
|
418 |
- return slide; |
|
419 |
- }); |
|
420 |
- if (this.loop && !this.loopedSlides) { |
|
421 |
- this.calcLoopedSlides(); |
|
422 |
- } |
|
423 |
- if (!this.virtual) { |
|
424 |
- this.prependSlides = of(this.slides.slice(this.slides.length - this.loopedSlides)); |
|
425 |
- this.appendSlides = of(this.slides.slice(0, this.loopedSlides)); |
|
426 |
- } |
|
427 |
- this._changeDetectorRef.detectChanges(); |
|
428 |
- }; |
|
429 |
- this.style = null; |
|
430 |
- this.updateVirtualSlides = (virtualData) => { |
|
431 |
- // TODO: type virtualData |
|
432 |
- if (!this.swiperRef || |
|
433 |
- (this.currentVirtualData && |
|
434 |
- this.currentVirtualData.from === virtualData.from && |
|
435 |
- this.currentVirtualData.to === virtualData.to && |
|
436 |
- this.currentVirtualData.offset === virtualData.offset)) { |
|
437 |
- return; |
|
438 |
- } |
|
439 |
- this.style = this.swiperRef.isHorizontal() |
|
440 |
- ? { |
|
441 |
- [this.swiperRef.rtlTranslate ? 'right' : 'left']: `${virtualData.offset}px`, |
|
442 |
- } |
|
443 |
- : { |
|
444 |
- top: `${virtualData.offset}px`, |
|
445 |
- }; |
|
446 |
- this.currentVirtualData = virtualData; |
|
447 |
- this._activeSlides.next(virtualData.slides); |
|
448 |
- this._changeDetectorRef.detectChanges(); |
|
449 |
- this._ngZone.runOutsideAngular(() => { |
|
450 |
- this.swiperRef.updateSlides(); |
|
451 |
- this.swiperRef.updateProgress(); |
|
452 |
- this.swiperRef.updateSlidesClasses(); |
|
453 |
- if (this.swiperRef.lazy && this.swiperRef.params.lazy['enabled']) { |
|
454 |
- this.swiperRef.lazy.load(); |
|
455 |
- } |
|
456 |
- this.swiperRef.virtual.update(true); |
|
457 |
- }); |
|
458 |
- return; |
|
459 |
- }; |
|
460 |
- } |
|
461 |
- set navigation(val) { |
|
462 |
- var _a, _b, _c, _d; |
|
463 |
- const currentNext = typeof this._navigation !== 'boolean' ? (_a = this._navigation) === null || _a === void 0 ? void 0 : _a.nextEl : null; |
|
464 |
- const currentPrev = typeof this._navigation !== 'boolean' ? (_b = this._navigation) === null || _b === void 0 ? void 0 : _b.prevEl : null; |
|
465 |
- this._navigation = setProperty(val, { |
|
466 |
- nextEl: currentNext || null, |
|
467 |
- prevEl: currentPrev || null, |
|
468 |
- }); |
|
469 |
- if (typeof this._navigation !== 'boolean' && |
|
470 |
- (typeof ((_c = this._navigation) === null || _c === void 0 ? void 0 : _c.nextEl) === 'string' || typeof ((_d = this._navigation) === null || _d === void 0 ? void 0 : _d.prevEl) === 'string')) { |
|
471 |
- this.showNavigation = false; |
|
472 |
- } |
|
473 |
- } |
|
474 |
- get navigation() { |
|
475 |
- return this._navigation; |
|
476 |
- } |
|
477 |
- set pagination(val) { |
|
478 |
- var _a, _b; |
|
479 |
- const current = typeof this._pagination !== 'boolean' ? (_a = this._pagination) === null || _a === void 0 ? void 0 : _a.el : null; |
|
480 |
- this._pagination = setProperty(val, { |
|
481 |
- el: current || null, |
|
482 |
- }); |
|
483 |
- if (typeof this._pagination !== 'boolean' && typeof ((_b = this._pagination) === null || _b === void 0 ? void 0 : _b.el) === 'string') { |
|
484 |
- this.showPagination = false; |
|
485 |
- } |
|
486 |
- } |
|
487 |
- get pagination() { |
|
488 |
- return this._pagination; |
|
489 |
- } |
|
490 |
- set scrollbar(val) { |
|
491 |
- var _a, _b; |
|
492 |
- const current = typeof this._scrollbar !== 'boolean' ? (_a = this._scrollbar) === null || _a === void 0 ? void 0 : _a.el : null; |
|
493 |
- this._scrollbar = setProperty(val, { |
|
494 |
- el: current || null, |
|
495 |
- }); |
|
496 |
- if (typeof this._scrollbar !== 'boolean' && typeof ((_b = this._scrollbar) === null || _b === void 0 ? void 0 : _b.el) === 'string') { |
|
497 |
- this.showScrollbar = false; |
|
498 |
- } |
|
499 |
- } |
|
500 |
- get scrollbar() { |
|
501 |
- return this._scrollbar; |
|
502 |
- } |
|
503 |
- set virtual(val) { |
|
504 |
- this._virtual = setProperty(val); |
|
505 |
- } |
|
506 |
- get virtual() { |
|
507 |
- return this._virtual; |
|
508 |
- } |
|
509 |
- set index(index) { |
|
510 |
- this.setIndex(index); |
|
511 |
- } |
|
512 |
- set config(val) { |
|
513 |
- this.updateSwiper(val); |
|
514 |
- const { params } = getParams(val); |
|
515 |
- Object.assign(this, params); |
|
516 |
- } |
|
517 |
- set prevElRef(el) { |
|
518 |
- this._setElement(el, this.navigation, 'navigation', 'prevEl'); |
|
519 |
- } |
|
520 |
- set nextElRef(el) { |
|
521 |
- this._setElement(el, this.navigation, 'navigation', 'nextEl'); |
|
522 |
- } |
|
523 |
- set scrollbarElRef(el) { |
|
524 |
- this._setElement(el, this.scrollbar, 'scrollbar'); |
|
525 |
- } |
|
526 |
- set paginationElRef(el) { |
|
527 |
- this._setElement(el, this.pagination, 'pagination'); |
|
528 |
- } |
|
529 |
- get activeSlides() { |
|
530 |
- if (this.virtual) { |
|
531 |
- return this._activeSlides; |
|
532 |
- } |
|
533 |
- return of(this.slides); |
|
534 |
- } |
|
535 |
- get zoomContainerClass() { |
|
536 |
- return typeof this.zoom !== 'boolean' ? this.zoom.containerClass : 'swiper-zoom-container'; |
|
537 |
- } |
|
538 |
- _setElement(el, ref, update, key = 'el') { |
|
539 |
- if (!el || !ref) { |
|
540 |
- return; |
|
541 |
- } |
|
542 |
- if (ref && el.nativeElement) { |
|
543 |
- if (ref[key] === el.nativeElement) { |
|
544 |
- return; |
|
545 |
- } |
|
546 |
- ref[key] = el.nativeElement; |
|
547 |
- } |
|
548 |
- const updateObj = {}; |
|
549 |
- updateObj[update] = true; |
|
550 |
- this.updateInitSwiper(updateObj); |
|
551 |
- } |
|
552 |
- ngOnInit() { |
|
553 |
- const { params } = getParams(this); |
|
554 |
- Object.assign(this, params); |
|
555 |
- } |
|
556 |
- ngAfterViewInit() { |
|
557 |
- this.childrenSlidesInit(); |
|
558 |
- this.initSwiper(); |
|
559 |
- this._changeDetectorRef.detectChanges(); |
|
560 |
- setTimeout(() => { |
|
561 |
- this.s_swiper.emit(this.swiperRef); |
|
562 |
- }); |
|
563 |
- } |
|
564 |
- childrenSlidesInit() { |
|
565 |
- this.slidesChanges(this.slidesEl); |
|
566 |
- this.slidesEl.changes.subscribe(this.slidesChanges); |
|
567 |
- } |
|
568 |
- get isSwiperActive() { |
|
569 |
- return this.swiperRef && !this.swiperRef.destroyed; |
|
570 |
- } |
|
571 |
- initSwiper() { |
|
572 |
- const { params: swiperParams, passedParams } = getParams(this); |
|
573 |
- Object.assign(this, swiperParams); |
|
574 |
- this._ngZone.runOutsideAngular(() => { |
|
575 |
- swiperParams.init = false; |
|
576 |
- if (!swiperParams.virtual) { |
|
577 |
- swiperParams.observer = true; |
|
578 |
- } |
|
579 |
- swiperParams.onAny = (event, ...args) => { |
|
580 |
- const emitter = this[`s_${event}`]; |
|
581 |
- if (emitter) { |
|
582 |
- emitter.emit(...args); |
|
583 |
- } |
|
584 |
- }; |
|
585 |
- Object.assign(swiperParams.on, { |
|
586 |
- _containerClasses(swiper, classes) { |
|
587 |
- this.containerClasses = classes; |
|
588 |
- }, |
|
589 |
- _slideClasses: (_, updated) => { |
|
590 |
- updated.forEach(({ slideEl, classNames }, index) => { |
|
591 |
- const slideIndex = parseInt(slideEl.getAttribute('data-swiper-slide-index')) || index; |
|
592 |
- if (this.virtual) { |
|
593 |
- const virtualSlide = this.slides.find((item) => { |
|
594 |
- return item.virtualIndex && item.virtualIndex === slideIndex; |
|
595 |
- }); |
|
596 |
- if (virtualSlide) { |
|
597 |
- virtualSlide.classNames = classNames; |
|
598 |
- return; |
|
599 |
- } |
|
600 |
- } |
|
601 |
- if (this.slides[slideIndex]) { |
|
602 |
- this.slides[slideIndex].classNames = classNames; |
|
603 |
- } |
|
604 |
- }); |
|
605 |
- this._changeDetectorRef.detectChanges(); |
|
606 |
- }, |
|
607 |
- }); |
|
608 |
- const swiperRef = new Swiper(swiperParams); |
|
609 |
- swiperRef.loopCreate = () => { }; |
|
610 |
- swiperRef.loopDestroy = () => { }; |
|
611 |
- if (swiperParams.loop) { |
|
612 |
- swiperRef.loopedSlides = this.loopedSlides; |
|
613 |
- } |
|
614 |
- if (swiperRef.virtual && swiperRef.params.virtual.enabled) { |
|
615 |
- swiperRef.virtual.slides = this.slides; |
|
616 |
- const extendWith = { |
|
617 |
- cache: false, |
|
618 |
- renderExternal: this.updateVirtualSlides, |
|
619 |
- renderExternalUpdate: false, |
|
620 |
- }; |
|
621 |
- extend(swiperRef.params.virtual, extendWith); |
|
622 |
- extend(swiperRef.originalParams.virtual, extendWith); |
|
623 |
- } |
|
624 |
- if (isPlatformBrowser(this._platformId)) { |
|
625 |
- this.swiperRef = swiperRef.init(this.elementRef.nativeElement); |
|
626 |
- if (this.swiperRef.virtual && this.swiperRef.params.virtual.enabled) { |
|
627 |
- this.swiperRef.virtual.update(true); |
|
628 |
- } |
|
629 |
- this._changeDetectorRef.detectChanges(); |
|
630 |
- swiperRef.on('slideChange', () => { |
|
631 |
- this.indexChange.emit(this.swiperRef.realIndex); |
|
632 |
- }); |
|
633 |
- } |
|
634 |
- }); |
|
635 |
- } |
|
636 |
- ngOnChanges(changedParams) { |
|
637 |
- this.updateSwiper(changedParams); |
|
638 |
- this._changeDetectorRef.detectChanges(); |
|
639 |
- } |
|
640 |
- updateInitSwiper(changedParams) { |
|
641 |
- if (!(changedParams && this.swiperRef && !this.swiperRef.destroyed)) { |
|
642 |
- return; |
|
643 |
- } |
|
644 |
- this._ngZone.runOutsideAngular(() => { |
|
645 |
- const { params: currentParams, pagination, navigation, scrollbar, virtual, thumbs, } = this.swiperRef; |
|
646 |
- if (changedParams.pagination) { |
|
647 |
- if (this.pagination && |
|
648 |
- typeof this.pagination !== 'boolean' && |
|
649 |
- this.pagination.el && |
|
650 |
- pagination && |
|
651 |
- !pagination.el) { |
|
652 |
- this.updateParameter('pagination', this.pagination); |
|
653 |
- pagination.init(); |
|
654 |
- pagination.render(); |
|
655 |
- pagination.update(); |
|
656 |
- } |
|
657 |
- else { |
|
658 |
- pagination.destroy(); |
|
659 |
- pagination.el = null; |
|
660 |
- } |
|
661 |
- } |
|
662 |
- if (changedParams.scrollbar) { |
|
663 |
- if (this.scrollbar && |
|
664 |
- typeof this.scrollbar !== 'boolean' && |
|
665 |
- this.scrollbar.el && |
|
666 |
- scrollbar && |
|
667 |
- !scrollbar.el) { |
|
668 |
- this.updateParameter('scrollbar', this.scrollbar); |
|
669 |
- scrollbar.init(); |
|
670 |
- scrollbar.updateSize(); |
|
671 |
- scrollbar.setTranslate(); |
|
672 |
- } |
|
673 |
- else { |
|
674 |
- scrollbar.destroy(); |
|
675 |
- scrollbar.el = null; |
|
676 |
- } |
|
677 |
- } |
|
678 |
- if (changedParams.navigation) { |
|
679 |
- if (this.navigation && |
|
680 |
- typeof this.navigation !== 'boolean' && |
|
681 |
- this.navigation.prevEl && |
|
682 |
- this.navigation.nextEl && |
|
683 |
- navigation && |
|
684 |
- !navigation.prevEl && |
|
685 |
- !navigation.nextEl) { |
|
686 |
- this.updateParameter('navigation', this.navigation); |
|
687 |
- navigation.init(); |
|
688 |
- navigation.update(); |
|
689 |
- } |
|
690 |
- else if (navigation.prevEl && navigation.nextEl) { |
|
691 |
- navigation.destroy(); |
|
692 |
- navigation.nextEl = null; |
|
693 |
- navigation.prevEl = null; |
|
694 |
- } |
|
695 |
- } |
|
696 |
- if (changedParams.thumbs && this.thumbs && this.thumbs.swiper) { |
|
697 |
- this.updateParameter('thumbs', this.thumbs); |
|
698 |
- const initialized = thumbs.init(); |
|
699 |
- if (initialized) |
|
700 |
- thumbs.update(true); |
|
701 |
- } |
|
702 |
- if (changedParams.controller && this.controller && this.controller.control) { |
|
703 |
- this.swiperRef.controller.control = this.controller.control; |
|
704 |
- } |
|
705 |
- this.swiperRef.update(); |
|
706 |
- }); |
|
707 |
- } |
|
708 |
- updateSwiper(changedParams) { |
|
709 |
- this._ngZone.runOutsideAngular(() => { |
|
710 |
- var _a, _b; |
|
711 |
- if (changedParams.config) { |
|
712 |
- return; |
|
713 |
- } |
|
714 |
- if (!(changedParams && this.swiperRef && !this.swiperRef.destroyed)) { |
|
715 |
- return; |
|
716 |
- } |
|
717 |
- for (const key in changedParams) { |
|
718 |
- if (ignoreNgOnChanges.indexOf(key) >= 0) { |
|
719 |
- continue; |
|
720 |
- } |
|
721 |
- const newValue = (_b = (_a = changedParams[key]) === null || _a === void 0 ? void 0 : _a.currentValue) !== null && _b !== void 0 ? _b : changedParams[key]; |
|
722 |
- this.updateParameter(key, newValue); |
|
723 |
- } |
|
724 |
- if (changedParams.allowSlideNext) { |
|
725 |
- this.swiperRef.allowSlideNext = this.allowSlideNext; |
|
726 |
- } |
|
727 |
- if (changedParams.allowSlidePrev) { |
|
728 |
- this.swiperRef.allowSlidePrev = this.allowSlidePrev; |
|
729 |
- } |
|
730 |
- if (changedParams.direction) { |
|
731 |
- this.swiperRef.changeDirection(this.direction, false); |
|
732 |
- } |
|
733 |
- if (changedParams.breakpoints) { |
|
734 |
- if (this.loop && !this.loopedSlides) { |
|
735 |
- this.calcLoopedSlides(); |
|
736 |
- } |
|
737 |
- this.swiperRef.currentBreakpoint = null; |
|
738 |
- this.swiperRef.setBreakpoint(); |
|
739 |
- } |
|
740 |
- if (changedParams.thumbs || changedParams.controller) { |
|
741 |
- this.updateInitSwiper(changedParams); |
|
742 |
- } |
|
743 |
- this.swiperRef.update(); |
|
744 |
- }); |
|
745 |
- } |
|
746 |
- calcLoopedSlides() { |
|
747 |
- if (!this.loop) { |
|
748 |
- return; |
|
749 |
- } |
|
750 |
- let slidesPerViewParams = this.slidesPerView; |
|
751 |
- if (this.breakpoints) { |
|
752 |
- const breakpoint = Swiper.prototype.getBreakpoint(this.breakpoints); |
|
753 |
- const breakpointOnlyParams = breakpoint in this.breakpoints ? this.breakpoints[breakpoint] : undefined; |
|
754 |
- if (breakpointOnlyParams && breakpointOnlyParams.slidesPerView) { |
|
755 |
- slidesPerViewParams = breakpointOnlyParams.slidesPerView; |
|
756 |
- } |
|
757 |
- } |
|
758 |
- if (slidesPerViewParams === 'auto') { |
|
759 |
- this.loopedSlides = this.slides.length; |
|
760 |
- return this.slides.length; |
|
761 |
- } |
|
762 |
- let loopedSlides = this.loopedSlides || slidesPerViewParams; |
|
763 |
- loopedSlides += this.loopAdditionalSlides; |
|
764 |
- if (loopedSlides > this.slides.length) { |
|
765 |
- loopedSlides = this.slides.length; |
|
766 |
- } |
|
767 |
- this.loopedSlides = loopedSlides; |
|
768 |
- return loopedSlides; |
|
769 |
- } |
|
770 |
- updateParameter(key, value) { |
|
771 |
- if (!(this.swiperRef && !this.swiperRef.destroyed)) { |
|
772 |
- return; |
|
773 |
- } |
|
774 |
- const _key = key.replace(/^_/, ''); |
|
775 |
- if (Object.keys(this.swiperRef.modules).indexOf(_key) >= 0) { |
|
776 |
- extend(value, this.swiperRef.modules[_key].params[_key]); |
|
777 |
- } |
|
778 |
- if (isObject(this.swiperRef.params[_key]) && isObject(value)) { |
|
779 |
- extend(this.swiperRef.params[_key], value); |
|
780 |
- } |
|
781 |
- else { |
|
782 |
- this.swiperRef.params[_key] = value; |
|
783 |
- } |
|
784 |
- } |
|
785 |
- setIndex(index, speed, silent) { |
|
786 |
- if (!this.isSwiperActive) { |
|
787 |
- this.initialSlide = index; |
|
788 |
- return; |
|
789 |
- } |
|
790 |
- if (index === this.swiperRef.activeIndex) { |
|
791 |
- return; |
|
792 |
- } |
|
793 |
- this._ngZone.runOutsideAngular(() => { |
|
794 |
- if (this.loop) { |
|
795 |
- this.swiperRef.slideToLoop(index, speed, !silent); |
|
796 |
- } |
|
797 |
- else { |
|
798 |
- this.swiperRef.slideTo(index, speed, !silent); |
|
799 |
- } |
|
800 |
- }); |
|
801 |
- } |
|
802 |
- ngOnDestroy() { |
|
803 |
- this._ngZone.runOutsideAngular(() => { |
|
804 |
- var _a; |
|
805 |
- (_a = this.swiperRef) === null || _a === void 0 ? void 0 : _a.destroy(); |
|
806 |
- }); |
|
807 |
- } |
|
808 |
-} |
|
809 |
-SwiperComponent.decorators = [ |
|
810 |
- { type: Component, args: [{ |
|
811 |
- selector: 'swiper, [swiper]', |
|
812 |
- template: "<ng-content select=\"[slot=container-start]\"></ng-content>\n<ng-container *ngIf=\"navigation && showNavigation\">\n <div class=\"swiper-button-prev\" #prevElRef></div>\n <div class=\"swiper-button-next\" #nextElRef></div>\n</ng-container>\n<div *ngIf=\"scrollbar && showScrollbar\" class=\"swiper-scrollbar\" #scrollbarElRef></div>\n<div *ngIf=\"pagination && showPagination\" class=\"swiper-pagination\" #paginationElRef></div>\n<div [ngClass]=\"wrapperClass\">\n <ng-content select=\"[slot=wrapper-start]\"></ng-content>\n <ng-template\n *ngTemplateOutlet=\"\n slidesTemplate;\n context: {\n loopSlides: prependSlides,\n key: 'prepend'\n }\n \"\n ></ng-template>\n <ng-template\n *ngTemplateOutlet=\"\n slidesTemplate;\n context: {\n loopSlides: activeSlides,\n key: ''\n }\n \"\n ></ng-template>\n <ng-template\n *ngTemplateOutlet=\"\n slidesTemplate;\n context: {\n loopSlides: appendSlides,\n key: 'append'\n }\n \"\n ></ng-template>\n <ng-content select=\"[slot=wrapper-end]\"></ng-content>\n</div>\n<ng-content select=\"[slot=container-end]\"></ng-content>\n\n<ng-template #slidesTemplate let-loopSlides=\"loopSlides\" let-slideKey=\"key\">\n <div\n *ngFor=\"let slide of loopSlides | async\"\n [ngClass]=\"\n (slide.class ? slide.class + ' ' : '') +\n slideClass +\n (slideKey !== '' ? ' ' + slideDuplicateClass : '')\n \"\n [attr.data-swiper-slide-index]=\"slide.virtualIndex ? slide.virtualIndex : slide.slideIndex\"\n [style]=\"style\"\n [ngSwitch]=\"slide.zoom\"\n >\n <div *ngSwitchCase=\"true\" [ngClass]=\"zoomContainerClass\">\n <ng-template\n [ngTemplateOutlet]=\"slide.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: slide.slideData\n }\"\n ></ng-template>\n </div>\n <ng-container *ngSwitchDefault>\n <ng-template\n [ngTemplateOutlet]=\"slide.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: slide.slideData\n }\"\n ></ng-template>\n </ng-container>\n </div>\n</ng-template>\n", |
|
813 |
- changeDetection: ChangeDetectionStrategy.OnPush, |
|
814 |
- encapsulation: ViewEncapsulation.None, |
|
815 |
- styles: [` |
|
816 |
- swiper { |
|
817 |
- display: block; |
|
818 |
- } |
|
819 |
- `] |
|
820 |
- },] } |
|
821 |
-]; |
|
822 |
-SwiperComponent.ctorParameters = () => [ |
|
823 |
- { type: NgZone }, |
|
824 |
- { type: ElementRef }, |
|
825 |
- { type: ChangeDetectorRef }, |
|
826 |
- { type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] } |
|
827 |
-]; |
|
828 |
-SwiperComponent.propDecorators = { |
|
829 |
- direction: [{ type: Input }], |
|
830 |
- touchEventsTarget: [{ type: Input }], |
|
831 |
- initialSlide: [{ type: Input }], |
|
832 |
- speed: [{ type: Input }], |
|
833 |
- cssMode: [{ type: Input }], |
|
834 |
- updateOnWindowResize: [{ type: Input }], |
|
835 |
- resizeObserver: [{ type: Input }], |
|
836 |
- nested: [{ type: Input }], |
|
837 |
- width: [{ type: Input }], |
|
838 |
- height: [{ type: Input }], |
|
839 |
- preventInteractionOnTransition: [{ type: Input }], |
|
840 |
- userAgent: [{ type: Input }], |
|
841 |
- url: [{ type: Input }], |
|
842 |
- edgeSwipeDetection: [{ type: Input }], |
|
843 |
- edgeSwipeThreshold: [{ type: Input }], |
|
844 |
- freeMode: [{ type: Input }], |
|
845 |
- freeModeMomentum: [{ type: Input }], |
|
846 |
- freeModeMomentumRatio: [{ type: Input }], |
|
847 |
- freeModeMomentumBounce: [{ type: Input }], |
|
848 |
- freeModeMomentumBounceRatio: [{ type: Input }], |
|
849 |
- freeModeMomentumVelocityRatio: [{ type: Input }], |
|
850 |
- freeModeSticky: [{ type: Input }], |
|
851 |
- freeModeMinimumVelocity: [{ type: Input }], |
|
852 |
- autoHeight: [{ type: Input }], |
|
853 |
- setWrapperSize: [{ type: Input }], |
|
854 |
- virtualTranslate: [{ type: Input }], |
|
855 |
- effect: [{ type: Input }], |
|
856 |
- breakpoints: [{ type: Input }], |
|
857 |
- spaceBetween: [{ type: Input }], |
|
858 |
- slidesPerView: [{ type: Input }], |
|
859 |
- slidesPerColumn: [{ type: Input }], |
|
860 |
- slidesPerColumnFill: [{ type: Input }], |
|
861 |
- slidesPerGroup: [{ type: Input }], |
|
862 |
- slidesPerGroupSkip: [{ type: Input }], |
|
863 |
- centeredSlides: [{ type: Input }], |
|
864 |
- centeredSlidesBounds: [{ type: Input }], |
|
865 |
- slidesOffsetBefore: [{ type: Input }], |
|
866 |
- slidesOffsetAfter: [{ type: Input }], |
|
867 |
- normalizeSlideIndex: [{ type: Input }], |
|
868 |
- centerInsufficientSlides: [{ type: Input }], |
|
869 |
- watchOverflow: [{ type: Input }], |
|
870 |
- roundLengths: [{ type: Input }], |
|
871 |
- touchRatio: [{ type: Input }], |
|
872 |
- touchAngle: [{ type: Input }], |
|
873 |
- simulateTouch: [{ type: Input }], |
|
874 |
- shortSwipes: [{ type: Input }], |
|
875 |
- longSwipes: [{ type: Input }], |
|
876 |
- longSwipesRatio: [{ type: Input }], |
|
877 |
- longSwipesMs: [{ type: Input }], |
|
878 |
- followFinger: [{ type: Input }], |
|
879 |
- allowTouchMove: [{ type: Input }], |
|
880 |
- threshold: [{ type: Input }], |
|
881 |
- touchMoveStopPropagation: [{ type: Input }], |
|
882 |
- touchStartPreventDefault: [{ type: Input }], |
|
883 |
- touchStartForcePreventDefault: [{ type: Input }], |
|
884 |
- touchReleaseOnEdges: [{ type: Input }], |
|
885 |
- uniqueNavElements: [{ type: Input }], |
|
886 |
- resistance: [{ type: Input }], |
|
887 |
- resistanceRatio: [{ type: Input }], |
|
888 |
- watchSlidesProgress: [{ type: Input }], |
|
889 |
- watchSlidesVisibility: [{ type: Input }], |
|
890 |
- grabCursor: [{ type: Input }], |
|
891 |
- preventClicks: [{ type: Input }], |
|
892 |
- preventClicksPropagation: [{ type: Input }], |
|
893 |
- slideToClickedSlide: [{ type: Input }], |
|
894 |
- preloadImages: [{ type: Input }], |
|
895 |
- updateOnImagesReady: [{ type: Input }], |
|
896 |
- loop: [{ type: Input }], |
|
897 |
- loopAdditionalSlides: [{ type: Input }], |
|
898 |
- loopedSlides: [{ type: Input }], |
|
899 |
- loopFillGroupWithBlank: [{ type: Input }], |
|
900 |
- loopPreventsSlide: [{ type: Input }], |
|
901 |
- allowSlidePrev: [{ type: Input }], |
|
902 |
- allowSlideNext: [{ type: Input }], |
|
903 |
- swipeHandler: [{ type: Input }], |
|
904 |
- noSwiping: [{ type: Input }], |
|
905 |
- noSwipingClass: [{ type: Input }], |
|
906 |
- noSwipingSelector: [{ type: Input }], |
|
907 |
- passiveListeners: [{ type: Input }], |
|
908 |
- containerModifierClass: [{ type: Input }], |
|
909 |
- slideClass: [{ type: Input }], |
|
910 |
- slideBlankClass: [{ type: Input }], |
|
911 |
- slideActiveClass: [{ type: Input }], |
|
912 |
- slideDuplicateActiveClass: [{ type: Input }], |
|
913 |
- slideVisibleClass: [{ type: Input }], |
|
914 |
- slideDuplicateClass: [{ type: Input }], |
|
915 |
- slideNextClass: [{ type: Input }], |
|
916 |
- slideDuplicateNextClass: [{ type: Input }], |
|
917 |
- slidePrevClass: [{ type: Input }], |
|
918 |
- slideDuplicatePrevClass: [{ type: Input }], |
|
919 |
- wrapperClass: [{ type: Input }], |
|
920 |
- runCallbacksOnInit: [{ type: Input }], |
|
921 |
- observeParents: [{ type: Input }], |
|
922 |
- observeSlideChildren: [{ type: Input }], |
|
923 |
- a11y: [{ type: Input }], |
|
924 |
- autoplay: [{ type: Input }], |
|
925 |
- controller: [{ type: Input }], |
|
926 |
- coverflowEffect: [{ type: Input }], |
|
927 |
- cubeEffect: [{ type: Input }], |
|
928 |
- fadeEffect: [{ type: Input }], |
|
929 |
- flipEffect: [{ type: Input }], |
|
930 |
- hashNavigation: [{ type: Input }], |
|
931 |
- history: [{ type: Input }], |
|
932 |
- keyboard: [{ type: Input }], |
|
933 |
- lazy: [{ type: Input }], |
|
934 |
- mousewheel: [{ type: Input }], |
|
935 |
- parallax: [{ type: Input }], |
|
936 |
- thumbs: [{ type: Input }], |
|
937 |
- zoom: [{ type: Input }], |
|
938 |
- navigation: [{ type: Input }], |
|
939 |
- pagination: [{ type: Input }], |
|
940 |
- scrollbar: [{ type: Input }], |
|
941 |
- virtual: [{ type: Input }], |
|
942 |
- index: [{ type: Input }], |
|
943 |
- config: [{ type: Input }], |
|
944 |
- s__beforeBreakpoint: [{ type: Output, args: ['_beforeBreakpoint',] }], |
|
945 |
- s__containerClasses: [{ type: Output, args: ['_containerClasses',] }], |
|
946 |
- s__slideClass: [{ type: Output, args: ['_slideClass',] }], |
|
947 |
- s__swiper: [{ type: Output, args: ['_swiper',] }], |
|
948 |
- s_activeIndexChange: [{ type: Output, args: ['activeIndexChange',] }], |
|
949 |
- s_afterInit: [{ type: Output, args: ['afterInit',] }], |
|
950 |
- s_autoplay: [{ type: Output, args: ['autoplay',] }], |
|
951 |
- s_autoplayStart: [{ type: Output, args: ['autoplayStart',] }], |
|
952 |
- s_autoplayStop: [{ type: Output, args: ['autoplayStop',] }], |
|
953 |
- s_beforeDestroy: [{ type: Output, args: ['beforeDestroy',] }], |
|
954 |
- s_beforeInit: [{ type: Output, args: ['beforeInit',] }], |
|
955 |
- s_beforeLoopFix: [{ type: Output, args: ['beforeLoopFix',] }], |
|
956 |
- s_beforeResize: [{ type: Output, args: ['beforeResize',] }], |
|
957 |
- s_beforeSlideChangeStart: [{ type: Output, args: ['beforeSlideChangeStart',] }], |
|
958 |
- s_beforeTransitionStart: [{ type: Output, args: ['beforeTransitionStart',] }], |
|
959 |
- s_breakpoint: [{ type: Output, args: ['breakpoint',] }], |
|
960 |
- s_changeDirection: [{ type: Output, args: ['changeDirection',] }], |
|
961 |
- s_click: [{ type: Output, args: ['click',] }], |
|
962 |
- s_doubleTap: [{ type: Output, args: ['doubleTap',] }], |
|
963 |
- s_doubleClick: [{ type: Output, args: ['doubleClick',] }], |
|
964 |
- s_destroy: [{ type: Output, args: ['destroy',] }], |
|
965 |
- s_fromEdge: [{ type: Output, args: ['fromEdge',] }], |
|
966 |
- s_hashChange: [{ type: Output, args: ['hashChange',] }], |
|
967 |
- s_hashSet: [{ type: Output, args: ['hashSet',] }], |
|
968 |
- s_imagesReady: [{ type: Output, args: ['imagesReady',] }], |
|
969 |
- s_init: [{ type: Output, args: ['init',] }], |
|
970 |
- s_keyPress: [{ type: Output, args: ['keyPress',] }], |
|
971 |
- s_lazyImageLoad: [{ type: Output, args: ['lazyImageLoad',] }], |
|
972 |
- s_lazyImageReady: [{ type: Output, args: ['lazyImageReady',] }], |
|
973 |
- s_loopFix: [{ type: Output, args: ['loopFix',] }], |
|
974 |
- s_momentumBounce: [{ type: Output, args: ['momentumBounce',] }], |
|
975 |
- s_navigationHide: [{ type: Output, args: ['navigationHide',] }], |
|
976 |
- s_navigationShow: [{ type: Output, args: ['navigationShow',] }], |
|
977 |
- s_observerUpdate: [{ type: Output, args: ['observerUpdate',] }], |
|
978 |
- s_orientationchange: [{ type: Output, args: ['orientationchange',] }], |
|
979 |
- s_paginationHide: [{ type: Output, args: ['paginationHide',] }], |
|
980 |
- s_paginationRender: [{ type: Output, args: ['paginationRender',] }], |
|
981 |
- s_paginationShow: [{ type: Output, args: ['paginationShow',] }], |
|
982 |
- s_paginationUpdate: [{ type: Output, args: ['paginationUpdate',] }], |
|
983 |
- s_progress: [{ type: Output, args: ['progress',] }], |
|
984 |
- s_reachBeginning: [{ type: Output, args: ['reachBeginning',] }], |
|
985 |
- s_reachEnd: [{ type: Output, args: ['reachEnd',] }], |
|
986 |
- s_realIndexChange: [{ type: Output, args: ['realIndexChange',] }], |
|
987 |
- s_resize: [{ type: Output, args: ['resize',] }], |
|
988 |
- s_scroll: [{ type: Output, args: ['scroll',] }], |
|
989 |
- s_scrollbarDragEnd: [{ type: Output, args: ['scrollbarDragEnd',] }], |
|
990 |
- s_scrollbarDragMove: [{ type: Output, args: ['scrollbarDragMove',] }], |
|
991 |
- s_scrollbarDragStart: [{ type: Output, args: ['scrollbarDragStart',] }], |
|
992 |
- s_setTransition: [{ type: Output, args: ['setTransition',] }], |
|
993 |
- s_setTranslate: [{ type: Output, args: ['setTranslate',] }], |
|
994 |
- s_slideChange: [{ type: Output, args: ['slideChange',] }], |
|
995 |
- s_slideChangeTransitionEnd: [{ type: Output, args: ['slideChangeTransitionEnd',] }], |
|
996 |
- s_slideChangeTransitionStart: [{ type: Output, args: ['slideChangeTransitionStart',] }], |
|
997 |
- s_slideNextTransitionEnd: [{ type: Output, args: ['slideNextTransitionEnd',] }], |
|
998 |
- s_slideNextTransitionStart: [{ type: Output, args: ['slideNextTransitionStart',] }], |
|
999 |
- s_slidePrevTransitionEnd: [{ type: Output, args: ['slidePrevTransitionEnd',] }], |
|
1000 |
- s_slidePrevTransitionStart: [{ type: Output, args: ['slidePrevTransitionStart',] }], |
|
1001 |
- s_slideResetTransitionStart: [{ type: Output, args: ['slideResetTransitionStart',] }], |
|
1002 |
- s_slideResetTransitionEnd: [{ type: Output, args: ['slideResetTransitionEnd',] }], |
|
1003 |
- s_sliderMove: [{ type: Output, args: ['sliderMove',] }], |
|
1004 |
- s_sliderFirstMove: [{ type: Output, args: ['sliderFirstMove',] }], |
|
1005 |
- s_slidesLengthChange: [{ type: Output, args: ['slidesLengthChange',] }], |
|
1006 |
- s_slidesGridLengthChange: [{ type: Output, args: ['slidesGridLengthChange',] }], |
|
1007 |
- s_snapGridLengthChange: [{ type: Output, args: ['snapGridLengthChange',] }], |
|
1008 |
- s_snapIndexChange: [{ type: Output, args: ['snapIndexChange',] }], |
|
1009 |
- s_tap: [{ type: Output, args: ['tap',] }], |
|
1010 |
- s_toEdge: [{ type: Output, args: ['toEdge',] }], |
|
1011 |
- s_touchEnd: [{ type: Output, args: ['touchEnd',] }], |
|
1012 |
- s_touchMove: [{ type: Output, args: ['touchMove',] }], |
|
1013 |
- s_touchMoveOpposite: [{ type: Output, args: ['touchMoveOpposite',] }], |
|
1014 |
- s_touchStart: [{ type: Output, args: ['touchStart',] }], |
|
1015 |
- s_transitionEnd: [{ type: Output, args: ['transitionEnd',] }], |
|
1016 |
- s_transitionStart: [{ type: Output, args: ['transitionStart',] }], |
|
1017 |
- s_update: [{ type: Output, args: ['update',] }], |
|
1018 |
- s_zoomChange: [{ type: Output, args: ['zoomChange',] }], |
|
1019 |
- s_swiper: [{ type: Output, args: ['swiper',] }], |
|
1020 |
- indexChange: [{ type: Output }], |
|
1021 |
- prevElRef: [{ type: ViewChild, args: ['prevElRef', { static: false },] }], |
|
1022 |
- nextElRef: [{ type: ViewChild, args: ['nextElRef', { static: false },] }], |
|
1023 |
- scrollbarElRef: [{ type: ViewChild, args: ['scrollbarElRef', { static: false },] }], |
|
1024 |
- paginationElRef: [{ type: ViewChild, args: ['paginationElRef', { static: false },] }], |
|
1025 |
- slidesEl: [{ type: ContentChildren, args: [SwiperSlideDirective, { descendants: true, emitDistinctChangesOnly: true },] }], |
|
1026 |
- containerClasses: [{ type: HostBinding, args: ['class',] }] |
|
1027 |
-}; |
|
1028 |
- |
|
1029 |
-class SwiperModule { |
|
1030 |
-} |
|
1031 |
-SwiperModule.decorators = [ |
|
1032 |
- { type: NgModule, args: [{ |
|
1033 |
- declarations: [SwiperComponent, SwiperSlideDirective], |
|
1034 |
- exports: [SwiperComponent, SwiperSlideDirective], |
|
1035 |
- imports: [CommonModule], |
|
1036 |
- },] } |
|
1037 |
-]; |
|
1038 |
- |
|
1039 |
-/* |
|
1040 |
- * Public API Surface of angular |
|
1041 |
- */ |
|
1042 |
- |
|
1043 |
-/** |
|
1044 |
- * Generated bundle index. Do not edit. |
|
1045 |
- */ |
|
1046 |
- |
|
1047 |
-export { SwiperComponent, SwiperModule, SwiperSlideDirective }; |
|
1048 |
-//# sourceMappingURL=swiper_angular.js.map |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,1048 @@ |
1 |
+import { Directive, TemplateRef, Input, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, NgZone, ElementRef, ChangeDetectorRef, Inject, PLATFORM_ID, Output, ViewChild, ContentChildren, HostBinding, NgModule } from '@angular/core'; |
|
2 |
+import { isPlatformBrowser, CommonModule } from '@angular/common'; |
|
3 |
+import Swiper from 'swiper/core'; |
|
4 |
+import { Subject, of } from 'rxjs'; |
|
5 |
+ |
|
6 |
+function isObject(o) { |
|
7 |
+ return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object; |
|
8 |
+} |
|
9 |
+function extend(target, src) { |
|
10 |
+ Object.keys(src).forEach((key) => { |
|
11 |
+ if (typeof target[key] === 'undefined') { |
|
12 |
+ target[key] = src[key]; |
|
13 |
+ return; |
|
14 |
+ } |
|
15 |
+ if (target[key] && !src[key]) { |
|
16 |
+ return; |
|
17 |
+ } |
|
18 |
+ if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) { |
|
19 |
+ extend(target[key], src[key]); |
|
20 |
+ } |
|
21 |
+ else { |
|
22 |
+ target[key] = src[key]; |
|
23 |
+ } |
|
24 |
+ }); |
|
25 |
+} |
|
26 |
+function coerceBooleanProperty(value) { |
|
27 |
+ return value != null && `${value}` !== 'false'; |
|
28 |
+} |
|
29 |
+const ignoreNgOnChanges = ['pagination', 'navigation', 'scrollbar', 'virtual']; |
|
30 |
+function setProperty(val, obj = {}) { |
|
31 |
+ if (isObject(val)) { |
|
32 |
+ return val; |
|
33 |
+ } |
|
34 |
+ const newValue = coerceBooleanProperty(val); |
|
35 |
+ if (newValue === true) { |
|
36 |
+ return obj; |
|
37 |
+ } |
|
38 |
+ return newValue; |
|
39 |
+} |
|
40 |
+ |
|
41 |
+/* underscore in name -> watch for changes */ |
|
42 |
+const paramsList = [ |
|
43 |
+ 'init', |
|
44 |
+ '_direction', |
|
45 |
+ 'touchEventsTarget', |
|
46 |
+ 'initialSlide', |
|
47 |
+ '_speed', |
|
48 |
+ 'cssMode', |
|
49 |
+ 'updateOnWindowResize', |
|
50 |
+ 'resizeObserver', |
|
51 |
+ 'nested', |
|
52 |
+ '_width', |
|
53 |
+ '_height', |
|
54 |
+ 'preventInteractionOnTransition', |
|
55 |
+ 'userAgent', |
|
56 |
+ 'url', |
|
57 |
+ '_edgeSwipeDetection', |
|
58 |
+ '_edgeSwipeThreshold', |
|
59 |
+ '_freeMode', |
|
60 |
+ '_freeModeMomentum', |
|
61 |
+ '_freeModeMomentumRatio', |
|
62 |
+ '_freeModeMomentumBounce', |
|
63 |
+ '_freeModeMomentumBounceRatio', |
|
64 |
+ '_freeModeMomentumVelocityRatio', |
|
65 |
+ '_freeModeSticky', |
|
66 |
+ '_freeModeMinimumVelocity', |
|
67 |
+ '_autoHeight', |
|
68 |
+ 'setWrapperSize', |
|
69 |
+ 'virtualTranslate', |
|
70 |
+ '_effect', |
|
71 |
+ 'breakpoints', |
|
72 |
+ '_spaceBetween', |
|
73 |
+ '_slidesPerView', |
|
74 |
+ '_slidesPerColumn', |
|
75 |
+ '_slidesPerColumnFill', |
|
76 |
+ '_slidesPerGroup', |
|
77 |
+ '_slidesPerGroupSkip', |
|
78 |
+ '_centeredSlides', |
|
79 |
+ '_centeredSlidesBounds', |
|
80 |
+ '_slidesOffsetBefore', |
|
81 |
+ '_slidesOffsetAfter', |
|
82 |
+ 'normalizeSlideIndex', |
|
83 |
+ '_centerInsufficientSlides', |
|
84 |
+ '_watchOverflow', |
|
85 |
+ 'roundLengths', |
|
86 |
+ 'touchRatio', |
|
87 |
+ 'touchAngle', |
|
88 |
+ 'simulateTouch', |
|
89 |
+ '_shortSwipes', |
|
90 |
+ '_longSwipes', |
|
91 |
+ 'longSwipesRatio', |
|
92 |
+ 'longSwipesMs', |
|
93 |
+ '_followFinger', |
|
94 |
+ 'allowTouchMove', |
|
95 |
+ '_threshold', |
|
96 |
+ 'touchMoveStopPropagation', |
|
97 |
+ 'touchStartPreventDefault', |
|
98 |
+ 'touchStartForcePreventDefault', |
|
99 |
+ 'touchReleaseOnEdges', |
|
100 |
+ 'uniqueNavElements', |
|
101 |
+ '_resistance', |
|
102 |
+ '_resistanceRatio', |
|
103 |
+ '_watchSlidesProgress', |
|
104 |
+ '_watchSlidesVisibility', |
|
105 |
+ '_grabCursor', |
|
106 |
+ 'preventClicks', |
|
107 |
+ 'preventClicksPropagation', |
|
108 |
+ '_slideToClickedSlide', |
|
109 |
+ '_preloadImages', |
|
110 |
+ 'updateOnImagesReady', |
|
111 |
+ '_loop', |
|
112 |
+ '_loopAdditionalSlides', |
|
113 |
+ '_loopedSlides', |
|
114 |
+ '_loopFillGroupWithBlank', |
|
115 |
+ 'loopPreventsSlide', |
|
116 |
+ '_allowSlidePrev', |
|
117 |
+ '_allowSlideNext', |
|
118 |
+ '_swipeHandler', |
|
119 |
+ '_noSwiping', |
|
120 |
+ 'noSwipingClass', |
|
121 |
+ 'noSwipingSelector', |
|
122 |
+ 'passiveListeners', |
|
123 |
+ 'containerModifierClass', |
|
124 |
+ 'slideClass', |
|
125 |
+ 'slideBlankClass', |
|
126 |
+ 'slideActiveClass', |
|
127 |
+ 'slideDuplicateActiveClass', |
|
128 |
+ 'slideVisibleClass', |
|
129 |
+ 'slideDuplicateClass', |
|
130 |
+ 'slideNextClass', |
|
131 |
+ 'slideDuplicateNextClass', |
|
132 |
+ 'slidePrevClass', |
|
133 |
+ 'slideDuplicatePrevClass', |
|
134 |
+ 'wrapperClass', |
|
135 |
+ 'runCallbacksOnInit', |
|
136 |
+ 'observer', |
|
137 |
+ 'observeParents', |
|
138 |
+ 'observeSlideChildren', |
|
139 |
+ // modules |
|
140 |
+ 'a11y', |
|
141 |
+ 'autoplay', |
|
142 |
+ '_controller', |
|
143 |
+ 'coverflowEffect', |
|
144 |
+ 'cubeEffect', |
|
145 |
+ 'fadeEffect', |
|
146 |
+ 'flipEffect', |
|
147 |
+ 'hashNavigation', |
|
148 |
+ 'history', |
|
149 |
+ 'keyboard', |
|
150 |
+ 'lazy', |
|
151 |
+ 'mousewheel', |
|
152 |
+ '_navigation', |
|
153 |
+ '_pagination', |
|
154 |
+ 'parallax', |
|
155 |
+ '_scrollbar', |
|
156 |
+ '_thumbs', |
|
157 |
+ 'virtual', |
|
158 |
+ 'zoom', |
|
159 |
+]; |
|
160 |
+ |
|
161 |
+// eslint-disable-next-line |
|
162 |
+const ɵ0 = (key) => key.replace(/_/, ''); |
|
163 |
+const allowedParams = paramsList.map(ɵ0); |
|
164 |
+function getParams(obj = {}) { |
|
165 |
+ const params = { |
|
166 |
+ on: {}, |
|
167 |
+ }; |
|
168 |
+ const passedParams = {}; |
|
169 |
+ extend(params, Swiper.defaults); |
|
170 |
+ extend(params, Swiper.extendedDefaults); |
|
171 |
+ params._emitClasses = true; |
|
172 |
+ const rest = {}; |
|
173 |
+ Object.keys(obj).forEach((key) => { |
|
174 |
+ const _key = key.replace(/^_/, ''); |
|
175 |
+ if (typeof obj[_key] === 'undefined') |
|
176 |
+ return; |
|
177 |
+ if (allowedParams.indexOf(_key) >= 0) { |
|
178 |
+ if (isObject(obj[_key])) { |
|
179 |
+ params[_key] = {}; |
|
180 |
+ passedParams[_key] = {}; |
|
181 |
+ extend(params[_key], obj[_key]); |
|
182 |
+ extend(passedParams[_key], obj[_key]); |
|
183 |
+ } |
|
184 |
+ else { |
|
185 |
+ params[_key] = obj[_key]; |
|
186 |
+ passedParams[_key] = obj[_key]; |
|
187 |
+ } |
|
188 |
+ } |
|
189 |
+ else { |
|
190 |
+ rest[_key] = obj[_key]; |
|
191 |
+ } |
|
192 |
+ }); |
|
193 |
+ return { params, passedParams, rest }; |
|
194 |
+} |
|
195 |
+ |
|
196 |
+class SwiperSlideDirective { |
|
197 |
+ constructor(template) { |
|
198 |
+ this.template = template; |
|
199 |
+ this.class = ''; |
|
200 |
+ this.slideData = { |
|
201 |
+ isActive: false, |
|
202 |
+ isPrev: false, |
|
203 |
+ isNext: false, |
|
204 |
+ isVisible: false, |
|
205 |
+ isDuplicate: false, |
|
206 |
+ }; |
|
207 |
+ } |
|
208 |
+ set zoom(val) { |
|
209 |
+ this._zoom = coerceBooleanProperty(val); |
|
210 |
+ } |
|
211 |
+ get zoom() { |
|
212 |
+ return this._zoom; |
|
213 |
+ } |
|
214 |
+ get classNames() { |
|
215 |
+ return this._classNames; |
|
216 |
+ } |
|
217 |
+ set classNames(val) { |
|
218 |
+ if (this._classNames === val) { |
|
219 |
+ return; |
|
220 |
+ } |
|
221 |
+ this._classNames = val; |
|
222 |
+ this.slideData = { |
|
223 |
+ isActive: this._hasClass(['swiper-slide-active', 'swiper-slide-duplicate-active']), |
|
224 |
+ isVisible: this._hasClass(['swiper-slide-visible']), |
|
225 |
+ isDuplicate: this._hasClass(['swiper-slide-duplicate']), |
|
226 |
+ isPrev: this._hasClass(['swiper-slide-prev', 'swiper-slide-duplicate-prev']), |
|
227 |
+ isNext: this._hasClass(['swiper-slide-next', 'swiper-slide-duplicate-next']), |
|
228 |
+ }; |
|
229 |
+ } |
|
230 |
+ _hasClass(classNames) { |
|
231 |
+ return classNames.some((className) => this._classNames.indexOf(className) >= 0); |
|
232 |
+ } |
|
233 |
+} |
|
234 |
+SwiperSlideDirective.decorators = [ |
|
235 |
+ { type: Directive, args: [{ |
|
236 |
+ selector: 'ng-template[swiperSlide]', |
|
237 |
+ },] } |
|
238 |
+]; |
|
239 |
+SwiperSlideDirective.ctorParameters = () => [ |
|
240 |
+ { type: TemplateRef } |
|
241 |
+]; |
|
242 |
+SwiperSlideDirective.propDecorators = { |
|
243 |
+ virtualIndex: [{ type: Input }], |
|
244 |
+ class: [{ type: Input }], |
|
245 |
+ zoom: [{ type: Input }] |
|
246 |
+}; |
|
247 |
+ |
|
248 |
+class SwiperComponent { |
|
249 |
+ constructor(_ngZone, elementRef, _changeDetectorRef, _platformId) { |
|
250 |
+ this._ngZone = _ngZone; |
|
251 |
+ this.elementRef = elementRef; |
|
252 |
+ this._changeDetectorRef = _changeDetectorRef; |
|
253 |
+ this._platformId = _platformId; |
|
254 |
+ this.slideClass = 'swiper-slide'; |
|
255 |
+ this.wrapperClass = 'swiper-wrapper'; |
|
256 |
+ this.showNavigation = true; |
|
257 |
+ this.showPagination = true; |
|
258 |
+ this.showScrollbar = true; |
|
259 |
+ // prettier-ignore |
|
260 |
+ this.s__beforeBreakpoint = new EventEmitter(); |
|
261 |
+ // prettier-ignore |
|
262 |
+ this.s__containerClasses = new EventEmitter(); |
|
263 |
+ // prettier-ignore |
|
264 |
+ this.s__slideClass = new EventEmitter(); |
|
265 |
+ // prettier-ignore |
|
266 |
+ this.s__swiper = new EventEmitter(); |
|
267 |
+ // prettier-ignore |
|
268 |
+ this.s_activeIndexChange = new EventEmitter(); |
|
269 |
+ // prettier-ignore |
|
270 |
+ this.s_afterInit = new EventEmitter(); |
|
271 |
+ // prettier-ignore |
|
272 |
+ this.s_autoplay = new EventEmitter(); |
|
273 |
+ // prettier-ignore |
|
274 |
+ this.s_autoplayStart = new EventEmitter(); |
|
275 |
+ // prettier-ignore |
|
276 |
+ this.s_autoplayStop = new EventEmitter(); |
|
277 |
+ // prettier-ignore |
|
278 |
+ this.s_beforeDestroy = new EventEmitter(); |
|
279 |
+ // prettier-ignore |
|
280 |
+ this.s_beforeInit = new EventEmitter(); |
|
281 |
+ // prettier-ignore |
|
282 |
+ this.s_beforeLoopFix = new EventEmitter(); |
|
283 |
+ // prettier-ignore |
|
284 |
+ this.s_beforeResize = new EventEmitter(); |
|
285 |
+ // prettier-ignore |
|
286 |
+ this.s_beforeSlideChangeStart = new EventEmitter(); |
|
287 |
+ // prettier-ignore |
|
288 |
+ this.s_beforeTransitionStart = new EventEmitter(); |
|
289 |
+ // prettier-ignore |
|
290 |
+ this.s_breakpoint = new EventEmitter(); |
|
291 |
+ // prettier-ignore |
|
292 |
+ this.s_changeDirection = new EventEmitter(); |
|
293 |
+ // prettier-ignore |
|
294 |
+ this.s_click = new EventEmitter(); |
|
295 |
+ // prettier-ignore |
|
296 |
+ this.s_doubleTap = new EventEmitter(); |
|
297 |
+ // prettier-ignore |
|
298 |
+ this.s_doubleClick = new EventEmitter(); |
|
299 |
+ // prettier-ignore |
|
300 |
+ this.s_destroy = new EventEmitter(); |
|
301 |
+ // prettier-ignore |
|
302 |
+ this.s_fromEdge = new EventEmitter(); |
|
303 |
+ // prettier-ignore |
|
304 |
+ this.s_hashChange = new EventEmitter(); |
|
305 |
+ // prettier-ignore |
|
306 |
+ this.s_hashSet = new EventEmitter(); |
|
307 |
+ // prettier-ignore |
|
308 |
+ this.s_imagesReady = new EventEmitter(); |
|
309 |
+ // prettier-ignore |
|
310 |
+ this.s_init = new EventEmitter(); |
|
311 |
+ // prettier-ignore |
|
312 |
+ this.s_keyPress = new EventEmitter(); |
|
313 |
+ // prettier-ignore |
|
314 |
+ this.s_lazyImageLoad = new EventEmitter(); |
|
315 |
+ // prettier-ignore |
|
316 |
+ this.s_lazyImageReady = new EventEmitter(); |
|
317 |
+ // prettier-ignore |
|
318 |
+ this.s_loopFix = new EventEmitter(); |
|
319 |
+ // prettier-ignore |
|
320 |
+ this.s_momentumBounce = new EventEmitter(); |
|
321 |
+ // prettier-ignore |
|
322 |
+ this.s_navigationHide = new EventEmitter(); |
|
323 |
+ // prettier-ignore |
|
324 |
+ this.s_navigationShow = new EventEmitter(); |
|
325 |
+ // prettier-ignore |
|
326 |
+ this.s_observerUpdate = new EventEmitter(); |
|
327 |
+ // prettier-ignore |
|
328 |
+ this.s_orientationchange = new EventEmitter(); |
|
329 |
+ // prettier-ignore |
|
330 |
+ this.s_paginationHide = new EventEmitter(); |
|
331 |
+ // prettier-ignore |
|
332 |
+ this.s_paginationRender = new EventEmitter(); |
|
333 |
+ // prettier-ignore |
|
334 |
+ this.s_paginationShow = new EventEmitter(); |
|
335 |
+ // prettier-ignore |
|
336 |
+ this.s_paginationUpdate = new EventEmitter(); |
|
337 |
+ // prettier-ignore |
|
338 |
+ this.s_progress = new EventEmitter(); |
|
339 |
+ // prettier-ignore |
|
340 |
+ this.s_reachBeginning = new EventEmitter(); |
|
341 |
+ // prettier-ignore |
|
342 |
+ this.s_reachEnd = new EventEmitter(); |
|
343 |
+ // prettier-ignore |
|
344 |
+ this.s_realIndexChange = new EventEmitter(); |
|
345 |
+ // prettier-ignore |
|
346 |
+ this.s_resize = new EventEmitter(); |
|
347 |
+ // prettier-ignore |
|
348 |
+ this.s_scroll = new EventEmitter(); |
|
349 |
+ // prettier-ignore |
|
350 |
+ this.s_scrollbarDragEnd = new EventEmitter(); |
|
351 |
+ // prettier-ignore |
|
352 |
+ this.s_scrollbarDragMove = new EventEmitter(); |
|
353 |
+ // prettier-ignore |
|
354 |
+ this.s_scrollbarDragStart = new EventEmitter(); |
|
355 |
+ // prettier-ignore |
|
356 |
+ this.s_setTransition = new EventEmitter(); |
|
357 |
+ // prettier-ignore |
|
358 |
+ this.s_setTranslate = new EventEmitter(); |
|
359 |
+ // prettier-ignore |
|
360 |
+ this.s_slideChange = new EventEmitter(); |
|
361 |
+ // prettier-ignore |
|
362 |
+ this.s_slideChangeTransitionEnd = new EventEmitter(); |
|
363 |
+ // prettier-ignore |
|
364 |
+ this.s_slideChangeTransitionStart = new EventEmitter(); |
|
365 |
+ // prettier-ignore |
|
366 |
+ this.s_slideNextTransitionEnd = new EventEmitter(); |
|
367 |
+ // prettier-ignore |
|
368 |
+ this.s_slideNextTransitionStart = new EventEmitter(); |
|
369 |
+ // prettier-ignore |
|
370 |
+ this.s_slidePrevTransitionEnd = new EventEmitter(); |
|
371 |
+ // prettier-ignore |
|
372 |
+ this.s_slidePrevTransitionStart = new EventEmitter(); |
|
373 |
+ // prettier-ignore |
|
374 |
+ this.s_slideResetTransitionStart = new EventEmitter(); |
|
375 |
+ // prettier-ignore |
|
376 |
+ this.s_slideResetTransitionEnd = new EventEmitter(); |
|
377 |
+ // prettier-ignore |
|
378 |
+ this.s_sliderMove = new EventEmitter(); |
|
379 |
+ // prettier-ignore |
|
380 |
+ this.s_sliderFirstMove = new EventEmitter(); |
|
381 |
+ // prettier-ignore |
|
382 |
+ this.s_slidesLengthChange = new EventEmitter(); |
|
383 |
+ // prettier-ignore |
|
384 |
+ this.s_slidesGridLengthChange = new EventEmitter(); |
|
385 |
+ // prettier-ignore |
|
386 |
+ this.s_snapGridLengthChange = new EventEmitter(); |
|
387 |
+ // prettier-ignore |
|
388 |
+ this.s_snapIndexChange = new EventEmitter(); |
|
389 |
+ // prettier-ignore |
|
390 |
+ this.s_tap = new EventEmitter(); |
|
391 |
+ // prettier-ignore |
|
392 |
+ this.s_toEdge = new EventEmitter(); |
|
393 |
+ // prettier-ignore |
|
394 |
+ this.s_touchEnd = new EventEmitter(); |
|
395 |
+ // prettier-ignore |
|
396 |
+ this.s_touchMove = new EventEmitter(); |
|
397 |
+ // prettier-ignore |
|
398 |
+ this.s_touchMoveOpposite = new EventEmitter(); |
|
399 |
+ // prettier-ignore |
|
400 |
+ this.s_touchStart = new EventEmitter(); |
|
401 |
+ // prettier-ignore |
|
402 |
+ this.s_transitionEnd = new EventEmitter(); |
|
403 |
+ // prettier-ignore |
|
404 |
+ this.s_transitionStart = new EventEmitter(); |
|
405 |
+ // prettier-ignore |
|
406 |
+ this.s_update = new EventEmitter(); |
|
407 |
+ // prettier-ignore |
|
408 |
+ this.s_zoomChange = new EventEmitter(); |
|
409 |
+ // prettier-ignore |
|
410 |
+ this.s_swiper = new EventEmitter(); |
|
411 |
+ this.indexChange = new EventEmitter(); |
|
412 |
+ this._activeSlides = new Subject(); |
|
413 |
+ this.containerClasses = 'swiper-container'; |
|
414 |
+ this.slidesChanges = (val) => { |
|
415 |
+ this.slides = val.map((slide, index) => { |
|
416 |
+ slide.slideIndex = index; |
|
417 |
+ slide.classNames = this.slideClass; |
|
418 |
+ return slide; |
|
419 |
+ }); |
|
420 |
+ if (this.loop && !this.loopedSlides) { |
|
421 |
+ this.calcLoopedSlides(); |
|
422 |
+ } |
|
423 |
+ if (!this.virtual) { |
|
424 |
+ this.prependSlides = of(this.slides.slice(this.slides.length - this.loopedSlides)); |
|
425 |
+ this.appendSlides = of(this.slides.slice(0, this.loopedSlides)); |
|
426 |
+ } |
|
427 |
+ this._changeDetectorRef.detectChanges(); |
|
428 |
+ }; |
|
429 |
+ this.style = null; |
|
430 |
+ this.updateVirtualSlides = (virtualData) => { |
|
431 |
+ // TODO: type virtualData |
|
432 |
+ if (!this.swiperRef || |
|
433 |
+ (this.currentVirtualData && |
|
434 |
+ this.currentVirtualData.from === virtualData.from && |
|
435 |
+ this.currentVirtualData.to === virtualData.to && |
|
436 |
+ this.currentVirtualData.offset === virtualData.offset)) { |
|
437 |
+ return; |
|
438 |
+ } |
|
439 |
+ this.style = this.swiperRef.isHorizontal() |
|
440 |
+ ? { |
|
441 |
+ [this.swiperRef.rtlTranslate ? 'right' : 'left']: `${virtualData.offset}px`, |
|
442 |
+ } |
|
443 |
+ : { |
|
444 |
+ top: `${virtualData.offset}px`, |
|
445 |
+ }; |
|
446 |
+ this.currentVirtualData = virtualData; |
|
447 |
+ this._activeSlides.next(virtualData.slides); |
|
448 |
+ this._changeDetectorRef.detectChanges(); |
|
449 |
+ this._ngZone.runOutsideAngular(() => { |
|
450 |
+ this.swiperRef.updateSlides(); |
|
451 |
+ this.swiperRef.updateProgress(); |
|
452 |
+ this.swiperRef.updateSlidesClasses(); |
|
453 |
+ if (this.swiperRef.lazy && this.swiperRef.params.lazy['enabled']) { |
|
454 |
+ this.swiperRef.lazy.load(); |
|
455 |
+ } |
|
456 |
+ this.swiperRef.virtual.update(true); |
|
457 |
+ }); |
|
458 |
+ return; |
|
459 |
+ }; |
|
460 |
+ } |
|
461 |
+ set navigation(val) { |
|
462 |
+ var _a, _b, _c, _d; |
|
463 |
+ const currentNext = typeof this._navigation !== 'boolean' ? (_a = this._navigation) === null || _a === void 0 ? void 0 : _a.nextEl : null; |
|
464 |
+ const currentPrev = typeof this._navigation !== 'boolean' ? (_b = this._navigation) === null || _b === void 0 ? void 0 : _b.prevEl : null; |
|
465 |
+ this._navigation = setProperty(val, { |
|
466 |
+ nextEl: currentNext || null, |
|
467 |
+ prevEl: currentPrev || null, |
|
468 |
+ }); |
|
469 |
+ if (typeof this._navigation !== 'boolean' && |
|
470 |
+ (typeof ((_c = this._navigation) === null || _c === void 0 ? void 0 : _c.nextEl) === 'string' || typeof ((_d = this._navigation) === null || _d === void 0 ? void 0 : _d.prevEl) === 'string')) { |
|
471 |
+ this.showNavigation = false; |
|
472 |
+ } |
|
473 |
+ } |
|
474 |
+ get navigation() { |
|
475 |
+ return this._navigation; |
|
476 |
+ } |
|
477 |
+ set pagination(val) { |
|
478 |
+ var _a, _b; |
|
479 |
+ const current = typeof this._pagination !== 'boolean' ? (_a = this._pagination) === null || _a === void 0 ? void 0 : _a.el : null; |
|
480 |
+ this._pagination = setProperty(val, { |
|
481 |
+ el: current || null, |
|
482 |
+ }); |
|
483 |
+ if (typeof this._pagination !== 'boolean' && typeof ((_b = this._pagination) === null || _b === void 0 ? void 0 : _b.el) === 'string') { |
|
484 |
+ this.showPagination = false; |
|
485 |
+ } |
|
486 |
+ } |
|
487 |
+ get pagination() { |
|
488 |
+ return this._pagination; |
|
489 |
+ } |
|
490 |
+ set scrollbar(val) { |
|
491 |
+ var _a, _b; |
|
492 |
+ const current = typeof this._scrollbar !== 'boolean' ? (_a = this._scrollbar) === null || _a === void 0 ? void 0 : _a.el : null; |
|
493 |
+ this._scrollbar = setProperty(val, { |
|
494 |
+ el: current || null, |
|
495 |
+ }); |
|
496 |
+ if (typeof this._scrollbar !== 'boolean' && typeof ((_b = this._scrollbar) === null || _b === void 0 ? void 0 : _b.el) === 'string') { |
|
497 |
+ this.showScrollbar = false; |
|
498 |
+ } |
|
499 |
+ } |
|
500 |
+ get scrollbar() { |
|
501 |
+ return this._scrollbar; |
|
502 |
+ } |
|
503 |
+ set virtual(val) { |
|
504 |
+ this._virtual = setProperty(val); |
|
505 |
+ } |
|
506 |
+ get virtual() { |
|
507 |
+ return this._virtual; |
|
508 |
+ } |
|
509 |
+ set index(index) { |
|
510 |
+ this.setIndex(index); |
|
511 |
+ } |
|
512 |
+ set config(val) { |
|
513 |
+ this.updateSwiper(val); |
|
514 |
+ const { params } = getParams(val); |
|
515 |
+ Object.assign(this, params); |
|
516 |
+ } |
|
517 |
+ set prevElRef(el) { |
|
518 |
+ this._setElement(el, this.navigation, 'navigation', 'prevEl'); |
|
519 |
+ } |
|
520 |
+ set nextElRef(el) { |
|
521 |
+ this._setElement(el, this.navigation, 'navigation', 'nextEl'); |
|
522 |
+ } |
|
523 |
+ set scrollbarElRef(el) { |
|
524 |
+ this._setElement(el, this.scrollbar, 'scrollbar'); |
|
525 |
+ } |
|
526 |
+ set paginationElRef(el) { |
|
527 |
+ this._setElement(el, this.pagination, 'pagination'); |
|
528 |
+ } |
|
529 |
+ get activeSlides() { |
|
530 |
+ if (this.virtual) { |
|
531 |
+ return this._activeSlides; |
|
532 |
+ } |
|
533 |
+ return of(this.slides); |
|
534 |
+ } |
|
535 |
+ get zoomContainerClass() { |
|
536 |
+ return typeof this.zoom !== 'boolean' ? this.zoom.containerClass : 'swiper-zoom-container'; |
|
537 |
+ } |
|
538 |
+ _setElement(el, ref, update, key = 'el') { |
|
539 |
+ if (!el || !ref) { |
|
540 |
+ return; |
|
541 |
+ } |
|
542 |
+ if (ref && el.nativeElement) { |
|
543 |
+ if (ref[key] === el.nativeElement) { |
|
544 |
+ return; |
|
545 |
+ } |
|
546 |
+ ref[key] = el.nativeElement; |
|
547 |
+ } |
|
548 |
+ const updateObj = {}; |
|
549 |
+ updateObj[update] = true; |
|
550 |
+ this.updateInitSwiper(updateObj); |
|
551 |
+ } |
|
552 |
+ ngOnInit() { |
|
553 |
+ const { params } = getParams(this); |
|
554 |
+ Object.assign(this, params); |
|
555 |
+ } |
|
556 |
+ ngAfterViewInit() { |
|
557 |
+ this.childrenSlidesInit(); |
|
558 |
+ this.initSwiper(); |
|
559 |
+ this._changeDetectorRef.detectChanges(); |
|
560 |
+ setTimeout(() => { |
|
561 |
+ this.s_swiper.emit(this.swiperRef); |
|
562 |
+ }); |
|
563 |
+ } |
|
564 |
+ childrenSlidesInit() { |
|
565 |
+ this.slidesChanges(this.slidesEl); |
|
566 |
+ this.slidesEl.changes.subscribe(this.slidesChanges); |
|
567 |
+ } |
|
568 |
+ get isSwiperActive() { |
|
569 |
+ return this.swiperRef && !this.swiperRef.destroyed; |
|
570 |
+ } |
|
571 |
+ initSwiper() { |
|
572 |
+ const { params: swiperParams, passedParams } = getParams(this); |
|
573 |
+ Object.assign(this, swiperParams); |
|
574 |
+ this._ngZone.runOutsideAngular(() => { |
|
575 |
+ swiperParams.init = false; |
|
576 |
+ if (!swiperParams.virtual) { |
|
577 |
+ swiperParams.observer = true; |
|
578 |
+ } |
|
579 |
+ swiperParams.onAny = (event, ...args) => { |
|
580 |
+ const emitter = this[`s_${event}`]; |
|
581 |
+ if (emitter) { |
|
582 |
+ emitter.emit(...args); |
|
583 |
+ } |
|
584 |
+ }; |
|
585 |
+ Object.assign(swiperParams.on, { |
|
586 |
+ _containerClasses(swiper, classes) { |
|
587 |
+ this.containerClasses = classes; |
|
588 |
+ }, |
|
589 |
+ _slideClasses: (_, updated) => { |
|
590 |
+ updated.forEach(({ slideEl, classNames }, index) => { |
|
591 |
+ const slideIndex = parseInt(slideEl.getAttribute('data-swiper-slide-index')) || index; |
|
592 |
+ if (this.virtual) { |
|
593 |
+ const virtualSlide = this.slides.find((item) => { |
|
594 |
+ return item.virtualIndex && item.virtualIndex === slideIndex; |
|
595 |
+ }); |
|
596 |
+ if (virtualSlide) { |
|
597 |
+ virtualSlide.classNames = classNames; |
|
598 |
+ return; |
|
599 |
+ } |
|
600 |
+ } |
|
601 |
+ if (this.slides[slideIndex]) { |
|
602 |
+ this.slides[slideIndex].classNames = classNames; |
|
603 |
+ } |
|
604 |
+ }); |
|
605 |
+ this._changeDetectorRef.detectChanges(); |
|
606 |
+ }, |
|
607 |
+ }); |
|
608 |
+ const swiperRef = new Swiper(swiperParams); |
|
609 |
+ swiperRef.loopCreate = () => { }; |
|
610 |
+ swiperRef.loopDestroy = () => { }; |
|
611 |
+ if (swiperParams.loop) { |
|
612 |
+ swiperRef.loopedSlides = this.loopedSlides; |
|
613 |
+ } |
|
614 |
+ if (swiperRef.virtual && swiperRef.params.virtual.enabled) { |
|
615 |
+ swiperRef.virtual.slides = this.slides; |
|
616 |
+ const extendWith = { |
|
617 |
+ cache: false, |
|
618 |
+ renderExternal: this.updateVirtualSlides, |
|
619 |
+ renderExternalUpdate: false, |
|
620 |
+ }; |
|
621 |
+ extend(swiperRef.params.virtual, extendWith); |
|
622 |
+ extend(swiperRef.originalParams.virtual, extendWith); |
|
623 |
+ } |
|
624 |
+ if (isPlatformBrowser(this._platformId)) { |
|
625 |
+ this.swiperRef = swiperRef.init(this.elementRef.nativeElement); |
|
626 |
+ if (this.swiperRef.virtual && this.swiperRef.params.virtual.enabled) { |
|
627 |
+ this.swiperRef.virtual.update(true); |
|
628 |
+ } |
|
629 |
+ this._changeDetectorRef.detectChanges(); |
|
630 |
+ swiperRef.on('slideChange', () => { |
|
631 |
+ this.indexChange.emit(this.swiperRef.realIndex); |
|
632 |
+ }); |
|
633 |
+ } |
|
634 |
+ }); |
|
635 |
+ } |
|
636 |
+ ngOnChanges(changedParams) { |
|
637 |
+ this.updateSwiper(changedParams); |
|
638 |
+ this._changeDetectorRef.detectChanges(); |
|
639 |
+ } |
|
640 |
+ updateInitSwiper(changedParams) { |
|
641 |
+ if (!(changedParams && this.swiperRef && !this.swiperRef.destroyed)) { |
|
642 |
+ return; |
|
643 |
+ } |
|
644 |
+ this._ngZone.runOutsideAngular(() => { |
|
645 |
+ const { params: currentParams, pagination, navigation, scrollbar, virtual, thumbs, } = this.swiperRef; |
|
646 |
+ if (changedParams.pagination) { |
|
647 |
+ if (this.pagination && |
|
648 |
+ typeof this.pagination !== 'boolean' && |
|
649 |
+ this.pagination.el && |
|
650 |
+ pagination && |
|
651 |
+ !pagination.el) { |
|
652 |
+ this.updateParameter('pagination', this.pagination); |
|
653 |
+ pagination.init(); |
|
654 |
+ pagination.render(); |
|
655 |
+ pagination.update(); |
|
656 |
+ } |
|
657 |
+ else { |
|
658 |
+ pagination.destroy(); |
|
659 |
+ pagination.el = null; |
|
660 |
+ } |
|
661 |
+ } |
|
662 |
+ if (changedParams.scrollbar) { |
|
663 |
+ if (this.scrollbar && |
|
664 |
+ typeof this.scrollbar !== 'boolean' && |
|
665 |
+ this.scrollbar.el && |
|
666 |
+ scrollbar && |
|
667 |
+ !scrollbar.el) { |
|
668 |
+ this.updateParameter('scrollbar', this.scrollbar); |
|
669 |
+ scrollbar.init(); |
|
670 |
+ scrollbar.updateSize(); |
|
671 |
+ scrollbar.setTranslate(); |
|
672 |
+ } |
|
673 |
+ else { |
|
674 |
+ scrollbar.destroy(); |
|
675 |
+ scrollbar.el = null; |
|
676 |
+ } |
|
677 |
+ } |
|
678 |
+ if (changedParams.navigation) { |
|
679 |
+ if (this.navigation && |
|
680 |
+ typeof this.navigation !== 'boolean' && |
|
681 |
+ this.navigation.prevEl && |
|
682 |
+ this.navigation.nextEl && |
|
683 |
+ navigation && |
|
684 |
+ !navigation.prevEl && |
|
685 |
+ !navigation.nextEl) { |
|
686 |
+ this.updateParameter('navigation', this.navigation); |
|
687 |
+ navigation.init(); |
|
688 |
+ navigation.update(); |
|
689 |
+ } |
|
690 |
+ else if (navigation.prevEl && navigation.nextEl) { |
|
691 |
+ navigation.destroy(); |
|
692 |
+ navigation.nextEl = null; |
|
693 |
+ navigation.prevEl = null; |
|
694 |
+ } |
|
695 |
+ } |
|
696 |
+ if (changedParams.thumbs && this.thumbs && this.thumbs.swiper) { |
|
697 |
+ this.updateParameter('thumbs', this.thumbs); |
|
698 |
+ const initialized = thumbs.init(); |
|
699 |
+ if (initialized) |
|
700 |
+ thumbs.update(true); |
|
701 |
+ } |
|
702 |
+ if (changedParams.controller && this.controller && this.controller.control) { |
|
703 |
+ this.swiperRef.controller.control = this.controller.control; |
|
704 |
+ } |
|
705 |
+ this.swiperRef.update(); |
|
706 |
+ }); |
|
707 |
+ } |
|
708 |
+ updateSwiper(changedParams) { |
|
709 |
+ this._ngZone.runOutsideAngular(() => { |
|
710 |
+ var _a, _b; |
|
711 |
+ if (changedParams.config) { |
|
712 |
+ return; |
|
713 |
+ } |
|
714 |
+ if (!(changedParams && this.swiperRef && !this.swiperRef.destroyed)) { |
|
715 |
+ return; |
|
716 |
+ } |
|
717 |
+ for (const key in changedParams) { |
|
718 |
+ if (ignoreNgOnChanges.indexOf(key) >= 0) { |
|
719 |
+ continue; |
|
720 |
+ } |
|
721 |
+ const newValue = (_b = (_a = changedParams[key]) === null || _a === void 0 ? void 0 : _a.currentValue) !== null && _b !== void 0 ? _b : changedParams[key]; |
|
722 |
+ this.updateParameter(key, newValue); |
|
723 |
+ } |
|
724 |
+ if (changedParams.allowSlideNext) { |
|
725 |
+ this.swiperRef.allowSlideNext = this.allowSlideNext; |
|
726 |
+ } |
|
727 |
+ if (changedParams.allowSlidePrev) { |
|
728 |
+ this.swiperRef.allowSlidePrev = this.allowSlidePrev; |
|
729 |
+ } |
|
730 |
+ if (changedParams.direction) { |
|
731 |
+ this.swiperRef.changeDirection(this.direction, false); |
|
732 |
+ } |
|
733 |
+ if (changedParams.breakpoints) { |
|
734 |
+ if (this.loop && !this.loopedSlides) { |
|
735 |
+ this.calcLoopedSlides(); |
|
736 |
+ } |
|
737 |
+ this.swiperRef.currentBreakpoint = null; |
|
738 |
+ this.swiperRef.setBreakpoint(); |
|
739 |
+ } |
|
740 |
+ if (changedParams.thumbs || changedParams.controller) { |
|
741 |
+ this.updateInitSwiper(changedParams); |
|
742 |
+ } |
|
743 |
+ this.swiperRef.update(); |
|
744 |
+ }); |
|
745 |
+ } |
|
746 |
+ calcLoopedSlides() { |
|
747 |
+ if (!this.loop) { |
|
748 |
+ return; |
|
749 |
+ } |
|
750 |
+ let slidesPerViewParams = this.slidesPerView; |
|
751 |
+ if (this.breakpoints) { |
|
752 |
+ const breakpoint = Swiper.prototype.getBreakpoint(this.breakpoints); |
|
753 |
+ const breakpointOnlyParams = breakpoint in this.breakpoints ? this.breakpoints[breakpoint] : undefined; |
|
754 |
+ if (breakpointOnlyParams && breakpointOnlyParams.slidesPerView) { |
|
755 |
+ slidesPerViewParams = breakpointOnlyParams.slidesPerView; |
|
756 |
+ } |
|
757 |
+ } |
|
758 |
+ if (slidesPerViewParams === 'auto') { |
|
759 |
+ this.loopedSlides = this.slides.length; |
|
760 |
+ return this.slides.length; |
|
761 |
+ } |
|
762 |
+ let loopedSlides = this.loopedSlides || slidesPerViewParams; |
|
763 |
+ loopedSlides += this.loopAdditionalSlides; |
|
764 |
+ if (loopedSlides > this.slides.length) { |
|
765 |
+ loopedSlides = this.slides.length; |
|
766 |
+ } |
|
767 |
+ this.loopedSlides = loopedSlides; |
|
768 |
+ return loopedSlides; |
|
769 |
+ } |
|
770 |
+ updateParameter(key, value) { |
|
771 |
+ if (!(this.swiperRef && !this.swiperRef.destroyed)) { |
|
772 |
+ return; |
|
773 |
+ } |
|
774 |
+ const _key = key.replace(/^_/, ''); |
|
775 |
+ if (Object.keys(this.swiperRef.modules).indexOf(_key) >= 0) { |
|
776 |
+ extend(value, this.swiperRef.modules[_key].params[_key]); |
|
777 |
+ } |
|
778 |
+ if (isObject(this.swiperRef.params[_key]) && isObject(value)) { |
|
779 |
+ extend(this.swiperRef.params[_key], value); |
|
780 |
+ } |
|
781 |
+ else { |
|
782 |
+ this.swiperRef.params[_key] = value; |
|
783 |
+ } |
|
784 |
+ } |
|
785 |
+ setIndex(index, speed, silent) { |
|
786 |
+ if (!this.isSwiperActive) { |
|
787 |
+ this.initialSlide = index; |
|
788 |
+ return; |
|
789 |
+ } |
|
790 |
+ if (index === this.swiperRef.activeIndex) { |
|
791 |
+ return; |
|
792 |
+ } |
|
793 |
+ this._ngZone.runOutsideAngular(() => { |
|
794 |
+ if (this.loop) { |
|
795 |
+ this.swiperRef.slideToLoop(index, speed, !silent); |
|
796 |
+ } |
|
797 |
+ else { |
|
798 |
+ this.swiperRef.slideTo(index, speed, !silent); |
|
799 |
+ } |
|
800 |
+ }); |
|
801 |
+ } |
|
802 |
+ ngOnDestroy() { |
|
803 |
+ this._ngZone.runOutsideAngular(() => { |
|
804 |
+ var _a; |
|
805 |
+ (_a = this.swiperRef) === null || _a === void 0 ? void 0 : _a.destroy(); |
|
806 |
+ }); |
|
807 |
+ } |
|
808 |
+} |
|
809 |
+SwiperComponent.decorators = [ |
|
810 |
+ { type: Component, args: [{ |
|
811 |
+ selector: 'swiper, [swiper]', |
|
812 |
+ template: "<ng-content select=\"[slot=container-start]\"></ng-content>\n<ng-container *ngIf=\"navigation && showNavigation\">\n <div class=\"swiper-button-prev\" #prevElRef></div>\n <div class=\"swiper-button-next\" #nextElRef></div>\n</ng-container>\n<div *ngIf=\"scrollbar && showScrollbar\" class=\"swiper-scrollbar\" #scrollbarElRef></div>\n<div *ngIf=\"pagination && showPagination\" class=\"swiper-pagination\" #paginationElRef></div>\n<div [ngClass]=\"wrapperClass\">\n <ng-content select=\"[slot=wrapper-start]\"></ng-content>\n <ng-template\n *ngTemplateOutlet=\"\n slidesTemplate;\n context: {\n loopSlides: prependSlides,\n key: 'prepend'\n }\n \"\n ></ng-template>\n <ng-template\n *ngTemplateOutlet=\"\n slidesTemplate;\n context: {\n loopSlides: activeSlides,\n key: ''\n }\n \"\n ></ng-template>\n <ng-template\n *ngTemplateOutlet=\"\n slidesTemplate;\n context: {\n loopSlides: appendSlides,\n key: 'append'\n }\n \"\n ></ng-template>\n <ng-content select=\"[slot=wrapper-end]\"></ng-content>\n</div>\n<ng-content select=\"[slot=container-end]\"></ng-content>\n\n<ng-template #slidesTemplate let-loopSlides=\"loopSlides\" let-slideKey=\"key\">\n <div\n *ngFor=\"let slide of loopSlides | async\"\n [ngClass]=\"\n (slide.class ? slide.class + ' ' : '') +\n slideClass +\n (slideKey !== '' ? ' ' + slideDuplicateClass : '')\n \"\n [attr.data-swiper-slide-index]=\"slide.virtualIndex ? slide.virtualIndex : slide.slideIndex\"\n [style]=\"style\"\n [ngSwitch]=\"slide.zoom\"\n >\n <div *ngSwitchCase=\"true\" [ngClass]=\"zoomContainerClass\">\n <ng-template\n [ngTemplateOutlet]=\"slide.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: slide.slideData\n }\"\n ></ng-template>\n </div>\n <ng-container *ngSwitchDefault>\n <ng-template\n [ngTemplateOutlet]=\"slide.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: slide.slideData\n }\"\n ></ng-template>\n </ng-container>\n </div>\n</ng-template>\n", |
|
813 |
+ changeDetection: ChangeDetectionStrategy.OnPush, |
|
814 |
+ encapsulation: ViewEncapsulation.None, |
|
815 |
+ styles: [` |
|
816 |
+ swiper { |
|
817 |
+ display: block; |
|
818 |
+ } |
|
819 |
+ `] |
|
820 |
+ },] } |
|
821 |
+]; |
|
822 |
+SwiperComponent.ctorParameters = () => [ |
|
823 |
+ { type: NgZone }, |
|
824 |
+ { type: ElementRef }, |
|
825 |
+ { type: ChangeDetectorRef }, |
|
826 |
+ { type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] } |
|
827 |
+]; |
|
828 |
+SwiperComponent.propDecorators = { |
|
829 |
+ direction: [{ type: Input }], |
|
830 |
+ touchEventsTarget: [{ type: Input }], |
|
831 |
+ initialSlide: [{ type: Input }], |
|
832 |
+ speed: [{ type: Input }], |
|
833 |
+ cssMode: [{ type: Input }], |
|
834 |
+ updateOnWindowResize: [{ type: Input }], |
|
835 |
+ resizeObserver: [{ type: Input }], |
|
836 |
+ nested: [{ type: Input }], |
|
837 |
+ width: [{ type: Input }], |
|
838 |
+ height: [{ type: Input }], |
|
839 |
+ preventInteractionOnTransition: [{ type: Input }], |
|
840 |
+ userAgent: [{ type: Input }], |
|
841 |
+ url: [{ type: Input }], |
|
842 |
+ edgeSwipeDetection: [{ type: Input }], |
|
843 |
+ edgeSwipeThreshold: [{ type: Input }], |
|
844 |
+ freeMode: [{ type: Input }], |
|
845 |
+ freeModeMomentum: [{ type: Input }], |
|
846 |
+ freeModeMomentumRatio: [{ type: Input }], |
|
847 |
+ freeModeMomentumBounce: [{ type: Input }], |
|
848 |
+ freeModeMomentumBounceRatio: [{ type: Input }], |
|
849 |
+ freeModeMomentumVelocityRatio: [{ type: Input }], |
|
850 |
+ freeModeSticky: [{ type: Input }], |
|
851 |
+ freeModeMinimumVelocity: [{ type: Input }], |
|
852 |
+ autoHeight: [{ type: Input }], |
|
853 |
+ setWrapperSize: [{ type: Input }], |
|
854 |
+ virtualTranslate: [{ type: Input }], |
|
855 |
+ effect: [{ type: Input }], |
|
856 |
+ breakpoints: [{ type: Input }], |
|
857 |
+ spaceBetween: [{ type: Input }], |
|
858 |
+ slidesPerView: [{ type: Input }], |
|
859 |
+ slidesPerColumn: [{ type: Input }], |
|
860 |
+ slidesPerColumnFill: [{ type: Input }], |
|
861 |
+ slidesPerGroup: [{ type: Input }], |
|
862 |
+ slidesPerGroupSkip: [{ type: Input }], |
|
863 |
+ centeredSlides: [{ type: Input }], |
|
864 |
+ centeredSlidesBounds: [{ type: Input }], |
|
865 |
+ slidesOffsetBefore: [{ type: Input }], |
|
866 |
+ slidesOffsetAfter: [{ type: Input }], |
|
867 |
+ normalizeSlideIndex: [{ type: Input }], |
|
868 |
+ centerInsufficientSlides: [{ type: Input }], |
|
869 |
+ watchOverflow: [{ type: Input }], |
|
870 |
+ roundLengths: [{ type: Input }], |
|
871 |
+ touchRatio: [{ type: Input }], |
|
872 |
+ touchAngle: [{ type: Input }], |
|
873 |
+ simulateTouch: [{ type: Input }], |
|
874 |
+ shortSwipes: [{ type: Input }], |
|
875 |
+ longSwipes: [{ type: Input }], |
|
876 |
+ longSwipesRatio: [{ type: Input }], |
|
877 |
+ longSwipesMs: [{ type: Input }], |
|
878 |
+ followFinger: [{ type: Input }], |
|
879 |
+ allowTouchMove: [{ type: Input }], |
|
880 |
+ threshold: [{ type: Input }], |
|
881 |
+ touchMoveStopPropagation: [{ type: Input }], |
|
882 |
+ touchStartPreventDefault: [{ type: Input }], |
|
883 |
+ touchStartForcePreventDefault: [{ type: Input }], |
|
884 |
+ touchReleaseOnEdges: [{ type: Input }], |
|
885 |
+ uniqueNavElements: [{ type: Input }], |
|
886 |
+ resistance: [{ type: Input }], |
|
887 |
+ resistanceRatio: [{ type: Input }], |
|
888 |
+ watchSlidesProgress: [{ type: Input }], |
|
889 |
+ watchSlidesVisibility: [{ type: Input }], |
|
890 |
+ grabCursor: [{ type: Input }], |
|
891 |
+ preventClicks: [{ type: Input }], |
|
892 |
+ preventClicksPropagation: [{ type: Input }], |
|
893 |
+ slideToClickedSlide: [{ type: Input }], |
|
894 |
+ preloadImages: [{ type: Input }], |
|
895 |
+ updateOnImagesReady: [{ type: Input }], |
|
896 |
+ loop: [{ type: Input }], |
|
897 |
+ loopAdditionalSlides: [{ type: Input }], |
|
898 |
+ loopedSlides: [{ type: Input }], |
|
899 |
+ loopFillGroupWithBlank: [{ type: Input }], |
|
900 |
+ loopPreventsSlide: [{ type: Input }], |
|
901 |
+ allowSlidePrev: [{ type: Input }], |
|
902 |
+ allowSlideNext: [{ type: Input }], |
|
903 |
+ swipeHandler: [{ type: Input }], |
|
904 |
+ noSwiping: [{ type: Input }], |
|
905 |
+ noSwipingClass: [{ type: Input }], |
|
906 |
+ noSwipingSelector: [{ type: Input }], |
|
907 |
+ passiveListeners: [{ type: Input }], |
|
908 |
+ containerModifierClass: [{ type: Input }], |
|
909 |
+ slideClass: [{ type: Input }], |
|
910 |
+ slideBlankClass: [{ type: Input }], |
|
911 |
+ slideActiveClass: [{ type: Input }], |
|
912 |
+ slideDuplicateActiveClass: [{ type: Input }], |
|
913 |
+ slideVisibleClass: [{ type: Input }], |
|
914 |
+ slideDuplicateClass: [{ type: Input }], |
|
915 |
+ slideNextClass: [{ type: Input }], |
|
916 |
+ slideDuplicateNextClass: [{ type: Input }], |
|
917 |
+ slidePrevClass: [{ type: Input }], |
|
918 |
+ slideDuplicatePrevClass: [{ type: Input }], |
|
919 |
+ wrapperClass: [{ type: Input }], |
|
920 |
+ runCallbacksOnInit: [{ type: Input }], |
|
921 |
+ observeParents: [{ type: Input }], |
|
922 |
+ observeSlideChildren: [{ type: Input }], |
|
923 |
+ a11y: [{ type: Input }], |
|
924 |
+ autoplay: [{ type: Input }], |
|
925 |
+ controller: [{ type: Input }], |
|
926 |
+ coverflowEffect: [{ type: Input }], |
|
927 |
+ cubeEffect: [{ type: Input }], |
|
928 |
+ fadeEffect: [{ type: Input }], |
|
929 |
+ flipEffect: [{ type: Input }], |
|
930 |
+ hashNavigation: [{ type: Input }], |
|
931 |
+ history: [{ type: Input }], |
|
932 |
+ keyboard: [{ type: Input }], |
|
933 |
+ lazy: [{ type: Input }], |
|
934 |
+ mousewheel: [{ type: Input }], |
|
935 |
+ parallax: [{ type: Input }], |
|
936 |
+ thumbs: [{ type: Input }], |
|
937 |
+ zoom: [{ type: Input }], |
|
938 |
+ navigation: [{ type: Input }], |
|
939 |
+ pagination: [{ type: Input }], |
|
940 |
+ scrollbar: [{ type: Input }], |
|
941 |
+ virtual: [{ type: Input }], |
|
942 |
+ index: [{ type: Input }], |
|
943 |
+ config: [{ type: Input }], |
|
944 |
+ s__beforeBreakpoint: [{ type: Output, args: ['_beforeBreakpoint',] }], |
|
945 |
+ s__containerClasses: [{ type: Output, args: ['_containerClasses',] }], |
|
946 |
+ s__slideClass: [{ type: Output, args: ['_slideClass',] }], |
|
947 |
+ s__swiper: [{ type: Output, args: ['_swiper',] }], |
|
948 |
+ s_activeIndexChange: [{ type: Output, args: ['activeIndexChange',] }], |
|
949 |
+ s_afterInit: [{ type: Output, args: ['afterInit',] }], |
|
950 |
+ s_autoplay: [{ type: Output, args: ['autoplay',] }], |
|
951 |
+ s_autoplayStart: [{ type: Output, args: ['autoplayStart',] }], |
|
952 |
+ s_autoplayStop: [{ type: Output, args: ['autoplayStop',] }], |
|
953 |
+ s_beforeDestroy: [{ type: Output, args: ['beforeDestroy',] }], |
|
954 |
+ s_beforeInit: [{ type: Output, args: ['beforeInit',] }], |
|
955 |
+ s_beforeLoopFix: [{ type: Output, args: ['beforeLoopFix',] }], |
|
956 |
+ s_beforeResize: [{ type: Output, args: ['beforeResize',] }], |
|
957 |
+ s_beforeSlideChangeStart: [{ type: Output, args: ['beforeSlideChangeStart',] }], |
|
958 |
+ s_beforeTransitionStart: [{ type: Output, args: ['beforeTransitionStart',] }], |
|
959 |
+ s_breakpoint: [{ type: Output, args: ['breakpoint',] }], |
|
960 |
+ s_changeDirection: [{ type: Output, args: ['changeDirection',] }], |
|
961 |
+ s_click: [{ type: Output, args: ['click',] }], |
|
962 |
+ s_doubleTap: [{ type: Output, args: ['doubleTap',] }], |
|
963 |
+ s_doubleClick: [{ type: Output, args: ['doubleClick',] }], |
|
964 |
+ s_destroy: [{ type: Output, args: ['destroy',] }], |
|
965 |
+ s_fromEdge: [{ type: Output, args: ['fromEdge',] }], |
|
966 |
+ s_hashChange: [{ type: Output, args: ['hashChange',] }], |
|
967 |
+ s_hashSet: [{ type: Output, args: ['hashSet',] }], |
|
968 |
+ s_imagesReady: [{ type: Output, args: ['imagesReady',] }], |
|
969 |
+ s_init: [{ type: Output, args: ['init',] }], |
|
970 |
+ s_keyPress: [{ type: Output, args: ['keyPress',] }], |
|
971 |
+ s_lazyImageLoad: [{ type: Output, args: ['lazyImageLoad',] }], |
|
972 |
+ s_lazyImageReady: [{ type: Output, args: ['lazyImageReady',] }], |
|
973 |
+ s_loopFix: [{ type: Output, args: ['loopFix',] }], |
|
974 |
+ s_momentumBounce: [{ type: Output, args: ['momentumBounce',] }], |
|
975 |
+ s_navigationHide: [{ type: Output, args: ['navigationHide',] }], |
|
976 |
+ s_navigationShow: [{ type: Output, args: ['navigationShow',] }], |
|
977 |
+ s_observerUpdate: [{ type: Output, args: ['observerUpdate',] }], |
|
978 |
+ s_orientationchange: [{ type: Output, args: ['orientationchange',] }], |
|
979 |
+ s_paginationHide: [{ type: Output, args: ['paginationHide',] }], |
|
980 |
+ s_paginationRender: [{ type: Output, args: ['paginationRender',] }], |
|
981 |
+ s_paginationShow: [{ type: Output, args: ['paginationShow',] }], |
|
982 |
+ s_paginationUpdate: [{ type: Output, args: ['paginationUpdate',] }], |
|
983 |
+ s_progress: [{ type: Output, args: ['progress',] }], |
|
984 |
+ s_reachBeginning: [{ type: Output, args: ['reachBeginning',] }], |
|
985 |
+ s_reachEnd: [{ type: Output, args: ['reachEnd',] }], |
|
986 |
+ s_realIndexChange: [{ type: Output, args: ['realIndexChange',] }], |
|
987 |
+ s_resize: [{ type: Output, args: ['resize',] }], |
|
988 |
+ s_scroll: [{ type: Output, args: ['scroll',] }], |
|
989 |
+ s_scrollbarDragEnd: [{ type: Output, args: ['scrollbarDragEnd',] }], |
|
990 |
+ s_scrollbarDragMove: [{ type: Output, args: ['scrollbarDragMove',] }], |
|
991 |
+ s_scrollbarDragStart: [{ type: Output, args: ['scrollbarDragStart',] }], |
|
992 |
+ s_setTransition: [{ type: Output, args: ['setTransition',] }], |
|
993 |
+ s_setTranslate: [{ type: Output, args: ['setTranslate',] }], |
|
994 |
+ s_slideChange: [{ type: Output, args: ['slideChange',] }], |
|
995 |
+ s_slideChangeTransitionEnd: [{ type: Output, args: ['slideChangeTransitionEnd',] }], |
|
996 |
+ s_slideChangeTransitionStart: [{ type: Output, args: ['slideChangeTransitionStart',] }], |
|
997 |
+ s_slideNextTransitionEnd: [{ type: Output, args: ['slideNextTransitionEnd',] }], |
|
998 |
+ s_slideNextTransitionStart: [{ type: Output, args: ['slideNextTransitionStart',] }], |
|
999 |
+ s_slidePrevTransitionEnd: [{ type: Output, args: ['slidePrevTransitionEnd',] }], |
|
1000 |
+ s_slidePrevTransitionStart: [{ type: Output, args: ['slidePrevTransitionStart',] }], |
|
1001 |
+ s_slideResetTransitionStart: [{ type: Output, args: ['slideResetTransitionStart',] }], |
|
1002 |
+ s_slideResetTransitionEnd: [{ type: Output, args: ['slideResetTransitionEnd',] }], |
|
1003 |
+ s_sliderMove: [{ type: Output, args: ['sliderMove',] }], |
|
1004 |
+ s_sliderFirstMove: [{ type: Output, args: ['sliderFirstMove',] }], |
|
1005 |
+ s_slidesLengthChange: [{ type: Output, args: ['slidesLengthChange',] }], |
|
1006 |
+ s_slidesGridLengthChange: [{ type: Output, args: ['slidesGridLengthChange',] }], |
|
1007 |
+ s_snapGridLengthChange: [{ type: Output, args: ['snapGridLengthChange',] }], |
|
1008 |
+ s_snapIndexChange: [{ type: Output, args: ['snapIndexChange',] }], |
|
1009 |
+ s_tap: [{ type: Output, args: ['tap',] }], |
|
1010 |
+ s_toEdge: [{ type: Output, args: ['toEdge',] }], |
|
1011 |
+ s_touchEnd: [{ type: Output, args: ['touchEnd',] }], |
|
1012 |
+ s_touchMove: [{ type: Output, args: ['touchMove',] }], |
|
1013 |
+ s_touchMoveOpposite: [{ type: Output, args: ['touchMoveOpposite',] }], |
|
1014 |
+ s_touchStart: [{ type: Output, args: ['touchStart',] }], |
|
1015 |
+ s_transitionEnd: [{ type: Output, args: ['transitionEnd',] }], |
|
1016 |
+ s_transitionStart: [{ type: Output, args: ['transitionStart',] }], |
|
1017 |
+ s_update: [{ type: Output, args: ['update',] }], |
|
1018 |
+ s_zoomChange: [{ type: Output, args: ['zoomChange',] }], |
|
1019 |
+ s_swiper: [{ type: Output, args: ['swiper',] }], |
|
1020 |
+ indexChange: [{ type: Output }], |
|
1021 |
+ prevElRef: [{ type: ViewChild, args: ['prevElRef', { static: false },] }], |
|
1022 |
+ nextElRef: [{ type: ViewChild, args: ['nextElRef', { static: false },] }], |
|
1023 |
+ scrollbarElRef: [{ type: ViewChild, args: ['scrollbarElRef', { static: false },] }], |
|
1024 |
+ paginationElRef: [{ type: ViewChild, args: ['paginationElRef', { static: false },] }], |
|
1025 |
+ slidesEl: [{ type: ContentChildren, args: [SwiperSlideDirective, { descendants: true, emitDistinctChangesOnly: true },] }], |
|
1026 |
+ containerClasses: [{ type: HostBinding, args: ['class',] }] |
|
1027 |
+}; |
|
1028 |
+ |
|
1029 |
+class SwiperModule { |
|
1030 |
+} |
|
1031 |
+SwiperModule.decorators = [ |
|
1032 |
+ { type: NgModule, args: [{ |
|
1033 |
+ declarations: [SwiperComponent, SwiperSlideDirective], |
|
1034 |
+ exports: [SwiperComponent, SwiperSlideDirective], |
|
1035 |
+ imports: [CommonModule], |
|
1036 |
+ },] } |
|
1037 |
+]; |
|
1038 |
+ |
|
1039 |
+/* |
|
1040 |
+ * Public API Surface of angular |
|
1041 |
+ */ |
|
1042 |
+ |
|
1043 |
+/** |
|
1044 |
+ * Generated bundle index. Do not edit. |
|
1045 |
+ */ |
|
1046 |
+ |
|
1047 |
+export { SwiperComponent, SwiperModule, SwiperSlideDirective }; |
|
1048 |
+//# sourceMappingURL=swiper_angular.js.map |