471 lines
59 KiB
JavaScript
471 lines
59 KiB
JavaScript
|
|
import { ChangeDetectionStrategy, Component, ContentChildren, Directive, EventEmitter, Inject, Input, Output, PLATFORM_ID, ViewEncapsulation, } from '@angular/core';
|
||
|
|
import { isPlatformBrowser, NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
|
||
|
|
import { BehaviorSubject, combineLatest, NEVER, Subject, timer, zip } from 'rxjs';
|
||
|
|
import { distinctUntilChanged, map, startWith, switchMap, take, takeUntil } from 'rxjs/operators';
|
||
|
|
import { ngbCompleteTransition, ngbRunTransition } from '../util/transition/ngbTransition';
|
||
|
|
import { ngbCarouselTransitionIn, ngbCarouselTransitionOut, NgbSlideEventDirection, } from './carousel-transition';
|
||
|
|
import * as i0 from "@angular/core";
|
||
|
|
import * as i1 from "./carousel-config";
|
||
|
|
let nextId = 0;
|
||
|
|
/**
|
||
|
|
* A directive that wraps the individual carousel slide.
|
||
|
|
*/
|
||
|
|
export class NgbSlide {
|
||
|
|
constructor(tplRef) {
|
||
|
|
this.tplRef = tplRef;
|
||
|
|
/**
|
||
|
|
* Slide id that must be unique for the entire document.
|
||
|
|
*
|
||
|
|
* If not provided, will be generated in the `ngb-slide-xx` format.
|
||
|
|
*/
|
||
|
|
this.id = `ngb-slide-${nextId++}`;
|
||
|
|
/**
|
||
|
|
* An event emitted when the slide transition is finished
|
||
|
|
*
|
||
|
|
* @since 8.0.0
|
||
|
|
*/
|
||
|
|
this.slid = new EventEmitter();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbSlide.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbSlide, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||
|
|
NgbSlide.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: NgbSlide, isStandalone: true, selector: "ng-template[ngbSlide]", inputs: { id: "id" }, outputs: { slid: "slid" }, ngImport: i0 });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbSlide, decorators: [{
|
||
|
|
type: Directive,
|
||
|
|
args: [{ selector: 'ng-template[ngbSlide]', standalone: true }]
|
||
|
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { id: [{
|
||
|
|
type: Input
|
||
|
|
}], slid: [{
|
||
|
|
type: Output
|
||
|
|
}] } });
|
||
|
|
/**
|
||
|
|
* Carousel is a component to easily create and control slideshows.
|
||
|
|
*
|
||
|
|
* Allows to set intervals, change the way user interacts with the slides and provides a programmatic API.
|
||
|
|
*/
|
||
|
|
export class NgbCarousel {
|
||
|
|
constructor(config, _platformId, _ngZone, _cd, _container) {
|
||
|
|
this._platformId = _platformId;
|
||
|
|
this._ngZone = _ngZone;
|
||
|
|
this._cd = _cd;
|
||
|
|
this._container = _container;
|
||
|
|
this.NgbSlideEventSource = NgbSlideEventSource;
|
||
|
|
this._destroy$ = new Subject();
|
||
|
|
this._interval$ = new BehaviorSubject(0);
|
||
|
|
this._mouseHover$ = new BehaviorSubject(false);
|
||
|
|
this._focused$ = new BehaviorSubject(false);
|
||
|
|
this._pauseOnHover$ = new BehaviorSubject(false);
|
||
|
|
this._pauseOnFocus$ = new BehaviorSubject(false);
|
||
|
|
this._pause$ = new BehaviorSubject(false);
|
||
|
|
this._wrap$ = new BehaviorSubject(false);
|
||
|
|
/**
|
||
|
|
* An event emitted just before the slide transition starts.
|
||
|
|
*
|
||
|
|
* See [`NgbSlideEvent`](#/components/carousel/api#NgbSlideEvent) for payload details.
|
||
|
|
*/
|
||
|
|
this.slide = new EventEmitter();
|
||
|
|
/**
|
||
|
|
* An event emitted right after the slide transition is completed.
|
||
|
|
*
|
||
|
|
* See [`NgbSlideEvent`](#/components/carousel/api#NgbSlideEvent) for payload details.
|
||
|
|
*
|
||
|
|
* @since 8.0.0
|
||
|
|
*/
|
||
|
|
this.slid = new EventEmitter();
|
||
|
|
/*
|
||
|
|
* Keep the ids of the panels currently transitionning
|
||
|
|
* in order to allow only the transition revertion
|
||
|
|
*/
|
||
|
|
this._transitionIds = null;
|
||
|
|
this.animation = config.animation;
|
||
|
|
this.interval = config.interval;
|
||
|
|
this.wrap = config.wrap;
|
||
|
|
this.keyboard = config.keyboard;
|
||
|
|
this.pauseOnHover = config.pauseOnHover;
|
||
|
|
this.pauseOnFocus = config.pauseOnFocus;
|
||
|
|
this.showNavigationArrows = config.showNavigationArrows;
|
||
|
|
this.showNavigationIndicators = config.showNavigationIndicators;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Time in milliseconds before the next slide is shown.
|
||
|
|
*/
|
||
|
|
set interval(value) {
|
||
|
|
this._interval$.next(value);
|
||
|
|
}
|
||
|
|
get interval() {
|
||
|
|
return this._interval$.value;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* If `true`, will 'wrap' the carousel by switching from the last slide back to the first.
|
||
|
|
*/
|
||
|
|
set wrap(value) {
|
||
|
|
this._wrap$.next(value);
|
||
|
|
}
|
||
|
|
get wrap() {
|
||
|
|
return this._wrap$.value;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* If `true`, will pause slide switching when mouse cursor hovers the slide.
|
||
|
|
*
|
||
|
|
* @since 2.2.0
|
||
|
|
*/
|
||
|
|
set pauseOnHover(value) {
|
||
|
|
this._pauseOnHover$.next(value);
|
||
|
|
}
|
||
|
|
get pauseOnHover() {
|
||
|
|
return this._pauseOnHover$.value;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* If `true`, will pause slide switching when the focus is inside the carousel.
|
||
|
|
*/
|
||
|
|
set pauseOnFocus(value) {
|
||
|
|
this._pauseOnFocus$.next(value);
|
||
|
|
}
|
||
|
|
get pauseOnFocus() {
|
||
|
|
return this._pauseOnFocus$.value;
|
||
|
|
}
|
||
|
|
set mouseHover(value) {
|
||
|
|
this._mouseHover$.next(value);
|
||
|
|
}
|
||
|
|
get mouseHover() {
|
||
|
|
return this._mouseHover$.value;
|
||
|
|
}
|
||
|
|
set focused(value) {
|
||
|
|
this._focused$.next(value);
|
||
|
|
}
|
||
|
|
get focused() {
|
||
|
|
return this._focused$.value;
|
||
|
|
}
|
||
|
|
arrowLeft() {
|
||
|
|
this.focus();
|
||
|
|
this.prev(NgbSlideEventSource.ARROW_LEFT);
|
||
|
|
}
|
||
|
|
arrowRight() {
|
||
|
|
this.focus();
|
||
|
|
this.next(NgbSlideEventSource.ARROW_RIGHT);
|
||
|
|
}
|
||
|
|
ngAfterContentInit() {
|
||
|
|
// setInterval() doesn't play well with SSR and protractor,
|
||
|
|
// so we should run it in the browser and outside Angular
|
||
|
|
if (isPlatformBrowser(this._platformId)) {
|
||
|
|
this._ngZone.runOutsideAngular(() => {
|
||
|
|
const hasNextSlide$ = combineLatest([
|
||
|
|
this.slide.pipe(map((slideEvent) => slideEvent.current), startWith(this.activeId)),
|
||
|
|
this._wrap$,
|
||
|
|
this.slides.changes.pipe(startWith(null)),
|
||
|
|
]).pipe(map(([currentSlideId, wrap]) => {
|
||
|
|
const slideArr = this.slides.toArray();
|
||
|
|
const currentSlideIdx = this._getSlideIdxById(currentSlideId);
|
||
|
|
return wrap ? slideArr.length > 1 : currentSlideIdx < slideArr.length - 1;
|
||
|
|
}), distinctUntilChanged());
|
||
|
|
combineLatest([
|
||
|
|
this._pause$,
|
||
|
|
this._pauseOnHover$,
|
||
|
|
this._mouseHover$,
|
||
|
|
this._pauseOnFocus$,
|
||
|
|
this._focused$,
|
||
|
|
this._interval$,
|
||
|
|
hasNextSlide$,
|
||
|
|
])
|
||
|
|
.pipe(map(([pause, pauseOnHover, mouseHover, pauseOnFocus, focused, interval, hasNextSlide]) => pause || (pauseOnHover && mouseHover) || (pauseOnFocus && focused) || !hasNextSlide ? 0 : interval), distinctUntilChanged(), switchMap((interval) => (interval > 0 ? timer(interval, interval) : NEVER)), takeUntil(this._destroy$))
|
||
|
|
.subscribe(() => this._ngZone.run(() => this.next(NgbSlideEventSource.TIMER)));
|
||
|
|
});
|
||
|
|
}
|
||
|
|
this.slides.changes.pipe(takeUntil(this._destroy$)).subscribe(() => {
|
||
|
|
this._transitionIds?.forEach((id) => ngbCompleteTransition(this._getSlideElement(id)));
|
||
|
|
this._transitionIds = null;
|
||
|
|
this._cd.markForCheck();
|
||
|
|
// The following code need to be done asynchronously, after the dom becomes stable,
|
||
|
|
// otherwise all changes will be undone.
|
||
|
|
this._ngZone.onStable.pipe(take(1)).subscribe(() => {
|
||
|
|
for (const { id } of this.slides) {
|
||
|
|
const element = this._getSlideElement(id);
|
||
|
|
if (id === this.activeId) {
|
||
|
|
element.classList.add('active');
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
element.classList.remove('active');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
}
|
||
|
|
ngAfterContentChecked() {
|
||
|
|
let activeSlide = this._getSlideById(this.activeId);
|
||
|
|
this.activeId = activeSlide ? activeSlide.id : this.slides.length ? this.slides.first.id : '';
|
||
|
|
}
|
||
|
|
ngAfterViewInit() {
|
||
|
|
// Initialize the 'active' class (not managed by the template)
|
||
|
|
if (this.activeId) {
|
||
|
|
const element = this._getSlideElement(this.activeId);
|
||
|
|
if (element) {
|
||
|
|
element.classList.add('active');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
ngOnDestroy() {
|
||
|
|
this._destroy$.next();
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Navigates to a slide with the specified identifier.
|
||
|
|
*/
|
||
|
|
select(slideId, source) {
|
||
|
|
this._cycleToSelected(slideId, this._getSlideEventDirection(this.activeId, slideId), source);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Navigates to the previous slide.
|
||
|
|
*/
|
||
|
|
prev(source) {
|
||
|
|
this._cycleToSelected(this._getPrevSlide(this.activeId), NgbSlideEventDirection.END, source);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Navigates to the next slide.
|
||
|
|
*/
|
||
|
|
next(source) {
|
||
|
|
this._cycleToSelected(this._getNextSlide(this.activeId), NgbSlideEventDirection.START, source);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Pauses cycling through the slides.
|
||
|
|
*/
|
||
|
|
pause() {
|
||
|
|
this._pause$.next(true);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Restarts cycling through the slides from start to end.
|
||
|
|
*/
|
||
|
|
cycle() {
|
||
|
|
this._pause$.next(false);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Set the focus on the carousel.
|
||
|
|
*/
|
||
|
|
focus() {
|
||
|
|
this._container.nativeElement.focus();
|
||
|
|
}
|
||
|
|
_cycleToSelected(slideIdx, direction, source) {
|
||
|
|
const transitionIds = this._transitionIds;
|
||
|
|
if (transitionIds && (transitionIds[0] !== slideIdx || transitionIds[1] !== this.activeId)) {
|
||
|
|
// Revert prevented
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
let selectedSlide = this._getSlideById(slideIdx);
|
||
|
|
if (selectedSlide && selectedSlide.id !== this.activeId) {
|
||
|
|
this._transitionIds = [this.activeId, slideIdx];
|
||
|
|
this.slide.emit({
|
||
|
|
prev: this.activeId,
|
||
|
|
current: selectedSlide.id,
|
||
|
|
direction: direction,
|
||
|
|
paused: this._pause$.value,
|
||
|
|
source,
|
||
|
|
});
|
||
|
|
const options = {
|
||
|
|
animation: this.animation,
|
||
|
|
runningTransition: 'stop',
|
||
|
|
context: { direction },
|
||
|
|
};
|
||
|
|
const transitions = [];
|
||
|
|
const activeSlide = this._getSlideById(this.activeId);
|
||
|
|
if (activeSlide) {
|
||
|
|
const activeSlideTransition = ngbRunTransition(this._ngZone, this._getSlideElement(activeSlide.id), ngbCarouselTransitionOut, options);
|
||
|
|
activeSlideTransition.subscribe(() => {
|
||
|
|
activeSlide.slid.emit({ isShown: false, direction, source });
|
||
|
|
});
|
||
|
|
transitions.push(activeSlideTransition);
|
||
|
|
}
|
||
|
|
const previousId = this.activeId;
|
||
|
|
this.activeId = selectedSlide.id;
|
||
|
|
const nextSlide = this._getSlideById(this.activeId);
|
||
|
|
const transition = ngbRunTransition(this._ngZone, this._getSlideElement(selectedSlide.id), ngbCarouselTransitionIn, options);
|
||
|
|
transition.subscribe(() => {
|
||
|
|
nextSlide?.slid.emit({ isShown: true, direction, source });
|
||
|
|
});
|
||
|
|
transitions.push(transition);
|
||
|
|
zip(...transitions)
|
||
|
|
.pipe(take(1))
|
||
|
|
.subscribe(() => {
|
||
|
|
this._transitionIds = null;
|
||
|
|
this.slid.emit({
|
||
|
|
prev: previousId,
|
||
|
|
current: selectedSlide.id,
|
||
|
|
direction: direction,
|
||
|
|
paused: this._pause$.value,
|
||
|
|
source,
|
||
|
|
});
|
||
|
|
});
|
||
|
|
}
|
||
|
|
// we get here after the interval fires or any external API call like next(), prev() or select()
|
||
|
|
this._cd.markForCheck();
|
||
|
|
}
|
||
|
|
_getSlideEventDirection(currentActiveSlideId, nextActiveSlideId) {
|
||
|
|
const currentActiveSlideIdx = this._getSlideIdxById(currentActiveSlideId);
|
||
|
|
const nextActiveSlideIdx = this._getSlideIdxById(nextActiveSlideId);
|
||
|
|
return currentActiveSlideIdx > nextActiveSlideIdx ? NgbSlideEventDirection.END : NgbSlideEventDirection.START;
|
||
|
|
}
|
||
|
|
_getSlideById(slideId) {
|
||
|
|
return this.slides.find((slide) => slide.id === slideId) || null;
|
||
|
|
}
|
||
|
|
_getSlideIdxById(slideId) {
|
||
|
|
const slide = this._getSlideById(slideId);
|
||
|
|
return slide != null ? this.slides.toArray().indexOf(slide) : -1;
|
||
|
|
}
|
||
|
|
_getNextSlide(currentSlideId) {
|
||
|
|
const slideArr = this.slides.toArray();
|
||
|
|
const currentSlideIdx = this._getSlideIdxById(currentSlideId);
|
||
|
|
const isLastSlide = currentSlideIdx === slideArr.length - 1;
|
||
|
|
return isLastSlide
|
||
|
|
? this.wrap
|
||
|
|
? slideArr[0].id
|
||
|
|
: slideArr[slideArr.length - 1].id
|
||
|
|
: slideArr[currentSlideIdx + 1].id;
|
||
|
|
}
|
||
|
|
_getPrevSlide(currentSlideId) {
|
||
|
|
const slideArr = this.slides.toArray();
|
||
|
|
const currentSlideIdx = this._getSlideIdxById(currentSlideId);
|
||
|
|
const isFirstSlide = currentSlideIdx === 0;
|
||
|
|
return isFirstSlide
|
||
|
|
? this.wrap
|
||
|
|
? slideArr[slideArr.length - 1].id
|
||
|
|
: slideArr[0].id
|
||
|
|
: slideArr[currentSlideIdx - 1].id;
|
||
|
|
}
|
||
|
|
_getSlideElement(slideId) {
|
||
|
|
return this._container.nativeElement.querySelector(`#slide-${slideId}`);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbCarousel.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbCarousel, deps: [{ token: i1.NgbCarouselConfig }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
||
|
|
NgbCarousel.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: NgbCarousel, isStandalone: true, selector: "ngb-carousel", inputs: { animation: "animation", activeId: "activeId", interval: "interval", wrap: "wrap", keyboard: "keyboard", pauseOnHover: "pauseOnHover", pauseOnFocus: "pauseOnFocus", showNavigationArrows: "showNavigationArrows", showNavigationIndicators: "showNavigationIndicators" }, outputs: { slide: "slide", slid: "slid" }, host: { attributes: { "tabIndex": "0" }, listeners: { "keydown.arrowLeft": "keyboard && arrowLeft()", "keydown.arrowRight": "keyboard && arrowRight()", "mouseenter": "mouseHover = true", "mouseleave": "mouseHover = false", "focusin": "focused = true", "focusout": "focused = false" }, properties: { "style.display": "\"block\"", "attr.aria-activedescendant": "'slide-' + activeId" }, classAttribute: "carousel slide" }, queries: [{ propertyName: "slides", predicate: NgbSlide }], exportAs: ["ngbCarousel"], ngImport: i0, template: `
|
||
|
|
<div class="carousel-indicators" [class.visually-hidden]="!showNavigationIndicators" role="tablist">
|
||
|
|
<button
|
||
|
|
type="button"
|
||
|
|
data-bs-target
|
||
|
|
*ngFor="let slide of slides"
|
||
|
|
[class.active]="slide.id === activeId"
|
||
|
|
role="tab"
|
||
|
|
[attr.aria-labelledby]="'slide-' + slide.id"
|
||
|
|
[attr.aria-controls]="'slide-' + slide.id"
|
||
|
|
[attr.aria-selected]="slide.id === activeId"
|
||
|
|
(click)="focus(); select(slide.id, NgbSlideEventSource.INDICATOR)"
|
||
|
|
></button>
|
||
|
|
</div>
|
||
|
|
<div class="carousel-inner">
|
||
|
|
<div
|
||
|
|
*ngFor="let slide of slides; index as i; count as c"
|
||
|
|
class="carousel-item"
|
||
|
|
[id]="'slide-' + slide.id"
|
||
|
|
role="tabpanel"
|
||
|
|
>
|
||
|
|
<span
|
||
|
|
class="visually-hidden"
|
||
|
|
i18n="Currently selected slide number read by screen reader@@ngb.carousel.slide-number"
|
||
|
|
>
|
||
|
|
Slide {{ i + 1 }} of {{ c }}
|
||
|
|
</span>
|
||
|
|
<ng-template [ngTemplateOutlet]="slide.tplRef"></ng-template>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<button class="carousel-control-prev" type="button" (click)="arrowLeft()" *ngIf="showNavigationArrows">
|
||
|
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||
|
|
<span class="visually-hidden" i18n="@@ngb.carousel.previous">Previous</span>
|
||
|
|
</button>
|
||
|
|
<button class="carousel-control-next" type="button" (click)="arrowRight()" *ngIf="showNavigationArrows">
|
||
|
|
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||
|
|
<span class="visually-hidden" i18n="@@ngb.carousel.next">Next</span>
|
||
|
|
</button>
|
||
|
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbCarousel, decorators: [{
|
||
|
|
type: Component,
|
||
|
|
args: [{
|
||
|
|
selector: 'ngb-carousel',
|
||
|
|
exportAs: 'ngbCarousel',
|
||
|
|
standalone: true,
|
||
|
|
imports: [NgFor, NgTemplateOutlet, NgIf],
|
||
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||
|
|
encapsulation: ViewEncapsulation.None,
|
||
|
|
host: {
|
||
|
|
class: 'carousel slide',
|
||
|
|
'[style.display]': '"block"',
|
||
|
|
tabIndex: '0',
|
||
|
|
'(keydown.arrowLeft)': 'keyboard && arrowLeft()',
|
||
|
|
'(keydown.arrowRight)': 'keyboard && arrowRight()',
|
||
|
|
'(mouseenter)': 'mouseHover = true',
|
||
|
|
'(mouseleave)': 'mouseHover = false',
|
||
|
|
'(focusin)': 'focused = true',
|
||
|
|
'(focusout)': 'focused = false',
|
||
|
|
'[attr.aria-activedescendant]': `'slide-' + activeId`,
|
||
|
|
},
|
||
|
|
template: `
|
||
|
|
<div class="carousel-indicators" [class.visually-hidden]="!showNavigationIndicators" role="tablist">
|
||
|
|
<button
|
||
|
|
type="button"
|
||
|
|
data-bs-target
|
||
|
|
*ngFor="let slide of slides"
|
||
|
|
[class.active]="slide.id === activeId"
|
||
|
|
role="tab"
|
||
|
|
[attr.aria-labelledby]="'slide-' + slide.id"
|
||
|
|
[attr.aria-controls]="'slide-' + slide.id"
|
||
|
|
[attr.aria-selected]="slide.id === activeId"
|
||
|
|
(click)="focus(); select(slide.id, NgbSlideEventSource.INDICATOR)"
|
||
|
|
></button>
|
||
|
|
</div>
|
||
|
|
<div class="carousel-inner">
|
||
|
|
<div
|
||
|
|
*ngFor="let slide of slides; index as i; count as c"
|
||
|
|
class="carousel-item"
|
||
|
|
[id]="'slide-' + slide.id"
|
||
|
|
role="tabpanel"
|
||
|
|
>
|
||
|
|
<span
|
||
|
|
class="visually-hidden"
|
||
|
|
i18n="Currently selected slide number read by screen reader@@ngb.carousel.slide-number"
|
||
|
|
>
|
||
|
|
Slide {{ i + 1 }} of {{ c }}
|
||
|
|
</span>
|
||
|
|
<ng-template [ngTemplateOutlet]="slide.tplRef"></ng-template>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<button class="carousel-control-prev" type="button" (click)="arrowLeft()" *ngIf="showNavigationArrows">
|
||
|
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||
|
|
<span class="visually-hidden" i18n="@@ngb.carousel.previous">Previous</span>
|
||
|
|
</button>
|
||
|
|
<button class="carousel-control-next" type="button" (click)="arrowRight()" *ngIf="showNavigationArrows">
|
||
|
|
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||
|
|
<span class="visually-hidden" i18n="@@ngb.carousel.next">Next</span>
|
||
|
|
</button>
|
||
|
|
`,
|
||
|
|
}]
|
||
|
|
}], ctorParameters: function () { return [{ type: i1.NgbCarouselConfig }, { type: undefined, decorators: [{
|
||
|
|
type: Inject,
|
||
|
|
args: [PLATFORM_ID]
|
||
|
|
}] }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { slides: [{
|
||
|
|
type: ContentChildren,
|
||
|
|
args: [NgbSlide]
|
||
|
|
}], animation: [{
|
||
|
|
type: Input
|
||
|
|
}], activeId: [{
|
||
|
|
type: Input
|
||
|
|
}], interval: [{
|
||
|
|
type: Input
|
||
|
|
}], wrap: [{
|
||
|
|
type: Input
|
||
|
|
}], keyboard: [{
|
||
|
|
type: Input
|
||
|
|
}], pauseOnHover: [{
|
||
|
|
type: Input
|
||
|
|
}], pauseOnFocus: [{
|
||
|
|
type: Input
|
||
|
|
}], showNavigationArrows: [{
|
||
|
|
type: Input
|
||
|
|
}], showNavigationIndicators: [{
|
||
|
|
type: Input
|
||
|
|
}], slide: [{
|
||
|
|
type: Output
|
||
|
|
}], slid: [{
|
||
|
|
type: Output
|
||
|
|
}] } });
|
||
|
|
export var NgbSlideEventSource;
|
||
|
|
(function (NgbSlideEventSource) {
|
||
|
|
NgbSlideEventSource["TIMER"] = "timer";
|
||
|
|
NgbSlideEventSource["ARROW_LEFT"] = "arrowLeft";
|
||
|
|
NgbSlideEventSource["ARROW_RIGHT"] = "arrowRight";
|
||
|
|
NgbSlideEventSource["INDICATOR"] = "indicator";
|
||
|
|
})(NgbSlideEventSource || (NgbSlideEventSource = {}));
|
||
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Fyb3VzZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2Fyb3VzZWwvY2Fyb3VzZWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUdOLHVCQUF1QixFQUV2QixTQUFTLEVBQ1QsZUFBZSxFQUNmLFNBQVMsRUFFVCxZQUFZLEVBQ1osTUFBTSxFQUNOLEtBQUssRUFHTCxNQUFNLEVBQ04sV0FBVyxFQUdYLGlCQUFpQixHQUVqQixNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsaUJBQWlCLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBSW5GLE9BQU8sRUFBRSxlQUFlLEVBQUUsYUFBYSxFQUFFLEtBQUssRUFBYyxPQUFPLEVBQUUsS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUM5RixPQUFPLEVBQUUsb0JBQW9CLEVBQUUsR0FBRyxFQUFFLFNBQVMsRUFBRSxTQUFTL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