@arco-design/mobile-react 2.27.5 → 2.28.1
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 +30 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.d.ts +1 -0
- package/cjs/_helpers/hooks.js +43 -27
- package/cjs/avatar/type.d.ts +1 -1
- package/cjs/badge/style/css/index.css +12 -0
- package/cjs/badge/style/index.less +3 -3
- package/cjs/button/style/css/index.css +4 -0
- package/cjs/button/style/index.less +1 -1
- package/cjs/cell/style/css/index.css +7 -0
- package/cjs/cell/style/index.less +4 -1
- package/cjs/checkbox/style/css/index.css +13 -0
- package/cjs/checkbox/style/index.less +3 -3
- package/cjs/collapse/collapse.js +12 -6
- package/cjs/form/style/css/index.css +16 -0
- package/cjs/form/style/index.less +4 -4
- package/cjs/image-preview/index.js +2 -1
- package/cjs/radio/style/css/index.css +8 -0
- package/cjs/radio/style/index.less +2 -2
- package/cjs/rate/index.js +5 -3
- package/cjs/rate/style/css/index.css +4 -0
- package/cjs/rate/style/index.less +4 -0
- package/cjs/sticky/index.d.ts +5 -0
- package/cjs/sticky/index.js +20 -7
- package/cjs/switch/index.js +7 -2
- package/cjs/switch/style/css/index.css +44 -0
- package/cjs/switch/style/index.less +19 -7
- package/cjs/tabs/demo/style/css/mobile.css +11 -0
- package/cjs/tabs/demo/style/mobile.less +5 -1
- package/cjs/tabs/index.js +14 -5
- package/cjs/tabs/style/css/index.css +32 -7
- package/cjs/tabs/style/index.less +9 -14
- package/cjs/tabs/tab-cell-underline.js +14 -5
- package/cjs/tabs/tab-cell.js +15 -7
- package/cjs/tabs/tab-pane.js +4 -3
- package/cjs/tabs/type.d.ts +1 -0
- package/dist/index.js +92 -40
- package/dist/index.min.js +3 -3
- package/dist/style.css +134 -7
- package/dist/style.min.css +1 -1
- package/esm/_helpers/hooks.d.ts +1 -0
- package/esm/_helpers/hooks.js +41 -27
- package/esm/avatar/type.d.ts +1 -1
- package/esm/badge/style/css/index.css +12 -0
- package/esm/badge/style/index.less +3 -3
- package/esm/button/style/css/index.css +4 -0
- package/esm/button/style/index.less +1 -1
- package/esm/cell/style/css/index.css +7 -0
- package/esm/cell/style/index.less +4 -1
- package/esm/checkbox/style/css/index.css +13 -0
- package/esm/checkbox/style/index.less +3 -3
- package/esm/collapse/collapse.js +14 -8
- package/esm/form/style/css/index.css +16 -0
- package/esm/form/style/index.less +4 -4
- package/esm/image-preview/index.js +2 -1
- package/esm/radio/style/css/index.css +8 -0
- package/esm/radio/style/index.less +2 -2
- package/esm/rate/index.js +5 -3
- package/esm/rate/style/css/index.css +4 -0
- package/esm/rate/style/index.less +4 -0
- package/esm/sticky/index.d.ts +5 -0
- package/esm/sticky/index.js +20 -7
- package/esm/switch/index.js +9 -4
- package/esm/switch/style/css/index.css +44 -0
- package/esm/switch/style/index.less +19 -7
- package/esm/tabs/demo/style/css/mobile.css +11 -0
- package/esm/tabs/demo/style/mobile.less +5 -1
- package/esm/tabs/index.js +16 -7
- package/esm/tabs/style/css/index.css +32 -7
- package/esm/tabs/style/index.less +9 -14
- package/esm/tabs/tab-cell-underline.js +14 -6
- package/esm/tabs/tab-cell.js +15 -8
- package/esm/tabs/tab-pane.js +4 -3
- package/esm/tabs/type.d.ts +1 -0
- package/package.json +17 -3
- package/umd/_helpers/hooks.d.ts +1 -0
- package/umd/_helpers/hooks.js +43 -27
- package/umd/avatar/type.d.ts +1 -1
- package/umd/badge/style/css/index.css +12 -0
- package/umd/badge/style/index.less +3 -3
- package/umd/button/style/css/index.css +4 -0
- package/umd/button/style/index.less +1 -1
- package/umd/cell/style/css/index.css +7 -0
- package/umd/cell/style/index.less +4 -1
- package/umd/checkbox/style/css/index.css +13 -0
- package/umd/checkbox/style/index.less +3 -3
- package/umd/collapse/collapse.js +12 -6
- package/umd/form/style/css/index.css +16 -0
- package/umd/form/style/index.less +4 -4
- package/umd/image-preview/index.js +2 -1
- package/umd/radio/style/css/index.css +8 -0
- package/umd/radio/style/index.less +2 -2
- package/umd/rate/index.js +5 -3
- package/umd/rate/style/css/index.css +4 -0
- package/umd/rate/style/index.less +4 -0
- package/umd/sticky/index.d.ts +5 -0
- package/umd/sticky/index.js +20 -7
- package/umd/switch/index.js +7 -2
- package/umd/switch/style/css/index.css +44 -0
- package/umd/switch/style/index.less +19 -7
- package/umd/tabs/demo/style/css/mobile.css +11 -0
- package/umd/tabs/demo/style/mobile.less +5 -1
- package/umd/tabs/index.js +14 -5
- package/umd/tabs/style/css/index.css +32 -7
- package/umd/tabs/style/index.less +9 -14
- package/umd/tabs/tab-cell-underline.js +16 -9
- package/umd/tabs/tab-cell.js +17 -11
- package/umd/tabs/tab-pane.js +4 -3
- package/umd/tabs/type.d.ts +1 -0
|
@@ -44,15 +44,31 @@
|
|
|
44
44
|
right: auto;
|
|
45
45
|
left: 5PX ;
|
|
46
46
|
}
|
|
47
|
+
[dir="rtl"] .arco-switch.type-android.checked .arco-switch-text {
|
|
48
|
+
right: initial;
|
|
49
|
+
left: auto;
|
|
50
|
+
}
|
|
51
|
+
[dir="rtl"] .arco-switch.type-android.checked .arco-switch-text {
|
|
52
|
+
left: initial;
|
|
53
|
+
right: 5PX ;
|
|
54
|
+
}
|
|
47
55
|
.arco-switch.type-android.checked .arco-switch-inner {
|
|
48
56
|
-webkit-transform: translateX(16PX) ;
|
|
49
57
|
transform: translateX(16PX) ;
|
|
50
58
|
}
|
|
59
|
+
[dir="rtl"] .arco-switch.type-android.checked .arco-switch-inner {
|
|
60
|
+
-webkit-transform: rotate(180deg) translateX(16PX) ;
|
|
61
|
+
transform: rotate(180deg) translateX(16PX) ;
|
|
62
|
+
}
|
|
51
63
|
.arco-switch.type-android .arco-switch-inner {
|
|
52
64
|
width: 20PX ;
|
|
53
65
|
height: 20PX ;
|
|
54
66
|
box-shadow: 0 2PX 4PX 0 rgba(0, 0, 0, 0.08) ;
|
|
55
67
|
}
|
|
68
|
+
[dir="rtl"] .arco-switch.type-android .arco-switch-inner {
|
|
69
|
+
-webkit-transform: rotate(180deg);
|
|
70
|
+
transform: rotate(180deg);
|
|
71
|
+
}
|
|
56
72
|
.arco-switch.type-android.disabled.checked {
|
|
57
73
|
background-color: #94bfff ;
|
|
58
74
|
}
|
|
@@ -63,6 +79,10 @@
|
|
|
63
79
|
font-size: 12PX ;
|
|
64
80
|
right: 5PX ;
|
|
65
81
|
}
|
|
82
|
+
[dir="rtl"] .arco-switch.type-android .arco-switch-text {
|
|
83
|
+
right: initial;
|
|
84
|
+
left: 5PX ;
|
|
85
|
+
}
|
|
66
86
|
.arco-switch.type-ios {
|
|
67
87
|
width: 1.02rem ;
|
|
68
88
|
height: 0.62rem ;
|
|
@@ -83,11 +103,23 @@
|
|
|
83
103
|
right: auto;
|
|
84
104
|
left: 0.12rem ;
|
|
85
105
|
}
|
|
106
|
+
[dir="rtl"] .arco-switch.type-ios.checked .arco-switch-text {
|
|
107
|
+
right: initial;
|
|
108
|
+
left: auto;
|
|
109
|
+
}
|
|
110
|
+
[dir="rtl"] .arco-switch.type-ios.checked .arco-switch-text {
|
|
111
|
+
left: initial;
|
|
112
|
+
right: 0.12rem ;
|
|
113
|
+
}
|
|
86
114
|
.arco-switch.type-ios.checked .arco-switch-inner {
|
|
87
115
|
-webkit-transform: translateX(0.4rem) ;
|
|
88
116
|
transform: translateX(0.4rem) ;
|
|
89
117
|
box-shadow: 0 3PX 2PX 0 rgba(0, 0, 0, 0.12) ;
|
|
90
118
|
}
|
|
119
|
+
[dir="rtl"] .arco-switch.type-ios.checked .arco-switch-inner {
|
|
120
|
+
-webkit-transform: rotate(180deg) translateX(0.4rem) ;
|
|
121
|
+
transform: rotate(180deg) translateX(0.4rem) ;
|
|
122
|
+
}
|
|
91
123
|
.arco-switch.type-ios.disabled.checked {
|
|
92
124
|
opacity: 0.3 ;
|
|
93
125
|
}
|
|
@@ -95,6 +127,10 @@
|
|
|
95
127
|
font-size: 0.28rem ;
|
|
96
128
|
right: 0.12rem ;
|
|
97
129
|
}
|
|
130
|
+
[dir="rtl"] .arco-switch.type-ios .arco-switch-text {
|
|
131
|
+
right: initial;
|
|
132
|
+
left: 0.12rem ;
|
|
133
|
+
}
|
|
98
134
|
.arco-switch.type-ios .arco-switch-inner {
|
|
99
135
|
width: 0.54rem ;
|
|
100
136
|
height: 0.54rem ;
|
|
@@ -136,6 +172,10 @@
|
|
|
136
172
|
border-radius: 150%;
|
|
137
173
|
}
|
|
138
174
|
}
|
|
175
|
+
[dir="rtl"] .arco-switch.type-ios .arco-switch-inner {
|
|
176
|
+
-webkit-transform: rotate(180deg);
|
|
177
|
+
transform: rotate(180deg);
|
|
178
|
+
}
|
|
139
179
|
.arco-switch.type-ios.disabled.checked {
|
|
140
180
|
background-color: #4DD865 ;
|
|
141
181
|
}
|
|
@@ -169,6 +209,10 @@
|
|
|
169
209
|
-webkit-transition: all 0.2s ;
|
|
170
210
|
transition: all 0.2s ;
|
|
171
211
|
}
|
|
212
|
+
[dir="rtl"] .arco-switch-inner {
|
|
213
|
+
left: initial;
|
|
214
|
+
right: 0;
|
|
215
|
+
}
|
|
172
216
|
.fully .arco-switch-inner {
|
|
173
217
|
border-radius: 50% ;
|
|
174
218
|
}
|
|
@@ -33,17 +33,23 @@
|
|
|
33
33
|
&.checked {
|
|
34
34
|
.use-var(background-color, switch-android-checked-background);
|
|
35
35
|
.@{prefix}-switch-text {
|
|
36
|
-
right
|
|
37
|
-
.use-var(left, switch-android-text-gap-size);
|
|
36
|
+
.set-prop-with-rtl(right, auto);
|
|
37
|
+
.use-var-with-rtl(left, switch-android-text-gap-size);
|
|
38
38
|
}
|
|
39
39
|
.@{prefix}-switch-inner {
|
|
40
40
|
.use-var(transform, switch-android-checked-inner-transform);
|
|
41
|
+
[dir="rtl"] & {
|
|
42
|
+
.use-var(transform, switch-android-checked-inner-transform, "rotate(180deg)");
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
.@{prefix}-switch-inner {
|
|
44
47
|
.use-var(width, switch-android-inner-diameter-size);
|
|
45
48
|
.use-var(height, switch-android-inner-diameter-size);
|
|
46
49
|
.use-var(box-shadow, switch-android-inner-box-shadow);
|
|
50
|
+
[dir="rtl"] & {
|
|
51
|
+
transform: rotate(180deg);
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
&.disabled {
|
|
@@ -58,7 +64,7 @@
|
|
|
58
64
|
}
|
|
59
65
|
.@{prefix}-switch-text {
|
|
60
66
|
.use-var(font-size, switch-android-text-font-size);
|
|
61
|
-
.use-var(right, switch-android-text-gap-size);
|
|
67
|
+
.use-var-with-rtl(right, switch-android-text-gap-size);
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
|
|
@@ -80,12 +86,15 @@
|
|
|
80
86
|
&.checked {
|
|
81
87
|
.use-var(background-color, switch-ios-checked-background);
|
|
82
88
|
.@{prefix}-switch-text {
|
|
83
|
-
right
|
|
84
|
-
.use-var(left, switch-ios-text-gap-size);
|
|
89
|
+
.set-prop-with-rtl(right, auto);
|
|
90
|
+
.use-var-with-rtl(left, switch-ios-text-gap-size);
|
|
85
91
|
}
|
|
86
92
|
.@{prefix}-switch-inner {
|
|
87
93
|
.use-var(transform, switch-ios-checked-inner-transform);
|
|
88
94
|
.use-var(box-shadow, switch-ios-inner-box-shadow);
|
|
95
|
+
[dir="rtl"] & {
|
|
96
|
+
.use-var(transform, switch-ios-checked-inner-transform, "rotate(180deg)");
|
|
97
|
+
}
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
100
|
|
|
@@ -94,12 +103,15 @@
|
|
|
94
103
|
}
|
|
95
104
|
.@{prefix}-switch-text {
|
|
96
105
|
.use-var(font-size, switch-ios-text-font-size);
|
|
97
|
-
.use-var(right, switch-ios-text-gap-size);
|
|
106
|
+
.use-var-with-rtl(right, switch-ios-text-gap-size);
|
|
98
107
|
}
|
|
99
108
|
.@{prefix}-switch-inner {
|
|
100
109
|
.use-var(width, switch-ios-inner-diameter-size);
|
|
101
110
|
.use-var(height, switch-ios-inner-diameter-size);
|
|
102
111
|
.onepx-border-var(all, switch-ios-inner-border-color, 50%);
|
|
112
|
+
[dir="rtl"] & {
|
|
113
|
+
transform: rotate(180deg);
|
|
114
|
+
}
|
|
103
115
|
}
|
|
104
116
|
|
|
105
117
|
&.disabled {
|
|
@@ -127,7 +139,7 @@
|
|
|
127
139
|
|
|
128
140
|
&-inner {
|
|
129
141
|
position: relative;
|
|
130
|
-
left
|
|
142
|
+
.set-prop-with-rtl(left, 0);
|
|
131
143
|
top: 0;
|
|
132
144
|
display: flex;
|
|
133
145
|
align-items: center;
|
|
@@ -43,6 +43,17 @@
|
|
|
43
43
|
justify-content: flex-end;
|
|
44
44
|
font-weight: bold;
|
|
45
45
|
}
|
|
46
|
+
[dir="rtl"] #demo-tabs .demo-tabs-add-extra {
|
|
47
|
+
right: initial;
|
|
48
|
+
left: 0;
|
|
49
|
+
}
|
|
50
|
+
[dir="rtl"] #demo-tabs .demo-tabs-add-extra {
|
|
51
|
+
-webkit-box-pack: start;
|
|
52
|
+
-webkit-justify-content: flex-start;
|
|
53
|
+
justify-content: flex-start;
|
|
54
|
+
-webkit-transform: rotate(180deg);
|
|
55
|
+
transform: rotate(180deg);
|
|
56
|
+
}
|
|
46
57
|
#demo-tabs .demo-tab-custom-bar .arco-tab-cell-container-wrap {
|
|
47
58
|
height: 1.52rem;
|
|
48
59
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
.demo-tabs-add-extra {
|
|
26
26
|
position: absolute;
|
|
27
|
-
right
|
|
27
|
+
.set-prop-with-rtl(right, 0);
|
|
28
28
|
top: 0;
|
|
29
29
|
background: linear-gradient(270deg, #fff 66.04%, rgba(255, 255, 255, 0) 105%);
|
|
30
30
|
.rem(width, 64);
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
align-items: center;
|
|
37
37
|
justify-content: flex-end;
|
|
38
38
|
font-weight: bold;
|
|
39
|
+
[dir="rtl"] & {
|
|
40
|
+
justify-content: flex-start;
|
|
41
|
+
transform: rotate(180deg);
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
.demo-tab-custom-bar {
|
package/umd/tabs/index.js
CHANGED
|
@@ -150,6 +150,10 @@
|
|
|
150
150
|
tabBarStopPropagation = _props$tabBarStopProp === void 0 ? true : _props$tabBarStopProp,
|
|
151
151
|
_props$swipeEnergySav = props.swipeEnergySaving,
|
|
152
152
|
swipeEnergySaving = _props$swipeEnergySav === void 0 ? false : _props$swipeEnergySav;
|
|
153
|
+
|
|
154
|
+
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
|
155
|
+
useRtl = _useContext.useRtl;
|
|
156
|
+
|
|
153
157
|
var domRef = (0, _react.useRef)(null);
|
|
154
158
|
var cellRef = (0, _react.useRef)(null);
|
|
155
159
|
var paneRef = (0, _react.useRef)(null);
|
|
@@ -201,6 +205,8 @@
|
|
|
201
205
|
var allPanes = getAllPanes();
|
|
202
206
|
var tabDirection = ['top', 'bottom'].indexOf(tabBarPosition) !== -1 ? 'vertical' : 'horizontal';
|
|
203
207
|
var canSwipe = mode === 'swipe' && !disabled && swipeable && tabDirection === 'vertical' && tabs.length > 1;
|
|
208
|
+
var horizontalUseRtl = tabDirection === 'vertical' && useRtl;
|
|
209
|
+
var rtlRatio = horizontalUseRtl ? -1 : 1;
|
|
204
210
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
205
211
|
return {
|
|
206
212
|
dom: domRef.current,
|
|
@@ -320,6 +326,7 @@
|
|
|
320
326
|
var posDisY = touchMoveY - touchStartYRef.current;
|
|
321
327
|
var absDisX = Math.abs(posDisX);
|
|
322
328
|
var absDisY = Math.abs(posDisY);
|
|
329
|
+
var comparedDis = posDisX * rtlRatio;
|
|
323
330
|
|
|
324
331
|
if (scrollingRef.current === null) {
|
|
325
332
|
scrollingRef.current = absDisX < absDisY;
|
|
@@ -337,10 +344,10 @@
|
|
|
337
344
|
return;
|
|
338
345
|
}
|
|
339
346
|
|
|
340
|
-
if (activeIndexRef.current === 0 &&
|
|
347
|
+
if (activeIndexRef.current === 0 && comparedDis > 0 || activeIndexRef.current === tabs.length - 1 && comparedDis < 0) {
|
|
341
348
|
if (!touchStoppedRef.current && absDisX > stopTouchThreshold) {
|
|
342
349
|
touchStoppedRef.current = true;
|
|
343
|
-
onTouchStopped && onTouchStopped(
|
|
350
|
+
onTouchStopped && onTouchStopped(comparedDis >= 0 ? -1 : 1);
|
|
344
351
|
}
|
|
345
352
|
|
|
346
353
|
setDistance(0);
|
|
@@ -390,10 +397,11 @@
|
|
|
390
397
|
var index = activeIndexRef.current;
|
|
391
398
|
var needJump = Math.abs(dis) > maxSlice && Math.abs(dis) > distanceToChangeTab || Math.abs(speed) > speedToChangeTab;
|
|
392
399
|
var newIndex = index;
|
|
400
|
+
var comparedDis = dis * rtlRatio;
|
|
393
401
|
|
|
394
|
-
if (
|
|
402
|
+
if (comparedDis > 0 && needJump) {
|
|
395
403
|
newIndex = index - 1;
|
|
396
|
-
} else if (
|
|
404
|
+
} else if (comparedDis < 0 && needJump) {
|
|
397
405
|
newIndex = index + 1;
|
|
398
406
|
}
|
|
399
407
|
|
|
@@ -537,7 +545,8 @@
|
|
|
537
545
|
tabPaneExtra: tabPaneExtra,
|
|
538
546
|
autoHeight: autoHeight,
|
|
539
547
|
onScroll: onScroll,
|
|
540
|
-
swipeEnergySaving: swipeEnergySaving
|
|
548
|
+
swipeEnergySaving: swipeEnergySaving,
|
|
549
|
+
rtlRatio: rtlRatio
|
|
541
550
|
}, commonProps)));
|
|
542
551
|
});
|
|
543
552
|
});
|
|
@@ -368,11 +368,12 @@
|
|
|
368
368
|
-webkit-flex: 1;
|
|
369
369
|
flex: 1;
|
|
370
370
|
}
|
|
371
|
-
.arco-tab-cell.vertical:not(.custom).line {
|
|
371
|
+
.arco-tab-cell.vertical:not(.custom).line:not(.last) {
|
|
372
372
|
margin-right: 0.8rem ;
|
|
373
373
|
}
|
|
374
|
-
.arco-tab-cell.vertical:not(.custom).line.last {
|
|
375
|
-
margin-right:
|
|
374
|
+
[dir="rtl"] .arco-tab-cell.vertical:not(.custom).line:not(.last) {
|
|
375
|
+
margin-right: initial;
|
|
376
|
+
margin-left: 0.8rem ;
|
|
376
377
|
}
|
|
377
378
|
.arco-tab-cell.vertical:not(.custom).line.active,
|
|
378
379
|
.arco-tab-cell.vertical:not(.custom).line-divide.active {
|
|
@@ -407,29 +408,53 @@
|
|
|
407
408
|
.arco-tab-cell.vertical:not(.custom).card:not(:last-child) {
|
|
408
409
|
border-right: 1PX solid #165dff ;
|
|
409
410
|
}
|
|
411
|
+
[dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:not(:last-child) {
|
|
412
|
+
border-right: initial;
|
|
413
|
+
border-left: 1PX solid #165dff ;
|
|
414
|
+
}
|
|
410
415
|
.arco-tab-cell.vertical:not(.custom).card:first-of-type {
|
|
411
416
|
border-top-left-radius: 2PX ;
|
|
412
417
|
border-bottom-left-radius: 2PX ;
|
|
413
418
|
}
|
|
419
|
+
[dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:first-of-type {
|
|
420
|
+
border-top-left-radius: initial;
|
|
421
|
+
border-top-right-radius: 2PX ;
|
|
422
|
+
}
|
|
423
|
+
[dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:first-of-type {
|
|
424
|
+
border-bottom-left-radius: initial;
|
|
425
|
+
border-bottom-right-radius: 2PX ;
|
|
426
|
+
}
|
|
414
427
|
.arco-tab-cell.vertical:not(.custom).card:last-of-type {
|
|
415
428
|
border-top-right-radius: 2PX ;
|
|
416
429
|
border-bottom-right-radius: 2PX ;
|
|
417
430
|
}
|
|
431
|
+
[dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:last-of-type {
|
|
432
|
+
border-top-right-radius: initial;
|
|
433
|
+
border-top-left-radius: 2PX ;
|
|
434
|
+
}
|
|
435
|
+
[dir="rtl"] .arco-tab-cell.vertical:not(.custom).card:last-of-type {
|
|
436
|
+
border-bottom-right-radius: initial;
|
|
437
|
+
border-bottom-left-radius: 2PX ;
|
|
438
|
+
}
|
|
418
439
|
.arco-tab-cell.vertical:not(.custom).card.android,
|
|
419
440
|
.arco-tab-cell.vertical:not(.custom).tag-divide.android {
|
|
420
441
|
padding-top: 0.04rem;
|
|
421
442
|
}
|
|
422
443
|
.arco-tab-cell.vertical:not(.custom).tag,
|
|
423
444
|
.arco-tab-cell.vertical:not(.custom).tag-divide {
|
|
424
|
-
margin-right: 0.32rem ;
|
|
425
445
|
padding: 0 0.32rem ;
|
|
426
446
|
border-radius: 2rem;
|
|
427
447
|
background: #f7f8fA ;
|
|
428
448
|
color: #1d2129 ;
|
|
429
449
|
}
|
|
430
|
-
.arco-tab-cell.vertical:not(.custom).tag.last,
|
|
431
|
-
.arco-tab-cell.vertical:not(.custom).tag-divide.last {
|
|
432
|
-
margin-right:
|
|
450
|
+
.arco-tab-cell.vertical:not(.custom).tag:not(.last),
|
|
451
|
+
.arco-tab-cell.vertical:not(.custom).tag-divide:not(.last) {
|
|
452
|
+
margin-right: 0.32rem ;
|
|
453
|
+
}
|
|
454
|
+
[dir="rtl"] .arco-tab-cell.vertical:not(.custom).tag:not(.last),
|
|
455
|
+
[dir="rtl"] .arco-tab-cell.vertical:not(.custom).tag-divide:not(.last) {
|
|
456
|
+
margin-right: initial;
|
|
457
|
+
margin-left: 0.32rem ;
|
|
433
458
|
}
|
|
434
459
|
.arco-tab-cell.vertical:not(.custom).tag.active,
|
|
435
460
|
.arco-tab-cell.vertical:not(.custom).tag-divide.active {
|
|
@@ -310,12 +310,8 @@
|
|
|
310
310
|
|
|
311
311
|
&:not(.custom) {
|
|
312
312
|
|
|
313
|
-
&.line {
|
|
314
|
-
.use-var(margin-right, tabs-tab-bar-line-gutter);
|
|
315
|
-
|
|
316
|
-
&.last {
|
|
317
|
-
margin-right: 0;
|
|
318
|
-
}
|
|
313
|
+
&.line:not(.last) {
|
|
314
|
+
.use-var-with-rtl(margin-right, tabs-tab-bar-line-gutter);
|
|
319
315
|
}
|
|
320
316
|
|
|
321
317
|
&.line,
|
|
@@ -337,17 +333,17 @@
|
|
|
337
333
|
}
|
|
338
334
|
|
|
339
335
|
&:not(:last-child) {
|
|
340
|
-
.use-var(border-right, tabs-tab-bar-card-color, 1PX solid);
|
|
336
|
+
.use-var-with-rtl(border-right, tabs-tab-bar-card-color, 1PX solid);
|
|
341
337
|
}
|
|
342
338
|
|
|
343
339
|
&:first-of-type {
|
|
344
|
-
.use-var(border-top-left-radius, tabs-tab-bar-card-border-radius);
|
|
345
|
-
.use-var(border-bottom-left-radius, tabs-tab-bar-card-border-radius);
|
|
340
|
+
.use-var-with-rtl(border-top-left-radius, tabs-tab-bar-card-border-radius);
|
|
341
|
+
.use-var-with-rtl(border-bottom-left-radius, tabs-tab-bar-card-border-radius);
|
|
346
342
|
}
|
|
347
343
|
|
|
348
344
|
&:last-of-type {
|
|
349
|
-
.use-var(border-top-right-radius, tabs-tab-bar-card-border-radius);
|
|
350
|
-
.use-var(border-bottom-right-radius, tabs-tab-bar-card-border-radius);
|
|
345
|
+
.use-var-with-rtl(border-top-right-radius, tabs-tab-bar-card-border-radius);
|
|
346
|
+
.use-var-with-rtl(border-bottom-right-radius, tabs-tab-bar-card-border-radius);
|
|
351
347
|
}
|
|
352
348
|
}
|
|
353
349
|
|
|
@@ -361,14 +357,13 @@
|
|
|
361
357
|
|
|
362
358
|
&.tag,
|
|
363
359
|
&.tag-divide {
|
|
364
|
-
.use-var(margin-right, tabs-tab-bar-tag-gutter);
|
|
365
360
|
.use-var(padding, tabs-tab-bar-tag-padding);
|
|
366
361
|
.rem(border-radius, 100);
|
|
367
362
|
.use-var(background, tabs-tab-bar-tag-background);
|
|
368
363
|
.use-var(color, tabs-tab-bar-tag-text-color);
|
|
369
364
|
|
|
370
|
-
|
|
371
|
-
margin-right
|
|
365
|
+
&:not(.last) {
|
|
366
|
+
.use-var-with-rtl(margin-right, tabs-tab-bar-tag-gutter);
|
|
372
367
|
}
|
|
373
368
|
|
|
374
369
|
&.active {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../_helpers"], factory);
|
|
3
|
+
define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../_helpers", "../context-provider"], factory);
|
|
4
4
|
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../_helpers"));
|
|
5
|
+
factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../_helpers"), require("../context-provider"));
|
|
6
6
|
} else {
|
|
7
7
|
var mod = {
|
|
8
8
|
exports: {}
|
|
9
9
|
};
|
|
10
|
-
factory(mod.exports, global._extends, global.react, global.mobileUtils, global._helpers);
|
|
10
|
+
factory(mod.exports, global._extends, global.react, global.mobileUtils, global._helpers, global.contextProvider);
|
|
11
11
|
global.tabCellUnderline = mod.exports;
|
|
12
12
|
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _helpers) {
|
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _helpers, _contextProvider) {
|
|
14
14
|
"use strict";
|
|
15
15
|
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
getTabRect = props.getTabRect,
|
|
48
48
|
getTabCenterLeft = props.getTabCenterLeft;
|
|
49
49
|
|
|
50
|
+
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
|
51
|
+
useRtl = _useContext.useRtl;
|
|
52
|
+
|
|
50
53
|
var _useState = (0, _react.useState)({}),
|
|
51
54
|
underlineStyle = _useState[0],
|
|
52
55
|
setUnderlineStyle = _useState[1];
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
var isVertical = tabDirection === 'vertical';
|
|
67
70
|
var maxScaleWithDefault = caterpillarMaxScale || 2;
|
|
68
71
|
var translateZStr = translateZ ? ' translateZ(0)' : '';
|
|
72
|
+
var rtlRatio = isVertical && useRtl ? -1 : 1;
|
|
69
73
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
70
74
|
return {
|
|
71
75
|
setCaterpillarAnimate: setCaterpillarAnimate,
|
|
@@ -137,11 +141,13 @@
|
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
function getDescIndex() {
|
|
140
|
-
|
|
144
|
+
var comparedDis = distance * rtlRatio;
|
|
145
|
+
|
|
146
|
+
if (comparedDis > 0) {
|
|
141
147
|
return activeIndex - 1;
|
|
142
148
|
}
|
|
143
149
|
|
|
144
|
-
if (
|
|
150
|
+
if (comparedDis < 0) {
|
|
145
151
|
return activeIndex + 1;
|
|
146
152
|
}
|
|
147
153
|
|
|
@@ -163,7 +169,8 @@
|
|
|
163
169
|
var currentLeft = getLineLeft(activeIndex);
|
|
164
170
|
var descIndex = getDescIndex();
|
|
165
171
|
var descLeft = getLineLeft(descIndex);
|
|
166
|
-
var
|
|
172
|
+
var comparedDis = distance * rtlRatio;
|
|
173
|
+
var moveRatio = wrapWidth ? comparedDis / wrapWidth : 0;
|
|
167
174
|
var leftOffset = moveRatio * (currentLeft - descLeft);
|
|
168
175
|
var direc = isVertical ? 'X' : 'Y';
|
|
169
176
|
var transStyle = useCaterpillar && !jumpingDis && !underlineAdaptive ? caterpillarProperty === 'size' ? (_ref = {}, _ref[isVertical ? 'width' : 'height'] = 100 * getLineScale(moveRatio) + "%", _ref.willChange = 'width', _ref) : {
|
|
@@ -178,7 +185,7 @@
|
|
|
178
185
|
var currentWidth = getLineWidth(activeIndex);
|
|
179
186
|
var descWidth = getLineWidth(descIndex);
|
|
180
187
|
var widthOffset = moveRatio * (currentWidth - descWidth);
|
|
181
|
-
adaptiveStyle = (_adaptiveStyle = {}, _adaptiveStyle[isVertical ? 'width' : 'height'] =
|
|
188
|
+
adaptiveStyle = (_adaptiveStyle = {}, _adaptiveStyle[isVertical ? 'width' : 'height'] = comparedDis > 0 ? currentWidth - widthOffset : currentWidth + widthOffset, _adaptiveStyle.willChange = 'width', _adaptiveStyle);
|
|
182
189
|
adaptiveOuterStyle = isVertical ? {
|
|
183
190
|
width: 'auto'
|
|
184
191
|
} : {
|
|
@@ -195,7 +202,7 @@
|
|
|
195
202
|
};
|
|
196
203
|
return {
|
|
197
204
|
outer: (0, _extends2.default)({
|
|
198
|
-
transform: "translate" + direc + "(" + (
|
|
205
|
+
transform: "translate" + direc + "(" + (comparedDis > 0 ? currentLeft - leftOffset : currentLeft + leftOffset) + "px)" + translateZStr
|
|
199
206
|
}, outerSize, adaptiveOuterStyle),
|
|
200
207
|
inner: (0, _extends2.default)({}, transStyle, adaptiveStyle)
|
|
201
208
|
};
|
package/umd/tabs/tab-cell.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../_helpers", "./tab-cell-underline"], factory);
|
|
3
|
+
define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../_helpers", "./tab-cell-underline", "../context-provider"], factory);
|
|
4
4
|
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../_helpers"), require("./tab-cell-underline"));
|
|
5
|
+
factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../_helpers"), require("./tab-cell-underline"), require("../context-provider"));
|
|
6
6
|
} else {
|
|
7
7
|
var mod = {
|
|
8
8
|
exports: {}
|
|
9
9
|
};
|
|
10
|
-
factory(mod.exports, global._extends, global.react, global.mobileUtils, global._helpers, global.tabCellUnderline);
|
|
10
|
+
factory(mod.exports, global._extends, global.react, global.mobileUtils, global._helpers, global.tabCellUnderline, global.contextProvider);
|
|
11
11
|
global.tabCell = mod.exports;
|
|
12
12
|
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _helpers, _tabCellUnderline) {
|
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _helpers, _tabCellUnderline, _contextProvider) {
|
|
14
14
|
"use strict";
|
|
15
15
|
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -74,6 +74,10 @@
|
|
|
74
74
|
translateZ = props.translateZ,
|
|
75
75
|
tabBarStopPropagation = props.tabBarStopPropagation;
|
|
76
76
|
var prefix = prefixCls + "-tab-cell";
|
|
77
|
+
|
|
78
|
+
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
|
79
|
+
useRtl = _useContext.useRtl;
|
|
80
|
+
|
|
77
81
|
var domRef = (0, _react.useRef)(null);
|
|
78
82
|
var underlineRef = (0, _react.useRef)(null);
|
|
79
83
|
var allCellRectRef = (0, _react.useRef)([]);
|
|
@@ -268,20 +272,22 @@
|
|
|
268
272
|
}
|
|
269
273
|
|
|
270
274
|
function getCellStyle(index) {
|
|
275
|
+
var _ref2;
|
|
276
|
+
|
|
271
277
|
if (!isVertical) {
|
|
272
278
|
return {};
|
|
273
279
|
}
|
|
274
280
|
|
|
281
|
+
var marginStart = useRtl ? 'marginRight' : 'marginLeft';
|
|
282
|
+
var marginEnd = useRtl ? 'marginLeft' : 'marginRight';
|
|
283
|
+
|
|
275
284
|
if (index === 0) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
};
|
|
285
|
+
var _ref;
|
|
286
|
+
|
|
287
|
+
return _ref = {}, _ref[marginEnd] = cellGutter, _ref[marginStart] = getCellPadding('left'), _ref;
|
|
280
288
|
}
|
|
281
289
|
|
|
282
|
-
return {
|
|
283
|
-
marginRight: index === tabs.length - 1 ? void 0 : cellGutter
|
|
284
|
-
};
|
|
290
|
+
return _ref2 = {}, _ref2[marginEnd] = index === tabs.length - 1 ? void 0 : cellGutter, _ref2;
|
|
285
291
|
}
|
|
286
292
|
|
|
287
293
|
function renderBarItem(tab, index) {
|
package/umd/tabs/tab-pane.js
CHANGED
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
autoHeight = props.autoHeight,
|
|
59
59
|
swipeEnergySaving = props.swipeEnergySaving,
|
|
60
60
|
changeIndex = props.changeIndex,
|
|
61
|
-
onScroll = props.onScroll
|
|
61
|
+
onScroll = props.onScroll,
|
|
62
|
+
rtlRatio = props.rtlRatio;
|
|
62
63
|
var domRef = (0, _react.useRef)(null);
|
|
63
64
|
var panesRef = (0, _react.useRef)([]);
|
|
64
65
|
var autoScrollingRef = (0, _react.useRef)(false);
|
|
@@ -257,7 +258,7 @@
|
|
|
257
258
|
var translateStr = translateZ ? ' translateZ(0)' : '';
|
|
258
259
|
var sizeStyle = tabDirection === 'vertical' ? {
|
|
259
260
|
width: 100 * panes.length + "%",
|
|
260
|
-
transform: "translateX(" + (distance - wrapWidth * activeIndex) + "px)" + translateStr
|
|
261
|
+
transform: "translateX(" + (distance - wrapWidth * activeIndex * rtlRatio) + "px)" + translateStr
|
|
261
262
|
} : {
|
|
262
263
|
height: 100 * panes.length + "%",
|
|
263
264
|
transform: "translateY(" + (distance - wrapHeight * activeIndex) + "px)" + translateStr
|
|
@@ -285,7 +286,7 @@
|
|
|
285
286
|
|
|
286
287
|
var translateStr = translateZ ? ' translateZ(0)' : '';
|
|
287
288
|
var sizeStyle = tabDirection === 'vertical' ? {
|
|
288
|
-
transform: "translateX(" + (distance - wrapWidth * (activeIndex - index)) + "px)" + translateStr
|
|
289
|
+
transform: "translateX(" + (distance - wrapWidth * (activeIndex - index) * rtlRatio) + "px)" + translateStr
|
|
289
290
|
} : {
|
|
290
291
|
transform: "translateY(" + (distance - wrapHeight * (activeIndex - index)) + "px)" + translateStr
|
|
291
292
|
};
|
package/umd/tabs/type.d.ts
CHANGED
|
@@ -579,6 +579,7 @@ export interface TabPaneProps extends Pick<TabsProps, 'duration' | 'transitionDu
|
|
|
579
579
|
paneTrans: boolean;
|
|
580
580
|
swipeable: boolean;
|
|
581
581
|
changeIndex: (newIndex: number, from?: string) => void;
|
|
582
|
+
rtlRatio: number;
|
|
582
583
|
}
|
|
583
584
|
export interface TabPaneRef {
|
|
584
585
|
/**
|