import { ChangeDetectionStrategy, Component, EventEmitter, HostBinding, Input, Output, Type, } from '@angular/core';
import { RCalendarSize } from '../../model';
import { RCalendarYearCellComponent } from './calendar-year-cell.component';
import { RDateService } from '../../services/date.service';
import { RCalendarYearModelService } from '../../services/calendar-year-model.service';
export class RCalendarYearPickerComponent {
    constructor(dateService, yearModelService) {
        this.dateService = dateService;
        this.yearModelService = yearModelService;
        this.cellComponent = RCalendarYearCellComponent;
        this.size = RCalendarSize.MEDIUM;
        this.yearChange = new EventEmitter();
    }
    set _cellComponent(cellComponent) {
        if (cellComponent) {
            this.cellComponent = cellComponent;
        }
    }
    get large() {
        return this.size === RCalendarSize.LARGE;
    }
    ngOnChanges() {
        this.years = this.yearModelService.getViewYears(this.year);
    }
    onSelect(year) {
        this.yearChange.emit(year);
    }
}
RCalendarYearPickerComponent.decorators = [
    { type: Component, args: [{
                selector: 'r-calendar-year-picker',
                template: `
    <r-calendar-picker
      [data]="years"
      [min]="min"
      [max]="max"
      [filter]="filter"
      [selectedValue]="date"
      [visibleDate]="year"
      [cellComponent]="cellComponent"
      [size]="size"
      (select)="onSelect($event)">
    </r-calendar-picker>
  `,
                changeDetection: ChangeDetectionStrategy.OnPush
            },] }
];
RCalendarYearPickerComponent.ctorParameters = () => [
    { type: RDateService },
    { type: RCalendarYearModelService }
];
RCalendarYearPickerComponent.propDecorators = {
    date: [{ type: Input }],
    min: [{ type: Input }],
    max: [{ type: Input }],
    filter: [{ type: Input }],
    _cellComponent: [{ type: Input, args: ['cellComponent',] }],
    size: [{ type: Input }],
    year: [{ type: Input }],
    yearChange: [{ type: Output }],
    large: [{ type: HostBinding, args: ['class.size-large',] }]
};
//# sourceMappingURL=calendar-year-picker.component.js.map