epic-designer
Version:
基于vue3的设计器,可视化开发页面表单
94 lines (93 loc) • 3.06 kB
JavaScript
import { defineComponent as w, useSlots as T, ref as h, computed as v, provide as k, createElementBlock as V, openBlock as b, createElementVNode as a, createVNode as c, unref as x, withCtx as B, withDirectives as N, vShow as S } from "vue";
/* empty css */
import U from "../icon/icon.vue.js";
/* empty css */
/* empty css */
import { pluginManager as D } from "../../../../manager/src/pluginManager.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";
/* empty css */
import I from "./treeNodes.vue.js";
import { TREE_CONTEXT_KEY as $ } from "./useTreeContext.js";
const L = { class: "epic-tree flex h-full flex-col" }, M = { class: "epic-search-box px-10px py-6px" }, O = { class: "epic-tree-main h-0 flex-1 overflow-auto" }, P = { class: "pt-42px text-center text-gray-400" }, Z = /* @__PURE__ */ w({
name: "ETree",
__name: "tree",
props: {
draggable: { type: Boolean, default: !1 },
hoverKey: { default: "" },
options: { default: () => [] },
selectedKeys: { default: () => [] }
},
emits: ["update:selectedKeys", "nodeClick"],
setup(_, { emit: y }) {
const n = _, i = y, g = T(), K = D.component.get("input"), l = h(""), E = h([]), p = v({
get() {
return n.selectedKeys;
},
set(o) {
i("update:selectedKeys", o);
}
}), r = v({
get() {
return d(n.options, l.value);
},
set() {
}
});
function d(o, e) {
const t = [];
return o.forEach((s) => {
var u;
if ((u = s.label) != null && u.includes(e))
t.push(s);
else if (s.children) {
const m = d(s.children, e);
if (m.length > 0) {
const f = { ...s };
f.children = m, t.push(f);
}
}
}), t;
}
function C(o, e) {
p.value = [o], i("nodeClick", { componentSchema: e, id: o });
}
return k($, {
expandedKeys: E,
handleSelect: C,
selectedKeys: p,
slots: g,
treeProps: n
}), (o, e) => (b(), V("div", L, [
a("div", M, [
c(x(K), {
modelValue: l.value,
"onUpdate:modelValue": e[0] || (e[0] = (t) => l.value = t),
value: l.value,
"onUpdate:value": e[1] || (e[1] = (t) => l.value = t),
placeholder: "搜索节点",
clearable: "",
"allow-clear": ""
}, {
prefix: B(() => [
c(x(U), { name: "icon--epic--search-rounded" })
]),
_: 1
}, 8, ["modelValue", "value"])
]),
a("div", O, [
c(I, {
schemas: r.value,
"onUpdate:schemas": e[2] || (e[2] = (t) => r.value = t)
}, null, 8, ["schemas"]),
N(a("div", P, " 没有查询到的数据 ", 512), [
[S, r.value.length === 0]
])
])
]));
}
});
export {
Z as default
};