import { Component, Input, HostBinding, ChangeDetectionStrategy } from '@angular/core';
import { RDateService } from '../../services/date.service';
import { RCalendarSize } from '../../model';
export class RCalendarWeekNumberComponent {
    constructor(dateService) {
        this.dateService = dateService;
    }
    get isLarge() {
        return this.size === RCalendarSize.LARGE;
    }
    ngOnChanges(changes) {
        if (changes.weeks) {
            this.weekNumbers = this.getWeeks();
        }
    }
    getWeeks() {
        return this.weeks.map((week) => {
            // Find last defined day as week could contain null days in case
            // boundingMonth set to false
            const lastDay = [...week].reverse().find((day) => !!day);
            // Use last day of the week to determine week number.
            // This way weeks which span between sibling years is marked first
            return this.dateService.getWeekNumber(lastDay);
        });
    }
}
RCalendarWeekNumberComponent.decorators = [
    { type: Component, args: [{
                selector: 'r-calendar-week-numbers',
                template: `
    <div class="sign-container">
      <div class="sign">{{ weekNumberSymbol }}</div>
    </div>
    <div class="week-number" *ngFor="let weekNumber of weekNumbers">{{ weekNumber }}</div>
  `,
                changeDetection: ChangeDetectionStrategy.OnPush,
                styles: [":host{display:flex;flex-direction:column}"]
            },] }
];
RCalendarWeekNumberComponent.ctorParameters = () => [
    { type: RDateService }
];
RCalendarWeekNumberComponent.propDecorators = {
    weeks: [{ type: Input }],
    size: [{ type: Input }],
    weekNumberSymbol: [{ type: Input }],
    isLarge: [{ type: HostBinding, args: ['class.size-large',] }]
};
//# sourceMappingURL=calendar-week-number.component.js.map