antd-mobile 5.12.4 → 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/action-sheet/action-sheet.css +22 -7
- package/2x/cjs/components/action-sheet/action-sheet.js +8 -16
- package/2x/cjs/components/button/button.d.ts +1 -1
- package/2x/cjs/components/calendar/calendar.css +4 -0
- package/2x/cjs/components/calendar/calendar.d.ts +1 -0
- package/2x/cjs/components/calendar/calendar.js +1 -1
- 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/form/form-item.js +1 -4
- package/2x/cjs/components/image/image.d.ts +1 -0
- package/2x/cjs/components/image/image.js +4 -2
- 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/popover/popover.css +1 -0
- package/2x/cjs/components/search-bar/search-bar.d.ts +1 -1
- 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/swiper/index.d.ts +1 -1
- package/2x/cjs/components/swiper/swiper.d.ts +1 -1
- package/2x/cjs/components/tab-bar/tab-bar.js +1 -0
- package/2x/cjs/components/text-area/text-area.js +2 -1
- 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/action-sheet/action-sheet.css +22 -7
- package/2x/es/components/action-sheet/action-sheet.js +8 -15
- package/2x/es/components/button/button.d.ts +1 -1
- package/2x/es/components/calendar/calendar.css +4 -0
- package/2x/es/components/calendar/calendar.d.ts +1 -0
- package/2x/es/components/calendar/calendar.js +1 -1
- 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/form/form-item.js +1 -4
- package/2x/es/components/image/image.d.ts +1 -0
- package/2x/es/components/image/image.js +4 -2
- 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/popover/popover.css +1 -0
- package/2x/es/components/search-bar/search-bar.d.ts +1 -1
- 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/swiper/index.d.ts +1 -1
- package/2x/es/components/swiper/swiper.d.ts +1 -1
- package/2x/es/components/tab-bar/tab-bar.js +2 -0
- package/2x/es/components/text-area/text-area.js +2 -1
- 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 +1708 -1567
- package/bundle/antd-mobile.es.js +1705 -1567
- package/bundle/style.css +100 -79
- package/cjs/components/action-sheet/action-sheet.css +19 -7
- package/cjs/components/action-sheet/action-sheet.js +8 -16
- package/cjs/components/button/button.d.ts +1 -1
- package/cjs/components/calendar/calendar.css +3 -0
- package/cjs/components/calendar/calendar.d.ts +1 -0
- package/cjs/components/calendar/calendar.js +1 -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/form/form-item.js +1 -4
- package/cjs/components/image/image.d.ts +1 -0
- package/cjs/components/image/image.js +4 -2
- 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/popover/popover.css +1 -0
- package/cjs/components/search-bar/search-bar.d.ts +1 -1
- package/cjs/components/side-bar/side-bar.js +1 -0
- package/cjs/components/spin-loading/spin-loading.js +6 -2
- package/cjs/components/swiper/index.d.ts +1 -1
- package/cjs/components/swiper/swiper.d.ts +1 -1
- package/cjs/components/tab-bar/tab-bar.js +1 -0
- package/cjs/components/text-area/text-area.js +2 -1
- 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/action-sheet/action-sheet.css +19 -7
- package/es/components/action-sheet/action-sheet.js +8 -15
- package/es/components/button/button.d.ts +1 -1
- package/es/components/calendar/calendar.css +3 -0
- package/es/components/calendar/calendar.d.ts +1 -0
- package/es/components/calendar/calendar.js +1 -1
- 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/form/form-item.js +1 -4
- package/es/components/image/image.d.ts +1 -0
- package/es/components/image/image.js +4 -2
- 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/popover/popover.css +1 -0
- package/es/components/search-bar/search-bar.d.ts +1 -1
- package/es/components/side-bar/side-bar.js +2 -0
- package/es/components/spin-loading/spin-loading.js +5 -2
- package/es/components/swiper/index.d.ts +1 -1
- package/es/components/swiper/swiper.d.ts +1 -1
- package/es/components/tab-bar/tab-bar.js +2 -0
- package/es/components/text-area/text-area.js +2 -1
- 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
|
@@ -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;
|
|
@@ -35,6 +35,10 @@ var _nativeProps = require("../../utils/native-props");
|
|
|
35
35
|
|
|
36
36
|
var _antdMobileIcons = require("antd-mobile-icons");
|
|
37
37
|
|
|
38
|
+
var _shouldRender = require("../../utils/should-render");
|
|
39
|
+
|
|
40
|
+
var _useInnerVisible = require("../../utils/use-inner-visible");
|
|
41
|
+
|
|
38
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
43
|
|
|
40
44
|
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); }
|
|
@@ -49,7 +53,9 @@ const defaultProps = {
|
|
|
49
53
|
stopPropagation: ['click'],
|
|
50
54
|
showCloseButton: false,
|
|
51
55
|
getContainer: null,
|
|
52
|
-
disableBodyScroll: true
|
|
56
|
+
disableBodyScroll: true,
|
|
57
|
+
destroyOnClose: false,
|
|
58
|
+
forceRender: false
|
|
53
59
|
};
|
|
54
60
|
|
|
55
61
|
const Modal = p => {
|
|
@@ -64,9 +70,6 @@ const Modal = p => {
|
|
|
64
70
|
friction: 25,
|
|
65
71
|
clamp: true
|
|
66
72
|
},
|
|
67
|
-
onStart: () => {
|
|
68
|
-
setActive(true);
|
|
69
|
-
},
|
|
70
73
|
onRest: () => {
|
|
71
74
|
var _a, _b;
|
|
72
75
|
|
|
@@ -81,6 +84,12 @@ const Modal = p => {
|
|
|
81
84
|
}
|
|
82
85
|
});
|
|
83
86
|
const [active, setActive] = (0, _react.useState)(props.visible);
|
|
87
|
+
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
88
|
+
if (props.visible) {
|
|
89
|
+
setActive(true);
|
|
90
|
+
}
|
|
91
|
+
}, [props.visible]);
|
|
92
|
+
const maskVisible = (0, _useInnerVisible.useInnerVisible)(active && props.visible);
|
|
84
93
|
|
|
85
94
|
const body = _react.default.createElement("div", {
|
|
86
95
|
className: (0, _classnames.default)(cls('body'), props.image && cls('with-image'), props.bodyClassName),
|
|
@@ -123,23 +132,27 @@ const Modal = p => {
|
|
|
123
132
|
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
124
133
|
className: cls(),
|
|
125
134
|
style: {
|
|
126
|
-
display: active ? undefined : 'none'
|
|
135
|
+
display: active ? undefined : 'none',
|
|
136
|
+
pointerEvents: active ? undefined : 'none'
|
|
127
137
|
}
|
|
128
138
|
}, _react.default.createElement(_mask.default, {
|
|
129
|
-
visible:
|
|
139
|
+
visible: maskVisible,
|
|
140
|
+
forceRender: props.forceRender,
|
|
141
|
+
destroyOnClose: props.destroyOnClose,
|
|
130
142
|
onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
|
|
131
143
|
style: props.maskStyle,
|
|
132
144
|
className: (0, _classnames.default)(cls('mask'), props.maskClassName),
|
|
133
145
|
disableBodyScroll: props.disableBodyScroll
|
|
134
146
|
}), _react.default.createElement("div", {
|
|
135
|
-
className: cls('wrap')
|
|
136
|
-
style: {
|
|
137
|
-
pointerEvents: props.visible ? undefined : 'none'
|
|
138
|
-
}
|
|
147
|
+
className: cls('wrap')
|
|
139
148
|
}, _react.default.createElement(_web.animated.div, {
|
|
140
149
|
style: style
|
|
141
150
|
}, body)))));
|
|
142
|
-
return
|
|
151
|
+
return _react.default.createElement(_shouldRender.ShouldRender, {
|
|
152
|
+
active: active,
|
|
153
|
+
forceRender: props.forceRender,
|
|
154
|
+
destroyOnClose: props.destroyOnClose
|
|
155
|
+
}, (0, _renderToContainer.renderToContainer)(props.getContainer, node));
|
|
143
156
|
};
|
|
144
157
|
|
|
145
158
|
exports.Modal = Modal;
|
|
@@ -31,4 +31,4 @@ export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps,
|
|
|
31
31
|
onSearch?: ((val: string) => void) | undefined;
|
|
32
32
|
onChange?: ((val: string) => void) | undefined;
|
|
33
33
|
onCancel?: (() => void) | undefined;
|
|
34
|
-
} & NativeProps<"--
|
|
34
|
+
} & NativeProps<"--height" | "--border-radius" | "--padding-left" | "--background" | "--placeholder-color"> & React.RefAttributes<InputRef>>;
|
|
@@ -22,6 +22,7 @@ var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
24
|
const classPrefix = `adm-side-bar`;
|
|
25
|
+
/* istanbul ignore next */
|
|
25
26
|
|
|
26
27
|
const SideBarItem = () => {
|
|
27
28
|
return null;
|
|
@@ -13,6 +13,8 @@ var _withDefaultProps = require("../../utils/with-default-props");
|
|
|
13
13
|
|
|
14
14
|
var _web = require("@react-spring/web");
|
|
15
15
|
|
|
16
|
+
var _reduceAndRestoreMotion = require("../../utils/reduce-and-restore-motion");
|
|
17
|
+
|
|
16
18
|
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); }
|
|
17
19
|
|
|
18
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -31,17 +33,19 @@ const SpinLoading = (0, _react.memo)(p => {
|
|
|
31
33
|
var _a;
|
|
32
34
|
|
|
33
35
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
36
|
+
const motionReduced = (0, _reduceAndRestoreMotion.useMotionReduced)();
|
|
34
37
|
const {
|
|
35
38
|
percent
|
|
36
39
|
} = (0, _web.useSpring)({
|
|
40
|
+
cancel: motionReduced,
|
|
37
41
|
loop: {
|
|
38
42
|
reverse: true
|
|
39
43
|
},
|
|
40
44
|
from: {
|
|
41
|
-
percent:
|
|
45
|
+
percent: 80
|
|
42
46
|
},
|
|
43
47
|
to: {
|
|
44
|
-
percent:
|
|
48
|
+
percent: 30
|
|
45
49
|
},
|
|
46
50
|
config: {
|
|
47
51
|
duration: 1200
|
|
@@ -16,7 +16,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
16
16
|
stuckAtBoundary?: boolean | undefined;
|
|
17
17
|
rubberband?: boolean | undefined;
|
|
18
18
|
children?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | undefined;
|
|
19
|
-
} & import("../../utils/native-props").NativeProps<"--
|
|
19
|
+
} & import("../../utils/native-props").NativeProps<"--width" | "--height" | "--border-radius" | "--track-padding"> & import("react").RefAttributes<import("./swiper").SwiperRef>> & {
|
|
20
20
|
Item: import("react").FC<{
|
|
21
21
|
onClick?: ((e: import("react").MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
22
22
|
children?: import("react").ReactNode;
|
|
@@ -37,4 +37,4 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
|
37
37
|
stuckAtBoundary?: boolean | undefined;
|
|
38
38
|
rubberband?: boolean | undefined;
|
|
39
39
|
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
40
|
-
} & NativeProps<"--
|
|
40
|
+
} & NativeProps<"--width" | "--height" | "--border-radius" | "--track-padding"> & React.RefAttributes<SwiperRef>>;
|
|
@@ -123,7 +123,8 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
123
123
|
compositingRef.current = false;
|
|
124
124
|
|
|
125
125
|
if (maxLength) {
|
|
126
|
-
|
|
126
|
+
const v = e.target.value;
|
|
127
|
+
setValue([...v].slice(0, maxLength).join(''));
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
(_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
package/2x/cjs/index.d.ts
CHANGED
|
@@ -77,3 +77,5 @@ export { default as Toast } from './components/toast';
|
|
|
77
77
|
export { default as TreeSelect } from './components/tree-select';
|
|
78
78
|
export { default as VirtualInput } from './components/virtual-input';
|
|
79
79
|
export { default as WaterMark } from './components/water-mark';
|
|
80
|
+
export { createErrorBlock } from './components/error-block';
|
|
81
|
+
export { reduceMotion, restoreMotion } from './utils/reduce-and-restore-motion';
|
package/2x/cjs/index.js
CHANGED
|
@@ -465,6 +465,24 @@ Object.defineProperty(exports, "WaterMark", {
|
|
|
465
465
|
return _waterMark.default;
|
|
466
466
|
}
|
|
467
467
|
});
|
|
468
|
+
Object.defineProperty(exports, "createErrorBlock", {
|
|
469
|
+
enumerable: true,
|
|
470
|
+
get: function () {
|
|
471
|
+
return _errorBlock.createErrorBlock;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
Object.defineProperty(exports, "reduceMotion", {
|
|
475
|
+
enumerable: true,
|
|
476
|
+
get: function () {
|
|
477
|
+
return _reduceAndRestoreMotion.reduceMotion;
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
Object.defineProperty(exports, "restoreMotion", {
|
|
481
|
+
enumerable: true,
|
|
482
|
+
get: function () {
|
|
483
|
+
return _reduceAndRestoreMotion.restoreMotion;
|
|
484
|
+
}
|
|
485
|
+
});
|
|
468
486
|
Object.defineProperty(exports, "setDefaultConfig", {
|
|
469
487
|
enumerable: true,
|
|
470
488
|
get: function () {
|
|
@@ -522,7 +540,7 @@ var _ellipsis = _interopRequireDefault(require("./components/ellipsis"));
|
|
|
522
540
|
|
|
523
541
|
var _empty = _interopRequireDefault(require("./components/empty"));
|
|
524
542
|
|
|
525
|
-
var _errorBlock =
|
|
543
|
+
var _errorBlock = _interopRequireWildcard(require("./components/error-block"));
|
|
526
544
|
|
|
527
545
|
var _floatingBubble = _interopRequireDefault(require("./components/floating-bubble"));
|
|
528
546
|
|
|
@@ -628,6 +646,8 @@ var _virtualInput = _interopRequireDefault(require("./components/virtual-input")
|
|
|
628
646
|
|
|
629
647
|
var _waterMark = _interopRequireDefault(require("./components/water-mark"));
|
|
630
648
|
|
|
649
|
+
var _reduceAndRestoreMotion = require("./utils/reduce-and-restore-motion");
|
|
650
|
+
|
|
631
651
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
632
652
|
|
|
633
653
|
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); }
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare const frFR: {
|
|
2
|
+
locale: string;
|
|
3
|
+
common: {
|
|
4
|
+
confirm: string;
|
|
5
|
+
cancel: string;
|
|
6
|
+
loading: string;
|
|
7
|
+
};
|
|
8
|
+
Calendar: {
|
|
9
|
+
markItems: string[];
|
|
10
|
+
renderYearAndMonth: (year: number, month: number) => string;
|
|
11
|
+
};
|
|
12
|
+
Cascader: {
|
|
13
|
+
placeholder: string;
|
|
14
|
+
};
|
|
15
|
+
Dialog: {
|
|
16
|
+
ok: string;
|
|
17
|
+
};
|
|
18
|
+
ErrorBlock: {
|
|
19
|
+
default: {
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
busy: {
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
disconnected: {
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
empty: {
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
Form: {
|
|
37
|
+
required: string;
|
|
38
|
+
optional: string;
|
|
39
|
+
defaultValidateMessages: {
|
|
40
|
+
default: string;
|
|
41
|
+
required: string;
|
|
42
|
+
enum: string;
|
|
43
|
+
whitespace: string;
|
|
44
|
+
date: {
|
|
45
|
+
format: string;
|
|
46
|
+
parse: string;
|
|
47
|
+
invalid: string;
|
|
48
|
+
};
|
|
49
|
+
types: {
|
|
50
|
+
string: string;
|
|
51
|
+
method: string;
|
|
52
|
+
array: string;
|
|
53
|
+
object: string;
|
|
54
|
+
number: string;
|
|
55
|
+
date: string;
|
|
56
|
+
boolean: string;
|
|
57
|
+
integer: string;
|
|
58
|
+
float: string;
|
|
59
|
+
regexp: string;
|
|
60
|
+
email: string;
|
|
61
|
+
url: string;
|
|
62
|
+
hex: string;
|
|
63
|
+
};
|
|
64
|
+
string: {
|
|
65
|
+
len: string;
|
|
66
|
+
min: string;
|
|
67
|
+
max: string;
|
|
68
|
+
range: string;
|
|
69
|
+
};
|
|
70
|
+
number: {
|
|
71
|
+
len: string;
|
|
72
|
+
min: string;
|
|
73
|
+
max: string;
|
|
74
|
+
range: string;
|
|
75
|
+
};
|
|
76
|
+
array: {
|
|
77
|
+
len: string;
|
|
78
|
+
min: string;
|
|
79
|
+
max: string;
|
|
80
|
+
range: string;
|
|
81
|
+
};
|
|
82
|
+
pattern: {
|
|
83
|
+
mismatch: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
ImageUploader: {
|
|
88
|
+
uploading: string;
|
|
89
|
+
upload: string;
|
|
90
|
+
};
|
|
91
|
+
InfiniteScroll: {
|
|
92
|
+
noMore: string;
|
|
93
|
+
};
|
|
94
|
+
Mask: {
|
|
95
|
+
name: string;
|
|
96
|
+
};
|
|
97
|
+
Modal: {
|
|
98
|
+
ok: string;
|
|
99
|
+
};
|
|
100
|
+
PullToRefresh: {
|
|
101
|
+
pulling: string;
|
|
102
|
+
canRelease: string;
|
|
103
|
+
complete: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export default frFR;
|