@content-blocks/js 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/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 +11 -11
- 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,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const contentCarousel_entry = require('./content-carousel-
|
|
4
|
-
require('./index-
|
|
3
|
+
const contentCarousel_entry = require('./content-carousel-d866cb77.js');
|
|
4
|
+
require('./index-239b1c46.js');
|
|
5
5
|
require('./BehaviorSubject-771fd78b.js');
|
|
6
6
|
|
|
7
7
|
let support;
|
|
@@ -380,24 +380,8 @@ function updateSize() {
|
|
|
380
380
|
|
|
381
381
|
function updateSlides() {
|
|
382
382
|
const swiper = this;
|
|
383
|
-
function getDirectionLabel(property) {
|
|
384
|
-
if (swiper.isHorizontal()) {
|
|
385
|
-
return property;
|
|
386
|
-
}
|
|
387
|
-
// prettier-ignore
|
|
388
|
-
return {
|
|
389
|
-
'width': 'height',
|
|
390
|
-
'margin-top': 'margin-left',
|
|
391
|
-
'margin-bottom ': 'margin-right',
|
|
392
|
-
'margin-left': 'margin-top',
|
|
393
|
-
'margin-right': 'margin-bottom',
|
|
394
|
-
'padding-left': 'padding-top',
|
|
395
|
-
'padding-right': 'padding-bottom',
|
|
396
|
-
'marginRight': 'marginBottom'
|
|
397
|
-
}[property];
|
|
398
|
-
}
|
|
399
383
|
function getDirectionPropertyValue(node, label) {
|
|
400
|
-
return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
|
|
384
|
+
return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
|
|
401
385
|
}
|
|
402
386
|
const params = swiper.params;
|
|
403
387
|
const {
|
|
@@ -456,7 +440,9 @@ function updateSlides() {
|
|
|
456
440
|
}
|
|
457
441
|
const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
|
|
458
442
|
if (gridEnabled) {
|
|
459
|
-
swiper.grid.initSlides(
|
|
443
|
+
swiper.grid.initSlides(slides);
|
|
444
|
+
} else if (swiper.grid) {
|
|
445
|
+
swiper.grid.unsetSlides();
|
|
460
446
|
}
|
|
461
447
|
|
|
462
448
|
// Calc slides
|
|
@@ -469,13 +455,13 @@ function updateSlides() {
|
|
|
469
455
|
let slide;
|
|
470
456
|
if (slides[i]) slide = slides[i];
|
|
471
457
|
if (gridEnabled) {
|
|
472
|
-
swiper.grid.updateSlide(i, slide,
|
|
458
|
+
swiper.grid.updateSlide(i, slide, slides);
|
|
473
459
|
}
|
|
474
460
|
if (slides[i] && contentCarousel_entry.elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
|
|
475
461
|
|
|
476
462
|
if (params.slidesPerView === 'auto') {
|
|
477
463
|
if (shouldResetSlideSize) {
|
|
478
|
-
slides[i].style[getDirectionLabel('width')] = ``;
|
|
464
|
+
slides[i].style[swiper.getDirectionLabel('width')] = ``;
|
|
479
465
|
}
|
|
480
466
|
const slideStyles = getComputedStyle(slide);
|
|
481
467
|
const currentTransform = slide.style.transform;
|
|
@@ -517,7 +503,7 @@ function updateSlides() {
|
|
|
517
503
|
slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
|
|
518
504
|
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
|
519
505
|
if (slides[i]) {
|
|
520
|
-
slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
|
|
506
|
+
slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
|
|
521
507
|
}
|
|
522
508
|
}
|
|
523
509
|
if (slides[i]) {
|
|
@@ -547,10 +533,10 @@ function updateSlides() {
|
|
|
547
533
|
wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
|
|
548
534
|
}
|
|
549
535
|
if (params.setWrapperSize) {
|
|
550
|
-
wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
|
|
536
|
+
wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
|
|
551
537
|
}
|
|
552
538
|
if (gridEnabled) {
|
|
553
|
-
swiper.grid.updateWrapperSize(slideSize, snapGrid
|
|
539
|
+
swiper.grid.updateWrapperSize(slideSize, snapGrid);
|
|
554
540
|
}
|
|
555
541
|
|
|
556
542
|
// Remove last grid elements depending on width
|
|
@@ -587,7 +573,7 @@ function updateSlides() {
|
|
|
587
573
|
}
|
|
588
574
|
if (snapGrid.length === 0) snapGrid = [0];
|
|
589
575
|
if (spaceBetween !== 0) {
|
|
590
|
-
const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
|
|
576
|
+
const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');
|
|
591
577
|
slides.filter((_, slideIndex) => {
|
|
592
578
|
if (!params.cssMode || params.loop) return true;
|
|
593
579
|
if (slideIndex === slides.length - 1) {
|
|
@@ -739,7 +725,7 @@ function updateSlidesProgress(translate) {
|
|
|
739
725
|
|
|
740
726
|
// Visible Slides
|
|
741
727
|
slides.forEach(slideEl => {
|
|
742
|
-
slideEl.classList.remove(params.slideVisibleClass);
|
|
728
|
+
slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass);
|
|
743
729
|
});
|
|
744
730
|
swiper.visibleSlidesIndexes = [];
|
|
745
731
|
swiper.visibleSlides = [];
|
|
@@ -759,12 +745,16 @@ function updateSlidesProgress(translate) {
|
|
|
759
745
|
const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
|
|
760
746
|
const slideBefore = -(offsetCenter - slideOffset);
|
|
761
747
|
const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
|
|
748
|
+
const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];
|
|
762
749
|
const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
|
|
763
750
|
if (isVisible) {
|
|
764
751
|
swiper.visibleSlides.push(slide);
|
|
765
752
|
swiper.visibleSlidesIndexes.push(i);
|
|
766
753
|
slides[i].classList.add(params.slideVisibleClass);
|
|
767
754
|
}
|
|
755
|
+
if (isFullyVisible) {
|
|
756
|
+
slides[i].classList.add(params.slideFullyVisibleClass);
|
|
757
|
+
}
|
|
768
758
|
slide.progress = rtl ? -slideProgress : slideProgress;
|
|
769
759
|
slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
|
|
770
760
|
}
|
|
@@ -842,6 +832,7 @@ function updateSlidesClasses() {
|
|
|
842
832
|
activeIndex
|
|
843
833
|
} = swiper;
|
|
844
834
|
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
835
|
+
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
845
836
|
const getFilteredSlide = selector => {
|
|
846
837
|
return contentCarousel_entry.elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
|
|
847
838
|
};
|
|
@@ -849,6 +840,8 @@ function updateSlidesClasses() {
|
|
|
849
840
|
slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
850
841
|
});
|
|
851
842
|
let activeSlide;
|
|
843
|
+
let prevSlide;
|
|
844
|
+
let nextSlide;
|
|
852
845
|
if (isVirtual) {
|
|
853
846
|
if (params.loop) {
|
|
854
847
|
let slideIndex = activeIndex - swiper.virtual.slidesBefore;
|
|
@@ -859,27 +852,42 @@ function updateSlidesClasses() {
|
|
|
859
852
|
activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
|
|
860
853
|
}
|
|
861
854
|
} else {
|
|
862
|
-
|
|
855
|
+
if (gridEnabled) {
|
|
856
|
+
activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0];
|
|
857
|
+
nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0];
|
|
858
|
+
prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0];
|
|
859
|
+
} else {
|
|
860
|
+
activeSlide = slides[activeIndex];
|
|
861
|
+
}
|
|
863
862
|
}
|
|
864
863
|
if (activeSlide) {
|
|
865
864
|
// Active classes
|
|
866
865
|
activeSlide.classList.add(params.slideActiveClass);
|
|
866
|
+
if (gridEnabled) {
|
|
867
|
+
if (nextSlide) {
|
|
868
|
+
nextSlide.classList.add(params.slideNextClass);
|
|
869
|
+
}
|
|
870
|
+
if (prevSlide) {
|
|
871
|
+
prevSlide.classList.add(params.slidePrevClass);
|
|
872
|
+
}
|
|
873
|
+
} else {
|
|
874
|
+
// Next Slide
|
|
875
|
+
nextSlide = contentCarousel_entry.elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
876
|
+
if (params.loop && !nextSlide) {
|
|
877
|
+
nextSlide = slides[0];
|
|
878
|
+
}
|
|
879
|
+
if (nextSlide) {
|
|
880
|
+
nextSlide.classList.add(params.slideNextClass);
|
|
881
|
+
}
|
|
867
882
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
// Prev Slide
|
|
877
|
-
let prevSlide = contentCarousel_entry.elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
878
|
-
if (params.loop && !prevSlide === 0) {
|
|
879
|
-
prevSlide = slides[slides.length - 1];
|
|
880
|
-
}
|
|
881
|
-
if (prevSlide) {
|
|
882
|
-
prevSlide.classList.add(params.slidePrevClass);
|
|
883
|
+
// Prev Slide
|
|
884
|
+
prevSlide = contentCarousel_entry.elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
885
|
+
if (params.loop && !prevSlide === 0) {
|
|
886
|
+
prevSlide = slides[slides.length - 1];
|
|
887
|
+
}
|
|
888
|
+
if (prevSlide) {
|
|
889
|
+
prevSlide.classList.add(params.slidePrevClass);
|
|
890
|
+
}
|
|
883
891
|
}
|
|
884
892
|
}
|
|
885
893
|
swiper.emitSlidesClasses();
|
|
@@ -892,7 +900,17 @@ const processLazyPreloader = (swiper, imageEl) => {
|
|
|
892
900
|
if (slideEl) {
|
|
893
901
|
let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);
|
|
894
902
|
if (!lazyEl && swiper.isElement) {
|
|
895
|
-
|
|
903
|
+
if (slideEl.shadowRoot) {
|
|
904
|
+
lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
|
|
905
|
+
} else {
|
|
906
|
+
// init later
|
|
907
|
+
requestAnimationFrame(() => {
|
|
908
|
+
if (slideEl.shadowRoot) {
|
|
909
|
+
lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
|
|
910
|
+
if (lazyEl) lazyEl.remove();
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
}
|
|
896
914
|
}
|
|
897
915
|
if (lazyEl) lazyEl.remove();
|
|
898
916
|
}
|
|
@@ -994,22 +1012,37 @@ function updateActiveIndex(newActiveIndex) {
|
|
|
994
1012
|
snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
|
|
995
1013
|
}
|
|
996
1014
|
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
|
997
|
-
if (activeIndex === previousIndex) {
|
|
1015
|
+
if (activeIndex === previousIndex && !swiper.params.loop) {
|
|
998
1016
|
if (snapIndex !== previousSnapIndex) {
|
|
999
1017
|
swiper.snapIndex = snapIndex;
|
|
1000
1018
|
swiper.emit('snapIndexChange');
|
|
1001
1019
|
}
|
|
1002
|
-
if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
|
|
1003
|
-
swiper.realIndex = getVirtualRealIndex(activeIndex);
|
|
1004
|
-
}
|
|
1005
1020
|
return;
|
|
1006
1021
|
}
|
|
1022
|
+
if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
|
|
1023
|
+
swiper.realIndex = getVirtualRealIndex(activeIndex);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
1027
|
+
|
|
1007
1028
|
// Get real index
|
|
1008
1029
|
let realIndex;
|
|
1009
1030
|
if (swiper.virtual && params.virtual.enabled && params.loop) {
|
|
1010
1031
|
realIndex = getVirtualRealIndex(activeIndex);
|
|
1032
|
+
} else if (gridEnabled) {
|
|
1033
|
+
const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0];
|
|
1034
|
+
let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
|
|
1035
|
+
if (Number.isNaN(activeSlideIndex)) {
|
|
1036
|
+
activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
|
|
1037
|
+
}
|
|
1038
|
+
realIndex = Math.floor(activeSlideIndex / params.grid.rows);
|
|
1011
1039
|
} else if (swiper.slides[activeIndex]) {
|
|
1012
|
-
|
|
1040
|
+
const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');
|
|
1041
|
+
if (slideIndex) {
|
|
1042
|
+
realIndex = parseInt(slideIndex, 10);
|
|
1043
|
+
} else {
|
|
1044
|
+
realIndex = activeIndex;
|
|
1045
|
+
}
|
|
1013
1046
|
} else {
|
|
1014
1047
|
realIndex = activeIndex;
|
|
1015
1048
|
}
|
|
@@ -1026,18 +1059,25 @@ function updateActiveIndex(newActiveIndex) {
|
|
|
1026
1059
|
}
|
|
1027
1060
|
swiper.emit('activeIndexChange');
|
|
1028
1061
|
swiper.emit('snapIndexChange');
|
|
1029
|
-
if (previousRealIndex !== realIndex) {
|
|
1030
|
-
swiper.emit('realIndexChange');
|
|
1031
|
-
}
|
|
1032
1062
|
if (swiper.initialized || swiper.params.runCallbacksOnInit) {
|
|
1063
|
+
if (previousRealIndex !== realIndex) {
|
|
1064
|
+
swiper.emit('realIndexChange');
|
|
1065
|
+
}
|
|
1033
1066
|
swiper.emit('slideChange');
|
|
1034
1067
|
}
|
|
1035
1068
|
}
|
|
1036
1069
|
|
|
1037
|
-
function updateClickedSlide(
|
|
1070
|
+
function updateClickedSlide(el, path) {
|
|
1038
1071
|
const swiper = this;
|
|
1039
1072
|
const params = swiper.params;
|
|
1040
|
-
|
|
1073
|
+
let slide = el.closest(`.${params.slideClass}, swiper-slide`);
|
|
1074
|
+
if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) {
|
|
1075
|
+
[...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => {
|
|
1076
|
+
if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) {
|
|
1077
|
+
slide = pathEl;
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1041
1081
|
let slideFound = false;
|
|
1042
1082
|
let slideIndex;
|
|
1043
1083
|
if (slide) {
|
|
@@ -1496,16 +1536,58 @@ function slideToLoop(index, speed, runCallbacks, internal) {
|
|
|
1496
1536
|
index = indexAsNumber;
|
|
1497
1537
|
}
|
|
1498
1538
|
const swiper = this;
|
|
1539
|
+
const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
|
|
1499
1540
|
let newIndex = index;
|
|
1500
1541
|
if (swiper.params.loop) {
|
|
1501
1542
|
if (swiper.virtual && swiper.params.virtual.enabled) {
|
|
1502
1543
|
// eslint-disable-next-line
|
|
1503
1544
|
newIndex = newIndex + swiper.virtual.slidesBefore;
|
|
1504
1545
|
} else {
|
|
1505
|
-
|
|
1546
|
+
let targetSlideIndex;
|
|
1547
|
+
if (gridEnabled) {
|
|
1548
|
+
const slideIndex = newIndex * swiper.params.grid.rows;
|
|
1549
|
+
targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
|
|
1550
|
+
} else {
|
|
1551
|
+
targetSlideIndex = swiper.getSlideIndexByData(newIndex);
|
|
1552
|
+
}
|
|
1553
|
+
const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
|
|
1554
|
+
const {
|
|
1555
|
+
centeredSlides
|
|
1556
|
+
} = swiper.params;
|
|
1557
|
+
let slidesPerView = swiper.params.slidesPerView;
|
|
1558
|
+
if (slidesPerView === 'auto') {
|
|
1559
|
+
slidesPerView = swiper.slidesPerViewDynamic();
|
|
1560
|
+
} else {
|
|
1561
|
+
slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
1562
|
+
if (centeredSlides && slidesPerView % 2 === 0) {
|
|
1563
|
+
slidesPerView = slidesPerView + 1;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
let needLoopFix = cols - targetSlideIndex < slidesPerView;
|
|
1567
|
+
if (centeredSlides) {
|
|
1568
|
+
needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
|
|
1569
|
+
}
|
|
1570
|
+
if (needLoopFix) {
|
|
1571
|
+
const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
|
|
1572
|
+
swiper.loopFix({
|
|
1573
|
+
direction,
|
|
1574
|
+
slideTo: true,
|
|
1575
|
+
activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
|
|
1576
|
+
slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
if (gridEnabled) {
|
|
1580
|
+
const slideIndex = newIndex * swiper.params.grid.rows;
|
|
1581
|
+
newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
|
|
1582
|
+
} else {
|
|
1583
|
+
newIndex = swiper.getSlideIndexByData(newIndex);
|
|
1584
|
+
}
|
|
1506
1585
|
}
|
|
1507
1586
|
}
|
|
1508
|
-
|
|
1587
|
+
requestAnimationFrame(() => {
|
|
1588
|
+
swiper.slideTo(newIndex, speed, runCallbacks, internal);
|
|
1589
|
+
});
|
|
1590
|
+
return swiper;
|
|
1509
1591
|
}
|
|
1510
1592
|
|
|
1511
1593
|
/* eslint no-unused-vars: "off" */
|
|
@@ -1536,6 +1618,12 @@ function slideNext(speed, runCallbacks, internal) {
|
|
|
1536
1618
|
});
|
|
1537
1619
|
// eslint-disable-next-line
|
|
1538
1620
|
swiper._clientLeft = swiper.wrapperEl.clientLeft;
|
|
1621
|
+
if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {
|
|
1622
|
+
requestAnimationFrame(() => {
|
|
1623
|
+
swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
|
|
1624
|
+
});
|
|
1625
|
+
return true;
|
|
1626
|
+
}
|
|
1539
1627
|
}
|
|
1540
1628
|
if (params.rewind && swiper.isEnd) {
|
|
1541
1629
|
return swiper.slideTo(0, speed, runCallbacks, internal);
|
|
@@ -1602,6 +1690,11 @@ function slidePrev(speed, runCallbacks, internal) {
|
|
|
1602
1690
|
if (params.rewind && swiper.isBeginning) {
|
|
1603
1691
|
const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
|
|
1604
1692
|
return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
|
|
1693
|
+
} else if (params.loop && swiper.activeIndex === 0 && params.cssMode) {
|
|
1694
|
+
requestAnimationFrame(() => {
|
|
1695
|
+
swiper.slideTo(prevIndex, speed, runCallbacks, internal);
|
|
1696
|
+
});
|
|
1697
|
+
return true;
|
|
1605
1698
|
}
|
|
1606
1699
|
return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
|
|
1607
1700
|
}
|
|
@@ -1710,10 +1803,45 @@ function loopCreate(slideRealIndex) {
|
|
|
1710
1803
|
slidesEl
|
|
1711
1804
|
} = swiper;
|
|
1712
1805
|
if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
|
|
1713
|
-
const
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1806
|
+
const initSlides = () => {
|
|
1807
|
+
const slides = contentCarousel_entry.elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
|
|
1808
|
+
slides.forEach((el, index) => {
|
|
1809
|
+
el.setAttribute('data-swiper-slide-index', index);
|
|
1810
|
+
});
|
|
1811
|
+
};
|
|
1812
|
+
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
1813
|
+
const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
|
|
1814
|
+
const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
|
|
1815
|
+
const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
|
|
1816
|
+
const addBlankSlides = amountOfSlides => {
|
|
1817
|
+
for (let i = 0; i < amountOfSlides; i += 1) {
|
|
1818
|
+
const slideEl = swiper.isElement ? contentCarousel_entry.createElement('swiper-slide', [params.slideBlankClass]) : contentCarousel_entry.createElement('div', [params.slideClass, params.slideBlankClass]);
|
|
1819
|
+
swiper.slidesEl.append(slideEl);
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
if (shouldFillGroup) {
|
|
1823
|
+
if (params.loopAddBlankSlides) {
|
|
1824
|
+
const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;
|
|
1825
|
+
addBlankSlides(slidesToAdd);
|
|
1826
|
+
swiper.recalcSlides();
|
|
1827
|
+
swiper.updateSlides();
|
|
1828
|
+
} else {
|
|
1829
|
+
contentCarousel_entry.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)');
|
|
1830
|
+
}
|
|
1831
|
+
initSlides();
|
|
1832
|
+
} else if (shouldFillGrid) {
|
|
1833
|
+
if (params.loopAddBlankSlides) {
|
|
1834
|
+
const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
|
|
1835
|
+
addBlankSlides(slidesToAdd);
|
|
1836
|
+
swiper.recalcSlides();
|
|
1837
|
+
swiper.updateSlides();
|
|
1838
|
+
} else {
|
|
1839
|
+
contentCarousel_entry.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)');
|
|
1840
|
+
}
|
|
1841
|
+
initSlides();
|
|
1842
|
+
} else {
|
|
1843
|
+
initSlides();
|
|
1844
|
+
}
|
|
1717
1845
|
swiper.loopFix({
|
|
1718
1846
|
slideRealIndex,
|
|
1719
1847
|
direction: params.centeredSlides ? undefined : 'next'
|
|
@@ -1740,6 +1868,9 @@ function loopFix(_temp) {
|
|
|
1740
1868
|
slidesEl,
|
|
1741
1869
|
params
|
|
1742
1870
|
} = swiper;
|
|
1871
|
+
const {
|
|
1872
|
+
centeredSlides
|
|
1873
|
+
} = params;
|
|
1743
1874
|
swiper.allowSlidePrev = true;
|
|
1744
1875
|
swiper.allowSlideNext = true;
|
|
1745
1876
|
if (swiper.virtual && params.virtual.enabled) {
|
|
@@ -1757,17 +1888,33 @@ function loopFix(_temp) {
|
|
|
1757
1888
|
swiper.emit('loopFix');
|
|
1758
1889
|
return;
|
|
1759
1890
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1891
|
+
let slidesPerView = params.slidesPerView;
|
|
1892
|
+
if (slidesPerView === 'auto') {
|
|
1893
|
+
slidesPerView = swiper.slidesPerViewDynamic();
|
|
1894
|
+
} else {
|
|
1895
|
+
slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
|
|
1896
|
+
if (centeredSlides && slidesPerView % 2 === 0) {
|
|
1897
|
+
slidesPerView = slidesPerView + 1;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
|
|
1901
|
+
let loopedSlides = slidesPerGroup;
|
|
1902
|
+
if (loopedSlides % slidesPerGroup !== 0) {
|
|
1903
|
+
loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
|
|
1764
1904
|
}
|
|
1905
|
+
loopedSlides += params.loopAdditionalSlides;
|
|
1765
1906
|
swiper.loopedSlides = loopedSlides;
|
|
1907
|
+
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
1908
|
+
if (slides.length < slidesPerView + loopedSlides) {
|
|
1909
|
+
contentCarousel_entry.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');
|
|
1910
|
+
} else if (gridEnabled && params.grid.fill === 'row') {
|
|
1911
|
+
contentCarousel_entry.showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');
|
|
1912
|
+
}
|
|
1766
1913
|
const prependSlidesIndexes = [];
|
|
1767
1914
|
const appendSlidesIndexes = [];
|
|
1768
1915
|
let activeIndex = swiper.activeIndex;
|
|
1769
1916
|
if (typeof activeSlideIndex === 'undefined') {
|
|
1770
|
-
activeSlideIndex = swiper.getSlideIndex(
|
|
1917
|
+
activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
|
|
1771
1918
|
} else {
|
|
1772
1919
|
activeIndex = activeSlideIndex;
|
|
1773
1920
|
}
|
|
@@ -1775,37 +1922,64 @@ function loopFix(_temp) {
|
|
|
1775
1922
|
const isPrev = direction === 'prev' || !direction;
|
|
1776
1923
|
let slidesPrepended = 0;
|
|
1777
1924
|
let slidesAppended = 0;
|
|
1925
|
+
const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
|
|
1926
|
+
const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
|
|
1927
|
+
const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
|
|
1778
1928
|
// prepend last slides before start
|
|
1779
|
-
if (
|
|
1780
|
-
slidesPrepended = Math.max(loopedSlides -
|
|
1781
|
-
for (let i = 0; i < loopedSlides -
|
|
1782
|
-
const index = i - Math.floor(i /
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1929
|
+
if (activeColIndexWithShift < loopedSlides) {
|
|
1930
|
+
slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
|
|
1931
|
+
for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
|
|
1932
|
+
const index = i - Math.floor(i / cols) * cols;
|
|
1933
|
+
if (gridEnabled) {
|
|
1934
|
+
const colIndexToPrepend = cols - index - 1;
|
|
1935
|
+
for (let i = slides.length - 1; i >= 0; i -= 1) {
|
|
1936
|
+
if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);
|
|
1937
|
+
}
|
|
1938
|
+
// slides.forEach((slide, slideIndex) => {
|
|
1939
|
+
// if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);
|
|
1940
|
+
// });
|
|
1941
|
+
} else {
|
|
1942
|
+
prependSlidesIndexes.push(cols - index - 1);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
} else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
|
|
1946
|
+
slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
|
|
1787
1947
|
for (let i = 0; i < slidesAppended; i += 1) {
|
|
1788
|
-
const index = i - Math.floor(i /
|
|
1789
|
-
|
|
1948
|
+
const index = i - Math.floor(i / cols) * cols;
|
|
1949
|
+
if (gridEnabled) {
|
|
1950
|
+
slides.forEach((slide, slideIndex) => {
|
|
1951
|
+
if (slide.column === index) appendSlidesIndexes.push(slideIndex);
|
|
1952
|
+
});
|
|
1953
|
+
} else {
|
|
1954
|
+
appendSlidesIndexes.push(index);
|
|
1955
|
+
}
|
|
1790
1956
|
}
|
|
1791
1957
|
}
|
|
1958
|
+
swiper.__preventObserver__ = true;
|
|
1959
|
+
requestAnimationFrame(() => {
|
|
1960
|
+
swiper.__preventObserver__ = false;
|
|
1961
|
+
});
|
|
1792
1962
|
if (isPrev) {
|
|
1793
1963
|
prependSlidesIndexes.forEach(index => {
|
|
1794
|
-
|
|
1795
|
-
slidesEl.prepend(
|
|
1796
|
-
|
|
1964
|
+
slides[index].swiperLoopMoveDOM = true;
|
|
1965
|
+
slidesEl.prepend(slides[index]);
|
|
1966
|
+
slides[index].swiperLoopMoveDOM = false;
|
|
1797
1967
|
});
|
|
1798
1968
|
}
|
|
1799
1969
|
if (isNext) {
|
|
1800
1970
|
appendSlidesIndexes.forEach(index => {
|
|
1801
|
-
|
|
1802
|
-
slidesEl.append(
|
|
1803
|
-
|
|
1971
|
+
slides[index].swiperLoopMoveDOM = true;
|
|
1972
|
+
slidesEl.append(slides[index]);
|
|
1973
|
+
slides[index].swiperLoopMoveDOM = false;
|
|
1804
1974
|
});
|
|
1805
1975
|
}
|
|
1806
1976
|
swiper.recalcSlides();
|
|
1807
1977
|
if (params.slidesPerView === 'auto') {
|
|
1808
1978
|
swiper.updateSlides();
|
|
1979
|
+
} else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
|
|
1980
|
+
swiper.slides.forEach((slide, slideIndex) => {
|
|
1981
|
+
swiper.grid.updateSlide(slideIndex, slide, swiper.slides);
|
|
1982
|
+
});
|
|
1809
1983
|
}
|
|
1810
1984
|
if (params.watchSlidesProgress) {
|
|
1811
1985
|
swiper.updateSlidesOffset();
|
|
@@ -1821,13 +1995,14 @@ function loopFix(_temp) {
|
|
|
1821
1995
|
} else {
|
|
1822
1996
|
swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);
|
|
1823
1997
|
if (setTranslate) {
|
|
1824
|
-
swiper.
|
|
1825
|
-
swiper.touchEventsData.currentTranslate = swiper.
|
|
1998
|
+
swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
|
|
1999
|
+
swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
|
|
1826
2000
|
}
|
|
1827
2001
|
}
|
|
1828
2002
|
} else {
|
|
1829
2003
|
if (setTranslate) {
|
|
1830
|
-
|
|
2004
|
+
const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;
|
|
2005
|
+
swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
|
|
1831
2006
|
swiper.touchEventsData.currentTranslate = swiper.translate;
|
|
1832
2007
|
}
|
|
1833
2008
|
}
|
|
@@ -1841,12 +2016,13 @@ function loopFix(_temp) {
|
|
|
1841
2016
|
} else {
|
|
1842
2017
|
swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
|
|
1843
2018
|
if (setTranslate) {
|
|
1844
|
-
swiper.
|
|
1845
|
-
swiper.touchEventsData.currentTranslate = swiper.
|
|
2019
|
+
swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
|
|
2020
|
+
swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
|
|
1846
2021
|
}
|
|
1847
2022
|
}
|
|
1848
2023
|
} else {
|
|
1849
|
-
|
|
2024
|
+
const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;
|
|
2025
|
+
swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
|
|
1850
2026
|
}
|
|
1851
2027
|
}
|
|
1852
2028
|
}
|
|
@@ -1959,27 +2135,54 @@ function closestElement(selector, base) {
|
|
|
1959
2135
|
}
|
|
1960
2136
|
return __closestFrom(base);
|
|
1961
2137
|
}
|
|
2138
|
+
function preventEdgeSwipe(swiper, event, startX) {
|
|
2139
|
+
const window = contentCarousel_entry.getWindow();
|
|
2140
|
+
const {
|
|
2141
|
+
params
|
|
2142
|
+
} = swiper;
|
|
2143
|
+
const edgeSwipeDetection = params.edgeSwipeDetection;
|
|
2144
|
+
const edgeSwipeThreshold = params.edgeSwipeThreshold;
|
|
2145
|
+
if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
|
|
2146
|
+
if (edgeSwipeDetection === 'prevent') {
|
|
2147
|
+
event.preventDefault();
|
|
2148
|
+
return true;
|
|
2149
|
+
}
|
|
2150
|
+
return false;
|
|
2151
|
+
}
|
|
2152
|
+
return true;
|
|
2153
|
+
}
|
|
1962
2154
|
function onTouchStart(event) {
|
|
1963
2155
|
const swiper = this;
|
|
1964
2156
|
const document = contentCarousel_entry.getDocument();
|
|
1965
|
-
|
|
2157
|
+
let e = event;
|
|
2158
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
1966
2159
|
const data = swiper.touchEventsData;
|
|
1967
|
-
|
|
2160
|
+
if (e.type === 'pointerdown') {
|
|
2161
|
+
if (data.pointerId !== null && data.pointerId !== e.pointerId) {
|
|
2162
|
+
return;
|
|
2163
|
+
}
|
|
2164
|
+
data.pointerId = e.pointerId;
|
|
2165
|
+
} else if (e.type === 'touchstart' && e.targetTouches.length === 1) {
|
|
2166
|
+
data.touchId = e.targetTouches[0].identifier;
|
|
2167
|
+
}
|
|
2168
|
+
if (e.type === 'touchstart') {
|
|
2169
|
+
// don't proceed touch event
|
|
2170
|
+
preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
1968
2173
|
const {
|
|
1969
2174
|
params,
|
|
1970
2175
|
touches,
|
|
1971
2176
|
enabled
|
|
1972
2177
|
} = swiper;
|
|
1973
2178
|
if (!enabled) return;
|
|
1974
|
-
if (!params.simulateTouch &&
|
|
2179
|
+
if (!params.simulateTouch && e.pointerType === 'mouse') return;
|
|
1975
2180
|
if (swiper.animating && params.preventInteractionOnTransition) {
|
|
1976
2181
|
return;
|
|
1977
2182
|
}
|
|
1978
2183
|
if (!swiper.animating && params.cssMode && params.loop) {
|
|
1979
2184
|
swiper.loopFix();
|
|
1980
2185
|
}
|
|
1981
|
-
let e = event;
|
|
1982
|
-
if (e.originalEvent) e = e.originalEvent;
|
|
1983
2186
|
let targetEl = e.target;
|
|
1984
2187
|
if (params.touchEventsTarget === 'wrapper') {
|
|
1985
2188
|
if (!swiper.wrapperEl.contains(targetEl)) return;
|
|
@@ -1991,7 +2194,7 @@ function onTouchStart(event) {
|
|
|
1991
2194
|
// change target el for shadow root component
|
|
1992
2195
|
const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
|
|
1993
2196
|
// eslint-disable-next-line
|
|
1994
|
-
const eventPath =
|
|
2197
|
+
const eventPath = e.composedPath ? e.composedPath() : e.path;
|
|
1995
2198
|
if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
|
|
1996
2199
|
targetEl = eventPath[0];
|
|
1997
2200
|
}
|
|
@@ -2013,14 +2216,8 @@ function onTouchStart(event) {
|
|
|
2013
2216
|
|
|
2014
2217
|
// Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
|
|
2015
2218
|
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
|
|
2019
|
-
if (edgeSwipeDetection === 'prevent') {
|
|
2020
|
-
event.preventDefault();
|
|
2021
|
-
} else {
|
|
2022
|
-
return;
|
|
2023
|
-
}
|
|
2219
|
+
if (!preventEdgeSwipe(swiper, e, startX)) {
|
|
2220
|
+
return;
|
|
2024
2221
|
}
|
|
2025
2222
|
Object.assign(data, {
|
|
2026
2223
|
isTouched: true,
|
|
@@ -2070,15 +2267,24 @@ function onTouchMove(event) {
|
|
|
2070
2267
|
if (!params.simulateTouch && event.pointerType === 'mouse') return;
|
|
2071
2268
|
let e = event;
|
|
2072
2269
|
if (e.originalEvent) e = e.originalEvent;
|
|
2270
|
+
if (e.type === 'pointermove') {
|
|
2271
|
+
if (data.touchId !== null) return; // return from pointer if we use touch
|
|
2272
|
+
const id = e.pointerId;
|
|
2273
|
+
if (id !== data.pointerId) return;
|
|
2274
|
+
}
|
|
2275
|
+
let targetTouch;
|
|
2276
|
+
if (e.type === 'touchmove') {
|
|
2277
|
+
targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
|
|
2278
|
+
if (!targetTouch || targetTouch.identifier !== data.touchId) return;
|
|
2279
|
+
} else {
|
|
2280
|
+
targetTouch = e;
|
|
2281
|
+
}
|
|
2073
2282
|
if (!data.isTouched) {
|
|
2074
2283
|
if (data.startMoving && data.isScrolling) {
|
|
2075
2284
|
swiper.emit('touchMoveOpposite', e);
|
|
2076
2285
|
}
|
|
2077
2286
|
return;
|
|
2078
2287
|
}
|
|
2079
|
-
const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
|
|
2080
|
-
if (pointerIndex >= 0) data.evCache[pointerIndex] = e;
|
|
2081
|
-
const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;
|
|
2082
2288
|
const pageX = targetTouch.pageX;
|
|
2083
2289
|
const pageY = targetTouch.pageY;
|
|
2084
2290
|
if (e.preventedByNestedSwiper) {
|
|
@@ -2094,8 +2300,6 @@ function onTouchMove(event) {
|
|
|
2094
2300
|
Object.assign(touches, {
|
|
2095
2301
|
startX: pageX,
|
|
2096
2302
|
startY: pageY,
|
|
2097
|
-
prevX: swiper.touches.currentX,
|
|
2098
|
-
prevY: swiper.touches.currentY,
|
|
2099
2303
|
currentX: pageX,
|
|
2100
2304
|
currentY: pageY
|
|
2101
2305
|
});
|
|
@@ -2125,7 +2329,8 @@ function onTouchMove(event) {
|
|
|
2125
2329
|
if (data.allowTouchCallbacks) {
|
|
2126
2330
|
swiper.emit('touchMove', e);
|
|
2127
2331
|
}
|
|
2128
|
-
|
|
2332
|
+
touches.previousX = touches.currentX;
|
|
2333
|
+
touches.previousY = touches.currentY;
|
|
2129
2334
|
touches.currentX = pageX;
|
|
2130
2335
|
touches.currentY = pageY;
|
|
2131
2336
|
const diffX = touches.currentX - touches.startX;
|
|
@@ -2151,7 +2356,7 @@ function onTouchMove(event) {
|
|
|
2151
2356
|
data.startMoving = true;
|
|
2152
2357
|
}
|
|
2153
2358
|
}
|
|
2154
|
-
if (data.isScrolling
|
|
2359
|
+
if (data.isScrolling) {
|
|
2155
2360
|
data.isTouched = false;
|
|
2156
2361
|
return;
|
|
2157
2362
|
}
|
|
@@ -2181,8 +2386,9 @@ function onTouchMove(event) {
|
|
|
2181
2386
|
swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
|
|
2182
2387
|
swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
|
|
2183
2388
|
const isLoop = swiper.params.loop && !params.cssMode;
|
|
2389
|
+
const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev;
|
|
2184
2390
|
if (!data.isMoved) {
|
|
2185
|
-
if (isLoop) {
|
|
2391
|
+
if (isLoop && allowLoopFix) {
|
|
2186
2392
|
swiper.loopFix({
|
|
2187
2393
|
direction: swiper.swipeDirection
|
|
2188
2394
|
});
|
|
@@ -2204,13 +2410,18 @@ function onTouchMove(event) {
|
|
|
2204
2410
|
swiper.emit('sliderFirstMove', e);
|
|
2205
2411
|
}
|
|
2206
2412
|
let loopFixed;
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2413
|
+
new Date().getTime();
|
|
2414
|
+
if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
|
|
2415
|
+
Object.assign(touches, {
|
|
2416
|
+
startX: pageX,
|
|
2417
|
+
startY: pageY,
|
|
2418
|
+
currentX: pageX,
|
|
2419
|
+
currentY: pageY,
|
|
2420
|
+
startTranslate: data.currentTranslate
|
|
2212
2421
|
});
|
|
2213
|
-
|
|
2422
|
+
data.loopSwapReset = true;
|
|
2423
|
+
data.startTranslate = data.currentTranslate;
|
|
2424
|
+
return;
|
|
2214
2425
|
}
|
|
2215
2426
|
swiper.emit('sliderMove', e);
|
|
2216
2427
|
data.isMoved = true;
|
|
@@ -2221,7 +2432,7 @@ function onTouchMove(event) {
|
|
|
2221
2432
|
resistanceRatio = 0;
|
|
2222
2433
|
}
|
|
2223
2434
|
if (diff > 0) {
|
|
2224
|
-
if (isLoop && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.
|
|
2435
|
+
if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] : swiper.minTranslate())) {
|
|
2225
2436
|
swiper.loopFix({
|
|
2226
2437
|
direction: 'prev',
|
|
2227
2438
|
setTranslate: true,
|
|
@@ -2235,7 +2446,7 @@ function onTouchMove(event) {
|
|
|
2235
2446
|
}
|
|
2236
2447
|
}
|
|
2237
2448
|
} else if (diff < 0) {
|
|
2238
|
-
if (isLoop && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.
|
|
2449
|
+
if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] : swiper.maxTranslate())) {
|
|
2239
2450
|
swiper.loopFix({
|
|
2240
2451
|
direction: 'next',
|
|
2241
2452
|
setTranslate: true,
|
|
@@ -2299,16 +2510,26 @@ function onTouchMove(event) {
|
|
|
2299
2510
|
function onTouchEnd(event) {
|
|
2300
2511
|
const swiper = this;
|
|
2301
2512
|
const data = swiper.touchEventsData;
|
|
2302
|
-
|
|
2303
|
-
if (
|
|
2304
|
-
|
|
2513
|
+
let e = event;
|
|
2514
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
2515
|
+
let targetTouch;
|
|
2516
|
+
const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';
|
|
2517
|
+
if (!isTouchEvent) {
|
|
2518
|
+
if (data.touchId !== null) return; // return from pointer if we use touch
|
|
2519
|
+
if (e.pointerId !== data.pointerId) return;
|
|
2520
|
+
targetTouch = e;
|
|
2521
|
+
} else {
|
|
2522
|
+
targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
|
|
2523
|
+
if (!targetTouch || targetTouch.identifier !== data.touchId) return;
|
|
2305
2524
|
}
|
|
2306
|
-
if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(
|
|
2307
|
-
const proceed = ['pointercancel', 'contextmenu'].includes(
|
|
2525
|
+
if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {
|
|
2526
|
+
const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
|
|
2308
2527
|
if (!proceed) {
|
|
2309
2528
|
return;
|
|
2310
2529
|
}
|
|
2311
2530
|
}
|
|
2531
|
+
data.pointerId = null;
|
|
2532
|
+
data.touchId = null;
|
|
2312
2533
|
const {
|
|
2313
2534
|
params,
|
|
2314
2535
|
touches,
|
|
@@ -2317,9 +2538,7 @@ function onTouchEnd(event) {
|
|
|
2317
2538
|
enabled
|
|
2318
2539
|
} = swiper;
|
|
2319
2540
|
if (!enabled) return;
|
|
2320
|
-
if (!params.simulateTouch &&
|
|
2321
|
-
let e = event;
|
|
2322
|
-
if (e.originalEvent) e = e.originalEvent;
|
|
2541
|
+
if (!params.simulateTouch && e.pointerType === 'mouse') return;
|
|
2323
2542
|
if (data.allowTouchCallbacks) {
|
|
2324
2543
|
swiper.emit('touchEnd', e);
|
|
2325
2544
|
}
|
|
@@ -2332,6 +2551,7 @@ function onTouchEnd(event) {
|
|
|
2332
2551
|
data.startMoving = false;
|
|
2333
2552
|
return;
|
|
2334
2553
|
}
|
|
2554
|
+
|
|
2335
2555
|
// Return Grab Cursor
|
|
2336
2556
|
if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
|
2337
2557
|
swiper.setGrabCursor(false);
|
|
@@ -2344,7 +2564,7 @@ function onTouchEnd(event) {
|
|
|
2344
2564
|
// Tap, doubleTap, Click
|
|
2345
2565
|
if (swiper.allowClick) {
|
|
2346
2566
|
const pathTree = e.path || e.composedPath && e.composedPath();
|
|
2347
|
-
swiper.updateClickedSlide(pathTree && pathTree[0] || e.target);
|
|
2567
|
+
swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree);
|
|
2348
2568
|
swiper.emit('tap click', e);
|
|
2349
2569
|
if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
|
|
2350
2570
|
swiper.emit('doubleTap doubleClick', e);
|
|
@@ -2354,7 +2574,7 @@ function onTouchEnd(event) {
|
|
|
2354
2574
|
contentCarousel_entry.nextTick(() => {
|
|
2355
2575
|
if (!swiper.destroyed) swiper.allowClick = true;
|
|
2356
2576
|
});
|
|
2357
|
-
if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
|
|
2577
|
+
if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {
|
|
2358
2578
|
data.isTouched = false;
|
|
2359
2579
|
data.isMoved = false;
|
|
2360
2580
|
data.startMoving = false;
|
|
@@ -2551,8 +2771,15 @@ function onLoad(e) {
|
|
|
2551
2771
|
swiper.update();
|
|
2552
2772
|
}
|
|
2553
2773
|
|
|
2554
|
-
|
|
2555
|
-
|
|
2774
|
+
function onDocumentTouchStart() {
|
|
2775
|
+
const swiper = this;
|
|
2776
|
+
if (swiper.documentTouchHandlerProceeded) return;
|
|
2777
|
+
swiper.documentTouchHandlerProceeded = true;
|
|
2778
|
+
if (swiper.params.touchReleaseOnEdges) {
|
|
2779
|
+
swiper.el.style.touchAction = 'auto';
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2556
2783
|
const events = (swiper, method) => {
|
|
2557
2784
|
const document = contentCarousel_entry.getDocument();
|
|
2558
2785
|
const {
|
|
@@ -2566,19 +2793,36 @@ const events = (swiper, method) => {
|
|
|
2566
2793
|
const swiperMethod = method;
|
|
2567
2794
|
|
|
2568
2795
|
// Touch Events
|
|
2796
|
+
document[domMethod]('touchstart', swiper.onDocumentTouchStart, {
|
|
2797
|
+
passive: false,
|
|
2798
|
+
capture
|
|
2799
|
+
});
|
|
2800
|
+
el[domMethod]('touchstart', swiper.onTouchStart, {
|
|
2801
|
+
passive: false
|
|
2802
|
+
});
|
|
2569
2803
|
el[domMethod]('pointerdown', swiper.onTouchStart, {
|
|
2570
2804
|
passive: false
|
|
2571
2805
|
});
|
|
2806
|
+
document[domMethod]('touchmove', swiper.onTouchMove, {
|
|
2807
|
+
passive: false,
|
|
2808
|
+
capture
|
|
2809
|
+
});
|
|
2572
2810
|
document[domMethod]('pointermove', swiper.onTouchMove, {
|
|
2573
2811
|
passive: false,
|
|
2574
2812
|
capture
|
|
2575
2813
|
});
|
|
2814
|
+
document[domMethod]('touchend', swiper.onTouchEnd, {
|
|
2815
|
+
passive: true
|
|
2816
|
+
});
|
|
2576
2817
|
document[domMethod]('pointerup', swiper.onTouchEnd, {
|
|
2577
2818
|
passive: true
|
|
2578
2819
|
});
|
|
2579
2820
|
document[domMethod]('pointercancel', swiper.onTouchEnd, {
|
|
2580
2821
|
passive: true
|
|
2581
2822
|
});
|
|
2823
|
+
document[domMethod]('touchcancel', swiper.onTouchEnd, {
|
|
2824
|
+
passive: true
|
|
2825
|
+
});
|
|
2582
2826
|
document[domMethod]('pointerout', swiper.onTouchEnd, {
|
|
2583
2827
|
passive: true
|
|
2584
2828
|
});
|
|
@@ -2611,22 +2855,18 @@ const events = (swiper, method) => {
|
|
|
2611
2855
|
};
|
|
2612
2856
|
function attachEvents() {
|
|
2613
2857
|
const swiper = this;
|
|
2614
|
-
const document = contentCarousel_entry.getDocument();
|
|
2615
2858
|
const {
|
|
2616
2859
|
params
|
|
2617
2860
|
} = swiper;
|
|
2618
2861
|
swiper.onTouchStart = onTouchStart.bind(swiper);
|
|
2619
2862
|
swiper.onTouchMove = onTouchMove.bind(swiper);
|
|
2620
2863
|
swiper.onTouchEnd = onTouchEnd.bind(swiper);
|
|
2864
|
+
swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);
|
|
2621
2865
|
if (params.cssMode) {
|
|
2622
2866
|
swiper.onScroll = onScroll.bind(swiper);
|
|
2623
2867
|
}
|
|
2624
2868
|
swiper.onClick = onClick.bind(swiper);
|
|
2625
2869
|
swiper.onLoad = onLoad.bind(swiper);
|
|
2626
|
-
if (!dummyEventAttached) {
|
|
2627
|
-
document.addEventListener('touchstart', dummyEventListener);
|
|
2628
|
-
dummyEventAttached = true;
|
|
2629
|
-
}
|
|
2630
2870
|
events(swiper, 'on');
|
|
2631
2871
|
}
|
|
2632
2872
|
function detachEvents() {
|
|
@@ -2685,11 +2925,13 @@ function setBreakpoint() {
|
|
|
2685
2925
|
});
|
|
2686
2926
|
const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
|
|
2687
2927
|
const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
|
|
2928
|
+
const wasLoop = params.loop;
|
|
2688
2929
|
if (directionChanged && initialized) {
|
|
2689
2930
|
swiper.changeDirection();
|
|
2690
2931
|
}
|
|
2691
2932
|
contentCarousel_entry.extend(swiper.params, breakpointParams);
|
|
2692
2933
|
const isEnabled = swiper.params.enabled;
|
|
2934
|
+
const hasLoop = swiper.params.loop;
|
|
2693
2935
|
Object.assign(swiper, {
|
|
2694
2936
|
allowTouchMove: swiper.params.allowTouchMove,
|
|
2695
2937
|
allowSlideNext: swiper.params.allowSlideNext,
|
|
@@ -2702,10 +2944,17 @@ function setBreakpoint() {
|
|
|
2702
2944
|
}
|
|
2703
2945
|
swiper.currentBreakpoint = breakpoint;
|
|
2704
2946
|
swiper.emit('_beforeBreakpoint', breakpointParams);
|
|
2705
|
-
if (
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2947
|
+
if (initialized) {
|
|
2948
|
+
if (needsReLoop) {
|
|
2949
|
+
swiper.loopDestroy();
|
|
2950
|
+
swiper.loopCreate(realIndex);
|
|
2951
|
+
swiper.updateSlides();
|
|
2952
|
+
} else if (!wasLoop && hasLoop) {
|
|
2953
|
+
swiper.loopCreate(realIndex);
|
|
2954
|
+
swiper.updateSlides();
|
|
2955
|
+
} else if (wasLoop && !hasLoop) {
|
|
2956
|
+
swiper.loopDestroy();
|
|
2957
|
+
}
|
|
2709
2958
|
}
|
|
2710
2959
|
swiper.emit('breakpoint', breakpointParams);
|
|
2711
2960
|
}
|
|
@@ -2865,6 +3114,7 @@ var defaults = {
|
|
|
2865
3114
|
resizeObserver: true,
|
|
2866
3115
|
nested: false,
|
|
2867
3116
|
createElements: false,
|
|
3117
|
+
eventsPrefix: 'swiper',
|
|
2868
3118
|
enabled: true,
|
|
2869
3119
|
focusableElements: 'input, select, option, textarea, button, video, label',
|
|
2870
3120
|
// Overrides
|
|
@@ -2939,7 +3189,8 @@ var defaults = {
|
|
|
2939
3189
|
slideToClickedSlide: false,
|
|
2940
3190
|
// loop
|
|
2941
3191
|
loop: false,
|
|
2942
|
-
|
|
3192
|
+
loopAddBlankSlides: true,
|
|
3193
|
+
loopAdditionalSlides: 0,
|
|
2943
3194
|
loopPreventsSliding: true,
|
|
2944
3195
|
// rewind
|
|
2945
3196
|
rewind: false,
|
|
@@ -2958,8 +3209,10 @@ var defaults = {
|
|
|
2958
3209
|
containerModifierClass: 'swiper-',
|
|
2959
3210
|
// NEW
|
|
2960
3211
|
slideClass: 'swiper-slide',
|
|
3212
|
+
slideBlankClass: 'swiper-slide-blank',
|
|
2961
3213
|
slideActiveClass: 'swiper-slide-active',
|
|
2962
3214
|
slideVisibleClass: 'swiper-slide-visible',
|
|
3215
|
+
slideFullyVisibleClass: 'swiper-slide-fully-visible',
|
|
2963
3216
|
slideNextClass: 'swiper-slide-next',
|
|
2964
3217
|
slidePrevClass: 'swiper-slide-prev',
|
|
2965
3218
|
wrapperClass: 'swiper-wrapper',
|
|
@@ -2982,20 +3235,21 @@ function moduleExtendParams(params, allModulesParams) {
|
|
|
2982
3235
|
contentCarousel_entry.extend(allModulesParams, obj);
|
|
2983
3236
|
return;
|
|
2984
3237
|
}
|
|
2985
|
-
if (
|
|
3238
|
+
if (params[moduleParamName] === true) {
|
|
2986
3239
|
params[moduleParamName] = {
|
|
2987
|
-
|
|
3240
|
+
enabled: true
|
|
2988
3241
|
};
|
|
2989
3242
|
}
|
|
3243
|
+
if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) {
|
|
3244
|
+
params[moduleParamName].auto = true;
|
|
3245
|
+
}
|
|
3246
|
+
if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) {
|
|
3247
|
+
params[moduleParamName].auto = true;
|
|
3248
|
+
}
|
|
2990
3249
|
if (!(moduleParamName in params && 'enabled' in moduleParams)) {
|
|
2991
3250
|
contentCarousel_entry.extend(allModulesParams, obj);
|
|
2992
3251
|
return;
|
|
2993
3252
|
}
|
|
2994
|
-
if (params[moduleParamName] === true) {
|
|
2995
|
-
params[moduleParamName] = {
|
|
2996
|
-
enabled: true
|
|
2997
|
-
};
|
|
2998
|
-
}
|
|
2999
3253
|
if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
|
|
3000
3254
|
params[moduleParamName].enabled = true;
|
|
3001
3255
|
}
|
|
@@ -3151,7 +3405,8 @@ class Swiper {
|
|
|
3151
3405
|
velocities: [],
|
|
3152
3406
|
allowMomentumBounce: undefined,
|
|
3153
3407
|
startMoving: undefined,
|
|
3154
|
-
|
|
3408
|
+
pointerId: null,
|
|
3409
|
+
touchId: null
|
|
3155
3410
|
},
|
|
3156
3411
|
// Clicks
|
|
3157
3412
|
allowClick: true,
|
|
@@ -3179,6 +3434,22 @@ class Swiper {
|
|
|
3179
3434
|
// eslint-disable-next-line no-constructor-return
|
|
3180
3435
|
return swiper;
|
|
3181
3436
|
}
|
|
3437
|
+
getDirectionLabel(property) {
|
|
3438
|
+
if (this.isHorizontal()) {
|
|
3439
|
+
return property;
|
|
3440
|
+
}
|
|
3441
|
+
// prettier-ignore
|
|
3442
|
+
return {
|
|
3443
|
+
'width': 'height',
|
|
3444
|
+
'margin-top': 'margin-left',
|
|
3445
|
+
'margin-bottom ': 'margin-right',
|
|
3446
|
+
'margin-left': 'margin-top',
|
|
3447
|
+
'margin-right': 'margin-bottom',
|
|
3448
|
+
'padding-left': 'padding-top',
|
|
3449
|
+
'padding-right': 'padding-bottom',
|
|
3450
|
+
'marginRight': 'marginBottom'
|
|
3451
|
+
}[property];
|
|
3452
|
+
}
|
|
3182
3453
|
getSlideIndex(slideEl) {
|
|
3183
3454
|
const {
|
|
3184
3455
|
slidesEl,
|
|
@@ -3273,6 +3544,7 @@ class Swiper {
|
|
|
3273
3544
|
activeIndex
|
|
3274
3545
|
} = swiper;
|
|
3275
3546
|
let spv = 1;
|
|
3547
|
+
if (typeof params.slidesPerView === 'number') return params.slidesPerView;
|
|
3276
3548
|
if (params.centeredSlides) {
|
|
3277
3549
|
let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0;
|
|
3278
3550
|
let breakLoop;
|
|
@@ -3555,7 +3827,7 @@ class Swiper {
|
|
|
3555
3827
|
wrapperEl.removeAttribute('style');
|
|
3556
3828
|
if (slides && slides.length) {
|
|
3557
3829
|
slides.forEach(slideEl => {
|
|
3558
|
-
slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
3830
|
+
slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
3559
3831
|
slideEl.removeAttribute('style');
|
|
3560
3832
|
slideEl.removeAttribute('data-swiper-slide-index');
|
|
3561
3833
|
});
|
|
@@ -3609,4 +3881,4 @@ Swiper.use([Resize, Observer]);
|
|
|
3609
3881
|
exports.Swiper = Swiper;
|
|
3610
3882
|
exports.default = Swiper;
|
|
3611
3883
|
|
|
3612
|
-
//# sourceMappingURL=swiper-
|
|
3884
|
+
//# sourceMappingURL=swiper-2fe1b80b.js.map
|