epic-designer-cjh
Version:
基于vue3的设计器,可视化开发页面表单
37 lines (36 loc) • 1.07 kB
JavaScript
import { inject as c, ref as s, computed as a, onMounted as t, watch as f, toRef as I, onUnmounted as h } from "vue";
import { b0 as m, b1 as w, bi as y } from "./index-97ce4605.js";
const U = () => {
const o = c(m, void 0), u = c(w, void 0);
return {
form: o,
formItem: u
};
}, j = (o, {
formItemContext: u,
disableIdGeneration: n,
disableIdManagement: i
}) => {
n || (n = s(!1)), i || (i = s(!1));
const v = s();
let e;
const p = a(() => {
var l;
return !!(!o.label && u && u.inputIds && ((l = u.inputIds) == null ? void 0 : l.length) <= 1);
});
return t(() => {
e = f([I(o, "id"), n], ([l, r]) => {
const d = l ?? (r ? void 0 : y().value);
d !== v.value && (u != null && u.removeInputId && (v.value && u.removeInputId(v.value), !(i != null && i.value) && !r && d && u.addInputId(d)), v.value = d);
}, { immediate: !0 });
}), h(() => {
e && e(), u != null && u.removeInputId && v.value && u.removeInputId(v.value);
}), {
isLabeledByFormItem: p,
inputId: v
};
};
export {
j as a,
U as u
};