UNPKG

hongluan-ui

Version:
136 lines (135 loc) 4.74 kB
import type { VNode, ExtractPropTypes } from 'vue'; import type Notification from './notification.vue'; export declare const notificationTypes: readonly ["success", "info", "warning", "error", "danger"]; export declare const notificationProps: { /** * @description custom class name for Notification */ readonly customClass: { readonly type: StringConstructor; readonly default: ""; }; /** * @description whether `message` is treated as HTML string */ readonly dangerouslyUseHTMLString: BooleanConstructor; /** * @description duration before close. It will not automatically close if set 0 */ readonly duration: { readonly type: NumberConstructor; readonly default: 4500; }; readonly iconClass: { readonly type: StringConstructor; readonly default: ""; }; /** * @description notification dom id */ readonly id: { readonly type: StringConstructor; readonly default: ""; }; /** * @description description text */ readonly message: import("hongluan-ui/es/utils").EpPropFinalized<import("vue").PropType<string | VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any; }>>, never, never, string, false>; /** * @description custom icon component. It will be overridden by `type` */ readonly icon: { readonly type: import("vue").PropType<VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any; }>>; readonly required: false; readonly validator: (val: unknown) => boolean; __epPropKey: true; }; /** * @description offset from the top edge of the screen. Every Notification instance of the same moment should have the same offset */ readonly offset: { readonly type: NumberConstructor; readonly default: 0; }; /** * @description callback function when notification clicked */ readonly onClick: { readonly type: import("vue").PropType<() => void>; readonly required: false; readonly validator: (val: unknown) => boolean; __epPropKey: true; }; /** * @description callback function when closed */ readonly onClose: { readonly type: import("vue").PropType<() => void>; readonly required: true; readonly validator: (val: unknown) => boolean; __epPropKey: true; }; /** * @description custom position */ readonly position: import("hongluan-ui/es/utils").EpPropFinalized<StringConstructor, "top-right" | "top-left" | "bottom-right" | "bottom-left", never, "top-right", false>; /** * @description whether to show a close button */ readonly showClose: { readonly type: BooleanConstructor; readonly default: true; }; /** * @description title */ readonly title: { readonly type: StringConstructor; readonly default: ""; }; /** * @description notification type */ readonly type: import("hongluan-ui/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "info" | "warning" | "danger" | "error", never, "", false>; /** * @description initial zIndex */ readonly zIndex: NumberConstructor; }; export declare type NotificationProps = ExtractPropTypes<typeof notificationProps>; export declare const notificationEmits: { destroy: () => boolean; }; export declare type NotificationEmits = typeof notificationEmits; export declare type NotificationInstance = InstanceType<typeof Notification>; export declare type NotificationOptions = Omit<NotificationProps, 'id'> & { /** * @description set the root element for the notification, default to `document.body` */ appendTo?: HTMLElement | string; }; export declare type NotificationOptionsTyped = Omit<NotificationOptions, 'type'>; export interface NotificationHandle { close: () => void; } export declare type NotificationParams = Partial<NotificationOptions> | string | VNode; export declare type NotificationParamsTyped = Partial<NotificationOptionsTyped> | string | VNode; export declare type NotifyFn = ((options?: NotificationParams) => NotificationHandle) & { closeAll: () => void; }; export declare type NotifyTypedFn = (options?: NotificationParamsTyped) => NotificationHandle; export interface Notify extends NotifyFn { success: NotifyTypedFn; warning: NotifyTypedFn; error: NotifyTypedFn; danger: NotifyTypedFn; info: NotifyTypedFn; } export interface NotificationQueueItem { vm: VNode; } export declare type NotificationQueue = NotificationQueueItem[];