var _a;
import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Emit, Prop } from 'vue-property-decorator';
import { Enums } from '../../../utils/enums/enums';
import { ModulVue } from '../../../utils/vue/vue';
import { TABLE_EMPTY_ROW_NAME, TABLE_GROUP_HEADER_NAME, TABLE_GROUP_NAME } from '../../component-names';
import { getCellAlignmentClass, getCellWidthStyle, MTableColspan, MTableRowsStyle } from '../responsive-table-commons';
import { MTableEmptyRow } from '../table-empty-row/table-empty-row';
import { MTableGroupHeader } from '../table-group-header/table-group-header';
import { MTableGroupMixin } from './table-group-mixin';
import WithRender from './table-group.html?style=./table-group.scss';
var MTableGroup = /** @class */ (function (_super) {
    __extends(MTableGroup, _super);
    function MTableGroup() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MTableGroup.prototype.emitEmptyButtonClick = function (rowsGroup) { };
    MTableGroup.prototype.getRowClassName = function (row, columnid) {
        return row.cells &&
            row.cells[columnid] &&
            row.cells[columnid].className
            ? row.cells[columnid].className
            : undefined;
    };
    MTableGroup.prototype.getRowColspan = function (row, column) {
        var colspan = row.cells &&
            row.cells[column.id] &&
            row.cells[column.id].colspan
            ? row.cells[column.id].colspan
            : undefined;
        return colspan === MTableColspan.AllColumns
            ? this.as().totalColumnsLength
            : colspan;
    };
    MTableGroup.prototype.getRowspan = function (row, column) {
        return row.cells &&
            row.cells[column.id] &&
            row.cells[column.id].rowspan
            ? row.cells[column.id].rowspan
            : undefined;
    };
    MTableGroup.prototype.getRowAlignmentClass = function (row, column) {
        if (row.cells && row.cells[column.name] && row.cells[column.name].textAlign) {
            return getCellAlignmentClass(row.cells[column.name].textAlign);
        }
        return getCellAlignmentClass(column.textAlign);
    };
    MTableGroup.prototype.getRowWidthStyle = function (column) {
        return getCellWidthStyle(column);
    };
    MTableGroup.prototype.isCellHeader = function (row, columnName) {
        return Boolean(row.cells && row.cells[columnName] && row.cells[columnName].isHeader);
    };
    __decorate([
        Prop({
            default: MTableRowsStyle.AlternateBackground,
            validator: function (value) {
                return Enums.toValueArray(MTableRowsStyle).includes(value);
            }
        })
    ], MTableGroup.prototype, "rowsStyle", void 0);
    __decorate([
        Prop({
            default: true
        })
    ], MTableGroup.prototype, "rowHighlightedOnHover", void 0);
    __decorate([
        Prop({
            default: 0
        })
    ], MTableGroup.prototype, "horizontalScrollOffset", void 0);
    __decorate([
        Prop({
            default: '100%'
        })
    ], MTableGroup.prototype, "tableComponentWidth", void 0);
    __decorate([
        Emit('empty-button-click')
    ], MTableGroup.prototype, "emitEmptyButtonClick", null);
    MTableGroup = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[TABLE_GROUP_HEADER_NAME] = MTableGroupHeader,
                _a[TABLE_EMPTY_ROW_NAME] = MTableEmptyRow,
                _a),
            mixins: [MTableGroupMixin]
        })
    ], MTableGroup);
    return MTableGroup;
}(ModulVue));
export { MTableGroup };
var TableGroupPlugin = {
    install: function (v) {
        v.prototype.$log.debug(TABLE_GROUP_NAME, 'plugin.install');
        v.component(TABLE_GROUP_NAME, MTableGroup);
    }
};
export default TableGroupPlugin;
//# sourceMappingURL=table-group.js.map