carousel.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import { AfterContentChecked, AfterContentInit, ChangeDetectorRef, EventEmitter, NgZone, OnDestroy, QueryList, TemplateRef } from '@angular/core';
  2. import { NgbCarouselConfig } from './carousel-config';
  3. /**
  4. * A directive that wraps the individual carousel slide.
  5. */
  6. export declare class NgbSlide {
  7. tplRef: TemplateRef<any>;
  8. /**
  9. * Slide id that must be unique for the entire document.
  10. *
  11. * If not provided, will be generated in the `ngb-slide-xx` format.
  12. */
  13. id: string;
  14. constructor(tplRef: TemplateRef<any>);
  15. }
  16. /**
  17. * Carousel is a component to easily create and control slideshows.
  18. *
  19. * Allows to set intervals, change the way user interacts with the slides and provides a programmatic API.
  20. */
  21. export declare class NgbCarousel implements AfterContentChecked, AfterContentInit, OnDestroy {
  22. private _platformId;
  23. private _ngZone;
  24. private _cd;
  25. slides: QueryList<NgbSlide>;
  26. NgbSlideEventSource: typeof NgbSlideEventSource;
  27. private _destroy$;
  28. private _interval$;
  29. private _mouseHover$;
  30. private _pauseOnHover$;
  31. private _pause$;
  32. private _wrap$;
  33. /**
  34. * The slide id that should be displayed **initially**.
  35. *
  36. * For subsequent interactions use methods `select()`, `next()`, etc. and the `(slide)` output.
  37. */
  38. activeId: string;
  39. /**
  40. * Time in milliseconds before the next slide is shown.
  41. */
  42. interval: number;
  43. /**
  44. * If `true`, will 'wrap' the carousel by switching from the last slide back to the first.
  45. */
  46. wrap: boolean;
  47. /**
  48. * If `true`, allows to interact with carousel using keyboard 'arrow left' and 'arrow right'.
  49. */
  50. keyboard: boolean;
  51. /**
  52. * If `true`, will pause slide switching when mouse cursor hovers the slide.
  53. *
  54. * @since 2.2.0
  55. */
  56. pauseOnHover: boolean;
  57. /**
  58. * If `true`, 'previous' and 'next' navigation arrows will be visible on the slide.
  59. *
  60. * @since 2.2.0
  61. */
  62. showNavigationArrows: boolean;
  63. /**
  64. * If `true`, navigation indicators at the bottom of the slide will be visible.
  65. *
  66. * @since 2.2.0
  67. */
  68. showNavigationIndicators: boolean;
  69. /**
  70. * An event emitted right after the slide transition is completed.
  71. *
  72. * See [`NgbSlideEvent`](#/components/carousel/api#NgbSlideEvent) for payload details.
  73. */
  74. slide: EventEmitter<NgbSlideEvent>;
  75. constructor(config: NgbCarouselConfig, _platformId: any, _ngZone: NgZone, _cd: ChangeDetectorRef);
  76. mouseEnter(): void;
  77. mouseLeave(): void;
  78. ngAfterContentInit(): void;
  79. ngAfterContentChecked(): void;
  80. ngOnDestroy(): void;
  81. /**
  82. * Navigates to a slide with the specified identifier.
  83. */
  84. select(slideId: string, source?: NgbSlideEventSource): void;
  85. /**
  86. * Navigates to the previous slide.
  87. */
  88. prev(source?: NgbSlideEventSource): void;
  89. /**
  90. * Navigates to the next slide.
  91. */
  92. next(source?: NgbSlideEventSource): void;
  93. /**
  94. * Pauses cycling through the slides.
  95. */
  96. pause(): void;
  97. /**
  98. * Restarts cycling through the slides from left to right.
  99. */
  100. cycle(): void;
  101. private _cycleToSelected;
  102. private _getSlideEventDirection;
  103. private _getSlideById;
  104. private _getSlideIdxById;
  105. private _getNextSlide;
  106. private _getPrevSlide;
  107. }
  108. /**
  109. * A slide change event emitted right after the slide transition is completed.
  110. */
  111. export interface NgbSlideEvent {
  112. /**
  113. * The previous slide id.
  114. */
  115. prev: string;
  116. /**
  117. * The current slide id.
  118. */
  119. current: string;
  120. /**
  121. * The slide event direction.
  122. *
  123. * Possible values are `'left' | 'right'`.
  124. */
  125. direction: NgbSlideEventDirection;
  126. /**
  127. * Whether the pause() method was called (and no cycle() call was done afterwards).
  128. *
  129. * @since 5.1.0
  130. */
  131. paused: boolean;
  132. /**
  133. * Source triggering the slide change event.
  134. *
  135. * Possible values are `'timer' | 'arrowLeft' | 'arrowRight' | 'indicator'`
  136. *
  137. * @since 5.1.0
  138. */
  139. source?: NgbSlideEventSource;
  140. }
  141. /**
  142. * Defines the carousel slide transition direction.
  143. */
  144. export declare enum NgbSlideEventDirection {
  145. LEFT,
  146. RIGHT
  147. }
  148. export declare enum NgbSlideEventSource {
  149. TIMER = "timer",
  150. ARROW_LEFT = "arrowLeft",
  151. ARROW_RIGHT = "arrowRight",
  152. INDICATOR = "indicator"
  153. }
  154. export declare const NGB_CAROUSEL_DIRECTIVES: (typeof NgbSlide | typeof NgbCarousel)[];