epic-designer-gold 0.0.14 → 0.0.16

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.
Files changed (45) hide show
  1. package/dist/{attributeView-lpFl3t4a.cjs → attributeView-DZseOPbA.cjs} +1 -1
  2. package/dist/{attributeView-BN2nA4jI.js → attributeView-DaKcfxYS.js} +1 -1
  3. package/dist/core/components/designer/src/designer.vue.d.ts +1 -0
  4. package/dist/core/components/designer/src/types.d.ts +1 -0
  5. package/dist/core/components/node/src/node.vue.d.ts +2 -2
  6. package/dist/core/extensions/EOptionsEditor/index.vue.d.ts +2 -2
  7. package/dist/{eventView-BKpQ9YIh.js → eventView-BFaz-0Gd.js} +1 -1
  8. package/dist/{eventView-DgqXxWY1.cjs → eventView-DMdS5tNd.cjs} +1 -1
  9. package/dist/index-B0Zx7BFr.js +1587 -0
  10. package/dist/index-B14JQGo7.js +4 -0
  11. package/dist/{index-D8YBJFH6.cjs → index-Bg5w6ttO.cjs} +1 -1
  12. package/dist/{index-BzsFImwK.js → index-Bo7Wv18B.js} +1 -1
  13. package/dist/{index-YHlIFgpT.cjs → index-BzE8aBGI.cjs} +1 -1
  14. package/dist/{index-Yx99TN9O.js → index-C23zgjw8.js} +1 -1
  15. package/dist/{index-CGHtM1lr.cjs → index-C3SntaaD.cjs} +1 -1
  16. package/dist/index-C4_h1__K.cjs +10 -0
  17. package/dist/{index-BXNPTGKl.cjs → index-CIHXNeLh.cjs} +1 -1
  18. package/dist/{index-CdgT4gQu.cjs → index-CYvxg3TX.cjs} +1 -1
  19. package/dist/index-CecS9Ywo.js +216 -0
  20. package/dist/{index-DZYSBPVO.js → index-CwopQ1ii.js} +1 -1
  21. package/dist/{index-Mf82MCCF.js → index-D2KcZm16.js} +1 -1
  22. package/dist/index-DAucrTY2.cjs +1 -0
  23. package/dist/{index-lH0_mCG-.cjs → index-DaGkNfvy.cjs} +1 -1
  24. package/dist/{index-BlJ0TQyn.js → index-DsZL9gYb.js} +1 -1
  25. package/dist/{index-By5rfqCj.cjs → index-LuEk_rsN.cjs} +1 -1
  26. package/dist/{index-DPfAejnH.js → index-UhAkLhp5.js} +1 -1
  27. package/dist/{index-kWCcT4er.js → index-ji8WAXwM.js} +1 -1
  28. package/dist/{index-CNzcV-bQ.cjs → index-wccisfiH.cjs} +1 -1
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/select-B8HCbraJ.js +29 -0
  32. package/dist/select-D6bRz5G2.cjs +1 -0
  33. package/dist/style.css +1 -1
  34. package/dist/{styleView-CXp05_Ar.js → styleView-DIACFMk_.js} +1 -1
  35. package/dist/{styleView-auUK19Dr.cjs → styleView-Dti52JEQ.cjs} +1 -1
  36. package/dist/ui/elementPlus/index.cjs +1 -1
  37. package/dist/ui/elementPlus/index.js +1 -1
  38. package/package.json +1 -1
  39. package/dist/index-BHmIF8aI.cjs +0 -10
  40. package/dist/index-CL_7RzF7.js +0 -214
  41. package/dist/index-CkRhCvJK.cjs +0 -1
  42. package/dist/index-Ol-YPkY9.js +0 -1550
  43. package/dist/index-qJNRPNIj.js +0 -4
  44. package/dist/select-B479QwwL.cjs +0 -1
  45. package/dist/select-CtUVWh2M.js +0 -29
