@extclp/vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
63 lines (62 loc) • 1.45 kB
JavaScript
import { ref as R, getCurrentInstance as g, createVNode as A, render as c, createApp as M, nextTick as f, h as b, unref as H } from "vue";
import "./modal.vue.mjs";
import { isClient as _, noop as k } from "@vexip-ui/utils";
import { modalProps as w } from "./props.mjs";
import l from "./modal.vue2.mjs";
function E(p = {}) {
if (!_) return k;
const {
appContext: i,
loading: s,
renderer: m,
headerRenderer: v,
titleRenderer: C,
closeRenderer: x,
footerRenderer: h,
onHide: t,
...y
} = p, r = R(!1);
let n = g(), e = document.createElement("div"), o;
if (i || n) {
const u = A(d, null, null);
u.appContext = i || n.appContext, c(u, e);
} else
o = M(d), o.mount(e);
document.body.appendChild(e), f(() => {
r.value = !0;
});
function d() {
return b(
l,
{
...y,
active: r.value,
transfer: !1,
autoRemove: !1,
loading: H(s),
onHide: Array.isArray(t) ? [...t, a] : t ? [t, a] : a
},
{
header: v,
title: C,
close: x,
default: m,
footer: h
}
);
}
function a() {
n && (e && c(null, e), n = null), o && (o.unmount(), o = void 0), e && (document.body.removeChild(e), e = void 0);
}
return () => f(() => {
r.value = !1;
});
}
l.open = E;
const V = l;
export {
V as Modal,
w as modalProps,
E as useModal
};
//# sourceMappingURL=index.mjs.map