epic-designer-gold 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attributeView-DEyQL7em.cjs → attributeView-CfMG9ANQ.cjs} +1 -1
- package/dist/{attributeView-jwbZhq65.js → attributeView-CqQCeL9p.js} +1 -1
- package/dist/{eventView-CfMax_U7.cjs → eventView-CSJb3Zam.cjs} +1 -1
- package/dist/{eventView-CEeT_JLL.js → eventView-C_THyz3W.js} +1 -1
- package/dist/{index-D4e8XNyx.js → index-BC_6e5pJ.js} +1 -1
- package/dist/{index-DZRPexQZ.js → index-BMnsWYrT.js} +1 -1
- package/dist/{index-Cevjl8jo.cjs → index-Bd5nBb_T.cjs} +1 -1
- package/dist/{index-D3KAAzmX.cjs → index-BnRo1212.cjs} +1 -1
- package/dist/{index-Dtax565w.js → index-BqPDmqv7.js} +1 -1
- package/dist/{index-D-2x46HI.cjs → index-CaIsXqm5.cjs} +1 -1
- package/dist/{index-gFqI49-0.cjs → index-Ctr7oJRf.cjs} +1 -1
- package/dist/{index-B2N4pP55.cjs → index-Cz47jN8A.cjs} +1 -1
- package/dist/{index-DHwtlP2J.js → index-DAWH9Tr_.js} +1 -1
- package/dist/{index-CTd2_vna.cjs → index-DAk3CFkW.cjs} +1 -1
- package/dist/{index-DC4NLl3o.js → index-DBj3eppg.js} +1 -1
- package/dist/{index-Xb_SJdEs.cjs → index-DZ5RBl4U.cjs} +1 -1
- package/dist/{index-E2PvWPhl.js → index-DtXxkuvD.js} +1 -1
- package/dist/{index-BcZSHbp2.js → index-GtUWspi3.js} +1 -1
- package/dist/{index-B6yexTNr.js → index-MwVOPR2b.js} +8 -8
- package/dist/{index-yVm3iKnk.js → index-S4XwR1vD.js} +83 -83
- package/dist/index-jsf_Tgj1.js +4 -0
- package/dist/index-mxP1Ba2T.cjs +1 -0
- package/dist/{index-DgRGSX7j.cjs → index-p6doDa9j.cjs} +2 -2
- package/dist/{index-B7sMvYm_.cjs → index-sZ9OfgE1.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{styleView-CHar-6GB.cjs → styleView-0rthSdVL.cjs} +1 -1
- package/dist/{styleView-B1kY8Fux.js → styleView-DX_XKKmF.js} +1 -1
- package/package.json +1 -1
- package/dist/index-CrrXaIZY.js +0 -4
- package/dist/index-br62scsB.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as B, inject as M, resolveComponent as j, openBlock as p, createBlock as N, unref as
|
|
1
|
+
import { defineComponent as B, inject as M, resolveComponent as j, openBlock as p, createBlock as N, unref as n, isRef as O, withCtx as z, createElementVNode as m, normalizeClass as A, createVNode as d, createCommentVNode as $, createElementBlock as g, ref as J, reactive as w, onMounted as K, watch as L, provide as P, Fragment as R, renderList as T, toDisplayString as F, withDirectives as q, vShow as G, createTextVNode as H } from "vue";
|
|
2
2
|
import { d as Q } from "./vuedraggable.umd-D2S7Eo7p.js";
|
|
3
|
-
import { p as
|
|
3
|
+
import { p as b, E as W } from "./pluginManager-D8PM7ICc.js";
|
|
4
4
|
import { _ as E } from "./icon.vue_vue_type_script_setup_true_lang-D3QdcReY.js";
|
|
5
|
-
import { n as I } from "./index-
|
|
5
|
+
import { n as I } from "./index-MwVOPR2b.js";
|
|
6
6
|
import { ElMessage as X } from "element-plus";
|
|
7
7
|
import { a as Y } from "./axios-CXDYiOMX.js";
|
|
8
8
|
import { _ as Z } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
@@ -16,23 +16,23 @@ const ee = {
|
|
|
16
16
|
modelValue: {}
|
|
17
17
|
},
|
|
18
18
|
emits: ["update:modelValue"],
|
|
19
|
-
setup(
|
|
20
|
-
const
|
|
21
|
-
function
|
|
19
|
+
setup(C, { emit: U }) {
|
|
20
|
+
const S = C, x = b.getComponent("input"), c = M("tree", !1), u = I(S, "modelValue", U);
|
|
21
|
+
function y(l) {
|
|
22
22
|
const s = {
|
|
23
23
|
label: "",
|
|
24
24
|
value: ""
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
l.children ? l.children.push(s) : l.children = [s];
|
|
27
27
|
}
|
|
28
|
-
function i(
|
|
29
|
-
u.value = u.value.filter((s, f) => f !==
|
|
28
|
+
function i(l) {
|
|
29
|
+
u.value = u.value.filter((s, f) => f !== l);
|
|
30
30
|
}
|
|
31
|
-
return (
|
|
31
|
+
return (l, s) => {
|
|
32
32
|
const f = j("EOptionItem");
|
|
33
|
-
return p(), N(
|
|
34
|
-
modelValue:
|
|
35
|
-
"onUpdate:modelValue": s[0] || (s[0] = (
|
|
33
|
+
return p(), N(n(Q), {
|
|
34
|
+
modelValue: n(u),
|
|
35
|
+
"onUpdate:modelValue": s[0] || (s[0] = (a) => O(u) ? u.value = a : null),
|
|
36
36
|
"item-key": "id",
|
|
37
37
|
"component-data": {
|
|
38
38
|
type: "transition-group"
|
|
@@ -41,45 +41,45 @@ const ee = {
|
|
|
41
41
|
handle: ".handle",
|
|
42
42
|
animation: 200
|
|
43
43
|
}, {
|
|
44
|
-
item: z(({ element:
|
|
44
|
+
item: z(({ element: a, index: h }) => [
|
|
45
45
|
m("div", null, [
|
|
46
46
|
m("div", {
|
|
47
|
-
class: A([
|
|
47
|
+
class: A([n(c) ? "grid-cols-[16px_auto_auto_16px_16px]" : "grid-cols-[16px_auto_auto_16px]", "option-item text-16px grid text-$epic-text-secondary gap-2 items-center mb-2"])
|
|
48
48
|
}, [
|
|
49
|
-
d(
|
|
49
|
+
d(n(E), {
|
|
50
50
|
class: "mr-2 cursor-move handle",
|
|
51
51
|
name: "icon--epic--drag"
|
|
52
52
|
}),
|
|
53
|
-
d(
|
|
54
|
-
modelValue:
|
|
55
|
-
"onUpdate:modelValue": (r) =>
|
|
56
|
-
value:
|
|
57
|
-
"onUpdate:value": (r) =>
|
|
53
|
+
d(n(x), {
|
|
54
|
+
modelValue: a.label,
|
|
55
|
+
"onUpdate:modelValue": (r) => a.label = r,
|
|
56
|
+
value: a.label,
|
|
57
|
+
"onUpdate:value": (r) => a.label = r,
|
|
58
58
|
placeholder: "label"
|
|
59
59
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "value", "onUpdate:value"]),
|
|
60
|
-
d(
|
|
61
|
-
modelValue:
|
|
62
|
-
"onUpdate:modelValue": (r) =>
|
|
63
|
-
value:
|
|
64
|
-
"onUpdate:value": (r) =>
|
|
60
|
+
d(n(x), {
|
|
61
|
+
modelValue: a.value,
|
|
62
|
+
"onUpdate:modelValue": (r) => a.value = r,
|
|
63
|
+
value: a.value,
|
|
64
|
+
"onUpdate:value": (r) => a.value = r,
|
|
65
65
|
placeholder: "value"
|
|
66
66
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "value", "onUpdate:value"]),
|
|
67
|
-
|
|
67
|
+
n(c) ? (p(), N(n(E), {
|
|
68
68
|
key: 0,
|
|
69
69
|
class: "cursor-pointer text-lg!",
|
|
70
70
|
name: "icon--epic--add-rounded",
|
|
71
|
-
onClick: (r) =>
|
|
71
|
+
onClick: (r) => y(a)
|
|
72
72
|
}, null, 8, ["onClick"])) : $("", !0),
|
|
73
|
-
d(
|
|
73
|
+
d(n(E), {
|
|
74
74
|
class: "hover:text-red cursor-pointer",
|
|
75
75
|
name: "icon--epic--delete-outline-rounded",
|
|
76
|
-
onClick: (r) => i(
|
|
76
|
+
onClick: (r) => i(h)
|
|
77
77
|
}, null, 8, ["onClick"])
|
|
78
78
|
], 2),
|
|
79
|
-
|
|
79
|
+
a.children ? (p(), g("div", ee, [
|
|
80
80
|
d(f, {
|
|
81
|
-
modelValue:
|
|
82
|
-
"onUpdate:modelValue": (r) =>
|
|
81
|
+
modelValue: a.children,
|
|
82
|
+
"onUpdate:modelValue": (r) => a.children = r
|
|
83
83
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
84
84
|
])) : $("", !0)
|
|
85
85
|
])
|
|
@@ -97,31 +97,31 @@ const ee = {
|
|
|
97
97
|
type: {}
|
|
98
98
|
},
|
|
99
99
|
emits: ["update:modelValue", "update:EOptionsEditor"],
|
|
100
|
-
setup(
|
|
101
|
-
const
|
|
100
|
+
setup(C, { emit: U }) {
|
|
101
|
+
const S = b.getComponent("button"), x = b.getComponent("select"), c = J([]), v = w({
|
|
102
102
|
title: "静态"
|
|
103
|
-
}), u =
|
|
104
|
-
W.on("updateSource", (
|
|
105
|
-
|
|
103
|
+
}), u = C, y = U;
|
|
104
|
+
W.on("updateSource", (t) => {
|
|
105
|
+
c.value = b.sourceData.map((e) => ({
|
|
106
106
|
...e,
|
|
107
107
|
label: e.apiName,
|
|
108
108
|
value: e.id
|
|
109
|
-
}));
|
|
109
|
+
})), console.log("%c [ ]-79", "font-size:13px; background:pink; color:#bf2c9f;", l.value), h(l.value);
|
|
110
110
|
}), K(() => {
|
|
111
|
-
c.value =
|
|
112
|
-
...
|
|
113
|
-
label:
|
|
114
|
-
value:
|
|
115
|
-
}));
|
|
111
|
+
c.value = b.sourceData.map((t) => ({
|
|
112
|
+
...t,
|
|
113
|
+
label: t.apiName,
|
|
114
|
+
value: t.id
|
|
115
|
+
})), console.log("%c [ ]-89", "font-size:13px; background:pink; color:#bf2c9f;", l.value), h(l.value);
|
|
116
116
|
});
|
|
117
|
-
const i = I(u, "modelValue",
|
|
118
|
-
function s(
|
|
119
|
-
return
|
|
117
|
+
const i = I(u, "modelValue", y), l = I(u, "dynamicId", y);
|
|
118
|
+
function s(t) {
|
|
119
|
+
return t && Object.prototype.toString.call(t) === "[object Array]" ? t : (X.info("请检查数据位置是否配置准确"), []);
|
|
120
120
|
}
|
|
121
121
|
L(
|
|
122
|
-
() =>
|
|
122
|
+
() => l.value,
|
|
123
123
|
async () => {
|
|
124
|
-
|
|
124
|
+
l.value ? v.title = "动态" : v.title = "静态";
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
immediate: !0
|
|
@@ -135,12 +135,12 @@ const ee = {
|
|
|
135
135
|
title: "动态"
|
|
136
136
|
}
|
|
137
137
|
];
|
|
138
|
-
async function t
|
|
139
|
-
v.title =
|
|
138
|
+
async function a(t) {
|
|
139
|
+
v.title = t.title, t.title === "静态" && (l.value = "");
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
142
|
-
const e = c.value.find((
|
|
143
|
-
let
|
|
141
|
+
async function h(t) {
|
|
142
|
+
const e = c.value.find((o) => o.id === t);
|
|
143
|
+
let V = await Y({
|
|
144
144
|
method: (e == null ? void 0 : e.method) || "get",
|
|
145
145
|
url: e.url,
|
|
146
146
|
// url: "http://localhost:3333/users",
|
|
@@ -149,67 +149,67 @@ const ee = {
|
|
|
149
149
|
headers: e != null && e.header ? JSON.parse(e == null ? void 0 : e.header) : {}
|
|
150
150
|
});
|
|
151
151
|
if (e && (e != null && e.dataPath)) {
|
|
152
|
-
const
|
|
153
|
-
console.log("%c [ ]-148", "font-size:13px; background:pink; color:#bf2c9f;",
|
|
154
|
-
label:
|
|
155
|
-
value:
|
|
152
|
+
const k = e.dataPath.split(".").reduce((_, D) => _[D], V.data);
|
|
153
|
+
console.log("%c [ ]-148", "font-size:13px; background:pink; color:#bf2c9f;", k), i.value = s(k).map((_) => ({
|
|
154
|
+
label: _[e.dataKey],
|
|
155
|
+
value: _[e.dataValue]
|
|
156
156
|
}));
|
|
157
157
|
} else
|
|
158
|
-
i.value = s(
|
|
159
|
-
label:
|
|
160
|
-
value:
|
|
158
|
+
i.value = s(V.data).map((o) => ({
|
|
159
|
+
label: o[e.dataKey],
|
|
160
|
+
value: o[e.dataValue]
|
|
161
161
|
}));
|
|
162
162
|
}
|
|
163
163
|
u.modelValue, P("tree", u.tree);
|
|
164
164
|
function r() {
|
|
165
|
-
const
|
|
165
|
+
const t = w({
|
|
166
166
|
label: "",
|
|
167
167
|
value: ""
|
|
168
168
|
});
|
|
169
|
-
i.value.length ? i.value = [...i.value,
|
|
169
|
+
i.value.length ? i.value = [...i.value, t] : i.value = [t];
|
|
170
170
|
}
|
|
171
|
-
return (
|
|
172
|
-
var
|
|
173
|
-
return p(),
|
|
171
|
+
return (t, e) => {
|
|
172
|
+
var V;
|
|
173
|
+
return p(), g("div", te, [
|
|
174
174
|
m("div", null, [
|
|
175
175
|
m("div", ae, [
|
|
176
|
-
(p(),
|
|
177
|
-
class: A(["epic-tab cursor-pointer truncate", { checked: v.title ===
|
|
178
|
-
key:
|
|
179
|
-
title:
|
|
180
|
-
onClick: (
|
|
181
|
-
}, F(
|
|
176
|
+
(p(), g(R, null, T(f, (o, k) => m("div", {
|
|
177
|
+
class: A(["epic-tab cursor-pointer truncate", { checked: v.title === o.title }]),
|
|
178
|
+
key: k,
|
|
179
|
+
title: o.title,
|
|
180
|
+
onClick: (_) => a(o)
|
|
181
|
+
}, F(o.title), 11, oe)), 64))
|
|
182
182
|
]),
|
|
183
|
-
v.title === "静态" ? (p(),
|
|
183
|
+
v.title === "静态" ? (p(), g("div", ne, [
|
|
184
184
|
q(m("div", re, "暂无选项", 512), [
|
|
185
|
-
[G, !((
|
|
185
|
+
[G, !((V = n(i)) != null && V.length)]
|
|
186
186
|
]),
|
|
187
187
|
d(le, {
|
|
188
|
-
modelValue:
|
|
189
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
188
|
+
modelValue: n(i),
|
|
189
|
+
"onUpdate:modelValue": e[0] || (e[0] = (o) => O(i) ? i.value = o : null)
|
|
190
190
|
}, null, 8, ["modelValue"]),
|
|
191
|
-
d(
|
|
191
|
+
d(n(S), { onClick: r }, {
|
|
192
192
|
default: z(() => e[2] || (e[2] = [
|
|
193
193
|
H("添加选项")
|
|
194
194
|
])),
|
|
195
195
|
_: 1
|
|
196
196
|
})
|
|
197
|
-
])) : (p(),
|
|
197
|
+
])) : (p(), g("div", ie, [
|
|
198
198
|
e[3] || (e[3] = m("span", { style: { "font-size": "12px", "margin-bottom": "8px", display: "inline-block" } }, "数据源", -1)),
|
|
199
|
-
d(
|
|
200
|
-
modelValue:
|
|
201
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
199
|
+
d(n(x), {
|
|
200
|
+
modelValue: n(l),
|
|
201
|
+
"onUpdate:modelValue": e[1] || (e[1] = (o) => O(l) ? l.value = o : null),
|
|
202
202
|
placeholder: "请选择数据源",
|
|
203
203
|
clearable: "",
|
|
204
204
|
options: c.value,
|
|
205
|
-
onChange:
|
|
205
|
+
onChange: h
|
|
206
206
|
}, null, 8, ["modelValue", "options"])
|
|
207
207
|
]))
|
|
208
208
|
])
|
|
209
209
|
]);
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
}), Ve = /* @__PURE__ */ Z(ue, [["__scopeId", "data-v-
|
|
212
|
+
}), Ve = /* @__PURE__ */ Z(ue, [["__scopeId", "data-v-a883f089"]]);
|
|
213
213
|
export {
|
|
214
214
|
Ve as default
|
|
215
215
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),E=require("./vuedraggable.umd-BqhSJIAi.cjs"),p=require("./pluginManager-itCTrGag.cjs"),y=require("./icon.vue_vue_type_script_setup_true_lang-DJbUD5AQ.cjs"),C=require("./index-p6doDa9j.cjs"),B=require("element-plus"),S=require("./axios-tuVKNgv9.cjs"),U=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),M={key:0,class:"pl-4"},O=e.defineComponent({name:"EOptionItem",__name:"optionItem",props:{modelValue:{}},emits:["update:modelValue"],setup(k,{emit:b}){const x=k,g=p.pluginManager.getComponent("input"),d=e.inject("tree",!1),s=b,c=C.useVModel(x,"modelValue",s);function _(t){const i={label:"",value:""};t.children?t.children.push(i):t.children=[i]}function u(t){c.value=c.value.filter((i,m)=>m!==t)}return(t,i)=>{const m=e.resolveComponent("EOptionItem");return e.openBlock(),e.createBlock(e.unref(E.draggable),{modelValue:e.unref(c),"onUpdate:modelValue":i[0]||(i[0]=a=>e.isRef(c)?c.value=a:null),"item-key":"id","component-data":{type:"transition-group"},group:"option-list",handle:".handle",animation:200},{item:e.withCtx(({element:a,index:v})=>[e.createElementVNode("div",null,[e.createElementVNode("div",{class:e.normalizeClass([e.unref(d)?"grid-cols-[16px_auto_auto_16px_16px]":"grid-cols-[16px_auto_auto_16px]","option-item text-16px grid text-$epic-text-secondary gap-2 items-center mb-2"])},[e.createVNode(e.unref(y._sfc_main),{class:"mr-2 cursor-move handle",name:"icon--epic--drag"}),e.createVNode(e.unref(g),{modelValue:a.label,"onUpdate:modelValue":r=>a.label=r,value:a.label,"onUpdate:value":r=>a.label=r,placeholder:"label"},null,8,["modelValue","onUpdate:modelValue","value","onUpdate:value"]),e.createVNode(e.unref(g),{modelValue:a.value,"onUpdate:modelValue":r=>a.value=r,value:a.value,"onUpdate:value":r=>a.value=r,placeholder:"value"},null,8,["modelValue","onUpdate:modelValue","value","onUpdate:value"]),e.unref(d)?(e.openBlock(),e.createBlock(e.unref(y._sfc_main),{key:0,class:"cursor-pointer text-lg!",name:"icon--epic--add-rounded",onClick:r=>_(a)},null,8,["onClick"])):e.createCommentVNode("",!0),e.createVNode(e.unref(y._sfc_main),{class:"hover:text-red cursor-pointer",name:"icon--epic--delete-outline-rounded",onClick:r=>u(v)},null,8,["onClick"])],2),a.children?(e.openBlock(),e.createElementBlock("div",M,[e.createVNode(m,{modelValue:a.children,"onUpdate:modelValue":r=>a.children=r},null,8,["modelValue","onUpdate:modelValue"])])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue"])}}}),I={class:""},q={class:"epic-tabs-box"},w=["title","onClick"],$={key:0},z={class:"py-4 my-2 text-center text-gray-400 bg-white"},j={key:1},A=e.defineComponent({__name:"index",props:{tree:{type:Boolean},modelValue:{},dynamicId:{},type:{}},emits:["update:modelValue","update:EOptionsEditor"],setup(k,{emit:b}){const x=p.pluginManager.getComponent("button"),g=p.pluginManager.getComponent("select"),d=e.ref([]),s=e.reactive({title:"静态"}),c=k,_=b;p.EventBus.on("updateSource",n=>{d.value=p.pluginManager.sourceData.map(l=>({...l,label:l.apiName,value:l.id})),console.log("%c [ ]-79","font-size:13px; background:pink; color:#bf2c9f;",t.value),v(t.value)}),e.onMounted(()=>{d.value=p.pluginManager.sourceData.map(n=>({...n,label:n.apiName,value:n.id})),console.log("%c [ ]-89","font-size:13px; background:pink; color:#bf2c9f;",t.value),v(t.value)});const u=C.useVModel(c,"modelValue",_),t=C.useVModel(c,"dynamicId",_);function i(n){return n&&Object.prototype.toString.call(n)==="[object Array]"?n:(B.ElMessage.info("请检查数据位置是否配置准确"),[])}e.watch(()=>t.value,async()=>{t.value?s.title="动态":s.title="静态"},{immediate:!0});const m=[{title:"静态"},{title:"动态"}];async function a(n){s.title=n.title,n.title==="静态"&&(t.value="")}async function v(n){const l=d.value.find(o=>o.id===n);let f=await S.axios({method:(l==null?void 0:l.method)||"get",url:l.url,params:l!=null&&l.params?JSON.parse(l==null?void 0:l.params):{},data:l!=null&&l.data?JSON.parse(l==null?void 0:l.data):{},headers:l!=null&&l.header?JSON.parse(l==null?void 0:l.header):{}});if(l&&(l!=null&&l.dataPath)){const h=l.dataPath.split(".").reduce((V,N)=>V[N],f.data);console.log("%c [ ]-148","font-size:13px; background:pink; color:#bf2c9f;",h),u.value=i(h).map(V=>({label:V[l.dataKey],value:V[l.dataValue]}))}else u.value=i(f.data).map(o=>({label:o[l.dataKey],value:o[l.dataValue]}))}c.modelValue,e.provide("tree",c.tree);function r(){const n=e.reactive({label:"",value:""});u.value.length?u.value=[...u.value,n]:u.value=[n]}return(n,l)=>{var f;return e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("div",null,[e.createElementVNode("div",q,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(m,(o,h)=>e.createElementVNode("div",{class:e.normalizeClass(["epic-tab cursor-pointer truncate",{checked:s.title===o.title}]),key:h,title:o.title,onClick:V=>a(o)},e.toDisplayString(o.title),11,w)),64))]),s.title==="静态"?(e.openBlock(),e.createElementBlock("div",$,[e.withDirectives(e.createElementVNode("div",z,"暂无选项",512),[[e.vShow,!((f=e.unref(u))!=null&&f.length)]]),e.createVNode(O,{modelValue:e.unref(u),"onUpdate:modelValue":l[0]||(l[0]=o=>e.isRef(u)?u.value=o:null)},null,8,["modelValue"]),e.createVNode(e.unref(x),{onClick:r},{default:e.withCtx(()=>l[2]||(l[2]=[e.createTextVNode("添加选项")])),_:1})])):(e.openBlock(),e.createElementBlock("div",j,[l[3]||(l[3]=e.createElementVNode("span",{style:{"font-size":"12px","margin-bottom":"8px",display:"inline-block"}},"数据源",-1)),e.createVNode(e.unref(g),{modelValue:e.unref(t),"onUpdate:modelValue":l[1]||(l[1]=o=>e.isRef(t)?t.value=o:null),placeholder:"请选择数据源",clearable:"",options:d.value,onChange:v},null,8,["modelValue","options"])]))])])}}}),D=U._export_sfc(A,[["__scopeId","data-v-a883f089"]]);exports.default=D;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),E=require("./pluginManager-itCTrGag.cjs");function T(t=10){const a="abcdefghijklmnopqrstuvwxyz0123456789";let o="";for(let r=0;r<t;r++){const n=Math.floor(Math.random()*a.length);o+=a[n]}return o}function G(t){return t.charAt(0).toUpperCase()+t.slice(1)}function V(t,a=new WeakMap){if(typeof t!="object"||t===null)return t;if(a.has(t))return a.get(t);if(Array.isArray(t)){const r=t.map(n=>V(n,a));return a.set(t,r),r}const o={};return a.set(t,o),Object.keys(t).forEach(r=>{o[r]=V(t[r],a)}),o}function ue(t){const[a]=j([V(t)],o=>{var n,s;const r={...o,id:`${o.type}_${T(8)}`};return(r.field||r.input)&&!((s=(n=E.pluginManager.getComponentConfingByType(r.type))==null?void 0:n.editConstraints)!=null&&s.fixedField)&&(r.field=r.id),r});return a}function M(t,a,o=!0){for(const[r,n]of Object.entries(a)){let s=t==null?void 0:t[r];s&&n&&typeof s=="object"&&typeof n=="object"?(Array.isArray(s)&&!Array.isArray(n)?s=t[r]={}:!Array.isArray(s)&&Array.isArray(n)&&(s=t[r]=[]),M(s,n,o)):t[r]=n}o&&Object.keys(t).reverse().forEach(r=>{a.hasOwnProperty(r)||(Array.isArray(t)?t.splice(Number(r),1):delete t[r])})}function K(t,a,o=[],r=new WeakMap){const n=s=>{if(Array.isArray(s))return s.map(n);if(typeof s=="object"&&s!==null){if(r.has(s))return"[Circular]";r.set(s,!0);const l=Object.keys(s).sort(),c={};return l.forEach(u=>{o.includes(u)||(c[u]=n(s[u]))}),r.delete(s),c}else return s};return JSON.stringify(n(t))===JSON.stringify(n(a))}function Y(t,a){const o=[];let r=!1;function n(s){if(o.push(s),s.id===a&&(r=!0),!r&&s.children!=null&&s.children.length>0)for(let l=0;l<s.children.length&&(n(s.children[l]),!r);l++);if(!r&&s.slots)for(let l in s.slots)for(let c=0;c<s.slots[l].length&&(n(s.slots[l][c]),!r);c++);r||o.pop()}return t.forEach(n),r||console.error(`没有查询到id为${a}的节点`),o}function de(t,a,o){const r=a.split(".");let n=t;for(let s=0;s<r.length;s++){if(n==null)return o;n=n[r[s]]}return n===void 0?o:n}function fe(t,a,o){const r=a.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean);let n=t;for(let s=0;s<r.length-1;s++){const l=r[s];n[l]==null&&(n[l]=isNaN(Number(r[s+1]))?{}:[]),n=n[l]}return n[r[r.length-1]]=o,t}function pe(t,a="default"){return X(t,a).map(r=>r.field)}function X(t,a="default"){const o=O(t,n=>{var s;return n.type==="form"&&(((s=n.componentProps)==null?void 0:s.name)??n.name===a)},!0);return O((o==null?void 0:o.children)??[],n=>!!n.input,!1,n=>n.type!=="subform")}function O(t,a,o=!1,r){const n=[],s=[...t];for(;s.length;){const l=s.pop();if(l!=null&&l.children&&(!r||r(l))&&s.push(...l.children),l!=null&&l.slots&&(!r||r(l)))for(let c in l.slots)s.push(...l.slots[c]);if(a(l)&&(n.push(l),o))return l}return o?!1:n}function j(t,a,o){const r=[...t];for(;r.length;){const n=r.pop();if(n!=null&&n.children&&(!o||o(n))&&r.push(...n.children),n!=null&&n.slots&&(!o||o(n)))for(let s in n.slots)r.push(...n.slots[s]);M(n,a(n))}return t}function me(t,a){const o=O(t,r=>r.id===a,!0);if(!o)throw new Error(`没有查询到id为${a}的节点`);return o}function he(t,a){const o=[{type:"",children:t}];let r=0,n=null;if(O(o,s=>{if(n=s.children??null,!n){if(s!=null&&s.slots)for(let l in s.slots){n=s.slots[l];for(let c=0;c<n.length;c++)if(n[c].id===a)return r=c,!0}return!1}for(let l=0;l<n.length;l++)if(n[l].id===a)return r=l,!0;return!1},!0),!n)throw new Error(`没有查询到id为${a}的节点`);return{list:n,schema:n[r],index:r}}function ve(t){const a={schemas:[{type:"page",id:"root",label:"页面",children:[{label:"表单",type:"form",icon:"epic-icon-daibanshixiang",labelWidth:t.config.labelWidth||100,name:"default",componentProps:{layout:t.config.layout||"horizontal",labelWidth:t.config.labelWidth||100,labelLayout:t.config.labelLayout==="flex"?"fixed":"flex",labelCol:t.config.labelCol||{span:5},wrapperCol:t.config.wrapperCol||{span:19},hideRequiredMark:t.config.hideRequiredMark||!1,colon:t.config.colon||!0,labelAlign:t.config.labelAlign||"right",size:t.config.size||"middle"},children:[],id:"form_"+T()}],componentProps:{style:{padding:"16px"}}}],script:t.script||""};return a.schemas[0].children[0].children=R(t.list),a}function R(t,a){return t.map(o=>{var u,S,h;let r=o.type??"";const n=o.options??{},s=(i,v)=>{r===i&&(r=v,n.defaultValue&&(n.defaultValue=JSON.parse(n.defaultValue)))};if(s("uploadImg","upload-image"),s("uploadFile","upload-file"),r==="date"&&n.range&&(n.type="daterange",delete n.range),(r==="date"||r==="time")&&(n.valueFormat=n.format),r==="textarea"){const{minRows:i,maxRows:v}=n;n.autoSize={minRows:i,maxRows:v},delete n.minRows,delete n.maxRows}r==="number"&&!n.precision&&delete n.precision,n.width&&(n.style={width:n.width},delete n.width),r==="grid"&&(r="row"),a&&a.type==="grid"&&(r="col",n.span=o.span,o.key=T());const l={label:o.label,type:r,icon:o.icon||"",field:o.model,componentProps:n,id:o.key};return(n.noFormItem||!n.showLabel)&&(l.noFormItem=!0,delete n.noFormItem,delete n.showLabel),n.clearable&&(n.allowClear=!0,delete n.clearable),["input","textarea","number","password","select","cascader","checkbox","radio","date","time","slider","switch","color-picker","upload-file","upload-image"].includes(r)&&(l.input=!0,((S=(u=o.rules)==null?void 0:u[0])==null?void 0:S.required)===!1&&o.rules.shift(),((h=o.rules)==null?void 0:h.length)>0&&(l.rules=o.rules)),o.list&&(l.children=R(o.list,o)),o.columns&&(l.children=R(o.columns,o)),o.trs&&(l.children=R(o.trs,o)),o.tds&&(l.children=R(o.tds,o)),l})}function ge(t,a){let o=null;return(...r)=>{o&&clearTimeout(o),o=setTimeout(()=>{t(...r)},a)}}function Z(){const t=e.ref({}),a=e.ref({}),o=e.ref(!1),r=e.ref([]),n=e.reactive({});function s(p){return t.value[p]}function l(p,y){t.value[p]=y}function c(p){delete t.value[p]}function u(p,y=!1){const w=Object.entries(E.pluginManager.publicMethods).reduce((C,[I,B])=>(C[I]=B.handler,C),{});try{new Function(`const epic = this;${p}`).bind({...w,getComponent:s,find:s,defineExpose:S,publicMethods:w,pluginManager:E.pluginManager})()}catch(C){y&&console.error("[epic:自定义函数]异常:",C)}}function S(p){p!=null&&(a.value=p)}function h(p,...y){if(!p||p.length===0){console.warn("未提供任何动作");return}p.forEach(w=>{const C=w.args?JSON.parse(w.args):y;switch(w.type){case"public":i(w,C);break;case"custom":v(w,C);break;case"component":d(w,C);break;default:console.warn(`未知的动作类型: ${w.type}`);break}})}function i(p,y){var w;try{(w=E.pluginManager.publicMethods[p.methodName])==null||w.handler(...y)}catch(C){console.error(`[Epic:公共函数(${p.methodName})]执行异常:`,C)}}function v(p,y){var w,C;try{(C=(w=a.value)[p.methodName])==null||C.call(w,...y)}catch(I){console.error(`[Epic:自定义函数(${p.methodName})]执行异常:`,I)}}function d(p,y){const w=p.componentId!=null&&s(p.componentId);if(!w){console.warn(`[Epic:组件${p.componentId}]未找到`);return}try{w[p.methodName](...y)}catch(C){console.error(`[Epic:组件${p.componentId}函数(${p.methodName})]执行异常:`,C)}}function m(p=!0){o.value=p}function f(p){const y=O(p,()=>!0);r.value=y.map(w=>w.id)}function k(p,y="default"){if(n[y]){const w=n[y];M(p,w)}n[y]=p}function D(p,y="default"){if(n[y]){M(n[y],p,!1);return}n[y]=p}return{componentInstances:t,funcs:a,isDesignMode:o,defaultComponentIds:r,forms:n,addFormData:k,setFormData:D,getComponentInstance:s,find:s,addComponentInstance:l,removeComponentInstance:c,setMethods:u,doActions:h,setDesignMode:m,setDefaultComponentIds:f}}function ee(){const t=e.ref([]),a=e.ref([]),o=e.ref(null);let r=0;function n(u,S="插入组件"){const h=Date.now();r+150>h||(r=h,o.value!=null&&(t.value.push(o.value),a.value.splice(0,a.value.length)),o.value={type:S,componentSchema:JSON.stringify(u)},t.value.length>60&&t.value.unshift())}function s(){if(t.value.length===0)return!1;const u=t.value.pop();return o.value!=null&&a.value.push(o.value),o.value=u,JSON.parse(u.componentSchema)}function l(){if(a.value.length===0)return!1;const u=a.value.pop();return o.value!=null&&t.value.push(o.value),o.value=u,JSON.parse(u.componentSchema)}function c(){t.value=[],a.value=[],o.value=null}return{recordList:t,undoList:a,currentRecord:o,push:n,undo:s,redo:l,reset:c}}const ye=e.defineComponent({__name:"dynamicFormItem",props:{hasFormItem:{type:Boolean},formItemProps:{}},emits:["updateFormItemRef"],setup(t,{emit:a}){const o=E.pluginManager.getComponent("form-item"),r=t,n=a,s=e.ref(),l=()=>{n("updateFormItemRef",s.value)};return(c,u)=>r.hasFormItem?(e.openBlock(),e.createBlock(e.unref(o),e.mergeProps({key:0,ref_key:"formItemRef",ref:s,onVnodeMounted:l},r.formItemProps),{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3},16,["onVnodeMounted"])):e.renderSlot(c.$slots,"default",{key:1})}}),te=e.defineComponent({name:"ENode",__name:"node",props:{componentSchema:{},modelValue:{},ruleField:{},resetFormData:{type:Boolean},name:{},dynamicId:{}},emits:["update:modelValue","change","update:dynamicId"],setup(t,{emit:a}){const{proxy:o}=e.getCurrentInstance(),r=t,n=e.ref(null);let s=e.inject("formData",e.reactive({}));const l=e.inject("slots",{}),c=e.inject("pageManager",{}),u=e.inject("disabled",{value:!1}),S=e.inject("ruleFieldPrefix",null),h=e.inject("resetFormData",!1);let i=e.reactive(V(r.componentSchema));v(),e.watch(()=>r.componentSchema,g=>{K(i,g,["children"])||(M(i,V(g)),v())},{deep:!0});function v(){c.isDesignMode.value&&typeof i.field=="string"&&(i.field+="-design-mode")}(r.resetFormData||h)&&(s={});const d=a,m=e.ref(),f=e.ref(),k=g=>{f.value=g},D=e.useAttrs();Object.keys(D).length&&e.provide("nodeAttrs",D);const p=e.shallowRef(null),y=e.computed(()=>{var g,A;return(g=i.componentProps)!=null&&g.hidden?!1:typeof i.show=="boolean"?i.show:((A=i.show)==null?void 0:A.call(i,{values:s}))??!0}),w=e.computed(()=>{var P;const g=y.value&&((P=i.rules)==null?void 0:P.map(x=>({...x,validator:x.validator&&c.funcs.value[x.validator]})));let A=i.field;r.ruleField?A=r.ruleField:S&&i.field&&(A=V(S),A.push(i.field));const _={...i,rules:g,rule:g,field:A};return _.children&&delete _.children,_}),C=e.computed(()=>{var _,P;const g=((_=I.value)==null?void 0:_.bindModel)??"modelValue",A={};return i.on&&Object.keys(i.on).forEach(x=>{A[`on${G(x)}`]=(...ce)=>c.doActions(i.on[x],...ce)}),{...r,...i.componentProps,disabled:(u==null?void 0:u.value)||((P=i.componentProps)==null?void 0:P.disabled),bindModel:g,...A}}),I=e.computed(()=>E.pluginManager.getComponentConfingByType(i.type)??null);e.watchEffect(()=>{n.value=r.modelValue??s[i.field??""]}),e.watch(()=>n.value,()=>{n.value!==(r.modelValue??s[i.field??""])&&N(n.value)}),e.watch(()=>m.value,()=>{B()},{immediate:!0});function B(){var A;const g=m.value||o;i.id&&g&&(i.input&&(g.setValue=N,g.getValue=()=>s[i.field]||r.modelValue),g.setAttr=(_,P)=>(i.componentProps||(i.componentProps={}),i.componentProps[_]=P),g.getAttr=_=>i.componentProps[_],c.addComponentInstance(i.id,g),(A=I.value)!=null&&A.defaultSchema.input&&i.noFormItem!==!0&&f.value&&c.addComponentInstance(i.id+"formItem",f.value))}function L(){var g;i.id&&(c.removeComponentInstance(i.id),(g=I.value)!=null&&g.defaultSchema.input&&i.noFormItem!==!0&&c.removeComponentInstance(i.id+"formItem"))}async function J(){var A,_,P;if(typeof((A=i.componentProps)==null?void 0:A.defaultValue)<"u"){const x=c.isDesignMode.value?(_=i.componentProps)==null?void 0:_.defaultValue:s[i.field]??((P=i.componentProps)==null?void 0:P.defaultValue);N(V(x))}if(i.type==="slot"){const x=i.slotName;if(!x)return;p.value=e.defineComponent({setup(){return()=>e.renderSlot(l,x,{componentSchema:i,model:s})}});return}const g=E.pluginManager.getComponent(i.type);if(!g){console.error(`组件${i.type}未注册`);return}if(typeof g=="function"){const x=await g();p.value=x.default??x}else p.value=g}function N(g){d("update:modelValue",g),d("change",g),i.field&&(s[i.field]=g)}function U(g){d("update:dynamicId",g)}let b=null;return e.watch(()=>i,g=>{const A=JSON.stringify({...g,children:void 0});if(A===b)return!1;b=A,J()},{immediate:!0,deep:!0}),e.onUnmounted(L),(g,A)=>{var P;const _=e.resolveComponent("ENode");return p.value&&y.value?(e.openBlock(),e.createBlock(ye,{key:0,hasFormItem:e.unref(i).noFormItem!==!0&&((P=I.value)==null?void 0:P.defaultSchema.input),formItemProps:w.value,onUpdateFormItemRef:k},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value),e.mergeProps({ref_key:"componentInstance",ref:m,onVnodeMounted:B,model:e.unref(s)},{...C.value},{[C.value.bindModel]:n.value,["onUpdate:"+C.value.bindModel]:A[0]||(A[0]=x=>n.value=x),[`onUpdate:${C.value.bindModel}`||""]:N,"onUpdate:dynamicId":U}),{node:e.withCtx(x=>[e.createVNode(_,e.normalizeProps(e.guardReactiveProps(x)),null,16)]),"edit-node":e.withCtx(()=>[e.renderSlot(g.$slots,"edit-node")]),_:3},16,["model"]))]),_:3},8,["hasFormItem","formItemProps"])):e.createCommentVNode("",!0)}}});function we(){const t=e.ref(!1),a=Z(),o=e.ref({});function r(){return new Promise(d=>{if(t.value)d();else{const m=e.watch(t,()=>{m(),d()})}})}async function n(d="default"){var f;await r();const m=(f=o.value)==null?void 0:f[d];if(!m)throw new Error(`表单 [name=${d}] 不存在`);return m}async function s(d,m){const f=await n(d);return V(await m(f))}async function l(d="default"){return await s(d,m=>m.getData())}function c(d,m="default"){var k;a.setFormData(d,m);const f=(k=o.value)==null?void 0:k[m];f==null||f.clearValidate()}async function u(d="default"){return await s(d,async m=>(await m.validate(),await m.getData()))}async function S(d){await r();const m={};for(const f in o.value){const k=o.value[f];k&&(m[f]=V(await d(k)))}return m}async function h(){return await S(d=>d.getData())}function i(d){for(const m in d)c(d[m],m)}async function v(){return await S(async d=>(await d.validate(),await d.getData()))}return{ready:t,pageManager:a,forms:o,getData:l,setData:c,validate:u,getForms:h,setForms:i,validateAll:v,getFormInstance:n}}const Se={key:0,class:"epic-loading-box"},be={class:"epic-builder-main"},Ce={class:"epic-loading-box"},ne=e.defineComponent({__name:"builder",props:{pageSchema:{},formData:{},disabled:{type:Boolean}},emits:["ready"],setup(t,{expose:a,emit:o}){const r=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Cap7FkuS.cjs"))),n=o,{ready:s,pageManager:l,forms:c,getData:u,setData:S,validate:h,getForms:i,setForms:v,validateAll:d,getFormInstance:m}=we(),f=t,k=e.reactive({schemas:[]});e.watch(()=>f.pageSchema,w=>{M(k,w)},{immediate:!0,deep:!0}),e.watch(()=>f.formData,w=>{w&&S(w)},{immediate:!0,deep:!0}),e.watch(()=>k.script,w=>{w&&l.setMethods(w,!0)},{immediate:!0}),e.provide("slots",e.useSlots()),e.provide("pageManager",l),e.provide("forms",c),e.provide("pageSchema",k),e.provide("disabled",e.computed(()=>f.disabled));const D=e.getCurrentInstance(),p=D==null?void 0:D.proxy;function y(){e.nextTick(()=>{s.value=!0,n("ready",l),p&&l.addComponentInstance("builder",p)})}return a({ready:s,pageManager:l,getData:u,setData:S,validate:h,getForms:i,setForms:v,validateAll:d,getFormInstance:m}),(w,C)=>e.unref(E.pluginManager).initialized.value?(e.openBlock(),e.createBlock(e.Suspense,{key:1,onResolve:y},{default:e.withCtx(()=>[e.createElementVNode("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.schemas,(I,B)=>(e.openBlock(),e.createBlock(e.unref(te),{key:B,componentSchema:I},null,8,["componentSchema"]))),128))])]),fallback:e.withCtx(()=>[e.createElementVNode("div",Ce,[e.createVNode(e.unref(r))])]),_:1})):(e.openBlock(),e.createElementBlock("div",Se))}});function Q(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ke(t){let a=0,o,r;const n=()=>{a-=1,r&&a<=0&&(r.stop(),o=void 0,r=void 0)};return(...s)=>(a+=1,r||(r=e.effectScope(!0),o=r.run(()=>t(...s))),Q(n),o)}function $(t){return typeof t=="function"?t():e.unref(t)}const Ee=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ae=t=>typeof t<"u",xe=Object.prototype.toString,De=t=>xe.call(t)==="[object Object]",Ie=()=>{};function _e(t){return e.getCurrentInstance()}function Pe(t,a=!0,o){_e()?e.onMounted(t,o):a?t():e.nextTick(t)}function Ve(t=!1,a={}){const{truthyValue:o=!0,falsyValue:r=!1}=a,n=e.isRef(t),s=e.ref(t);function l(c){if(arguments.length)return s.value=c,s.value;{const u=$(o);return s.value=s.value===u?$(r):u,s.value}}return n?l:[s,l]}function Me(t,a,o){const r=e.watch(t,(...n)=>(e.nextTick(()=>r()),a(...n)),o);return r}const z=Ee?window:void 0;function F(t){var a;const o=$(t);return(a=o==null?void 0:o.$el)!=null?a:o}function Be(...t){let a,o,r,n;if(typeof t[0]=="string"||Array.isArray(t[0])?([o,r,n]=t,a=z):[a,o,r,n]=t,!a)return Ie;Array.isArray(o)||(o=[o]),Array.isArray(r)||(r=[r]);const s=[],l=()=>{s.forEach(h=>h()),s.length=0},c=(h,i,v,d)=>(h.addEventListener(i,v,d),()=>h.removeEventListener(i,v,d)),u=e.watch(()=>[F(a),$(n)],([h,i])=>{if(l(),!h)return;const v=De(i)?{...i}:i;s.push(...o.flatMap(d=>r.map(m=>c(h,d,m,v))))},{immediate:!0,flush:"post"}),S=()=>{u(),l()};return Q(S),S}function Fe(t){return typeof t=="function"?t:typeof t=="string"?a=>a.key===t:Array.isArray(t)?a=>t.includes(a.key):()=>!0}function oe(...t){let a,o,r={};t.length===3?(a=t[0],o=t[1],r=t[2]):t.length===2?typeof t[1]=="object"?(a=!0,o=t[0],r=t[1]):(a=t[0],o=t[1]):(a=!0,o=t[0]);const{target:n=z,eventName:s="keydown",passive:l=!1,dedupe:c=!1}=r,u=Fe(a);return Be(n,s,h=>{h.repeat&&$(c)||u(h)&&o(h)},l)}function W(t,a,o={}){return oe(t,a,{...o,eventName:"keydown"})}function H(t,a,o={}){return oe(t,a,{...o,eventName:"keyup"})}function Ne(){const t=e.ref(!1),a=e.getCurrentInstance();return a&&e.onMounted(()=>{t.value=!0},a),t}function Re(t){const a=Ne();return e.computed(()=>(a.value,!!t()))}function Oe(t){return JSON.parse(JSON.stringify(t))}function re(t,a,o={}){const{window:r=z,...n}=o;let s;const l=Re(()=>r&&"ResizeObserver"in r),c=()=>{s&&(s.disconnect(),s=void 0)},u=e.computed(()=>{const i=$(t);return Array.isArray(i)?i.map(v=>F(v)):[F(i)]}),S=e.watch(u,i=>{if(c(),l.value&&r){s=new ResizeObserver(a);for(const v of i)v&&s.observe(v,n)}},{immediate:!0,flush:"post"}),h=()=>{c(),S()};return Q(h),{isSupported:l,stop:h}}function $e(t,a={width:0,height:0},o={}){const{window:r=z,box:n="content-box"}=o,s=e.computed(()=>{var i,v;return(v=(i=F(t))==null?void 0:i.namespaceURI)==null?void 0:v.includes("svg")}),l=e.ref(a.width),c=e.ref(a.height),{stop:u}=re(t,([i])=>{const v=n==="border-box"?i.borderBoxSize:n==="content-box"?i.contentBoxSize:i.devicePixelContentBoxSize;if(r&&s.value){const d=F(t);if(d){const m=d.getBoundingClientRect();l.value=m.width,c.value=m.height}}else if(v){const d=Array.isArray(v)?v:[v];l.value=d.reduce((m,{inlineSize:f})=>m+f,0),c.value=d.reduce((m,{blockSize:f})=>m+f,0)}else l.value=i.contentRect.width,c.value=i.contentRect.height},o);Pe(()=>{const i=F(t);i&&(l.value="offsetWidth"in i?i.offsetWidth:a.width,c.value="offsetHeight"in i?i.offsetHeight:a.height)});const S=e.watch(()=>F(t),i=>{l.value=i?a.width:0,c.value=i?a.height:0});function h(){u(),S()}return{width:l,height:c,stop:h}}function Te(t,a,o,r={}){var n,s,l;const{clone:c=!1,passive:u=!1,eventName:S,deep:h=!1,defaultValue:i,shouldEmit:v}=r,d=e.getCurrentInstance(),m=o||(d==null?void 0:d.emit)||((n=d==null?void 0:d.$emit)==null?void 0:n.bind(d))||((l=(s=d==null?void 0:d.proxy)==null?void 0:s.$emit)==null?void 0:l.bind(d==null?void 0:d.proxy));let f=S;a||(a="modelValue"),f=f||`update:${a.toString()}`;const k=y=>c?typeof c=="function"?c(y):Oe(y):y,D=()=>Ae(t[a])?k(t[a]):i,p=y=>{v?v(y)&&m(f,y):m(f,y)};if(u){const y=D(),w=e.ref(y);let C=!1;return e.watch(()=>t[a],I=>{C||(C=!0,w.value=k(I),e.nextTick(()=>C=!1))}),e.watch(w,I=>{!C&&(I!==t[a]||h)&&p(I)},{deep:h}),w}else return e.computed({get(){return D()},set(y){p(y)}})}function qe(){const{isDark:t}=q(),a=Ve(t);return{isDark:t,toggleDark:a}}function ae(){const t=e.ref(!1);return e.onMounted(()=>{se(t),Le(t)}),e.watch(()=>t.value,()=>{t.value?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}),{isDark:t}}function se(t){var a=document.documentElement;a&&(a.classList.contains("dark")?t.value=!0:t.value=!1)}function Le(t){var a=document.querySelector("html"),o=new MutationObserver(function(r){for(var n of r)if(n.type==="attributes"&&n.attributeName==="class"){const s=n.target;new Array(...s.classList).includes("dark")?t.value=!0:t.value=!1}});o.observe(a,{attributes:!0,attributeFilter:["class"]}),e.onUnmounted(()=>{o.disconnect()})}function ie(){const t=e.ref(1),a=e.ref(!1),{isDark:o}=ae(),{pressSpace:r,pressShift:n,pressCtrl:s}=le();return{canvasScale:t,pressSpace:r,pressShift:n,pressCtrl:s,disabledZoom:a,isDark:o}}const q=ke(ie);function le(){const t=e.ref(!1),a=e.ref(!1),o=e.ref(!1);return W(" ",()=>{t.value=!0}),H(" ",()=>{t.value=!1}),W("Shift",r=>{r.preventDefault(),a.value=!0}),H("Shift",()=>{a.value=!1}),W("Control",r=>{r.preventDefault(),o.value=!0}),H("Control",()=>{o.value=!1}),{pressSpace:t,pressShift:a,pressCtrl:o}}function Ue(t){const{pressSpace:a}=q(),o=new Image(1,1);o.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";let r=0,n=0;function s(u){var S;a.value&&(r=u.x,n=u.y,(S=u.dataTransfer)==null||S.setDragImage(document.createElement("div"),0,0))}function l(u){if(u.preventDefault(),!u.x||!u.y||!a.value)return;const S=u.x-r,h=u.y-n;r=u.x,n=u.y,t.value&&(t.value.scrollTop-=h,t.value.scrollLeft-=S)}function c(){a.value=!1}return{handleElementDragStart:s,handleElementDrag:l,handleElementDragEnd:c}}function ze(t){const{pressCtrl:a,canvasScale:o,disabledZoom:r}=q();function n(s){if(!a.value||r.value)return;s.preventDefault();let l=0;s.deltaY<0?l=o.value+.05:l=o.value-.05,!(l>150||l<.5)&&(o.value=l)}return e.watch(()=>o.value,s=>{t.value&&!r.value&&(t.value.style.transform=`scale(${s})`)}),{handleZoom:n,canvasScale:o}}function Je(t,a=16.66){let o;function r(){n(),o=window.setInterval(t,a)}function n(){window.clearInterval(o)}return{startTimedQuery:r,stopTimedQuery:n}}const We={class:"min-w-750px rounded"},He={class:"h-full rounded"},Ke=e.defineComponent({__name:"index",setup(t,{expose:a}){const o=E.pluginManager.getComponent("monacoEditor"),r=E.pluginManager.getComponent("modal"),n=e.ref(null),s=e.ref(!1),l=e.ref(!1),c=e.ref({}),u=e.inject("pageSchema"),S=e.ref(null),h=e.ref("");function i(){l.value=!1}function v(){s.value=!1}function d(){s.value=!0,h.value=T()}async function m(){try{let f=await S.value.validateAll();if(!Object.keys(f).length){alert("请添加表单组件后再尝试!");return}Object.keys(f).length===1&&(f=f.default),c.value=JSON.stringify(f,null,2),e.nextTick(()=>{var k;(k=n.value)==null||k.setValue(c.value)}),l.value=!0}catch(f){console.error(f)}}return a({handleOpen:d}),(f,k)=>(e.openBlock(),e.createBlock(e.unref(r),{modelValue:s.value,"onUpdate:modelValue":k[1]||(k[1]=D=>s.value=D),title:"预览",class:"w-900px",width:"900px",onClose:v,onOk:m,okText:"表单数据"},{default:e.withCtx(()=>[e.createElementVNode("div",We,[(e.openBlock(),e.createBlock(e.unref(ne),{key:h.value,ref_key:"kb",ref:S,"page-schema":e.unref(u)},null,8,["page-schema"])),e.createVNode(e.unref(r),{modelValue:l.value,"onUpdate:modelValue":k[0]||(k[0]=D=>l.value=D),title:"表单数据",class:"w-860px",width:"860px",onClose:i,onOk:i},{default:e.withCtx(()=>[e.createElementVNode("div",He,[e.createVNode(e.unref(o),{ref_key:"monacoEditorRef",ref:n,autoToggleTheme:"",readOnly:"",class:"h-full editor","model-value":c.value},null,8,["model-value"])])]),_:1},8,["modelValue"])])]),_:1},8,["modelValue"]))}}),Ze={key:0,class:"epic-loading-box"},Qe={class:"epic-designer-main"},Ge={class:"epic-header-container"},Ye={class:"epic-loading-box"},Xe=e.defineComponent({__name:"designer",props:{disabledZoom:{type:Boolean,default:!1},hiddenHeader:{type:Boolean,default:!1},lockDefaultSchemaEdit:{type:Boolean,default:!1},formMode:{type:Boolean,default:!1},title:{default:"EpicDesigner默认项目"},defaultSchema:{},sourceCodeReadOnly:{type:Boolean},source:{default:[]}},emits:["ready","save","reset","toggleDeviceMode","saveSourceData","deleteSourceData","updateSourceData"],setup(t,{expose:a,emit:o}){const r=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Bs6GdgDl.cjs"))),n=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-CuxnFxdY.cjs"))),s=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-D-2x46HI.cjs"))),l=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-DBQ-tc2k.cjs"))),c=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Cap7FkuS.cjs"))),u=Z(),S=ee(),h=t;let i={schemas:[{type:"form",id:"root",label:"页面",children:[],componentProps:{name:"表单",style:{padding:"16px"}}}],script:`const { defineExpose, find } = epic;
|
|
1
|
+
"use strict";const e=require("vue"),E=require("./pluginManager-itCTrGag.cjs");function T(t=10){const a="abcdefghijklmnopqrstuvwxyz0123456789";let o="";for(let r=0;r<t;r++){const n=Math.floor(Math.random()*a.length);o+=a[n]}return o}function G(t){return t.charAt(0).toUpperCase()+t.slice(1)}function V(t,a=new WeakMap){if(typeof t!="object"||t===null)return t;if(a.has(t))return a.get(t);if(Array.isArray(t)){const r=t.map(n=>V(n,a));return a.set(t,r),r}const o={};return a.set(t,o),Object.keys(t).forEach(r=>{o[r]=V(t[r],a)}),o}function ue(t){const[a]=j([V(t)],o=>{var n,s;const r={...o,id:`${o.type}_${T(8)}`};return(r.field||r.input)&&!((s=(n=E.pluginManager.getComponentConfingByType(r.type))==null?void 0:n.editConstraints)!=null&&s.fixedField)&&(r.field=r.id),r});return a}function M(t,a,o=!0){for(const[r,n]of Object.entries(a)){let s=t==null?void 0:t[r];s&&n&&typeof s=="object"&&typeof n=="object"?(Array.isArray(s)&&!Array.isArray(n)?s=t[r]={}:!Array.isArray(s)&&Array.isArray(n)&&(s=t[r]=[]),M(s,n,o)):t[r]=n}o&&Object.keys(t).reverse().forEach(r=>{a.hasOwnProperty(r)||(Array.isArray(t)?t.splice(Number(r),1):delete t[r])})}function K(t,a,o=[],r=new WeakMap){const n=s=>{if(Array.isArray(s))return s.map(n);if(typeof s=="object"&&s!==null){if(r.has(s))return"[Circular]";r.set(s,!0);const l=Object.keys(s).sort(),c={};return l.forEach(u=>{o.includes(u)||(c[u]=n(s[u]))}),r.delete(s),c}else return s};return JSON.stringify(n(t))===JSON.stringify(n(a))}function Y(t,a){const o=[];let r=!1;function n(s){if(o.push(s),s.id===a&&(r=!0),!r&&s.children!=null&&s.children.length>0)for(let l=0;l<s.children.length&&(n(s.children[l]),!r);l++);if(!r&&s.slots)for(let l in s.slots)for(let c=0;c<s.slots[l].length&&(n(s.slots[l][c]),!r);c++);r||o.pop()}return t.forEach(n),r||console.error(`没有查询到id为${a}的节点`),o}function de(t,a,o){const r=a.split(".");let n=t;for(let s=0;s<r.length;s++){if(n==null)return o;n=n[r[s]]}return n===void 0?o:n}function fe(t,a,o){const r=a.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean);let n=t;for(let s=0;s<r.length-1;s++){const l=r[s];n[l]==null&&(n[l]=isNaN(Number(r[s+1]))?{}:[]),n=n[l]}return n[r[r.length-1]]=o,t}function pe(t,a="default"){return X(t,a).map(r=>r.field)}function X(t,a="default"){const o=O(t,n=>{var s;return n.type==="form"&&(((s=n.componentProps)==null?void 0:s.name)??n.name===a)},!0);return O((o==null?void 0:o.children)??[],n=>!!n.input,!1,n=>n.type!=="subform")}function O(t,a,o=!1,r){const n=[],s=[...t];for(;s.length;){const l=s.pop();if(l!=null&&l.children&&(!r||r(l))&&s.push(...l.children),l!=null&&l.slots&&(!r||r(l)))for(let c in l.slots)s.push(...l.slots[c]);if(a(l)&&(n.push(l),o))return l}return o?!1:n}function j(t,a,o){const r=[...t];for(;r.length;){const n=r.pop();if(n!=null&&n.children&&(!o||o(n))&&r.push(...n.children),n!=null&&n.slots&&(!o||o(n)))for(let s in n.slots)r.push(...n.slots[s]);M(n,a(n))}return t}function me(t,a){const o=O(t,r=>r.id===a,!0);if(!o)throw new Error(`没有查询到id为${a}的节点`);return o}function he(t,a){const o=[{type:"",children:t}];let r=0,n=null;if(O(o,s=>{if(n=s.children??null,!n){if(s!=null&&s.slots)for(let l in s.slots){n=s.slots[l];for(let c=0;c<n.length;c++)if(n[c].id===a)return r=c,!0}return!1}for(let l=0;l<n.length;l++)if(n[l].id===a)return r=l,!0;return!1},!0),!n)throw new Error(`没有查询到id为${a}的节点`);return{list:n,schema:n[r],index:r}}function ve(t){const a={schemas:[{type:"page",id:"root",label:"页面",children:[{label:"表单",type:"form",icon:"epic-icon-daibanshixiang",labelWidth:t.config.labelWidth||100,name:"default",componentProps:{layout:t.config.layout||"horizontal",labelWidth:t.config.labelWidth||100,labelLayout:t.config.labelLayout==="flex"?"fixed":"flex",labelCol:t.config.labelCol||{span:5},wrapperCol:t.config.wrapperCol||{span:19},hideRequiredMark:t.config.hideRequiredMark||!1,colon:t.config.colon||!0,labelAlign:t.config.labelAlign||"right",size:t.config.size||"middle"},children:[],id:"form_"+T()}],componentProps:{style:{padding:"16px"}}}],script:t.script||""};return a.schemas[0].children[0].children=R(t.list),a}function R(t,a){return t.map(o=>{var u,S,h;let r=o.type??"";const n=o.options??{},s=(i,v)=>{r===i&&(r=v,n.defaultValue&&(n.defaultValue=JSON.parse(n.defaultValue)))};if(s("uploadImg","upload-image"),s("uploadFile","upload-file"),r==="date"&&n.range&&(n.type="daterange",delete n.range),(r==="date"||r==="time")&&(n.valueFormat=n.format),r==="textarea"){const{minRows:i,maxRows:v}=n;n.autoSize={minRows:i,maxRows:v},delete n.minRows,delete n.maxRows}r==="number"&&!n.precision&&delete n.precision,n.width&&(n.style={width:n.width},delete n.width),r==="grid"&&(r="row"),a&&a.type==="grid"&&(r="col",n.span=o.span,o.key=T());const l={label:o.label,type:r,icon:o.icon||"",field:o.model,componentProps:n,id:o.key};return(n.noFormItem||!n.showLabel)&&(l.noFormItem=!0,delete n.noFormItem,delete n.showLabel),n.clearable&&(n.allowClear=!0,delete n.clearable),["input","textarea","number","password","select","cascader","checkbox","radio","date","time","slider","switch","color-picker","upload-file","upload-image"].includes(r)&&(l.input=!0,((S=(u=o.rules)==null?void 0:u[0])==null?void 0:S.required)===!1&&o.rules.shift(),((h=o.rules)==null?void 0:h.length)>0&&(l.rules=o.rules)),o.list&&(l.children=R(o.list,o)),o.columns&&(l.children=R(o.columns,o)),o.trs&&(l.children=R(o.trs,o)),o.tds&&(l.children=R(o.tds,o)),l})}function ge(t,a){let o=null;return(...r)=>{o&&clearTimeout(o),o=setTimeout(()=>{t(...r)},a)}}function Z(){const t=e.ref({}),a=e.ref({}),o=e.ref(!1),r=e.ref([]),n=e.reactive({});function s(p){return t.value[p]}function l(p,y){t.value[p]=y}function c(p){delete t.value[p]}function u(p,y=!1){const w=Object.entries(E.pluginManager.publicMethods).reduce((C,[I,B])=>(C[I]=B.handler,C),{});try{new Function(`const epic = this;${p}`).bind({...w,getComponent:s,find:s,defineExpose:S,publicMethods:w,pluginManager:E.pluginManager})()}catch(C){y&&console.error("[epic:自定义函数]异常:",C)}}function S(p){p!=null&&(a.value=p)}function h(p,...y){if(!p||p.length===0){console.warn("未提供任何动作");return}p.forEach(w=>{const C=w.args?JSON.parse(w.args):y;switch(w.type){case"public":i(w,C);break;case"custom":v(w,C);break;case"component":d(w,C);break;default:console.warn(`未知的动作类型: ${w.type}`);break}})}function i(p,y){var w;try{(w=E.pluginManager.publicMethods[p.methodName])==null||w.handler(...y)}catch(C){console.error(`[Epic:公共函数(${p.methodName})]执行异常:`,C)}}function v(p,y){var w,C;try{(C=(w=a.value)[p.methodName])==null||C.call(w,...y)}catch(I){console.error(`[Epic:自定义函数(${p.methodName})]执行异常:`,I)}}function d(p,y){const w=p.componentId!=null&&s(p.componentId);if(!w){console.warn(`[Epic:组件${p.componentId}]未找到`);return}try{w[p.methodName](...y)}catch(C){console.error(`[Epic:组件${p.componentId}函数(${p.methodName})]执行异常:`,C)}}function m(p=!0){o.value=p}function f(p){const y=O(p,()=>!0);r.value=y.map(w=>w.id)}function k(p,y="default"){if(n[y]){const w=n[y];M(p,w)}n[y]=p}function D(p,y="default"){if(n[y]){M(n[y],p,!1);return}n[y]=p}return{componentInstances:t,funcs:a,isDesignMode:o,defaultComponentIds:r,forms:n,addFormData:k,setFormData:D,getComponentInstance:s,find:s,addComponentInstance:l,removeComponentInstance:c,setMethods:u,doActions:h,setDesignMode:m,setDefaultComponentIds:f}}function ee(){const t=e.ref([]),a=e.ref([]),o=e.ref(null);let r=0;function n(u,S="插入组件"){const h=Date.now();r+150>h||(r=h,o.value!=null&&(t.value.push(o.value),a.value.splice(0,a.value.length)),o.value={type:S,componentSchema:JSON.stringify(u)},t.value.length>60&&t.value.unshift())}function s(){if(t.value.length===0)return!1;const u=t.value.pop();return o.value!=null&&a.value.push(o.value),o.value=u,JSON.parse(u.componentSchema)}function l(){if(a.value.length===0)return!1;const u=a.value.pop();return o.value!=null&&t.value.push(o.value),o.value=u,JSON.parse(u.componentSchema)}function c(){t.value=[],a.value=[],o.value=null}return{recordList:t,undoList:a,currentRecord:o,push:n,undo:s,redo:l,reset:c}}const ye=e.defineComponent({__name:"dynamicFormItem",props:{hasFormItem:{type:Boolean},formItemProps:{}},emits:["updateFormItemRef"],setup(t,{emit:a}){const o=E.pluginManager.getComponent("form-item"),r=t,n=a,s=e.ref(),l=()=>{n("updateFormItemRef",s.value)};return(c,u)=>r.hasFormItem?(e.openBlock(),e.createBlock(e.unref(o),e.mergeProps({key:0,ref_key:"formItemRef",ref:s,onVnodeMounted:l},r.formItemProps),{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3},16,["onVnodeMounted"])):e.renderSlot(c.$slots,"default",{key:1})}}),te=e.defineComponent({name:"ENode",__name:"node",props:{componentSchema:{},modelValue:{},ruleField:{},resetFormData:{type:Boolean},name:{},dynamicId:{}},emits:["update:modelValue","change","update:dynamicId"],setup(t,{emit:a}){const{proxy:o}=e.getCurrentInstance(),r=t,n=e.ref(null);let s=e.inject("formData",e.reactive({}));const l=e.inject("slots",{}),c=e.inject("pageManager",{}),u=e.inject("disabled",{value:!1}),S=e.inject("ruleFieldPrefix",null),h=e.inject("resetFormData",!1);let i=e.reactive(V(r.componentSchema));v(),e.watch(()=>r.componentSchema,g=>{K(i,g,["children"])||(M(i,V(g)),v())},{deep:!0});function v(){c.isDesignMode.value&&typeof i.field=="string"&&(i.field+="-design-mode")}(r.resetFormData||h)&&(s={});const d=a,m=e.ref(),f=e.ref(),k=g=>{f.value=g},D=e.useAttrs();Object.keys(D).length&&e.provide("nodeAttrs",D);const p=e.shallowRef(null),y=e.computed(()=>{var g,A;return(g=i.componentProps)!=null&&g.hidden?!1:typeof i.show=="boolean"?i.show:((A=i.show)==null?void 0:A.call(i,{values:s}))??!0}),w=e.computed(()=>{var P;const g=y.value&&((P=i.rules)==null?void 0:P.map(x=>({...x,validator:x.validator&&c.funcs.value[x.validator]})));let A=i.field;r.ruleField?A=r.ruleField:S&&i.field&&(A=V(S),A.push(i.field));const _={...i,rules:g,rule:g,field:A};return _.children&&delete _.children,_}),C=e.computed(()=>{var _,P;const g=((_=I.value)==null?void 0:_.bindModel)??"modelValue",A={};return i.on&&Object.keys(i.on).forEach(x=>{A[`on${G(x)}`]=(...ce)=>c.doActions(i.on[x],...ce)}),{...r,...i.componentProps,disabled:(u==null?void 0:u.value)||((P=i.componentProps)==null?void 0:P.disabled),bindModel:g,...A}}),I=e.computed(()=>E.pluginManager.getComponentConfingByType(i.type)??null);e.watchEffect(()=>{n.value=r.modelValue??s[i.field??""]}),e.watch(()=>n.value,()=>{n.value!==(r.modelValue??s[i.field??""])&&N(n.value)}),e.watch(()=>m.value,()=>{B()},{immediate:!0});function B(){var A;const g=m.value||o;i.id&&g&&(i.input&&(g.setValue=N,g.getValue=()=>s[i.field]||r.modelValue),g.setAttr=(_,P)=>(i.componentProps||(i.componentProps={}),i.componentProps[_]=P),g.getAttr=_=>i.componentProps[_],c.addComponentInstance(i.id,g),(A=I.value)!=null&&A.defaultSchema.input&&i.noFormItem!==!0&&f.value&&c.addComponentInstance(i.id+"formItem",f.value))}function L(){var g;i.id&&(c.removeComponentInstance(i.id),(g=I.value)!=null&&g.defaultSchema.input&&i.noFormItem!==!0&&c.removeComponentInstance(i.id+"formItem"))}async function J(){var A,_,P;if(typeof((A=i.componentProps)==null?void 0:A.defaultValue)<"u"){const x=c.isDesignMode.value?(_=i.componentProps)==null?void 0:_.defaultValue:s[i.field]??((P=i.componentProps)==null?void 0:P.defaultValue);N(V(x))}if(i.type==="slot"){const x=i.slotName;if(!x)return;p.value=e.defineComponent({setup(){return()=>e.renderSlot(l,x,{componentSchema:i,model:s})}});return}const g=E.pluginManager.getComponent(i.type);if(!g){console.error(`组件${i.type}未注册`);return}if(typeof g=="function"){const x=await g();p.value=x.default??x}else p.value=g}function N(g){d("update:modelValue",g),d("change",g),i.field&&(s[i.field]=g)}function U(g){d("update:dynamicId",g)}let b=null;return e.watch(()=>i,g=>{const A=JSON.stringify({...g,children:void 0});if(A===b)return!1;b=A,J()},{immediate:!0,deep:!0}),e.onUnmounted(L),(g,A)=>{var P;const _=e.resolveComponent("ENode");return p.value&&y.value?(e.openBlock(),e.createBlock(ye,{key:0,hasFormItem:e.unref(i).noFormItem!==!0&&((P=I.value)==null?void 0:P.defaultSchema.input),formItemProps:w.value,onUpdateFormItemRef:k},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value),e.mergeProps({ref_key:"componentInstance",ref:m,onVnodeMounted:B,model:e.unref(s)},{...C.value},{[C.value.bindModel]:n.value,["onUpdate:"+C.value.bindModel]:A[0]||(A[0]=x=>n.value=x),[`onUpdate:${C.value.bindModel}`||""]:N,"onUpdate:dynamicId":U}),{node:e.withCtx(x=>[e.createVNode(_,e.normalizeProps(e.guardReactiveProps(x)),null,16)]),"edit-node":e.withCtx(()=>[e.renderSlot(g.$slots,"edit-node")]),_:3},16,["model"]))]),_:3},8,["hasFormItem","formItemProps"])):e.createCommentVNode("",!0)}}});function we(){const t=e.ref(!1),a=Z(),o=e.ref({});function r(){return new Promise(d=>{if(t.value)d();else{const m=e.watch(t,()=>{m(),d()})}})}async function n(d="default"){var f;await r();const m=(f=o.value)==null?void 0:f[d];if(!m)throw new Error(`表单 [name=${d}] 不存在`);return m}async function s(d,m){const f=await n(d);return V(await m(f))}async function l(d="default"){return await s(d,m=>m.getData())}function c(d,m="default"){var k;a.setFormData(d,m);const f=(k=o.value)==null?void 0:k[m];f==null||f.clearValidate()}async function u(d="default"){return await s(d,async m=>(await m.validate(),await m.getData()))}async function S(d){await r();const m={};for(const f in o.value){const k=o.value[f];k&&(m[f]=V(await d(k)))}return m}async function h(){return await S(d=>d.getData())}function i(d){for(const m in d)c(d[m],m)}async function v(){return await S(async d=>(await d.validate(),await d.getData()))}return{ready:t,pageManager:a,forms:o,getData:l,setData:c,validate:u,getForms:h,setForms:i,validateAll:v,getFormInstance:n}}const Se={key:0,class:"epic-loading-box"},be={class:"epic-builder-main"},Ce={class:"epic-loading-box"},ne=e.defineComponent({__name:"builder",props:{pageSchema:{},formData:{},disabled:{type:Boolean}},emits:["ready"],setup(t,{expose:a,emit:o}){const r=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Cap7FkuS.cjs"))),n=o,{ready:s,pageManager:l,forms:c,getData:u,setData:S,validate:h,getForms:i,setForms:v,validateAll:d,getFormInstance:m}=we(),f=t,k=e.reactive({schemas:[]});e.watch(()=>f.pageSchema,w=>{M(k,w)},{immediate:!0,deep:!0}),e.watch(()=>f.formData,w=>{w&&S(w)},{immediate:!0,deep:!0}),e.watch(()=>k.script,w=>{w&&l.setMethods(w,!0)},{immediate:!0}),e.provide("slots",e.useSlots()),e.provide("pageManager",l),e.provide("forms",c),e.provide("pageSchema",k),e.provide("disabled",e.computed(()=>f.disabled));const D=e.getCurrentInstance(),p=D==null?void 0:D.proxy;function y(){e.nextTick(()=>{s.value=!0,n("ready",l),p&&l.addComponentInstance("builder",p)})}return a({ready:s,pageManager:l,getData:u,setData:S,validate:h,getForms:i,setForms:v,validateAll:d,getFormInstance:m}),(w,C)=>e.unref(E.pluginManager).initialized.value?(e.openBlock(),e.createBlock(e.Suspense,{key:1,onResolve:y},{default:e.withCtx(()=>[e.createElementVNode("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.schemas,(I,B)=>(e.openBlock(),e.createBlock(e.unref(te),{key:B,componentSchema:I},null,8,["componentSchema"]))),128))])]),fallback:e.withCtx(()=>[e.createElementVNode("div",Ce,[e.createVNode(e.unref(r))])]),_:1})):(e.openBlock(),e.createElementBlock("div",Se))}});function Q(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ke(t){let a=0,o,r;const n=()=>{a-=1,r&&a<=0&&(r.stop(),o=void 0,r=void 0)};return(...s)=>(a+=1,r||(r=e.effectScope(!0),o=r.run(()=>t(...s))),Q(n),o)}function $(t){return typeof t=="function"?t():e.unref(t)}const Ee=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ae=t=>typeof t<"u",xe=Object.prototype.toString,De=t=>xe.call(t)==="[object Object]",Ie=()=>{};function _e(t){return e.getCurrentInstance()}function Pe(t,a=!0,o){_e()?e.onMounted(t,o):a?t():e.nextTick(t)}function Ve(t=!1,a={}){const{truthyValue:o=!0,falsyValue:r=!1}=a,n=e.isRef(t),s=e.ref(t);function l(c){if(arguments.length)return s.value=c,s.value;{const u=$(o);return s.value=s.value===u?$(r):u,s.value}}return n?l:[s,l]}function Me(t,a,o){const r=e.watch(t,(...n)=>(e.nextTick(()=>r()),a(...n)),o);return r}const z=Ee?window:void 0;function F(t){var a;const o=$(t);return(a=o==null?void 0:o.$el)!=null?a:o}function Be(...t){let a,o,r,n;if(typeof t[0]=="string"||Array.isArray(t[0])?([o,r,n]=t,a=z):[a,o,r,n]=t,!a)return Ie;Array.isArray(o)||(o=[o]),Array.isArray(r)||(r=[r]);const s=[],l=()=>{s.forEach(h=>h()),s.length=0},c=(h,i,v,d)=>(h.addEventListener(i,v,d),()=>h.removeEventListener(i,v,d)),u=e.watch(()=>[F(a),$(n)],([h,i])=>{if(l(),!h)return;const v=De(i)?{...i}:i;s.push(...o.flatMap(d=>r.map(m=>c(h,d,m,v))))},{immediate:!0,flush:"post"}),S=()=>{u(),l()};return Q(S),S}function Fe(t){return typeof t=="function"?t:typeof t=="string"?a=>a.key===t:Array.isArray(t)?a=>t.includes(a.key):()=>!0}function oe(...t){let a,o,r={};t.length===3?(a=t[0],o=t[1],r=t[2]):t.length===2?typeof t[1]=="object"?(a=!0,o=t[0],r=t[1]):(a=t[0],o=t[1]):(a=!0,o=t[0]);const{target:n=z,eventName:s="keydown",passive:l=!1,dedupe:c=!1}=r,u=Fe(a);return Be(n,s,h=>{h.repeat&&$(c)||u(h)&&o(h)},l)}function W(t,a,o={}){return oe(t,a,{...o,eventName:"keydown"})}function H(t,a,o={}){return oe(t,a,{...o,eventName:"keyup"})}function Ne(){const t=e.ref(!1),a=e.getCurrentInstance();return a&&e.onMounted(()=>{t.value=!0},a),t}function Re(t){const a=Ne();return e.computed(()=>(a.value,!!t()))}function Oe(t){return JSON.parse(JSON.stringify(t))}function re(t,a,o={}){const{window:r=z,...n}=o;let s;const l=Re(()=>r&&"ResizeObserver"in r),c=()=>{s&&(s.disconnect(),s=void 0)},u=e.computed(()=>{const i=$(t);return Array.isArray(i)?i.map(v=>F(v)):[F(i)]}),S=e.watch(u,i=>{if(c(),l.value&&r){s=new ResizeObserver(a);for(const v of i)v&&s.observe(v,n)}},{immediate:!0,flush:"post"}),h=()=>{c(),S()};return Q(h),{isSupported:l,stop:h}}function $e(t,a={width:0,height:0},o={}){const{window:r=z,box:n="content-box"}=o,s=e.computed(()=>{var i,v;return(v=(i=F(t))==null?void 0:i.namespaceURI)==null?void 0:v.includes("svg")}),l=e.ref(a.width),c=e.ref(a.height),{stop:u}=re(t,([i])=>{const v=n==="border-box"?i.borderBoxSize:n==="content-box"?i.contentBoxSize:i.devicePixelContentBoxSize;if(r&&s.value){const d=F(t);if(d){const m=d.getBoundingClientRect();l.value=m.width,c.value=m.height}}else if(v){const d=Array.isArray(v)?v:[v];l.value=d.reduce((m,{inlineSize:f})=>m+f,0),c.value=d.reduce((m,{blockSize:f})=>m+f,0)}else l.value=i.contentRect.width,c.value=i.contentRect.height},o);Pe(()=>{const i=F(t);i&&(l.value="offsetWidth"in i?i.offsetWidth:a.width,c.value="offsetHeight"in i?i.offsetHeight:a.height)});const S=e.watch(()=>F(t),i=>{l.value=i?a.width:0,c.value=i?a.height:0});function h(){u(),S()}return{width:l,height:c,stop:h}}function Te(t,a,o,r={}){var n,s,l;const{clone:c=!1,passive:u=!1,eventName:S,deep:h=!1,defaultValue:i,shouldEmit:v}=r,d=e.getCurrentInstance(),m=o||(d==null?void 0:d.emit)||((n=d==null?void 0:d.$emit)==null?void 0:n.bind(d))||((l=(s=d==null?void 0:d.proxy)==null?void 0:s.$emit)==null?void 0:l.bind(d==null?void 0:d.proxy));let f=S;a||(a="modelValue"),f=f||`update:${a.toString()}`;const k=y=>c?typeof c=="function"?c(y):Oe(y):y,D=()=>Ae(t[a])?k(t[a]):i,p=y=>{v?v(y)&&m(f,y):m(f,y)};if(u){const y=D(),w=e.ref(y);let C=!1;return e.watch(()=>t[a],I=>{C||(C=!0,w.value=k(I),e.nextTick(()=>C=!1))}),e.watch(w,I=>{!C&&(I!==t[a]||h)&&p(I)},{deep:h}),w}else return e.computed({get(){return D()},set(y){p(y)}})}function qe(){const{isDark:t}=q(),a=Ve(t);return{isDark:t,toggleDark:a}}function ae(){const t=e.ref(!1);return e.onMounted(()=>{se(t),Le(t)}),e.watch(()=>t.value,()=>{t.value?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}),{isDark:t}}function se(t){var a=document.documentElement;a&&(a.classList.contains("dark")?t.value=!0:t.value=!1)}function Le(t){var a=document.querySelector("html"),o=new MutationObserver(function(r){for(var n of r)if(n.type==="attributes"&&n.attributeName==="class"){const s=n.target;new Array(...s.classList).includes("dark")?t.value=!0:t.value=!1}});o.observe(a,{attributes:!0,attributeFilter:["class"]}),e.onUnmounted(()=>{o.disconnect()})}function ie(){const t=e.ref(1),a=e.ref(!1),{isDark:o}=ae(),{pressSpace:r,pressShift:n,pressCtrl:s}=le();return{canvasScale:t,pressSpace:r,pressShift:n,pressCtrl:s,disabledZoom:a,isDark:o}}const q=ke(ie);function le(){const t=e.ref(!1),a=e.ref(!1),o=e.ref(!1);return W(" ",()=>{t.value=!0}),H(" ",()=>{t.value=!1}),W("Shift",r=>{r.preventDefault(),a.value=!0}),H("Shift",()=>{a.value=!1}),W("Control",r=>{r.preventDefault(),o.value=!0}),H("Control",()=>{o.value=!1}),{pressSpace:t,pressShift:a,pressCtrl:o}}function Ue(t){const{pressSpace:a}=q(),o=new Image(1,1);o.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";let r=0,n=0;function s(u){var S;a.value&&(r=u.x,n=u.y,(S=u.dataTransfer)==null||S.setDragImage(document.createElement("div"),0,0))}function l(u){if(u.preventDefault(),!u.x||!u.y||!a.value)return;const S=u.x-r,h=u.y-n;r=u.x,n=u.y,t.value&&(t.value.scrollTop-=h,t.value.scrollLeft-=S)}function c(){a.value=!1}return{handleElementDragStart:s,handleElementDrag:l,handleElementDragEnd:c}}function ze(t){const{pressCtrl:a,canvasScale:o,disabledZoom:r}=q();function n(s){if(!a.value||r.value)return;s.preventDefault();let l=0;s.deltaY<0?l=o.value+.05:l=o.value-.05,!(l>150||l<.5)&&(o.value=l)}return e.watch(()=>o.value,s=>{t.value&&!r.value&&(t.value.style.transform=`scale(${s})`)}),{handleZoom:n,canvasScale:o}}function Je(t,a=16.66){let o;function r(){n(),o=window.setInterval(t,a)}function n(){window.clearInterval(o)}return{startTimedQuery:r,stopTimedQuery:n}}const We={class:"min-w-750px rounded"},He={class:"h-full rounded"},Ke=e.defineComponent({__name:"index",setup(t,{expose:a}){const o=E.pluginManager.getComponent("monacoEditor"),r=E.pluginManager.getComponent("modal"),n=e.ref(null),s=e.ref(!1),l=e.ref(!1),c=e.ref({}),u=e.inject("pageSchema"),S=e.ref(null),h=e.ref("");function i(){l.value=!1}function v(){s.value=!1}function d(){s.value=!0,h.value=T()}async function m(){try{let f=await S.value.validateAll();if(!Object.keys(f).length){alert("请添加表单组件后再尝试!");return}Object.keys(f).length===1&&(f=f.default),c.value=JSON.stringify(f,null,2),e.nextTick(()=>{var k;(k=n.value)==null||k.setValue(c.value)}),l.value=!0}catch(f){console.error(f)}}return a({handleOpen:d}),(f,k)=>(e.openBlock(),e.createBlock(e.unref(r),{modelValue:s.value,"onUpdate:modelValue":k[1]||(k[1]=D=>s.value=D),title:"预览",class:"w-900px",width:"900px",onClose:v,onOk:m,okText:"表单数据"},{default:e.withCtx(()=>[e.createElementVNode("div",We,[(e.openBlock(),e.createBlock(e.unref(ne),{key:h.value,ref_key:"kb",ref:S,"page-schema":e.unref(u)},null,8,["page-schema"])),e.createVNode(e.unref(r),{modelValue:l.value,"onUpdate:modelValue":k[0]||(k[0]=D=>l.value=D),title:"表单数据",class:"w-860px",width:"860px",onClose:i,onOk:i},{default:e.withCtx(()=>[e.createElementVNode("div",He,[e.createVNode(e.unref(o),{ref_key:"monacoEditorRef",ref:n,autoToggleTheme:"",readOnly:"",class:"h-full editor","model-value":c.value},null,8,["model-value"])])]),_:1},8,["modelValue"])])]),_:1},8,["modelValue"]))}}),Ze={key:0,class:"epic-loading-box"},Qe={class:"epic-designer-main"},Ge={class:"epic-header-container"},Ye={class:"epic-loading-box"},Xe=e.defineComponent({__name:"designer",props:{disabledZoom:{type:Boolean,default:!1},hiddenHeader:{type:Boolean,default:!1},lockDefaultSchemaEdit:{type:Boolean,default:!1},formMode:{type:Boolean,default:!1},title:{default:"EpicDesigner默认项目"},defaultSchema:{},sourceCodeReadOnly:{type:Boolean},source:{default:[]}},emits:["ready","save","reset","toggleDeviceMode","saveSourceData","deleteSourceData","updateSourceData"],setup(t,{expose:a,emit:o}){const r=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Bs6GdgDl.cjs"))),n=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-CuxnFxdY.cjs"))),s=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-CaIsXqm5.cjs"))),l=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-DBQ-tc2k.cjs"))),c=E.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Cap7FkuS.cjs"))),u=Z(),S=ee(),h=t;let i={schemas:[{type:"form",id:"root",label:"页面",children:[],componentProps:{name:"表单",style:{padding:"16px"}}}],script:`const { defineExpose, find } = epic;
|
|
2
2
|
|
|
3
3
|
function test (){
|
|
4
4
|
console.log('test')
|
|
@@ -7,4 +7,4 @@ function test (){
|
|
|
7
7
|
// 通过defineExpose暴露的函数或者属性
|
|
8
8
|
defineExpose({
|
|
9
9
|
test
|
|
10
|
-
})`};e.watchEffect(()=>{if(h.defaultSchema){i=h.defaultSchema;return}h.source&&E.pluginManager.setSourceData(h.source),h.formMode&&(i.schemas=E.pluginManager.formSchemas)}),u.setDesignMode(),u.setDefaultComponentIds(i.schemas);const v=o,d=e.ref(null),m=e.reactive({checkedNode:null,hoverNode:null,disableHover:!1,matched:[]}),f=e.reactive({schemas:[],script:i.script}),{disabledZoom:k}=q();e.watchEffect(()=>{k.value=h.disabledZoom}),e.watchEffect(()=>{const b=f.script;b&&b!==""&&u.setMethods(b)}),e.provide("pageSchema",f),e.provide("revoke",S),e.provide("pageManager",u),e.provide("designerProps",e.computed(()=>h)),e.provide("designer",{setCheckedNode:p,setHoverNode:y,setDisableHover:C,handleToggleDeviceMode:N,reset:L,state:m}),E.EventBus.on("saveSourceData",b=>{v("saveSourceData",b)}),E.EventBus.on("deleteSourceData",b=>{v("deleteSourceData",b)}),E.EventBus.on("updateSourceData",b=>{v("updateSourceData",b)});function D(){f.schemas=V(i.schemas),p(f.schemas[0]),S.push(f.schemas,"初始化撤销功能")}async function p(b=f.schemas[0]){m.checkedNode=b,m.matched=Y(f.schemas,b.id)}async function y(b=null){var g;if(!b||m.disableHover)return m.hoverNode=null,!1;if((b==null?void 0:b.id)===((g=m.hoverNode)==null?void 0:g.id))return!1;m.hoverNode=b}function w(){e.nextTick(()=>{v("ready",{pageManager:u})})}async function C(b=!1){m.disableHover=b}function I(b){M(f,V(b))}function B(){return e.toRaw(f)}function L(){K(f.schemas,i.schemas)&&f.script===i.script||(M(f.schemas,i.schemas),f.script=i.script,p(f.schemas[0]),S.push(f.schemas,"重置操作"),v("reset",f))}function J(){v("save",e.toRaw(f))}function N(b){v("toggleDeviceMode",b)}function U(){d.value.handleOpen()}return D(),a({revoke:S,setData:I,getData:B,reset:L,preview:U}),(b,g)=>e.unref(E.pluginManager).initialized.value?(e.openBlock(),e.createBlock(e.Suspense,{key:1,onResolve:w},{default:e.withCtx(()=>[e.createElementVNode("div",Qe,[e.createElementVNode("div",Ge,[e.renderSlot(b.$slots,"header",{},()=>[h.hiddenHeader?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(r),{key:0,onPreview:U,onSave:J},{header:e.withCtx(()=>[e.renderSlot(b.$slots,"header-prefix")]),prefix:e.withCtx(()=>[e.renderSlot(b.$slots,"header-prefix")]),title:e.withCtx(()=>[e.renderSlot(b.$slots,"header-title")]),"right-prefix":e.withCtx(()=>[e.renderSlot(b.$slots,"header-right-prefix")]),"right-action":e.withCtx(()=>[e.renderSlot(b.$slots,"header-right-action")]),"right-suffix":e.withCtx(()=>[e.renderSlot(b.$slots,"header-right-suffix")]),_:3}))])]),e.createElementVNode("div",{class:e.normalizeClass(["epic-split-view-container",{"hidden-header":b.hiddenHeader}])},[e.createVNode(e.unref(n)),e.createVNode(e.unref(s)),e.createVNode(e.unref(l))],2),e.createVNode(Ke,{ref_key:"previewRef",ref:d},null,512)])]),fallback:e.withCtx(()=>[e.createElementVNode("div",Ye,[e.createVNode(e.unref(c))])]),_:3})):(e.openBlock(),e.createElementBlock("div",Ze))}}),je={component:async()=>await Promise.resolve().then(()=>require("./index-
|
|
10
|
+
})`};e.watchEffect(()=>{if(h.defaultSchema){i=h.defaultSchema;return}h.source&&E.pluginManager.setSourceData(h.source),h.formMode&&(i.schemas=E.pluginManager.formSchemas)}),u.setDesignMode(),u.setDefaultComponentIds(i.schemas);const v=o,d=e.ref(null),m=e.reactive({checkedNode:null,hoverNode:null,disableHover:!1,matched:[]}),f=e.reactive({schemas:[],script:i.script}),{disabledZoom:k}=q();e.watchEffect(()=>{k.value=h.disabledZoom}),e.watchEffect(()=>{const b=f.script;b&&b!==""&&u.setMethods(b)}),e.provide("pageSchema",f),e.provide("revoke",S),e.provide("pageManager",u),e.provide("designerProps",e.computed(()=>h)),e.provide("designer",{setCheckedNode:p,setHoverNode:y,setDisableHover:C,handleToggleDeviceMode:N,reset:L,state:m}),E.EventBus.on("saveSourceData",b=>{v("saveSourceData",b)}),E.EventBus.on("deleteSourceData",b=>{v("deleteSourceData",b)}),E.EventBus.on("updateSourceData",b=>{v("updateSourceData",b)});function D(){f.schemas=V(i.schemas),p(f.schemas[0]),S.push(f.schemas,"初始化撤销功能")}async function p(b=f.schemas[0]){m.checkedNode=b,m.matched=Y(f.schemas,b.id)}async function y(b=null){var g;if(!b||m.disableHover)return m.hoverNode=null,!1;if((b==null?void 0:b.id)===((g=m.hoverNode)==null?void 0:g.id))return!1;m.hoverNode=b}function w(){e.nextTick(()=>{v("ready",{pageManager:u})})}async function C(b=!1){m.disableHover=b}function I(b){M(f,V(b))}function B(){return e.toRaw(f)}function L(){K(f.schemas,i.schemas)&&f.script===i.script||(M(f.schemas,i.schemas),f.script=i.script,p(f.schemas[0]),S.push(f.schemas,"重置操作"),v("reset",f))}function J(){v("save",e.toRaw(f))}function N(b){v("toggleDeviceMode",b)}function U(){d.value.handleOpen()}return D(),a({revoke:S,setData:I,getData:B,reset:L,preview:U}),(b,g)=>e.unref(E.pluginManager).initialized.value?(e.openBlock(),e.createBlock(e.Suspense,{key:1,onResolve:w},{default:e.withCtx(()=>[e.createElementVNode("div",Qe,[e.createElementVNode("div",Ge,[e.renderSlot(b.$slots,"header",{},()=>[h.hiddenHeader?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(r),{key:0,onPreview:U,onSave:J},{header:e.withCtx(()=>[e.renderSlot(b.$slots,"header-prefix")]),prefix:e.withCtx(()=>[e.renderSlot(b.$slots,"header-prefix")]),title:e.withCtx(()=>[e.renderSlot(b.$slots,"header-title")]),"right-prefix":e.withCtx(()=>[e.renderSlot(b.$slots,"header-right-prefix")]),"right-action":e.withCtx(()=>[e.renderSlot(b.$slots,"header-right-action")]),"right-suffix":e.withCtx(()=>[e.renderSlot(b.$slots,"header-right-suffix")]),_:3}))])]),e.createElementVNode("div",{class:e.normalizeClass(["epic-split-view-container",{"hidden-header":b.hiddenHeader}])},[e.createVNode(e.unref(n)),e.createVNode(e.unref(s)),e.createVNode(e.unref(l))],2),e.createVNode(Ke,{ref_key:"previewRef",ref:d},null,512)])]),fallback:e.withCtx(()=>[e.createElementVNode("div",Ye,[e.createVNode(e.unref(c))])]),_:3})):(e.openBlock(),e.createElementBlock("div",Ze))}}),je={component:async()=>await Promise.resolve().then(()=>require("./index-sZ9OfgE1.cjs")),defaultSchema:{label:"代码编辑器",type:"monacoEditor",field:"monacoEditor",icon:"epic-icon-write",input:!0},config:{attribute:[{label:"字段名",type:"input",field:"field"},{label:"标题",type:"input",field:"label"},{label:"默认值",type:"monacoEditor",field:"componentProps.defaultValue"}]},bindModel:"model-value"},et={component:async()=>await Promise.resolve().then(()=>require("./index-Ch9jeYmj.cjs")),defaultSchema:{label:"页面",type:"page",componentProps:{},children:[]},config:{attribute:[{label:"页面名称",type:"input",componentProps:{placeholder:"请输入"},field:"componentProps.name"}]}};function tt(t){t.component("EInputSize",async()=>await Promise.resolve().then(()=>require("./index-DWjMyXtP.cjs"))),t.component("EColEditor",async()=>await Promise.resolve().then(()=>require("./index-DZ5RBl4U.cjs"))),t.component("EActionEditor",async()=>await Promise.resolve().then(()=>require("./index-Cz47jN8A.cjs"))),t.component("ERuleEditor",async()=>await Promise.resolve().then(()=>require("./index-Ctr7oJRf.cjs"))),t.component("EOptionsEditor",async()=>await Promise.resolve().then(()=>require("./index-mxP1Ba2T.cjs"))),t.component("ENode",async()=>await Promise.resolve().then(()=>require("./index-BnRo1212.cjs"))),t.component("EDataSource",async()=>await Promise.resolve().then(()=>require("./index-B3dTIoEC.cjs"))),t.registerActivitybar({id:"component_view",title:"组件",icon:"icon--epic--extension-outline",component:async()=>await Promise.resolve().then(()=>require("./index-DAk3CFkW.cjs"))}),t.registerActivitybar({id:"sound_code_view",title:"源码",icon:"icon--epic--sdk-outline-rounded",component:async()=>await Promise.resolve().then(()=>require("./index-Bd5nBb_T.cjs"))}),t.registerActivitybar({id:"outline_view",title:"大纲",icon:"icon--epic--account-tree-outline-rounded",component:async()=>await Promise.resolve().then(()=>require("./outline-UAdT8ap6.cjs"))}),t.registerRightSidebar({id:"attribute_view",title:"属性",component:async()=>await Promise.resolve().then(()=>require("./attributeView-CfMG9ANQ.cjs"))}),t.registerRightSidebar({id:"style_view",title:"样式",component:async()=>await Promise.resolve().then(()=>require("./styleView-0rthSdVL.cjs"))}),t.registerRightSidebar({id:"event_view",title:"事件",component:async()=>await Promise.resolve().then(()=>require("./eventView-CSJb3Zam.cjs"))}),[je,et].forEach(o=>{t.registerComponent(o)})}tt(E.pluginManager);exports._sfc_main=te;exports._sfc_main$1=ne;exports._sfc_main$2=Xe;exports.capitalizeFirstLetter=G;exports.convertKFormData=ve;exports.debounce=ge;exports.deepClone=V;exports.deepCompareAndModify=M;exports.deepEqual=K;exports.findSchemaById=me;exports.findSchemaInfoById=he;exports.findSchemas=O;exports.generateNewSchema=ue;exports.getDarkState=se;exports.getFormFields=pe;exports.getFormSchemas=X;exports.getMatchedById=Y;exports.getUUID=T;exports.getValueByPath=de;exports.initStore=ie;exports.mapSchemas=j;exports.recursionConvertedNode=R;exports.setValueByPath=fe;exports.useDark=ae;exports.useElementDrag=Ue;exports.useElementSize=$e;exports.useElementZoom=ze;exports.useKeyPress=le;exports.usePageManager=Z;exports.useResizeObserver=re;exports.useRevoke=ee;exports.useStore=q;exports.useTheme=qe;exports.useTimedQuery=Je;exports.useVModel=Te;exports.watchOnce=Me;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),p=require("monaco-editor"),b=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),p=require("monaco-editor"),b=require("./index-p6doDa9j.cjs"),h=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function v(l){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:()=>l[r]})}}return o.default=l,Object.freeze(o)}const i=v(p),_=a.defineComponent({__name:"index",props:{language:{default:"json"},readOnly:{type:Boolean,default:!1},valueFormat:{default:"string"},modelValue:{},config:{default:()=>({selectOnLineNumbers:!0,minimap:{enabled:!1}})},lineNumbers:{default:"on"},autoToggleTheme:{type:Boolean},theme:{default:"vs-light"}},emits:["update:modelValue"],setup(l,{expose:o,emit:r}){const t=l,s=r,c=a.ref(null);let e=null;const{isDark:f}=b.useTheme();function d(){f.value?i.editor.setTheme("vs-dark"):i.editor.setTheme("vs-light")}function m(u){e==null||e.setValue(u||"")}function g(u){const n=e==null?void 0:e.getPosition();n&&(e==null||e.executeEdits("",[{range:new i.Range(n.lineNumber,n.column,n.lineNumber,n.column),text:u}]),e==null||e.setPosition({...n,column:n.column+u.length}),e==null||e.focus())}return a.onMounted(()=>{e=i.editor.create(c.value,{value:u(),...t.config,language:t.language,readOnly:t.readOnly,lineNumbers:t.lineNumbers,theme:t.theme,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10},automaticLayout:!0}),t.autoToggleTheme&&a.watch(()=>f.value,()=>{a.nextTick(()=>d())},{immediate:!0});function u(){return t.valueFormat==="json"&&t.modelValue?JSON.stringify(t.modelValue,null,2):t.modelValue??""}e.onDidChangeModelContent(()=>{const n=e==null?void 0:e.getValue();if(t.valueFormat==="json"&&n){s("update:modelValue",JSON.parse(n));return}s("update:modelValue",n??"")})}),o({setValue:m,insertText:g}),(u,n)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"editContainer",ref:c,class:"epic-code-editor"},null,512))}}),y=h._export_sfc(_,[["__scopeId","data-v-3e2e893c"]]);exports.default=y;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-p6doDa9j.cjs"),a=require("./pluginManager-itCTrGag.cjs");exports.EBuilder=e._sfc_main$1;exports.EDesigner=e._sfc_main$2;exports.ENode=e._sfc_main;exports.capitalizeFirstLetter=e.capitalizeFirstLetter;exports.convertKFormData=e.convertKFormData;exports.debounce=e.debounce;exports.deepClone=e.deepClone;exports.deepCompareAndModify=e.deepCompareAndModify;exports.deepEqual=e.deepEqual;exports.findSchemaById=e.findSchemaById;exports.findSchemaInfoById=e.findSchemaInfoById;exports.findSchemas=e.findSchemas;exports.generateNewSchema=e.generateNewSchema;exports.getDarkState=e.getDarkState;exports.getFormFields=e.getFormFields;exports.getFormSchemas=e.getFormSchemas;exports.getMatchedById=e.getMatchedById;exports.getUUID=e.getUUID;exports.getValueByPath=e.getValueByPath;exports.initStore=e.initStore;exports.mapSchemas=e.mapSchemas;exports.recursionConvertedNode=e.recursionConvertedNode;exports.setValueByPath=e.setValueByPath;exports.useDark=e.useDark;exports.useElementDrag=e.useElementDrag;exports.useElementZoom=e.useElementZoom;exports.useKeyPress=e.useKeyPress;exports.usePageManager=e.usePageManager;exports.useRevoke=e.useRevoke;exports.useStore=e.useStore;exports.useTheme=e.useTheme;exports.useTimedQuery=e.useTimedQuery;exports.EventBus=a.EventBus;exports.PluginManager=a.PluginManager;exports.loadAsyncComponent=a.loadAsyncComponent;exports.pluginManager=a.pluginManager;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as s, t, _ as r, E as o, c as n, j as d, m, d as u, o as i, l as g, f as l, B as c, g as p, H as h, z as y, A as E, y as S, k as f, p as B, I as D, C as F, D as I, s as P, G as v, e as C, i as M, F as k, v as x, x as A, u as N, q, a as z } from "./index-
|
|
1
|
+
import { r as s, t, _ as r, E as o, c as n, j as d, m, d as u, o as i, l as g, f as l, B as c, g as p, H as h, z as y, A as E, y as S, k as f, p as B, I as D, C as F, D as I, s as P, G as v, e as C, i as M, F as k, v as x, x as A, u as N, q, a as z } from "./index-MwVOPR2b.js";
|
|
2
2
|
import { E as T, P as U, l as V, p as b } from "./pluginManager-D8PM7ICc.js";
|
|
3
3
|
export {
|
|
4
4
|
s as EBuilder,
|