mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 09:21:22 +08:00
72 lines
1.4 KiB
TypeScript
72 lines
1.4 KiB
TypeScript
import * as React from 'react';
|
|
import Modal, { ModalFuncProps, destroyFns } from './Modal';
|
|
import confirm from './confirm';
|
|
import Icon from '../icon';
|
|
|
|
export { ActionButtonProps } from './ActionButton';
|
|
export { ModalProps, ModalFuncProps } from './Modal';
|
|
|
|
function modalWarn(props: ModalFuncProps) {
|
|
const config = {
|
|
type: 'warning',
|
|
icon: <Icon type="exclamation-circle" />,
|
|
okCancel: false,
|
|
...props,
|
|
};
|
|
return confirm(config);
|
|
}
|
|
|
|
Modal.info = function infoFn(props: ModalFuncProps) {
|
|
const config = {
|
|
type: 'info',
|
|
icon: <Icon type="info-circle" />,
|
|
okCancel: false,
|
|
...props,
|
|
};
|
|
return confirm(config);
|
|
};
|
|
|
|
Modal.success = function successFn(props: ModalFuncProps) {
|
|
const config = {
|
|
type: 'success',
|
|
icon: <Icon type="check-circle" />,
|
|
okCancel: false,
|
|
...props,
|
|
};
|
|
return confirm(config);
|
|
};
|
|
|
|
Modal.error = function errorFn(props: ModalFuncProps) {
|
|
const config = {
|
|
type: 'error',
|
|
icon: <Icon type="close-circle" />,
|
|
okCancel: false,
|
|
...props,
|
|
};
|
|
return confirm(config);
|
|
};
|
|
|
|
Modal.warning = modalWarn;
|
|
|
|
Modal.warn = modalWarn;
|
|
|
|
Modal.confirm = function confirmFn(props: ModalFuncProps) {
|
|
const config = {
|
|
type: 'confirm',
|
|
okCancel: true,
|
|
...props,
|
|
};
|
|
return confirm(config);
|
|
};
|
|
|
|
Modal.destroyAll = function destroyAllFn() {
|
|
while (destroyFns.length) {
|
|
const close = destroyFns.pop();
|
|
if (close) {
|
|
close();
|
|
}
|
|
}
|
|
};
|
|
|
|
export default Modal;
|