import { ElementRef, Input, Directive, NgModule } from '@angular/core';
import { instanceResolver } from '@rxweb/framework';
import { CommonModule } from '@angular/common';

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;
};
let RxSpinnerDirective = class RxSpinnerDirective {
    constructor(elementRef) {
        this.elementRef = elementRef;
        this.element = this.elementRef.nativeElement;
    }
    set spinner(value) {
        this._spinner = value;
        if (this.spinnerDirective)
            this.bind();
    }
    get spinner() {
        return this._spinner;
    }
    ngAfterViewInit() {
        this.spinnerDirective = instanceResolver("rxSpinner", this.element);
        this.bind();
    }
    bind() {
        this.spinnerDirective.valueChange(this._spinner);
    }
    ngOnDestroy() {
        this.spinnerDirective.destroy();
    }
};
RxSpinnerDirective.ctorParameters = () => [
    { type: ElementRef }
];
__decorate([
    Input()
], RxSpinnerDirective.prototype, "componentId", void 0);
__decorate([
    Input('rxSpinner')
], RxSpinnerDirective.prototype, "spinner", null);
RxSpinnerDirective = __decorate([
    Directive({
        selector: '[rxSpinner]',
    })
], RxSpinnerDirective);
let RxSpinnerModule = class RxSpinnerModule {
};
RxSpinnerModule = __decorate([
    NgModule({
        imports: [CommonModule],
        exports: [RxSpinnerDirective],
        declarations: [RxSpinnerDirective]
    })
], RxSpinnerModule);

/**
 * Generated bundle index. Do not edit.
 */

export { RxSpinnerDirective, RxSpinnerModule };
//# sourceMappingURL=rxweb-angular-spinner.js.map
