epic-designer-gold 0.0.22 → 0.0.24
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-B8JS7SiW.cjs → attributeView-BSDAcGr-.cjs} +1 -1
- package/dist/{attributeView-oIH3-2FN.js → attributeView-Bz43SH5k.js} +8 -8
- package/dist/index-79-_PiUp.js +213 -0
- package/dist/index-B5dOTX9c.cjs +1 -0
- package/dist/{index-nhr7ps1e.js → index-BA8b7URG.js} +1 -1
- package/dist/index-BXjAqIhc.js +665 -0
- package/dist/{index-Bwmb5sha.cjs → index-BlhSSPRn.cjs} +1 -1
- package/dist/{index-rby8nugJ.cjs → index-BqRnThy4.cjs} +1 -1
- package/dist/{index-CrGWYheb.js → index-BqVHIRpW.js} +1 -1
- package/dist/{index-C5XNe5wE.js → index-BqkkpMMv.js} +1 -1
- package/dist/index-C5buJETv.js +4 -0
- package/dist/index-C_98Qusp.cjs +10 -0
- package/dist/index-Cc2pSWZA.cjs +1 -0
- package/dist/{index-Bts_xVeS.cjs → index-Cjz6Uuh1.cjs} +1 -1
- package/dist/{index-DiMAGPRY.js → index-D2XUpDv0.js} +1 -1
- package/dist/index-D4aHRq8_.cjs +1 -0
- package/dist/{index-CwXlSYIH.cjs → index-D8TH-5-y.cjs} +1 -1
- package/dist/index-DFc_FT_D.js +675 -0
- package/dist/{index-DitKpeDV.cjs → index-Dd63RYpy.cjs} +1 -1
- package/dist/{index-C5yhSYKA.js → index-Df-u4kqP.js} +235 -248
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{styleView-BDUqyY8T.cjs → styleView-7qHQlM8R.cjs} +1 -1
- package/dist/{styleView-CtfATcTc.js → styleView-Dqnk80Tm.js} +1 -1
- package/dist/ui/elementPlus/index.cjs +1 -1
- package/dist/ui/elementPlus/index.js +12 -0
- package/package.json +1 -1
- package/dist/core/components/designer/src/modules/attributeView/eventView.vue.d.ts +0 -2
- package/dist/core/components/designer/src/modules/outline/outline.vue.d.ts +0 -2
- package/dist/core/components/designer/src/modules/sourceCode/index.vue.d.ts +0 -2
- package/dist/eventView-BL4A2PVd.cjs +0 -1
- package/dist/eventView-Ed_9JLnx.js +0 -64
- package/dist/index-05ByfwQb.js +0 -432
- package/dist/index-BUkdmwKe.cjs +0 -10
- package/dist/index-Bt6BXCcr.cjs +0 -1
- package/dist/index-CjrdkSiN.js +0 -682
- package/dist/index-CqdmlJ1d.cjs +0 -1
- package/dist/index-DWW8LGvj.js +0 -41
- package/dist/index-DZIjd60A.js +0 -4
- package/dist/index-D_CH15dJ.cjs +0 -1
- package/dist/index-DskzasEn.js +0 -216
- package/dist/index-GJSr_nl7.cjs +0 -1
- package/dist/outline-CJSEUbgc.cjs +0 -1
- package/dist/outline-yy4pIEi3.js +0 -54
- package/dist/tree.vue_vue_type_script_setup_true_lang-RWTXU6lO.cjs +0 -1
- package/dist/tree.vue_vue_type_script_setup_true_lang-uR4G8wa_.js +0 -242
package/dist/index-05ByfwQb.js
DELETED
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
import { defineComponent as U, inject as L, openBlock as p, createElementBlock as g, Fragment as A, renderList as T, createElementVNode as i, toDisplayString as O, createVNode as C, unref as _, withCtx as R, createCommentVNode as G, createTextVNode as J, ref as E, computed as S, withDirectives as F, normalizeClass as j, vShow as P, reactive as H, createBlock as K, nextTick as Q, toRaw as z, watch as W } from "vue";
|
|
2
|
-
import { l as q, _ as X, k as Y, m as Z } from "./index-C5yhSYKA.js";
|
|
3
|
-
import { p as w } from "./axios-ITY6Uw7A.js";
|
|
4
|
-
import { _ as D } from "./icon.vue_vue_type_script_setup_true_lang-D3QdcReY.js";
|
|
5
|
-
import { d as ee } from "./vuedraggable.umd-D2S7Eo7p.js";
|
|
6
|
-
import { _ as te } from "./tree.vue_vue_type_script_setup_true_lang-uR4G8wa_.js";
|
|
7
|
-
const ne = { class: "epic-event-info" }, oe = ["title"], le = { class: "epic-event-btn text-lg flex items-center text-$epic-text-secondary" }, ae = { class: "epic-action-editor-main" }, se = { class: "epic-editor-item rounded" }, ie = { class: "w-36px flex items-center text-lg" }, ce = { class: "flex-1" }, de = { key: 0 }, ue = { key: 1 }, re = { key: 2 }, pe = { class: "epic-action-box text-lg text-$epic-text-medium" }, me = ["onClick"], ve = ["onClick"], fe = /* @__PURE__ */ U({
|
|
8
|
-
__name: "EActionEditorItem",
|
|
9
|
-
props: {
|
|
10
|
-
itemEvents: {
|
|
11
|
-
type: Array,
|
|
12
|
-
default: () => []
|
|
13
|
-
},
|
|
14
|
-
allEvents: {
|
|
15
|
-
type: Array,
|
|
16
|
-
default: () => []
|
|
17
|
-
},
|
|
18
|
-
modelValue: {
|
|
19
|
-
type: Object,
|
|
20
|
-
default: () => []
|
|
21
|
-
},
|
|
22
|
-
events: {
|
|
23
|
-
type: Object,
|
|
24
|
-
default: () => ({})
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
emits: ["add", "edit", "update:modelValue"],
|
|
28
|
-
setup(b, { emit: k }) {
|
|
29
|
-
const m = b, x = k, f = L("pageSchema");
|
|
30
|
-
function V(v) {
|
|
31
|
-
x("add", v);
|
|
32
|
-
}
|
|
33
|
-
function h(v) {
|
|
34
|
-
return q(f.schemas, v).label;
|
|
35
|
-
}
|
|
36
|
-
function r(v, c) {
|
|
37
|
-
var e;
|
|
38
|
-
const l = n(c);
|
|
39
|
-
l[c] = m.events[c].filter(($, N) => v !== N), (e = l[c]) != null && e.length || delete l[c], x("update:modelValue", l);
|
|
40
|
-
}
|
|
41
|
-
function u(v, c, l) {
|
|
42
|
-
x("edit", v, c, l);
|
|
43
|
-
}
|
|
44
|
-
function n(v) {
|
|
45
|
-
const c = {};
|
|
46
|
-
return m.allEvents.forEach((l) => {
|
|
47
|
-
if (!m.events[l.type].length || l.type === v)
|
|
48
|
-
return !1;
|
|
49
|
-
c[l.type] = m.events[l.type];
|
|
50
|
-
}), c;
|
|
51
|
-
}
|
|
52
|
-
return (v, c) => (p(!0), g(A, null, T(b.itemEvents, (l) => (p(), g("div", {
|
|
53
|
-
key: l.type,
|
|
54
|
-
class: "epic-event-item"
|
|
55
|
-
}, [
|
|
56
|
-
i("div", ne, [
|
|
57
|
-
i("div", {
|
|
58
|
-
class: "epic-event-label",
|
|
59
|
-
title: l.describe
|
|
60
|
-
}, O(l.describe), 9, oe),
|
|
61
|
-
i("div", le, [
|
|
62
|
-
C(_(D), {
|
|
63
|
-
name: "icon--epic--add-rounded",
|
|
64
|
-
onClick: (e) => V(l.type)
|
|
65
|
-
}, null, 8, ["onClick"])
|
|
66
|
-
])
|
|
67
|
-
]),
|
|
68
|
-
i("div", ae, [
|
|
69
|
-
C(_(ee), {
|
|
70
|
-
modelValue: m.events[l.type],
|
|
71
|
-
"onUpdate:modelValue": (e) => m.events[l.type] = e,
|
|
72
|
-
"item-key": "id",
|
|
73
|
-
"component-data": {
|
|
74
|
-
type: "transition-group"
|
|
75
|
-
},
|
|
76
|
-
group: "option-list",
|
|
77
|
-
handle: ".handle",
|
|
78
|
-
animation: 200
|
|
79
|
-
}, {
|
|
80
|
-
item: R(({ element: e, index: $ }) => [
|
|
81
|
-
i("div", se, [
|
|
82
|
-
i("div", ie, [
|
|
83
|
-
C(_(D), {
|
|
84
|
-
class: "mr-2 text-lg cursor-move handle text-$epic-text-medium",
|
|
85
|
-
name: "icon--epic--drag"
|
|
86
|
-
})
|
|
87
|
-
]),
|
|
88
|
-
i("div", ce, [
|
|
89
|
-
e.type === "component" ? (p(), g("div", de, O(h(e.componentId)), 1)) : e.type === "custom" ? (p(), g("div", ue, " 自定义函数 ")) : e.type === "public" ? (p(), g("div", re, " 公共函数 ")) : G("", !0),
|
|
90
|
-
J(" " + O(e.methodName), 1)
|
|
91
|
-
]),
|
|
92
|
-
i("div", pe, [
|
|
93
|
-
i("div", {
|
|
94
|
-
class: "epic-edit-btn",
|
|
95
|
-
onClick: (N) => u($, l.type, e)
|
|
96
|
-
}, [
|
|
97
|
-
C(_(D), { name: "icon--epic--page-info-outline-rounded" })
|
|
98
|
-
], 8, me),
|
|
99
|
-
i("div", {
|
|
100
|
-
class: "epic-del-btn",
|
|
101
|
-
onClick: (N) => r($, l.type)
|
|
102
|
-
}, [
|
|
103
|
-
C(_(D), { name: "icon--epic--delete-outline-rounded" })
|
|
104
|
-
], 8, ve)
|
|
105
|
-
])
|
|
106
|
-
])
|
|
107
|
-
]),
|
|
108
|
-
_: 2
|
|
109
|
-
}, 1032, ["modelValue", "onUpdate:modelValue"])
|
|
110
|
-
])
|
|
111
|
-
]))), 128));
|
|
112
|
-
}
|
|
113
|
-
}), he = { class: "h-full flex flex-col" }, ge = /* @__PURE__ */ U({
|
|
114
|
-
__name: "EScriptEdit",
|
|
115
|
-
setup(b) {
|
|
116
|
-
const k = w.getComponent("monacoEditor"), m = {
|
|
117
|
-
theme: "vs-light",
|
|
118
|
-
selectOnLineNumbers: !0,
|
|
119
|
-
minimap: {
|
|
120
|
-
enabled: !1
|
|
121
|
-
}
|
|
122
|
-
}, x = E(null), f = L("pageSchema");
|
|
123
|
-
return (V, h) => (p(), g("div", he, [
|
|
124
|
-
h[1] || (h[1] = i("div", { class: "pb-2" }, " 自定义函数编辑 ", -1)),
|
|
125
|
-
C(_(k), {
|
|
126
|
-
ref_key: "monacoEditorRef",
|
|
127
|
-
ref: x,
|
|
128
|
-
autoToggleTheme: "",
|
|
129
|
-
modelValue: _(f).script,
|
|
130
|
-
"onUpdate:modelValue": h[0] || (h[0] = (r) => _(f).script = r),
|
|
131
|
-
class: "epic-editor flex-1",
|
|
132
|
-
config: m,
|
|
133
|
-
language: "javascript"
|
|
134
|
-
}, null, 8, ["modelValue"])
|
|
135
|
-
]));
|
|
136
|
-
}
|
|
137
|
-
}), _e = { class: "epic-attribute-view" }, ye = ["title"], xe = { class: "epic-attr-input" }, Ie = /* @__PURE__ */ U({
|
|
138
|
-
__name: "EArgsEditor",
|
|
139
|
-
props: {
|
|
140
|
-
modelValue: {},
|
|
141
|
-
actionArgsConfigs: {}
|
|
142
|
-
},
|
|
143
|
-
emits: ["update:modelValue"],
|
|
144
|
-
setup(b, { emit: k }) {
|
|
145
|
-
const m = b, x = k, f = S(() => m.modelValue ? JSON.parse(m.modelValue) : []);
|
|
146
|
-
function V(r) {
|
|
147
|
-
var u;
|
|
148
|
-
return typeof r.show == "boolean" ? r.show : typeof r.show == "function" ? (u = r.show) == null ? void 0 : u.call(r, { values: f.value }) : !0;
|
|
149
|
-
}
|
|
150
|
-
function h(r, u) {
|
|
151
|
-
const n = [
|
|
152
|
-
...JSON.parse(m.modelValue ?? "[]")
|
|
153
|
-
];
|
|
154
|
-
n[u] = r, x("update:modelValue", JSON.stringify(n));
|
|
155
|
-
}
|
|
156
|
-
return (r, u) => (p(), g("div", _e, [
|
|
157
|
-
(p(!0), g(A, null, T(m.actionArgsConfigs, (n) => (p(), g("div", {
|
|
158
|
-
key: n.field + n.type
|
|
159
|
-
}, [
|
|
160
|
-
F(i("div", {
|
|
161
|
-
class: j(["epic-attr-item", n.layout])
|
|
162
|
-
}, [
|
|
163
|
-
i("div", {
|
|
164
|
-
class: "epic-attr-label",
|
|
165
|
-
title: n.label
|
|
166
|
-
}, O(n.label), 9, ye),
|
|
167
|
-
i("div", xe, [
|
|
168
|
-
C(_(X), {
|
|
169
|
-
componentSchema: { ...n, componentProps: { ...n.componentProps, input: !1, field: void 0, hidden: !1 }, show: !0, noFormItem: !0 },
|
|
170
|
-
"model-value": f.value[n.field],
|
|
171
|
-
"onUpdate:modelValue": (v) => h(v, n.field)
|
|
172
|
-
}, null, 8, ["componentSchema", "model-value", "onUpdate:modelValue"])
|
|
173
|
-
])
|
|
174
|
-
], 2), [
|
|
175
|
-
[P, V(n)]
|
|
176
|
-
])
|
|
177
|
-
]))), 128))
|
|
178
|
-
]));
|
|
179
|
-
}
|
|
180
|
-
}), Ce = { class: "rounded epic-modal-action-main" }, Ve = { class: "epic-modal-left-panel h-full flex flex-col" }, ke = { class: "flex flex-1 h-0 flex-col" }, be = { class: "flex-1 h-0" }, Ee = { class: "epic-action-select h-30/100 flex flex-col" }, $e = { class: "flex-1 overflow-auto pr-8px" }, Ne = ["onClick"], Se = { class: "text-center pt-42px text-gray-400" }, we = { class: "epic-modal-right-panel" }, Oe = {
|
|
181
|
-
key: 1,
|
|
182
|
-
class: "text-center pt-42px text-gray-400"
|
|
183
|
-
}, Ae = /* @__PURE__ */ U({
|
|
184
|
-
__name: "EActionModal",
|
|
185
|
-
emits: ["add", "edit"],
|
|
186
|
-
setup(b, { expose: k, emit: m }) {
|
|
187
|
-
const x = w.getComponent("modal"), f = E(!0), V = L("pageSchema"), h = L("pageManager", {}), r = E(!1), u = E([]), n = E(null), v = m, c = S(() => {
|
|
188
|
-
var o;
|
|
189
|
-
return e.actionItem.type === "component" ? n.value ? (o = w.getComponentConfings()[n.value.type].config.action) == null ? void 0 : o.map((t) => ({
|
|
190
|
-
label: t.describe,
|
|
191
|
-
value: t.type
|
|
192
|
-
})) : [] : e.actionItem.type === "custom" ? Object.entries(h.funcs.value).filter(([t, I]) => typeof I == "function").map(([t]) => ({ label: t, value: t })) : e.actionItem.type === "public" ? Object.entries(w.publicMethods).map(([t]) => ({
|
|
193
|
-
label: t,
|
|
194
|
-
value: t
|
|
195
|
-
})) : [];
|
|
196
|
-
}), l = S(() => {
|
|
197
|
-
if (e.actionItem.type === "component" && n.value) {
|
|
198
|
-
const o = w.getComponentConfings()[n.value.type].config.action, t = o == null ? void 0 : o.find(
|
|
199
|
-
(I) => I.type === e.actionItem.methodName
|
|
200
|
-
);
|
|
201
|
-
if (t != null && t.argsConfigs) {
|
|
202
|
-
const I = t.argsConfigs.findIndex(
|
|
203
|
-
(y) => y.label === "设置数据"
|
|
204
|
-
);
|
|
205
|
-
I !== -1 && (t.argsConfigs[I] = {
|
|
206
|
-
...n.value,
|
|
207
|
-
label: "设置数据",
|
|
208
|
-
field: "0",
|
|
209
|
-
id: Y()
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
return (t == null ? void 0 : t.argsConfigs) ?? [];
|
|
213
|
-
}
|
|
214
|
-
return [];
|
|
215
|
-
}), e = H({
|
|
216
|
-
actionItem: {
|
|
217
|
-
type: "custom",
|
|
218
|
-
methodName: "test",
|
|
219
|
-
componentId: null
|
|
220
|
-
},
|
|
221
|
-
cacheData: {}
|
|
222
|
-
});
|
|
223
|
-
function $() {
|
|
224
|
-
var o;
|
|
225
|
-
r.value = !0, f.value = !0, e.actionItem.type = "custom", e.actionItem.componentId = null, (o = c.value) != null && o.length && d(c.value[0].value);
|
|
226
|
-
}
|
|
227
|
-
function N(o) {
|
|
228
|
-
if (r.value = !0, f.value = !1, n.value = null, o.componentId) {
|
|
229
|
-
const t = q(V.schemas, o.componentId);
|
|
230
|
-
n.value = t, u.value = [o.componentId];
|
|
231
|
-
}
|
|
232
|
-
Q(() => {
|
|
233
|
-
e.actionItem.componentId = o.componentId, e.actionItem.methodName = o.methodName, e.actionItem.type = o.type, e.actionItem.args = o.args;
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
function B() {
|
|
237
|
-
if (!e.actionItem.methodName) {
|
|
238
|
-
alert("请先选择动作方法");
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
v(f.value ? "add" : "edit", Z(z(e.actionItem))), M();
|
|
242
|
-
}
|
|
243
|
-
function M() {
|
|
244
|
-
r.value = !1, u.value = [], e.cacheData = {};
|
|
245
|
-
}
|
|
246
|
-
function s(o) {
|
|
247
|
-
var t;
|
|
248
|
-
e.actionItem.componentId = null, e.actionItem.type = o, n.value = null, e.actionItem.methodName = null, u.value = [], (t = c.value) != null && t.length && d(c.value[0].value);
|
|
249
|
-
}
|
|
250
|
-
function a(o) {
|
|
251
|
-
var t;
|
|
252
|
-
e.actionItem.args && (e.cacheData[e.actionItem.componentId + e.actionItem.methodName] = e.actionItem.args), e.actionItem.componentId = o.id, e.actionItem.type = "component", e.actionItem.methodName = null, n.value = o.componentSchema, (t = c.value) != null && t.length && d(c.value[0].value);
|
|
253
|
-
}
|
|
254
|
-
function d(o) {
|
|
255
|
-
e.actionItem.methodName = o, e.actionItem.args = e.cacheData[e.actionItem.componentId + e.actionItem.methodName];
|
|
256
|
-
}
|
|
257
|
-
return k({
|
|
258
|
-
handleOpen: $,
|
|
259
|
-
handleOpenEdit: N
|
|
260
|
-
}), (o, t) => (p(), K(_(x), {
|
|
261
|
-
modelValue: r.value,
|
|
262
|
-
"onUpdate:modelValue": t[4] || (t[4] = (I) => r.value = I),
|
|
263
|
-
class: "w-1200px",
|
|
264
|
-
width: "1200px",
|
|
265
|
-
onClose: M,
|
|
266
|
-
onOk: B,
|
|
267
|
-
title: "动作配置"
|
|
268
|
-
}, {
|
|
269
|
-
default: R(() => {
|
|
270
|
-
var I;
|
|
271
|
-
return [
|
|
272
|
-
i("div", Ce, [
|
|
273
|
-
i("div", Ve, [
|
|
274
|
-
i("div", ke, [
|
|
275
|
-
i("div", {
|
|
276
|
-
class: j(["fun-btn", { checked: e.actionItem.type === "custom" }]),
|
|
277
|
-
onClick: t[0] || (t[0] = (y) => s("custom"))
|
|
278
|
-
}, " 自定义函数 ", 2),
|
|
279
|
-
i("div", {
|
|
280
|
-
class: j(["fun-btn", { checked: e.actionItem.type === "public" }]),
|
|
281
|
-
onClick: t[1] || (t[1] = (y) => s("public"))
|
|
282
|
-
}, " 公共函数 ", 2),
|
|
283
|
-
t[5] || (t[5] = J(" 组件 ")),
|
|
284
|
-
i("div", be, [
|
|
285
|
-
C(_(te), {
|
|
286
|
-
selectedKeys: u.value,
|
|
287
|
-
"onUpdate:selectedKeys": t[2] || (t[2] = (y) => u.value = y),
|
|
288
|
-
options: _(V).schemas,
|
|
289
|
-
onNodeClick: a
|
|
290
|
-
}, null, 8, ["selectedKeys", "options"])
|
|
291
|
-
])
|
|
292
|
-
]),
|
|
293
|
-
i("div", Ee, [
|
|
294
|
-
t[6] || (t[6] = i("div", { class: "mb-2" }, "动作选择", -1)),
|
|
295
|
-
i("div", $e, [
|
|
296
|
-
(p(!0), g(A, null, T(c.value, (y) => (p(), g("div", {
|
|
297
|
-
class: j([{ checked: y.value === e.actionItem.methodName }, "epic-action-item"]),
|
|
298
|
-
onClick: (Ue) => d(y.value),
|
|
299
|
-
key: y.value
|
|
300
|
-
}, [
|
|
301
|
-
i("span", null, O(y.label), 1)
|
|
302
|
-
], 10, Ne))), 128)),
|
|
303
|
-
F(i("div", Se, " 当前组件暂无动作 ", 512), [
|
|
304
|
-
[P, !((I = c.value) != null && I.length)]
|
|
305
|
-
])
|
|
306
|
-
])
|
|
307
|
-
])
|
|
308
|
-
]),
|
|
309
|
-
i("div", we, [
|
|
310
|
-
e.actionItem.type === "custom" ? (p(), K(ge, { key: 0 })) : l.value.length === 0 ? (p(), g("div", Oe, " 暂无配置 ")) : (p(), K(Ie, {
|
|
311
|
-
key: 2,
|
|
312
|
-
modelValue: e.actionItem.args,
|
|
313
|
-
"onUpdate:modelValue": t[3] || (t[3] = (y) => e.actionItem.args = y),
|
|
314
|
-
actionArgsConfigs: l.value
|
|
315
|
-
}, null, 8, ["modelValue", "actionArgsConfigs"]))
|
|
316
|
-
])
|
|
317
|
-
])
|
|
318
|
-
];
|
|
319
|
-
}),
|
|
320
|
-
_: 1
|
|
321
|
-
}, 8, ["modelValue"]));
|
|
322
|
-
}
|
|
323
|
-
}), Te = /* @__PURE__ */ U({
|
|
324
|
-
__name: "index",
|
|
325
|
-
props: {
|
|
326
|
-
eventList: {
|
|
327
|
-
type: Array,
|
|
328
|
-
default: () => []
|
|
329
|
-
},
|
|
330
|
-
modelValue: {
|
|
331
|
-
type: Object
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
emits: ["update:modelValue"],
|
|
335
|
-
setup(b, { emit: k }) {
|
|
336
|
-
const m = w.getComponent("Collapse"), x = w.getComponent("CollapseItem"), f = E(null);
|
|
337
|
-
let V = 0;
|
|
338
|
-
const h = b, r = k, u = S({
|
|
339
|
-
get() {
|
|
340
|
-
return h.modelValue;
|
|
341
|
-
},
|
|
342
|
-
set(s) {
|
|
343
|
-
r("update:modelValue", s);
|
|
344
|
-
}
|
|
345
|
-
}), n = E([]), v = S(() => h.eventList.filter((s) => s.events.length)), c = S(() => h.eventList.map((s) => s.events).flat()), l = E({});
|
|
346
|
-
c.value.forEach((s) => {
|
|
347
|
-
l.value[s.type] = S({
|
|
348
|
-
get() {
|
|
349
|
-
var a;
|
|
350
|
-
return ((a = u.value) == null ? void 0 : a[s.type]) ?? [];
|
|
351
|
-
},
|
|
352
|
-
set(a) {
|
|
353
|
-
a && a.length ? u.value[s.type] = a.map((d) => z(d)) : delete u.value[s.type];
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
}), W(() => v.value, (s) => {
|
|
357
|
-
s.length && (n.value = s.filter((a) => {
|
|
358
|
-
for (let d = 0; d < a.events.length; d++) {
|
|
359
|
-
const o = a.events[d].type;
|
|
360
|
-
if (l.value[o].length)
|
|
361
|
-
return !0;
|
|
362
|
-
}
|
|
363
|
-
return !1;
|
|
364
|
-
}).map((a) => a.title));
|
|
365
|
-
}, {
|
|
366
|
-
// 配置选项
|
|
367
|
-
immediate: !0
|
|
368
|
-
// 立即执行一次回调函数
|
|
369
|
-
});
|
|
370
|
-
let e = "";
|
|
371
|
-
function $(s) {
|
|
372
|
-
var a;
|
|
373
|
-
(a = f.value) == null || a.handleOpen(), e = s;
|
|
374
|
-
}
|
|
375
|
-
function N(s, a, d) {
|
|
376
|
-
var o;
|
|
377
|
-
(o = f.value) == null || o.handleOpenEdit(d), V = s, e = a;
|
|
378
|
-
}
|
|
379
|
-
function B(s) {
|
|
380
|
-
l.value[e][V] = s, u.value[e] = [...l.value[e] ?? []];
|
|
381
|
-
}
|
|
382
|
-
function M(s) {
|
|
383
|
-
if (!u.value) {
|
|
384
|
-
u.value = { [e]: [...l.value[e] ?? [], s] };
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
u.value[e] = [...l.value[e] ?? [], s];
|
|
388
|
-
}
|
|
389
|
-
return (s, a) => (p(), g(A, null, [
|
|
390
|
-
C(_(m), {
|
|
391
|
-
modelValue: n.value,
|
|
392
|
-
"onUpdate:modelValue": a[1] || (a[1] = (d) => n.value = d),
|
|
393
|
-
activeKey: n.value,
|
|
394
|
-
"onUpdate:activeKey": a[2] || (a[2] = (d) => n.value = d),
|
|
395
|
-
"expanded-names": n.value,
|
|
396
|
-
"onUpdate:expandedNames": a[3] || (a[3] = (d) => n.value = d)
|
|
397
|
-
}, {
|
|
398
|
-
default: R(() => [
|
|
399
|
-
(p(!0), g(A, null, T(v.value, (d) => (p(), K(_(x), {
|
|
400
|
-
key: d.title,
|
|
401
|
-
title: d.title,
|
|
402
|
-
header: d.title,
|
|
403
|
-
name: d.title
|
|
404
|
-
}, {
|
|
405
|
-
default: R(() => [
|
|
406
|
-
C(fe, {
|
|
407
|
-
modelValue: u.value,
|
|
408
|
-
"onUpdate:modelValue": a[0] || (a[0] = (o) => u.value = o),
|
|
409
|
-
"item-events": d.events,
|
|
410
|
-
"all-events": c.value,
|
|
411
|
-
events: l.value,
|
|
412
|
-
onAdd: $,
|
|
413
|
-
onEdit: N
|
|
414
|
-
}, null, 8, ["modelValue", "item-events", "all-events", "events"])
|
|
415
|
-
]),
|
|
416
|
-
_: 2
|
|
417
|
-
}, 1032, ["title", "header", "name"]))), 128))
|
|
418
|
-
]),
|
|
419
|
-
_: 1
|
|
420
|
-
}, 8, ["modelValue", "activeKey", "expanded-names"]),
|
|
421
|
-
C(Ae, {
|
|
422
|
-
ref_key: "EActionModalRef",
|
|
423
|
-
ref: f,
|
|
424
|
-
onAdd: M,
|
|
425
|
-
onEdit: B
|
|
426
|
-
}, null, 512)
|
|
427
|
-
], 64));
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
export {
|
|
431
|
-
Te as default
|
|
432
|
-
};
|
package/dist/index-BUkdmwKe.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),A=require("./axios-CYGTE3lR.cjs");function q(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 ee(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 he(t){const[a]=oe([V(t)],o=>{var n,s;const r={...o,id:`${o.type}_${q(8)}`};return(r.field||r.input)&&!((s=(n=A.pluginManager.getComponentConfingByType(r.type))==null?void 0:n.editConstraints)!=null&&s.fixedField)&&(r.field=r.id),r});return a}function B(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]=[]),B(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 G(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 i=Object.keys(s).sort(),c={};return i.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 te(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 i=0;i<s.children.length&&(n(s.children[i]),!r);i++);if(!r&&s.slots)for(let i in s.slots)for(let c=0;c<s.slots[i].length&&(n(s.slots[i][c]),!r);c++);r||o.pop()}return t.forEach(n),r||console.error(`没有查询到id为${a}的节点`),o}function ve(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 ye(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 i=r[s];n[i]==null&&(n[i]=isNaN(Number(r[s+1]))?{}:[]),n=n[i]}return n[r[r.length-1]]=o,t}function ge(t,a="default"){return ne(t,a).map(r=>r.field)}function ne(t,a="default"){const o=R(t,n=>{var s;return n.type==="form"&&(((s=n.componentProps)==null?void 0:s.name)??n.name===a)},!0);return R((o==null?void 0:o.children)??[],n=>!!n.input,!1,n=>n.type!=="subform")}function R(t,a,o=!1,r){const n=[],s=[...t];for(;s.length;){const i=s.pop();if(i!=null&&i.children&&(!r||r(i))&&s.push(...i.children),i!=null&&i.slots&&(!r||r(i)))for(let c in i.slots)s.push(...i.slots[c]);if(a(i)&&(n.push(i),o))return i}return o?!1:n}function oe(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]);B(n,a(n))}return t}function we(t,a){const o=R(t,r=>r.id===a,!0);if(!o)throw new Error(`没有查询到id为${a}的节点`);return o}function Se(t,a){const o=[{type:"",children:t}];let r=0,n=null;if(R(o,s=>{if(n=s.children??null,!n){if(s!=null&&s.slots)for(let i in s.slots){n=s.slots[i];for(let c=0;c<n.length;c++)if(n[c].id===a)return r=c,!0}return!1}for(let i=0;i<n.length;i++)if(n[i].id===a)return r=i,!0;return!1},!0),!n)throw new Error(`没有查询到id为${a}的节点`);return{list:n,schema:n[r],index:r}}function be(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_"+q()}],componentProps:{style:{padding:"16px"}}}],script:t.script||""};return a.schemas[0].children[0].children=O(t.list),a}function O(t,a){return t.map(o=>{var u,S,v;let r=o.type??"";const n=o.options??{},s=(l,g)=>{r===l&&(r=g,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:l,maxRows:g}=n;n.autoSize={minRows:l,maxRows:g},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=q());const i={label:o.label,type:r,icon:o.icon||"",field:o.model,componentProps:n,id:o.key};return(n.noFormItem||!n.showLabel)&&(i.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)&&(i.input=!0,((S=(u=o.rules)==null?void 0:u[0])==null?void 0:S.required)===!1&&o.rules.shift(),((v=o.rules)==null?void 0:v.length)>0&&(i.rules=o.rules)),o.list&&(i.children=O(o.list,o)),o.columns&&(i.children=O(o.columns,o)),o.trs&&(i.children=O(o.trs,o)),o.tds&&(i.children=O(o.tds,o)),i})}function Ce(t,a){let o=null;return(...r)=>{o&&clearTimeout(o),o=setTimeout(()=>{t(...r)},a)}}function Y(){const t=e.ref({}),a=e.ref({}),o=e.ref(!1),r=e.ref([]),n=e.reactive({});function s(h){return t.value[h]}function i(h,w){t.value[h]=w}function c(h){delete t.value[h]}function u(h,w=!1){const y=Object.entries(A.pluginManager.publicMethods).reduce((E,[_,M])=>(E[_]=M.handler,E),{});try{new Function(`const epic = this;${h}`).bind({...y,getComponent:s,find:s,defineExpose:S,publicMethods:y,pluginManager:A.pluginManager})()}catch(E){w&&console.error("[epic:自定义函数]异常:",E)}}function S(h){h!=null&&(a.value=h)}function v(h,...w){if(!h||h.length===0){console.warn("未提供任何动作");return}h.forEach(y=>{const E=y.args?JSON.parse(y.args):w;switch(y.type){case"public":l(y,E);break;case"custom":g(y,E);break;case"component":f(y,E);break;default:console.warn(`未知的动作类型: ${y.type}`);break}})}function l(h,w){var y;try{(y=A.pluginManager.publicMethods[h.methodName])==null||y.handler(...w)}catch(E){console.error(`[Epic:公共函数(${h.methodName})]执行异常:`,E)}}function g(h,w){var y,E;try{(E=(y=a.value)[h.methodName])==null||E.call(y,...w)}catch(_){console.error(`[Epic:自定义函数(${h.methodName})]执行异常:`,_)}}function f(h,w){const y=h.componentId!=null&&s(h.componentId);if(!y){console.warn(`[Epic:组件${h.componentId}]未找到`);return}try{y[h.methodName](...w)}catch(E){console.error(`[Epic:组件${h.componentId}函数(${h.methodName})]执行异常:`,E)}}function p(h=!0){o.value=h}function d(h){const w=R(h,()=>!0);r.value=w.map(y=>y.id)}function C(h,w="default"){if(n[w]){const y=n[w];B(h,y)}n[w]=h}function I(h,w="default"){if(n[w]){B(n[w],h,!1);return}n[w]=h}return{componentInstances:t,funcs:a,isDesignMode:o,defaultComponentIds:r,forms:n,addFormData:C,setFormData:I,getComponentInstance:s,find:s,addComponentInstance:i,removeComponentInstance:c,setMethods:u,doActions:v,setDesignMode:p,setDefaultComponentIds:d}}function re(){const t=e.ref([]),a=e.ref([]),o=e.ref(null);let r=0;function n(u,S="插入组件"){const v=Date.now();r+150>v||(r=v,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 i(){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:i,reset:c}}const ke=e.defineComponent({__name:"dynamicFormItem",props:{hasFormItem:{type:Boolean},formItemProps:{}},emits:["updateFormItemRef"],setup(t,{emit:a}){const o=A.pluginManager.getComponent("form-item"),r=t,n=a,s=e.ref(),i=()=>{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:i},r.formItemProps),{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3},16,["onVnodeMounted"])):e.renderSlot(c.$slots,"default",{key:1})}}),ae=e.defineComponent({name:"ENode",__name:"node",props:{componentSchema:{},modelValue:{},ruleField:{},resetFormData:{type:Boolean},name:{},dynamicId:{},sourceDateUrl:{}},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 i=e.inject("slots",{}),c=e.inject("pageManager",{}),u=e.inject("disabled",{value:!1}),S=e.inject("ruleFieldPrefix",null),v=e.inject("resetFormData",!1);let l=e.reactive(V(r.componentSchema));p();async function g(m){if(["cascader","checkbox","select","radio"].includes(m.type)&&m.componentProps.dynamicId&&r.sourceDateUrl){const k=(await A.axios({url:r.sourceDateUrl,method:"get",params:{id:m.componentProps.dynamicId}})).data.data;let x=await A.axios({url:k.url,method:k.method,data:JSON.parse(k.body),params:JSON.parse(k.params),headers:JSON.parse(k.headers)});if(k&&(k!=null&&k.dataPath)){const pe=k.dataPath.split(".").reduce((W,me)=>W[me],x.data);m.componentProps.options=f(pe).map(W=>({label:W[k.dataKey],value:W[k.dataValue]}))}else m.componentProps.options=f(x.data).map(U=>({label:U[k.dataKey],value:U[k.dataValue]}));return m}return m}function f(m){return m&&Object.prototype.toString.call(m)==="[object Array]"?m:[]}e.watch(()=>r.componentSchema,m=>{G(l,m,["children"])||(B(l,V(m)),p())},{deep:!0});function p(){c.isDesignMode.value&&typeof l.field=="string"&&(l.field+="-design-mode")}(r.resetFormData||v)&&(s={});const d=a,C=e.ref(),I=e.ref(),h=m=>{I.value=m},w=e.useAttrs();Object.keys(w).length&&e.provide("nodeAttrs",w);const y=e.shallowRef(null),E=e.computed(()=>{var m,D;return(m=l.componentProps)!=null&&m.hidden?!1:typeof l.show=="boolean"?l.show:((D=l.show)==null?void 0:D.call(l,{values:s}))??!0}),_=e.computed(()=>{var k;const m=E.value&&((k=l.rules)==null?void 0:k.map(x=>({...x,validator:x.validator&&c.funcs.value[x.validator]})));let D=l.field;r.ruleField?D=r.ruleField:S&&l.field&&(D=V(S),D.push(l.field));const P={...l,rules:m,rule:m,field:D};return P.children&&delete P.children,P}),M=e.computed(()=>{var P,k;const m=((P=N.value)==null?void 0:P.bindModel)??"modelValue",D={};return l.on&&Object.keys(l.on).forEach(x=>{D[`on${ee(x)}`]=(...U)=>c.doActions(l.on[x],...U)}),{...r,...l.componentProps,disabled:(u==null?void 0:u.value)||((k=l.componentProps)==null?void 0:k.disabled),bindModel:m,...D}}),N=e.computed(()=>A.pluginManager.getComponentConfingByType(l.type)??null);e.watchEffect(()=>{n.value=r.modelValue??s[l.field??""]}),e.watch(()=>n.value,()=>{n.value!==(r.modelValue??s[l.field??""])&&b(n.value)}),e.watch(()=>C.value,()=>{z()},{immediate:!0});function z(){var D;const m=C.value||o;l.id&&m&&(l.input&&(m.setValue=b,m.getValue=()=>s[l.field]||r.modelValue),m.setAttr=(P,k)=>(l.componentProps||(l.componentProps={}),l.componentProps[P]=k),m.getAttr=P=>l.componentProps[P],c.addComponentInstance(l.id,m),(D=N.value)!=null&&D.defaultSchema.input&&l.noFormItem!==!0&&I.value&&c.addComponentInstance(l.id+"formItem",I.value))}function K(){var m;l.id&&(c.removeComponentInstance(l.id),(m=N.value)!=null&&m.defaultSchema.input&&l.noFormItem!==!0&&c.removeComponentInstance(l.id+"formItem"))}async function J(){var D,P,k;if(l=await g(l),typeof((D=l.componentProps)==null?void 0:D.defaultValue)<"u"){const x=c.isDesignMode.value?(P=l.componentProps)==null?void 0:P.defaultValue:s[l.field]??((k=l.componentProps)==null?void 0:k.defaultValue);b(V(x))}if(l.type==="slot"){const x=l.slotName;if(!x)return;y.value=e.defineComponent({setup(){return()=>e.renderSlot(i,x,{componentSchema:l,model:s})}});return}const m=A.pluginManager.getComponent(l.type);if(!m){console.error(`组件${l.type}未注册`);return}if(typeof m=="function"){const x=await m();y.value=x.default??x}else y.value=m}function b(m){d("update:modelValue",m),d("change",m),l.field&&(s[l.field]=m)}function T(m){d("update:dynamicId",m)}let j=null;return e.watch(()=>l,async m=>{const D=JSON.stringify({...m,children:void 0,componentProps:{...m.componentProps,options:null}});if(D===j)return!1;j=D,J()},{immediate:!0,deep:!0}),e.onUnmounted(K),(m,D)=>{var k;const P=e.resolveComponent("ENode");return y.value&&E.value?(e.openBlock(),e.createBlock(ke,{key:0,hasFormItem:e.unref(l).noFormItem!==!0&&((k=N.value)==null?void 0:k.defaultSchema.input),formItemProps:_.value,onUpdateFormItemRef:h},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.value),e.mergeProps({ref_key:"componentInstance",ref:C,onVnodeMounted:z,model:e.unref(s)},{...M.value},{[M.value.bindModel]:n.value,["onUpdate:"+M.value.bindModel]:D[0]||(D[0]=x=>n.value=x),[`onUpdate:${M.value.bindModel}`||""]:b,"onUpdate:dynamicId":T}),{node:e.withCtx(x=>[e.createVNode(P,e.mergeProps(x,{sourceDateUrl:r.sourceDateUrl}),null,16,["sourceDateUrl"])]),"edit-node":e.withCtx(()=>[e.renderSlot(m.$slots,"edit-node")]),_:3},16,["model"]))]),_:3},8,["hasFormItem","formItemProps"])):e.createCommentVNode("",!0)}}});function Ee(){const t=e.ref(!1),a=Y(),o=e.ref({});function r(){return new Promise(f=>{if(t.value)f();else{const p=e.watch(t,()=>{p(),f()})}})}async function n(f="default"){var d;await r();const p=(d=o.value)==null?void 0:d[f];if(!p)throw new Error(`表单 [name=${f}] 不存在`);return p}async function s(f,p){const d=await n(f);return V(await p(d))}async function i(f="default"){return await s(f,p=>p.getData())}function c(f,p="default"){var C;a.setFormData(f,p);const d=(C=o.value)==null?void 0:C[p];d==null||d.clearValidate()}async function u(f="default"){return await s(f,async p=>(await p.validate(),await p.getData()))}async function S(f){await r();const p={};for(const d in o.value){const C=o.value[d];C&&(p[d]=V(await f(C)))}return p}async function v(){return await S(f=>f.getData())}function l(f){for(const p in f)c(f[p],p)}async function g(){return await S(async f=>(await f.validate(),await f.getData()))}return{ready:t,pageManager:a,forms:o,getData:i,setData:c,validate:u,getForms:v,setForms:l,validateAll:g,getFormInstance:n}}const Ae={key:0,class:"epic-loading-box"},De={class:"epic-builder-main"},xe={class:"epic-loading-box"},se=e.defineComponent({__name:"builder",props:{pageSchema:{},formData:{},disabled:{type:Boolean},sourceDateUrl:{}},emits:["ready"],setup(t,{expose:a,emit:o}){const r=A.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Cap7FkuS.cjs"))),n=o,{ready:s,pageManager:i,forms:c,getData:u,setData:S,validate:v,getForms:l,setForms:g,validateAll:f,getFormInstance:p}=Ee(),d=t,C=e.reactive({schemas:[]});e.watch(()=>d.pageSchema,y=>{B(C,y)},{immediate:!0,deep:!0}),e.watch(()=>d.formData,y=>{y&&S(y)},{immediate:!0,deep:!0}),e.watch(()=>C.script,y=>{y&&i.setMethods(y,!0)},{immediate:!0}),e.provide("slots",e.useSlots()),e.provide("pageManager",i),e.provide("forms",c),e.provide("pageSchema",C),e.provide("disabled",e.computed(()=>d.disabled));const I=e.getCurrentInstance(),h=I==null?void 0:I.proxy;function w(){e.nextTick(()=>{s.value=!0,n("ready",i),h&&i.addComponentInstance("builder",h)})}return a({ready:s,pageManager:i,getData:u,setData:S,validate:v,getForms:l,setForms:g,validateAll:f,getFormInstance:p}),(y,E)=>e.unref(A.pluginManager).initialized.value?(e.openBlock(),e.createBlock(e.Suspense,{key:1,onResolve:w},{default:e.withCtx(()=>[e.createElementVNode("div",De,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.schemas,(_,M)=>(e.openBlock(),e.createBlock(e.unref(ae),{key:M,sourceDateUrl:d.sourceDateUrl,componentSchema:_},null,8,["sourceDateUrl","componentSchema"]))),128))])]),fallback:e.withCtx(()=>[e.createElementVNode("div",xe,[e.createVNode(e.unref(r))])]),_:1})):(e.openBlock(),e.createElementBlock("div",Ae))}});function X(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function Ie(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))),X(n),o)}function $(t){return typeof t=="function"?t():e.unref(t)}const Pe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const _e=t=>typeof t<"u",Ve=Object.prototype.toString,Me=t=>Ve.call(t)==="[object Object]",Be=()=>{};function Ne(t){return e.getCurrentInstance()}function Fe(t,a=!0,o){Ne()?e.onMounted(t,o):a?t():e.nextTick(t)}function Oe(t=!1,a={}){const{truthyValue:o=!0,falsyValue:r=!1}=a,n=e.isRef(t),s=e.ref(t);function i(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?i:[s,i]}function Re(t,a,o){const r=e.watch(t,(...n)=>(e.nextTick(()=>r()),a(...n)),o);return r}const H=Pe?window:void 0;function F(t){var a;const o=$(t);return(a=o==null?void 0:o.$el)!=null?a:o}function $e(...t){let a,o,r,n;if(typeof t[0]=="string"||Array.isArray(t[0])?([o,r,n]=t,a=H):[a,o,r,n]=t,!a)return Be;Array.isArray(o)||(o=[o]),Array.isArray(r)||(r=[r]);const s=[],i=()=>{s.forEach(v=>v()),s.length=0},c=(v,l,g,f)=>(v.addEventListener(l,g,f),()=>v.removeEventListener(l,g,f)),u=e.watch(()=>[F(a),$(n)],([v,l])=>{if(i(),!v)return;const g=Me(l)?{...l}:l;s.push(...o.flatMap(f=>r.map(p=>c(v,f,p,g))))},{immediate:!0,flush:"post"}),S=()=>{u(),i()};return X(S),S}function Te(t){return typeof t=="function"?t:typeof t=="string"?a=>a.key===t:Array.isArray(t)?a=>t.includes(a.key):()=>!0}function le(...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=H,eventName:s="keydown",passive:i=!1,dedupe:c=!1}=r,u=Te(a);return $e(n,s,v=>{v.repeat&&$(c)||u(v)&&o(v)},i)}function Z(t,a,o={}){return le(t,a,{...o,eventName:"keydown"})}function Q(t,a,o={}){return le(t,a,{...o,eventName:"keyup"})}function Ue(){const t=e.ref(!1),a=e.getCurrentInstance();return a&&e.onMounted(()=>{t.value=!0},a),t}function qe(t){const a=Ue();return e.computed(()=>(a.value,!!t()))}function Le(t){return JSON.parse(JSON.stringify(t))}function ie(t,a,o={}){const{window:r=H,...n}=o;let s;const i=qe(()=>r&&"ResizeObserver"in r),c=()=>{s&&(s.disconnect(),s=void 0)},u=e.computed(()=>{const l=$(t);return Array.isArray(l)?l.map(g=>F(g)):[F(l)]}),S=e.watch(u,l=>{if(c(),i.value&&r){s=new ResizeObserver(a);for(const g of l)g&&s.observe(g,n)}},{immediate:!0,flush:"post"}),v=()=>{c(),S()};return X(v),{isSupported:i,stop:v}}function ze(t,a={width:0,height:0},o={}){const{window:r=H,box:n="content-box"}=o,s=e.computed(()=>{var l,g;return(g=(l=F(t))==null?void 0:l.namespaceURI)==null?void 0:g.includes("svg")}),i=e.ref(a.width),c=e.ref(a.height),{stop:u}=ie(t,([l])=>{const g=n==="border-box"?l.borderBoxSize:n==="content-box"?l.contentBoxSize:l.devicePixelContentBoxSize;if(r&&s.value){const f=F(t);if(f){const p=f.getBoundingClientRect();i.value=p.width,c.value=p.height}}else if(g){const f=Array.isArray(g)?g:[g];i.value=f.reduce((p,{inlineSize:d})=>p+d,0),c.value=f.reduce((p,{blockSize:d})=>p+d,0)}else i.value=l.contentRect.width,c.value=l.contentRect.height},o);Fe(()=>{const l=F(t);l&&(i.value="offsetWidth"in l?l.offsetWidth:a.width,c.value="offsetHeight"in l?l.offsetHeight:a.height)});const S=e.watch(()=>F(t),l=>{i.value=l?a.width:0,c.value=l?a.height:0});function v(){u(),S()}return{width:i,height:c,stop:v}}function Je(t,a,o,r={}){var n,s,i;const{clone:c=!1,passive:u=!1,eventName:S,deep:v=!1,defaultValue:l,shouldEmit:g}=r,f=e.getCurrentInstance(),p=o||(f==null?void 0:f.emit)||((n=f==null?void 0:f.$emit)==null?void 0:n.bind(f))||((i=(s=f==null?void 0:f.proxy)==null?void 0:s.$emit)==null?void 0:i.bind(f==null?void 0:f.proxy));let d=S;a||(a="modelValue"),d=d||`update:${a.toString()}`;const C=w=>c?typeof c=="function"?c(w):Le(w):w,I=()=>_e(t[a])?C(t[a]):l,h=w=>{g?g(w)&&p(d,w):p(d,w)};if(u){const w=I(),y=e.ref(w);let E=!1;return e.watch(()=>t[a],_=>{E||(E=!0,y.value=C(_),e.nextTick(()=>E=!1))}),e.watch(y,_=>{!E&&(_!==t[a]||v)&&h(_)},{deep:v}),y}else return e.computed({get(){return I()},set(w){h(w)}})}function We(){const{isDark:t}=L(),a=Oe(t);return{isDark:t,toggleDark:a}}function ce(){const t=e.ref(!1);return e.onMounted(()=>{ue(t),He(t)}),e.watch(()=>t.value,()=>{t.value?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}),{isDark:t}}function ue(t){var a=document.documentElement;a&&(a.classList.contains("dark")?t.value=!0:t.value=!1)}function He(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 de(){const t=e.ref(1),a=e.ref(!1),{isDark:o}=ce(),{pressSpace:r,pressShift:n,pressCtrl:s}=fe();return{canvasScale:t,pressSpace:r,pressShift:n,pressCtrl:s,disabledZoom:a,isDark:o}}const L=Ie(de);function fe(){const t=e.ref(!1),a=e.ref(!1),o=e.ref(!1);return Z(" ",()=>{t.value=!0}),Q(" ",()=>{t.value=!1}),Z("Shift",r=>{r.preventDefault(),a.value=!0}),Q("Shift",()=>{a.value=!1}),Z("Control",r=>{r.preventDefault(),o.value=!0}),Q("Control",()=>{o.value=!1}),{pressSpace:t,pressShift:a,pressCtrl:o}}function Ke(t){const{pressSpace:a}=L(),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 i(u){if(u.preventDefault(),!u.x||!u.y||!a.value)return;const S=u.x-r,v=u.y-n;r=u.x,n=u.y,t.value&&(t.value.scrollTop-=v,t.value.scrollLeft-=S)}function c(){a.value=!1}return{handleElementDragStart:s,handleElementDrag:i,handleElementDragEnd:c}}function Ze(t){const{pressCtrl:a,canvasScale:o,disabledZoom:r}=L();function n(s){if(!a.value||r.value)return;s.preventDefault();let i=0;s.deltaY<0?i=o.value+.05:i=o.value-.05,!(i>150||i<.5)&&(o.value=i)}return e.watch(()=>o.value,s=>{t.value&&!r.value&&(t.value.style.transform=`scale(${s})`)}),{handleZoom:n,canvasScale:o}}function Qe(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 Ge={class:"min-w-750px rounded"},Ye={class:"h-full rounded"},Xe=e.defineComponent({__name:"index",setup(t,{expose:a}){const o=A.pluginManager.getComponent("monacoEditor"),r=A.pluginManager.getComponent("modal"),n=e.ref(null),s=e.ref(!1),i=e.ref(!1),c=e.ref({}),u=e.inject("pageSchema"),S=e.ref(null),v=e.ref("");function l(){i.value=!1}function g(){s.value=!1}function f(){s.value=!0,v.value=q()}async function p(){try{let d=await S.value.validateAll();if(!Object.keys(d).length){alert("请添加表单组件后再尝试!");return}Object.keys(d).length===1&&(d=d.default),c.value=JSON.stringify(d,null,2),e.nextTick(()=>{var C;(C=n.value)==null||C.setValue(c.value)}),i.value=!0}catch(d){console.error(d)}}return a({handleOpen:f}),(d,C)=>(e.openBlock(),e.createBlock(e.unref(r),{modelValue:s.value,"onUpdate:modelValue":C[1]||(C[1]=I=>s.value=I),title:"预览",class:"w-900px",width:"900px",onClose:g,onOk:p,okText:"表单数据"},{default:e.withCtx(()=>[e.createElementVNode("div",Ge,[(e.openBlock(),e.createBlock(e.unref(se),{key:v.value,ref_key:"kb",ref:S,"page-schema":e.unref(u)},null,8,["page-schema"])),e.createVNode(e.unref(r),{modelValue:i.value,"onUpdate:modelValue":C[0]||(C[0]=I=>i.value=I),title:"表单数据",class:"w-860px",width:"860px",onClose:l,onOk:l},{default:e.withCtx(()=>[e.createElementVNode("div",Ye,[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"]))}}),je={key:0,class:"epic-loading-box"},et={class:"epic-designer-main"},tt={class:"epic-header-container"},nt={class:"epic-loading-box"},ot=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:[]},updateSourceId:{}},emits:["ready","save","reset","toggleDeviceMode","saveSourceData","deleteSourceData","updateSourceData"],setup(t,{expose:a,emit:o}){const r=A.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-1afOcXnV.cjs"))),n=A.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-BJlPL6eL.cjs"))),s=A.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-D_CH15dJ.cjs"))),i=A.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-C6ceZM1C.cjs"))),c=A.loadAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Cap7FkuS.cjs"))),u=Y(),S=re(),v=t;let l={schemas:[{type:"form",id:"root",label:"页面",children:[],componentProps:{name:"表单",style:{padding:"16px"}}}],script:`const { defineExpose, find } = epic;
|
|
2
|
-
|
|
3
|
-
function test (){
|
|
4
|
-
console.log('test')
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// 通过defineExpose暴露的函数或者属性
|
|
8
|
-
defineExpose({
|
|
9
|
-
test
|
|
10
|
-
})`};e.watchEffect(()=>{if(v.defaultSchema){l=v.defaultSchema;return}v.source&&A.pluginManager.setSourceData(v.source),v.formMode&&(l.schemas=A.pluginManager.formSchemas)}),u.setDesignMode(),u.setDefaultComponentIds(l.schemas);const g=o,f=e.ref(null),p=e.reactive({checkedNode:null,hoverNode:null,disableHover:!1,matched:[]}),d=e.reactive({schemas:[],script:l.script}),{disabledZoom:C}=L();e.watchEffect(()=>{C.value=v.disabledZoom}),e.watchEffect(()=>{const b=d.script;b&&b!==""&&u.setMethods(b)}),e.provide("pageSchema",d),e.provide("revoke",S),e.provide("pageManager",u),e.provide("designerProps",e.computed(()=>v)),e.provide("designer",{setCheckedNode:h,setHoverNode:w,setDisableHover:E,handleToggleDeviceMode:K,reset:N,state:p}),A.EventBus.on("saveSourceData",b=>{g("saveSourceData",b)}),A.EventBus.on("deleteSourceData",b=>{g("deleteSourceData",b)}),A.EventBus.on("updateSourceData",b=>{g("updateSourceData",b)});function I(){d.schemas=V(l.schemas),h(d.schemas[0]),S.push(d.schemas,"初始化撤销功能")}async function h(b=d.schemas[0]){p.checkedNode=b,p.matched=te(d.schemas,b.id)}async function w(b=null){var T;if(!b||p.disableHover)return p.hoverNode=null,!1;if((b==null?void 0:b.id)===((T=p.hoverNode)==null?void 0:T.id))return!1;p.hoverNode=b}function y(){e.nextTick(()=>{g("ready",{pageManager:u})})}async function E(b=!1){p.disableHover=b}function _(b){B(d,V(b))}function M(){return e.toRaw(d)}function N(){G(d.schemas,l.schemas)&&d.script===l.script||(B(d.schemas,l.schemas),d.script=l.script,h(d.schemas[0]),S.push(d.schemas,"重置操作"),g("reset",d))}function z(){g("save",e.toRaw(d))}function K(b){g("toggleDeviceMode",b)}function J(){f.value.handleOpen()}return I(),a({revoke:S,setData:_,getData:M,reset:N,preview:J}),(b,T)=>e.unref(A.pluginManager).initialized.value?(e.openBlock(),e.createBlock(e.Suspense,{key:1,onResolve:y},{default:e.withCtx(()=>[e.createElementVNode("div",et,[e.createElementVNode("div",tt,[e.renderSlot(b.$slots,"header",{},()=>[v.hiddenHeader?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(r),{key:0,onPreview:J,onSave:z},{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(i))],2),e.createVNode(Xe,{ref_key:"previewRef",ref:f},null,512)])]),fallback:e.withCtx(()=>[e.createElementVNode("div",nt,[e.createVNode(e.unref(c))])]),_:3})):(e.openBlock(),e.createElementBlock("div",je))}}),rt={component:async()=>await Promise.resolve().then(()=>require("./index-DitKpeDV.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"},at={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 st(t){t.component("EInputSize",async()=>await Promise.resolve().then(()=>require("./index-DpzLP1Zp.cjs"))),t.component("EColEditor",async()=>await Promise.resolve().then(()=>require("./index-CwXlSYIH.cjs"))),t.component("EActionEditor",async()=>await Promise.resolve().then(()=>require("./index-CqdmlJ1d.cjs"))),t.component("ERuleEditor",async()=>await Promise.resolve().then(()=>require("./index-rby8nugJ.cjs"))),t.component("EOptionsEditor",async()=>await Promise.resolve().then(()=>require("./index-GJSr_nl7.cjs"))),t.component("ENode",async()=>await Promise.resolve().then(()=>require("./index-Bwmb5sha.cjs"))),t.component("EDataSource",async()=>await Promise.resolve().then(()=>require("./index-B03W7FZR.cjs"))),t.registerActivitybar({id:"component_view",title:"组件",icon:"icon--epic--extension-outline",component:async()=>await Promise.resolve().then(()=>require("./index-Bts_xVeS.cjs"))}),t.registerActivitybar({id:"sound_code_view",title:"源码",icon:"icon--epic--sdk-outline-rounded",component:async()=>await Promise.resolve().then(()=>require("./index-Bt6BXCcr.cjs"))}),t.registerActivitybar({id:"outline_view",title:"大纲",icon:"icon--epic--account-tree-outline-rounded",component:async()=>await Promise.resolve().then(()=>require("./outline-CJSEUbgc.cjs"))}),t.registerRightSidebar({id:"attribute_view",title:"属性",component:async()=>await Promise.resolve().then(()=>require("./attributeView-B8JS7SiW.cjs"))}),t.registerRightSidebar({id:"style_view",title:"样式",component:async()=>await Promise.resolve().then(()=>require("./styleView-BDUqyY8T.cjs"))}),t.registerRightSidebar({id:"event_view",title:"事件",component:async()=>await Promise.resolve().then(()=>require("./eventView-BL4A2PVd.cjs"))}),[rt,at].forEach(o=>{t.registerComponent(o)})}st(A.pluginManager);exports._sfc_main=ae;exports._sfc_main$1=se;exports._sfc_main$2=ot;exports.capitalizeFirstLetter=ee;exports.convertKFormData=be;exports.debounce=Ce;exports.deepClone=V;exports.deepCompareAndModify=B;exports.deepEqual=G;exports.findSchemaById=we;exports.findSchemaInfoById=Se;exports.findSchemas=R;exports.generateNewSchema=he;exports.getDarkState=ue;exports.getFormFields=ge;exports.getFormSchemas=ne;exports.getMatchedById=te;exports.getUUID=q;exports.getValueByPath=ve;exports.initStore=de;exports.mapSchemas=oe;exports.recursionConvertedNode=O;exports.setValueByPath=ye;exports.useDark=ce;exports.useElementDrag=Ke;exports.useElementSize=ze;exports.useElementZoom=Ze;exports.useKeyPress=fe;exports.usePageManager=Y;exports.useResizeObserver=ie;exports.useRevoke=re;exports.useStore=L;exports.useTheme=We;exports.useTimedQuery=Qe;exports.useVModel=Je;exports.watchOnce=Re;
|
package/dist/index-Bt6BXCcr.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./axios-CYGTE3lR.cjs"),d=require("./index-BUkdmwKe.cjs"),f={class:"epic-sound-code"},p=e.defineComponent({__name:"index",setup(m){const s=u.pluginManager.getComponent("monacoEditor"),c=e.ref(null),t=e.inject("designer"),a=e.inject("designerProps");let r={};e.watch(()=>t.state.checkedNode,o=>{var n;d.deepEqual(r,e.toRaw(o))||(n=c.value)==null||n.setValue(JSON.stringify(o,null,2))},{deep:!0});const i=JSON.stringify(t.state.checkedNode,null,2);function l(o){try{if(!t.state.checkedNode)return!1;r=JSON.parse(o),d.deepCompareAndModify(t.state.checkedNode,r)}catch(n){console.warn("[epic-desinger:源码]异常:",n)}}return(o,n)=>(e.openBlock(),e.createElementBlock("div",f,[e.createVNode(e.unref(s),{ref_key:"monacoEditorRef",ref:c,autoToggleTheme:"",class:"epic-editor",readOnly:e.unref(a).sourceCodeReadOnly,"model-value":e.unref(i),lineNumbers:"off","onUpdate:modelValue":l},null,8,["readOnly","model-value"])]))}});exports.default=p;
|