/**
 * tdesign v0.32.0
 * (c) 2021 tdesign
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var Vue = require('vue');
var config = require('../../config.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);

var TableColGroup = Vue__default["default"].extend({
  name: "".concat(config.prefix, "-table-col-group"),
  props: {
    columns: {
      type: Array,
      "default": function _default() {
        return [];
      }
    }
  },
  methods: {
    renderColgroup: function renderColgroup() {
      var h = this.$createElement;
      var columns = this.columns;
      var colgroup = [];
      columns.forEach(function (column) {
        var width = column.width,
            minWidth = column.minWidth,
            colKey = column.colKey;
        var style = {};

        if (width) {
          style.width = isNaN(width) ? width : "".concat(width, "px");
        }

        if (minWidth) {
          if (!width) {
            style.width = "".concat(minWidth, "px");
          }

          style.minWidth = "".concat(minWidth, "px");
        }

        colgroup.push(h("col", {
          "key": colKey,
          "style": style
        }));
      });
      return colgroup;
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("colgroup", [this.renderColgroup()]);
  }
});

exports["default"] = TableColGroup;
//# sourceMappingURL=col-group.js.map
