/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Directive, ElementRef, HostListener, Input, NgModule } from '@angular/core';
var IgxTextSelectionDirective = /** @class */ (function () {
    function IgxTextSelectionDirective(element) {
        this.element = element;
        this.selectionState = true;
    }
    Object.defineProperty(IgxTextSelectionDirective.prototype, "selected", {
        /**
         * Returns whether the input element is selectable through the directive.
         *
         * ```typescript
         * // get
         * @ViewChild('firstName',
         *  {read: IgxTextSelectionDirective})
         * public firstName: IgxTextSelectionDirective;
         *
         * public getFirstNameSelectionStatus() {
         *  return this.firstName.selected;
         * }
         * ```
         */
        get: /**
         * Returns whether the input element is selectable through the directive.
         *
         * ```typescript
         * // get
         * \@ViewChild('firstName',
         *  {read: IgxTextSelectionDirective})
         * public firstName: IgxTextSelectionDirective;
         *
         * public getFirstNameSelectionStatus() {
         *  return this.firstName.selected;
         * }
         * ```
         * @return {?}
         */
        function () {
            return this.selectionState;
        },
        /**
         *  Determines whether the input element could be selected through the directive.
         *
         *```html
         * <!--set-->
         * <input
         *   type="text"
         *   id="firstName"
         *   [igxTextSelection]="true">
         * </input>
         *
         * <input
         *   type="text"
         *   id="lastName"
         *   igxTextSelection
         *   [selected]="true">
         * </input>
         * ```
         */
        set: /**
         *  Determines whether the input element could be selected through the directive.
         *
         * ```html
         * <!--set-->
         * <input
         *   type="text"
         *   id="firstName"
         *   [igxTextSelection]="true">
         * </input>
         *
         * <input
         *   type="text"
         *   id="lastName"
         *   igxTextSelection
         *   [selected]="true">
         * </input>
         * ```
         * @param {?} val
         * @return {?}
         */
        function (val) {
            this.selectionState = val;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxTextSelectionDirective.prototype, "nativeElement", {
        /**
         * Returns the nativeElement of the element where the directive was applied.
         *
         * ```html
         * <input
         *   type="text"
        *    id="firstName"
         *   igxTextSelection>
         * </input>
         * ```
         *
         * ```typescript
         * @ViewChild('firstName',
         *  {read: IgxTextSelectionDirective})
         * public inputElement: IgxTextSelectionDirective;
         *
         * public getNativeElement() {
         *  return this.inputElement.nativeElement;
         * }
         * ```
         */
        get: /**
         * Returns the nativeElement of the element where the directive was applied.
         *
         * ```html
         * <input
         *   type="text"
         *    id="firstName"
         *   igxTextSelection>
         * </input>
         * ```
         *
         * ```typescript
         * \@ViewChild('firstName',
         *  {read: IgxTextSelectionDirective})
         * public inputElement: IgxTextSelectionDirective;
         *
         * public getNativeElement() {
         *  return this.inputElement.nativeElement;
         * }
         * ```
         * @return {?}
         */
        function () {
            return this.element.nativeElement;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @hidden
     */
    /**
     * @hidden
     * @return {?}
     */
    IgxTextSelectionDirective.prototype.onFocus = /**
     * @hidden
     * @return {?}
     */
    function () {
        this.trigger();
    };
    /**
     * Triggers the selection of the element if it is marked as selectable.
     *
     * ```html
     * <input
     *   type="text"
     *   id="firstName"
     *   igxTextSelection>
     * </input>
     * ```
     *
     * ```typescript
     * @ViewChild('firstName',
     *  {read: IgxTextSelectionDirective})
     * public inputElement: IgxTextSelectionDirective;
     *
     * public triggerElementSelection() {
     *  this.inputElement.trigger();
     * }
     * ```
     */
    /**
     * Triggers the selection of the element if it is marked as selectable.
     *
     * ```html
     * <input
     *   type="text"
     *   id="firstName"
     *   igxTextSelection>
     * </input>
     * ```
     *
     * ```typescript
     * \@ViewChild('firstName',
     *  {read: IgxTextSelectionDirective})
     * public inputElement: IgxTextSelectionDirective;
     *
     * public triggerElementSelection() {
     *  this.inputElement.trigger();
     * }
     * ```
     * @return {?}
     */
    IgxTextSelectionDirective.prototype.trigger = /**
     * Triggers the selection of the element if it is marked as selectable.
     *
     * ```html
     * <input
     *   type="text"
     *   id="firstName"
     *   igxTextSelection>
     * </input>
     * ```
     *
     * ```typescript
     * \@ViewChild('firstName',
     *  {read: IgxTextSelectionDirective})
     * public inputElement: IgxTextSelectionDirective;
     *
     * public triggerElementSelection() {
     *  this.inputElement.trigger();
     * }
     * ```
     * @return {?}
     */
    function () {
        var _this = this;
        if (this.selected && this.nativeElement.value.length) {
            requestAnimationFrame(function () { return _this.nativeElement.setSelectionRange(0, _this.nativeElement.value.length); });
        }
    };
    IgxTextSelectionDirective.decorators = [
        { type: Directive, args: [{
                    exportAs: 'igxTextSelection',
                    selector: '[igxTextSelection]'
                },] }
    ];
    /** @nocollapse */
    IgxTextSelectionDirective.ctorParameters = function () { return [
        { type: ElementRef }
    ]; };
    IgxTextSelectionDirective.propDecorators = {
        selected: [{ type: Input, args: ['igxTextSelection',] }],
        onFocus: [{ type: HostListener, args: ['focus',] }]
    };
    return IgxTextSelectionDirective;
}());
export { IgxTextSelectionDirective };
if (false) {
    /**
     * @type {?}
     * @private
     */
    IgxTextSelectionDirective.prototype.selectionState;
    /**
     * @type {?}
     * @private
     */
    IgxTextSelectionDirective.prototype.element;
}
/**
 * @hidden
 */
var IgxTextSelectionModule = /** @class */ (function () {
    function IgxTextSelectionModule() {
    }
    IgxTextSelectionModule.decorators = [
        { type: NgModule, args: [{
                    declarations: [IgxTextSelectionDirective],
                    exports: [IgxTextSelectionDirective]
                },] }
    ];
    return IgxTextSelectionModule;
}());
export { IgxTextSelectionModule };
//# sourceMappingURL=data:application/json;base64, 