@tarojs/components-react 4.1.7-beta.1 → 4.1.7-beta.2
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/original/components/button/index.js +87 -0
- package/dist/original/components/button/index.js.map +1 -0
- package/dist/original/components/button/style/index.css +3 -0
- package/dist/original/components/button/style/index.css.map +1 -0
- package/dist/original/components/icon/index.js +36 -0
- package/dist/original/components/icon/index.js.map +1 -0
- package/dist/original/components/icon/style/index.css +3 -0
- package/dist/original/components/icon/style/index.css.map +1 -0
- package/dist/original/components/image/index.js +146 -0
- package/dist/original/components/image/index.js.map +1 -0
- package/dist/original/components/image/style/index.css +3 -0
- package/dist/original/components/image/style/index.css.map +1 -0
- package/dist/original/components/input/index.js +233 -0
- package/dist/original/components/input/index.js.map +1 -0
- package/dist/original/components/input/style/index.css +3 -0
- package/dist/original/components/input/style/index.css.map +1 -0
- package/dist/original/components/picker/index.js +788 -0
- package/dist/original/components/picker/index.js.map +1 -0
- package/dist/original/components/picker/picker-group.js +491 -0
- package/dist/original/components/picker/picker-group.js.map +1 -0
- package/dist/{components/picker/react-style/style.css → original/components/picker/style/index.css} +2 -1
- package/dist/original/components/picker/style/index.css.map +1 -0
- package/dist/original/components/pull-down-refresh/index.js +320 -0
- package/dist/original/components/pull-down-refresh/index.js.map +1 -0
- package/dist/original/components/pull-down-refresh/style/index.css +3 -0
- package/dist/original/components/pull-down-refresh/style/index.css.map +1 -0
- package/dist/original/components/refresher/index.js +7 -0
- package/dist/original/components/refresher/index.js.map +1 -0
- package/dist/original/components/scroll-view/index.js +189 -0
- package/dist/original/components/scroll-view/index.js.map +1 -0
- package/dist/original/components/scroll-view/style/index.css +3 -0
- package/dist/original/components/scroll-view/style/index.css.map +1 -0
- package/dist/original/components/swiper/index.js +461 -0
- package/dist/original/components/swiper/index.js.map +1 -0
- package/dist/original/components/swiper/style/index.css +3 -0
- package/dist/original/components/swiper/style/index.css.map +1 -0
- package/dist/original/components/text/index.js +28 -0
- package/dist/original/components/text/index.js.map +1 -0
- package/dist/original/components/text/style/index.css +3 -0
- package/dist/original/components/text/style/index.css.map +1 -0
- package/dist/original/components/view/index.js +80 -0
- package/dist/original/components/view/index.js.map +1 -0
- package/dist/original/index.css +2 -0
- package/dist/original/index.css.map +1 -0
- package/dist/original/index.js +15 -0
- package/dist/original/index.js.map +1 -0
- package/dist/original/utils/hooks.react.js +15 -0
- package/dist/original/utils/hooks.react.js.map +1 -0
- package/dist/original/utils/index.js +162 -0
- package/dist/original/utils/index.js.map +1 -0
- package/package.json +8 -6
- package/dist/components/picker/react-style/style.css.map +0 -1
- package/dist/components/picker/react-style/style.js +0 -4
- package/dist/components/picker/react-style/style.js.map +0 -1
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import { __rest, __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
|
|
2
|
+
import 'swiper/swiper-bundle.css';
|
|
3
|
+
import './style/index.css';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import React__default from 'react';
|
|
6
|
+
import Swipers from 'swiper/bundle';
|
|
7
|
+
import { debounce, createForwardRefComponent } from '../../utils/index.js';
|
|
8
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
var _SwiperInner_source, _SwiperInner_swiperResetting, _SwiperInner_lastSwiperActiveIndex, _SwiperInner_domChangeByOutSide;
|
|
11
|
+
let INSTANCE_ID = 0;
|
|
12
|
+
const ONE_ADDITIONAL_SLIDES_THRESHOLD = 5;
|
|
13
|
+
const TWO_ADDITIONAL_SLIDES_THRESHOLD = 7;
|
|
14
|
+
const createEvent = type => {
|
|
15
|
+
let e;
|
|
16
|
+
try {
|
|
17
|
+
e = new TouchEvent(type);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
e = document.createEvent('Event');
|
|
20
|
+
e.initEvent(type, true, true);
|
|
21
|
+
}
|
|
22
|
+
return e;
|
|
23
|
+
};
|
|
24
|
+
class SwiperItemInner extends React__default.Component {
|
|
25
|
+
render() {
|
|
26
|
+
const _a = this.props,
|
|
27
|
+
{
|
|
28
|
+
className,
|
|
29
|
+
style,
|
|
30
|
+
itemId,
|
|
31
|
+
children,
|
|
32
|
+
forwardedRef
|
|
33
|
+
} = _a,
|
|
34
|
+
restProps = __rest(_a, ["className", "style", "itemId", "children", "forwardedRef"]);
|
|
35
|
+
const cls = classNames('swiper-slide', className);
|
|
36
|
+
return /*#__PURE__*/jsx("div", {
|
|
37
|
+
ref: e => {
|
|
38
|
+
if (e && forwardedRef) {
|
|
39
|
+
forwardedRef.current = e;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
className: cls,
|
|
43
|
+
style: style,
|
|
44
|
+
"item-id": itemId,
|
|
45
|
+
...restProps,
|
|
46
|
+
children: children
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class SwiperInner extends React__default.Component {
|
|
51
|
+
constructor(props) {
|
|
52
|
+
var _this;
|
|
53
|
+
super(props);
|
|
54
|
+
_this = this;
|
|
55
|
+
this._id = 1 + INSTANCE_ID++;
|
|
56
|
+
_SwiperInner_source.set(this, 'autoplay');
|
|
57
|
+
_SwiperInner_swiperResetting.set(this, false);
|
|
58
|
+
_SwiperInner_lastSwiperActiveIndex.set(this, 0
|
|
59
|
+
// dom 变化是否由外部引起,因为 swiper 的循环模式也会引起 dom 的变化。如果不是由外部引起的 dom 变化,就不需要重新初始化 swiper
|
|
60
|
+
);
|
|
61
|
+
// dom 变化是否由外部引起,因为 swiper 的循环模式也会引起 dom 的变化。如果不是由外部引起的 dom 变化,就不需要重新初始化 swiper
|
|
62
|
+
_SwiperInner_domChangeByOutSide.set(this, false);
|
|
63
|
+
this.handleInit = function () {
|
|
64
|
+
let reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
65
|
+
const {
|
|
66
|
+
autoplay = false,
|
|
67
|
+
circular = true,
|
|
68
|
+
current = 0,
|
|
69
|
+
displayMultipleItems = 1,
|
|
70
|
+
duration = 500,
|
|
71
|
+
interval = 5000,
|
|
72
|
+
currentItemId,
|
|
73
|
+
effectsProps = {},
|
|
74
|
+
vertical
|
|
75
|
+
} = _this.props;
|
|
76
|
+
let initialSlide = parseInt(String(current), 10);
|
|
77
|
+
if (reset) {
|
|
78
|
+
initialSlide = __classPrivateFieldGet(_this, _SwiperInner_lastSwiperActiveIndex, "f");
|
|
79
|
+
} else {
|
|
80
|
+
if (currentItemId) {
|
|
81
|
+
let itemIdIndex = 0;
|
|
82
|
+
_this.getSlidersList().forEach((swiperItem, index) => {
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
if (swiperItem.itemId && swiperItem.itemId === currentItemId) {
|
|
85
|
+
itemIdIndex = index;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
initialSlide = itemIdIndex;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const loopAdditionalSlides = _this.getLoopAdditionalSlides();
|
|
92
|
+
const centeredSlides = displayMultipleItems === 1 && _this.getNeedFixLoop();
|
|
93
|
+
const slidesPerView = displayMultipleItems;
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
95
|
+
const that = _this;
|
|
96
|
+
const opt = Object.assign(Object.assign({
|
|
97
|
+
// 指示器
|
|
98
|
+
pagination: {
|
|
99
|
+
el: `.taro-swiper-${_this._id} > .swiper-container > .swiper-pagination`
|
|
100
|
+
},
|
|
101
|
+
direction: vertical ? 'vertical' : 'horizontal',
|
|
102
|
+
loop: circular,
|
|
103
|
+
slidesPerView: slidesPerView,
|
|
104
|
+
initialSlide,
|
|
105
|
+
speed: parseInt(String(duration), 10),
|
|
106
|
+
observer: true,
|
|
107
|
+
observeParents: true,
|
|
108
|
+
nested: true,
|
|
109
|
+
loopAdditionalSlides,
|
|
110
|
+
centeredSlides,
|
|
111
|
+
touchReleaseOnEdges: true,
|
|
112
|
+
threshold: 0
|
|
113
|
+
}, effectsProps), {
|
|
114
|
+
on: {
|
|
115
|
+
init(_swiper) {
|
|
116
|
+
that.getNeedFixLoop() && _swiper.loopFix();
|
|
117
|
+
that.props.autoplay && _swiper.autoplay.start();
|
|
118
|
+
},
|
|
119
|
+
transitionEnd(_swiper) {
|
|
120
|
+
if (__classPrivateFieldGet(that, _SwiperInner_swiperResetting, "f") || __classPrivateFieldGet(that, _SwiperInner_lastSwiperActiveIndex, "f") === _swiper.realIndex) return;
|
|
121
|
+
__classPrivateFieldSet(that, _SwiperInner_lastSwiperActiveIndex, _swiper.realIndex, "f");
|
|
122
|
+
that.getNeedFixLoop() && _swiper.loopFix();
|
|
123
|
+
that.props.autoplay && _swiper.autoplay.start();
|
|
124
|
+
const e = createEvent('touchend');
|
|
125
|
+
try {
|
|
126
|
+
const currentId = that.getCurrentId(_swiper);
|
|
127
|
+
Object.defineProperty(e, 'detail', {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
value: {
|
|
130
|
+
source: __classPrivateFieldGet(that, _SwiperInner_source, "f"),
|
|
131
|
+
current: this.realIndex,
|
|
132
|
+
currentId: currentId
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
} catch (err) {} // eslint-disable-line no-empty
|
|
136
|
+
that.handleOnAnimationFinish(e);
|
|
137
|
+
__classPrivateFieldSet(that, _SwiperInner_source, 'autoplay', "f");
|
|
138
|
+
},
|
|
139
|
+
touchMove() {
|
|
140
|
+
__classPrivateFieldSet(that, _SwiperInner_source, 'touch', "f");
|
|
141
|
+
},
|
|
142
|
+
touchEnd: _swiper => {
|
|
143
|
+
__classPrivateFieldSet(that, _SwiperInner_source, 'touch', "f");
|
|
144
|
+
that.props.autoplay && _swiper.autoplay.start();
|
|
145
|
+
},
|
|
146
|
+
touchStart: _swiper => {
|
|
147
|
+
__classPrivateFieldSet(that, _SwiperInner_source, 'touch', "f");
|
|
148
|
+
that.props.autoplay && _swiper.autoplay.pause();
|
|
149
|
+
},
|
|
150
|
+
slideChange(_swiper) {
|
|
151
|
+
if (__classPrivateFieldGet(that, _SwiperInner_swiperResetting, "f") || __classPrivateFieldGet(that, _SwiperInner_lastSwiperActiveIndex, "f") === _swiper.realIndex) return;
|
|
152
|
+
const e = createEvent('touchend');
|
|
153
|
+
try {
|
|
154
|
+
const currentId = that.getCurrentId(_swiper);
|
|
155
|
+
Object.defineProperty(e, 'detail', {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
value: {
|
|
158
|
+
current: this.realIndex,
|
|
159
|
+
source: __classPrivateFieldGet(that, _SwiperInner_source, "f"),
|
|
160
|
+
currentId
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
} catch (err) {} // eslint-disable-line no-empty
|
|
164
|
+
that.handleOnChange(e);
|
|
165
|
+
},
|
|
166
|
+
autoplay(_swiper) {
|
|
167
|
+
// Note: 修复 autoplay 时,切换到其他页面再切回来,autoplay 会停止的问题
|
|
168
|
+
_swiper.animating = false;
|
|
169
|
+
__classPrivateFieldSet(that, _SwiperInner_source, 'autoplay', "f");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
// 自动播放
|
|
174
|
+
if (autoplay) {
|
|
175
|
+
opt.autoplay = {
|
|
176
|
+
delay: parseInt(String(interval), 10),
|
|
177
|
+
disableOnInteraction: false
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
_this.swiper = new Swipers(_this.$el, opt);
|
|
181
|
+
// Note: 这里是拦截了 swiper 的 minTranslate 和 maxTranslate 方法,手动修复了 loop 模式下的 margin 问题
|
|
182
|
+
// 因为这两个属性会影响滑动到哪个位置进行 fixloop
|
|
183
|
+
// 可参考源码:https://github.com/nolimits4web/swiper/blob/v11.1.0/src/core/events/onTouchMove.mjs
|
|
184
|
+
// https://github.com/nolimits4web/swiper/blob/v11.1.0/src/core/loop/loopFix.mjs
|
|
185
|
+
if (_this.getNeedFixLoop()) {
|
|
186
|
+
// @ts-ignore
|
|
187
|
+
const minTranslate = _this.swiper.minTranslate.bind(_this.swiper);
|
|
188
|
+
// @ts-ignore
|
|
189
|
+
const maxTranslate = _this.swiper.maxTranslate.bind(_this.swiper);
|
|
190
|
+
if (centeredSlides && _this.getSlidersList().length < 4) {
|
|
191
|
+
// @ts-ignore
|
|
192
|
+
_this.swiper.minTranslate = () => minTranslate() + _this.parseMargin()[1];
|
|
193
|
+
// @ts-ignore
|
|
194
|
+
_this.swiper.maxTranslate = () => maxTranslate() - _this.parseMargin()[0];
|
|
195
|
+
} else {
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
_this.swiper.minTranslate = () => minTranslate() - _this.parseMargin()[0];
|
|
198
|
+
// @ts-ignore
|
|
199
|
+
_this.swiper.maxTranslate = () => maxTranslate() + _this.parseMargin()[1];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
_this.setState({
|
|
203
|
+
swiperWrapper: _this.swiper.wrapperEl
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
this.handleSwiperSizeDebounce = debounce(() => {
|
|
207
|
+
if (!this.swiper) return;
|
|
208
|
+
if (this.props.circular) {
|
|
209
|
+
if (__classPrivateFieldGet(this, _SwiperInner_domChangeByOutSide, "f")) {
|
|
210
|
+
this.reset();
|
|
211
|
+
__classPrivateFieldSet(this, _SwiperInner_domChangeByOutSide, false, "f");
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
this.swiper.update();
|
|
215
|
+
__classPrivateFieldSet(this, _SwiperInner_swiperResetting, false, "f");
|
|
216
|
+
}
|
|
217
|
+
}, 50);
|
|
218
|
+
this.reset = () => {
|
|
219
|
+
if (!this.swiper) return;
|
|
220
|
+
__classPrivateFieldSet(this, _SwiperInner_swiperResetting, true, "f");
|
|
221
|
+
__classPrivateFieldSet(this, _SwiperInner_lastSwiperActiveIndex, this.swiper.realIndex, "f");
|
|
222
|
+
this.swiper.destroy();
|
|
223
|
+
this.handleInit(true);
|
|
224
|
+
__classPrivateFieldSet(this, _SwiperInner_swiperResetting, false, "f");
|
|
225
|
+
};
|
|
226
|
+
// 以下为方法函数
|
|
227
|
+
this.getSlidersList = () => {
|
|
228
|
+
var _a, _b;
|
|
229
|
+
return ((_b = (_a = this.$el) === null || _a === void 0 ? void 0 : _a.querySelectorAll) === null || _b === void 0 ? void 0 : _b.call(_a, '.swiper-slide')) || [];
|
|
230
|
+
};
|
|
231
|
+
// 获取是否需要手动修复 loop 的条件
|
|
232
|
+
this.getNeedFixLoop = () => {
|
|
233
|
+
const margins = this.parseMargin();
|
|
234
|
+
const hasMargin = margins.filter(Boolean).length > 0;
|
|
235
|
+
return this.props.circular && hasMargin;
|
|
236
|
+
};
|
|
237
|
+
this.parseMargin = () => {
|
|
238
|
+
const {
|
|
239
|
+
previousMargin = '0px',
|
|
240
|
+
nextMargin = '0px'
|
|
241
|
+
} = this.props;
|
|
242
|
+
const [, pM] = /^(\d+)px/.exec(previousMargin) || [];
|
|
243
|
+
const [, nN] = /^(\d+)px/.exec(nextMargin) || [];
|
|
244
|
+
return [parseInt(pM) || 0, parseInt(nN) || 0];
|
|
245
|
+
};
|
|
246
|
+
this.state = {
|
|
247
|
+
swiperWrapper: null
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
componentDidMount() {
|
|
251
|
+
this.handleInit();
|
|
252
|
+
}
|
|
253
|
+
hackSwiperWrapDomAction() {
|
|
254
|
+
if (!this.state.swiperWrapper || !this.swiper) return;
|
|
255
|
+
const appendChild = this.state.swiperWrapper.appendChild.bind(this.state.swiperWrapper);
|
|
256
|
+
const removeChild = this.state.swiperWrapper.removeChild.bind(this.state.swiperWrapper);
|
|
257
|
+
const replaceChild = this.state.swiperWrapper.replaceChild.bind(this.state.swiperWrapper);
|
|
258
|
+
const insertBefore = this.state.swiperWrapper.insertBefore.bind(this.state.swiperWrapper);
|
|
259
|
+
const beforeAction = () => {
|
|
260
|
+
if (!this.state.swiperWrapper || !this.swiper) return;
|
|
261
|
+
__classPrivateFieldSet(this, _SwiperInner_swiperResetting, true, "f");
|
|
262
|
+
if (!__classPrivateFieldGet(this, _SwiperInner_domChangeByOutSide, "f") && this.props.circular) {
|
|
263
|
+
// 如果是由于外部子节点的变化引起的 dom 变化,需要重新初始化 swiper。
|
|
264
|
+
// 在初dom操作之前,需要调用 loopDestroy,把子节点的顺序恢复
|
|
265
|
+
__classPrivateFieldSet(this, _SwiperInner_domChangeByOutSide, true, "f");
|
|
266
|
+
this.swiper.loopDestroy();
|
|
267
|
+
this.swiper.params.loop = false;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
// eslint-disable-next-line react/no-direct-mutation-state
|
|
271
|
+
this.state.swiperWrapper.appendChild = function () {
|
|
272
|
+
beforeAction();
|
|
273
|
+
return appendChild(...arguments);
|
|
274
|
+
};
|
|
275
|
+
// eslint-disable-next-line react/no-direct-mutation-state
|
|
276
|
+
this.state.swiperWrapper.removeChild = function () {
|
|
277
|
+
beforeAction();
|
|
278
|
+
return removeChild(...arguments);
|
|
279
|
+
};
|
|
280
|
+
// eslint-disable-next-line react/no-direct-mutation-state
|
|
281
|
+
this.state.swiperWrapper.replaceChild = function () {
|
|
282
|
+
beforeAction();
|
|
283
|
+
return replaceChild(...arguments);
|
|
284
|
+
};
|
|
285
|
+
// eslint-disable-next-line react/no-direct-mutation-state
|
|
286
|
+
this.state.swiperWrapper.insertBefore = function () {
|
|
287
|
+
beforeAction();
|
|
288
|
+
return insertBefore(...arguments);
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
componentDidUpdate(prevProps, pervState) {
|
|
292
|
+
if (!this.swiper || !this.state.swiperWrapper) return;
|
|
293
|
+
if (pervState.swiperWrapper !== this.state.swiperWrapper && this.state.swiperWrapper) {
|
|
294
|
+
this.observer && this.observer.disconnect();
|
|
295
|
+
this.observer = new MutationObserver(this.handleSwiperSizeDebounce);
|
|
296
|
+
this.observer.observe(this.state.swiperWrapper, {
|
|
297
|
+
childList: true
|
|
298
|
+
});
|
|
299
|
+
this.hackSwiperWrapDomAction();
|
|
300
|
+
}
|
|
301
|
+
if (prevProps.circular !== this.props.circular || prevProps.displayMultipleItems !== this.props.displayMultipleItems) {
|
|
302
|
+
this.reset();
|
|
303
|
+
}
|
|
304
|
+
if (prevProps.interval !== this.props.interval) {
|
|
305
|
+
if (typeof this.swiper.params.autoplay === 'object') {
|
|
306
|
+
this.swiper.params.autoplay.delay = this.props.interval;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (prevProps.duration !== this.props.duration) {
|
|
310
|
+
this.swiper.params.speed = this.props.duration;
|
|
311
|
+
}
|
|
312
|
+
if (prevProps.current !== this.props.current && !this.props.currentItemId) {
|
|
313
|
+
const n = parseInt(String(this.props.current), 10);
|
|
314
|
+
if (isNaN(n) || n === this.swiper.realIndex) return;
|
|
315
|
+
__classPrivateFieldSet(this, _SwiperInner_source, '', "f");
|
|
316
|
+
if (this.props.circular) {
|
|
317
|
+
this.swiper.slideToLoop(n); // 更新下标
|
|
318
|
+
this.props.autoplay && this.swiper.autoplay.pause();
|
|
319
|
+
// @ts-ignore
|
|
320
|
+
this.swiper.loopFix();
|
|
321
|
+
this.props.autoplay && this.swiper.autoplay.start();
|
|
322
|
+
} else {
|
|
323
|
+
this.swiper.slideTo(n); // 更新下标
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (prevProps.autoplay !== this.props.autoplay) {
|
|
327
|
+
const swiperAutoplay = this.swiper.autoplay;
|
|
328
|
+
if (swiperAutoplay) {
|
|
329
|
+
if (swiperAutoplay.running === this.props.autoplay) return;
|
|
330
|
+
if (this.props.autoplay) {
|
|
331
|
+
if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
|
|
332
|
+
if (this.swiper.params.autoplay.disableOnInteraction === true) {
|
|
333
|
+
this.swiper.params.autoplay.disableOnInteraction = false;
|
|
334
|
+
}
|
|
335
|
+
this.swiper.params.autoplay.delay = this.props.interval;
|
|
336
|
+
}
|
|
337
|
+
swiperAutoplay.start();
|
|
338
|
+
} else {
|
|
339
|
+
swiperAutoplay.stop();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (prevProps.currentItemId !== this.props.currentItemId) {
|
|
344
|
+
let itemIdIndex = 0;
|
|
345
|
+
this.getSlidersList().forEach((swiperItem, index) => {
|
|
346
|
+
const itemId = swiperItem.getAttribute('item-id');
|
|
347
|
+
// @ts-ignore
|
|
348
|
+
if (itemId === this.props.currentItemId) {
|
|
349
|
+
if (this.props.circular) {
|
|
350
|
+
itemIdIndex = Number(swiperItem.getAttribute('data-swiper-slide-index'));
|
|
351
|
+
} else {
|
|
352
|
+
itemIdIndex = index;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
if (isNaN(itemIdIndex) || itemIdIndex === this.swiper.realIndex) return;
|
|
357
|
+
__classPrivateFieldSet(this, _SwiperInner_source, '', "f");
|
|
358
|
+
if (this.props.circular) {
|
|
359
|
+
this.swiper.slideToLoop(itemIdIndex); // 更新下标
|
|
360
|
+
this.props.autoplay && this.swiper.autoplay.pause();
|
|
361
|
+
// @ts-ignore
|
|
362
|
+
this.swiper.loopFix();
|
|
363
|
+
this.props.autoplay && this.swiper.autoplay.start();
|
|
364
|
+
} else {
|
|
365
|
+
this.swiper.slideTo(itemIdIndex); // 更新下标
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
componentWillUnmount() {
|
|
370
|
+
var _a, _b, _c, _d;
|
|
371
|
+
this.$el = null;
|
|
372
|
+
(_b = (_a = this.swiper) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
373
|
+
(_d = (_c = this.observer) === null || _c === void 0 ? void 0 : _c.disconnect) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
374
|
+
this.setState({
|
|
375
|
+
swiperWrapper: null
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
handleOnChange(e) {
|
|
379
|
+
const func = this.props.onChange;
|
|
380
|
+
typeof func === 'function' && func(e);
|
|
381
|
+
}
|
|
382
|
+
handleOnAnimationFinish(e) {
|
|
383
|
+
const func = this.props.onAnimationFinish;
|
|
384
|
+
typeof func === 'function' && func(e);
|
|
385
|
+
}
|
|
386
|
+
// Note: loop 的时候添加 additionalSlides 可以避免循环的时候由于 loopFix 不及时,出现空白的问题。但是并不是 additionalSlides 越多越好,因为 additionalSlides 越多,如果 swiper-item 的数量不够,会导致出现 bug。
|
|
387
|
+
// 目前的策略是 swiper-item 的数量小于等于 5 时,不添加 additionalSlides,大于 5 小于等于 7 时,添加 1 个 additionalSlides,大于 7 时,添加 2 个 additionalSlides。
|
|
388
|
+
getLoopAdditionalSlides() {
|
|
389
|
+
const slidersLength = this.getSlidersList().length;
|
|
390
|
+
if (!this.$el || !this.getNeedFixLoop() || slidersLength < ONE_ADDITIONAL_SLIDES_THRESHOLD) return 0;
|
|
391
|
+
if (slidersLength <= TWO_ADDITIONAL_SLIDES_THRESHOLD) return 1;
|
|
392
|
+
return 2;
|
|
393
|
+
}
|
|
394
|
+
getCurrentId(swiper) {
|
|
395
|
+
const slides = swiper.slides;
|
|
396
|
+
const activeIndex = swiper.activeIndex;
|
|
397
|
+
const currentSlide = slides[activeIndex];
|
|
398
|
+
return currentSlide.getAttribute('item-id');
|
|
399
|
+
}
|
|
400
|
+
render() {
|
|
401
|
+
const {
|
|
402
|
+
className,
|
|
403
|
+
style,
|
|
404
|
+
vertical,
|
|
405
|
+
indicatorColor,
|
|
406
|
+
indicatorActiveColor,
|
|
407
|
+
forwardedRef
|
|
408
|
+
} = this.props;
|
|
409
|
+
const defaultIndicatorColor = indicatorColor || 'rgba(0, 0, 0, .3)';
|
|
410
|
+
const defaultIndicatorActiveColor = indicatorActiveColor || '#000';
|
|
411
|
+
const [pM, nM] = this.parseMargin();
|
|
412
|
+
const cls = classNames(`taro-swiper-${this._id}`, className);
|
|
413
|
+
const sty = Object.assign({
|
|
414
|
+
overflow: 'hidden'
|
|
415
|
+
}, style);
|
|
416
|
+
if (this.props.full) {
|
|
417
|
+
sty.height = '100%';
|
|
418
|
+
}
|
|
419
|
+
const swiperContainerStyleList = ['overflow: visible;', vertical ? `margin-top: ${pM}px; margin-bottom: ${nM}px;` : `margin-right: ${nM}px; margin-left: ${pM}px;`, this.props.full ? 'height: 100%;' : ''];
|
|
420
|
+
const swiperPaginationStyleList = [this.props.indicatorDots ? 'opacity: 1;' : 'display: none;', 'font-size: 0;'];
|
|
421
|
+
return /*#__PURE__*/jsx("div", {
|
|
422
|
+
className: `swiper-container-wrapper ${cls}`,
|
|
423
|
+
style: sty,
|
|
424
|
+
ref: e => {
|
|
425
|
+
if (forwardedRef && e) {
|
|
426
|
+
forwardedRef.current = e;
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
430
|
+
className: "swiper-container",
|
|
431
|
+
style: {
|
|
432
|
+
overflow: 'visible'
|
|
433
|
+
},
|
|
434
|
+
ref: el => {
|
|
435
|
+
this.$el = el;
|
|
436
|
+
},
|
|
437
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
438
|
+
dangerouslySetInnerHTML: {
|
|
439
|
+
__html: `<style type='text/css'>
|
|
440
|
+
.taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet { background: ${defaultIndicatorColor} }
|
|
441
|
+
.taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet-active { background: ${defaultIndicatorActiveColor} }
|
|
442
|
+
.taro-swiper-${this._id} > .swiper-container { ${swiperContainerStyleList.join('')} }
|
|
443
|
+
.taro-swiper-${this._id} > .swiper-container > .swiper-pagination { ${swiperPaginationStyleList.join('')} }
|
|
444
|
+
</style>`
|
|
445
|
+
}
|
|
446
|
+
}), /*#__PURE__*/jsx("div", {
|
|
447
|
+
className: "swiper-wrapper",
|
|
448
|
+
children: this.props.children
|
|
449
|
+
}), /*#__PURE__*/jsx("div", {
|
|
450
|
+
className: "swiper-pagination"
|
|
451
|
+
})]
|
|
452
|
+
})
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
_SwiperInner_source = new WeakMap(), _SwiperInner_swiperResetting = new WeakMap(), _SwiperInner_lastSwiperActiveIndex = new WeakMap(), _SwiperInner_domChangeByOutSide = new WeakMap();
|
|
457
|
+
const Swiper = createForwardRefComponent(SwiperInner);
|
|
458
|
+
const SwiperItem = createForwardRefComponent(SwiperItemInner);
|
|
459
|
+
|
|
460
|
+
export { Swiper, SwiperItem };
|
|
461
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/swiper/index.tsx"],"sourcesContent":["import 'swiper/swiper-bundle.css'\nimport './style/index.css'\n\nimport classNames from 'classnames'\nimport React from 'react'\nimport Swipers from 'swiper/bundle'\n\nimport { createForwardRefComponent, debounce } from '../../utils'\n\nimport type ISwiper from 'swiper'\n\nlet INSTANCE_ID = 0\nconst ONE_ADDITIONAL_SLIDES_THRESHOLD = 5\nconst TWO_ADDITIONAL_SLIDES_THRESHOLD = 7\n\ninterface SwiperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n itemId: string\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n}\n\ninterface SwiperProps extends React.HTMLAttributes<HTMLDivElement> {\n autoplay?: boolean\n interval?: number\n duration?: number\n current?: number\n displayMultipleItems?: number\n circular?: boolean\n vertical?: boolean\n spaceBetween?: any\n previousMargin?: string\n nextMargin?: string\n indicatorColor?: string\n indicatorActiveColor?: string\n indicatorDots?: boolean\n currentItemId?: string\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n full?: boolean\n onAnimationFinish?: (e: TouchEvent) => void\n effectsProps?: Record<string, any>\n}\n\nconst createEvent = (type: string) => {\n let e\n try {\n e = new TouchEvent(type)\n } catch (err) {\n e = document.createEvent('Event')\n e.initEvent(type, true, true)\n }\n return e\n}\n\nclass SwiperItemInner extends React.Component<SwiperItemProps, Record<string, unknown>> {\n render () {\n const { className, style, itemId, children, forwardedRef, ...restProps } = this.props\n const cls = classNames('swiper-slide', className)\n return (\n <div\n ref={(e) => {\n if (e && forwardedRef) {\n forwardedRef.current = e\n }\n }}\n className={cls}\n style={style}\n item-id={itemId}\n {...restProps}\n >\n {children}\n </div>\n )\n }\n}\n\ninterface SwiperState {\n swiperWrapper: HTMLElement | null\n}\n\nclass SwiperInner extends React.Component<SwiperProps, SwiperState> {\n _id = 1 + INSTANCE_ID++\n #source = 'autoplay'\n #swiperResetting: boolean = false\n #lastSwiperActiveIndex: number = 0\n // dom 变化是否由外部引起,因为 swiper 的循环模式也会引起 dom 的变化。如果不是由外部引起的 dom 变化,就不需要重新初始化 swiper\n #domChangeByOutSide: boolean = false\n $el: HTMLDivElement | null\n swiper: ISwiper| null\n observer: MutationObserver\n\n constructor(props) {\n super(props)\n this.state = {\n swiperWrapper: null\n }\n }\n\n componentDidMount () {\n this.handleInit()\n }\n\n hackSwiperWrapDomAction () {\n if (!this.state.swiperWrapper || !this.swiper) return\n const appendChild = this.state.swiperWrapper.appendChild.bind(this.state.swiperWrapper)\n const removeChild = this.state.swiperWrapper.removeChild.bind(this.state.swiperWrapper)\n const replaceChild = this.state.swiperWrapper.replaceChild.bind(this.state.swiperWrapper)\n const insertBefore = this.state.swiperWrapper.insertBefore.bind(this.state.swiperWrapper)\n\n const beforeAction = () => {\n if (!this.state.swiperWrapper || !this.swiper) return\n this.#swiperResetting = true\n if (!this.#domChangeByOutSide && this.props.circular) {\n // 如果是由于外部子节点的变化引起的 dom 变化,需要重新初始化 swiper。\n // 在初dom操作之前,需要调用 loopDestroy,把子节点的顺序恢复\n this.#domChangeByOutSide = true\n this.swiper.loopDestroy()\n this.swiper.params.loop = false\n }\n }\n\n // eslint-disable-next-line react/no-direct-mutation-state\n this.state.swiperWrapper.appendChild = (...args) => {\n beforeAction()\n return appendChild(...args)\n }\n\n // eslint-disable-next-line react/no-direct-mutation-state\n this.state.swiperWrapper.removeChild = (...args) => {\n beforeAction()\n return removeChild(...args)\n }\n\n // eslint-disable-next-line react/no-direct-mutation-state\n this.state.swiperWrapper.replaceChild = (...args) => {\n beforeAction()\n return replaceChild(...args)\n }\n\n // eslint-disable-next-line react/no-direct-mutation-state\n this.state.swiperWrapper.insertBefore = (...args) => {\n beforeAction()\n return insertBefore(...args)\n }\n }\n\n handleInit = (reset = false) => {\n const {\n autoplay = false,\n circular = true,\n current = 0,\n displayMultipleItems = 1,\n duration = 500,\n interval = 5000,\n currentItemId,\n effectsProps = {},\n vertical\n } = this.props\n\n let initialSlide = parseInt(String(current), 10)\n if (reset) {\n initialSlide = this.#lastSwiperActiveIndex\n } else {\n if (currentItemId) {\n let itemIdIndex = 0\n this.getSlidersList().forEach((swiperItem, index) => {\n // @ts-ignore\n if (swiperItem.itemId && swiperItem.itemId === currentItemId) {\n itemIdIndex = index\n }\n })\n initialSlide = itemIdIndex\n }\n }\n\n const loopAdditionalSlides = this.getLoopAdditionalSlides()\n const centeredSlides = displayMultipleItems === 1 && this.getNeedFixLoop()\n const slidesPerView = displayMultipleItems\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this\n const opt: Record<string, any> = {\n // 指示器\n pagination: { el: `.taro-swiper-${this._id} > .swiper-container > .swiper-pagination` },\n direction: vertical ? 'vertical' : 'horizontal',\n loop: circular,\n slidesPerView: slidesPerView,\n initialSlide,\n speed: parseInt(String(duration), 10),\n observer: true,\n observeParents: true,\n nested: true,\n loopAdditionalSlides,\n centeredSlides,\n touchReleaseOnEdges: true,\n threshold: 0,\n ...effectsProps,\n on: {\n init (_swiper) {\n that.getNeedFixLoop() && _swiper.loopFix()\n that.props.autoplay && _swiper.autoplay.start()\n },\n transitionEnd (_swiper) {\n if (that.#swiperResetting || that.#lastSwiperActiveIndex === _swiper.realIndex) return\n that.#lastSwiperActiveIndex = _swiper.realIndex\n that.getNeedFixLoop() && _swiper.loopFix()\n that.props.autoplay && _swiper.autoplay.start()\n const e = createEvent('touchend')\n try {\n const currentId = that.getCurrentId(_swiper)\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n value: {\n source: that.#source,\n current: this.realIndex,\n currentId: currentId\n }\n })\n } catch (err) {} // eslint-disable-line no-empty\n that.handleOnAnimationFinish(e)\n that.#source = 'autoplay'\n },\n touchMove () {\n that.#source = 'touch'\n },\n touchEnd: (_swiper) => {\n that.#source = 'touch'\n that.props.autoplay && _swiper.autoplay.start()\n },\n touchStart: (_swiper) => {\n that.#source = 'touch'\n that.props.autoplay && _swiper.autoplay.pause()\n },\n slideChange (_swiper) {\n if (that.#swiperResetting || that.#lastSwiperActiveIndex === _swiper.realIndex) return\n const e = createEvent('touchend')\n try {\n const currentId = that.getCurrentId(_swiper)\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n value: {\n current: this.realIndex,\n source: that.#source,\n currentId,\n }\n })\n } catch (err) {} // eslint-disable-line no-empty\n that.handleOnChange(e)\n },\n autoplay (_swiper) {\n // Note: 修复 autoplay 时,切换到其他页面再切回来,autoplay 会停止的问题\n _swiper.animating = false\n that.#source = 'autoplay'\n }\n }\n }\n\n // 自动播放\n if (autoplay) {\n opt.autoplay = {\n delay: parseInt(String(interval), 10),\n disableOnInteraction: false\n }\n }\n\n this.swiper = new Swipers(this.$el!, opt)\n\n // Note: 这里是拦截了 swiper 的 minTranslate 和 maxTranslate 方法,手动修复了 loop 模式下的 margin 问题\n // 因为这两个属性会影响滑动到哪个位置进行 fixloop\n // 可参考源码:https://github.com/nolimits4web/swiper/blob/v11.1.0/src/core/events/onTouchMove.mjs\n // https://github.com/nolimits4web/swiper/blob/v11.1.0/src/core/loop/loopFix.mjs\n if (this.getNeedFixLoop()) {\n // @ts-ignore\n const minTranslate = this.swiper.minTranslate.bind(this.swiper)\n // @ts-ignore\n const maxTranslate = this.swiper.maxTranslate.bind(this.swiper)\n if (centeredSlides && this.getSlidersList().length < 4) {\n // @ts-ignore\n this.swiper.minTranslate = () => minTranslate() + this.parseMargin()[1]\n // @ts-ignore\n this.swiper.maxTranslate = () => maxTranslate() - this.parseMargin()[0]\n } else {\n // @ts-ignore\n this.swiper.minTranslate = () => minTranslate() - this.parseMargin()[0]\n // @ts-ignore\n this.swiper.maxTranslate = () => maxTranslate() + this.parseMargin()[1]\n }\n }\n\n this.setState({\n swiperWrapper: this.swiper.wrapperEl\n })\n }\n\n componentDidUpdate (prevProps, pervState) {\n if (!this.swiper || !this.state.swiperWrapper) return\n if (pervState.swiperWrapper !== this.state.swiperWrapper && this.state.swiperWrapper) {\n this.observer && this.observer.disconnect()\n this.observer = new MutationObserver(this.handleSwiperSizeDebounce)\n this.observer.observe(this.state.swiperWrapper as Node, {\n childList: true\n })\n this.hackSwiperWrapDomAction()\n }\n\n if (prevProps.circular !== this.props.circular || prevProps.displayMultipleItems !== this.props.displayMultipleItems) {\n this.reset()\n }\n\n if (prevProps.interval !== this.props.interval) {\n if (typeof this.swiper.params.autoplay === 'object') {\n this.swiper.params.autoplay.delay = this.props.interval\n }\n }\n\n if (prevProps.duration !== this.props.duration) {\n this.swiper.params.speed = this.props.duration\n }\n\n if (prevProps.current !== this.props.current && !this.props.currentItemId) {\n const n = parseInt(String(this.props.current), 10)\n if (isNaN(n) || n === this.swiper.realIndex) return\n this.#source = ''\n if (this.props.circular) {\n this.swiper.slideToLoop(n) // 更新下标\n this.props.autoplay && this.swiper.autoplay.pause()\n // @ts-ignore\n this.swiper.loopFix()\n this.props.autoplay && this.swiper.autoplay.start()\n } else {\n this.swiper.slideTo(n) // 更新下标\n }\n }\n\n if (prevProps.autoplay !== this.props.autoplay) {\n const swiperAutoplay = this.swiper.autoplay\n if (swiperAutoplay) {\n if (swiperAutoplay.running === this.props.autoplay) return\n\n if (this.props.autoplay) {\n if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {\n if (this.swiper.params.autoplay.disableOnInteraction === true) {\n this.swiper.params.autoplay.disableOnInteraction = false\n }\n this.swiper.params.autoplay.delay = this.props.interval\n }\n swiperAutoplay.start()\n } else {\n swiperAutoplay.stop()\n }\n }\n }\n\n if (prevProps.currentItemId !== this.props.currentItemId) {\n let itemIdIndex = 0\n this.getSlidersList().forEach((swiperItem, index) => {\n const itemId = swiperItem.getAttribute('item-id')\n // @ts-ignore\n if (itemId === this.props.currentItemId) {\n if (this.props.circular) {\n itemIdIndex = Number(swiperItem.getAttribute('data-swiper-slide-index'))\n } else {\n itemIdIndex = index\n }\n }\n })\n if (isNaN(itemIdIndex) || itemIdIndex === this.swiper.realIndex) return\n this.#source = ''\n if (this.props.circular) {\n this.swiper.slideToLoop(itemIdIndex) // 更新下标\n this.props.autoplay && this.swiper.autoplay.pause()\n // @ts-ignore\n this.swiper.loopFix()\n this.props.autoplay && this.swiper.autoplay.start()\n } else {\n this.swiper.slideTo(itemIdIndex) // 更新下标\n }\n }\n }\n\n componentWillUnmount () {\n this.$el = null\n this.swiper?.destroy?.()\n this.observer?.disconnect?.()\n this.setState({\n swiperWrapper: null\n })\n }\n\n handleOnChange (e: React.FormEvent<HTMLDivElement>) {\n const func = this.props.onChange\n typeof func === 'function' && func(e)\n }\n\n handleOnAnimationFinish (e: TouchEvent) {\n const func = this.props.onAnimationFinish\n typeof func === 'function' && func(e)\n }\n\n handleSwiperSizeDebounce = debounce(() => {\n if (!this.swiper) return\n if (this.props.circular) {\n if (this.#domChangeByOutSide) {\n this.reset()\n this.#domChangeByOutSide = false\n }\n } else {\n this.swiper.update()\n this.#swiperResetting = false\n }\n }, 50)\n\n\n reset = () => {\n if (!this.swiper) return\n this.#swiperResetting = true\n this.#lastSwiperActiveIndex = this.swiper.realIndex\n this.swiper.destroy()\n this.handleInit(true)\n this.#swiperResetting = false\n }\n\n // 以下为方法函数\n getSlidersList = () => this.$el?.querySelectorAll?.('.swiper-slide') || []\n\n // 获取是否需要手动修复 loop 的条件\n getNeedFixLoop = () => {\n const margins = this.parseMargin()\n const hasMargin = margins.filter(Boolean).length > 0\n return this.props.circular && hasMargin\n }\n\n // Note: loop 的时候添加 additionalSlides 可以避免循环的时候由于 loopFix 不及时,出现空白的问题。但是并不是 additionalSlides 越多越好,因为 additionalSlides 越多,如果 swiper-item 的数量不够,会导致出现 bug。\n // 目前的策略是 swiper-item 的数量小于等于 5 时,不添加 additionalSlides,大于 5 小于等于 7 时,添加 1 个 additionalSlides,大于 7 时,添加 2 个 additionalSlides。\n getLoopAdditionalSlides():number {\n const slidersLength = (this.getSlidersList()).length\n if (!this.$el || !this.getNeedFixLoop() || slidersLength < ONE_ADDITIONAL_SLIDES_THRESHOLD) return 0\n if (slidersLength <= TWO_ADDITIONAL_SLIDES_THRESHOLD) return 1\n return 2\n }\n\n parseMargin = () => {\n const { previousMargin = '0px', nextMargin = '0px' } = this.props\n const [, pM] = /^(\\d+)px/.exec(previousMargin) || []\n const [, nN] = /^(\\d+)px/.exec(nextMargin as string) || []\n return [parseInt(pM) || 0, parseInt(nN) || 0]\n }\n\n getCurrentId (swiper: ISwiper) {\n const slides = swiper.slides\n const activeIndex = swiper.activeIndex\n const currentSlide = slides[activeIndex]\n return currentSlide.getAttribute('item-id')\n }\n\n render () {\n const {\n className,\n style,\n vertical,\n indicatorColor,\n indicatorActiveColor,\n forwardedRef\n } = this.props\n const defaultIndicatorColor = indicatorColor || 'rgba(0, 0, 0, .3)'\n const defaultIndicatorActiveColor = indicatorActiveColor || '#000'\n const [pM, nM] = this.parseMargin()\n const cls = classNames(`taro-swiper-${this._id}`, className)\n const sty = Object.assign({ overflow: 'hidden' }, style)\n if (this.props.full) {\n sty.height = '100%'\n }\n const swiperContainerStyleList:string [] = [\n 'overflow: visible;',\n vertical ? `margin-top: ${pM}px; margin-bottom: ${nM}px;` : `margin-right: ${nM}px; margin-left: ${pM}px;`,\n this.props.full ? 'height: 100%;' : ''\n ]\n\n\n const swiperPaginationStyleList:string [] = [\n this.props.indicatorDots ? 'opacity: 1;' : 'display: none;',\n 'font-size: 0;'\n ]\n return (\n <div className={`swiper-container-wrapper ${cls}`} style={sty} ref={(e) => {\n if (forwardedRef && e) {\n forwardedRef.current = e\n }\n }}>\n <div className='swiper-container' style={{ overflow: 'visible' }} ref={(el) => { this.$el = el }}>\n <div\n dangerouslySetInnerHTML={{\n __html: `<style type='text/css'>\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet { background: ${defaultIndicatorColor} }\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet-active { background: ${defaultIndicatorActiveColor} }\n .taro-swiper-${this._id} > .swiper-container { ${swiperContainerStyleList.join('')} }\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination { ${swiperPaginationStyleList.join('')} }\n </style>`\n }}\n />\n <div className='swiper-wrapper' >{this.props.children}</div>\n <div className='swiper-pagination' />\n </div>\n </div>\n )\n }\n}\n\nexport const Swiper = createForwardRefComponent(SwiperInner)\nexport const SwiperItem = createForwardRefComponent(SwiperItemInner)\n"],"names":["INSTANCE_ID","ONE_ADDITIONAL_SLIDES_THRESHOLD","TWO_ADDITIONAL_SLIDES_THRESHOLD","createEvent","type","e","TouchEvent","err","document","initEvent","SwiperItemInner","React","Component","render","_a","props","className","style","itemId","children","forwardedRef","restProps","__rest","cls","classNames","_jsx","ref","current","SwiperInner","constructor","_this","this","_id","_SwiperInner_source","set","_SwiperInner_swiperResetting","_SwiperInner_lastSwiperActiveIndex","_SwiperInner_domChangeByOutSide","handleInit","reset","arguments","length","undefined","autoplay","circular","displayMultipleItems","duration","interval","currentItemId","effectsProps","vertical","initialSlide","parseInt","String","__classPrivateFieldGet","itemIdIndex","getSlidersList","forEach","swiperItem","index","loopAdditionalSlides","getLoopAdditionalSlides","centeredSlides","getNeedFixLoop","slidesPerView","that","opt","Object","assign","pagination","el","direction","loop","speed","observer","observeParents","nested","touchReleaseOnEdges","threshold","on","init","_swiper","loopFix","start","transitionEnd","realIndex","__classPrivateFieldSet","currentId","getCurrentId","defineProperty","enumerable","value","source","handleOnAnimationFinish","touchMove","touchEnd","touchStart","pause","slideChange","handleOnChange","animating","delay","disableOnInteraction","swiper","Swipers","$el","minTranslate","bind","maxTranslate","parseMargin","setState","swiperWrapper","wrapperEl","handleSwiperSizeDebounce","debounce","update","destroy","_b","querySelectorAll","margins","hasMargin","filter","Boolean","previousMargin","nextMargin","pM","exec","nN","state","componentDidMount","hackSwiperWrapDomAction","appendChild","removeChild","replaceChild","insertBefore","beforeAction","loopDestroy","params","componentDidUpdate","prevProps","pervState","disconnect","MutationObserver","observe","childList","n","isNaN","slideToLoop","slideTo","swiperAutoplay","running","stop","getAttribute","Number","componentWillUnmount","_d","_c","func","onChange","onAnimationFinish","slidersLength","slides","activeIndex","currentSlide","indicatorColor","indicatorActiveColor","defaultIndicatorColor","defaultIndicatorActiveColor","nM","sty","overflow","full","height","swiperContainerStyleList","swiperPaginationStyleList","indicatorDots","_jsxs","dangerouslySetInnerHTML","__html","join","Swiper","createForwardRefComponent","SwiperItem"],"mappings":";;;;;;;;;;AAWA,IAAIA,WAAW,GAAG,CAAC;AACnB,MAAMC,+BAA+B,GAAG,CAAC;AACzC,MAAMC,+BAA+B,GAAG,CAAC;AA4BzC,MAAMC,WAAW,GAAIC,IAAY,IAAI;AACnC,EAAA,IAAIC,CAAC;EACL,IAAI;AACFA,IAAAA,CAAC,GAAG,IAAIC,UAAU,CAACF,IAAI,CAAC;GACzB,CAAC,OAAOG,GAAG,EAAE;AACZF,IAAAA,CAAC,GAAGG,QAAQ,CAACL,WAAW,CAAC,OAAO,CAAC;IACjCE,CAAC,CAACI,SAAS,CAACL,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAC/B;AACA,EAAA,OAAOC,CAAC;AACV,CAAC;AAED,MAAMK,eAAgB,SAAQC,cAAK,CAACC,SAAmD,CAAA;AACrFC,EAAAA,MAAMA,GAAA;AACJ,IAAA,MAAMC,EAAA,GAAqE,IAAI,CAACC,KAAK;AAA/E,MAAA;QAAEC,SAAS;QAAEC,KAAK;QAAEC,MAAM;QAAEC,QAAQ;AAAEC,QAAAA;AAAY,OAAA,GAAAN,EAA6B;AAAxBO,MAAAA,SAAS,GAAA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AAI,CAACnJ,GAAG,CAAA,4CAAA,EAA+C8I,yBAAyB,CAACK,IAAI,CAAC,EAAE,CAAC,CAAA;AAC/F,sBAAA;AACV;SAEH,CAAA,eAAA1J,GAAA,CAAA,KAAA,EAAA;AAAKT,UAAAA,SAAS,EAAC,gBAAgB;AAAAG,UAAAA,QAAA,EAAG,IAAI,CAACJ,KAAK,CAACI;SAAc,CAC3D,eAAAM,GAAA,CAAA,KAAA,EAAA;AAAKT,UAAAA,SAAS,EAAC;AAAmB,SACpC,CAAA;OAAK;AACP,KAAK,CAAC;AAEV;AACD;;MAEYoK,MAAM,GAAGC,yBAAyB,CAACzJ,WAAW;MAC9C0J,UAAU,GAAGD,yBAAyB,CAAC3K,eAAe;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/swiper/style/index.css"],"names":[],"mappings":"AAAA,0BACI,YACJ,CAEA,kBACI,WAAY,CAEZ,gBAAiB,CADjB,iBAEJ","file":"index.css","sourcesContent":[".swiper-container-wrapper {\n height: 150px;\n}\n\n.swiper-container {\n height: 100%;\n position: relative;\n overflow: visible;\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import './style/index.css';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import 'react';
|
|
5
|
+
import { createForwardRefComponent } from '../../utils/index.js';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function Text(props) {
|
|
9
|
+
const {
|
|
10
|
+
className,
|
|
11
|
+
selectable = false,
|
|
12
|
+
forwardedRef
|
|
13
|
+
} = props,
|
|
14
|
+
restProps = __rest(props, ["className", "selectable", "forwardedRef"]);
|
|
15
|
+
const cls = classNames('taro-text', {
|
|
16
|
+
'taro-text__selectable': selectable
|
|
17
|
+
}, className);
|
|
18
|
+
return /*#__PURE__*/jsx("span", {
|
|
19
|
+
...restProps,
|
|
20
|
+
className: cls,
|
|
21
|
+
ref: forwardedRef,
|
|
22
|
+
children: props.children
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
var index = createForwardRefComponent(Text);
|
|
26
|
+
|
|
27
|
+
export { index as default };
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/text/index.tsx"],"sourcesContent":["import './style/index.css'\n\nimport classNames from 'classnames'\nimport React from 'react'\n\nimport { createForwardRefComponent } from '../../utils'\n\ninterface IProps extends React.HTMLAttributes<HTMLSpanElement> {\n selectable?: boolean\n forwardedRef?: React.MutableRefObject<HTMLSpanElement>\n}\n\nfunction Text (props: IProps) {\n const { className, selectable = false, forwardedRef, ...restProps } = props\n const cls = classNames(\n 'taro-text',\n {\n 'taro-text__selectable': selectable\n },\n className\n )\n return (\n <span {...restProps} className={cls} ref={forwardedRef}>\n {props.children}\n </span>\n )\n}\n\nexport default createForwardRefComponent(Text)\n"],"names":["Text","props","className","selectable","forwardedRef","restProps","__rest","cls","classNames","_jsx","ref","children","createForwardRefComponent"],"mappings":";;;;;;;AAYA,SAASA,IAAIA,CAAEC,KAAa,EAAA;EAC1B,MAAM;MAAEC,SAAS;AAAEC,MAAAA,UAAU,GAAG,KAAK;AAAEC,MAAAA;AAA+B,KAAA,GAAAH,KAAK;AAAnBI,IAAAA,SAAS,GAAAC,MAAA,CAAKL,KAAK,EAArE,CAAA,WAAA,EAAA,YAAA,EAAA,cAAA,CAA6D,CAAQ;AAC3E,EAAA,MAAMM,GAAG,GAAGC,UAAU,CACpB,WAAW,EACX;AACE,IAAA,uBAAuB,EAAEL;GAC1B,EACDD,SAAS,CACV;AACD,EAAA,oBACEO,GAAA,CAAA,MAAA,EAAA;AAAA,IAAA,GAAUJ,SAAS;AAAEH,IAAAA,SAAS,EAAEK,GAAI;AAACG,IAAAA,GAAG,EAAEN,YAAa;IAAAO,QAAA,EACpDV,KAAK,CAACU;AAAQ,GACX,CAAC;AAEX;AAEA,YAAeC,yBAAyB,CAACZ,IAAI,CAAC;;;;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
.taro-text{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.taro-text__selectable{-moz-user-select:text;-webkit-user-select:text;-ms-user-select:text;user-select:text}
|
|
2
|
+
/*# sourceMappingURL=index.css.map */
|
|
3
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/text/style/index.css"],"names":[],"mappings":"AAAA,WACE,qBAAsB,CACtB,wBAAyB,CACzB,oBAAqB,CACrB,gBACF,CAEA,uBACE,qBAAsB,CACtB,wBAAyB,CACzB,oBAAqB,CACrB,gBACF","file":"index.css","sourcesContent":[".taro-text {\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.taro-text__selectable {\n -moz-user-select: text;\n -webkit-user-select: text;\n -ms-user-select: text;\n user-select: text;\n}\n"]}
|