acud 0.0.64 → 0.0.67
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/acud.css +131 -39
- package/dist/acud.css.map +1 -1
- package/dist/acud.js +799 -212
- package/dist/acud.js.map +1 -1
- package/dist/acud.min.css +1 -1
- package/dist/acud.min.css.map +1 -1
- package/dist/acud.min.js +11 -7
- package/dist/acud.min.js.map +1 -1
- package/es/breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/es/breadcrumb/BreadcrumbItem.js +16 -4
- package/es/dialog-box/style/index.css +4 -4
- package/es/dropdown/dropdown-button.js +8 -4
- package/es/dropdown/style/index.css +2 -1
- package/es/dropdown/style/index.less +2 -1
- package/es/modal/DialogBox.d.ts +46 -0
- package/es/modal/DialogBox.js +152 -0
- package/es/modal/Modal.d.ts +5 -2
- package/es/modal/Modal.js +6 -4
- package/es/modal/dialog.d.ts +17 -0
- package/es/modal/dialog.js +123 -0
- package/es/modal/index.d.ts +11 -2
- package/es/modal/index.js +10 -1
- package/es/modal/style/index.css +79 -13
- package/es/modal/style/index.less +93 -6
- package/es/modal/style/mixin.less +4 -4
- package/es/progress/style/common.less +5 -3
- package/es/progress/style/index.css +2 -1
- package/es/radio/index.d.ts +3 -0
- package/es/style/themes/dark/components/modal.less +14 -9
- package/es/style/themes/default/components/modal.less +15 -15
- package/es/tabs/src/TabNavList/index.js +2 -2
- package/es/tabs/style/index.css +0 -1
- package/es/tabs/style/index.less +0 -1
- package/es/time-picker/style/index.css +1 -0
- package/es/time-picker/style/index.less +1 -0
- package/es/transfer/{dataSource.d.ts → DataSource.d.ts} +1 -1
- package/es/transfer/{dataSource.js → DataSource.js} +37 -6
- package/{lib/transfer/sourceList.d.ts → es/transfer/SourceList.d.ts} +2 -2
- package/es/transfer/{sourceList.js → SourceList.js} +0 -0
- package/es/transfer/{target.d.ts → Target.d.ts} +1 -1
- package/es/transfer/{target.js → Target.js} +60 -4
- package/{lib/transfer/targetList.d.ts → es/transfer/TargetList.d.ts} +2 -2
- package/es/transfer/{targetList.js → TargetList.js} +0 -0
- package/es/transfer/index.d.ts +3 -0
- package/es/transfer/index.js +9 -4
- package/es/transfer/style/css.js +3 -1
- package/es/transfer/style/index.css +25 -5
- package/es/transfer/style/index.d.ts +1 -0
- package/es/transfer/style/index.js +3 -1
- package/es/transfer/style/index.less +30 -5
- package/es/upload/UploadList/ListItem.js +7 -2
- package/es/upload/UploadList/index.js +4 -7
- package/es/upload/style/index.css +17 -13
- package/es/upload/style/index.less +25 -20
- package/es/upload/utils.js +1 -1
- package/lib/breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/lib/breadcrumb/BreadcrumbItem.js +21 -8
- package/lib/dialog-box/style/index.css +4 -4
- package/lib/dropdown/dropdown-button.js +8 -4
- package/lib/dropdown/style/index.css +2 -1
- package/lib/dropdown/style/index.less +2 -1
- package/lib/modal/DialogBox.d.ts +46 -0
- package/lib/modal/DialogBox.js +179 -0
- package/lib/modal/Modal.d.ts +5 -2
- package/lib/modal/Modal.js +6 -4
- package/lib/modal/dialog.d.ts +17 -0
- package/lib/modal/dialog.js +145 -0
- package/lib/modal/index.d.ts +11 -2
- package/lib/modal/index.js +13 -1
- package/lib/modal/style/index.css +79 -13
- package/lib/modal/style/index.less +93 -6
- package/lib/modal/style/mixin.less +4 -4
- package/lib/progress/style/common.less +5 -3
- package/lib/progress/style/index.css +2 -1
- package/lib/radio/index.d.ts +3 -0
- package/lib/style/themes/dark/components/modal.less +14 -9
- package/lib/style/themes/default/components/modal.less +15 -15
- package/lib/tabs/src/TabNavList/index.js +2 -2
- package/lib/tabs/style/index.css +0 -1
- package/lib/tabs/style/index.less +0 -1
- package/lib/time-picker/style/index.css +1 -0
- package/lib/time-picker/style/index.less +1 -0
- package/lib/transfer/{dataSource.d.ts → DataSource.d.ts} +1 -1
- package/lib/transfer/{dataSource.js → DataSource.js} +38 -6
- package/{es/transfer/sourceList.d.ts → lib/transfer/SourceList.d.ts} +2 -2
- package/lib/transfer/{sourceList.js → SourceList.js} +0 -0
- package/lib/transfer/{target.d.ts → Target.d.ts} +1 -1
- package/lib/transfer/{target.js → Target.js} +63 -5
- package/{es/transfer/targetList.d.ts → lib/transfer/TargetList.d.ts} +2 -2
- package/lib/transfer/{targetList.js → TargetList.js} +0 -0
- package/lib/transfer/index.d.ts +3 -0
- package/lib/transfer/index.js +11 -7
- package/lib/transfer/style/css.js +3 -1
- package/lib/transfer/style/index.css +25 -5
- package/lib/transfer/style/index.d.ts +1 -0
- package/lib/transfer/style/index.js +3 -1
- package/lib/transfer/style/index.less +30 -5
- package/lib/upload/UploadList/ListItem.js +7 -2
- package/lib/upload/UploadList/index.js +4 -7
- package/lib/upload/style/index.css +17 -13
- package/lib/upload/style/index.less +25 -20
- package/lib/upload/utils.js +1 -1
- package/package.json +1 -1
|
@@ -57,8 +57,10 @@ var DropdownButton = function DropdownButton(props) {
|
|
|
57
57
|
trigger = props.trigger,
|
|
58
58
|
visible = props.visible,
|
|
59
59
|
onVisibleChange = props.onVisibleChange,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
overlayClassName = props.overlayClassName,
|
|
61
|
+
overlayStyle = props.overlayStyle,
|
|
62
|
+
getPopupContainer = props.getPopupContainer,
|
|
63
|
+
restProps = __rest(props, ["children", "overlay", "disabled", "trigger", "visible", "onVisibleChange", "overlayClassName", "overlayStyle", "getPopupContainer"]); // 菜单可见,需要将ICON旋转
|
|
62
64
|
|
|
63
65
|
|
|
64
66
|
var _useState = (0, _react.useState)(!!visible),
|
|
@@ -75,13 +77,15 @@ var DropdownButton = function DropdownButton(props) {
|
|
|
75
77
|
}, []);
|
|
76
78
|
var arrowCls = (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, 'acud-btn-group-expand', popupVisible), (0, _defineProperty2["default"])(_classNames, 'acud-btn-group-border-left', restProps.type === 'primary'), _classNames));
|
|
77
79
|
return /*#__PURE__*/_react["default"].createElement(ButtonGroup, null, /*#__PURE__*/_react["default"].createElement(_button["default"], (0, _extends2["default"])({
|
|
78
|
-
disabled: disabled
|
|
79
|
-
onClick: onClick
|
|
80
|
+
disabled: disabled
|
|
80
81
|
}, restProps), children), /*#__PURE__*/_react["default"].createElement(_dropdown["default"], {
|
|
81
82
|
disabled: disabled,
|
|
82
83
|
placement: "bottomRight",
|
|
83
84
|
trigger: trigger,
|
|
84
85
|
overlay: overlay,
|
|
86
|
+
overlayClassName: overlayClassName,
|
|
87
|
+
overlayStyle: overlayStyle,
|
|
88
|
+
getPopupContainer: getPopupContainer,
|
|
85
89
|
visible: popupVisible,
|
|
86
90
|
onVisibleChange: handleVisibleChange
|
|
87
91
|
}, /*#__PURE__*/_react["default"].createElement(_button["default"], (0, _extends2["default"])({
|
|
@@ -93,9 +93,10 @@
|
|
|
93
93
|
margin-top: -8px;
|
|
94
94
|
font-size: 12px;
|
|
95
95
|
line-height: 16px;
|
|
96
|
+
transition: transform 0.48s;
|
|
96
97
|
}
|
|
97
98
|
.acud-dropdown-trigger-arrow-expand {
|
|
98
|
-
transform: rotate(
|
|
99
|
+
transform: rotate(180deg);
|
|
99
100
|
}
|
|
100
101
|
.acud-dropdown-trigger-arrow > svg {
|
|
101
102
|
width: 16px;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface ModalFuncProps {
|
|
3
|
+
/** 对话框标题 */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** 对话框内容 */
|
|
6
|
+
content?: React.ReactNode;
|
|
7
|
+
/** 点击确定回调 */
|
|
8
|
+
onOk?: (e: React.MouseEvent<HTMLElement>) => (void | Promise<any>);
|
|
9
|
+
/** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调 */
|
|
10
|
+
onCancel?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
+
afterClose?: () => void;
|
|
12
|
+
/** 弹框宽度 */
|
|
13
|
+
width?: number;
|
|
14
|
+
/** 弹框高度 */
|
|
15
|
+
height?: number;
|
|
16
|
+
/** 确认按钮文字 */
|
|
17
|
+
okText?: string;
|
|
18
|
+
/** 取消按钮文字 */
|
|
19
|
+
cancelText?: string;
|
|
20
|
+
/** 点击蒙层是否允许关闭 */
|
|
21
|
+
maskClosable?: boolean;
|
|
22
|
+
/** 是否强制渲染 DialogBox */
|
|
23
|
+
forceRender?: boolean;
|
|
24
|
+
/** 关闭时是否销毁 DialogBox 里的子元素 */
|
|
25
|
+
destroyOnClose?: boolean;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
className?: string;
|
|
28
|
+
/** 指定DialogBox挂载的html节点 */
|
|
29
|
+
getContainer?: string | HTMLElement | (() => HTMLElement) | false | null;
|
|
30
|
+
/** 设置 DialogBox 的 z-index */
|
|
31
|
+
zIndex?: number;
|
|
32
|
+
/** 是否支持键盘 esc 关闭 */
|
|
33
|
+
keyboard?: boolean;
|
|
34
|
+
/** 自定义关闭图标 */
|
|
35
|
+
closeIcon?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
export interface DialogBoxProps extends ModalFuncProps {
|
|
38
|
+
/** 是否有取消按钮 */
|
|
39
|
+
cancelBtn?: boolean;
|
|
40
|
+
onClose?: (...args: any[]) => void;
|
|
41
|
+
visible?: boolean;
|
|
42
|
+
type: 'confirm' | 'success' | 'info' | 'error' | 'warning';
|
|
43
|
+
confirmLoading?: boolean;
|
|
44
|
+
}
|
|
45
|
+
declare const DialogBox: React.FC<DialogBoxProps>;
|
|
46
|
+
export default DialogBox;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var React = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _FilledError = _interopRequireDefault(require("acud-icon/lib/icons/FilledError"));
|
|
19
|
+
|
|
20
|
+
var _OutlinedClose = _interopRequireDefault(require("acud-icon/lib/icons/OutlinedClose"));
|
|
21
|
+
|
|
22
|
+
var _FilledSuccess = _interopRequireDefault(require("acud-icon/lib/icons/FilledSuccess"));
|
|
23
|
+
|
|
24
|
+
var _FilledWarn = _interopRequireDefault(require("acud-icon/lib/icons/FilledWarn"));
|
|
25
|
+
|
|
26
|
+
var _FilledInfo = _interopRequireDefault(require("acud-icon/lib/icons/FilledInfo"));
|
|
27
|
+
|
|
28
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
29
|
+
|
|
30
|
+
var _configProvider = require("../config-provider");
|
|
31
|
+
|
|
32
|
+
var _button = _interopRequireDefault(require("../button"));
|
|
33
|
+
|
|
34
|
+
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
35
|
+
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
41
|
+
var t = {};
|
|
42
|
+
|
|
43
|
+
for (var p in s) {
|
|
44
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
48
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
49
|
+
}
|
|
50
|
+
return t;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var DialogType = {
|
|
54
|
+
success: {
|
|
55
|
+
className: 'sucess',
|
|
56
|
+
icon: /*#__PURE__*/React.createElement(_FilledSuccess["default"], {
|
|
57
|
+
color: "@S6"
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
warning: {
|
|
61
|
+
className: 'warning',
|
|
62
|
+
icon: /*#__PURE__*/React.createElement(_FilledWarn["default"], {
|
|
63
|
+
color: "@W6"
|
|
64
|
+
})
|
|
65
|
+
},
|
|
66
|
+
confirm: {
|
|
67
|
+
className: 'confirm',
|
|
68
|
+
icon: /*#__PURE__*/React.createElement(_FilledWarn["default"], {
|
|
69
|
+
color: "@W6"
|
|
70
|
+
})
|
|
71
|
+
},
|
|
72
|
+
info: {
|
|
73
|
+
className: 'info',
|
|
74
|
+
icon: /*#__PURE__*/React.createElement(_FilledInfo["default"], {
|
|
75
|
+
color: "@B6"
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
error: {
|
|
79
|
+
className: 'error',
|
|
80
|
+
icon: /*#__PURE__*/React.createElement(_FilledError["default"], {
|
|
81
|
+
color: "@E6"
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var DialogBox = function DialogBox(props) {
|
|
87
|
+
var _React$useContext = React.useContext(_configProvider.ConfigContext),
|
|
88
|
+
getPopupContainer = _React$useContext.getPopupContainer,
|
|
89
|
+
getPrefixCls = _React$useContext.getPrefixCls;
|
|
90
|
+
|
|
91
|
+
var prefixCls = getPrefixCls('modal-dialogbox');
|
|
92
|
+
var closeIconToRender = /*#__PURE__*/React.createElement("span", {
|
|
93
|
+
className: "".concat(prefixCls, "-close-x")
|
|
94
|
+
}, /*#__PURE__*/React.createElement(_OutlinedClose["default"], {
|
|
95
|
+
className: "".concat(prefixCls, "-close-icon")
|
|
96
|
+
}));
|
|
97
|
+
|
|
98
|
+
var visible = props.visible,
|
|
99
|
+
className = props.className,
|
|
100
|
+
title = props.title,
|
|
101
|
+
content = props.content,
|
|
102
|
+
type = props.type,
|
|
103
|
+
cancelBtn = props.cancelBtn,
|
|
104
|
+
okText = props.okText,
|
|
105
|
+
confirmLoading = props.confirmLoading,
|
|
106
|
+
onOk = props.onOk,
|
|
107
|
+
onClose = props.onClose,
|
|
108
|
+
restProps = __rest(props, ["visible", "className", "title", "content", "type", "cancelBtn", "okText", "confirmLoading", "onOk", "onClose"]);
|
|
109
|
+
|
|
110
|
+
var _React$useState = React.useState(false),
|
|
111
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
112
|
+
loading = _React$useState2[0],
|
|
113
|
+
toggleLoading = _React$useState2[1];
|
|
114
|
+
|
|
115
|
+
var okBtnLoading = React.useMemo(function () {
|
|
116
|
+
if (typeof confirmLoading === 'boolean') {
|
|
117
|
+
return confirmLoading;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return loading;
|
|
121
|
+
}, [confirmLoading, loading]);
|
|
122
|
+
var handleOk = React.useCallback(function (e) {
|
|
123
|
+
var okResult = onOk === null || onOk === void 0 ? void 0 : onOk(e);
|
|
124
|
+
|
|
125
|
+
if (okResult && typeof okResult.then === 'function') {
|
|
126
|
+
toggleLoading(true);
|
|
127
|
+
okResult.then(function () {
|
|
128
|
+
console.log('then: close');
|
|
129
|
+
toggleLoading(false);
|
|
130
|
+
onClose === null || onClose === void 0 ? void 0 : onClose.apply(void 0, arguments);
|
|
131
|
+
}, function (e) {
|
|
132
|
+
console.error(e);
|
|
133
|
+
toggleLoading(false);
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
137
|
+
}
|
|
138
|
+
}, [onOk, onClose]);
|
|
139
|
+
var handleCancel = React.useCallback(function () {
|
|
140
|
+
onClose === null || onClose === void 0 ? void 0 : onClose({
|
|
141
|
+
triggerCancel: true
|
|
142
|
+
});
|
|
143
|
+
}, [onClose]);
|
|
144
|
+
var titleNode = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
className: "".concat(prefixCls, "-icon")
|
|
146
|
+
}, DialogType[type].icon), /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
className: "".concat(prefixCls, "-title")
|
|
148
|
+
}, title));
|
|
149
|
+
var footer = React.useMemo(function () {
|
|
150
|
+
if (!cancelBtn) {
|
|
151
|
+
return /*#__PURE__*/React.createElement(_button["default"], {
|
|
152
|
+
type: "primary",
|
|
153
|
+
loading: okBtnLoading,
|
|
154
|
+
onClick: handleOk
|
|
155
|
+
}, okText);
|
|
156
|
+
}
|
|
157
|
+
}, [okText, cancelBtn, okBtnLoading, handleOk]);
|
|
158
|
+
return /*#__PURE__*/React.createElement(_Modal["default"], (0, _extends2["default"])({}, restProps, {
|
|
159
|
+
confirmLoading: okBtnLoading,
|
|
160
|
+
footer: footer,
|
|
161
|
+
title: titleNode,
|
|
162
|
+
className: (0, _classnames["default"])(className, "".concat(prefixCls), "".concat(prefixCls, "-").concat(type)),
|
|
163
|
+
getContainer: getPopupContainer,
|
|
164
|
+
visible: visible,
|
|
165
|
+
closeIcon: closeIconToRender,
|
|
166
|
+
onCancel: handleCancel,
|
|
167
|
+
onOk: handleOk,
|
|
168
|
+
okText: okText
|
|
169
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
170
|
+
className: "".concat(prefixCls, "-content")
|
|
171
|
+
}, content));
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
DialogBox.defaultProps = {
|
|
175
|
+
visible: true,
|
|
176
|
+
type: 'info'
|
|
177
|
+
};
|
|
178
|
+
var _default = DialogBox;
|
|
179
|
+
exports["default"] = _default;
|
package/lib/modal/Modal.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ButtonProps } from '../button';
|
|
2
3
|
declare enum SizeType {
|
|
3
4
|
'small' = "sm",
|
|
4
5
|
'normal' = "md",
|
|
@@ -14,15 +15,17 @@ export interface ModalProps {
|
|
|
14
15
|
confirmLoading?: boolean;
|
|
15
16
|
/** 弹框标题 */
|
|
16
17
|
title?: React.ReactNode;
|
|
18
|
+
/** 确认按钮 props */
|
|
19
|
+
okButtonProps?: ButtonProps;
|
|
17
20
|
/** 点击确定回调 */
|
|
18
21
|
onOk?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
22
|
+
/** 取消按钮 props */
|
|
23
|
+
cancelButtonProps?: ButtonProps;
|
|
19
24
|
/** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调 */
|
|
20
25
|
onCancel?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
21
26
|
afterClose?: () => void;
|
|
22
27
|
/** 弹框宽度 */
|
|
23
28
|
width?: number;
|
|
24
|
-
/** 弹框高度 */
|
|
25
|
-
height?: number;
|
|
26
29
|
/** 底部内容 */
|
|
27
30
|
footer?: React.ReactNode;
|
|
28
31
|
/** 确认按钮文字 */
|
package/lib/modal/Modal.js
CHANGED
|
@@ -87,15 +87,17 @@ var Modal = function Modal(props) {
|
|
|
87
87
|
var renderFooter = function renderFooter() {
|
|
88
88
|
var okText = props.okText,
|
|
89
89
|
cancelText = props.cancelText,
|
|
90
|
-
confirmLoading = props.confirmLoading
|
|
91
|
-
|
|
90
|
+
confirmLoading = props.confirmLoading,
|
|
91
|
+
okButtonProps = props.okButtonProps,
|
|
92
|
+
cancelButtonProps = props.cancelButtonProps;
|
|
93
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_button["default"], (0, _extends2["default"])({
|
|
92
94
|
onClick: handleCancel,
|
|
93
95
|
type: "default"
|
|
94
|
-
}, cancelText || '取消'), /*#__PURE__*/React.createElement(_button["default"], {
|
|
96
|
+
}, cancelButtonProps), cancelText || '取消'), /*#__PURE__*/React.createElement(_button["default"], (0, _extends2["default"])({
|
|
95
97
|
onClick: handleOk,
|
|
96
98
|
loading: confirmLoading,
|
|
97
99
|
type: "primary"
|
|
98
|
-
}, okText || '确定'));
|
|
100
|
+
}, okButtonProps), okText || '确定'));
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
var visible = props.visible,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ModalFuncProps } from './DialogBox';
|
|
2
|
+
export declare function destroyAll(): void;
|
|
3
|
+
export declare function confirm(config: ModalFuncProps): {
|
|
4
|
+
destroy: (...args: any[]) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function success(config: ModalFuncProps): {
|
|
7
|
+
destroy: (...args: any[]) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function info(config: ModalFuncProps): {
|
|
10
|
+
destroy: (...args: any[]) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function warning(config: ModalFuncProps): {
|
|
13
|
+
destroy: (...args: any[]) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function error(config: ModalFuncProps): {
|
|
16
|
+
destroy: (...args: any[]) => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.confirm = confirm;
|
|
9
|
+
exports.destroyAll = destroyAll;
|
|
10
|
+
exports.error = error;
|
|
11
|
+
exports.info = info;
|
|
12
|
+
exports.success = success;
|
|
13
|
+
exports.warning = warning;
|
|
14
|
+
|
|
15
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
16
|
+
|
|
17
|
+
var _react = _interopRequireDefault(require("react"));
|
|
18
|
+
|
|
19
|
+
var _reactDom = require("react-dom");
|
|
20
|
+
|
|
21
|
+
var _DialogBox = _interopRequireDefault(require("./DialogBox"));
|
|
22
|
+
|
|
23
|
+
var destroyFns = [];
|
|
24
|
+
|
|
25
|
+
function renderDialogBox(config) {
|
|
26
|
+
var currentConfig = (0, _extends2["default"])((0, _extends2["default"])({}, config), {
|
|
27
|
+
visible: true,
|
|
28
|
+
onClose: close
|
|
29
|
+
});
|
|
30
|
+
var container = document.createDocumentFragment();
|
|
31
|
+
|
|
32
|
+
function render(dialogConfig) {
|
|
33
|
+
setTimeout(function () {
|
|
34
|
+
(0, _reactDom.render)( /*#__PURE__*/_react["default"].createElement(_DialogBox["default"], dialogConfig), container);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function destroy() {
|
|
39
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
40
|
+
args[_key] = arguments[_key];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var triggerCancel = args.some(function (param) {
|
|
44
|
+
return param && param.triggerCancel;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (config.onCancel && triggerCancel) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
config.onCancel.apply(config, args);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
for (var i = 0; i < destroyFns.length; i++) {
|
|
53
|
+
var fn = destroyFns[i];
|
|
54
|
+
|
|
55
|
+
if (fn === close) {
|
|
56
|
+
destroyFns.splice(i, 1);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
(0, _reactDom.unmountComponentAtNode)(container);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function close() {
|
|
65
|
+
var _this = this;
|
|
66
|
+
|
|
67
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
68
|
+
args[_key2] = arguments[_key2];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
render((0, _extends2["default"])((0, _extends2["default"])({}, currentConfig), {
|
|
72
|
+
visible: false,
|
|
73
|
+
afterClose: function afterClose() {
|
|
74
|
+
if (typeof config.afterClose === 'function') {
|
|
75
|
+
config.afterClose();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
destroy.apply(_this, args);
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
render(currentConfig);
|
|
84
|
+
destroyFns.push(close);
|
|
85
|
+
return {
|
|
86
|
+
destroy: close
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function destroyAll() {
|
|
91
|
+
while (destroyFns.length) {
|
|
92
|
+
var close = destroyFns.pop();
|
|
93
|
+
|
|
94
|
+
if (close) {
|
|
95
|
+
close();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function confirm(config) {
|
|
101
|
+
return renderDialogBox((0, _extends2["default"])((0, _extends2["default"])({}, config), {
|
|
102
|
+
type: 'confirm',
|
|
103
|
+
cancelBtn: true
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function success(config) {
|
|
108
|
+
var _a;
|
|
109
|
+
|
|
110
|
+
return renderDialogBox((0, _extends2["default"])((0, _extends2["default"])({}, config), {
|
|
111
|
+
type: 'success',
|
|
112
|
+
cancelBtn: false,
|
|
113
|
+
okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '关闭'
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function info(config) {
|
|
118
|
+
var _a;
|
|
119
|
+
|
|
120
|
+
return renderDialogBox((0, _extends2["default"])((0, _extends2["default"])({}, config), {
|
|
121
|
+
type: 'info',
|
|
122
|
+
cancelBtn: false,
|
|
123
|
+
okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '确定'
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function warning(config) {
|
|
128
|
+
var _a;
|
|
129
|
+
|
|
130
|
+
return renderDialogBox((0, _extends2["default"])((0, _extends2["default"])({}, config), {
|
|
131
|
+
type: 'warning',
|
|
132
|
+
cancelBtn: false,
|
|
133
|
+
okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '关闭'
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function error(config) {
|
|
138
|
+
var _a;
|
|
139
|
+
|
|
140
|
+
return renderDialogBox((0, _extends2["default"])((0, _extends2["default"])({}, config), {
|
|
141
|
+
type: 'error',
|
|
142
|
+
cancelBtn: false,
|
|
143
|
+
okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '重试'
|
|
144
|
+
}));
|
|
145
|
+
}
|
package/lib/modal/index.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { confirm, success, info, error, warning, destroyAll } from './dialog';
|
|
3
|
+
declare const _default: import("react").FC<import("./Modal").ModalProps> & {
|
|
4
|
+
confirm: typeof confirm;
|
|
5
|
+
success: typeof success;
|
|
6
|
+
info: typeof info;
|
|
7
|
+
error: typeof error;
|
|
8
|
+
warning: typeof warning;
|
|
9
|
+
destroyAll: typeof destroyAll;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
package/lib/modal/index.js
CHANGED
|
@@ -7,7 +7,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
10
12
|
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _dialog = require("./dialog");
|
|
15
|
+
|
|
16
|
+
var _default = (0, _extends2["default"])(_Modal["default"], {
|
|
17
|
+
confirm: _dialog.confirm,
|
|
18
|
+
success: _dialog.success,
|
|
19
|
+
info: _dialog.info,
|
|
20
|
+
error: _dialog.error,
|
|
21
|
+
warning: _dialog.warning,
|
|
22
|
+
destroyAll: _dialog.destroyAll
|
|
23
|
+
});
|
|
24
|
+
|
|
13
25
|
exports["default"] = _default;
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
transform: translate(-50%, -50%);
|
|
20
20
|
width: auto;
|
|
21
21
|
max-width: calc(100vw - 32px);
|
|
22
|
-
padding-bottom: 24px;
|
|
23
22
|
}
|
|
24
23
|
.acud-modal.zoom-enter,
|
|
25
24
|
.acud-modal.zoom-appear {
|
|
@@ -58,23 +57,43 @@
|
|
|
58
57
|
}
|
|
59
58
|
.acud-modal-sm {
|
|
60
59
|
width: 520px;
|
|
61
|
-
height: 240px;
|
|
62
|
-
max-height:
|
|
60
|
+
min-height: 240px;
|
|
61
|
+
max-height: 560px;
|
|
62
|
+
}
|
|
63
|
+
.acud-modal-sm > .acud-modal-content {
|
|
64
|
+
width: 100%;
|
|
65
|
+
min-height: 240px;
|
|
66
|
+
max-height: 560px;
|
|
63
67
|
}
|
|
64
68
|
.acud-modal-md {
|
|
65
69
|
width: 800px;
|
|
66
|
-
height: 400px;
|
|
67
|
-
max-height:
|
|
70
|
+
min-height: 400px;
|
|
71
|
+
max-height: 560px;
|
|
72
|
+
}
|
|
73
|
+
.acud-modal-md > .acud-modal-content {
|
|
74
|
+
width: 100%;
|
|
75
|
+
min-height: 400px;
|
|
76
|
+
max-height: 560px;
|
|
68
77
|
}
|
|
69
78
|
.acud-modal-lg {
|
|
70
79
|
width: 1120px;
|
|
71
|
-
height: 480px;
|
|
72
|
-
max-height:
|
|
80
|
+
min-height: 480px;
|
|
81
|
+
max-height: 560px;
|
|
82
|
+
}
|
|
83
|
+
.acud-modal-lg > .acud-modal-content {
|
|
84
|
+
width: 100%;
|
|
85
|
+
min-height: 480px;
|
|
86
|
+
max-height: 560px;
|
|
73
87
|
}
|
|
74
88
|
.acud-modal-xl {
|
|
75
89
|
width: 1200px;
|
|
76
|
-
height: 480px;
|
|
77
|
-
max-height:
|
|
90
|
+
min-height: 480px;
|
|
91
|
+
max-height: 560px;
|
|
92
|
+
}
|
|
93
|
+
.acud-modal-xl > .acud-modal-content {
|
|
94
|
+
width: 100%;
|
|
95
|
+
min-height: 480px;
|
|
96
|
+
max-height: 560px;
|
|
78
97
|
}
|
|
79
98
|
.acud-modal-content {
|
|
80
99
|
position: relative;
|
|
@@ -111,7 +130,7 @@
|
|
|
111
130
|
}
|
|
112
131
|
.acud-modal-close-x {
|
|
113
132
|
display: block;
|
|
114
|
-
margin-top:
|
|
133
|
+
margin-top: 27px;
|
|
115
134
|
font-size: 16px;
|
|
116
135
|
text-align: center;
|
|
117
136
|
text-transform: none;
|
|
@@ -125,24 +144,29 @@
|
|
|
125
144
|
font-weight: 900;
|
|
126
145
|
}
|
|
127
146
|
.acud-modal-title {
|
|
128
|
-
font-size:
|
|
129
|
-
line-height:
|
|
147
|
+
font-size: 14px;
|
|
148
|
+
line-height: 22px;
|
|
149
|
+
padding-right: 12px;
|
|
130
150
|
word-wrap: break-word;
|
|
131
151
|
}
|
|
132
152
|
.acud-modal-body {
|
|
133
|
-
|
|
153
|
+
margin: 16px 24px 24px;
|
|
134
154
|
font-size: 12px;
|
|
135
155
|
font-weight: 400;
|
|
136
156
|
line-height: 20px;
|
|
137
157
|
word-wrap: break-word;
|
|
138
158
|
color: #151B26;
|
|
139
159
|
flex: 1;
|
|
160
|
+
overflow-y: auto;
|
|
140
161
|
}
|
|
141
162
|
.acud-modal-footer {
|
|
142
163
|
padding: 0 24px 24px;
|
|
143
164
|
background: #FFFFFF;
|
|
144
165
|
text-align: right;
|
|
145
166
|
flex: none;
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: flex-end;
|
|
146
170
|
}
|
|
147
171
|
.acud-modal-footer .acud-btn {
|
|
148
172
|
margin: 0;
|
|
@@ -150,3 +174,45 @@
|
|
|
150
174
|
.acud-modal-footer .acud-btn + .acud-btn {
|
|
151
175
|
margin-left: 16px;
|
|
152
176
|
}
|
|
177
|
+
.acud-modal-dialogbox {
|
|
178
|
+
width: 400px;
|
|
179
|
+
height: auto;
|
|
180
|
+
min-height: 184px;
|
|
181
|
+
}
|
|
182
|
+
.acud-modal-dialogbox-icon {
|
|
183
|
+
height: 100%;
|
|
184
|
+
margin-right: 12px;
|
|
185
|
+
float: left;
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
padding-top: 2px;
|
|
189
|
+
}
|
|
190
|
+
.acud-modal-dialogbox-title {
|
|
191
|
+
overflow: hidden;
|
|
192
|
+
padding-right: 12px;
|
|
193
|
+
}
|
|
194
|
+
.acud-modal-dialogbox-content {
|
|
195
|
+
width: 100%;
|
|
196
|
+
padding-left: 32px;
|
|
197
|
+
}
|
|
198
|
+
.acud-modal-dialogbox .acud-modal-title .acudicon {
|
|
199
|
+
font-size: 20px;
|
|
200
|
+
}
|
|
201
|
+
.acud-modal-dialogbox > .acud-modal-content {
|
|
202
|
+
min-height: 184px;
|
|
203
|
+
}
|
|
204
|
+
.acud-modal-dialogbox-warning .acud-modal-dialogbox-icon {
|
|
205
|
+
color: #FF9326;
|
|
206
|
+
}
|
|
207
|
+
.acud-modal-dialogbox-info .acud-modal-dialogbox-icon {
|
|
208
|
+
color: #2468F2;
|
|
209
|
+
}
|
|
210
|
+
.acud-modal-dialogbox-success .acud-modal-dialogbox-icon {
|
|
211
|
+
color: #30BF13;
|
|
212
|
+
}
|
|
213
|
+
.acud-modal-dialogbox-error .acud-modal-dialogbox-icon {
|
|
214
|
+
color: #F33E3E;
|
|
215
|
+
}
|
|
216
|
+
.acud-modal-dialogbox-confirm .acud-modal-dialogbox-icon {
|
|
217
|
+
color: #FF9326;
|
|
218
|
+
}
|