/**
 * @license
 * Copyright Endlessjs. All Rights Reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { ChangeDetectionStrategy, Component, ComponentFactoryResolver, EventEmitter, Input, Output, TemplateRef, Type, ViewChild, ViewContainerRef, } from '@angular/core';
let ElCalendarPickerRowComponent = class ElCalendarPickerRowComponent {
    constructor(cfr) {
        this.cfr = cfr;
        this.select = new EventEmitter();
    }
    ngOnChanges() {
        const factory = this.cfr.resolveComponentFactory(this.component);
        this.containerRef.clear();
        this.row.forEach((date) => {
            const component = this.containerRef.createComponent(factory);
            this.patchWithContext(component.instance, date);
            component.changeDetectorRef.detectChanges();
        });
    }
    patchWithContext(component, date) {
        component.visibleDate = this.visibleDate;
        component.selectedValue = this.selectedValue;
        component.date = date;
        component.min = this.min;
        component.max = this.max;
        component.filter = this.filter;
        component.select.subscribe(this.select.emit.bind(this.select));
    }
};
__decorate([
    Input(),
    __metadata("design:type", Array)
], ElCalendarPickerRowComponent.prototype, "row", void 0);
__decorate([
    Input(),
    __metadata("design:type", Object)
], ElCalendarPickerRowComponent.prototype, "selectedValue", void 0);
__decorate([
    Input(),
    __metadata("design:type", Object)
], ElCalendarPickerRowComponent.prototype, "visibleDate", void 0);
__decorate([
    Input(),
    __metadata("design:type", Type)
], ElCalendarPickerRowComponent.prototype, "component", void 0);
__decorate([
    Input(),
    __metadata("design:type", Object)
], ElCalendarPickerRowComponent.prototype, "min", void 0);
__decorate([
    Input(),
    __metadata("design:type", Object)
], ElCalendarPickerRowComponent.prototype, "max", void 0);
__decorate([
    Input(),
    __metadata("design:type", Function)
], ElCalendarPickerRowComponent.prototype, "filter", void 0);
__decorate([
    Output(),
    __metadata("design:type", EventEmitter)
], ElCalendarPickerRowComponent.prototype, "select", void 0);
__decorate([
    ViewChild(TemplateRef, { read: ViewContainerRef, static: true }),
    __metadata("design:type", ViewContainerRef)
], ElCalendarPickerRowComponent.prototype, "containerRef", void 0);
ElCalendarPickerRowComponent = __decorate([
    Component({
        selector: 'el-calendar-picker-row',
        template: '<ng-template></ng-template>',
        changeDetection: ChangeDetectionStrategy.OnPush,
        styles: [`
    :host {
      display: flex;
      justify-content: space-between;
    }
  `]
    }),
    __metadata("design:paramtypes", [ComponentFactoryResolver])
], ElCalendarPickerRowComponent);
export { ElCalendarPickerRowComponent };
//# sourceMappingURL=calendar-picker-row.component.js.map