antd-mobile 5.5.0 → 5.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2x/cjs/components/action-sheet/action-sheet.d.ts +5 -5
- package/2x/cjs/components/action-sheet/action-sheet.js +6 -46
- package/2x/cjs/components/action-sheet/index.d.ts +1 -1
- package/2x/cjs/components/badge/badge.js +1 -1
- package/2x/cjs/components/cascader-view/cascader-view.js +7 -0
- package/2x/cjs/components/checkbox/checkbox.js +4 -20
- package/2x/cjs/components/checkbox/native-input.d.ts +10 -0
- package/2x/cjs/components/checkbox/native-input.js +42 -0
- package/2x/cjs/components/dialog/index.d.ts +1 -1
- package/2x/cjs/components/dialog/show.d.ts +2 -4
- package/2x/cjs/components/dialog/show.js +9 -47
- package/2x/cjs/components/dot-loading/dot-loading.js +1 -2
- package/2x/cjs/components/empty/empty-icon.d.ts +3 -0
- package/2x/cjs/components/empty/empty-icon.js +37 -0
- package/2x/cjs/components/empty/empty.js +27 -15
- package/2x/cjs/components/error-block/error-block.css +1 -0
- package/2x/cjs/components/error-block/error-block.js +5 -8
- package/2x/cjs/components/error-block/images/busy.d.ts +1 -0
- package/2x/cjs/components/error-block/images/busy.js +102 -0
- package/2x/cjs/components/error-block/images/default.d.ts +1 -0
- package/2x/cjs/components/error-block/images/default.js +178 -0
- package/2x/cjs/components/error-block/images/disconnected.d.ts +1 -0
- package/2x/cjs/components/error-block/images/disconnected.js +135 -0
- package/2x/cjs/components/error-block/images/empty.d.ts +1 -0
- package/2x/cjs/components/error-block/images/empty.js +131 -0
- package/2x/cjs/components/error-block/images/index.d.ts +2 -0
- package/2x/cjs/components/error-block/images/index.js +22 -0
- package/2x/cjs/components/floating-bubble/floating-bubble.css +2 -1
- package/2x/cjs/components/floating-bubble/floating-bubble.d.ts +1 -1
- package/2x/cjs/components/form/form-item.d.ts +1 -1
- package/2x/cjs/components/form/form-item.js +4 -1
- package/2x/cjs/components/image-viewer/index.d.ts +1 -1
- package/2x/cjs/components/image-viewer/methods.d.ts +3 -7
- package/2x/cjs/components/image-viewer/methods.js +13 -79
- package/2x/cjs/components/modal/index.d.ts +1 -1
- package/2x/cjs/components/modal/show.d.ts +2 -4
- package/2x/cjs/components/modal/show.js +9 -47
- package/2x/cjs/components/popover/popover.css +1 -0
- package/2x/cjs/components/popover/popover.js +7 -6
- package/2x/cjs/components/popover/temp-floating-ui.min.d.ts +1 -0
- package/2x/cjs/components/popover/temp-floating-ui.min.js +1 -0
- package/2x/cjs/components/radio/radio.js +4 -20
- package/2x/cjs/components/search-bar/search-bar.d.ts +1 -1
- package/2x/cjs/components/tab-bar/tab-bar.d.ts +1 -1
- package/2x/cjs/components/tab-bar/tab-bar.js +1 -1
- package/2x/cjs/components/tree-select/tree-select.js +2 -2
- package/2x/cjs/utils/render-imperatively.d.ts +10 -0
- package/2x/cjs/utils/render-imperatively.js +68 -0
- package/2x/es/components/action-sheet/action-sheet.d.ts +5 -5
- package/2x/es/components/action-sheet/action-sheet.js +5 -41
- package/2x/es/components/action-sheet/index.d.ts +1 -1
- package/2x/es/components/badge/badge.js +1 -1
- package/2x/es/components/cascader-view/cascader-view.js +7 -0
- package/2x/es/components/checkbox/checkbox.js +4 -21
- package/2x/es/components/checkbox/native-input.d.ts +10 -0
- package/2x/es/components/checkbox/native-input.js +28 -0
- package/2x/es/components/dialog/index.d.ts +1 -1
- package/2x/es/components/dialog/show.d.ts +2 -4
- package/2x/es/components/dialog/show.js +8 -44
- package/2x/es/components/dot-loading/dot-loading.js +1 -2
- package/2x/es/components/empty/empty-icon.d.ts +3 -0
- package/2x/es/components/empty/empty-icon.js +24 -0
- package/2x/es/components/empty/empty.js +27 -14
- package/2x/es/components/error-block/error-block.css +1 -0
- package/2x/es/components/error-block/error-block.js +4 -6
- package/2x/es/components/error-block/images/busy.d.ts +1 -0
- package/2x/es/components/error-block/images/busy.js +90 -0
- package/2x/es/components/error-block/images/default.d.ts +1 -0
- package/2x/es/components/error-block/images/default.js +166 -0
- package/2x/es/components/error-block/images/disconnected.d.ts +1 -0
- package/2x/es/components/error-block/images/disconnected.js +123 -0
- package/2x/es/components/error-block/images/empty.d.ts +1 -0
- package/2x/es/components/error-block/images/empty.js +119 -0
- package/2x/es/components/error-block/images/index.d.ts +2 -0
- package/2x/es/components/error-block/images/index.js +10 -0
- package/2x/es/components/floating-bubble/floating-bubble.css +2 -1
- package/2x/es/components/floating-bubble/floating-bubble.d.ts +1 -1
- package/2x/es/components/form/form-item.d.ts +1 -1
- package/2x/es/components/form/form-item.js +4 -1
- package/2x/es/components/image-viewer/index.d.ts +1 -1
- package/2x/es/components/image-viewer/methods.d.ts +3 -7
- package/2x/es/components/image-viewer/methods.js +12 -75
- package/2x/es/components/modal/index.d.ts +1 -1
- package/2x/es/components/modal/show.d.ts +2 -4
- package/2x/es/components/modal/show.js +8 -44
- package/2x/es/components/popover/popover.css +1 -0
- package/2x/es/components/popover/popover.js +2 -1
- package/2x/es/components/popover/temp-floating-ui.min.d.ts +1 -0
- package/2x/es/components/popover/temp-floating-ui.min.js +1 -0
- package/2x/es/components/radio/radio.js +4 -21
- package/2x/es/components/search-bar/search-bar.d.ts +1 -1
- package/2x/es/components/tab-bar/tab-bar.d.ts +1 -1
- package/2x/es/components/tab-bar/tab-bar.js +1 -1
- package/2x/es/components/tree-select/tree-select.js +2 -2
- package/2x/es/utils/render-imperatively.d.ts +10 -0
- package/2x/es/utils/render-imperatively.js +53 -0
- package/2x/package.json +2 -3
- package/cjs/components/action-sheet/action-sheet.d.ts +5 -5
- package/cjs/components/action-sheet/action-sheet.js +6 -46
- package/cjs/components/action-sheet/index.d.ts +1 -1
- package/cjs/components/badge/badge.js +1 -1
- package/cjs/components/cascader-view/cascader-view.js +7 -0
- package/cjs/components/checkbox/checkbox.js +4 -20
- package/cjs/components/checkbox/native-input.d.ts +10 -0
- package/cjs/components/checkbox/native-input.js +42 -0
- package/cjs/components/dialog/index.d.ts +1 -1
- package/cjs/components/dialog/show.d.ts +2 -4
- package/cjs/components/dialog/show.js +9 -47
- package/cjs/components/dot-loading/dot-loading.js +1 -2
- package/cjs/components/empty/empty-icon.d.ts +3 -0
- package/cjs/components/empty/empty-icon.js +37 -0
- package/cjs/components/empty/empty.js +27 -15
- package/cjs/components/error-block/error-block.css +1 -0
- package/cjs/components/error-block/error-block.js +5 -8
- package/cjs/components/error-block/images/busy.d.ts +1 -0
- package/cjs/components/error-block/images/busy.js +102 -0
- package/cjs/components/error-block/images/default.d.ts +1 -0
- package/cjs/components/error-block/images/default.js +178 -0
- package/cjs/components/error-block/images/disconnected.d.ts +1 -0
- package/cjs/components/error-block/images/disconnected.js +135 -0
- package/cjs/components/error-block/images/empty.d.ts +1 -0
- package/cjs/components/error-block/images/empty.js +131 -0
- package/cjs/components/error-block/images/index.d.ts +2 -0
- package/cjs/components/error-block/images/index.js +22 -0
- package/cjs/components/floating-bubble/floating-bubble.css +2 -1
- package/cjs/components/floating-bubble/floating-bubble.d.ts +1 -1
- package/cjs/components/form/form-item.d.ts +1 -1
- package/cjs/components/form/form-item.js +4 -1
- package/cjs/components/image-viewer/index.d.ts +1 -1
- package/cjs/components/image-viewer/methods.d.ts +3 -7
- package/cjs/components/image-viewer/methods.js +13 -79
- package/cjs/components/modal/index.d.ts +1 -1
- package/cjs/components/modal/show.d.ts +2 -4
- package/cjs/components/modal/show.js +9 -47
- package/cjs/components/popover/popover.css +1 -0
- package/cjs/components/popover/popover.js +7 -6
- package/cjs/components/popover/temp-floating-ui.min.d.ts +1 -0
- package/cjs/components/popover/temp-floating-ui.min.js +1 -0
- package/cjs/components/radio/radio.js +4 -20
- package/cjs/components/search-bar/search-bar.d.ts +1 -1
- package/cjs/components/tab-bar/tab-bar.d.ts +1 -1
- package/cjs/components/tab-bar/tab-bar.js +1 -1
- package/cjs/components/tree-select/tree-select.js +2 -2
- package/cjs/utils/render-imperatively.d.ts +10 -0
- package/cjs/utils/render-imperatively.js +68 -0
- package/es/components/action-sheet/action-sheet.d.ts +5 -5
- package/es/components/action-sheet/action-sheet.js +5 -41
- package/es/components/action-sheet/index.d.ts +1 -1
- package/es/components/badge/badge.js +1 -1
- package/es/components/cascader-view/cascader-view.js +7 -0
- package/es/components/checkbox/checkbox.js +4 -21
- package/es/components/checkbox/native-input.d.ts +10 -0
- package/es/components/checkbox/native-input.js +28 -0
- package/es/components/dialog/index.d.ts +1 -1
- package/es/components/dialog/show.d.ts +2 -4
- package/es/components/dialog/show.js +8 -44
- package/es/components/dot-loading/dot-loading.js +1 -2
- package/es/components/empty/empty-icon.d.ts +3 -0
- package/es/components/empty/empty-icon.js +24 -0
- package/es/components/empty/empty.js +27 -14
- package/es/components/error-block/error-block.css +1 -0
- package/es/components/error-block/error-block.js +4 -6
- package/es/components/error-block/images/busy.d.ts +1 -0
- package/es/components/error-block/images/busy.js +90 -0
- package/es/components/error-block/images/default.d.ts +1 -0
- package/es/components/error-block/images/default.js +166 -0
- package/es/components/error-block/images/disconnected.d.ts +1 -0
- package/es/components/error-block/images/disconnected.js +123 -0
- package/es/components/error-block/images/empty.d.ts +1 -0
- package/es/components/error-block/images/empty.js +119 -0
- package/es/components/error-block/images/index.d.ts +2 -0
- package/es/components/error-block/images/index.js +10 -0
- package/es/components/floating-bubble/floating-bubble.css +2 -1
- package/es/components/floating-bubble/floating-bubble.d.ts +1 -1
- package/es/components/form/form-item.d.ts +1 -1
- package/es/components/form/form-item.js +4 -1
- package/es/components/image-viewer/index.d.ts +1 -1
- package/es/components/image-viewer/methods.d.ts +3 -7
- package/es/components/image-viewer/methods.js +12 -75
- package/es/components/modal/index.d.ts +1 -1
- package/es/components/modal/show.d.ts +2 -4
- package/es/components/modal/show.js +8 -44
- package/es/components/popover/popover.css +1 -0
- package/es/components/popover/popover.js +2 -1
- package/es/components/popover/temp-floating-ui.min.d.ts +1 -0
- package/es/components/popover/temp-floating-ui.min.js +1 -0
- package/es/components/radio/radio.js +4 -21
- package/es/components/search-bar/search-bar.d.ts +1 -1
- package/es/components/tab-bar/tab-bar.d.ts +1 -1
- package/es/components/tab-bar/tab-bar.js +1 -1
- package/es/components/tree-select/tree-select.js +2 -2
- package/es/utils/render-imperatively.d.ts +10 -0
- package/es/utils/render-imperatively.js +53 -0
- package/package.json +2 -3
- package/umd/antd-mobile.js +1 -1
- package/2x/assets/busy.svg +0 -42
- package/2x/assets/default.svg +0 -53
- package/2x/assets/disconnected.svg +0 -60
- package/2x/assets/empty-icon.svg +0 -18
- package/2x/assets/empty.svg +0 -52
- package/2x/cjs/assets/busy.svg +0 -42
- package/2x/cjs/assets/default.svg +0 -53
- package/2x/cjs/assets/disconnected.svg +0 -60
- package/2x/cjs/assets/empty-icon.svg +0 -18
- package/2x/cjs/assets/empty.svg +0 -52
- package/2x/cjs/components/error-block/error.d.ts +0 -1
- package/2x/cjs/components/error-block/error.js +0 -24
- package/2x/es/assets/busy.svg +0 -42
- package/2x/es/assets/default.svg +0 -53
- package/2x/es/assets/disconnected.svg +0 -60
- package/2x/es/assets/empty-icon.svg +0 -18
- package/2x/es/assets/empty.svg +0 -52
- package/2x/es/components/error-block/error.d.ts +0 -1
- package/2x/es/components/error-block/error.js +0 -10
- package/assets/busy.svg +0 -42
- package/assets/default.svg +0 -53
- package/assets/disconnected.svg +0 -60
- package/assets/empty-icon.svg +0 -18
- package/assets/empty.svg +0 -52
- package/cjs/assets/busy.svg +0 -42
- package/cjs/assets/default.svg +0 -53
- package/cjs/assets/disconnected.svg +0 -60
- package/cjs/assets/empty-icon.svg +0 -18
- package/cjs/assets/empty.svg +0 -52
- package/cjs/components/error-block/error.d.ts +0 -1
- package/cjs/components/error-block/error.js +0 -24
- package/es/assets/busy.svg +0 -42
- package/es/assets/default.svg +0 -53
- package/es/assets/disconnected.svg +0 -60
- package/es/assets/empty-icon.svg +0 -18
- package/es/assets/empty.svg +0 -52
- package/es/components/error-block/error.d.ts +0 -1
- package/es/components/error-block/error.js +0 -10
|
@@ -7,106 +7,40 @@ exports.clearImageViewer = clearImageViewer;
|
|
|
7
7
|
exports.showImageViewer = showImageViewer;
|
|
8
8
|
exports.showMultiImageViewer = showMultiImageViewer;
|
|
9
9
|
|
|
10
|
-
var _react =
|
|
11
|
-
|
|
12
|
-
var _renderToBody = require("../../utils/render-to-body");
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
11
|
|
|
14
12
|
var _imageViewer = require("./image-viewer");
|
|
15
13
|
|
|
16
|
-
var
|
|
17
|
-
|
|
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); }
|
|
14
|
+
var _renderImperatively = require("../../utils/render-imperatively");
|
|
19
15
|
|
|
20
|
-
function
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
17
|
|
|
22
18
|
const handlerSet = new Set();
|
|
23
19
|
|
|
24
20
|
function showImageViewer(props) {
|
|
25
21
|
clearImageViewer();
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
(0, _react.useEffect)(() => {
|
|
29
|
-
setVisible(true);
|
|
30
|
-
}, []);
|
|
31
|
-
const isUnmountedRef = (0, _ahooks.useUnmountedRef)();
|
|
32
|
-
(0, _react.useImperativeHandle)(ref, () => ({
|
|
33
|
-
close: () => {
|
|
34
|
-
if (isUnmountedRef.current) return;
|
|
35
|
-
setVisible(false);
|
|
36
|
-
}
|
|
37
|
-
}));
|
|
38
|
-
return _react.default.createElement(_imageViewer.ImageViewer, Object.assign({}, props, {
|
|
39
|
-
visible: visible,
|
|
40
|
-
onClose: () => {
|
|
41
|
-
var _a;
|
|
42
|
-
|
|
43
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
44
|
-
setVisible(false);
|
|
45
|
-
},
|
|
46
|
-
afterClose: () => {
|
|
47
|
-
var _a;
|
|
48
|
-
|
|
49
|
-
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
50
|
-
unmount();
|
|
51
|
-
}
|
|
52
|
-
}));
|
|
53
|
-
});
|
|
54
|
-
const ref = (0, _react.createRef)();
|
|
55
|
-
const unmount = (0, _renderToBody.renderToBody)(_react.default.createElement(Wrapper, {
|
|
56
|
-
ref: ref
|
|
57
|
-
}));
|
|
58
|
-
const handler = {
|
|
59
|
-
close: () => {
|
|
22
|
+
const handler = (0, _renderImperatively.renderImperatively)(_react.default.createElement(_imageViewer.ImageViewer, Object.assign({}, props, {
|
|
23
|
+
afterClose: () => {
|
|
60
24
|
var _a;
|
|
61
25
|
|
|
62
|
-
|
|
26
|
+
handlerSet.delete(handler);
|
|
27
|
+
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
63
28
|
}
|
|
64
|
-
};
|
|
29
|
+
})));
|
|
65
30
|
handlerSet.add(handler);
|
|
66
31
|
return handler;
|
|
67
32
|
}
|
|
68
33
|
|
|
69
34
|
function showMultiImageViewer(props) {
|
|
70
35
|
clearImageViewer();
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
(0, _react.useEffect)(() => {
|
|
74
|
-
setVisible(true);
|
|
75
|
-
}, []);
|
|
76
|
-
const isUnmountedRef = (0, _ahooks.useUnmountedRef)();
|
|
77
|
-
(0, _react.useImperativeHandle)(ref, () => ({
|
|
78
|
-
close: () => {
|
|
79
|
-
if (isUnmountedRef.current) return;
|
|
80
|
-
setVisible(false);
|
|
81
|
-
}
|
|
82
|
-
}));
|
|
83
|
-
return _react.default.createElement(_imageViewer.MultiImageViewer, Object.assign({}, props, {
|
|
84
|
-
visible: visible,
|
|
85
|
-
onClose: () => {
|
|
86
|
-
var _a;
|
|
87
|
-
|
|
88
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
89
|
-
setVisible(false);
|
|
90
|
-
},
|
|
91
|
-
afterClose: () => {
|
|
92
|
-
var _a;
|
|
93
|
-
|
|
94
|
-
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
95
|
-
unmount();
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
});
|
|
99
|
-
const ref = (0, _react.createRef)();
|
|
100
|
-
const unmount = (0, _renderToBody.renderToBody)(_react.default.createElement(Wrapper, {
|
|
101
|
-
ref: ref
|
|
102
|
-
}));
|
|
103
|
-
const handler = {
|
|
104
|
-
close: () => {
|
|
36
|
+
const handler = (0, _renderImperatively.renderImperatively)(_react.default.createElement(_imageViewer.MultiImageViewer, Object.assign({}, props, {
|
|
37
|
+
afterClose: () => {
|
|
105
38
|
var _a;
|
|
106
39
|
|
|
107
|
-
|
|
40
|
+
handlerSet.delete(handler);
|
|
41
|
+
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
108
42
|
}
|
|
109
|
-
};
|
|
43
|
+
})));
|
|
110
44
|
handlerSet.add(handler);
|
|
111
45
|
return handler;
|
|
112
46
|
}
|
|
@@ -6,7 +6,7 @@ import { confirm } from './confirm';
|
|
|
6
6
|
import { clear } from './clear';
|
|
7
7
|
export type { ModalProps } from './modal';
|
|
8
8
|
export type { Action } from './modal-action-button';
|
|
9
|
-
export type { ModalShowProps,
|
|
9
|
+
export type { ModalShowProps, ModalShowHandler } from './show';
|
|
10
10
|
export type { ModalAlertProps } from './alert';
|
|
11
11
|
export type { ModalConfirmProps } from './confirm';
|
|
12
12
|
declare const _default: import("react").FC<import("./modal").ModalProps> & {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ModalProps } from './modal';
|
|
2
2
|
export declare type ModalShowProps = Omit<ModalProps, 'visible'>;
|
|
3
|
-
export declare type
|
|
3
|
+
export declare type ModalShowHandler = {
|
|
4
4
|
close: () => void;
|
|
5
5
|
};
|
|
6
6
|
export declare const closeFnSet: Set<() => void>;
|
|
7
|
-
export declare function show(props: ModalShowProps):
|
|
8
|
-
close: () => void;
|
|
9
|
-
};
|
|
7
|
+
export declare function show(props: ModalShowProps): ModalShowHandler;
|
|
@@ -6,64 +6,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.closeFnSet = void 0;
|
|
7
7
|
exports.show = show;
|
|
8
8
|
|
|
9
|
-
var _react =
|
|
10
|
-
|
|
11
|
-
var _renderToBody = require("../../utils/render-to-body");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
10
|
|
|
13
11
|
var _modal = require("./modal");
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
var _renderImperatively = require("../../utils/render-imperatively");
|
|
16
14
|
|
|
17
|
-
function
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
16
|
|
|
19
17
|
const closeFnSet = new Set();
|
|
20
18
|
exports.closeFnSet = closeFnSet;
|
|
21
19
|
|
|
22
20
|
function show(props) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
(0, _react.useEffect)(() => {
|
|
26
|
-
setVisible(true);
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
function handleClose() {
|
|
30
|
-
var _a;
|
|
31
|
-
|
|
32
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
33
|
-
setVisible(false);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
(0, _react.useImperativeHandle)(ref, () => ({
|
|
37
|
-
close: handleClose
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
function handleAfterClose() {
|
|
21
|
+
const handler = (0, _renderImperatively.renderImperatively)(_react.default.createElement(_modal.Modal, Object.assign({}, props, {
|
|
22
|
+
afterClose: () => {
|
|
41
23
|
var _a;
|
|
42
24
|
|
|
25
|
+
closeFnSet.delete(handler.close);
|
|
43
26
|
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
44
|
-
unmount();
|
|
45
|
-
closeFnSet.delete(close);
|
|
46
27
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onClose: handleClose,
|
|
51
|
-
afterClose: handleAfterClose
|
|
52
|
-
}));
|
|
53
|
-
});
|
|
54
|
-
const ref = (0, _react.createRef)();
|
|
55
|
-
const unmount = (0, _renderToBody.renderToBody)(_react.default.createElement(Wrapper, {
|
|
56
|
-
ref: ref
|
|
57
|
-
}));
|
|
58
|
-
|
|
59
|
-
const close = () => {
|
|
60
|
-
var _a;
|
|
61
|
-
|
|
62
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
closeFnSet.add(close);
|
|
66
|
-
return {
|
|
67
|
-
close
|
|
68
|
-
};
|
|
28
|
+
})));
|
|
29
|
+
closeFnSet.add(handler.close);
|
|
30
|
+
return handler;
|
|
69
31
|
}
|
|
@@ -23,7 +23,7 @@ var _arrow = require("./arrow");
|
|
|
23
23
|
|
|
24
24
|
var _renderToContainer = require("../../utils/render-to-container");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _tempFloatingUiMin = require("./temp-floating-ui.min.js");
|
|
27
27
|
|
|
28
28
|
var _wrapper = require("./wrapper");
|
|
29
29
|
|
|
@@ -98,13 +98,13 @@ const Popover = (0, _react.forwardRef)((p, ref) => {
|
|
|
98
98
|
y,
|
|
99
99
|
placement: realPlacement,
|
|
100
100
|
middlewareData
|
|
101
|
-
} = yield (0,
|
|
101
|
+
} = yield (0, _tempFloatingUiMin.computePosition)(target, floating, {
|
|
102
102
|
placement,
|
|
103
|
-
middleware: [(0,
|
|
103
|
+
middleware: [(0, _tempFloatingUiMin.offset)((0, _convertPx.convertPx)(12)), (0, _tempFloatingUiMin.shift)({
|
|
104
104
|
padding: (0, _convertPx.convertPx)(4),
|
|
105
105
|
crossAxis: false,
|
|
106
|
-
limiter: (0,
|
|
107
|
-
}), (0,
|
|
106
|
+
limiter: (0, _tempFloatingUiMin.limitShift)()
|
|
107
|
+
}), (0, _tempFloatingUiMin.flip)(), (0, _tempFloatingUiMin.hide)(), (0, _tempFloatingUiMin.arrow)({
|
|
108
108
|
element: arrowElement,
|
|
109
109
|
padding: (0, _convertPx.convertPx)(12)
|
|
110
110
|
})]
|
|
@@ -149,6 +149,7 @@ const Popover = (0, _react.forwardRef)((p, ref) => {
|
|
|
149
149
|
if (!props.trigger) return;
|
|
150
150
|
|
|
151
151
|
function handleClick() {
|
|
152
|
+
console.log('handleClick');
|
|
152
153
|
setVisible(v => !v);
|
|
153
154
|
}
|
|
154
155
|
|
|
@@ -160,7 +161,7 @@ const Popover = (0, _react.forwardRef)((p, ref) => {
|
|
|
160
161
|
(0, _react.useEffect)(() => {
|
|
161
162
|
const floatingElement = floatingRef.current;
|
|
162
163
|
if (!targetElement || !floatingElement) return;
|
|
163
|
-
return (0,
|
|
164
|
+
return (0, _tempFloatingUiMin.autoUpdate)(targetElement, floatingElement, update);
|
|
164
165
|
}, [targetElement]);
|
|
165
166
|
(0, _ahooks.useClickAway)(() => {
|
|
166
167
|
if (!props.trigger) return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@floating-ui/dom'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@floating-ui/core")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUIDOM={},t.FloatingUICore)}(this,(function(t,e){"use strict";function n(t){return"[object Window]"===(null==t?void 0:t.toString())}function o(t){if(null==t)return window;if(!n(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function i(t){return o(t).getComputedStyle(t)}function r(t){return n(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(t){return t instanceof o(t).HTMLElement}function c(t){return t instanceof o(t).Element}function f(t){return t instanceof o(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:n,overflowY:o}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function s(t){return["table","td","th"].includes(r(t))}function d(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=i(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}const h=Math.min,a=Math.max,g=Math.round;function p(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&l(t)&&(o=t.offsetWidth>0&&g(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&g(n.height)/t.offsetHeight||1),{width:n.width/o,height:n.height/i,top:n.top/i,right:n.right/o,bottom:n.bottom/i,left:n.left/o,x:n.left/o,y:n.top/i}}function m(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function y(t){return n(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function w(t){return p(m(t)).left+y(t).scrollLeft}function b(t,e,n){const o=l(e),i=m(e),c=p(t,o&&function(t){const e=p(t);return g(e.width)!==t.offsetWidth||g(e.height)!==t.offsetHeight}(e));let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||u(i))&&(f=y(e)),l(e)){const t=p(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=w(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function v(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||m(t)}function x(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function L(t){const e=o(t);let n=x(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=x(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=v(t);for(f(e)&&(e=e.host);l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function O(t){if(l(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=p(t);return{width:e.width,height:e.height}}function P(t){const e=v(t);return["html","body","#document"].includes(r(e))?t.ownerDocument.body:l(e)&&u(e)?e:P(e)}function R(t,e){var n;void 0===e&&(e=[]);const i=P(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=o(i),c=r?[l].concat(l.visualViewport||[],u(i)?i:[]):i,f=e.concat(c);return r?f:f.concat(R(v(c)))}function T(t,n){return"viewport"===n?e.rectToClientRect(function(t){const e=o(t),n=m(t),i=e.visualViewport;let r=n.clientWidth,l=n.clientHeight,c=0,f=0;return i&&(r=i.width,l=i.height,Math.abs(e.innerWidth/i.scale-i.width)<.01&&(c=i.offsetLeft,f=i.offsetTop)),{width:r,height:l,x:c,y:f}}(t)):c(n)?function(t){const e=p(t),n=e.top+t.clientTop,o=e.left+t.clientLeft;return{top:n,left:o,x:o,y:n,right:o+t.clientWidth,bottom:n+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n):e.rectToClientRect(function(t){var e;const n=m(t),o=y(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=a(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=a(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+w(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=a(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(m(t)))}function C(t){const e=R(t),n=["absolute","fixed"].includes(i(t).position)&&l(t)?L(t):t;return c(n)?e.filter((t=>c(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&f(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,n)&&"body"!==r(t))):[]}const W={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingAncestors"===n?C(e):[].concat(n),o],r=i[0],l=i.reduce(((t,n)=>{const o=T(e,n);return t.top=a(o.top,t.top),t.right=h(o.right,t.right),t.bottom=h(o.bottom,t.bottom),t.left=a(o.left,t.left),t}),T(e,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=l(n),c=m(n);if(n===c)return e;let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||u(c))&&(f=y(n)),l(n))){const t=p(n,!0);s.x=t.x+n.clientLeft,s.y=t.y+n.clientTop}return{...e,x:e.x-f.scrollLeft+s.x,y:e.y-f.scrollTop+s.y}},isElement:c,getDimensions:O,getOffsetParent:L,getDocumentElement:m,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:b(e,L(n),o),floating:{...O(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===i(t).direction};Object.defineProperty(t,"arrow",{enumerable:!0,get:function(){return e.arrow}}),Object.defineProperty(t,"autoPlacement",{enumerable:!0,get:function(){return e.autoPlacement}}),Object.defineProperty(t,"detectOverflow",{enumerable:!0,get:function(){return e.detectOverflow}}),Object.defineProperty(t,"flip",{enumerable:!0,get:function(){return e.flip}}),Object.defineProperty(t,"hide",{enumerable:!0,get:function(){return e.hide}}),Object.defineProperty(t,"inline",{enumerable:!0,get:function(){return e.inline}}),Object.defineProperty(t,"limitShift",{enumerable:!0,get:function(){return e.limitShift}}),Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}}),Object.defineProperty(t,"shift",{enumerable:!0,get:function(){return e.shift}}),Object.defineProperty(t,"size",{enumerable:!0,get:function(){return e.size}}),t.autoUpdate=function(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:f=!1}=o;let u=!1;const s=i&&!f,d=r&&!f,h=l&&!f,a=s||d?[...c(t)?R(t):[],...R(e)]:[];a.forEach((t=>{s&&t.addEventListener("scroll",n,{passive:!0}),d&&t.addEventListener("resize",n)}));let g,m=null;h&&(m=new ResizeObserver(n),c(t)&&m.observe(t),m.observe(e));let y=f?p(t):null;return f&&function e(){if(u)return;const o=p(t);!y||o.x===y.x&&o.y===y.y&&o.width===y.width&&o.height===y.height||n();y=o,g=requestAnimationFrame(e)}(),()=>{var t;u=!0,a.forEach((t=>{s&&t.removeEventListener("scroll",n),d&&t.removeEventListener("resize",n)})),null==(t=m)||t.disconnect(),m=null,f&&cancelAnimationFrame(g)}},t.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:W,...o}),t.getOverflowAncestors=R,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
@@ -23,6 +23,8 @@ var _devLog = require("../../utils/dev-log");
|
|
|
23
23
|
|
|
24
24
|
var _isDev = require("../../utils/is-dev");
|
|
25
25
|
|
|
26
|
+
var _nativeInput = require("../checkbox/native-input");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
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); }
|
|
@@ -87,34 +89,16 @@ const Radio = p => {
|
|
|
87
89
|
}, checked && _react.default.createElement(_checkIcon.CheckIcon, null));
|
|
88
90
|
};
|
|
89
91
|
|
|
90
|
-
const inputRef = (0, _react.useRef)(null);
|
|
91
|
-
const labelRef = (0, _react.useRef)(null);
|
|
92
|
-
(0, _react.useEffect)(() => {
|
|
93
|
-
var _a;
|
|
94
|
-
|
|
95
|
-
(_a = labelRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('click', e => {
|
|
96
|
-
if (e.target !== inputRef.current) {
|
|
97
|
-
e.stopPropagation();
|
|
98
|
-
e.stopImmediatePropagation();
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
capture: false
|
|
102
|
-
});
|
|
103
|
-
}, []);
|
|
104
92
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("label", {
|
|
105
|
-
ref: labelRef,
|
|
106
93
|
className: (0, _classnames.default)(classPrefix, {
|
|
107
94
|
[`${classPrefix}-checked`]: checked,
|
|
108
95
|
[`${classPrefix}-disabled`]: disabled,
|
|
109
96
|
[`${classPrefix}-block`]: props.block
|
|
110
97
|
})
|
|
111
|
-
}, _react.default.createElement(
|
|
112
|
-
ref: inputRef,
|
|
98
|
+
}, _react.default.createElement(_nativeInput.NativeInput, {
|
|
113
99
|
type: 'radio',
|
|
114
100
|
checked: checked,
|
|
115
|
-
onChange:
|
|
116
|
-
setChecked(e.target.checked);
|
|
117
|
-
},
|
|
101
|
+
onChange: setChecked,
|
|
118
102
|
disabled: disabled,
|
|
119
103
|
id: props.id
|
|
120
104
|
}), renderIcon(), props.children && _react.default.createElement("div", {
|
|
@@ -29,4 +29,4 @@ export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps,
|
|
|
29
29
|
onSearch?: ((val: string) => void) | undefined;
|
|
30
30
|
onChange?: ((val: string) => void) | undefined;
|
|
31
31
|
onCancel?: (() => void) | undefined;
|
|
32
|
-
} & NativeProps<"--border-radius" | "--height" | "--padding-left" | "--
|
|
32
|
+
} & NativeProps<"--border-radius" | "--height" | "--padding-left" | "--background" | "--placeholder-color"> & React.RefAttributes<InputRef>>;
|
|
@@ -3,7 +3,7 @@ import { NativeProps } from '../../utils/native-props';
|
|
|
3
3
|
import { BadgeProps } from '../badge';
|
|
4
4
|
export declare type TabBarItemProps = {
|
|
5
5
|
icon?: ReactNode | ((active: boolean) => ReactNode);
|
|
6
|
-
title?: ReactNode;
|
|
6
|
+
title?: ReactNode | ((active: boolean) => ReactNode);
|
|
7
7
|
badge?: BadgeProps['content'];
|
|
8
8
|
} & NativeProps;
|
|
9
9
|
export declare const TabBarItem: FC<TabBarItemProps>;
|
|
@@ -74,7 +74,7 @@ const TabBar = p => {
|
|
|
74
74
|
|
|
75
75
|
const titleElement = item.props.title && _react.default.createElement("div", {
|
|
76
76
|
className: `${classPrefix}-item-title`
|
|
77
|
-
}, item.props.title);
|
|
77
|
+
}, typeof item.props.title === 'function' ? item.props.title(active) : item.props.title);
|
|
78
78
|
|
|
79
79
|
if (iconElement) {
|
|
80
80
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_badge.default, {
|
|
@@ -67,12 +67,12 @@ const TreeSelect = p => {
|
|
|
67
67
|
let current = node;
|
|
68
68
|
|
|
69
69
|
while (current) {
|
|
70
|
-
parentNodes.
|
|
70
|
+
parentNodes.push(current);
|
|
71
71
|
const next = optionsParentMap.get(current[valueName]);
|
|
72
72
|
current = next;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const values = parentNodes.map(i => i[valueName]);
|
|
75
|
+
const values = parentNodes.reverse().map(i => i[valueName]);
|
|
76
76
|
setValue(values);
|
|
77
77
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values, {
|
|
78
78
|
options: parentNodes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
declare type ImperativeProps = {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
afterClose?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function renderImperatively(element: ReactElement<ImperativeProps>): {
|
|
8
|
+
close: () => void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderImperatively = renderImperatively;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _renderToBody = require("./render-to-body");
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
function renderImperatively(element) {
|
|
17
|
+
const Wrapper = _react.default.forwardRef((_, ref) => {
|
|
18
|
+
const [visible, setVisible] = (0, _react.useState)(false);
|
|
19
|
+
const closedRef = (0, _react.useRef)(false);
|
|
20
|
+
(0, _react.useEffect)(() => {
|
|
21
|
+
if (!closedRef.current) {
|
|
22
|
+
setVisible(true);
|
|
23
|
+
} else {
|
|
24
|
+
afterClose();
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
function onClose() {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
|
|
31
|
+
closedRef.current = true;
|
|
32
|
+
setVisible(false);
|
|
33
|
+
(_b = (_a = element.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function afterClose() {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
|
|
39
|
+
unmount();
|
|
40
|
+
(_b = (_a = element.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
44
|
+
close: onClose
|
|
45
|
+
}));
|
|
46
|
+
return _react.default.cloneElement(element, Object.assign(Object.assign({}, element.props), {
|
|
47
|
+
visible,
|
|
48
|
+
onClose,
|
|
49
|
+
afterClose
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const wrapperRef = _react.default.createRef();
|
|
54
|
+
|
|
55
|
+
const unmount = (0, _renderToBody.renderToBody)(_react.default.createElement(Wrapper, {
|
|
56
|
+
ref: wrapperRef
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
function close() {
|
|
60
|
+
var _a;
|
|
61
|
+
|
|
62
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
close
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -10,7 +10,7 @@ export declare type Action = {
|
|
|
10
10
|
onClick?: () => void;
|
|
11
11
|
};
|
|
12
12
|
export declare type ActionSheetProps = {
|
|
13
|
-
visible
|
|
13
|
+
visible?: boolean;
|
|
14
14
|
actions: Action[];
|
|
15
15
|
extra?: React.ReactNode;
|
|
16
16
|
cancelText?: React.ReactNode;
|
|
@@ -22,11 +22,11 @@ export declare type ActionSheetProps = {
|
|
|
22
22
|
closeOnMaskClick?: boolean;
|
|
23
23
|
getContainer?: GetContainer;
|
|
24
24
|
safeArea?: boolean;
|
|
25
|
+
popupClassName?: string;
|
|
26
|
+
popupStyle?: React.CSSProperties;
|
|
25
27
|
} & NativeProps;
|
|
26
28
|
export declare const ActionSheet: FC<ActionSheetProps>;
|
|
27
|
-
export declare type
|
|
28
|
-
close: () => void;
|
|
29
|
-
};
|
|
30
|
-
export declare function showActionSheet(props: Omit<ActionSheetProps, 'visible'>): {
|
|
29
|
+
export declare type ActionSheetShowHandler = {
|
|
31
30
|
close: () => void;
|
|
32
31
|
};
|
|
32
|
+
export declare function showActionSheet(props: Omit<ActionSheetProps, 'visible'>): ActionSheetShowHandler;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { withNativeProps } from '../../utils/native-props';
|
|
3
3
|
import { mergeProps } from '../../utils/with-default-props';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import Popup from '../popup';
|
|
6
6
|
import Button from '../button';
|
|
7
|
-
import { renderToBody } from '../../utils/render-to-body';
|
|
8
7
|
import SafeArea from '../safe-area';
|
|
8
|
+
import { renderImperatively } from '../../utils/render-imperatively';
|
|
9
9
|
const classPrefix = `adm-action-sheet`;
|
|
10
10
|
const defaultProps = {
|
|
11
11
|
visible: false,
|
|
@@ -29,7 +29,8 @@ export const ActionSheet = p => {
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
afterClose: props.afterClose,
|
|
32
|
-
className: `${classPrefix}-popup`,
|
|
32
|
+
className: classNames(`${classPrefix}-popup`, props.popupClassName),
|
|
33
|
+
style: props.popupStyle,
|
|
33
34
|
getContainer: props.getContainer
|
|
34
35
|
}, withNativeProps(props, React.createElement("div", {
|
|
35
36
|
className: classPrefix
|
|
@@ -83,42 +84,5 @@ export const ActionSheet = p => {
|
|
|
83
84
|
}))));
|
|
84
85
|
};
|
|
85
86
|
export function showActionSheet(props) {
|
|
86
|
-
|
|
87
|
-
const [visible, setVisible] = useState(false);
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
setVisible(true);
|
|
90
|
-
}, []);
|
|
91
|
-
|
|
92
|
-
function handleClose() {
|
|
93
|
-
var _a;
|
|
94
|
-
|
|
95
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
96
|
-
setVisible(false);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
useImperativeHandle(ref, () => ({
|
|
100
|
-
close: handleClose
|
|
101
|
-
}));
|
|
102
|
-
return React.createElement(ActionSheet, Object.assign({}, props, {
|
|
103
|
-
visible: visible,
|
|
104
|
-
onClose: handleClose,
|
|
105
|
-
afterClose: () => {
|
|
106
|
-
var _a;
|
|
107
|
-
|
|
108
|
-
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
109
|
-
unmount();
|
|
110
|
-
}
|
|
111
|
-
}));
|
|
112
|
-
});
|
|
113
|
-
const ref = createRef();
|
|
114
|
-
const unmount = renderToBody(React.createElement(Wrapper, {
|
|
115
|
-
ref: ref
|
|
116
|
-
}));
|
|
117
|
-
return {
|
|
118
|
-
close: () => {
|
|
119
|
-
var _a;
|
|
120
|
-
|
|
121
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
122
|
-
}
|
|
123
|
-
};
|
|
87
|
+
return renderImperatively(React.createElement(ActionSheet, Object.assign({}, props)));
|
|
124
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './action-sheet.less';
|
|
3
3
|
import { showActionSheet } from './action-sheet';
|
|
4
|
-
export type { Action, ActionSheetProps,
|
|
4
|
+
export type { Action, ActionSheetProps, ActionSheetShowHandler, } from './action-sheet';
|
|
5
5
|
declare const _default: import("react").FC<import("./action-sheet").ActionSheetProps> & {
|
|
6
6
|
show: typeof showActionSheet;
|
|
7
7
|
};
|
|
@@ -11,7 +11,7 @@ export const Badge = props => {
|
|
|
11
11
|
} = props;
|
|
12
12
|
const isDot = content === dot;
|
|
13
13
|
const badgeCls = classNames(classPrefix, !!children && `${classPrefix}-fixed`, isDot && `${classPrefix}-dot`, props.bordered && `${classPrefix}-bordered`);
|
|
14
|
-
const element = content ? withNativeProps(props, React.createElement("div", {
|
|
14
|
+
const element = content || content === 0 ? withNativeProps(props, React.createElement("div", {
|
|
15
15
|
className: badgeCls,
|
|
16
16
|
style: {
|
|
17
17
|
'--color': color
|
|
@@ -61,6 +61,13 @@ export const CascaderView = p => {
|
|
|
61
61
|
useEffect(() => {
|
|
62
62
|
setTabActiveKey(levels.length - 1);
|
|
63
63
|
}, [value]);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const max = levels.length - 1;
|
|
66
|
+
|
|
67
|
+
if (tabActiveKey > max) {
|
|
68
|
+
setTabActiveKey(max);
|
|
69
|
+
}
|
|
70
|
+
}, [tabActiveKey, levels]);
|
|
64
71
|
|
|
65
72
|
const onItemSelect = (selectValue, depth) => {
|
|
66
73
|
const next = value.slice(0, depth);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import { withNativeProps } from '../../utils/native-props';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { CheckboxGroupContext } from './group-context';
|
|
@@ -8,6 +8,7 @@ import { devWarning } from '../../utils/dev-log';
|
|
|
8
8
|
import { CheckIcon } from './check-icon';
|
|
9
9
|
import { IndeterminateIcon } from './indeterminate-icon';
|
|
10
10
|
import { isDev } from '../../utils/is-dev';
|
|
11
|
+
import { NativeInput } from './native-input';
|
|
11
12
|
const classPrefix = `adm-checkbox`;
|
|
12
13
|
const defaultProps = {
|
|
13
14
|
defaultChecked: false,
|
|
@@ -66,35 +67,17 @@ export const Checkbox = p => {
|
|
|
66
67
|
}, props.indeterminate ? React.createElement(IndeterminateIcon, null) : checked && React.createElement(CheckIcon, null));
|
|
67
68
|
};
|
|
68
69
|
|
|
69
|
-
const inputRef = useRef(null);
|
|
70
|
-
const labelRef = useRef(null);
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
var _a;
|
|
73
|
-
|
|
74
|
-
(_a = labelRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('click', e => {
|
|
75
|
-
if (e.target !== inputRef.current) {
|
|
76
|
-
e.stopPropagation();
|
|
77
|
-
e.stopImmediatePropagation();
|
|
78
|
-
}
|
|
79
|
-
}, {
|
|
80
|
-
capture: false
|
|
81
|
-
});
|
|
82
|
-
}, []);
|
|
83
70
|
return withNativeProps(props, React.createElement("label", {
|
|
84
|
-
ref: labelRef,
|
|
85
71
|
className: classNames(classPrefix, {
|
|
86
72
|
[`${classPrefix}-checked`]: checked && !props.indeterminate,
|
|
87
73
|
[`${classPrefix}-indeterminate`]: props.indeterminate,
|
|
88
74
|
[`${classPrefix}-disabled`]: disabled,
|
|
89
75
|
[`${classPrefix}-block`]: props.block
|
|
90
76
|
})
|
|
91
|
-
}, React.createElement(
|
|
92
|
-
ref: inputRef,
|
|
77
|
+
}, React.createElement(NativeInput, {
|
|
93
78
|
type: 'checkbox',
|
|
94
79
|
checked: checked,
|
|
95
|
-
onChange:
|
|
96
|
-
setChecked(e.target.checked);
|
|
97
|
-
},
|
|
80
|
+
onChange: setChecked,
|
|
98
81
|
disabled: disabled,
|
|
99
82
|
id: props.id
|
|
100
83
|
}), renderIcon(), props.children && React.createElement("div", {
|