popover.d.ts 4.7 KB

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