import { Component, EventEmitter, Input, Output } from '@angular/core';
import {
BsDatepickerViewMode, BsNavigationDirection,
BsNavigationEvent,
DatepickerRenderOptions, CellHoverEvent, MonthsCalendarViewModel,
CalendarCellViewModel
} from '../../models/index';
@Component({
selector: 'bs-month-calendar-view',
template: `
`
})
export class BsMonthCalendarViewComponent {
@Input() calendar: MonthsCalendarViewModel;
@Output() onNavigate = new EventEmitter();
@Output() onViewMode = new EventEmitter();
@Output() onSelect = new EventEmitter();
@Output() onHover = new EventEmitter();
navigateTo(event: BsNavigationDirection): void {
const step = BsNavigationDirection.DOWN === event ? -1 : 1;
this.onNavigate.emit({step: {year: step}});
}
viewMonth(month: CalendarCellViewModel) {
this.onSelect.emit(month);
}
hoverMonth(cell: CalendarCellViewModel, isHovered: boolean) {
this.onHover.emit({cell, isHovered});
}
changeViewMode(event: BsDatepickerViewMode): void {
this.onViewMode.emit(event);
}
}