index.d.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import type { CSSProperties } from 'vue';
  2. import type { VueNode } from '../_util/type';
  3. import type { NotificationInstance as VCNotificationInstance } from '../vc-notification/Notification';
  4. export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
  5. export declare type IconType = 'success' | 'info' | 'error' | 'warning';
  6. export interface ConfigProps {
  7. top?: string | number;
  8. bottom?: string | number;
  9. duration?: number;
  10. prefixCls?: string;
  11. placement?: NotificationPlacement;
  12. getContainer?: () => HTMLElement;
  13. closeIcon?: VueNode | (() => VueNode);
  14. rtl?: boolean;
  15. maxCount?: number;
  16. }
  17. export interface NotificationArgsProps {
  18. message: VueNode | (() => VueNode);
  19. description?: VueNode | (() => VueNode);
  20. btn?: VueNode | (() => VueNode);
  21. key?: string;
  22. onClose?: () => void;
  23. duration?: number | null;
  24. icon?: VueNode | (() => VueNode);
  25. placement?: NotificationPlacement;
  26. style?: CSSProperties;
  27. prefixCls?: string;
  28. class?: string;
  29. readonly type?: IconType;
  30. onClick?: () => void;
  31. top?: string;
  32. bottom?: string;
  33. getContainer?: () => HTMLElement;
  34. closeIcon?: VueNode | (() => VueNode);
  35. appContext?: any;
  36. }
  37. export interface NotificationInstance {
  38. success(args: NotificationArgsProps): void;
  39. error(args: NotificationArgsProps): void;
  40. info(args: NotificationArgsProps): void;
  41. warning(args: NotificationArgsProps): void;
  42. open(args: NotificationArgsProps): void;
  43. }
  44. export interface NotificationApi extends NotificationInstance {
  45. warn(args: NotificationArgsProps): void;
  46. close(key: string): void;
  47. config(options: ConfigProps): void;
  48. destroy(): void;
  49. }
  50. /** @private test Only function. Not work on production */
  51. export declare const getInstance: (cacheKey: string) => Promise<VCNotificationInstance>;
  52. declare const _default: NotificationApi;
  53. export default _default;