"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const comp = require("../../ui/src/comp.js");
const column = require("./column.js");
const util = require("./util.js");
const cell = require("./cell.js");
const VxeColgroupComponent = comp.defineVxeComponent({
  name: "VxeColgroup",
  props: column.columnProps,
  setup(props, { slots }) {
    const refElem = vue.ref();
    const $xeTable = vue.inject("$xeTable", null);
    const $xeParentColgroup = vue.inject("$xeColgroup", null);
    if (!$xeTable) {
      return () => vue.createCommentVNode();
    }
    const columnConfig = cell.Cell.createColumn($xeTable, props);
    const columnSlots = {};
    if (slots.header) {
      columnSlots.header = slots.header;
    }
    columnConfig.slots = columnSlots;
    columnConfig.children = [];
    util.watchColumn($xeTable, props, columnConfig);
    vue.onMounted(() => {
      const elem = refElem.value;
      if (elem) {
        util.assembleColumn($xeTable, elem, columnConfig, $xeParentColgroup);
      }
    });
    vue.onUnmounted(() => {
      util.destroyColumn($xeTable, columnConfig);
    });
    const renderVN = () => {
      return vue.h("div", {
        ref: refElem
      }, slots.default ? slots.default() : []);
    };
    const $xeColgroup = { columnConfig };
    vue.provide("$xeColgroup", $xeColgroup);
    vue.provide("$xeGrid", null);
    vue.provide("$xeGantt", null);
    return renderVN;
  }
});
exports.default = VxeColgroupComponent;
