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

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

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