@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
package/esm/_helpers/hooks.js
CHANGED
@@ -58,11 +58,25 @@ export function useMountedState(initialState) {
|
|
58
58
|
var result = [state, setValidState];
|
59
59
|
return result;
|
60
60
|
}
|
61
|
-
export function
|
61
|
+
export function useSameRefState(initialValue) {
|
62
62
|
var _useState2 = useState(initialValue),
|
63
63
|
state = _useState2[0],
|
64
64
|
setState = _useState2[1];
|
65
65
|
|
66
|
+
var stateRef = useRef(state);
|
67
|
+
|
68
|
+
var setStateProxy = function setStateProxy(data) {
|
69
|
+
stateRef.current = data;
|
70
|
+
setState(data);
|
71
|
+
};
|
72
|
+
|
73
|
+
return [state, stateRef, setStateProxy];
|
74
|
+
}
|
75
|
+
export function useRefState(initialValue) {
|
76
|
+
var _useState3 = useState(initialValue),
|
77
|
+
state = _useState3[0],
|
78
|
+
setState = _useState3[1];
|
79
|
+
|
66
80
|
var stateRef = useRef(state);
|
67
81
|
useEffect(function () {
|
68
82
|
stateRef.current = state;
|
@@ -95,8 +109,8 @@ export function useUpdateEffect(effect, dependencies) {
|
|
95
109
|
}, dependencies);
|
96
110
|
}
|
97
111
|
export function useForceUpdate() {
|
98
|
-
var
|
99
|
-
setTick =
|
112
|
+
var _useState4 = useState(0),
|
113
|
+
setTick = _useState4[1];
|
100
114
|
|
101
115
|
var update = useCallback(function () {
|
102
116
|
setTick(function (tick) {
|
@@ -116,11 +130,11 @@ export function useSystem() {
|
|
116
130
|
var _useContext = useContext(GlobalContext),
|
117
131
|
currentSystem = _useContext.system;
|
118
132
|
|
119
|
-
var
|
133
|
+
var _useState5 = useState(function () {
|
120
134
|
return currentSystem || getSystem();
|
121
135
|
}),
|
122
|
-
system =
|
123
|
-
setSystem =
|
136
|
+
system = _useState5[0],
|
137
|
+
setSystem = _useState5[1];
|
124
138
|
|
125
139
|
useEffect(function () {
|
126
140
|
setSystem(currentSystem || getSystem());
|
@@ -128,13 +142,13 @@ export function useSystem() {
|
|
128
142
|
return system;
|
129
143
|
}
|
130
144
|
export function useWindowSize(listenResize) {
|
131
|
-
var _useState5 = useState(0),
|
132
|
-
windowWidth = _useState5[0],
|
133
|
-
setWindowWidth = _useState5[1];
|
134
|
-
|
135
145
|
var _useState6 = useState(0),
|
136
|
-
|
137
|
-
|
146
|
+
windowWidth = _useState6[0],
|
147
|
+
setWindowWidth = _useState6[1];
|
148
|
+
|
149
|
+
var _useState7 = useState(0),
|
150
|
+
windowHeight = _useState7[0],
|
151
|
+
setWindowHeight = _useState7[1];
|
138
152
|
|
139
153
|
function setSize() {
|
140
154
|
setWindowWidth(window.innerWidth);
|
@@ -436,17 +450,17 @@ export function usePreventBodyScroll(visible, preventBodyScroll, initialBodyOver
|
|
436
450
|
}, [visible]);
|
437
451
|
}
|
438
452
|
export var useProgress = function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
|
439
|
-
var
|
440
|
-
currentPercentage =
|
441
|
-
setCurrentPercentage =
|
453
|
+
var _useState8 = useState(0),
|
454
|
+
currentPercentage = _useState8[0],
|
455
|
+
setCurrentPercentage = _useState8[1];
|
442
456
|
|
443
|
-
var
|
444
|
-
transitionControl =
|
445
|
-
setTransitionControl =
|
457
|
+
var _useState9 = useState(false),
|
458
|
+
transitionControl = _useState9[0],
|
459
|
+
setTransitionControl = _useState9[1];
|
446
460
|
|
447
|
-
var
|
448
|
-
count =
|
449
|
-
setCount =
|
461
|
+
var _useState10 = useState(0),
|
462
|
+
count = _useState10[0],
|
463
|
+
setCount = _useState10[1];
|
450
464
|
|
451
465
|
var latestPercentage = useRef(percentage);
|
452
466
|
useEffect(function () {
|
@@ -475,9 +489,9 @@ export function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
|
|
475
489
|
delay = 200;
|
476
490
|
}
|
477
491
|
|
478
|
-
var
|
479
|
-
clickTimes =
|
480
|
-
setClickTimes =
|
492
|
+
var _useState11 = useState(0),
|
493
|
+
clickTimes = _useState11[0],
|
494
|
+
setClickTimes = _useState11[1];
|
481
495
|
|
482
496
|
var eventRef = useRef();
|
483
497
|
useEffect(function () {
|
@@ -499,9 +513,9 @@ export function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
|
|
499
513
|
}
|
500
514
|
var arcoSvgKeyCount = 0;
|
501
515
|
export function useGenSvgKey(userSetSvgKey) {
|
502
|
-
var
|
503
|
-
innerSvgKey =
|
504
|
-
setInnerSvgKey =
|
516
|
+
var _useState12 = useState(''),
|
517
|
+
innerSvgKey = _useState12[0],
|
518
|
+
setInnerSvgKey = _useState12[1];
|
505
519
|
|
506
520
|
var svgKey = userSetSvgKey || innerSvgKey;
|
507
521
|
useEffect(function () {
|
package/esm/avatar/type.d.ts
CHANGED
@@ -18,7 +18,7 @@ export interface AvatarProps<T extends ImageProps = ImageProps> extends BaseProp
|
|
18
18
|
* 图片头像的资源地址
|
19
19
|
* @en resource of avatar picture
|
20
20
|
*/
|
21
|
-
src
|
21
|
+
src?: string;
|
22
22
|
/**
|
23
23
|
* 图片头像组件参数,透传给Image组件
|
24
24
|
* @en Image avatar component props, transparently passed to the Image component
|
@@ -89,7 +89,19 @@
|
|
89
89
|
margin-left: -8PX ;
|
90
90
|
margin-top: -8PX ;
|
91
91
|
}
|
92
|
+
[dir="rtl"] .arco-badge-absolute {
|
93
|
+
left: initial;
|
94
|
+
right: 100%;
|
95
|
+
}
|
96
|
+
[dir="rtl"] .arco-badge-absolute {
|
97
|
+
margin-left: initial;
|
98
|
+
margin-right: -8PX ;
|
99
|
+
}
|
92
100
|
.arco-badge-absolute.arco-badge-dot {
|
93
101
|
margin-left: -4PX ;
|
94
102
|
margin-top: -4PX ;
|
95
103
|
}
|
104
|
+
[dir="rtl"] .arco-badge-absolute.arco-badge-dot {
|
105
|
+
margin-left: initial;
|
106
|
+
margin-right: -4PX ;
|
107
|
+
}
|
@@ -60,13 +60,13 @@
|
|
60
60
|
&-absolute {
|
61
61
|
position: absolute;
|
62
62
|
top: 0;
|
63
|
-
left
|
64
|
-
.use-var(margin-left, badge-text-deviation);
|
63
|
+
.set-prop-with-rtl(left, 100%);
|
64
|
+
.use-var-with-rtl(margin-left, badge-text-deviation);
|
65
65
|
.use-var(margin-top, badge-text-deviation);
|
66
66
|
}
|
67
67
|
|
68
68
|
&-absolute&-dot {
|
69
|
-
.use-var(margin-left, badge-dot-deviation);
|
69
|
+
.use-var-with-rtl(margin-left, badge-dot-deviation);
|
70
70
|
.use-var(margin-top, badge-dot-deviation);
|
71
71
|
}
|
72
72
|
}
|
@@ -210,6 +210,10 @@
|
|
210
210
|
.arco-button-text-has-icon {
|
211
211
|
margin-left: 0.08rem ;
|
212
212
|
}
|
213
|
+
[dir="rtl"] .arco-button-text-has-icon {
|
214
|
+
margin-left: initial;
|
215
|
+
margin-right: 0.08rem ;
|
216
|
+
}
|
213
217
|
.arco-button-loading-icon {
|
214
218
|
display: inline-block;
|
215
219
|
vertical-align: middle;
|
@@ -164,6 +164,9 @@
|
|
164
164
|
-webkit-box-orient: vertical;
|
165
165
|
white-space: normal;
|
166
166
|
}
|
167
|
+
[dir="rtl"] .arco-cell .cell-content .cell-text {
|
168
|
+
text-align: left;
|
169
|
+
}
|
167
170
|
.arco-cell .cell-label-icon {
|
168
171
|
margin-right: 0.24rem ;
|
169
172
|
font-size: 0;
|
@@ -181,6 +184,10 @@
|
|
181
184
|
margin-left: 0.16rem ;
|
182
185
|
font-size: 0;
|
183
186
|
}
|
187
|
+
[dir="rtl"] .arco-cell .cell-arrow-icon {
|
188
|
+
-webkit-transform: scale(-1);
|
189
|
+
transform: scale(-1);
|
190
|
+
}
|
184
191
|
[dir="rtl"] .arco-cell .cell-arrow-icon {
|
185
192
|
margin-left: initial;
|
186
193
|
margin-right: 0.16rem ;
|
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
.cell-text {
|
56
56
|
width: 100%;
|
57
|
-
text-align
|
57
|
+
.set-value-with-rtl(text-align, right);
|
58
58
|
.use-var(font-size, cell-content-font-size);
|
59
59
|
.text-overflow(2);
|
60
60
|
}
|
@@ -71,6 +71,9 @@
|
|
71
71
|
}
|
72
72
|
|
73
73
|
.cell-arrow-icon {
|
74
|
+
[dir="rtl"] & {
|
75
|
+
transform: scale(-1);
|
76
|
+
}
|
74
77
|
.use-var-with-rtl(margin-left, cell-arrow-gutter);
|
75
78
|
font-size: 0;
|
76
79
|
.@{prefix}-icon {
|
@@ -32,6 +32,10 @@
|
|
32
32
|
.arco-checkbox .checkbox-icon + .checkbox-text {
|
33
33
|
margin-left: 0.16rem ;
|
34
34
|
}
|
35
|
+
[dir="rtl"] .arco-checkbox .checkbox-icon + .checkbox-text {
|
36
|
+
margin-left: initial;
|
37
|
+
margin-right: 0.16rem ;
|
38
|
+
}
|
35
39
|
.arco-checkbox.disabled .checkbox-text {
|
36
40
|
opacity: 0.5 ;
|
37
41
|
}
|
@@ -47,7 +51,16 @@
|
|
47
51
|
.arco-checkbox-group .arco-checkbox:not(:last-child) {
|
48
52
|
margin-right: 0.48rem ;
|
49
53
|
}
|
54
|
+
[dir="rtl"] .arco-checkbox-group .arco-checkbox:not(:last-child) {
|
55
|
+
margin-right: initial;
|
56
|
+
margin-left: 0.48rem ;
|
57
|
+
}
|
50
58
|
.arco-checkbox-group .arco-checkbox:not(:last-child).block,
|
51
59
|
.arco-checkbox-group .arco-checkbox:not(:last-child).justify {
|
52
60
|
margin-right: 0;
|
53
61
|
}
|
62
|
+
[dir="rtl"] .arco-checkbox-group .arco-checkbox:not(:last-child).block,
|
63
|
+
[dir="rtl"] .arco-checkbox-group .arco-checkbox:not(:last-child).justify {
|
64
|
+
margin-right: initial;
|
65
|
+
margin-left: 0;
|
66
|
+
}
|
@@ -29,7 +29,7 @@
|
|
29
29
|
}
|
30
30
|
|
31
31
|
.checkbox-icon + .checkbox-text {
|
32
|
-
.use-var(margin-left, checkbox-icon-margin-right);
|
32
|
+
.use-var-with-rtl(margin-left, checkbox-icon-margin-right);
|
33
33
|
}
|
34
34
|
|
35
35
|
&.disabled .checkbox-text {
|
@@ -48,11 +48,11 @@
|
|
48
48
|
|
49
49
|
.@{prefix}-checkbox-group {
|
50
50
|
.@{prefix}-checkbox:not(:last-child) {
|
51
|
-
.use-var(margin-right, checkbox-group-gutter);
|
51
|
+
.use-var-with-rtl(margin-right, checkbox-group-gutter);
|
52
52
|
|
53
53
|
&.block,
|
54
54
|
&.justify {
|
55
|
-
margin-right
|
55
|
+
.set-prop-with-rtl(margin-right, 0);
|
56
56
|
}
|
57
57
|
}
|
58
58
|
}
|
package/esm/collapse/collapse.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import React, { useRef, forwardRef, useImperativeHandle, useState, useEffect, useContext
|
1
|
+
import React, { useRef, forwardRef, useImperativeHandle, useState, useEffect, useContext } from 'react';
|
2
2
|
import { cls, convertCssDuration, nextTick } from '@arco-design/mobile-utils';
|
3
3
|
import { ContextLayout } from '../context-provider';
|
4
|
-
import { useRefState, useUpdateEffect } from '../_helpers';
|
4
|
+
import { useRefState, useSameRefState, useUpdateEffect } from '../_helpers';
|
5
5
|
import IconArrowDown from '../icon/IconArrowDown';
|
6
6
|
import { allContexts, CollapseKeyContext } from './utils';
|
7
7
|
export var Collapse = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -46,7 +46,13 @@ export var Collapse = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
46
46
|
|
47
47
|
var CollapseContext = allContexts[groupKey] || {};
|
48
48
|
var groupContext = useContext(CollapseContext) || {};
|
49
|
-
|
49
|
+
|
50
|
+
var _useSameRefState = useSameRefState(false),
|
51
|
+
opened = _useSameRefState[0],
|
52
|
+
openedRef = _useSameRefState[1],
|
53
|
+
setOpened = _useSameRefState[2];
|
54
|
+
|
55
|
+
useEffect(function () {
|
50
56
|
var show = false; // 优先级: group > children
|
51
57
|
// @en Priority: group > children
|
52
58
|
|
@@ -60,7 +66,7 @@ export var Collapse = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
60
66
|
show = itemActive;
|
61
67
|
}
|
62
68
|
|
63
|
-
|
69
|
+
setOpened(show);
|
64
70
|
}, [value, active, itemActive, groupContext.isGroup, groupContext.value]);
|
65
71
|
|
66
72
|
var getContentHeight = function getContentHeight() {
|
@@ -78,8 +84,8 @@ export var Collapse = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
78
84
|
contentWrapRef.current.style.height = newHeight;
|
79
85
|
var transTimeout = convertCssDuration(contentWrapRef.current, 'transitionDuration');
|
80
86
|
setTimeout(function () {
|
81
|
-
return contentWrapRef.current && (contentWrapRef.current.style.height =
|
82
|
-
},
|
87
|
+
return contentWrapRef.current && (contentWrapRef.current.style.height = openedRef.current ? 'auto' : '0px');
|
88
|
+
}, openedRef.current ? transTimeout : 20);
|
83
89
|
};
|
84
90
|
|
85
91
|
var toggleOpened = function toggleOpened() {
|
@@ -102,10 +108,10 @@ export var Collapse = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
102
108
|
}
|
103
109
|
|
104
110
|
var height = getContentHeight();
|
105
|
-
contentWrapRef.current.style.height =
|
111
|
+
contentWrapRef.current.style.height = openedRef.current ? contentHeightRef.current + "px" : '0px';
|
106
112
|
nextTick(function () {
|
107
113
|
contentHeightRef.current = height;
|
108
|
-
resetHeight(
|
114
|
+
resetHeight(openedRef.current ? height + "px" : '0px');
|
109
115
|
});
|
110
116
|
};
|
111
117
|
|
@@ -27,6 +27,10 @@
|
|
27
27
|
padding-right: 0.32rem ;
|
28
28
|
width: 1.92rem ;
|
29
29
|
}
|
30
|
+
[dir="rtl"] .arco-form-label-item {
|
31
|
+
padding-right: initial;
|
32
|
+
padding-left: 0.32rem ;
|
33
|
+
}
|
30
34
|
.arco-form-label-item-required-asterisk {
|
31
35
|
position: absolute;
|
32
36
|
left: -0.6em;
|
@@ -35,6 +39,10 @@
|
|
35
39
|
line-height: 1.08rem ;
|
36
40
|
color: #f53f3f ;
|
37
41
|
}
|
42
|
+
[dir="rtl"] .arco-form-label-item-required-asterisk {
|
43
|
+
left: initial;
|
44
|
+
right: -0.6em;
|
45
|
+
}
|
38
46
|
.disabled .arco-form-label-item {
|
39
47
|
color: #c9cdd4 ;
|
40
48
|
}
|
@@ -68,6 +76,10 @@
|
|
68
76
|
.arco-form-item-message svg {
|
69
77
|
margin-right: 0.08rem;
|
70
78
|
}
|
79
|
+
[dir="rtl"] .arco-form-item-message svg {
|
80
|
+
margin-right: initial;
|
81
|
+
margin-left: 0.08rem;
|
82
|
+
}
|
71
83
|
.arco-form-item-error-message {
|
72
84
|
color: #f53f3f ;
|
73
85
|
}
|
@@ -80,6 +92,10 @@
|
|
80
92
|
.arco-form-item.arco-form-item-vertical .arco-input-wrap {
|
81
93
|
padding-left: 0;
|
82
94
|
}
|
95
|
+
[dir="rtl"] .arco-form-item.arco-form-item-vertical .arco-input-wrap {
|
96
|
+
padding-left: initial;
|
97
|
+
padding-right: 0;
|
98
|
+
}
|
83
99
|
.arco-form-item.arco-form-item-vertical .arco-form-label-item {
|
84
100
|
width: auto;
|
85
101
|
margin-top: 16px;
|
@@ -20,12 +20,12 @@
|
|
20
20
|
.use-var(font-size, form-item-label-item-font-size);
|
21
21
|
.use-var(line-height, form-item-label-item-line-height);
|
22
22
|
.use-var(color, form-item-label-item-color);
|
23
|
-
.use-var(padding-right, form-item-label-item-gutter);
|
23
|
+
.use-var-with-rtl(padding-right, form-item-label-item-gutter);
|
24
24
|
.use-var(width, form-item-label-item-width);
|
25
25
|
|
26
26
|
&-required-asterisk {
|
27
27
|
position: absolute;
|
28
|
-
left
|
28
|
+
.set-prop-with-rtl(left, -0.6em);
|
29
29
|
top: 0;
|
30
30
|
|
31
31
|
.use-var(font-size, form-item-label-item-font-size);
|
@@ -60,7 +60,7 @@
|
|
60
60
|
}
|
61
61
|
|
62
62
|
svg {
|
63
|
-
.rem(margin-right, 4);
|
63
|
+
.rem-with-rtl(margin-right, 4);
|
64
64
|
}
|
65
65
|
margin-bottom: 16px;
|
66
66
|
}
|
@@ -75,7 +75,7 @@
|
|
75
75
|
&-item.@{prefix}-form-item-vertical {
|
76
76
|
display: block;
|
77
77
|
.arco-input-wrap {
|
78
|
-
padding-left
|
78
|
+
.set-prop-with-rtl(padding-left, 0);
|
79
79
|
}
|
80
80
|
.@{prefix}-form-label-item {
|
81
81
|
width: auto;
|
@@ -766,7 +766,8 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
766
766
|
return /*#__PURE__*/React.createElement(Carousel, _extends({
|
767
767
|
autoPlay: false,
|
768
768
|
loop: loop,
|
769
|
-
lazyloadCount: lazyloadCount
|
769
|
+
lazyloadCount: lazyloadCount,
|
770
|
+
stopPropagation: false
|
770
771
|
}, carouselProps), (allImages || []).map(function (image, index) {
|
771
772
|
var innerNode = /*#__PURE__*/React.createElement("div", {
|
772
773
|
key: index,
|
@@ -32,6 +32,10 @@
|
|
32
32
|
.arco-radio .radio-icon + .radio-text {
|
33
33
|
margin-left: 0.16rem ;
|
34
34
|
}
|
35
|
+
[dir="rtl"] .arco-radio .radio-icon + .radio-text {
|
36
|
+
margin-left: initial;
|
37
|
+
margin-right: 0.16rem ;
|
38
|
+
}
|
35
39
|
.arco-radio.disabled .radio-text {
|
36
40
|
opacity: 0.5 ;
|
37
41
|
}
|
@@ -47,3 +51,7 @@
|
|
47
51
|
.arco-radio-group .arco-radio:not(:last-child, .block) {
|
48
52
|
margin-right: 0.48rem ;
|
49
53
|
}
|
54
|
+
[dir="rtl"] .arco-radio-group .arco-radio:not(:last-child, .block) {
|
55
|
+
margin-right: initial;
|
56
|
+
margin-left: 0.48rem ;
|
57
|
+
}
|
@@ -29,7 +29,7 @@
|
|
29
29
|
}
|
30
30
|
|
31
31
|
.radio-icon + .radio-text {
|
32
|
-
.use-var(margin-left, checkbox-icon-margin-right);
|
32
|
+
.use-var-with-rtl(margin-left, checkbox-icon-margin-right);
|
33
33
|
}
|
34
34
|
|
35
35
|
&.disabled .radio-text {
|
@@ -48,6 +48,6 @@
|
|
48
48
|
|
49
49
|
.@{prefix}-radio-group {
|
50
50
|
.@{prefix}-radio:not(:last-child, .block) {
|
51
|
-
.use-var(margin-right, checkbox-group-gutter);
|
51
|
+
.use-var-with-rtl(margin-right, checkbox-group-gutter);
|
52
52
|
}
|
53
53
|
}
|
package/esm/rate/index.js
CHANGED
@@ -133,7 +133,8 @@ var Rate = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
133
133
|
}
|
134
134
|
|
135
135
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref2) {
|
136
|
-
var prefixCls = _ref2.prefixCls
|
136
|
+
var prefixCls = _ref2.prefixCls,
|
137
|
+
useRtl = _ref2.useRtl;
|
137
138
|
return /*#__PURE__*/React.createElement("div", {
|
138
139
|
role: "slider",
|
139
140
|
"aria-valuemin": 0,
|
@@ -149,6 +150,7 @@ var Rate = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
149
150
|
// 对内的index从1开始,方便计算
|
150
151
|
// @en The index of the pair starts from 1, which is convenient for calculation
|
151
152
|
var index = i + 1;
|
153
|
+
var halfIndex = allowHalf ? index - 0.5 : index;
|
152
154
|
var status = getIconStatus(index);
|
153
155
|
return /*#__PURE__*/React.createElement("div", {
|
154
156
|
key: index,
|
@@ -159,12 +161,12 @@ var Rate = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
159
161
|
}, renderRateIcon(prefixCls + "-rate", status, index), /*#__PURE__*/React.createElement("div", {
|
160
162
|
className: prefixCls + "-rate-icon-click-half left",
|
161
163
|
onClick: function onClick() {
|
162
|
-
return handleStarIndexChange(
|
164
|
+
return handleStarIndexChange(useRtl ? index : halfIndex);
|
163
165
|
}
|
164
166
|
}), /*#__PURE__*/React.createElement("div", {
|
165
167
|
className: prefixCls + "-rate-icon-click-half right",
|
166
168
|
onClick: function onClick() {
|
167
|
-
return handleStarIndexChange(index);
|
169
|
+
return handleStarIndexChange(useRtl ? halfIndex : index);
|
168
170
|
}
|
169
171
|
}));
|
170
172
|
}));
|
package/esm/sticky/index.d.ts
CHANGED
@@ -10,6 +10,11 @@ export interface StickyRef {
|
|
10
10
|
* @en In the local scrolling mode, if there is nested scrolling outside the container, this method can be actively called to make the sticky element actively update the fixed position
|
11
11
|
*/
|
12
12
|
recalculatePosition: () => void;
|
13
|
+
/**
|
14
|
+
* 手动更新占位模块的高度
|
15
|
+
* @en Manually update the height of the placeholder
|
16
|
+
*/
|
17
|
+
updatePlaceholderLayout: () => void;
|
13
18
|
}
|
14
19
|
export interface StickyEventPayload {
|
15
20
|
/**
|
package/esm/sticky/index.js
CHANGED
@@ -141,6 +141,22 @@ var Sticky = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
141
141
|
});
|
142
142
|
framePendingRef.current = true;
|
143
143
|
}, [containerEventHandler]);
|
144
|
+
var updatePlaceholderLayoutInner = useCallback(function () {
|
145
|
+
if (placeholderRef.current) {
|
146
|
+
var contentHeight = contentCalculateHeightRef.current; // 当元素吸顶时,默认有一个占位的元素占住该元素的位置,避免布局产生抖动
|
147
|
+
// @en When an element is sticky to the top, a placeholder element occupies the element's position by default to avoid jitter in the layout
|
148
|
+
|
149
|
+
placeholderRef.current.style.height = (isStickyRef.current ? contentHeight : 0) + "px";
|
150
|
+
}
|
151
|
+
}, []);
|
152
|
+
var updatePlaceholderLayout = useCallback(function () {
|
153
|
+
if (contentRef.current) {
|
154
|
+
var contentClientRect = contentRef.current.getBoundingClientRect();
|
155
|
+
contentCalculateHeightRef.current = contentClientRect.height;
|
156
|
+
}
|
157
|
+
|
158
|
+
updatePlaceholderLayoutInner();
|
159
|
+
}, []);
|
144
160
|
useEffect(function () {
|
145
161
|
var containerEle = getActualContainer(getContainer);
|
146
162
|
containerRef.current = containerEle || document.body;
|
@@ -163,18 +179,15 @@ var Sticky = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
163
179
|
};
|
164
180
|
}, [getContainer, getScrollContainer, recalculatePosition]);
|
165
181
|
useEffect(function () {
|
166
|
-
|
167
|
-
// 当元素吸顶时,默认有一个占位的元素占住该元素的位置,避免布局产生抖动
|
168
|
-
// @en When an element is sticky to the top, a placeholder element occupies the element's position by default to avoid jitter in the layout
|
169
|
-
placeholderRef.current.style.height = (isStickyRef.current ? contentCalculateHeightRef.current : 0) + "px";
|
170
|
-
}
|
182
|
+
updatePlaceholderLayoutInner();
|
171
183
|
}, [isSticky, wasSticky]);
|
172
184
|
useImperativeHandle(ref, function () {
|
173
185
|
return {
|
174
186
|
dom: contentRef.current,
|
175
|
-
recalculatePosition: recalculatePosition
|
187
|
+
recalculatePosition: recalculatePosition,
|
188
|
+
updatePlaceholderLayout: updatePlaceholderLayout
|
176
189
|
};
|
177
|
-
}, [recalculatePosition]);
|
190
|
+
}, [recalculatePosition, updatePlaceholderLayout]);
|
178
191
|
var computedStyle = useMemo(function () {
|
179
192
|
return _extends({}, style || {}, stickyStateStyle);
|
180
193
|
}, [stickyStateStyle, style]);
|
package/esm/switch/index.js
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef } from 'react';
|
1
|
+
import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef, useContext } from 'react';
|
2
2
|
import { cls, componentWrapper } from '@arco-design/mobile-utils';
|
3
|
-
import { ContextLayout } from '../context-provider';
|
3
|
+
import { ContextLayout, GlobalContext } from '../context-provider';
|
4
4
|
import { useSystem } from '../_helpers';
|
5
5
|
var Switch = /*#__PURE__*/forwardRef(function (props, ref) {
|
6
|
+
var _useContext = useContext(GlobalContext),
|
7
|
+
useRtl = _useContext.useRtl;
|
8
|
+
|
6
9
|
var system = useSystem();
|
7
10
|
var className = props.className,
|
8
11
|
style = props.style,
|
@@ -70,13 +73,15 @@ var Switch = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
73
|
|
71
74
|
var touchEndX = e.changedTouches && e.changedTouches[0] ? e.changedTouches[0].clientX : 0;
|
72
75
|
var distance = touchEndX - touchStartX;
|
76
|
+
var swipeRight = useRtl ? distance < 0 : distance > 0;
|
77
|
+
var swipeLeft = useRtl ? distance > 0 : distance < 0;
|
73
78
|
var newChecked = false; // 右滑打开
|
74
79
|
// @en Swipe right to open
|
75
80
|
|
76
|
-
if (
|
81
|
+
if (swipeRight) {
|
77
82
|
newChecked = true; // 左滑关闭
|
78
83
|
// @en Swipe left to close
|
79
|
-
} else if (
|
84
|
+
} else if (swipeLeft) {
|
80
85
|
newChecked = false; // 点击时取反
|
81
86
|
// @en Invert on clicking
|
82
87
|
} else {
|