@arco-design/mobile-react 2.30.6 → 2.30.8
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 +26 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/checkbox/style/css/index.css +0 -3
- package/cjs/checkbox/style/index.less +0 -5
- package/cjs/ellipsis/components/js-ellipsis.js +9 -4
- package/cjs/radio/style/css/index.css +0 -3
- package/cjs/radio/style/index.less +0 -5
- package/cjs/skeleton/type.d.ts +1 -0
- package/cjs/skeleton/type.js +6 -1
- package/cjs/swipe-load/index.js +24 -19
- package/cjs/swipe-load/style/css/index.css +4 -0
- package/cjs/swipe-load/style/index.less +1 -1
- package/cjs/tabs/index.js +2 -1
- package/dist/index.js +277 -214
- package/dist/index.min.js +4 -4
- package/dist/style.css +7 -6
- package/dist/style.min.css +1 -1
- package/esm/checkbox/style/css/index.css +0 -3
- package/esm/checkbox/style/index.less +0 -5
- package/esm/ellipsis/components/js-ellipsis.js +8 -4
- package/esm/radio/style/css/index.css +0 -3
- package/esm/radio/style/index.less +0 -5
- package/esm/skeleton/type.d.ts +1 -0
- package/esm/skeleton/type.js +2 -1
- package/esm/swipe-load/index.js +24 -19
- package/esm/swipe-load/style/css/index.css +4 -0
- package/esm/swipe-load/style/index.less +1 -1
- package/esm/tabs/index.js +2 -1
- package/package.json +3 -3
- package/style/css/public.css +3 -0
- package/umd/checkbox/style/css/index.css +0 -3
- package/umd/checkbox/style/index.less +0 -5
- package/umd/ellipsis/components/js-ellipsis.js +11 -8
- package/umd/radio/style/css/index.css +0 -3
- package/umd/radio/style/index.less +0 -5
- package/umd/skeleton/type.d.ts +1 -0
- package/umd/skeleton/type.js +6 -4
- package/umd/swipe-load/index.js +24 -19
- package/umd/swipe-load/style/css/index.css +4 -0
- package/umd/swipe-load/style/index.less +1 -1
- package/umd/tabs/index.js +2 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { useEffect, useRef, forwardRef, useImperativeHandle, useCallback } from 'react';
|
2
2
|
import ResizeObserver from 'resize-observer-polyfill';
|
3
3
|
import { getLineHeight, wrapTextChildNodesWithSpan } from '../utils/dom';
|
4
|
+
import { useLatestRef } from '../../_helpers';
|
4
5
|
var JsEllipsis = /*#__PURE__*/forwardRef(function (props, ref) {
|
5
6
|
var prefixCls = props.prefixCls,
|
6
7
|
text = props.text,
|
@@ -20,10 +21,11 @@ var JsEllipsis = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
20
21
|
var domRef = useRef(null);
|
21
22
|
var textRef = useRef(null);
|
22
23
|
var ellipsisRef = useRef(null);
|
24
|
+
var ellipsisValueRef = useLatestRef(ellipsis);
|
23
25
|
var lineHeightRef = useRef(0);
|
24
26
|
var setCurLineHeight = useCallback(function () {
|
25
27
|
if (domRef.current) {
|
26
|
-
lineHeightRef.current = getLineHeight(domRef.current);
|
28
|
+
lineHeightRef.current = Math.round(getLineHeight(domRef.current));
|
27
29
|
}
|
28
30
|
}, []);
|
29
31
|
useEffect(function () {
|
@@ -81,7 +83,6 @@ var JsEllipsis = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
81
83
|
function truncateHTML(container, textContainer, max) {
|
82
84
|
// only enter this function when container overflow.
|
83
85
|
var children = textContainer.childNodes;
|
84
|
-
var actualHeight = getActualHeight(container);
|
85
86
|
|
86
87
|
if (children.length === 1) {
|
87
88
|
var node = children[0];
|
@@ -92,6 +93,7 @@ var JsEllipsis = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
92
93
|
var html = node.innerHTML; // clear content to determine whether the empty node can be placed.
|
93
94
|
|
94
95
|
node.innerHTML = '';
|
96
|
+
var actualHeight = getActualHeight(container);
|
95
97
|
|
96
98
|
if (actualHeight > max) {
|
97
99
|
// return after remove the node, if overflow with empty node.
|
@@ -112,7 +114,9 @@ var JsEllipsis = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
112
114
|
while (i < nodes.length) {
|
113
115
|
textContainer.appendChild(nodes[i]);
|
114
116
|
|
115
|
-
|
117
|
+
var _actualHeight = getActualHeight(container);
|
118
|
+
|
119
|
+
if (_actualHeight > max) {
|
116
120
|
if (nodes[i].childNodes && nodes[i].childNodes.length) {
|
117
121
|
break;
|
118
122
|
} else {
|
@@ -147,7 +151,7 @@ var JsEllipsis = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
147
151
|
textRef.current.innerText = text;
|
148
152
|
}
|
149
153
|
|
150
|
-
if (!
|
154
|
+
if (!ellipsisValueRef.current) {
|
151
155
|
return;
|
152
156
|
}
|
153
157
|
|
package/esm/skeleton/type.d.ts
CHANGED
package/esm/skeleton/type.js
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
import { BaseProps, SimpleBaseProps } from '../_helpers';
|
2
|
+
export { BaseProps, SimpleBaseProps };
|
package/esm/swipe-load/index.js
CHANGED
@@ -56,7 +56,8 @@ var SwipeLoad = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
56
56
|
|
57
57
|
var _useContext = useContext(GlobalContext),
|
58
58
|
_useContext$locale = _useContext.locale,
|
59
|
-
locale = _useContext$locale === void 0 ? defaultLocale : _useContext$locale
|
59
|
+
locale = _useContext$locale === void 0 ? defaultLocale : _useContext$locale,
|
60
|
+
useRtl = _useContext.useRtl;
|
60
61
|
|
61
62
|
var _useState = useState(disabled),
|
62
63
|
disableState = _useState[0],
|
@@ -138,16 +139,20 @@ var SwipeLoad = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
138
139
|
// 判断元素是否属于滚动元素 先置为1 之后变成0表示非滚动容器
|
139
140
|
// @en Determine whether the element belongs to a scrolling element. Set it to 1 and then change to 0 to indicate a non-scrolling container
|
140
141
|
if (!scrollContainer.scrollLeft) {
|
141
|
-
scrollContainer.scrollLeft = 1;
|
142
|
+
scrollContainer.scrollLeft = useRtl ? -1 : 1;
|
142
143
|
}
|
143
144
|
|
144
145
|
endX = e.touches[0].clientX || 0;
|
145
146
|
var diff = endX - startX;
|
146
147
|
offsetRef.current = diff;
|
147
|
-
var labelDiff = fingerDisToLabelDis(Math.abs(diff), damping); //
|
148
|
+
var labelDiff = fingerDisToLabelDis(Math.abs(diff), damping); // 判断是否是滚动到列表开始方向,ltr模式下是向左滚动,rtl模式下是向右滚动
|
149
|
+
|
150
|
+
var isScrollToLeft = useRtl ? diff < 0 : diff > 0; // 判断是否是滚动到列表结束方向,ltr模式下是向右滚动,rtl模式下是向左滚动
|
151
|
+
|
152
|
+
var isScrollToRight = useRtl ? diff > 0 : diff < 0; // 滑动到最左侧,处理回弹效果
|
148
153
|
// @en Swipe to the far left to handle the rebound effect
|
149
154
|
|
150
|
-
if (
|
155
|
+
if (isScrollToLeft && Math.abs(scrollContainer.scrollLeft) <= 1 && bounceWhenBumpBoundary) {
|
151
156
|
e.stopPropagation();
|
152
157
|
e.cancelBubble && e.preventDefault();
|
153
158
|
bouncingRef.current = true;
|
@@ -165,14 +170,14 @@ var SwipeLoad = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
165
170
|
// @en Swipe left to the end and the 'more' label is loaded. Judging by scrollLeft, the scroll container reaches the edge and the non-scroll container does not judge
|
166
171
|
|
167
172
|
|
168
|
-
if (
|
173
|
+
if (isScrollToRight && (Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && !ifToRightRef.current) {
|
169
174
|
showLoadMoreRef.current = true;
|
170
175
|
loadingCurrent.style.display = 'flex';
|
171
176
|
} // 继续滑动露出标签
|
172
177
|
// @en Continue swiping to reveal labels
|
173
178
|
|
174
179
|
|
175
|
-
if (showLoadMoreRef.current &&
|
180
|
+
if (showLoadMoreRef.current && isScrollToRight) {
|
176
181
|
// 此时禁止list原生滚动
|
177
182
|
// @en Disable list native scrolling at this time
|
178
183
|
e.stopPropagation();
|
@@ -192,22 +197,22 @@ var SwipeLoad = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
192
197
|
|
193
198
|
setStyleWithVendor(loadingCurrent, {
|
194
199
|
transition: 'none',
|
195
|
-
transform: "translateX(-" + labelRightMargin + "px) translateZ(0)"
|
200
|
+
transform: useRtl ? "translateX(" + labelRightMargin + "px) translateZ(0)" : "translateX(-" + labelRightMargin + "px) translateZ(0)"
|
196
201
|
});
|
197
202
|
setStyleWithVendor(scrollContainer, {
|
198
203
|
transition: 'none',
|
199
|
-
transform: "translateX(-" + listRightMargin + "px) translateZ(0)"
|
204
|
+
transform: useRtl ? "translateX(" + listRightMargin + "px) translateZ(0)" : "translateX(-" + listRightMargin + "px) translateZ(0)"
|
200
205
|
});
|
201
206
|
}
|
202
207
|
|
203
|
-
if (
|
208
|
+
if (isScrollToLeft && Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth <= scrollContainer.scrollWidth - 1) {
|
204
209
|
showLoadMoreRef.current = false;
|
205
210
|
loadingCurrent.style.display = 'none';
|
206
211
|
} // 针对ios惯性滚动处理
|
207
212
|
// @en Handling inertial scrolling for ios
|
208
213
|
|
209
214
|
|
210
|
-
if (
|
215
|
+
if (isScrollToRight && Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth <= scrollContainer.scrollWidth - 1) {
|
211
216
|
ifToRightRef.current = false;
|
212
217
|
} else {
|
213
218
|
ifToRightRef.current = true;
|
@@ -252,7 +257,7 @@ var SwipeLoad = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
252
257
|
// @em Swipe left, labels are all displayed
|
253
258
|
|
254
259
|
|
255
|
-
if (labelDiff >= minConfirmOffset && (scrollContainer.scrollLeft + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && showLoadMoreRef.current) {
|
260
|
+
if (labelDiff >= minConfirmOffset && (Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && showLoadMoreRef.current) {
|
256
261
|
onConfirm(); // 安卓机型返回动画优化
|
257
262
|
// @en Return animation optimization on Android
|
258
263
|
|
@@ -280,6 +285,8 @@ var SwipeLoad = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
280
285
|
};
|
281
286
|
});
|
282
287
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
288
|
+
var _ref2, _ref3;
|
289
|
+
|
283
290
|
var prefixCls = _ref.prefixCls;
|
284
291
|
return /*#__PURE__*/React.createElement("div", {
|
285
292
|
className: prefixCls + "-swipe-load " + className,
|
@@ -290,19 +297,17 @@ var SwipeLoad = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
290
297
|
}, children), renderLabel ? /*#__PURE__*/React.createElement("div", {
|
291
298
|
className: cls(prefixCls + "-custom-loading-area"),
|
292
299
|
ref: loadingRef,
|
293
|
-
style: {
|
294
|
-
position: 'absolute'
|
295
|
-
|
296
|
-
}
|
300
|
+
style: (_ref2 = {
|
301
|
+
position: 'absolute'
|
302
|
+
}, _ref2[useRtl ? 'left' : 'right'] = initPos + "px", _ref2)
|
297
303
|
}, renderLabel.length ? renderLabel(labelOffsetState) : renderLabel()) : /*#__PURE__*/React.createElement("div", {
|
298
304
|
className: cls(prefixCls + "-loading-area"),
|
299
305
|
ref: loadingRef,
|
300
|
-
style: {
|
306
|
+
style: (_ref3 = {
|
301
307
|
width: circleSize + "px",
|
302
308
|
height: circleSize + "px",
|
303
|
-
position: 'absolute'
|
304
|
-
|
305
|
-
}
|
309
|
+
position: 'absolute'
|
310
|
+
}, _ref3[useRtl ? 'left' : 'right'] = "-" + circleSize + "px", _ref3)
|
306
311
|
}, /*#__PURE__*/React.createElement("div", {
|
307
312
|
className: cls(prefixCls + "-loading-label"),
|
308
313
|
ref: loadingLabelRef
|
@@ -519,6 +519,10 @@
|
|
519
519
|
color: #1d2129 ;
|
520
520
|
font-size: 0.24rem ;
|
521
521
|
}
|
522
|
+
[dir="rtl"] .arco-swipe-load .arco-loading-area .arco-loading-label {
|
523
|
+
margin-left: initial;
|
524
|
+
margin-right: 0.4rem ;
|
525
|
+
}
|
522
526
|
/***************************************************
|
523
527
|
* *
|
524
528
|
* Arco Theme Style *
|
@@ -20,7 +20,7 @@
|
|
20
20
|
.use-var(border-radius, swipe-load-label-border-radius);
|
21
21
|
|
22
22
|
.@{prefix}-loading-label {
|
23
|
-
.use-var(margin-left, swipe-load-label-text-margin-left);
|
23
|
+
.use-var-with-rtl(margin-left, swipe-load-label-text-margin-left);
|
24
24
|
.use-var(width, swipe-load-label-text-width);
|
25
25
|
.use-var(color, swipe-load-label-text-color);
|
26
26
|
.use-var(font-size, swipe-load-label-text-font-size);
|
package/esm/tabs/index.js
CHANGED
@@ -440,11 +440,12 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
440
440
|
changeFromRef.current = changeFrom || '';
|
441
441
|
setCellTrans(true);
|
442
442
|
setInnerIndex(newIndex);
|
443
|
-
setDistance(0);
|
444
443
|
|
445
444
|
if (newIndex !== activeIndexRef.current) {
|
446
445
|
onChange && onChange(tabs[newIndex], newIndex, changeFrom);
|
447
446
|
}
|
447
|
+
|
448
|
+
setDistance(0);
|
448
449
|
}
|
449
450
|
|
450
451
|
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arco-design/mobile-react",
|
3
|
-
"version": "2.30.
|
3
|
+
"version": "2.30.8",
|
4
4
|
"description": "",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "esm/index.js",
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"author": "taoyiyue@bytedance.com",
|
16
16
|
"license": "ISC",
|
17
17
|
"dependencies": {
|
18
|
-
"@arco-design/mobile-utils": "2.17.
|
18
|
+
"@arco-design/mobile-utils": "2.17.8",
|
19
19
|
"@arco-design/transformable": "^1.0.0",
|
20
20
|
"lodash.throttle": "^4.1.1",
|
21
21
|
"resize-observer-polyfill": "^1.5.1"
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"publishConfig": {
|
50
50
|
"access": "public"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "2838b15919944eb0a2122b01cb1a9e8e0e0af75a"
|
53
53
|
}
|
package/style/css/public.css
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
(function (global, factory) {
|
2
2
|
if (typeof define === "function" && define.amd) {
|
3
|
-
define(["exports", "react", "resize-observer-polyfill", "../utils/dom"], factory);
|
3
|
+
define(["exports", "react", "resize-observer-polyfill", "../utils/dom", "../../_helpers"], factory);
|
4
4
|
} else if (typeof exports !== "undefined") {
|
5
|
-
factory(exports, require("react"), require("resize-observer-polyfill"), require("../utils/dom"));
|
5
|
+
factory(exports, require("react"), require("resize-observer-polyfill"), require("../utils/dom"), require("../../_helpers"));
|
6
6
|
} else {
|
7
7
|
var mod = {
|
8
8
|
exports: {}
|
9
9
|
};
|
10
|
-
factory(mod.exports, global.react, global.resizeObserverPolyfill, global.dom);
|
10
|
+
factory(mod.exports, global.react, global.resizeObserverPolyfill, global.dom, global._helpers);
|
11
11
|
global.jsEllipsis = mod.exports;
|
12
12
|
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _resizeObserverPolyfill, _dom) {
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _resizeObserverPolyfill, _dom, _helpers) {
|
14
14
|
"use strict";
|
15
15
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
@@ -43,10 +43,11 @@
|
|
43
43
|
var domRef = (0, _react.useRef)(null);
|
44
44
|
var textRef = (0, _react.useRef)(null);
|
45
45
|
var ellipsisRef = (0, _react.useRef)(null);
|
46
|
+
var ellipsisValueRef = (0, _helpers.useLatestRef)(ellipsis);
|
46
47
|
var lineHeightRef = (0, _react.useRef)(0);
|
47
48
|
var setCurLineHeight = (0, _react.useCallback)(function () {
|
48
49
|
if (domRef.current) {
|
49
|
-
lineHeightRef.current = (0, _dom.getLineHeight)(domRef.current);
|
50
|
+
lineHeightRef.current = Math.round((0, _dom.getLineHeight)(domRef.current));
|
50
51
|
}
|
51
52
|
}, []);
|
52
53
|
(0, _react.useEffect)(function () {
|
@@ -104,7 +105,6 @@
|
|
104
105
|
function truncateHTML(container, textContainer, max) {
|
105
106
|
// only enter this function when container overflow.
|
106
107
|
var children = textContainer.childNodes;
|
107
|
-
var actualHeight = getActualHeight(container);
|
108
108
|
|
109
109
|
if (children.length === 1) {
|
110
110
|
var node = children[0];
|
@@ -115,6 +115,7 @@
|
|
115
115
|
var html = node.innerHTML; // clear content to determine whether the empty node can be placed.
|
116
116
|
|
117
117
|
node.innerHTML = '';
|
118
|
+
var actualHeight = getActualHeight(container);
|
118
119
|
|
119
120
|
if (actualHeight > max) {
|
120
121
|
// return after remove the node, if overflow with empty node.
|
@@ -135,7 +136,9 @@
|
|
135
136
|
while (i < nodes.length) {
|
136
137
|
textContainer.appendChild(nodes[i]);
|
137
138
|
|
138
|
-
|
139
|
+
var _actualHeight = getActualHeight(container);
|
140
|
+
|
141
|
+
if (_actualHeight > max) {
|
139
142
|
if (nodes[i].childNodes && nodes[i].childNodes.length) {
|
140
143
|
break;
|
141
144
|
} else {
|
@@ -170,7 +173,7 @@
|
|
170
173
|
textRef.current.innerText = text;
|
171
174
|
}
|
172
175
|
|
173
|
-
if (!
|
176
|
+
if (!ellipsisValueRef.current) {
|
174
177
|
return;
|
175
178
|
}
|
176
179
|
|
package/umd/skeleton/type.d.ts
CHANGED
package/umd/skeleton/type.js
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
(function (global, factory) {
|
2
2
|
if (typeof define === "function" && define.amd) {
|
3
|
-
define(["exports"], factory);
|
3
|
+
define(["exports", "../_helpers"], factory);
|
4
4
|
} else if (typeof exports !== "undefined") {
|
5
|
-
factory(exports);
|
5
|
+
factory(exports, require("../_helpers"));
|
6
6
|
} else {
|
7
7
|
var mod = {
|
8
8
|
exports: {}
|
9
9
|
};
|
10
|
-
factory(mod.exports);
|
10
|
+
factory(mod.exports, global._helpers);
|
11
11
|
global.type = mod.exports;
|
12
12
|
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _helpers) {
|
14
14
|
"use strict";
|
15
15
|
|
16
16
|
_exports.__esModule = true;
|
17
|
+
_exports.BaseProps = _helpers.BaseProps;
|
18
|
+
_exports.SimpleBaseProps = _helpers.SimpleBaseProps;
|
17
19
|
});
|
package/umd/swipe-load/index.js
CHANGED
@@ -79,7 +79,8 @@
|
|
79
79
|
|
80
80
|
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
81
81
|
_useContext$locale = _useContext.locale,
|
82
|
-
locale = _useContext$locale === void 0 ? _mobileUtils.defaultLocale : _useContext$locale
|
82
|
+
locale = _useContext$locale === void 0 ? _mobileUtils.defaultLocale : _useContext$locale,
|
83
|
+
useRtl = _useContext.useRtl;
|
83
84
|
|
84
85
|
var _useState = (0, _react.useState)(disabled),
|
85
86
|
disableState = _useState[0],
|
@@ -161,16 +162,20 @@
|
|
161
162
|
// 判断元素是否属于滚动元素 先置为1 之后变成0表示非滚动容器
|
162
163
|
// @en Determine whether the element belongs to a scrolling element. Set it to 1 and then change to 0 to indicate a non-scrolling container
|
163
164
|
if (!scrollContainer.scrollLeft) {
|
164
|
-
scrollContainer.scrollLeft = 1;
|
165
|
+
scrollContainer.scrollLeft = useRtl ? -1 : 1;
|
165
166
|
}
|
166
167
|
|
167
168
|
endX = e.touches[0].clientX || 0;
|
168
169
|
var diff = endX - startX;
|
169
170
|
offsetRef.current = diff;
|
170
|
-
var labelDiff = (0, _mobileUtils.fingerDisToLabelDis)(Math.abs(diff), damping); //
|
171
|
+
var labelDiff = (0, _mobileUtils.fingerDisToLabelDis)(Math.abs(diff), damping); // 判断是否是滚动到列表开始方向,ltr模式下是向左滚动,rtl模式下是向右滚动
|
172
|
+
|
173
|
+
var isScrollToLeft = useRtl ? diff < 0 : diff > 0; // 判断是否是滚动到列表结束方向,ltr模式下是向右滚动,rtl模式下是向左滚动
|
174
|
+
|
175
|
+
var isScrollToRight = useRtl ? diff > 0 : diff < 0; // 滑动到最左侧,处理回弹效果
|
171
176
|
// @en Swipe to the far left to handle the rebound effect
|
172
177
|
|
173
|
-
if (
|
178
|
+
if (isScrollToLeft && Math.abs(scrollContainer.scrollLeft) <= 1 && bounceWhenBumpBoundary) {
|
174
179
|
e.stopPropagation();
|
175
180
|
e.cancelBubble && e.preventDefault();
|
176
181
|
bouncingRef.current = true;
|
@@ -188,14 +193,14 @@
|
|
188
193
|
// @en Swipe left to the end and the 'more' label is loaded. Judging by scrollLeft, the scroll container reaches the edge and the non-scroll container does not judge
|
189
194
|
|
190
195
|
|
191
|
-
if (
|
196
|
+
if (isScrollToRight && (Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && !ifToRightRef.current) {
|
192
197
|
showLoadMoreRef.current = true;
|
193
198
|
loadingCurrent.style.display = 'flex';
|
194
199
|
} // 继续滑动露出标签
|
195
200
|
// @en Continue swiping to reveal labels
|
196
201
|
|
197
202
|
|
198
|
-
if (showLoadMoreRef.current &&
|
203
|
+
if (showLoadMoreRef.current && isScrollToRight) {
|
199
204
|
// 此时禁止list原生滚动
|
200
205
|
// @en Disable list native scrolling at this time
|
201
206
|
e.stopPropagation();
|
@@ -215,22 +220,22 @@
|
|
215
220
|
|
216
221
|
(0, _helpers.setStyleWithVendor)(loadingCurrent, {
|
217
222
|
transition: 'none',
|
218
|
-
transform: "translateX(-" + labelRightMargin + "px) translateZ(0)"
|
223
|
+
transform: useRtl ? "translateX(" + labelRightMargin + "px) translateZ(0)" : "translateX(-" + labelRightMargin + "px) translateZ(0)"
|
219
224
|
});
|
220
225
|
(0, _helpers.setStyleWithVendor)(scrollContainer, {
|
221
226
|
transition: 'none',
|
222
|
-
transform: "translateX(-" + listRightMargin + "px) translateZ(0)"
|
227
|
+
transform: useRtl ? "translateX(" + listRightMargin + "px) translateZ(0)" : "translateX(-" + listRightMargin + "px) translateZ(0)"
|
223
228
|
});
|
224
229
|
}
|
225
230
|
|
226
|
-
if (
|
231
|
+
if (isScrollToLeft && Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth <= scrollContainer.scrollWidth - 1) {
|
227
232
|
showLoadMoreRef.current = false;
|
228
233
|
loadingCurrent.style.display = 'none';
|
229
234
|
} // 针对ios惯性滚动处理
|
230
235
|
// @en Handling inertial scrolling for ios
|
231
236
|
|
232
237
|
|
233
|
-
if (
|
238
|
+
if (isScrollToRight && Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth <= scrollContainer.scrollWidth - 1) {
|
234
239
|
ifToRightRef.current = false;
|
235
240
|
} else {
|
236
241
|
ifToRightRef.current = true;
|
@@ -275,7 +280,7 @@
|
|
275
280
|
// @em Swipe left, labels are all displayed
|
276
281
|
|
277
282
|
|
278
|
-
if (labelDiff >= minConfirmOffset && (scrollContainer.scrollLeft + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && showLoadMoreRef.current) {
|
283
|
+
if (labelDiff >= minConfirmOffset && (Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && showLoadMoreRef.current) {
|
279
284
|
onConfirm(); // 安卓机型返回动画优化
|
280
285
|
// @en Return animation optimization on Android
|
281
286
|
|
@@ -303,6 +308,8 @@
|
|
303
308
|
};
|
304
309
|
});
|
305
310
|
return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
|
311
|
+
var _ref2, _ref3;
|
312
|
+
|
306
313
|
var prefixCls = _ref.prefixCls;
|
307
314
|
return /*#__PURE__*/_react.default.createElement("div", {
|
308
315
|
className: prefixCls + "-swipe-load " + className,
|
@@ -313,19 +320,17 @@
|
|
313
320
|
}, children), renderLabel ? /*#__PURE__*/_react.default.createElement("div", {
|
314
321
|
className: (0, _mobileUtils.cls)(prefixCls + "-custom-loading-area"),
|
315
322
|
ref: loadingRef,
|
316
|
-
style: {
|
317
|
-
position: 'absolute'
|
318
|
-
|
319
|
-
}
|
323
|
+
style: (_ref2 = {
|
324
|
+
position: 'absolute'
|
325
|
+
}, _ref2[useRtl ? 'left' : 'right'] = initPos + "px", _ref2)
|
320
326
|
}, renderLabel.length ? renderLabel(labelOffsetState) : renderLabel()) : /*#__PURE__*/_react.default.createElement("div", {
|
321
327
|
className: (0, _mobileUtils.cls)(prefixCls + "-loading-area"),
|
322
328
|
ref: loadingRef,
|
323
|
-
style: {
|
329
|
+
style: (_ref3 = {
|
324
330
|
width: circleSize + "px",
|
325
331
|
height: circleSize + "px",
|
326
|
-
position: 'absolute'
|
327
|
-
|
328
|
-
}
|
332
|
+
position: 'absolute'
|
333
|
+
}, _ref3[useRtl ? 'left' : 'right'] = "-" + circleSize + "px", _ref3)
|
329
334
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
330
335
|
className: (0, _mobileUtils.cls)(prefixCls + "-loading-label"),
|
331
336
|
ref: loadingLabelRef
|
@@ -519,6 +519,10 @@
|
|
519
519
|
color: #1d2129 ;
|
520
520
|
font-size: 0.24rem ;
|
521
521
|
}
|
522
|
+
[dir="rtl"] .arco-swipe-load .arco-loading-area .arco-loading-label {
|
523
|
+
margin-left: initial;
|
524
|
+
margin-right: 0.4rem ;
|
525
|
+
}
|
522
526
|
/***************************************************
|
523
527
|
* *
|
524
528
|
* Arco Theme Style *
|
@@ -20,7 +20,7 @@
|
|
20
20
|
.use-var(border-radius, swipe-load-label-border-radius);
|
21
21
|
|
22
22
|
.@{prefix}-loading-label {
|
23
|
-
.use-var(margin-left, swipe-load-label-text-margin-left);
|
23
|
+
.use-var-with-rtl(margin-left, swipe-load-label-text-margin-left);
|
24
24
|
.use-var(width, swipe-load-label-text-width);
|
25
25
|
.use-var(color, swipe-load-label-text-color);
|
26
26
|
.use-var(font-size, swipe-load-label-text-font-size);
|
package/umd/tabs/index.js
CHANGED
@@ -466,11 +466,12 @@
|
|
466
466
|
changeFromRef.current = changeFrom || '';
|
467
467
|
setCellTrans(true);
|
468
468
|
setInnerIndex(newIndex);
|
469
|
-
setDistance(0);
|
470
469
|
|
471
470
|
if (newIndex !== activeIndexRef.current) {
|
472
471
|
onChange && onChange(tabs[newIndex], newIndex, changeFrom);
|
473
472
|
}
|
473
|
+
|
474
|
+
setDistance(0);
|
474
475
|
}
|
475
476
|
|
476
477
|
return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
|