@trionesdev/antd-mobile-react 0.0.2-beta.8 → 0.0.2-beta.9
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/dist/CalendarDatetimePopup/CalendarDatetimePopup.js +2 -1
- package/dist/CalendarPopup/calendar-range-popup.d.ts +3 -3
- package/dist/CalendarPopup/calendar-range-popup.js +6 -5
- package/dist/CascaderPopup/cascader-popup.js +2 -1
- package/dist/Overlay/Overlay.d.ts +3 -2
- package/dist/Overlay/Overlay.js +47 -23
- package/dist/Overlay/demo/base.d.ts +3 -0
- package/dist/Overlay/demo/base.js +27 -0
- package/dist/Popup/demo/base.js +107 -25
- package/dist/Popup/index.d.ts +1 -0
- package/dist/Popup/index.js +1 -0
- package/dist/Popup/popup.d.ts +30 -3
- package/dist/Popup/popup.js +84 -53
- package/dist/Popup/style.scss +112 -34
- package/dist/utils/use-isomorphic-update-layout-effect.d.ts +1 -1
- package/package.json +5 -7
- package/dist/Popup/popup-modal.d.ts +0 -52
- package/dist/Popup/popup-modal.js +0 -74
|
@@ -106,7 +106,8 @@ export var CalendarDatetimePopup = function CalendarDatetimePopup(_ref) {
|
|
|
106
106
|
};
|
|
107
107
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
108
108
|
open: open,
|
|
109
|
-
onClose: onClose
|
|
109
|
+
onClose: onClose,
|
|
110
|
+
round: true
|
|
110
111
|
}, /*#__PURE__*/React.createElement("div", {
|
|
111
112
|
className: classNames(cls)
|
|
112
113
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import
|
|
3
|
-
import { CalendarPopupRangeProps } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
import { CalendarPopupRangeProps } from './types';
|
|
4
4
|
export declare const CalendarRangePopup: FC<CalendarPopupRangeProps>;
|
|
@@ -4,12 +4,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import classNames from "classnames";
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import React, { memo, useEffect, useRef } from 'react';
|
|
10
9
|
import Calendar from "../Calendar";
|
|
11
|
-
import "./style.scss";
|
|
12
10
|
import ConfigProvider from "../ConfigProvider";
|
|
11
|
+
import Popup from "../Popup";
|
|
12
|
+
import "./style.scss";
|
|
13
13
|
var cls = 'triones-antm-calendar-popup';
|
|
14
14
|
export var CalendarRangePopup = /*#__PURE__*/memo(function (_ref) {
|
|
15
15
|
var mouth = _ref.mouth,
|
|
@@ -62,7 +62,8 @@ export var CalendarRangePopup = /*#__PURE__*/memo(function (_ref) {
|
|
|
62
62
|
open: innerOpen,
|
|
63
63
|
onClose: function onClose() {
|
|
64
64
|
setInnerOpen(false);
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
|
+
round: true
|
|
66
67
|
}, /*#__PURE__*/React.createElement("div", {
|
|
67
68
|
className: classNames("".concat(cls))
|
|
68
69
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -48,7 +48,8 @@ export var CascaderPopup = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
48
48
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
49
49
|
open: open,
|
|
50
50
|
onClose: handleClose,
|
|
51
|
-
|
|
51
|
+
overlayClosable: true,
|
|
52
|
+
round: true,
|
|
52
53
|
styles: {
|
|
53
54
|
body: {
|
|
54
55
|
borderTopLeftRadius: 6,
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from
|
|
2
|
-
import { FC } from "react";
|
|
1
|
+
import React, { FC, PropsWithChildren } from 'react';
|
|
3
2
|
export type OverlayProps = {
|
|
4
3
|
className?: string;
|
|
5
4
|
style?: React.CSSProperties;
|
|
6
5
|
open: boolean;
|
|
7
6
|
zIndex?: number;
|
|
8
7
|
closeOnOverlayClick?: boolean;
|
|
8
|
+
destroyOnHidden?: boolean;
|
|
9
9
|
onClick?: (e: any) => void;
|
|
10
10
|
onClose?: () => void;
|
|
11
11
|
afterClose?: () => void;
|
|
12
12
|
afterOpenChange?: (open: boolean) => void;
|
|
13
13
|
duration?: number;
|
|
14
|
+
getContainer?: () => HTMLElement;
|
|
14
15
|
};
|
|
15
16
|
export declare const Overlay: FC<PropsWithChildren<OverlayProps>>;
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -10,8 +10,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import React, { useEffect, useState } from 'react';
|
|
15
|
+
import { createPortal } from 'react-dom';
|
|
15
16
|
var cls = 'triones-antm-overlay';
|
|
16
17
|
export var Overlay = function Overlay(_ref) {
|
|
17
18
|
var children = _ref.children,
|
|
@@ -22,12 +23,17 @@ export var Overlay = function Overlay(_ref) {
|
|
|
22
23
|
zIndex = _ref$zIndex === void 0 ? 1000 : _ref$zIndex,
|
|
23
24
|
_ref$closeOnOverlayCl = _ref.closeOnOverlayClick,
|
|
24
25
|
closeOnOverlayClick = _ref$closeOnOverlayCl === void 0 ? true : _ref$closeOnOverlayCl,
|
|
26
|
+
_ref$destroyOnHidden = _ref.destroyOnHidden,
|
|
27
|
+
destroyOnHidden = _ref$destroyOnHidden === void 0 ? false : _ref$destroyOnHidden,
|
|
25
28
|
onClick = _ref.onClick,
|
|
26
29
|
onClose = _ref.onClose,
|
|
27
30
|
afterClose = _ref.afterClose,
|
|
28
31
|
afterOpenChange = _ref.afterOpenChange,
|
|
29
32
|
_ref$duration = _ref.duration,
|
|
30
|
-
duration = _ref$duration === void 0 ? 300 : _ref$duration
|
|
33
|
+
duration = _ref$duration === void 0 ? 300 : _ref$duration,
|
|
34
|
+
getContainer = _ref.getContainer;
|
|
35
|
+
var mountRef = React.useRef(null);
|
|
36
|
+
var rootContainer = (getContainer === null || getContainer === void 0 ? void 0 : getContainer()) || document.body;
|
|
31
37
|
var _useState = useState(false),
|
|
32
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
33
39
|
active = _useState2[0],
|
|
@@ -40,6 +46,36 @@ export var Overlay = function Overlay(_ref) {
|
|
|
40
46
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
47
|
internalOpen = _useState6[0],
|
|
42
48
|
setInternalOpen = _useState6[1];
|
|
49
|
+
var handleDestroy = function handleDestroy() {
|
|
50
|
+
if (rootContainer && mountRef.current) {
|
|
51
|
+
rootContainer.removeChild(mountRef.current);
|
|
52
|
+
}
|
|
53
|
+
mountRef.current = null;
|
|
54
|
+
};
|
|
55
|
+
var handleClose = function handleClose() {
|
|
56
|
+
setInternalOpen(false);
|
|
57
|
+
onClose === null || onClose === void 0 || onClose();
|
|
58
|
+
if (destroyOnHidden) {
|
|
59
|
+
handleDestroy();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var handleClick = function handleClick(e) {
|
|
63
|
+
// 只在点击遮罩层本身时触发,忽略子元素冒泡上来的点击
|
|
64
|
+
if (e.target === e.currentTarget) {
|
|
65
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
66
|
+
if (closeOnOverlayClick) {
|
|
67
|
+
handleClose();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
if (open === undefined) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (open !== internalOpen) {
|
|
76
|
+
setInternalOpen(open);
|
|
77
|
+
}
|
|
78
|
+
}, [open]);
|
|
43
79
|
useEffect(function () {
|
|
44
80
|
if (internalOpen) {
|
|
45
81
|
setRender(true);
|
|
@@ -63,31 +99,19 @@ export var Overlay = function Overlay(_ref) {
|
|
|
63
99
|
};
|
|
64
100
|
}
|
|
65
101
|
}, [internalOpen, duration]);
|
|
66
|
-
var handleClick = function handleClick(e) {
|
|
67
|
-
// 只在点击遮罩层本身时触发,忽略子元素冒泡上来的点击
|
|
68
|
-
if (e.target === e.currentTarget) {
|
|
69
|
-
onClick === null || onClick === void 0 || onClick(e);
|
|
70
|
-
if (closeOnOverlayClick) {
|
|
71
|
-
setInternalOpen(false);
|
|
72
|
-
onClose === null || onClose === void 0 || onClose();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
useEffect(function () {
|
|
77
|
-
if (open === undefined) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (open !== internalOpen) {
|
|
81
|
-
setInternalOpen(open);
|
|
82
|
-
}
|
|
83
|
-
}, [open]);
|
|
84
102
|
if (!render) return null;
|
|
85
|
-
|
|
103
|
+
if (render) {
|
|
104
|
+
if (!mountRef.current) {
|
|
105
|
+
mountRef.current = document.createElement('div');
|
|
106
|
+
rootContainer === null || rootContainer === void 0 || rootContainer.appendChild(mountRef.current);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return render && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
86
110
|
className: classNames(cls, _defineProperty({}, "".concat(cls, "-active"), active), className),
|
|
87
111
|
onClick: handleClick,
|
|
88
112
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
89
113
|
zIndex: zIndex,
|
|
90
114
|
transitionDuration: "".concat(duration, "ms")
|
|
91
115
|
})
|
|
92
|
-
}, children);
|
|
116
|
+
}, children), mountRef.current);
|
|
93
117
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
9
|
+
import { Button, Overlay } from "../../index";
|
|
10
|
+
export default (function () {
|
|
11
|
+
var _useState = useState(false),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
open = _useState2[0],
|
|
14
|
+
setOpen = _useState2[1];
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
16
|
+
title: "\u57FA\u672C\u4F7F\u7528"
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
18
|
+
onClick: function onClick() {
|
|
19
|
+
return setOpen(true);
|
|
20
|
+
}
|
|
21
|
+
}, "\u70B9\u51FB\u6309\u94AE\u663E\u793A\u906E\u7F69\u5C42"), /*#__PURE__*/React.createElement(Overlay, {
|
|
22
|
+
open: open,
|
|
23
|
+
onClick: function onClick() {
|
|
24
|
+
return setOpen(false);
|
|
25
|
+
}
|
|
26
|
+
})));
|
|
27
|
+
});
|
package/dist/Popup/demo/base.js
CHANGED
|
@@ -8,41 +8,72 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
8
8
|
* compact: true
|
|
9
9
|
*/
|
|
10
10
|
import { DemoBlock } from "../../DemoBlock";
|
|
11
|
-
import React
|
|
11
|
+
import React from 'react';
|
|
12
12
|
import Button from "../../Button";
|
|
13
13
|
import Popup from "../index";
|
|
14
14
|
export default (function () {
|
|
15
15
|
var _React$useState = React.useState(false),
|
|
16
16
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
defaultOpen = _React$useState2[0],
|
|
18
|
+
setDefaultOpen = _React$useState2[1];
|
|
19
19
|
var _React$useState3 = React.useState(false),
|
|
20
20
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
topOpen = _React$useState4[0],
|
|
22
|
+
setTopOpen = _React$useState4[1];
|
|
23
23
|
var _React$useState5 = React.useState(false),
|
|
24
24
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
bottomOpen = _React$useState6[0],
|
|
26
|
+
setBottomOpen = _React$useState6[1];
|
|
27
27
|
var _React$useState7 = React.useState(false),
|
|
28
28
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
leftOpen = _React$useState8[0],
|
|
30
|
+
setLeftOpen = _React$useState8[1];
|
|
31
|
+
var _React$useState9 = React.useState(false),
|
|
32
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
33
|
+
rightOpen = _React$useState10[0],
|
|
34
|
+
setRightOpen = _React$useState10[1];
|
|
35
|
+
var _React$useState11 = React.useState(false),
|
|
36
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
37
|
+
centerOpen = _React$useState12[0],
|
|
38
|
+
setCenterOpen = _React$useState12[1];
|
|
39
|
+
var _React$useState13 = React.useState(false),
|
|
40
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
41
|
+
roundOpen = _React$useState14[0],
|
|
42
|
+
setRoundOpen = _React$useState14[1];
|
|
43
|
+
var _React$useState15 = React.useState(false),
|
|
44
|
+
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
45
|
+
closeIconOpen = _React$useState16[0],
|
|
46
|
+
setCloseIconOpen = _React$useState16[1];
|
|
34
47
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
35
|
-
title: "\u57FA\
|
|
48
|
+
title: "\u57FA\u672C\u4F7F\u7528"
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Popup, {
|
|
50
|
+
open: defaultOpen,
|
|
51
|
+
title: "\u6807\u9898",
|
|
52
|
+
closable: true,
|
|
53
|
+
afterClose: function afterClose() {
|
|
54
|
+
setDefaultOpen(false);
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
style: {
|
|
58
|
+
minHeight: '200px'
|
|
59
|
+
}
|
|
60
|
+
}, "\u57FA\u7840\u5F39\u7A97")), /*#__PURE__*/React.createElement(Button, {
|
|
61
|
+
block: true,
|
|
62
|
+
onClick: function onClick() {
|
|
63
|
+
setDefaultOpen(true);
|
|
64
|
+
}
|
|
65
|
+
}, "\u57FA\u7840\u5F39\u7A97")), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
66
|
+
title: "\u5F39\u51FA\u4F4D\u7F6E"
|
|
36
67
|
}, /*#__PURE__*/React.createElement(Popup, {
|
|
37
68
|
open: topOpen,
|
|
38
|
-
|
|
39
|
-
|
|
69
|
+
destroyOnHidden: true,
|
|
70
|
+
position: "top",
|
|
71
|
+
afterClose: function afterClose() {
|
|
40
72
|
setTopOpen(false);
|
|
41
|
-
}
|
|
42
|
-
maskClosable: true
|
|
73
|
+
}
|
|
43
74
|
}, /*#__PURE__*/React.createElement("div", {
|
|
44
75
|
style: {
|
|
45
|
-
minHeight:
|
|
76
|
+
minHeight: '200px'
|
|
46
77
|
}
|
|
47
78
|
}, "\u9876\u90E8\u5F39\u51FA")), /*#__PURE__*/React.createElement(Button, {
|
|
48
79
|
block: true,
|
|
@@ -53,12 +84,12 @@ export default (function () {
|
|
|
53
84
|
open: bottomOpen,
|
|
54
85
|
position: "bottom",
|
|
55
86
|
closable: true,
|
|
56
|
-
|
|
87
|
+
afterClose: function afterClose() {
|
|
57
88
|
setBottomOpen(false);
|
|
58
89
|
}
|
|
59
90
|
}, /*#__PURE__*/React.createElement("div", {
|
|
60
91
|
style: {
|
|
61
|
-
minHeight:
|
|
92
|
+
minHeight: '200px'
|
|
62
93
|
}
|
|
63
94
|
}, "\u5E95\u90E8\u5F39\u51FA")), /*#__PURE__*/React.createElement(Button, {
|
|
64
95
|
block: true,
|
|
@@ -68,12 +99,12 @@ export default (function () {
|
|
|
68
99
|
}, "\u5E95\u90E8\u5F39\u51FA"), /*#__PURE__*/React.createElement(Popup, {
|
|
69
100
|
open: leftOpen,
|
|
70
101
|
position: "left",
|
|
71
|
-
|
|
102
|
+
afterClose: function afterClose() {
|
|
72
103
|
setLeftOpen(false);
|
|
73
104
|
}
|
|
74
105
|
}, /*#__PURE__*/React.createElement("div", {
|
|
75
106
|
style: {
|
|
76
|
-
minWidth:
|
|
107
|
+
minWidth: '200px'
|
|
77
108
|
}
|
|
78
109
|
}, "\u5DE6\u90E8\u5F39\u51FA")), /*#__PURE__*/React.createElement(Button, {
|
|
79
110
|
block: true,
|
|
@@ -83,17 +114,68 @@ export default (function () {
|
|
|
83
114
|
}, "\u5DE6\u90E8\u5F39\u51FA"), /*#__PURE__*/React.createElement(Popup, {
|
|
84
115
|
open: rightOpen,
|
|
85
116
|
position: "right",
|
|
86
|
-
|
|
117
|
+
afterClose: function afterClose() {
|
|
87
118
|
setRightOpen(false);
|
|
88
119
|
}
|
|
89
120
|
}, /*#__PURE__*/React.createElement("div", {
|
|
90
121
|
style: {
|
|
91
|
-
minWidth:
|
|
122
|
+
minWidth: '200px'
|
|
92
123
|
}
|
|
93
124
|
}, "\u53F3\u90E8\u5F39\u51FA")), /*#__PURE__*/React.createElement(Button, {
|
|
94
125
|
block: true,
|
|
95
126
|
onClick: function onClick() {
|
|
96
127
|
setRightOpen(true);
|
|
97
128
|
}
|
|
98
|
-
}, "\u53F3\u90E8\u5F39\u51FA")
|
|
129
|
+
}, "\u53F3\u90E8\u5F39\u51FA"), /*#__PURE__*/React.createElement(Popup, {
|
|
130
|
+
open: centerOpen,
|
|
131
|
+
position: "center",
|
|
132
|
+
afterClose: function afterClose() {
|
|
133
|
+
setCenterOpen(false);
|
|
134
|
+
}
|
|
135
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
style: {
|
|
137
|
+
minWidth: '200px',
|
|
138
|
+
minHeight: '200px'
|
|
139
|
+
}
|
|
140
|
+
}, "\u5C45\u4E2D\u5F39\u51FA")), /*#__PURE__*/React.createElement(Button, {
|
|
141
|
+
block: true,
|
|
142
|
+
onClick: function onClick() {
|
|
143
|
+
setCenterOpen(true);
|
|
144
|
+
}
|
|
145
|
+
}, "\u5C45\u4E2D\u5F39\u51FA")), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
146
|
+
title: "\u5706\u89D2"
|
|
147
|
+
}, /*#__PURE__*/React.createElement(Popup, {
|
|
148
|
+
open: roundOpen,
|
|
149
|
+
round: true,
|
|
150
|
+
afterClose: function afterClose() {
|
|
151
|
+
setRoundOpen(false);
|
|
152
|
+
}
|
|
153
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
style: {
|
|
155
|
+
minHeight: '200px'
|
|
156
|
+
}
|
|
157
|
+
}, "\u5706\u89D2\u5F39\u7A97")), /*#__PURE__*/React.createElement(Button, {
|
|
158
|
+
block: true,
|
|
159
|
+
onClick: function onClick() {
|
|
160
|
+
setRoundOpen(true);
|
|
161
|
+
}
|
|
162
|
+
}, "\u5706\u89D2\u5F39\u7A97")), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
163
|
+
title: "\u5173\u95ED\u56FE\u6807"
|
|
164
|
+
}, /*#__PURE__*/React.createElement(Popup, {
|
|
165
|
+
open: closeIconOpen,
|
|
166
|
+
round: true,
|
|
167
|
+
closable: true,
|
|
168
|
+
afterClose: function afterClose() {
|
|
169
|
+
setCloseIconOpen(false);
|
|
170
|
+
}
|
|
171
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
172
|
+
style: {
|
|
173
|
+
minHeight: '200px'
|
|
174
|
+
}
|
|
175
|
+
}, "\u5706\u89D2\u5F39\u7A97")), /*#__PURE__*/React.createElement(Button, {
|
|
176
|
+
block: true,
|
|
177
|
+
onClick: function onClick() {
|
|
178
|
+
setCloseIconOpen(true);
|
|
179
|
+
}
|
|
180
|
+
}, "\u5173\u95ED\u56FE\u6807")));
|
|
99
181
|
});
|
package/dist/Popup/index.d.ts
CHANGED
package/dist/Popup/index.js
CHANGED
package/dist/Popup/popup.d.ts
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { FC, PropsWithChildren } from 'react';
|
|
2
|
+
export type PopupProps = {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
title?: React.ReactNode;
|
|
5
|
+
position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
6
|
+
closable?: boolean;
|
|
7
|
+
closeIconPosition?: 'top-left' | 'top-right';
|
|
8
|
+
closeIcon?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* @description 点击遮罩层是否关闭
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
overlayClosable?: boolean;
|
|
14
|
+
destroyOnHidden?: boolean;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
afterClose?: () => void;
|
|
17
|
+
afterOpenChange?: (open: boolean) => void;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
round?: boolean;
|
|
21
|
+
safeArea?: boolean;
|
|
22
|
+
zIndex?: number;
|
|
23
|
+
styles?: {
|
|
24
|
+
overlay?: React.CSSProperties;
|
|
25
|
+
container?: React.CSSProperties;
|
|
26
|
+
header?: React.CSSProperties;
|
|
27
|
+
title?: React.CSSProperties;
|
|
28
|
+
body?: React.CSSProperties;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
4
31
|
export declare const Popup: FC<PropsWithChildren<PopupProps>>;
|
package/dist/Popup/popup.js
CHANGED
|
@@ -1,56 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
function
|
|
3
|
-
function
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { memo, useEffect, useState } from 'react';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import { CloseOutline } from '@trionesdev/antd-mobile-icons-react';
|
|
14
|
+
import Overlay from "../Overlay";
|
|
15
|
+
import SafeArea from "../SafeArea";
|
|
16
|
+
var cls = 'triones-antm-popup';
|
|
7
17
|
export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
8
|
-
var
|
|
9
|
-
_ref$open = _ref.open,
|
|
18
|
+
var _ref$open = _ref.open,
|
|
10
19
|
open = _ref$open === void 0 ? false : _ref$open,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
20
|
+
title = _ref.title,
|
|
21
|
+
_ref$position = _ref.position,
|
|
22
|
+
position = _ref$position === void 0 ? 'bottom' : _ref$position,
|
|
23
|
+
_ref$closable = _ref.closable,
|
|
24
|
+
closable = _ref$closable === void 0 ? false : _ref$closable,
|
|
25
|
+
_ref$closeIconPositio = _ref.closeIconPosition,
|
|
26
|
+
closeIconPosition = _ref$closeIconPositio === void 0 ? 'top-right' : _ref$closeIconPositio,
|
|
27
|
+
closeIcon = _ref.closeIcon,
|
|
28
|
+
_ref$overlayClosable = _ref.overlayClosable,
|
|
29
|
+
overlayClosable = _ref$overlayClosable === void 0 ? true : _ref$overlayClosable,
|
|
30
|
+
_ref$destroyOnHidden = _ref.destroyOnHidden,
|
|
31
|
+
destroyOnHidden = _ref$destroyOnHidden === void 0 ? false : _ref$destroyOnHidden,
|
|
32
|
+
onClose = _ref.onClose,
|
|
33
|
+
afterClose = _ref.afterClose,
|
|
34
|
+
afterOpenChange = _ref.afterOpenChange,
|
|
35
|
+
className = _ref.className,
|
|
36
|
+
style = _ref.style,
|
|
37
|
+
_ref$round = _ref.round,
|
|
38
|
+
round = _ref$round === void 0 ? false : _ref$round,
|
|
39
|
+
_ref$safeArea = _ref.safeArea,
|
|
40
|
+
safeArea = _ref$safeArea === void 0 ? true : _ref$safeArea,
|
|
41
|
+
zIndex = _ref.zIndex,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
styles = _ref.styles;
|
|
44
|
+
var _useState = useState(open || false),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
internalOpen = _useState2[0],
|
|
47
|
+
setInternalOpen = _useState2[1];
|
|
48
|
+
var handleClose = function handleClose() {
|
|
49
|
+
setInternalOpen(false);
|
|
50
|
+
onClose === null || onClose === void 0 || onClose();
|
|
51
|
+
};
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
if (open === undefined) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (open !== internalOpen) {
|
|
57
|
+
setInternalOpen(open);
|
|
58
|
+
}
|
|
59
|
+
}, [open]);
|
|
60
|
+
var popupInner = /*#__PURE__*/React.createElement(React.Fragment, null, closable && /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: classNames("".concat(cls, "-close"), "".concat(cls, "-close-").concat(closeIconPosition)),
|
|
62
|
+
onClick: handleClose
|
|
63
|
+
}, closeIcon || /*#__PURE__*/React.createElement(CloseOutline, null)), title && /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "".concat(cls, "-header"),
|
|
65
|
+
style: styles === null || styles === void 0 ? void 0 : styles.header
|
|
66
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: "".concat(cls, "-title"),
|
|
68
|
+
style: styles === null || styles === void 0 ? void 0 : styles.title
|
|
69
|
+
}, title)), /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: "".concat(cls, "-body"),
|
|
71
|
+
style: styles === null || styles === void 0 ? void 0 : styles.body
|
|
72
|
+
}, children));
|
|
73
|
+
return /*#__PURE__*/React.createElement(Overlay, {
|
|
74
|
+
open: internalOpen,
|
|
75
|
+
onClose: handleClose,
|
|
76
|
+
closeOnOverlayClick: overlayClosable,
|
|
77
|
+
zIndex: zIndex,
|
|
78
|
+
className: classNames("".concat(cls, "-overlay"), "".concat(cls, "-").concat(position)),
|
|
79
|
+
afterClose: afterClose,
|
|
80
|
+
afterOpenChange: afterOpenChange,
|
|
81
|
+
destroyOnHidden: destroyOnHidden,
|
|
82
|
+
style: styles === null || styles === void 0 ? void 0 : styles.overlay
|
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: classNames("".concat(cls, "-container"), _defineProperty({}, "".concat(cls, "-round"), round)),
|
|
85
|
+
style: styles === null || styles === void 0 ? void 0 : styles.container
|
|
86
|
+
}, ['top', 'bottom', 'left', 'right'].includes(position) ? /*#__PURE__*/React.createElement(SafeArea, null, popupInner) : popupInner));
|
|
56
87
|
});
|
package/dist/Popup/style.scss
CHANGED
|
@@ -1,51 +1,129 @@
|
|
|
1
1
|
@use "../style/variable" as variable;
|
|
2
|
-
$popupCls: 'triones-antm-popup';
|
|
3
|
-
|
|
4
|
-
.#{$popupCls} {
|
|
5
|
-
position: fixed;
|
|
6
|
-
top: 0;
|
|
7
|
-
left: 0;
|
|
8
|
-
right: 0;
|
|
9
|
-
bottom: 0;
|
|
10
|
-
|
|
11
|
-
&-mask {
|
|
12
|
-
height: 100%;
|
|
13
|
-
width: 100%;
|
|
14
|
-
background-color: rgba(0, 0, 0, .55);
|
|
15
|
-
}
|
|
16
2
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
$trionesPopupCls: 'triones-antm-popup';
|
|
4
|
+
|
|
5
|
+
.#{$trionesPopupCls} {
|
|
6
|
+
&-overlay {
|
|
7
|
+
display: flex;
|
|
8
|
+
|
|
9
|
+
.#{$trionesPopupCls} {
|
|
10
|
+
&-container {
|
|
11
|
+
position: relative;
|
|
12
|
+
background-color: white;
|
|
13
|
+
|
|
14
|
+
.#{$trionesPopupCls} {
|
|
15
|
+
&-header {
|
|
16
|
+
padding-block: variable.$trionesPaddingContentVertical;
|
|
17
|
+
padding-inline: variable.$trionesPaddingContentHorizontal;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&-title {
|
|
23
|
+
text-align: center;
|
|
24
|
+
}
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
&-close {
|
|
27
|
+
position: absolute;
|
|
28
|
+
|
|
29
|
+
&-top-right {
|
|
30
|
+
top: variable.$trionesPaddingContentVertical;
|
|
31
|
+
right: variable.$trionesPaddingContentHorizontal;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-top-left {
|
|
35
|
+
top: variable.$trionesPaddingContentVertical;
|
|
36
|
+
left: variable.$trionesPaddingContentHorizontal;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
26
40
|
}
|
|
27
41
|
|
|
28
42
|
&-top {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
justify-content: flex-start;
|
|
46
|
+
|
|
47
|
+
.#{$trionesPopupCls} {
|
|
48
|
+
&-container {
|
|
49
|
+
width: 100%;
|
|
50
|
+
min-height: 20%;
|
|
51
|
+
max-height: 90%;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&-round {
|
|
55
|
+
border-bottom-left-radius: variable.$trionesBorderRadius;
|
|
56
|
+
border-bottom-right-radius: variable.$trionesBorderRadius;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
32
59
|
}
|
|
33
60
|
|
|
34
61
|
&-bottom {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
align-items: flex-end;
|
|
64
|
+
justify-content: flex-end;
|
|
65
|
+
|
|
66
|
+
.#{$trionesPopupCls} {
|
|
67
|
+
&-container {
|
|
68
|
+
width: 100%;
|
|
69
|
+
min-height: 20%;
|
|
70
|
+
max-height: 90%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&-round {
|
|
74
|
+
border-top-left-radius: variable.$trionesBorderRadius;
|
|
75
|
+
border-top-right-radius: variable.$trionesBorderRadius;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
38
78
|
}
|
|
39
79
|
|
|
40
80
|
&-left {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
justify-content: flex-start;
|
|
83
|
+
|
|
84
|
+
.#{$trionesPopupCls} {
|
|
85
|
+
&-container {
|
|
86
|
+
height: 100%;
|
|
87
|
+
min-width: 20%;
|
|
88
|
+
max-width: 90%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&-round {
|
|
92
|
+
border-top-right-radius: variable.$trionesBorderRadius;
|
|
93
|
+
border-bottom-right-radius: variable.$trionesBorderRadius;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
44
96
|
}
|
|
45
97
|
|
|
98
|
+
|
|
46
99
|
&-right {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
100
|
+
flex-direction: row;
|
|
101
|
+
justify-content: flex-end;
|
|
102
|
+
|
|
103
|
+
.#{$trionesPopupCls} {
|
|
104
|
+
&-container {
|
|
105
|
+
height: 100%;
|
|
106
|
+
min-width: 20%;
|
|
107
|
+
max-width: 90%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&-round {
|
|
111
|
+
border-top-left-radius: variable.$trionesBorderRadius;
|
|
112
|
+
border-bottom-left-radius: variable.$trionesBorderRadius;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
50
115
|
}
|
|
116
|
+
|
|
117
|
+
&-center {
|
|
118
|
+
justify-content: center;
|
|
119
|
+
align-items: center;
|
|
120
|
+
|
|
121
|
+
.#{$trionesPopupCls} {
|
|
122
|
+
&-round {
|
|
123
|
+
border-radius: variable.$trionesBorderRadius;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
51
129
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const useIsomorphicUpdateLayoutEffect: typeof import("react").
|
|
2
|
+
export declare const useIsomorphicUpdateLayoutEffect: typeof import("react").useEffect | typeof import("react").useLayoutEffect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trionesdev/antd-mobile-react",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.9",
|
|
4
4
|
"description": "antd mobile react ",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -89,17 +89,15 @@
|
|
|
89
89
|
"stylelint": "^16.12.0"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@trionesdev/antd-mobile-base-react": "^0.0.2-beta.
|
|
92
|
+
"@trionesdev/antd-mobile-base-react": "^0.0.2-beta.9",
|
|
93
93
|
"ahooks": "^3.8.4",
|
|
94
94
|
"crypto-js": "^4.2.0",
|
|
95
95
|
"dayjs": "^1.11.19",
|
|
96
|
-
"rc-field-form": "^2.7.0"
|
|
97
|
-
"rc-util": "^5.44.3",
|
|
98
|
-
"runes2": "^1.1.4"
|
|
96
|
+
"rc-field-form": "^2.7.0"
|
|
99
97
|
},
|
|
100
98
|
"optionalDependencies": {
|
|
101
99
|
"@trionesdev/antd-mobile-base-react": "workspace:*",
|
|
102
|
-
"@trionesdev/antd-mobile-icons-react": "0.0.2-beta.
|
|
100
|
+
"@trionesdev/antd-mobile-icons-react": "0.0.2-beta.9"
|
|
103
101
|
},
|
|
104
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "c062f3bd8651ea933f9385279c05a1ab0245b2b8"
|
|
105
103
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, FC, PropsWithChildren } from 'react';
|
|
2
|
-
import './style.scss';
|
|
3
|
-
export type Position = 'top' | 'bottom' | 'left' | 'right';
|
|
4
|
-
export type PopupModalProps = {
|
|
5
|
-
className?: string;
|
|
6
|
-
/**
|
|
7
|
-
* @description 样式
|
|
8
|
-
* @default horizontal
|
|
9
|
-
*/
|
|
10
|
-
styles?: {
|
|
11
|
-
body?: CSSProperties;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @description Modal 完全关闭后的回调
|
|
15
|
-
* @default
|
|
16
|
-
*/
|
|
17
|
-
afterClose?: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* @description 是否打开
|
|
20
|
-
* @default false
|
|
21
|
-
*/
|
|
22
|
-
open?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* @description 打开位置
|
|
25
|
-
* @default bottom
|
|
26
|
-
*/
|
|
27
|
-
position?: Position;
|
|
28
|
-
/**
|
|
29
|
-
* @description 是否可以关闭(显示关闭按钮)
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
closable?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* @description 是否蒙层关闭
|
|
35
|
-
* @default true
|
|
36
|
-
*/
|
|
37
|
-
maskClosable?: boolean;
|
|
38
|
-
onMaskClick?: () => void;
|
|
39
|
-
/**
|
|
40
|
-
* @description 关闭时销毁 Modal 里的子元素
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
destroyOnClose?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* @description 设置 Modal 的 z-index
|
|
46
|
-
* @default 1000
|
|
47
|
-
*/
|
|
48
|
-
zIndex?: number;
|
|
49
|
-
onClose?: () => void;
|
|
50
|
-
onDestroy?: () => void;
|
|
51
|
-
};
|
|
52
|
-
export declare const PopupModal: FC<PropsWithChildren<PopupModalProps>>;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import React, { memo, useMemo } from 'react';
|
|
3
|
-
import SafeArea from "../SafeArea";
|
|
4
|
-
import "./style.scss";
|
|
5
|
-
import { CloseOutline } from "@trionesdev/antd-mobile-icons-react";
|
|
6
|
-
var popupCls = 'triones-antm-popup';
|
|
7
|
-
export var PopupModal = /*#__PURE__*/memo(function (_ref) {
|
|
8
|
-
var children = _ref.children,
|
|
9
|
-
styles = _ref.styles,
|
|
10
|
-
afterClose = _ref.afterClose,
|
|
11
|
-
_ref$open = _ref.open,
|
|
12
|
-
open = _ref$open === void 0 ? false : _ref$open,
|
|
13
|
-
_ref$position = _ref.position,
|
|
14
|
-
position = _ref$position === void 0 ? 'bottom' : _ref$position,
|
|
15
|
-
_ref$closable = _ref.closable,
|
|
16
|
-
closable = _ref$closable === void 0 ? false : _ref$closable,
|
|
17
|
-
_ref$maskClosable = _ref.maskClosable,
|
|
18
|
-
maskClosable = _ref$maskClosable === void 0 ? true : _ref$maskClosable,
|
|
19
|
-
onMaskClick = _ref.onMaskClick,
|
|
20
|
-
_ref$destroyOnClose = _ref.destroyOnClose,
|
|
21
|
-
destroyOnClose = _ref$destroyOnClose === void 0 ? false : _ref$destroyOnClose,
|
|
22
|
-
_ref$zIndex = _ref.zIndex,
|
|
23
|
-
zIndex = _ref$zIndex === void 0 ? 1000 : _ref$zIndex,
|
|
24
|
-
onClose = _ref.onClose,
|
|
25
|
-
onDestroy = _ref.onDestroy;
|
|
26
|
-
var safeAreaPosition = useMemo(function () {
|
|
27
|
-
if (position === 'bottom') {
|
|
28
|
-
return 'bottom';
|
|
29
|
-
} else if (position === 'top') {
|
|
30
|
-
return 'top';
|
|
31
|
-
}
|
|
32
|
-
return undefined;
|
|
33
|
-
}, [position]);
|
|
34
|
-
var handleClose = function handleClose() {
|
|
35
|
-
onClose === null || onClose === void 0 || onClose();
|
|
36
|
-
afterClose === null || afterClose === void 0 || afterClose();
|
|
37
|
-
if (destroyOnClose) {
|
|
38
|
-
onDestroy === null || onDestroy === void 0 || onDestroy();
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className: classNames(popupCls),
|
|
43
|
-
style: {
|
|
44
|
-
zIndex: zIndex,
|
|
45
|
-
display: open ? 'block' : 'none'
|
|
46
|
-
},
|
|
47
|
-
onClick: function onClick(e) {
|
|
48
|
-
e.stopPropagation();
|
|
49
|
-
e.preventDefault();
|
|
50
|
-
}
|
|
51
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
52
|
-
className: classNames("".concat(popupCls, "-mask")),
|
|
53
|
-
onClick: function onClick() {
|
|
54
|
-
if (maskClosable) {
|
|
55
|
-
onMaskClick === null || onMaskClick === void 0 || onMaskClick();
|
|
56
|
-
handleClose();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: classNames("".concat(popupCls, "-body"), "".concat(popupCls, "-").concat(position)),
|
|
61
|
-
style: styles === null || styles === void 0 ? void 0 : styles.body,
|
|
62
|
-
onClick: function onClick(e) {
|
|
63
|
-
e.stopPropagation();
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
}
|
|
66
|
-
}, closable && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CloseOutline, {
|
|
67
|
-
className: classNames("".concat(popupCls, "-close")),
|
|
68
|
-
onClick: function onClick() {
|
|
69
|
-
handleClose();
|
|
70
|
-
}
|
|
71
|
-
})), /*#__PURE__*/React.createElement(SafeArea, {
|
|
72
|
-
position: safeAreaPosition
|
|
73
|
-
}, children)));
|
|
74
|
-
});
|