HookNotification.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import type { CSSProperties } from 'vue';
  2. import type { NoticeProps } from './Notice';
  3. import type { CSSMotionProps } from '../_util/transition';
  4. import type { Key, VueNode } from '../_util/type';
  5. export declare function getUuid(): string;
  6. export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
  7. export interface OpenConfig extends NoticeProps {
  8. key: Key;
  9. placement?: Placement;
  10. content?: VueNode;
  11. duration?: number | null;
  12. }
  13. export type Placements = Partial<Record<Placement, OpenConfig[]>>;
  14. export interface NoticeContent extends Omit<NoticeProps, 'prefixCls' | 'noticeKey' | 'onClose'> {
  15. prefixCls?: string;
  16. key?: Key;
  17. updateMark?: string;
  18. content?: any;
  19. onClose?: () => void;
  20. style?: CSSProperties;
  21. class?: String;
  22. placement?: Placement;
  23. }
  24. export type NoticeFunc = (noticeProps: NoticeContent) => void;
  25. export type HolderReadyCallback = (div: HTMLDivElement, noticeProps: NoticeProps & {
  26. key: Key;
  27. }) => void;
  28. export interface NotificationInstance {
  29. notice: NoticeFunc;
  30. removeNotice: (key: Key) => void;
  31. destroy: () => void;
  32. add: (noticeProps: NoticeContent) => void;
  33. component: Notification;
  34. }
  35. export interface HookNotificationProps {
  36. prefixCls?: string;
  37. transitionName?: string;
  38. animation?: string | CSSMotionProps | ((placement?: Placement) => CSSMotionProps);
  39. maxCount?: number;
  40. closeIcon?: any;
  41. hashId?: string;
  42. remove: (key: Key) => void;
  43. notices: NotificationState;
  44. getStyles?: (placement?: Placement) => CSSProperties;
  45. getClassName?: (placement?: Placement) => string;
  46. onAllRemoved?: VoidFunction;
  47. getContainer?: () => HTMLElement;
  48. }
  49. type NotificationState = {
  50. notice: NoticeContent & {
  51. userPassKey?: Key;
  52. };
  53. holderCallback?: HolderReadyCallback;
  54. }[];
  55. declare const Notification: import("vue").DefineComponent<HookNotificationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<HookNotificationProps>, {
  56. closeIcon?: any;
  57. }, {}>;
  58. export default Notification;