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
|
@@ -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: 15px;
|
|
3
3
|
--prefix-width: 'auto';
|
|
4
4
|
--prefix-padding-right: 12px;
|
|
5
5
|
--align-items: center;
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
.adm-list-header {
|
|
15
15
|
color: var(--adm-color-weak);
|
|
16
16
|
font-size: var(--header-font-size);
|
|
17
|
-
padding
|
|
18
|
-
padding-right: var(--padding-right);
|
|
19
|
-
margin: 16px 0 4px;
|
|
17
|
+
padding: 8px var(--padding-right) 8px var(--padding-left);
|
|
20
18
|
}
|
|
21
19
|
.adm-list-body {
|
|
22
20
|
background-color: #ffffff;
|
|
@@ -36,6 +34,9 @@
|
|
|
36
34
|
.adm-list-card .adm-list-body {
|
|
37
35
|
border-radius: 8px;
|
|
38
36
|
}
|
|
37
|
+
.adm-list-card .adm-list-header {
|
|
38
|
+
padding-left: 0;
|
|
39
|
+
}
|
|
39
40
|
.adm-list-item {
|
|
40
41
|
display: block;
|
|
41
42
|
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
|
},
|
|
@@ -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>>;
|
|
@@ -53,12 +53,11 @@ export const Radio = p => {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
return withNativeProps(props, React.createElement("label", {
|
|
56
|
-
className: classNames(classPrefix,
|
|
56
|
+
className: classNames(classPrefix, {
|
|
57
57
|
[`${classPrefix}-checked`]: checked,
|
|
58
58
|
[`${classPrefix}-disabled`]: disabled,
|
|
59
59
|
[`${classPrefix}-block`]: props.block
|
|
60
|
-
})
|
|
61
|
-
style: props.style
|
|
60
|
+
})
|
|
62
61
|
}, React.createElement("input", {
|
|
63
62
|
type: 'radio',
|
|
64
63
|
checked: checked,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-mobile",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.27",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@react-spring/web": "^9.4.
|
|
5
|
+
"@react-spring/web": "^9.4.3",
|
|
6
6
|
"@types/resize-observer-browser": "^0.1.7",
|
|
7
|
-
"@use-gesture/react": "^10.2.
|
|
7
|
+
"@use-gesture/react": "^10.2.6",
|
|
8
8
|
"ahooks": "^3.1.9",
|
|
9
9
|
"antd-mobile-icons": "^0.2.2",
|
|
10
10
|
"antd-mobile-v5-count": "^1.0.1",
|