import { omit as b } from "lodash-unified";
import { ref as T, defineComponent as g, h as a, render as s, onUnmounted as C } from "vue";
import "../../../config-provider/index.mjs";
import "../table-modal.vue.mjs";
import { ConfigProvider as y, globalConfigCached as A } from "../../../config-provider/config-provider.mjs";
import h from "../table-modal.vue2.mjs";
function _(r) {
  let t = !0;
  const c = document.body, e = T(), { destroyOnUnmounted: d = !0 } = r, o = document.createElement("div"), u = () => {
    const n = g({
      setup() {
        return () => a(
          y,
          { ...A.value },
          a(h, {
            ...b(r, "destroyOnUnmounted"),
            ref: e
          })
        );
      }
    });
    c.appendChild(o), s(a(n), o), t = !1;
  }, l = () => {
    e.value?.close(), t || setTimeout(() => {
      s(null, o), o.parentElement?.removeChild(o), t = !0;
    }, 400);
  }, i = async (n = [], v = {}) => (e.value || u(), e.value?.open(n, v)), m = () => {
    t || e.value?.close();
  }, p = () => {
    e.value?.getApTableInstance()?.submit();
  }, f = () => {
    e.value?.getApTableInstance()?.reset();
  };
  return C(() => {
    d && l();
  }), {
    openModal: i,
    closeModal: m,
    destroy: l,
    reloadApTableData: p,
    resetApTableData: f,
    getApTableInstance: () => e.value?.getApTableInstance(),
    isDestroyed: t
  };
}
export {
  _ as useCreateTableModal
};
