| | |
| | | import type { ModalFunc, ModalFuncProps } from 'ant-design-vue/lib/modal/Modal'; |
| | | import type { ModalFuncProps } from 'ant-design-vue/lib/modal/Modal'; |
| | | import { Modal, message as Message, notification } from 'ant-design-vue'; |
| | | import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons-vue'; |
| | | import { NotificationArgsProps, ConfigProps } from 'ant-design-vue/lib/notification'; |
| | | import { useI18n } from './useI18n'; |
| | | import { isString } from '/@/utils/is'; |
| | | import { isString } from '@/utils/is'; |
| | | |
| | | export interface NotifyApi { |
| | | info(config: NotificationArgsProps): void; |
| | |
| | | iconType: 'warning' | 'success' | 'error' | 'info'; |
| | | } |
| | | export type ModalOptionsPartial = Partial<ModalOptionsEx> & Pick<ModalOptionsEx, 'content'>; |
| | | |
| | | interface ConfirmOptions { |
| | | info: ModalFunc; |
| | | success: ModalFunc; |
| | | error: ModalFunc; |
| | | warn: ModalFunc; |
| | | warning: ModalFunc; |
| | | } |
| | | |
| | | function getIcon(iconType: string) { |
| | | if (iconType === 'warning') { |
| | |
| | | /** |
| | | * @description: Create confirmation box |
| | | */ |
| | | function createConfirm(options: ModalOptionsEx): ConfirmOptions { |
| | | function createConfirm(options: ModalOptionsEx) { |
| | | const iconType = options.iconType || 'warning'; |
| | | Reflect.deleteProperty(options, 'iconType'); |
| | | const opt: ModalFuncProps = { |
| | |
| | | ...options, |
| | | content: renderContent(options), |
| | | }; |
| | | return Modal.confirm(opt) as unknown as ConfirmOptions; |
| | | return Modal.confirm(opt); |
| | | } |
| | | |
| | | const getBaseOptions = () => { |
| | |
| | | return { |
| | | createMessage: Message, |
| | | notification: notification as NotifyApi, |
| | | createConfirm: createConfirm, |
| | | createConfirm, |
| | | createSuccessModal, |
| | | createErrorModal, |
| | | createInfoModal, |