@arco-design/mobile-react 2.22.2 → 2.22.3
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/CHANGELOG.md +12 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/carousel/index.d.ts +6 -0
- package/cjs/carousel/index.js +6 -4
- package/dist/index.js +90 -88
- package/dist/index.min.js +4 -4
- package/esm/carousel/index.d.ts +6 -0
- package/esm/carousel/index.js +6 -4
- package/package.json +3 -3
- package/tools/flexible.js +82 -63
- package/umd/carousel/index.d.ts +6 -0
- package/umd/carousel/index.js +6 -4
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.22.3](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.22.2...@arco-design/mobile-react@2.22.3) (2022-11-23)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* `Carousel` supports autoPlayDirection ([#72](https://github.com/arco-design/arco-design-mobile/issues/72)) ([527aaf4](https://github.com/arco-design/arco-design-mobile/commit/527aaf4bdf86fe4cf995bd8e4bd2580e9db8c942))
|
12
|
+
* flexible.js support umd ([#73](https://github.com/arco-design/arco-design-mobile/issues/73)) ([d3f35c0](https://github.com/arco-design/arco-design-mobile/commit/d3f35c093a579bb404fff91dbf6437cdd93f19f7))
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
6
18
|
## [2.22.2](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.22.0...@arco-design/mobile-react@2.22.2) (2022-11-09)
|
7
19
|
|
8
20
|
|
package/README.en-US.md
CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="_b
|
|
59
59
|
React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">Click here</a>**
|
60
60
|
|
61
61
|
```
|
62
|
-
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.22.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.22.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.22.2/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.22.2/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## Full import
|
package/README.md
CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="
|
|
59
59
|
React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">戳这里获取</a>**
|
60
60
|
|
61
61
|
```
|
62
|
-
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.22.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.22.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.22.2/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.22.2/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## 引入全部
|
package/cjs/carousel/index.d.ts
CHANGED
@@ -66,6 +66,12 @@ export interface CarouselProps {
|
|
66
66
|
* @default true
|
67
67
|
*/
|
68
68
|
autoPlay?: boolean;
|
69
|
+
/**
|
70
|
+
* 自动播放方向
|
71
|
+
* @en Direction when playing auto
|
72
|
+
* @default "normal"
|
73
|
+
*/
|
74
|
+
autoPlayDirection?: 'normal' | 'reverse';
|
69
75
|
/**
|
70
76
|
* 是否响应手势滑动
|
71
77
|
* @en Whether to respond to gesture swipe
|
package/cjs/carousel/index.js
CHANGED
@@ -42,6 +42,8 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
42
42
|
loop = _props$loop === void 0 ? true : _props$loop,
|
43
43
|
_props$autoPlay = props.autoPlay,
|
44
44
|
autoPlay = _props$autoPlay === void 0 ? true : _props$autoPlay,
|
45
|
+
_props$autoPlayDirect = props.autoPlayDirection,
|
46
|
+
autoPlayDirection = _props$autoPlayDirect === void 0 ? 'normal' : _props$autoPlayDirect,
|
45
47
|
_props$swipeable = props.swipeable,
|
46
48
|
swipeable = _props$swipeable === void 0 ? true : _props$swipeable,
|
47
49
|
_props$stayDuration = props.stayDuration,
|
@@ -164,7 +166,7 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
164
166
|
transformsRef = _useRefState4[1],
|
165
167
|
setTransforms = _useRefState4[2];
|
166
168
|
|
167
|
-
var _useRefState5 = (0, _helpers.useRefState)('left'),
|
169
|
+
var _useRefState5 = (0, _helpers.useRefState)(autoPlayDirection === 'reverse' && autoPlay ? 'right' : 'left'),
|
168
170
|
direction = _useRefState5[0],
|
169
171
|
directionRef = _useRefState5[1],
|
170
172
|
setStateDirection = _useRefState5[2];
|
@@ -401,7 +403,7 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
401
403
|
return function () {
|
402
404
|
clear();
|
403
405
|
};
|
404
|
-
}, [userSetBoxWidth, userSetBoxHeight, childWidth, childHeight, stayDuration, noInterval]);
|
406
|
+
}, [userSetBoxWidth, userSetBoxHeight, childWidth, childHeight, stayDuration, noInterval, autoPlayDirection]);
|
405
407
|
(0, _helpers.useUpdateEffect)(function () {
|
406
408
|
if (currentIndex !== void 0) {
|
407
409
|
jumpTo(currentIndex);
|
@@ -541,7 +543,7 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
541
543
|
var changedIndex = newIndex !== oldIndex ? getShownIndex(newIndex) : -1;
|
542
544
|
|
543
545
|
if (autoJump) {
|
544
|
-
setDirection('left');
|
546
|
+
setDirection(autoPlayDirection === 'reverse' ? 'right' : 'left');
|
545
547
|
} else if (newIndex === indexRef.current) {
|
546
548
|
setDirection(distanceRef.current > 0 ? 'right' : 'left');
|
547
549
|
} else {
|
@@ -595,7 +597,7 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
595
597
|
}
|
596
598
|
|
597
599
|
timerRef.current = delayTimeout(function () {
|
598
|
-
jumpTo(indexRef.current + 1);
|
600
|
+
jumpTo(autoPlayDirection === 'reverse' ? indexRef.current - 1 : indexRef.current + 1);
|
599
601
|
}, stayDuration);
|
600
602
|
}
|
601
603
|
|
package/dist/index.js
CHANGED
@@ -4222,61 +4222,63 @@
|
|
4222
4222
|
loop = _d === void 0 ? true : _d,
|
4223
4223
|
_e = props.autoPlay,
|
4224
4224
|
autoPlay = _e === void 0 ? true : _e,
|
4225
|
-
_f = props.
|
4226
|
-
|
4227
|
-
_g = props.
|
4228
|
-
|
4225
|
+
_f = props.autoPlayDirection,
|
4226
|
+
autoPlayDirection = _f === void 0 ? 'normal' : _f,
|
4227
|
+
_g = props.swipeable,
|
4228
|
+
swipeable = _g === void 0 ? true : _g,
|
4229
|
+
_h = props.stayDuration,
|
4230
|
+
stayDuration = _h === void 0 ? 4000 : _h,
|
4229
4231
|
boxWidth = props.boxWidth,
|
4230
4232
|
boxHeight = props.boxHeight,
|
4231
4233
|
baseBoxWidth = props.baseBoxWidth,
|
4232
4234
|
baseBoxHeight = props.baseBoxHeight,
|
4233
|
-
|
4234
|
-
width =
|
4235
|
+
_j = props.width,
|
4236
|
+
width = _j === void 0 ? 0 : _j,
|
4235
4237
|
height = props.height,
|
4236
|
-
|
4237
|
-
initialIndex =
|
4238
|
+
_k = props.initialIndex,
|
4239
|
+
initialIndex = _k === void 0 ? 0 : _k,
|
4238
4240
|
renderIndicator = props.renderIndicator,
|
4239
|
-
|
4240
|
-
indicatorPos =
|
4241
|
-
|
4242
|
-
indicatorVerticalPos =
|
4241
|
+
_l = props.indicatorPos,
|
4242
|
+
indicatorPos = _l === void 0 ? 'center' : _l,
|
4243
|
+
_m = props.indicatorVerticalPos,
|
4244
|
+
indicatorVerticalPos = _m === void 0 ? 'left' : _m,
|
4243
4245
|
indicatorOutside = props.indicatorOutside,
|
4244
|
-
|
4245
|
-
showIndicator =
|
4246
|
-
|
4247
|
-
hideSingleIndicator =
|
4248
|
-
|
4249
|
-
indicatorType =
|
4250
|
-
|
4251
|
-
indicatorClass =
|
4246
|
+
_o = props.showIndicator,
|
4247
|
+
showIndicator = _o === void 0 ? true : _o,
|
4248
|
+
_p = props.hideSingleIndicator,
|
4249
|
+
hideSingleIndicator = _p === void 0 ? true : _p,
|
4250
|
+
_q = props.indicatorType,
|
4251
|
+
indicatorType = _q === void 0 ? 'square' : _q,
|
4252
|
+
_r = props.indicatorClass,
|
4253
|
+
indicatorClass = _r === void 0 ? '' : _r,
|
4252
4254
|
indicatorInverse = props.indicatorInverse,
|
4253
|
-
|
4254
|
-
spaceBetween =
|
4255
|
-
|
4256
|
-
offsetBetween =
|
4255
|
+
_s = props.spaceBetween,
|
4256
|
+
spaceBetween = _s === void 0 ? 0 : _s,
|
4257
|
+
_t = props.offsetBetween,
|
4258
|
+
offsetBetween = _t === void 0 ? 0 : _t,
|
4257
4259
|
currentIndex = props.currentIndex,
|
4258
|
-
|
4259
|
-
autoHeight =
|
4260
|
-
|
4261
|
-
percentToChange =
|
4262
|
-
|
4263
|
-
distanceToChange =
|
4264
|
-
|
4265
|
-
speedToChange =
|
4260
|
+
_u = props.autoHeight,
|
4261
|
+
autoHeight = _u === void 0 ? false : _u,
|
4262
|
+
_v = props.percentToChange,
|
4263
|
+
percentToChange = _v === void 0 ? 0.3 : _v,
|
4264
|
+
_w = props.distanceToChange,
|
4265
|
+
distanceToChange = _w === void 0 ? 10 : _w,
|
4266
|
+
_x = props.speedToChange,
|
4267
|
+
speedToChange = _x === void 0 ? 100 : _x,
|
4266
4268
|
vertical = props.vertical,
|
4267
4269
|
lazyloadCount = props.lazyloadCount,
|
4268
|
-
|
4269
|
-
inactiveScale =
|
4270
|
-
|
4271
|
-
stopPropagation =
|
4272
|
-
|
4273
|
-
fakeItem =
|
4274
|
-
|
4275
|
-
allowEndBlank =
|
4276
|
-
|
4277
|
-
bounceWhenNoLoop =
|
4278
|
-
|
4279
|
-
bounceDampRate =
|
4270
|
+
_y = props.inactiveScale,
|
4271
|
+
inactiveScale = _y === void 0 ? 1 : _y,
|
4272
|
+
_z = props.stopPropagation,
|
4273
|
+
stopPropagation = _z === void 0 ? true : _z,
|
4274
|
+
_0 = props.fakeItem,
|
4275
|
+
fakeItem = _0 === void 0 ? false : _0,
|
4276
|
+
_1 = props.allowEndBlank,
|
4277
|
+
allowEndBlank = _1 === void 0 ? false : _1,
|
4278
|
+
_2 = props.bounceWhenNoLoop,
|
4279
|
+
bounceWhenNoLoop = _2 === void 0 ? false : _2,
|
4280
|
+
_3 = props.bounceDampRate,
|
4281
|
+
bounceDampRate = _3 === void 0 ? 3 : _3,
|
4280
4282
|
distanceProcessor = props.distanceProcessor,
|
4281
4283
|
getInnerScrollContainer = props.getInnerScrollContainer,
|
4282
4284
|
onChange = props.onChange,
|
@@ -4287,8 +4289,8 @@
|
|
4287
4289
|
onTransitionStart = props.onTransitionStart,
|
4288
4290
|
onTransitionEnd = props.onTransitionEnd,
|
4289
4291
|
onDistanceChange = props.onDistanceChange,
|
4290
|
-
|
4291
|
-
stopTouchThreshold =
|
4292
|
+
_4 = props.stopTouchThreshold,
|
4293
|
+
stopTouchThreshold = _4 === void 0 ? 0 : _4,
|
4292
4294
|
onTouchStopped = props.onTouchStopped,
|
4293
4295
|
onPageVisibleChange = props.onPageVisibleChange;
|
4294
4296
|
var domRef = React.useRef(null);
|
@@ -4302,13 +4304,13 @@
|
|
4302
4304
|
var touchStartedRef = React.useRef(false);
|
4303
4305
|
var touchMovedRef = React.useRef(false);
|
4304
4306
|
|
4305
|
-
var
|
4306
|
-
wrapWidth =
|
4307
|
-
setWrapWidth =
|
4307
|
+
var _5 = React.useState(baseBoxWidth || 0),
|
4308
|
+
wrapWidth = _5[0],
|
4309
|
+
setWrapWidth = _5[1];
|
4308
4310
|
|
4309
|
-
var
|
4310
|
-
wrapHeight =
|
4311
|
-
setWrapHeight =
|
4311
|
+
var _6 = React.useState(baseBoxHeight || 0),
|
4312
|
+
wrapHeight = _6[0],
|
4313
|
+
setWrapHeight = _6[1];
|
4312
4314
|
|
4313
4315
|
var touchStartXRef = React.useRef(0);
|
4314
4316
|
var touchStartYRef = React.useRef(0);
|
@@ -4316,45 +4318,45 @@
|
|
4316
4318
|
var touchStoppedRef = React.useRef(false);
|
4317
4319
|
var bouncingRef = React.useRef(false);
|
4318
4320
|
|
4319
|
-
var
|
4320
|
-
currentItemHeight =
|
4321
|
-
setCurrentItemHeight =
|
4321
|
+
var _7 = React.useState('auto'),
|
4322
|
+
currentItemHeight = _7[0],
|
4323
|
+
setCurrentItemHeight = _7[1];
|
4322
4324
|
|
4323
|
-
var
|
4324
|
-
posAdjusting =
|
4325
|
-
posAdjustingRef =
|
4326
|
-
setPosAdjusting =
|
4325
|
+
var _8 = useRefState(false),
|
4326
|
+
posAdjusting = _8[0],
|
4327
|
+
posAdjustingRef = _8[1],
|
4328
|
+
setPosAdjusting = _8[2];
|
4327
4329
|
|
4328
|
-
var
|
4329
|
-
distance =
|
4330
|
-
distanceRef =
|
4331
|
-
setDistance =
|
4330
|
+
var _9 = useRefState(0),
|
4331
|
+
distance = _9[0],
|
4332
|
+
distanceRef = _9[1],
|
4333
|
+
setDistance = _9[2];
|
4332
4334
|
|
4333
|
-
var
|
4334
|
-
isAutoJump =
|
4335
|
-
setIsAutoJump =
|
4335
|
+
var _10 = React.useState(true),
|
4336
|
+
isAutoJump = _10[0],
|
4337
|
+
setIsAutoJump = _10[1];
|
4336
4338
|
|
4337
|
-
var
|
4338
|
-
index =
|
4339
|
-
indexRef =
|
4340
|
-
setIndex =
|
4339
|
+
var _11 = useRefState(currentIndex !== void 0 ? currentIndex : initialIndex),
|
4340
|
+
index = _11[0],
|
4341
|
+
indexRef = _11[1],
|
4342
|
+
setIndex = _11[2];
|
4341
4343
|
|
4342
|
-
var
|
4343
|
-
transforms =
|
4344
|
-
transformsRef =
|
4345
|
-
setTransforms =
|
4344
|
+
var _12 = useRefState([]),
|
4345
|
+
transforms = _12[0],
|
4346
|
+
transformsRef = _12[1],
|
4347
|
+
setTransforms = _12[2];
|
4346
4348
|
|
4347
|
-
var
|
4348
|
-
direction =
|
4349
|
-
directionRef =
|
4350
|
-
setStateDirection =
|
4349
|
+
var _13 = useRefState(autoPlayDirection === 'reverse' && autoPlay ? 'right' : 'left'),
|
4350
|
+
direction = _13[0],
|
4351
|
+
directionRef = _13[1],
|
4352
|
+
setStateDirection = _13[2];
|
4351
4353
|
|
4352
4354
|
var lastDirectionRef = React.useRef('');
|
4353
4355
|
var lastShownIndexRef = React.useRef(-1);
|
4354
4356
|
|
4355
|
-
var
|
4356
|
-
allChildren =
|
4357
|
-
fakeTwoChildren =
|
4357
|
+
var _14 = getAllChildren(),
|
4358
|
+
allChildren = _14.allChildren,
|
4359
|
+
fakeTwoChildren = _14.fakeTwoChildren;
|
4358
4360
|
|
4359
4361
|
var total = allChildren.length;
|
4360
4362
|
var shownTotal = fakeTwoChildren ? 2 : total;
|
@@ -4386,9 +4388,9 @@
|
|
4386
4388
|
return Math.max(0, Math.min(inactiveScale, 1));
|
4387
4389
|
}, [inactiveScale]);
|
4388
4390
|
|
4389
|
-
var
|
4390
|
-
fakeIndexes =
|
4391
|
-
setFakeIndexes =
|
4391
|
+
var _15 = React.useState([]),
|
4392
|
+
fakeIndexes = _15[0],
|
4393
|
+
setFakeIndexes = _15[1];
|
4392
4394
|
|
4393
4395
|
var system = useSystem(); // 开启自动循环时iOS会有渲染问题需要强刷dom,但不需要autoPlay的不用强刷,这里判断下
|
4394
4396
|
// @en When the automatic loop is turned on, there will be rendering problems in iOS. Need to brush the dom, but if you don't need autoPlay, don't need to brush.
|
@@ -4581,7 +4583,7 @@
|
|
4581
4583
|
return function () {
|
4582
4584
|
clear();
|
4583
4585
|
};
|
4584
|
-
}, [userSetBoxWidth, userSetBoxHeight, childWidth, childHeight, stayDuration, noInterval]);
|
4586
|
+
}, [userSetBoxWidth, userSetBoxHeight, childWidth, childHeight, stayDuration, noInterval, autoPlayDirection]);
|
4585
4587
|
useUpdateEffect(function () {
|
4586
4588
|
if (currentIndex !== void 0) {
|
4587
4589
|
jumpTo(currentIndex);
|
@@ -4721,7 +4723,7 @@
|
|
4721
4723
|
var changedIndex = newIndex !== oldIndex ? getShownIndex(newIndex) : -1;
|
4722
4724
|
|
4723
4725
|
if (autoJump) {
|
4724
|
-
setDirection('left');
|
4726
|
+
setDirection(autoPlayDirection === 'reverse' ? 'right' : 'left');
|
4725
4727
|
} else if (newIndex === indexRef.current) {
|
4726
4728
|
setDirection(distanceRef.current > 0 ? 'right' : 'left');
|
4727
4729
|
} else {
|
@@ -4775,7 +4777,7 @@
|
|
4775
4777
|
}
|
4776
4778
|
|
4777
4779
|
timerRef.current = delayTimeout(function () {
|
4778
|
-
jumpTo(indexRef.current + 1);
|
4780
|
+
jumpTo(autoPlayDirection === 'reverse' ? indexRef.current - 1 : indexRef.current + 1);
|
4779
4781
|
}, stayDuration);
|
4780
4782
|
}
|
4781
4783
|
|
@@ -14682,7 +14684,7 @@
|
|
14682
14684
|
});
|
14683
14685
|
|
14684
14686
|
/*!
|
14685
|
-
* @arco-design/transformable v1.0.
|
14687
|
+
* @arco-design/transformable v1.0.1
|
14686
14688
|
* (c) 2022 ludan.kibbon
|
14687
14689
|
*/
|
14688
14690
|
function _defineProperty(obj, key, value) {
|