/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { ChangeDetectionStrategy, Component, HostBinding, forwardRef, ElementRef, ViewChildren, QueryList, ViewChild, TemplateRef } from '@angular/core';
import { IgxRowComponent } from '../row.component';
import { IgxHierarchicalGridCellComponent } from './hierarchical-cell.component';
var IgxHierarchicalRowComponent = /** @class */ (function (_super) {
    tslib_1.__extends(IgxHierarchicalRowComponent, _super);
    function IgxHierarchicalRowComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        /**
         * @hidden
         */
        _this.tabindex = 0;
        /**
         * @hidden
         * \@internal
         */
        _this.select = function () {
            _this.grid.selectRows([_this.rowID]);
        };
        /**
         * @hidden
         * \@internal
         */
        _this.deselect = function () {
            _this.grid.deselectRows([_this.rowID]);
        };
        return _this;
    }
    Object.defineProperty(IgxHierarchicalRowComponent.prototype, "viewIndex", {
        get: /**
         * @return {?}
         */
        function () {
            return this.index + this.grid.page * this.grid.perPage;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxHierarchicalRowComponent.prototype, "expanded", {
        /**
     * Returns whether the row is expanded.
     * ```typescript
     * const RowExpanded = this.grid1.rowList.first.expanded;
     * ```
     */
        get: /**
         * Returns whether the row is expanded.
         * ```typescript
         * const RowExpanded = this.grid1.rowList.first.expanded;
         * ```
         * @return {?}
         */
        function () {
            return this.grid.isExpanded(this.rowData);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxHierarchicalRowComponent.prototype, "hasChildren", {
        get: /**
         * @return {?}
         */
        function () {
            return !!this.grid.childLayoutKeys.length;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxHierarchicalRowComponent.prototype, "highlighted", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.grid && this.grid.highlightedRowID === this.rowID;
        },
        enumerable: true,
        configurable: true
    });
    /**
    * @hidden
    */
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxHierarchicalRowComponent.prototype.expanderClick = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        event.stopPropagation();
        this.toggle();
    };
    /**
     * Toggles the hierarchical row.
     * ```typescript
     * this.grid1.rowList.first.toggle()
     * ```
     */
    /**
     * Toggles the hierarchical row.
     * ```typescript
     * this.grid1.rowList.first.toggle()
     * ```
     * @return {?}
     */
    IgxHierarchicalRowComponent.prototype.toggle = /**
     * Toggles the hierarchical row.
     * ```typescript
     * this.grid1.rowList.first.toggle()
     * ```
     * @return {?}
     */
    function () {
        var _this = this;
        if (this.added) {
            return;
        }
        /** @type {?} */
        var grid = this.gridAPI.grid;
        this.endEdit(grid.rootGrid);
        /** @type {?} */
        var state = this.gridAPI.grid.hierarchicalState;
        if (!this.expanded) {
            state.push({ rowID: this.rowID });
            grid.hierarchicalState = tslib_1.__spread(state);
        }
        else {
            grid.hierarchicalState = state.filter(function (v) {
                return v.rowID !== _this.rowID;
            });
        }
        grid.cdr.detectChanges();
    };
    Object.defineProperty(IgxHierarchicalRowComponent.prototype, "iconTemplate", {
        /**
        * @hidden
        */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            /** @type {?} */
            var expandable = true;
            if (this.grid.hasChildrenKey) {
                expandable = this.rowData[this.grid.hasChildrenKey];
            }
            if (!expandable) {
                return this.defaultEmptyTemplate;
            }
            if (this.expanded) {
                return this.grid.rowExpandedIndicatorTemplate || this.defaultExpandedTemplate;
            }
            else {
                return this.grid.rowCollapsedIndicatorTemplate || this.defaultCollapsedTemplate;
            }
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @private
     * @param {?} grid
     * @return {?}
     */
    IgxHierarchicalRowComponent.prototype.endEdit = /**
     * @private
     * @param {?} grid
     * @return {?}
     */
    function (grid) {
        if (grid.crudService.inEditMode) {
            grid.endEdit();
        }
        grid.hgridAPI.getChildGrids(true).forEach(function (g) {
            if (g.crudService.inEditMode) {
                g.endEdit();
            }
        });
    };
    IgxHierarchicalRowComponent.decorators = [
        { type: Component, args: [{
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    preserveWhitespaces: false,
                    selector: 'igx-hierarchical-grid-row',
                    template: "<div (click)=\"expanderClick($event)\" class=\"igx-grid__hierarchical-expander\" [tabIndex]=\"tabindex\" *ngIf=\"hasChildren\" #expander>\n        <ng-container *ngTemplateOutlet=\"iconTemplate; context: { $implicit: this }\">\n        </ng-container>\n</div>\n<ng-template #defaultExpandedTemplate>\n        <igx-icon [isActive]='!added' fontSet=\"material\">expand_more</igx-icon>\n    </ng-template>\n\n<ng-template #defaultCollapsedTemplate>\n        <igx-icon [isActive]='!added' fontSet=\"material\">chevron_right</igx-icon>\n </ng-template>\n\n <ng-template #defaultEmptyTemplate>\n    <igx-icon fontSet=\"material\"></igx-icon>\n</ng-template>\n\n<ng-container *ngIf=\"rowDraggable\">\n    <div [class]=\"resolveDragIndicatorClasses\" [igxRowDrag]=\"this\" (click)=\"$event.stopPropagation()\" [ghostTemplate]=\"this.grid.getDragGhostCustomTemplate()\">\n            <ng-container *ngTemplateOutlet=\"this.grid.dragIndicatorIconTemplate ? this.grid.dragIndicatorIconTemplate : this.grid.dragIndicatorIconBase\"></ng-container>\n    </div>\n</ng-container>\n<ng-container *ngIf=\"showRowSelectors\">\n    <div class=\"igx-grid__cbx-selection\" (click)=\"onRowSelectorClick($event)\">\n        <ng-template *ngTemplateOutlet=\"\n            this.grid.rowSelectorTemplate ? this.grid.rowSelectorTemplate : rowSelectorBaseTemplate;\n            context: { $implicit: {\n                            index: viewIndex,\n                            rowID: rowID,\n                            selected: selected,\n                            select: select,\n                            deselect: deselect }}\">\n        </ng-template>\n    </div>\n</ng-container>\n\n<ng-container *ngIf=\"pinnedColumns.length > 0\">\n    <igx-hierarchical-grid-cell *ngFor=\"let col of pinnedColumns | igxNotGrouped\"\n        class=\"igx-grid__td igx-grid__td--fw igx-grid__td--pinned\"\n        [class.igx-grid__td--number]=\"col.dataType === 'number'\"\n        [ngClass]=\"col.cellClasses | igxCellStyleClasses:rowData[col.field]:rowData:col.field:viewIndex\"\n        [ngStyle]=\"col.cellStyles | igxCellStyles:rowData[col.field]:rowData:col.field:viewIndex\"\n        [editMode]=\"col.editable && crudService.isInEditMode(index, col.index)\"\n        [column]=\"col\"\n        [formatter]=\"col.formatter\"\n        [row]=\"this\"\n        [lastPinned]=\"col.isLastPinned\"\n        [style.min-height.px]=\"grid.rowHeight || 32\"\n        [rowData]=\"rowData\"\n        [style.min-width.px]=\"col.width\"\n        [style.flex-basis.px]=\"col.width\"\n        [width]=\"col.getCellWidth()\"\n        [visibleColumnIndex]=\"col.visibleIndex\"\n        [value]=\"rowData[col.field]\"\n        [cellTemplate]=\"col.bodyTemplate\"\n        [cellSelectionMode]=\"grid.cellSelection\">\n    </igx-hierarchical-grid-cell>\n</ng-container>\n\n<ng-template igxGridFor let-col [igxGridForOf]=\"unpinnedColumns | igxNotGrouped\" [igxForScrollContainer]=\"grid.parentVirtDir\" let-colIndex=\"index\" [igxForSizePropName]='\"calcPixelWidth\"' [igxForScrollOrientation]=\"'horizontal'\" [igxForContainerSize]='grid.unpinnedWidth' [igxForTrackBy]='grid.trackColumnChanges' #igxDirRef>\n    <igx-hierarchical-grid-cell\n        class=\"igx-grid__td igx-grid__td--fw\"\n        [class.igx-grid__td--number]=\"col.dataType === 'number'\"\n        [ngClass]=\"col.cellClasses | igxCellStyleClasses:rowData[col.field]:rowData:col.field:viewIndex\"\n        [ngStyle]=\"col.cellStyles | igxCellStyles:rowData[col.field]:rowData:col.field:viewIndex\"\n        [editMode]=\"col.editable && crudService.isInEditMode(index, col.index)\"\n        [column]=\"col\"\n        [formatter]=\"col.formatter\"\n        [row]=\"this\"\n        [style.min-height.px]=\"grid.rowHeight || 32\"\n        [rowData]=\"rowData\"\n        [style.min-width.px]=\"col.width\"\n        [style.flex-basis.px]=\"col.width\"\n        [width]=\"col.getCellWidth()\"\n        [visibleColumnIndex]=\"col.visibleIndex\"\n        [value]=\"rowData[col.field]\"\n        [cellTemplate]=\"col.bodyTemplate\"\n        [cellSelectionMode]=\"grid.cellSelection\">\n    </igx-hierarchical-grid-cell>\n</ng-template>\n\n<ng-template #rowSelectorBaseTemplate>\n    <div class=\"igx-grid__cbx-padding\">\n        <igx-checkbox\n            [readonly]=\"true\"\n            [checked]=\"selected\"\n            disableRipple=\"true\"\n            [disabled]=\"deleted\"\n            [disableTransitions]=\"grid.disableTransitions\"\n            [aria-label]=\"rowCheckboxAriaLabel\">\n        </igx-checkbox>\n    </div>\n</ng-template>\n",
                    providers: [{ provide: IgxRowComponent, useExisting: forwardRef(function () { return IgxHierarchicalRowComponent; }) }]
                }] }
    ];
    IgxHierarchicalRowComponent.propDecorators = {
        cells: [{ type: ViewChildren, args: [forwardRef(function () { return IgxHierarchicalGridCellComponent; }), { read: IgxHierarchicalGridCellComponent },] }],
        expander: [{ type: ViewChild, args: ['expander', { read: ElementRef, static: false },] }],
        defaultExpandedTemplate: [{ type: ViewChild, args: ['defaultExpandedTemplate', { read: TemplateRef, static: true },] }],
        defaultEmptyTemplate: [{ type: ViewChild, args: ['defaultEmptyTemplate', { read: TemplateRef, static: true },] }],
        defaultCollapsedTemplate: [{ type: ViewChild, args: ['defaultCollapsedTemplate', { read: TemplateRef, static: true },] }],
        tabindex: [{ type: HostBinding, args: ['attr.tabindex',] }],
        expanded: [{ type: HostBinding, args: ['class.igx-grid__tr--expanded',] }],
        highlighted: [{ type: HostBinding, args: ['class.igx-grid__tr--highlighted',] }]
    };
    return IgxHierarchicalRowComponent;
}(IgxRowComponent));
export { IgxHierarchicalRowComponent };
if (false) {
    /**
     * The rendered cells in the row component.
     *
     * ```typescript
     * // get the cells of the third selected row
     * let selectedRowCells = this.grid.selectedRows[2].cells;
     * ```
     * @type {?}
     */
    IgxHierarchicalRowComponent.prototype.cells;
    /** @type {?} */
    IgxHierarchicalRowComponent.prototype.expander;
    /**
     * @hidden
     * @type {?}
     * @protected
     */
    IgxHierarchicalRowComponent.prototype.defaultExpandedTemplate;
    /**
     * @hidden
     * @type {?}
     * @protected
     */
    IgxHierarchicalRowComponent.prototype.defaultEmptyTemplate;
    /**
     * @hidden
     * @type {?}
     * @protected
     */
    IgxHierarchicalRowComponent.prototype.defaultCollapsedTemplate;
    /**
     * @hidden
     * @type {?}
     */
    IgxHierarchicalRowComponent.prototype.tabindex;
    /**
     * @hidden
     * \@internal
     * @type {?}
     */
    IgxHierarchicalRowComponent.prototype.select;
    /**
     * @hidden
     * \@internal
     * @type {?}
     */
    IgxHierarchicalRowComponent.prototype.deselect;
}
//# sourceMappingURL=data:application/json;base64, 