/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { config } from '../../config';
var TableComponent = /** @class */ (function () {
    function TableComponent() {
        this.onSortEmitter = new EventEmitter();
    }
    /**
     * @return {?}
     */
    TableComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        this.initValues();
    };
    /**
     * @return {?}
     */
    TableComponent.prototype.initValues = /**
     * @return {?}
     */
    function () {
        var defaultProps = TableComponent.defaultProps;
        this.activeSortedColumn = this.activeSortedColumn;
        this.data = this.dataInput || defaultProps.data;
        this.title = this.titleInput || defaultProps.title;
    };
    /**
     * @param {?} header
     * @return {?}
     */
    TableComponent.prototype.sort = /**
     * @param {?} header
     * @return {?}
     */
    function (header) {
        if (this.activeSortedColumn && header.key !== this.activeSortedColumn) {
            this.data.headers.forEach((/**
             * @param {?} item
             * @return {?}
             */
            function (item) {
                item.direction = null;
            }));
        }
        this.activeSortedColumn = header.key;
        header.direction = this.getNewDirection(header.direction || null);
        this.onSortEmitter.emit({
            direction: header.direction,
            key: header.key
        });
    };
    /**
     * @param {?} currentDirection
     * @return {?}
     */
    TableComponent.prototype.getNewDirection = /**
     * @param {?} currentDirection
     * @return {?}
     */
    function (currentDirection) {
        if (!currentDirection) {
            return 'desc';
        }
        if (currentDirection === 'desc') {
            return 'asc';
        }
        return null;
    };
    TableComponent.defaultProps = {
        activeSortedColumn: '',
        data: (/** @type {?} */ ({})),
        title: ''
    };
    TableComponent.decorators = [
        { type: Component, args: [{
                    selector: config.components.prefix + "-table }",
                    template: "<div class=\"table-container\">\n  <div *ngIf=\"title\" class=\"table-title\">{{ title }}</div>\n\n  <div class=\"table\">\n    <div class=\"table-head\">\n      <div class=\"table-row\">\n        <div class=\"table-cell\" *ngFor=\"let header of data.headers\">\n          <div class=\"table-sort-container\" [class.active]=\"header.direction\">\n            <materialize-icon *ngIf=\"header.canSort\" className=\"table-sort-icon\" (onClick)=\"sort(header)\">\n              {{ header.direction === 'asc' ? 'arrow_upward' : 'arrow_downward' }}\n            </materialize-icon>\n            <div class=\"table-sort-text\">\n              {{ header.content }}\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div class=\"table-body\">\n      <div class=\"table-row\" *ngFor=\"let row of data.body\">\n        <div class=\"table-cell\" *ngFor=\"let cell of row\">\n          {{ cell.content }}\n        </div>\n      </div>\n    </div>\n    <div class=\"table-footer\">\n      <div class=\"table-row\">\n        <!-- TODO: -->\n      </div>\n    </div>\n  </div>\n</div>\n",
                    styles: [".table-container{border-radius:4px;box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12);font-size:20px;padding-top:20px}.table-title{margin-bottom:16px;margin-left:20px}.table{display:table;width:100%}.table-row{display:table-row}.table-cell{border-bottom:1px solid #dcdbdc;border-right:1px solid #dcdbdc;color:#6a6a6a;cursor:pointer;display:table-cell;font-size:13px;padding:16px 20px}.table-cell:last-child{border-right:0}.table-head{display:table-header-group}.table-head .table-cell{border-bottom:0;border-right:0;font-size:12px;font-weight:500}.table-body{display:table-row-group}.table-body .table-row:hover{background:#f4f3f4}.table-body .table-row:first-child .table-cell{border-top:1px solid #dcdbdc}.table-footer{display:table-footer-group}.table-sort-container{align-content:center;color:#6a6a6a;display:flex;flex-direction:row}.table-sort-container.active .table-sort-icon{color:#000}.table-sort-icon{color:#dcdbdc;margin-right:8px}.table-sort-text{align-items:center;display:flex}"]
                }] }
    ];
    /** @nocollapse */
    TableComponent.ctorParameters = function () { return []; };
    TableComponent.propDecorators = {
        onSortEmitter: [{ type: Output, args: ['onSort',] }],
        activeSortedColumnInput: [{ type: Input, args: ['activeSortedColumn',] }],
        dataInput: [{ type: Input, args: ['data',] }],
        titleInput: [{ type: Input, args: ['title',] }]
    };
    return TableComponent;
}());
export { TableComponent };
if (false) {
    /** @type {?} */
    TableComponent.defaultProps;
    /** @type {?} */
    TableComponent.prototype.onSortEmitter;
    /** @type {?} */
    TableComponent.prototype.activeSortedColumnInput;
    /** @type {?} */
    TableComponent.prototype.dataInput;
    /** @type {?} */
    TableComponent.prototype.titleInput;
    /** @type {?} */
    TableComponent.prototype.activeSortedColumn;
    /** @type {?} */
    TableComponent.prototype.data;
    /** @type {?} */
    TableComponent.prototype.title;
}
//# sourceMappingURL=data:application/json;base64, 