antd-mobile 5.2.2 → 5.4.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/2x/cjs/components/avatar/avatar.js +1 -0
- package/2x/cjs/components/calendar/calendar.js +23 -20
- package/2x/cjs/components/date-picker/date-picker.js +3 -7
- package/2x/cjs/components/ellipsis/ellipsis.d.ts +2 -0
- package/2x/cjs/components/ellipsis/ellipsis.js +8 -5
- package/2x/cjs/components/floating-bubble/floating-bubble.d.ts +2 -0
- package/2x/cjs/components/floating-bubble/floating-bubble.js +47 -16
- package/2x/cjs/components/form/context.d.ts +2 -1
- package/2x/cjs/components/form/context.js +6 -5
- package/2x/cjs/components/form/form-item.css +27 -1
- package/2x/cjs/components/form/form-item.d.ts +1 -0
- package/2x/cjs/components/form/form-item.js +44 -13
- package/2x/cjs/components/form/form.js +19 -10
- package/2x/cjs/components/form/index.css +27 -1
- package/2x/cjs/components/infinite-scroll/infinite-scroll.js +23 -19
- package/2x/cjs/components/input/input.js +2 -2
- package/2x/cjs/components/modal/modal.js +0 -1
- package/2x/cjs/components/notice-bar/notice-bar.js +1 -1
- package/2x/cjs/components/pull-to-refresh/pull-to-refresh.js +1 -1
- package/2x/cjs/components/search-bar/search-bar.js +0 -1
- package/2x/cjs/components/swiper/swiper.js +1 -1
- package/2x/cjs/components/text-area/text-area.css +4 -1
- package/2x/cjs/components/text-area/text-area.d.ts +2 -2
- package/2x/cjs/locales/base.d.ts +51 -0
- package/2x/cjs/locales/base.js +52 -0
- package/2x/cjs/locales/en-US.d.ts +51 -0
- package/2x/cjs/locales/zh-CN.d.ts +51 -0
- package/2x/cjs/locales/zh-CN.js +52 -0
- package/2x/es/components/avatar/avatar.js +1 -0
- package/2x/es/components/calendar/calendar.js +23 -19
- package/2x/es/components/date-picker/date-picker.js +3 -7
- package/2x/es/components/ellipsis/ellipsis.d.ts +2 -0
- package/2x/es/components/ellipsis/ellipsis.js +7 -5
- package/2x/es/components/floating-bubble/floating-bubble.d.ts +2 -0
- package/2x/es/components/floating-bubble/floating-bubble.js +48 -17
- package/2x/es/components/form/context.d.ts +2 -1
- package/2x/es/components/form/context.js +4 -3
- package/2x/es/components/form/form-item.css +27 -1
- package/2x/es/components/form/form-item.d.ts +1 -0
- package/2x/es/components/form/form-item.js +43 -13
- package/2x/es/components/form/form.js +19 -12
- package/2x/es/components/form/index.css +27 -1
- package/2x/es/components/infinite-scroll/infinite-scroll.js +22 -19
- package/2x/es/components/input/input.js +2 -2
- package/2x/es/components/modal/modal.js +0 -1
- package/2x/es/components/notice-bar/notice-bar.js +1 -1
- package/2x/es/components/pull-to-refresh/pull-to-refresh.js +1 -1
- package/2x/es/components/search-bar/search-bar.js +0 -1
- package/2x/es/components/swiper/swiper.js +1 -1
- package/2x/es/components/text-area/text-area.css +4 -1
- package/2x/es/components/text-area/text-area.d.ts +2 -2
- package/2x/es/locales/base.d.ts +51 -0
- package/2x/es/locales/base.js +52 -0
- package/2x/es/locales/en-US.d.ts +51 -0
- package/2x/es/locales/zh-CN.d.ts +51 -0
- package/2x/es/locales/zh-CN.js +52 -0
- package/2x/package.json +4 -4
- package/cjs/components/avatar/avatar.js +1 -0
- package/cjs/components/calendar/calendar.js +23 -20
- package/cjs/components/date-picker/date-picker.js +3 -7
- package/cjs/components/ellipsis/ellipsis.d.ts +2 -0
- package/cjs/components/ellipsis/ellipsis.js +8 -5
- package/cjs/components/floating-bubble/floating-bubble.d.ts +2 -0
- package/cjs/components/floating-bubble/floating-bubble.js +47 -16
- package/cjs/components/form/context.d.ts +2 -1
- package/cjs/components/form/context.js +6 -5
- package/cjs/components/form/form-item.css +21 -1
- package/cjs/components/form/form-item.d.ts +1 -0
- package/cjs/components/form/form-item.js +44 -13
- package/cjs/components/form/form.js +19 -10
- package/cjs/components/form/index.css +21 -1
- package/cjs/components/infinite-scroll/infinite-scroll.js +23 -19
- package/cjs/components/input/input.js +2 -2
- package/cjs/components/modal/modal.js +0 -1
- package/cjs/components/notice-bar/notice-bar.js +1 -1
- package/cjs/components/pull-to-refresh/pull-to-refresh.js +1 -1
- package/cjs/components/search-bar/search-bar.js +0 -1
- package/cjs/components/swiper/swiper.js +1 -1
- package/cjs/components/text-area/text-area.css +4 -1
- package/cjs/components/text-area/text-area.d.ts +2 -2
- package/cjs/locales/base.d.ts +51 -0
- package/cjs/locales/base.js +52 -0
- package/cjs/locales/en-US.d.ts +51 -0
- package/cjs/locales/zh-CN.d.ts +51 -0
- package/cjs/locales/zh-CN.js +52 -0
- package/es/components/avatar/avatar.js +1 -0
- package/es/components/calendar/calendar.js +23 -19
- package/es/components/date-picker/date-picker.js +3 -7
- package/es/components/ellipsis/ellipsis.d.ts +2 -0
- package/es/components/ellipsis/ellipsis.js +7 -5
- package/es/components/floating-bubble/floating-bubble.d.ts +2 -0
- package/es/components/floating-bubble/floating-bubble.js +48 -17
- package/es/components/form/context.d.ts +2 -1
- package/es/components/form/context.js +4 -3
- package/es/components/form/form-item.css +21 -1
- package/es/components/form/form-item.d.ts +1 -0
- package/es/components/form/form-item.js +43 -13
- package/es/components/form/form.js +19 -12
- package/es/components/form/index.css +21 -1
- package/es/components/infinite-scroll/infinite-scroll.js +22 -19
- package/es/components/input/input.js +2 -2
- package/es/components/modal/modal.js +0 -1
- package/es/components/notice-bar/notice-bar.js +1 -1
- package/es/components/pull-to-refresh/pull-to-refresh.js +1 -1
- package/es/components/search-bar/search-bar.js +0 -1
- package/es/components/swiper/swiper.js +1 -1
- package/es/components/text-area/text-area.css +4 -1
- package/es/components/text-area/text-area.d.ts +2 -2
- package/es/locales/base.d.ts +51 -0
- package/es/locales/base.js +52 -0
- package/es/locales/en-US.d.ts +51 -0
- package/es/locales/zh-CN.d.ts +51 -0
- package/es/locales/zh-CN.js +52 -0
- package/package.json +4 -4
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +0 -24
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
color: #666666;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.adm-form-item-label-required {
|
|
14
|
+
.adm-form-item-label .adm-form-item-required-asterisk {
|
|
15
15
|
position: absolute;
|
|
16
16
|
left: -0.6em;
|
|
17
17
|
top: 0;
|
|
@@ -20,8 +20,34 @@
|
|
|
20
20
|
user-select: none;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
.adm-form-item-label .adm-form-item-required-text {
|
|
24
|
+
margin-left: 8px;
|
|
25
|
+
color: var(--adm-color-weak);
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
.adm-form-item-label-help {
|
|
24
29
|
margin-left: 8px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.adm-form-item-child {
|
|
34
|
+
display: flex;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.adm-form-item-child-position-normal {
|
|
38
|
+
justify-content: normal;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.adm-form-item-child-position-normal > * {
|
|
42
|
+
flex: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.adm-form-item-child-position-right {
|
|
46
|
+
justify-content: right;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.adm-form-item-child-position-right > * {
|
|
50
|
+
flex: none;
|
|
25
51
|
}
|
|
26
52
|
|
|
27
53
|
.adm-form-item-footer {
|
|
@@ -16,6 +16,7 @@ export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePr
|
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
hidden?: boolean;
|
|
18
18
|
layout?: FormLayout;
|
|
19
|
+
childElementPosition?: 'normal' | 'right';
|
|
19
20
|
children: ChildrenType;
|
|
20
21
|
} & NativeProps;
|
|
21
22
|
export declare const FormItem: FC<FormItemProps>;
|
|
@@ -9,6 +9,7 @@ import { toArray } from './utils';
|
|
|
9
9
|
import List from '../list';
|
|
10
10
|
import Popover from '../popover';
|
|
11
11
|
import { QuestionCircleOutline } from 'antd-mobile-icons';
|
|
12
|
+
import { useConfig } from '../config-provider';
|
|
12
13
|
const NAME_SPLIT = '__SPLIT__';
|
|
13
14
|
const classPrefix = `adm-form-item`;
|
|
14
15
|
const MemoInput = React.memo(({
|
|
@@ -29,18 +30,47 @@ const FormItemLayout = props => {
|
|
|
29
30
|
hidden,
|
|
30
31
|
errors,
|
|
31
32
|
arrow,
|
|
32
|
-
description
|
|
33
|
+
description,
|
|
34
|
+
childElementPosition = 'normal'
|
|
33
35
|
} = props;
|
|
34
36
|
const context = useContext(FormContext);
|
|
37
|
+
const {
|
|
38
|
+
locale
|
|
39
|
+
} = useConfig();
|
|
35
40
|
const hasFeedback = props.hasFeedback !== undefined ? props.hasFeedback : context.hasFeedback;
|
|
36
41
|
const layout = props.layout || context.layout;
|
|
37
42
|
const feedback = hasFeedback && errors && errors.length > 0 ? errors[0] : null;
|
|
43
|
+
|
|
44
|
+
const requiredMark = (() => {
|
|
45
|
+
const {
|
|
46
|
+
requiredMarkStyle
|
|
47
|
+
} = context;
|
|
48
|
+
|
|
49
|
+
switch (requiredMarkStyle) {
|
|
50
|
+
case 'asterisk':
|
|
51
|
+
return required && React.createElement("span", {
|
|
52
|
+
className: `${classPrefix}-required-asterisk`
|
|
53
|
+
}, "*");
|
|
54
|
+
|
|
55
|
+
case 'text-required':
|
|
56
|
+
return required && React.createElement("span", {
|
|
57
|
+
className: `${classPrefix}-required-text`
|
|
58
|
+
}, "(", locale.Form.required, ")");
|
|
59
|
+
|
|
60
|
+
case 'text-optional':
|
|
61
|
+
return !required && React.createElement("span", {
|
|
62
|
+
className: `${classPrefix}-required-text`
|
|
63
|
+
}, "(", locale.Form.optional, ")");
|
|
64
|
+
|
|
65
|
+
default:
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
})();
|
|
69
|
+
|
|
38
70
|
const labelElement = label ? React.createElement("label", {
|
|
39
71
|
className: `${classPrefix}-label`,
|
|
40
72
|
htmlFor: htmlFor
|
|
41
|
-
}, label,
|
|
42
|
-
className: `${classPrefix}-label-required`
|
|
43
|
-
}, "*"), help && React.createElement("span", {
|
|
73
|
+
}, label, requiredMark, help && React.createElement("span", {
|
|
44
74
|
className: `${classPrefix}-label-help`
|
|
45
75
|
}, React.createElement(Popover, {
|
|
46
76
|
content: help,
|
|
@@ -62,7 +92,11 @@ const FormItemLayout = props => {
|
|
|
62
92
|
disabled: disabled,
|
|
63
93
|
onClick: props.onClick,
|
|
64
94
|
arrow: arrow
|
|
65
|
-
},
|
|
95
|
+
}, React.createElement("div", {
|
|
96
|
+
className: classNames(`${classPrefix}-child`, `${classPrefix}-child-position-${childElementPosition}`)
|
|
97
|
+
}, React.createElement("div", {
|
|
98
|
+
className: classNames(`${classPrefix}-child-inner`)
|
|
99
|
+
}, children)));
|
|
66
100
|
};
|
|
67
101
|
|
|
68
102
|
export const FormItem = props => {
|
|
@@ -80,6 +114,7 @@ export const FormItem = props => {
|
|
|
80
114
|
noStyle,
|
|
81
115
|
hidden,
|
|
82
116
|
layout,
|
|
117
|
+
childElementPosition,
|
|
83
118
|
description,
|
|
84
119
|
// Field 相关
|
|
85
120
|
disabled,
|
|
@@ -93,7 +128,7 @@ export const FormItem = props => {
|
|
|
93
128
|
dependencies,
|
|
94
129
|
arrow
|
|
95
130
|
} = props,
|
|
96
|
-
fieldProps = __rest(props, ["className", "style", "label", "help", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "arrow"]);
|
|
131
|
+
fieldProps = __rest(props, ["className", "style", "label", "help", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "childElementPosition", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "arrow"]);
|
|
97
132
|
|
|
98
133
|
const {
|
|
99
134
|
validateTrigger: contextValidateTrigger
|
|
@@ -151,6 +186,7 @@ export const FormItem = props => {
|
|
|
151
186
|
onClick: onClick,
|
|
152
187
|
hidden: hidden,
|
|
153
188
|
layout: layout,
|
|
189
|
+
childElementPosition: childElementPosition,
|
|
154
190
|
arrow: arrow
|
|
155
191
|
}, React.createElement(NoStyleItemContext.Provider, {
|
|
156
192
|
value: onSubMetaChange
|
|
@@ -193,13 +229,7 @@ export const FormItem = props => {
|
|
|
193
229
|
messageVariables: Variables
|
|
194
230
|
}), (control, meta, context) => {
|
|
195
231
|
let childNode = null;
|
|
196
|
-
const isRequired = required !== undefined ? required :
|
|
197
|
-
if (rule && typeof rule === 'object' && rule.required) {
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return false;
|
|
202
|
-
}));
|
|
232
|
+
const isRequired = required !== undefined ? required : rules && rules.some(rule => !!(rule && typeof rule === 'object' && rule.required));
|
|
203
233
|
const fieldId = (toArray(name).length && meta ? meta.name : []).join('_');
|
|
204
234
|
|
|
205
235
|
if (shouldUpdate && dependencies) {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
2
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import List from '../list';
|
|
5
5
|
import RcForm from 'rc-field-form';
|
|
6
|
-
import { FormContext } from './context';
|
|
6
|
+
import { defaultFormContext, FormContext } from './context';
|
|
7
7
|
import { mergeProps } from '../../utils/with-default-props';
|
|
8
8
|
import { Header } from './header';
|
|
9
|
+
import { useConfig } from '../config-provider';
|
|
10
|
+
import merge from 'lodash/merge';
|
|
9
11
|
const classPrefix = 'adm-form';
|
|
10
|
-
const defaultProps =
|
|
11
|
-
hasFeedback: true,
|
|
12
|
-
layout: 'vertical'
|
|
13
|
-
};
|
|
12
|
+
const defaultProps = defaultFormContext;
|
|
14
13
|
export const Form = forwardRef((p, ref) => {
|
|
15
14
|
const props = mergeProps(defaultProps, p);
|
|
16
15
|
|
|
@@ -21,10 +20,15 @@ export const Form = forwardRef((p, ref) => {
|
|
|
21
20
|
children,
|
|
22
21
|
layout,
|
|
23
22
|
footer,
|
|
24
|
-
mode
|
|
23
|
+
mode,
|
|
24
|
+
requiredMarkStyle
|
|
25
25
|
} = props,
|
|
26
|
-
formProps = __rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode"]);
|
|
26
|
+
formProps = __rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode", "requiredMarkStyle"]);
|
|
27
27
|
|
|
28
|
+
const {
|
|
29
|
+
locale
|
|
30
|
+
} = useConfig();
|
|
31
|
+
const validateMessages = useMemo(() => merge({}, locale.Form.defaultValidateMessages, formProps.validateMessages), [locale.Form.defaultValidateMessages, formProps.validateMessages]);
|
|
28
32
|
const lists = [];
|
|
29
33
|
let currentHeader = null;
|
|
30
34
|
let items = [];
|
|
@@ -41,7 +45,7 @@ export const Form = forwardRef((p, ref) => {
|
|
|
41
45
|
items = [];
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
React.Children.forEach(props.children,
|
|
48
|
+
React.Children.forEach(props.children, child => {
|
|
45
49
|
if (React.isValidElement(child) && child.type === Header) {
|
|
46
50
|
collect();
|
|
47
51
|
currentHeader = child.props.children;
|
|
@@ -54,10 +58,13 @@ export const Form = forwardRef((p, ref) => {
|
|
|
54
58
|
className: classNames(classPrefix, className),
|
|
55
59
|
style: style,
|
|
56
60
|
ref: ref
|
|
57
|
-
}, formProps
|
|
61
|
+
}, formProps, {
|
|
62
|
+
validateMessages: validateMessages
|
|
63
|
+
}), React.createElement(FormContext.Provider, {
|
|
58
64
|
value: {
|
|
59
|
-
hasFeedback
|
|
60
|
-
layout
|
|
65
|
+
hasFeedback,
|
|
66
|
+
layout,
|
|
67
|
+
requiredMarkStyle
|
|
61
68
|
}
|
|
62
69
|
}, lists), footer && React.createElement("div", {
|
|
63
70
|
className: `${classPrefix}-footer`
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
color: #666666;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.adm-form-item-label-required {
|
|
35
|
+
.adm-form-item-label .adm-form-item-required-asterisk {
|
|
36
36
|
position: absolute;
|
|
37
37
|
left: -0.6em;
|
|
38
38
|
top: 0;
|
|
@@ -41,8 +41,34 @@
|
|
|
41
41
|
user-select: none;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
.adm-form-item-label .adm-form-item-required-text {
|
|
45
|
+
margin-left: 8px;
|
|
46
|
+
color: var(--adm-color-weak);
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
.adm-form-item-label-help {
|
|
45
50
|
margin-left: 8px;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.adm-form-item-child {
|
|
55
|
+
display: flex;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.adm-form-item-child-position-normal {
|
|
59
|
+
justify-content: normal;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.adm-form-item-child-position-normal > * {
|
|
63
|
+
flex: auto;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.adm-form-item-child-position-right {
|
|
67
|
+
justify-content: right;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.adm-form-item-child-position-right > * {
|
|
71
|
+
flex: none;
|
|
46
72
|
}
|
|
47
73
|
|
|
48
74
|
.adm-form-item-footer {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import { mergeProps } from '../../utils/with-default-props';
|
|
2
|
-
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
4
|
import { useLockFn, useMemoizedFn } from 'ahooks';
|
|
4
5
|
import { withNativeProps } from '../../utils/native-props';
|
|
5
6
|
import { getScrollParent } from '../../utils/get-scroll-parent';
|
|
@@ -23,25 +24,27 @@ export const InfiniteScroll = p => {
|
|
|
23
24
|
}, p);
|
|
24
25
|
const doLoadMore = useLockFn(() => props.loadMore());
|
|
25
26
|
const elementRef = useRef(null);
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
const [flag, setFlag] = useState({});
|
|
28
|
+
const nextFlagRef = useRef(flag);
|
|
29
|
+
const check = useMemoizedFn(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
if (nextFlagRef.current !== flag) return;
|
|
31
|
+
if (!props.hasMore) return;
|
|
32
|
+
const element = elementRef.current;
|
|
33
|
+
if (!element) return;
|
|
34
|
+
if (!element.offsetParent) return;
|
|
35
|
+
const parent = getScrollParent(element);
|
|
36
|
+
if (!parent) return;
|
|
37
|
+
const rect = element.getBoundingClientRect();
|
|
38
|
+
const elementTop = rect.top;
|
|
39
|
+
const current = isWindow(parent) ? window.innerHeight : parent.getBoundingClientRect().bottom;
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
if (current >= elementTop - props.threshold) {
|
|
42
|
+
const nextFlag = {};
|
|
43
|
+
nextFlagRef.current = nextFlag;
|
|
44
|
+
yield doLoadMore();
|
|
45
|
+
setFlag(nextFlag);
|
|
46
|
+
}
|
|
47
|
+
})); // 确保在内容不足时会自动触发加载事件
|
|
45
48
|
|
|
46
49
|
useEffect(() => {
|
|
47
50
|
check();
|
|
@@ -57,7 +57,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
57
57
|
let nextValue = value;
|
|
58
58
|
|
|
59
59
|
if (props.type === 'number') {
|
|
60
|
-
nextValue = bound(parseFloat(nextValue), props.min, props.max).toString();
|
|
60
|
+
nextValue = nextValue && bound(parseFloat(nextValue), props.min, props.max).toString();
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (nextValue !== value) {
|
|
@@ -105,7 +105,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
105
105
|
onKeyUp: props.onKeyUp,
|
|
106
106
|
onCompositionStart: props.onCompositionStart,
|
|
107
107
|
onCompositionEnd: props.onCompositionEnd
|
|
108
|
-
}), props.clearable && !!value && !props.readOnly && React.createElement("div", {
|
|
108
|
+
}), props.clearable && !!value && !props.readOnly && hasFocus && React.createElement("div", {
|
|
109
109
|
className: `${classPrefix}-clear`,
|
|
110
110
|
onMouseDown: e => {
|
|
111
111
|
e.preventDefault();
|
|
@@ -13,7 +13,6 @@ import AutoCenter from '../auto-center';
|
|
|
13
13
|
import { useSpring, animated } from '@react-spring/web';
|
|
14
14
|
import { withNativeProps } from '../../utils/native-props';
|
|
15
15
|
import { CloseOutline } from 'antd-mobile-icons';
|
|
16
|
-
const classPrefix = `adm-modal`;
|
|
17
16
|
const defaultProps = {
|
|
18
17
|
visible: false,
|
|
19
18
|
actions: [],
|
|
@@ -108,7 +108,7 @@ export const PullToRefresh = p => {
|
|
|
108
108
|
if (!element) return;
|
|
109
109
|
const scrollParent = getScrollParent(element);
|
|
110
110
|
if (!scrollParent) return;
|
|
111
|
-
const top = 'scrollTop' in scrollParent ? scrollParent.scrollTop : scrollParent.
|
|
111
|
+
const top = 'scrollTop' in scrollParent ? scrollParent.scrollTop : scrollParent.scrollY;
|
|
112
112
|
|
|
113
113
|
if (top <= 0 && y > 0) {
|
|
114
114
|
pullingRef.current = true;
|
|
@@ -45,7 +45,6 @@ export const SearchBar = forwardRef((p, ref) => {
|
|
|
45
45
|
|
|
46
46
|
const renderCancelButton = () => {
|
|
47
47
|
let isShowCancel = false;
|
|
48
|
-
const showCancelButton = props.showCancelButton;
|
|
49
48
|
|
|
50
49
|
if (typeof props.showCancelButton === 'function') {
|
|
51
50
|
isShowCancel = props.showCancelButton(hasFocus, value);
|
|
@@ -230,7 +230,7 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
230
230
|
style: {
|
|
231
231
|
[isVertical ? 'y' : 'x']: position.to(position => `${-position}%`)
|
|
232
232
|
}
|
|
233
|
-
}, React.Children.map(validChildren,
|
|
233
|
+
}, React.Children.map(validChildren, child => {
|
|
234
234
|
return React.createElement("div", {
|
|
235
235
|
className: 'adm-swiper-slide'
|
|
236
236
|
}, child);
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
--color: var(--adm-color-text);
|
|
4
4
|
--placeholder-color: var(--adm-color-light);
|
|
5
5
|
--disabled-color: var(--adm-color-weak);
|
|
6
|
+
--text-align: left;
|
|
7
|
+
--count-text-align: right;
|
|
6
8
|
width: 100%;
|
|
7
9
|
max-width: 100%;
|
|
8
10
|
max-height: 100%;
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
outline: none;
|
|
28
30
|
appearance: none;
|
|
29
31
|
min-height: 1.5em;
|
|
32
|
+
text-align: var(--text-align);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
.adm-text-area-element::placeholder {
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
.adm-text-area-count {
|
|
65
|
-
text-align:
|
|
68
|
+
text-align: var(--count-text-align);
|
|
66
69
|
color: var(--adm-color-weak);
|
|
67
70
|
font-size: 34px;
|
|
68
71
|
padding-top: 16px;
|
|
@@ -14,7 +14,7 @@ export declare type TextAreaProps = Pick<React.DetailedHTMLProps<React.TextareaH
|
|
|
14
14
|
maxRows?: number;
|
|
15
15
|
};
|
|
16
16
|
id?: string;
|
|
17
|
-
} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--disabled-color'>;
|
|
17
|
+
} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--disabled-color' | '--text-align' | '--count-text-align'>;
|
|
18
18
|
export declare type TextAreaRef = {
|
|
19
19
|
clear: () => void;
|
|
20
20
|
focus: () => void;
|
|
@@ -33,4 +33,4 @@ export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.Detail
|
|
|
33
33
|
maxRows?: number | undefined;
|
|
34
34
|
} | undefined;
|
|
35
35
|
id?: string | undefined;
|
|
36
|
-
} & NativeProps<"--color" | "--font-size" | "--placeholder-color" | "--disabled-color"> & React.RefAttributes<TextAreaRef>>;
|
|
36
|
+
} & NativeProps<"--color" | "--font-size" | "--placeholder-color" | "--text-align" | "--disabled-color" | "--count-text-align"> & React.RefAttributes<TextAreaRef>>;
|
package/2x/es/locales/base.d.ts
CHANGED
|
@@ -31,6 +31,57 @@ export declare const base: {
|
|
|
31
31
|
description: string;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
+
Form: {
|
|
35
|
+
required: string;
|
|
36
|
+
optional: string;
|
|
37
|
+
defaultValidateMessages: {
|
|
38
|
+
default: string;
|
|
39
|
+
required: string;
|
|
40
|
+
enum: string;
|
|
41
|
+
whitespace: string;
|
|
42
|
+
date: {
|
|
43
|
+
format: string;
|
|
44
|
+
parse: string;
|
|
45
|
+
invalid: string;
|
|
46
|
+
};
|
|
47
|
+
types: {
|
|
48
|
+
string: string;
|
|
49
|
+
method: string;
|
|
50
|
+
array: string;
|
|
51
|
+
object: string;
|
|
52
|
+
number: string;
|
|
53
|
+
date: string;
|
|
54
|
+
boolean: string;
|
|
55
|
+
integer: string;
|
|
56
|
+
float: string;
|
|
57
|
+
regexp: string;
|
|
58
|
+
email: string;
|
|
59
|
+
url: string;
|
|
60
|
+
hex: string;
|
|
61
|
+
};
|
|
62
|
+
string: {
|
|
63
|
+
len: string;
|
|
64
|
+
min: string;
|
|
65
|
+
max: string;
|
|
66
|
+
range: string;
|
|
67
|
+
};
|
|
68
|
+
number: {
|
|
69
|
+
len: string;
|
|
70
|
+
min: string;
|
|
71
|
+
max: string;
|
|
72
|
+
range: string;
|
|
73
|
+
};
|
|
74
|
+
array: {
|
|
75
|
+
len: string;
|
|
76
|
+
min: string;
|
|
77
|
+
max: string;
|
|
78
|
+
range: string;
|
|
79
|
+
};
|
|
80
|
+
pattern: {
|
|
81
|
+
mismatch: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
34
85
|
ImageUploader: {
|
|
35
86
|
uploading: string;
|
|
36
87
|
};
|
package/2x/es/locales/base.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const typeTemplate = '${label} is not a valid ${type}';
|
|
1
2
|
export const base = {
|
|
2
3
|
common: {
|
|
3
4
|
confirm: 'Confirm',
|
|
@@ -31,6 +32,57 @@ export const base = {
|
|
|
31
32
|
description: 'Want to try a new search?'
|
|
32
33
|
}
|
|
33
34
|
},
|
|
35
|
+
Form: {
|
|
36
|
+
required: 'Required',
|
|
37
|
+
optional: 'Optional',
|
|
38
|
+
defaultValidateMessages: {
|
|
39
|
+
default: 'Field validation error for ${label}',
|
|
40
|
+
required: 'Please enter ${label}',
|
|
41
|
+
enum: '${label} must be one of [${enum}]',
|
|
42
|
+
whitespace: '${label} cannot be a blank character',
|
|
43
|
+
date: {
|
|
44
|
+
format: '${label} date format is invalid',
|
|
45
|
+
parse: '${label} cannot be converted to a date',
|
|
46
|
+
invalid: '${label} is an invalid date'
|
|
47
|
+
},
|
|
48
|
+
types: {
|
|
49
|
+
string: typeTemplate,
|
|
50
|
+
method: typeTemplate,
|
|
51
|
+
array: typeTemplate,
|
|
52
|
+
object: typeTemplate,
|
|
53
|
+
number: typeTemplate,
|
|
54
|
+
date: typeTemplate,
|
|
55
|
+
boolean: typeTemplate,
|
|
56
|
+
integer: typeTemplate,
|
|
57
|
+
float: typeTemplate,
|
|
58
|
+
regexp: typeTemplate,
|
|
59
|
+
email: typeTemplate,
|
|
60
|
+
url: typeTemplate,
|
|
61
|
+
hex: typeTemplate
|
|
62
|
+
},
|
|
63
|
+
string: {
|
|
64
|
+
len: '${label} must be ${len} characters',
|
|
65
|
+
min: '${label} must be at least ${min} characters',
|
|
66
|
+
max: '${label} must be up to ${max} characters',
|
|
67
|
+
range: '${label} must be between ${min}-${max} characters'
|
|
68
|
+
},
|
|
69
|
+
number: {
|
|
70
|
+
len: '${label} must be equal to ${len}',
|
|
71
|
+
min: '${label} must be minimum ${min}',
|
|
72
|
+
max: '${label} must be maximum ${max}',
|
|
73
|
+
range: '${label} must be between ${min}-${max}'
|
|
74
|
+
},
|
|
75
|
+
array: {
|
|
76
|
+
len: 'Must be ${len} ${label}',
|
|
77
|
+
min: 'At least ${min} ${label}',
|
|
78
|
+
max: 'At most ${max} ${label}',
|
|
79
|
+
range: 'The amount of ${label} must be between ${min}-${max}'
|
|
80
|
+
},
|
|
81
|
+
pattern: {
|
|
82
|
+
mismatch: '${label} does not match the pattern ${pattern}'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
34
86
|
ImageUploader: {
|
|
35
87
|
uploading: 'Uploading...'
|
|
36
88
|
},
|
package/2x/es/locales/en-US.d.ts
CHANGED
|
@@ -31,6 +31,57 @@ declare const enUS: {
|
|
|
31
31
|
description: string;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
+
Form: {
|
|
35
|
+
required: string;
|
|
36
|
+
optional: string;
|
|
37
|
+
defaultValidateMessages: {
|
|
38
|
+
default: string;
|
|
39
|
+
required: string;
|
|
40
|
+
enum: string;
|
|
41
|
+
whitespace: string;
|
|
42
|
+
date: {
|
|
43
|
+
format: string;
|
|
44
|
+
parse: string;
|
|
45
|
+
invalid: string;
|
|
46
|
+
};
|
|
47
|
+
types: {
|
|
48
|
+
string: string;
|
|
49
|
+
method: string;
|
|
50
|
+
array: string;
|
|
51
|
+
object: string;
|
|
52
|
+
number: string;
|
|
53
|
+
date: string;
|
|
54
|
+
boolean: string;
|
|
55
|
+
integer: string;
|
|
56
|
+
float: string;
|
|
57
|
+
regexp: string;
|
|
58
|
+
email: string;
|
|
59
|
+
url: string;
|
|
60
|
+
hex: string;
|
|
61
|
+
};
|
|
62
|
+
string: {
|
|
63
|
+
len: string;
|
|
64
|
+
min: string;
|
|
65
|
+
max: string;
|
|
66
|
+
range: string;
|
|
67
|
+
};
|
|
68
|
+
number: {
|
|
69
|
+
len: string;
|
|
70
|
+
min: string;
|
|
71
|
+
max: string;
|
|
72
|
+
range: string;
|
|
73
|
+
};
|
|
74
|
+
array: {
|
|
75
|
+
len: string;
|
|
76
|
+
min: string;
|
|
77
|
+
max: string;
|
|
78
|
+
range: string;
|
|
79
|
+
};
|
|
80
|
+
pattern: {
|
|
81
|
+
mismatch: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
34
85
|
ImageUploader: {
|
|
35
86
|
uploading: string;
|
|
36
87
|
};
|
package/2x/es/locales/zh-CN.d.ts
CHANGED
|
@@ -31,6 +31,57 @@ declare const zhCN: {
|
|
|
31
31
|
description: string;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
+
Form: {
|
|
35
|
+
required: string;
|
|
36
|
+
optional: string;
|
|
37
|
+
defaultValidateMessages: {
|
|
38
|
+
default: string;
|
|
39
|
+
required: string;
|
|
40
|
+
enum: string;
|
|
41
|
+
whitespace: string;
|
|
42
|
+
date: {
|
|
43
|
+
format: string;
|
|
44
|
+
parse: string;
|
|
45
|
+
invalid: string;
|
|
46
|
+
};
|
|
47
|
+
types: {
|
|
48
|
+
string: string;
|
|
49
|
+
method: string;
|
|
50
|
+
array: string;
|
|
51
|
+
object: string;
|
|
52
|
+
number: string;
|
|
53
|
+
date: string;
|
|
54
|
+
boolean: string;
|
|
55
|
+
integer: string;
|
|
56
|
+
float: string;
|
|
57
|
+
regexp: string;
|
|
58
|
+
email: string;
|
|
59
|
+
url: string;
|
|
60
|
+
hex: string;
|
|
61
|
+
};
|
|
62
|
+
string: {
|
|
63
|
+
len: string;
|
|
64
|
+
min: string;
|
|
65
|
+
max: string;
|
|
66
|
+
range: string;
|
|
67
|
+
};
|
|
68
|
+
number: {
|
|
69
|
+
len: string;
|
|
70
|
+
min: string;
|
|
71
|
+
max: string;
|
|
72
|
+
range: string;
|
|
73
|
+
};
|
|
74
|
+
array: {
|
|
75
|
+
len: string;
|
|
76
|
+
min: string;
|
|
77
|
+
max: string;
|
|
78
|
+
range: string;
|
|
79
|
+
};
|
|
80
|
+
pattern: {
|
|
81
|
+
mismatch: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
34
85
|
ImageUploader: {
|
|
35
86
|
uploading: string;
|
|
36
87
|
};
|