/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, forwardRef, HostBinding, Input, QueryList, ViewChild, ViewChildren } from '@angular/core';
import { IgxCheckboxComponent } from '../checkbox/checkbox.component';
import { IgxSelectionAPIService } from '../core/selection';
import { IgxGridForOfDirective } from '../directives/for-of/for_of.directive';
import { GridBaseAPIService } from './api.service';
import { IgxGridCellComponent } from './cell.component';
import { TransactionType } from '../services';
import { IgxGridSelectionService, IgxGridCRUDService, IgxRow } from '../core/grid-selection';
/**
 * @template T
 */
var IgxRowComponent = /** @class */ (function () {
    function IgxRowComponent(gridAPI, crudService, selectionService, selection, element, cdr) {
        this.gridAPI = gridAPI;
        this.crudService = crudService;
        this.selectionService = selectionService;
        this.selection = selection;
        this.element = element;
        this.cdr = cdr;
        /**
         * @hidden
         */
        this.role = 'row';
        /**
         * @hidden
         */
        this.dragging = false;
        /**
         * @hidden
         */
        this.focused = false;
        /**
         * @hidden
         * \@internal
         */
        this.defaultCssClass = 'igx-grid__tr';
        /**
         * @hidden
         */
        this._rowSelection = false;
    }
    Object.defineProperty(IgxRowComponent.prototype, "rowData", {
        /**
         *  The data passed to the row component.
         *
         * ```typescript
         * // get the row data for the first selected row
         * let selectedRowData = this.grid.selectedRows[0].rowData;
         * ```
         */
        get: /**
         *  The data passed to the row component.
         *
         * ```typescript
         * // get the row data for the first selected row
         * let selectedRowData = this.grid.selectedRows[0].rowData;
         * ```
         * @return {?}
         */
        function () {
            if (this.inEditMode) {
                return Object.assign({}, this._rowData, this.grid.transactions.getAggregatedValue(this.rowID, false));
            }
            return this._rowData;
        },
        set: /**
         * @param {?} v
         * @return {?}
         */
        function (v) {
            this._rowData = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "dataRowIndex", {
        get: /**
         * @return {?}
         */
        function () {
            return this.index;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "styleClasses", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.resolveClasses();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "columns", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.grid.visibleColumns;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "pinnedColumns", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.grid.pinnedColumns;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "unpinnedColumns", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.grid.unpinnedColumns;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "rowSelectable", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.grid.rowSelectable;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "showRowCheckboxes", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.grid.showRowCheckboxes;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "dirty", {
        /** @hidden */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            /** @type {?} */
            var row = this.grid.transactions.getState(this.rowID);
            if (row) {
                return row.type === TransactionType.ADD || row.type === TransactionType.UPDATE;
            }
            return false;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "rowDraggable", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.grid.rowDraggable;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "added", {
        /** @hidden */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            /** @type {?} */
            var row = this.grid.transactions.getState(this.rowID);
            if (row) {
                return row.type === TransactionType.ADD;
            }
            return false;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "deleted", {
        /** @hidden */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.gridAPI.row_deleted_transaction(this.rowID);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "inEditMode", {
        // TODO: Refactor
        get: 
        // TODO: Refactor
        /**
         * @return {?}
         */
        function () {
            if (this.grid.rowEditable) {
                /** @type {?} */
                var editRowState = this.crudService.row;
                return (editRowState && editRowState.id === this.rowID) || false;
            }
            else {
                return false;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "grid", {
        /**
         * Get a reference to the grid that contains the selected row.
         *
         * ```typescript
         * handleRowSelection(event) {
         *  // the grid on which the onRowSelectionChange event was triggered
         *  const grid = event.row.grid;
         * }
         * ```
         *
         * ```html
         *  <igx-grid
         *    [data]="data"
         *    (onRowSelectionChange)="handleRowSelection($event)">
         *  </igx-grid>
         * ```
         */
        get: /**
         * Get a reference to the grid that contains the selected row.
         *
         * ```typescript
         * handleRowSelection(event) {
         *  // the grid on which the onRowSelectionChange event was triggered
         *  const grid = event.row.grid;
         * }
         * ```
         *
         * ```html
         *  <igx-grid
         *    [data]="data"
         *    (onRowSelectionChange)="handleRowSelection($event)">
         *  </igx-grid>
         * ```
         * @return {?}
         */
        function () {
            return this.gridAPI.grid;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "rowID", {
        /**
         * Gets the ID of the row.
         * A row in the grid is identified either by:
         * - primaryKey data value,
         * - the whole rowData, if the primaryKey is omitted.
         *
         * ```typescript
         * let rowID = this.grid.selectedRows[2].rowID;
         * ```
         */
        get: /**
         * Gets the ID of the row.
         * A row in the grid is identified either by:
         * - primaryKey data value,
         * - the whole rowData, if the primaryKey is omitted.
         *
         * ```typescript
         * let rowID = this.grid.selectedRows[2].rowID;
         * ```
         * @return {?}
         */
        function () {
            /** @type {?} */
            var primaryKey = this.grid.primaryKey;
            return primaryKey ? this._rowData[primaryKey] : this._rowData;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxRowComponent.prototype, "nativeElement", {
        /**
         * The native DOM element representing the row. Could be null in certain environments.
         *
         * ```typescript
         * // get the nativeElement of the second selected row
         * let selectedRowNativeElement = this.grid.selectedRows[1].nativeElement;
         * ```
         */
        get: /**
         * The native DOM element representing the row. Could be null in certain environments.
         *
         * ```typescript
         * // get the nativeElement of the second selected row
         * let selectedRowNativeElement = this.grid.selectedRows[1].nativeElement;
         * ```
         * @return {?}
         */
        function () {
            return this.element.nativeElement;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @hidden
     */
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxRowComponent.prototype.onCheckboxClick = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        /** @type {?} */
        var newSelection = (event.checked) ?
            this.selection.add_item(this.gridID, this.rowID) :
            this.selection.delete_item(this.gridID, this.rowID);
        this.grid.triggerRowSelectionChange(newSelection, this, event);
    };
    /**
     * Updates the specified row object and the data source record with the passed value.
     * This method emits `onEditDone` event.
     *
     * ```typescript
     * // update the second selected row's value
     * let newValue = "Apple";
     * this.grid.selectedRows[1].update(newValue);
     * ```
     */
    /**
     * Updates the specified row object and the data source record with the passed value.
     * This method emits `onEditDone` event.
     *
     * ```typescript
     * // update the second selected row's value
     * let newValue = "Apple";
     * this.grid.selectedRows[1].update(newValue);
     * ```
     * @param {?} value
     * @return {?}
     */
    IgxRowComponent.prototype.update = /**
     * Updates the specified row object and the data source record with the passed value.
     * This method emits `onEditDone` event.
     *
     * ```typescript
     * // update the second selected row's value
     * let newValue = "Apple";
     * this.grid.selectedRows[1].update(newValue);
     * ```
     * @param {?} value
     * @return {?}
     */
    function (value) {
        /** @type {?} */
        var crudService = this.crudService;
        if (crudService.inEditMode && crudService.cell.id.rowID === this.rowID) {
            this.grid.endEdit(false);
        }
        /** @type {?} */
        var row = new IgxRow(this.rowID, this.index, this.rowData);
        this.gridAPI.update_row(row, value);
        this.cdr.markForCheck();
    };
    /**
     * Removes the specified row from the grid's data source.
     * This method emits `onRowDeleted` event.
     *
     * ```typescript
     * // delete the third selected row from the grid
     * this.grid.selectedRows[2].delete();
     * ```
     */
    /**
     * Removes the specified row from the grid's data source.
     * This method emits `onRowDeleted` event.
     *
     * ```typescript
     * // delete the third selected row from the grid
     * this.grid.selectedRows[2].delete();
     * ```
     * @return {?}
     */
    IgxRowComponent.prototype.delete = /**
     * Removes the specified row from the grid's data source.
     * This method emits `onRowDeleted` event.
     *
     * ```typescript
     * // delete the third selected row from the grid
     * this.grid.selectedRows[2].delete();
     * ```
     * @return {?}
     */
    function () {
        this.grid.deleteRowById(this.rowID);
    };
    Object.defineProperty(IgxRowComponent.prototype, "rowCheckboxAriaLabel", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.grid.primaryKey ?
                this.isSelected ? 'Deselect row with key ' + this.rowID : 'Select row with key ' + this.rowID :
                this.isSelected ? 'Deselect row' : 'Select row';
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @hidden
     */
    /**
     * @hidden
     * @return {?}
     */
    IgxRowComponent.prototype.ngDoCheck = /**
     * @hidden
     * @return {?}
     */
    function () {
        this.isSelected = this.rowSelectable ?
            this.grid.allRowsSelected ? true : this.selection.is_item_selected(this.gridID, this.rowID) :
            this.selection.is_item_selected(this.gridID, this.rowID);
        this.cdr.markForCheck();
        if (this.checkboxElement) {
            this.checkboxElement.checked = this.isSelected;
        }
    };
    /**
     * @hidden
     */
    /**
     * @hidden
     * @protected
     * @return {?}
     */
    IgxRowComponent.prototype.resolveClasses = /**
     * @hidden
     * @protected
     * @return {?}
     */
    function () {
        /** @type {?} */
        var indexClass = this.index % 2 ? this.grid.evenRowCSS : this.grid.oddRowCSS;
        /** @type {?} */
        var selectedClass = this.isSelected ? 'igx-grid__tr--selected' : '';
        /** @type {?} */
        var editClass = this.inEditMode ? 'igx-grid__tr--edit' : '';
        /** @type {?} */
        var dirtyClass = this.dirty ? 'igx-grid__tr--edited' : '';
        /** @type {?} */
        var deletedClass = this.deleted ? 'igx-grid__tr--deleted' : '';
        /** @type {?} */
        var mrlClass = this.grid.hasColumnLayouts ? 'igx-grid__tr--mrl' : '';
        /** @type {?} */
        var dragClass = this.dragging ? 'igx-grid__tr--drag' : '';
        return (this.defaultCssClass + " " + indexClass + " " + selectedClass + " " + editClass + " " + dirtyClass + "\n         " + deletedClass + " " + mrlClass + " " + dragClass).trim();
    };
    Object.defineProperty(IgxRowComponent.prototype, "resolveDragIndicatorClasses", {
        /**
         * @hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            /** @type {?} */
            var defaultDragIndicatorCssClass = 'igx-grid__drag-indicator';
            /** @type {?} */
            var dragIndicatorOff = this.grid.rowDragging && !this.dragging ? 'igx-grid__drag-indicator--off' : '';
            return defaultDragIndicatorCssClass + " " + dragIndicatorOff;
        },
        enumerable: true,
        configurable: true
    });
    IgxRowComponent.decorators = [
        { type: Component, args: [{
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    preserveWhitespaces: false,
                    selector: 'igx-row',
                    template: "<ng-container *ngIf=\"grid.groupingExpressions.length > 0\">\n    <div class=\"igx-grid__row-indentation igx-grid__row-indentation--level-{{grid.groupingExpressions.length}}\"></div>\n</ng-container>\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=\"showRowCheckboxes\">\n    <div class=\"igx-grid__cbx-selection\">\n        <igx-checkbox [checked]=\"isSelected\" [disabled]=\"deleted\" (change)=\"onCheckboxClick($event)\" disableRipple=\"true\" [disableTransitions]=\"grid.disableTransitions\" [aria-label]=\"rowCheckboxAriaLabel\"></igx-checkbox>\n    </div>\n</ng-container>\n\n<ng-container *ngIf=\"!grid.hasColumnLayouts\">\n    <ng-container *ngIf=\"pinnedColumns.length > 0\">\n        <igx-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-grid-cell>\n    </ng-container>\n    <ng-template igxGridFor let-col [igxGridForOf]=\"unpinnedColumns | igxNotGrouped\" [igxForScrollContainer]=\"grid.parentVirtDir\" [igxForScrollOrientation]=\"'horizontal'\" [igxForContainerSize]='grid.unpinnedWidth' [igxForSizePropName]='\"calcPixelWidth\"' [igxForTrackBy]='grid.trackColumnChanges' #igxDirRef>\n        <igx-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-grid-cell>\n    </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"grid.hasColumnLayouts\">\n    <ng-container *ngIf=\"pinnedColumns.length > 0\">\n        <div *ngFor=\"let col of pinnedColumns | igxTopLevel\" class=\"igx-grid__mrl-block\"\n        [ngClass]=\"{'igx-grid__td--pinned-last': col.hasLastPinnedChildColumn}\"\n        [ngStyle]=\"{'grid-template-rows':col.getGridTemplate(true, false),\n        'grid-template-columns':col.getGridTemplate(false, false),\n        'z-index': col.pinned ? 1 : null,\n        '-ms-grid-rows':col.getGridTemplate(true, true),\n        '-ms-grid-columns':col.getGridTemplate(false, true)}\">\n            <igx-grid-cell *ngFor=\"let child of col.children\"\n                class=\"igx-grid__td igx-grid__td--fw igx-grid__td--pinned\"\n                [class.igx-grid__td--number]=\"child.dataType === 'number'\"\n                [ngClass]=\"child.cellClasses | igxCellStyles:rowData[child.field]:rowData:child.field\"\n                [editMode]=\"child.editable && crudService.isInEditMode(index, child.index)\"\n                [column]=\"child\"\n                [formatter]=\"child.formatter\"\n                [row]=\"this\"\n                [style.min-height.px]=\"grid.rowHeight || 32\"\n                [rowData]=\"rowData\"\n                [visibleColumnIndex]=\"child.visibleIndex\"\n                [value]=\"rowData[child.field]\"\n                [cellTemplate]=\"child.bodyTemplate\"></igx-grid-cell>\n        </div>\n    </ng-container>\n    <ng-template igxGridFor let-col [igxGridForOf]=\"unpinnedColumns | igxTopLevel\" [igxForScrollContainer]=\"grid.parentVirtDir\" let-colIndex=\"index\" [igxForScrollOrientation]=\"'horizontal'\" [igxForContainerSize]='grid.unpinnedWidth' [igxForSizePropName]='\"calcPixelWidth\"' [igxForTrackBy]='grid.trackColumnChanges' #igxDirRef>\n        <div class=\"igx-grid__mrl-block\"\n        [ngStyle]=\"{'grid-template-rows':col.getGridTemplate(true, false),\n     'grid-template-columns':col.getGridTemplate(false, false),\n     '-ms-grid-rows':col.getGridTemplate(true, true),\n     '-ms-grid-columns':col.getGridTemplate(false, true)}\">\n            <igx-grid-cell *ngFor=\"let child of col.children\"\n                class=\"igx-grid__td igx-grid__td--fw\"\n                [class.igx-grid__td--number]=\"child.dataType === 'number'\"\n                [ngClass]=\"child.cellClasses | igxCellStyles:rowData[child.field]:rowData:child.field\"\n                [editMode]=\"child.editable && crudService.isInEditMode(index, child.index)\"\n                [column]=\"child\"\n                [formatter]=\"child.formatter\"\n                [row]=\"this\"\n                [style.min-height.px]=\"grid.rowHeight || 32\"\n                [rowData]=\"rowData\"\n                [visibleColumnIndex]=\"child.visibleIndex\"\n                [value]=\"rowData[child.field]\"\n                [cellTemplate]=\"child.bodyTemplate\"></igx-grid-cell>\n        </div>\n    </ng-template>\n</ng-container>\n"
                }] }
    ];
    /** @nocollapse */
    IgxRowComponent.ctorParameters = function () { return [
        { type: GridBaseAPIService },
        { type: IgxGridCRUDService },
        { type: IgxGridSelectionService },
        { type: IgxSelectionAPIService },
        { type: ElementRef },
        { type: ChangeDetectorRef }
    ]; };
    IgxRowComponent.propDecorators = {
        rowData: [{ type: Input }],
        index: [{ type: Input }],
        gridID: [{ type: Input }],
        virtDirRow: [{ type: ViewChild, args: ['igxDirRef', { read: IgxGridForOfDirective, static: false },] }],
        checkboxElement: [{ type: ViewChild, args: [forwardRef(function () { return IgxCheckboxComponent; }), { read: IgxCheckboxComponent, static: false },] }],
        cells: [{ type: ViewChildren, args: [forwardRef(function () { return IgxGridCellComponent; }),] }],
        role: [{ type: HostBinding, args: ['attr.role',] }],
        dataRowIndex: [{ type: HostBinding, args: ['attr.data-rowIndex',] }],
        styleClasses: [{ type: HostBinding, args: ['class',] }],
        isSelected: [{ type: HostBinding, args: ['attr.aria-selected',] }]
    };
    return IgxRowComponent;
}());
export { IgxRowComponent };
if (false) {
    /**
     * @type {?}
     * @private
     */
    IgxRowComponent.prototype._rowData;
    /**
     * The index of the row.
     *
     * ```typescript
     * // get the index of the second selected row
     * let selectedRowIndex = this.grid.selectedRows[1].index;
     * ```
     * @type {?}
     */
    IgxRowComponent.prototype.index;
    /**
     * @hidden
     * @type {?}
     */
    IgxRowComponent.prototype.gridID;
    /**
     * @hidden
     * @type {?}
     */
    IgxRowComponent.prototype.virtDirRow;
    /**
     * @hidden
     * @type {?}
     */
    IgxRowComponent.prototype.checkboxElement;
    /**
     * The rendered cells in the row component.
     *
     * ```typescript
     * // get the cells of the third selected row
     * let selectedRowCells = this.grid.selectedRows[2].cells;
     * ```
     * @type {?}
     */
    IgxRowComponent.prototype.cells;
    /**
     * @hidden
     * @type {?}
     */
    IgxRowComponent.prototype.role;
    /**
     * @hidden
     * @type {?}
     */
    IgxRowComponent.prototype.isSelected;
    /**
     * @hidden
     * @type {?}
     */
    IgxRowComponent.prototype.dragging;
    /**
     * @hidden
     * @type {?}
     */
    IgxRowComponent.prototype.focused;
    /**
     * @hidden
     * \@internal
     * @type {?}
     */
    IgxRowComponent.prototype.defaultCssClass;
    /**
     * @hidden
     * @type {?}
     * @protected
     */
    IgxRowComponent.prototype._rowSelection;
    /** @type {?} */
    IgxRowComponent.prototype.gridAPI;
    /** @type {?} */
    IgxRowComponent.prototype.crudService;
    /** @type {?} */
    IgxRowComponent.prototype.selectionService;
    /**
     * @type {?}
     * @private
     */
    IgxRowComponent.prototype.selection;
    /** @type {?} */
    IgxRowComponent.prototype.element;
    /** @type {?} */
    IgxRowComponent.prototype.cdr;
}
//# sourceMappingURL=data:application/json;base64, 