import { defineComponent, inject, ref, useSlots, resolveComponent, createBlock, openBlock, mergeProps, toHandlers, unref, createSlots, withCtx, renderSlot } from 'vue';
import '../../../../utils/index.mjs';
import { TableCtxKey } from '../../../../constants/table.mjs';
import { elTableEmits, tableEmits, tableProps } from './table.mjs';
import { getGmEvent } from '../../../../utils/src/elementPlus/event.mjs';
import { getGmExports } from '../../../../utils/src/elementPlus/exports.mjs';

var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{
    name: "GmTable"
  },
  __name: "Table",
  props: tableProps,
  emits: tableEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const tableCtx = inject(TableCtxKey);
    const elRef = ref();
    const slots = useSlots();
    const props = __props;
    if (tableCtx && tableCtx.tableId === props.tableId) {
      tableCtx.tableRef = elRef;
    }
    const emit = __emit;
    const elEvents = getGmEvent(elTableEmits, emit);
    const exposeEvents = [
      "clearSelection",
      "getSelectionRows",
      "toggleRowSelection",
      "toggleAllSelection",
      "toggleRowExpansion",
      "setCurrentRow",
      "setChecked",
      "clearSort",
      "clearFilter",
      "doLayout",
      "sort",
      "scrollTo",
      "setScrollTop",
      "setScrollLeft"
    ];
    const { exposeFns } = getGmExports(elRef, exposeEvents);
    __expose({
      elRef,
      ...exposeFns
    });
    return (_ctx, _cache) => {
      const _component_el_table = resolveComponent("el-table");
      return openBlock(), createBlock(
        _component_el_table,
        mergeProps({
          ref_key: "elRef",
          ref: elRef
        }, props, toHandlers(unref(elEvents))),
        createSlots({
          _: 2
          /* DYNAMIC */
        }, [
          unref(slots).default ? {
            name: "default",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "default")
            ]),
            key: "0"
          } : void 0,
          unref(slots).append ? {
            name: "append",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "append")
            ]),
            key: "1"
          } : void 0,
          unref(slots).empty ? {
            name: "empty",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "empty")
            ]),
            key: "2"
          } : void 0
        ]),
        1040
        /* FULL_PROPS, DYNAMIC_SLOTS */
      );
    };
  }
});

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