UNPKG

6.42 kBTypeScriptView Raw
1import { AfterContentChecked, AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, QueryList, TemplateRef, AfterViewInit } from '@angular/core';
2import { NgbCarouselConfig } from './carousel-config';
3import { NgbSlideEventDirection } from './carousel-transition';
4/**
5 * A directive that wraps the individual carousel slide.
6 */
7export declare class NgbSlide {
8 tplRef: TemplateRef<any>;
9 /**
10 * Slide id that must be unique for the entire document.
11 *
12 * If not provided, will be generated in the `ngb-slide-xx` format.
13 */
14 id: string;
15 /**
16 * An event emitted when the slide transition is finished
17 *
18 * @since 8.0.0
19 */
20 slid: EventEmitter<NgbSingleSlideEvent>;
21 constructor(tplRef: TemplateRef<any>);
22}
23/**
24 * Carousel is a component to easily create and control slideshows.
25 *
26 * Allows to set intervals, change the way user interacts with the slides and provides a programmatic API.
27 */
28export declare class NgbCarousel implements AfterContentChecked, AfterContentInit, AfterViewInit, OnDestroy {
29 private _platformId;
30 private _ngZone;
31 private _cd;
32 private _container;
33 slides: QueryList<NgbSlide>;
34 NgbSlideEventSource: typeof NgbSlideEventSource;
35 private _destroy$;
36 private _interval$;
37 private _mouseHover$;
38 private _focused$;
39 private _pauseOnHover$;
40 private _pauseOnFocus$;
41 private _pause$;
42 private _wrap$;
43 /**
44 * A flag to enable/disable the animations.
45 *
46 * @since 8.0.0
47 */
48 animation: boolean;
49 /**
50 * The slide id that should be displayed **initially**.
51 *
52 * For subsequent interactions use methods `select()`, `next()`, etc. and the `(slide)` output.
53 */
54 activeId: string;
55 /**
56 * Time in milliseconds before the next slide is shown.
57 */
58 set interval(value: number);
59 get interval(): number;
60 /**
61 * If `true`, will 'wrap' the carousel by switching from the last slide back to the first.
62 */
63 set wrap(value: boolean);
64 get wrap(): boolean;
65 /**
66 * If `true`, allows to interact with carousel using keyboard 'arrow left' and 'arrow right'.
67 */
68 keyboard: boolean;
69 /**
70 * If `true`, will pause slide switching when mouse cursor hovers the slide.
71 *
72 * @since 2.2.0
73 */
74 set pauseOnHover(value: boolean);
75 get pauseOnHover(): boolean;
76 /**
77 * If `true`, will pause slide switching when the focus is inside the carousel.
78 */
79 set pauseOnFocus(value: boolean);
80 get pauseOnFocus(): boolean;
81 /**
82 * If `true`, 'previous' and 'next' navigation arrows will be visible on the slide.
83 *
84 * @since 2.2.0
85 */
86 showNavigationArrows: boolean;
87 /**
88 * If `true`, navigation indicators at the bottom of the slide will be visible.
89 *
90 * @since 2.2.0
91 */
92 showNavigationIndicators: boolean;
93 /**
94 * An event emitted just before the slide transition starts.
95 *
96 * See [`NgbSlideEvent`](#/components/carousel/api#NgbSlideEvent) for payload details.
97 */
98 slide: EventEmitter<NgbSlideEvent>;
99 /**
100 * An event emitted right after the slide transition is completed.
101 *
102 * See [`NgbSlideEvent`](#/components/carousel/api#NgbSlideEvent) for payload details.
103 *
104 * @since 8.0.0
105 */
106 slid: EventEmitter<NgbSlideEvent>;
107 private _transitionIds;
108 set mouseHover(value: boolean);
109 get mouseHover(): boolean;
110 set focused(value: boolean);
111 get focused(): boolean;
112 constructor(config: NgbCarouselConfig, _platformId: any, _ngZone: NgZone, _cd: ChangeDetectorRef, _container: ElementRef);
113 arrowLeft(): void;
114 arrowRight(): void;
115 ngAfterContentInit(): void;
116 ngAfterContentChecked(): void;
117 ngAfterViewInit(): void;
118 ngOnDestroy(): void;
119 /**
120 * Navigates to a slide with the specified identifier.
121 */
122 select(slideId: string, source?: NgbSlideEventSource): void;
123 /**
124 * Navigates to the previous slide.
125 */
126 prev(source?: NgbSlideEventSource): void;
127 /**
128 * Navigates to the next slide.
129 */
130 next(source?: NgbSlideEventSource): void;
131 /**
132 * Pauses cycling through the slides.
133 */
134 pause(): void;
135 /**
136 * Restarts cycling through the slides from left to right.
137 */
138 cycle(): void;
139 /**
140 * Set the focus on the carousel.
141 */
142 focus(): void;
143 private _cycleToSelected;
144 private _getSlideEventDirection;
145 private _getSlideById;
146 private _getSlideIdxById;
147 private _getNextSlide;
148 private _getPrevSlide;
149 private _getSlideElement;
150}
151/**
152 * A slide change event emitted right after the slide transition is completed.
153 */
154export interface NgbSlideEvent {
155 /**
156 * The previous slide id.
157 */
158 prev: string;
159 /**
160 * The current slide id.
161 */
162 current: string;
163 /**
164 * The slide event direction.
165 *
166 * Possible values are `'left' | 'right'`.
167 */
168 direction: NgbSlideEventDirection;
169 /**
170 * Whether the pause() method was called (and no cycle() call was done afterwards).
171 *
172 * @since 5.1.0
173 */
174 paused: boolean;
175 /**
176 * Source triggering the slide change event.
177 *
178 * Possible values are `'timer' | 'arrowLeft' | 'arrowRight' | 'indicator'`
179 *
180 * @since 5.1.0
181 */
182 source?: NgbSlideEventSource;
183}
184/**
185 * A slide change event emitted right after the slide transition is completed.
186 *
187 * @since 8.0.0
188 */
189export interface NgbSingleSlideEvent {
190 /**
191 * true if the slide is shown, false otherwise
192 */
193 isShown: boolean;
194 /**
195 * The slide event direction.
196 *
197 * Possible values are `'left' | 'right'`.
198 */
199 direction: NgbSlideEventDirection;
200 /**
201 * Source triggering the slide change event.
202 *
203 * Possible values are `'timer' | 'arrowLeft' | 'arrowRight' | 'indicator'`
204 *
205 */
206 source?: NgbSlideEventSource;
207}
208export declare enum NgbSlideEventSource {
209 TIMER = "timer",
210 ARROW_LEFT = "arrowLeft",
211 ARROW_RIGHT = "arrowRight",
212 INDICATOR = "indicator"
213}
214export declare const NGB_CAROUSEL_DIRECTIVES: (typeof NgbSlide | typeof NgbCarousel)[];