@@ -0,0 +1,1587 @@
1
+ import { ref as A, reactive as Y, defineComponent as X, openBlock as M, createBlock as L, unref as _, mergeProps as he, withCtx as P, renderSlot as R, getCurrentInstance as ae, inject as q, watch as O, useAttrs as _e, provide as $, shallowRef as Pe, computed as U, watchEffect as se, onUnmounted as Se, resolveComponent as Oe, resolveDynamicComponent as Ve, createVNode as T, createCommentVNode as Ae, useSlots as Fe, createElementBlock as ve, Suspense as De, createElementVNode as z, Fragment as Me, renderList as Re, nextTick as ee, effectScope as $e, isRef as Ne, getCurrentScope as Be, onScopeDispose as Ue, onMounted as ge, normalizeClass as Te, toRaw as be } from "vue";
2
+ import { p as F, a as ye, l as Q, E as fe } from "./axios-ITY6Uw7A.js";
3
+ function le(e = 10) {
4
+ const a = "abcdefghijklmnopqrstuvwxyz0123456789";
5
+ let n = "";
6
+ for (let o = 0; o < e; o++) {
7
+ const t = Math.floor(Math.random() * a.length);
8
+ n += a[t];
9
+ }
10
+ return n;
11
+ }
12
+ function Le(e) {
13
+ return e.charAt(0).toUpperCase() + e.slice(1);
14
+ }
15
+ function N(e, a = /* @__PURE__ */ new WeakMap()) {
16
+ if (typeof e != "object" || e === null)
17
+ return e;
18
+ if (a.has(e))
19
+ return a.get(e);
20
+ if (Array.isArray(e)) {
21
+ const o = e.map((t) => N(t, a));
22
+ return a.set(e, o), o;
23
+ }
24
+ const n = {};
25
+ return a.set(e, n), Object.keys(e).forEach((o) => {
26
+ n[o] = N(e[o], a);
27
+ }), n;
28
+ }
29
+ function Ot(e) {
30
+ const [a] = We([N(e)], (n) => {
31
+ var t, r;
32
+ const o = {
33
+ ...n,
34
+ id: `${n.type}_${le(8)}`
35
+ };
36
+ return (o.field || o.input) && !((r = (t = F.getComponentConfingByType(o.type)) == null ? void 0 : t.editConstraints) != null && r.fixedField) && (o.field = o.id), o;
37
+ });
38
+ return a;
39
+ }
40
+ function J(e, a, n = !0) {
41
+ for (const [o, t] of Object.entries(a)) {
42
+ let r = e == null ? void 0 : e[o];
43
+ r && t && typeof r == "object" && typeof t == "object" ? (Array.isArray(r) && !Array.isArray(t) ? r = e[o] = {} : !Array.isArray(r) && Array.isArray(t) && (r = e[o] = []), J(r, t, n)) : e[o] = t;
44
+ }
45
+ n && Object.keys(e).reverse().forEach((o) => {
46
+ a.hasOwnProperty(o) || (Array.isArray(e) ? e.splice(Number(o), 1) : delete e[o]);
47
+ });
48
+ }
49
+ function ke(e, a, n = [], o = /* @__PURE__ */ new WeakMap()) {
50
+ const t = (r) => {
51
+ if (Array.isArray(r))
52
+ return r.map(t);
53
+ if (typeof r == "object" && r !== null) {
54
+ if (o.has(r))
55
+ return "[Circular]";
56
+ o.set(r, !0);
57
+ const l = Object.keys(r).sort(), c = {};
58
+ return l.forEach((d) => {
59
+ n.includes(d) || (c[d] = t(r[d]));
60
+ }), o.delete(r), c;
61
+ } else
62
+ return r;
63
+ };
64
+ return JSON.stringify(t(e)) === JSON.stringify(t(a));
65
+ }
66
+ function ze(e, a) {
67
+ const n = [];
68
+ let o = !1;
69
+ function t(r) {
70
+ if (n.push(r), r.id === a && (o = !0), !o && r.children != null && r.children.length > 0)
71
+ for (let l = 0; l < r.children.length && (t(r.children[l]), !o); l++)
72
+ ;
73
+ if (!o && r.slots)
74
+ for (let l in r.slots)
75
+ for (let c = 0; c < r.slots[l].length && (t(r.slots[l][c]), !o); c++)
76
+ ;
77
+ o || n.pop();
78
+ }
79
+ return e.forEach(t), o || console.error(`没有查询到id为${a}的节点`), n;
80
+ }
81
+ function Vt(e, a, n) {
82
+ const o = a.split(".");
83
+ let t = e;
84
+ for (let r = 0; r < o.length; r++) {
85
+ if (t == null)
86
+ return n;
87
+ t = t[o[r]];
88
+ }
89
+ return t === void 0 ? n : t;
90
+ }
91
+ function Ft(e, a, n) {
92
+ const o = a.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
93
+ let t = e;
94
+ for (let r = 0; r < o.length - 1; r++) {
95
+ const l = o[r];
96
+ t[l] == null && (t[l] = isNaN(Number(o[r + 1])) ? {} : []), t = t[l];
97
+ }
98
+ return t[o[o.length - 1]] = n, e;
99
+ }
100
+ function Mt(e, a = "default") {
101
+ return Je(e, a).map((o) => o.field);
102
+ }
103
+ function Je(e, a = "default") {
104
+ const n = oe(
105
+ e,
106
+ (t) => {
107
+ var r;
108
+ return t.type === "form" && (((r = t.componentProps) == null ? void 0 : r.name) ?? t.name === a);
109
+ },
110
+ !0
111
+ );
112
+ return oe(
113
+ (n == null ? void 0 : n.children) ?? [],
114
+ (t) => !!t.input,
115
+ !1,
116
+ (t) => t.type !== "subform"
117
+ );
118
+ }
119
+ function oe(e, a, n = !1, o) {
120
+ const t = [], r = [...e];
121
+ for (; r.length; ) {
122
+ const l = r.pop();
123
+ if (l != null && l.children && (!o || o(l)) && r.push(...l.children), l != null && l.slots && (!o || o(l)))
124
+ for (let c in l.slots)
125
+ r.push(...l.slots[c]);
126
+ if (a(l) && (t.push(l), n))
127
+ return l;
128
+ }
129
+ return n ? !1 : t;
130
+ }
131
+ function We(e, a, n) {
132
+ const o = [...e];
133
+ for (; o.length; ) {
134
+ const t = o.pop();
135
+ if (t != null && t.children && (!n || n(t)) && o.push(...t.children), t != null && t.slots && (!n || n(t)))
136
+ for (let r in t.slots)
137
+ o.push(...t.slots[r]);
138
+ J(t, a(t));
139
+ }
140
+ return e;
141
+ }
142
+ function Rt(e, a) {
143
+ const n = oe(
144
+ e,
145
+ (o) => o.id === a,
146
+ !0
147
+ );
148
+ if (!n)
149
+ throw new Error(`没有查询到id为${a}的节点`);
150
+ return n;
151
+ }
152
+ function $t(e, a) {
153
+ const n = [{ type: "", children: e }];
154
+ let o = 0, t = null;
155
+ if (oe(
156
+ n,
157
+ (r) => {
158
+ if (t = r.children ?? null, !t) {
159
+ if (r != null && r.slots)
160
+ for (let l in r.slots) {
161
+ t = r.slots[l];
162
+ for (let c = 0; c < t.length; c++)
163
+ if (t[c].id === a)
164
+ return o = c, !0;
165
+ }
166
+ return !1;
167
+ }
168
+ for (let l = 0; l < t.length; l++)
169
+ if (t[l].id === a)
170
+ return o = l, !0;
171
+ return !1;
172
+ },
173
+ !0
174
+ ), !t)
175
+ throw new Error(`没有查询到id为${a}的节点`);
176
+ return {
177
+ list: t,
178
+ schema: t[o],
179
+ index: o
180
+ };
181
+ }
182
+ function Nt(e) {
183
+ const a = {
184
+ schemas: [
185
+ {
186
+ type: "page",
187
+ id: "root",
188
+ label: "页面",
189
+ children: [
190
+ {
191
+ label: "表单",
192
+ type: "form",
193
+ icon: "epic-icon-daibanshixiang",
194
+ labelWidth: e.config.labelWidth || 100,
195
+ name: "default",
196
+ componentProps: {
197
+ layout: e.config.layout || "horizontal",
198
+ labelWidth: e.config.labelWidth || 100,
199
+ labelLayout: e.config.labelLayout === "flex" ? "fixed" : "flex",
200
+ labelCol: e.config.labelCol || { span: 5 },
201
+ wrapperCol: e.config.wrapperCol || { span: 19 },
202
+ hideRequiredMark: e.config.hideRequiredMark || !1,
203
+ colon: e.config.colon || !0,
204
+ labelAlign: e.config.labelAlign || "right",
205
+ size: e.config.size || "middle"
206
+ },
207
+ children: [],
208
+ id: "form_" + le()
209
+ }
210
+ ],
211
+ componentProps: {
212
+ style: {
213
+ padding: "16px"
214
+ }
215
+ }
216
+ }
217
+ ],
218
+ script: e.script || ""
219
+ };
220
+ return a.schemas[0].children[0].children = ne(e.list), a;
221
+ }
222
+ function ne(e, a) {
223
+ return e.map((n) => {
224
+ var d, b, f;
225
+ let o = n.type ?? "";
226
+ const t = n.options ?? {}, r = (s, S) => {
227
+ o === s && (o = S, t.defaultValue && (t.defaultValue = JSON.parse(t.defaultValue)));
228
+ };
229
+ if (r("uploadImg", "upload-image"), r("uploadFile", "upload-file"), o === "date" && t.range && (t.type = "daterange", delete t.range), (o === "date" || o === "time") && (t.valueFormat = t.format), o === "textarea") {
230
+ const { minRows: s, maxRows: S } = t;
231
+ t.autoSize = { minRows: s, maxRows: S }, delete t.minRows, delete t.maxRows;
232
+ }
233
+ o === "number" && !t.precision && delete t.precision, t.width && (t.style = { width: t.width }, delete t.width), o === "grid" && (o = "row"), a && a.type === "grid" && (o = "col", t.span = n.span, n.key = le());
234
+ const l = {
235
+ label: n.label,
236
+ type: o,
237
+ icon: n.icon || "",
238
+ field: n.model,
239
+ componentProps: t,
240
+ id: n.key
241
+ };
242
+ return (t.noFormItem || !t.showLabel) && (l.noFormItem = !0, delete t.noFormItem, delete t.showLabel), t.clearable && (t.allowClear = !0, delete t.clearable), [
243
+ "input",
244
+ "textarea",
245
+ "number",
246
+ "password",
247
+ "select",
248
+ "cascader",
249
+ "checkbox",
250
+ "radio",
251
+ "date",
252
+ "time",
253
+ "slider",
254
+ "switch",
255
+ "color-picker",
256
+ "upload-file",
257
+ "upload-image"
258
+ ].includes(o) && (l.input = !0, ((b = (d = n.rules) == null ? void 0 : d[0]) == null ? void 0 : b.required) === !1 && n.rules.shift(), ((f = n.rules) == null ? void 0 : f.length) > 0 && (l.rules = n.rules)), n.list && (l.children = ne(n.list, n)), n.columns && (l.children = ne(n.columns, n)), n.trs && (l.children = ne(n.trs, n)), n.tds && (l.children = ne(n.tds, n)), l;
259
+ });
260
+ }
261
+ function Bt(e, a) {
262
+ let n = null;
263
+ return (...o) => {
264
+ n && clearTimeout(n), n = setTimeout(() => {
265
+ e(...o);
266
+ }, a);
267
+ };
268
+ }
269
+ function Ie() {
270
+ const e = A({}), a = A({}), n = A(!1), o = A([]), t = Y({});
271
+ function r(m) {
272
+ return e.value[m];
273
+ }
274
+ function l(m, w) {
275
+ e.value[m] = w;
276
+ }
277
+ function c(m) {
278
+ delete e.value[m];
279
+ }
280
+ function d(m, w = !1) {
281
+ const g = Object.entries(F.publicMethods).reduce(
282
+ (k, [V, B]) => (k[V] = B.handler, k),
283
+ {}
284
+ );
285
+ try {
286
+ new Function(`const epic = this;${m}`).bind({
287
+ ...g,
288
+ getComponent: r,
289
+ find: r,
290
+ defineExpose: b,
291
+ publicMethods: g,
292
+ pluginManager: F
293
+ })();
294
+ } catch (k) {
295
+ w && console.error("[epic:自定义函数]异常:", k);
296
+ }
297
+ }
298
+ function b(m) {
299
+ m != null && (a.value = m);
300
+ }
301
+ function f(m, ...w) {
302
+ if (!m || m.length === 0) {
303
+ console.warn("未提供任何动作");
304
+ return;
305
+ }
306
+ m.forEach((g) => {
307
+ const k = g.args ? JSON.parse(g.args) : w;
308
+ switch (g.type) {
309
+ case "public":
310
+ s(g, k);
311
+ break;
312
+ case "custom":
313
+ S(g, k);
314
+ break;
315
+ case "component":
316
+ u(g, k);
317
+ break;
318
+ default:
319
+ console.warn(`未知的动作类型: ${g.type}`);
320
+ break;
321
+ }
322
+ });
323
+ }
324
+ function s(m, w) {
325
+ var g;
326
+ try {
327
+ (g = F.publicMethods[m.methodName]) == null || g.handler(...w);
328
+ } catch (k) {
329
+ console.error(`[Epic:公共函数(${m.methodName})]执行异常:`, k);
330
+ }
331
+ }
332
+ function S(m, w) {
333
+ var g, k;
334
+ try {
335
+ (k = (g = a.value)[m.methodName]) == null || k.call(g, ...w);
336
+ } catch (V) {
337
+ console.error(`[Epic:自定义函数(${m.methodName})]执行异常:`, V);
338
+ }
339
+ }
340
+ function u(m, w) {
341
+ const g = m.componentId != null && r(m.componentId);
342
+ if (!g) {
343
+ console.warn(`[Epic:组件${m.componentId}]未找到`);
344
+ return;
345
+ }
346
+ try {
347
+ g[m.methodName](...w);
348
+ } catch (k) {
349
+ console.error(`[Epic:组件${m.componentId}函数(${m.methodName})]执行异常:`, k);
350
+ }
351
+ }
352
+ function y(m = !0) {
353
+ n.value = m;
354
+ }
355
+ function p(m) {
356
+ const w = oe(m, () => !0);
357
+ o.value = w.map((g) => g.id);
358
+ }
359
+ function v(m, w = "default") {
360
+ if (t[w]) {
361
+ const g = t[w];
362
+ J(m, g);
363
+ }
364
+ t[w] = m;
365
+ }
366
+ function C(m, w = "default") {
367
+ if (t[w]) {
368
+ J(t[w], m, !1);
369
+ return;
370
+ }
371
+ t[w] = m;
372
+ }
373
+ return {
374
+ componentInstances: e,
375
+ funcs: a,
376
+ isDesignMode: n,
377
+ defaultComponentIds: o,
378
+ forms: t,
379
+ addFormData: v,
380
+ setFormData: C,
381
+ getComponentInstance: r,
382
+ // 简化查询函数, 推荐使用
383
+ find: r,
384
+ addComponentInstance: l,
385
+ removeComponentInstance: c,
386
+ setMethods: d,
387
+ doActions: f,
388
+ setDesignMode: y,
389
+ setDefaultComponentIds: p
390
+ };
391
+ }
392
+ function He() {
393
+ const e = A([]), a = A([]), n = A(null);
394
+ let o = 0;
395
+ function t(d, b = "插入组件") {
396
+ const f = Date.now();
397
+ o + 150 > f || (o = f, n.value != null && (e.value.push(n.value), a.value.splice(0, a.value.length)), n.value = {
398
+ type: b,
399
+ componentSchema: JSON.stringify(d)
400
+ }, e.value.length > 60 && e.value.unshift());
401
+ }
402
+ function r() {
403
+ if (e.value.length === 0)
404
+ return !1;
405
+ const d = e.value.pop();
406
+ return n.value != null && a.value.push(n.value), n.value = d, JSON.parse(d.componentSchema);
407
+ }
408
+ function l() {
409
+ if (a.value.length === 0)
410
+ return !1;
411
+ const d = a.value.pop();
412
+ return n.value != null && e.value.push(n.value), n.value = d, JSON.parse(d.componentSchema);
413
+ }
414
+ function c() {
415
+ e.value = [], a.value = [], n.value = null;
416
+ }
417
+ return {
418
+ recordList: e,
419
+ undoList: a,
420
+ currentRecord: n,
421
+ push: t,
422
+ undo: r,
423
+ redo: l,
424
+ reset: c
425
+ };
426
+ }
427
+ const Ke = /* @__PURE__ */ X({
428
+ __name: "dynamicFormItem",
429
+ props: {
430
+ hasFormItem: { type: Boolean },
431
+ formItemProps: {}
432
+ },
433
+ emits: ["updateFormItemRef"],
434
+ setup(e, { emit: a }) {
435
+ const n = F.getComponent("form-item"), o = e, t = a, r = A(), l = () => {
436
+ t("updateFormItemRef", r.value);
437
+ };
438
+ return (c, d) => o.hasFormItem ? (M(), L(_(n), he({
439
+ key: 0,
440
+ ref_key: "formItemRef",
441
+ ref: r,
442
+ onVnodeMounted: l
443
+ }, o.formItemProps), {
444
+ default: P(() => [
445
+ R(c.$slots, "default")
446
+ ]),
447
+ _: 3
448
+ }, 16, ["onVnodeMounted"])) : R(c.$slots, "default", { key: 1 });
449
+ }
450
+ }), qe = /* @__PURE__ */ X({
451
+ name: "ENode",
452
+ __name: "node",
453
+ props: {
454
+ componentSchema: {},
455
+ modelValue: {},
456
+ ruleField: {},
457
+ resetFormData: { type: Boolean },
458
+ name: {},
459
+ dynamicId: {},
460
+ sourceDateUrl: {}
461
+ },
462
+ emits: ["update:modelValue", "change", "update:dynamicId"],
463
+ setup(e, { emit: a }) {
464
+ const { proxy: n } = ae(), o = e, t = A(null);
465
+ let r = q("formData", Y({}));
466
+ const l = q("slots", {}), c = q("pageManager", {}), d = q("disabled", { value: !1 }), b = q("ruleFieldPrefix", null), f = q("resetFormData", !1);
467
+ let s = Y(N(o.componentSchema));
468
+ y();
469
+ async function S(i) {
470
+ if (["cascader", "checkbox", "select", "radio"].includes(i.type) && i.componentProps.dynamicId && o.sourceDateUrl) {
471
+ const D = (await ye({
472
+ // || "http://192.168.28.205:3000/dev-api/data-source
473
+ url: o.sourceDateUrl,
474
+ method: "get",
475
+ params: {
476
+ id: i.componentProps.dynamicId
477
+ }
478
+ })).data.data;
479
+ let E = await ye({
480
+ url: D.url,
481
+ method: D.method,
482
+ data: JSON.parse(D.body),
483
+ params: JSON.parse(D.params),
484
+ headers: JSON.parse(D.headers)
485
+ });
486
+ if (D && (D != null && D.dataPath)) {
487
+ const xe = D.dataPath.split(".").reduce((re, Ce) => re[Ce], E.data);
488
+ i.componentProps.options = u(xe).map((re) => ({
489
+ label: re[D.dataKey],
490
+ value: re[D.dataValue]
491
+ }));
492
+ } else
493
+ i.componentProps.options = u(E.data).map((K) => ({
494
+ label: K[D.dataKey],
495
+ value: K[D.dataValue]
496
+ }));
497
+ return i;
498
+ }
499
+ return i;
500
+ }
501
+ function u(i) {
502
+ return i && Object.prototype.toString.call(i) === "[object Array]" ? i : [];
503
+ }
504
+ O(
505
+ () => o.componentSchema,
506
+ (i) => {
507
+ ke(s, i, ["children"]) || (J(s, N(i)), y());
508
+ },
509
+ {
510
+ deep: !0
511
+ }
512
+ );
513
+ function y() {
514
+ c.isDesignMode.value && typeof s.field == "string" && (s.field += "-design-mode");
515
+ }
516
+ (o.resetFormData || f) && (r = {});
517
+ const p = a, v = A(), C = A(), m = (i) => {
518
+ C.value = i;
519
+ }, w = _e();
520
+ Object.keys(w).length && $("nodeAttrs", w);
521
+ const g = Pe(null), k = U(() => {
522
+ var i, I;
523
+ return (i = s.componentProps) != null && i.hidden ? !1 : typeof s.show == "boolean" ? s.show : ((I = s.show) == null ? void 0 : I.call(s, { values: r })) ?? !0;
524
+ }), V = U(() => {
525
+ var D;
526
+ const i = k.value && ((D = s.rules) == null ? void 0 : D.map((E) => ({
527
+ ...E,
528
+ validator: E.validator && c.funcs.value[E.validator]
529
+ // 自定义校验函数
530
+ })));
531
+ let I = s.field;
532
+ o.ruleField ? I = o.ruleField : b && s.field && (I = N(b), I.push(s.field));
533
+ const x = {
534
+ ...s,
535
+ rules: i,
536
+ rule: i,
537
+ field: I
538
+ };
539
+ return x.children && delete x.children, x;
540
+ }), B = U(() => {
541
+ var x, D;
542
+ const i = ((x = G.value) == null ? void 0 : x.bindModel) ?? "modelValue", I = {};
543
+ return s.on && Object.keys(s.on).forEach((E) => {
544
+ I[`on${Le(E)}`] = (...K) => c.doActions(s.on[E], ...K);
545
+ }), {
546
+ ...o,
547
+ ...s.componentProps,
548
+ disabled: (d == null ? void 0 : d.value) || ((D = s.componentProps) == null ? void 0 : D.disabled),
549
+ bindModel: i,
550
+ ...I
551
+ };
552
+ }), G = U(() => F.getComponentConfingByType(s.type) ?? null);
553
+ se(() => {
554
+ t.value = o.modelValue ?? r[s.field ?? ""];
555
+ }), O(
556
+ () => t.value,
557
+ () => {
558
+ t.value !== (o.modelValue ?? r[s.field ?? ""]) && W(t.value);
559
+ }
560
+ ), O(
561
+ () => v.value,
562
+ () => {
563
+ te();
564
+ },
565
+ { immediate: !0 }
566
+ );
567
+ function te() {
568
+ var I;
569
+ const i = v.value || n;
570
+ s.id && i && (s.input && (i.setValue = W, i.getValue = () => r[s.field] || o.modelValue), i.setAttr = (x, D) => (s.componentProps || (s.componentProps = {}), s.componentProps[x] = D), i.getAttr = (x) => s.componentProps[x], c.addComponentInstance(s.id, i), (I = G.value) != null && I.defaultSchema.input && s.noFormItem !== !0 && C.value && c.addComponentInstance(s.id + "formItem", C.value));
571
+ }
572
+ function ue() {
573
+ var i;
574
+ s.id && (c.removeComponentInstance(s.id), (i = G.value) != null && i.defaultSchema.input && s.noFormItem !== !0 && c.removeComponentInstance(s.id + "formItem"));
575
+ }
576
+ async function de() {
577
+ var I, x, D;
578
+ if (s = await S(s), typeof ((I = s.componentProps) == null ? void 0 : I.defaultValue) < "u") {
579
+ const E = c.isDesignMode.value ? (x = s.componentProps) == null ? void 0 : x.defaultValue : r[s.field] ?? ((D = s.componentProps) == null ? void 0 : D.defaultValue);
580
+ W(N(E));
581
+ }
582
+ if (s.type === "slot") {
583
+ const E = s.slotName;
584
+ if (!E) return;
585
+ g.value = X({
586
+ setup() {
587
+ return () => R(l, E, {
588
+ componentSchema: s,
589
+ model: r
590
+ });
591
+ }
592
+ });
593
+ return;
594
+ }
595
+ const i = F.getComponent(s.type);
596
+ if (!i) {
597
+ console.error(`组件${s.type}未注册`);
598
+ return;
599
+ }
600
+ if (typeof i == "function") {
601
+ const E = await i();
602
+ g.value = E.default ?? E;
603
+ } else
604
+ g.value = i;
605
+ }
606
+ function W(i) {
607
+ p("update:modelValue", i), p("change", i), s.field && (r[s.field] = i);
608
+ }
609
+ function h(i) {
610
+ p("update:dynamicId", i);
611
+ }
612
+ let H = null;
613
+ return O(
614
+ () => s,
615
+ async (i) => {
616
+ const I = JSON.stringify({
617
+ ...i,
618
+ children: void 0,
619
+ componentProps: {
620
+ ...i.componentProps,
621
+ options: null
622
+ }
623
+ });
624
+ if (I === H)
625
+ return !1;
626
+ H = I, de();
627
+ },
628
+ {
629
+ immediate: !0,
630
+ deep: !0
631
+ }
632
+ ), Se(ue), (i, I) => {
633
+ var D;
634
+ const x = Oe("ENode");
635
+ return g.value && k.value ? (M(), L(Ke, {
636
+ key: 0,
637
+ hasFormItem: _(s).noFormItem !== !0 && ((D = G.value) == null ? void 0 : D.defaultSchema.input),
638
+ formItemProps: V.value,
639
+ onUpdateFormItemRef: m
640
+ }, {
641
+ default: P(() => [
642
+ (M(), L(Ve(g.value), he({
643
+ ref_key: "componentInstance",
644
+ ref: v,
645
+ onVnodeMounted: te,
646
+ model: _(r)
647
+ }, { ...B.value }, {
648
+ [B.value.bindModel]: t.value,
649
+ ["onUpdate:" + B.value.bindModel]: I[0] || (I[0] = (E) => t.value = E),
650
+ [`onUpdate:${B.value.bindModel}` || ""]: W,
651
+ "onUpdate:dynamicId": h
652
+ }), {
653
+ node: P((E) => [
654
+ T(x, he(E, {
655
+ sourceDateUrl: o.sourceDateUrl
656
+ }), null, 16, ["sourceDateUrl"])
657
+ ]),
658
+ "edit-node": P(() => [
659
+ R(i.$slots, "edit-node")
660
+ ]),
661
+ _: 3
662
+ }, 16, ["model"]))
663
+ ]),
664
+ _: 3
665
+ }, 8, ["hasFormItem", "formItemProps"])) : Ae("", !0);
666
+ };
667
+ }
668
+ });
669
+ function Ze() {
670
+ const e = A(!1), a = Ie(), n = A({});
671
+ function o() {
672
+ return new Promise((u) => {
673
+ if (e.value)
674
+ u();
675
+ else {
676
+ const y = O(e, () => {
677
+ y(), u();
678
+ });
679
+ }
680
+ });
681
+ }
682
+ async function t(u = "default") {
683
+ var p;
684
+ await o();
685
+ const y = (p = n.value) == null ? void 0 : p[u];
686
+ if (!y) throw new Error(`表单 [name=${u}] 不存在`);
687
+ return y;
688
+ }
689
+ async function r(u, y) {
690
+ const p = await t(u);
691
+ return N(await y(p));
692
+ }
693
+ async function l(u = "default") {
694
+ return await r(u, (y) => y.getData());
695
+ }
696
+ function c(u, y = "default") {
697
+ var v;
698
+ a.setFormData(u, y);
699
+ const p = (v = n.value) == null ? void 0 : v[y];
700
+ p == null || p.clearValidate();
701
+ }
702
+ async function d(u = "default") {
703
+ return await r(u, async (y) => (await y.validate(), await y.getData()));
704
+ }
705
+ async function b(u) {
706
+ await o();
707
+ const y = {};
708
+ for (const p in n.value) {
709
+ const v = n.value[p];
710
+ v && (y[p] = N(await u(v)));
711
+ }
712
+ return y;
713
+ }
714
+ async function f() {
715
+ return await b((u) => u.getData());
716
+ }
717
+ function s(u) {
718
+ for (const y in u)
719
+ c(u[y], y);
720
+ }
721
+ async function S() {
722
+ return await b(async (u) => (await u.validate(), await u.getData()));
723
+ }
724
+ return {
725
+ ready: e,
726
+ pageManager: a,
727
+ forms: n,
728
+ getData: l,
729
+ setData: c,
730
+ validate: d,
731
+ getForms: f,
732
+ setForms: s,
733
+ validateAll: S,
734
+ getFormInstance: t
735
+ };
736
+ }
737
+ const Ge = {
738
+ key: 0,
739
+ class: "epic-loading-box"
740
+ }, Qe = { class: "epic-builder-main" }, Ye = { class: "epic-loading-box" }, Xe = /* @__PURE__ */ X({
741
+ __name: "builder",
742
+ props: {
743
+ pageSchema: {},
744
+ formData: {},
745
+ disabled: { type: Boolean },
746
+ sourceDateUrl: {}
747
+ },
748
+ emits: ["ready"],
749
+ setup(e, { expose: a, emit: n }) {
750
+ const o = Q(() => import("./index-DgcFxYFp.js")), t = n, { ready: r, pageManager: l, forms: c, getData: d, setData: b, validate: f, getForms: s, setForms: S, validateAll: u, getFormInstance: y } = Ze(), p = e, v = Y({
751
+ schemas: []
752
+ });
753
+ O(
754
+ () => p.pageSchema,
755
+ (g) => {
756
+ J(v, g);
757
+ },
758
+ {
759
+ immediate: !0,
760
+ deep: !0
761
+ }
762
+ ), O(
763
+ () => p.formData,
764
+ (g) => {
765
+ g && b(g);
766
+ },
767
+ {
768
+ immediate: !0,
769
+ deep: !0
770
+ }
771
+ ), O(
772
+ () => v.script,
773
+ (g) => {
774
+ g && l.setMethods(g, !0);
775
+ },
776
+ {
777
+ immediate: !0
778
+ }
779
+ ), $("slots", Fe()), $("pageManager", l), $("forms", c), $("pageSchema", v), $(
780
+ "disabled",
781
+ U(() => p.disabled)
782
+ );
783
+ const C = ae(), m = C == null ? void 0 : C.proxy;
784
+ function w() {
785
+ ee(() => {
786
+ r.value = !0, t("ready", l), m && l.addComponentInstance("builder", m);
787
+ });
788
+ }
789
+ return a({
790
+ ready: r,
791
+ pageManager: l,
792
+ getData: d,
793
+ setData: b,
794
+ validate: f,
795
+ getForms: s,
796
+ setForms: S,
797
+ validateAll: u,
798
+ getFormInstance: y
799
+ }), (g, k) => _(F).initialized.value ? (M(), L(De, {
800
+ key: 1,
801
+ onResolve: w
802
+ }, {
803
+ default: P(() => [
804
+ z("div", Qe, [
805
+ (M(!0), ve(Me, null, Re(v.schemas, (V, B) => (M(), L(_(qe), {
806
+ key: B,
807
+ sourceDateUrl: p.sourceDateUrl,
808
+ componentSchema: V
809
+ }, null, 8, ["sourceDateUrl", "componentSchema"]))), 128))
810
+ ])
811
+ ]),
812
+ fallback: P(() => [
813
+ z("div", Ye, [
814
+ T(_(o))
815
+ ])
816
+ ]),
817
+ _: 1
818
+ })) : (M(), ve("div", Ge));
819
+ }
820
+ });
821
+ function we(e) {
822
+ return Be() ? (Ue(e), !0) : !1;
823
+ }
824
+ function je(e) {
825
+ let a = 0, n, o;
826
+ const t = () => {
827
+ a -= 1, o && a <= 0 && (o.stop(), n = void 0, o = void 0);
828
+ };
829
+ return (...r) => (a += 1, o || (o = $e(!0), n = o.run(() => e(...r))), we(t), n);
830
+ }
831
+ function j(e) {
832
+ return typeof e == "function" ? e() : _(e);
833
+ }
834
+ const et = typeof window < "u" && typeof document < "u";
835
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
836
+ const tt = (e) => typeof e < "u", nt = Object.prototype.toString, ot = (e) => nt.call(e) === "[object Object]", at = () => {
837
+ };
838
+ function rt(e) {
839
+ return ae();
840
+ }
841
+ function st(e, a = !0, n) {
842
+ rt() ? ge(e, n) : a ? e() : ee(e);
843
+ }
844
+ function lt(e = !1, a = {}) {
845
+ const {
846
+ truthyValue: n = !0,
847
+ falsyValue: o = !1
848
+ } = a, t = Ne(e), r = A(e);
849
+ function l(c) {
850
+ if (arguments.length)
851
+ return r.value = c, r.value;
852
+ {
853
+ const d = j(n);
854
+ return r.value = r.value === d ? j(o) : d, r.value;
855
+ }
856
+ }
857
+ return t ? l : [r, l];
858
+ }
859
+ function Ut(e, a, n) {
860
+ const o = O(e, (...t) => (ee(() => o()), a(...t)), n);
861
+ return o;
862
+ }
863
+ const ie = et ? window : void 0;
864
+ function Z(e) {
865
+ var a;
866
+ const n = j(e);
867
+ return (a = n == null ? void 0 : n.$el) != null ? a : n;
868
+ }
869
+ function it(...e) {
870
+ let a, n, o, t;
871
+ if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([n, o, t] = e, a = ie) : [a, n, o, t] = e, !a)
872
+ return at;
873
+ Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
874
+ const r = [], l = () => {
875
+ r.forEach((f) => f()), r.length = 0;
876
+ }, c = (f, s, S, u) => (f.addEventListener(s, S, u), () => f.removeEventListener(s, S, u)), d = O(
877
+ () => [Z(a), j(t)],
878
+ ([f, s]) => {
879
+ if (l(), !f)
880
+ return;
881
+ const S = ot(s) ? { ...s } : s;
882
+ r.push(
883
+ ...n.flatMap((u) => o.map((y) => c(f, u, y, S)))
884
+ );
885
+ },
886
+ { immediate: !0, flush: "post" }
887
+ ), b = () => {
888
+ d(), l();
889
+ };
890
+ return we(b), b;
891
+ }
892
+ function ct(e) {
893
+ return typeof e == "function" ? e : typeof e == "string" ? (a) => a.key === e : Array.isArray(e) ? (a) => e.includes(a.key) : () => !0;
894
+ }
895
+ function Ee(...e) {
896
+ let a, n, o = {};
897
+ e.length === 3 ? (a = e[0], n = e[1], o = e[2]) : e.length === 2 ? typeof e[1] == "object" ? (a = !0, n = e[0], o = e[1]) : (a = e[0], n = e[1]) : (a = !0, n = e[0]);
898
+ const {
899
+ target: t = ie,
900
+ eventName: r = "keydown",
901
+ passive: l = !1,
902
+ dedupe: c = !1
903
+ } = o, d = ct(a);
904
+ return it(t, r, (f) => {
905
+ f.repeat && j(c) || d(f) && n(f);
906
+ }, l);
907
+ }
908
+ function pe(e, a, n = {}) {
909
+ return Ee(e, a, { ...n, eventName: "keydown" });
910
+ }
911
+ function me(e, a, n = {}) {
912
+ return Ee(e, a, { ...n, eventName: "keyup" });
913
+ }
914
+ function ut() {
915
+ const e = A(!1), a = ae();
916
+ return a && ge(() => {
917
+ e.value = !0;
918
+ }, a), e;
919
+ }
920
+ function dt(e) {
921
+ const a = ut();
922
+ return U(() => (a.value, !!e()));
923
+ }
924
+ function ft(e) {
925
+ return JSON.parse(JSON.stringify(e));
926
+ }
927
+ function pt(e, a, n = {}) {
928
+ const { window: o = ie, ...t } = n;
929
+ let r;
930
+ const l = dt(() => o && "ResizeObserver" in o), c = () => {
931
+ r && (r.disconnect(), r = void 0);
932
+ }, d = U(() => {
933
+ const s = j(e);
934
+ return Array.isArray(s) ? s.map((S) => Z(S)) : [Z(s)];
935
+ }), b = O(
936
+ d,
937
+ (s) => {
938
+ if (c(), l.value && o) {
939
+ r = new ResizeObserver(a);
940
+ for (const S of s)
941
+ S && r.observe(S, t);
942
+ }
943
+ },
944
+ { immediate: !0, flush: "post" }
945
+ ), f = () => {
946
+ c(), b();
947
+ };
948
+ return we(f), {
949
+ isSupported: l,
950
+ stop: f
951
+ };
952
+ }
953
+ function Tt(e, a = { width: 0, height: 0 }, n = {}) {
954
+ const { window: o = ie, box: t = "content-box" } = n, r = U(() => {
955
+ var s, S;
956
+ return (S = (s = Z(e)) == null ? void 0 : s.namespaceURI) == null ? void 0 : S.includes("svg");
957
+ }), l = A(a.width), c = A(a.height), { stop: d } = pt(
958
+ e,
959
+ ([s]) => {
960
+ const S = t === "border-box" ? s.borderBoxSize : t === "content-box" ? s.contentBoxSize : s.devicePixelContentBoxSize;
961
+ if (o && r.value) {
962
+ const u = Z(e);
963
+ if (u) {
964
+ const y = u.getBoundingClientRect();
965
+ l.value = y.width, c.value = y.height;
966
+ }
967
+ } else if (S) {
968
+ const u = Array.isArray(S) ? S : [S];
969
+ l.value = u.reduce((y, { inlineSize: p }) => y + p, 0), c.value = u.reduce((y, { blockSize: p }) => y + p, 0);
970
+ } else
971
+ l.value = s.contentRect.width, c.value = s.contentRect.height;
972
+ },
973
+ n
974
+ );
975
+ st(() => {
976
+ const s = Z(e);
977
+ s && (l.value = "offsetWidth" in s ? s.offsetWidth : a.width, c.value = "offsetHeight" in s ? s.offsetHeight : a.height);
978
+ });
979
+ const b = O(
980
+ () => Z(e),
981
+ (s) => {
982
+ l.value = s ? a.width : 0, c.value = s ? a.height : 0;
983
+ }
984
+ );
985
+ function f() {
986
+ d(), b();
987
+ }
988
+ return {
989
+ width: l,
990
+ height: c,
991
+ stop: f
992
+ };
993
+ }
994
+ function Lt(e, a, n, o = {}) {
995
+ var t, r, l;
996
+ const {
997
+ clone: c = !1,
998
+ passive: d = !1,
999
+ eventName: b,
1000
+ deep: f = !1,
1001
+ defaultValue: s,
1002
+ shouldEmit: S
1003
+ } = o, u = ae(), y = n || (u == null ? void 0 : u.emit) || ((t = u == null ? void 0 : u.$emit) == null ? void 0 : t.bind(u)) || ((l = (r = u == null ? void 0 : u.proxy) == null ? void 0 : r.$emit) == null ? void 0 : l.bind(u == null ? void 0 : u.proxy));
1004
+ let p = b;
1005
+ a || (a = "modelValue"), p = p || `update:${a.toString()}`;
1006
+ const v = (w) => c ? typeof c == "function" ? c(w) : ft(w) : w, C = () => tt(e[a]) ? v(e[a]) : s, m = (w) => {
1007
+ S ? S(w) && y(p, w) : y(p, w);
1008
+ };
1009
+ if (d) {
1010
+ const w = C(), g = A(w);
1011
+ let k = !1;
1012
+ return O(
1013
+ () => e[a],
1014
+ (V) => {
1015
+ k || (k = !0, g.value = v(V), ee(() => k = !1));
1016
+ }
1017
+ ), O(
1018
+ g,
1019
+ (V) => {
1020
+ !k && (V !== e[a] || f) && m(V);
1021
+ },
1022
+ { deep: f }
1023
+ ), g;
1024
+ } else
1025
+ return U({
1026
+ get() {
1027
+ return C();
1028
+ },
1029
+ set(w) {
1030
+ m(w);
1031
+ }
1032
+ });
1033
+ }
1034
+ function zt() {
1035
+ const { isDark: e } = ce(), a = lt(e);
1036
+ return {
1037
+ isDark: e,
1038
+ toggleDark: a
1039
+ };
1040
+ }
1041
+ function mt() {
1042
+ const e = A(!1);
1043
+ return ge(() => {
1044
+ ht(e), vt(e);
1045
+ }), O(
1046
+ () => e.value,
1047
+ () => {
1048
+ e.value ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
1049
+ }
1050
+ ), {
1051
+ isDark: e
1052
+ };
1053
+ }
1054
+ function ht(e) {
1055
+ var a = document.documentElement;
1056
+ a && (a.classList.contains("dark") ? e.value = !0 : e.value = !1);
1057
+ }
1058
+ function vt(e) {
1059
+ var a = document.querySelector("html"), n = new MutationObserver(function(o) {
1060
+ for (var t of o)
1061
+ if (t.type === "attributes" && t.attributeName === "class") {
1062
+ const r = t.target;
1063
+ new Array(...r.classList).includes("dark") ? e.value = !0 : e.value = !1;
1064
+ }
1065
+ });
1066
+ n.observe(a, {
1067
+ attributes: !0,
1068
+ attributeFilter: ["class"]
1069
+ }), Se(() => {
1070
+ n.disconnect();
1071
+ });
1072
+ }
1073
+ function yt() {
1074
+ const e = A(1), a = A(!1), { isDark: n } = mt(), { pressSpace: o, pressShift: t, pressCtrl: r } = gt();
1075
+ return {
1076
+ canvasScale: e,
1077
+ pressSpace: o,
1078
+ pressShift: t,
1079
+ pressCtrl: r,
1080
+ disabledZoom: a,
1081
+ isDark: n
1082
+ };
1083
+ }
1084
+ const ce = je(yt);
1085
+ function gt() {
1086
+ const e = A(!1), a = A(!1), n = A(!1);
1087
+ return pe(" ", () => {
1088
+ e.value = !0;
1089
+ }), me(" ", () => {
1090
+ e.value = !1;
1091
+ }), pe("Shift", (o) => {
1092
+ o.preventDefault(), a.value = !0;
1093
+ }), me("Shift", () => {
1094
+ a.value = !1;
1095
+ }), pe("Control", (o) => {
1096
+ o.preventDefault(), n.value = !0;
1097
+ }), me("Control", () => {
1098
+ n.value = !1;
1099
+ }), { pressSpace: e, pressShift: a, pressCtrl: n };
1100
+ }
1101
+ function Jt(e) {
1102
+ const { pressSpace: a } = ce(), n = new Image(1, 1);
1103
+ n.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";
1104
+ let o = 0, t = 0;
1105
+ function r(d) {
1106
+ var b;
1107
+ a.value && (o = d.x, t = d.y, (b = d.dataTransfer) == null || b.setDragImage(document.createElement("div"), 0, 0));
1108
+ }
1109
+ function l(d) {
1110
+ if (d.preventDefault(), !d.x || !d.y || !a.value)
1111
+ return;
1112
+ const b = d.x - o, f = d.y - t;
1113
+ o = d.x, t = d.y, e.value && (e.value.scrollTop -= f, e.value.scrollLeft -= b);
1114
+ }
1115
+ function c() {
1116
+ a.value = !1;
1117
+ }
1118
+ return { handleElementDragStart: r, handleElementDrag: l, handleElementDragEnd: c };
1119
+ }
1120
+ function Wt(e) {
1121
+ const { pressCtrl: a, canvasScale: n, disabledZoom: o } = ce();
1122
+ function t(r) {
1123
+ if (!a.value || o.value)
1124
+ return;
1125
+ r.preventDefault();
1126
+ let l = 0;
1127
+ r.deltaY < 0 ? l = n.value + 0.05 : l = n.value - 0.05, !(l > 150 || l < 0.5) && (n.value = l);
1128
+ }
1129
+ return O(
1130
+ () => n.value,
1131
+ (r) => {
1132
+ e.value && !o.value && (e.value.style.transform = `scale(${r})`);
1133
+ }
1134
+ ), { handleZoom: t, canvasScale: n };
1135
+ }
1136
+ function Ht(e, a = 16.66) {
1137
+ let n;
1138
+ function o() {
1139
+ t(), n = window.setInterval(e, a);
1140
+ }
1141
+ function t() {
1142
+ window.clearInterval(n);
1143
+ }
1144
+ return {
1145
+ startTimedQuery: o,
1146
+ stopTimedQuery: t
1147
+ };
1148
+ }
1149
+ const wt = { class: "min-w-750px rounded" }, bt = { class: "h-full rounded" }, St = /* @__PURE__ */ X({
1150
+ __name: "index",
1151
+ setup(e, { expose: a }) {
1152
+ const n = F.getComponent("monacoEditor"), o = F.getComponent("modal"), t = A(null), r = A(!1), l = A(!1), c = A({}), d = q("pageSchema"), b = A(null), f = A("");
1153
+ function s() {
1154
+ l.value = !1;
1155
+ }
1156
+ function S() {
1157
+ r.value = !1;
1158
+ }
1159
+ function u() {
1160
+ r.value = !0, f.value = le();
1161
+ }
1162
+ async function y() {
1163
+ try {
1164
+ let p = await b.value.validateAll();
1165
+ if (!Object.keys(p).length) {
1166
+ alert("请添加表单组件后再尝试!");
1167
+ return;
1168
+ }
1169
+ Object.keys(p).length === 1 && (p = p.default), c.value = JSON.stringify(p, null, 2), ee(() => {
1170
+ var v;
1171
+ (v = t.value) == null || v.setValue(c.value);
1172
+ }), l.value = !0;
1173
+ } catch (p) {
1174
+ console.error(p);
1175
+ }
1176
+ }
1177
+ return a({
1178
+ handleOpen: u
1179
+ }), (p, v) => (M(), L(_(o), {
1180
+ modelValue: r.value,
1181
+ "onUpdate:modelValue": v[1] || (v[1] = (C) => r.value = C),
1182
+ title: "预览",
1183
+ class: "w-900px",
1184
+ width: "900px",
1185
+ onClose: S,
1186
+ onOk: y,
1187
+ okText: "表单数据"
1188
+ }, {
1189
+ default: P(() => [
1190
+ z("div", wt, [
1191
+ (M(), L(_(Xe), {
1192
+ key: f.value,
1193
+ ref_key: "kb",
1194
+ ref: b,
1195
+ "page-schema": _(d)
1196
+ }, null, 8, ["page-schema"])),
1197
+ T(_(o), {
1198
+ modelValue: l.value,
1199
+ "onUpdate:modelValue": v[0] || (v[0] = (C) => l.value = C),
1200
+ title: "表单数据",
1201
+ class: "w-860px",
1202
+ width: "860px",
1203
+ onClose: s,
1204
+ onOk: s
1205
+ }, {
1206
+ default: P(() => [
1207
+ z("div", bt, [
1208
+ T(_(n), {
1209
+ ref_key: "monacoEditorRef",
1210
+ ref: t,
1211
+ autoToggleTheme: "",
1212
+ readOnly: "",
1213
+ class: "h-full editor",
1214
+ "model-value": c.value
1215
+ }, null, 8, ["model-value"])
1216
+ ])
1217
+ ]),
1218
+ _: 1
1219
+ }, 8, ["modelValue"])
1220
+ ])
1221
+ ]),
1222
+ _: 1
1223
+ }, 8, ["modelValue"]));
1224
+ }
1225
+ }), At = {
1226
+ key: 0,
1227
+ class: "epic-loading-box"
1228
+ }, Dt = { class: "epic-designer-main" }, kt = { class: "epic-header-container" }, It = { class: "epic-loading-box" }, Kt = /* @__PURE__ */ X({
1229
+ __name: "designer",
1230
+ props: {
1231
+ disabledZoom: { type: Boolean, default: !1 },
1232
+ hiddenHeader: { type: Boolean, default: !1 },
1233
+ lockDefaultSchemaEdit: { type: Boolean, default: !1 },
1234
+ formMode: { type: Boolean, default: !1 },
1235
+ title: { default: "EpicDesigner默认项目" },
1236
+ defaultSchema: {},
1237
+ sourceCodeReadOnly: { type: Boolean },
1238
+ source: { default: [] },
1239
+ updateSourceId: { default: "" }
1240
+ },
1241
+ emits: [
1242
+ "ready",
1243
+ "save",
1244
+ "reset",
1245
+ "toggleDeviceMode",
1246
+ "saveSourceData",
1247
+ "deleteSourceData",
1248
+ "updateSourceData"
1249
+ ],
1250
+ setup(e, { expose: a, emit: n }) {
1251
+ const o = Q(() => import("./index-C-XUgjda.js")), t = Q(() => import("./index-ASoFJnMl.js")), r = Q(() => import("./index-Bo7Wv18B.js")), l = Q(() => import("./index-ooVzYa5L.js")), c = Q(() => import("./index-DgcFxYFp.js")), d = Ie(), b = He(), f = e;
1252
+ let s = {
1253
+ schemas: [
1254
+ {
1255
+ type: "form",
1256
+ id: "root",
1257
+ label: "页面",
1258
+ children: [],
1259
+ componentProps: {
1260
+ name: "表单",
1261
+ style: {
1262
+ padding: "16px"
1263
+ }
1264
+ }
1265
+ }
1266
+ // {
1267
+ // type: "form",
1268
+ // id: "root",
1269
+ // label: "表单",
1270
+ // children: [],
1271
+ // componentProps: {
1272
+ // style: {
1273
+ // margin: "0px",
1274
+ // },
1275
+ // name: "default",
1276
+ // labelWidth: "100px",
1277
+ // labelLayout: "fixed",
1278
+ // labelCol: {
1279
+ // span: 5,
1280
+ // },
1281
+ // wrapperCol: {
1282
+ // span: 19,
1283
+ // },
1284
+ // },
1285
+ // },
1286
+ ],
1287
+ script: `const { defineExpose, find } = epic;
1288
+
1289
+ function test (){
1290
+ console.log('test')
1291
+ }
1292
+
1293
+ // 通过defineExpose暴露的函数或者属性
1294
+ defineExpose({
1295
+ test
1296
+ })`
1297
+ };
1298
+ se(async () => {
1299
+ if (console.log("%c [ defaultSchema ]-136", "font-size:13px; background:pink; color:#bf2c9f;", f.defaultSchema), f.defaultSchema) {
1300
+ s = f.defaultSchema;
1301
+ return;
1302
+ }
1303
+ console.log("%c [ updateSourceId ]-141", "font-size:13px; background:pink; color:#bf2c9f;", f.updateSourceId), console.log("%c [ source ]-141", "font-size:13px; background:pink; color:#bf2c9f;", f.source), f.source && F.setSourceData(f.source), f.formMode && (s.schemas = F.formSchemas), f.updateSourceId && (s.schemas = await Promise.all(
1304
+ s.schemas.map(async (h) => {
1305
+ if (["cascader", "checkbox", "select", "radio"].includes(h.type) && h.componentProps.dynamicId && f.updateSourceId === h.componentProps.dynamicId) {
1306
+ const i = f.source.find((x) => x.id === f.updateSourceId);
1307
+ let I = await ye({
1308
+ url: i.url,
1309
+ method: i.method,
1310
+ data: JSON.parse(i.body),
1311
+ params: JSON.parse(i.params),
1312
+ headers: JSON.parse(i.headers)
1313
+ });
1314
+ if (i && (i != null && i.dataPath)) {
1315
+ const D = i.dataPath.split(".").reduce((E, K) => E[K], I.data);
1316
+ h.componentProps.options = S(D).map((E) => ({
1317
+ label: E[i.dataKey],
1318
+ value: E[i.dataValue]
1319
+ }));
1320
+ } else
1321
+ h.componentProps.options = S(I.data).map((x) => ({
1322
+ label: x[i.dataKey],
1323
+ value: x[i.dataValue]
1324
+ }));
1325
+ }
1326
+ return h;
1327
+ })
1328
+ ), console.log("%c [ ]-193", "font-size:13px; background:pink; color:#bf2c9f;", s.schemas));
1329
+ });
1330
+ function S(h) {
1331
+ return h && Object.prototype.toString.call(h) === "[object Array]" ? h : [];
1332
+ }
1333
+ d.setDesignMode(), d.setDefaultComponentIds(s.schemas);
1334
+ const u = n, y = A(null), p = Y({
1335
+ checkedNode: null,
1336
+ hoverNode: null,
1337
+ disableHover: !1,
1338
+ matched: []
1339
+ }), v = Y({
1340
+ schemas: [],
1341
+ script: s.script
1342
+ }), { disabledZoom: C } = ce();
1343
+ se(() => {
1344
+ C.value = f.disabledZoom;
1345
+ }), se(() => {
1346
+ const h = v.script;
1347
+ h && h !== "" && d.setMethods(h);
1348
+ }), $("pageSchema", v), $("revoke", b), $("pageManager", d), $(
1349
+ "designerProps",
1350
+ U(() => f)
1351
+ ), $("designer", {
1352
+ setCheckedNode: w,
1353
+ setHoverNode: g,
1354
+ setDisableHover: V,
1355
+ handleToggleDeviceMode: de,
1356
+ reset: te,
1357
+ state: p
1358
+ }), fe.on("saveSourceData", (h) => {
1359
+ u("saveSourceData", h);
1360
+ }), fe.on("deleteSourceData", (h) => {
1361
+ u("deleteSourceData", h);
1362
+ }), fe.on("updateSourceData", (h) => {
1363
+ u("updateSourceData", h);
1364
+ });
1365
+ function m() {
1366
+ v.schemas = N(s.schemas), w(v.schemas[0]), b.push(v.schemas, "初始化撤销功能");
1367
+ }
1368
+ async function w(h = v.schemas[0]) {
1369
+ p.checkedNode = h, p.matched = ze(v.schemas, h.id);
1370
+ }
1371
+ async function g(h = null) {
1372
+ var H;
1373
+ if (!h || p.disableHover)
1374
+ return p.hoverNode = null, !1;
1375
+ if ((h == null ? void 0 : h.id) === ((H = p.hoverNode) == null ? void 0 : H.id))
1376
+ return !1;
1377
+ p.hoverNode = h;
1378
+ }
1379
+ function k() {
1380
+ ee(() => {
1381
+ u("ready", { pageManager: d });
1382
+ });
1383
+ }
1384
+ async function V(h = !1) {
1385
+ p.disableHover = h;
1386
+ }
1387
+ function B(h) {
1388
+ J(v, N(h));
1389
+ }
1390
+ function G() {
1391
+ return be(v);
1392
+ }
1393
+ function te() {
1394
+ ke(v.schemas, s.schemas) && v.script === s.script || (J(v.schemas, s.schemas), v.script = s.script, w(v.schemas[0]), b.push(v.schemas, "重置操作"), u("reset", v));
1395
+ }
1396
+ function ue() {
1397
+ u("save", be(v));
1398
+ }
1399
+ function de(h) {
1400
+ u("toggleDeviceMode", h);
1401
+ }
1402
+ function W() {
1403
+ console.log("%c [ ]-385", "font-size:13px; background:pink; color:#bf2c9f;", f), y.value.handleOpen();
1404
+ }
1405
+ return m(), a({
1406
+ revoke: b,
1407
+ setData: B,
1408
+ getData: G,
1409
+ reset: te,
1410
+ preview: W
1411
+ }), (h, H) => _(F).initialized.value ? (M(), L(De, {
1412
+ key: 1,
1413
+ onResolve: k
1414
+ }, {
1415
+ default: P(() => [
1416
+ z("div", Dt, [
1417
+ z("div", kt, [
1418
+ R(h.$slots, "header", {}, () => [
1419
+ f.hiddenHeader ? Ae("", !0) : (M(), L(_(o), {
1420
+ key: 0,
1421
+ onPreview: W,
1422
+ onSave: ue
1423
+ }, {
1424
+ header: P(() => [
1425
+ R(h.$slots, "header-prefix")
1426
+ ]),
1427
+ prefix: P(() => [
1428
+ R(h.$slots, "header-prefix")
1429
+ ]),
1430
+ title: P(() => [
1431
+ R(h.$slots, "header-title")
1432
+ ]),
1433
+ "right-prefix": P(() => [
1434
+ R(h.$slots, "header-right-prefix")
1435
+ ]),
1436
+ "right-action": P(() => [
1437
+ R(h.$slots, "header-right-action")
1438
+ ]),
1439
+ "right-suffix": P(() => [
1440
+ R(h.$slots, "header-right-suffix")
1441
+ ]),
1442
+ _: 3
1443
+ }))
1444
+ ])
1445
+ ]),
1446
+ z("div", {
1447
+ class: Te(["epic-split-view-container", { "hidden-header": h.hiddenHeader }])
1448
+ }, [
1449
+ T(_(t)),
1450
+ T(_(r)),
1451
+ T(_(l))
1452
+ ], 2),
1453
+ T(St, {
1454
+ ref_key: "previewRef",
1455
+ ref: y
1456
+ }, null, 512)
1457
+ ])
1458
+ ]),
1459
+ fallback: P(() => [
1460
+ z("div", It, [
1461
+ T(_(c))
1462
+ ])
1463
+ ]),
1464
+ _: 3
1465
+ })) : (M(), ve("div", At));
1466
+ }
1467
+ }), Et = {
1468
+ component: async () => await import("./index-DsZL9gYb.js"),
1469
+ defaultSchema: {
1470
+ label: "代码编辑器",
1471
+ type: "monacoEditor",
1472
+ field: "monacoEditor",
1473
+ icon: "epic-icon-write",
1474
+ input: !0
1475
+ },
1476
+ config: {
1477
+ attribute: [
1478
+ {
1479
+ label: "字段名",
1480
+ type: "input",
1481
+ field: "field"
1482
+ },
1483
+ {
1484
+ label: "标题",
1485
+ type: "input",
1486
+ field: "label"
1487
+ },
1488
+ {
1489
+ label: "默认值",
1490
+ type: "monacoEditor",
1491
+ field: "componentProps.defaultValue"
1492
+ }
1493
+ ]
1494
+ },
1495
+ bindModel: "model-value"
1496
+ }, xt = {
1497
+ component: async () => await import("./index-DiDIFoTk.js"),
1498
+ defaultSchema: {
1499
+ label: "页面",
1500
+ type: "page",
1501
+ componentProps: {},
1502
+ children: []
1503
+ },
1504
+ config: {
1505
+ attribute: [
1506
+ {
1507
+ label: "页面名称",
1508
+ type: "input",
1509
+ componentProps: {
1510
+ placeholder: "请输入"
1511
+ },
1512
+ field: "componentProps.name"
1513
+ }
1514
+ ]
1515
+ }
1516
+ };
1517
+ function Ct(e) {
1518
+ e.component("EInputSize", async () => await import("./index-C4sdhgF2.js")), e.component("EColEditor", async () => await import("./index-CwopQ1ii.js")), e.component("EActionEditor", async () => await import("./index-ji8WAXwM.js")), e.component("ERuleEditor", async () => await import("./index-UhAkLhp5.js")), e.component("EOptionsEditor", async () => await import("./index-CecS9Ywo.js")), e.component("ENode", async () => await import("./index-B14JQGo7.js")), e.component("EDataSource", async () => await import("./index-CCTMCqiz.js")), e.registerActivitybar({
1519
+ id: "component_view",
1520
+ title: "组件",
1521
+ icon: "icon--epic--extension-outline",
1522
+ component: async () => await import("./index-D2KcZm16.js")
1523
+ }), e.registerActivitybar({
1524
+ id: "sound_code_view",
1525
+ title: "源码",
1526
+ icon: "icon--epic--sdk-outline-rounded",
1527
+ component: async () => await import("./index-C23zgjw8.js")
1528
+ }), e.registerActivitybar({
1529
+ id: "outline_view",
1530
+ title: "大纲",
1531
+ icon: "icon--epic--account-tree-outline-rounded",
1532
+ component: async () => await import("./outline-yy4pIEi3.js")
1533
+ }), e.registerRightSidebar({
1534
+ id: "attribute_view",
1535
+ title: "属性",
1536
+ component: async () => await import("./attributeView-DaKcfxYS.js")
1537
+ }), e.registerRightSidebar({
1538
+ id: "style_view",
1539
+ title: "样式",
1540
+ component: async () => await import("./styleView-DIACFMk_.js")
1541
+ }), e.registerRightSidebar({
1542
+ id: "event_view",
1543
+ title: "事件",
1544
+ component: async () => await import("./eventView-BFaz-0Gd.js")
1545
+ }), [Et, xt].forEach((n) => {
1546
+ e.registerComponent(n);
1547
+ });
1548
+ }
1549
+ Ct(F);
1550
+ export {
1551
+ Je as A,
1552
+ oe as B,
1553
+ We as C,
1554
+ ne as D,
1555
+ Le as E,
1556
+ gt as F,
1557
+ mt as G,
1558
+ ht as H,
1559
+ yt as I,
1560
+ qe as _,
1561
+ Ht as a,
1562
+ pt as b,
1563
+ Nt as c,
1564
+ J as d,
1565
+ Jt as e,
1566
+ $t as f,
1567
+ Ot as g,
1568
+ Tt as h,
1569
+ Wt as i,
1570
+ Bt as j,
1571
+ le as k,
1572
+ Rt as l,
1573
+ N as m,
1574
+ Lt as n,
1575
+ ke as o,
1576
+ Vt as p,
1577
+ zt as q,
1578
+ Xe as r,
1579
+ Ft as s,
1580
+ Kt as t,
1581
+ ce as u,
1582
+ Ie as v,
1583
+ Ut as w,
1584
+ He as x,
1585
+ ze as y,
1586
+ Mt as z
1587
+ };