antd-mobile 5.9.5 → 5.10.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/capsule-tabs/capsule-tabs.js +3 -3
- package/2x/cjs/components/collapse/collapse.js +3 -3
- package/2x/cjs/components/divider/divider.css +19 -8
- package/2x/cjs/components/divider/divider.d.ts +1 -0
- package/2x/cjs/components/divider/divider.js +3 -2
- package/2x/cjs/components/form/form.js +3 -2
- package/2x/cjs/components/image-uploader/image-uploader.d.ts +2 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +4 -1
- package/2x/cjs/components/image-uploader/preview-item.d.ts +2 -0
- package/2x/cjs/components/image-uploader/preview-item.js +3 -2
- package/2x/cjs/components/index-bar/index-bar.js +3 -3
- package/2x/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
- package/2x/cjs/components/picker-view/picker-view.d.ts +1 -0
- package/2x/cjs/components/picker-view/wheel.js +3 -1
- package/2x/cjs/components/popover/popover-menu.js +2 -1
- package/2x/cjs/components/side-bar/side-bar.js +3 -3
- package/2x/cjs/components/stepper/stepper.js +15 -8
- package/2x/cjs/components/tab-bar/tab-bar.js +3 -3
- package/2x/cjs/components/tabs/tabs.js +3 -3
- package/2x/cjs/components/tree-select/multiple.js +2 -1
- package/2x/cjs/utils/traverse-react-node.d.ts +2 -0
- package/2x/cjs/utils/traverse-react-node.js +29 -0
- package/2x/es/components/capsule-tabs/capsule-tabs.js +2 -1
- package/2x/es/components/collapse/collapse.js +2 -1
- package/2x/es/components/divider/divider.css +19 -8
- package/2x/es/components/divider/divider.d.ts +1 -0
- package/2x/es/components/divider/divider.js +3 -2
- package/2x/es/components/form/form.js +2 -1
- package/2x/es/components/image-uploader/image-uploader.d.ts +2 -0
- package/2x/es/components/image-uploader/image-uploader.js +4 -1
- package/2x/es/components/image-uploader/preview-item.d.ts +2 -0
- package/2x/es/components/image-uploader/preview-item.js +3 -2
- package/2x/es/components/index-bar/index-bar.js +2 -1
- package/2x/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
- package/2x/es/components/picker-view/picker-view.d.ts +1 -0
- package/2x/es/components/picker-view/wheel.js +3 -1
- package/2x/es/components/popover/popover-menu.js +2 -1
- package/2x/es/components/side-bar/side-bar.js +2 -1
- package/2x/es/components/stepper/stepper.js +14 -8
- package/2x/es/components/tab-bar/tab-bar.js +2 -1
- package/2x/es/components/tabs/tabs.js +2 -1
- package/2x/es/components/tree-select/multiple.js +2 -1
- package/2x/es/utils/traverse-react-node.d.ts +2 -0
- package/2x/es/utils/traverse-react-node.js +18 -0
- package/2x/package.json +5 -1
- package/bundle/antd-mobile.cjs.js +49 -22
- package/bundle/antd-mobile.es.js +48 -22
- package/bundle/style.css +18 -8
- package/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
- package/cjs/components/collapse/collapse.js +3 -3
- package/cjs/components/divider/divider.css +18 -8
- package/cjs/components/divider/divider.d.ts +1 -0
- package/cjs/components/divider/divider.js +3 -2
- package/cjs/components/form/form.js +3 -2
- package/cjs/components/image-uploader/image-uploader.d.ts +2 -0
- package/cjs/components/image-uploader/image-uploader.js +4 -1
- package/cjs/components/image-uploader/preview-item.d.ts +2 -0
- package/cjs/components/image-uploader/preview-item.js +3 -2
- package/cjs/components/index-bar/index-bar.js +3 -3
- package/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
- package/cjs/components/picker-view/picker-view.d.ts +1 -0
- package/cjs/components/picker-view/wheel.js +3 -1
- package/cjs/components/popover/popover-menu.js +2 -1
- package/cjs/components/side-bar/side-bar.js +3 -3
- package/cjs/components/stepper/stepper.js +15 -8
- package/cjs/components/tab-bar/tab-bar.js +3 -3
- package/cjs/components/tabs/tabs.js +3 -3
- package/cjs/components/tree-select/multiple.js +2 -1
- package/cjs/utils/traverse-react-node.d.ts +2 -0
- package/cjs/utils/traverse-react-node.js +29 -0
- package/es/components/capsule-tabs/capsule-tabs.js +2 -1
- package/es/components/collapse/collapse.js +2 -1
- package/es/components/divider/divider.css +18 -8
- package/es/components/divider/divider.d.ts +1 -0
- package/es/components/divider/divider.js +3 -2
- package/es/components/form/form.js +2 -1
- package/es/components/image-uploader/image-uploader.d.ts +2 -0
- package/es/components/image-uploader/image-uploader.js +4 -1
- package/es/components/image-uploader/preview-item.d.ts +2 -0
- package/es/components/image-uploader/preview-item.js +3 -2
- package/es/components/index-bar/index-bar.js +2 -1
- package/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
- package/es/components/picker-view/picker-view.d.ts +1 -0
- package/es/components/picker-view/wheel.js +3 -1
- package/es/components/popover/popover-menu.js +2 -1
- package/es/components/side-bar/side-bar.js +2 -1
- package/es/components/stepper/stepper.js +14 -8
- package/es/components/tab-bar/tab-bar.js +2 -1
- package/es/components/tabs/tabs.js +2 -1
- package/es/components/tree-select/multiple.js +2 -1
- package/es/utils/traverse-react-node.d.ts +2 -0
- package/es/utils/traverse-react-node.js +18 -0
- package/package.json +5 -1
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +9 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC, InputHTMLAttributes } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import type { ImageProps } from '../image';
|
|
3
4
|
export declare type TaskStatus = 'pending' | 'fail';
|
|
4
5
|
export interface ImageUploadItem {
|
|
5
6
|
key?: string | number;
|
|
@@ -25,5 +26,6 @@ export declare type ImageUploaderProps = {
|
|
|
25
26
|
onDelete?: (item: ImageUploadItem) => boolean | Promise<boolean> | void;
|
|
26
27
|
preview?: boolean;
|
|
27
28
|
showFailed?: boolean;
|
|
29
|
+
imageFit?: ImageProps['fit'];
|
|
28
30
|
} & NativeProps<'--cell-size'>;
|
|
29
31
|
export declare const ImageUploader: FC<ImageUploaderProps>;
|
|
@@ -18,7 +18,8 @@ const defaultProps = {
|
|
|
18
18
|
defaultValue: [],
|
|
19
19
|
accept: 'image/*',
|
|
20
20
|
preview: true,
|
|
21
|
-
showFailed: true
|
|
21
|
+
showFailed: true,
|
|
22
|
+
imageFit: 'cover'
|
|
22
23
|
};
|
|
23
24
|
export const ImageUploader = p => {
|
|
24
25
|
const props = mergeProps(defaultProps, p);
|
|
@@ -157,6 +158,7 @@ export const ImageUploader = p => {
|
|
|
157
158
|
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index,
|
|
158
159
|
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
159
160
|
deletable: props.deletable,
|
|
161
|
+
imageFit: props.imageFit,
|
|
160
162
|
onClick: () => {
|
|
161
163
|
if (props.preview) {
|
|
162
164
|
previewImage(index);
|
|
@@ -182,6 +184,7 @@ export const ImageUploader = p => {
|
|
|
182
184
|
file: task.file,
|
|
183
185
|
deletable: task.status !== 'pending',
|
|
184
186
|
status: task.status,
|
|
187
|
+
imageFit: props.imageFit,
|
|
185
188
|
onDelete: () => {
|
|
186
189
|
setTasks(tasks.filter(x => x.id !== task.id));
|
|
187
190
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { TaskStatus } from './image-uploader';
|
|
3
|
+
import type { ImageProps } from '../image';
|
|
3
4
|
declare type Props = {
|
|
4
5
|
onClick?: () => void;
|
|
5
6
|
onDelete?: () => void;
|
|
@@ -7,6 +8,7 @@ declare type Props = {
|
|
|
7
8
|
url?: string;
|
|
8
9
|
file?: File;
|
|
9
10
|
status?: TaskStatus;
|
|
11
|
+
imageFit: ImageProps['fit'];
|
|
10
12
|
};
|
|
11
13
|
declare const PreviewItem: FC<Props>;
|
|
12
14
|
export default PreviewItem;
|
|
@@ -14,7 +14,8 @@ const PreviewItem = props => {
|
|
|
14
14
|
url,
|
|
15
15
|
file,
|
|
16
16
|
deletable,
|
|
17
|
-
onDelete
|
|
17
|
+
onDelete,
|
|
18
|
+
imageFit
|
|
18
19
|
} = props;
|
|
19
20
|
const src = useMemo(() => {
|
|
20
21
|
if (url) {
|
|
@@ -54,7 +55,7 @@ const PreviewItem = props => {
|
|
|
54
55
|
}, React.createElement(Image, {
|
|
55
56
|
className: `${classPrefix}-cell-image`,
|
|
56
57
|
src: src,
|
|
57
|
-
fit:
|
|
58
|
+
fit: imageFit,
|
|
58
59
|
onClick: props.onClick
|
|
59
60
|
}), renderLoading(), renderDelete());
|
|
60
61
|
};
|
|
@@ -7,6 +7,7 @@ import { Sidebar } from './sidebar';
|
|
|
7
7
|
import { convertPx } from '../../utils/convert-px';
|
|
8
8
|
import { Panel } from './panel';
|
|
9
9
|
import { devWarning } from '../../utils/dev-log';
|
|
10
|
+
import { traverseReactNode } from '../../utils/traverse-react-node';
|
|
10
11
|
const classPrefix = `adm-index-bar`;
|
|
11
12
|
const defaultProps = {
|
|
12
13
|
sticky: true
|
|
@@ -17,7 +18,7 @@ export const IndexBar = forwardRef((p, ref) => {
|
|
|
17
18
|
const bodyRef = useRef(null);
|
|
18
19
|
const indexItems = [];
|
|
19
20
|
const panels = [];
|
|
20
|
-
|
|
21
|
+
traverseReactNode(props.children, child => {
|
|
21
22
|
var _a;
|
|
22
23
|
|
|
23
24
|
if (!React.isValidElement(child)) return;
|
|
@@ -7,6 +7,7 @@ import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
|
7
7
|
import { useTabListScroll } from '../../utils/use-tab-list-scroll';
|
|
8
8
|
import ScrollMask from '../scroll-mask';
|
|
9
9
|
import { ShouldRender } from '../../utils/should-render';
|
|
10
|
+
import { traverseReactNode } from '../../utils/traverse-react-node';
|
|
10
11
|
const classPrefix = `adm-jumbo-tabs`;
|
|
11
12
|
export const JumboTab = () => {
|
|
12
13
|
return null;
|
|
@@ -19,7 +20,7 @@ export const JumboTabs = props => {
|
|
|
19
20
|
const keyToIndexRecord = {};
|
|
20
21
|
let firstActiveKey = null;
|
|
21
22
|
const panes = [];
|
|
22
|
-
|
|
23
|
+
traverseReactNode(props.children, (child, index) => {
|
|
23
24
|
if (!React.isValidElement(child)) return;
|
|
24
25
|
const key = child.key;
|
|
25
26
|
if (typeof key !== 'string') return;
|
|
@@ -9,6 +9,7 @@ export declare type PickerValueExtend = {
|
|
|
9
9
|
export declare type PickerColumnItem = {
|
|
10
10
|
label: ReactNode;
|
|
11
11
|
value: string;
|
|
12
|
+
key?: string | number;
|
|
12
13
|
};
|
|
13
14
|
export declare type PickerColumn = (string | PickerColumnItem)[];
|
|
14
15
|
export declare type PickerViewProps = {
|
|
@@ -140,6 +140,8 @@ export const Wheel = memo(props => {
|
|
|
140
140
|
className: `${classPrefix}-column-wheel`,
|
|
141
141
|
"aria-hidden": true
|
|
142
142
|
}, column.map((item, index) => {
|
|
143
|
+
var _a;
|
|
144
|
+
|
|
143
145
|
const selected = props.value === item.value;
|
|
144
146
|
if (selected) selectedIndex = index;
|
|
145
147
|
|
|
@@ -149,7 +151,7 @@ export const Wheel = memo(props => {
|
|
|
149
151
|
}
|
|
150
152
|
|
|
151
153
|
return React.createElement("div", {
|
|
152
|
-
key: item.value,
|
|
154
|
+
key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
|
|
153
155
|
"data-selected": item.value === value,
|
|
154
156
|
className: `${classPrefix}-column-item`,
|
|
155
157
|
onClick: handleClick,
|
|
@@ -3,7 +3,8 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { Popover } from './popover';
|
|
4
4
|
const classPrefix = `adm-popover-menu`;
|
|
5
5
|
export const PopoverMenu = forwardRef((props, ref) => {
|
|
6
|
-
const innerRef = useRef(null);
|
|
6
|
+
const innerRef = useRef(null); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7
|
+
|
|
7
8
|
useImperativeHandle(ref, () => innerRef.current, []);
|
|
8
9
|
const onClick = useCallback(e => {
|
|
9
10
|
var _a;
|
|
@@ -4,6 +4,7 @@ import Badge from '../badge';
|
|
|
4
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
5
5
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
6
6
|
import { Corner } from './corner';
|
|
7
|
+
import { traverseReactNode } from '../../utils/traverse-react-node';
|
|
7
8
|
const classPrefix = `adm-side-bar`;
|
|
8
9
|
export const SideBarItem = () => {
|
|
9
10
|
return null;
|
|
@@ -13,7 +14,7 @@ export const SideBar = props => {
|
|
|
13
14
|
|
|
14
15
|
let firstActiveKey = null;
|
|
15
16
|
const items = [];
|
|
16
|
-
|
|
17
|
+
traverseReactNode(props.children, (child, index) => {
|
|
17
18
|
if (!React.isValidElement(child)) return;
|
|
18
19
|
const key = child.key;
|
|
19
20
|
if (typeof key !== 'string') return;
|
|
@@ -7,6 +7,7 @@ import { mergeProps } from '../../utils/with-default-props';
|
|
|
7
7
|
import { bound } from '../../utils/bound';
|
|
8
8
|
import Input from '../input';
|
|
9
9
|
import Button from '../button';
|
|
10
|
+
import Big from 'big.js';
|
|
10
11
|
const classPrefix = `adm-stepper`;
|
|
11
12
|
const defaultProps = {
|
|
12
13
|
defaultValue: 0,
|
|
@@ -24,13 +25,13 @@ export const Stepper = p => {
|
|
|
24
25
|
inputReadOnly
|
|
25
26
|
} = props;
|
|
26
27
|
const [value, setValue] = usePropsValue(props);
|
|
27
|
-
const [inputValue, setInputValue] = useState(() => convertValueToText(value));
|
|
28
|
+
const [inputValue, setInputValue] = useState(() => convertValueToText(value, props.digits));
|
|
28
29
|
|
|
29
30
|
function setValueWithCheck(v) {
|
|
30
31
|
if (isNaN(v)) return;
|
|
31
32
|
let target = bound(v, props.min, props.max);
|
|
32
33
|
|
|
33
|
-
if (props.digits
|
|
34
|
+
if (props.digits !== undefined) {
|
|
34
35
|
target = parseFloat(target.toFixed(props.digits));
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -40,12 +41,12 @@ export const Stepper = p => {
|
|
|
40
41
|
const [hasFocus, setHasFocus] = useState(false);
|
|
41
42
|
useEffect(() => {
|
|
42
43
|
if (!hasFocus) {
|
|
43
|
-
setInputValue(convertValueToText(value));
|
|
44
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
44
45
|
}
|
|
45
46
|
}, [hasFocus]);
|
|
46
47
|
useEffect(() => {
|
|
47
48
|
if (!hasFocus) {
|
|
48
|
-
setInputValue(convertValueToText(value));
|
|
49
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
49
50
|
}
|
|
50
51
|
}, [value]);
|
|
51
52
|
|
|
@@ -65,11 +66,11 @@ export const Stepper = p => {
|
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
const handleMinus = () => {
|
|
68
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
69
|
+
setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
const handlePlus = () => {
|
|
72
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
73
|
+
setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).add(step).toNumber());
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
const minusDisabled = () => {
|
|
@@ -137,9 +138,14 @@ export const Stepper = p => {
|
|
|
137
138
|
}, React.createElement(AddOutline, null))));
|
|
138
139
|
};
|
|
139
140
|
|
|
140
|
-
function convertValueToText(value) {
|
|
141
|
+
function convertValueToText(value, digits) {
|
|
141
142
|
if (value === null) return '';
|
|
142
|
-
|
|
143
|
+
|
|
144
|
+
if (digits !== undefined) {
|
|
145
|
+
return value.toFixed(digits);
|
|
146
|
+
} else {
|
|
147
|
+
return value.toString();
|
|
148
|
+
}
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
function convertTextToValue(text) {
|
|
@@ -5,6 +5,7 @@ import { mergeProps } from '../../utils/with-default-props';
|
|
|
5
5
|
import Badge from '../badge';
|
|
6
6
|
import SafeArea from '../safe-area';
|
|
7
7
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
8
|
+
import { traverseReactNode } from '../../utils/traverse-react-node';
|
|
8
9
|
export const TabBarItem = () => {
|
|
9
10
|
return null;
|
|
10
11
|
};
|
|
@@ -18,7 +19,7 @@ export const TabBar = p => {
|
|
|
18
19
|
const props = mergeProps(defaultProps, p);
|
|
19
20
|
let firstActiveKey = null;
|
|
20
21
|
const items = [];
|
|
21
|
-
|
|
22
|
+
traverseReactNode(props.children, (child, index) => {
|
|
22
23
|
if (!React.isValidElement(child)) return;
|
|
23
24
|
const key = child.key;
|
|
24
25
|
if (typeof key !== 'string') return;
|
|
@@ -10,6 +10,7 @@ import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
|
10
10
|
import { mergeProps } from '../../utils/with-default-props';
|
|
11
11
|
import { useIsomorphicUpdateLayoutEffect } from '../../utils/use-isomorphic-update-layout-effect';
|
|
12
12
|
import { ShouldRender } from '../../utils/should-render';
|
|
13
|
+
import { traverseReactNode } from '../../utils/traverse-react-node';
|
|
13
14
|
const classPrefix = `adm-tabs`;
|
|
14
15
|
export const Tab = () => {
|
|
15
16
|
return null;
|
|
@@ -27,7 +28,7 @@ export const Tabs = p => {
|
|
|
27
28
|
const keyToIndexRecord = {};
|
|
28
29
|
let firstActiveKey = null;
|
|
29
30
|
const panes = [];
|
|
30
|
-
|
|
31
|
+
traverseReactNode(props.children, (child, index) => {
|
|
31
32
|
if (!React.isValidElement(child)) return;
|
|
32
33
|
const key = child.key;
|
|
33
34
|
if (typeof key !== 'string') return;
|
|
@@ -137,7 +137,8 @@ export const Multiple = p => {
|
|
|
137
137
|
walker(groupKeys);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
groupKeys = groupKeys.filter(i => !unusedKeys.includes(i));
|
|
140
|
+
groupKeys = groupKeys.filter(i => !unusedKeys.includes(i)); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
141
|
+
|
|
141
142
|
const groupOptions = groupKeys.map(i => optionsMap.get(i));
|
|
142
143
|
setValue(groupKeys);
|
|
143
144
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, groupKeys, groupOptions);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isFragment } from 'react-is';
|
|
3
|
+
export function traverseReactNode(children, fn) {
|
|
4
|
+
let i = 0;
|
|
5
|
+
|
|
6
|
+
function handle(target) {
|
|
7
|
+
React.Children.forEach(target, child => {
|
|
8
|
+
if (!isFragment(child)) {
|
|
9
|
+
fn(child, i);
|
|
10
|
+
i += 1;
|
|
11
|
+
} else {
|
|
12
|
+
handle(child.props.children);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
handle(children);
|
|
18
|
+
}
|
package/2x/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-mobile",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@floating-ui/dom": "^0.4.2",
|
|
6
6
|
"@react-spring/web": "^9.4.4",
|
|
7
|
+
"@types/big.js": "^6.1.3",
|
|
8
|
+
"@types/react-is": "^17.0.3",
|
|
7
9
|
"@types/resize-observer-browser": "^0.1.7",
|
|
8
10
|
"@use-gesture/react": "^10.2.10",
|
|
9
11
|
"ahooks": "^3.1.14",
|
|
10
12
|
"antd-mobile-icons": "^0.2.2",
|
|
11
13
|
"antd-mobile-v5-count": "^1.0.1",
|
|
14
|
+
"big.js": "^6.1.1",
|
|
12
15
|
"classnames": "^2.3.1",
|
|
13
16
|
"dayjs": "^1.11.0",
|
|
14
17
|
"lodash": "^4.17.21",
|
|
15
18
|
"rc-field-form": "^1.24.0",
|
|
19
|
+
"react-is": "^17.0.2",
|
|
16
20
|
"staged-components": "^1.1.2",
|
|
17
21
|
"tslib": "^2.3.1"
|
|
18
22
|
},
|
|
@@ -6,11 +6,13 @@ var classNames = require("classnames");
|
|
|
6
6
|
var ahooks = require("ahooks");
|
|
7
7
|
var web = require("@react-spring/web");
|
|
8
8
|
var dayjs = require("dayjs");
|
|
9
|
+
var reactIs = require("react-is");
|
|
9
10
|
var react = require("@use-gesture/react");
|
|
10
11
|
var antdMobileIcons = require("antd-mobile-icons");
|
|
11
12
|
var stagedComponents = require("staged-components");
|
|
12
13
|
var RcForm = require("rc-field-form");
|
|
13
14
|
var dom = require("@floating-ui/dom");
|
|
15
|
+
var Big = require("big.js");
|
|
14
16
|
function _interopDefaultLegacy(e) {
|
|
15
17
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
16
18
|
}
|
|
@@ -18,6 +20,7 @@ var React__default = /* @__PURE__ */ _interopDefaultLegacy(React$1);
|
|
|
18
20
|
var classNames__default = /* @__PURE__ */ _interopDefaultLegacy(classNames);
|
|
19
21
|
var dayjs__default = /* @__PURE__ */ _interopDefaultLegacy(dayjs);
|
|
20
22
|
var RcForm__default = /* @__PURE__ */ _interopDefaultLegacy(RcForm);
|
|
23
|
+
var Big__default = /* @__PURE__ */ _interopDefaultLegacy(Big);
|
|
21
24
|
var global$1 = "";
|
|
22
25
|
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
23
26
|
if (canUseDom) {
|
|
@@ -9144,6 +9147,20 @@ const ScrollMask = (props) => {
|
|
|
9144
9147
|
}
|
|
9145
9148
|
}));
|
|
9146
9149
|
};
|
|
9150
|
+
function traverseReactNode(children, fn) {
|
|
9151
|
+
let i = 0;
|
|
9152
|
+
function handle(target) {
|
|
9153
|
+
React__default["default"].Children.forEach(target, (child) => {
|
|
9154
|
+
if (!reactIs.isFragment(child)) {
|
|
9155
|
+
fn(child, i);
|
|
9156
|
+
i += 1;
|
|
9157
|
+
} else {
|
|
9158
|
+
handle(child.props.children);
|
|
9159
|
+
}
|
|
9160
|
+
});
|
|
9161
|
+
}
|
|
9162
|
+
handle(children);
|
|
9163
|
+
}
|
|
9147
9164
|
const classPrefix$15 = `adm-capsule-tabs`;
|
|
9148
9165
|
const CapsuleTab = () => {
|
|
9149
9166
|
return null;
|
|
@@ -9155,7 +9172,7 @@ const CapsuleTabs = (props) => {
|
|
|
9155
9172
|
const keyToIndexRecord = {};
|
|
9156
9173
|
let firstActiveKey = null;
|
|
9157
9174
|
const panes = [];
|
|
9158
|
-
|
|
9175
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
9159
9176
|
if (!React__default["default"].isValidElement(child))
|
|
9160
9177
|
return;
|
|
9161
9178
|
const key = child.key;
|
|
@@ -9673,6 +9690,7 @@ const Wheel = React$1.memo((props) => {
|
|
|
9673
9690
|
className: `${classPrefix$13}-column-wheel`,
|
|
9674
9691
|
"aria-hidden": true
|
|
9675
9692
|
}, column.map((item, index2) => {
|
|
9693
|
+
var _a;
|
|
9676
9694
|
const selected = props.value === item.value;
|
|
9677
9695
|
if (selected)
|
|
9678
9696
|
selectedIndex = index2;
|
|
@@ -9681,7 +9699,7 @@ const Wheel = React$1.memo((props) => {
|
|
|
9681
9699
|
scrollSelect(index2);
|
|
9682
9700
|
}
|
|
9683
9701
|
return React__default["default"].createElement("div", {
|
|
9684
|
-
key: item.value,
|
|
9702
|
+
key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
|
|
9685
9703
|
"data-selected": item.value === value,
|
|
9686
9704
|
className: `${classPrefix$13}-column-item`,
|
|
9687
9705
|
onClick: handleClick,
|
|
@@ -10058,7 +10076,7 @@ const Tabs$1 = (p) => {
|
|
|
10058
10076
|
const keyToIndexRecord = {};
|
|
10059
10077
|
let firstActiveKey = null;
|
|
10060
10078
|
const panes = [];
|
|
10061
|
-
|
|
10079
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
10062
10080
|
if (!React__default["default"].isValidElement(child))
|
|
10063
10081
|
return;
|
|
10064
10082
|
const key = child.key;
|
|
@@ -10921,7 +10939,7 @@ const CollapsePanelContent = (props) => {
|
|
|
10921
10939
|
const Collapse = (props) => {
|
|
10922
10940
|
var _a;
|
|
10923
10941
|
const panels = [];
|
|
10924
|
-
|
|
10942
|
+
traverseReactNode(props.children, (child) => {
|
|
10925
10943
|
if (!React__default["default"].isValidElement(child))
|
|
10926
10944
|
return;
|
|
10927
10945
|
const key = child.key;
|
|
@@ -11733,12 +11751,13 @@ var index$b = attachPropertiesToComponent(Dialog, {
|
|
|
11733
11751
|
var divider = "";
|
|
11734
11752
|
const classPrefix$R = `adm-divider`;
|
|
11735
11753
|
const defaultProps$E = {
|
|
11736
|
-
contentPosition: "center"
|
|
11754
|
+
contentPosition: "center",
|
|
11755
|
+
direction: "horizontal"
|
|
11737
11756
|
};
|
|
11738
11757
|
const Divider = (p) => {
|
|
11739
11758
|
const props = mergeProps(defaultProps$E, p);
|
|
11740
11759
|
return withNativeProps(props, React__default["default"].createElement("div", {
|
|
11741
|
-
className: classNames__default["default"](classPrefix$R, `${classPrefix$R}-${props.contentPosition}`)
|
|
11760
|
+
className: classNames__default["default"](classPrefix$R, `${classPrefix$R}-${props.direction}`, `${classPrefix$R}-${props.contentPosition}`)
|
|
11742
11761
|
}, props.children && React__default["default"].createElement("div", {
|
|
11743
11762
|
className: `${classPrefix$R}-content`
|
|
11744
11763
|
}, props.children)));
|
|
@@ -12891,7 +12910,7 @@ const Form$1 = React$1.forwardRef((p, ref) => {
|
|
|
12891
12910
|
}, items));
|
|
12892
12911
|
items = [];
|
|
12893
12912
|
}
|
|
12894
|
-
|
|
12913
|
+
traverseReactNode(props.children, (child) => {
|
|
12895
12914
|
if (React__default["default"].isValidElement(child)) {
|
|
12896
12915
|
if (child.type === Header) {
|
|
12897
12916
|
collect();
|
|
@@ -14022,7 +14041,8 @@ const PreviewItem = (props) => {
|
|
|
14022
14041
|
url,
|
|
14023
14042
|
file,
|
|
14024
14043
|
deletable,
|
|
14025
|
-
onDelete
|
|
14044
|
+
onDelete,
|
|
14045
|
+
imageFit
|
|
14026
14046
|
} = props;
|
|
14027
14047
|
const src = React$1.useMemo(() => {
|
|
14028
14048
|
if (url) {
|
|
@@ -14057,7 +14077,7 @@ const PreviewItem = (props) => {
|
|
|
14057
14077
|
}, React__default["default"].createElement(Image$1, {
|
|
14058
14078
|
className: `${classPrefix$B}-cell-image`,
|
|
14059
14079
|
src,
|
|
14060
|
-
fit:
|
|
14080
|
+
fit: imageFit,
|
|
14061
14081
|
onClick: props.onClick
|
|
14062
14082
|
}), renderLoading(), renderDelete());
|
|
14063
14083
|
};
|
|
@@ -14097,7 +14117,8 @@ const defaultProps$t = {
|
|
|
14097
14117
|
defaultValue: [],
|
|
14098
14118
|
accept: "image/*",
|
|
14099
14119
|
preview: true,
|
|
14100
|
-
showFailed: true
|
|
14120
|
+
showFailed: true,
|
|
14121
|
+
imageFit: "cover"
|
|
14101
14122
|
};
|
|
14102
14123
|
const ImageUploader = (p) => {
|
|
14103
14124
|
const props = mergeProps(defaultProps$t, p);
|
|
@@ -14223,6 +14244,7 @@ const ImageUploader = (p) => {
|
|
|
14223
14244
|
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
|
|
14224
14245
|
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
14225
14246
|
deletable: props.deletable,
|
|
14247
|
+
imageFit: props.imageFit,
|
|
14226
14248
|
onClick: () => {
|
|
14227
14249
|
if (props.preview) {
|
|
14228
14250
|
previewImage(index2);
|
|
@@ -14246,6 +14268,7 @@ const ImageUploader = (p) => {
|
|
|
14246
14268
|
file: task.file,
|
|
14247
14269
|
deletable: task.status !== "pending",
|
|
14248
14270
|
status: task.status,
|
|
14271
|
+
imageFit: props.imageFit,
|
|
14249
14272
|
onDelete: () => {
|
|
14250
14273
|
setTasks(tasks.filter((x) => x.id !== task.id));
|
|
14251
14274
|
}
|
|
@@ -14343,7 +14366,7 @@ const IndexBar = React$1.forwardRef((p, ref) => {
|
|
|
14343
14366
|
const bodyRef = React$1.useRef(null);
|
|
14344
14367
|
const indexItems = [];
|
|
14345
14368
|
const panels = [];
|
|
14346
|
-
|
|
14369
|
+
traverseReactNode(props.children, (child) => {
|
|
14347
14370
|
var _a;
|
|
14348
14371
|
if (!React__default["default"].isValidElement(child))
|
|
14349
14372
|
return;
|
|
@@ -14611,7 +14634,7 @@ const JumboTabs = (props) => {
|
|
|
14611
14634
|
const keyToIndexRecord = {};
|
|
14612
14635
|
let firstActiveKey = null;
|
|
14613
14636
|
const panes = [];
|
|
14614
|
-
|
|
14637
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
14615
14638
|
if (!React__default["default"].isValidElement(child))
|
|
14616
14639
|
return;
|
|
14617
14640
|
const key = child.key;
|
|
@@ -15909,7 +15932,7 @@ const SideBar = (props) => {
|
|
|
15909
15932
|
var _a;
|
|
15910
15933
|
let firstActiveKey = null;
|
|
15911
15934
|
const items = [];
|
|
15912
|
-
|
|
15935
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
15913
15936
|
if (!React__default["default"].isValidElement(child))
|
|
15914
15937
|
return;
|
|
15915
15938
|
const key = child.key;
|
|
@@ -16285,12 +16308,12 @@ const Stepper = (p) => {
|
|
|
16285
16308
|
inputReadOnly
|
|
16286
16309
|
} = props;
|
|
16287
16310
|
const [value, setValue] = usePropsValue(props);
|
|
16288
|
-
const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value));
|
|
16311
|
+
const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value, props.digits));
|
|
16289
16312
|
function setValueWithCheck(v) {
|
|
16290
16313
|
if (isNaN(v))
|
|
16291
16314
|
return;
|
|
16292
16315
|
let target = bound(v, props.min, props.max);
|
|
16293
|
-
if (props.digits
|
|
16316
|
+
if (props.digits !== void 0) {
|
|
16294
16317
|
target = parseFloat(target.toFixed(props.digits));
|
|
16295
16318
|
}
|
|
16296
16319
|
setValue(target);
|
|
@@ -16298,12 +16321,12 @@ const Stepper = (p) => {
|
|
|
16298
16321
|
const [hasFocus, setHasFocus] = React$1.useState(false);
|
|
16299
16322
|
React$1.useEffect(() => {
|
|
16300
16323
|
if (!hasFocus) {
|
|
16301
|
-
setInputValue(convertValueToText(value));
|
|
16324
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
16302
16325
|
}
|
|
16303
16326
|
}, [hasFocus]);
|
|
16304
16327
|
React$1.useEffect(() => {
|
|
16305
16328
|
if (!hasFocus) {
|
|
16306
|
-
setInputValue(convertValueToText(value));
|
|
16329
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
16307
16330
|
}
|
|
16308
16331
|
}, [value]);
|
|
16309
16332
|
const handleInputChange = (v) => {
|
|
@@ -16320,10 +16343,10 @@ const Stepper = (p) => {
|
|
|
16320
16343
|
}
|
|
16321
16344
|
};
|
|
16322
16345
|
const handleMinus = () => {
|
|
16323
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
16346
|
+
setValueWithCheck(Big__default["default"](value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
|
|
16324
16347
|
};
|
|
16325
16348
|
const handlePlus = () => {
|
|
16326
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
16349
|
+
setValueWithCheck(Big__default["default"](value !== null && value !== void 0 ? value : 0).add(step).toNumber());
|
|
16327
16350
|
};
|
|
16328
16351
|
const minusDisabled = () => {
|
|
16329
16352
|
if (disabled)
|
|
@@ -16385,10 +16408,14 @@ const Stepper = (p) => {
|
|
|
16385
16408
|
color: "primary"
|
|
16386
16409
|
}, React__default["default"].createElement(antdMobileIcons.AddOutline, null))));
|
|
16387
16410
|
};
|
|
16388
|
-
function convertValueToText(value) {
|
|
16411
|
+
function convertValueToText(value, digits) {
|
|
16389
16412
|
if (value === null)
|
|
16390
16413
|
return "";
|
|
16391
|
-
|
|
16414
|
+
if (digits !== void 0) {
|
|
16415
|
+
return value.toFixed(digits);
|
|
16416
|
+
} else {
|
|
16417
|
+
return value.toString();
|
|
16418
|
+
}
|
|
16392
16419
|
}
|
|
16393
16420
|
function convertTextToValue(text) {
|
|
16394
16421
|
if (text === "")
|
|
@@ -16980,7 +17007,7 @@ const TabBar = (p) => {
|
|
|
16980
17007
|
const props = mergeProps(defaultProps$7, p);
|
|
16981
17008
|
let firstActiveKey = null;
|
|
16982
17009
|
const items = [];
|
|
16983
|
-
|
|
17010
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
16984
17011
|
if (!React__default["default"].isValidElement(child))
|
|
16985
17012
|
return;
|
|
16986
17013
|
const key = child.key;
|