@coderlt/form-designer
Version:
基于vue3的设计器,可视化开发页面表单
66 lines (65 loc) • 1.52 kB
JavaScript
import { readonly as a, ref as o, onBeforeMount as v, onBeforeUnmount as g } from "vue";
import { i as h, h as C } from "./index-b826a2e2.js";
import { a as f, o as d } from "./delegate-6e021bb9.js";
const l = o(null);
function m(e) {
if (e.clientX > 0 || e.clientY > 0)
l.value = {
x: e.clientX,
y: e.clientY
};
else {
const { target: n } = e;
if (n instanceof Element) {
const { left: t, top: i, width: u, height: c } = n.getBoundingClientRect();
t > 0 || i > 0 ? l.value = {
x: t + u / 2,
y: i + c / 2
} : l.value = { x: 0, y: 0 };
} else
l.value = null;
}
}
let r = 0, w = !0;
function T() {
if (!h)
return a(o(null));
r === 0 && f("click", document, m, !0);
const e = () => {
r += 1;
};
return w && (w = C()) ? (v(e), g(() => {
r -= 1, r === 0 && d("click", document, m, !0);
})) : e(), a(l);
}
const x = o(void 0);
let s = 0;
function k() {
x.value = Date.now();
}
let p = !0;
function b(e) {
if (!h)
return a(o(!1));
const n = o(!1);
let t = null;
function i() {
t !== null && window.clearTimeout(t);
}
function u() {
i(), n.value = !0, t = window.setTimeout(() => {
n.value = !1;
}, e);
}
s === 0 && f("click", window, k, !0);
const c = () => {
s += 1, f("click", window, u, !0);
};
return p && (p = C()) ? (v(c), g(() => {
s -= 1, s === 0 && d("click", window, k, !0), d("click", window, u, !0), i();
})) : c(), a(n);
}
export {
b as a,
T as u
};