@aplus-frontend/ui
Version:
63 lines (62 loc) • 2.43 kB
TypeScript
import { ModalFuncProps } from '@aplus-frontend/antdv/lib/modal/Modal';
import { NotificationArgsProps, ConfigProps } from '@aplus-frontend/antdv/lib/notification';
import { ModalFuncProps } from '@aplus-frontend/antdv';
import { MessageApi } from '@aplus-frontend/antdv/es/message';
export interface NotifyApi {
info(config: NotificationArgsProps): void;
success(config: NotificationArgsProps): void;
error(config: NotificationArgsProps): void;
warn(config: NotificationArgsProps): void;
warning(config: NotificationArgsProps): void;
open(args: NotificationArgsProps): void;
close(key: string): void;
config(options: ConfigProps): void;
destroy(): void;
}
export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
export declare type IconType = 'success' | 'info' | 'error' | 'warning';
export interface ModalOptionsEx extends Omit<ModalFuncProps, 'iconType'> {
iconType: 'warning' | 'success' | 'error' | 'info';
}
export type ModalOptionsPartial = Partial<ModalOptionsEx> & Pick<ModalOptionsEx, 'content'>;
/**
* @description: Create confirmation box
*/
declare function createConfirm(options: ModalOptionsEx): {
destroy: () => void;
update: (newConfig: ModalFuncProps) => void;
};
declare function createSuccessModal(options: ModalOptionsPartial): {
destroy: () => void;
update: (newConfig: ModalFuncProps) => void;
};
declare function createErrorModal(options: ModalOptionsPartial): {
destroy: () => void;
update: (newConfig: ModalFuncProps) => void;
};
declare function createInfoModal(options: ModalOptionsPartial): {
destroy: () => void;
update: (newConfig: ModalFuncProps) => void;
};
declare function createWarningModal(options: ModalOptionsPartial): {
destroy: () => void;
update: (newConfig: ModalFuncProps) => void;
};
declare function createModal(options: ModalOptionsPartial, type: IconType): {
destroy: () => void;
update: (newConfig: ModalFuncProps) => void;
};
/**
* @description: message
*/
export declare function useMessage(): {
createMessage: MessageApi;
notification: NotifyApi;
createConfirm: typeof createConfirm;
createSuccessModal: typeof createSuccessModal;
createErrorModal: typeof createErrorModal;
createInfoModal: typeof createInfoModal;
createWarningModal: typeof createWarningModal;
createModal: typeof createModal;
};
export {};