[swiper] Update swiper typings to v5.4 (#45330)

* [swiper] Update swiper typings to v5.4

* [swiper] Update tests for changed typings
This commit is contained in:
Jayden 2020-06-25 09:40:10 +09:00 committed by GitHub
parent 94b5f9c904
commit 1e4b8d4d61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for Swiper 5.3
// Type definitions for Swiper 5.4
// Project: https://github.com/nolimits4web/Swiper, http://www.idangero.us/swiper
// Definitions by: Sebastián Galiano <https://github.com/sgaliano>
// Luca Trazzi <https://github.com/lucax88x>
@ -61,10 +61,15 @@ export type AutoplayEvent = 'autoplayStart' | 'autoplayStop' | 'autoplay';
*/
export type LazyLoadingEvent = 'lazyImageLoad' | 'lazyImageReady';
/**
* Swiper hash-navigation event names.
*/
export type HashNavigationEvent = 'hashChange' | 'hashSet';
/**
* Swiper event names.
*/
export type SwiperEvent = CommonEvent | PaginationEvent | AutoplayEvent | LazyLoadingEvent;
export type SwiperEvent = CommonEvent | PaginationEvent | AutoplayEvent | LazyLoadingEvent | HashNavigationEvent;
/**
* Swiper module types.
@ -1014,6 +1019,8 @@ export interface ThumbsOptions {
swiper?: Swiper;
slideThumbActiveClass?: string;
thumbsContainerClass?: string;
multipleActiveThumbs?: boolean;
autoScrollOffset?: number;
}
export interface ZoomOptions {

View File

@ -565,6 +565,10 @@ function hashNavigation() {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
on: {
hashChange: () => null,
hashSet: () => null
}
});
}
@ -811,3 +815,28 @@ function updateOnWindowResize() {
},
});
}
/**
* Thumbs
*/
function thumbs() {
const thumbsSwiper = new Swiper('.swiper-container-thumbs', {
slidesPerView: 5,
});
const swiper = new Swiper(containerSelector, {
pagination: {
el: '.swiper-pagination',
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
thumbs: {
swiper: thumbsSwiper,
slideThumbActiveClass: 'swiper-slide-thumb-active',
thumbsContainerClass: 'swiper-container-thumbs',
multipleActiveThumbs: true,
autoScrollOffset: 0
}
});
}