acud 0.0.64 → 0.0.65
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 +41 -5
- package/dist/acud.css.map +1 -1
- package/dist/acud.js +341 -7
- 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 +3 -3
- package/dist/acud.min.js.map +1 -1
- package/es/dropdown/dropdown-button.js +2 -4
- package/es/modal/DialogBox.d.ts +46 -0
- package/es/modal/DialogBox.js +152 -0
- 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 +40 -4
- package/es/modal/style/index.less +60 -1
- package/es/style/themes/default/components/modal.less +2 -2
- package/lib/dropdown/dropdown-button.js +2 -4
- package/lib/modal/DialogBox.d.ts +46 -0
- package/lib/modal/DialogBox.js +179 -0
- 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 +40 -4
- package/lib/modal/style/index.less +60 -1
- package/lib/style/themes/default/components/modal.less +2 -2
- package/package.json +1 -1
|
@@ -35,8 +35,7 @@ var DropdownButton = function DropdownButton(props) {
|
|
|
35
35
|
trigger = props.trigger,
|
|
36
36
|
visible = props.visible,
|
|
37
37
|
onVisibleChange = props.onVisibleChange,
|
|
38
|
-
|
|
39
|
-
restProps = __rest(props, ["children", "overlay", "disabled", "trigger", "visible", "onVisibleChange", "onClick"]); // 菜单可见,需要将ICON旋转
|
|
38
|
+
restProps = __rest(props, ["children", "overlay", "disabled", "trigger", "visible", "onVisibleChange"]); // 菜单可见,需要将ICON旋转
|
|
40
39
|
|
|
41
40
|
|
|
42
41
|
var _useState = useState(!!visible),
|
|
@@ -53,8 +52,7 @@ var DropdownButton = function DropdownButton(props) {
|
|
|
53
52
|
}, []);
|
|
54
53
|
var arrowCls = classNames((_classNames = {}, _defineProperty(_classNames, 'acud-btn-group-expand', popupVisible), _defineProperty(_classNames, 'acud-btn-group-border-left', restProps.type === 'primary'), _classNames));
|
|
55
54
|
return /*#__PURE__*/React.createElement(ButtonGroup, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
56
|
-
disabled: disabled
|
|
57
|
-
onClick: onClick
|
|
55
|
+
disabled: disabled
|
|
58
56
|
}, restProps), children), /*#__PURE__*/React.createElement(Dropdown, {
|
|
59
57
|
disabled: disabled,
|
|
60
58
|
placement: "bottomRight",
|
|
@@ -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,152 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
|
|
4
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
5
|
+
var t = {};
|
|
6
|
+
|
|
7
|
+
for (var p in s) {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
12
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
import FilledError from "acud-icon/es/icons/FilledError";
|
|
19
|
+
import OutlinedClose from "acud-icon/es/icons/OutlinedClose";
|
|
20
|
+
import FilledSuccess from "acud-icon/es/icons/FilledSuccess";
|
|
21
|
+
import FilledWarn from "acud-icon/es/icons/FilledWarn";
|
|
22
|
+
import FilledInfo from "acud-icon/es/icons/FilledInfo";
|
|
23
|
+
import classNames from 'classnames';
|
|
24
|
+
import { ConfigContext } from '../config-provider';
|
|
25
|
+
import Button from '../button';
|
|
26
|
+
import Modal from './Modal';
|
|
27
|
+
var DialogType = {
|
|
28
|
+
success: {
|
|
29
|
+
className: 'sucess',
|
|
30
|
+
icon: /*#__PURE__*/React.createElement(FilledSuccess, {
|
|
31
|
+
color: "@S6"
|
|
32
|
+
})
|
|
33
|
+
},
|
|
34
|
+
warning: {
|
|
35
|
+
className: 'warning',
|
|
36
|
+
icon: /*#__PURE__*/React.createElement(FilledWarn, {
|
|
37
|
+
color: "@W6"
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
confirm: {
|
|
41
|
+
className: 'confirm',
|
|
42
|
+
icon: /*#__PURE__*/React.createElement(FilledWarn, {
|
|
43
|
+
color: "@W6"
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
info: {
|
|
47
|
+
className: 'info',
|
|
48
|
+
icon: /*#__PURE__*/React.createElement(FilledInfo, {
|
|
49
|
+
color: "@B6"
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
error: {
|
|
53
|
+
className: 'error',
|
|
54
|
+
icon: /*#__PURE__*/React.createElement(FilledError, {
|
|
55
|
+
color: "@E6"
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var DialogBox = function DialogBox(props) {
|
|
61
|
+
var _React$useContext = React.useContext(ConfigContext),
|
|
62
|
+
getPopupContainer = _React$useContext.getPopupContainer,
|
|
63
|
+
getPrefixCls = _React$useContext.getPrefixCls;
|
|
64
|
+
|
|
65
|
+
var prefixCls = getPrefixCls('modal-dialogbox');
|
|
66
|
+
var closeIconToRender = /*#__PURE__*/React.createElement("span", {
|
|
67
|
+
className: "".concat(prefixCls, "-close-x")
|
|
68
|
+
}, /*#__PURE__*/React.createElement(OutlinedClose, {
|
|
69
|
+
className: "".concat(prefixCls, "-close-icon")
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
var visible = props.visible,
|
|
73
|
+
className = props.className,
|
|
74
|
+
title = props.title,
|
|
75
|
+
content = props.content,
|
|
76
|
+
type = props.type,
|
|
77
|
+
cancelBtn = props.cancelBtn,
|
|
78
|
+
okText = props.okText,
|
|
79
|
+
confirmLoading = props.confirmLoading,
|
|
80
|
+
onOk = props.onOk,
|
|
81
|
+
onClose = props.onClose,
|
|
82
|
+
restProps = __rest(props, ["visible", "className", "title", "content", "type", "cancelBtn", "okText", "confirmLoading", "onOk", "onClose"]);
|
|
83
|
+
|
|
84
|
+
var _React$useState = React.useState(false),
|
|
85
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
86
|
+
loading = _React$useState2[0],
|
|
87
|
+
toggleLoading = _React$useState2[1];
|
|
88
|
+
|
|
89
|
+
var okBtnLoading = React.useMemo(function () {
|
|
90
|
+
if (typeof confirmLoading === 'boolean') {
|
|
91
|
+
return confirmLoading;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return loading;
|
|
95
|
+
}, [confirmLoading, loading]);
|
|
96
|
+
var handleOk = React.useCallback(function (e) {
|
|
97
|
+
var okResult = onOk === null || onOk === void 0 ? void 0 : onOk(e);
|
|
98
|
+
|
|
99
|
+
if (okResult && typeof okResult.then === 'function') {
|
|
100
|
+
toggleLoading(true);
|
|
101
|
+
okResult.then(function () {
|
|
102
|
+
console.log('then: close');
|
|
103
|
+
toggleLoading(false);
|
|
104
|
+
onClose === null || onClose === void 0 ? void 0 : onClose.apply(void 0, arguments);
|
|
105
|
+
}, function (e) {
|
|
106
|
+
console.error(e);
|
|
107
|
+
toggleLoading(false);
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
111
|
+
}
|
|
112
|
+
}, [onOk, onClose]);
|
|
113
|
+
var handleCancel = React.useCallback(function () {
|
|
114
|
+
onClose === null || onClose === void 0 ? void 0 : onClose({
|
|
115
|
+
triggerCancel: true
|
|
116
|
+
});
|
|
117
|
+
}, [onClose]);
|
|
118
|
+
var titleNode = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
className: "".concat(prefixCls, "-icon")
|
|
120
|
+
}, DialogType[type].icon), /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
className: "".concat(prefixCls, "-title")
|
|
122
|
+
}, title));
|
|
123
|
+
var footer = React.useMemo(function () {
|
|
124
|
+
if (!cancelBtn) {
|
|
125
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
126
|
+
type: "primary",
|
|
127
|
+
loading: okBtnLoading,
|
|
128
|
+
onClick: handleOk
|
|
129
|
+
}, okText);
|
|
130
|
+
}
|
|
131
|
+
}, [okText, cancelBtn, okBtnLoading, handleOk]);
|
|
132
|
+
return /*#__PURE__*/React.createElement(Modal, _extends({}, restProps, {
|
|
133
|
+
confirmLoading: okBtnLoading,
|
|
134
|
+
footer: footer,
|
|
135
|
+
title: titleNode,
|
|
136
|
+
className: classNames(className, "".concat(prefixCls), "".concat(prefixCls, "-").concat(type)),
|
|
137
|
+
getContainer: getPopupContainer,
|
|
138
|
+
visible: visible,
|
|
139
|
+
closeIcon: closeIconToRender,
|
|
140
|
+
onCancel: handleCancel,
|
|
141
|
+
onOk: handleOk,
|
|
142
|
+
okText: okText
|
|
143
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
144
|
+
className: "".concat(prefixCls, "-content")
|
|
145
|
+
}, content));
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
DialogBox.defaultProps = {
|
|
149
|
+
visible: true,
|
|
150
|
+
type: 'info'
|
|
151
|
+
};
|
|
152
|
+
export default DialogBox;
|
|
@@ -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,123 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render as reactRender, unmountComponentAtNode } from 'react-dom';
|
|
4
|
+
import DialogBox from './DialogBox';
|
|
5
|
+
var destroyFns = [];
|
|
6
|
+
|
|
7
|
+
function renderDialogBox(config) {
|
|
8
|
+
var currentConfig = _extends(_extends({}, config), {
|
|
9
|
+
visible: true,
|
|
10
|
+
onClose: close
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var container = document.createDocumentFragment();
|
|
14
|
+
|
|
15
|
+
function render(dialogConfig) {
|
|
16
|
+
setTimeout(function () {
|
|
17
|
+
reactRender( /*#__PURE__*/React.createElement(DialogBox, dialogConfig), container);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function destroy() {
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
args[_key] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var triggerCancel = args.some(function (param) {
|
|
27
|
+
return param && param.triggerCancel;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (config.onCancel && triggerCancel) {
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
config.onCancel.apply(config, args);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
for (var i = 0; i < destroyFns.length; i++) {
|
|
36
|
+
var fn = destroyFns[i];
|
|
37
|
+
|
|
38
|
+
if (fn === close) {
|
|
39
|
+
destroyFns.splice(i, 1);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
unmountComponentAtNode(container);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function close() {
|
|
48
|
+
var _this = this;
|
|
49
|
+
|
|
50
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
51
|
+
args[_key2] = arguments[_key2];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
render(_extends(_extends({}, currentConfig), {
|
|
55
|
+
visible: false,
|
|
56
|
+
afterClose: function afterClose() {
|
|
57
|
+
if (typeof config.afterClose === 'function') {
|
|
58
|
+
config.afterClose();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
destroy.apply(_this, args);
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
render(currentConfig);
|
|
67
|
+
destroyFns.push(close);
|
|
68
|
+
return {
|
|
69
|
+
destroy: close
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function destroyAll() {
|
|
74
|
+
while (destroyFns.length) {
|
|
75
|
+
var close = destroyFns.pop();
|
|
76
|
+
|
|
77
|
+
if (close) {
|
|
78
|
+
close();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function confirm(config) {
|
|
83
|
+
return renderDialogBox(_extends(_extends({}, config), {
|
|
84
|
+
type: 'confirm',
|
|
85
|
+
cancelBtn: true
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
export function success(config) {
|
|
89
|
+
var _a;
|
|
90
|
+
|
|
91
|
+
return renderDialogBox(_extends(_extends({}, config), {
|
|
92
|
+
type: 'success',
|
|
93
|
+
cancelBtn: false,
|
|
94
|
+
okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '关闭'
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
export function info(config) {
|
|
98
|
+
var _a;
|
|
99
|
+
|
|
100
|
+
return renderDialogBox(_extends(_extends({}, config), {
|
|
101
|
+
type: 'info',
|
|
102
|
+
cancelBtn: false,
|
|
103
|
+
okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '确定'
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
export function warning(config) {
|
|
107
|
+
var _a;
|
|
108
|
+
|
|
109
|
+
return renderDialogBox(_extends(_extends({}, config), {
|
|
110
|
+
type: 'warning',
|
|
111
|
+
cancelBtn: false,
|
|
112
|
+
okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '关闭'
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
export function error(config) {
|
|
116
|
+
var _a;
|
|
117
|
+
|
|
118
|
+
return renderDialogBox(_extends(_extends({}, config), {
|
|
119
|
+
type: 'error',
|
|
120
|
+
cancelBtn: false,
|
|
121
|
+
okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '重试'
|
|
122
|
+
}));
|
|
123
|
+
}
|
package/es/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/es/modal/index.js
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import Modal from './Modal';
|
|
2
|
-
|
|
3
|
+
import { confirm, success, info, error, warning, destroyAll } from './dialog';
|
|
4
|
+
export default _extends(Modal, {
|
|
5
|
+
confirm: confirm,
|
|
6
|
+
success: success,
|
|
7
|
+
info: info,
|
|
8
|
+
error: error,
|
|
9
|
+
warning: warning,
|
|
10
|
+
destroyAll: destroyAll
|
|
11
|
+
});
|
package/es/modal/style/index.css
CHANGED
|
@@ -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 {
|
|
@@ -111,7 +110,7 @@
|
|
|
111
110
|
}
|
|
112
111
|
.acud-modal-close-x {
|
|
113
112
|
display: block;
|
|
114
|
-
margin-top:
|
|
113
|
+
margin-top: 27px;
|
|
115
114
|
font-size: 16px;
|
|
116
115
|
text-align: center;
|
|
117
116
|
text-transform: none;
|
|
@@ -125,8 +124,8 @@
|
|
|
125
124
|
font-weight: 900;
|
|
126
125
|
}
|
|
127
126
|
.acud-modal-title {
|
|
128
|
-
font-size:
|
|
129
|
-
line-height:
|
|
127
|
+
font-size: 14px;
|
|
128
|
+
line-height: 22px;
|
|
130
129
|
word-wrap: break-word;
|
|
131
130
|
}
|
|
132
131
|
.acud-modal-body {
|
|
@@ -143,6 +142,9 @@
|
|
|
143
142
|
background: #FFFFFF;
|
|
144
143
|
text-align: right;
|
|
145
144
|
flex: none;
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: flex-end;
|
|
146
148
|
}
|
|
147
149
|
.acud-modal-footer .acud-btn {
|
|
148
150
|
margin: 0;
|
|
@@ -150,3 +152,37 @@
|
|
|
150
152
|
.acud-modal-footer .acud-btn + .acud-btn {
|
|
151
153
|
margin-left: 16px;
|
|
152
154
|
}
|
|
155
|
+
.acud-modal-dialogbox {
|
|
156
|
+
width: 400px;
|
|
157
|
+
height: auto;
|
|
158
|
+
min-height: 184px;
|
|
159
|
+
}
|
|
160
|
+
.acud-modal-dialogbox-icon {
|
|
161
|
+
height: 100%;
|
|
162
|
+
margin-right: 12px;
|
|
163
|
+
float: left;
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
padding-top: 2px;
|
|
167
|
+
}
|
|
168
|
+
.acud-modal-dialogbox .acud-modal-title .acudicon {
|
|
169
|
+
font-size: 20px;
|
|
170
|
+
}
|
|
171
|
+
.acud-modal-dialogbox-content {
|
|
172
|
+
padding-left: 32px;
|
|
173
|
+
}
|
|
174
|
+
.acud-modal-dialogbox-warning .acud-modal-dialogbox-icon {
|
|
175
|
+
color: #FF9326;
|
|
176
|
+
}
|
|
177
|
+
.acud-modal-dialogbox-info .acud-modal-dialogbox-icon {
|
|
178
|
+
color: #2468F2;
|
|
179
|
+
}
|
|
180
|
+
.acud-modal-dialogbox-success .acud-modal-dialogbox-icon {
|
|
181
|
+
color: #30BF13;
|
|
182
|
+
}
|
|
183
|
+
.acud-modal-dialogbox-error .acud-modal-dialogbox-icon {
|
|
184
|
+
color: #F33E3E;
|
|
185
|
+
}
|
|
186
|
+
.acud-modal-dialogbox-confirm .acud-modal-dialogbox-icon {
|
|
187
|
+
color: #FF9326;
|
|
188
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@import './mixin';
|
|
4
4
|
|
|
5
5
|
@modal-prefix-cls: ~'@{acud-prefix}-modal';
|
|
6
|
+
@dialogbox-prefix: ~'@{modal-prefix-cls}-dialogbox';
|
|
6
7
|
|
|
7
8
|
.@{modal-prefix-cls} {
|
|
8
9
|
.reset-component();
|
|
@@ -16,7 +17,6 @@
|
|
|
16
17
|
transform: translate(-50%, -50%);
|
|
17
18
|
width: auto;
|
|
18
19
|
max-width: calc(100vw - 32px);
|
|
19
|
-
padding-bottom: 24px;
|
|
20
20
|
|
|
21
21
|
&-sm {
|
|
22
22
|
.modal-size-config(sm);
|
|
@@ -114,6 +114,10 @@
|
|
|
114
114
|
background: @modal-footer-bg-color;
|
|
115
115
|
text-align: right;
|
|
116
116
|
flex: none;
|
|
117
|
+
// TODO: 暂时解决 confirmLoading 时按钮对齐问题
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
justify-content: flex-end;
|
|
117
121
|
|
|
118
122
|
.@{acud-prefix}-btn {
|
|
119
123
|
margin: 0;
|
|
@@ -123,3 +127,58 @@
|
|
|
123
127
|
}
|
|
124
128
|
}
|
|
125
129
|
}
|
|
130
|
+
|
|
131
|
+
.@{dialogbox-prefix} {
|
|
132
|
+
width: @P * 100;
|
|
133
|
+
height: auto;
|
|
134
|
+
min-height: @P * 46;
|
|
135
|
+
|
|
136
|
+
&-icon {
|
|
137
|
+
height: 100%;
|
|
138
|
+
margin-right: @P * 3;
|
|
139
|
+
float: left;
|
|
140
|
+
// TODO: 没找到更好的居中办法
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
padding-top: 2px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.@{modal-prefix-cls}-title {
|
|
147
|
+
.acudicon {
|
|
148
|
+
font-size: @T6;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&-content {
|
|
153
|
+
padding-left: @P * 3 + @T6;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.@{dialogbox-prefix}-warning {
|
|
158
|
+
.@{dialogbox-prefix}-icon {
|
|
159
|
+
color: @W6;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.@{dialogbox-prefix}-info {
|
|
164
|
+
.@{dialogbox-prefix}-icon {
|
|
165
|
+
color: @B6;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.@{dialogbox-prefix}-success {
|
|
170
|
+
.@{dialogbox-prefix}-icon {
|
|
171
|
+
color: @S6;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
.@{dialogbox-prefix}-error {
|
|
175
|
+
.@{dialogbox-prefix}-icon {
|
|
176
|
+
color: @E6;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.@{dialogbox-prefix}-confirm {
|
|
181
|
+
.@{dialogbox-prefix}-icon {
|
|
182
|
+
color: @W6;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
@modal-content-bg-color: @G11;
|
|
30
30
|
|
|
31
31
|
// Header
|
|
32
|
-
@modal-heading-height:
|
|
32
|
+
@modal-heading-height: 22px;
|
|
33
33
|
@modal-heading-bg-color: @G10;
|
|
34
34
|
@modal-heading-padding: 6*@P 6*@P 0;
|
|
35
|
-
@modal-heading-font-size: @
|
|
35
|
+
@modal-heading-font-size: @T3;
|
|
36
36
|
@modal-heading-font-weight: 500;
|
|
37
37
|
@modal-heading-color: @G2;
|
|
38
38
|
|
|
@@ -57,8 +57,7 @@ var DropdownButton = function DropdownButton(props) {
|
|
|
57
57
|
trigger = props.trigger,
|
|
58
58
|
visible = props.visible,
|
|
59
59
|
onVisibleChange = props.onVisibleChange,
|
|
60
|
-
|
|
61
|
-
restProps = __rest(props, ["children", "overlay", "disabled", "trigger", "visible", "onVisibleChange", "onClick"]); // 菜单可见,需要将ICON旋转
|
|
60
|
+
restProps = __rest(props, ["children", "overlay", "disabled", "trigger", "visible", "onVisibleChange"]); // 菜单可见,需要将ICON旋转
|
|
62
61
|
|
|
63
62
|
|
|
64
63
|
var _useState = (0, _react.useState)(!!visible),
|
|
@@ -75,8 +74,7 @@ var DropdownButton = function DropdownButton(props) {
|
|
|
75
74
|
}, []);
|
|
76
75
|
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
76
|
return /*#__PURE__*/_react["default"].createElement(ButtonGroup, null, /*#__PURE__*/_react["default"].createElement(_button["default"], (0, _extends2["default"])({
|
|
78
|
-
disabled: disabled
|
|
79
|
-
onClick: onClick
|
|
77
|
+
disabled: disabled
|
|
80
78
|
}, restProps), children), /*#__PURE__*/_react["default"].createElement(_dropdown["default"], {
|
|
81
79
|
disabled: disabled,
|
|
82
80
|
placement: "bottomRight",
|
|
@@ -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;
|