1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,31 @@ |
1 |
+import React from 'react'; |
|
2 |
+ |
|
3 |
+function updateOnVirtualData(swiper) { |
|
4 |
+ if (!swiper || swiper.destroyed) return; |
|
5 |
+ swiper.updateSlides(); |
|
6 |
+ swiper.updateProgress(); |
|
7 |
+ swiper.updateSlidesClasses(); |
|
8 |
+ |
|
9 |
+ if (swiper.lazy && swiper.params.lazy.enabled) { |
|
10 |
+ swiper.lazy.load(); |
|
11 |
+ } |
|
12 |
+} |
|
13 |
+ |
|
14 |
+function renderVirtual(swiper, slides, virtualData) { |
|
15 |
+ var _ref; |
|
16 |
+ |
|
17 |
+ if (!virtualData) return null; |
|
18 |
+ var style = swiper.isHorizontal() ? (_ref = {}, _ref[swiper.rtlTranslate ? 'right' : 'left'] = virtualData.offset + "px", _ref) : { |
|
19 |
+ top: virtualData.offset + "px" |
|
20 |
+ }; |
|
21 |
+ return slides.filter(function (child, index) { |
|
22 |
+ return index >= virtualData.from && index <= virtualData.to; |
|
23 |
+ }).map(function (child) { |
|
24 |
+ return /*#__PURE__*/React.cloneElement(child, { |
|
25 |
+ swiper: swiper, |
|
26 |
+ style: style |
|
27 |
+ }); |
|
28 |
+ }); |
|
29 |
+} |
|
30 |
+ |
|
31 |
+export { renderVirtual, updateOnVirtualData }; |
|
0 | 32 |
\ No newline at end of file |