@arco-design/mobile-react 2.19.2-ee92494.5 → 2.20.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 +23 -0
- package/README.en-US.md +4 -4
- package/README.md +4 -4
- package/cjs/avatar/group.js +1 -1
- package/cjs/avatar/index.js +10 -13
- package/cjs/avatar/style/css/index.css +96 -126
- package/cjs/avatar/style/index.less +54 -72
- package/cjs/badge/index.js +6 -8
- package/cjs/badge/style/css/index.css +5 -5
- package/cjs/badge/style/index.less +5 -5
- package/cjs/button/demo/style/mobile.less +0 -4
- package/cjs/button/hooks.d.ts +1 -2
- package/cjs/button/hooks.js +5 -3
- package/cjs/button/index.d.ts +1 -1
- package/cjs/button/index.js +28 -33
- package/cjs/button/style/css/index.css +75 -310
- package/cjs/button/style/index.less +32 -38
- package/cjs/dropdown/dropdown.d.ts +3 -0
- package/cjs/dropdown/dropdown.js +306 -0
- package/cjs/dropdown/index.d.ts +3 -4
- package/cjs/dropdown/index.js +3 -303
- package/cjs/dropdown/options.js +2 -1
- package/cjs/dropdown/type.d.ts +20 -9
- package/cjs/dropdown-menu/dropdown-menu.d.ts +4 -0
- package/cjs/dropdown-menu/dropdown-menu.js +273 -0
- package/cjs/dropdown-menu/helper.d.ts +1 -1
- package/cjs/dropdown-menu/index.d.ts +2 -3
- package/cjs/dropdown-menu/index.js +2 -245
- package/cjs/dropdown-menu/type.d.ts +21 -20
- package/cjs/image/index.js +4 -1
- package/cjs/image/style/css/index.css +2 -1
- package/cjs/image/style/index.less +2 -1
- package/cjs/image-picker/index.d.ts +6 -6
- package/cjs/image-picker/index.js +4 -3
- package/cjs/nav-bar/index.js +7 -2
- package/cjs/show-monitor/index.js +31 -3
- package/dist/index.js +644 -604
- package/dist/index.min.js +3 -3
- package/dist/style.css +174 -438
- package/dist/style.min.css +1 -1
- package/esm/avatar/group.js +1 -1
- package/esm/avatar/index.js +10 -13
- package/esm/avatar/style/css/index.css +96 -126
- package/esm/avatar/style/index.less +54 -72
- package/esm/badge/index.js +6 -8
- package/esm/badge/style/css/index.css +5 -5
- package/esm/badge/style/index.less +5 -5
- package/esm/button/demo/style/mobile.less +0 -4
- package/esm/button/hooks.d.ts +1 -2
- package/esm/button/hooks.js +5 -3
- package/esm/button/index.d.ts +1 -1
- package/esm/button/index.js +30 -35
- package/esm/button/style/css/index.css +75 -310
- package/esm/button/style/index.less +32 -38
- package/esm/dropdown/dropdown.d.ts +3 -0
- package/esm/dropdown/dropdown.js +288 -0
- package/esm/dropdown/index.d.ts +3 -4
- package/esm/dropdown/index.js +3 -293
- package/esm/dropdown/options.js +2 -1
- package/esm/dropdown/type.d.ts +20 -9
- package/esm/dropdown-menu/dropdown-menu.d.ts +4 -0
- package/esm/dropdown-menu/dropdown-menu.js +256 -0
- package/esm/dropdown-menu/helper.d.ts +1 -1
- package/esm/dropdown-menu/index.d.ts +2 -3
- package/esm/dropdown-menu/index.js +2 -237
- package/esm/dropdown-menu/type.d.ts +21 -20
- package/esm/image/index.js +4 -1
- package/esm/image/style/css/index.css +2 -1
- package/esm/image/style/index.less +2 -1
- package/esm/image-picker/index.d.ts +6 -6
- package/esm/image-picker/index.js +4 -3
- package/esm/nav-bar/index.js +6 -2
- package/esm/show-monitor/index.js +31 -3
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +2 -1
- package/tokens/app/arcodesign/default/index.d.ts +2 -1
- package/tokens/app/arcodesign/default/index.js +2 -1
- package/tokens/app/arcodesign/default/index.json +27 -15
- package/tokens/app/arcodesign/default/index.less +2 -1
- package/umd/avatar/group.js +1 -1
- package/umd/avatar/index.js +10 -13
- package/umd/avatar/style/css/index.css +96 -126
- package/umd/avatar/style/index.less +54 -72
- package/umd/badge/index.js +6 -8
- package/umd/badge/style/css/index.css +5 -5
- package/umd/badge/style/index.less +5 -5
- package/umd/button/demo/style/mobile.less +0 -4
- package/umd/button/hooks.d.ts +1 -2
- package/umd/button/hooks.js +5 -3
- package/umd/button/index.d.ts +1 -1
- package/umd/button/index.js +28 -33
- package/umd/button/style/css/index.css +75 -310
- package/umd/button/style/index.less +32 -38
- package/umd/dropdown/dropdown.d.ts +3 -0
- package/umd/dropdown/dropdown.js +309 -0
- package/umd/dropdown/index.d.ts +3 -4
- package/umd/dropdown/index.js +5 -298
- package/umd/dropdown/options.js +2 -1
- package/umd/dropdown/type.d.ts +20 -9
- package/umd/dropdown-menu/dropdown-menu.d.ts +4 -0
- package/umd/dropdown-menu/dropdown-menu.js +278 -0
- package/umd/dropdown-menu/helper.d.ts +1 -1
- package/umd/dropdown-menu/index.d.ts +2 -3
- package/umd/dropdown-menu/index.js +5 -241
- package/umd/dropdown-menu/type.d.ts +21 -20
- package/umd/image/index.js +4 -1
- package/umd/image/style/css/index.css +2 -1
- package/umd/image/style/index.less +2 -1
- package/umd/image-picker/index.d.ts +6 -6
- package/umd/image-picker/index.js +4 -3
- package/umd/nav-bar/index.js +9 -6
- package/umd/show-monitor/index.js +31 -3
@@ -1,5 +1,5 @@
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
2
|
-
import { OptionsItem, DropdownCommonProps } from '../dropdown';
|
2
|
+
import { OptionsItem, DropdownCommonProps, OptionValueType } from '../dropdown';
|
3
3
|
export type { OptionsItem, DropdownCommonProps };
|
4
4
|
export interface CascadeOptions extends OptionsItem {
|
5
5
|
/**
|
@@ -29,11 +29,6 @@ export interface DropdownMenuBasicProps {
|
|
29
29
|
* @en The selected number of selector (controlled)
|
30
30
|
*/
|
31
31
|
selectIndex?: number;
|
32
|
-
/**
|
33
|
-
* 自定义选择器
|
34
|
-
* @en Custom selector
|
35
|
-
*/
|
36
|
-
renderSelectLabel?: (op: OptionsItem, index: number) => ReactNode;
|
37
32
|
/**
|
38
33
|
* 选择器禁用状态
|
39
34
|
* @en Selector disabled state
|
@@ -112,47 +107,53 @@ export interface SingleOptionProps {
|
|
112
107
|
* 初始选择项
|
113
108
|
* @en initial selection item
|
114
109
|
* */
|
115
|
-
defaultValues?:
|
110
|
+
defaultValues?: OptionValueType[];
|
116
111
|
/**
|
117
112
|
* (受控) 每个选择器选中的项
|
118
113
|
* @en (Controlled) The item selected by each selector
|
119
114
|
* */
|
120
|
-
values?:
|
115
|
+
values?: OptionValueType[];
|
116
|
+
/**
|
117
|
+
* 自定义选择器
|
118
|
+
* @en Custom selector
|
119
|
+
*/
|
120
|
+
renderSelectLabel?: (op: OptionsItem, index: number) => ReactNode;
|
121
121
|
/**
|
122
122
|
* 点击选项时触发的回调函数
|
123
123
|
* @en Callback when clicking option
|
124
124
|
* */
|
125
|
-
onOptionClick?: (value:
|
125
|
+
onOptionClick?: (value: OptionValueType, item: OptionsItem, selectIndex?: number) => void;
|
126
126
|
/**
|
127
127
|
* 选项改变时触发的回调函数
|
128
128
|
* @en Callback when options change
|
129
129
|
* */
|
130
|
-
onOptionChange?: (value:
|
130
|
+
onOptionChange?: (value: OptionValueType, item: OptionsItem, selectIndex?: number) => void;
|
131
131
|
/**
|
132
132
|
* 所有选择器选项总值改变时的回调函数
|
133
133
|
* @en Callback when the total value of all selector options changes
|
134
134
|
* */
|
135
|
-
onValuesChange?: (values:
|
135
|
+
onValuesChange?: (values: OptionValueType[]) => void;
|
136
136
|
/**
|
137
137
|
* 格式化传入的options
|
138
138
|
* @en Format the input options
|
139
139
|
* */
|
140
|
-
getFormattedOptions?: (options: SingleOptionProps['options'], values?:
|
140
|
+
getFormattedOptions?: (options: SingleOptionProps['options'], values?: OptionValueType[]) => {
|
141
141
|
formattedOptions: OptionsItem[][];
|
142
|
-
formattedValue:
|
142
|
+
formattedValue: OptionValueType[];
|
143
143
|
};
|
144
144
|
}
|
145
145
|
export interface MultipleOptionProps {
|
146
146
|
multiple: true;
|
147
147
|
options: string[] | OptionsItem[][];
|
148
|
-
defaultValues?:
|
149
|
-
values?:
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
148
|
+
defaultValues?: OptionValueType[][];
|
149
|
+
values?: OptionValueType[][];
|
150
|
+
renderSelectLabel?: (op: OptionsItem[], index: number) => ReactNode;
|
151
|
+
onOptionClick?: (selected: boolean, val: OptionValueType, item: OptionsItem, selectIndex?: number) => void;
|
152
|
+
onOptionChange?: (vals: OptionValueType[], item: OptionsItem, selectIndex?: number) => void;
|
153
|
+
onValuesChange?: (values: OptionValueType[][]) => void;
|
154
|
+
getFormattedOptions?: (options: SingleOptionProps['options'], values?: OptionValueType[][]) => {
|
154
155
|
formattedOptions: OptionsItem[][];
|
155
|
-
formattedValue:
|
156
|
+
formattedValue: OptionValueType[][];
|
156
157
|
};
|
157
158
|
}
|
158
159
|
export declare type OptionProps = SingleOptionProps | MultipleOptionProps;
|
package/umd/image/index.js
CHANGED
@@ -57,6 +57,7 @@
|
|
57
57
|
var wrapRef = (0, _react.useRef)(null);
|
58
58
|
var retryCountRef = (0, _react.useRef)(0);
|
59
59
|
var loadingImageRef = (0, _react.useRef)(null);
|
60
|
+
var hasLoadedRef = (0, _react.useRef)(false);
|
60
61
|
var style = props.style,
|
61
62
|
className = props.className,
|
62
63
|
status = props.status,
|
@@ -180,6 +181,7 @@
|
|
180
181
|
image.onload = function (evt) {
|
181
182
|
loadingImageRef.current = null;
|
182
183
|
imageDomRef.current = image;
|
184
|
+
hasLoadedRef.current = true;
|
183
185
|
changeStatus('loaded');
|
184
186
|
var _image$width = image.width,
|
185
187
|
imageWidth = _image$width === void 0 ? 0 : _image$width,
|
@@ -294,7 +296,8 @@
|
|
294
296
|
})) : null, /*#__PURE__*/_react.default.createElement("div", {
|
295
297
|
className: (0, _mobileUtils.cls)('image-container', validStatus, {
|
296
298
|
animate: Boolean(animateDuration),
|
297
|
-
'static-label': staticLabel
|
299
|
+
'static-label': staticLabel,
|
300
|
+
'has-loaded': hasLoadedRef.current
|
298
301
|
}),
|
299
302
|
style: (0, _helpers.getStyleWithVendor)({
|
300
303
|
transitionDuration: animateDuration + "ms"
|
@@ -66,7 +66,8 @@
|
|
66
66
|
}
|
67
67
|
.arco-image .image-container.static-label,
|
68
68
|
.arco-image .image-container.loaded,
|
69
|
-
.arco-image .image-container.error
|
69
|
+
.arco-image .image-container.error,
|
70
|
+
.arco-image .image-container.has-loaded {
|
70
71
|
opacity: 1;
|
71
72
|
}
|
72
73
|
.arco-image .image-container.animate {
|
@@ -14,9 +14,10 @@ export interface ImagePickItem {
|
|
14
14
|
/**
|
15
15
|
* 图片状态
|
16
16
|
* @en Image Status
|
17
|
-
* @default
|
17
|
+
* @default 以图片自身加载状态而定
|
18
|
+
* @default_en According to inner status of the image
|
18
19
|
*/
|
19
|
-
status
|
20
|
+
status?: 'loaded' | 'loading' | 'error';
|
20
21
|
}
|
21
22
|
export interface AdapterFile {
|
22
23
|
url?: string;
|
@@ -117,7 +118,7 @@ export interface ImagePickerProps {
|
|
117
118
|
* 透传给图片的属性
|
118
119
|
* @en Attributes passed through to the image
|
119
120
|
*/
|
120
|
-
imageProps?: ImageProps
|
121
|
+
imageProps?: Partial<ImageProps>;
|
121
122
|
/**
|
122
123
|
* 自定义上传失败展示
|
123
124
|
* @en Defined upload failed display
|
@@ -133,12 +134,11 @@ export interface ImagePickerProps {
|
|
133
134
|
* @en upload function
|
134
135
|
*/
|
135
136
|
upload?: (file: ImagePickItem) => Promise<ImagePickItem | null>;
|
136
|
-
onSelect?: (...args: any[]) => void;
|
137
137
|
/**
|
138
138
|
* 已选图片列表发生变化
|
139
139
|
* @en The list of selected images changes
|
140
140
|
*/
|
141
|
-
onChange?: (fileList: ImagePickItem[]) =>
|
141
|
+
onChange?: (fileList: ImagePickItem[]) => void;
|
142
142
|
/**
|
143
143
|
* 图片超过限制大小
|
144
144
|
* @en Image exceeds size limit
|
@@ -163,7 +163,7 @@ export interface ImagePickerProps {
|
|
163
163
|
* 图片选择适配器
|
164
164
|
* @en Select Adaptor
|
165
165
|
*/
|
166
|
-
selectAdapter
|
166
|
+
selectAdapter?: () => Promise<SelectCallback>;
|
167
167
|
}
|
168
168
|
export interface ImagePickerRef {
|
169
169
|
/**
|
@@ -139,7 +139,7 @@
|
|
139
139
|
var res = parseFiles.map(function (url, index) {
|
140
140
|
return {
|
141
141
|
url: url,
|
142
|
-
status: upload ? 'loading' : 'loaded',
|
142
|
+
status: typeof upload === 'function' ? 'loading' : 'loaded',
|
143
143
|
file: files[index]
|
144
144
|
};
|
145
145
|
});
|
@@ -150,11 +150,12 @@
|
|
150
150
|
var propsImageLength = images.length;
|
151
151
|
files.forEach(function (_file, index) {
|
152
152
|
upload(cacheRes[propsImageLength + index]).then(function (data) {
|
153
|
-
cacheRes[propsImageLength + index] = (0, _extends2.default)({}, cacheRes[propsImageLength + index], data
|
153
|
+
cacheRes[propsImageLength + index] = (0, _extends2.default)({}, cacheRes[propsImageLength + index], data, {
|
154
|
+
status: undefined
|
155
|
+
});
|
154
156
|
}).catch(function () {
|
155
157
|
cacheRes[propsImageLength + index].status = 'error';
|
156
158
|
}).finally(function () {
|
157
|
-
cacheRes[propsImageLength + index].status = 'loaded';
|
158
159
|
onChange([].concat(cacheRes));
|
159
160
|
});
|
160
161
|
});
|
package/umd/nav-bar/index.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
(function (global, factory) {
|
2
2
|
if (typeof define === "function" && define.amd) {
|
3
|
-
define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../context-provider", "./back-icon"], factory);
|
3
|
+
define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../context-provider", "./back-icon", "../_helpers"], factory);
|
4
4
|
} else if (typeof exports !== "undefined") {
|
5
|
-
factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../context-provider"), require("./back-icon"));
|
5
|
+
factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../context-provider"), require("./back-icon"), require("../_helpers"));
|
6
6
|
} else {
|
7
7
|
var mod = {
|
8
8
|
exports: {}
|
9
9
|
};
|
10
|
-
factory(mod.exports, global._extends, global.react, global.mobileUtils, global.contextProvider, global.backIcon);
|
10
|
+
factory(mod.exports, global._extends, global.react, global.mobileUtils, global.contextProvider, global.backIcon, global._helpers);
|
11
11
|
global.index = mod.exports;
|
12
12
|
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _contextProvider, _backIcon) {
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _contextProvider, _backIcon, _helpers) {
|
14
14
|
"use strict";
|
15
15
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
@@ -72,8 +72,10 @@
|
|
72
72
|
customStyle = _useState2[0],
|
73
73
|
setCustomStyle = _useState2[1];
|
74
74
|
|
75
|
+
var system = (0, _helpers.useSystem)();
|
76
|
+
|
75
77
|
var onElementScroll = function onElementScroll(curOffset) {
|
76
|
-
setScrollToggleHide(curOffset
|
78
|
+
setScrollToggleHide(curOffset < showOffset);
|
77
79
|
|
78
80
|
if (getComputedStyleByScroll) {
|
79
81
|
var cstyle = getComputedStyleByScroll(curOffset);
|
@@ -99,6 +101,7 @@
|
|
99
101
|
(0, _react.useEffect)(function () {
|
100
102
|
var needBind = showOffset || getComputedStyleByScroll;
|
101
103
|
var container = (0, _mobileUtils.getValidScrollContainer)(getScrollContainer);
|
104
|
+
handleEleScroll();
|
102
105
|
|
103
106
|
if (needBind && container) {
|
104
107
|
container.addEventListener('scroll', handleEleScroll, false);
|
@@ -146,7 +149,7 @@
|
|
146
149
|
background: relBackground
|
147
150
|
} : {})
|
148
151
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
149
|
-
className: (0, _mobileUtils.cls)(className, prefixCls + "-nav-bar-wrapper", (_cls2 = {}, _cls2[prefixCls + "-nav-bar-wrapper-fixed"] = fixed, _cls2[prefixCls + "-nav-bar-wrapper-border"] = hasBottomLine, _cls2)),
|
152
|
+
className: (0, _mobileUtils.cls)(className, system, prefixCls + "-nav-bar-wrapper", (_cls2 = {}, _cls2[prefixCls + "-nav-bar-wrapper-fixed"] = fixed, _cls2[prefixCls + "-nav-bar-wrapper-border"] = hasBottomLine, _cls2)),
|
150
153
|
style: (0, _extends2.default)({
|
151
154
|
paddingTop: statusBarHeight ? statusBarHeight + "px" : ''
|
152
155
|
}, customStyle)
|
@@ -130,6 +130,34 @@
|
|
130
130
|
offset: offset,
|
131
131
|
threshold: threshold
|
132
132
|
}, true);
|
133
|
+
},
|
134
|
+
|
135
|
+
/**
|
136
|
+
* 重置元素初始可见态为false,并重新对元素可见度发起检测,优先级低于disabled(通常用在对ShowMonitor内部元素变化时发起的重新监听)
|
137
|
+
* @en Reset the initial visible state of the element to false, and re-detect the visibility of the element, the priority is lower than 'disabled'(Usually used to re-listen when elements inside ShowMonitor change)
|
138
|
+
*/
|
139
|
+
flushVisibleStatus: function flushVisibleStatus() {
|
140
|
+
isVisible.current = false;
|
141
|
+
|
142
|
+
if (isSupportNativeApi && io.current && domRef.current) {
|
143
|
+
disabled ? io.current.unobserve(domRef.current) : io.current.observe(domRef.current);
|
144
|
+
} else if (listener.current) {
|
145
|
+
var _key = wrapperKey.current;
|
146
|
+
|
147
|
+
if (once && onOnceEmittedListeners != null && onOnceEmittedListeners[_key]) {
|
148
|
+
onOnceEmittedListeners[_key] = onOnceEmittedListeners[_key].filter(function (emitListener) {
|
149
|
+
return emitListener !== listener.current;
|
150
|
+
});
|
151
|
+
}
|
152
|
+
|
153
|
+
if (!disabled && !listeners[_key].find(function (_listener) {
|
154
|
+
return _listener === listener.current;
|
155
|
+
})) {
|
156
|
+
listeners[_key].push(listener.current);
|
157
|
+
}
|
158
|
+
|
159
|
+
!disabled && _checkVisible(listener.current);
|
160
|
+
}
|
133
161
|
}
|
134
162
|
};
|
135
163
|
});
|
@@ -397,8 +425,8 @@
|
|
397
425
|
}
|
398
426
|
}
|
399
427
|
|
400
|
-
var
|
401
|
-
var curListeners = listeners[
|
428
|
+
var _key2 = wrapperKey.current;
|
429
|
+
var curListeners = listeners[_key2];
|
402
430
|
|
403
431
|
if (curListeners) {
|
404
432
|
// 不在监听队列中,移除
|
@@ -408,7 +436,7 @@
|
|
408
436
|
// @en When the listening queue is empty, unbind scroll and resize events
|
409
437
|
|
410
438
|
if (curListeners.length === 0) {
|
411
|
-
delete listeners[
|
439
|
+
delete listeners[_key2];
|
412
440
|
|
413
441
|
if (scrollPort.current) {
|
414
442
|
scrollPort.current.removeEventListener('scroll', throttlingVisibleChange);
|