fx-epic-designer
Version:
基于vue3的设计器,可视化开发页面表单
116 lines (115 loc) • 4.31 kB
JavaScript
import { defineComponent as N, inject as i, ref as _, computed as x, resolveComponent as I, createElementBlock as B, openBlock as P, createElementVNode as n, createVNode as c, unref as l, withCtx as y, withDirectives as U, mergeProps as $, toDisplayString as D, vShow as E } from "vue";
/* empty css */
import T from "../../../../base-ui/src/icon/icon.vue2.js";
import { generateNewSchema as C, findSchemaInfoById as j } from "../../../../../utils/src/common/data.js";
import "@vueuse/core";
import "../../../../../hooks/src/store/index.js";
import { pluginManager as r } from "../../../../../utils/src/manager/pluginManager.js";
import G from "vuedraggable";
const L = { class: "nada-component-view flex flex-col" }, M = { class: "nada-search-box px-10px py-6px" }, q = { class: "flex flex-1 overflow-auto" }, z = { class: "box-border h-full flex-1 overflow-auto py-2" }, A = ["onClick"], F = { class: "nada-componet-label w-0 flex-1 truncate" }, H = { class: "pt-42px text-center text-gray-400" }, ee = /* @__PURE__ */ N({
__name: "index",
setup(J) {
const S = r.getComponent("input"), b = i("pageSchema"), u = i("designer"), w = i("revoke");
i("designerProps");
const k = r.getComponentSchemaGroups(), a = _(""), f = {
title: "全部",
list: []
};
_(f), x(() => [f, ...k.value]);
const d = x(() => [
{
componentProps: {
placeholder: "请输入销售单号"
},
field: "so_no",
id: "so_no",
input: !0,
label: "销售单",
type: "input"
},
{
componentProps: {
placeholder: "请输入采购单号"
},
field: "po_no",
id: "po_no",
input: !0,
label: "销售单",
type: "input"
}
]);
function V(t) {
var g, h, v;
const o = j(
b.schemas,
((g = u.state.selectedNode) == null ? void 0 : g.id) ?? "root"
);
if (console.log(t), !o)
return !1;
let { index: s, schema: e, list: p } = o;
console.log(t), e.children && !((v = (h = r.getComponentConfingByType(e.type)) == null ? void 0 : h.editConstraints) != null && v.childImmovable) && (p = e.children, s = e.children.length - 1), console.log(t);
const m = C(t);
console.log(m), p.splice(s + 1, 0, m), u.setSelectedNode(m), w.push("插入组件");
}
return (t, o) => {
const s = I("NadaIcon");
return P(), B("div", L, [
n("div", M, [
c(l(S), {
modelValue: a.value,
"onUpdate:modelValue": o[0] || (o[0] = (e) => a.value = e),
value: a.value,
"onUpdate:value": o[1] || (o[1] = (e) => a.value = e),
placeholder: "搜索组件",
clearable: "",
"allow-clear": ""
}, {
prefix: y(() => [
c(l(T), {
class: "text-$nada-text-helper",
name: "icon--nada--search-rounded"
})
]),
_: 1
}, 8, ["modelValue", "value"])
]),
n("div", q, [
n("div", z, [
c(l(G), $({
modelValue: d.value,
"onUpdate:modelValue": o[2] || (o[2] = (e) => d.value = e)
}, {
group: { name: "edit-draggable", pull: "clone", put: !1 },
sort: !1,
animation: 180,
ghostClass: "moving"
}, {
clone: l(C),
"item-key": "id",
class: "px-10px grid grid-cols-[auto_auto] gap-2"
}), {
item: y(({ element: e }) => [
n("div", {
class: "nada-componet-item flex items-center truncate",
onClick: (p) => V(e)
}, [
c(s, {
name: l(r).getComponentConfingByType(e.type).icon ?? ""
}, null, 8, ["name"]),
n("div", F, D(e.label), 1)
], 8, A)
]),
_: 1
}, 16, ["modelValue", "clone"]),
U(n("div", H, " 没有查询到的组件 ", 512), [
[E, d.value.length === 0]
])
])
])
]);
};
}
});
export {
ee as default
};