antd-mobile 0.0.0-dev-626cbf51f → 0.0.0-dev.fc623d614
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/badge/badge.d.ts +1 -1
- package/2x/cjs/components/badge/badge.js +3 -1
- package/2x/cjs/components/badge/index.d.ts +1 -1
- package/2x/cjs/components/button/button.d.ts +6 -4
- package/2x/cjs/components/button/button.js +5 -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 +2 -2
- package/2x/cjs/components/dialog/dialog.d.ts +4 -1
- package/2x/cjs/components/dialog/dialog.js +24 -13
- package/2x/cjs/components/dropdown/dropdown.css +1 -1
- package/2x/cjs/components/error-block/images/busy.d.ts +1 -0
- package/2x/cjs/components/error-block/images/default.d.ts +1 -0
- package/2x/cjs/components/error-block/images/disconnected.d.ts +1 -0
- package/2x/cjs/components/error-block/images/empty.d.ts +1 -0
- package/2x/cjs/components/form/form-item.js +1 -4
- package/2x/cjs/components/image/broken-image-icon.d.ts +1 -0
- package/2x/cjs/components/image/broken-image-icon.js +21 -0
- package/2x/cjs/components/image/image-icon.d.ts +1 -0
- package/2x/cjs/components/image/image-icon.js +21 -0
- package/2x/cjs/components/image/image.css +4 -2
- package/2x/cjs/components/image/image.d.ts +2 -1
- package/2x/cjs/components/image/image.js +10 -6
- package/2x/cjs/components/image-uploader/image-uploader.js +1 -4
- 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/infinite-scroll/infinite-scroll.js +8 -6
- package/2x/cjs/components/mask/mask.js +9 -7
- package/2x/cjs/components/modal/modal.d.ts +4 -1
- package/2x/cjs/components/modal/modal.js +24 -11
- package/2x/cjs/components/popover/popover.css +1 -0
- package/2x/cjs/components/popup/popup.d.ts +2 -1
- package/2x/cjs/components/search-bar/search-bar.d.ts +1 -1
- package/2x/cjs/components/search-bar/search-bar.js +5 -8
- package/2x/cjs/components/side-bar/side-bar.d.ts +2 -1
- package/2x/cjs/components/swiper/index.d.ts +1 -1
- package/2x/cjs/components/swiper/swiper.d.ts +1 -1
- package/2x/cjs/components/tabs/tabs.css +4 -3
- package/2x/cjs/components/tabs/tabs.d.ts +1 -1
- package/2x/cjs/components/text-area/text-area.js +2 -1
- package/2x/cjs/components/toast/toast.css +1 -1
- package/2x/cjs/components/toast/toast.d.ts +2 -1
- package/2x/cjs/locales/fr-FR.d.ts +106 -0
- package/2x/cjs/locales/fr-FR.js +119 -0
- package/2x/cjs/utils/get-scroll-parent.js +1 -1
- package/2x/cjs/utils/render.js +14 -2
- 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/badge/badge.d.ts +1 -1
- package/2x/es/components/badge/badge.js +1 -1
- package/2x/es/components/badge/index.d.ts +1 -1
- package/2x/es/components/button/button.d.ts +6 -4
- package/2x/es/components/button/button.js +5 -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 +2 -2
- package/2x/es/components/dialog/dialog.d.ts +4 -1
- package/2x/es/components/dialog/dialog.js +23 -14
- package/2x/es/components/dropdown/dropdown.css +1 -1
- package/2x/es/components/error-block/images/busy.d.ts +1 -0
- package/2x/es/components/error-block/images/default.d.ts +1 -0
- package/2x/es/components/error-block/images/disconnected.d.ts +1 -0
- package/2x/es/components/error-block/images/empty.d.ts +1 -0
- package/2x/es/components/form/form-item.js +1 -4
- package/2x/es/components/image/broken-image-icon.d.ts +1 -0
- package/2x/es/components/image/broken-image-icon.js +9 -0
- package/2x/es/components/image/image-icon.d.ts +1 -0
- package/2x/es/components/image/image-icon.js +9 -0
- package/2x/es/components/image/image.css +4 -2
- package/2x/es/components/image/image.d.ts +2 -1
- package/2x/es/components/image/image.js +8 -5
- package/2x/es/components/image-uploader/image-uploader.js +2 -5
- 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/infinite-scroll/infinite-scroll.js +8 -6
- package/2x/es/components/mask/mask.js +10 -8
- package/2x/es/components/modal/modal.d.ts +4 -1
- package/2x/es/components/modal/modal.js +23 -12
- package/2x/es/components/popover/popover.css +1 -0
- package/2x/es/components/popup/popup.d.ts +2 -1
- package/2x/es/components/search-bar/search-bar.d.ts +1 -1
- package/2x/es/components/search-bar/search-bar.js +5 -8
- package/2x/es/components/side-bar/side-bar.d.ts +2 -1
- package/2x/es/components/swiper/index.d.ts +1 -1
- package/2x/es/components/swiper/swiper.d.ts +1 -1
- package/2x/es/components/tabs/tabs.css +4 -3
- package/2x/es/components/tabs/tabs.d.ts +1 -1
- package/2x/es/components/text-area/text-area.js +2 -1
- package/2x/es/components/toast/toast.css +1 -1
- package/2x/es/components/toast/toast.d.ts +2 -1
- package/2x/es/locales/fr-FR.d.ts +106 -0
- package/2x/es/locales/fr-FR.js +109 -0
- package/2x/es/utils/get-scroll-parent.js +1 -1
- package/2x/es/utils/render.js +14 -2
- 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 +6 -11
- package/README.md +10 -8
- package/bundle/antd-mobile.cjs.js +293 -229
- package/bundle/antd-mobile.es.js +295 -231
- package/bundle/style.css +110 -86
- package/cjs/components/action-sheet/action-sheet.css +19 -7
- package/cjs/components/action-sheet/action-sheet.js +8 -16
- package/cjs/components/badge/badge.d.ts +1 -1
- package/cjs/components/badge/badge.js +3 -1
- package/cjs/components/badge/index.d.ts +1 -1
- package/cjs/components/button/button.d.ts +6 -4
- package/cjs/components/button/button.js +5 -1
- package/cjs/components/calendar/calendar.css +3 -0
- package/cjs/components/calendar/calendar.d.ts +1 -0
- package/cjs/components/calendar/calendar.js +2 -2
- package/cjs/components/dialog/dialog.d.ts +4 -1
- package/cjs/components/dialog/dialog.js +24 -13
- package/cjs/components/dropdown/dropdown.css +1 -1
- package/cjs/components/error-block/images/busy.d.ts +1 -0
- package/cjs/components/error-block/images/default.d.ts +1 -0
- package/cjs/components/error-block/images/disconnected.d.ts +1 -0
- package/cjs/components/error-block/images/empty.d.ts +1 -0
- package/cjs/components/form/form-item.js +1 -4
- package/cjs/components/image/broken-image-icon.d.ts +1 -0
- package/cjs/components/image/broken-image-icon.js +21 -0
- package/cjs/components/image/image-icon.d.ts +1 -0
- package/cjs/components/image/image-icon.js +21 -0
- package/cjs/components/image/image.css +4 -2
- package/cjs/components/image/image.d.ts +2 -1
- package/cjs/components/image/image.js +10 -6
- package/cjs/components/image-uploader/image-uploader.js +1 -4
- 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/infinite-scroll/infinite-scroll.js +8 -6
- package/cjs/components/mask/mask.js +9 -7
- package/cjs/components/modal/modal.d.ts +4 -1
- package/cjs/components/modal/modal.js +24 -11
- package/cjs/components/popover/popover.css +1 -0
- package/cjs/components/popup/popup.d.ts +2 -1
- package/cjs/components/search-bar/search-bar.d.ts +1 -1
- package/cjs/components/search-bar/search-bar.js +5 -8
- package/cjs/components/side-bar/side-bar.d.ts +2 -1
- package/cjs/components/swiper/index.d.ts +1 -1
- package/cjs/components/swiper/swiper.d.ts +1 -1
- package/cjs/components/tabs/tabs.css +4 -3
- package/cjs/components/tabs/tabs.d.ts +1 -1
- package/cjs/components/text-area/text-area.js +2 -1
- package/cjs/components/toast/toast.css +1 -1
- package/cjs/components/toast/toast.d.ts +2 -1
- package/cjs/locales/fr-FR.d.ts +106 -0
- package/cjs/locales/fr-FR.js +119 -0
- package/cjs/utils/get-scroll-parent.js +1 -1
- package/cjs/utils/render.js +14 -2
- 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/badge/badge.d.ts +1 -1
- package/es/components/badge/badge.js +1 -1
- package/es/components/badge/index.d.ts +1 -1
- package/es/components/button/button.d.ts +6 -4
- package/es/components/button/button.js +5 -1
- package/es/components/calendar/calendar.css +3 -0
- package/es/components/calendar/calendar.d.ts +1 -0
- package/es/components/calendar/calendar.js +2 -2
- package/es/components/dialog/dialog.d.ts +4 -1
- package/es/components/dialog/dialog.js +23 -14
- package/es/components/dropdown/dropdown.css +1 -1
- package/es/components/error-block/images/busy.d.ts +1 -0
- package/es/components/error-block/images/default.d.ts +1 -0
- package/es/components/error-block/images/disconnected.d.ts +1 -0
- package/es/components/error-block/images/empty.d.ts +1 -0
- package/es/components/form/form-item.js +1 -4
- package/es/components/image/broken-image-icon.d.ts +1 -0
- package/es/components/image/broken-image-icon.js +9 -0
- package/es/components/image/image-icon.d.ts +1 -0
- package/es/components/image/image-icon.js +9 -0
- package/es/components/image/image.css +4 -2
- package/es/components/image/image.d.ts +2 -1
- package/es/components/image/image.js +8 -5
- package/es/components/image-uploader/image-uploader.js +2 -5
- 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/infinite-scroll/infinite-scroll.js +8 -6
- package/es/components/mask/mask.js +10 -8
- package/es/components/modal/modal.d.ts +4 -1
- package/es/components/modal/modal.js +23 -12
- package/es/components/popover/popover.css +1 -0
- package/es/components/popup/popup.d.ts +2 -1
- package/es/components/search-bar/search-bar.d.ts +1 -1
- package/es/components/search-bar/search-bar.js +5 -8
- package/es/components/side-bar/side-bar.d.ts +2 -1
- package/es/components/swiper/index.d.ts +1 -1
- package/es/components/swiper/swiper.d.ts +1 -1
- package/es/components/tabs/tabs.css +4 -3
- package/es/components/tabs/tabs.d.ts +1 -1
- package/es/components/text-area/text-area.js +2 -1
- package/es/components/toast/toast.css +1 -1
- package/es/components/toast/toast.d.ts +2 -1
- package/es/locales/fr-FR.d.ts +106 -0
- package/es/locales/fr-FR.js +109 -0
- package/es/utils/get-scroll-parent.js +1 -1
- package/es/utils/render.js +14 -2
- package/es/utils/use-inner-visible.d.ts +1 -0
- package/es/utils/use-inner-visible.js +9 -0
- package/package.json +6 -11
- package/umd/antd-mobile.js +1 -1
|
@@ -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>;
|
|
@@ -47,9 +47,11 @@ const InfiniteScroll = p => {
|
|
|
47
47
|
threshold: 250
|
|
48
48
|
}, p);
|
|
49
49
|
const doLoadMore = (0, _ahooks.useLockFn)(() => props.loadMore());
|
|
50
|
-
const elementRef = (0, _react.useRef)(null);
|
|
50
|
+
const elementRef = (0, _react.useRef)(null); // Prevent duplicated trigger of `check` function
|
|
51
|
+
|
|
51
52
|
const [flag, setFlag] = (0, _react.useState)({});
|
|
52
53
|
const nextFlagRef = (0, _react.useRef)(flag);
|
|
54
|
+
const [scrollParent, setScrollParent] = (0, _react.useState)();
|
|
53
55
|
const check = (0, _ahooks.useMemoizedFn)(() => (0, _tslib.__awaiter)(void 0, void 0, void 0, function* () {
|
|
54
56
|
if (nextFlagRef.current !== flag) return;
|
|
55
57
|
if (!props.hasMore) return;
|
|
@@ -57,6 +59,7 @@ const InfiniteScroll = p => {
|
|
|
57
59
|
if (!element) return;
|
|
58
60
|
if (!element.offsetParent) return;
|
|
59
61
|
const parent = (0, _getScrollParent.getScrollParent)(element);
|
|
62
|
+
setScrollParent(parent);
|
|
60
63
|
if (!parent) return;
|
|
61
64
|
const rect = element.getBoundingClientRect();
|
|
62
65
|
const elementTop = rect.top;
|
|
@@ -76,18 +79,17 @@ const InfiniteScroll = p => {
|
|
|
76
79
|
(0, _react.useEffect)(() => {
|
|
77
80
|
const element = elementRef.current;
|
|
78
81
|
if (!element) return;
|
|
79
|
-
|
|
80
|
-
if (!parent) return;
|
|
82
|
+
if (!scrollParent) return;
|
|
81
83
|
|
|
82
84
|
function onScroll() {
|
|
83
85
|
check();
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
scrollParent.addEventListener('scroll', onScroll);
|
|
87
89
|
return () => {
|
|
88
|
-
|
|
90
|
+
scrollParent.removeEventListener('scroll', onScroll);
|
|
89
91
|
};
|
|
90
|
-
}, []);
|
|
92
|
+
}, [scrollParent]);
|
|
91
93
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
92
94
|
className: classPrefix,
|
|
93
95
|
ref: elementRef
|
|
@@ -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;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FC, ReactNode } from 'react';
|
|
2
|
+
import type { MaskProps } from '../mask';
|
|
2
3
|
import { Action } from './modal-action-button';
|
|
3
4
|
import { GetContainer } from '../../utils/render-to-container';
|
|
4
5
|
import { PropagationEvent } from '../../utils/with-stop-propagation';
|
|
@@ -19,10 +20,12 @@ export declare type ModalProps = {
|
|
|
19
20
|
getContainer?: GetContainer;
|
|
20
21
|
bodyStyle?: React.CSSProperties;
|
|
21
22
|
bodyClassName?: string;
|
|
22
|
-
maskStyle?:
|
|
23
|
+
maskStyle?: MaskProps['style'];
|
|
23
24
|
maskClassName?: string;
|
|
24
25
|
stopPropagation?: PropagationEvent[];
|
|
25
26
|
showCloseButton?: boolean;
|
|
26
27
|
disableBodyScroll?: boolean;
|
|
28
|
+
destroyOnClose?: boolean;
|
|
29
|
+
forceRender?: boolean;
|
|
27
30
|
} & NativeProps;
|
|
28
31
|
export declare const Modal: FC<ModalProps>;
|
|
@@ -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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import type { MaskProps } from '../mask';
|
|
3
4
|
import { GetContainer } from '../../utils/render-to-container';
|
|
4
5
|
import { PropagationEvent } from '../../utils/with-stop-propagation';
|
|
5
6
|
export declare type PopupProps = {
|
|
@@ -15,7 +16,7 @@ export declare type PopupProps = {
|
|
|
15
16
|
bodyClassName?: string;
|
|
16
17
|
bodyStyle?: React.CSSProperties;
|
|
17
18
|
maskClassName?: string;
|
|
18
|
-
maskStyle?:
|
|
19
|
+
maskStyle?: MaskProps['style'];
|
|
19
20
|
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
20
21
|
stopPropagation?: PropagationEvent[];
|
|
21
22
|
children?: React.ReactNode;
|
|
@@ -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>>;
|
|
@@ -74,7 +74,7 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
74
74
|
}));
|
|
75
75
|
|
|
76
76
|
const renderCancelButton = () => {
|
|
77
|
-
let isShowCancel
|
|
77
|
+
let isShowCancel;
|
|
78
78
|
|
|
79
79
|
if (typeof props.showCancelButton === 'function') {
|
|
80
80
|
isShowCancel = props.showCancelButton(hasFocus, value);
|
|
@@ -83,13 +83,7 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
return isShowCancel && _react.default.createElement("div", {
|
|
86
|
-
className: `${classPrefix}-suffix
|
|
87
|
-
onMouseDown: e => {
|
|
88
|
-
e.preventDefault();
|
|
89
|
-
},
|
|
90
|
-
onTouchStart: e => {
|
|
91
|
-
e.preventDefault();
|
|
92
|
-
}
|
|
86
|
+
className: `${classPrefix}-suffix`
|
|
93
87
|
}, _react.default.createElement(_button.default, {
|
|
94
88
|
fill: 'none',
|
|
95
89
|
className: `${classPrefix}-cancel-button`,
|
|
@@ -102,6 +96,9 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
102
96
|
|
|
103
97
|
(_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
104
98
|
(_c = props.onCancel) === null || _c === void 0 ? void 0 : _c.call(props);
|
|
99
|
+
},
|
|
100
|
+
onMouseDown: e => {
|
|
101
|
+
e.preventDefault();
|
|
105
102
|
}
|
|
106
103
|
}, props.cancelText));
|
|
107
104
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { BadgeProps } from '../badge';
|
|
3
4
|
import { NativeProps } from '../../utils/native-props';
|
|
4
5
|
export declare type SideBarItemProps = {
|
|
5
6
|
title?: ReactNode;
|
|
6
7
|
disabled?: boolean;
|
|
7
|
-
badge?:
|
|
8
|
+
badge?: BadgeProps['content'];
|
|
8
9
|
} & NativeProps;
|
|
9
10
|
export declare const SideBarItem: FC<SideBarItemProps>;
|
|
10
11
|
export declare type SideBarProps = {
|
|
@@ -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>>;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
--content-padding: 24px;
|
|
4
4
|
--active-line-height: 4px;
|
|
5
5
|
--active-line-border-radius: var(--active-line-height);
|
|
6
|
+
--active-line-color: var(--adm-color-primary);
|
|
7
|
+
--active-title-color: var(--adm-color-primary);
|
|
6
8
|
position: relative;
|
|
7
9
|
min-width: 0;
|
|
8
10
|
}
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
.adm-tabs-tab-active {
|
|
48
|
-
color: var(--
|
|
50
|
+
color: var(--active-title-color);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
.adm-tabs-tab-disabled {
|
|
@@ -57,8 +59,7 @@
|
|
|
57
59
|
position: absolute;
|
|
58
60
|
bottom: 0;
|
|
59
61
|
height: var(--active-line-height);
|
|
60
|
-
|
|
61
|
-
background: var(--adm-color-primary);
|
|
62
|
+
background: var(--active-line-color);
|
|
62
63
|
border-radius: var(--active-line-border-radius);
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -15,5 +15,5 @@ export declare type TabsProps = {
|
|
|
15
15
|
stretch?: boolean;
|
|
16
16
|
onChange?: (key: string) => void;
|
|
17
17
|
children?: React.ReactNode;
|
|
18
|
-
} & NativeProps<'--fixed-active-line-width' | '--active-line-height' | '--active-line-border-radius' | '--title-font-size' | '--content-padding'>;
|
|
18
|
+
} & NativeProps<'--fixed-active-line-width' | '--active-line-height' | '--active-line-border-radius' | '--title-font-size' | '--content-padding' | '--active-title-color' | '--active-line-color'>;
|
|
19
19
|
export declare const Tabs: FC<TabsProps>;
|
|
@@ -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);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import type { MaskProps } from '../mask';
|
|
2
3
|
import { PropagationEvent } from '../../utils/with-stop-propagation';
|
|
3
4
|
import { GetContainer } from '../../utils/render-to-container';
|
|
4
5
|
export interface ToastProps {
|
|
5
6
|
afterClose?: () => void;
|
|
6
|
-
maskStyle?:
|
|
7
|
+
maskStyle?: MaskProps['style'];
|
|
7
8
|
maskClassName?: string;
|
|
8
9
|
maskClickable?: boolean;
|
|
9
10
|
content?: ReactNode;
|
|
@@ -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;
|