UNPKG

epic-designer

Version:

基于vue3的设计器,可视化开发页面表单

81 lines (80 loc) 2.99 kB
import { defineComponent as D, computed as c, createBlock as i, createElementBlock as l, unref as g, openBlock as a, mergeProps as T, withCtx as V, Fragment as f, renderList as h, normalizeClass as N } from "vue"; import { VueDraggable as P } from "vue-draggable-plus"; /* empty css */ /* empty css */ /* empty css */ import { pluginManager as b } from "../../../../manager/src/pluginManager.js"; /* empty css */ import v from "./treeNodeItem.vue.js"; import { useTreeContext as E } from "./useTreeContext.js"; import "../../../../git/epic/epic-designer/node_modules/.pnpm/jsep@1.4.0/node_modules/jsep/dist/jsep.js"; import "@vueuse/core"; import "../../../../hooks/src/store/index.js"; import { useDesignerContext as I } from "../../../../hooks/src/designer/useDesignerContext.js"; const w = { key: 1 }, Q = /* @__PURE__ */ D({ name: "ETreeNodes", __name: "treeNodes", props: { parentSchema: {}, schemas: {} }, emits: ["update:schemas"], setup(C, { emit: y }) { const d = C, k = y, m = I(), p = m.pageSchema, S = E().treeProps, o = c({ get() { return d.schemas; }, set(e) { k("update:schemas", e); } }); function x(e) { e !== void 0 && (m.setDisabledHover(!0), m.setSelectedNode(o.value[e])); } function _(e) { var t, n, s; return e.id === ((t = p.schemas[0]) == null ? void 0 : t.id) || (s = (n = b.component.getConfigByType(e.type)) == null ? void 0 : n.editConstraints) != null && s.immovable ? "node-drag-disabled" : "node-drag-enabled"; } const B = c(() => { var e, t; return !S.draggable || ((e = o.value[0]) == null ? void 0 : e.id) === ((t = p.schemas[0]) == null ? void 0 : t.id); }); return (e, t) => { var n, s, u; return (u = (s = g(b).component.getConfigByType(((n = d.parentSchema) == null ? void 0 : n.type) || "")) == null ? void 0 : s.editConstraints) != null && u.childImmovable ? (a(), l("ul", w, [ (a(!0), l(f, null, h(o.value, (r) => (a(), i(v, { key: r.id, schema: r }, null, 8, ["schema"]))), 128)) ])) : (a(), i(g(P), T({ key: 0, modelValue: o.value, "onUpdate:modelValue": t[0] || (t[0] = (r) => o.value = r), "item-key": "id", "component-data": {}, class: "epic-draggable-range" }, { animation: 200, tag: "ul", group: "tree-draggable", ghostClass: "moveing", draggable: ".node-drag-enabled", disabled: B.value }, { onStart: t[1] || (t[1] = (r) => x(r.oldIndex)) }), { default: V(() => [ (a(!0), l(f, null, h(o.value, (r) => (a(), i(v, { key: r.id, class: N(_(r)), schema: r }, null, 8, ["class", "schema"]))), 128)) ]), _: 1 }, 16, ["modelValue"])); }; } }); export { Q as default };