UNPKG

879 BJavaScriptView Raw
1import Modal, { destroyFns } from './Modal';
2import confirm, { withWarn, withInfo, withSuccess, withError, withConfirm } from './confirm';
3
4function modalWarn(props) {
5 return confirm(withWarn(props));
6}
7
8Modal.info = function infoFn(props) {
9 return confirm(withInfo(props));
10};
11
12Modal.success = function successFn(props) {
13 return confirm(withSuccess(props));
14};
15
16Modal.error = function errorFn(props) {
17 return confirm(withError(props));
18};
19
20Modal.warning = modalWarn;
21Modal.warn = modalWarn;
22
23Modal.confirm = function confirmFn(props) {
24 return confirm(withConfirm(props));
25};
26
27Modal.destroyAll = function destroyAllFn() {
28 while (destroyFns.length) {
29 var close = destroyFns.pop();
30
31 if (close) {
32 close();
33 }
34 }
35};
36/* istanbul ignore next */
37
38
39Modal.install = function (app) {
40 app.component(Modal.name, Modal);
41 return app;
42};
43
44export default Modal;
\No newline at end of file