snowy-designer
Version:
基于Epic-Designer-Pro版本的设计器,可视化开发页面表单
149 lines (148 loc) • 5.63 kB
JavaScript
import { defineComponent as B, inject as P, computed as d, provide as T, ref as O, createElementBlock as j, openBlock as m, createVNode as o, unref as l, withCtx as a, createBlock as f, createCommentVNode as V, createElementVNode as u, normalizeClass as E, createTextVNode as _, isRef as M } from "vue";
/* empty css */
import "radix-vue";
import "clsx";
import "tailwind-merge";
import "lucide-vue-next";
import "../../../../base-ui/src/shadch-ui/button/index.js";
import { useVModel as R } from "@vueuse/core";
import L from "../../../../base-ui/src/shadch-ui/select/EpSelect.vue2.js";
import h from "../../../../base-ui/src/shadch-ui/tabs/Tabs.vue2.js";
import g from "../../../../base-ui/src/shadch-ui/tabs/TabsContent.vue2.js";
import z from "../../../../base-ui/src/shadch-ui/tabs/TabsList.vue2.js";
import C from "../../../../base-ui/src/shadch-ui/tabs/TabsTrigger.vue2.js";
import "../../../../base-ui/src/shadch-ui/toast/index.js";
import { setValueByPath as N } from "../../../../../utils/src/common/data.js";
import "../../../../../hooks/src/store/index.js";
import "lodash";
import { pluginManager as s } from "../../../../../utils/src/manager/pluginManager.js";
import "monaco-editor";
import "../../../../../utils/src/request/index.js";
import "vuedraggable";
import D from "./options.vue.js";
const I = { class: "rounded bg-gray-50" }, A = { class: "p-2 pt-1" }, F = { class: "epic-attr-item" }, G = { class: "epic-attr-item" }, ve = /* @__PURE__ */ B({
__name: "index",
props: {
modelValue: {},
tree: { type: Boolean }
},
emits: ["update:modelValue"],
setup(U, { emit: $ }) {
const b = U, q = $;
s.loadDictList();
const x = P("designer"), i = d(() => x.state.selectedNode);
T("tree", b.tree);
const p = R(b, "modelValue", q), n = O(null), y = (t) => {
i.value && N(i.value, "componentProps.dictCode", t);
}, w = d({
get() {
var t, e;
return ((e = (t = i.value) == null ? void 0 : t.componentProps) == null ? void 0 : e.dataType) ?? "static";
},
set(t) {
i.value && N(i.value, "componentProps.dataType", t);
}
}), k = (t, e) => e.label.toLowerCase().includes(t.toLowerCase()), v = d(() => Object.values(s.request.requests).map((t) => ({
label: t.label,
value: t.name
}))), c = d(() => {
let t = 1;
return s.dictList.value.length && (t += 1), v.value.length && (t += 1), t;
});
return (t, e) => (m(), j("div", I, [
o(l(h), {
modelValue: w.value,
"onUpdate:modelValue": e[3] || (e[3] = (r) => w.value = r)
}, {
default: a(() => [
c.value > 1 ? (m(), f(l(z), {
key: 0,
class: E(["grid w-full", {
"grid-cols-2": c.value === 2,
"grid-cols-3": c.value === 3
}])
}, {
default: a(() => [
o(l(C), { value: "static" }, {
default: a(() => e[4] || (e[4] = [
_(" 静态数据 ")
])),
_: 1
}),
l(s).dictList.value.length ? (m(), f(l(C), {
key: 0,
value: "dict"
}, {
default: a(() => e[5] || (e[5] = [
_(" 字典数据 ")
])),
_: 1
})) : V("", !0),
v.value.length ? (m(), f(l(C), {
key: 1,
value: "request"
}, {
default: a(() => e[6] || (e[6] = [
_(" 内置请求 ")
])),
_: 1
})) : V("", !0)
]),
_: 1
}, 8, ["class"])) : V("", !0),
u("div", A, [
o(l(g), { value: "static" }, {
default: a(() => [
o(D, {
modelValue: l(p),
"onUpdate:modelValue": e[0] || (e[0] = (r) => M(p) ? p.value = r : null)
}, null, 8, ["modelValue"])
]),
_: 1
}),
o(l(g), { value: "dict" }, {
default: a(() => [
u("div", F, [
e[7] || (e[7] = u("div", { class: "epic-attr-label" }, "选择字典", -1)),
o(l(L), {
value: n.value,
"onUpdate:value": e[1] || (e[1] = (r) => n.value = r),
"show-search": "",
"filter-option": k,
"allow-clear": "",
options: l(s).dictList.value,
placeholder: "请选择",
"onUpdate:modelValue": y
}, null, 8, ["value", "options"])
])
]),
_: 1
}),
o(l(g), { value: "request" }, {
default: a(() => [
u("div", G, [
e[8] || (e[8] = u("div", { class: "epic-attr-label" }, "选择请求", -1)),
o(l(L), {
value: n.value,
"onUpdate:value": e[2] || (e[2] = (r) => n.value = r),
"show-search": "",
"filter-option": k,
"allow-clear": "",
options: v.value,
placeholder: "请选择",
"onUpdate:modelValue": y
}, null, 8, ["value", "options"])
])
]),
_: 1
})
])
]),
_: 1
}, 8, ["modelValue"])
]));
}
});
export {
ve as default
};