epic-designer
Version:
基于vue3的设计器,可视化开发页面表单
82 lines (81 loc) • 3.55 kB
JavaScript
import { defineComponent as C, watchEffect as $, computed as g, createElementBlock as r, openBlock as c, createElementVNode as l, createCommentVNode as D, unref as e, createVNode as v, createTextVNode as E, toDisplayString as h, Fragment as S, renderList as A } from "vue";
/* empty css */
import I from "../../../../base-ui/src/icon/icon.vue.js";
/* empty css */
/* empty css */
import { pluginManager as p } from "../../../../../manager/src/pluginManager.js";
import "../../../../../git/epic/epic-designer/node_modules/.pnpm/jsep@1.4.0/node_modules/jsep/dist/jsep.js";
import { useClipboard as V } from "@vueuse/core";
import "../../../../../hooks/src/store/index.js";
import { useDesignerContext as w } from "../../../../../hooks/src/designer/useDesignerContext.js";
import { useTableMeta as M } from "../../../../../hooks/src/designer/useTableMeta.js";
/* empty css */
import "vue-draggable-plus";
import z from "./modules/attributeItem.vue.js";
const B = { class: "epic-attr-item mb-2 mt-2 flex h-8 cursor-pointer items-center px-4" }, R = {
key: 0,
class: "epic-attr-item mb-2 flex h-8 cursor-pointer items-center px-4"
}, T = { class: "bg-$ep-secondary rounded-1 h-full flex-1 px-2 leading-8" }, Z = /* @__PURE__ */ C({
__name: "attribute",
setup(F) {
const o = w(), m = o.pageSchema, { copied: _, copy: x } = V();
$(() => {
_.value && p.global.$message.success("节点ID复制成功");
});
const y = p.component.getComponentConfigs(), s = g(() => o.state.selectedNode), u = M(p), N = g(() => {
var i, n, a;
if (!s.value || !s.value.type)
return [];
const t = [...((n = (i = y[s.value.type]) == null ? void 0 : i.config) == null ? void 0 : n.attribute) ?? []];
return s.value.id === ((a = m.schemas[0]) == null ? void 0 : a.id) && t.push(
{
editData: m,
field: "canvas.width",
label: "画布宽度",
type: "EInputSize"
},
{
editData: m,
field: "canvas.height",
label: "画布高度",
type: "EInputSize"
}
), t;
});
return (k, t) => {
var i, n, a, f;
return c(), r("div", {
key: (i = s.value) == null ? void 0 : i.id,
class: "epic-attribute-view"
}, [
l("div", B, [
l("div", {
class: "bg-$ep-secondary rounded-1 h-full flex-1 px-2 leading-8",
onClick: t[0] || (t[0] = (d) => {
var b;
return e(x)(((b = e(o).state.selectedNode) == null ? void 0 : b.id) ?? "");
})
}, [
v(e(I), {
class: "epic-component-icon translate-y-2px mr-1",
name: e(p).component.getIcon(e(o).state.selectedNode.type)
}, null, 8, ["name"]),
E(" " + h((n = e(o).state.selectedNode) == null ? void 0 : n.id), 1)
])
]),
(a = e(u)) != null && a.tableRemark && ((f = e(o).state.selectedNode) != null && f.input) ? (c(), r("div", R, [
t[1] || (t[1] = l("div", { class: "epic-attr-label" }, "数据表", -1)),
l("div", T, h(e(u).tableRemark), 1)
])) : D("", !0),
(c(!0), r(S, null, A(N.value, (d) => (c(), r("div", {
key: d.field
}, [
v(z, { schema: d }, null, 8, ["schema"])
]))), 128))
]);
};
}
});
export {
Z as default
};