/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, HostBinding, Input, ViewChild, QueryList, ViewChildren, forwardRef, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef, HostListener } from '@angular/core';
import { IgxColumnComponent } from './column.component';
import { IgxFilteringService } from './filtering/grid-filtering.service';
import { GridBaseAPIService } from './api.service';
import { IgxColumnResizingService } from './grid-column-resizing.service';
import { IgxGridHeaderComponent } from './grid-header.component';
import { IgxGridFilteringCellComponent } from './filtering/grid-filtering-cell.component';
import { isIE } from '../core/utils';
/** @type {?} */
var Z_INDEX = 9999;
/**
 * @hidden
 */
var IgxGridHeaderGroupComponent = /** @class */ (function () {
    function IgxGridHeaderGroupComponent(cdr, gridAPI, element, colResizingService, filteringService) {
        this.cdr = cdr;
        this.gridAPI = gridAPI;
        this.element = element;
        this.colResizingService = colResizingService;
        this.filteringService = filteringService;
    }
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "gridRowSpan", {
        get: /**
         * @return {?}
         */
        function () {
            return this.column.gridRowSpan;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "gridColumnSpan", {
        get: /**
         * @return {?}
         */
        function () {
            return this.column.gridColumnSpan;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "rowEnd", {
        get: /**
         * @return {?}
         */
        function () {
            return this.column.rowEnd;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "colEnd", {
        get: /**
         * @return {?}
         */
        function () {
            return this.column.colEnd;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "rowStart", {
        get: /**
         * @return {?}
         */
        function () {
            return this.column.rowStart;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "colStart", {
        get: /**
         * @return {?}
         */
        function () {
            return this.column.colStart;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "width", {
        /**
         * Gets the width of the header group.
         * @memberof IgxGridHeaderGroupComponent
         */
        get: /**
         * Gets the width of the header group.
         * \@memberof IgxGridHeaderGroupComponent
         * @return {?}
         */
        function () {
            return this.grid.getHeaderGroupWidth(this.column);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "styleClasses", {
        /**
         * Gets the style classes of the header group.
         * @memberof IgxGridHeaderGroupComponent
         */
        get: /**
         * Gets the style classes of the header group.
         * \@memberof IgxGridHeaderGroupComponent
         * @return {?}
         */
        function () {
            /** @type {?} */
            var defaultClasses = [
                'igx-grid__thead-item',
                this.column.headerGroupClasses
            ];
            /** @type {?} */
            var classList = {
                'igx-grid__th--pinned': this.isPinned,
                'igx-grid__th--pinned-last': this.isLastPinned,
                'igx-grid__drag-col-header': this.isHeaderDragged,
                'igx-grid__th--filtering': this.isFiltered
            };
            Object.entries(classList).forEach(function (_a) {
                var _b = tslib_1.__read(_a, 2), className = _b[0], value = _b[1];
                if (value) {
                    defaultClasses.push(className);
                }
            });
            return defaultClasses.join(' ');
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "zIndex", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            if (!this.column.pinned) {
                return null;
            }
            return Z_INDEX - this.grid.pinnedColumns.indexOf(this.column);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "grid", {
        /**
         * Gets the grid of the header group.
         * @memberof IgxGridHeaderGroupComponent
         */
        get: /**
         * Gets the grid of the header group.
         * \@memberof IgxGridHeaderGroupComponent
         * @return {?}
         */
        function () {
            return this.gridAPI.grid;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "isFiltered", {
        /**
         * Gets whether the header group belongs to a column that is filtered.
         * @memberof IgxGridHeaderGroupComponent
         */
        get: /**
         * Gets whether the header group belongs to a column that is filtered.
         * \@memberof IgxGridHeaderGroupComponent
         * @return {?}
         */
        function () {
            return this.filteringService.filteredColumn === this.column;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "isLastPinned", {
        /**
         * Gets whether the header group is stored in the last column in the pinned area.
         * @memberof IgxGridHeaderGroupComponent
         */
        get: /**
         * Gets whether the header group is stored in the last column in the pinned area.
         * \@memberof IgxGridHeaderGroupComponent
         * @return {?}
         */
        function () {
            return !this.grid.hasColumnLayouts ? this.column.isLastPinned : false;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "groupDisplayStyle", {
        get: /**
         * @return {?}
         */
        function () {
            return this.grid.hasColumnLayouts && this.column.children && !isIE() ? 'flex' : '';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "isPinned", {
        /**
         * Gets whether the header group is stored in a pinned column.
         * @memberof IgxGridHeaderGroupComponent
         */
        get: /**
         * Gets whether the header group is stored in a pinned column.
         * \@memberof IgxGridHeaderGroupComponent
         * @return {?}
         */
        function () {
            return this.column.pinned;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "isHeaderDragged", {
        /**
         * Gets whether the header group belongs to a column that is moved.
         * @memberof IgxGridHeaderGroupComponent
         */
        get: /**
         * Gets whether the header group belongs to a column that is moved.
         * \@memberof IgxGridHeaderGroupComponent
         * @return {?}
         */
        function () {
            return this.grid.draggedColumn === this.column;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "hasLastPinnedChildColumn", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.column.allChildren.some(function (child) { return child.isLastPinned; });
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxGridHeaderGroupComponent.prototype, "height", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.element.nativeElement.getBoundingClientRect().height;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @hidden
     */
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxGridHeaderGroupComponent.prototype.onMouseDown = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        // hack for preventing text selection in IE and Edge while dragging the resizer
        event.preventDefault();
    };
    /**
     * @return {?}
     */
    IgxGridHeaderGroupComponent.prototype.ngDoCheck = /**
     * @return {?}
     */
    function () {
        this.cdr.markForCheck();
    };
    IgxGridHeaderGroupComponent.decorators = [
        { type: Component, args: [{
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    preserveWhitespaces: false,
                    selector: 'igx-grid-header-group',
                    template: "<ng-container *ngIf=\"grid.hasColumnLayouts && column.columnGroup\">\n    <span *ngIf=\"grid.hasMovableColumns\" class=\"igx-grid__th-drop-indicator-left\"></span>\n    <div class=\"igx-grid__thead-group igx-grid__mrl-block\"\n     [ngClass]=\"{'igx-grid__th--pinned-last': hasLastPinnedChildColumn}\"\n     [ngStyle]=\"{'grid-template-rows':column.getGridTemplate(true, false),\n     'grid-template-columns':column.getGridTemplate(false, false),\n     '-ms-grid-rows':column.getGridTemplate(true, true),\n     '-ms-grid-columns':column.getGridTemplate(false, true)}\">\n        <ng-container *ngFor=\"let child of column.children\" >\n            <igx-grid-header-group *ngIf=\"!child.hidden\" class=\"igx-grid__thead-subgroup\"\n                [column]=\"child\"\n                [gridID]=\"child.gridID\"\n                [igxColumnMovingDrag]=\"child\"\n                [dragGhostHost]=\"grid.outletDirective.nativeElement\"\n                [attr.droppable]=\"true\"\n                [igxColumnMovingDrop]=\"child\">\n            </igx-grid-header-group>\n        </ng-container>\n    </div>\n    <span *ngIf=\"grid.hasMovableColumns\" class=\"igx-grid__th-drop-indicator-right\"></span>\n</ng-container>\n\n<ng-container *ngIf=\"!grid.hasColumnLayouts && column.columnGroup\">\n    <span *ngIf=\"grid.hasMovableColumns\" class=\"igx-grid__th-drop-indicator-left\"></span>\n    <div class=\"igx-grid__thead-title\"\n        [ngClass]=\"{'igx-grid__th--pinned-last': hasLastPinnedChildColumn}\"\n        [igxColumnMovingDrag]=\"column\"\n        [dragGhostHost]=\"grid.outletDirective.nativeElement\"\n        [attr.droppable]=\"true\"\n        [igxColumnMovingDrop]=\"column\">{{ column.header }}</div>\n    <div class=\"igx-grid__thead-group\">\n        <ng-container *ngFor=\"let child of column.children\">\n            <igx-grid-header-group *ngIf=\"!child.hidden\" class=\"igx-grid__thead-subgroup\"\n                                [column]=\"child\"\n                                [gridID]=\"child.grid.id\"\n                                [style.min-width.px]=\"grid.getHeaderGroupWidth(child)\"\n                                [style.flex-basis.px]=\"grid.getHeaderGroupWidth(child)\">\n            </igx-grid-header-group>\n        </ng-container>\n    </div>\n    <span *ngIf=\"grid.hasMovableColumns\" class=\"igx-grid__th-drop-indicator-right\"></span>\n</ng-container>\n\n<ng-container *ngIf=\"!column.columnGroup\">\n    <span *ngIf=\"grid.hasMovableColumns\" class=\"igx-grid__th-drop-indicator-left\"></span>\n    <igx-grid-header [igxColumnMovingDrag]=\"column\" [dragGhostHost]=\"grid.outletDirective.nativeElement\" [attr.droppable]=\"true\" [igxColumnMovingDrop]=\"column\" [gridID]=\"column.grid.id\" [column]=\"column\"></igx-grid-header>\n    <igx-grid-filtering-cell *ngIf=\"grid.allowFiltering && grid.filterMode == 'quickFilter'\" [column]=\"column\" [attr.draggable]=\"false\"></igx-grid-filtering-cell>\n    <span *ngIf=\"!column.columnGroup && column.resizable\" class=\"igx-grid__th-resize-handle\"\n          [igxResizeHandle]=\"column\"\n          [attr.draggable]=\"false\"\n          [style.cursor]=\"colResizingService.resizeCursor\">\n    </span>\n    <span *ngIf=\"grid.hasMovableColumns\" class=\"igx-grid__th-drop-indicator-right\"></span>\n</ng-container>\n"
                }] }
    ];
    /** @nocollapse */
    IgxGridHeaderGroupComponent.ctorParameters = function () { return [
        { type: ChangeDetectorRef },
        { type: GridBaseAPIService },
        { type: ElementRef },
        { type: IgxColumnResizingService },
        { type: IgxFilteringService }
    ]; };
    IgxGridHeaderGroupComponent.propDecorators = {
        gridRowSpan: [{ type: HostBinding, args: ['style.-ms-grid-row-span',] }],
        gridColumnSpan: [{ type: HostBinding, args: ['style.-ms-grid-column-span',] }],
        rowEnd: [{ type: HostBinding, args: ['style.grid-row-end',] }],
        colEnd: [{ type: HostBinding, args: ['style.grid-column-end',] }],
        rowStart: [{ type: HostBinding, args: ['style.-ms-grid-row',] }, { type: HostBinding, args: ['style.grid-row-start',] }],
        colStart: [{ type: HostBinding, args: ['style.-ms-grid-column',] }, { type: HostBinding, args: ['style.grid-column-start',] }],
        column: [{ type: Input }],
        gridID: [{ type: Input }],
        headerCell: [{ type: ViewChild, args: [IgxGridHeaderComponent,] }],
        filterCell: [{ type: ViewChild, args: [IgxGridFilteringCellComponent,] }],
        children: [{ type: ViewChildren, args: [forwardRef(function () { return IgxGridHeaderGroupComponent; }), { read: IgxGridHeaderGroupComponent },] }],
        width: [{ type: HostBinding, args: ['style.min-width',] }, { type: HostBinding, args: ['style.flex-basis',] }],
        styleClasses: [{ type: HostBinding, args: ['class',] }],
        zIndex: [{ type: HostBinding, args: ['style.z-index',] }],
        groupDisplayStyle: [{ type: HostBinding, args: ['style.display',] }],
        onMouseDown: [{ type: HostListener, args: ['mousedown', ['$event'],] }]
    };
    return IgxGridHeaderGroupComponent;
}());
export { IgxGridHeaderGroupComponent };
if (false) {
    /**
     * Gets the column of the header group.
     * \@memberof IgxGridHeaderGroupComponent
     * @type {?}
     */
    IgxGridHeaderGroupComponent.prototype.column;
    /**
     * Gets the `id` of the grid in which the header group is stored.
     * \@memberof IgxGridHeaderGroupComponent
     * @type {?}
     */
    IgxGridHeaderGroupComponent.prototype.gridID;
    /**
     * @hidden
     * @type {?}
     */
    IgxGridHeaderGroupComponent.prototype.headerCell;
    /**
     * @hidden
     * @type {?}
     */
    IgxGridHeaderGroupComponent.prototype.filterCell;
    /**
     * @hidden
     * @type {?}
     */
    IgxGridHeaderGroupComponent.prototype.children;
    /**
     * @type {?}
     * @private
     */
    IgxGridHeaderGroupComponent.prototype.cdr;
    /** @type {?} */
    IgxGridHeaderGroupComponent.prototype.gridAPI;
    /** @type {?} */
    IgxGridHeaderGroupComponent.prototype.element;
    /** @type {?} */
    IgxGridHeaderGroupComponent.prototype.colResizingService;
    /** @type {?} */
    IgxGridHeaderGroupComponent.prototype.filteringService;
}
//# sourceMappingURL=data:application/json;base64, 