UNPKG

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