UNPKG

@aplus-frontend/ui

Version:

49 lines (48 loc) 1.42 kB
import { ref as b, defineComponent as T, h as a, render as s, onUnmounted as g } from "vue"; import "../table-modal.vue.mjs"; import "../../../config-provider/index.mjs"; import { omit as C } from "lodash-unified"; 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 = b(), { destroyOnUnmounted: d = !0 } = r, o = document.createElement("div"), u = () => { const n = T({ setup() { return () => a( y, { ...A.value }, a(h, { ...C(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 g(() => { d && l(); }), { openModal: i, closeModal: m, destroy: l, reloadApTableData: p, resetApTableData: f, getApTableInstance: () => e.value?.getApTableInstance(), isDestroyed: t }; } export { _ as useCreateTableModal };