/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
 */
import { Component, Input } from '@angular/core';
var GenericTableConfigComponent = /** @class */ (function () {
    function GenericTableConfigComponent() {
    }
    Object.defineProperty(GenericTableConfigComponent.prototype, "widgetConfig", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            if (value) {
                this.widgetConfiguration = value;
                if (value.config && value.config.tableColumnRules) {
                    this.genericTableConfiguration = value.config;
                }
                else {
                    this.genericTableConfiguration = { tableColumnRules: [] };
                    value.config = this.genericTableConfiguration;
                }
                this.genericTableConfiguration.tableColumnRules.forEach(function (tcr) {
                    return tcr.heatmapRules = tcr.heatmapRules ? tcr.heatmapRules : { low: '', high: '' };
                });
            }
            else {
                this.genericTableConfiguration = undefined;
                this.widgetConfiguration = undefined;
            }
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @return {?}
     */
    GenericTableConfigComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () { };
    /**
     * @return {?}
     */
    GenericTableConfigComponent.prototype.Add = /**
     * @return {?}
     */
    function () {
        if (this.widgetConfiguration.config === undefined) {
            /** @type {?} */
            var config = { tableColumnRules: [] };
            this.widgetConfiguration.config = config;
        }
        this.widgetConfiguration.config.tableColumnRules.push({
            columnName: '',
            alternateColorOnValueChange: false,
            heatmapRules: {
                low: '',
                high: ''
            }
        });
    };
    /**
     * @param {?} idx
     * @return {?}
     */
    GenericTableConfigComponent.prototype.DeleteByIndex = /**
     * @param {?} idx
     * @return {?}
     */
    function (idx) {
        this.genericTableConfiguration.tableColumnRules.splice(idx, 1);
    };
    GenericTableConfigComponent.decorators = [
        { type: Component, args: [{
                    selector: 'app-generic-table-config',
                    template: "<label>Column Rules</label>\r\n\r\n<div *ngIf=\"widgetConfiguration && genericTableConfiguration\">\r\n    <div class=\"form-group row\">\r\n        <label class=\"col-sm-3 tightPad col-form-label\">Column</label>\r\n        <label class=\"col-sm-3 col-form-label\">Switch background on change</label>\r\n        <label class=\"col-sm-2 tightPad col-form-label\">Heatmap rule: low</label>\r\n        <label class=\"col-sm-2 tightPad col-form-label\">Heatmap rule: high</label>\r\n        <label class=\"col-sm-2 tightPad col-form-label\">Remove</label>\r\n    </div>\r\n    <div class=\"form-group row\" *ngFor=\"let rule of genericTableConfiguration.tableColumnRules; let idx = index\">\r\n\r\n        <div *ngIf=\"widgetConfiguration.dataConsumerConfiguration.columns; else noColumns\" class=\"col-sm-3\">\r\n            <select class=\"form-control\" [(ngModel)]=\"rule.columnName\" id=\"rulecolumnName\">\r\n        <option *ngFor=\"let name of widgetConfiguration.dataConsumerConfiguration.columns\" [ngValue]=\"name\">\r\n                {{name}}\r\n        </option>\r\n      </select>\r\n        </div>\r\n        <ng-template #noColumns>\r\n            <div class=\"col-sm-3\">\r\n                <input type=\"text\" class=\"form-control\" [(ngModel)]=\"rule.columnName\" name=\"rulecolumnName\">\r\n            </div>\r\n        </ng-template>\r\n\r\n\r\n        <div class=\"col-sm-3\">\r\n            <select class=\"form-control\" [(ngModel)]=\"rule.alternateColorOnValueChange\">\r\n          <option [ngValue]=\"true\">True</option>\r\n          <option [ngValue]=\"false\">False</option>\r\n      </select>\r\n        </div>\r\n\r\n        <div class=\"col-sm-2\">\r\n            <input type=\"text\" class=\"form-control\" [(ngModel)]=\"rule.heatmapRules.low\" name=\"low\">\r\n        </div>\r\n\r\n        <div class=\"col-sm-2\">\r\n            <input type=\"text\" class=\"form-control\" [(ngModel)]=\"rule.heatmapRules.high\" name=\"high\">\r\n        </div>\r\n\r\n        <div class=\"col-sm-2 tightPad\">\r\n            <button type=\"button\" class=\"btn btn-info btn-sm\">\r\n      <span (click)=\"DeleteByIndex(idx)\" class=\"badge badge-danger\"><i _ngcontent-c24=\"\" class=\"fa fa-times\"></i></span>\r\n    </button>\r\n        </div>\r\n    </div>\r\n    <button type=\"button\" class=\"btn btn-sm btn-secondary\" (click)=\"Add()\">Add</button>\r\n</div>",
                    styles: [""]
                }] }
    ];
    /** @nocollapse */
    GenericTableConfigComponent.ctorParameters = function () { return []; };
    GenericTableConfigComponent.propDecorators = {
        widgetConfig: [{ type: Input }]
    };
    return GenericTableConfigComponent;
}());
export { GenericTableConfigComponent };
if (false) {
    /** @type {?} */
    GenericTableConfigComponent.prototype.genericTableConfiguration;
    /** @type {?} */
    GenericTableConfigComponent.prototype.widgetConfiguration;
}

//# sourceMappingURL=data:application/json;base64, 