@tarojs/components 3.5.10 → 3.5.12
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/taro-swiper-core_2.cjs.entry.js +60 -21
- package/dist/collection/components/swiper/swiper-item.js +37 -2
- package/dist/collection/components/swiper/swiper.js +24 -22
- package/dist/esm/taro-swiper-core_2.entry.js +60 -21
- package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
- package/dist/taro-components/p-0380841f.system.js +1 -1
- package/dist/taro-components/{p-a5496bf5.system.entry.js → p-d8a10125.system.entry.js} +1 -1
- package/dist/taro-components/{p-34178401.entry.js → p-eeb6de57.entry.js} +1 -1
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/types/components/swiper/swiper-item.d.ts +2 -0
- package/package.json +4 -4
- package/types/Button.d.ts +1 -1
- package/types/Camera.d.ts +1 -1
- package/types/ChannelLive.d.ts +22 -0
- package/types/Checkbox.d.ts +1 -1
- package/types/CheckboxGroup.d.ts +1 -1
- package/types/CoverImage.d.ts +1 -1
- package/types/CustomWrapper.d.ts +1 -0
- package/types/Form.d.ts +7 -1
- package/types/Icon.d.ts +1 -1
- package/types/Image.d.ts +1 -1
- package/types/Input.d.ts +16 -1
- package/types/Label.d.ts +1 -1
- package/types/LivePusher.d.ts +15 -0
- package/types/NativeSlot.d.ts +1 -0
- package/types/NavigationBar.d.ts +2 -1
- package/types/Navigator.d.ts +1 -1
- package/types/Picker.d.ts +1 -1
- package/types/PickerView.d.ts +1 -1
- package/types/PickerViewColumn.d.ts +1 -1
- package/types/Progress.d.ts +1 -1
- package/types/Radio.d.ts +1 -1
- package/types/RadioGroup.d.ts +1 -1
- package/types/RichText.d.ts +1 -1
- package/types/ScrollView.d.ts +1 -1
- package/types/ShareElement.d.ts +2 -7
- package/types/Slider.d.ts +1 -1
- package/types/Slot.d.ts +2 -1
- package/types/Swiper.d.ts +1 -1
- package/types/SwiperItem.d.ts +1 -1
- package/types/Switch.d.ts +1 -1
- package/types/Textarea.d.ts +2 -1
- package/types/Video.d.ts +7 -1
- package/types/View.d.ts +1 -1
- package/types/WebView.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/virtual-list/index.d.ts +0 -1
- package/virtual-list/react/index.d.ts +0 -1
|
@@ -9922,12 +9922,12 @@ let Swiper = class {
|
|
|
9922
9922
|
*/
|
|
9923
9923
|
this.zoom = false;
|
|
9924
9924
|
this.handleSwiperLoopListen = () => {
|
|
9925
|
-
var _a, _b;
|
|
9925
|
+
var _a, _b, _c;
|
|
9926
9926
|
((_a = this.observerFirst) === null || _a === void 0 ? void 0 : _a.disconnect) && this.observerFirst.disconnect();
|
|
9927
9927
|
((_b = this.observerLast) === null || _b === void 0 ? void 0 : _b.disconnect) && this.observerLast.disconnect();
|
|
9928
9928
|
this.observerFirst = new MutationObserver(this.handleSwiperLoop);
|
|
9929
9929
|
this.observerLast = new MutationObserver(this.handleSwiperLoop);
|
|
9930
|
-
const wrapper = this.swiper.$wrapperEl[0];
|
|
9930
|
+
const wrapper = (_c = this.swiper.$wrapperEl) === null || _c === void 0 ? void 0 : _c[0];
|
|
9931
9931
|
const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)');
|
|
9932
9932
|
if (list.length >= 1) {
|
|
9933
9933
|
this.observerFirst.observe(list[0], {
|
|
@@ -9943,11 +9943,9 @@ let Swiper = class {
|
|
|
9943
9943
|
this.handleSwiperLoop = index$2.debounce(() => {
|
|
9944
9944
|
if (this.swiper && this.circular) {
|
|
9945
9945
|
// @ts-ignore
|
|
9946
|
-
this.swiper.
|
|
9947
|
-
// @ts-ignore
|
|
9948
|
-
this.swiper.loopCreate();
|
|
9946
|
+
this.swiper.loopFix();
|
|
9949
9947
|
}
|
|
9950
|
-
},
|
|
9948
|
+
}, 50);
|
|
9951
9949
|
this.handleSwiperSize = index$2.debounce(() => {
|
|
9952
9950
|
if (this.swiper && !this.circular) {
|
|
9953
9951
|
this.swiper.updateSlides();
|
|
@@ -9972,19 +9970,22 @@ let Swiper = class {
|
|
|
9972
9970
|
watchAutoplay(newVal) {
|
|
9973
9971
|
if (!this.isWillLoadCalled || !this.swiper)
|
|
9974
9972
|
return;
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9973
|
+
const swiperAutoplay = this.swiper.autoplay;
|
|
9974
|
+
if (swiperAutoplay) {
|
|
9975
|
+
if (swiperAutoplay.running === newVal)
|
|
9976
|
+
return;
|
|
9977
|
+
if (newVal) {
|
|
9978
|
+
if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
|
|
9979
|
+
if (this.swiper.params.autoplay.disableOnInteraction === true) {
|
|
9980
|
+
this.swiper.params.autoplay.disableOnInteraction = false;
|
|
9981
|
+
}
|
|
9982
|
+
this.swiper.params.autoplay.delay = this.interval;
|
|
9981
9983
|
}
|
|
9982
|
-
|
|
9984
|
+
swiperAutoplay.start();
|
|
9985
|
+
}
|
|
9986
|
+
else {
|
|
9987
|
+
swiperAutoplay.stop();
|
|
9983
9988
|
}
|
|
9984
|
-
this.swiper.autoplay.start();
|
|
9985
|
-
}
|
|
9986
|
-
else {
|
|
9987
|
-
this.swiper.autoplay.stop();
|
|
9988
9989
|
}
|
|
9989
9990
|
}
|
|
9990
9991
|
watchDuration(newVal) {
|
|
@@ -10029,20 +10030,22 @@ let Swiper = class {
|
|
|
10029
10030
|
this.isWillLoadCalled = true;
|
|
10030
10031
|
}
|
|
10031
10032
|
componentDidLoad() {
|
|
10033
|
+
var _a;
|
|
10032
10034
|
this.handleInit();
|
|
10033
10035
|
if (!this.swiper || !this.circular)
|
|
10034
10036
|
return;
|
|
10035
|
-
const wrapper = this.swiper.$wrapperEl[0];
|
|
10037
|
+
const wrapper = (_a = this.swiper.$wrapperEl) === null || _a === void 0 ? void 0 : _a[0];
|
|
10036
10038
|
this.observer = new MutationObserver(this.handleSwiperLoopListen);
|
|
10037
10039
|
this.observer.observe(wrapper, {
|
|
10038
10040
|
childList: true
|
|
10039
10041
|
});
|
|
10040
10042
|
}
|
|
10041
10043
|
componentWillUpdate() {
|
|
10044
|
+
var _a, _b;
|
|
10042
10045
|
if (!this.swiper)
|
|
10043
10046
|
return;
|
|
10044
|
-
if (this.autoplay && !this.swiper.autoplay.running) {
|
|
10045
|
-
this.swiper.autoplay.start();
|
|
10047
|
+
if (this.autoplay && !((_a = this.swiper.autoplay) === null || _a === void 0 ? void 0 : _a.running)) {
|
|
10048
|
+
(_b = this.swiper.autoplay) === null || _b === void 0 ? void 0 : _b.start();
|
|
10046
10049
|
}
|
|
10047
10050
|
this.swiper.update(); // 更新子元素
|
|
10048
10051
|
}
|
|
@@ -10079,7 +10082,7 @@ let Swiper = class {
|
|
|
10079
10082
|
slideChangeTransitionStart(_swiper) {
|
|
10080
10083
|
if (that.circular) {
|
|
10081
10084
|
if (_swiper.isBeginning || _swiper.isEnd) {
|
|
10082
|
-
_swiper.slideToLoop(this.realIndex, 0)
|
|
10085
|
+
// _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
|
|
10083
10086
|
return;
|
|
10084
10087
|
}
|
|
10085
10088
|
}
|
|
@@ -10160,13 +10163,49 @@ let Swiper = class {
|
|
|
10160
10163
|
};
|
|
10161
10164
|
Swiper.style = indexCss;
|
|
10162
10165
|
|
|
10166
|
+
function isEqualTag(a, b) {
|
|
10167
|
+
return typeof a.tagName === 'undefined' ? a.nodeType === b.nodeType : a.tagName === b.tagName;
|
|
10168
|
+
}
|
|
10169
|
+
function parseChildNodes(items, targets) {
|
|
10170
|
+
const list = Array.from(targets.values());
|
|
10171
|
+
for (let i = 0, j = 0; i < list.length; i++, j++) {
|
|
10172
|
+
const target = list[i];
|
|
10173
|
+
let item = items.item(j);
|
|
10174
|
+
while (item && !isEqualTag(item, target)) {
|
|
10175
|
+
item.remove();
|
|
10176
|
+
j++;
|
|
10177
|
+
item = items.item(j);
|
|
10178
|
+
}
|
|
10179
|
+
if (item && !item.isEqualNode(target)) {
|
|
10180
|
+
parseChildNodes(item.childNodes, target.childNodes);
|
|
10181
|
+
}
|
|
10182
|
+
while (i === list.length - 1 && j < items.length) {
|
|
10183
|
+
j++;
|
|
10184
|
+
item = items.item(j);
|
|
10185
|
+
item === null || item === void 0 ? void 0 : item.remove();
|
|
10186
|
+
}
|
|
10187
|
+
}
|
|
10188
|
+
}
|
|
10163
10189
|
let SwiperItem = class {
|
|
10164
10190
|
constructor(hostRef) {
|
|
10165
10191
|
index$1.registerInstance(this, hostRef);
|
|
10166
10192
|
}
|
|
10193
|
+
componentDidRender() {
|
|
10194
|
+
var _a, _b, _c;
|
|
10195
|
+
const el = this.el;
|
|
10196
|
+
if (el.classList.contains('swiper-slide-duplicate')) {
|
|
10197
|
+
const list = Array
|
|
10198
|
+
.from(((_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.values()) || [])
|
|
10199
|
+
.filter((e) => e.tagName === 'TARO-SWIPER-ITEM-CORE');
|
|
10200
|
+
if (list.length > 0) {
|
|
10201
|
+
parseChildNodes(el.childNodes, (_c = list[list.indexOf(el) === 0 ? list.length - 2 : 1]) === null || _c === void 0 ? void 0 : _c.childNodes);
|
|
10202
|
+
}
|
|
10203
|
+
}
|
|
10204
|
+
}
|
|
10167
10205
|
render() {
|
|
10168
10206
|
return (index$1.h(index$1.Host, { class: 'swiper-slide', "item-id": this.itemId }));
|
|
10169
10207
|
}
|
|
10208
|
+
get el() { return index$1.getElement(this); }
|
|
10170
10209
|
};
|
|
10171
10210
|
|
|
10172
10211
|
exports.taro_swiper_core = Swiper;
|
|
@@ -1,6 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Component, Element, Host, h, Prop } from '@stencil/core';
|
|
2
|
+
function isEqualTag(a, b) {
|
|
3
|
+
return typeof a.tagName === 'undefined' ? a.nodeType === b.nodeType : a.tagName === b.tagName;
|
|
4
|
+
}
|
|
5
|
+
function parseChildNodes(items, targets) {
|
|
6
|
+
const list = Array.from(targets.values());
|
|
7
|
+
for (let i = 0, j = 0; i < list.length; i++, j++) {
|
|
8
|
+
const target = list[i];
|
|
9
|
+
let item = items.item(j);
|
|
10
|
+
while (item && !isEqualTag(item, target)) {
|
|
11
|
+
item.remove();
|
|
12
|
+
j++;
|
|
13
|
+
item = items.item(j);
|
|
14
|
+
}
|
|
15
|
+
if (item && !item.isEqualNode(target)) {
|
|
16
|
+
parseChildNodes(item.childNodes, target.childNodes);
|
|
17
|
+
}
|
|
18
|
+
while (i === list.length - 1 && j < items.length) {
|
|
19
|
+
j++;
|
|
20
|
+
item = items.item(j);
|
|
21
|
+
item === null || item === void 0 ? void 0 : item.remove();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
3
25
|
export class SwiperItem {
|
|
26
|
+
componentDidRender() {
|
|
27
|
+
var _a, _b, _c;
|
|
28
|
+
const el = this.el;
|
|
29
|
+
if (el.classList.contains('swiper-slide-duplicate')) {
|
|
30
|
+
const list = Array
|
|
31
|
+
.from(((_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.values()) || [])
|
|
32
|
+
.filter((e) => e.tagName === 'TARO-SWIPER-ITEM-CORE');
|
|
33
|
+
if (list.length > 0) {
|
|
34
|
+
parseChildNodes(el.childNodes, (_c = list[list.indexOf(el) === 0 ? list.length - 2 : 1]) === null || _c === void 0 ? void 0 : _c.childNodes);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
4
38
|
render() {
|
|
5
39
|
return (h(Host, { class: 'swiper-slide', "item-id": this.itemId }));
|
|
6
40
|
}
|
|
@@ -24,4 +58,5 @@ export class SwiperItem {
|
|
|
24
58
|
"reflect": false
|
|
25
59
|
}
|
|
26
60
|
}; }
|
|
61
|
+
static get elementRef() { return "el"; }
|
|
27
62
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
1
|
import { Component, h, Prop, Event, Watch, Host, Element, State } from '@stencil/core';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import SwiperJS from 'swiper/swiper-bundle.esm.js';
|
|
@@ -65,12 +64,12 @@ export class Swiper {
|
|
|
65
64
|
*/
|
|
66
65
|
this.zoom = false;
|
|
67
66
|
this.handleSwiperLoopListen = () => {
|
|
68
|
-
var _a, _b;
|
|
67
|
+
var _a, _b, _c;
|
|
69
68
|
((_a = this.observerFirst) === null || _a === void 0 ? void 0 : _a.disconnect) && this.observerFirst.disconnect();
|
|
70
69
|
((_b = this.observerLast) === null || _b === void 0 ? void 0 : _b.disconnect) && this.observerLast.disconnect();
|
|
71
70
|
this.observerFirst = new MutationObserver(this.handleSwiperLoop);
|
|
72
71
|
this.observerLast = new MutationObserver(this.handleSwiperLoop);
|
|
73
|
-
const wrapper = this.swiper.$wrapperEl[0];
|
|
72
|
+
const wrapper = (_c = this.swiper.$wrapperEl) === null || _c === void 0 ? void 0 : _c[0];
|
|
74
73
|
const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)');
|
|
75
74
|
if (list.length >= 1) {
|
|
76
75
|
this.observerFirst.observe(list[0], {
|
|
@@ -86,11 +85,9 @@ export class Swiper {
|
|
|
86
85
|
this.handleSwiperLoop = debounce(() => {
|
|
87
86
|
if (this.swiper && this.circular) {
|
|
88
87
|
// @ts-ignore
|
|
89
|
-
this.swiper.
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
this.swiper.loopCreate();
|
|
88
|
+
this.swiper.loopFix();
|
|
92
89
|
}
|
|
93
|
-
},
|
|
90
|
+
}, 50);
|
|
94
91
|
this.handleSwiperSize = debounce(() => {
|
|
95
92
|
if (this.swiper && !this.circular) {
|
|
96
93
|
this.swiper.updateSlides();
|
|
@@ -115,19 +112,22 @@ export class Swiper {
|
|
|
115
112
|
watchAutoplay(newVal) {
|
|
116
113
|
if (!this.isWillLoadCalled || !this.swiper)
|
|
117
114
|
return;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
const swiperAutoplay = this.swiper.autoplay;
|
|
116
|
+
if (swiperAutoplay) {
|
|
117
|
+
if (swiperAutoplay.running === newVal)
|
|
118
|
+
return;
|
|
119
|
+
if (newVal) {
|
|
120
|
+
if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
|
|
121
|
+
if (this.swiper.params.autoplay.disableOnInteraction === true) {
|
|
122
|
+
this.swiper.params.autoplay.disableOnInteraction = false;
|
|
123
|
+
}
|
|
124
|
+
this.swiper.params.autoplay.delay = this.interval;
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
+
swiperAutoplay.start();
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
swiperAutoplay.stop();
|
|
126
130
|
}
|
|
127
|
-
this.swiper.autoplay.start();
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
this.swiper.autoplay.stop();
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
watchDuration(newVal) {
|
|
@@ -172,20 +172,22 @@ export class Swiper {
|
|
|
172
172
|
this.isWillLoadCalled = true;
|
|
173
173
|
}
|
|
174
174
|
componentDidLoad() {
|
|
175
|
+
var _a;
|
|
175
176
|
this.handleInit();
|
|
176
177
|
if (!this.swiper || !this.circular)
|
|
177
178
|
return;
|
|
178
|
-
const wrapper = this.swiper.$wrapperEl[0];
|
|
179
|
+
const wrapper = (_a = this.swiper.$wrapperEl) === null || _a === void 0 ? void 0 : _a[0];
|
|
179
180
|
this.observer = new MutationObserver(this.handleSwiperLoopListen);
|
|
180
181
|
this.observer.observe(wrapper, {
|
|
181
182
|
childList: true
|
|
182
183
|
});
|
|
183
184
|
}
|
|
184
185
|
componentWillUpdate() {
|
|
186
|
+
var _a, _b;
|
|
185
187
|
if (!this.swiper)
|
|
186
188
|
return;
|
|
187
|
-
if (this.autoplay && !this.swiper.autoplay.running) {
|
|
188
|
-
this.swiper.autoplay.start();
|
|
189
|
+
if (this.autoplay && !((_a = this.swiper.autoplay) === null || _a === void 0 ? void 0 : _a.running)) {
|
|
190
|
+
(_b = this.swiper.autoplay) === null || _b === void 0 ? void 0 : _b.start();
|
|
189
191
|
}
|
|
190
192
|
this.swiper.update(); // 更新子元素
|
|
191
193
|
}
|
|
@@ -222,7 +224,7 @@ export class Swiper {
|
|
|
222
224
|
slideChangeTransitionStart(_swiper) {
|
|
223
225
|
if (that.circular) {
|
|
224
226
|
if (_swiper.isBeginning || _swiper.isEnd) {
|
|
225
|
-
_swiper.slideToLoop(this.realIndex, 0)
|
|
227
|
+
// _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
|
|
226
228
|
return;
|
|
227
229
|
}
|
|
228
230
|
}
|
|
@@ -9918,12 +9918,12 @@ let Swiper = class {
|
|
|
9918
9918
|
*/
|
|
9919
9919
|
this.zoom = false;
|
|
9920
9920
|
this.handleSwiperLoopListen = () => {
|
|
9921
|
-
var _a, _b;
|
|
9921
|
+
var _a, _b, _c;
|
|
9922
9922
|
((_a = this.observerFirst) === null || _a === void 0 ? void 0 : _a.disconnect) && this.observerFirst.disconnect();
|
|
9923
9923
|
((_b = this.observerLast) === null || _b === void 0 ? void 0 : _b.disconnect) && this.observerLast.disconnect();
|
|
9924
9924
|
this.observerFirst = new MutationObserver(this.handleSwiperLoop);
|
|
9925
9925
|
this.observerLast = new MutationObserver(this.handleSwiperLoop);
|
|
9926
|
-
const wrapper = this.swiper.$wrapperEl[0];
|
|
9926
|
+
const wrapper = (_c = this.swiper.$wrapperEl) === null || _c === void 0 ? void 0 : _c[0];
|
|
9927
9927
|
const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)');
|
|
9928
9928
|
if (list.length >= 1) {
|
|
9929
9929
|
this.observerFirst.observe(list[0], {
|
|
@@ -9939,11 +9939,9 @@ let Swiper = class {
|
|
|
9939
9939
|
this.handleSwiperLoop = debounce(() => {
|
|
9940
9940
|
if (this.swiper && this.circular) {
|
|
9941
9941
|
// @ts-ignore
|
|
9942
|
-
this.swiper.
|
|
9943
|
-
// @ts-ignore
|
|
9944
|
-
this.swiper.loopCreate();
|
|
9942
|
+
this.swiper.loopFix();
|
|
9945
9943
|
}
|
|
9946
|
-
},
|
|
9944
|
+
}, 50);
|
|
9947
9945
|
this.handleSwiperSize = debounce(() => {
|
|
9948
9946
|
if (this.swiper && !this.circular) {
|
|
9949
9947
|
this.swiper.updateSlides();
|
|
@@ -9968,19 +9966,22 @@ let Swiper = class {
|
|
|
9968
9966
|
watchAutoplay(newVal) {
|
|
9969
9967
|
if (!this.isWillLoadCalled || !this.swiper)
|
|
9970
9968
|
return;
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9969
|
+
const swiperAutoplay = this.swiper.autoplay;
|
|
9970
|
+
if (swiperAutoplay) {
|
|
9971
|
+
if (swiperAutoplay.running === newVal)
|
|
9972
|
+
return;
|
|
9973
|
+
if (newVal) {
|
|
9974
|
+
if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
|
|
9975
|
+
if (this.swiper.params.autoplay.disableOnInteraction === true) {
|
|
9976
|
+
this.swiper.params.autoplay.disableOnInteraction = false;
|
|
9977
|
+
}
|
|
9978
|
+
this.swiper.params.autoplay.delay = this.interval;
|
|
9977
9979
|
}
|
|
9978
|
-
|
|
9980
|
+
swiperAutoplay.start();
|
|
9981
|
+
}
|
|
9982
|
+
else {
|
|
9983
|
+
swiperAutoplay.stop();
|
|
9979
9984
|
}
|
|
9980
|
-
this.swiper.autoplay.start();
|
|
9981
|
-
}
|
|
9982
|
-
else {
|
|
9983
|
-
this.swiper.autoplay.stop();
|
|
9984
9985
|
}
|
|
9985
9986
|
}
|
|
9986
9987
|
watchDuration(newVal) {
|
|
@@ -10025,20 +10026,22 @@ let Swiper = class {
|
|
|
10025
10026
|
this.isWillLoadCalled = true;
|
|
10026
10027
|
}
|
|
10027
10028
|
componentDidLoad() {
|
|
10029
|
+
var _a;
|
|
10028
10030
|
this.handleInit();
|
|
10029
10031
|
if (!this.swiper || !this.circular)
|
|
10030
10032
|
return;
|
|
10031
|
-
const wrapper = this.swiper.$wrapperEl[0];
|
|
10033
|
+
const wrapper = (_a = this.swiper.$wrapperEl) === null || _a === void 0 ? void 0 : _a[0];
|
|
10032
10034
|
this.observer = new MutationObserver(this.handleSwiperLoopListen);
|
|
10033
10035
|
this.observer.observe(wrapper, {
|
|
10034
10036
|
childList: true
|
|
10035
10037
|
});
|
|
10036
10038
|
}
|
|
10037
10039
|
componentWillUpdate() {
|
|
10040
|
+
var _a, _b;
|
|
10038
10041
|
if (!this.swiper)
|
|
10039
10042
|
return;
|
|
10040
|
-
if (this.autoplay && !this.swiper.autoplay.running) {
|
|
10041
|
-
this.swiper.autoplay.start();
|
|
10043
|
+
if (this.autoplay && !((_a = this.swiper.autoplay) === null || _a === void 0 ? void 0 : _a.running)) {
|
|
10044
|
+
(_b = this.swiper.autoplay) === null || _b === void 0 ? void 0 : _b.start();
|
|
10042
10045
|
}
|
|
10043
10046
|
this.swiper.update(); // 更新子元素
|
|
10044
10047
|
}
|
|
@@ -10075,7 +10078,7 @@ let Swiper = class {
|
|
|
10075
10078
|
slideChangeTransitionStart(_swiper) {
|
|
10076
10079
|
if (that.circular) {
|
|
10077
10080
|
if (_swiper.isBeginning || _swiper.isEnd) {
|
|
10078
|
-
_swiper.slideToLoop(this.realIndex, 0)
|
|
10081
|
+
// _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
|
|
10079
10082
|
return;
|
|
10080
10083
|
}
|
|
10081
10084
|
}
|
|
@@ -10156,13 +10159,49 @@ let Swiper = class {
|
|
|
10156
10159
|
};
|
|
10157
10160
|
Swiper.style = indexCss;
|
|
10158
10161
|
|
|
10162
|
+
function isEqualTag(a, b) {
|
|
10163
|
+
return typeof a.tagName === 'undefined' ? a.nodeType === b.nodeType : a.tagName === b.tagName;
|
|
10164
|
+
}
|
|
10165
|
+
function parseChildNodes(items, targets) {
|
|
10166
|
+
const list = Array.from(targets.values());
|
|
10167
|
+
for (let i = 0, j = 0; i < list.length; i++, j++) {
|
|
10168
|
+
const target = list[i];
|
|
10169
|
+
let item = items.item(j);
|
|
10170
|
+
while (item && !isEqualTag(item, target)) {
|
|
10171
|
+
item.remove();
|
|
10172
|
+
j++;
|
|
10173
|
+
item = items.item(j);
|
|
10174
|
+
}
|
|
10175
|
+
if (item && !item.isEqualNode(target)) {
|
|
10176
|
+
parseChildNodes(item.childNodes, target.childNodes);
|
|
10177
|
+
}
|
|
10178
|
+
while (i === list.length - 1 && j < items.length) {
|
|
10179
|
+
j++;
|
|
10180
|
+
item = items.item(j);
|
|
10181
|
+
item === null || item === void 0 ? void 0 : item.remove();
|
|
10182
|
+
}
|
|
10183
|
+
}
|
|
10184
|
+
}
|
|
10159
10185
|
let SwiperItem = class {
|
|
10160
10186
|
constructor(hostRef) {
|
|
10161
10187
|
registerInstance(this, hostRef);
|
|
10162
10188
|
}
|
|
10189
|
+
componentDidRender() {
|
|
10190
|
+
var _a, _b, _c;
|
|
10191
|
+
const el = this.el;
|
|
10192
|
+
if (el.classList.contains('swiper-slide-duplicate')) {
|
|
10193
|
+
const list = Array
|
|
10194
|
+
.from(((_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.values()) || [])
|
|
10195
|
+
.filter((e) => e.tagName === 'TARO-SWIPER-ITEM-CORE');
|
|
10196
|
+
if (list.length > 0) {
|
|
10197
|
+
parseChildNodes(el.childNodes, (_c = list[list.indexOf(el) === 0 ? list.length - 2 : 1]) === null || _c === void 0 ? void 0 : _c.childNodes);
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
}
|
|
10163
10201
|
render() {
|
|
10164
10202
|
return (h(Host, { class: 'swiper-slide', "item-id": this.itemId }));
|
|
10165
10203
|
}
|
|
10204
|
+
get el() { return getElement(this); }
|
|
10166
10205
|
};
|
|
10167
10206
|
|
|
10168
10207
|
export { Swiper as taro_swiper_core, SwiperItem as taro_swiper_item_core };
|