-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): move slides manipulation methods to Manipulation module
- Loading branch information
1 parent
3b50feb
commit 74873f1
Showing
14 changed files
with
89 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ module.exports = { | |
'thumbs', | ||
'free-mode', | ||
'grid', | ||
'manipulation', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import appendSlide from './methods/appendSlide.js'; | ||
import prependSlide from './methods/prependSlide.js'; | ||
import addSlide from './methods/addSlide.js'; | ||
import removeSlide from './methods/removeSlide.js'; | ||
import removeAllSlides from './methods/removeAllSlides.js'; | ||
|
||
export default function Manipulation({ swiper }) { | ||
Object.assign(swiper, { | ||
appendSlide: appendSlide.bind(swiper), | ||
prependSlide: prependSlide.bind(swiper), | ||
addSlide: addSlide.bind(swiper), | ||
removeSlide: removeSlide.bind(swiper), | ||
removeAllSlides: removeAllSlides.bind(swiper), | ||
}); | ||
} |
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
export interface ManipulationMethods { | ||
/** | ||
* Add new slides to the end. slides could be | ||
* HTMLElement or HTML string with new slide or | ||
* array with such slides, for example: | ||
* | ||
* @example | ||
* ```js | ||
* appendSlide('<div class="swiper-slide">Slide 10"</div>') | ||
* | ||
* appendSlide([ | ||
* '<div class="swiper-slide">Slide 10"</div>', | ||
* '<div class="swiper-slide">Slide 11"</div>' | ||
* ]); | ||
* ``` | ||
*/ | ||
appendSlide(slides: HTMLElement | string | string[] | HTMLElement[]): void; | ||
|
||
/** | ||
* Add new slides to the beginning. slides could be | ||
* HTMLElement or HTML string with new slide or array with such slides, for example: | ||
* | ||
* @example | ||
* ```js | ||
* prependSlide('<div class="swiper-slide">Slide 0"</div>') | ||
* | ||
* prependSlide([ | ||
* '<div class="swiper-slide">Slide 1"</div>', | ||
* '<div class="swiper-slide">Slide 2"</div>' | ||
* ]); | ||
* ``` | ||
*/ | ||
prependSlide(slides: HTMLElement | string | string[] | HTMLElement[]): void; | ||
|
||
/** | ||
* Add new slides to the required index. slides could be HTMLElement or HTML string with new slide or array with such slides, for example: | ||
* | ||
* @example | ||
* ```js | ||
* addSlide(1, '<div class="swiper-slide">Slide 10"</div>') | ||
* | ||
* addSlide(1, [ | ||
* '<div class="swiper-slide">Slide 10"</div>', | ||
* '<div class="swiper-slide">Slide 11"</div>' | ||
* ]); | ||
* ``` | ||
*/ | ||
addSlide(index: number, slides: HTMLElement | string | string[] | HTMLElement[]): void; | ||
|
||
/** | ||
* Remove selected slides. slideIndex could be a number with slide index to remove or array with indexes. | ||
* | ||
* @example | ||
* ```js | ||
* removeSlide(0); // remove first slide | ||
* removeSlide([0, 1]); // remove first and second slides | ||
* removeAllSlides(); // Remove all slides | ||
* ``` | ||
*/ | ||
removeSlide(slideIndex: number | number[]): void; | ||
|
||
/** | ||
* Remove all slides | ||
*/ | ||
removeAllSlides(): void; | ||
} | ||
|
||
export interface ManipulationEvents {} | ||
|
||
export interface ManipulationOptions {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters