@arco-design/mobile-react 2.27.5 → 2.28.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 +18 -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/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/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 +3 -3
- package/umd/_helpers/hooks.d.ts +1 -0
- package/umd/_helpers/hooks.js +43 -27
- 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/CHANGELOG.md
CHANGED
@@ -3,6 +3,24 @@
|
|
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.28.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.27.5...@arco-design/mobile-react@2.28.0) (2023-07-14)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* `Collapse` update with the latest opened ([#140](https://github.com/arco-design/arco-design-mobile/issues/140)) ([b963787](https://github.com/arco-design/arco-design-mobile/commit/b96378761557f4d90f09f789f662e9d3588c3cbd))
|
12
|
+
* `ImagePreview` fix scroll through ([ea3f9bc](https://github.com/arco-design/arco-design-mobile/commit/ea3f9bc5d0980f70c81e2de99084e0a11187b3c1))
|
13
|
+
* `Sticky` support the method "updatePlaceholderLayout" ([842b4fe](https://github.com/arco-design/arco-design-mobile/commit/842b4fe6084b3ae282bd54850e381fbe34bd826f))
|
14
|
+
|
15
|
+
|
16
|
+
### Features
|
17
|
+
|
18
|
+
* RTL support for `Badge`, `Button`, `Cell`, `Checkbox`, `Form`, `Radio`, `Rate`, `Switch` and `Tabs` ([#135](https://github.com/arco-design/arco-design-mobile/issues/135)) ([97de976](https://github.com/arco-design/arco-design-mobile/commit/97de976ba514ec0f48103bd4f0c535ebceb8981a))
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
6
24
|
## [2.27.5](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.27.4...@arco-design/mobile-react@2.27.5) (2023-07-04)
|
7
25
|
|
8
26
|
|
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.27.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.27.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.27.5/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.27.5/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.27.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.27.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.27.5/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.27.5/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## 引入全部
|
package/cjs/_helpers/hooks.d.ts
CHANGED
@@ -15,6 +15,7 @@ export declare function useListenResize(resizeHandler: () => void, deps?: any[],
|
|
15
15
|
* @param initialState {en} Initial State
|
16
16
|
*/
|
17
17
|
export declare function useMountedState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>];
|
18
|
+
export declare function useSameRefState<T>(initialValue: T): [T, React.MutableRefObject<T>, (data: T) => void];
|
18
19
|
export declare function useRefState<T>(initialValue: T | (() => T)): [T, React.MutableRefObject<T>, React.Dispatch<React.SetStateAction<T>>];
|
19
20
|
export declare function useRefMountedState<T>(initialValue: T | (() => T)): [T, React.MutableRefObject<T>, React.Dispatch<React.SetStateAction<T>>];
|
20
21
|
export declare function useUpdateEffect(effect: () => void | (() => void), dependencies?: any[]): void;
|
package/cjs/_helpers/hooks.js
CHANGED
@@ -12,6 +12,7 @@ exports.usePreventBodyScroll = usePreventBodyScroll;
|
|
12
12
|
exports.useProgress = void 0;
|
13
13
|
exports.useRefMountedState = useRefMountedState;
|
14
14
|
exports.useRefState = useRefState;
|
15
|
+
exports.useSameRefState = useSameRefState;
|
15
16
|
exports.useSingleAndDoubleClick = useSingleAndDoubleClick;
|
16
17
|
exports.useSwiperInnerScroll = useSwiperInnerScroll;
|
17
18
|
exports.useSystem = useSystem;
|
@@ -83,11 +84,26 @@ function useMountedState(initialState) {
|
|
83
84
|
return result;
|
84
85
|
}
|
85
86
|
|
86
|
-
function
|
87
|
+
function useSameRefState(initialValue) {
|
87
88
|
var _useState2 = (0, _react.useState)(initialValue),
|
88
89
|
state = _useState2[0],
|
89
90
|
setState = _useState2[1];
|
90
91
|
|
92
|
+
var stateRef = (0, _react.useRef)(state);
|
93
|
+
|
94
|
+
var setStateProxy = function setStateProxy(data) {
|
95
|
+
stateRef.current = data;
|
96
|
+
setState(data);
|
97
|
+
};
|
98
|
+
|
99
|
+
return [state, stateRef, setStateProxy];
|
100
|
+
}
|
101
|
+
|
102
|
+
function useRefState(initialValue) {
|
103
|
+
var _useState3 = (0, _react.useState)(initialValue),
|
104
|
+
state = _useState3[0],
|
105
|
+
setState = _useState3[1];
|
106
|
+
|
91
107
|
var stateRef = (0, _react.useRef)(state);
|
92
108
|
(0, _react.useEffect)(function () {
|
93
109
|
stateRef.current = state;
|
@@ -123,8 +139,8 @@ function useUpdateEffect(effect, dependencies) {
|
|
123
139
|
}
|
124
140
|
|
125
141
|
function useForceUpdate() {
|
126
|
-
var
|
127
|
-
setTick =
|
142
|
+
var _useState4 = (0, _react.useState)(0),
|
143
|
+
setTick = _useState4[1];
|
128
144
|
|
129
145
|
var update = (0, _react.useCallback)(function () {
|
130
146
|
setTick(function (tick) {
|
@@ -146,11 +162,11 @@ function useSystem() {
|
|
146
162
|
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
147
163
|
currentSystem = _useContext.system;
|
148
164
|
|
149
|
-
var
|
165
|
+
var _useState5 = (0, _react.useState)(function () {
|
150
166
|
return currentSystem || (0, _mobileUtils.getSystem)();
|
151
167
|
}),
|
152
|
-
system =
|
153
|
-
setSystem =
|
168
|
+
system = _useState5[0],
|
169
|
+
setSystem = _useState5[1];
|
154
170
|
|
155
171
|
(0, _react.useEffect)(function () {
|
156
172
|
setSystem(currentSystem || (0, _mobileUtils.getSystem)());
|
@@ -159,13 +175,13 @@ function useSystem() {
|
|
159
175
|
}
|
160
176
|
|
161
177
|
function useWindowSize(listenResize) {
|
162
|
-
var _useState5 = (0, _react.useState)(0),
|
163
|
-
windowWidth = _useState5[0],
|
164
|
-
setWindowWidth = _useState5[1];
|
165
|
-
|
166
178
|
var _useState6 = (0, _react.useState)(0),
|
167
|
-
|
168
|
-
|
179
|
+
windowWidth = _useState6[0],
|
180
|
+
setWindowWidth = _useState6[1];
|
181
|
+
|
182
|
+
var _useState7 = (0, _react.useState)(0),
|
183
|
+
windowHeight = _useState7[0],
|
184
|
+
setWindowHeight = _useState7[1];
|
169
185
|
|
170
186
|
function setSize() {
|
171
187
|
setWindowWidth(window.innerWidth);
|
@@ -472,17 +488,17 @@ function usePreventBodyScroll(visible, preventBodyScroll, initialBodyOverflow) {
|
|
472
488
|
}
|
473
489
|
|
474
490
|
var useProgress = function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
|
475
|
-
var
|
476
|
-
currentPercentage =
|
477
|
-
setCurrentPercentage =
|
491
|
+
var _useState8 = (0, _react.useState)(0),
|
492
|
+
currentPercentage = _useState8[0],
|
493
|
+
setCurrentPercentage = _useState8[1];
|
478
494
|
|
479
|
-
var
|
480
|
-
transitionControl =
|
481
|
-
setTransitionControl =
|
495
|
+
var _useState9 = (0, _react.useState)(false),
|
496
|
+
transitionControl = _useState9[0],
|
497
|
+
setTransitionControl = _useState9[1];
|
482
498
|
|
483
|
-
var
|
484
|
-
count =
|
485
|
-
setCount =
|
499
|
+
var _useState10 = (0, _react.useState)(0),
|
500
|
+
count = _useState10[0],
|
501
|
+
setCount = _useState10[1];
|
486
502
|
|
487
503
|
var latestPercentage = (0, _react.useRef)(percentage);
|
488
504
|
(0, _react.useEffect)(function () {
|
@@ -514,9 +530,9 @@ function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
|
|
514
530
|
delay = 200;
|
515
531
|
}
|
516
532
|
|
517
|
-
var
|
518
|
-
clickTimes =
|
519
|
-
setClickTimes =
|
533
|
+
var _useState11 = (0, _react.useState)(0),
|
534
|
+
clickTimes = _useState11[0],
|
535
|
+
setClickTimes = _useState11[1];
|
520
536
|
|
521
537
|
var eventRef = (0, _react.useRef)();
|
522
538
|
(0, _react.useEffect)(function () {
|
@@ -540,9 +556,9 @@ function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
|
|
540
556
|
var arcoSvgKeyCount = 0;
|
541
557
|
|
542
558
|
function useGenSvgKey(userSetSvgKey) {
|
543
|
-
var
|
544
|
-
innerSvgKey =
|
545
|
-
setInnerSvgKey =
|
559
|
+
var _useState12 = (0, _react.useState)(''),
|
560
|
+
innerSvgKey = _useState12[0],
|
561
|
+
setInnerSvgKey = _useState12[1];
|
546
562
|
|
547
563
|
var svgKey = userSetSvgKey || innerSvgKey;
|
548
564
|
(0, _react.useEffect)(function () {
|
@@ -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/cjs/collapse/collapse.js
CHANGED
@@ -63,7 +63,13 @@ var Collapse = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
63
63
|
|
64
64
|
var CollapseContext = _utils.allContexts[groupKey] || {};
|
65
65
|
var groupContext = (0, _react.useContext)(CollapseContext) || {};
|
66
|
-
|
66
|
+
|
67
|
+
var _useSameRefState = (0, _helpers.useSameRefState)(false),
|
68
|
+
opened = _useSameRefState[0],
|
69
|
+
openedRef = _useSameRefState[1],
|
70
|
+
setOpened = _useSameRefState[2];
|
71
|
+
|
72
|
+
(0, _react.useEffect)(function () {
|
67
73
|
var show = false; // 优先级: group > children
|
68
74
|
// @en Priority: group > children
|
69
75
|
|
@@ -77,7 +83,7 @@ var Collapse = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
77
83
|
show = itemActive;
|
78
84
|
}
|
79
85
|
|
80
|
-
|
86
|
+
setOpened(show);
|
81
87
|
}, [value, active, itemActive, groupContext.isGroup, groupContext.value]);
|
82
88
|
|
83
89
|
var getContentHeight = function getContentHeight() {
|
@@ -95,8 +101,8 @@ var Collapse = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
95
101
|
contentWrapRef.current.style.height = newHeight;
|
96
102
|
var transTimeout = (0, _mobileUtils.convertCssDuration)(contentWrapRef.current, 'transitionDuration');
|
97
103
|
setTimeout(function () {
|
98
|
-
return contentWrapRef.current && (contentWrapRef.current.style.height =
|
99
|
-
},
|
104
|
+
return contentWrapRef.current && (contentWrapRef.current.style.height = openedRef.current ? 'auto' : '0px');
|
105
|
+
}, openedRef.current ? transTimeout : 20);
|
100
106
|
};
|
101
107
|
|
102
108
|
var toggleOpened = function toggleOpened() {
|
@@ -119,10 +125,10 @@ var Collapse = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
119
125
|
}
|
120
126
|
|
121
127
|
var height = getContentHeight();
|
122
|
-
contentWrapRef.current.style.height =
|
128
|
+
contentWrapRef.current.style.height = openedRef.current ? contentHeightRef.current + "px" : '0px';
|
123
129
|
(0, _mobileUtils.nextTick)(function () {
|
124
130
|
contentHeightRef.current = height;
|
125
|
-
resetHeight(
|
131
|
+
resetHeight(openedRef.current ? height + "px" : '0px');
|
126
132
|
});
|
127
133
|
};
|
128
134
|
|
@@ -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;
|
@@ -800,7 +800,8 @@ var ImagePreview = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
800
800
|
return /*#__PURE__*/_react.default.createElement(_carousel.default, (0, _extends5.default)({
|
801
801
|
autoPlay: false,
|
802
802
|
loop: loop,
|
803
|
-
lazyloadCount: lazyloadCount
|
803
|
+
lazyloadCount: lazyloadCount,
|
804
|
+
stopPropagation: false
|
804
805
|
}, carouselProps), (allImages || []).map(function (image, index) {
|
805
806
|
var innerNode = /*#__PURE__*/_react.default.createElement("div", {
|
806
807
|
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/cjs/rate/index.js
CHANGED
@@ -150,7 +150,8 @@ var Rate = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
150
150
|
}
|
151
151
|
|
152
152
|
return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref2) {
|
153
|
-
var prefixCls = _ref2.prefixCls
|
153
|
+
var prefixCls = _ref2.prefixCls,
|
154
|
+
useRtl = _ref2.useRtl;
|
154
155
|
return /*#__PURE__*/_react.default.createElement("div", {
|
155
156
|
role: "slider",
|
156
157
|
"aria-valuemin": 0,
|
@@ -166,6 +167,7 @@ var Rate = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
166
167
|
// 对内的index从1开始,方便计算
|
167
168
|
// @en The index of the pair starts from 1, which is convenient for calculation
|
168
169
|
var index = i + 1;
|
170
|
+
var halfIndex = allowHalf ? index - 0.5 : index;
|
169
171
|
var status = getIconStatus(index);
|
170
172
|
return /*#__PURE__*/_react.default.createElement("div", {
|
171
173
|
key: index,
|
@@ -176,12 +178,12 @@ var Rate = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
176
178
|
}, renderRateIcon(prefixCls + "-rate", status, index), /*#__PURE__*/_react.default.createElement("div", {
|
177
179
|
className: prefixCls + "-rate-icon-click-half left",
|
178
180
|
onClick: function onClick() {
|
179
|
-
return handleStarIndexChange(
|
181
|
+
return handleStarIndexChange(useRtl ? index : halfIndex);
|
180
182
|
}
|
181
183
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
182
184
|
className: prefixCls + "-rate-icon-click-half right",
|
183
185
|
onClick: function onClick() {
|
184
|
-
return handleStarIndexChange(index);
|
186
|
+
return handleStarIndexChange(useRtl ? halfIndex : index);
|
185
187
|
}
|
186
188
|
}));
|
187
189
|
}));
|
package/cjs/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/cjs/sticky/index.js
CHANGED
@@ -157,6 +157,22 @@ var Sticky = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
157
157
|
});
|
158
158
|
framePendingRef.current = true;
|
159
159
|
}, [containerEventHandler]);
|
160
|
+
var updatePlaceholderLayoutInner = (0, _react.useCallback)(function () {
|
161
|
+
if (placeholderRef.current) {
|
162
|
+
var contentHeight = contentCalculateHeightRef.current; // 当元素吸顶时,默认有一个占位的元素占住该元素的位置,避免布局产生抖动
|
163
|
+
// @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
|
164
|
+
|
165
|
+
placeholderRef.current.style.height = (isStickyRef.current ? contentHeight : 0) + "px";
|
166
|
+
}
|
167
|
+
}, []);
|
168
|
+
var updatePlaceholderLayout = (0, _react.useCallback)(function () {
|
169
|
+
if (contentRef.current) {
|
170
|
+
var contentClientRect = contentRef.current.getBoundingClientRect();
|
171
|
+
contentCalculateHeightRef.current = contentClientRect.height;
|
172
|
+
}
|
173
|
+
|
174
|
+
updatePlaceholderLayoutInner();
|
175
|
+
}, []);
|
160
176
|
(0, _react.useEffect)(function () {
|
161
177
|
var containerEle = (0, _mobileUtils.getActualContainer)(getContainer);
|
162
178
|
containerRef.current = containerEle || document.body;
|
@@ -179,18 +195,15 @@ var Sticky = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
179
195
|
};
|
180
196
|
}, [getContainer, getScrollContainer, recalculatePosition]);
|
181
197
|
(0, _react.useEffect)(function () {
|
182
|
-
|
183
|
-
// 当元素吸顶时,默认有一个占位的元素占住该元素的位置,避免布局产生抖动
|
184
|
-
// @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
|
185
|
-
placeholderRef.current.style.height = (isStickyRef.current ? contentCalculateHeightRef.current : 0) + "px";
|
186
|
-
}
|
198
|
+
updatePlaceholderLayoutInner();
|
187
199
|
}, [isSticky, wasSticky]);
|
188
200
|
(0, _react.useImperativeHandle)(ref, function () {
|
189
201
|
return {
|
190
202
|
dom: contentRef.current,
|
191
|
-
recalculatePosition: recalculatePosition
|
203
|
+
recalculatePosition: recalculatePosition,
|
204
|
+
updatePlaceholderLayout: updatePlaceholderLayout
|
192
205
|
};
|
193
|
-
}, [recalculatePosition]);
|
206
|
+
}, [recalculatePosition, updatePlaceholderLayout]);
|
194
207
|
var computedStyle = (0, _react.useMemo)(function () {
|
195
208
|
return (0, _extends2.default)({}, style || {}, stickyStateStyle);
|
196
209
|
}, [stickyStateStyle, style]);
|
package/cjs/switch/index.js
CHANGED
@@ -16,6 +16,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
17
17
|
|
18
18
|
var Switch = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
19
|
+
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
20
|
+
useRtl = _useContext.useRtl;
|
21
|
+
|
19
22
|
var system = (0, _helpers.useSystem)();
|
20
23
|
var className = props.className,
|
21
24
|
style = props.style,
|
@@ -83,13 +86,15 @@ var Switch = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
83
86
|
|
84
87
|
var touchEndX = e.changedTouches && e.changedTouches[0] ? e.changedTouches[0].clientX : 0;
|
85
88
|
var distance = touchEndX - touchStartX;
|
89
|
+
var swipeRight = useRtl ? distance < 0 : distance > 0;
|
90
|
+
var swipeLeft = useRtl ? distance > 0 : distance < 0;
|
86
91
|
var newChecked = false; // 右滑打开
|
87
92
|
// @en Swipe right to open
|
88
93
|
|
89
|
-
if (
|
94
|
+
if (swipeRight) {
|
90
95
|
newChecked = true; // 左滑关闭
|
91
96
|
// @en Swipe left to close
|
92
|
-
} else if (
|
97
|
+
} else if (swipeLeft) {
|
93
98
|
newChecked = false; // 点击时取反
|
94
99
|
// @en Invert on clicking
|
95
100
|
} else {
|