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