162 lines
7.0 KiB
TypeScript
162 lines
7.0 KiB
TypeScript
import type { AppContext, Component, ExtractPublicPropTypes, VNode } from 'vue';
|
|
import type Notification from './notification.vue';
|
|
export declare const notificationTypes: readonly ["primary", "success", "info", "warning", "error"];
|
|
export type NotificationType = (typeof notificationTypes)[number] | '';
|
|
export type NotificationPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
export interface NotificationProps {
|
|
/**
|
|
* @description custom class name for Notification
|
|
*/
|
|
customClass?: string;
|
|
/**
|
|
* @description whether `message` is treated as HTML string
|
|
*/
|
|
dangerouslyUseHTMLString?: boolean;
|
|
/**
|
|
* @description duration before close. It will not automatically close if set 0
|
|
*/
|
|
duration?: number;
|
|
/**
|
|
* @description custom icon component. It will be overridden by `type`
|
|
*/
|
|
icon?: string | Component;
|
|
/**
|
|
* @description notification dom id
|
|
*/
|
|
id?: string;
|
|
/**
|
|
* @description description text
|
|
*/
|
|
message?: string | VNode | (() => VNode);
|
|
/**
|
|
* @description offset from the top edge of the screen. Every Notification instance of the same moment should have the same offset
|
|
*/
|
|
offset?: number;
|
|
/**
|
|
* @description callback function when notification clicked
|
|
*/
|
|
onClick?: () => void;
|
|
/**
|
|
* @description callback function when closed
|
|
*/
|
|
onClose: () => void;
|
|
/**
|
|
* @description custom position
|
|
*/
|
|
position?: NotificationPosition;
|
|
/**
|
|
* @description whether to show a close button
|
|
*/
|
|
showClose?: boolean;
|
|
/**
|
|
* @description title
|
|
*/
|
|
title?: string;
|
|
/**
|
|
* @description notification type
|
|
*/
|
|
type?: NotificationType;
|
|
/**
|
|
* @description initial zIndex
|
|
*/
|
|
zIndex?: number;
|
|
/**
|
|
* @description custom close icon, default is Close
|
|
*/
|
|
closeIcon?: string | Component;
|
|
}
|
|
/**
|
|
* @deprecated Removed after 3.0.0, Use `NotificationProps` instead.
|
|
*/
|
|
export declare const notificationProps: {
|
|
readonly customClass: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
readonly dangerouslyUseHTMLString: BooleanConstructor;
|
|
readonly duration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 4500, boolean>;
|
|
readonly icon: {
|
|
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
readonly message: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
[key: string]: any;
|
|
}> | (() => VNode)) | (() => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
[key: string]: any;
|
|
}> | (() => VNode)) | ((new (...args: any[]) => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
[key: string]: any;
|
|
}> | (() => VNode)) | (() => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
[key: string]: any;
|
|
}> | (() => VNode)))[], unknown, unknown, "", boolean>;
|
|
readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
readonly onClick: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => () => void) | (() => () => void) | {
|
|
(): () => void;
|
|
new (): any;
|
|
readonly prototype: any;
|
|
} | ((new (...args: any[]) => () => void) | (() => () => void) | {
|
|
(): () => void;
|
|
new (): any;
|
|
readonly prototype: any;
|
|
})[], unknown, unknown, () => undefined, boolean>;
|
|
readonly onClose: {
|
|
readonly type: import("vue").PropType<() => void>;
|
|
readonly required: true;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
readonly position: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "top-left" | "top-right" | "bottom-left" | "bottom-right", unknown, "top-right", boolean>;
|
|
readonly showClose: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
readonly title: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "error" | "primary" | "success" | "warning" | "info", unknown, "", boolean>;
|
|
readonly zIndex: NumberConstructor;
|
|
readonly closeIcon: {
|
|
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown>>;
|
|
readonly required: false;
|
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
__epPropKey: true;
|
|
};
|
|
};
|
|
/**
|
|
* @deprecated Removed after 3.0.0, Use `NotificationProps` instead.
|
|
*/
|
|
export type NotificationPropsPublic = ExtractPublicPropTypes<typeof notificationProps>;
|
|
export declare const notificationEmits: {
|
|
destroy: () => boolean;
|
|
};
|
|
export type NotificationEmits = typeof notificationEmits;
|
|
export type NotificationInstance = InstanceType<typeof Notification> & unknown;
|
|
export type NotificationOptions = Omit<NotificationProps, 'id' | 'onClose'> & {
|
|
/**
|
|
* @description set the root element for the notification, default to `document.body`
|
|
*/
|
|
appendTo?: HTMLElement | string;
|
|
/**
|
|
* @description callback function when closed
|
|
*/
|
|
onClose?(vm: VNode): void;
|
|
};
|
|
export type NotificationOptionsTyped = Omit<NotificationOptions, 'type'>;
|
|
export interface NotificationHandle {
|
|
close: () => void;
|
|
}
|
|
export type NotificationParams = Partial<NotificationOptions> | string | VNode;
|
|
export type NotificationParamsTyped = Partial<NotificationOptionsTyped> | string | VNode;
|
|
export interface NotifyFn {
|
|
(options?: NotificationParams, appContext?: null | AppContext): NotificationHandle;
|
|
closeAll(): void;
|
|
updateOffsets(position?: NotificationOptions['position']): void;
|
|
_context: AppContext | null;
|
|
}
|
|
export type NotifyTypedFn = (options?: NotificationParamsTyped, appContext?: null | AppContext) => NotificationHandle;
|
|
export interface Notify extends NotifyFn {
|
|
primary: NotifyTypedFn;
|
|
success: NotifyTypedFn;
|
|
warning: NotifyTypedFn;
|
|
error: NotifyTypedFn;
|
|
info: NotifyTypedFn;
|
|
}
|
|
export interface NotificationQueueItem {
|
|
vm: VNode;
|
|
}
|
|
export type NotificationQueue = NotificationQueueItem[];
|