mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 04:36:19 +08:00
f7ed77b52f
* chore: refactor test cases
* ✨ support Modal.config
* fix lint
* remove extra default prefixCls value
* fix tsd
* docs: fix api
* Update components/message/index.en-US.md
Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>
Co-authored-by: xrk <xrkffgg@gmail.com>
55 lines
1.2 KiB
TypeScript
55 lines
1.2 KiB
TypeScript
import OriginModal, { ModalFuncProps, destroyFns } from './Modal';
|
|
import confirm, {
|
|
withWarn,
|
|
withInfo,
|
|
withSuccess,
|
|
withError,
|
|
withConfirm,
|
|
ModalStaticFunctions,
|
|
globalConfig,
|
|
} from './confirm';
|
|
|
|
export { ActionButtonProps } from './ActionButton';
|
|
export { ModalProps, ModalFuncProps } from './Modal';
|
|
|
|
function modalWarn(props: ModalFuncProps) {
|
|
return confirm(withWarn(props));
|
|
}
|
|
|
|
type Modal = typeof OriginModal &
|
|
ModalStaticFunctions & { destroyAll: () => void; config: typeof globalConfig };
|
|
const Modal = OriginModal as Modal;
|
|
|
|
Modal.info = function infoFn(props: ModalFuncProps) {
|
|
return confirm(withInfo(props));
|
|
};
|
|
|
|
Modal.success = function successFn(props: ModalFuncProps) {
|
|
return confirm(withSuccess(props));
|
|
};
|
|
|
|
Modal.error = function errorFn(props: ModalFuncProps) {
|
|
return confirm(withError(props));
|
|
};
|
|
|
|
Modal.warning = modalWarn;
|
|
|
|
Modal.warn = modalWarn;
|
|
|
|
Modal.confirm = function confirmFn(props: ModalFuncProps) {
|
|
return confirm(withConfirm(props));
|
|
};
|
|
|
|
Modal.destroyAll = function destroyAllFn() {
|
|
while (destroyFns.length) {
|
|
const close = destroyFns.pop();
|
|
if (close) {
|
|
close();
|
|
}
|
|
}
|
|
};
|
|
|
|
Modal.config = globalConfig;
|
|
|
|
export default Modal;
|