var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { MapToComponentField, VegaSlimmer } from 'vega-slimmer/core';
import { h } from '@stencil/core';
import { isBreakpointsTokenType } from '../../../../types/type-guard';
export class VegaTableColGroupRenderer extends VegaSlimmer {
  constructor() {
    super(...arguments);
    this.getColResponsiveClass = (column) => {
      return column.breakpoint && isBreakpointsTokenType(column.breakpoint)
        ? `v-hidden ${column.breakpoint}:v-table-column`
        : '';
    };
  }
  render() {
    return (h("colgroup", null,
      h("col", { style: { minWidth: this.paddingX[0], width: this.paddingX[0] } }),
      this.vegaTableRowSelectionController.getRowSelectionType() === 'multiple' && (h("col", { style: { minWidth: '40px', width: '40px' } })),
      this.columnStructureModel
        .generateColumnConfigByLeaves(this.columns)
        .map((column) => {
        if (column) {
          const responsiveClass = this.getColResponsiveClass(column);
          return (h("col", { class: responsiveClass, style: { width: column.width ? column.width : null } }));
        }
        else {
          return h("col", null);
        }
      }),
      this.rowExpandable && h("col", { style: { minWidth: '40px', width: '40px' } }),
      h("col", { style: { minWidth: this.paddingX[1], width: this.paddingX[1] } })));
  }
}
__decorate([
  MapToComponentField()
], VegaTableColGroupRenderer.prototype, "paddingX", void 0);
__decorate([
  MapToComponentField()
], VegaTableColGroupRenderer.prototype, "columnStructureModel", void 0);
__decorate([
  MapToComponentField()
], VegaTableColGroupRenderer.prototype, "columns", void 0);
__decorate([
  MapToComponentField()
], VegaTableColGroupRenderer.prototype, "rowExpandable", void 0);
__decorate([
  MapToComponentField()
], VegaTableColGroupRenderer.prototype, "vegaTableRowSelectionController", void 0);
