epic-designer
Version:
基于vue3的设计器,可视化开发页面表单
75 lines (74 loc) • 2.57 kB
JavaScript
import { defineComponent as x, inject as i, computed as g, createBlock as m, createElementBlock as u, unref as h, openBlock as s, mergeProps as D, withCtx as N, normalizeClass as P, Fragment as T, renderList as V } from "vue";
/* empty css */
import E from "vuedraggable";
import f from "./treeNodeItem.vue.js";
import "@vueuse/core";
import "../../../../hooks/src/store/index.js";
import { pluginManager as b } from "../../../../utils/src/manager/pluginManager.js";
const I = { key: 1 }, U = /* @__PURE__ */ x({
name: "ETreeNodes",
__name: "treeNodes",
props: {
parentSchema: {},
schemas: {}
},
emits: ["update:schemas"],
setup(v, { emit: y }) {
const l = v, C = y, d = i("designer"), c = i("pageSchema"), k = i("treeProps"), r = g({
get() {
return l.schemas;
},
set(e) {
C("update:schemas", e);
}
});
function S(e) {
d.setDisabledHover(!0), d.setSelectedNode(r.value[e]);
}
function _(e) {
var t, o, n;
return e.id === ((t = c.schemas[0]) == null ? void 0 : t.id) || (n = (o = b.getComponentConfingByType(e.type)) == null ? void 0 : o.editConstraints) != null && n.immovable ? "epic-unmover-item" : "epic-draggable-item";
}
const B = g(() => {
var e, t;
return !k.draggable || ((e = r.value[0]) == null ? void 0 : e.id) === ((t = c.schemas[0]) == null ? void 0 : t.id);
});
return (e, t) => {
var o, n, p;
return (p = (n = h(b).getComponentConfingByType(((o = l.parentSchema) == null ? void 0 : o.type) || "")) == null ? void 0 : n.editConstraints) != null && p.childImmovable ? (s(), u("ul", I, [
(s(!0), u(T, null, V(r.value, (a) => (s(), m(f, {
key: a.id,
schema: a
}, null, 8, ["schema"]))), 128))
])) : (s(), m(h(E), D({
key: 0,
modelValue: r.value,
"onUpdate:modelValue": t[0] || (t[0] = (a) => r.value = a),
"item-key": "id",
"component-data": {},
class: "epic-draggable-range"
}, {
animation: 200,
tag: "ul",
group: "tree-draggable",
ghostClass: "moveing",
draggable: ".epic-draggable-item",
disabled: B.value
}, {
onStart: t[1] || (t[1] = (a) => S(a.oldIndex))
}), {
item: N(({ element: a }) => [
(s(), m(f, {
key: a.id,
class: P(_(a)),
schema: a
}, null, 8, ["class", "schema"]))
]),
_: 1
}, 16, ["modelValue"]));
};
}
});
export {
U as default
};