mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
10c326ee94
* feat: 添加全局静态配置 * chore: change globalConfig * chore: change globalPrefixCls * chore: review * feat: 恢复 message 静态 prefix * feat: modal * feat: notification * fix: prefix * fix: prefix * fix: 添加 test * chore: review * docs: doc * chore: en * chore: test * fix: notification config set empty * chore: link * chore: change name * chore: doc * chore: doc
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import OriginModal, { ModalFuncProps, destroyFns } from './Modal';
|
|
import confirm, {
|
|
withWarn,
|
|
withInfo,
|
|
withSuccess,
|
|
withError,
|
|
withConfirm,
|
|
ModalStaticFunctions,
|
|
modalGlobalConfig,
|
|
} from './confirm';
|
|
|
|
export { ActionButtonProps } from './ActionButton';
|
|
export { ModalProps, ModalFuncProps } from './Modal';
|
|
|
|
function modalWarn(props: ModalFuncProps) {
|
|
return confirm(withWarn(props));
|
|
}
|
|
|
|
type ModalType = typeof OriginModal &
|
|
ModalStaticFunctions & { destroyAll: () => void; config: typeof modalGlobalConfig };
|
|
|
|
const Modal = OriginModal as ModalType;
|
|
|
|
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 = modalGlobalConfig;
|
|
|
|
export default Modal;
|