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);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
import { Component, Inject, Input, TemplateRef, ViewChild } from '@angular/core';
import { AbstractControl } from '@angular/forms';
import { EL_STEPPER } from './stepper-tokens';
import { convertToBoolProperty } from '../helpers';
/**
 * Component intended to be used within  the `<el-stepper>` component.
 * Container for a step
 */
let ElStepComponent = class ElStepComponent {
    constructor(stepper) {
        this._completed = false;
        this.interacted = false;
        this.stepper = stepper;
    }
    /**
     * Check that label is a TemplateRef.
     *
     * @return boolean
     * */
    get isLabelTemplate() {
        return this.label instanceof TemplateRef;
    }
    /**
     * Whether step is marked as completed.
     *
     * @type {boolean}
     */
    get completed() {
        return this._completed || this.isCompleted;
    }
    set completed(value) {
        this._completed = convertToBoolProperty(value);
    }
    get isCompleted() {
        return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;
    }
    /**
     * Mark step as selected
     * */
    select() {
        this.stepper.selected = this;
    }
    /**
     * Reset step and stepControl state
     * */
    reset() {
        this.interacted = false;
        if (this.stepControl) {
            this.stepControl.reset();
        }
    }
};
__decorate([
    ViewChild(TemplateRef, { static: true }),
    __metadata("design:type", TemplateRef)
], ElStepComponent.prototype, "content", void 0);
__decorate([
    Input(),
    __metadata("design:type", AbstractControl)
], ElStepComponent.prototype, "stepControl", void 0);
__decorate([
    Input(),
    __metadata("design:type", Object)
], ElStepComponent.prototype, "label", void 0);
__decorate([
    Input(),
    __metadata("design:type", Boolean)
], ElStepComponent.prototype, "hidden", void 0);
__decorate([
    Input(),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ElStepComponent.prototype, "completed", null);
ElStepComponent = __decorate([
    Component({
        selector: 'el-step',
        template: `
    <ng-template>
      <ng-content></ng-content>
    </ng-template>
  `
    }),
    __param(0, Inject(EL_STEPPER)),
    __metadata("design:paramtypes", [Object])
], ElStepComponent);
export { ElStepComponent };
//# sourceMappingURL=step.component.js.map