import { ChangeDetectionStrategy, Component, EventEmitter, HostBinding, Input, Output, Type, } from '@angular/core';
import { RCalendarMonthModelService } from '../../services/calendar-month-model.service';
import { RCalendarDayCellComponent } from './calendar-day-cell.component';
import { RCalendarSize } from '../../model';
/**
 * Provides capability pick days.
 * */
export class RCalendarDayPickerComponent {
    constructor(monthModel) {
        this.monthModel = monthModel;
        /**
         * Defines if we should render previous and next months
         * in the current month view.
         * */
        this.boundingMonths = true;
        this.cellComponent = RCalendarDayCellComponent;
        /**
         * Size of the component.
         * Can be 'medium' which is default or 'large'.
         * */
        this.size = RCalendarSize.MEDIUM;
        this._showWeekNumber = false;
        /**
         * Fires newly selected date.
         * */
        this.dateChange = new EventEmitter();
    }
    /**
     * Custom day cell component. Have to implement `RCalendarCell` interface.
     * */
    set setCellComponent(cellComponent) {
        if (cellComponent) {
            this.cellComponent = cellComponent;
        }
    }
    /**
     * Determines should we show week numbers column.
     * False by default.
     * */
    get showWeekNumber() {
        return this._showWeekNumber;
    }
    set showWeekNumber(value) {
        this._showWeekNumber = !!value;
    }
    get large() {
        return this.size === RCalendarSize.LARGE;
    }
    ngOnChanges({ visibleDate, boundingMonths }) {
        if (visibleDate || boundingMonths) {
            this.weeks = this.monthModel.createDaysGrid(this.visibleDate, this.boundingMonths);
        }
    }
    onSelect(day) {
        this.dateChange.emit(day);
    }
}
RCalendarDayPickerComponent.decorators = [
    { type: Component, args: [{
                selector: 'r-calendar-day-picker',
                template: `
    <r-calendar-week-numbers *ngIf="showWeekNumber"
                              [weeks]="weeks"
                              [size]="size"
                              [weekNumberSymbol]="weekNumberSymbol">
    </r-calendar-week-numbers>
    <div class="days-container">
      <r-calendar-days-names [size]="size"></r-calendar-days-names>
      <r-calendar-picker
          [data]="weeks"
          [visibleDate]="visibleDate"
          [selectedValue]="date"
          [cellComponent]="cellComponent"
          [min]="min"
          [max]="max"
          [filter]="filter"
          [size]="size"
          (select)="onSelect($event)">
      </r-calendar-picker>
    </div>
  `,
                changeDetection: ChangeDetectionStrategy.OnPush,
                styles: [":host{display:flex}.days-container{width:100%}"]
            },] }
];
RCalendarDayPickerComponent.ctorParameters = () => [
    { type: RCalendarMonthModelService }
];
RCalendarDayPickerComponent.propDecorators = {
    visibleDate: [{ type: Input }],
    boundingMonths: [{ type: Input }],
    min: [{ type: Input }],
    max: [{ type: Input }],
    filter: [{ type: Input }],
    setCellComponent: [{ type: Input, args: ['cellComponent',] }],
    size: [{ type: Input }],
    date: [{ type: Input }],
    showWeekNumber: [{ type: Input }],
    weekNumberSymbol: [{ type: Input }],
    dateChange: [{ type: Output }],
    large: [{ type: HostBinding, args: ['class.size-large',] }]
};
//# sourceMappingURL=calendar-day-picker.component.js.map