/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
import { Directive, ElementRef, HostListener, Input, NgModule } from '@angular/core';
export class IgxTextSelectionDirective {
    /**
     * @param {?} element
     */
    constructor(element) {
        this.element = element;
        this.selectionState = true;
    }
    /**
     * @return {?}
     */
    get selected() {
        return this.selectionState;
    }
    /**
     * @param {?} val
     * @return {?}
     */
    set selected(val) {
        this.selectionState = val;
    }
    /**
     * @return {?}
     */
    get nativeElement() {
        return this.element.nativeElement;
    }
    /**
     * @return {?}
     */
    onFocus() {
        this.trigger();
    }
    /**
     * @return {?}
     */
    trigger() {
        if (this.selected && this.nativeElement.value.length) {
            requestAnimationFrame(() => this.nativeElement.setSelectionRange(0, this.nativeElement.value.length));
        }
    }
}
IgxTextSelectionDirective.decorators = [
    { type: Directive, args: [{
                exportAs: 'igxTextSelection',
                selector: '[igxTextSelection]'
            },] },
];
/** @nocollapse */
IgxTextSelectionDirective.ctorParameters = () => [
    { type: ElementRef, },
];
IgxTextSelectionDirective.propDecorators = {
    "selected": [{ type: Input, args: ['igxTextSelection',] },],
    "onFocus": [{ type: HostListener, args: ['focus',] },],
};
function IgxTextSelectionDirective_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    IgxTextSelectionDirective.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    IgxTextSelectionDirective.ctorParameters;
    /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
    IgxTextSelectionDirective.propDecorators;
    /** @type {?} */
    IgxTextSelectionDirective.prototype.selectionState;
    /** @type {?} */
    IgxTextSelectionDirective.prototype.element;
}
export class IgxTextSelectionModule {
}
IgxTextSelectionModule.decorators = [
    { type: NgModule, args: [{
                declarations: [IgxTextSelectionDirective],
                exports: [IgxTextSelectionDirective]
            },] },
];
function IgxTextSelectionModule_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    IgxTextSelectionModule.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    IgxTextSelectionModule.ctorParameters;
}

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGV4dC1zZWxlY3Rpb24uZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vaWduaXRldWktYW5ndWxhci8iLCJzb3VyY2VzIjpbImxpYi9kaXJlY3RpdmVzL3RleHQtc2VsZWN0aW9uL3RleHQtc2VsZWN0aW9uLmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxVQUFVLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFNckYsTUFBTTs7OztJQXNCRixZQUFvQixPQUFtQjtRQUFuQixZQUFPLEdBQVAsT0FBTyxDQUFZOzhCQXBCZCxJQUFJO0tBb0JlOzs7O1FBakJ4QyxRQUFRO1FBQ1IsTUFBTSxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUM7Ozs7OztJQUcvQixJQUFJLFFBQVEsQ0FBQyxHQUFZO1FBQ3JCLElBQUksQ0FBQyxjQUFjLEdBQUcsR0FBRyxDQUFDO0tBQzdCOzs7O0lBRUQsSUFBSSxhQUFhO1FBQ2IsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDO0tBQ3JDOzs7O0lBR0QsT0FBTztRQUNILElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQzs7Ozs7SUFLbkIsT0FBTztRQUNILEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxRQUFRLElBQUksSUFBSSxDQUFDLGFBQWEsQ0F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