antd-mobile 5.12.6 → 5.13.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/README.md +10 -8
- package/2x/cjs/components/dialog/dialog.d.ts +2 -0
- package/2x/cjs/components/dialog/dialog.js +24 -13
- package/2x/cjs/components/ellipsis/ellipsis.js +1 -1
- package/2x/cjs/components/error-block/create-error-block.d.ts +12 -0
- package/2x/cjs/components/error-block/create-error-block.js +59 -0
- package/2x/cjs/components/error-block/error-block.d.ts +2 -11
- package/2x/cjs/components/error-block/error-block.js +7 -53
- package/2x/cjs/components/error-block/images/index.d.ts +4 -2
- package/2x/cjs/components/error-block/images/index.js +25 -10
- package/2x/cjs/components/error-block/index.d.ts +5 -1
- package/2x/cjs/components/error-block/index.js +8 -0
- package/2x/cjs/components/image-viewer/image-viewer.css +7 -1
- package/2x/cjs/components/image-viewer/image-viewer.d.ts +5 -2
- package/2x/cjs/components/image-viewer/image-viewer.js +24 -4
- package/2x/cjs/components/image-viewer/index.d.ts +2 -1
- package/2x/cjs/components/index-bar/index-bar.d.ts +2 -0
- package/2x/cjs/components/index-bar/index-bar.js +6 -0
- package/2x/cjs/components/index-bar/index.d.ts +1 -0
- package/2x/cjs/components/input/input.js +22 -4
- package/2x/cjs/components/mask/mask.js +9 -7
- package/2x/cjs/components/modal/modal.d.ts +2 -0
- package/2x/cjs/components/modal/modal.js +24 -11
- package/2x/cjs/components/side-bar/side-bar.js +1 -0
- package/2x/cjs/components/spin-loading/spin-loading.js +6 -2
- package/2x/cjs/components/tab-bar/tab-bar.js +1 -0
- package/2x/cjs/index.d.ts +2 -0
- package/2x/cjs/index.js +21 -1
- package/2x/cjs/locales/fr-FR.d.ts +106 -0
- package/2x/cjs/locales/fr-FR.js +119 -0
- package/2x/cjs/utils/measure-css-length.js +2 -2
- package/2x/cjs/utils/reduce-and-restore-motion.d.ts +4 -0
- package/2x/cjs/utils/reduce-and-restore-motion.js +53 -0
- package/2x/cjs/utils/use-inner-visible.d.ts +1 -0
- package/2x/cjs/utils/use-inner-visible.js +18 -0
- package/2x/es/components/dialog/dialog.d.ts +2 -0
- package/2x/es/components/dialog/dialog.js +23 -14
- package/2x/es/components/ellipsis/ellipsis.js +1 -1
- package/2x/es/components/error-block/create-error-block.d.ts +12 -0
- package/2x/es/components/error-block/create-error-block.js +44 -0
- package/2x/es/components/error-block/error-block.d.ts +2 -11
- package/2x/es/components/error-block/error-block.js +8 -46
- package/2x/es/components/error-block/images/index.d.ts +4 -2
- package/2x/es/components/error-block/images/index.js +4 -10
- package/2x/es/components/error-block/index.d.ts +5 -1
- package/2x/es/components/error-block/index.js +1 -0
- package/2x/es/components/image-viewer/image-viewer.css +7 -1
- package/2x/es/components/image-viewer/image-viewer.d.ts +5 -2
- package/2x/es/components/image-viewer/image-viewer.js +24 -5
- package/2x/es/components/image-viewer/index.d.ts +2 -1
- package/2x/es/components/index-bar/index-bar.d.ts +2 -0
- package/2x/es/components/index-bar/index-bar.js +6 -0
- package/2x/es/components/index-bar/index.d.ts +1 -0
- package/2x/es/components/input/input.js +21 -4
- package/2x/es/components/mask/mask.js +10 -8
- package/2x/es/components/modal/modal.d.ts +2 -0
- package/2x/es/components/modal/modal.js +23 -12
- package/2x/es/components/side-bar/side-bar.js +2 -0
- package/2x/es/components/spin-loading/spin-loading.js +5 -2
- package/2x/es/components/tab-bar/tab-bar.js +2 -0
- package/2x/es/index.d.ts +2 -0
- package/2x/es/index.js +3 -1
- package/2x/es/locales/fr-FR.d.ts +106 -0
- package/2x/es/locales/fr-FR.js +109 -0
- package/2x/es/utils/measure-css-length.js +2 -2
- package/2x/es/utils/reduce-and-restore-motion.d.ts +4 -0
- package/2x/es/utils/reduce-and-restore-motion.js +36 -0
- package/2x/es/utils/use-inner-visible.d.ts +1 -0
- package/2x/es/utils/use-inner-visible.js +9 -0
- package/2x/package.json +8 -7
- package/README.md +10 -8
- package/bundle/antd-mobile.cjs.js +1551 -1405
- package/bundle/antd-mobile.es.js +1547 -1404
- package/bundle/style.css +6 -1
- package/cjs/components/dialog/dialog.d.ts +2 -0
- package/cjs/components/dialog/dialog.js +24 -13
- package/cjs/components/ellipsis/ellipsis.js +1 -1
- package/cjs/components/error-block/create-error-block.d.ts +12 -0
- package/cjs/components/error-block/create-error-block.js +59 -0
- package/cjs/components/error-block/error-block.d.ts +2 -11
- package/cjs/components/error-block/error-block.js +7 -53
- package/cjs/components/error-block/images/index.d.ts +4 -2
- package/cjs/components/error-block/images/index.js +25 -10
- package/cjs/components/error-block/index.d.ts +5 -1
- package/cjs/components/error-block/index.js +8 -0
- package/cjs/components/image-viewer/image-viewer.css +6 -1
- package/cjs/components/image-viewer/image-viewer.d.ts +5 -2
- package/cjs/components/image-viewer/image-viewer.js +24 -4
- package/cjs/components/image-viewer/index.d.ts +2 -1
- package/cjs/components/index-bar/index-bar.d.ts +2 -0
- package/cjs/components/index-bar/index-bar.js +6 -0
- package/cjs/components/index-bar/index.d.ts +1 -0
- package/cjs/components/input/input.js +22 -4
- package/cjs/components/mask/mask.js +9 -7
- package/cjs/components/modal/modal.d.ts +2 -0
- package/cjs/components/modal/modal.js +24 -11
- package/cjs/components/side-bar/side-bar.js +1 -0
- package/cjs/components/spin-loading/spin-loading.js +6 -2
- package/cjs/components/tab-bar/tab-bar.js +1 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +21 -1
- package/cjs/locales/fr-FR.d.ts +106 -0
- package/cjs/locales/fr-FR.js +119 -0
- package/cjs/utils/measure-css-length.js +2 -2
- package/cjs/utils/reduce-and-restore-motion.d.ts +4 -0
- package/cjs/utils/reduce-and-restore-motion.js +53 -0
- package/cjs/utils/use-inner-visible.d.ts +1 -0
- package/cjs/utils/use-inner-visible.js +18 -0
- package/es/components/dialog/dialog.d.ts +2 -0
- package/es/components/dialog/dialog.js +23 -14
- package/es/components/ellipsis/ellipsis.js +1 -1
- package/es/components/error-block/create-error-block.d.ts +12 -0
- package/es/components/error-block/create-error-block.js +44 -0
- package/es/components/error-block/error-block.d.ts +2 -11
- package/es/components/error-block/error-block.js +8 -46
- package/es/components/error-block/images/index.d.ts +4 -2
- package/es/components/error-block/images/index.js +4 -10
- package/es/components/error-block/index.d.ts +5 -1
- package/es/components/error-block/index.js +1 -0
- package/es/components/image-viewer/image-viewer.css +6 -1
- package/es/components/image-viewer/image-viewer.d.ts +5 -2
- package/es/components/image-viewer/image-viewer.js +24 -5
- package/es/components/image-viewer/index.d.ts +2 -1
- package/es/components/index-bar/index-bar.d.ts +2 -0
- package/es/components/index-bar/index-bar.js +6 -0
- package/es/components/index-bar/index.d.ts +1 -0
- package/es/components/input/input.js +21 -4
- package/es/components/mask/mask.js +10 -8
- package/es/components/modal/modal.d.ts +2 -0
- package/es/components/modal/modal.js +23 -12
- package/es/components/side-bar/side-bar.js +2 -0
- package/es/components/spin-loading/spin-loading.js +5 -2
- package/es/components/tab-bar/tab-bar.js +2 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/es/locales/fr-FR.d.ts +106 -0
- package/es/locales/fr-FR.js +109 -0
- package/es/utils/measure-css-length.js +2 -2
- package/es/utils/reduce-and-restore-motion.d.ts +4 -0
- package/es/utils/reduce-and-restore-motion.js +36 -0
- package/es/utils/use-inner-visible.d.ts +1 -0
- package/es/utils/use-inner-visible.js +9 -0
- package/package.json +8 -7
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +12 -0
package/bundle/style.css
CHANGED
|
@@ -1721,10 +1721,15 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
1721
1721
|
.adm-image-viewer-content {
|
|
1722
1722
|
width: 100vw;
|
|
1723
1723
|
height: 100vh;
|
|
1724
|
-
max-height: -webkit-fill-available;
|
|
1725
1724
|
touch-action: none;
|
|
1726
1725
|
user-select: none;
|
|
1727
1726
|
}
|
|
1727
|
+
.adm-image-viewer-footer {
|
|
1728
|
+
position: absolute;
|
|
1729
|
+
width: 100%;
|
|
1730
|
+
bottom: 0;
|
|
1731
|
+
z-index: 1;
|
|
1732
|
+
}
|
|
1728
1733
|
.adm-image-viewer-slides {
|
|
1729
1734
|
height: 100%;
|
|
1730
1735
|
position: relative;
|
|
@@ -31,6 +31,10 @@ var _web = require("@react-spring/web");
|
|
|
31
31
|
|
|
32
32
|
var _nativeProps = require("../../utils/native-props");
|
|
33
33
|
|
|
34
|
+
var _shouldRender = require("../../utils/should-render");
|
|
35
|
+
|
|
36
|
+
var _useInnerVisible = require("../../utils/use-inner-visible");
|
|
37
|
+
|
|
34
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
39
|
|
|
36
40
|
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); }
|
|
@@ -44,7 +48,9 @@ const defaultProps = {
|
|
|
44
48
|
closeOnMaskClick: false,
|
|
45
49
|
stopPropagation: ['click'],
|
|
46
50
|
getContainer: null,
|
|
47
|
-
disableBodyScroll: true
|
|
51
|
+
disableBodyScroll: true,
|
|
52
|
+
destroyOnClose: false,
|
|
53
|
+
forceRender: false
|
|
48
54
|
};
|
|
49
55
|
|
|
50
56
|
const Dialog = p => {
|
|
@@ -59,9 +65,6 @@ const Dialog = p => {
|
|
|
59
65
|
friction: 25,
|
|
60
66
|
clamp: true
|
|
61
67
|
},
|
|
62
|
-
onStart: () => {
|
|
63
|
-
setActive(true);
|
|
64
|
-
},
|
|
65
68
|
onRest: () => {
|
|
66
69
|
var _a, _b;
|
|
67
70
|
|
|
@@ -76,6 +79,12 @@ const Dialog = p => {
|
|
|
76
79
|
}
|
|
77
80
|
});
|
|
78
81
|
const [active, setActive] = (0, _react.useState)(props.visible);
|
|
82
|
+
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
83
|
+
if (props.visible) {
|
|
84
|
+
setActive(true);
|
|
85
|
+
}
|
|
86
|
+
}, [props.visible]);
|
|
87
|
+
const maskVisible = (0, _useInnerVisible.useInnerVisible)(active && props.visible);
|
|
79
88
|
|
|
80
89
|
const body = _react.default.createElement("div", {
|
|
81
90
|
className: (0, _classnames.default)(cls('body'), props.image && cls('with-image'), props.bodyClassName),
|
|
@@ -114,26 +123,28 @@ const Dialog = p => {
|
|
|
114
123
|
})));
|
|
115
124
|
})));
|
|
116
125
|
|
|
117
|
-
const node = (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
126
|
+
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
118
127
|
className: cls(),
|
|
119
128
|
style: {
|
|
120
|
-
display: active ? undefined : 'none'
|
|
129
|
+
display: active ? undefined : 'none',
|
|
130
|
+
pointerEvents: active ? undefined : 'none'
|
|
121
131
|
}
|
|
122
132
|
}, _react.default.createElement(_mask.default, {
|
|
123
|
-
visible:
|
|
133
|
+
visible: maskVisible,
|
|
124
134
|
onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
|
|
125
135
|
style: props.maskStyle,
|
|
126
136
|
className: (0, _classnames.default)(cls('mask'), props.maskClassName),
|
|
127
137
|
disableBodyScroll: props.disableBodyScroll
|
|
128
138
|
}), _react.default.createElement("div", {
|
|
129
|
-
className: cls('wrap')
|
|
130
|
-
style: {
|
|
131
|
-
pointerEvents: props.visible ? undefined : 'none'
|
|
132
|
-
}
|
|
139
|
+
className: cls('wrap')
|
|
133
140
|
}, _react.default.createElement(_web.animated.div, {
|
|
134
141
|
style: style
|
|
135
|
-
}, body))));
|
|
136
|
-
return
|
|
142
|
+
}, body)))));
|
|
143
|
+
return _react.default.createElement(_shouldRender.ShouldRender, {
|
|
144
|
+
active: active,
|
|
145
|
+
forceRender: props.forceRender,
|
|
146
|
+
destroyOnClose: props.destroyOnClose
|
|
147
|
+
}, (0, _renderToContainer.renderToContainer)(props.getContainer, node));
|
|
137
148
|
};
|
|
138
149
|
|
|
139
150
|
exports.Dialog = Dialog;
|
|
@@ -116,7 +116,7 @@ const Ellipsis = p => {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
|
119
|
-
const rightPartMiddle = Math.
|
|
119
|
+
const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
|
120
120
|
container.innerText = props.content.slice(0, leftPartMiddle) + '...' + actionText + '...' + props.content.slice(rightPartMiddle, end);
|
|
121
121
|
|
|
122
122
|
if (container.offsetHeight <= maxHeight) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import type { ErrorBlockStatus, ImageRecord } from '.';
|
|
4
|
+
export declare type ErrorBlockProps = {
|
|
5
|
+
status?: ErrorBlockStatus;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
image?: string | ReactElement;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
fullPage?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
} & NativeProps<'--image-height' | '--image-height-full-page' | '--image-width' | '--image-width-full-page'>;
|
|
12
|
+
export declare function createErrorBlock(imageRecord: ImageRecord): React.FC<ErrorBlockProps>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createErrorBlock = createErrorBlock;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
|
|
12
|
+
var _withDefaultProps = require("../../utils/with-default-props");
|
|
13
|
+
|
|
14
|
+
var _nativeProps = require("../../utils/native-props");
|
|
15
|
+
|
|
16
|
+
var _configProvider = require("../config-provider");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
const classPrefix = `adm-error-block`;
|
|
21
|
+
const defaultProps = {
|
|
22
|
+
status: 'default'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function createErrorBlock(imageRecord) {
|
|
26
|
+
const ErrorBlock = p => {
|
|
27
|
+
var _a;
|
|
28
|
+
|
|
29
|
+
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
30
|
+
const {
|
|
31
|
+
locale
|
|
32
|
+
} = (0, _configProvider.useConfig)();
|
|
33
|
+
const contentPack = locale.ErrorBlock[props.status];
|
|
34
|
+
const des = 'description' in props ? props.description : contentPack.description;
|
|
35
|
+
const title = 'title' in props ? props.title : contentPack.title;
|
|
36
|
+
const image = (_a = props.image) !== null && _a !== void 0 ? _a : imageRecord[props.status];
|
|
37
|
+
const imageNode = typeof image === 'string' ? _react.default.createElement("img", {
|
|
38
|
+
src: image,
|
|
39
|
+
alt: 'error block image'
|
|
40
|
+
}) : image;
|
|
41
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
42
|
+
className: (0, _classnames.default)(classPrefix, {
|
|
43
|
+
[`${classPrefix}-full-page`]: props.fullPage
|
|
44
|
+
})
|
|
45
|
+
}, _react.default.createElement("div", {
|
|
46
|
+
className: `${classPrefix}-image`
|
|
47
|
+
}, imageNode), _react.default.createElement("div", {
|
|
48
|
+
className: `${classPrefix}-description`
|
|
49
|
+
}, title && _react.default.createElement("div", {
|
|
50
|
+
className: `${classPrefix}-description-title`
|
|
51
|
+
}, title), des && _react.default.createElement("div", {
|
|
52
|
+
className: `${classPrefix}-description-subtitle`
|
|
53
|
+
}, des)), props.children && _react.default.createElement("div", {
|
|
54
|
+
className: `${classPrefix}-content`
|
|
55
|
+
}, props.children)));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return ErrorBlock;
|
|
59
|
+
}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare type ErrorBlockProps = {
|
|
4
|
-
status?: 'default' | 'disconnected' | 'empty' | 'busy';
|
|
5
|
-
title?: ReactNode;
|
|
6
|
-
image?: string | ReactElement;
|
|
7
|
-
description?: ReactNode;
|
|
8
|
-
fullPage?: boolean;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
} & NativeProps<'--image-height' | '--image-height-full-page' | '--image-width' | '--image-width-full-page'>;
|
|
11
|
-
export declare const ErrorBlock: FC<ErrorBlockProps>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ErrorBlock: import("react").FC<import("./create-error-block").ErrorBlockProps>;
|
|
@@ -5,61 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ErrorBlock = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _withDefaultProps = require("../../utils/with-default-props");
|
|
13
|
-
|
|
14
|
-
var _nativeProps = require("../../utils/native-props");
|
|
15
|
-
|
|
16
|
-
var _configProvider = require("../config-provider");
|
|
8
|
+
var _createErrorBlock = require("./create-error-block");
|
|
17
9
|
|
|
18
10
|
var _images = require("./images");
|
|
19
11
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
const imageRecord = {
|
|
13
|
+
'default': _images.defaultImage,
|
|
14
|
+
'disconnected': _images.disconnectedImage,
|
|
15
|
+
'empty': _images.emptyImage,
|
|
16
|
+
'busy': _images.busyImage
|
|
25
17
|
};
|
|
26
|
-
|
|
27
|
-
const ErrorBlock = p => {
|
|
28
|
-
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
29
|
-
const {
|
|
30
|
-
locale
|
|
31
|
-
} = (0, _configProvider.useConfig)();
|
|
32
|
-
const contentPack = locale.ErrorBlock[props.status];
|
|
33
|
-
const des = 'description' in props ? props.description : contentPack.description;
|
|
34
|
-
const title = 'title' in props ? props.title : contentPack.title;
|
|
35
|
-
let imageNode = _images.imageRecord[props.status];
|
|
36
|
-
|
|
37
|
-
if (props.image) {
|
|
38
|
-
if (typeof props.image === 'string') {
|
|
39
|
-
imageNode = _react.default.createElement("img", {
|
|
40
|
-
src: props.image,
|
|
41
|
-
alt: 'error block image'
|
|
42
|
-
});
|
|
43
|
-
} else {
|
|
44
|
-
imageNode = props.image;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
49
|
-
className: (0, _classnames.default)(classPrefix, {
|
|
50
|
-
[`${classPrefix}-full-page`]: props.fullPage
|
|
51
|
-
})
|
|
52
|
-
}, _react.default.createElement("div", {
|
|
53
|
-
className: `${classPrefix}-image`
|
|
54
|
-
}, imageNode), _react.default.createElement("div", {
|
|
55
|
-
className: `${classPrefix}-description`
|
|
56
|
-
}, title && _react.default.createElement("div", {
|
|
57
|
-
className: `${classPrefix}-description-title`
|
|
58
|
-
}, title), des && _react.default.createElement("div", {
|
|
59
|
-
className: `${classPrefix}-description-subtitle`
|
|
60
|
-
}, des)), props.children && _react.default.createElement("div", {
|
|
61
|
-
className: `${classPrefix}-content`
|
|
62
|
-
}, props.children)));
|
|
63
|
-
};
|
|
64
|
-
|
|
18
|
+
const ErrorBlock = (0, _createErrorBlock.createErrorBlock)(imageRecord);
|
|
65
19
|
exports.ErrorBlock = ErrorBlock;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export { defaultImage } from './default';
|
|
2
|
+
export { disconnectedImage } from './disconnected';
|
|
3
|
+
export { emptyImage } from './empty';
|
|
4
|
+
export { busyImage } from './busy';
|
|
@@ -3,7 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
Object.defineProperty(exports, "busyImage", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _busy.busyImage;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "defaultImage", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _default.defaultImage;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "disconnectedImage", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _disconnected.disconnectedImage;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "emptyImage", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _empty.emptyImage;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
7
30
|
|
|
8
31
|
var _default = require("./default");
|
|
9
32
|
|
|
@@ -11,12 +34,4 @@ var _disconnected = require("./disconnected");
|
|
|
11
34
|
|
|
12
35
|
var _empty = require("./empty");
|
|
13
36
|
|
|
14
|
-
var _busy = require("./busy");
|
|
15
|
-
|
|
16
|
-
const imageRecord = {
|
|
17
|
-
'default': _default.defaultImage,
|
|
18
|
-
'disconnected': _disconnected.disconnectedImage,
|
|
19
|
-
'empty': _empty.emptyImage,
|
|
20
|
-
'busy': _busy.busyImage
|
|
21
|
-
};
|
|
22
|
-
exports.imageRecord = imageRecord;
|
|
37
|
+
var _busy = require("./busy");
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import './error-block.less';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
import { ErrorBlock } from './error-block';
|
|
3
|
-
export
|
|
4
|
+
export { createErrorBlock } from './create-error-block';
|
|
5
|
+
export type { ErrorBlockProps } from './create-error-block';
|
|
6
|
+
export declare type ErrorBlockStatus = 'default' | 'disconnected' | 'empty' | 'busy';
|
|
7
|
+
export declare type ImageRecord = Partial<Record<ErrorBlockStatus, string | ReactNode>>;
|
|
4
8
|
export default ErrorBlock;
|
|
@@ -3,11 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "createErrorBlock", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _createErrorBlock.createErrorBlock;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
exports.default = void 0;
|
|
7
13
|
|
|
8
14
|
require("./error-block.css");
|
|
9
15
|
|
|
10
16
|
var _errorBlock2 = require("./error-block");
|
|
11
17
|
|
|
18
|
+
var _createErrorBlock = require("./create-error-block");
|
|
19
|
+
|
|
12
20
|
var _default = _errorBlock2.ErrorBlock;
|
|
13
21
|
exports.default = _default;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
.adm-image-viewer-content {
|
|
2
2
|
width: 100vw;
|
|
3
3
|
height: 100vh;
|
|
4
|
-
max-height: -webkit-fill-available;
|
|
5
4
|
touch-action: none;
|
|
6
5
|
user-select: none;
|
|
7
6
|
}
|
|
7
|
+
.adm-image-viewer-footer {
|
|
8
|
+
position: absolute;
|
|
9
|
+
width: 100%;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
z-index: 1;
|
|
12
|
+
}
|
|
8
13
|
.adm-image-viewer-slides {
|
|
9
14
|
height: 100%;
|
|
10
15
|
position: relative;
|
|
@@ -8,16 +8,19 @@ export declare type ImageViewerProps = {
|
|
|
8
8
|
visible?: boolean;
|
|
9
9
|
onClose?: () => void;
|
|
10
10
|
afterClose?: () => void;
|
|
11
|
+
renderFooter?: (image: string) => React.ReactNode;
|
|
11
12
|
};
|
|
12
13
|
export declare const ImageViewer: FC<ImageViewerProps>;
|
|
13
14
|
export declare type MultiImageViewerRef = SlidesRef;
|
|
14
|
-
export declare type MultiImageViewerProps = Omit<ImageViewerProps, 'image'> & {
|
|
15
|
+
export declare type MultiImageViewerProps = Omit<ImageViewerProps, 'image' | 'renderFooter'> & {
|
|
15
16
|
images?: string[];
|
|
16
17
|
defaultIndex?: number;
|
|
17
18
|
onIndexChange?: (index: number) => void;
|
|
19
|
+
renderFooter?: (image: string, index: number) => React.ReactNode;
|
|
18
20
|
};
|
|
19
|
-
export declare const MultiImageViewer: React.ForwardRefExoticComponent<Omit<ImageViewerProps, "image"> & {
|
|
21
|
+
export declare const MultiImageViewer: React.ForwardRefExoticComponent<Omit<ImageViewerProps, "image" | "renderFooter"> & {
|
|
20
22
|
images?: string[] | undefined;
|
|
21
23
|
defaultIndex?: number | undefined;
|
|
22
24
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
25
|
+
renderFooter?: ((image: string, index: number) => React.ReactNode) | undefined;
|
|
23
26
|
} & React.RefAttributes<SlidesRef>>;
|
|
@@ -13,6 +13,8 @@ var _renderToContainer = require("../../utils/render-to-container");
|
|
|
13
13
|
|
|
14
14
|
var _mask = _interopRequireDefault(require("../mask"));
|
|
15
15
|
|
|
16
|
+
var _safeArea = _interopRequireDefault(require("../safe-area"));
|
|
17
|
+
|
|
16
18
|
var _slide = require("./slide");
|
|
17
19
|
|
|
18
20
|
var _slides = require("./slides");
|
|
@@ -31,6 +33,8 @@ const defaultProps = {
|
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
const ImageViewer = p => {
|
|
36
|
+
var _a;
|
|
37
|
+
|
|
34
38
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
35
39
|
|
|
36
40
|
const node = _react.default.createElement(_mask.default, {
|
|
@@ -48,6 +52,10 @@ const ImageViewer = p => {
|
|
|
48
52
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
49
53
|
},
|
|
50
54
|
maxZoom: props.maxZoom
|
|
55
|
+
})), props.image && _react.default.createElement("div", {
|
|
56
|
+
className: `${classPrefix}-footer`
|
|
57
|
+
}, (_a = props.renderFooter) === null || _a === void 0 ? void 0 : _a.call(props, props.image), _react.default.createElement(_safeArea.default, {
|
|
58
|
+
position: 'bottom'
|
|
51
59
|
})));
|
|
52
60
|
|
|
53
61
|
return (0, _renderToContainer.renderToContainer)(props.getContainer, node);
|
|
@@ -58,17 +66,25 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps), {
|
|
|
58
66
|
defaultIndex: 0
|
|
59
67
|
});
|
|
60
68
|
const MultiImageViewer = (0, _react.forwardRef)((p, ref) => {
|
|
69
|
+
var _a;
|
|
70
|
+
|
|
61
71
|
const props = (0, _withDefaultProps.mergeProps)(multiDefaultProps, p);
|
|
62
|
-
const [
|
|
72
|
+
const [index, setIndex] = (0, _react.useState)(props.defaultIndex);
|
|
63
73
|
const slidesRef = (0, _react.useRef)(null);
|
|
64
74
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
65
75
|
swipeTo: (index, immediate) => {
|
|
66
76
|
var _a;
|
|
67
77
|
|
|
68
|
-
|
|
78
|
+
setIndex(index);
|
|
69
79
|
(_a = slidesRef.current) === null || _a === void 0 ? void 0 : _a.swipeTo(index, immediate);
|
|
70
80
|
}
|
|
71
81
|
}));
|
|
82
|
+
const onSlideChange = (0, _react.useCallback)(index => {
|
|
83
|
+
var _a;
|
|
84
|
+
|
|
85
|
+
setIndex(index);
|
|
86
|
+
(_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, index);
|
|
87
|
+
}, [props.onIndexChange]);
|
|
72
88
|
|
|
73
89
|
const node = _react.default.createElement(_mask.default, {
|
|
74
90
|
visible: props.visible,
|
|
@@ -79,8 +95,8 @@ const MultiImageViewer = (0, _react.forwardRef)((p, ref) => {
|
|
|
79
95
|
className: `${classPrefix}-content`
|
|
80
96
|
}, props.images && _react.default.createElement(_slides.Slides, {
|
|
81
97
|
ref: slidesRef,
|
|
82
|
-
defaultIndex:
|
|
83
|
-
onIndexChange:
|
|
98
|
+
defaultIndex: index,
|
|
99
|
+
onIndexChange: onSlideChange,
|
|
84
100
|
images: props.images,
|
|
85
101
|
onTap: () => {
|
|
86
102
|
var _a;
|
|
@@ -88,6 +104,10 @@ const MultiImageViewer = (0, _react.forwardRef)((p, ref) => {
|
|
|
88
104
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
89
105
|
},
|
|
90
106
|
maxZoom: props.maxZoom
|
|
107
|
+
})), props.images && _react.default.createElement("div", {
|
|
108
|
+
className: `${classPrefix}-footer`
|
|
109
|
+
}, (_a = props.renderFooter) === null || _a === void 0 ? void 0 : _a.call(props, props.images[index], index), _react.default.createElement(_safeArea.default, {
|
|
110
|
+
position: 'bottom'
|
|
91
111
|
})));
|
|
92
112
|
|
|
93
113
|
return (0, _renderToContainer.renderToContainer)(props.getContainer, node);
|
|
@@ -4,10 +4,11 @@ import { showMultiImageViewer, showImageViewer, clearImageViewer } from './metho
|
|
|
4
4
|
export type { ImageViewerProps, MultiImageViewerProps, MultiImageViewerRef, } from './image-viewer';
|
|
5
5
|
export type { ImageViewerShowHandler } from './methods';
|
|
6
6
|
declare const _default: import("react").FC<import("./image-viewer").ImageViewerProps> & {
|
|
7
|
-
Multi: import("react").ForwardRefExoticComponent<Omit<import("./image-viewer").ImageViewerProps, "image"> & {
|
|
7
|
+
Multi: import("react").ForwardRefExoticComponent<Omit<import("./image-viewer").ImageViewerProps, "image" | "renderFooter"> & {
|
|
8
8
|
images?: string[] | undefined;
|
|
9
9
|
defaultIndex?: number | undefined;
|
|
10
10
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
11
|
+
renderFooter?: ((image: string, index: number) => import("react").ReactNode) | undefined;
|
|
11
12
|
} & import("react").RefAttributes<import("./slides").SlidesRef>> & {
|
|
12
13
|
show: typeof showMultiImageViewer;
|
|
13
14
|
};
|
|
@@ -2,6 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type IndexBarProps = {
|
|
4
4
|
sticky?: boolean;
|
|
5
|
+
onIndexChange?: (index: string) => void;
|
|
5
6
|
children?: React.ReactNode;
|
|
6
7
|
} & NativeProps<'--sticky-offset-top'>;
|
|
7
8
|
export declare type IndexBarRef = {
|
|
@@ -9,5 +10,6 @@ export declare type IndexBarRef = {
|
|
|
9
10
|
};
|
|
10
11
|
export declare const IndexBar: React.ForwardRefExoticComponent<{
|
|
11
12
|
sticky?: boolean | undefined;
|
|
13
|
+
onIndexChange?: ((index: string) => void) | undefined;
|
|
12
14
|
children?: React.ReactNode;
|
|
13
15
|
} & NativeProps<"--sticky-offset-top"> & React.RefAttributes<IndexBarRef>>;
|
|
@@ -72,6 +72,8 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
72
72
|
}));
|
|
73
73
|
|
|
74
74
|
function scrollTo(index) {
|
|
75
|
+
var _a;
|
|
76
|
+
|
|
75
77
|
const body = bodyRef.current;
|
|
76
78
|
if (!body) return;
|
|
77
79
|
const children = body.children;
|
|
@@ -84,6 +86,7 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
84
86
|
if (panelIndex === index) {
|
|
85
87
|
body.scrollTop = panel.offsetTop;
|
|
86
88
|
setActiveIndex(index);
|
|
89
|
+
activeIndex !== index && ((_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, index));
|
|
87
90
|
return;
|
|
88
91
|
}
|
|
89
92
|
}
|
|
@@ -92,6 +95,8 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
92
95
|
const {
|
|
93
96
|
run: checkActiveIndex
|
|
94
97
|
} = (0, _ahooks.useThrottleFn)(() => {
|
|
98
|
+
var _a;
|
|
99
|
+
|
|
95
100
|
const body = bodyRef.current;
|
|
96
101
|
if (!body) return;
|
|
97
102
|
const scrollTop = body.scrollTop;
|
|
@@ -105,6 +110,7 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
105
110
|
|
|
106
111
|
if (panel.offsetTop + panel.clientHeight - titleHeight > scrollTop) {
|
|
107
112
|
setActiveIndex(panelIndex);
|
|
113
|
+
activeIndex !== panelIndex && ((_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, panelIndex));
|
|
108
114
|
return;
|
|
109
115
|
}
|
|
110
116
|
}
|
|
@@ -4,6 +4,7 @@ export type { IndexBarProps, IndexBarRef } from './index-bar';
|
|
|
4
4
|
export type { IndexBarPanelProps } from './panel';
|
|
5
5
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
6
6
|
sticky?: boolean | undefined;
|
|
7
|
+
onIndexChange?: ((index: string) => void) | undefined;
|
|
7
8
|
children?: import("react").ReactNode;
|
|
8
9
|
} & import("../../utils/native-props").NativeProps<"--sticky-offset-top"> & import("react").RefAttributes<import("./index-bar").IndexBarRef>> & {
|
|
9
10
|
Panel: import("react").FC<import("./panel").IndexBarPanelProps>;
|
|
@@ -21,6 +21,8 @@ var _ahooks = require("ahooks");
|
|
|
21
21
|
|
|
22
22
|
var _bound = require("../../utils/bound");
|
|
23
23
|
|
|
24
|
+
var _validate = require("../../utils/validate");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
28
|
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); }
|
|
@@ -36,6 +38,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
36
38
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
37
39
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
|
|
38
40
|
const [hasFocus, setHasFocus] = (0, _react.useState)(false);
|
|
41
|
+
const compositionStartRef = (0, _react.useRef)(false);
|
|
39
42
|
const nativeInputRef = (0, _react.useRef)(null);
|
|
40
43
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
41
44
|
clear: () => {
|
|
@@ -142,8 +145,18 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
142
145
|
autoCorrect: props.autoCorrect,
|
|
143
146
|
onKeyDown: handleKeydown,
|
|
144
147
|
onKeyUp: props.onKeyUp,
|
|
145
|
-
onCompositionStart:
|
|
146
|
-
|
|
148
|
+
onCompositionStart: e => {
|
|
149
|
+
var _a;
|
|
150
|
+
|
|
151
|
+
compositionStartRef.current = true;
|
|
152
|
+
(_a = props.onCompositionStart) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
153
|
+
},
|
|
154
|
+
onCompositionEnd: e => {
|
|
155
|
+
var _a;
|
|
156
|
+
|
|
157
|
+
compositionStartRef.current = false;
|
|
158
|
+
(_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
159
|
+
},
|
|
147
160
|
onClick: props.onClick
|
|
148
161
|
}), shouldShowClear && _react.default.createElement("div", {
|
|
149
162
|
className: `${classPrefix}-clear`,
|
|
@@ -151,10 +164,15 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
151
164
|
e.preventDefault();
|
|
152
165
|
},
|
|
153
166
|
onClick: () => {
|
|
154
|
-
var _a;
|
|
167
|
+
var _a, _b;
|
|
155
168
|
|
|
156
169
|
setValue('');
|
|
157
|
-
(_a = props.onClear) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
170
|
+
(_a = props.onClear) === null || _a === void 0 ? void 0 : _a.call(props); // https://github.com/ant-design/ant-design-mobile/issues/5212
|
|
171
|
+
|
|
172
|
+
if ((0, _validate.isIOS)() && compositionStartRef.current) {
|
|
173
|
+
compositionStartRef.current = false;
|
|
174
|
+
(_b = nativeInputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
175
|
+
}
|
|
158
176
|
}
|
|
159
177
|
}, _react.default.createElement(_antdMobileIcons.CloseCircleFill, null))));
|
|
160
178
|
});
|
|
@@ -69,7 +69,7 @@ const Mask = p => {
|
|
|
69
69
|
config: {
|
|
70
70
|
precision: 0.01,
|
|
71
71
|
mass: 1,
|
|
72
|
-
tension:
|
|
72
|
+
tension: 250,
|
|
73
73
|
friction: 30,
|
|
74
74
|
clamp: true
|
|
75
75
|
},
|
|
@@ -89,14 +89,12 @@ const Mask = p => {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
const shouldRender = (0, _shouldRender.useShouldRender)(active, props.forceRender, props.destroyOnClose);
|
|
93
92
|
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement(_web.animated.div, {
|
|
94
93
|
className: classPrefix,
|
|
95
94
|
ref: ref,
|
|
96
|
-
style: Object.assign(Object.assign({
|
|
95
|
+
style: Object.assign(Object.assign({}, props.style), {
|
|
97
96
|
background,
|
|
98
|
-
opacity
|
|
99
|
-
}, props.style), {
|
|
97
|
+
opacity,
|
|
100
98
|
display: active ? undefined : 'none'
|
|
101
99
|
}),
|
|
102
100
|
onClick: e => {
|
|
@@ -113,8 +111,12 @@ const Mask = p => {
|
|
|
113
111
|
onClick: props.onMaskClick
|
|
114
112
|
}), _react.default.createElement("div", {
|
|
115
113
|
className: `${classPrefix}-content`
|
|
116
|
-
},
|
|
117
|
-
return
|
|
114
|
+
}, props.children))));
|
|
115
|
+
return _react.default.createElement(_shouldRender.ShouldRender, {
|
|
116
|
+
active: active,
|
|
117
|
+
forceRender: props.forceRender,
|
|
118
|
+
destroyOnClose: props.destroyOnClose
|
|
119
|
+
}, (0, _renderToContainer.renderToContainer)(props.getContainer, node));
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
exports.Mask = Mask;
|