typings.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Use of this source code is governed by an MIT-style license that can be
  3. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  4. */
  5. import { TemplateRef } from '@angular/core';
  6. import { Subject } from 'rxjs';
  7. import { NgClassInterface, NgStyleInterface, NzSafeAny } from 'ng-zorro-antd/core/types';
  8. import type { NzNotificationComponent } from './notification.component';
  9. export type NzNotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'top' | 'bottom';
  10. export type NzNotificationContentType = string | TemplateRef<void | {
  11. $implicit: NzNotificationComponent;
  12. data: NzSafeAny;
  13. }>;
  14. export interface NzNotificationDataOptions<T = {}> {
  15. nzKey?: string;
  16. nzStyle?: NgStyleInterface;
  17. nzClass?: NgClassInterface | string;
  18. nzCloseIcon?: TemplateRef<void> | string;
  19. nzButton?: TemplateRef<{
  20. $implicit: NzNotificationComponent;
  21. }>;
  22. nzPlacement?: NzNotificationPlacement;
  23. nzData?: T;
  24. nzDuration?: number;
  25. nzAnimate?: boolean;
  26. nzPauseOnHover?: boolean;
  27. }
  28. export interface NzNotificationData {
  29. title?: string | TemplateRef<void>;
  30. content?: NzNotificationContentType;
  31. createdAt?: Date;
  32. messageId?: string;
  33. options?: NzNotificationDataOptions;
  34. state?: 'enter' | 'leave';
  35. template?: TemplateRef<{}>;
  36. type?: 'success' | 'info' | 'warning' | 'error' | 'blank' | string;
  37. onClose?: Subject<boolean>;
  38. onClick?: Subject<MouseEvent>;
  39. }
  40. export type NzNotificationRef = Pick<Required<NzNotificationData>, 'onClose' | 'onClick' | 'messageId'>;