import { ElementRef, Input, Directive, NgModule } from '@angular/core';
import { FocusDirective } 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 RxFocusDirective = class RxFocusDirective {
    constructor(elementRef) {
        this.elementRef = elementRef;
        this.element = this.elementRef.nativeElement;
    }
    set focus(value) {
        this._focus = value;
        if (this.focusDirective)
            this.focusDirective.bind(this._focus);
    }
    ;
    get focus() {
        return this._focus;
    }
    ngAfterViewInit() {
        this.focusDirective = new FocusDirective(this.element);
        this.focusDirective.bind(this.focus === "" || this.focus);
    }
    ngOnDestroy() {
        this.element = undefined;
    }
};
RxFocusDirective.ctorParameters = () => [
    { type: ElementRef }
];
__decorate([
    Input()
], RxFocusDirective.prototype, "componentId", void 0);
__decorate([
    Input('rxFocus')
], RxFocusDirective.prototype, "focus", null);
RxFocusDirective = __decorate([
    Directive({
        selector: '[rxFocus]',
    })
], RxFocusDirective);
let RxFocusModule = class RxFocusModule {
};
RxFocusModule = __decorate([
    NgModule({
        imports: [CommonModule],
        exports: [RxFocusDirective],
        declarations: [RxFocusDirective]
    })
], RxFocusModule);

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

export { RxFocusDirective, RxFocusModule };
//# sourceMappingURL=rxweb-angular-focus.js.map
