notification.d.ts 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import type { AppContext, ExtractPropTypes, VNode } from 'vue';
  2. import type Notification from './notification.vue';
  3. export declare const notificationTypes: readonly ["success", "info", "warning", "error"];
  4. export declare const notificationProps: {
  5. readonly customClass: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
  6. readonly dangerouslyUseHTMLString: BooleanConstructor;
  7. readonly duration: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 4500, boolean>;
  8. readonly icon: {
  9. readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
  10. readonly required: false;
  11. readonly validator: ((val: unknown) => boolean) | undefined;
  12. __epPropKey: true;
  13. };
  14. readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
  15. readonly message: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
  16. [key: string]: any;
  17. }> | (() => VNode)) | (() => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
  18. [key: string]: any;
  19. }> | (() => VNode)) | ((new (...args: any[]) => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
  20. [key: string]: any;
  21. }> | (() => VNode)) | (() => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
  22. [key: string]: any;
  23. }> | (() => VNode)))[], unknown, unknown, "", boolean>;
  24. readonly offset: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
  25. readonly onClick: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => () => void) | (() => () => void) | {
  26. (): () => void;
  27. new (): any;
  28. readonly prototype: any;
  29. } | ((new (...args: any[]) => () => void) | (() => () => void) | {
  30. (): () => void;
  31. new (): any;
  32. readonly prototype: any;
  33. })[], unknown, unknown, () => undefined, boolean>;
  34. readonly onClose: {
  35. readonly type: import("vue").PropType<() => void>;
  36. readonly required: true;
  37. readonly validator: ((val: unknown) => boolean) | undefined;
  38. __epPropKey: true;
  39. };
  40. readonly position: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "top-right" | "top-left" | "bottom-right" | "bottom-left", unknown, "top-right", boolean>;
  41. readonly showClose: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
  42. readonly title: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
  43. readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "error" | "success" | "warning" | "info", unknown, "", boolean>;
  44. readonly zIndex: NumberConstructor;
  45. readonly closeIcon: {
  46. readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>>;
  47. readonly required: false;
  48. readonly validator: ((val: unknown) => boolean) | undefined;
  49. __epPropKey: true;
  50. };
  51. };
  52. export type NotificationProps = ExtractPropTypes<typeof notificationProps>;
  53. export declare const notificationEmits: {
  54. destroy: () => boolean;
  55. };
  56. export type NotificationEmits = typeof notificationEmits;
  57. export type NotificationInstance = InstanceType<typeof Notification> & unknown;
  58. export type NotificationOptions = Omit<NotificationProps, 'id' | 'onClose'> & {
  59. /**
  60. * @description set the root element for the notification, default to `document.body`
  61. */
  62. appendTo?: HTMLElement | string;
  63. /**
  64. * @description callback function when closed
  65. */
  66. onClose?(vm: VNode): void;
  67. };
  68. export type NotificationOptionsTyped = Omit<NotificationOptions, 'type'>;
  69. export interface NotificationHandle {
  70. close: () => void;
  71. }
  72. export type NotificationParams = Partial<NotificationOptions> | string | VNode;
  73. export type NotificationParamsTyped = Partial<NotificationOptionsTyped> | string | VNode;
  74. export interface NotifyFn {
  75. (options?: NotificationParams, appContext?: null | AppContext): NotificationHandle;
  76. closeAll(): void;
  77. _context: AppContext | null;
  78. }
  79. export type NotifyTypedFn = (options?: NotificationParamsTyped, appContext?: null | AppContext) => NotificationHandle;
  80. export interface Notify extends NotifyFn {
  81. success: NotifyTypedFn;
  82. warning: NotifyTypedFn;
  83. error: NotifyTypedFn;
  84. info: NotifyTypedFn;
  85. }
  86. export interface NotificationQueueItem {
  87. vm: VNode;
  88. }
  89. export type NotificationQueue = NotificationQueueItem[];