antd-mobile 5.0.0-rc.26 → 5.0.0-rc.27
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/date-picker/date-picker.d.ts +1 -1
- package/2x/cjs/components/dialog/dialog.css +4 -0
- package/2x/cjs/components/dropdown/dropdown.css +0 -4
- package/2x/cjs/components/dropdown/item.js +3 -1
- package/2x/cjs/components/empty/empty.css +1 -1
- package/2x/cjs/components/form/form-item.css +1 -4
- package/2x/cjs/components/form/index.css +1 -4
- package/2x/cjs/components/image-viewer/image-viewer.css +2 -0
- package/2x/cjs/components/image-viewer/slide.js +9 -6
- package/2x/cjs/components/index-bar/index-bar.css +2 -1
- package/2x/cjs/components/input/input.d.ts +6 -2
- package/2x/cjs/components/input/input.js +16 -0
- package/2x/cjs/components/list/list.css +6 -4
- package/2x/cjs/components/picker/picker.d.ts +1 -0
- package/2x/cjs/components/picker/picker.js +3 -1
- package/2x/cjs/components/popover/index.d.ts +4 -6
- package/2x/cjs/components/popover/popover-menu.d.ts +9 -12
- package/2x/cjs/components/radio/radio.js +2 -3
- package/2x/es/components/date-picker/date-picker.d.ts +1 -1
- package/2x/es/components/dialog/dialog.css +4 -0
- package/2x/es/components/dropdown/dropdown.css +0 -4
- package/2x/es/components/dropdown/item.js +3 -1
- package/2x/es/components/empty/empty.css +1 -1
- package/2x/es/components/form/form-item.css +1 -4
- package/2x/es/components/form/index.css +1 -4
- package/2x/es/components/image-viewer/image-viewer.css +2 -0
- package/2x/es/components/image-viewer/slide.js +9 -6
- package/2x/es/components/index-bar/index-bar.css +2 -1
- package/2x/es/components/input/input.d.ts +6 -2
- package/2x/es/components/input/input.js +15 -0
- package/2x/es/components/list/list.css +6 -4
- package/2x/es/components/picker/picker.d.ts +1 -0
- package/2x/es/components/picker/picker.js +3 -1
- package/2x/es/components/popover/index.d.ts +4 -6
- package/2x/es/components/popover/popover-menu.d.ts +9 -12
- package/2x/es/components/radio/radio.js +2 -3
- package/2x/package.json +3 -3
- package/cjs/components/date-picker/date-picker.d.ts +1 -1
- package/cjs/components/dialog/dialog.css +3 -0
- package/cjs/components/dropdown/dropdown.css +0 -3
- package/cjs/components/dropdown/item.js +3 -1
- package/cjs/components/empty/empty.css +1 -1
- package/cjs/components/form/form-item.css +1 -3
- package/cjs/components/form/index.css +1 -3
- package/cjs/components/image-viewer/image-viewer.css +2 -0
- package/cjs/components/image-viewer/slide.js +9 -6
- package/cjs/components/index-bar/index-bar.css +2 -1
- package/cjs/components/input/input.d.ts +6 -2
- package/cjs/components/input/input.js +16 -0
- package/cjs/components/list/list.css +5 -4
- package/cjs/components/picker/picker.d.ts +1 -0
- package/cjs/components/picker/picker.js +3 -1
- package/cjs/components/popover/index.d.ts +4 -6
- package/cjs/components/popover/popover-menu.d.ts +9 -12
- package/cjs/components/radio/radio.js +2 -3
- package/es/components/date-picker/date-picker.d.ts +1 -1
- package/es/components/dialog/dialog.css +3 -0
- package/es/components/dropdown/dropdown.css +0 -3
- package/es/components/dropdown/item.js +3 -1
- package/es/components/empty/empty.css +1 -1
- package/es/components/form/form-item.css +1 -3
- package/es/components/form/index.css +1 -3
- package/es/components/image-viewer/image-viewer.css +2 -0
- package/es/components/image-viewer/slide.js +9 -6
- package/es/components/index-bar/index-bar.css +2 -1
- package/es/components/input/input.d.ts +6 -2
- package/es/components/input/input.js +15 -0
- package/es/components/list/list.css +5 -4
- package/es/components/picker/picker.d.ts +1 -0
- package/es/components/picker/picker.js +3 -1
- package/es/components/popover/index.d.ts +4 -6
- package/es/components/popover/popover-menu.d.ts +9 -12
- package/es/components/radio/radio.js +2 -3
- package/package.json +3 -3
- package/umd/antd-mobile.js +1 -1
|
@@ -2,7 +2,7 @@ import { FC, ReactNode } from 'react';
|
|
|
2
2
|
import type { PickerProps } from '../picker';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
import type { Precision, DatePickerFilter } from './date-picker-utils';
|
|
5
|
-
export declare type DatePickerProps = Pick<PickerProps, 'onCancel' | 'onClose' | 'visible' | 'confirmText' | 'cancelText' | 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'title' | 'stopPropagation' | 'style'> & {
|
|
5
|
+
export declare type DatePickerProps = Pick<PickerProps, 'onCancel' | 'onClose' | 'closeOnMaskClick' | 'visible' | 'confirmText' | 'cancelText' | 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'title' | 'stopPropagation' | 'style'> & {
|
|
6
6
|
value?: Date | null;
|
|
7
7
|
defaultValue?: Date | null;
|
|
8
8
|
onSelect?: (value: Date) => void;
|
|
@@ -20,9 +20,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
20
|
const classPrefix = `adm-dropdown-item`;
|
|
21
21
|
|
|
22
22
|
const Item = props => {
|
|
23
|
+
var _a;
|
|
24
|
+
|
|
23
25
|
const cls = (0, _classnames.default)(classPrefix, {
|
|
24
26
|
[`${classPrefix}-active`]: props.active,
|
|
25
|
-
[`${classPrefix}-highlight`]: props.highlight
|
|
27
|
+
[`${classPrefix}-highlight`]: (_a = props.highlight) !== null && _a !== void 0 ? _a : props.active
|
|
26
28
|
});
|
|
27
29
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
28
30
|
className: cls,
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
.adm-form-item-footer {
|
|
23
23
|
color: var(--adm-color-danger);
|
|
24
|
+
margin-top: 8px;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.adm-form-item.adm-form-item-hidden {
|
|
@@ -32,10 +33,6 @@
|
|
|
32
33
|
margin-bottom: 8px;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
.adm-form-vertical .adm-form-item-footer {
|
|
36
|
-
margin-top: 8px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
36
|
.adm-form-horizontal .adm-list-item-content-prefix {
|
|
40
37
|
padding-top: 24px;
|
|
41
38
|
padding-bottom: 24px;
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
.adm-form-item-footer {
|
|
41
41
|
color: var(--adm-color-danger);
|
|
42
|
+
margin-top: 8px;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
.adm-form-item.adm-form-item-hidden {
|
|
@@ -50,10 +51,6 @@
|
|
|
50
51
|
margin-bottom: 8px;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
.adm-form-vertical .adm-form-item-footer {
|
|
54
|
-
margin-top: 8px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
54
|
.adm-form-horizontal .adm-list-item-content-prefix {
|
|
58
55
|
padding-top: 24px;
|
|
59
56
|
padding-bottom: 24px;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
position: relative;
|
|
12
12
|
z-index: 1;
|
|
13
13
|
cursor: grab;
|
|
14
|
+
touch-action: none;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.adm-image-viewer-slides-inner {
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
width: 100%;
|
|
38
39
|
height: 100%;
|
|
39
40
|
cursor: grab;
|
|
41
|
+
touch-action: none;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
.adm-image-viewer-image-wrapper {
|
|
@@ -37,7 +37,7 @@ const Slide = props => {
|
|
|
37
37
|
const pinchLockRef = (0, _react.useRef)(false);
|
|
38
38
|
(0, _react2.useGesture)({
|
|
39
39
|
onDrag: state => {
|
|
40
|
-
if (state.tap && state.elapsedTime > 0) {
|
|
40
|
+
if (state.tap && state.elapsedTime > 0 && state.elapsedTime < 1000) {
|
|
41
41
|
// 判断点击时间>0是为了过滤掉非正常操作,例如用户长按选择图片之后的取消操作(也是一次点击)
|
|
42
42
|
props.onTap();
|
|
43
43
|
return;
|
|
@@ -96,13 +96,16 @@ const Slide = props => {
|
|
|
96
96
|
target: controlRef,
|
|
97
97
|
drag: {
|
|
98
98
|
// filterTaps: true,
|
|
99
|
-
from: () => [x.get(), y.get()]
|
|
99
|
+
from: () => [x.get(), y.get()],
|
|
100
|
+
pointer: {
|
|
101
|
+
touch: true
|
|
102
|
+
}
|
|
100
103
|
},
|
|
101
104
|
pinch: {
|
|
102
|
-
from: () => [zoom.get(), 0]
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
from: () => [zoom.get(), 0],
|
|
106
|
+
pointer: {
|
|
107
|
+
touch: true
|
|
108
|
+
}
|
|
106
109
|
}
|
|
107
110
|
});
|
|
108
111
|
return _react.default.createElement("div", {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
top: 50%;
|
|
34
34
|
right: 0;
|
|
35
35
|
transform: translateY(-50%);
|
|
36
|
-
z-index:
|
|
36
|
+
z-index: 910;
|
|
37
37
|
overflow: visible;
|
|
38
38
|
color: var(--adm-color-weak);
|
|
39
39
|
font-size: 24px;
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
|
|
90
90
|
.adm-index-bar-sticky .adm-index-bar-anchor-title {
|
|
91
91
|
position: sticky;
|
|
92
|
+
z-index: 900;
|
|
92
93
|
top: var(--sticky-offset-top);
|
|
93
94
|
left: 0;
|
|
94
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
4
|
-
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | '
|
|
4
|
+
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd'> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
defaultValue?: string;
|
|
7
7
|
onChange?: (val: string) => void;
|
|
@@ -13,13 +13,15 @@ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength
|
|
|
13
13
|
id?: string;
|
|
14
14
|
onEnterPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
15
15
|
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
16
|
+
min?: number;
|
|
17
|
+
max?: number;
|
|
16
18
|
} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--text-align'>;
|
|
17
19
|
export declare type InputRef = {
|
|
18
20
|
clear: () => void;
|
|
19
21
|
focus: () => void;
|
|
20
22
|
blur: () => void;
|
|
21
23
|
};
|
|
22
|
-
export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "pattern" | "
|
|
24
|
+
export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "pattern" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "maxLength" | "minLength"> & {
|
|
23
25
|
value?: string | undefined;
|
|
24
26
|
defaultValue?: string | undefined;
|
|
25
27
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -31,5 +33,7 @@ export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedH
|
|
|
31
33
|
id?: string | undefined;
|
|
32
34
|
onEnterPress?: ((e: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
|
|
33
35
|
enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
36
|
+
min?: number | undefined;
|
|
37
|
+
max?: number | undefined;
|
|
34
38
|
} & NativeProps<"--color" | "--font-size" | "--placeholder-color" | "--text-align"> & React.RefAttributes<InputRef>>;
|
|
35
39
|
export {};
|
|
@@ -19,6 +19,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
19
19
|
|
|
20
20
|
var _ahooks = require("ahooks");
|
|
21
21
|
|
|
22
|
+
var _bound = require("../../utils/bound");
|
|
23
|
+
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
25
|
|
|
24
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -71,6 +73,19 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
71
73
|
(_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.removeAttribute('enterkeyhint');
|
|
72
74
|
};
|
|
73
75
|
}, [props.enterKeyHint]);
|
|
76
|
+
|
|
77
|
+
function checkValue() {
|
|
78
|
+
let nextValue = value;
|
|
79
|
+
|
|
80
|
+
if (props.type === 'number') {
|
|
81
|
+
nextValue = (0, _bound.bound)(parseFloat(nextValue), props.min, props.max).toString();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (nextValue !== value) {
|
|
85
|
+
setValue(nextValue);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
74
89
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
75
90
|
className: (0, _classnames.default)(`${classPrefix}`, props.disabled && `${classPrefix}-disabled`)
|
|
76
91
|
}, _react.default.createElement("input", {
|
|
@@ -90,6 +105,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
90
105
|
var _a;
|
|
91
106
|
|
|
92
107
|
setHasFocus(false);
|
|
108
|
+
checkValue();
|
|
93
109
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
94
110
|
},
|
|
95
111
|
id: props.id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.adm-list {
|
|
2
|
-
--header-font-size:
|
|
2
|
+
--header-font-size: 30px;
|
|
3
3
|
--prefix-width: 'auto';
|
|
4
4
|
--prefix-padding-right: 24px;
|
|
5
5
|
--align-items: center;
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
.adm-list-header {
|
|
16
16
|
color: var(--adm-color-weak);
|
|
17
17
|
font-size: var(--header-font-size);
|
|
18
|
-
padding
|
|
19
|
-
padding-right: var(--padding-right);
|
|
20
|
-
margin: 32px 0 8px;
|
|
18
|
+
padding: 16px var(--padding-right) 16px var(--padding-left);
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
.adm-list-body {
|
|
@@ -43,6 +41,10 @@
|
|
|
43
41
|
border-radius: 16px;
|
|
44
42
|
}
|
|
45
43
|
|
|
44
|
+
.adm-list-card .adm-list-header {
|
|
45
|
+
padding-left: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
46
48
|
.adm-list-item {
|
|
47
49
|
display: block;
|
|
48
50
|
padding-left: var(--padding-left);
|
|
@@ -10,6 +10,7 @@ export declare type PickerProps = {
|
|
|
10
10
|
onConfirm?: (value: PickerValue[], extend: PickerValueExtend) => void;
|
|
11
11
|
onCancel?: () => void;
|
|
12
12
|
onClose?: () => void;
|
|
13
|
+
closeOnMaskClick?: boolean;
|
|
13
14
|
visible?: boolean;
|
|
14
15
|
title?: ReactNode;
|
|
15
16
|
confirmText?: ReactNode;
|
|
@@ -35,7 +35,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
|
|
36
36
|
const classPrefix = `adm-picker`;
|
|
37
37
|
const defaultProps = {
|
|
38
|
-
defaultValue: []
|
|
38
|
+
defaultValue: [],
|
|
39
|
+
closeOnMaskClick: true
|
|
39
40
|
};
|
|
40
41
|
const Picker = (0, _react.memo)(p => {
|
|
41
42
|
var _a;
|
|
@@ -114,6 +115,7 @@ const Picker = (0, _react.memo)(p => {
|
|
|
114
115
|
onMaskClick: () => {
|
|
115
116
|
var _a, _b;
|
|
116
117
|
|
|
118
|
+
if (!props.closeOnMaskClick) return;
|
|
117
119
|
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
118
120
|
(_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
119
121
|
},
|
|
@@ -13,11 +13,9 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
13
13
|
stopPropagation?: "click"[] | undefined;
|
|
14
14
|
content: import("react").ReactNode;
|
|
15
15
|
} & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "align" | "defaultVisible" | "onVisibleChange"> & import("../../utils/native-props").NativeProps<"--z-index"> & import("react").RefAttributes<import("./popover").PopoverRef>> & {
|
|
16
|
-
Menu:
|
|
17
|
-
actions:
|
|
18
|
-
onAction?: ((
|
|
19
|
-
} &
|
|
20
|
-
ref?: ((instance: import("./popover").PopoverRef | null) => void) | import("react").RefObject<import("./popover").PopoverRef> | null | undefined;
|
|
21
|
-
}) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
|
|
16
|
+
Menu: import("react").ForwardRefExoticComponent<Pick<import("./popover").PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "trigger" | "defaultVisible" | "onVisibleChange" | "placement" | "destroyOnHide"> & {
|
|
17
|
+
actions: import("./popover-menu").Action[];
|
|
18
|
+
onAction?: ((item: import("./popover-menu").Action) => void) | undefined;
|
|
19
|
+
} & import("react").RefAttributes<import("./popover").PopoverRef>>;
|
|
22
20
|
};
|
|
23
21
|
export default _default;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PopoverProps, PopoverRef } from './popover';
|
|
3
3
|
export declare type Action = {
|
|
4
4
|
text: React.ReactNode;
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
key?: string;
|
|
7
|
+
key?: string | number;
|
|
8
8
|
onClick?: () => void;
|
|
9
|
-
[key: string]: any;
|
|
10
9
|
};
|
|
11
|
-
export declare type PopoverMenuProps
|
|
12
|
-
actions:
|
|
13
|
-
onAction?: (
|
|
10
|
+
export declare type PopoverMenuProps = Omit<PopoverProps, 'content'> & {
|
|
11
|
+
actions: Action[];
|
|
12
|
+
onAction?: (item: Action) => void;
|
|
14
13
|
};
|
|
15
|
-
export declare const PopoverMenu: <
|
|
16
|
-
actions:
|
|
17
|
-
onAction?: ((
|
|
18
|
-
} &
|
|
19
|
-
ref?: ((instance: PopoverRef | null) => void) | React.RefObject<PopoverRef> | null | undefined;
|
|
20
|
-
}) => ReactElement;
|
|
14
|
+
export declare const PopoverMenu: React.ForwardRefExoticComponent<Pick<PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "trigger" | "defaultVisible" | "onVisibleChange" | "placement" | "destroyOnHide"> & {
|
|
15
|
+
actions: Action[];
|
|
16
|
+
onAction?: ((item: Action) => void) | undefined;
|
|
17
|
+
} & React.RefAttributes<PopoverRef>>;
|
|
@@ -74,12 +74,11 @@ const Radio = p => {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("label", {
|
|
77
|
-
className: (0, _classnames.default)(classPrefix,
|
|
77
|
+
className: (0, _classnames.default)(classPrefix, {
|
|
78
78
|
[`${classPrefix}-checked`]: checked,
|
|
79
79
|
[`${classPrefix}-disabled`]: disabled,
|
|
80
80
|
[`${classPrefix}-block`]: props.block
|
|
81
|
-
})
|
|
82
|
-
style: props.style
|
|
81
|
+
})
|
|
83
82
|
}, _react.default.createElement("input", {
|
|
84
83
|
type: 'radio',
|
|
85
84
|
checked: checked,
|
|
@@ -2,7 +2,7 @@ import { FC, ReactNode } from 'react';
|
|
|
2
2
|
import type { PickerProps } from '../picker';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
import type { Precision, DatePickerFilter } from './date-picker-utils';
|
|
5
|
-
export declare type DatePickerProps = Pick<PickerProps, 'onCancel' | 'onClose' | 'visible' | 'confirmText' | 'cancelText' | 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'title' | 'stopPropagation' | 'style'> & {
|
|
5
|
+
export declare type DatePickerProps = Pick<PickerProps, 'onCancel' | 'onClose' | 'closeOnMaskClick' | 'visible' | 'confirmText' | 'cancelText' | 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'title' | 'stopPropagation' | 'style'> & {
|
|
6
6
|
value?: Date | null;
|
|
7
7
|
defaultValue?: Date | null;
|
|
8
8
|
onSelect?: (value: Date) => void;
|
|
@@ -6,9 +6,11 @@ import { DownFill } from 'antd-mobile-icons';
|
|
|
6
6
|
const classPrefix = `adm-dropdown-item`;
|
|
7
7
|
|
|
8
8
|
const Item = props => {
|
|
9
|
+
var _a;
|
|
10
|
+
|
|
9
11
|
const cls = classNames(classPrefix, {
|
|
10
12
|
[`${classPrefix}-active`]: props.active,
|
|
11
|
-
[`${classPrefix}-highlight`]: props.highlight
|
|
13
|
+
[`${classPrefix}-highlight`]: (_a = props.highlight) !== null && _a !== void 0 ? _a : props.active
|
|
12
14
|
});
|
|
13
15
|
return withNativeProps(props, React.createElement("div", {
|
|
14
16
|
className: cls,
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
.adm-form-item-footer {
|
|
23
23
|
color: var(--adm-color-danger);
|
|
24
|
+
margin-top: 8px;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.adm-form-item.adm-form-item-hidden {
|
|
@@ -32,10 +33,6 @@
|
|
|
32
33
|
margin-bottom: 8px;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
.adm-form-vertical .adm-form-item-footer {
|
|
36
|
-
margin-top: 8px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
36
|
.adm-form-horizontal .adm-list-item-content-prefix {
|
|
40
37
|
padding-top: 24px;
|
|
41
38
|
padding-bottom: 24px;
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
.adm-form-item-footer {
|
|
41
41
|
color: var(--adm-color-danger);
|
|
42
|
+
margin-top: 8px;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
.adm-form-item.adm-form-item-hidden {
|
|
@@ -50,10 +51,6 @@
|
|
|
50
51
|
margin-bottom: 8px;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
.adm-form-vertical .adm-form-item-footer {
|
|
54
|
-
margin-top: 8px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
54
|
.adm-form-horizontal .adm-list-item-content-prefix {
|
|
58
55
|
padding-top: 24px;
|
|
59
56
|
padding-bottom: 24px;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
position: relative;
|
|
12
12
|
z-index: 1;
|
|
13
13
|
cursor: grab;
|
|
14
|
+
touch-action: none;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.adm-image-viewer-slides-inner {
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
width: 100%;
|
|
38
39
|
height: 100%;
|
|
39
40
|
cursor: grab;
|
|
41
|
+
touch-action: none;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
.adm-image-viewer-image-wrapper {
|
|
@@ -22,7 +22,7 @@ export const Slide = props => {
|
|
|
22
22
|
const pinchLockRef = useRef(false);
|
|
23
23
|
useGesture({
|
|
24
24
|
onDrag: state => {
|
|
25
|
-
if (state.tap && state.elapsedTime > 0) {
|
|
25
|
+
if (state.tap && state.elapsedTime > 0 && state.elapsedTime < 1000) {
|
|
26
26
|
// 判断点击时间>0是为了过滤掉非正常操作,例如用户长按选择图片之后的取消操作(也是一次点击)
|
|
27
27
|
props.onTap();
|
|
28
28
|
return;
|
|
@@ -81,13 +81,16 @@ export const Slide = props => {
|
|
|
81
81
|
target: controlRef,
|
|
82
82
|
drag: {
|
|
83
83
|
// filterTaps: true,
|
|
84
|
-
from: () => [x.get(), y.get()]
|
|
84
|
+
from: () => [x.get(), y.get()],
|
|
85
|
+
pointer: {
|
|
86
|
+
touch: true
|
|
87
|
+
}
|
|
85
88
|
},
|
|
86
89
|
pinch: {
|
|
87
|
-
from: () => [zoom.get(), 0]
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
from: () => [zoom.get(), 0],
|
|
91
|
+
pointer: {
|
|
92
|
+
touch: true
|
|
93
|
+
}
|
|
91
94
|
}
|
|
92
95
|
});
|
|
93
96
|
return React.createElement("div", {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
top: 50%;
|
|
34
34
|
right: 0;
|
|
35
35
|
transform: translateY(-50%);
|
|
36
|
-
z-index:
|
|
36
|
+
z-index: 910;
|
|
37
37
|
overflow: visible;
|
|
38
38
|
color: var(--adm-color-weak);
|
|
39
39
|
font-size: 24px;
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
|
|
90
90
|
.adm-index-bar-sticky .adm-index-bar-anchor-title {
|
|
91
91
|
position: sticky;
|
|
92
|
+
z-index: 900;
|
|
92
93
|
top: var(--sticky-offset-top);
|
|
93
94
|
left: 0;
|
|
94
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
4
|
-
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | '
|
|
4
|
+
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd'> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
defaultValue?: string;
|
|
7
7
|
onChange?: (val: string) => void;
|
|
@@ -13,13 +13,15 @@ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength
|
|
|
13
13
|
id?: string;
|
|
14
14
|
onEnterPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
15
15
|
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
16
|
+
min?: number;
|
|
17
|
+
max?: number;
|
|
16
18
|
} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--text-align'>;
|
|
17
19
|
export declare type InputRef = {
|
|
18
20
|
clear: () => void;
|
|
19
21
|
focus: () => void;
|
|
20
22
|
blur: () => void;
|
|
21
23
|
};
|
|
22
|
-
export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "pattern" | "
|
|
24
|
+
export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "pattern" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "maxLength" | "minLength"> & {
|
|
23
25
|
value?: string | undefined;
|
|
24
26
|
defaultValue?: string | undefined;
|
|
25
27
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -31,5 +33,7 @@ export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedH
|
|
|
31
33
|
id?: string | undefined;
|
|
32
34
|
onEnterPress?: ((e: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
|
|
33
35
|
enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
36
|
+
min?: number | undefined;
|
|
37
|
+
max?: number | undefined;
|
|
34
38
|
} & NativeProps<"--color" | "--font-size" | "--placeholder-color" | "--text-align"> & React.RefAttributes<InputRef>>;
|
|
35
39
|
export {};
|
|
@@ -5,6 +5,7 @@ import { withNativeProps } from '../../utils/native-props';
|
|
|
5
5
|
import { mergeProps } from '../../utils/with-default-props';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
8
|
+
import { bound } from '../../utils/bound';
|
|
8
9
|
const classPrefix = `adm-input`;
|
|
9
10
|
const defaultProps = {
|
|
10
11
|
defaultValue: ''
|
|
@@ -51,6 +52,19 @@ export const Input = forwardRef((p, ref) => {
|
|
|
51
52
|
(_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.removeAttribute('enterkeyhint');
|
|
52
53
|
};
|
|
53
54
|
}, [props.enterKeyHint]);
|
|
55
|
+
|
|
56
|
+
function checkValue() {
|
|
57
|
+
let nextValue = value;
|
|
58
|
+
|
|
59
|
+
if (props.type === 'number') {
|
|
60
|
+
nextValue = bound(parseFloat(nextValue), props.min, props.max).toString();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (nextValue !== value) {
|
|
64
|
+
setValue(nextValue);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
54
68
|
return withNativeProps(props, React.createElement("div", {
|
|
55
69
|
className: classNames(`${classPrefix}`, props.disabled && `${classPrefix}-disabled`)
|
|
56
70
|
}, React.createElement("input", {
|
|
@@ -70,6 +84,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
70
84
|
var _a;
|
|
71
85
|
|
|
72
86
|
setHasFocus(false);
|
|
87
|
+
checkValue();
|
|
73
88
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
74
89
|
},
|
|
75
90
|
id: props.id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.adm-list {
|
|
2
|
-
--header-font-size:
|
|
2
|
+
--header-font-size: 30px;
|
|
3
3
|
--prefix-width: 'auto';
|
|
4
4
|
--prefix-padding-right: 24px;
|
|
5
5
|
--align-items: center;
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
.adm-list-header {
|
|
16
16
|
color: var(--adm-color-weak);
|
|
17
17
|
font-size: var(--header-font-size);
|
|
18
|
-
padding
|
|
19
|
-
padding-right: var(--padding-right);
|
|
20
|
-
margin: 32px 0 8px;
|
|
18
|
+
padding: 16px var(--padding-right) 16px var(--padding-left);
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
.adm-list-body {
|
|
@@ -43,6 +41,10 @@
|
|
|
43
41
|
border-radius: 16px;
|
|
44
42
|
}
|
|
45
43
|
|
|
44
|
+
.adm-list-card .adm-list-header {
|
|
45
|
+
padding-left: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
46
48
|
.adm-list-item {
|
|
47
49
|
display: block;
|
|
48
50
|
padding-left: var(--padding-left);
|
|
@@ -10,6 +10,7 @@ export declare type PickerProps = {
|
|
|
10
10
|
onConfirm?: (value: PickerValue[], extend: PickerValueExtend) => void;
|
|
11
11
|
onCancel?: () => void;
|
|
12
12
|
onClose?: () => void;
|
|
13
|
+
closeOnMaskClick?: boolean;
|
|
13
14
|
visible?: boolean;
|
|
14
15
|
title?: ReactNode;
|
|
15
16
|
confirmText?: ReactNode;
|
|
@@ -11,7 +11,8 @@ import { useMemoizedFn } from 'ahooks';
|
|
|
11
11
|
import SafeArea from '../safe-area';
|
|
12
12
|
const classPrefix = `adm-picker`;
|
|
13
13
|
const defaultProps = {
|
|
14
|
-
defaultValue: []
|
|
14
|
+
defaultValue: [],
|
|
15
|
+
closeOnMaskClick: true
|
|
15
16
|
};
|
|
16
17
|
export const Picker = memo(p => {
|
|
17
18
|
var _a;
|
|
@@ -89,6 +90,7 @@ export const Picker = memo(p => {
|
|
|
89
90
|
onMaskClick: () => {
|
|
90
91
|
var _a, _b;
|
|
91
92
|
|
|
93
|
+
if (!props.closeOnMaskClick) return;
|
|
92
94
|
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
93
95
|
(_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
94
96
|
},
|