tooltip.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import { EventEmitter, OnInit, OnDestroy, Injector, Renderer2, ElementRef, TemplateRef, ViewContainerRef, ComponentFactoryResolver, NgZone, ChangeDetectorRef, ApplicationRef, OnChanges, SimpleChanges } from '@angular/core';
  2. import { PlacementArray } from '../util/positioning';
  3. import { NgbTooltipConfig } from './tooltip-config';
  4. export declare class NgbTooltipWindow {
  5. id: string;
  6. tooltipClass: string;
  7. }
  8. /**
  9. * A lightweight and extensible directive for fancy tooltip creation.
  10. */
  11. export declare class NgbTooltip implements OnInit, OnDestroy, OnChanges {
  12. private _elementRef;
  13. private _renderer;
  14. private _ngZone;
  15. private _document;
  16. private _changeDetector;
  17. /**
  18. * Indicates whether the tooltip should be closed on `Escape` key and inside/outside clicks:
  19. *
  20. * * `true` - closes on both outside and inside clicks as well as `Escape` presses
  21. * * `false` - disables the autoClose feature (NB: triggers still apply)
  22. * * `"inside"` - closes on inside clicks as well as Escape presses
  23. * * `"outside"` - closes on outside clicks (sometimes also achievable through triggers)
  24. * as well as `Escape` presses
  25. *
  26. * @since 3.0.0
  27. */
  28. autoClose: boolean | 'inside' | 'outside';
  29. /**
  30. * The preferred placement of the tooltip.
  31. *
  32. * Possible values are `"top"`, `"top-left"`, `"top-right"`, `"bottom"`, `"bottom-left"`,
  33. * `"bottom-right"`, `"left"`, `"left-top"`, `"left-bottom"`, `"right"`, `"right-top"`,
  34. * `"right-bottom"`
  35. *
  36. * Accepts an array of strings or a string with space separated possible values.
  37. *
  38. * The default order of preference is `"auto"` (same as the sequence above).
  39. *
  40. * Please see the [positioning overview](#/positioning) for more details.
  41. */
  42. placement: PlacementArray;
  43. /**
  44. * Specifies events that should trigger the tooltip.
  45. *
  46. * Supports a space separated list of event names.
  47. * For more details see the [triggers demo](#/components/tooltip/examples#triggers).
  48. */
  49. triggers: string;
  50. /**
  51. * A selector specifying the element the tooltip should be appended to.
  52. *
  53. * Currently only supports `"body"`.
  54. */
  55. container: string;
  56. /**
  57. * If `true`, tooltip is disabled and won't be displayed.
  58. *
  59. * @since 1.1.0
  60. */
  61. disableTooltip: boolean;
  62. /**
  63. * An optional class applied to the tooltip window element.
  64. *
  65. * @since 3.2.0
  66. */
  67. tooltipClass: string;
  68. /**
  69. * The opening delay in ms. Works only for "non-manual" opening triggers defined by the `triggers` input.
  70. *
  71. * @since 4.1.0
  72. */
  73. openDelay: number;
  74. /**
  75. * The closing delay in ms. Works only for "non-manual" opening triggers defined by the `triggers` input.
  76. *
  77. * @since 4.1.0
  78. */
  79. closeDelay: number;
  80. /**
  81. * An event emitted when the tooltip is shown. Contains no payload.
  82. */
  83. shown: EventEmitter<any>;
  84. /**
  85. * An event emitted when the popover is hidden. Contains no payload.
  86. */
  87. hidden: EventEmitter<any>;
  88. private _ngbTooltip;
  89. private _ngbTooltipWindowId;
  90. private _popupService;
  91. private _windowRef;
  92. private _unregisterListenersFn;
  93. private _zoneSubscription;
  94. constructor(_elementRef: ElementRef<HTMLElement>, _renderer: Renderer2, injector: Injector, componentFactoryResolver: ComponentFactoryResolver, viewContainerRef: ViewContainerRef, config: NgbTooltipConfig, _ngZone: NgZone, _document: any, _changeDetector: ChangeDetectorRef, applicationRef: ApplicationRef);
  95. /**
  96. * The string content or a `TemplateRef` for the content to be displayed in the tooltip.
  97. *
  98. * If the content if falsy, the tooltip won't open.
  99. */
  100. ngbTooltip: string | TemplateRef<any>;
  101. /**
  102. * Opens the tooltip.
  103. *
  104. * This is considered to be a "manual" triggering.
  105. * The `context` is an optional value to be injected into the tooltip template when it is created.
  106. */
  107. open(context?: any): void;
  108. /**
  109. * Closes the tooltip.
  110. *
  111. * This is considered to be a "manual" triggering of the tooltip.
  112. */
  113. close(): void;
  114. /**
  115. * Toggles the tooltip.
  116. *
  117. * This is considered to be a "manual" triggering of the tooltip.
  118. */
  119. toggle(): void;
  120. /**
  121. * Returns `true`, if the popover is currently shown.
  122. */
  123. isOpen(): boolean;
  124. ngOnInit(): void;
  125. ngOnChanges({ tooltipClass }: SimpleChanges): void;
  126. ngOnDestroy(): void;
  127. }