import { Component, Input } from "@angular/core";
import { Enum } from "../../../system/Enum";
import { StiHorizontalAlignment } from "../../../system/enums";
import { StiRadioButtonColumnItem } from "../../../elements/table/columns/StiRadioButtonColumnItem";
import { StiTableElement } from "../../../elements/StiTableElement";
import * as i0 from "@angular/core";
import * as i1 from "../../../services/model.service";
import * as i2 from "@angular/common";
import * as i3 from "../../sti-number.component";
import * as i4 from "../sti-table-text-input/sti-table-text-input.component";
import * as i5 from "../sti-table-radiobutton/sti-table-radiobutton.component";
import * as i6 from "../sti-table-combobox/sti-table-combobox.component";
import * as i7 from "../sti-table-checkbox/sti-table-checkbox.component";
import * as i8 from "../sti-table-label/sti-table-label.component";
export class StiTableColumnComponent {
    getColumnAlignment(column) {
        return Enum.getName(StiHorizontalAlignment, column.cellAlignment);
    }
    changeState(column, i) {
        if (column instanceof StiRadioButtonColumnItem) {
            if (this.element instanceof StiTableElement) {
                this.element.columns.forEach((col) => {
                    if (col instanceof StiRadioButtonColumnItem && col != column) {
                        col.cells[i].isChecked = false;
                    }
                });
            }
            if (!column.cells[i].isChecked) {
                column.cells[i].isChecked = true;
            }
        }
        else {
            column.cells[i].isChecked = !column.cells[i].isChecked;
        }
    }
    constructor(model) {
        this.model = model;
    }
    ngOnInit() { }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StiTableColumnComponent, deps: [{ token: i1.StiModelService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: StiTableColumnComponent, selector: "sti-table-column-component", inputs: { column: "column", index: "index", element: "element" }, ngImport: i0, template: `
    <sti-table-label-component
      *ngIf="column && column.type == 'LabelColumn'"
      [item]="column"
      [disabled]="element?.readOnly"
      [style.text-align]="getColumnAlignment(column)"
      [index]="index"
      [object]="element"
      [style.overflow]="'hidden'"
      [style.width]="'100%'"
    ></sti-table-label-component>
    <sti-table-input-text-component
      *ngIf="column && column.type == 'TextBoxColumn'"
      [item]="column"
      [disabled]="element?.readOnly"
      [index]="index"
      [object]="element"
      [style.overflow]="'hidden'"
      [style.width]="'100%'"
    ></sti-table-input-text-component>
    <sti-table-radio-button-component
      *ngIf="column && column.type == 'RadioButtonColumn'"
      [item]="column"
      [alignment]="getColumnAlignment(column)"
      [disabled]="element?.readOnly"
      [index]="index"
      [object]="element"
      (buttonClick)="changeState(column, index)"
      [style.width]="'100%'"
    ></sti-table-radio-button-component>
    <sti-number-component
      *ngIf="column && column.type == 'NumberBoxColumn'"
      [element]="column"
      [index]="index"
      [table]="element"
      [style.width]="'100%'"
      [style.overflow]="'hidden'"
    ></sti-number-component>
    <sti-table-combobox-component
      *ngIf="column && column.type == 'ComboBoxColumn'"
      [item]="column"
      [disabled]="element?.readOnly"
      [index]="index"
      [object]="element"
      [style.width]="'100%'"
      [style.overflow]="'hidden'"
    ></sti-table-combobox-component>
    <sti-table-checkbox-component
      *ngIf="column && column.type == 'CheckBoxColumn'"
      [item]="column"
      [disabled]="element?.readOnly"
      [object]="element"
      [alignment]="getColumnAlignment(column)"
      [index]="index"
      (buttonClick)="changeState(column, index)"
      [style.width]="'100%'"
    ></sti-table-checkbox-component>
  `, isInline: true, styles: [""], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.StiNumberComponent, selector: "sti-number-component", inputs: ["element", "index", "table"] }, { kind: "component", type: i4.StiTableInputTextComponent, selector: "sti-table-input-text-component", inputs: ["item", "index", "object", "disabled", "isClone"] }, { kind: "component", type: i5.StiTableRadioButtonComponent, selector: "sti-table-radio-button-component", inputs: ["item", "index", "disabled", "isClone", "object", "alignment"], outputs: ["buttonClick"] }, { kind: "component", type: i6.StiTableComboboxComponent, selector: "sti-table-combobox-component", inputs: ["item", "index", "object", "disabled", "isClone"] }, { kind: "component", type: i7.StiTableCheckboxComponent, selector: "sti-table-checkbox-component", inputs: ["item", "index", "object", "disabled", "isClone", "alignment"], outputs: ["buttonClick"] }, { kind: "component", type: i8.StiTableLabelComponent, selector: "sti-table-label-component", inputs: ["item", "index", "object", "disabled", "isClone"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: StiTableColumnComponent, decorators: [{
            type: Component,
            args: [{ selector: "sti-table-column-component", template: `
    <sti-table-label-component
      *ngIf="column && column.type == 'LabelColumn'"
      [item]="column"
      [disabled]="element?.readOnly"
      [style.text-align]="getColumnAlignment(column)"
      [index]="index"
      [object]="element"
      [style.overflow]="'hidden'"
      [style.width]="'100%'"
    ></sti-table-label-component>
    <sti-table-input-text-component
      *ngIf="column && column.type == 'TextBoxColumn'"
      [item]="column"
      [disabled]="element?.readOnly"
      [index]="index"
      [object]="element"
      [style.overflow]="'hidden'"
      [style.width]="'100%'"
    ></sti-table-input-text-component>
    <sti-table-radio-button-component
      *ngIf="column && column.type == 'RadioButtonColumn'"
      [item]="column"
      [alignment]="getColumnAlignment(column)"
      [disabled]="element?.readOnly"
      [index]="index"
      [object]="element"
      (buttonClick)="changeState(column, index)"
      [style.width]="'100%'"
    ></sti-table-radio-button-component>
    <sti-number-component
      *ngIf="column && column.type == 'NumberBoxColumn'"
      [element]="column"
      [index]="index"
      [table]="element"
      [style.width]="'100%'"
      [style.overflow]="'hidden'"
    ></sti-number-component>
    <sti-table-combobox-component
      *ngIf="column && column.type == 'ComboBoxColumn'"
      [item]="column"
      [disabled]="element?.readOnly"
      [index]="index"
      [object]="element"
      [style.width]="'100%'"
      [style.overflow]="'hidden'"
    ></sti-table-combobox-component>
    <sti-table-checkbox-component
      *ngIf="column && column.type == 'CheckBoxColumn'"
      [item]="column"
      [disabled]="element?.readOnly"
      [object]="element"
      [alignment]="getColumnAlignment(column)"
      [index]="index"
      (buttonClick)="changeState(column, index)"
      [style.width]="'100%'"
    ></sti-table-checkbox-component>
  ` }]
        }], ctorParameters: () => [{ type: i1.StiModelService }], propDecorators: { column: [{
                type: Input
            }], index: [{
                type: Input
            }], element: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 