import { defineComponent, ref, useSlots, inject, resolveComponent, createBlock, openBlock, mergeProps, toHandlers, unref, createSlots, withCtx, renderSlot, normalizeProps, guardReactiveProps, createCommentVNode } from 'vue';
import '../../../../utils/index.mjs';
import { TableCtxKey } from '../../../../constants/table.mjs';
import { elTableV2Emits, tableV2Emits, tableV2Props } from './tableV2.mjs';
import { getGmEvent } from '../../../../utils/src/elementPlus/event.mjs';
import { getGmExports } from '../../../../utils/src/elementPlus/exports.mjs';

var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{
    name: "GmTableV2"
  },
  __name: "TableV2",
  props: tableV2Props,
  emits: tableV2Emits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const elRef = ref();
    const slots = useSlots();
    const tableCtx = inject(TableCtxKey);
    const props = __props;
    if (tableCtx && tableCtx.tableId === props.tableId) {
      tableCtx.tableV2Ref = elRef;
    }
    const emit = __emit;
    const elEvents = getGmEvent(elTableV2Emits, emit);
    const exposeEvents = ["scrollTo", "scrollToLeft", "scrollToTop", "scrollToRow"];
    const { exposeFns } = getGmExports(elRef, exposeEvents);
    __expose({
      elRef,
      ...exposeFns
    });
    return (_ctx, _cache) => {
      const _component_el_table_v2 = resolveComponent("el-table-v2");
      return openBlock(), createBlock(
        _component_el_table_v2,
        mergeProps({
          ref_key: "elRef",
          ref: elRef
        }, props, toHandlers(unref(elEvents))),
        createSlots({
          _: 2
          /* DYNAMIC */
        }, [
          unref(slots).cell ? {
            name: "cell",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "cell")
            ]),
            key: "0"
          } : void 0,
          unref(slots).header ? {
            name: "header",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "header")
            ]),
            key: "1"
          } : void 0,
          unref(slots).headerCell ? {
            name: "headerCell",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "headerCell")
            ]),
            key: "2"
          } : void 0,
          unref(slots).row ? {
            name: "row",
            fn: withCtx((slotValue) => [
              renderSlot(_ctx.$slots, "row", normalizeProps(guardReactiveProps(slotValue)))
            ]),
            key: "3"
          } : void 0,
          unref(slots).footer ? {
            name: "footer",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "footer")
            ]),
            key: "4"
          } : void 0,
          unref(slots).empty ? {
            name: "empty",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "empty")
            ]),
            key: "5"
          } : void 0,
          unref(slots).overlay ? {
            name: "overlay",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "overlay"),
              createCommentVNode(' <VNodeRenderer :vnode="slots.overlay?.().children?.[0]" /> ')
            ]),
            key: "6"
          } : void 0
        ]),
        1040
        /* FULL_PROPS, DYNAMIC_SLOTS */
      );
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=TableV2.vue2.mjs.map
