@arco-design/mobile-react 2.20.0 → 2.21.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 +30 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/avatar/index.d.ts +1 -1
- package/cjs/avatar/index.js +1 -1
- package/cjs/badge/index.d.ts +1 -1
- package/cjs/badge/index.js +1 -1
- package/cjs/carousel/index.d.ts +1 -1
- package/cjs/carousel/index.js +1 -1
- package/cjs/cell/index.d.ts +1 -1
- package/cjs/cell/index.js +1 -1
- package/cjs/checkbox/index.d.ts +1 -1
- package/cjs/checkbox/index.js +1 -1
- package/cjs/collapse/index.d.ts +1 -1
- package/cjs/collapse/index.js +1 -1
- package/cjs/count-down/index.d.ts +1 -1
- package/cjs/count-down/index.js +1 -1
- package/cjs/date-picker/index.d.ts +1 -1
- package/cjs/date-picker/index.js +1 -1
- package/cjs/dropdown/dropdown.js +36 -20
- package/cjs/dropdown/style/css/index.css +3 -0
- package/cjs/dropdown/style/index.less +2 -0
- package/cjs/ellipsis/index.d.ts +1 -1
- package/cjs/ellipsis/index.js +1 -1
- package/cjs/image/index.d.ts +1 -1
- package/cjs/image/index.js +1 -1
- package/cjs/image-picker/index.d.ts +4 -175
- package/cjs/image-picker/index.js +41 -18
- package/cjs/image-picker/type.d.ts +174 -0
- package/cjs/image-picker/type.js +3 -0
- package/cjs/image-preview/index.d.ts +1 -1
- package/cjs/image-preview/index.js +1 -1
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +9 -1
- package/cjs/input/hooks.js +49 -8
- package/cjs/input/index.d.ts +1 -1
- package/cjs/input/index.js +1 -1
- package/cjs/input/props.d.ts +8 -2
- package/cjs/notice-bar/index.d.ts +1 -1
- package/cjs/notice-bar/index.js +1 -1
- package/cjs/picker/index.d.ts +1 -1
- package/cjs/picker/index.js +1 -1
- package/cjs/picker-view/index.d.ts +1 -1
- package/cjs/picker-view/index.js +1 -1
- package/cjs/popover/index.d.ts +1 -1
- package/cjs/popover/index.js +1 -1
- package/cjs/popup-swiper/index.js +3 -2
- package/cjs/radio/index.d.ts +1 -1
- package/cjs/radio/index.js +1 -1
- package/cjs/rate/index.d.ts +1 -1
- package/cjs/rate/index.js +1 -1
- package/cjs/search-bar/association.d.ts +3 -0
- package/cjs/search-bar/association.js +92 -0
- package/cjs/search-bar/cancel-button.d.ts +10 -0
- package/cjs/search-bar/cancel-button.js +41 -0
- package/cjs/search-bar/demo/style/css/mobile.css +5 -0
- package/cjs/search-bar/demo/style/mobile.less +9 -0
- package/cjs/search-bar/highlight.d.ts +12 -0
- package/cjs/search-bar/highlight.js +77 -0
- package/cjs/search-bar/index.d.ts +13 -0
- package/cjs/search-bar/index.js +239 -0
- package/cjs/search-bar/style/css/index.css +148 -0
- package/cjs/search-bar/style/css/index.d.ts +2 -0
- package/cjs/search-bar/style/css/index.js +5 -0
- package/cjs/search-bar/style/index.d.ts +2 -0
- package/cjs/search-bar/style/index.js +5 -0
- package/cjs/search-bar/style/index.less +111 -0
- package/cjs/search-bar/type.d.ts +163 -0
- package/cjs/search-bar/type.js +3 -0
- package/cjs/slider/index.d.ts +1 -1
- package/cjs/slider/index.js +1 -1
- package/cjs/steps/index.d.ts +1 -1
- package/cjs/steps/index.js +1 -1
- package/cjs/sticky/index.d.ts +1 -1
- package/cjs/style.d.ts +2 -0
- package/cjs/style.js +4 -0
- package/cjs/swipe-action/demo/style/css/mobile.css +5 -0
- package/cjs/swipe-action/demo/style/mobile.less +9 -0
- package/cjs/swipe-action/index.d.ts +12 -0
- package/cjs/swipe-action/index.js +339 -0
- package/cjs/swipe-action/item.d.ts +11 -0
- package/cjs/swipe-action/item.js +52 -0
- package/cjs/swipe-action/style/css/index.css +88 -0
- package/cjs/swipe-action/style/css/index.d.ts +2 -0
- package/cjs/swipe-action/style/css/index.js +5 -0
- package/cjs/swipe-action/style/index.d.ts +2 -0
- package/cjs/swipe-action/style/index.js +5 -0
- package/cjs/swipe-action/style/index.less +89 -0
- package/cjs/swipe-action/type.d.ts +123 -0
- package/cjs/swipe-action/type.js +3 -0
- package/cjs/switch/index.d.ts +1 -1
- package/cjs/switch/index.js +1 -1
- package/cjs/tabs/tab-pane.js +5 -1
- package/cjs/tag/index.d.ts +1 -1
- package/cjs/tag/index.js +1 -1
- package/cjs/textarea/index.d.ts +1 -1
- package/cjs/textarea/index.js +1 -1
- package/dist/index.js +7450 -6611
- package/dist/index.min.js +6 -6
- package/dist/style.css +203 -0
- package/dist/style.min.css +1 -1
- package/esm/avatar/index.d.ts +1 -1
- package/esm/avatar/index.js +1 -1
- package/esm/badge/index.d.ts +1 -1
- package/esm/badge/index.js +1 -1
- package/esm/carousel/index.d.ts +1 -1
- package/esm/carousel/index.js +1 -1
- package/esm/cell/index.d.ts +1 -1
- package/esm/cell/index.js +1 -1
- package/esm/checkbox/index.d.ts +1 -1
- package/esm/checkbox/index.js +1 -1
- package/esm/collapse/index.d.ts +1 -1
- package/esm/collapse/index.js +1 -1
- package/esm/count-down/index.d.ts +1 -1
- package/esm/count-down/index.js +1 -1
- package/esm/date-picker/index.d.ts +1 -1
- package/esm/date-picker/index.js +1 -1
- package/esm/dropdown/dropdown.js +36 -20
- package/esm/dropdown/style/css/index.css +3 -0
- package/esm/dropdown/style/index.less +2 -0
- package/esm/ellipsis/index.d.ts +1 -1
- package/esm/ellipsis/index.js +1 -1
- package/esm/image/index.d.ts +1 -1
- package/esm/image/index.js +1 -1
- package/esm/image-picker/index.d.ts +4 -175
- package/esm/image-picker/index.js +30 -17
- package/esm/image-picker/type.d.ts +174 -0
- package/esm/image-picker/type.js +1 -0
- package/esm/image-preview/index.d.ts +1 -1
- package/esm/image-preview/index.js +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/input/hooks.js +49 -8
- package/esm/input/index.d.ts +1 -1
- package/esm/input/index.js +1 -1
- package/esm/input/props.d.ts +8 -2
- package/esm/notice-bar/index.d.ts +1 -1
- package/esm/notice-bar/index.js +1 -1
- package/esm/picker/index.d.ts +1 -1
- package/esm/picker/index.js +1 -1
- package/esm/picker-view/index.d.ts +1 -1
- package/esm/picker-view/index.js +1 -1
- package/esm/popover/index.d.ts +1 -1
- package/esm/popover/index.js +1 -1
- package/esm/popup-swiper/index.js +3 -2
- package/esm/radio/index.d.ts +1 -1
- package/esm/radio/index.js +1 -1
- package/esm/rate/index.d.ts +1 -1
- package/esm/rate/index.js +1 -1
- package/esm/search-bar/association.d.ts +3 -0
- package/esm/search-bar/association.js +82 -0
- package/esm/search-bar/cancel-button.d.ts +10 -0
- package/esm/search-bar/cancel-button.js +30 -0
- package/esm/search-bar/demo/style/css/mobile.css +5 -0
- package/esm/search-bar/demo/style/mobile.less +9 -0
- package/esm/search-bar/highlight.d.ts +12 -0
- package/esm/search-bar/highlight.js +66 -0
- package/esm/search-bar/index.d.ts +13 -0
- package/esm/search-bar/index.js +213 -0
- package/esm/search-bar/style/css/index.css +148 -0
- package/esm/search-bar/style/css/index.d.ts +2 -0
- package/esm/search-bar/style/css/index.js +2 -0
- package/esm/search-bar/style/index.d.ts +2 -0
- package/esm/search-bar/style/index.js +2 -0
- package/esm/search-bar/style/index.less +111 -0
- package/esm/search-bar/type.d.ts +163 -0
- package/esm/search-bar/type.js +1 -0
- package/esm/slider/index.d.ts +1 -1
- package/esm/slider/index.js +1 -1
- package/esm/steps/index.d.ts +1 -1
- package/esm/steps/index.js +1 -1
- package/esm/sticky/index.d.ts +1 -1
- package/esm/style.d.ts +2 -0
- package/esm/style.js +2 -0
- package/esm/swipe-action/demo/style/css/mobile.css +5 -0
- package/esm/swipe-action/demo/style/mobile.less +9 -0
- package/esm/swipe-action/index.d.ts +12 -0
- package/esm/swipe-action/index.js +321 -0
- package/esm/swipe-action/item.d.ts +11 -0
- package/esm/swipe-action/item.js +42 -0
- package/esm/swipe-action/style/css/index.css +88 -0
- package/esm/swipe-action/style/css/index.d.ts +2 -0
- package/esm/swipe-action/style/css/index.js +2 -0
- package/esm/swipe-action/style/index.d.ts +2 -0
- package/esm/swipe-action/style/index.js +2 -0
- package/esm/swipe-action/style/index.less +89 -0
- package/esm/swipe-action/type.d.ts +123 -0
- package/esm/swipe-action/type.js +1 -0
- package/esm/switch/index.d.ts +1 -1
- package/esm/switch/index.js +1 -1
- package/esm/tabs/tab-pane.js +5 -1
- package/esm/tag/index.d.ts +1 -1
- package/esm/tag/index.js +1 -1
- package/esm/textarea/index.d.ts +1 -1
- package/esm/textarea/index.js +1 -1
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +34 -0
- package/tokens/app/arcodesign/default/index.d.ts +34 -0
- package/tokens/app/arcodesign/default/index.js +34 -0
- package/tokens/app/arcodesign/default/index.json +398 -0
- package/tokens/app/arcodesign/default/index.less +34 -0
- package/umd/avatar/index.d.ts +1 -1
- package/umd/avatar/index.js +1 -1
- package/umd/badge/index.d.ts +1 -1
- package/umd/badge/index.js +1 -1
- package/umd/carousel/index.d.ts +1 -1
- package/umd/carousel/index.js +1 -1
- package/umd/cell/index.d.ts +1 -1
- package/umd/cell/index.js +1 -1
- package/umd/checkbox/index.d.ts +1 -1
- package/umd/checkbox/index.js +1 -1
- package/umd/collapse/index.d.ts +1 -1
- package/umd/collapse/index.js +1 -1
- package/umd/count-down/index.d.ts +1 -1
- package/umd/count-down/index.js +1 -1
- package/umd/date-picker/index.d.ts +1 -1
- package/umd/date-picker/index.js +1 -1
- package/umd/dropdown/dropdown.js +36 -20
- package/umd/dropdown/style/css/index.css +3 -0
- package/umd/dropdown/style/index.less +2 -0
- package/umd/ellipsis/index.d.ts +1 -1
- package/umd/ellipsis/index.js +1 -1
- package/umd/image/index.d.ts +1 -1
- package/umd/image/index.js +1 -1
- package/umd/image-picker/index.d.ts +4 -175
- package/umd/image-picker/index.js +40 -22
- package/umd/image-picker/type.d.ts +174 -0
- package/umd/image-picker/type.js +17 -0
- package/umd/image-preview/index.d.ts +1 -1
- package/umd/image-preview/index.js +1 -1
- package/umd/index.d.ts +2 -0
- package/umd/index.js +9 -5
- package/umd/input/hooks.js +48 -7
- package/umd/input/index.d.ts +1 -1
- package/umd/input/index.js +1 -1
- package/umd/input/props.d.ts +8 -2
- package/umd/notice-bar/index.d.ts +1 -1
- package/umd/notice-bar/index.js +1 -1
- package/umd/picker/index.d.ts +1 -1
- package/umd/picker/index.js +1 -1
- package/umd/picker-view/index.d.ts +1 -1
- package/umd/picker-view/index.js +1 -1
- package/umd/popover/index.d.ts +1 -1
- package/umd/popover/index.js +1 -1
- package/umd/popup-swiper/index.js +3 -2
- package/umd/radio/index.d.ts +1 -1
- package/umd/radio/index.js +1 -1
- package/umd/rate/index.d.ts +1 -1
- package/umd/rate/index.js +1 -1
- package/umd/search-bar/association.d.ts +3 -0
- package/umd/search-bar/association.js +101 -0
- package/umd/search-bar/cancel-button.d.ts +10 -0
- package/umd/search-bar/cancel-button.js +52 -0
- package/umd/search-bar/demo/style/css/mobile.css +5 -0
- package/umd/search-bar/demo/style/mobile.less +9 -0
- package/umd/search-bar/highlight.d.ts +12 -0
- package/umd/search-bar/highlight.js +87 -0
- package/umd/search-bar/index.d.ts +13 -0
- package/umd/search-bar/index.js +235 -0
- package/umd/search-bar/style/css/index.css +148 -0
- package/umd/search-bar/style/css/index.d.ts +2 -0
- package/umd/search-bar/style/css/index.js +15 -0
- package/umd/search-bar/style/index.d.ts +2 -0
- package/umd/search-bar/style/index.js +15 -0
- package/umd/search-bar/style/index.less +111 -0
- package/umd/search-bar/type.d.ts +163 -0
- package/umd/search-bar/type.js +17 -0
- package/umd/slider/index.d.ts +1 -1
- package/umd/slider/index.js +1 -1
- package/umd/steps/index.d.ts +1 -1
- package/umd/steps/index.js +1 -1
- package/umd/sticky/index.d.ts +1 -1
- package/umd/style.d.ts +2 -0
- package/umd/style.js +4 -4
- package/umd/swipe-action/demo/style/css/mobile.css +5 -0
- package/umd/swipe-action/demo/style/mobile.less +9 -0
- package/umd/swipe-action/index.d.ts +12 -0
- package/umd/swipe-action/index.js +342 -0
- package/umd/swipe-action/item.d.ts +11 -0
- package/umd/swipe-action/item.js +62 -0
- package/umd/swipe-action/style/css/index.css +88 -0
- package/umd/swipe-action/style/css/index.d.ts +2 -0
- package/umd/swipe-action/style/css/index.js +15 -0
- package/umd/swipe-action/style/index.d.ts +2 -0
- package/umd/swipe-action/style/index.js +15 -0
- package/umd/swipe-action/style/index.less +89 -0
- package/umd/swipe-action/type.d.ts +123 -0
- package/umd/swipe-action/type.js +17 -0
- package/umd/switch/index.d.ts +1 -1
- package/umd/switch/index.js +1 -1
- package/umd/tabs/tab-pane.js +5 -1
- package/umd/tag/index.d.ts +1 -1
- package/umd/tag/index.js +1 -1
- package/umd/textarea/index.d.ts +1 -1
- package/umd/textarea/index.js +1 -1
package/esm/index.d.ts
CHANGED
@@ -41,8 +41,10 @@ export { default as PullRefresh } from './pull-refresh';
|
|
41
41
|
export { default as Radio } from './radio';
|
42
42
|
export { default as Rate } from './rate';
|
43
43
|
export { default as Slider } from './slider';
|
44
|
+
export { default as SearchBar } from './search-bar';
|
44
45
|
export { default as Steps } from './steps';
|
45
46
|
export { default as Sticky } from './sticky';
|
47
|
+
export { default as SwipeAction } from './swipe-action';
|
46
48
|
export { default as SwipeLoad } from './swipe-load';
|
47
49
|
export { default as TabBar } from './tab-bar';
|
48
50
|
export { default as Tag } from './tag';
|
package/esm/index.js
CHANGED
@@ -41,8 +41,10 @@ export { default as PullRefresh } from './pull-refresh';
|
|
41
41
|
export { default as Radio } from './radio';
|
42
42
|
export { default as Rate } from './rate';
|
43
43
|
export { default as Slider } from './slider';
|
44
|
+
export { default as SearchBar } from './search-bar';
|
44
45
|
export { default as Steps } from './steps';
|
45
46
|
export { default as Sticky } from './sticky';
|
47
|
+
export { default as SwipeAction } from './swipe-action';
|
46
48
|
export { default as SwipeLoad } from './swipe-load';
|
47
49
|
export { default as TabBar } from './tab-bar';
|
48
50
|
export { default as Tag } from './tag';
|
package/esm/input/hooks.js
CHANGED
@@ -30,6 +30,8 @@ export function useInputLogic(props, inputRef) {
|
|
30
30
|
clearShowType = _props$clearShowType === void 0 ? 'focus' : _props$clearShowType,
|
31
31
|
_props$clearIcon = props.clearIcon,
|
32
32
|
clearIcon = _props$clearIcon === void 0 ? /*#__PURE__*/React.createElement(IconClear, null) : _props$clearIcon,
|
33
|
+
_props$preventEventWh = props.preventEventWhenClearing,
|
34
|
+
preventEventWhenClearing = _props$preventEventWh === void 0 ? true : _props$preventEventWh,
|
33
35
|
onClear = props.onClear,
|
34
36
|
autoFocus = props.autoFocus;
|
35
37
|
|
@@ -42,8 +44,30 @@ export function useInputLogic(props, inputRef) {
|
|
42
44
|
}),
|
43
45
|
showClear = _useState2[0],
|
44
46
|
toggleClear = _useState2[1];
|
45
|
-
|
46
|
-
|
47
|
+
/**
|
48
|
+
* clear相关问题背景
|
49
|
+
* 如果点击clear按钮之前已经是focusing状态了,那么在点完clear按钮之后会手动聚焦一下
|
50
|
+
* 该行为将导致onClear事件触发时,也会触发一次onBlur和onFocus事件,可能影响一些组件外的代码逻辑
|
51
|
+
*
|
52
|
+
* e.g. 假设input按钮右侧有一个按钮仅在聚焦时展示
|
53
|
+
* 实现代码大致是:onBlur设置其visible为false,onFocus设置其visible为true
|
54
|
+
* 那么这个按钮就会因为clear的点击造成一瞬的闪烁
|
55
|
+
*
|
56
|
+
* 解决思路
|
57
|
+
* 先来看一下,在输入框已激活的状态时,点击清除按钮后,组件的一些事件的触发顺序
|
58
|
+
* handleBlur -> handleClear -> handleFocus -> onBlur(外部回调) -> onFocus(外部回调)
|
59
|
+
* 可以看到外部的onBlur和onFocus回调都是在handleClear函数之后被调用
|
60
|
+
* 因此可以在handleClear中设置一个shouldPreventEvent的boolean标志
|
61
|
+
* 如果这个标志为true,则跳过调用外部的onBlur和onFocus,并在最后再将标志置回false
|
62
|
+
*
|
63
|
+
*/
|
64
|
+
|
65
|
+
|
66
|
+
var _useState3 = useState(false),
|
67
|
+
isFocusing = _useState3[0],
|
68
|
+
setIsFocusing = _useState3[1];
|
69
|
+
|
70
|
+
var shouldPreventEvent = useRef(false);
|
47
71
|
var actualInputValue = value !== void 0 ? value : inputValue;
|
48
72
|
var system = useSystem();
|
49
73
|
var wrapRef = useRef(null);
|
@@ -111,7 +135,12 @@ export function useInputLogic(props, inputRef) {
|
|
111
135
|
|
112
136
|
function handleFocus(e) {
|
113
137
|
nextTick(function () {
|
114
|
-
|
138
|
+
if (preventEventWhenClearing && shouldPreventEvent.current) {
|
139
|
+
shouldPreventEvent.current = false;
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
|
143
|
+
setIsFocusing(true);
|
115
144
|
clearShowType === 'focus' && toggleClear(true);
|
116
145
|
onFocus && onFocus(e);
|
117
146
|
});
|
@@ -119,7 +148,11 @@ export function useInputLogic(props, inputRef) {
|
|
119
148
|
|
120
149
|
function handleBlur(e) {
|
121
150
|
nextTick(function () {
|
122
|
-
|
151
|
+
if (preventEventWhenClearing && shouldPreventEvent.current) {
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
|
155
|
+
setIsFocusing(false);
|
123
156
|
clearShowType === 'focus' && toggleClear(false);
|
124
157
|
onBlur && onBlur(e);
|
125
158
|
});
|
@@ -128,7 +161,7 @@ export function useInputLogic(props, inputRef) {
|
|
128
161
|
function handleClick(e) {
|
129
162
|
// 安卓才会有键盘切换不过来的问题,ios不开启此项,因为blur之后不能再自动focus
|
130
163
|
// @en Android will have the problem that the keyboard cannot be switched. iOS does not enable this, because it can no longer automatically focus after blur.
|
131
|
-
if (blurBeforeFocus && system === 'android' && !
|
164
|
+
if (blurBeforeFocus && system === 'android' && !isFocusing) {
|
132
165
|
inputRef.current && inputRef.current.blur();
|
133
166
|
nextTick(function () {
|
134
167
|
inputRef.current && inputRef.current.focus();
|
@@ -151,18 +184,26 @@ export function useInputLogic(props, inputRef) {
|
|
151
184
|
onClear && onClear(e); // 当点击clear前是focus时强制执行focus
|
152
185
|
// @en Enforce focus when focus is before clicking clear
|
153
186
|
|
154
|
-
if (
|
187
|
+
if (isFocusing) {
|
188
|
+
if (preventEventWhenClearing) {
|
189
|
+
shouldPreventEvent.current = true;
|
190
|
+
}
|
191
|
+
|
155
192
|
inputRef.current && inputRef.current.focus();
|
156
193
|
}
|
157
194
|
});
|
158
195
|
}
|
159
196
|
|
197
|
+
function renderPendNode(pend) {
|
198
|
+
return typeof pend === 'function' ? pend(isFocusing, actualInputValue) : pend;
|
199
|
+
}
|
200
|
+
|
160
201
|
function renderWrapper(prefixCls, type, children) {
|
161
202
|
return /*#__PURE__*/React.createElement("div", {
|
162
203
|
className: prefixCls + "-container all-border-box " + (className || ''),
|
163
204
|
style: style,
|
164
205
|
ref: wrapRef
|
165
|
-
}, prepend, /*#__PURE__*/React.createElement("div", {
|
206
|
+
}, renderPendNode(prepend), /*#__PURE__*/React.createElement("div", {
|
166
207
|
className: cls(prefixCls + "-wrap", type, "border-" + border, system, {
|
167
208
|
disabled: disabled
|
168
209
|
}, {
|
@@ -181,7 +222,7 @@ export function useInputLogic(props, inputRef) {
|
|
181
222
|
onClick: handleClear
|
182
223
|
}, clearIcon) : null, suffix ? /*#__PURE__*/React.createElement("div", {
|
183
224
|
className: prefixCls + "-suffix"
|
184
|
-
}, suffix) : null), append);
|
225
|
+
}, suffix) : null), renderPendNode(append));
|
185
226
|
}
|
186
227
|
|
187
228
|
return {
|
package/esm/input/index.d.ts
CHANGED
package/esm/input/index.js
CHANGED
package/esm/input/props.d.ts
CHANGED
@@ -80,12 +80,12 @@ export interface BasicInputProps<T = HTMLInputElement> {
|
|
80
80
|
* 输入框头部内容,在输入框外部
|
81
81
|
* @en The content of the header of the input box, outside the input box
|
82
82
|
*/
|
83
|
-
prepend?: React.ReactNode;
|
83
|
+
prepend?: React.ReactNode | ((focusing: boolean, inputValue: string) => React.ReactNode);
|
84
84
|
/**
|
85
85
|
* 输入框尾部内容,在输入框外部
|
86
86
|
* @en The content at the end of the input box, outside the input box
|
87
87
|
*/
|
88
|
-
append?: React.ReactNode;
|
88
|
+
append?: React.ReactNode | ((focusing: boolean, inputValue: string) => React.ReactNode);
|
89
89
|
/**
|
90
90
|
* 在聚焦之前blur掉,即切换不同input时会重新弹起键盘,常用于input type切换时重新加载键盘,安卓上有效
|
91
91
|
* @en Blur before focusing, that is, the keyboard will be re-bounced when switching between different inputs. It is often used to reload the keyboard when the input type is switched. It is valid on Android.
|
@@ -102,6 +102,12 @@ export interface BasicInputProps<T = HTMLInputElement> {
|
|
102
102
|
* @default "focus"
|
103
103
|
*/
|
104
104
|
clearShowType?: 'focus' | 'value' | 'always';
|
105
|
+
/**
|
106
|
+
* 在聚焦模式下点击清除按钮时,是否要屏蔽对应产生的onBlur和onFocus事件
|
107
|
+
* @en Whether to block the onBlur and onFocus events generated when the clear button is clicked in focus mode
|
108
|
+
* @default true
|
109
|
+
*/
|
110
|
+
preventEventWhenClearing?: boolean;
|
105
111
|
/**
|
106
112
|
* 清除按钮类型,也可自定义
|
107
113
|
* @en Clear button type, also customizable
|
@@ -98,7 +98,7 @@ export interface NoticeBarRef {
|
|
98
98
|
/**
|
99
99
|
* 可自定义换行或滚动效果,支持循环滚动。
|
100
100
|
* @en Line wrapping or scrolling effects can be customized, and circular scrolling is supported.
|
101
|
-
* @type
|
101
|
+
* @type 信息展示
|
102
102
|
* @type_en Data Display
|
103
103
|
* @name 通知栏
|
104
104
|
* @name_en NoticeBar
|
package/esm/notice-bar/index.js
CHANGED
@@ -6,7 +6,7 @@ import IconClose from '../icon/IconClose';
|
|
6
6
|
/**
|
7
7
|
* 可自定义换行或滚动效果,支持循环滚动。
|
8
8
|
* @en Line wrapping or scrolling effects can be customized, and circular scrolling is supported.
|
9
|
-
* @type
|
9
|
+
* @type 信息展示
|
10
10
|
* @type_en Data Display
|
11
11
|
* @name 通知栏
|
12
12
|
* @name_en NoticeBar
|
package/esm/picker/index.d.ts
CHANGED
package/esm/picker/index.js
CHANGED
@@ -45,7 +45,7 @@ export interface PickerViewRef {
|
|
45
45
|
/**
|
46
46
|
* 选择器视图组件,不含弹窗,方便使用方灵活定制选择器。
|
47
47
|
* @en The picker view component, not has contain popup, which is convenient for the user to flexibly customize the picker.
|
48
|
-
* @type
|
48
|
+
* @type 数据录入
|
49
49
|
* @type_en Data Entry
|
50
50
|
* @name 选择器视图
|
51
51
|
* @name_en PickerView
|
package/esm/picker-view/index.js
CHANGED
@@ -11,7 +11,7 @@ export { MultiPicker, PickerCell, Cascader };
|
|
11
11
|
/**
|
12
12
|
* 选择器视图组件,不含弹窗,方便使用方灵活定制选择器。
|
13
13
|
* @en The picker view component, not has contain popup, which is convenient for the user to flexibly customize the picker.
|
14
|
-
* @type
|
14
|
+
* @type 数据录入
|
15
15
|
* @type_en Data Entry
|
16
16
|
* @name 选择器视图
|
17
17
|
* @name_en PickerView
|
package/esm/popover/index.d.ts
CHANGED
@@ -8,7 +8,7 @@ declare const _default: import("react").ForwardRefExoticComponent<Partial<import
|
|
8
8
|
* @en Bubble card, supports six directions, small arrows are centered in each direction based on the mounted sub-elements, and supports controlled and uncontrolled modes.
|
9
9
|
* @name 气泡卡片
|
10
10
|
* @name_en Popover
|
11
|
-
* @type
|
11
|
+
* @type 信息展示
|
12
12
|
* @type_en Data Display
|
13
13
|
*/
|
14
14
|
export default _default;
|
package/esm/popover/index.js
CHANGED
@@ -13,7 +13,7 @@ var Menu = componentGenerator(Popover);
|
|
13
13
|
* @en Bubble card, supports six directions, small arrows are centered in each direction based on the mounted sub-elements, and supports controlled and uncontrolled modes.
|
14
14
|
* @name 气泡卡片
|
15
15
|
* @name_en Popover
|
16
|
-
* @type
|
16
|
+
* @type 信息展示
|
17
17
|
* @type_en Data Display
|
18
18
|
*/
|
19
19
|
|
@@ -118,13 +118,14 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
118
118
|
var movingFromDirec = allowedDirections.includes(fromDirec) ? fromDirec : '';
|
119
119
|
var disDirection = exitDirection || movingFromDirec;
|
120
120
|
var direcValue = ['top', 'bottom'].includes(disDirection) ? 'Y' : 'X';
|
121
|
+
var direcRatio = ['bottom', 'right'].includes(disDirection) ? 1 : -1;
|
121
122
|
|
122
123
|
switch (movingFromDirec) {
|
123
124
|
case 'top':
|
124
125
|
case 'bottom':
|
125
126
|
setDistance({
|
126
127
|
direction: direcValue,
|
127
|
-
value: Math
|
128
|
+
value: Math.abs(disY) * direcRatio
|
128
129
|
});
|
129
130
|
break;
|
130
131
|
|
@@ -132,7 +133,7 @@ var PopupSwiper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
132
133
|
case 'right':
|
133
134
|
setDistance({
|
134
135
|
direction: direcValue,
|
135
|
-
value: Math
|
136
|
+
value: Math.abs(disX) * direcRatio
|
136
137
|
});
|
137
138
|
break;
|
138
139
|
|
package/esm/radio/index.d.ts
CHANGED
@@ -8,7 +8,7 @@ declare const _default: import("react").ForwardRefExoticComponent<import("./type
|
|
8
8
|
* @en Radio button, click to switch selection when available, supports disabled state and radio option group.
|
9
9
|
* @name 单选框
|
10
10
|
* @name_en Radio
|
11
|
-
* @type
|
11
|
+
* @type 数据录入
|
12
12
|
* @type_en Data Entry
|
13
13
|
*/
|
14
14
|
export default _default;
|
package/esm/radio/index.js
CHANGED
package/esm/rate/index.d.ts
CHANGED
package/esm/rate/index.js
CHANGED
@@ -0,0 +1,82 @@
|
|
1
|
+
import { cls } from '@arco-design/mobile-utils';
|
2
|
+
import React from 'react';
|
3
|
+
import { highlightWithContainMode, highlightWithPrefixMode } from './highlight';
|
4
|
+
export function SearchBarAssociation(props) {
|
5
|
+
var _cls;
|
6
|
+
|
7
|
+
var prefixCls = props.prefixCls,
|
8
|
+
_props$associationIte = props.associationItems,
|
9
|
+
associationItems = _props$associationIte === void 0 ? [] : _props$associationIte,
|
10
|
+
highlightClassName = props.highlightClassName,
|
11
|
+
_props$highlightMode = props.highlightMode,
|
12
|
+
highlightMode = _props$highlightMode === void 0 ? 'none' : _props$highlightMode,
|
13
|
+
highlightStyle = props.highlightStyle,
|
14
|
+
onAssociationClick = props.onAssociationClick,
|
15
|
+
onAssociationItemClick = props.onAssociationItemClick,
|
16
|
+
renderAssociation = props.renderAssociation,
|
17
|
+
renderAssociationItem = props.renderAssociationItem,
|
18
|
+
keyword = props.keyword,
|
19
|
+
visible = props.visible;
|
20
|
+
var searchBarAssociationPrefixCls = prefixCls + "-association";
|
21
|
+
var defaultHighlightClassName = searchBarAssociationPrefixCls + "-item-highlight";
|
22
|
+
|
23
|
+
var renderHighlightNode = function renderHighlightNode(content) {
|
24
|
+
if (!content || !keyword || highlightMode === 'none') {
|
25
|
+
return content;
|
26
|
+
}
|
27
|
+
|
28
|
+
var config = {
|
29
|
+
keyword: keyword,
|
30
|
+
content: content,
|
31
|
+
highlightClassName: highlightClassName || defaultHighlightClassName,
|
32
|
+
highlightStyle: highlightStyle
|
33
|
+
};
|
34
|
+
|
35
|
+
if (highlightMode === 'contain') {
|
36
|
+
return highlightWithContainMode(config);
|
37
|
+
}
|
38
|
+
|
39
|
+
if (highlightMode === 'prefix') {
|
40
|
+
return highlightWithPrefixMode(config);
|
41
|
+
}
|
42
|
+
|
43
|
+
return typeof highlightMode === 'function' ? highlightMode(content, keyword, defaultHighlightClassName) : content;
|
44
|
+
};
|
45
|
+
|
46
|
+
var renderItem = function renderItem(item, index) {
|
47
|
+
var itemContent = item.content;
|
48
|
+
var node = itemContent; // itemContent为string类型,并且开启高亮模式才去走渲染高亮内容的逻辑
|
49
|
+
// @en When `itemContent` is a string, and the highlight mode is turned on, the logic of rendering the highlighted content is performed
|
50
|
+
|
51
|
+
if (typeof itemContent === 'string' && highlightMode !== 'none') {
|
52
|
+
node = renderHighlightNode(itemContent);
|
53
|
+
}
|
54
|
+
|
55
|
+
if (renderAssociationItem) {
|
56
|
+
node = renderAssociationItem(item, index, node);
|
57
|
+
}
|
58
|
+
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
60
|
+
key: index,
|
61
|
+
className: searchBarAssociationPrefixCls + "-item",
|
62
|
+
onClick: function onClick() {
|
63
|
+
return onAssociationItemClick == null ? void 0 : onAssociationItemClick(item, index);
|
64
|
+
}
|
65
|
+
}, node);
|
66
|
+
};
|
67
|
+
|
68
|
+
var renderContent = function renderContent() {
|
69
|
+
var associationContent = associationItems.map(renderItem);
|
70
|
+
|
71
|
+
if (renderAssociation) {
|
72
|
+
return renderAssociation(associationContent);
|
73
|
+
}
|
74
|
+
|
75
|
+
return associationContent;
|
76
|
+
};
|
77
|
+
|
78
|
+
return /*#__PURE__*/React.createElement("div", {
|
79
|
+
className: cls(searchBarAssociationPrefixCls, (_cls = {}, _cls[searchBarAssociationPrefixCls + "-visible"] = visible, _cls)),
|
80
|
+
onClick: onAssociationClick
|
81
|
+
}, renderContent());
|
82
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
interface CancelButtonProps {
|
3
|
+
className: string;
|
4
|
+
onCancel?: () => void;
|
5
|
+
focusing: boolean;
|
6
|
+
currentInputValue: string;
|
7
|
+
text?: string;
|
8
|
+
}
|
9
|
+
export declare function CancelButton(props: CancelButtonProps): JSX.Element | null;
|
10
|
+
export {};
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { nextTick } from '@arco-design/mobile-utils';
|
2
|
+
import React, { useEffect, useState } from 'react';
|
3
|
+
export function CancelButton(props) {
|
4
|
+
var className = props.className,
|
5
|
+
onCancel = props.onCancel,
|
6
|
+
focusing = props.focusing,
|
7
|
+
currentInputValue = props.currentInputValue,
|
8
|
+
text = props.text;
|
9
|
+
|
10
|
+
var _useState = useState(focusing || Boolean(currentInputValue)),
|
11
|
+
visible = _useState[0],
|
12
|
+
setVisible = _useState[1];
|
13
|
+
|
14
|
+
var handleClick = function handleClick() {
|
15
|
+
onCancel == null ? void 0 : onCancel(); // 如果不延迟,在聚焦切输入框有值的情况下,点击取消按钮会造成闪烁
|
16
|
+
// @en If there is no delay, when the focus cut input box has a value, clicking the cancel button will cause flickering
|
17
|
+
|
18
|
+
nextTick(function () {
|
19
|
+
setVisible(false);
|
20
|
+
});
|
21
|
+
};
|
22
|
+
|
23
|
+
useEffect(function () {
|
24
|
+
setVisible(focusing || Boolean(currentInputValue));
|
25
|
+
}, [focusing, currentInputValue]);
|
26
|
+
return visible ? /*#__PURE__*/React.createElement("span", {
|
27
|
+
className: className,
|
28
|
+
onClick: handleClick
|
29
|
+
}, text) : null;
|
30
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { SearchBarAssociationHighlightConfig } from './type';
|
3
|
+
/**
|
4
|
+
* 高亮搜索候选项中,包含的关键字
|
5
|
+
*
|
6
|
+
*/
|
7
|
+
export declare function highlightWithContainMode(config: SearchBarAssociationHighlightConfig): React.ReactNode[];
|
8
|
+
/**
|
9
|
+
* 高亮搜索候选项和关键字的最长前缀公共字符串
|
10
|
+
*
|
11
|
+
*/
|
12
|
+
export declare function highlightWithPrefixMode(config: SearchBarAssociationHighlightConfig): string | (string | JSX.Element)[];
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
+
var _excluded = ["content", "keyword"];
|
4
|
+
import React from 'react';
|
5
|
+
|
6
|
+
function createHighlightNode(config, index) {
|
7
|
+
var keyword = config.keyword,
|
8
|
+
highlightClassName = config.highlightClassName,
|
9
|
+
highlightStyle = config.highlightStyle;
|
10
|
+
return /*#__PURE__*/React.createElement("span", {
|
11
|
+
className: highlightClassName,
|
12
|
+
style: highlightStyle,
|
13
|
+
key: index
|
14
|
+
}, keyword);
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* 高亮搜索候选项中,包含的关键字
|
18
|
+
*
|
19
|
+
*/
|
20
|
+
|
21
|
+
|
22
|
+
export function highlightWithContainMode(config) {
|
23
|
+
var _config$content = config.content,
|
24
|
+
content = _config$content === void 0 ? '' : _config$content,
|
25
|
+
_config$keyword = config.keyword,
|
26
|
+
keyword = _config$keyword === void 0 ? '' : _config$keyword; // 具体实现思路就是将keyword作为split的分隔符,切割content得到数组
|
27
|
+
|
28
|
+
var splitContent = content.split(keyword); // 再将高亮后的keyword节点,插空填入数组
|
29
|
+
|
30
|
+
var highlightResult = splitContent.reduce(function (prev, word, index) {
|
31
|
+
prev.push(word);
|
32
|
+
|
33
|
+
if (index !== splitContent.length - 1) {
|
34
|
+
prev.push(createHighlightNode(config, index));
|
35
|
+
}
|
36
|
+
|
37
|
+
return prev;
|
38
|
+
}, []);
|
39
|
+
return highlightResult;
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* 高亮搜索候选项和关键字的最长前缀公共字符串
|
43
|
+
*
|
44
|
+
*/
|
45
|
+
|
46
|
+
export function highlightWithPrefixMode(config) {
|
47
|
+
var _config$content2 = config.content,
|
48
|
+
content = _config$content2 === void 0 ? '' : _config$content2,
|
49
|
+
_config$keyword2 = config.keyword,
|
50
|
+
keyword = _config$keyword2 === void 0 ? '' : _config$keyword2,
|
51
|
+
otherConfig = _objectWithoutPropertiesLoose(config, _excluded);
|
52
|
+
|
53
|
+
var splitIndex = -1;
|
54
|
+
|
55
|
+
for (var i = 0; i < keyword.length; i++) {
|
56
|
+
if (i >= content.length || content[i] !== keyword[i]) {
|
57
|
+
break;
|
58
|
+
}
|
59
|
+
|
60
|
+
splitIndex = i;
|
61
|
+
}
|
62
|
+
|
63
|
+
return splitIndex > -1 ? [createHighlightNode(_extends({}, otherConfig, {
|
64
|
+
keyword: content.substring(0, splitIndex + 1)
|
65
|
+
}), 0), content.substring(splitIndex + 1)] : content;
|
66
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { SearchAssociationBaseItem, SearchBarProps, SearchBarRef } from './type';
|
3
|
+
export { SearchBarProps, SearchBarRef, SearchAssociationHighlightMode, SearchAssociationItem, SearchAssociationShowType, SearchBarShape, } from './type';
|
4
|
+
/**
|
5
|
+
* 搜索栏组件
|
6
|
+
* @en SearchBar component
|
7
|
+
* @type 数据录入
|
8
|
+
* @type_en Data Entry
|
9
|
+
* @name 搜索栏
|
10
|
+
* @name_en SearchBar
|
11
|
+
*/
|
12
|
+
declare const SearchBar: React.ForwardRefExoticComponent<SearchBarProps<SearchAssociationBaseItem> & React.RefAttributes<SearchBarRef>>;
|
13
|
+
export default SearchBar;
|