import { Component, Inject, Input, TemplateRef, ViewChild } from '@angular/core';
import { R_STEPPER } from './stepper-tokens';
export class RStepComponent {
    constructor(stepper) {
        this._hidden = false;
        this._completed = false;
        this.interacted = false;
        this.stepper = stepper;
    }
    /**
     * Whether step will be displayed in wizard
     *
     * @type {boolean}
     */
    get hidden() {
        return this._hidden;
    }
    set hidden(value) {
        this._hidden = !!value;
    }
    /**
     * 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 = !!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();
        }
    }
}
RStepComponent.decorators = [
    { type: Component, args: [{
                selector: 'r-step',
                template: `
    <ng-template>
      <ng-content></ng-content>
    </ng-template>
  `
            },] }
];
RStepComponent.ctorParameters = () => [
    { type: undefined, decorators: [{ type: Inject, args: [R_STEPPER,] }] }
];
RStepComponent.propDecorators = {
    content: [{ type: ViewChild, args: [TemplateRef, { static: true },] }],
    stepControl: [{ type: Input }],
    label: [{ type: Input }],
    hidden: [{ type: Input }],
    completed: [{ type: Input }]
};
//# sourceMappingURL=step.component.js.map