前端初始化
This commit is contained in:
+185
@@ -0,0 +1,185 @@
|
||||
import { IconPropType } from "../../../utils/vue/icon.js";
|
||||
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
|
||||
import { ClassValue } from "../../../utils/typescript.js";
|
||||
import { ProgressProps } from "../../progress/src/progress.js";
|
||||
import _default from "./notification.vue.js";
|
||||
import * as _$vue from "vue";
|
||||
import { AppContext, ExtractPublicPropTypes, Ref, VNode } from "vue";
|
||||
|
||||
//#region ../../packages/components/notification/src/notification.d.ts
|
||||
declare const notificationTypes: readonly ["primary", "success", "info", "warning", "error"];
|
||||
type NotificationType = (typeof notificationTypes)[number] | '';
|
||||
type NotificationPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
||||
/**
|
||||
* Progress bar configuration. `percentage`, `type`, `duration`, `indeterminate`
|
||||
* and `width` are excluded: the bar is always a countdown-driven line.
|
||||
*/
|
||||
type NotificationProgress = Omit<Partial<ProgressProps>, 'percentage' | 'type' | 'duration' | 'indeterminate' | 'width'>;
|
||||
interface NotificationProps {
|
||||
/**
|
||||
* @description custom class name for Notification
|
||||
*/
|
||||
customClass?: ClassValue;
|
||||
/**
|
||||
* @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?: IconPropType;
|
||||
/**
|
||||
* @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?: IconPropType;
|
||||
/**
|
||||
* @description progress bar indicating auto-close countdown. Set `true` to show a default progress bar, or pass an object to customize it (options of `ElProgress`)
|
||||
*/
|
||||
progress?: boolean | NotificationProgress;
|
||||
/**
|
||||
* @description whether to pause the timer when hovering over the notification
|
||||
*/
|
||||
pauseOnHover?: boolean;
|
||||
}
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `NotificationProps` instead.
|
||||
*/
|
||||
declare const notificationProps: {
|
||||
readonly customClass: EpPropFinalized<(new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue) | (((new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue)) | null)[], unknown, unknown, "", boolean>;
|
||||
readonly dangerouslyUseHTMLString: BooleanConstructor;
|
||||
readonly duration: EpPropFinalized<NumberConstructor, unknown, unknown, 4500, boolean>;
|
||||
readonly icon: {
|
||||
readonly type: _$vue.PropType<EpPropMergeType<(new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component) | (((new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component)) | null)[], unknown, unknown>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly id: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly message: EpPropFinalized<(new (...args: any[]) => string | VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}> | (() => VNode)) | (() => string | VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}> | (() => VNode)) | (((new (...args: any[]) => string | VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}> | (() => VNode)) | (() => string | VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}> | (() => VNode))) | null)[], unknown, unknown, "", boolean>;
|
||||
readonly offset: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
||||
readonly onClick: EpPropFinalized<(new (...args: any[]) => () => void) | (() => () => void) | {
|
||||
(): () => void;
|
||||
new (): any;
|
||||
readonly prototype: any;
|
||||
} | (((new (...args: any[]) => () => void) | (() => () => void) | {
|
||||
(): () => void;
|
||||
new (): any;
|
||||
readonly prototype: any;
|
||||
}) | null)[], unknown, unknown, () => undefined, boolean>;
|
||||
readonly onClose: {
|
||||
readonly type: _$vue.PropType<() => void>;
|
||||
readonly required: true;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly position: EpPropFinalized<StringConstructor, "top-left" | "top-right" | "bottom-left" | "bottom-right", unknown, "top-right", boolean>;
|
||||
readonly showClose: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
||||
readonly title: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
||||
readonly type: EpPropFinalized<StringConstructor, "" | "primary" | "success" | "info" | "warning" | "error", unknown, "", boolean>;
|
||||
readonly zIndex: NumberConstructor;
|
||||
readonly closeIcon: EpPropFinalized<(new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component) | (((new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component)) | null)[], unknown, unknown, _$vue.DefineComponent<{}, void, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>, boolean>;
|
||||
readonly progress: EpPropFinalized<(new (...args: any[]) => boolean | NotificationProgress) | (() => boolean | NotificationProgress) | (((new (...args: any[]) => boolean | NotificationProgress) | (() => boolean | NotificationProgress)) | null)[], unknown, unknown, false, boolean>;
|
||||
readonly pauseOnHover: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
||||
};
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `NotificationProps` instead.
|
||||
*/
|
||||
type NotificationPropsPublic = ExtractPublicPropTypes<typeof notificationProps>;
|
||||
declare const notificationEmits: {
|
||||
destroy: () => boolean;
|
||||
};
|
||||
type NotificationEmits = typeof notificationEmits;
|
||||
type NotificationInstance = InstanceType<typeof _default> & unknown;
|
||||
interface NotificationExposed {
|
||||
/** @description close notification */
|
||||
close: () => void;
|
||||
visible: Ref<boolean>;
|
||||
}
|
||||
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;
|
||||
};
|
||||
type NotificationOptionsTyped = Omit<NotificationOptions, 'type'>;
|
||||
interface NotificationHandle {
|
||||
close: () => void;
|
||||
}
|
||||
type NotificationParams = Partial<NotificationOptions> | string | VNode;
|
||||
type NotificationParamsTyped = Partial<NotificationOptionsTyped> | string | VNode;
|
||||
interface NotifyFn {
|
||||
(options?: NotificationParams, appContext?: null | AppContext): NotificationHandle;
|
||||
closeAll(): void;
|
||||
updateOffsets(position?: NotificationOptions['position']): void;
|
||||
_context: AppContext | null;
|
||||
}
|
||||
type NotifyTypedFn = (options?: NotificationParamsTyped, appContext?: null | AppContext) => NotificationHandle;
|
||||
interface Notify extends NotifyFn {
|
||||
primary: NotifyTypedFn;
|
||||
success: NotifyTypedFn;
|
||||
warning: NotifyTypedFn;
|
||||
error: NotifyTypedFn;
|
||||
info: NotifyTypedFn;
|
||||
}
|
||||
interface NotificationQueueItem {
|
||||
vm: VNode;
|
||||
}
|
||||
type NotificationQueue = NotificationQueueItem[];
|
||||
//#endregion
|
||||
export { NotificationEmits, NotificationExposed, NotificationHandle, NotificationInstance, NotificationOptions, NotificationOptionsTyped, NotificationParams, NotificationParamsTyped, NotificationPosition, NotificationProgress, NotificationProps, NotificationPropsPublic, NotificationQueue, NotificationQueueItem, NotificationType, Notify, NotifyFn, NotifyTypedFn, notificationEmits, notificationProps, notificationTypes };
|
||||
Reference in New Issue
Block a user