antd-mobile 5.21.0 → 5.23.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/bundle/antd-mobile.cjs.development.js +25816 -0
- package/2x/bundle/antd-mobile.cjs.js +8 -32
- package/2x/bundle/antd-mobile.compatible.umd.js +12093 -12569
- package/2x/bundle/antd-mobile.es.development.js +25796 -0
- package/2x/bundle/antd-mobile.es.js +8578 -8861
- package/2x/bundle/antd-mobile.umd.development.js +25818 -0
- package/2x/bundle/antd-mobile.umd.js +8 -32
- package/2x/bundle/style.css +149 -44
- package/2x/cjs/components/action-sheet/action-sheet.css +6 -2
- package/2x/cjs/components/action-sheet/action-sheet.d.ts +1 -0
- package/2x/cjs/components/action-sheet/action-sheet.js +2 -1
- package/2x/cjs/components/avatar/avatar.js +2 -2
- package/2x/cjs/components/check-list/check-list.css +1 -1
- package/2x/cjs/components/dialog/dialog-action-button.d.ts +2 -2
- package/2x/cjs/components/ellipsis/ellipsis.js +1 -0
- package/2x/cjs/components/empty/empty.d.ts +1 -0
- package/2x/cjs/components/empty/empty.js +1 -0
- package/2x/cjs/components/floating-panel/floating-panel.js +2 -2
- package/2x/cjs/components/footer/footer.css +60 -0
- package/2x/cjs/components/footer/footer.d.ts +19 -0
- package/2x/cjs/components/footer/footer.js +83 -0
- package/2x/cjs/components/footer/index.d.ts +4 -0
- package/2x/cjs/components/footer/index.js +13 -0
- package/2x/cjs/components/image-uploader/image-uploader.d.ts +11 -1
- package/2x/cjs/components/image-uploader/image-uploader.js +42 -25
- package/2x/cjs/components/image-uploader/index.d.ts +1 -1
- package/2x/cjs/components/image-uploader/preview-item.js +5 -0
- package/2x/cjs/components/image-viewer/image-viewer.js +4 -2
- package/2x/cjs/components/image-viewer/slides.js +2 -2
- package/2x/cjs/components/index-bar/index-bar.css +1 -1
- package/2x/cjs/components/page-indicator/page-indicator.css +2 -1
- package/2x/cjs/components/picker/index.d.ts +2 -2
- package/2x/cjs/components/picker/picker.d.ts +1 -1
- package/2x/cjs/components/picker-view/picker-view.css +9 -0
- package/2x/cjs/components/picker-view/wheel.js +8 -4
- package/2x/cjs/components/rate/rate.css +6 -1
- package/2x/cjs/components/rate/rate.js +3 -1
- package/2x/cjs/components/selector/selector.css +10 -0
- package/2x/cjs/components/selector/selector.d.ts +3 -2
- package/2x/cjs/components/selector/selector.js +1 -4
- package/2x/cjs/components/slider/slider.css +15 -1
- package/2x/cjs/components/slider/slider.d.ts +1 -0
- package/2x/cjs/components/slider/slider.js +13 -2
- package/2x/cjs/components/slider/thumb.d.ts +1 -0
- package/2x/cjs/components/slider/thumb.js +4 -3
- package/2x/cjs/components/tab-bar/tab-bar.css +2 -2
- package/2x/cjs/components/toast/toast.css +4 -3
- package/2x/cjs/index.d.ts +1 -0
- package/2x/cjs/index.js +8 -0
- package/2x/cjs/locales/zh-CN.js +1 -1
- package/2x/cjs/utils/measure-css-length.js +1 -1
- package/2x/es/components/action-sheet/action-sheet.css +6 -2
- package/2x/es/components/action-sheet/action-sheet.d.ts +1 -0
- package/2x/es/components/action-sheet/action-sheet.js +2 -1
- package/2x/es/components/avatar/avatar.js +1 -1
- package/2x/es/components/check-list/check-list.css +1 -1
- package/2x/es/components/dialog/dialog-action-button.d.ts +2 -2
- package/2x/es/components/ellipsis/ellipsis.js +1 -0
- package/2x/es/components/empty/empty.d.ts +1 -0
- package/2x/es/components/empty/empty.js +2 -0
- package/2x/es/components/floating-panel/floating-panel.js +2 -2
- package/2x/es/components/footer/footer.css +60 -0
- package/2x/es/components/footer/footer.d.ts +19 -0
- package/2x/es/components/footer/footer.js +66 -0
- package/2x/es/components/footer/index.d.ts +4 -0
- package/2x/es/components/footer/index.js +3 -0
- package/2x/es/components/image-uploader/image-uploader.d.ts +11 -1
- package/2x/es/components/image-uploader/image-uploader.js +41 -25
- package/2x/es/components/image-uploader/index.d.ts +1 -1
- package/2x/es/components/image-uploader/preview-item.js +6 -1
- package/2x/es/components/image-viewer/image-viewer.js +4 -2
- package/2x/es/components/image-viewer/slides.js +2 -2
- package/2x/es/components/index-bar/index-bar.css +1 -1
- package/2x/es/components/page-indicator/page-indicator.css +2 -1
- package/2x/es/components/picker/index.d.ts +2 -2
- package/2x/es/components/picker/picker.d.ts +1 -1
- package/2x/es/components/picker-view/picker-view.css +9 -0
- package/2x/es/components/picker-view/wheel.js +8 -4
- package/2x/es/components/rate/rate.css +6 -1
- package/2x/es/components/rate/rate.js +3 -1
- package/2x/es/components/selector/selector.css +10 -0
- package/2x/es/components/selector/selector.d.ts +3 -2
- package/2x/es/components/selector/selector.js +1 -3
- package/2x/es/components/slider/slider.css +15 -1
- package/2x/es/components/slider/slider.d.ts +1 -0
- package/2x/es/components/slider/slider.js +12 -2
- package/2x/es/components/slider/thumb.d.ts +1 -0
- package/2x/es/components/slider/thumb.js +4 -3
- package/2x/es/components/tab-bar/tab-bar.css +2 -2
- package/2x/es/components/toast/toast.css +4 -3
- package/2x/es/index.d.ts +1 -0
- package/2x/es/index.js +1 -0
- package/2x/es/locales/zh-CN.js +1 -1
- package/2x/es/utils/measure-css-length.js +1 -1
- package/2x/package.json +1 -1
- package/2x/umd/antd-mobile.js +12093 -12569
- package/bundle/antd-mobile.cjs.development.js +25816 -0
- package/bundle/antd-mobile.cjs.js +8 -32
- package/bundle/antd-mobile.compatible.umd.js +12093 -12569
- package/bundle/antd-mobile.es.development.js +25796 -0
- package/bundle/antd-mobile.es.js +8578 -8861
- package/bundle/antd-mobile.umd.development.js +25818 -0
- package/bundle/antd-mobile.umd.js +8 -32
- package/bundle/style.css +1 -1
- package/cjs/components/action-sheet/action-sheet.css +5 -2
- package/cjs/components/action-sheet/action-sheet.d.ts +1 -0
- package/cjs/components/action-sheet/action-sheet.js +2 -1
- package/cjs/components/avatar/avatar.js +2 -2
- package/cjs/components/check-list/check-list.css +1 -1
- package/cjs/components/dialog/dialog-action-button.d.ts +2 -2
- package/cjs/components/ellipsis/ellipsis.js +1 -0
- package/cjs/components/empty/empty.d.ts +1 -0
- package/cjs/components/empty/empty.js +1 -0
- package/cjs/components/floating-panel/floating-panel.js +2 -2
- package/cjs/components/footer/footer.css +51 -0
- package/cjs/components/footer/footer.d.ts +19 -0
- package/cjs/components/footer/footer.js +83 -0
- package/cjs/components/footer/index.d.ts +4 -0
- package/cjs/components/footer/index.js +13 -0
- package/cjs/components/image-uploader/image-uploader.d.ts +11 -1
- package/cjs/components/image-uploader/image-uploader.js +42 -25
- package/cjs/components/image-uploader/index.d.ts +1 -1
- package/cjs/components/image-uploader/preview-item.js +5 -0
- package/cjs/components/image-viewer/image-viewer.js +4 -2
- package/cjs/components/image-viewer/slides.js +2 -2
- package/cjs/components/index-bar/index-bar.css +1 -1
- package/cjs/components/page-indicator/page-indicator.css +2 -1
- package/cjs/components/picker/index.d.ts +2 -2
- package/cjs/components/picker/picker.d.ts +1 -1
- package/cjs/components/picker-view/picker-view.css +8 -0
- package/cjs/components/picker-view/wheel.js +8 -4
- package/cjs/components/rate/rate.css +5 -1
- package/cjs/components/rate/rate.js +3 -1
- package/cjs/components/selector/selector.css +9 -0
- package/cjs/components/selector/selector.d.ts +3 -2
- package/cjs/components/selector/selector.js +1 -4
- package/cjs/components/slider/slider.css +14 -1
- package/cjs/components/slider/slider.d.ts +1 -0
- package/cjs/components/slider/slider.js +13 -2
- package/cjs/components/slider/thumb.d.ts +1 -0
- package/cjs/components/slider/thumb.js +4 -3
- package/cjs/components/tab-bar/tab-bar.css +2 -2
- package/cjs/components/toast/toast.css +4 -3
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +8 -0
- package/cjs/locales/zh-CN.js +1 -1
- package/cjs/utils/measure-css-length.js +1 -1
- package/es/components/action-sheet/action-sheet.css +5 -2
- package/es/components/action-sheet/action-sheet.d.ts +1 -0
- package/es/components/action-sheet/action-sheet.js +2 -1
- package/es/components/avatar/avatar.js +1 -1
- package/es/components/check-list/check-list.css +1 -1
- package/es/components/dialog/dialog-action-button.d.ts +2 -2
- package/es/components/ellipsis/ellipsis.js +1 -0
- package/es/components/empty/empty.d.ts +1 -0
- package/es/components/empty/empty.js +2 -0
- package/es/components/floating-panel/floating-panel.js +2 -2
- package/es/components/footer/footer.css +51 -0
- package/es/components/footer/footer.d.ts +19 -0
- package/es/components/footer/footer.js +66 -0
- package/es/components/footer/index.d.ts +4 -0
- package/es/components/footer/index.js +3 -0
- package/es/components/image-uploader/image-uploader.d.ts +11 -1
- package/es/components/image-uploader/image-uploader.js +41 -25
- package/es/components/image-uploader/index.d.ts +1 -1
- package/es/components/image-uploader/preview-item.js +6 -1
- package/es/components/image-viewer/image-viewer.js +4 -2
- package/es/components/image-viewer/slides.js +2 -2
- package/es/components/index-bar/index-bar.css +1 -1
- package/es/components/page-indicator/page-indicator.css +2 -1
- package/es/components/picker/index.d.ts +2 -2
- package/es/components/picker/picker.d.ts +1 -1
- package/es/components/picker-view/picker-view.css +8 -0
- package/es/components/picker-view/wheel.js +8 -4
- package/es/components/rate/rate.css +5 -1
- package/es/components/rate/rate.js +3 -1
- package/es/components/selector/selector.css +9 -0
- package/es/components/selector/selector.d.ts +3 -2
- package/es/components/selector/selector.js +1 -3
- package/es/components/slider/slider.css +14 -1
- package/es/components/slider/slider.d.ts +1 -0
- package/es/components/slider/slider.js +12 -2
- package/es/components/slider/thumb.d.ts +1 -0
- package/es/components/slider/thumb.js +4 -3
- package/es/components/tab-bar/tab-bar.css +2 -2
- package/es/components/toast/toast.css +4 -3
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locales/zh-CN.js +1 -1
- package/es/utils/measure-css-length.js +1 -1
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
package/cjs/locales/zh-CN.js
CHANGED
|
@@ -12,7 +12,7 @@ var _devLog = require("./dev-log");
|
|
|
12
12
|
function measureCSSLength(raw) {
|
|
13
13
|
if (raw === null || raw === undefined || raw === '') {
|
|
14
14
|
if (_isDev.isDev) {
|
|
15
|
-
(0, _devLog.devError)('Global', '
|
|
15
|
+
(0, _devLog.devError)('Global', 'Something went wrong when calculating CSS length. Please report an issue at https://github.com/ant-design/ant-design-mobile/issues/new/choose');
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
return 0;
|
|
@@ -39,13 +39,16 @@
|
|
|
39
39
|
font-size: var(--adm-font-size-10);
|
|
40
40
|
}
|
|
41
41
|
.adm-action-sheet-button-item-description {
|
|
42
|
-
font-size: var(--adm-font-size-
|
|
42
|
+
font-size: var(--adm-font-size-6);
|
|
43
43
|
color: var(--adm-color-weak);
|
|
44
|
-
padding-top:
|
|
44
|
+
padding-top: 4px;
|
|
45
45
|
}
|
|
46
46
|
.adm-action-sheet-button-item-danger .adm-action-sheet-button-item-name {
|
|
47
47
|
color: var(--adm-color-danger);
|
|
48
48
|
}
|
|
49
|
+
.adm-action-sheet-button-item-bold .adm-action-sheet-button-item-name {
|
|
50
|
+
font-weight: bold;
|
|
51
|
+
}
|
|
49
52
|
.adm-action-sheet-cancel {
|
|
50
53
|
background-color: var(--adm-color-box);
|
|
51
54
|
padding-top: 8px;
|
|
@@ -47,7 +47,8 @@ export const ActionSheet = p => {
|
|
|
47
47
|
}, React.createElement("a", {
|
|
48
48
|
className: classNames('adm-plain-anchor', `${classPrefix}-button-item`, {
|
|
49
49
|
[`${classPrefix}-button-item-danger`]: action.danger,
|
|
50
|
-
[`${classPrefix}-button-item-disabled`]: action.disabled
|
|
50
|
+
[`${classPrefix}-button-item-disabled`]: action.disabled,
|
|
51
|
+
[`${classPrefix}-button-item-bold`]: action.bold
|
|
51
52
|
}),
|
|
52
53
|
onClick: () => {
|
|
53
54
|
var _a, _b, _c;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { withNativeProps } from '../../utils/native-props';
|
|
3
|
-
import
|
|
3
|
+
import Image from '../image';
|
|
4
4
|
import { mergeProps } from '../../utils/with-default-props';
|
|
5
5
|
import { Fallback } from './fallback';
|
|
6
6
|
const classPrefix = 'adm-avatar';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type Action = {
|
|
4
4
|
key: string | number;
|
|
5
|
-
text:
|
|
5
|
+
text: ReactNode;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
danger?: boolean;
|
|
8
8
|
bold?: boolean;
|
|
@@ -23,6 +23,7 @@ export const Ellipsis = p => {
|
|
|
23
23
|
function calcEllipsised() {
|
|
24
24
|
const root = rootRef.current;
|
|
25
25
|
if (!root) return;
|
|
26
|
+
if (!root.offsetParent) return;
|
|
26
27
|
const originStyle = window.getComputedStyle(root);
|
|
27
28
|
const container = document.createElement('div');
|
|
28
29
|
const styleNames = Array.prototype.slice.apply(originStyle);
|
|
@@ -3,6 +3,8 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
4
|
import { EmptyIcon } from './empty-icon';
|
|
5
5
|
const classPrefix = `adm-empty`;
|
|
6
|
+
/** @deprecated Empty has been deprecated and will be removed in the next major version. */
|
|
7
|
+
|
|
6
8
|
export const Empty = props => {
|
|
7
9
|
function renderImageNode() {
|
|
8
10
|
const {
|
|
@@ -113,8 +113,8 @@ export const FloatingPanel = forwardRef((p, ref) => {
|
|
|
113
113
|
ref: elementRef,
|
|
114
114
|
className: 'adm-floating-panel',
|
|
115
115
|
style: {
|
|
116
|
-
height: maxHeight,
|
|
117
|
-
translateY: y.to(y => `calc(100% + (${y}px))`)
|
|
116
|
+
height: Math.round(maxHeight),
|
|
117
|
+
translateY: y.to(y => `calc(100% + (${Math.round(y)}px))`)
|
|
118
118
|
}
|
|
119
119
|
}, React.createElement("div", {
|
|
120
120
|
className: 'adm-floating-panel-mask',
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.adm-footer {
|
|
2
|
+
--background-color: var(--adm-color-background);
|
|
3
|
+
color: var(--adm-color-text);
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
align-items: center;
|
|
7
|
+
background-color: var(--background-color);
|
|
8
|
+
}
|
|
9
|
+
.adm-footer-label {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
.adm-footer-label .adm-divider.adm-divider {
|
|
13
|
+
color: var(--adm-color-light);
|
|
14
|
+
}
|
|
15
|
+
.adm-footer-links {
|
|
16
|
+
margin: 8px 0;
|
|
17
|
+
color: var(--adm-color-primary);
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
}
|
|
20
|
+
.adm-footer-links a {
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
}
|
|
23
|
+
.adm-footer-content {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
margin: 8px 0;
|
|
27
|
+
color: var(--adm-color-light);
|
|
28
|
+
}
|
|
29
|
+
.adm-footer-chips {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
margin: 8px 0;
|
|
34
|
+
}
|
|
35
|
+
.adm-footer-chip {
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
margin-right: 20px;
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
background-color: var(--adm-color-box);
|
|
40
|
+
color: var(--adm-color-weak);
|
|
41
|
+
padding: 4px 12px;
|
|
42
|
+
border-radius: 100px;
|
|
43
|
+
}
|
|
44
|
+
.adm-footer-chip-link {
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
background-color: #e7f1ff;
|
|
47
|
+
color: var(--adm-color-primary);
|
|
48
|
+
}
|
|
49
|
+
.adm-footer-chip:last-child {
|
|
50
|
+
margin-right: 0;
|
|
51
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
export declare type LinkItem = {
|
|
4
|
+
text: string;
|
|
5
|
+
href: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type ChipItem = {
|
|
8
|
+
text: ReactNode;
|
|
9
|
+
type?: 'plain' | 'link';
|
|
10
|
+
};
|
|
11
|
+
export declare type FooterProps = {
|
|
12
|
+
label?: ReactNode;
|
|
13
|
+
links?: LinkItem[];
|
|
14
|
+
content?: ReactNode;
|
|
15
|
+
chips?: ChipItem[];
|
|
16
|
+
onChipClick?: (item: ChipItem, index: number) => void;
|
|
17
|
+
onLinkClick?: (item: LinkItem, index: number) => void;
|
|
18
|
+
} & NativeProps<'--background-color'>;
|
|
19
|
+
export declare const Footer: FC<FooterProps>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
4
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
5
|
+
import { Divider } from '../divider/divider';
|
|
6
|
+
const classPrefix = `adm-footer`;
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
label: '',
|
|
9
|
+
links: [],
|
|
10
|
+
content: '',
|
|
11
|
+
chips: []
|
|
12
|
+
};
|
|
13
|
+
export const Footer = p => {
|
|
14
|
+
const props = mergeProps(defaultProps, p);
|
|
15
|
+
const {
|
|
16
|
+
label,
|
|
17
|
+
links,
|
|
18
|
+
content,
|
|
19
|
+
chips,
|
|
20
|
+
onChipClick,
|
|
21
|
+
onLinkClick
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
const clickChipItem = (item, index) => {
|
|
25
|
+
if ((chips === null || chips === void 0 ? void 0 : chips.length) && item.type === 'link') {
|
|
26
|
+
onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick(item, index);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const clickLinkItem = (item, index, e) => {
|
|
31
|
+
if (onLinkClick) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
onLinkClick(item, index);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return withNativeProps(props, React.createElement("div", {
|
|
38
|
+
className: classNames(classPrefix)
|
|
39
|
+
}, label && React.createElement("div", {
|
|
40
|
+
className: `${classPrefix}-label`
|
|
41
|
+
}, React.createElement(Divider, null, label)), links && links.length > 0 && React.createElement("div", {
|
|
42
|
+
className: `${classPrefix}-links`
|
|
43
|
+
}, links.map((link, index) => {
|
|
44
|
+
return React.createElement(React.Fragment, {
|
|
45
|
+
key: index
|
|
46
|
+
}, React.createElement("a", {
|
|
47
|
+
href: link.href,
|
|
48
|
+
rel: 'noopener noreferrer',
|
|
49
|
+
onClick: event => clickLinkItem(link, index, event)
|
|
50
|
+
}, link.text), index !== links.length - 1 && React.createElement(Divider, {
|
|
51
|
+
direction: 'vertical'
|
|
52
|
+
}));
|
|
53
|
+
})), content && React.createElement("div", {
|
|
54
|
+
className: `${classPrefix}-content`
|
|
55
|
+
}, content), chips && chips.length > 0 && React.createElement("div", {
|
|
56
|
+
className: `${classPrefix}-chips`
|
|
57
|
+
}, chips.map((chip, index) => {
|
|
58
|
+
return React.createElement("div", {
|
|
59
|
+
key: index,
|
|
60
|
+
onClick: () => clickChipItem(chip, index),
|
|
61
|
+
className: classNames(`${classPrefix}-chip`, {
|
|
62
|
+
[`${classPrefix}-chip-link`]: chip.type === 'link'
|
|
63
|
+
})
|
|
64
|
+
}, chip.text);
|
|
65
|
+
}))));
|
|
66
|
+
};
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import React, { FC, InputHTMLAttributes } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import type { ImageProps } from '../image';
|
|
4
|
-
export declare type TaskStatus = 'pending' | 'fail';
|
|
4
|
+
export declare type TaskStatus = 'pending' | 'fail' | 'success';
|
|
5
5
|
export interface ImageUploadItem {
|
|
6
6
|
key?: string | number;
|
|
7
7
|
url: string;
|
|
8
8
|
thumbnailUrl?: string;
|
|
9
9
|
extra?: any;
|
|
10
10
|
}
|
|
11
|
+
declare type Task = {
|
|
12
|
+
id: number;
|
|
13
|
+
url?: string;
|
|
14
|
+
file: File;
|
|
15
|
+
status: TaskStatus;
|
|
16
|
+
};
|
|
17
|
+
export declare type UploadTask = Pick<Task, 'id' | 'status'>;
|
|
11
18
|
export declare type ImageUploaderProps = {
|
|
12
19
|
defaultValue?: ImageUploadItem[];
|
|
13
20
|
value?: ImageUploadItem[];
|
|
14
21
|
onChange?: (items: ImageUploadItem[]) => void;
|
|
22
|
+
onUploadQueueChange?: (tasks: UploadTask[]) => void;
|
|
15
23
|
accept?: string;
|
|
16
24
|
multiple?: boolean;
|
|
17
25
|
maxCount?: number;
|
|
@@ -28,5 +36,7 @@ export declare type ImageUploaderProps = {
|
|
|
28
36
|
showFailed?: boolean;
|
|
29
37
|
imageFit?: ImageProps['fit'];
|
|
30
38
|
children?: React.ReactNode;
|
|
39
|
+
renderItem?: (originNode: React.ReactElement, file: ImageUploadItem, fileList: ImageUploadItem[]) => React.ReactNode;
|
|
31
40
|
} & NativeProps<'--cell-size'>;
|
|
32
41
|
export declare const ImageUploader: FC<ImageUploaderProps>;
|
|
42
|
+
export {};
|
|
@@ -35,10 +35,19 @@ export const ImageUploader = p => {
|
|
|
35
35
|
return !value.some(fileItem => fileItem.url === task.url);
|
|
36
36
|
}));
|
|
37
37
|
}, [value]);
|
|
38
|
+
useIsomorphicLayoutEffect(() => {
|
|
39
|
+
var _a;
|
|
40
|
+
|
|
41
|
+
(_a = props.onUploadQueueChange) === null || _a === void 0 ? void 0 : _a.call(props, tasks.map(item => ({
|
|
42
|
+
id: item.id,
|
|
43
|
+
status: item.status
|
|
44
|
+
})));
|
|
45
|
+
}, [tasks]);
|
|
38
46
|
const idCountRef = useRef(0);
|
|
39
47
|
const {
|
|
40
48
|
maxCount,
|
|
41
|
-
onPreview
|
|
49
|
+
onPreview,
|
|
50
|
+
renderItem
|
|
42
51
|
} = props;
|
|
43
52
|
|
|
44
53
|
function processFile(file, fileList) {
|
|
@@ -99,6 +108,7 @@ export const ImageUploader = p => {
|
|
|
99
108
|
return prev.map(task => {
|
|
100
109
|
if (task.id === currentTask.id) {
|
|
101
110
|
return Object.assign(Object.assign({}, task), {
|
|
111
|
+
status: 'success',
|
|
102
112
|
url: result.url
|
|
103
113
|
});
|
|
104
114
|
}
|
|
@@ -146,36 +156,42 @@ export const ImageUploader = p => {
|
|
|
146
156
|
(_a = imageViewerHandlerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
147
157
|
});
|
|
148
158
|
const showUpload = props.showUpload && (maxCount === 0 || value.length + tasks.length < maxCount);
|
|
159
|
+
|
|
160
|
+
const renderImages = () => {
|
|
161
|
+
return value.map((fileItem, index) => {
|
|
162
|
+
var _a, _b;
|
|
163
|
+
|
|
164
|
+
const originNode = React.createElement(PreviewItem, {
|
|
165
|
+
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index,
|
|
166
|
+
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
167
|
+
deletable: props.deletable,
|
|
168
|
+
imageFit: props.imageFit,
|
|
169
|
+
onClick: () => {
|
|
170
|
+
if (props.preview) {
|
|
171
|
+
previewImage(index);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
onPreview && onPreview(index, fileItem);
|
|
175
|
+
},
|
|
176
|
+
onDelete: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
177
|
+
var _c;
|
|
178
|
+
|
|
179
|
+
const canDelete = yield (_c = props.onDelete) === null || _c === void 0 ? void 0 : _c.call(props, fileItem);
|
|
180
|
+
if (canDelete === false) return;
|
|
181
|
+
setValue(value.filter((x, i) => i !== index));
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
return renderItem ? renderItem(originNode, fileItem, value) : originNode;
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
|
|
149
188
|
return withNativeProps(props, React.createElement("div", {
|
|
150
189
|
className: classPrefix
|
|
151
190
|
}, React.createElement(Space, {
|
|
152
191
|
className: `${classPrefix}-space`,
|
|
153
192
|
wrap: true,
|
|
154
193
|
block: true
|
|
155
|
-
},
|
|
156
|
-
var _a, _b;
|
|
157
|
-
|
|
158
|
-
return React.createElement(PreviewItem, {
|
|
159
|
-
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index,
|
|
160
|
-
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
161
|
-
deletable: props.deletable,
|
|
162
|
-
imageFit: props.imageFit,
|
|
163
|
-
onClick: () => {
|
|
164
|
-
if (props.preview) {
|
|
165
|
-
previewImage(index);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
onPreview && onPreview(index, fileItem);
|
|
169
|
-
},
|
|
170
|
-
onDelete: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
171
|
-
var _c;
|
|
172
|
-
|
|
173
|
-
const canDelete = yield (_c = props.onDelete) === null || _c === void 0 ? void 0 : _c.call(props, fileItem);
|
|
174
|
-
if (canDelete === false) return;
|
|
175
|
-
setValue(value.filter((x, i) => i !== index));
|
|
176
|
-
})
|
|
177
|
-
});
|
|
178
|
-
}), tasks.map(task => {
|
|
194
|
+
}, renderImages(), tasks.map(task => {
|
|
179
195
|
if (!props.showFailed && task.status === 'fail') {
|
|
180
196
|
return null;
|
|
181
197
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ImageUploader } from './image-uploader';
|
|
2
2
|
import './image-uploader.less';
|
|
3
|
-
export type { ImageUploadItem, ImageUploaderProps } from './image-uploader';
|
|
3
|
+
export type { ImageUploadItem, ImageUploaderProps, UploadTask, } from './image-uploader';
|
|
4
4
|
export default ImageUploader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useLayoutEffect, useMemo } from 'react';
|
|
2
2
|
import { CloseOutline } from 'antd-mobile-icons';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import Image from '../image';
|
|
@@ -28,6 +28,11 @@ const PreviewItem = props => {
|
|
|
28
28
|
|
|
29
29
|
return '';
|
|
30
30
|
}, [url, file]);
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
return () => {
|
|
33
|
+
URL.revokeObjectURL(src);
|
|
34
|
+
};
|
|
35
|
+
}, [src]);
|
|
31
36
|
|
|
32
37
|
function renderLoading() {
|
|
33
38
|
return props.status === 'pending' && React.createElement("div", {
|
|
@@ -19,7 +19,8 @@ export const ImageViewer = p => {
|
|
|
19
19
|
visible: props.visible,
|
|
20
20
|
disableBodyScroll: false,
|
|
21
21
|
opacity: 'thick',
|
|
22
|
-
afterClose: props.afterClose
|
|
22
|
+
afterClose: props.afterClose,
|
|
23
|
+
destroyOnClose: true
|
|
23
24
|
}, React.createElement("div", {
|
|
24
25
|
className: `${classPrefix}-content`
|
|
25
26
|
}, props.image && React.createElement(Slide, {
|
|
@@ -64,7 +65,8 @@ export const MultiImageViewer = forwardRef((p, ref) => {
|
|
|
64
65
|
visible: props.visible,
|
|
65
66
|
disableBodyScroll: false,
|
|
66
67
|
opacity: 'thick',
|
|
67
|
-
afterClose: props.afterClose
|
|
68
|
+
afterClose: props.afterClose,
|
|
69
|
+
destroyOnClose: true
|
|
68
70
|
}, React.createElement("div", {
|
|
69
71
|
className: `${classPrefix}-content`
|
|
70
72
|
}, props.images && React.createElement(Slides, {
|
|
@@ -75,8 +75,8 @@ export const Slides = forwardRef((props, ref) => {
|
|
|
75
75
|
style: {
|
|
76
76
|
x: x.to(x => -x)
|
|
77
77
|
}
|
|
78
|
-
}, props.images.map(image => React.createElement(Slide, {
|
|
79
|
-
key:
|
|
78
|
+
}, props.images.map((image, index) => React.createElement(Slide, {
|
|
79
|
+
key: index,
|
|
80
80
|
image: image,
|
|
81
81
|
onTap: props.onTap,
|
|
82
82
|
maxZoom: props.maxZoom,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.adm-page-indicator {
|
|
2
2
|
display: flex;
|
|
3
3
|
width: auto;
|
|
4
|
-
--dot-color:
|
|
4
|
+
--dot-color: #dddddd;
|
|
5
5
|
--active-dot-color: var(--adm-color-primary);
|
|
6
6
|
--dot-size: 3px;
|
|
7
7
|
--active-dot-size: 13px;
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
background: var(--active-dot-color);
|
|
25
25
|
}
|
|
26
26
|
.adm-page-indicator-color-white {
|
|
27
|
+
--dot-color: rgba(255, 255, 255, 0.5);
|
|
27
28
|
--active-dot-color: var(--adm-color-white);
|
|
28
29
|
}
|
|
29
30
|
.adm-page-indicator-horizontal {
|
|
@@ -24,7 +24,7 @@ declare const _default: import("react").NamedExoticComponent<{
|
|
|
24
24
|
popupStyle?: import("react").CSSProperties | undefined;
|
|
25
25
|
} & Pick<import("../popup").PopupProps, "onClick" | "destroyOnClose" | "forceRender" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation"> & {
|
|
26
26
|
className?: string | undefined;
|
|
27
|
-
style?: (import("react").CSSProperties & Partial<Record<"--
|
|
27
|
+
style?: (import("react").CSSProperties & Partial<Record<"--header-button-font-size" | "--title-font-size" | "--item-font-size" | "--item-height", string>>) | undefined;
|
|
28
28
|
tabIndex?: number | undefined;
|
|
29
29
|
} & import("react").AriaAttributes & import("react").RefAttributes<import("./picker").PickerActions>> & {
|
|
30
30
|
readonly type: import("react").ForwardRefExoticComponent<{
|
|
@@ -49,7 +49,7 @@ declare const _default: import("react").NamedExoticComponent<{
|
|
|
49
49
|
popupStyle?: import("react").CSSProperties | undefined;
|
|
50
50
|
} & Pick<import("../popup").PopupProps, "onClick" | "destroyOnClose" | "forceRender" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation"> & {
|
|
51
51
|
className?: string | undefined;
|
|
52
|
-
style?: (import("react").CSSProperties & Partial<Record<"--
|
|
52
|
+
style?: (import("react").CSSProperties & Partial<Record<"--header-button-font-size" | "--title-font-size" | "--item-font-size" | "--item-height", string>>) | undefined;
|
|
53
53
|
tabIndex?: number | undefined;
|
|
54
54
|
} & import("react").AriaAttributes & import("react").RefAttributes<import("./picker").PickerActions>>;
|
|
55
55
|
} & {
|
|
@@ -51,6 +51,6 @@ export declare const Picker: React.MemoExoticComponent<React.ForwardRefExoticCom
|
|
|
51
51
|
popupStyle?: React.CSSProperties | undefined;
|
|
52
52
|
} & Pick<PopupProps, "onClick" | "destroyOnClose" | "forceRender" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation"> & {
|
|
53
53
|
className?: string | undefined;
|
|
54
|
-
style?: (React.CSSProperties & Partial<Record<"--
|
|
54
|
+
style?: (React.CSSProperties & Partial<Record<"--header-button-font-size" | "--title-font-size" | "--item-font-size" | "--item-height", string>>) | undefined;
|
|
55
55
|
tabIndex?: number | undefined;
|
|
56
56
|
} & React.AriaAttributes & React.RefAttributes<PickerActions>>>;
|
|
@@ -32,11 +32,12 @@ export const Wheel = memo(props => {
|
|
|
32
32
|
}));
|
|
33
33
|
const draggingRef = useRef(false);
|
|
34
34
|
const rootRef = useRef(null);
|
|
35
|
+
const itemHeightMeasureRef = useRef(null);
|
|
35
36
|
const itemHeight = useRef(34);
|
|
36
37
|
useIsomorphicLayoutEffect(() => {
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
39
|
-
itemHeight.current = measureCSSLength(window.getComputedStyle(
|
|
38
|
+
const itemHeightMeasure = itemHeightMeasureRef.current;
|
|
39
|
+
if (!itemHeightMeasure) return;
|
|
40
|
+
itemHeight.current = measureCSSLength(window.getComputedStyle(itemHeightMeasure).getPropertyValue('height'));
|
|
40
41
|
});
|
|
41
42
|
useIsomorphicLayoutEffect(() => {
|
|
42
43
|
if (draggingRef.current) return;
|
|
@@ -153,7 +154,10 @@ export const Wheel = memo(props => {
|
|
|
153
154
|
|
|
154
155
|
return React.createElement("div", {
|
|
155
156
|
className: `${classPrefix}-column`
|
|
156
|
-
}, React.createElement(
|
|
157
|
+
}, React.createElement("div", {
|
|
158
|
+
className: `${classPrefix}-item-height-measure`,
|
|
159
|
+
ref: itemHeightMeasureRef
|
|
160
|
+
}), React.createElement(animated.div, {
|
|
157
161
|
ref: rootRef,
|
|
158
162
|
style: {
|
|
159
163
|
translateY: y
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
.adm-rate {
|
|
2
2
|
--star-size: 24px;
|
|
3
3
|
--active-color: #ffd21e;
|
|
4
|
-
--inactive-color:
|
|
4
|
+
--inactive-color: #e5e5e5;
|
|
5
|
+
--inactive-color-half: #dbdbdb;
|
|
5
6
|
display: inline-flex;
|
|
6
7
|
touch-action: pan-y;
|
|
7
8
|
-webkit-user-select: none;
|
|
@@ -34,3 +35,6 @@
|
|
|
34
35
|
.adm-rate-star-readonly {
|
|
35
36
|
cursor: unset;
|
|
36
37
|
}
|
|
38
|
+
.adm-rate.adm-rate-half .adm-rate-star-half:not(.adm-rate-star-active) {
|
|
39
|
+
color: var(--inactive-color-half);
|
|
40
|
+
}
|
|
@@ -63,7 +63,9 @@ export const Rate = p => {
|
|
|
63
63
|
filterTaps: true
|
|
64
64
|
});
|
|
65
65
|
return withNativeProps(props, React.createElement("div", Object.assign({
|
|
66
|
-
className: classPrefix,
|
|
66
|
+
className: classNames(classPrefix, {
|
|
67
|
+
[`${classPrefix}-half`]: props.allowHalf
|
|
68
|
+
}),
|
|
67
69
|
role: 'radiogroup',
|
|
68
70
|
"aria-readonly": props.readOnly,
|
|
69
71
|
ref: containerRef
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
--checked-border: none;
|
|
8
8
|
--border-radius: 2px;
|
|
9
9
|
--padding: 8px 16px;
|
|
10
|
+
--gap: 8px;
|
|
11
|
+
---gap: var(--gap);
|
|
12
|
+
---gap-horizontal: var(--gap-horizontal, var(--gap));
|
|
13
|
+
---gap-vertical: var(--gap-vertical, var(--gap));
|
|
10
14
|
overflow: hidden;
|
|
11
15
|
font-size: var(--adm-font-size-7);
|
|
12
16
|
line-height: 1.4;
|
|
@@ -14,6 +18,11 @@
|
|
|
14
18
|
.adm-selector .adm-space.adm-space {
|
|
15
19
|
--gap: 12px;
|
|
16
20
|
}
|
|
21
|
+
.adm-selector .adm-grid {
|
|
22
|
+
--gap: var(---gap);
|
|
23
|
+
--gap-horizontal: var(---gap-horizontal);
|
|
24
|
+
--gap-vertical: var(---gap-vertical);
|
|
25
|
+
}
|
|
17
26
|
.adm-selector-item {
|
|
18
27
|
padding: var(--padding);
|
|
19
28
|
position: relative;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import { GridProps } from '../grid';
|
|
3
4
|
declare type SelectorValue = string | number;
|
|
4
5
|
export interface SelectorOption<V> {
|
|
5
6
|
label: ReactNode;
|
|
@@ -9,7 +10,7 @@ export interface SelectorOption<V> {
|
|
|
9
10
|
}
|
|
10
11
|
export declare type SelectorProps<V> = {
|
|
11
12
|
options: SelectorOption<V>[];
|
|
12
|
-
columns?:
|
|
13
|
+
columns?: GridProps['columns'];
|
|
13
14
|
multiple?: boolean;
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
defaultValue?: V[];
|
|
@@ -18,6 +19,6 @@ export declare type SelectorProps<V> = {
|
|
|
18
19
|
items: SelectorOption<V>[];
|
|
19
20
|
}) => void;
|
|
20
21
|
showCheckMark?: boolean;
|
|
21
|
-
} & NativeProps<'--color' | '--checked-color' | '--text-color' | '--checked-text-color' | '--border' | '--checked-border' | '--border-radius' | '--padding'>;
|
|
22
|
+
} & NativeProps<'--color' | '--checked-color' | '--text-color' | '--checked-text-color' | '--border' | '--checked-border' | '--border-radius' | '--padding' | '--gap' | '--gap-vertical' | '--gap-horizontal'>;
|
|
22
23
|
export declare const Selector: <V extends SelectorValue>(p: SelectorProps<V>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
23
24
|
export {};
|
|
@@ -4,7 +4,6 @@ import { withNativeProps } from '../../utils/native-props';
|
|
|
4
4
|
import { mergeProps } from '../../utils/with-default-props';
|
|
5
5
|
import Space from '../space';
|
|
6
6
|
import Grid from '../grid';
|
|
7
|
-
import { convertPx } from '../../utils/convert-px';
|
|
8
7
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
9
8
|
import { CheckMark } from './check-mark';
|
|
10
9
|
const classPrefix = `adm-selector`;
|
|
@@ -65,7 +64,6 @@ export const Selector = p => {
|
|
|
65
64
|
}, !props.columns && React.createElement(Space, {
|
|
66
65
|
wrap: true
|
|
67
66
|
}, items), props.columns && React.createElement(Grid, {
|
|
68
|
-
columns: props.columns
|
|
69
|
-
gap: convertPx(8)
|
|
67
|
+
columns: props.columns
|
|
70
68
|
}, items)));
|
|
71
69
|
};
|