-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
/
Copy pathvirtual.d.ts
130 lines (118 loc) · 3.45 KB
/
virtual.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
export interface VirtualMethods {
/**
* Object with cached slides HTML elements
*/
cache: object;
/**
* Index of first rendered slide
*/
from: number;
/**
* Index of last rendered slide
*/
to: number;
/**
* Array with slide items passed by `virtual.slides` parameter
*/
slides: any[];
/*
* Methods
*/
/**
* Append slide. `slides` can be a single slide item or array with such slides.
*
* @note Only for Core version (in React, Svelte, Vue & Angular it should be done by modifying slides array/data/source)
*/
appendSlide(slide: HTMLElement | string | HTMLElement[] | string[]): void;
/**
* Prepend slide. `slides` can be a single slide item or array with such slides.
*
* @note Only for Core version (in React, Svelte, Vue & Angular it should be done by modifying slides array/data/source)
*/
prependSlide(slide: HTMLElement | string | HTMLElement[] | string[]): void;
/**
* Remove specific slide or slides. `slideIndexes` can be a number with slide index to remove or array with indexes.
*
* @note Only for Core version (in React, Svelte, Vue & Angular it should be done by modifying slides array/data/source)
*/
removeSlide(slideIndexes: number[]): void;
/**
* Remove all slides
*
* @note Only for Core version (in React, Svelte, Vue & Angular it should be done by modifying slides array/data/source)
*/
removeAllSlides(): void;
/**
* Update virtual slides state
*/
update(force: boolean): void;
}
export interface VirtualEvents {}
export interface VirtualData {
/**
* slides left/top offset in px
*/
offset: number;
/**
* index of first slide required to be rendered
*/
from: number;
/**
* index of last slide required to be rendered
*/
to: number;
/**
* array with slide items to be rendered
*/
slides: any[];
}
export interface VirtualOptions {
enabled?: boolean;
/**
* Array with slides
*
* @default []
*/
slides?: any[];
/**
* Enables DOM cache of rendering slides html elements. Once they are rendered they will be saved to cache and reused from it.
*
* @default true
*/
cache?: boolean;
/**
* Increases amount of pre-rendered slides before active slide
*
* @default 0
*/
addSlidesBefore?: number;
/**
* Increases amount of pre-rendered slides after active slide
*
* @default 0
*/
addSlidesAfter?: number;
/**
* Function to render slide. As an argument it accepts current slide item for `slides` array and index number of the current slide. Function must return an outter HTML of the swiper slide.
*
* @default null
*/
renderSlide?: (slide: any, index: any) => any | null;
/**
* Function for external rendering (e.g. using some other library to handle DOM manipulations and state like React.js or Vue.js). As an argument it accepts `data` object with the following properties:
*
* - `offset` - slides left/top offset in px
* - `from` - index of first slide required to be rendered
* - `to` - index of last slide required to be rendered
* - `slides` - array with slide items to be rendered
*
* @default null
*/
renderExternal?: (data: VirtualData) => any | null;
/**
* When enabled (by default) it will update Swiper layout right after renderExternal called. Useful to disable and update swiper manually when used with render libraries that renders asynchronously
*
* @default true
*/
renderExternalUpdate?: boolean;
}