/**
 * @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, ChangeDetectorRef, ViewChildren, QueryList, ViewChild } from '@angular/core';
import { IgxRowComponent } from '../row.component';
import { IgxHierarchicalSelectionAPIService } from './selection';
import { GridBaseAPIService } from '.././api.service';
import { IgxHierarchicalGridCellComponent } from './hierarchical-cell.component';
import { IgxGridCRUDService, IgxGridSelectionService } from '../../core/grid-selection';
var IgxHierarchicalRowComponent = /** @class */ (function (_super) {
    tslib_1.__extends(IgxHierarchicalRowComponent, _super);
    function IgxHierarchicalRowComponent(gridAPI, crudService, selectionService, hselection, element, cdr) {
        var _this = _super.call(this, gridAPI, crudService, selectionService, hselection, element, cdr) || this;
        _this.gridAPI = gridAPI;
        _this.crudService = crudService;
        _this.selectionService = selectionService;
        _this.hselection = hselection;
        _this.element = element;
        _this.cdr = cdr;
        /**
         * @hidden
         */
        _this.tabindex = 0;
        return _this;
    }
    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
    });
    /**
     * 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();
        requestAnimationFrame(function () {
            grid.reflow();
        });
    };
    /**
     * @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)=\"toggle()\" class=\"igx-grid__hierarchical-expander\" [tabIndex]=\"tabindex\" *ngIf=\"hasChildren\" #expander>\n    <igx-icon *ngIf=\"!expanded\" [isActive]='!added' fontSet=\"material\">expand_more</igx-icon>\n    <igx-icon *ngIf=\"expanded\" [isActive]='!added' fontSet=\"material\">expand_less</igx-icon>\n</div>\n<ng-container *ngIf=\"rowDraggable\">\n    <div [class]=\"resolveDragIndicatorClasses\" [igxRowDrag]=\"this\">\n            <ng-container *ngTemplateOutlet=\"this.grid.dragIndicatorIconTemplate ? this.grid.dragIndicatorIconTemplate : this.grid.dragIndicatorIconBase\"></ng-container>\n    </div>\n</ng-container>\n<ng-container *ngIf=\"rowSelectable\">\n        <div class=\"igx-grid__cbx-selection\">\n            <igx-checkbox [checked]=\"isSelected\" (change)=\"onCheckboxClick($event)\" disableRipple=\"true\" [disableTransitions]=\"grid.disableTransitions\" [aria-label]=\"rowCheckboxAriaLabel\"></igx-checkbox>\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 | igxCellStyles:rowData[col.field]:rowData:col.field\"\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    </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 | igxCellStyles:rowData[col.field]:rowData:col.field\"\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    </igx-hierarchical-grid-cell>\n</ng-template>\n\n",
                    providers: [{ provide: IgxRowComponent, useExisting: forwardRef(function () { return IgxHierarchicalRowComponent; }) }]
                }] }
    ];
    /** @nocollapse */
    IgxHierarchicalRowComponent.ctorParameters = function () { return [
        { type: GridBaseAPIService },
        { type: IgxGridCRUDService },
        { type: IgxGridSelectionService },
        { type: IgxHierarchicalSelectionAPIService },
        { type: ElementRef },
        { type: ChangeDetectorRef }
    ]; };
    IgxHierarchicalRowComponent.propDecorators = {
        cells: [{ type: ViewChildren, args: [forwardRef(function () { return IgxHierarchicalGridCellComponent; }), { read: IgxHierarchicalGridCellComponent },] }],
        expander: [{ type: ViewChild, args: ['expander', { read: ElementRef, static: false },] }],
        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 {?}
     */
    IgxHierarchicalRowComponent.prototype.tabindex;
    /** @type {?} */
    IgxHierarchicalRowComponent.prototype.gridAPI;
    /** @type {?} */
    IgxHierarchicalRowComponent.prototype.crudService;
    /** @type {?} */
    IgxHierarchicalRowComponent.prototype.selectionService;
    /**
     * @type {?}
     * @private
     */
    IgxHierarchicalRowComponent.prototype.hselection;
    /** @type {?} */
    IgxHierarchicalRowComponent.prototype.element;
    /** @type {?} */
    IgxHierarchicalRowComponent.prototype.cdr;
}
//# sourceMappingURL=data:application/json;base64, 