snowy-designer
Version:
基于Epic-Designer-Pro版本的设计器,可视化开发页面表单
138 lines (137 loc) • 5.41 kB
JavaScript
import { defineComponent as A, inject as c, computed as k, resolveComponent as E, createElementBlock as m, createCommentVNode as u, openBlock as n, Fragment as y, normalizeClass as b, createElementVNode as C, toDisplayString as I, createBlock as f, unref as a, createVNode as h, createTextVNode as D, withModifiers as T, withCtx as F, renderList as j, nextTick as z } from "vue";
/* empty css */
import S from "../../../../../base-ui/src/components/icon/icon.vue.js";
import "radix-vue";
import "clsx";
import "tailwind-merge";
import "lucide-vue-next";
import "../../../../../base-ui/src/shadch-ui/button/index.js";
import "@vueuse/core";
import "../../../../../base-ui/src/shadch-ui/toast/index.js";
import G from "../../../../../base-ui/src/components/node/node.vue.js";
import { setValueByPath as g, getValueByPath as L } from "../../../../../../utils/src/common/data.js";
import "../../../../../../hooks/src/store/index.js";
import "lodash";
import "../../../../../../utils/src/manager/pluginManager.js";
import "monaco-editor";
import "../../../../../../utils/src/request/index.js";
import "vuedraggable";
import M from "./collapse.vue.js";
const U = ["title"], q = { class: "flex items-center" }, H = { key: 1 }, se = /* @__PURE__ */ A({
name: "EAttributeItem",
__name: "attributeItem",
props: {
nodeSchema: {}
},
setup(_) {
const e = _, l = c("dataTable"), V = c("revoke"), w = c("designer"), B = c("componentAttributes"), v = c("handleDataConfig"), x = c("removeBind"), s = k(() => w.state.selectedNode);
function N(o, t = null, d, i = s.value) {
typeof d.onChange == "function" && d.onChange({
componentAttributes: B,
tableJson: l == null ? void 0 : l.value,
value: o,
values: i
}), t !== null && (d.changeSync ? g(i, t, o) : z(() => {
g(i, t, o);
}), V.push("编辑组件属性"));
}
function P(o) {
var t;
return typeof o.show == "boolean" ? o.show : typeof o.show == "function" ? (t = o.show) == null ? void 0 : t.call(o, {
tableJson: l == null ? void 0 : l.value,
values: s.value
}) : !0;
}
const $ = () => {
if (!e.nodeSchema.field)
return null;
const o = e.nodeSchema.editData ?? s.value, t = e.nodeSchema.field;
return L(o, t);
}, p = k(() => {
const o = s.value;
return !o || !o.dataSource ? !1 : o.dataSource.some((t) => t.field === e.nodeSchema.field);
});
return (o, t) => {
var i;
const d = E("EAttributeItem");
return P(e.nodeSchema) ? (n(), m(y, { key: 0 }, [
e.nodeSchema.isGroup ? (n(), m("div", H, [
h(M, {
title: e.nodeSchema.label
}, {
default: F(() => [
(n(!0), m(y, null, j(e.nodeSchema.children, (r) => (n(), f(d, {
key: r.field,
"node-schema": r
}, null, 8, ["node-schema"]))), 128))
]),
_: 1
}, 8, ["title"])
])) : (n(), m("div", {
key: 0,
class: b(["epic-attr-item", e.nodeSchema.layout])
}, [
e.nodeSchema.label ? (n(), m("div", {
key: 0,
class: "epic-attr-label",
title: e.nodeSchema.label
}, I(e.nodeSchema.label), 9, U)) : u("", !0),
C("div", {
class: b(["epic-attr-input", { "block!": e.nodeSchema.layout === "vertical" }])
}, [
p.value ? u("", !0) : (n(), f(a(G), {
key: 0,
"component-schema": {
...e.nodeSchema,
componentProps: {
...e.nodeSchema.componentProps,
...e.nodeSchema.field === "componentProps.defaultValue" ? (i = s.value) == null ? void 0 : i.componentProps : {},
input: !1,
label: "",
field: void 0,
hidden: !1
},
show: !0,
noFormItem: !0
},
"model-value": $(),
"onUpdate:modelValue": t[0] || (t[0] = (r) => N(
r,
e.nodeSchema.field,
e.nodeSchema,
e.nodeSchema.editData
))
}, null, 8, ["component-schema", "model-value"])),
e.nodeSchema.bindable && !p.value ? (n(), f(a(S), {
key: 1,
class: "ml-2 cursor-pointer",
name: "icon--epic--link-03",
onClick: t[1] || (t[1] = (r) => a(v)(e.nodeSchema))
})) : u("", !0),
p.value ? (n(), m("div", {
key: 2,
class: "rounded-1 flex cursor-pointer items-center p-1",
onClick: t[3] || (t[3] = (r) => a(v)(e.nodeSchema))
}, [
C("span", q, [
h(a(S), {
class: "mr-1",
name: "icon--epic--link-03"
}),
t[4] || (t[4] = D(" 查看关联 "))
]),
h(a(S), {
class: "hover:color-#f22 ml-2",
name: "icon--epic--delete-outline-rounded",
onClick: t[2] || (t[2] = T((r) => a(x)(e.nodeSchema), ["stop"]))
})
])) : u("", !0)
], 2)
], 2))
], 64)) : u("", !0);
};
}
});
export {
se as default
};