@arco-design/mobile-react 2.32.0 → 2.33.0
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 +17 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/avatar/index.js +3 -1
- package/cjs/avatar/type.d.ts +6 -0
- package/cjs/carousel/index.js +18 -1
- package/cjs/steps/index.d.ts +1 -1
- package/cjs/steps/index.js +6 -1
- package/cjs/steps/style/css/index.css +42 -4
- package/cjs/steps/style/index.less +58 -6
- package/cjs/steps/type.d.ts +5 -0
- package/dist/index.js +55 -31
- package/dist/index.min.js +1 -1
- package/dist/style.css +27 -4
- package/dist/style.min.css +1 -1
- package/esm/avatar/index.js +3 -1
- package/esm/avatar/type.d.ts +6 -0
- package/esm/carousel/index.js +18 -1
- package/esm/steps/index.d.ts +1 -1
- package/esm/steps/index.js +7 -2
- package/esm/steps/style/css/index.css +42 -4
- package/esm/steps/style/index.less +58 -6
- package/esm/steps/type.d.ts +5 -0
- package/esnext/avatar/index.js +2 -2
- package/esnext/avatar/type.d.ts +6 -0
- package/esnext/carousel/index.js +13 -4
- package/esnext/steps/index.d.ts +1 -1
- package/esnext/steps/index.js +6 -3
- package/esnext/steps/style/css/index.css +42 -4
- package/esnext/steps/style/index.less +58 -6
- package/esnext/steps/type.d.ts +5 -0
- package/package.json +3 -3
- package/umd/avatar/index.js +3 -1
- package/umd/avatar/type.d.ts +6 -0
- package/umd/carousel/index.js +18 -1
- package/umd/steps/index.d.ts +1 -1
- package/umd/steps/index.js +6 -1
- package/umd/steps/style/css/index.css +42 -4
- package/umd/steps/style/index.less +58 -6
- package/umd/steps/type.d.ts +5 -0
package/esm/avatar/type.d.ts
CHANGED
@@ -42,6 +42,12 @@ export interface AvatarProps<T extends ImageProps = ImageProps> extends BaseProp
|
|
42
42
|
* @default {}
|
43
43
|
*/
|
44
44
|
avatarStyle?: React.CSSProperties;
|
45
|
+
/**
|
46
|
+
* 头像元素的自定义类名
|
47
|
+
* @en Custom classname for avatar element
|
48
|
+
* @default ""
|
49
|
+
*/
|
50
|
+
avatarClass?: string;
|
45
51
|
/**
|
46
52
|
* 是否自动根据头像尺寸调整字体大小
|
47
53
|
* @en Whether to automatically adjust the font size according to the avatar size
|
package/esm/carousel/index.js
CHANGED
@@ -228,6 +228,12 @@ var Carousel = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
228
228
|
|
229
229
|
if (posAdjustingRef.current) {
|
230
230
|
return;
|
231
|
+
} // touchMove触发时,阻止handleTouchStart多次执行(如点击事件)
|
232
|
+
// @en When touchMove is triggered, prevent handleTouchStart from executing multiple times (such as click events)
|
233
|
+
|
234
|
+
|
235
|
+
if (touchStartedRef.current && touchMovedRef.current) {
|
236
|
+
return;
|
231
237
|
}
|
232
238
|
|
233
239
|
touchStartedRef.current = true;
|
@@ -684,12 +690,23 @@ var Carousel = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
684
690
|
return;
|
685
691
|
}
|
686
692
|
|
687
|
-
if (!touchStartedRef.current
|
693
|
+
if (!touchStartedRef.current) {
|
688
694
|
return;
|
689
695
|
}
|
690
696
|
|
691
697
|
touchStartedRef.current = false;
|
698
|
+
|
699
|
+
if (!touchMovedRef.current) {
|
700
|
+
setPlayIntervalRef.current();
|
701
|
+
return;
|
702
|
+
}
|
703
|
+
|
692
704
|
touchMovedRef.current = false;
|
705
|
+
|
706
|
+
if (posAdjustingRef.current || touchStoppedRef.current) {
|
707
|
+
return;
|
708
|
+
}
|
709
|
+
|
693
710
|
var touchEndTime = new Date().getTime();
|
694
711
|
var dis = Math.abs(distance);
|
695
712
|
var speed = dis / (touchEndTime - touchStartTimeRef.current) * 1000;
|
package/esm/steps/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { StepsProps, StepsRef } from './type';
|
3
3
|
export * from './type';
|
4
|
-
export declare const StepsContext: React.Context<Pick<StepsProps, "direction" | "status" | "align" | "iconType" | "current"> & {
|
4
|
+
export declare const StepsContext: React.Context<Pick<StepsProps, "direction" | "status" | "align" | "iconType" | "current" | "reverseOrder"> & {
|
5
5
|
index?: number | undefined;
|
6
6
|
changeIndex: (newIndex: number) => void;
|
7
7
|
}>;
|
package/esm/steps/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import React, { useRef, forwardRef, useImperativeHandle, Children, createContext, useCallback, useState, useEffect } from 'react';
|
3
|
-
import { componentWrapper } from '@arco-design/mobile-utils';
|
3
|
+
import { cls, componentWrapper } from '@arco-design/mobile-utils';
|
4
4
|
import { ContextLayout } from '../context-provider';
|
5
5
|
import Step from './step';
|
6
6
|
import { useSystem, useRefState } from '../_helpers';
|
@@ -24,6 +24,8 @@ var Steps = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
24
24
|
_props$status = props.status,
|
25
25
|
status = _props$status === void 0 ? 'process' : _props$status,
|
26
26
|
items = props.items,
|
27
|
+
_props$reverseOrder = props.reverseOrder,
|
28
|
+
reverseOrder = _props$reverseOrder === void 0 ? false : _props$reverseOrder,
|
27
29
|
onClick = props.onClick,
|
28
30
|
onChange = props.onChange;
|
29
31
|
var defaultAlign = direction === 'vertical' ? 'start' : 'center';
|
@@ -64,6 +66,7 @@ var Steps = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
64
66
|
index: index,
|
65
67
|
status: activeIndex === index ? status : void 0,
|
66
68
|
align: align,
|
69
|
+
reverseOrder: reverseOrder,
|
67
70
|
changeIndex: changeIndex
|
68
71
|
},
|
69
72
|
key: index
|
@@ -72,7 +75,9 @@ var Steps = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
72
75
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
73
76
|
var prefixCls = _ref.prefixCls;
|
74
77
|
return /*#__PURE__*/React.createElement("div", {
|
75
|
-
className: prefixCls + "-steps all-border-box " + className + " " + direction + " " + system,
|
78
|
+
className: cls(prefixCls + "-steps all-border-box " + className + " " + direction + " " + system, {
|
79
|
+
'reverse-order': reverseOrder
|
80
|
+
}),
|
76
81
|
style: style,
|
77
82
|
ref: domRef
|
78
83
|
}, items ? items.map(function (item, index) {
|
@@ -516,6 +516,12 @@
|
|
516
516
|
display: flex;
|
517
517
|
padding: 0.32rem 0 ;
|
518
518
|
}
|
519
|
+
.arco-steps.reverse-order {
|
520
|
+
-webkit-box-orient: horizontal;
|
521
|
+
-webkit-box-direction: reverse;
|
522
|
+
-webkit-flex-direction: row-reverse;
|
523
|
+
flex-direction: row-reverse;
|
524
|
+
}
|
519
525
|
.arco-steps-item {
|
520
526
|
position: relative;
|
521
527
|
display: -webkit-box;
|
@@ -548,6 +554,14 @@
|
|
548
554
|
.arco-steps-item:last-child .arco-steps-item-tail::after {
|
549
555
|
visibility: hidden;
|
550
556
|
}
|
557
|
+
.reverse-order .arco-steps-item:first-child .arco-steps-item-tail::after,
|
558
|
+
.reverse-order .arco-steps-item:last-child .arco-steps-item-tail::before {
|
559
|
+
visibility: hidden;
|
560
|
+
}
|
561
|
+
.reverse-order .arco-steps-item:first-child .arco-steps-item-tail::before,
|
562
|
+
.reverse-order .arco-steps-item:last-child .arco-steps-item-tail::after {
|
563
|
+
visibility: visible;
|
564
|
+
}
|
551
565
|
.arco-steps-item-tail {
|
552
566
|
position: absolute;
|
553
567
|
display: -webkit-box;
|
@@ -577,13 +591,13 @@
|
|
577
591
|
right: 9PX ;
|
578
592
|
}
|
579
593
|
.horizontal .arco-steps-item-tail-align-start::after {
|
580
|
-
content:
|
594
|
+
content: '';
|
581
595
|
width: 100%;
|
582
596
|
border-radius: 2PX ;
|
583
597
|
}
|
584
598
|
.horizontal .arco-steps-item-tail-align-center::before,
|
585
599
|
.horizontal .arco-steps-item-tail-align-center::after {
|
586
|
-
content:
|
600
|
+
content: '';
|
587
601
|
width: 50%;
|
588
602
|
}
|
589
603
|
.horizontal .arco-steps-item-tail-align-center::before {
|
@@ -637,13 +651,13 @@
|
|
637
651
|
padding: 14PX 0 ;
|
638
652
|
}
|
639
653
|
.vertical .arco-steps-item-tail-align-start::after {
|
640
|
-
content:
|
654
|
+
content: '';
|
641
655
|
height: 100%;
|
642
656
|
border-radius: 2PX ;
|
643
657
|
}
|
644
658
|
.vertical .arco-steps-item-tail-align-center::before,
|
645
659
|
.vertical .arco-steps-item-tail-align-center::after {
|
646
|
-
content:
|
660
|
+
content: '';
|
647
661
|
height: 50%;
|
648
662
|
}
|
649
663
|
.vertical .arco-steps-item-tail-align-center::before {
|
@@ -667,6 +681,15 @@
|
|
667
681
|
.arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::before {
|
668
682
|
background: #165DFF ;
|
669
683
|
}
|
684
|
+
.reverse-order .arco-steps-item-tail-status-finish::before,
|
685
|
+
.reverse-order .arco-steps-item-tail-status-process::after,
|
686
|
+
.reverse-order .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::after {
|
687
|
+
background: #165DFF ;
|
688
|
+
}
|
689
|
+
.reverse-order .arco-steps-item-tail-status-process::before,
|
690
|
+
.reverse-order .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::before {
|
691
|
+
background: #e5e6eb ;
|
692
|
+
}
|
670
693
|
.arco-steps-item-custom-icon,
|
671
694
|
.arco-steps-item-icon {
|
672
695
|
display: -webkit-inline-box;
|
@@ -796,6 +819,12 @@
|
|
796
819
|
padding-bottom: 0 ;
|
797
820
|
padding-left: 0.4rem ;
|
798
821
|
}
|
822
|
+
.arco-steps.vertical.reverse-order {
|
823
|
+
-webkit-box-orient: vertical;
|
824
|
+
-webkit-box-direction: reverse;
|
825
|
+
-webkit-flex-direction: column-reverse;
|
826
|
+
flex-direction: column-reverse;
|
827
|
+
}
|
799
828
|
[dir="rtl"] .arco-steps.vertical {
|
800
829
|
padding-left: initial;
|
801
830
|
padding-right: 0.4rem ;
|
@@ -823,6 +852,15 @@
|
|
823
852
|
.arco-theme-dark .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::before {
|
824
853
|
background: #3C7EFF ;
|
825
854
|
}
|
855
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-status-finish::before,
|
856
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-status-process::after,
|
857
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::after {
|
858
|
+
background: #3C7EFF ;
|
859
|
+
}
|
860
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-status-process::before,
|
861
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::before {
|
862
|
+
background: #484849 ;
|
863
|
+
}
|
826
864
|
.arco-theme-dark .number.finish .arco-steps-item-icon {
|
827
865
|
background: #000D4D ;
|
828
866
|
}
|
@@ -1,9 +1,13 @@
|
|
1
|
-
@import
|
1
|
+
@import '../../../style/mixin.less';
|
2
2
|
|
3
3
|
.@{prefix}-steps {
|
4
4
|
display: flex;
|
5
5
|
.use-var(padding, steps-padding);
|
6
6
|
|
7
|
+
&.reverse-order {
|
8
|
+
flex-direction: row-reverse;
|
9
|
+
}
|
10
|
+
|
7
11
|
&-item {
|
8
12
|
position: relative;
|
9
13
|
display: flex;
|
@@ -30,6 +34,20 @@
|
|
30
34
|
visibility: hidden;
|
31
35
|
}
|
32
36
|
|
37
|
+
&:first-child &-tail::after,
|
38
|
+
&:last-child &-tail::before {
|
39
|
+
.reverse-order & {
|
40
|
+
visibility: hidden;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
&:first-child &-tail::before,
|
45
|
+
&:last-child &-tail::after {
|
46
|
+
.reverse-order & {
|
47
|
+
visibility: visible;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
33
51
|
&-tail {
|
34
52
|
position: absolute;
|
35
53
|
display: flex;
|
@@ -50,7 +68,7 @@
|
|
50
68
|
.use-var(padding, steps-tail-horizontal-padding);
|
51
69
|
|
52
70
|
&::after {
|
53
|
-
content:
|
71
|
+
content: '';
|
54
72
|
width: 100%;
|
55
73
|
.use-var(border-radius, steps-tail-border-radius);
|
56
74
|
}
|
@@ -59,7 +77,7 @@
|
|
59
77
|
&-align-center {
|
60
78
|
&::before,
|
61
79
|
&::after {
|
62
|
-
content:
|
80
|
+
content: '';
|
63
81
|
width: 50%;
|
64
82
|
}
|
65
83
|
&::before {
|
@@ -90,7 +108,7 @@
|
|
90
108
|
.use-var(padding, steps-tail-vertical-padding);
|
91
109
|
|
92
110
|
&::after {
|
93
|
-
content:
|
111
|
+
content: '';
|
94
112
|
height: 100%;
|
95
113
|
.use-var(border-radius, steps-tail-border-radius);
|
96
114
|
}
|
@@ -99,7 +117,7 @@
|
|
99
117
|
&-align-center {
|
100
118
|
&::before,
|
101
119
|
&::after {
|
102
|
-
content:
|
120
|
+
content: '';
|
103
121
|
height: 50%;
|
104
122
|
}
|
105
123
|
&::before {
|
@@ -127,6 +145,20 @@
|
|
127
145
|
&-align-center&-status-error::before {
|
128
146
|
.use-var(background, steps-tail-finish-background);
|
129
147
|
}
|
148
|
+
|
149
|
+
&-status-finish::before,
|
150
|
+
&-status-process::after,
|
151
|
+
&-align-center&-status-error::after {
|
152
|
+
.reverse-order & {
|
153
|
+
.use-var(background, steps-tail-finish-background);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
&-status-process::before,
|
157
|
+
&-align-center&-status-error::before {
|
158
|
+
.reverse-order & {
|
159
|
+
.use-var(background, steps-tail-standard-background);
|
160
|
+
}
|
161
|
+
}
|
130
162
|
}
|
131
163
|
|
132
164
|
&-custom-icon,
|
@@ -206,7 +238,6 @@
|
|
206
238
|
}
|
207
239
|
|
208
240
|
&-content {
|
209
|
-
|
210
241
|
.horizontal & {
|
211
242
|
.use-var(margin-top, steps-horizontal-content-margin-top);
|
212
243
|
&-align-center {
|
@@ -262,6 +293,10 @@
|
|
262
293
|
}
|
263
294
|
|
264
295
|
&.vertical {
|
296
|
+
&.reverse-order {
|
297
|
+
flex-direction: column-reverse;
|
298
|
+
}
|
299
|
+
|
265
300
|
flex-direction: column;
|
266
301
|
.use-var(padding-bottom, steps-vertical-padding-bottom);
|
267
302
|
.use-var-with-rtl(padding-left, steps-vertical-padding-left);
|
@@ -307,6 +342,23 @@
|
|
307
342
|
.use-var(background, dark-steps-tail-finish-background);
|
308
343
|
}
|
309
344
|
}
|
345
|
+
&-status-finish::before,
|
346
|
+
&-status-process::after,
|
347
|
+
&-align-center&-status-error::after {
|
348
|
+
.reverse-order & {
|
349
|
+
@{arco-dark-mode-selector} & {
|
350
|
+
.use-var(background, dark-steps-tail-finish-background);
|
351
|
+
}
|
352
|
+
}
|
353
|
+
}
|
354
|
+
&-status-process::before,
|
355
|
+
&-align-center&-status-error::before {
|
356
|
+
.reverse-order & {
|
357
|
+
@{arco-dark-mode-selector} & {
|
358
|
+
.use-var(background, dark-steps-tail-standard-background);
|
359
|
+
}
|
360
|
+
}
|
361
|
+
}
|
310
362
|
}
|
311
363
|
&-icon {
|
312
364
|
.number.finish & {
|
package/esm/steps/type.d.ts
CHANGED
@@ -32,6 +32,11 @@ export interface StepsProps {
|
|
32
32
|
* @en Custom classname
|
33
33
|
*/
|
34
34
|
className?: string;
|
35
|
+
/**
|
36
|
+
* 顺序反转,设置为true后,顺序将从右到左,从下到上
|
37
|
+
* @en reverse the order from right to left and from bottom to top
|
38
|
+
*/
|
39
|
+
reverseOrder?: boolean;
|
35
40
|
/**
|
36
41
|
* 自定义样式,如果想用 css 控制 icon 颜色,可使用公共 mixin '.set-steps-color(@color)'
|
37
42
|
* @en Custom stylesheet. If want to use CSS to control icon color, use public mixin '.set-steps-color(@color)'
|
package/esnext/avatar/index.js
CHANGED
@@ -9,7 +9,7 @@ export function componentGenerator(Comp) {
|
|
9
9
|
return forwardRef((props, ref) => {
|
10
10
|
const { prefixCls } = useContext(GlobalContext);
|
11
11
|
const { shape: groupShape, size: groupSize, isGroup } = useContext(AvatarGroupContext);
|
12
|
-
const { shape = props.shape || (isGroup ? groupShape : 'circle'), size = props.size || (isGroup ? groupSize : 'small'), src, decoration = null, textAvatar = '', avatarStyle = {}, autoFixFontSize = true, autoFixFontOffset = 2, avatarName = '', avatarDesc = '', children = null, renderInfo = null, className = '', style = {}, imageProps = {}, defaultOverLap, onClickDecoration, onClick, } = props;
|
12
|
+
const { shape = props.shape || (isGroup ? groupShape : 'circle'), size = props.size || (isGroup ? groupSize : 'small'), src, decoration = null, textAvatar = '', avatarStyle = {}, avatarClass = '', autoFixFontSize = true, autoFixFontOffset = 2, avatarName = '', avatarDesc = '', children = null, renderInfo = null, className = '', style = {}, imageProps = {}, defaultOverLap, onClickDecoration, onClick, } = props;
|
13
13
|
const domRef = useRef(null);
|
14
14
|
const avatarRef = useRef(null);
|
15
15
|
const avatarTextRef = useRef(null);
|
@@ -51,7 +51,7 @@ export function componentGenerator(Comp) {
|
|
51
51
|
return (React.createElement("div", { ref: domRef, style: style, className: cls(`${prefixCls}-avatar-wrapper`, className, size, shape, `${prefixCls}-avatar-wrapper-shape-${shape}`, {
|
52
52
|
[`${prefixCls}-avatar-wrapper-with-info ${prefixCls}-avatar-wrapper-with-info-size-${size} with-info`]: Boolean(avatarName),
|
53
53
|
}), onClick: onClick },
|
54
|
-
React.createElement("div", { className: cls(`${prefixCls}-avatar`, `${prefixCls}-avatar-size-${size}`, size, `${prefixCls}-avatar-shape-${shape}`, shape, {
|
54
|
+
React.createElement("div", { className: cls(`${prefixCls}-avatar`, avatarClass, `${prefixCls}-avatar-size-${size}`, size, `${prefixCls}-avatar-shape-${shape}`, shape, {
|
55
55
|
[`${prefixCls}-text-avatar ${prefixCls}-avatar-mode-text`]: isTextAvatar,
|
56
56
|
[`${prefixCls}-image-avatar ${prefixCls}-avatar-mode-image`]: isImageAvatar,
|
57
57
|
[`${prefixCls}-avatar-default-overlap default-overlap`]: useDefaultAvatar,
|
package/esnext/avatar/type.d.ts
CHANGED
@@ -42,6 +42,12 @@ export interface AvatarProps<T extends ImageProps = ImageProps> extends BaseProp
|
|
42
42
|
* @default {}
|
43
43
|
*/
|
44
44
|
avatarStyle?: React.CSSProperties;
|
45
|
+
/**
|
46
|
+
* 头像元素的自定义类名
|
47
|
+
* @en Custom classname for avatar element
|
48
|
+
* @default ""
|
49
|
+
*/
|
50
|
+
avatarClass?: string;
|
45
51
|
/**
|
46
52
|
* 是否自动根据头像尺寸调整字体大小
|
47
53
|
* @en Whether to automatically adjust the font size according to the avatar size
|
package/esnext/carousel/index.js
CHANGED
@@ -94,6 +94,11 @@ const Carousel = forwardRef((props, ref) => {
|
|
94
94
|
if (posAdjustingRef.current) {
|
95
95
|
return;
|
96
96
|
}
|
97
|
+
// touchMove触发时,阻止handleTouchStart多次执行(如点击事件)
|
98
|
+
// @en When touchMove is triggered, prevent handleTouchStart from executing multiple times (such as click events)
|
99
|
+
if (touchStartedRef.current && touchMovedRef.current) {
|
100
|
+
return;
|
101
|
+
}
|
97
102
|
touchStartedRef.current = true;
|
98
103
|
touchMovedRef.current = false;
|
99
104
|
clear();
|
@@ -507,14 +512,18 @@ const Carousel = forwardRef((props, ref) => {
|
|
507
512
|
jumpTo(index, false);
|
508
513
|
return;
|
509
514
|
}
|
510
|
-
if (!touchStartedRef.current
|
511
|
-
!touchMovedRef.current ||
|
512
|
-
posAdjustingRef.current ||
|
513
|
-
touchStoppedRef.current) {
|
515
|
+
if (!touchStartedRef.current) {
|
514
516
|
return;
|
515
517
|
}
|
516
518
|
touchStartedRef.current = false;
|
519
|
+
if (!touchMovedRef.current) {
|
520
|
+
setPlayIntervalRef.current();
|
521
|
+
return;
|
522
|
+
}
|
517
523
|
touchMovedRef.current = false;
|
524
|
+
if (posAdjustingRef.current || touchStoppedRef.current) {
|
525
|
+
return;
|
526
|
+
}
|
518
527
|
const touchEndTime = new Date().getTime();
|
519
528
|
const dis = Math.abs(distance);
|
520
529
|
const speed = (dis / (touchEndTime - touchStartTimeRef.current)) * 1000;
|
package/esnext/steps/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { StepsProps, StepsRef } from './type';
|
3
3
|
export * from './type';
|
4
|
-
export declare const StepsContext: React.Context<Pick<StepsProps, "direction" | "status" | "align" | "iconType" | "current"> & {
|
4
|
+
export declare const StepsContext: React.Context<Pick<StepsProps, "direction" | "status" | "align" | "iconType" | "current" | "reverseOrder"> & {
|
5
5
|
index?: number | undefined;
|
6
6
|
changeIndex: (newIndex: number) => void;
|
7
7
|
}>;
|
package/esnext/steps/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import React, { useRef, forwardRef, useImperativeHandle, Children, createContext, useCallback, useState, useEffect, } from 'react';
|
2
|
-
import { componentWrapper } from '@arco-design/mobile-utils';
|
2
|
+
import { cls, componentWrapper } from '@arco-design/mobile-utils';
|
3
3
|
import { ContextLayout } from '../context-provider';
|
4
4
|
import Step from './step';
|
5
5
|
import { useSystem, useRefState } from '../_helpers';
|
6
6
|
export * from './type';
|
7
7
|
export const StepsContext = createContext({ changeIndex: () => { } });
|
8
8
|
const Steps = forwardRef((props, ref) => {
|
9
|
-
const { className = '', style, children, direction = 'horizontal', align: userSetAlign, iconType = 'number', current, defaultIndex = 0, status = 'process', items, onClick, onChange, } = props;
|
9
|
+
const { className = '', style, children, direction = 'horizontal', align: userSetAlign, iconType = 'number', current, defaultIndex = 0, status = 'process', items, reverseOrder = false, onClick, onChange, } = props;
|
10
10
|
const defaultAlign = direction === 'vertical' ? 'start' : 'center';
|
11
11
|
const align = userSetAlign !== void 0 ? userSetAlign : defaultAlign;
|
12
12
|
const [innerIndex, setInnerIndex] = useState(Number(defaultIndex));
|
@@ -31,9 +31,12 @@ const Steps = forwardRef((props, ref) => {
|
|
31
31
|
index,
|
32
32
|
status: activeIndex === index ? status : void 0,
|
33
33
|
align,
|
34
|
+
reverseOrder,
|
34
35
|
changeIndex,
|
35
36
|
}, key: index }, child)), [iconType, activeIndex, direction, align]);
|
36
|
-
return (React.createElement(ContextLayout, null, ({ prefixCls }) => (React.createElement("div", { className: `${prefixCls}-steps all-border-box ${className} ${direction} ${system}`,
|
37
|
+
return (React.createElement(ContextLayout, null, ({ prefixCls }) => (React.createElement("div", { className: cls(`${prefixCls}-steps all-border-box ${className} ${direction} ${system}`, {
|
38
|
+
'reverse-order': reverseOrder,
|
39
|
+
}), style: style, ref: domRef }, items
|
37
40
|
? items.map((item, index) => renderStep(React.createElement(Step, Object.assign({}, item, { key: index })), index))
|
38
41
|
: Children.toArray(children).map((child, index) => renderStep(child, index))))));
|
39
42
|
});
|
@@ -516,6 +516,12 @@
|
|
516
516
|
display: flex;
|
517
517
|
padding: 0.32rem 0 ;
|
518
518
|
}
|
519
|
+
.arco-steps.reverse-order {
|
520
|
+
-webkit-box-orient: horizontal;
|
521
|
+
-webkit-box-direction: reverse;
|
522
|
+
-webkit-flex-direction: row-reverse;
|
523
|
+
flex-direction: row-reverse;
|
524
|
+
}
|
519
525
|
.arco-steps-item {
|
520
526
|
position: relative;
|
521
527
|
display: -webkit-box;
|
@@ -548,6 +554,14 @@
|
|
548
554
|
.arco-steps-item:last-child .arco-steps-item-tail::after {
|
549
555
|
visibility: hidden;
|
550
556
|
}
|
557
|
+
.reverse-order .arco-steps-item:first-child .arco-steps-item-tail::after,
|
558
|
+
.reverse-order .arco-steps-item:last-child .arco-steps-item-tail::before {
|
559
|
+
visibility: hidden;
|
560
|
+
}
|
561
|
+
.reverse-order .arco-steps-item:first-child .arco-steps-item-tail::before,
|
562
|
+
.reverse-order .arco-steps-item:last-child .arco-steps-item-tail::after {
|
563
|
+
visibility: visible;
|
564
|
+
}
|
551
565
|
.arco-steps-item-tail {
|
552
566
|
position: absolute;
|
553
567
|
display: -webkit-box;
|
@@ -577,13 +591,13 @@
|
|
577
591
|
right: 9PX ;
|
578
592
|
}
|
579
593
|
.horizontal .arco-steps-item-tail-align-start::after {
|
580
|
-
content:
|
594
|
+
content: '';
|
581
595
|
width: 100%;
|
582
596
|
border-radius: 2PX ;
|
583
597
|
}
|
584
598
|
.horizontal .arco-steps-item-tail-align-center::before,
|
585
599
|
.horizontal .arco-steps-item-tail-align-center::after {
|
586
|
-
content:
|
600
|
+
content: '';
|
587
601
|
width: 50%;
|
588
602
|
}
|
589
603
|
.horizontal .arco-steps-item-tail-align-center::before {
|
@@ -637,13 +651,13 @@
|
|
637
651
|
padding: 14PX 0 ;
|
638
652
|
}
|
639
653
|
.vertical .arco-steps-item-tail-align-start::after {
|
640
|
-
content:
|
654
|
+
content: '';
|
641
655
|
height: 100%;
|
642
656
|
border-radius: 2PX ;
|
643
657
|
}
|
644
658
|
.vertical .arco-steps-item-tail-align-center::before,
|
645
659
|
.vertical .arco-steps-item-tail-align-center::after {
|
646
|
-
content:
|
660
|
+
content: '';
|
647
661
|
height: 50%;
|
648
662
|
}
|
649
663
|
.vertical .arco-steps-item-tail-align-center::before {
|
@@ -667,6 +681,15 @@
|
|
667
681
|
.arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::before {
|
668
682
|
background: #165DFF ;
|
669
683
|
}
|
684
|
+
.reverse-order .arco-steps-item-tail-status-finish::before,
|
685
|
+
.reverse-order .arco-steps-item-tail-status-process::after,
|
686
|
+
.reverse-order .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::after {
|
687
|
+
background: #165DFF ;
|
688
|
+
}
|
689
|
+
.reverse-order .arco-steps-item-tail-status-process::before,
|
690
|
+
.reverse-order .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::before {
|
691
|
+
background: #e5e6eb ;
|
692
|
+
}
|
670
693
|
.arco-steps-item-custom-icon,
|
671
694
|
.arco-steps-item-icon {
|
672
695
|
display: -webkit-inline-box;
|
@@ -796,6 +819,12 @@
|
|
796
819
|
padding-bottom: 0 ;
|
797
820
|
padding-left: 0.4rem ;
|
798
821
|
}
|
822
|
+
.arco-steps.vertical.reverse-order {
|
823
|
+
-webkit-box-orient: vertical;
|
824
|
+
-webkit-box-direction: reverse;
|
825
|
+
-webkit-flex-direction: column-reverse;
|
826
|
+
flex-direction: column-reverse;
|
827
|
+
}
|
799
828
|
[dir="rtl"] .arco-steps.vertical {
|
800
829
|
padding-left: initial;
|
801
830
|
padding-right: 0.4rem ;
|
@@ -823,6 +852,15 @@
|
|
823
852
|
.arco-theme-dark .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::before {
|
824
853
|
background: #3C7EFF ;
|
825
854
|
}
|
855
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-status-finish::before,
|
856
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-status-process::after,
|
857
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::after {
|
858
|
+
background: #3C7EFF ;
|
859
|
+
}
|
860
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-status-process::before,
|
861
|
+
.arco-theme-dark .reverse-order .arco-steps-item-tail-align-center.arco-steps-item-tail-status-error::before {
|
862
|
+
background: #484849 ;
|
863
|
+
}
|
826
864
|
.arco-theme-dark .number.finish .arco-steps-item-icon {
|
827
865
|
background: #000D4D ;
|
828
866
|
}
|