ngx-bootstrap
Version:
Angular Bootstrap
63 lines (57 loc) • 2.26 kB
JavaScript
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { BsNavigationDirection } from '../../models';
export class BsDatepickerNavigationViewComponent {
constructor() {
this.onNavigate = new EventEmitter();
this.onViewMode = new EventEmitter();
}
navTo(down) {
this.onNavigate.emit(down ? BsNavigationDirection.DOWN : BsNavigationDirection.UP);
}
view(viewMode) {
this.onViewMode.emit(viewMode);
}
}
BsDatepickerNavigationViewComponent.decorators = [
{ type: Component, args: [{
selector: 'bs-datepicker-navigation-view',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<button class="previous"
[disabled]="calendar.disableLeftArrow"
[style.visibility]="calendar.hideLeftArrow ? 'hidden' : 'visible'"
type="button"
(click)="navTo(true)">
<span>‹</span>
</button>
<ng-container *ngIf="calendar && calendar.monthTitle">
​ <!-- zero-width space needed for correct alignment
with preserveWhitespaces: false in Angular -->
<button class="current"
type="button"
(click)="view('month')"
><span>{{ calendar.monthTitle }}</span>
</button>
</ng-container>
​ <!-- zero-width space needed for correct alignment
with preserveWhitespaces: false in Angular -->
<button class="current" (click)="view('year')" type="button">
<span>{{ calendar.yearTitle }}</span>
</button>
​ <!-- zero-width space needed for correct alignment
with preserveWhitespaces: false in Angular -->
<button class="next"
[disabled]="calendar.disableRightArrow"
[style.visibility]="calendar.hideRightArrow ? 'hidden' : 'visible'"
type="button"
(click)="navTo(false)"><span>›</span>
</button>
`
},] }
];
BsDatepickerNavigationViewComponent.propDecorators = {
calendar: [{ type: Input }],
onNavigate: [{ type: Output }],
onViewMode: [{ type: Output }]
};
//# sourceMappingURL=bs-datepicker-navigation-view.component.js.map