@arco-design/mobile-react 2.30.7 → 2.30.9
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/_helpers/render.d.ts +6 -1
- package/cjs/_helpers/render.js +24 -2
- package/cjs/ellipsis/components/js-ellipsis.js +5 -2
- package/cjs/image/style/index.less +2 -4
- package/cjs/image-preview/methods.js +2 -7
- package/cjs/masking/methods.js +12 -6
- package/cjs/skeleton/type.d.ts +1 -0
- 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 +310 -223
- package/dist/index.min.js +5 -5
- package/dist/style.css +4 -0
- package/dist/style.min.css +1 -1
- package/esm/_helpers/render.d.ts +6 -1
- package/esm/_helpers/render.js +21 -1
- package/esm/ellipsis/components/js-ellipsis.js +4 -2
- package/esm/image/style/index.less +2 -4
- package/esm/image-preview/methods.js +2 -7
- package/esm/masking/methods.js +13 -7
- package/esm/skeleton/type.d.ts +1 -0
- 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/_helpers/render.d.ts +6 -1
- package/umd/_helpers/render.js +23 -2
- package/umd/ellipsis/components/js-ellipsis.js +7 -6
- package/umd/image/style/index.less +2 -4
- package/umd/image-preview/methods.js +2 -7
- package/umd/masking/methods.js +12 -6
- package/umd/skeleton/type.d.ts +1 -0
- 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/esm/_helpers/render.js
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import React from 'react';
|
3
3
|
import { render as copyRender } from './react-dom';
|
4
|
-
export var
|
4
|
+
export var renderRootCache = {};
|
5
|
+
export var ReactDOMRender = function ReactDOMRender(app, container, context, rootCacheId, // root id in cache
|
6
|
+
root // use root in cache
|
7
|
+
) {
|
5
8
|
var _this = this;
|
6
9
|
|
7
10
|
this.root = void 0;
|
8
11
|
this.app = void 0;
|
9
12
|
this.container = void 0;
|
10
13
|
this.context = void 0;
|
14
|
+
this.rootCacheId = void 0;
|
11
15
|
|
12
16
|
this.render = function (props) {
|
13
17
|
var CustomApp = _this.app;
|
@@ -23,14 +27,30 @@ export var ReactDOMRender = function ReactDOMRender(app, container, context) {
|
|
23
27
|
}
|
24
28
|
};
|
25
29
|
|
30
|
+
this.setRootCache = function () {
|
31
|
+
if (_this.rootCacheId) {
|
32
|
+
renderRootCache[_this.rootCacheId] = _this.root;
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
this.clearRootCache = function () {
|
37
|
+
if (_this.rootCacheId) {
|
38
|
+
delete renderRootCache[_this.rootCacheId];
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
26
42
|
this.unmount = function () {
|
27
43
|
var _this$root;
|
28
44
|
|
29
45
|
(_this$root = _this.root) == null ? void 0 : _this$root._unmount();
|
30
46
|
_this.root = undefined;
|
47
|
+
|
48
|
+
_this.clearRootCache();
|
31
49
|
};
|
32
50
|
|
33
51
|
this.app = app;
|
34
52
|
this.container = container;
|
35
53
|
this.context = context;
|
54
|
+
this.rootCacheId = rootCacheId;
|
55
|
+
this.root = root;
|
36
56
|
};
|
@@ -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 () {
|
@@ -149,7 +151,7 @@ var JsEllipsis = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
149
151
|
textRef.current.innerText = text;
|
150
152
|
}
|
151
153
|
|
152
|
-
if (!
|
154
|
+
if (!ellipsisValueRef.current) {
|
153
155
|
return;
|
154
156
|
}
|
155
157
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
@import
|
1
|
+
@import '../../../style/mixin.less';
|
2
2
|
|
3
3
|
.@{prefix}-image {
|
4
4
|
display: inline-block;
|
5
5
|
position: relative;
|
6
6
|
|
7
7
|
&.preview {
|
8
|
-
transition: all .3s ease-in-out;
|
8
|
+
transition: all 0.3s ease-in-out;
|
9
9
|
|
10
10
|
.image-container,
|
11
11
|
.image-loading-container .image-loading,
|
@@ -109,7 +109,6 @@
|
|
109
109
|
}
|
110
110
|
|
111
111
|
.image-error-container {
|
112
|
-
|
113
112
|
.image-retry-load {
|
114
113
|
position: absolute;
|
115
114
|
top: 0;
|
@@ -127,7 +126,6 @@
|
|
127
126
|
}
|
128
127
|
|
129
128
|
.image-loading-container {
|
130
|
-
|
131
129
|
.image-loading {
|
132
130
|
position: absolute;
|
133
131
|
top: 0;
|
@@ -3,9 +3,7 @@ import { appendElementById, removeElement } from '@arco-design/mobile-utils';
|
|
3
3
|
import { ReactDOMRender } from '../_helpers/render';
|
4
4
|
export function open(Component) {
|
5
5
|
return function (config, context) {
|
6
|
-
var baseProps = _extends({
|
7
|
-
unmountOnExit: true
|
8
|
-
}, config || {}, {
|
6
|
+
var baseProps = _extends({}, config || {}, {
|
9
7
|
close: function close() {}
|
10
8
|
}); // 不同的key用不同的容器挂载
|
11
9
|
// @en Different keys are mounted in different containers
|
@@ -42,10 +40,7 @@ export function open(Component) {
|
|
42
40
|
|
43
41
|
dynamicProps.onClose = function () {
|
44
42
|
baseProps.onClose && baseProps.onClose();
|
45
|
-
|
46
|
-
if (baseProps.unmountOnExit) {
|
47
|
-
removeElement(div);
|
48
|
-
}
|
43
|
+
removeElement(div);
|
49
44
|
};
|
50
45
|
|
51
46
|
dynamicProps.openIndex = -1;
|
package/esm/masking/methods.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import { appendElementById, removeElement, nextTick } from '@arco-design/mobile-utils';
|
3
|
-
import { ReactDOMRender } from '../_helpers/render';
|
3
|
+
import { ReactDOMRender, renderRootCache } from '../_helpers/render';
|
4
4
|
export function getOpenMethod(Component, containerId, normalize) {
|
5
5
|
if (normalize === void 0) {
|
6
6
|
normalize = function normalize(config) {
|
@@ -18,14 +18,14 @@ export function getOpenMethod(Component, containerId, normalize) {
|
|
18
18
|
|
19
19
|
|
20
20
|
var id = "_" + (containerId || 'ARCO_MASKING') + "_DIV_" + (config.key || '') + "_";
|
21
|
-
|
22
|
-
var
|
23
|
-
div = _appendElementById.child;
|
24
|
-
|
21
|
+
var existedDiv = baseProps.unmountOnExit ? null : document.getElementById(id);
|
22
|
+
var div = existedDiv || appendElementById(id, baseProps.getContainer).child;
|
25
23
|
var leaving = false;
|
26
24
|
|
27
|
-
var _ReactDOMRender = new ReactDOMRender(Component, div, context),
|
28
|
-
render = _ReactDOMRender.render
|
25
|
+
var _ReactDOMRender = new ReactDOMRender(Component, div, context, id, existedDiv ? renderRootCache[id] : undefined),
|
26
|
+
render = _ReactDOMRender.render,
|
27
|
+
unmount = _ReactDOMRender.unmount,
|
28
|
+
setRootCache = _ReactDOMRender.setRootCache;
|
29
29
|
|
30
30
|
var dynamicProps = _extends({}, baseProps, {
|
31
31
|
getContainer: function getContainer() {
|
@@ -50,11 +50,17 @@ export function getOpenMethod(Component, containerId, normalize) {
|
|
50
50
|
baseProps.onClose && baseProps.onClose(scene);
|
51
51
|
|
52
52
|
if (baseProps.unmountOnExit) {
|
53
|
+
unmount();
|
53
54
|
removeElement(div);
|
54
55
|
}
|
55
56
|
};
|
56
57
|
|
57
58
|
render(dynamicProps);
|
59
|
+
|
60
|
+
if (!baseProps.unmountOnExit) {
|
61
|
+
setRootCache();
|
62
|
+
}
|
63
|
+
|
58
64
|
nextTick(function () {
|
59
65
|
if (leaving) return;
|
60
66
|
dynamicProps.visible = true;
|
package/esm/skeleton/type.d.ts
CHANGED
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.9",
|
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.9",
|
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": "6831c908713b02b4f7738c793ea4118e17f03458"
|
53
53
|
}
|
package/umd/_helpers/render.d.ts
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
import { FunctionComponent } from 'react';
|
2
2
|
import { RootType } from './react-dom';
|
3
3
|
import { GlobalContextParams } from '../context-provider';
|
4
|
+
export declare const renderRootCache: Record<string, RootType | undefined>;
|
4
5
|
export declare class ReactDOMRender {
|
5
6
|
root: RootType | undefined;
|
6
7
|
app: FunctionComponent;
|
7
8
|
container: Element | DocumentFragment;
|
8
9
|
context: GlobalContextParams | undefined;
|
9
|
-
|
10
|
+
rootCacheId: string | undefined;
|
11
|
+
constructor(app: FunctionComponent, container: Element | DocumentFragment, context?: GlobalContextParams, rootCacheId?: string, // root id in cache
|
12
|
+
root?: RootType);
|
10
13
|
render: (props: any) => void;
|
14
|
+
setRootCache: () => void;
|
15
|
+
clearRootCache: () => void;
|
11
16
|
unmount: () => void;
|
12
17
|
}
|
package/umd/_helpers/render.js
CHANGED
@@ -16,17 +16,22 @@
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
17
17
|
|
18
18
|
_exports.__esModule = true;
|
19
|
-
_exports.ReactDOMRender = void 0;
|
19
|
+
_exports.renderRootCache = _exports.ReactDOMRender = void 0;
|
20
20
|
_extends2 = _interopRequireDefault(_extends2);
|
21
21
|
_react = _interopRequireDefault(_react);
|
22
|
+
var renderRootCache = {};
|
23
|
+
_exports.renderRootCache = renderRootCache;
|
22
24
|
|
23
|
-
var ReactDOMRender = function ReactDOMRender(app, container, context
|
25
|
+
var ReactDOMRender = function ReactDOMRender(app, container, context, rootCacheId, // root id in cache
|
26
|
+
root // use root in cache
|
27
|
+
) {
|
24
28
|
var _this = this;
|
25
29
|
|
26
30
|
this.root = void 0;
|
27
31
|
this.app = void 0;
|
28
32
|
this.container = void 0;
|
29
33
|
this.context = void 0;
|
34
|
+
this.rootCacheId = void 0;
|
30
35
|
|
31
36
|
this.render = function (props) {
|
32
37
|
var CustomApp = _this.app;
|
@@ -41,16 +46,32 @@
|
|
41
46
|
}
|
42
47
|
};
|
43
48
|
|
49
|
+
this.setRootCache = function () {
|
50
|
+
if (_this.rootCacheId) {
|
51
|
+
renderRootCache[_this.rootCacheId] = _this.root;
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
this.clearRootCache = function () {
|
56
|
+
if (_this.rootCacheId) {
|
57
|
+
delete renderRootCache[_this.rootCacheId];
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
44
61
|
this.unmount = function () {
|
45
62
|
var _this$root;
|
46
63
|
|
47
64
|
(_this$root = _this.root) == null ? void 0 : _this$root._unmount();
|
48
65
|
_this.root = undefined;
|
66
|
+
|
67
|
+
_this.clearRootCache();
|
49
68
|
};
|
50
69
|
|
51
70
|
this.app = app;
|
52
71
|
this.container = container;
|
53
72
|
this.context = context;
|
73
|
+
this.rootCacheId = rootCacheId;
|
74
|
+
this.root = root;
|
54
75
|
};
|
55
76
|
|
56
77
|
_exports.ReactDOMRender = ReactDOMRender;
|
@@ -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 () {
|
@@ -172,7 +173,7 @@
|
|
172
173
|
textRef.current.innerText = text;
|
173
174
|
}
|
174
175
|
|
175
|
-
if (!
|
176
|
+
if (!ellipsisValueRef.current) {
|
176
177
|
return;
|
177
178
|
}
|
178
179
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
@import
|
1
|
+
@import '../../../style/mixin.less';
|
2
2
|
|
3
3
|
.@{prefix}-image {
|
4
4
|
display: inline-block;
|
5
5
|
position: relative;
|
6
6
|
|
7
7
|
&.preview {
|
8
|
-
transition: all .3s ease-in-out;
|
8
|
+
transition: all 0.3s ease-in-out;
|
9
9
|
|
10
10
|
.image-container,
|
11
11
|
.image-loading-container .image-loading,
|
@@ -109,7 +109,6 @@
|
|
109
109
|
}
|
110
110
|
|
111
111
|
.image-error-container {
|
112
|
-
|
113
112
|
.image-retry-load {
|
114
113
|
position: absolute;
|
115
114
|
top: 0;
|
@@ -127,7 +126,6 @@
|
|
127
126
|
}
|
128
127
|
|
129
128
|
.image-loading-container {
|
130
|
-
|
131
129
|
.image-loading {
|
132
130
|
position: absolute;
|
133
131
|
top: 0;
|
@@ -21,9 +21,7 @@
|
|
21
21
|
|
22
22
|
function open(Component) {
|
23
23
|
return function (config, context) {
|
24
|
-
var baseProps = (0, _extends2.default)({
|
25
|
-
unmountOnExit: true
|
26
|
-
}, config || {}, {
|
24
|
+
var baseProps = (0, _extends2.default)({}, config || {}, {
|
27
25
|
close: function close() {}
|
28
26
|
}); // 不同的key用不同的容器挂载
|
29
27
|
// @en Different keys are mounted in different containers
|
@@ -59,10 +57,7 @@
|
|
59
57
|
|
60
58
|
dynamicProps.onClose = function () {
|
61
59
|
baseProps.onClose && baseProps.onClose();
|
62
|
-
|
63
|
-
if (baseProps.unmountOnExit) {
|
64
|
-
(0, _mobileUtils.removeElement)(div);
|
65
|
-
}
|
60
|
+
(0, _mobileUtils.removeElement)(div);
|
66
61
|
};
|
67
62
|
|
68
63
|
dynamicProps.openIndex = -1;
|
package/umd/masking/methods.js
CHANGED
@@ -36,14 +36,14 @@
|
|
36
36
|
}); // 不同的key用不同的容器挂载
|
37
37
|
|
38
38
|
var id = "_" + (containerId || 'ARCO_MASKING') + "_DIV_" + (config.key || '') + "_";
|
39
|
-
|
40
|
-
var
|
41
|
-
div = _appendElementById.child;
|
42
|
-
|
39
|
+
var existedDiv = baseProps.unmountOnExit ? null : document.getElementById(id);
|
40
|
+
var div = existedDiv || (0, _mobileUtils.appendElementById)(id, baseProps.getContainer).child;
|
43
41
|
var leaving = false;
|
44
42
|
|
45
|
-
var _ReactDOMRender = new _render.ReactDOMRender(Component, div, context),
|
46
|
-
render = _ReactDOMRender.render
|
43
|
+
var _ReactDOMRender = new _render.ReactDOMRender(Component, div, context, id, existedDiv ? _render.renderRootCache[id] : undefined),
|
44
|
+
render = _ReactDOMRender.render,
|
45
|
+
unmount = _ReactDOMRender.unmount,
|
46
|
+
setRootCache = _ReactDOMRender.setRootCache;
|
47
47
|
|
48
48
|
var dynamicProps = (0, _extends2.default)({}, baseProps, {
|
49
49
|
getContainer: function getContainer() {
|
@@ -68,11 +68,17 @@
|
|
68
68
|
baseProps.onClose && baseProps.onClose(scene);
|
69
69
|
|
70
70
|
if (baseProps.unmountOnExit) {
|
71
|
+
unmount();
|
71
72
|
(0, _mobileUtils.removeElement)(div);
|
72
73
|
}
|
73
74
|
};
|
74
75
|
|
75
76
|
render(dynamicProps);
|
77
|
+
|
78
|
+
if (!baseProps.unmountOnExit) {
|
79
|
+
setRootCache();
|
80
|
+
}
|
81
|
+
|
76
82
|
(0, _mobileUtils.nextTick)(function () {
|
77
83
|
if (leaving) return;
|
78
84
|
dynamicProps.visible = true;
|