/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, ElementRef, forwardRef, HostBinding, HostListener, Inject, Input } from '@angular/core';
import { IgxDropDownComponent } from './drop-down.component';
/**
 * The `<igx-drop-down-item> is a container intended for row items in
 * a `<igx-drop-down>` container.
 */
var IgxDropDownItemBase = /** @class */ (function () {
    function IgxDropDownItemBase(dropDown, elementRef) {
        this.dropDown = dropDown;
        this.elementRef = elementRef;
        /**
         * @hidden
         */
        this._isFocused = false;
        /**
         * Sets/gets if the given item is header
         * ```typescript
         *  // get
         *  let mySelectedItem = this.dropdown.selectedItem;
         *  let isMyItemHeader = mySelectedItem.isHeader;
         * ```
         *
         * ```html
         *  <!--set-->
         *  <igx-dropdown-item *ngFor="let item of items">
         *      <div *ngIf="items.indexOf(item) === 5; then item.isHeader = true">
         *          {{item.field}}
         *           </div>
         *  </igx-drop-down-item>
         * ```
         */
        this.isHeader = false;
        /**
         * Sets/gets if the given item is disabled
         *
         * ```typescript
         *  // get
         *  let mySelectedItem = this.dropdown.selectedItem;
         *  let myItemIsDisabled = mySelectedItem.disabled;
         * ```
         *
         * ```html
         *  <igx-drop-down-item *ngFor="let item of items" disabled={{!item.disabled}}>
         *      <div>
         *          {{item.field}}
         *      </div>
         *  </igx-drop-down-item>
         * ```
         */
        this.disabled = false;
    }
    Object.defineProperty(IgxDropDownItemBase.prototype, "itemID", {
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxDropDownItemBase.prototype, "itemStyle", {
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return !this.isHeader;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxDropDownItemBase.prototype, "isSelected", {
        /**
         * Gets if the item is the currently selected one in the dropdown
         *
         * ```typescript
         *  let mySelectedItem = this.dropdown.selectedItem;
         *  let isMyItemSelected = mySelectedItem.isSelected; // true
         * ```
         */
        get: /**
         * Gets if the item is the currently selected one in the dropdown
         *
         * ```typescript
         *  let mySelectedItem = this.dropdown.selectedItem;
         *  let isMyItemSelected = mySelectedItem.isSelected; // true
         * ```
         * @return {?}
         */
        function () {
            return this.dropDown.selectedItem === this;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxDropDownItemBase.prototype, "selectedStyle", {
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.isSelected;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxDropDownItemBase.prototype, "isFocused", {
        get: /**
         * Sets/gets if the given item is focused
         * ```typescript
         *  let mySelectedItem = this.dropdown.selectedItem;
         *  let isMyItemFocused = mySelectedItem.isFocused;
         * ```
         * @return {?}
         */
        function () {
            return this._isFocused;
        },
        /**
         * ```html
         *  <igx-drop-down-item *ngFor="let item of items" isFocused={{!item.isFocused}}>
         *      <div>
         *          {{item.field}}
         *      </div>
         *  </igx-drop-down-item>
         * ```
         */
        set: /**
         * ```html
         *  <igx-drop-down-item *ngFor="let item of items" isFocused={{!item.isFocused}}>
         *      <div>
         *          {{item.field}}
         *      </div>
         *  </igx-drop-down-item>
         * ```
         * @param {?} value
         * @return {?}
         */
        function (value) {
            if (this.disabled || this.isHeader) {
                this._isFocused = false;
                return;
            }
            if (value && !this.dropDown.collapsed) {
                this.elementRef.nativeElement.focus({ preventScroll: true });
            }
            this._isFocused = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxDropDownItemBase.prototype, "setTabIndex", {
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            var /** @type {?} */ shouldSetTabIndex = this.dropDown.allowItemsFocus && !(this.disabled || this.isHeader);
            if (shouldSetTabIndex) {
                return 0;
            }
            else {
                return null;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxDropDownItemBase.prototype, "index", {
        get: /**
         * Gets item index
         * @hidden
         * @return {?}
         */
        function () {
            return this.dropDown.items.indexOf(this);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxDropDownItemBase.prototype, "elementHeight", {
        get: /**
         * Gets item element height
         * @hidden
         * @return {?}
         */
        function () {
            return this.elementRef.nativeElement.clientHeight;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxDropDownItemBase.prototype, "element", {
        get: /**
         * Get item html element
         * @hidden
         * @return {?}
         */
        function () {
            return this.elementRef;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxDropDownItemBase.prototype.clicked = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        if (this.disabled || this.isHeader) {
            var /** @type {?} */ focusedItem = this.dropDown.items.find(function (item) { return item.isFocused; });
            focusedItem.elementRef.nativeElement.focus({ preventScroll: true });
            return;
        }
        this.dropDown.navigateItem(this.index);
        this.dropDown.selectItem(this, event);
    };
    /**
     * @hidden
     */
    /**
     * @hidden
     * @return {?}
     */
    IgxDropDownItemBase.prototype.markItemSelected = /**
     * @hidden
     * @return {?}
     */
    function () {
        this.dropDown.setSelectedItem(this.index);
        this.dropDown.close();
    };
    IgxDropDownItemBase.propDecorators = {
        "itemStyle": [{ type: HostBinding, args: ['class.igx-drop-down__item',] },],
        "selectedStyle": [{ type: HostBinding, args: ['attr.aria-selected',] }, { type: HostBinding, args: ['class.igx-drop-down__item--selected',] },],
        "isFocused": [{ type: HostBinding, args: ['class.igx-drop-down__item--focused',] },],
        "isHeader": [{ type: Input }, { type: HostBinding, args: ['class.igx-drop-down__header',] },],
        "disabled": [{ type: Input }, { type: HostBinding, args: ['class.igx-drop-down__item--disabled',] },],
        "setTabIndex": [{ type: HostBinding, args: ['attr.tabindex',] },],
        "clicked": [{ type: HostListener, args: ['click', ['$event'],] },],
    };
    return IgxDropDownItemBase;
}());
export { IgxDropDownItemBase };
function IgxDropDownItemBase_tsickle_Closure_declarations() {
    /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
    IgxDropDownItemBase.propDecorators;
    /**
     * @hidden
     * @type {?}
     */
    IgxDropDownItemBase.prototype._isFocused;
    /**
     * @hidden
     * @type {?}
     */
    IgxDropDownItemBase.prototype.itemData;
    /**
     * Sets/gets if the given item is header
     * ```typescript
     *  // get
     *  let mySelectedItem = this.dropdown.selectedItem;
     *  let isMyItemHeader = mySelectedItem.isHeader;
     * ```
     *
     * ```html
     *  <!--set-->
     *  <igx-dropdown-item *ngFor="let item of items">
     *      <div *ngIf="items.indexOf(item) === 5; then item.isHeader = true">
     *          {{item.field}}
     *           </div>
     *  </igx-drop-down-item>
     * ```
     * @type {?}
     */
    IgxDropDownItemBase.prototype.isHeader;
    /**
     * Sets/gets if the given item is disabled
     *
     * ```typescript
     *  // get
     *  let mySelectedItem = this.dropdown.selectedItem;
     *  let myItemIsDisabled = mySelectedItem.disabled;
     * ```
     *
     * ```html
     *  <igx-drop-down-item *ngFor="let item of items" disabled={{!item.disabled}}>
     *      <div>
     *          {{item.field}}
     *      </div>
     *  </igx-drop-down-item>
     * ```
     * @type {?}
     */
    IgxDropDownItemBase.prototype.disabled;
    /** @type {?} */
    IgxDropDownItemBase.prototype.dropDown;
    /** @type {?} */
    IgxDropDownItemBase.prototype.elementRef;
}
var IgxDropDownItemComponent = /** @class */ (function (_super) {
    tslib_1.__extends(IgxDropDownItemComponent, _super);
    function IgxDropDownItemComponent(dropDown, elementRef) {
        var _this = _super.call(this, dropDown, elementRef) || this;
        _this.dropDown = dropDown;
        _this.elementRef = elementRef;
        /**
         * @hidden
         */
        _this._isSelected = false;
        return _this;
    }
    Object.defineProperty(IgxDropDownItemComponent.prototype, "isSelected", {
        /**
         * Sets/Gets if the item is the currently selected one in the dropdown
         *
         * ```typescript
         *  let mySelectedItem = this.dropdown.selectedItem;
         *  let isMyItemSelected = mySelectedItem.isSelected; // true
         * ```
         */
        get: /**
         * Sets/Gets if the item is the currently selected one in the dropdown
         *
         * ```typescript
         *  let mySelectedItem = this.dropdown.selectedItem;
         *  let isMyItemSelected = mySelectedItem.isSelected; // true
         * ```
         * @return {?}
         */
        function () {
            return this._isSelected;
        },
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            if (this.isHeader) {
                return;
            }
            this._isSelected = value;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @return {?}
     */
    IgxDropDownItemComponent.prototype.ngDoCheck = /**
     * @return {?}
     */
    function () {
        if (this.isSelected) {
            var /** @type {?} */ dropDownSelectedItem = this.dropDown.selectedItem;
            if (!dropDownSelectedItem || this !== dropDownSelectedItem) {
                this.dropDown.selectItem(this);
            }
        }
    };
    IgxDropDownItemComponent.decorators = [
        { type: Component, args: [{
                    selector: 'igx-drop-down-item',
                    template: "<ng-content></ng-content>"
                },] },
    ];
    /** @nocollapse */
    IgxDropDownItemComponent.ctorParameters = function () { return [
        { type: IgxDropDownComponent, decorators: [{ type: Inject, args: [forwardRef(function () { return IgxDropDownComponent; }),] },] },
        { type: ElementRef, },
    ]; };
    IgxDropDownItemComponent.propDecorators = {
        "isSelected": [{ type: Input },],
    };
    return IgxDropDownItemComponent;
}(IgxDropDownItemBase));
export { IgxDropDownItemComponent };
function IgxDropDownItemComponent_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    IgxDropDownItemComponent.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    IgxDropDownItemComponent.ctorParameters;
    /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
    IgxDropDownItemComponent.propDecorators;
    /**
     * @hidden
     * @type {?}
     */
    IgxDropDownItemComponent.prototype._isSelected;
    /** @type {?} */
    IgxDropDownItemComponent.prototype.dropDown;
    /** @type {?} */
    IgxDropDownItemComponent.prototype.elementRef;
}

//# sourceMappingURL=data:application/json;base64, 