@arco-design/mobile-react 2.30.7 → 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 +14 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/ellipsis/components/js-ellipsis.js +5 -2
- 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 +276 -214
- package/dist/index.min.js +5 -5
- package/dist/style.css +4 -0
- package/dist/style.min.css +1 -1
- package/esm/ellipsis/components/js-ellipsis.js +4 -2
- 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/umd/ellipsis/components/js-ellipsis.js +7 -6
- 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
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,20 @@
|
|
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.30.8](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.30.7...@arco-design/mobile-react@2.30.8) (2024-01-31)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* `SwipeLoad` supports RTL ([#225](https://github.com/arco-design/arco-design-mobile/issues/225)) ([e39d09e](https://github.com/arco-design/arco-design-mobile/commit/e39d09e69c72c6e3ca65addabd1d90d96ac91eb1))
|
12
|
+
* `Ellipsis` optimize line height caculation ([#227](https://github.com/arco-design/arco-design-mobile/issues/227)) ([c791a8e](https://github.com/arco-design/arco-design-mobile/commit/c791a8e36309ce4887297fe711348f427e12954d))
|
13
|
+
* `Ellipsis` use ellipsisValueRef to reduce reflow ([#226](https://github.com/arco-design/arco-design-mobile/issues/226)) ([cbb761f](https://github.com/arco-design/arco-design-mobile/commit/cbb761fd05788e3cf191c94fd5870474e990cfa1))
|
14
|
+
* `Tabs` trigger "onChange" before distance is set to 0 ([#223](https://github.com/arco-design/arco-design-mobile/issues/223)) ([0f91c5b](https://github.com/arco-design/arco-design-mobile/commit/0f91c5b8e77d1b4688b47d3fd68e231ad964b214))
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
6
20
|
## [2.30.7](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.30.6...@arco-design/mobile-react@2.30.7) (2023-12-27)
|
7
21
|
|
8
22
|
|
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.30.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.30.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.30.7/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.30.7/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.30.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.30.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.30.7/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.30.7/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## 引入全部
|
@@ -11,6 +11,8 @@ var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-po
|
|
11
11
|
|
12
12
|
var _dom = require("../utils/dom");
|
13
13
|
|
14
|
+
var _helpers = require("../../_helpers");
|
15
|
+
|
14
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
15
17
|
|
16
18
|
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; }
|
@@ -34,10 +36,11 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
34
36
|
var domRef = (0, _react.useRef)(null);
|
35
37
|
var textRef = (0, _react.useRef)(null);
|
36
38
|
var ellipsisRef = (0, _react.useRef)(null);
|
39
|
+
var ellipsisValueRef = (0, _helpers.useLatestRef)(ellipsis);
|
37
40
|
var lineHeightRef = (0, _react.useRef)(0);
|
38
41
|
var setCurLineHeight = (0, _react.useCallback)(function () {
|
39
42
|
if (domRef.current) {
|
40
|
-
lineHeightRef.current = (0, _dom.getLineHeight)(domRef.current);
|
43
|
+
lineHeightRef.current = Math.round((0, _dom.getLineHeight)(domRef.current));
|
41
44
|
}
|
42
45
|
}, []);
|
43
46
|
(0, _react.useEffect)(function () {
|
@@ -163,7 +166,7 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
163
166
|
textRef.current.innerText = text;
|
164
167
|
}
|
165
168
|
|
166
|
-
if (!
|
169
|
+
if (!ellipsisValueRef.current) {
|
167
170
|
return;
|
168
171
|
}
|
169
172
|
|
package/cjs/skeleton/type.d.ts
CHANGED
package/cjs/skeleton/type.js
CHANGED
package/cjs/swipe-load/index.js
CHANGED
@@ -78,7 +78,8 @@ var SwipeLoad = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
78
78
|
|
79
79
|
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
80
80
|
_useContext$locale = _useContext.locale,
|
81
|
-
locale = _useContext$locale === void 0 ? _mobileUtils.defaultLocale : _useContext$locale
|
81
|
+
locale = _useContext$locale === void 0 ? _mobileUtils.defaultLocale : _useContext$locale,
|
82
|
+
useRtl = _useContext.useRtl;
|
82
83
|
|
83
84
|
var _useState = (0, _react.useState)(disabled),
|
84
85
|
disableState = _useState[0],
|
@@ -160,16 +161,20 @@ var SwipeLoad = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
160
161
|
// 判断元素是否属于滚动元素 先置为1 之后变成0表示非滚动容器
|
161
162
|
// @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
|
162
163
|
if (!scrollContainer.scrollLeft) {
|
163
|
-
scrollContainer.scrollLeft = 1;
|
164
|
+
scrollContainer.scrollLeft = useRtl ? -1 : 1;
|
164
165
|
}
|
165
166
|
|
166
167
|
endX = e.touches[0].clientX || 0;
|
167
168
|
var diff = endX - startX;
|
168
169
|
offsetRef.current = diff;
|
169
|
-
var labelDiff = (0, _mobileUtils.fingerDisToLabelDis)(Math.abs(diff), damping); //
|
170
|
+
var labelDiff = (0, _mobileUtils.fingerDisToLabelDis)(Math.abs(diff), damping); // 判断是否是滚动到列表开始方向,ltr模式下是向左滚动,rtl模式下是向右滚动
|
171
|
+
|
172
|
+
var isScrollToLeft = useRtl ? diff < 0 : diff > 0; // 判断是否是滚动到列表结束方向,ltr模式下是向右滚动,rtl模式下是向左滚动
|
173
|
+
|
174
|
+
var isScrollToRight = useRtl ? diff > 0 : diff < 0; // 滑动到最左侧,处理回弹效果
|
170
175
|
// @en Swipe to the far left to handle the rebound effect
|
171
176
|
|
172
|
-
if (
|
177
|
+
if (isScrollToLeft && Math.abs(scrollContainer.scrollLeft) <= 1 && bounceWhenBumpBoundary) {
|
173
178
|
e.stopPropagation();
|
174
179
|
e.cancelBubble && e.preventDefault();
|
175
180
|
bouncingRef.current = true;
|
@@ -187,14 +192,14 @@ var SwipeLoad = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
187
192
|
// @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
|
188
193
|
|
189
194
|
|
190
|
-
if (
|
195
|
+
if (isScrollToRight && (Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && !ifToRightRef.current) {
|
191
196
|
showLoadMoreRef.current = true;
|
192
197
|
loadingCurrent.style.display = 'flex';
|
193
198
|
} // 继续滑动露出标签
|
194
199
|
// @en Continue swiping to reveal labels
|
195
200
|
|
196
201
|
|
197
|
-
if (showLoadMoreRef.current &&
|
202
|
+
if (showLoadMoreRef.current && isScrollToRight) {
|
198
203
|
// 此时禁止list原生滚动
|
199
204
|
// @en Disable list native scrolling at this time
|
200
205
|
e.stopPropagation();
|
@@ -214,22 +219,22 @@ var SwipeLoad = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
214
219
|
|
215
220
|
(0, _helpers.setStyleWithVendor)(loadingCurrent, {
|
216
221
|
transition: 'none',
|
217
|
-
transform: "translateX(-" + labelRightMargin + "px) translateZ(0)"
|
222
|
+
transform: useRtl ? "translateX(" + labelRightMargin + "px) translateZ(0)" : "translateX(-" + labelRightMargin + "px) translateZ(0)"
|
218
223
|
});
|
219
224
|
(0, _helpers.setStyleWithVendor)(scrollContainer, {
|
220
225
|
transition: 'none',
|
221
|
-
transform: "translateX(-" + listRightMargin + "px) translateZ(0)"
|
226
|
+
transform: useRtl ? "translateX(" + listRightMargin + "px) translateZ(0)" : "translateX(-" + listRightMargin + "px) translateZ(0)"
|
222
227
|
});
|
223
228
|
}
|
224
229
|
|
225
|
-
if (
|
230
|
+
if (isScrollToLeft && Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth <= scrollContainer.scrollWidth - 1) {
|
226
231
|
showLoadMoreRef.current = false;
|
227
232
|
loadingCurrent.style.display = 'none';
|
228
233
|
} // 针对ios惯性滚动处理
|
229
234
|
// @en Handling inertial scrolling for ios
|
230
235
|
|
231
236
|
|
232
|
-
if (
|
237
|
+
if (isScrollToRight && Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth <= scrollContainer.scrollWidth - 1) {
|
233
238
|
ifToRightRef.current = false;
|
234
239
|
} else {
|
235
240
|
ifToRightRef.current = true;
|
@@ -274,7 +279,7 @@ var SwipeLoad = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
274
279
|
// @em Swipe left, labels are all displayed
|
275
280
|
|
276
281
|
|
277
|
-
if (labelDiff >= minConfirmOffset && (scrollContainer.scrollLeft + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && showLoadMoreRef.current) {
|
282
|
+
if (labelDiff >= minConfirmOffset && (Math.abs(scrollContainer.scrollLeft) + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && showLoadMoreRef.current) {
|
278
283
|
onConfirm(); // 安卓机型返回动画优化
|
279
284
|
// @en Return animation optimization on Android
|
280
285
|
|
@@ -302,6 +307,8 @@ var SwipeLoad = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
302
307
|
};
|
303
308
|
});
|
304
309
|
return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
|
310
|
+
var _ref2, _ref3;
|
311
|
+
|
305
312
|
var prefixCls = _ref.prefixCls;
|
306
313
|
return /*#__PURE__*/_react.default.createElement("div", {
|
307
314
|
className: prefixCls + "-swipe-load " + className,
|
@@ -312,19 +319,17 @@ var SwipeLoad = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
312
319
|
}, children), renderLabel ? /*#__PURE__*/_react.default.createElement("div", {
|
313
320
|
className: (0, _mobileUtils.cls)(prefixCls + "-custom-loading-area"),
|
314
321
|
ref: loadingRef,
|
315
|
-
style: {
|
316
|
-
position: 'absolute'
|
317
|
-
|
318
|
-
}
|
322
|
+
style: (_ref2 = {
|
323
|
+
position: 'absolute'
|
324
|
+
}, _ref2[useRtl ? 'left' : 'right'] = initPos + "px", _ref2)
|
319
325
|
}, renderLabel.length ? renderLabel(labelOffsetState) : renderLabel()) : /*#__PURE__*/_react.default.createElement("div", {
|
320
326
|
className: (0, _mobileUtils.cls)(prefixCls + "-loading-area"),
|
321
327
|
ref: loadingRef,
|
322
|
-
style: {
|
328
|
+
style: (_ref3 = {
|
323
329
|
width: circleSize + "px",
|
324
330
|
height: circleSize + "px",
|
325
|
-
position: 'absolute'
|
326
|
-
|
327
|
-
}
|
331
|
+
position: 'absolute'
|
332
|
+
}, _ref3[useRtl ? 'left' : 'right'] = "-" + circleSize + "px", _ref3)
|
328
333
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
329
334
|
className: (0, _mobileUtils.cls)(prefixCls + "-loading-label"),
|
330
335
|
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/cjs/tabs/index.js
CHANGED
@@ -466,11 +466,12 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
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) {
|