@content-blocks/js 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/content-accordion.cjs.entry.js +1 -1
- package/dist/cjs/content-blocks.cjs.js +2 -2
- package/dist/cjs/content-blocks.cjs.js.map +1 -1
- package/dist/cjs/content-button_10.cjs.entry.js +1 -1
- package/dist/cjs/content-button_10.cjs.entry.js.map +1 -1
- package/dist/cjs/{content-carousel-c8e0a9a9.js → content-carousel-d866cb77.js} +27 -22
- package/dist/cjs/content-carousel-d866cb77.js.map +1 -0
- package/dist/cjs/content-carousel.cjs.entry.js +2 -2
- package/dist/cjs/content-navigation-block.cjs.entry.js +4 -6
- package/dist/cjs/content-navigation-block.cjs.entry.js.map +1 -1
- package/dist/cjs/content-split-block.cjs.entry.js +1 -1
- package/dist/cjs/content-split-block.cjs.entry.js.map +1 -1
- package/dist/cjs/content-tabs.cjs.entry.js +1 -1
- package/dist/cjs/{index-e93f381a.js → index-239b1c46.js} +232 -102
- package/dist/cjs/index-239b1c46.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{swiper-d0296c76.js → swiper-2fe1b80b.js} +421 -149
- package/dist/cjs/swiper-2fe1b80b.js.map +1 -0
- package/dist/collection/blocks/content-hero-block/content-hero-block.js.map +1 -1
- package/dist/collection/blocks/content-split-block/content-split-block.js.map +1 -1
- package/dist/collection/blocks/content-text-block/content-text-block.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/content-carousel/content-carousel.css +3 -3
- package/dist/collection/components/content-navigation-block/content-navigation-block.js +3 -5
- package/dist/collection/components/content-navigation-block/content-navigation-block.js.map +1 -1
- package/dist/collection/elements/content-button/content-button.js.map +1 -1
- package/dist/collection/elements/content-line/content-line.js.map +1 -1
- package/dist/collection/elements/content-video/content-video.js.map +1 -1
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js.map +1 -1
- package/dist/components/content-button.js.map +1 -1
- package/dist/components/content-carousel.js +24 -20
- package/dist/components/content-carousel.js.map +1 -1
- package/dist/components/content-grid-formatter2.js.map +1 -1
- package/dist/components/content-hero-block.js.map +1 -1
- package/dist/components/content-line.js.map +1 -1
- package/dist/components/content-navigation-block.js +3 -5
- package/dist/components/content-navigation-block.js.map +1 -1
- package/dist/components/content-split-block.js.map +1 -1
- package/dist/components/content-text-block.js.map +1 -1
- package/dist/components/content-video.js.map +1 -1
- package/dist/components/swiper.js +419 -147
- package/dist/components/swiper.js.map +1 -1
- package/dist/content-blocks/content-blocks.esm.js +1 -1
- package/dist/content-blocks/content-blocks.esm.js.map +1 -1
- package/dist/content-blocks/p-08143d3f.js +2 -0
- package/dist/content-blocks/p-08143d3f.js.map +1 -0
- package/dist/content-blocks/{p-057c0e4d.entry.js → p-14dd6549.entry.js} +2 -2
- package/dist/content-blocks/p-14dd6549.entry.js.map +1 -0
- package/dist/content-blocks/{p-b1300b9a.entry.js → p-1947500c.entry.js} +2 -2
- package/dist/content-blocks/p-1947500c.entry.js.map +1 -0
- package/dist/content-blocks/p-26ff44fc.js +6 -6
- package/dist/content-blocks/{p-01952c81.entry.js → p-3732482d.entry.js} +2 -2
- package/dist/content-blocks/p-3732482d.entry.js.map +1 -0
- package/dist/content-blocks/p-3b4be54b.js +2 -0
- package/dist/content-blocks/p-3b4be54b.js.map +1 -0
- package/dist/content-blocks/{p-914e3550.entry.js → p-8d44f285.entry.js} +2 -2
- package/dist/content-blocks/p-a802c984.entry.js +2 -0
- package/dist/content-blocks/{p-2ec7fda2.entry.js → p-b27f84ad.entry.js} +2 -2
- package/dist/content-blocks/p-dc53dda7.js +3 -0
- package/dist/content-blocks/p-dc53dda7.js.map +1 -0
- package/dist/esm/content-accordion.entry.js +1 -1
- package/dist/esm/content-blocks.js +3 -3
- package/dist/esm/content-blocks.js.map +1 -1
- package/dist/esm/content-button_10.entry.js +1 -1
- package/dist/esm/content-button_10.entry.js.map +1 -1
- package/dist/esm/{content-carousel-f971cfcd.js → content-carousel-af580def.js} +27 -23
- package/dist/esm/content-carousel-af580def.js.map +1 -0
- package/dist/esm/content-carousel.entry.js +2 -2
- package/dist/esm/content-navigation-block.entry.js +4 -6
- package/dist/esm/content-navigation-block.entry.js.map +1 -1
- package/dist/esm/content-split-block.entry.js +1 -1
- package/dist/esm/content-split-block.entry.js.map +1 -1
- package/dist/esm/content-tabs.entry.js +1 -1
- package/dist/esm/{index-9501de67.js → index-6e48707b.js} +232 -102
- package/dist/esm/index-6e48707b.js.map +1 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{swiper-7d87458d.js → swiper-3d1a80cc.js} +421 -149
- package/dist/esm/swiper-3d1a80cc.js.map +1 -0
- package/dist/types/blocks/content-hero-block/content-hero-block.d.ts +0 -2
- package/dist/types/blocks/content-text-block/content-text-block.d.ts +0 -2
- package/dist/types/components/content-navigation-block/content-navigation-block.d.ts +0 -2
- package/dist/types/components.d.ts +11 -0
- package/dist/types/elements/content-button/content-button.d.ts +0 -2
- package/dist/types/elements/content-line/content-line.d.ts +0 -2
- package/dist/types/elements/content-video/content-video.d.ts +0 -2
- package/dist/types/formatters/content-grid-formatter/content-grid-formatter.d.ts +0 -2
- package/dist/types/stencil-public-runtime.d.ts +21 -0
- package/package.json +13 -13
- package/dist/cjs/content-carousel-c8e0a9a9.js.map +0 -1
- package/dist/cjs/index-e93f381a.js.map +0 -1
- package/dist/cjs/swiper-d0296c76.js.map +0 -1
- package/dist/content-blocks/p-01952c81.entry.js.map +0 -1
- package/dist/content-blocks/p-057c0e4d.entry.js.map +0 -1
- package/dist/content-blocks/p-3f3a30b1.entry.js +0 -2
- package/dist/content-blocks/p-8a8f13fb.js +0 -2
- package/dist/content-blocks/p-8a8f13fb.js.map +0 -1
- package/dist/content-blocks/p-b1300b9a.entry.js.map +0 -1
- package/dist/content-blocks/p-cd3c0fce.js +0 -3
- package/dist/content-blocks/p-cd3c0fce.js.map +0 -1
- package/dist/content-blocks/p-d8dc8d1e.js +0 -2
- package/dist/content-blocks/p-d8dc8d1e.js.map +0 -1
- package/dist/esm/content-carousel-f971cfcd.js.map +0 -1
- package/dist/esm/index-9501de67.js.map +0 -1
- package/dist/esm/swiper-7d87458d.js.map +0 -1
- /package/dist/content-blocks/{p-914e3550.entry.js.map → p-8d44f285.entry.js.map} +0 -0
- /package/dist/content-blocks/{p-3f3a30b1.entry.js.map → p-a802c984.entry.js.map} +0 -0
- /package/dist/content-blocks/{p-2ec7fda2.entry.js.map → p-b27f84ad.entry.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as extend, g as getDocument, a as elementChildren, b as elementIndex, c as createElement, d as elementStyle, f as deleteProps, h as getWindow, i as elementParents, s as setCSSProperty, j as elementOuterSize, k as elementNextAll, l as elementPrevAll, m as getTranslate, n as animateCSSModeScroll, o as nextTick, p as now } from './content-carousel.js';
|
|
1
|
+
import { e as extend, g as getDocument, a as elementChildren, b as elementIndex, c as createElement, d as elementStyle, f as deleteProps, h as getWindow, i as elementParents, s as setCSSProperty, j as elementOuterSize, k as elementNextAll, l as elementPrevAll, m as getTranslate, n as animateCSSModeScroll, o as nextTick, p as showWarning, q as now } from './content-carousel.js';
|
|
2
2
|
|
|
3
3
|
let support;
|
|
4
4
|
function calcSupport() {
|
|
@@ -376,24 +376,8 @@ function updateSize() {
|
|
|
376
376
|
|
|
377
377
|
function updateSlides() {
|
|
378
378
|
const swiper = this;
|
|
379
|
-
function getDirectionLabel(property) {
|
|
380
|
-
if (swiper.isHorizontal()) {
|
|
381
|
-
return property;
|
|
382
|
-
}
|
|
383
|
-
// prettier-ignore
|
|
384
|
-
return {
|
|
385
|
-
'width': 'height',
|
|
386
|
-
'margin-top': 'margin-left',
|
|
387
|
-
'margin-bottom ': 'margin-right',
|
|
388
|
-
'margin-left': 'margin-top',
|
|
389
|
-
'margin-right': 'margin-bottom',
|
|
390
|
-
'padding-left': 'padding-top',
|
|
391
|
-
'padding-right': 'padding-bottom',
|
|
392
|
-
'marginRight': 'marginBottom'
|
|
393
|
-
}[property];
|
|
394
|
-
}
|
|
395
379
|
function getDirectionPropertyValue(node, label) {
|
|
396
|
-
return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
|
|
380
|
+
return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
|
|
397
381
|
}
|
|
398
382
|
const params = swiper.params;
|
|
399
383
|
const {
|
|
@@ -452,7 +436,9 @@ function updateSlides() {
|
|
|
452
436
|
}
|
|
453
437
|
const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
|
|
454
438
|
if (gridEnabled) {
|
|
455
|
-
swiper.grid.initSlides(
|
|
439
|
+
swiper.grid.initSlides(slides);
|
|
440
|
+
} else if (swiper.grid) {
|
|
441
|
+
swiper.grid.unsetSlides();
|
|
456
442
|
}
|
|
457
443
|
|
|
458
444
|
// Calc slides
|
|
@@ -465,13 +451,13 @@ function updateSlides() {
|
|
|
465
451
|
let slide;
|
|
466
452
|
if (slides[i]) slide = slides[i];
|
|
467
453
|
if (gridEnabled) {
|
|
468
|
-
swiper.grid.updateSlide(i, slide,
|
|
454
|
+
swiper.grid.updateSlide(i, slide, slides);
|
|
469
455
|
}
|
|
470
456
|
if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
|
|
471
457
|
|
|
472
458
|
if (params.slidesPerView === 'auto') {
|
|
473
459
|
if (shouldResetSlideSize) {
|
|
474
|
-
slides[i].style[getDirectionLabel('width')] = ``;
|
|
460
|
+
slides[i].style[swiper.getDirectionLabel('width')] = ``;
|
|
475
461
|
}
|
|
476
462
|
const slideStyles = getComputedStyle(slide);
|
|
477
463
|
const currentTransform = slide.style.transform;
|
|
@@ -513,7 +499,7 @@ function updateSlides() {
|
|
|
513
499
|
slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
|
|
514
500
|
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
|
515
501
|
if (slides[i]) {
|
|
516
|
-
slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
|
|
502
|
+
slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
|
|
517
503
|
}
|
|
518
504
|
}
|
|
519
505
|
if (slides[i]) {
|
|
@@ -543,10 +529,10 @@ function updateSlides() {
|
|
|
543
529
|
wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
|
|
544
530
|
}
|
|
545
531
|
if (params.setWrapperSize) {
|
|
546
|
-
wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
|
|
532
|
+
wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
|
|
547
533
|
}
|
|
548
534
|
if (gridEnabled) {
|
|
549
|
-
swiper.grid.updateWrapperSize(slideSize, snapGrid
|
|
535
|
+
swiper.grid.updateWrapperSize(slideSize, snapGrid);
|
|
550
536
|
}
|
|
551
537
|
|
|
552
538
|
// Remove last grid elements depending on width
|
|
@@ -583,7 +569,7 @@ function updateSlides() {
|
|
|
583
569
|
}
|
|
584
570
|
if (snapGrid.length === 0) snapGrid = [0];
|
|
585
571
|
if (spaceBetween !== 0) {
|
|
586
|
-
const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
|
|
572
|
+
const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');
|
|
587
573
|
slides.filter((_, slideIndex) => {
|
|
588
574
|
if (!params.cssMode || params.loop) return true;
|
|
589
575
|
if (slideIndex === slides.length - 1) {
|
|
@@ -735,7 +721,7 @@ function updateSlidesProgress(translate) {
|
|
|
735
721
|
|
|
736
722
|
// Visible Slides
|
|
737
723
|
slides.forEach(slideEl => {
|
|
738
|
-
slideEl.classList.remove(params.slideVisibleClass);
|
|
724
|
+
slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass);
|
|
739
725
|
});
|
|
740
726
|
swiper.visibleSlidesIndexes = [];
|
|
741
727
|
swiper.visibleSlides = [];
|
|
@@ -755,12 +741,16 @@ function updateSlidesProgress(translate) {
|
|
|
755
741
|
const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
|
|
756
742
|
const slideBefore = -(offsetCenter - slideOffset);
|
|
757
743
|
const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
|
|
744
|
+
const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];
|
|
758
745
|
const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
|
|
759
746
|
if (isVisible) {
|
|
760
747
|
swiper.visibleSlides.push(slide);
|
|
761
748
|
swiper.visibleSlidesIndexes.push(i);
|
|
762
749
|
slides[i].classList.add(params.slideVisibleClass);
|
|
763
750
|
}
|
|
751
|
+
if (isFullyVisible) {
|
|
752
|
+
slides[i].classList.add(params.slideFullyVisibleClass);
|
|
753
|
+
}
|
|
764
754
|
slide.progress = rtl ? -slideProgress : slideProgress;
|
|
765
755
|
slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
|
|
766
756
|
}
|
|
@@ -838,6 +828,7 @@ function updateSlidesClasses() {
|
|
|
838
828
|
activeIndex
|
|
839
829
|
} = swiper;
|
|
840
830
|
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
831
|
+
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
841
832
|
const getFilteredSlide = selector => {
|
|
842
833
|
return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
|
|
843
834
|
};
|
|
@@ -845,6 +836,8 @@ function updateSlidesClasses() {
|
|
|
845
836
|
slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
846
837
|
});
|
|
847
838
|
let activeSlide;
|
|
839
|
+
let prevSlide;
|
|
840
|
+
let nextSlide;
|
|
848
841
|
if (isVirtual) {
|
|
849
842
|
if (params.loop) {
|
|
850
843
|
let slideIndex = activeIndex - swiper.virtual.slidesBefore;
|
|
@@ -855,27 +848,42 @@ function updateSlidesClasses() {
|
|
|
855
848
|
activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
|
|
856
849
|
}
|
|
857
850
|
} else {
|
|
858
|
-
|
|
851
|
+
if (gridEnabled) {
|
|
852
|
+
activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0];
|
|
853
|
+
nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0];
|
|
854
|
+
prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0];
|
|
855
|
+
} else {
|
|
856
|
+
activeSlide = slides[activeIndex];
|
|
857
|
+
}
|
|
859
858
|
}
|
|
860
859
|
if (activeSlide) {
|
|
861
860
|
// Active classes
|
|
862
861
|
activeSlide.classList.add(params.slideActiveClass);
|
|
862
|
+
if (gridEnabled) {
|
|
863
|
+
if (nextSlide) {
|
|
864
|
+
nextSlide.classList.add(params.slideNextClass);
|
|
865
|
+
}
|
|
866
|
+
if (prevSlide) {
|
|
867
|
+
prevSlide.classList.add(params.slidePrevClass);
|
|
868
|
+
}
|
|
869
|
+
} else {
|
|
870
|
+
// Next Slide
|
|
871
|
+
nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
872
|
+
if (params.loop && !nextSlide) {
|
|
873
|
+
nextSlide = slides[0];
|
|
874
|
+
}
|
|
875
|
+
if (nextSlide) {
|
|
876
|
+
nextSlide.classList.add(params.slideNextClass);
|
|
877
|
+
}
|
|
863
878
|
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
// Prev Slide
|
|
873
|
-
let prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
874
|
-
if (params.loop && !prevSlide === 0) {
|
|
875
|
-
prevSlide = slides[slides.length - 1];
|
|
876
|
-
}
|
|
877
|
-
if (prevSlide) {
|
|
878
|
-
prevSlide.classList.add(params.slidePrevClass);
|
|
879
|
+
// Prev Slide
|
|
880
|
+
prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
881
|
+
if (params.loop && !prevSlide === 0) {
|
|
882
|
+
prevSlide = slides[slides.length - 1];
|
|
883
|
+
}
|
|
884
|
+
if (prevSlide) {
|
|
885
|
+
prevSlide.classList.add(params.slidePrevClass);
|
|
886
|
+
}
|
|
879
887
|
}
|
|
880
888
|
}
|
|
881
889
|
swiper.emitSlidesClasses();
|
|
@@ -888,7 +896,17 @@ const processLazyPreloader = (swiper, imageEl) => {
|
|
|
888
896
|
if (slideEl) {
|
|
889
897
|
let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);
|
|
890
898
|
if (!lazyEl && swiper.isElement) {
|
|
891
|
-
|
|
899
|
+
if (slideEl.shadowRoot) {
|
|
900
|
+
lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
|
|
901
|
+
} else {
|
|
902
|
+
// init later
|
|
903
|
+
requestAnimationFrame(() => {
|
|
904
|
+
if (slideEl.shadowRoot) {
|
|
905
|
+
lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
|
|
906
|
+
if (lazyEl) lazyEl.remove();
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
}
|
|
892
910
|
}
|
|
893
911
|
if (lazyEl) lazyEl.remove();
|
|
894
912
|
}
|
|
@@ -990,22 +1008,37 @@ function updateActiveIndex(newActiveIndex) {
|
|
|
990
1008
|
snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
|
|
991
1009
|
}
|
|
992
1010
|
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
|
993
|
-
if (activeIndex === previousIndex) {
|
|
1011
|
+
if (activeIndex === previousIndex && !swiper.params.loop) {
|
|
994
1012
|
if (snapIndex !== previousSnapIndex) {
|
|
995
1013
|
swiper.snapIndex = snapIndex;
|
|
996
1014
|
swiper.emit('snapIndexChange');
|
|
997
1015
|
}
|
|
998
|
-
if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
|
|
999
|
-
swiper.realIndex = getVirtualRealIndex(activeIndex);
|
|
1000
|
-
}
|
|
1001
1016
|
return;
|
|
1002
1017
|
}
|
|
1018
|
+
if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
|
|
1019
|
+
swiper.realIndex = getVirtualRealIndex(activeIndex);
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
1023
|
+
|
|
1003
1024
|
// Get real index
|
|
1004
1025
|
let realIndex;
|
|
1005
1026
|
if (swiper.virtual && params.virtual.enabled && params.loop) {
|
|
1006
1027
|
realIndex = getVirtualRealIndex(activeIndex);
|
|
1028
|
+
} else if (gridEnabled) {
|
|
1029
|
+
const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0];
|
|
1030
|
+
let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
|
|
1031
|
+
if (Number.isNaN(activeSlideIndex)) {
|
|
1032
|
+
activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
|
|
1033
|
+
}
|
|
1034
|
+
realIndex = Math.floor(activeSlideIndex / params.grid.rows);
|
|
1007
1035
|
} else if (swiper.slides[activeIndex]) {
|
|
1008
|
-
|
|
1036
|
+
const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');
|
|
1037
|
+
if (slideIndex) {
|
|
1038
|
+
realIndex = parseInt(slideIndex, 10);
|
|
1039
|
+
} else {
|
|
1040
|
+
realIndex = activeIndex;
|
|
1041
|
+
}
|
|
1009
1042
|
} else {
|
|
1010
1043
|
realIndex = activeIndex;
|
|
1011
1044
|
}
|
|
@@ -1022,18 +1055,25 @@ function updateActiveIndex(newActiveIndex) {
|
|
|
1022
1055
|
}
|
|
1023
1056
|
swiper.emit('activeIndexChange');
|
|
1024
1057
|
swiper.emit('snapIndexChange');
|
|
1025
|
-
if (previousRealIndex !== realIndex) {
|
|
1026
|
-
swiper.emit('realIndexChange');
|
|
1027
|
-
}
|
|
1028
1058
|
if (swiper.initialized || swiper.params.runCallbacksOnInit) {
|
|
1059
|
+
if (previousRealIndex !== realIndex) {
|
|
1060
|
+
swiper.emit('realIndexChange');
|
|
1061
|
+
}
|
|
1029
1062
|
swiper.emit('slideChange');
|
|
1030
1063
|
}
|
|
1031
1064
|
}
|
|
1032
1065
|
|
|
1033
|
-
function updateClickedSlide(
|
|
1066
|
+
function updateClickedSlide(el, path) {
|
|
1034
1067
|
const swiper = this;
|
|
1035
1068
|
const params = swiper.params;
|
|
1036
|
-
|
|
1069
|
+
let slide = el.closest(`.${params.slideClass}, swiper-slide`);
|
|
1070
|
+
if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) {
|
|
1071
|
+
[...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => {
|
|
1072
|
+
if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) {
|
|
1073
|
+
slide = pathEl;
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1037
1077
|
let slideFound = false;
|
|
1038
1078
|
let slideIndex;
|
|
1039
1079
|
if (slide) {
|
|
@@ -1492,16 +1532,58 @@ function slideToLoop(index, speed, runCallbacks, internal) {
|
|
|
1492
1532
|
index = indexAsNumber;
|
|
1493
1533
|
}
|
|
1494
1534
|
const swiper = this;
|
|
1535
|
+
const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
|
|
1495
1536
|
let newIndex = index;
|
|
1496
1537
|
if (swiper.params.loop) {
|
|
1497
1538
|
if (swiper.virtual && swiper.params.virtual.enabled) {
|
|
1498
1539
|
// eslint-disable-next-line
|
|
1499
1540
|
newIndex = newIndex + swiper.virtual.slidesBefore;
|
|
1500
1541
|
} else {
|
|
1501
|
-
|
|
1542
|
+
let targetSlideIndex;
|
|
1543
|
+
if (gridEnabled) {
|
|
1544
|
+
const slideIndex = newIndex * swiper.params.grid.rows;
|
|
1545
|
+
targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
|
|
1546
|
+
} else {
|
|
1547
|
+
targetSlideIndex = swiper.getSlideIndexByData(newIndex);
|
|
1548
|
+
}
|
|
1549
|
+
const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
|
|
1550
|
+
const {
|
|
1551
|
+
centeredSlides
|
|
1552
|
+
} = swiper.params;
|
|
1553
|
+
let slidesPerView = swiper.params.slidesPerView;
|
|
1554
|
+
if (slidesPerView === 'auto') {
|
|
1555
|
+
slidesPerView = swiper.slidesPerViewDynamic();
|
|
1556
|
+
} else {
|
|
1557
|
+
slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
1558
|
+
if (centeredSlides && slidesPerView % 2 === 0) {
|
|
1559
|
+
slidesPerView = slidesPerView + 1;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
let needLoopFix = cols - targetSlideIndex < slidesPerView;
|
|
1563
|
+
if (centeredSlides) {
|
|
1564
|
+
needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
|
|
1565
|
+
}
|
|
1566
|
+
if (needLoopFix) {
|
|
1567
|
+
const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
|
|
1568
|
+
swiper.loopFix({
|
|
1569
|
+
direction,
|
|
1570
|
+
slideTo: true,
|
|
1571
|
+
activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
|
|
1572
|
+
slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
if (gridEnabled) {
|
|
1576
|
+
const slideIndex = newIndex * swiper.params.grid.rows;
|
|
1577
|
+
newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
|
|
1578
|
+
} else {
|
|
1579
|
+
newIndex = swiper.getSlideIndexByData(newIndex);
|
|
1580
|
+
}
|
|
1502
1581
|
}
|
|
1503
1582
|
}
|
|
1504
|
-
|
|
1583
|
+
requestAnimationFrame(() => {
|
|
1584
|
+
swiper.slideTo(newIndex, speed, runCallbacks, internal);
|
|
1585
|
+
});
|
|
1586
|
+
return swiper;
|
|
1505
1587
|
}
|
|
1506
1588
|
|
|
1507
1589
|
/* eslint no-unused-vars: "off" */
|
|
@@ -1532,6 +1614,12 @@ function slideNext(speed, runCallbacks, internal) {
|
|
|
1532
1614
|
});
|
|
1533
1615
|
// eslint-disable-next-line
|
|
1534
1616
|
swiper._clientLeft = swiper.wrapperEl.clientLeft;
|
|
1617
|
+
if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {
|
|
1618
|
+
requestAnimationFrame(() => {
|
|
1619
|
+
swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
|
|
1620
|
+
});
|
|
1621
|
+
return true;
|
|
1622
|
+
}
|
|
1535
1623
|
}
|
|
1536
1624
|
if (params.rewind && swiper.isEnd) {
|
|
1537
1625
|
return swiper.slideTo(0, speed, runCallbacks, internal);
|
|
@@ -1598,6 +1686,11 @@ function slidePrev(speed, runCallbacks, internal) {
|
|
|
1598
1686
|
if (params.rewind && swiper.isBeginning) {
|
|
1599
1687
|
const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
|
|
1600
1688
|
return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
|
|
1689
|
+
} else if (params.loop && swiper.activeIndex === 0 && params.cssMode) {
|
|
1690
|
+
requestAnimationFrame(() => {
|
|
1691
|
+
swiper.slideTo(prevIndex, speed, runCallbacks, internal);
|
|
1692
|
+
});
|
|
1693
|
+
return true;
|
|
1601
1694
|
}
|
|
1602
1695
|
return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
|
|
1603
1696
|
}
|
|
@@ -1706,10 +1799,45 @@ function loopCreate(slideRealIndex) {
|
|
|
1706
1799
|
slidesEl
|
|
1707
1800
|
} = swiper;
|
|
1708
1801
|
if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1802
|
+
const initSlides = () => {
|
|
1803
|
+
const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
|
|
1804
|
+
slides.forEach((el, index) => {
|
|
1805
|
+
el.setAttribute('data-swiper-slide-index', index);
|
|
1806
|
+
});
|
|
1807
|
+
};
|
|
1808
|
+
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
1809
|
+
const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
|
|
1810
|
+
const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
|
|
1811
|
+
const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
|
|
1812
|
+
const addBlankSlides = amountOfSlides => {
|
|
1813
|
+
for (let i = 0; i < amountOfSlides; i += 1) {
|
|
1814
|
+
const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]);
|
|
1815
|
+
swiper.slidesEl.append(slideEl);
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
if (shouldFillGroup) {
|
|
1819
|
+
if (params.loopAddBlankSlides) {
|
|
1820
|
+
const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;
|
|
1821
|
+
addBlankSlides(slidesToAdd);
|
|
1822
|
+
swiper.recalcSlides();
|
|
1823
|
+
swiper.updateSlides();
|
|
1824
|
+
} else {
|
|
1825
|
+
showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
|
|
1826
|
+
}
|
|
1827
|
+
initSlides();
|
|
1828
|
+
} else if (shouldFillGrid) {
|
|
1829
|
+
if (params.loopAddBlankSlides) {
|
|
1830
|
+
const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
|
|
1831
|
+
addBlankSlides(slidesToAdd);
|
|
1832
|
+
swiper.recalcSlides();
|
|
1833
|
+
swiper.updateSlides();
|
|
1834
|
+
} else {
|
|
1835
|
+
showWarning('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
|
|
1836
|
+
}
|
|
1837
|
+
initSlides();
|
|
1838
|
+
} else {
|
|
1839
|
+
initSlides();
|
|
1840
|
+
}
|
|
1713
1841
|
swiper.loopFix({
|
|
1714
1842
|
slideRealIndex,
|
|
1715
1843
|
direction: params.centeredSlides ? undefined : 'next'
|
|
@@ -1736,6 +1864,9 @@ function loopFix(_temp) {
|
|
|
1736
1864
|
slidesEl,
|
|
1737
1865
|
params
|
|
1738
1866
|
} = swiper;
|
|
1867
|
+
const {
|
|
1868
|
+
centeredSlides
|
|
1869
|
+
} = params;
|
|
1739
1870
|
swiper.allowSlidePrev = true;
|
|
1740
1871
|
swiper.allowSlideNext = true;
|
|
1741
1872
|
if (swiper.virtual && params.virtual.enabled) {
|
|
@@ -1753,17 +1884,33 @@ function loopFix(_temp) {
|
|
|
1753
1884
|
swiper.emit('loopFix');
|
|
1754
1885
|
return;
|
|
1755
1886
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1887
|
+
let slidesPerView = params.slidesPerView;
|
|
1888
|
+
if (slidesPerView === 'auto') {
|
|
1889
|
+
slidesPerView = swiper.slidesPerViewDynamic();
|
|
1890
|
+
} else {
|
|
1891
|
+
slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
|
|
1892
|
+
if (centeredSlides && slidesPerView % 2 === 0) {
|
|
1893
|
+
slidesPerView = slidesPerView + 1;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
|
|
1897
|
+
let loopedSlides = slidesPerGroup;
|
|
1898
|
+
if (loopedSlides % slidesPerGroup !== 0) {
|
|
1899
|
+
loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
|
|
1760
1900
|
}
|
|
1901
|
+
loopedSlides += params.loopAdditionalSlides;
|
|
1761
1902
|
swiper.loopedSlides = loopedSlides;
|
|
1903
|
+
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
1904
|
+
if (slides.length < slidesPerView + loopedSlides) {
|
|
1905
|
+
showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');
|
|
1906
|
+
} else if (gridEnabled && params.grid.fill === 'row') {
|
|
1907
|
+
showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');
|
|
1908
|
+
}
|
|
1762
1909
|
const prependSlidesIndexes = [];
|
|
1763
1910
|
const appendSlidesIndexes = [];
|
|
1764
1911
|
let activeIndex = swiper.activeIndex;
|
|
1765
1912
|
if (typeof activeSlideIndex === 'undefined') {
|
|
1766
|
-
activeSlideIndex = swiper.getSlideIndex(
|
|
1913
|
+
activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
|
|
1767
1914
|
} else {
|
|
1768
1915
|
activeIndex = activeSlideIndex;
|
|
1769
1916
|
}
|
|
@@ -1771,37 +1918,64 @@ function loopFix(_temp) {
|
|
|
1771
1918
|
const isPrev = direction === 'prev' || !direction;
|
|
1772
1919
|
let slidesPrepended = 0;
|
|
1773
1920
|
let slidesAppended = 0;
|
|
1921
|
+
const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
|
|
1922
|
+
const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
|
|
1923
|
+
const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
|
|
1774
1924
|
// prepend last slides before start
|
|
1775
|
-
if (
|
|
1776
|
-
slidesPrepended = Math.max(loopedSlides -
|
|
1777
|
-
for (let i = 0; i < loopedSlides -
|
|
1778
|
-
const index = i - Math.floor(i /
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1925
|
+
if (activeColIndexWithShift < loopedSlides) {
|
|
1926
|
+
slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
|
|
1927
|
+
for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
|
|
1928
|
+
const index = i - Math.floor(i / cols) * cols;
|
|
1929
|
+
if (gridEnabled) {
|
|
1930
|
+
const colIndexToPrepend = cols - index - 1;
|
|
1931
|
+
for (let i = slides.length - 1; i >= 0; i -= 1) {
|
|
1932
|
+
if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);
|
|
1933
|
+
}
|
|
1934
|
+
// slides.forEach((slide, slideIndex) => {
|
|
1935
|
+
// if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);
|
|
1936
|
+
// });
|
|
1937
|
+
} else {
|
|
1938
|
+
prependSlidesIndexes.push(cols - index - 1);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
} else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
|
|
1942
|
+
slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
|
|
1783
1943
|
for (let i = 0; i < slidesAppended; i += 1) {
|
|
1784
|
-
const index = i - Math.floor(i /
|
|
1785
|
-
|
|
1944
|
+
const index = i - Math.floor(i / cols) * cols;
|
|
1945
|
+
if (gridEnabled) {
|
|
1946
|
+
slides.forEach((slide, slideIndex) => {
|
|
1947
|
+
if (slide.column === index) appendSlidesIndexes.push(slideIndex);
|
|
1948
|
+
});
|
|
1949
|
+
} else {
|
|
1950
|
+
appendSlidesIndexes.push(index);
|
|
1951
|
+
}
|
|
1786
1952
|
}
|
|
1787
1953
|
}
|
|
1954
|
+
swiper.__preventObserver__ = true;
|
|
1955
|
+
requestAnimationFrame(() => {
|
|
1956
|
+
swiper.__preventObserver__ = false;
|
|
1957
|
+
});
|
|
1788
1958
|
if (isPrev) {
|
|
1789
1959
|
prependSlidesIndexes.forEach(index => {
|
|
1790
|
-
|
|
1791
|
-
slidesEl.prepend(
|
|
1792
|
-
|
|
1960
|
+
slides[index].swiperLoopMoveDOM = true;
|
|
1961
|
+
slidesEl.prepend(slides[index]);
|
|
1962
|
+
slides[index].swiperLoopMoveDOM = false;
|
|
1793
1963
|
});
|
|
1794
1964
|
}
|
|
1795
1965
|
if (isNext) {
|
|
1796
1966
|
appendSlidesIndexes.forEach(index => {
|
|
1797
|
-
|
|
1798
|
-
slidesEl.append(
|
|
1799
|
-
|
|
1967
|
+
slides[index].swiperLoopMoveDOM = true;
|
|
1968
|
+
slidesEl.append(slides[index]);
|
|
1969
|
+
slides[index].swiperLoopMoveDOM = false;
|
|
1800
1970
|
});
|
|
1801
1971
|
}
|
|
1802
1972
|
swiper.recalcSlides();
|
|
1803
1973
|
if (params.slidesPerView === 'auto') {
|
|
1804
1974
|
swiper.updateSlides();
|
|
1975
|
+
} else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
|
|
1976
|
+
swiper.slides.forEach((slide, slideIndex) => {
|
|
1977
|
+
swiper.grid.updateSlide(slideIndex, slide, swiper.slides);
|
|
1978
|
+
});
|
|
1805
1979
|
}
|
|
1806
1980
|
if (params.watchSlidesProgress) {
|
|
1807
1981
|
swiper.updateSlidesOffset();
|
|
@@ -1817,13 +1991,14 @@ function loopFix(_temp) {
|
|
|
1817
1991
|
} else {
|
|
1818
1992
|
swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);
|
|
1819
1993
|
if (setTranslate) {
|
|
1820
|
-
swiper.
|
|
1821
|
-
swiper.touchEventsData.currentTranslate = swiper.
|
|
1994
|
+
swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
|
|
1995
|
+
swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
|
|
1822
1996
|
}
|
|
1823
1997
|
}
|
|
1824
1998
|
} else {
|
|
1825
1999
|
if (setTranslate) {
|
|
1826
|
-
|
|
2000
|
+
const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;
|
|
2001
|
+
swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
|
|
1827
2002
|
swiper.touchEventsData.currentTranslate = swiper.translate;
|
|
1828
2003
|
}
|
|
1829
2004
|
}
|
|
@@ -1837,12 +2012,13 @@ function loopFix(_temp) {
|
|
|
1837
2012
|
} else {
|
|
1838
2013
|
swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
|
|
1839
2014
|
if (setTranslate) {
|
|
1840
|
-
swiper.
|
|
1841
|
-
swiper.touchEventsData.currentTranslate = swiper.
|
|
2015
|
+
swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
|
|
2016
|
+
swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
|
|
1842
2017
|
}
|
|
1843
2018
|
}
|
|
1844
2019
|
} else {
|
|
1845
|
-
|
|
2020
|
+
const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;
|
|
2021
|
+
swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
|
|
1846
2022
|
}
|
|
1847
2023
|
}
|
|
1848
2024
|
}
|
|
@@ -1955,27 +2131,54 @@ function closestElement(selector, base) {
|
|
|
1955
2131
|
}
|
|
1956
2132
|
return __closestFrom(base);
|
|
1957
2133
|
}
|
|
2134
|
+
function preventEdgeSwipe(swiper, event, startX) {
|
|
2135
|
+
const window = getWindow();
|
|
2136
|
+
const {
|
|
2137
|
+
params
|
|
2138
|
+
} = swiper;
|
|
2139
|
+
const edgeSwipeDetection = params.edgeSwipeDetection;
|
|
2140
|
+
const edgeSwipeThreshold = params.edgeSwipeThreshold;
|
|
2141
|
+
if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
|
|
2142
|
+
if (edgeSwipeDetection === 'prevent') {
|
|
2143
|
+
event.preventDefault();
|
|
2144
|
+
return true;
|
|
2145
|
+
}
|
|
2146
|
+
return false;
|
|
2147
|
+
}
|
|
2148
|
+
return true;
|
|
2149
|
+
}
|
|
1958
2150
|
function onTouchStart(event) {
|
|
1959
2151
|
const swiper = this;
|
|
1960
2152
|
const document = getDocument();
|
|
1961
|
-
|
|
2153
|
+
let e = event;
|
|
2154
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
1962
2155
|
const data = swiper.touchEventsData;
|
|
1963
|
-
|
|
2156
|
+
if (e.type === 'pointerdown') {
|
|
2157
|
+
if (data.pointerId !== null && data.pointerId !== e.pointerId) {
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
data.pointerId = e.pointerId;
|
|
2161
|
+
} else if (e.type === 'touchstart' && e.targetTouches.length === 1) {
|
|
2162
|
+
data.touchId = e.targetTouches[0].identifier;
|
|
2163
|
+
}
|
|
2164
|
+
if (e.type === 'touchstart') {
|
|
2165
|
+
// don't proceed touch event
|
|
2166
|
+
preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
1964
2169
|
const {
|
|
1965
2170
|
params,
|
|
1966
2171
|
touches,
|
|
1967
2172
|
enabled
|
|
1968
2173
|
} = swiper;
|
|
1969
2174
|
if (!enabled) return;
|
|
1970
|
-
if (!params.simulateTouch &&
|
|
2175
|
+
if (!params.simulateTouch && e.pointerType === 'mouse') return;
|
|
1971
2176
|
if (swiper.animating && params.preventInteractionOnTransition) {
|
|
1972
2177
|
return;
|
|
1973
2178
|
}
|
|
1974
2179
|
if (!swiper.animating && params.cssMode && params.loop) {
|
|
1975
2180
|
swiper.loopFix();
|
|
1976
2181
|
}
|
|
1977
|
-
let e = event;
|
|
1978
|
-
if (e.originalEvent) e = e.originalEvent;
|
|
1979
2182
|
let targetEl = e.target;
|
|
1980
2183
|
if (params.touchEventsTarget === 'wrapper') {
|
|
1981
2184
|
if (!swiper.wrapperEl.contains(targetEl)) return;
|
|
@@ -1987,7 +2190,7 @@ function onTouchStart(event) {
|
|
|
1987
2190
|
// change target el for shadow root component
|
|
1988
2191
|
const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
|
|
1989
2192
|
// eslint-disable-next-line
|
|
1990
|
-
const eventPath =
|
|
2193
|
+
const eventPath = e.composedPath ? e.composedPath() : e.path;
|
|
1991
2194
|
if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
|
|
1992
2195
|
targetEl = eventPath[0];
|
|
1993
2196
|
}
|
|
@@ -2009,14 +2212,8 @@ function onTouchStart(event) {
|
|
|
2009
2212
|
|
|
2010
2213
|
// Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
|
|
2011
2214
|
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
|
|
2015
|
-
if (edgeSwipeDetection === 'prevent') {
|
|
2016
|
-
event.preventDefault();
|
|
2017
|
-
} else {
|
|
2018
|
-
return;
|
|
2019
|
-
}
|
|
2215
|
+
if (!preventEdgeSwipe(swiper, e, startX)) {
|
|
2216
|
+
return;
|
|
2020
2217
|
}
|
|
2021
2218
|
Object.assign(data, {
|
|
2022
2219
|
isTouched: true,
|
|
@@ -2066,15 +2263,24 @@ function onTouchMove(event) {
|
|
|
2066
2263
|
if (!params.simulateTouch && event.pointerType === 'mouse') return;
|
|
2067
2264
|
let e = event;
|
|
2068
2265
|
if (e.originalEvent) e = e.originalEvent;
|
|
2266
|
+
if (e.type === 'pointermove') {
|
|
2267
|
+
if (data.touchId !== null) return; // return from pointer if we use touch
|
|
2268
|
+
const id = e.pointerId;
|
|
2269
|
+
if (id !== data.pointerId) return;
|
|
2270
|
+
}
|
|
2271
|
+
let targetTouch;
|
|
2272
|
+
if (e.type === 'touchmove') {
|
|
2273
|
+
targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
|
|
2274
|
+
if (!targetTouch || targetTouch.identifier !== data.touchId) return;
|
|
2275
|
+
} else {
|
|
2276
|
+
targetTouch = e;
|
|
2277
|
+
}
|
|
2069
2278
|
if (!data.isTouched) {
|
|
2070
2279
|
if (data.startMoving && data.isScrolling) {
|
|
2071
2280
|
swiper.emit('touchMoveOpposite', e);
|
|
2072
2281
|
}
|
|
2073
2282
|
return;
|
|
2074
2283
|
}
|
|
2075
|
-
const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
|
|
2076
|
-
if (pointerIndex >= 0) data.evCache[pointerIndex] = e;
|
|
2077
|
-
const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;
|
|
2078
2284
|
const pageX = targetTouch.pageX;
|
|
2079
2285
|
const pageY = targetTouch.pageY;
|
|
2080
2286
|
if (e.preventedByNestedSwiper) {
|
|
@@ -2090,8 +2296,6 @@ function onTouchMove(event) {
|
|
|
2090
2296
|
Object.assign(touches, {
|
|
2091
2297
|
startX: pageX,
|
|
2092
2298
|
startY: pageY,
|
|
2093
|
-
prevX: swiper.touches.currentX,
|
|
2094
|
-
prevY: swiper.touches.currentY,
|
|
2095
2299
|
currentX: pageX,
|
|
2096
2300
|
currentY: pageY
|
|
2097
2301
|
});
|
|
@@ -2121,7 +2325,8 @@ function onTouchMove(event) {
|
|
|
2121
2325
|
if (data.allowTouchCallbacks) {
|
|
2122
2326
|
swiper.emit('touchMove', e);
|
|
2123
2327
|
}
|
|
2124
|
-
|
|
2328
|
+
touches.previousX = touches.currentX;
|
|
2329
|
+
touches.previousY = touches.currentY;
|
|
2125
2330
|
touches.currentX = pageX;
|
|
2126
2331
|
touches.currentY = pageY;
|
|
2127
2332
|
const diffX = touches.currentX - touches.startX;
|
|
@@ -2147,7 +2352,7 @@ function onTouchMove(event) {
|
|
|
2147
2352
|
data.startMoving = true;
|
|
2148
2353
|
}
|
|
2149
2354
|
}
|
|
2150
|
-
if (data.isScrolling
|
|
2355
|
+
if (data.isScrolling) {
|
|
2151
2356
|
data.isTouched = false;
|
|
2152
2357
|
return;
|
|
2153
2358
|
}
|
|
@@ -2177,8 +2382,9 @@ function onTouchMove(event) {
|
|
|
2177
2382
|
swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
|
|
2178
2383
|
swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
|
|
2179
2384
|
const isLoop = swiper.params.loop && !params.cssMode;
|
|
2385
|
+
const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev;
|
|
2180
2386
|
if (!data.isMoved) {
|
|
2181
|
-
if (isLoop) {
|
|
2387
|
+
if (isLoop && allowLoopFix) {
|
|
2182
2388
|
swiper.loopFix({
|
|
2183
2389
|
direction: swiper.swipeDirection
|
|
2184
2390
|
});
|
|
@@ -2200,13 +2406,18 @@ function onTouchMove(event) {
|
|
|
2200
2406
|
swiper.emit('sliderFirstMove', e);
|
|
2201
2407
|
}
|
|
2202
2408
|
let loopFixed;
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2409
|
+
new Date().getTime();
|
|
2410
|
+
if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
|
|
2411
|
+
Object.assign(touches, {
|
|
2412
|
+
startX: pageX,
|
|
2413
|
+
startY: pageY,
|
|
2414
|
+
currentX: pageX,
|
|
2415
|
+
currentY: pageY,
|
|
2416
|
+
startTranslate: data.currentTranslate
|
|
2208
2417
|
});
|
|
2209
|
-
|
|
2418
|
+
data.loopSwapReset = true;
|
|
2419
|
+
data.startTranslate = data.currentTranslate;
|
|
2420
|
+
return;
|
|
2210
2421
|
}
|
|
2211
2422
|
swiper.emit('sliderMove', e);
|
|
2212
2423
|
data.isMoved = true;
|
|
@@ -2217,7 +2428,7 @@ function onTouchMove(event) {
|
|
|
2217
2428
|
resistanceRatio = 0;
|
|
2218
2429
|
}
|
|
2219
2430
|
if (diff > 0) {
|
|
2220
|
-
if (isLoop && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.
|
|
2431
|
+
if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] : swiper.minTranslate())) {
|
|
2221
2432
|
swiper.loopFix({
|
|
2222
2433
|
direction: 'prev',
|
|
2223
2434
|
setTranslate: true,
|
|
@@ -2231,7 +2442,7 @@ function onTouchMove(event) {
|
|
|
2231
2442
|
}
|
|
2232
2443
|
}
|
|
2233
2444
|
} else if (diff < 0) {
|
|
2234
|
-
if (isLoop && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.
|
|
2445
|
+
if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] : swiper.maxTranslate())) {
|
|
2235
2446
|
swiper.loopFix({
|
|
2236
2447
|
direction: 'next',
|
|
2237
2448
|
setTranslate: true,
|
|
@@ -2295,16 +2506,26 @@ function onTouchMove(event) {
|
|
|
2295
2506
|
function onTouchEnd(event) {
|
|
2296
2507
|
const swiper = this;
|
|
2297
2508
|
const data = swiper.touchEventsData;
|
|
2298
|
-
|
|
2299
|
-
if (
|
|
2300
|
-
|
|
2509
|
+
let e = event;
|
|
2510
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
2511
|
+
let targetTouch;
|
|
2512
|
+
const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';
|
|
2513
|
+
if (!isTouchEvent) {
|
|
2514
|
+
if (data.touchId !== null) return; // return from pointer if we use touch
|
|
2515
|
+
if (e.pointerId !== data.pointerId) return;
|
|
2516
|
+
targetTouch = e;
|
|
2517
|
+
} else {
|
|
2518
|
+
targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
|
|
2519
|
+
if (!targetTouch || targetTouch.identifier !== data.touchId) return;
|
|
2301
2520
|
}
|
|
2302
|
-
if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(
|
|
2303
|
-
const proceed = ['pointercancel', 'contextmenu'].includes(
|
|
2521
|
+
if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {
|
|
2522
|
+
const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
|
|
2304
2523
|
if (!proceed) {
|
|
2305
2524
|
return;
|
|
2306
2525
|
}
|
|
2307
2526
|
}
|
|
2527
|
+
data.pointerId = null;
|
|
2528
|
+
data.touchId = null;
|
|
2308
2529
|
const {
|
|
2309
2530
|
params,
|
|
2310
2531
|
touches,
|
|
@@ -2313,9 +2534,7 @@ function onTouchEnd(event) {
|
|
|
2313
2534
|
enabled
|
|
2314
2535
|
} = swiper;
|
|
2315
2536
|
if (!enabled) return;
|
|
2316
|
-
if (!params.simulateTouch &&
|
|
2317
|
-
let e = event;
|
|
2318
|
-
if (e.originalEvent) e = e.originalEvent;
|
|
2537
|
+
if (!params.simulateTouch && e.pointerType === 'mouse') return;
|
|
2319
2538
|
if (data.allowTouchCallbacks) {
|
|
2320
2539
|
swiper.emit('touchEnd', e);
|
|
2321
2540
|
}
|
|
@@ -2328,6 +2547,7 @@ function onTouchEnd(event) {
|
|
|
2328
2547
|
data.startMoving = false;
|
|
2329
2548
|
return;
|
|
2330
2549
|
}
|
|
2550
|
+
|
|
2331
2551
|
// Return Grab Cursor
|
|
2332
2552
|
if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
|
2333
2553
|
swiper.setGrabCursor(false);
|
|
@@ -2340,7 +2560,7 @@ function onTouchEnd(event) {
|
|
|
2340
2560
|
// Tap, doubleTap, Click
|
|
2341
2561
|
if (swiper.allowClick) {
|
|
2342
2562
|
const pathTree = e.path || e.composedPath && e.composedPath();
|
|
2343
|
-
swiper.updateClickedSlide(pathTree && pathTree[0] || e.target);
|
|
2563
|
+
swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree);
|
|
2344
2564
|
swiper.emit('tap click', e);
|
|
2345
2565
|
if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
|
|
2346
2566
|
swiper.emit('doubleTap doubleClick', e);
|
|
@@ -2350,7 +2570,7 @@ function onTouchEnd(event) {
|
|
|
2350
2570
|
nextTick(() => {
|
|
2351
2571
|
if (!swiper.destroyed) swiper.allowClick = true;
|
|
2352
2572
|
});
|
|
2353
|
-
if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
|
|
2573
|
+
if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {
|
|
2354
2574
|
data.isTouched = false;
|
|
2355
2575
|
data.isMoved = false;
|
|
2356
2576
|
data.startMoving = false;
|
|
@@ -2547,8 +2767,15 @@ function onLoad(e) {
|
|
|
2547
2767
|
swiper.update();
|
|
2548
2768
|
}
|
|
2549
2769
|
|
|
2550
|
-
|
|
2551
|
-
|
|
2770
|
+
function onDocumentTouchStart() {
|
|
2771
|
+
const swiper = this;
|
|
2772
|
+
if (swiper.documentTouchHandlerProceeded) return;
|
|
2773
|
+
swiper.documentTouchHandlerProceeded = true;
|
|
2774
|
+
if (swiper.params.touchReleaseOnEdges) {
|
|
2775
|
+
swiper.el.style.touchAction = 'auto';
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2552
2779
|
const events = (swiper, method) => {
|
|
2553
2780
|
const document = getDocument();
|
|
2554
2781
|
const {
|
|
@@ -2562,19 +2789,36 @@ const events = (swiper, method) => {
|
|
|
2562
2789
|
const swiperMethod = method;
|
|
2563
2790
|
|
|
2564
2791
|
// Touch Events
|
|
2792
|
+
document[domMethod]('touchstart', swiper.onDocumentTouchStart, {
|
|
2793
|
+
passive: false,
|
|
2794
|
+
capture
|
|
2795
|
+
});
|
|
2796
|
+
el[domMethod]('touchstart', swiper.onTouchStart, {
|
|
2797
|
+
passive: false
|
|
2798
|
+
});
|
|
2565
2799
|
el[domMethod]('pointerdown', swiper.onTouchStart, {
|
|
2566
2800
|
passive: false
|
|
2567
2801
|
});
|
|
2802
|
+
document[domMethod]('touchmove', swiper.onTouchMove, {
|
|
2803
|
+
passive: false,
|
|
2804
|
+
capture
|
|
2805
|
+
});
|
|
2568
2806
|
document[domMethod]('pointermove', swiper.onTouchMove, {
|
|
2569
2807
|
passive: false,
|
|
2570
2808
|
capture
|
|
2571
2809
|
});
|
|
2810
|
+
document[domMethod]('touchend', swiper.onTouchEnd, {
|
|
2811
|
+
passive: true
|
|
2812
|
+
});
|
|
2572
2813
|
document[domMethod]('pointerup', swiper.onTouchEnd, {
|
|
2573
2814
|
passive: true
|
|
2574
2815
|
});
|
|
2575
2816
|
document[domMethod]('pointercancel', swiper.onTouchEnd, {
|
|
2576
2817
|
passive: true
|
|
2577
2818
|
});
|
|
2819
|
+
document[domMethod]('touchcancel', swiper.onTouchEnd, {
|
|
2820
|
+
passive: true
|
|
2821
|
+
});
|
|
2578
2822
|
document[domMethod]('pointerout', swiper.onTouchEnd, {
|
|
2579
2823
|
passive: true
|
|
2580
2824
|
});
|
|
@@ -2607,22 +2851,18 @@ const events = (swiper, method) => {
|
|
|
2607
2851
|
};
|
|
2608
2852
|
function attachEvents() {
|
|
2609
2853
|
const swiper = this;
|
|
2610
|
-
const document = getDocument();
|
|
2611
2854
|
const {
|
|
2612
2855
|
params
|
|
2613
2856
|
} = swiper;
|
|
2614
2857
|
swiper.onTouchStart = onTouchStart.bind(swiper);
|
|
2615
2858
|
swiper.onTouchMove = onTouchMove.bind(swiper);
|
|
2616
2859
|
swiper.onTouchEnd = onTouchEnd.bind(swiper);
|
|
2860
|
+
swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);
|
|
2617
2861
|
if (params.cssMode) {
|
|
2618
2862
|
swiper.onScroll = onScroll.bind(swiper);
|
|
2619
2863
|
}
|
|
2620
2864
|
swiper.onClick = onClick.bind(swiper);
|
|
2621
2865
|
swiper.onLoad = onLoad.bind(swiper);
|
|
2622
|
-
if (!dummyEventAttached) {
|
|
2623
|
-
document.addEventListener('touchstart', dummyEventListener);
|
|
2624
|
-
dummyEventAttached = true;
|
|
2625
|
-
}
|
|
2626
2866
|
events(swiper, 'on');
|
|
2627
2867
|
}
|
|
2628
2868
|
function detachEvents() {
|
|
@@ -2681,11 +2921,13 @@ function setBreakpoint() {
|
|
|
2681
2921
|
});
|
|
2682
2922
|
const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
|
|
2683
2923
|
const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
|
|
2924
|
+
const wasLoop = params.loop;
|
|
2684
2925
|
if (directionChanged && initialized) {
|
|
2685
2926
|
swiper.changeDirection();
|
|
2686
2927
|
}
|
|
2687
2928
|
extend(swiper.params, breakpointParams);
|
|
2688
2929
|
const isEnabled = swiper.params.enabled;
|
|
2930
|
+
const hasLoop = swiper.params.loop;
|
|
2689
2931
|
Object.assign(swiper, {
|
|
2690
2932
|
allowTouchMove: swiper.params.allowTouchMove,
|
|
2691
2933
|
allowSlideNext: swiper.params.allowSlideNext,
|
|
@@ -2698,10 +2940,17 @@ function setBreakpoint() {
|
|
|
2698
2940
|
}
|
|
2699
2941
|
swiper.currentBreakpoint = breakpoint;
|
|
2700
2942
|
swiper.emit('_beforeBreakpoint', breakpointParams);
|
|
2701
|
-
if (
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2943
|
+
if (initialized) {
|
|
2944
|
+
if (needsReLoop) {
|
|
2945
|
+
swiper.loopDestroy();
|
|
2946
|
+
swiper.loopCreate(realIndex);
|
|
2947
|
+
swiper.updateSlides();
|
|
2948
|
+
} else if (!wasLoop && hasLoop) {
|
|
2949
|
+
swiper.loopCreate(realIndex);
|
|
2950
|
+
swiper.updateSlides();
|
|
2951
|
+
} else if (wasLoop && !hasLoop) {
|
|
2952
|
+
swiper.loopDestroy();
|
|
2953
|
+
}
|
|
2705
2954
|
}
|
|
2706
2955
|
swiper.emit('breakpoint', breakpointParams);
|
|
2707
2956
|
}
|
|
@@ -2861,6 +3110,7 @@ var defaults = {
|
|
|
2861
3110
|
resizeObserver: true,
|
|
2862
3111
|
nested: false,
|
|
2863
3112
|
createElements: false,
|
|
3113
|
+
eventsPrefix: 'swiper',
|
|
2864
3114
|
enabled: true,
|
|
2865
3115
|
focusableElements: 'input, select, option, textarea, button, video, label',
|
|
2866
3116
|
// Overrides
|
|
@@ -2935,7 +3185,8 @@ var defaults = {
|
|
|
2935
3185
|
slideToClickedSlide: false,
|
|
2936
3186
|
// loop
|
|
2937
3187
|
loop: false,
|
|
2938
|
-
|
|
3188
|
+
loopAddBlankSlides: true,
|
|
3189
|
+
loopAdditionalSlides: 0,
|
|
2939
3190
|
loopPreventsSliding: true,
|
|
2940
3191
|
// rewind
|
|
2941
3192
|
rewind: false,
|
|
@@ -2954,8 +3205,10 @@ var defaults = {
|
|
|
2954
3205
|
containerModifierClass: 'swiper-',
|
|
2955
3206
|
// NEW
|
|
2956
3207
|
slideClass: 'swiper-slide',
|
|
3208
|
+
slideBlankClass: 'swiper-slide-blank',
|
|
2957
3209
|
slideActiveClass: 'swiper-slide-active',
|
|
2958
3210
|
slideVisibleClass: 'swiper-slide-visible',
|
|
3211
|
+
slideFullyVisibleClass: 'swiper-slide-fully-visible',
|
|
2959
3212
|
slideNextClass: 'swiper-slide-next',
|
|
2960
3213
|
slidePrevClass: 'swiper-slide-prev',
|
|
2961
3214
|
wrapperClass: 'swiper-wrapper',
|
|
@@ -2978,20 +3231,21 @@ function moduleExtendParams(params, allModulesParams) {
|
|
|
2978
3231
|
extend(allModulesParams, obj);
|
|
2979
3232
|
return;
|
|
2980
3233
|
}
|
|
2981
|
-
if (
|
|
3234
|
+
if (params[moduleParamName] === true) {
|
|
2982
3235
|
params[moduleParamName] = {
|
|
2983
|
-
|
|
3236
|
+
enabled: true
|
|
2984
3237
|
};
|
|
2985
3238
|
}
|
|
3239
|
+
if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) {
|
|
3240
|
+
params[moduleParamName].auto = true;
|
|
3241
|
+
}
|
|
3242
|
+
if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) {
|
|
3243
|
+
params[moduleParamName].auto = true;
|
|
3244
|
+
}
|
|
2986
3245
|
if (!(moduleParamName in params && 'enabled' in moduleParams)) {
|
|
2987
3246
|
extend(allModulesParams, obj);
|
|
2988
3247
|
return;
|
|
2989
3248
|
}
|
|
2990
|
-
if (params[moduleParamName] === true) {
|
|
2991
|
-
params[moduleParamName] = {
|
|
2992
|
-
enabled: true
|
|
2993
|
-
};
|
|
2994
|
-
}
|
|
2995
3249
|
if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
|
|
2996
3250
|
params[moduleParamName].enabled = true;
|
|
2997
3251
|
}
|
|
@@ -3147,7 +3401,8 @@ class Swiper {
|
|
|
3147
3401
|
velocities: [],
|
|
3148
3402
|
allowMomentumBounce: undefined,
|
|
3149
3403
|
startMoving: undefined,
|
|
3150
|
-
|
|
3404
|
+
pointerId: null,
|
|
3405
|
+
touchId: null
|
|
3151
3406
|
},
|
|
3152
3407
|
// Clicks
|
|
3153
3408
|
allowClick: true,
|
|
@@ -3175,6 +3430,22 @@ class Swiper {
|
|
|
3175
3430
|
// eslint-disable-next-line no-constructor-return
|
|
3176
3431
|
return swiper;
|
|
3177
3432
|
}
|
|
3433
|
+
getDirectionLabel(property) {
|
|
3434
|
+
if (this.isHorizontal()) {
|
|
3435
|
+
return property;
|
|
3436
|
+
}
|
|
3437
|
+
// prettier-ignore
|
|
3438
|
+
return {
|
|
3439
|
+
'width': 'height',
|
|
3440
|
+
'margin-top': 'margin-left',
|
|
3441
|
+
'margin-bottom ': 'margin-right',
|
|
3442
|
+
'margin-left': 'margin-top',
|
|
3443
|
+
'margin-right': 'margin-bottom',
|
|
3444
|
+
'padding-left': 'padding-top',
|
|
3445
|
+
'padding-right': 'padding-bottom',
|
|
3446
|
+
'marginRight': 'marginBottom'
|
|
3447
|
+
}[property];
|
|
3448
|
+
}
|
|
3178
3449
|
getSlideIndex(slideEl) {
|
|
3179
3450
|
const {
|
|
3180
3451
|
slidesEl,
|
|
@@ -3269,6 +3540,7 @@ class Swiper {
|
|
|
3269
3540
|
activeIndex
|
|
3270
3541
|
} = swiper;
|
|
3271
3542
|
let spv = 1;
|
|
3543
|
+
if (typeof params.slidesPerView === 'number') return params.slidesPerView;
|
|
3272
3544
|
if (params.centeredSlides) {
|
|
3273
3545
|
let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0;
|
|
3274
3546
|
let breakLoop;
|
|
@@ -3551,7 +3823,7 @@ class Swiper {
|
|
|
3551
3823
|
wrapperEl.removeAttribute('style');
|
|
3552
3824
|
if (slides && slides.length) {
|
|
3553
3825
|
slides.forEach(slideEl => {
|
|
3554
|
-
slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
3826
|
+
slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
3555
3827
|
slideEl.removeAttribute('style');
|
|
3556
3828
|
slideEl.removeAttribute('data-swiper-slide-index');
|
|
3557
3829
|
});
|