base.d.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 { Direction } from '@angular/cdk/bidi';
  6. import { CdkConnectedOverlay, ConnectedOverlayPositionChange, ConnectionPositionPair } from '@angular/cdk/overlay';
  7. import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, Renderer2, SimpleChanges, TemplateRef, Type, ViewContainerRef } from '@angular/core';
  8. import { Subject } from 'rxjs';
  9. import { NzConfigService, PopConfirmConfig, PopoverConfig } from 'ng-zorro-antd/core/config';
  10. import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';
  11. import { POSITION_TYPE } from 'ng-zorro-antd/core/overlay';
  12. import { NgClassInterface, NgStyleInterface, NzSafeAny, NzTSType } from 'ng-zorro-antd/core/types';
  13. import * as i0 from "@angular/core";
  14. export interface PropertyMapping {
  15. [key: string]: [string, () => unknown];
  16. }
  17. export type NzTooltipTrigger = 'click' | 'focus' | 'hover' | null;
  18. export declare abstract class NzTooltipBaseDirective implements AfterViewInit, OnChanges, OnDestroy {
  19. protected componentType: Type<NzTooltipBaseComponent>;
  20. config?: Required<PopoverConfig | PopConfirmConfig>;
  21. abstract arrowPointAtCenter?: boolean;
  22. abstract directiveTitle?: NzTSType | null;
  23. abstract directiveContent?: NzTSType | null;
  24. abstract title?: NzTSType | null;
  25. abstract content?: NzTSType | null;
  26. abstract trigger?: NzTooltipTrigger;
  27. abstract placement?: string | string[];
  28. abstract origin?: ElementRef<HTMLElement>;
  29. abstract visible?: boolean;
  30. abstract mouseEnterDelay?: number;
  31. abstract mouseLeaveDelay?: number;
  32. abstract overlayClassName?: string;
  33. abstract overlayStyle?: NgStyleInterface;
  34. abstract overlayClickable?: boolean;
  35. cdkConnectedOverlayPush?: boolean;
  36. visibleChange: EventEmitter<boolean>;
  37. /**
  38. * This true title that would be used in other parts on this component.
  39. */
  40. protected get _title(): NzTSType | null;
  41. protected get _content(): NzTSType | null;
  42. protected get _trigger(): NzTooltipTrigger;
  43. protected get _placement(): string[];
  44. protected get _visible(): boolean;
  45. protected get _mouseEnterDelay(): number;
  46. protected get _mouseLeaveDelay(): number;
  47. protected get _overlayClassName(): string | null;
  48. protected get _overlayStyle(): NgStyleInterface | null;
  49. protected get _overlayClickable(): boolean;
  50. private internalVisible;
  51. protected getProxyPropertyMap(): PropertyMapping;
  52. component?: NzTooltipBaseComponent;
  53. protected readonly destroy$: Subject<void>;
  54. protected readonly triggerDisposables: Array<() => void>;
  55. private delayTimer?;
  56. elementRef: ElementRef<any>;
  57. protected hostView: ViewContainerRef;
  58. protected renderer: Renderer2;
  59. protected noAnimation: NzNoAnimationDirective | null;
  60. protected nzConfigService: NzConfigService;
  61. protected platformId: Object;
  62. constructor(componentType: Type<NzTooltipBaseComponent>);
  63. ngAfterViewInit(): void;
  64. ngOnChanges(changes: SimpleChanges): void;
  65. ngOnDestroy(): void;
  66. show(): void;
  67. hide(): void;
  68. /**
  69. * Force the component to update its position.
  70. */
  71. updatePosition(): void;
  72. /**
  73. * Create a dynamic tooltip component. This method can be override.
  74. */
  75. protected createComponent(): void;
  76. protected registerTriggers(): void;
  77. private updatePropertiesByChanges;
  78. private updatePropertiesByKeys;
  79. private initProperties;
  80. private updateComponentValue;
  81. private delayEnterLeave;
  82. private removeTriggerListeners;
  83. private clearTogglingTimer;
  84. static ɵfac: i0.ɵɵFactoryDeclaration<NzTooltipBaseDirective, never>;
  85. static ɵdir: i0.ɵɵDirectiveDeclaration<NzTooltipBaseDirective, never, never, {}, {}, never, never, true, never>;
  86. }
  87. export declare abstract class NzTooltipBaseComponent implements OnDestroy, OnInit {
  88. overlay: CdkConnectedOverlay;
  89. noAnimation: NzNoAnimationDirective | null;
  90. cdr: ChangeDetectorRef;
  91. private directionality;
  92. nzTitle: NzTSType | null;
  93. nzContent: NzTSType | null;
  94. nzArrowPointAtCenter: boolean;
  95. nzOverlayClassName: string;
  96. nzOverlayStyle: NgStyleInterface;
  97. nzOverlayClickable: boolean;
  98. nzBackdrop: boolean;
  99. nzMouseEnterDelay?: number;
  100. nzMouseLeaveDelay?: number;
  101. cdkConnectedOverlayPush?: boolean;
  102. nzVisibleChange: Subject<boolean>;
  103. set nzVisible(value: boolean);
  104. get nzVisible(): boolean;
  105. _visible: boolean;
  106. set nzTrigger(value: NzTooltipTrigger);
  107. get nzTrigger(): NzTooltipTrigger;
  108. protected _trigger: NzTooltipTrigger;
  109. set nzPlacement(value: POSITION_TYPE[]);
  110. preferredPlacement: string;
  111. origin: ElementRef<NzSafeAny>;
  112. dir: Direction;
  113. _classMap: NgClassInterface;
  114. _prefix: string;
  115. _positions: ConnectionPositionPair[];
  116. protected destroy$: Subject<void>;
  117. ngOnInit(): void;
  118. ngOnDestroy(): void;
  119. show(): void;
  120. hide(): void;
  121. updateByDirective(): void;
  122. /**
  123. * Force the component to update its position.
  124. */
  125. updatePosition(): void;
  126. onPositionChange(position: ConnectedOverlayPositionChange): void;
  127. setOverlayOrigin(origin: ElementRef<HTMLElement>): void;
  128. onClickOutside(event: MouseEvent): void;
  129. /**
  130. * Hide the component while the content is empty.
  131. */
  132. private updateVisibilityByTitle;
  133. protected updateStyles(): void;
  134. protected transformClassListToMap(klass: string): Record<string, boolean>;
  135. /**
  136. * Empty component cannot be opened.
  137. */
  138. protected abstract isEmpty(): boolean;
  139. static ɵfac: i0.ɵɵFactoryDeclaration<NzTooltipBaseComponent, never>;
  140. static ɵdir: i0.ɵɵDirectiveDeclaration<NzTooltipBaseComponent, never, never, {}, {}, never, never, true, never>;
  141. }
  142. export declare function isTooltipEmpty(value: string | TemplateRef<void> | null): boolean;