epic-designer-dev
Version:
基于vue3的设计器,可视化开发页面表单。在epic-designer的基础上新增了字典选择器
58 lines (57 loc) • 2.48 kB
JavaScript
import { defineComponent as h, inject as l, computed as v, createElementBlock as N, openBlock as p, createVNode as k, unref as e, withCtx as x, createElementVNode as i, withModifiers as m, normalizeClass as C, createBlock as S, createCommentVNode as M, createTextVNode as b, toDisplayString as u } from "vue";
/* empty css */
import w from "../../../../base-ui/src/icon/icon.vue2.js";
import "@vueuse/core";
import "../../../../../hooks/src/store/index.js";
import { pluginManager as B } from "../../../../../utils/src/manager/pluginManager.js";
import V from "../../../../base-ui/src/tree/tree.vue2.js";
const $ = { class: "epic-outline" }, E = ["onMouseenter"], H = { class: "max-w-full truncate" }, P = { class: "epic-node-type-text w-0 flex-1 truncate" }, G = /* @__PURE__ */ h({
__name: "outline",
setup(T) {
const f = l("pageSchema"), o = l("designer"), _ = v(() => {
var s;
const n = (s = o.state.selectedNode) == null ? void 0 : s.id;
return n ? [n] : [];
});
function y(n) {
o.setSelectedNode(n.componentSchema);
}
return (n, s) => {
var r;
return p(), N("div", $, [
k(e(V), {
options: e(f).schemas,
draggable: "",
"selected-keys": _.value,
"hover-key": ((r = e(o).state.hoverNode) == null ? void 0 : r.id) ?? "",
onNodeClick: y
}, {
"tree-node": x(({ schema: t }) => {
var d, c, a;
return [
i("div", {
class: C(["epic-text-padding flex", { hidden: (d = t.componentProps) == null ? void 0 : d.hidden }]),
onMouseenter: m((g) => e(o).setHoverNode(t), ["stop"]),
onMouseleave: s[0] || (s[0] = m((g) => e(o).setHoverNode(null), ["stop"]))
}, [
i("span", H, [
(c = t.componentProps) != null && c.hidden ? (p(), S(e(w), {
key: 0,
name: "icon--epic--visibility-off-outline-rounded",
class: "translate-y-2px"
})) : M("", !0),
b(" " + u(t.label ?? ((a = e(B).getComponentConfingByType(t.type)) == null ? void 0 : a.defaultSchema.label)), 1)
]),
i("span", P, u(t.id), 1)
], 42, E)
];
}),
_: 1
}, 8, ["options", "selected-keys", "hover-key"])
]);
};
}
});
export {
G as default
};