import { defineComponent, inject, createVNode } from 'vue';
import { provideKey } from '../const';

var colgroup = defineComponent({
  props: {
    columns: {
      type: Array,
      required: true
    }
  },
  setup(props) {
    const {
      layout
    } = inject(provideKey);
    const renderColgroup = columns => createVNode("colgroup", null, [columns.map(column => {
      var _layout$widthMap$valu, _layout$widthMap$valu2;
      const width = (_layout$widthMap$valu = layout.widthMap.value[column.id]) === null || _layout$widthMap$valu === void 0 ? void 0 : _layout$widthMap$valu.width;
      const minWidth = (_layout$widthMap$valu2 = layout.widthMap.value[column.id]) === null || _layout$widthMap$valu2 === void 0 ? void 0 : _layout$widthMap$valu2.minWidth;
      return createVNode("col", {
        "key": column.id,
        "style": [width && {
          width: `${width}px`
        }, minWidth && {
          minWidth: `${minWidth}px`
        }]
      }, null);
    })]);
    return () => renderColgroup(props.columns);
  }
});

export { colgroup as default };
