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
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.InfiniteScroll = void 0;
|
|
7
7
|
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
8
10
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
9
11
|
|
|
10
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -41,25 +43,27 @@ const InfiniteScroll = p => {
|
|
|
41
43
|
}, p);
|
|
42
44
|
const doLoadMore = (0, _ahooks.useLockFn)(() => props.loadMore());
|
|
43
45
|
const elementRef = (0, _react.useRef)(null);
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
const [flag, setFlag] = (0, _react.useState)({});
|
|
47
|
+
const nextFlagRef = (0, _react.useRef)(flag);
|
|
48
|
+
const check = (0, _ahooks.useMemoizedFn)(() => (0, _tslib.__awaiter)(void 0, void 0, void 0, function* () {
|
|
49
|
+
if (nextFlagRef.current !== flag) return;
|
|
50
|
+
if (!props.hasMore) return;
|
|
51
|
+
const element = elementRef.current;
|
|
52
|
+
if (!element) return;
|
|
53
|
+
if (!element.offsetParent) return;
|
|
54
|
+
const parent = (0, _getScrollParent.getScrollParent)(element);
|
|
55
|
+
if (!parent) return;
|
|
56
|
+
const rect = element.getBoundingClientRect();
|
|
57
|
+
const elementTop = rect.top;
|
|
58
|
+
const current = isWindow(parent) ? window.innerHeight : parent.getBoundingClientRect().bottom;
|
|
59
|
+
|
|
60
|
+
if (current >= elementTop - props.threshold) {
|
|
61
|
+
const nextFlag = {};
|
|
62
|
+
nextFlagRef.current = nextFlag;
|
|
63
|
+
yield doLoadMore();
|
|
64
|
+
setFlag(nextFlag);
|
|
65
|
+
}
|
|
66
|
+
})); // 确保在内容不足时会自动触发加载事件
|
|
63
67
|
|
|
64
68
|
(0, _react.useEffect)(() => {
|
|
65
69
|
check();
|
|
@@ -78,7 +78,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
78
78
|
let nextValue = value;
|
|
79
79
|
|
|
80
80
|
if (props.type === 'number') {
|
|
81
|
-
nextValue = (0, _bound.bound)(parseFloat(nextValue), props.min, props.max).toString();
|
|
81
|
+
nextValue = nextValue && (0, _bound.bound)(parseFloat(nextValue), props.min, props.max).toString();
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
if (nextValue !== value) {
|
|
@@ -126,7 +126,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
126
126
|
onKeyUp: props.onKeyUp,
|
|
127
127
|
onCompositionStart: props.onCompositionStart,
|
|
128
128
|
onCompositionEnd: props.onCompositionEnd
|
|
129
|
-
}), props.clearable && !!value && !props.readOnly && _react.default.createElement("div", {
|
|
129
|
+
}), props.clearable && !!value && !props.readOnly && hasFocus && _react.default.createElement("div", {
|
|
130
130
|
className: `${classPrefix}-clear`,
|
|
131
131
|
onMouseDown: e => {
|
|
132
132
|
e.preventDefault();
|
|
@@ -41,7 +41,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
41
41
|
|
|
42
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
43
|
|
|
44
|
-
const classPrefix = `adm-modal`;
|
|
45
44
|
const defaultProps = {
|
|
46
45
|
visible: false,
|
|
47
46
|
actions: [],
|
|
@@ -76,7 +76,7 @@ const NoticeBar = (0, _react.memo)(p => {
|
|
|
76
76
|
delayLockRef.current = false;
|
|
77
77
|
start();
|
|
78
78
|
}, props.delay);
|
|
79
|
-
(0, _useResizeEffect.useResizeEffect)(
|
|
79
|
+
(0, _useResizeEffect.useResizeEffect)(() => {
|
|
80
80
|
start();
|
|
81
81
|
}, containerRef);
|
|
82
82
|
(0, _useMutationEffect.useMutationEffect)(() => {
|
|
@@ -131,7 +131,7 @@ const PullToRefresh = p => {
|
|
|
131
131
|
if (!element) return;
|
|
132
132
|
const scrollParent = (0, _getScrollParent.getScrollParent)(element);
|
|
133
133
|
if (!scrollParent) return;
|
|
134
|
-
const top = 'scrollTop' in scrollParent ? scrollParent.scrollTop : scrollParent.
|
|
134
|
+
const top = 'scrollTop' in scrollParent ? scrollParent.scrollTop : scrollParent.scrollY;
|
|
135
135
|
|
|
136
136
|
if (top <= 0 && y > 0) {
|
|
137
137
|
pullingRef.current = true;
|
|
@@ -67,7 +67,6 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
67
67
|
|
|
68
68
|
const renderCancelButton = () => {
|
|
69
69
|
let isShowCancel = false;
|
|
70
|
-
const showCancelButton = props.showCancelButton;
|
|
71
70
|
|
|
72
71
|
if (typeof props.showCancelButton === 'function') {
|
|
73
72
|
isShowCancel = props.showCancelButton(hasFocus, value);
|
|
@@ -258,7 +258,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
258
258
|
style: {
|
|
259
259
|
[isVertical ? 'y' : 'x']: position.to(position => `${-position}%`)
|
|
260
260
|
}
|
|
261
|
-
}, _react.default.Children.map(validChildren,
|
|
261
|
+
}, _react.default.Children.map(validChildren, child => {
|
|
262
262
|
return _react.default.createElement("div", {
|
|
263
263
|
className: 'adm-swiper-slide'
|
|
264
264
|
}, 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%;
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
outline: none;
|
|
27
29
|
appearance: none;
|
|
28
30
|
min-height: 1.5em;
|
|
31
|
+
text-align: var(--text-align);
|
|
29
32
|
}
|
|
30
33
|
.adm-text-area-element::placeholder {
|
|
31
34
|
color: var(--placeholder-color);
|
|
@@ -53,7 +56,7 @@
|
|
|
53
56
|
pointer-events: none;
|
|
54
57
|
}
|
|
55
58
|
.adm-text-area-count {
|
|
56
|
-
text-align:
|
|
59
|
+
text-align: var(--count-text-align);
|
|
57
60
|
color: var(--adm-color-weak);
|
|
58
61
|
font-size: 17px;
|
|
59
62
|
padding-top: 8px;
|
|
@@ -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/cjs/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/cjs/locales/base.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.base = void 0;
|
|
7
|
+
const typeTemplate = '${label} is not a valid ${type}';
|
|
7
8
|
const base = {
|
|
8
9
|
common: {
|
|
9
10
|
confirm: 'Confirm',
|
|
@@ -37,6 +38,57 @@ const base = {
|
|
|
37
38
|
description: 'Want to try a new search?'
|
|
38
39
|
}
|
|
39
40
|
},
|
|
41
|
+
Form: {
|
|
42
|
+
required: 'Required',
|
|
43
|
+
optional: 'Optional',
|
|
44
|
+
defaultValidateMessages: {
|
|
45
|
+
default: 'Field validation error for ${label}',
|
|
46
|
+
required: 'Please enter ${label}',
|
|
47
|
+
enum: '${label} must be one of [${enum}]',
|
|
48
|
+
whitespace: '${label} cannot be a blank character',
|
|
49
|
+
date: {
|
|
50
|
+
format: '${label} date format is invalid',
|
|
51
|
+
parse: '${label} cannot be converted to a date',
|
|
52
|
+
invalid: '${label} is an invalid date'
|
|
53
|
+
},
|
|
54
|
+
types: {
|
|
55
|
+
string: typeTemplate,
|
|
56
|
+
method: typeTemplate,
|
|
57
|
+
array: typeTemplate,
|
|
58
|
+
object: typeTemplate,
|
|
59
|
+
number: typeTemplate,
|
|
60
|
+
date: typeTemplate,
|
|
61
|
+
boolean: typeTemplate,
|
|
62
|
+
integer: typeTemplate,
|
|
63
|
+
float: typeTemplate,
|
|
64
|
+
regexp: typeTemplate,
|
|
65
|
+
email: typeTemplate,
|
|
66
|
+
url: typeTemplate,
|
|
67
|
+
hex: typeTemplate
|
|
68
|
+
},
|
|
69
|
+
string: {
|
|
70
|
+
len: '${label} must be ${len} characters',
|
|
71
|
+
min: '${label} must be at least ${min} characters',
|
|
72
|
+
max: '${label} must be up to ${max} characters',
|
|
73
|
+
range: '${label} must be between ${min}-${max} characters'
|
|
74
|
+
},
|
|
75
|
+
number: {
|
|
76
|
+
len: '${label} must be equal to ${len}',
|
|
77
|
+
min: '${label} must be minimum ${min}',
|
|
78
|
+
max: '${label} must be maximum ${max}',
|
|
79
|
+
range: '${label} must be between ${min}-${max}'
|
|
80
|
+
},
|
|
81
|
+
array: {
|
|
82
|
+
len: 'Must be ${len} ${label}',
|
|
83
|
+
min: 'At least ${min} ${label}',
|
|
84
|
+
max: 'At most ${max} ${label}',
|
|
85
|
+
range: 'The amount of ${label} must be between ${min}-${max}'
|
|
86
|
+
},
|
|
87
|
+
pattern: {
|
|
88
|
+
mismatch: '${label} does not match the pattern ${pattern}'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
40
92
|
ImageUploader: {
|
|
41
93
|
uploading: 'Uploading...'
|
|
42
94
|
},
|
package/cjs/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/cjs/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
|
};
|
package/cjs/locales/zh-CN.js
CHANGED
|
@@ -9,6 +9,7 @@ var _mergeLocale = require("../utils/merge-locale");
|
|
|
9
9
|
|
|
10
10
|
var _base = require("./base");
|
|
11
11
|
|
|
12
|
+
const typeTemplate = '${label}不是一个有效的${type}';
|
|
12
13
|
const zhCN = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
13
14
|
common: {
|
|
14
15
|
confirm: '确定',
|
|
@@ -42,6 +43,57 @@ const zhCN = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
|
42
43
|
description: '找找其他的吧'
|
|
43
44
|
}
|
|
44
45
|
},
|
|
46
|
+
Form: {
|
|
47
|
+
required: '必填',
|
|
48
|
+
optional: '选填',
|
|
49
|
+
defaultValidateMessages: {
|
|
50
|
+
default: '字段验证错误${label}',
|
|
51
|
+
required: '请输入${label}',
|
|
52
|
+
enum: '${label}必须是其中一个[${enum}]',
|
|
53
|
+
whitespace: '${label}不能为空字符',
|
|
54
|
+
date: {
|
|
55
|
+
format: '${label}日期格式无效',
|
|
56
|
+
parse: '${label}不能转换为日期',
|
|
57
|
+
invalid: '${label}是一个无效日期'
|
|
58
|
+
},
|
|
59
|
+
types: {
|
|
60
|
+
string: typeTemplate,
|
|
61
|
+
method: typeTemplate,
|
|
62
|
+
array: typeTemplate,
|
|
63
|
+
object: typeTemplate,
|
|
64
|
+
number: typeTemplate,
|
|
65
|
+
date: typeTemplate,
|
|
66
|
+
boolean: typeTemplate,
|
|
67
|
+
integer: typeTemplate,
|
|
68
|
+
float: typeTemplate,
|
|
69
|
+
regexp: typeTemplate,
|
|
70
|
+
email: typeTemplate,
|
|
71
|
+
url: typeTemplate,
|
|
72
|
+
hex: typeTemplate
|
|
73
|
+
},
|
|
74
|
+
string: {
|
|
75
|
+
len: '${label}须为${len}个字符',
|
|
76
|
+
min: '${label}最少${min}个字符',
|
|
77
|
+
max: '${label}最多${max}个字符',
|
|
78
|
+
range: '${label}须在${min}-${max}字符之间'
|
|
79
|
+
},
|
|
80
|
+
number: {
|
|
81
|
+
len: '${label}必须等于${len}',
|
|
82
|
+
min: '${label}最小值为${min}',
|
|
83
|
+
max: '${label}最大值为${max}',
|
|
84
|
+
range: '${label}须在${min}-${max}之间'
|
|
85
|
+
},
|
|
86
|
+
array: {
|
|
87
|
+
len: '须为${len}个${label}',
|
|
88
|
+
min: '最少${min}个${label}',
|
|
89
|
+
max: '最多${max}个${label}',
|
|
90
|
+
range: '${label}数量须在${min}-${max}之间'
|
|
91
|
+
},
|
|
92
|
+
pattern: {
|
|
93
|
+
mismatch: '${label}与模式不匹配${pattern}'
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
45
97
|
ImageUploader: {
|
|
46
98
|
uploading: '上传中...'
|
|
47
99
|
},
|
|
@@ -26,7 +26,29 @@ export const Calendar = forwardRef((p, ref) => {
|
|
|
26
26
|
if (item) markItems.unshift(item);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const dateRange = useMemo(() => {
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
|
+
|
|
32
|
+
if (props.selectionMode === 'single') {
|
|
33
|
+
const value = (_b = (_a = props.value) !== null && _a !== void 0 ? _a : props.defaultValue) !== null && _b !== void 0 ? _b : null;
|
|
34
|
+
return [value, value];
|
|
35
|
+
} else if (props.selectionMode === 'range') {
|
|
36
|
+
return (_d = (_c = props.value) !== null && _c !== void 0 ? _c : props.defaultValue) !== null && _d !== void 0 ? _d : [null, null];
|
|
37
|
+
} else {
|
|
38
|
+
return [null, null];
|
|
39
|
+
}
|
|
40
|
+
}, [props.selectionMode, props.value, props.defaultValue]);
|
|
41
|
+
const [begin, setBegin] = useState(null);
|
|
42
|
+
const [end, setEnd] = useState(null);
|
|
43
|
+
useIsomorphicLayoutEffect(() => {
|
|
44
|
+
setBegin(dateRange[0] ? dayjs(dateRange[0]) : null);
|
|
45
|
+
setEnd(dateRange[1] ? dayjs(dateRange[1]) : null);
|
|
46
|
+
}, [dateRange[0], dateRange[1]]);
|
|
47
|
+
const [current, setCurrent] = useState(() => {
|
|
48
|
+
var _a;
|
|
49
|
+
|
|
50
|
+
return dayjs((_a = dateRange[0]) !== null && _a !== void 0 ? _a : today).date(1);
|
|
51
|
+
});
|
|
30
52
|
useUpdateEffect(() => {
|
|
31
53
|
var _a;
|
|
32
54
|
|
|
@@ -76,24 +98,6 @@ export const Calendar = forwardRef((p, ref) => {
|
|
|
76
98
|
setCurrent(current.add(1, 'year'));
|
|
77
99
|
}
|
|
78
100
|
}, React.createElement(ArrowLeftDouble, null)));
|
|
79
|
-
const dateRange = useMemo(() => {
|
|
80
|
-
var _a, _b, _c, _d;
|
|
81
|
-
|
|
82
|
-
if (props.selectionMode === 'single') {
|
|
83
|
-
const value = (_b = (_a = props.value) !== null && _a !== void 0 ? _a : props.defaultValue) !== null && _b !== void 0 ? _b : null;
|
|
84
|
-
return [value, value];
|
|
85
|
-
} else if (props.selectionMode === 'range') {
|
|
86
|
-
return (_d = (_c = props.value) !== null && _c !== void 0 ? _c : props.defaultValue) !== null && _d !== void 0 ? _d : [null, null];
|
|
87
|
-
} else {
|
|
88
|
-
return [null, null];
|
|
89
|
-
}
|
|
90
|
-
}, [props.selectionMode, props.value, props.defaultValue]);
|
|
91
|
-
const [begin, setBegin] = useState(null);
|
|
92
|
-
const [end, setEnd] = useState(null);
|
|
93
|
-
useIsomorphicLayoutEffect(() => {
|
|
94
|
-
setBegin(dateRange[0] ? dayjs(dateRange[0]) : null);
|
|
95
|
-
setEnd(dateRange[1] ? dayjs(dateRange[1]) : null);
|
|
96
|
-
}, [dateRange[0], dateRange[1]]);
|
|
97
101
|
|
|
98
102
|
function renderCells() {
|
|
99
103
|
var _a;
|
|
@@ -28,14 +28,10 @@ export const DatePicker = p => {
|
|
|
28
28
|
});
|
|
29
29
|
const now = useMemo(() => new Date(), []);
|
|
30
30
|
const pickerValue = useMemo(() => {
|
|
31
|
-
let date = value;
|
|
32
|
-
|
|
33
|
-
if (date === null) {
|
|
34
|
-
date = new Date(bound(now.getTime(), props.min.getTime(), props.max.getTime()));
|
|
35
|
-
}
|
|
36
|
-
|
|
31
|
+
let date = value !== null && value !== void 0 ? value : now;
|
|
32
|
+
date = new Date(bound(date.getTime(), props.min.getTime(), props.max.getTime()));
|
|
37
33
|
return convertDateToStringArray(date, props.precision);
|
|
38
|
-
}, [value, props.precision]);
|
|
34
|
+
}, [value, props.precision, props.min, props.max]);
|
|
39
35
|
const onConfirm = useCallback(val => {
|
|
40
36
|
setValue(convertStringArrayToDate(val, props.precision));
|
|
41
37
|
}, [setValue, props.precision]);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import { PropagationEvent } from '../../utils/with-stop-propagation';
|
|
3
4
|
export declare type EllipsisProps = {
|
|
4
5
|
content: string;
|
|
5
6
|
direction?: 'start' | 'end' | 'middle';
|
|
6
7
|
rows?: number;
|
|
7
8
|
expandText?: string;
|
|
8
9
|
collapseText?: string;
|
|
10
|
+
stopPropagationForActionButtons?: PropagationEvent[];
|
|
9
11
|
} & NativeProps;
|
|
10
12
|
export declare const Ellipsis: FC<EllipsisProps>;
|
|
@@ -3,12 +3,14 @@ import { mergeProps } from '../../utils/with-default-props';
|
|
|
3
3
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
4
|
import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
5
5
|
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
6
|
+
import { withStopPropagation } from '../../utils/with-stop-propagation';
|
|
6
7
|
const classPrefix = `adm-ellipsis`;
|
|
7
8
|
const defaultProps = {
|
|
8
9
|
direction: 'end',
|
|
9
10
|
rows: 1,
|
|
10
11
|
expandText: '',
|
|
11
|
-
collapseText: ''
|
|
12
|
+
collapseText: '',
|
|
13
|
+
stopPropagationForActionButtons: []
|
|
12
14
|
};
|
|
13
15
|
export const Ellipsis = p => {
|
|
14
16
|
const props = mergeProps(defaultProps, p);
|
|
@@ -117,16 +119,16 @@ export const Ellipsis = p => {
|
|
|
117
119
|
useIsomorphicLayoutEffect(() => {
|
|
118
120
|
calcEllipsised();
|
|
119
121
|
}, [props.content, props.direction, props.rows, props.expandText, props.collapseText]);
|
|
120
|
-
const expandActionElement = exceeded && props.expandText ? React.createElement("a", {
|
|
122
|
+
const expandActionElement = exceeded && props.expandText ? withStopPropagation(props.stopPropagationForActionButtons, React.createElement("a", {
|
|
121
123
|
onClick: () => {
|
|
122
124
|
setExpanded(true);
|
|
123
125
|
}
|
|
124
|
-
}, props.expandText) : null;
|
|
125
|
-
const collapseActionElement = exceeded && props.expandText ? React.createElement("a", {
|
|
126
|
+
}, props.expandText)) : null;
|
|
127
|
+
const collapseActionElement = exceeded && props.expandText ? withStopPropagation(props.stopPropagationForActionButtons, React.createElement("a", {
|
|
126
128
|
onClick: () => {
|
|
127
129
|
setExpanded(false);
|
|
128
130
|
}
|
|
129
|
-
}, props.collapseText) : null;
|
|
131
|
+
}, props.collapseText)) : null;
|
|
130
132
|
|
|
131
133
|
const renderContent = () => {
|
|
132
134
|
if (!exceeded) {
|
|
@@ -2,5 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type FloatingBubbleProps = {
|
|
4
4
|
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
5
|
+
axis?: 'x' | 'y' | 'xy' | 'lock';
|
|
6
|
+
magnetic?: 'x' | 'y';
|
|
5
7
|
} & NativeProps<'--initial-position-left' | '--initial-position-right' | '--initial-position-top' | '--initial-position-bottom' | '--z-index' | '--edge-distance' | '--size' | '--border-radius'>;
|
|
6
8
|
export declare const FloatingBubble: FC<FloatingBubbleProps>;
|