ant-design/components/modal/index.tsx

68 lines
1.4 KiB
TypeScript
Raw Normal View History

import * as React from 'react';
import Modal, { ModalFuncProps, destroyFns } from './Modal';
2015-09-07 11:48:57 +08:00
import confirm from './confirm';
import Icon from '../icon';
export { ActionButtonProps } from './ActionButton';
export { ModalProps, ModalFuncProps } from './Modal';
2018-12-07 20:02:01 +08:00
Modal.info = function(props: ModalFuncProps) {
const config = {
type: 'info',
icon: <Icon type="info-circle" />,
okCancel: false,
...props,
};
return confirm(config);
2015-09-07 11:48:57 +08:00
};
2018-12-07 20:02:01 +08:00
Modal.success = function(props: ModalFuncProps) {
const config = {
type: 'success',
icon: <Icon type="check-circle" />,
okCancel: false,
...props,
};
return confirm(config);
2015-09-07 11:48:57 +08:00
};
2018-12-07 20:02:01 +08:00
Modal.error = function(props: ModalFuncProps) {
const config = {
type: 'error',
icon: <Icon type="close-circle" />,
okCancel: false,
...props,
};
return confirm(config);
2015-09-07 11:48:57 +08:00
};
2018-12-07 20:02:01 +08:00
Modal.warning = Modal.warn = function(props: ModalFuncProps) {
const config = {
2016-04-11 14:59:37 +08:00
type: 'warning',
icon: <Icon type="exclamation-circle" />,
2016-04-11 14:59:37 +08:00
okCancel: false,
...props,
};
2016-04-11 14:59:37 +08:00
return confirm(config);
};
2018-12-07 20:02:01 +08:00
Modal.confirm = function(props: ModalFuncProps) {
const config = {
type: 'confirm',
okCancel: true,
...props,
};
return confirm(config);
2015-09-07 11:48:57 +08:00
};
Modal.destroyAll = function() {
while (destroyFns.length) {
const close = destroyFns.pop();
if (close) {
close();
}
}
};
export default Modal;