epic-designer-gold 0.0.15 → 0.0.17

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 (34) hide show
  1. package/dist/{attributeView-BoLhVQzb.cjs → attributeView-BrU7NVHB.cjs} +1 -1
  2. package/dist/{attributeView-CsETdPfQ.js → attributeView-C2nl9iK-.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/{eventView-CeoqK6Se.cjs → eventView-D-tRUHfx.cjs} +1 -1
  6. package/dist/{eventView-y92-iX1R.js → eventView-pHQ5eBv7.js} +1 -1
  7. package/dist/{index-Dzatsws1.js → index-3ZgPYrE2.js} +1 -1
  8. package/dist/index-71KHFYJU.js +1594 -0
  9. package/dist/{index-DqoXRcy4.js → index-BfSXPeVc.js} +1 -1
  10. package/dist/{index-FRRNZqrr.cjs → index-BiivAgJZ.cjs} +1 -1
  11. package/dist/{index-BimQe5uF.js → index-BkjzhhSi.js} +1 -1
  12. package/dist/{index-BwZBxXdy.cjs → index-Blo7yEnf.cjs} +1 -1
  13. package/dist/{index-9NfXcZ4Y.cjs → index-C2CpiJ_f.cjs} +1 -1
  14. package/dist/{index-CgW7uOAC.js → index-CJGTWlxP.js} +1 -1
  15. package/dist/{index-BuNxO1Pv.cjs → index-CSoobSpH.cjs} +1 -1
  16. package/dist/{index-FW4I6HiK.cjs → index-D75wUoUt.cjs} +1 -1
  17. package/dist/index-DKdtKvGH.cjs +10 -0
  18. package/dist/{index-uPLxG_y4.cjs → index-DQcq_Ryv.cjs} +1 -1
  19. package/dist/{index-Uwfc3-yh.cjs → index-Dzbf-pz4.cjs} +1 -1
  20. package/dist/{index-DLeXF615.js → index-U9gSTNR0.js} +1 -1
  21. package/dist/{index-D4hsNiQf.js → index-WWXiJl3c.js} +1 -1
  22. package/dist/{index-PwPgOIVo.cjs → index-hqgOCVG7.cjs} +1 -1
  23. package/dist/{index-CM2yS7Lz.js → index-i0m3r1ds.js} +1 -1
  24. package/dist/{index-QVJsPbkw.js → index-if6rPeHv.js} +1 -1
  25. package/dist/index-me8_Rc_U.js +4 -0
  26. package/dist/{index-BUw5OdPn.cjs → index-vMiAEdD_.cjs} +1 -1
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/{styleView-BfH5Ujdi.cjs → styleView-BKTC8Zam.cjs} +1 -1
  30. package/dist/{styleView-kap7mePV.js → styleView-yb0Xq3SX.js} +1 -1
  31. package/package.json +1 -1
  32. package/dist/index-BXqSZLpt.js +0 -4
  33. package/dist/index-C3ug5HS-.cjs +0 -10
  34. package/dist/index-CzIPdR2H.js +0 -1550
@@ -0,0 +1,1594 @@
1
+ import { ref as k, reactive as X, defineComponent as j, openBlock as M, createBlock as L, unref as _, mergeProps as ve, withCtx as P, renderSlot as R, getCurrentInstance as ae, inject as H, watch as O, useAttrs as _e, provide as $, shallowRef as Pe, computed as U, watchEffect as ie, onUnmounted as Ae, resolveComponent as Oe, resolveDynamicComponent as Ve, createVNode as T, createCommentVNode as De, useSlots as Fe, createElementBlock as ye, Suspense as Ie, createElementVNode as z, Fragment as Me, renderList as Re, nextTick as te, effectScope as $e, isRef as Ne, getCurrentScope as Be, onScopeDispose as Ue, onMounted as we, normalizeClass as Te, toRaw as Se } from "vue";
2
+ import { p as F, a as ge, l as Y, E as pe } from "./axios-ITY6Uw7A.js";
3
+ function ce(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}_${ce(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((u) => {
59
+ n.includes(u) || (c[u] = t(r[u]));
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_" + ce()
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 u, w, f;
225
+ let o = n.type ?? "";
226
+ const t = n.options ?? {}, r = (s, b) => {
227
+ o === s && (o = b, 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: b } = t;
231
+ t.autoSize = { minRows: s, maxRows: b }, 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 = ce());
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, ((w = (u = n.rules) == null ? void 0 : u[0]) == null ? void 0 : w.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 Ee() {
270
+ const e = k({}), a = k({}), n = k(!1), o = k([]), t = X({});
271
+ function r(m) {
272
+ return e.value[m];
273
+ }
274
+ function l(m, g) {
275
+ e.value[m] = g;
276
+ }
277
+ function c(m) {
278
+ delete e.value[m];
279
+ }
280
+ function u(m, g = !1) {
281
+ const h = Object.entries(F.publicMethods).reduce(
282
+ (x, [V, B]) => (x[V] = B.handler, x),
283
+ {}
284
+ );
285
+ try {
286
+ new Function(`const epic = this;${m}`).bind({
287
+ ...h,
288
+ getComponent: r,
289
+ find: r,
290
+ defineExpose: w,
291
+ publicMethods: h,
292
+ pluginManager: F
293
+ })();
294
+ } catch (x) {
295
+ g && console.error("[epic:自定义函数]异常:", x);
296
+ }
297
+ }
298
+ function w(m) {
299
+ m != null && (a.value = m);
300
+ }
301
+ function f(m, ...g) {
302
+ if (!m || m.length === 0) {
303
+ console.warn("未提供任何动作");
304
+ return;
305
+ }
306
+ m.forEach((h) => {
307
+ const x = h.args ? JSON.parse(h.args) : g;
308
+ switch (h.type) {
309
+ case "public":
310
+ s(h, x);
311
+ break;
312
+ case "custom":
313
+ b(h, x);
314
+ break;
315
+ case "component":
316
+ d(h, x);
317
+ break;
318
+ default:
319
+ console.warn(`未知的动作类型: ${h.type}`);
320
+ break;
321
+ }
322
+ });
323
+ }
324
+ function s(m, g) {
325
+ var h;
326
+ try {
327
+ (h = F.publicMethods[m.methodName]) == null || h.handler(...g);
328
+ } catch (x) {
329
+ console.error(`[Epic:公共函数(${m.methodName})]执行异常:`, x);
330
+ }
331
+ }
332
+ function b(m, g) {
333
+ var h, x;
334
+ try {
335
+ (x = (h = a.value)[m.methodName]) == null || x.call(h, ...g);
336
+ } catch (V) {
337
+ console.error(`[Epic:自定义函数(${m.methodName})]执行异常:`, V);
338
+ }
339
+ }
340
+ function d(m, g) {
341
+ const h = m.componentId != null && r(m.componentId);
342
+ if (!h) {
343
+ console.warn(`[Epic:组件${m.componentId}]未找到`);
344
+ return;
345
+ }
346
+ try {
347
+ h[m.methodName](...g);
348
+ } catch (x) {
349
+ console.error(`[Epic:组件${m.componentId}函数(${m.methodName})]执行异常:`, x);
350
+ }
351
+ }
352
+ function p(m = !0) {
353
+ n.value = m;
354
+ }
355
+ function v(m) {
356
+ const g = oe(m, () => !0);
357
+ o.value = g.map((h) => h.id);
358
+ }
359
+ function S(m, g = "default") {
360
+ if (t[g]) {
361
+ const h = t[g];
362
+ J(m, h);
363
+ }
364
+ t[g] = m;
365
+ }
366
+ function A(m, g = "default") {
367
+ if (t[g]) {
368
+ J(t[g], m, !1);
369
+ return;
370
+ }
371
+ t[g] = m;
372
+ }
373
+ return {
374
+ componentInstances: e,
375
+ funcs: a,
376
+ isDesignMode: n,
377
+ defaultComponentIds: o,
378
+ forms: t,
379
+ addFormData: S,
380
+ setFormData: A,
381
+ getComponentInstance: r,
382
+ // 简化查询函数, 推荐使用
383
+ find: r,
384
+ addComponentInstance: l,
385
+ removeComponentInstance: c,
386
+ setMethods: u,
387
+ doActions: f,
388
+ setDesignMode: p,
389
+ setDefaultComponentIds: v
390
+ };
391
+ }
392
+ function He() {
393
+ const e = k([]), a = k([]), n = k(null);
394
+ let o = 0;
395
+ function t(u, w = "插入组件") {
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: w,
399
+ componentSchema: JSON.stringify(u)
400
+ }, e.value.length > 60 && e.value.unshift());
401
+ }
402
+ function r() {
403
+ if (e.value.length === 0)
404
+ return !1;
405
+ const u = e.value.pop();
406
+ return n.value != null && a.value.push(n.value), n.value = u, JSON.parse(u.componentSchema);
407
+ }
408
+ function l() {
409
+ if (a.value.length === 0)
410
+ return !1;
411
+ const u = a.value.pop();
412
+ return n.value != null && e.value.push(n.value), n.value = u, JSON.parse(u.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__ */ j({
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 = k(), l = () => {
436
+ t("updateFormItemRef", r.value);
437
+ };
438
+ return (c, u) => o.hasFormItem ? (M(), L(_(n), ve({
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__ */ j({
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 = k(null);
465
+ let r = H("formData", X({}));
466
+ const l = H("slots", {}), c = H("pageManager", {}), u = H("disabled", { value: !1 }), w = H("ruleFieldPrefix", null), f = H("resetFormData", !1);
467
+ let s = X(N(o.componentSchema));
468
+ p();
469
+ async function b(i) {
470
+ if (["cascader", "checkbox", "select", "radio"].includes(i.type) && i.componentProps.dynamicId && o.sourceDateUrl) {
471
+ const I = (await ge({
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 ge({
480
+ url: I.url,
481
+ method: I.method,
482
+ data: JSON.parse(I.body),
483
+ params: JSON.parse(I.params),
484
+ headers: JSON.parse(I.headers)
485
+ });
486
+ if (I && (I != null && I.dataPath)) {
487
+ const G = I.dataPath.split(".").reduce((Q, Ce) => Q[Ce], E.data);
488
+ i.componentProps.options = d(G).map((Q) => ({
489
+ label: Q[I.dataKey],
490
+ value: Q[I.dataValue]
491
+ }));
492
+ } else
493
+ i.componentProps.options = d(E.data).map((W) => ({
494
+ label: W[I.dataKey],
495
+ value: W[I.dataValue]
496
+ }));
497
+ return i;
498
+ }
499
+ return i;
500
+ }
501
+ function d(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)), p());
508
+ },
509
+ {
510
+ deep: !0
511
+ }
512
+ );
513
+ function p() {
514
+ c.isDesignMode.value && typeof s.field == "string" && (s.field += "-design-mode");
515
+ }
516
+ (o.resetFormData || f) && (r = {});
517
+ const v = a, S = k(), A = k(), m = (i) => {
518
+ A.value = i;
519
+ }, g = _e();
520
+ Object.keys(g).length && $("nodeAttrs", g);
521
+ const h = Pe(null), x = U(() => {
522
+ var i, C;
523
+ return (i = s.componentProps) != null && i.hidden ? !1 : typeof s.show == "boolean" ? s.show : ((C = s.show) == null ? void 0 : C.call(s, { values: r })) ?? !0;
524
+ }), V = U(() => {
525
+ var I;
526
+ const i = x.value && ((I = s.rules) == null ? void 0 : I.map((E) => ({
527
+ ...E,
528
+ validator: E.validator && c.funcs.value[E.validator]
529
+ // 自定义校验函数
530
+ })));
531
+ let C = s.field;
532
+ o.ruleField ? C = o.ruleField : w && s.field && (C = N(w), C.push(s.field));
533
+ const D = {
534
+ ...s,
535
+ rules: i,
536
+ rule: i,
537
+ field: C
538
+ };
539
+ return D.children && delete D.children, D;
540
+ }), B = U(() => {
541
+ var D, I;
542
+ const i = ((D = q.value) == null ? void 0 : D.bindModel) ?? "modelValue", C = {};
543
+ return s.on && Object.keys(s.on).forEach((E) => {
544
+ C[`on${Le(E)}`] = (...W) => c.doActions(s.on[E], ...W);
545
+ }), {
546
+ ...o,
547
+ ...s.componentProps,
548
+ disabled: (u == null ? void 0 : u.value) || ((I = s.componentProps) == null ? void 0 : I.disabled),
549
+ bindModel: i,
550
+ ...C
551
+ };
552
+ }), q = U(() => F.getComponentConfingByType(s.type) ?? null);
553
+ ie(() => {
554
+ t.value = o.modelValue ?? r[s.field ?? ""];
555
+ }), O(
556
+ () => t.value,
557
+ () => {
558
+ t.value !== (o.modelValue ?? r[s.field ?? ""]) && Z(t.value);
559
+ }
560
+ ), O(
561
+ () => S.value,
562
+ () => {
563
+ re();
564
+ },
565
+ { immediate: !0 }
566
+ );
567
+ function re() {
568
+ var C;
569
+ const i = S.value || n;
570
+ s.id && i && (s.input && (i.setValue = Z, i.getValue = () => r[s.field] || o.modelValue), i.setAttr = (D, I) => (s.componentProps || (s.componentProps = {}), s.componentProps[D] = I), i.getAttr = (D) => s.componentProps[D], c.addComponentInstance(s.id, i), (C = q.value) != null && C.defaultSchema.input && s.noFormItem !== !0 && A.value && c.addComponentInstance(s.id + "formItem", A.value));
571
+ }
572
+ function se() {
573
+ var i;
574
+ s.id && (c.removeComponentInstance(s.id), (i = q.value) != null && i.defaultSchema.input && s.noFormItem !== !0 && c.removeComponentInstance(s.id + "formItem"));
575
+ }
576
+ async function fe() {
577
+ var C, D, I;
578
+ if (s = await b(s), typeof ((C = s.componentProps) == null ? void 0 : C.defaultValue) < "u") {
579
+ const E = c.isDesignMode.value ? (D = s.componentProps) == null ? void 0 : D.defaultValue : r[s.field] ?? ((I = s.componentProps) == null ? void 0 : I.defaultValue);
580
+ Z(N(E));
581
+ }
582
+ if (s.type === "slot") {
583
+ const E = s.slotName;
584
+ if (!E) return;
585
+ h.value = j({
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
+ h.value = E.default ?? E;
603
+ } else
604
+ h.value = i;
605
+ }
606
+ function Z(i) {
607
+ v("update:modelValue", i), v("change", i), s.field && (r[s.field] = i);
608
+ }
609
+ function le(i) {
610
+ v("update:dynamicId", i);
611
+ }
612
+ let y = null;
613
+ return O(
614
+ () => s,
615
+ async (i) => {
616
+ const C = JSON.stringify({
617
+ ...i,
618
+ children: void 0,
619
+ componentProps: {
620
+ ...i.componentProps,
621
+ options: null
622
+ }
623
+ });
624
+ if (C === y)
625
+ return !1;
626
+ y = C, fe();
627
+ },
628
+ {
629
+ immediate: !0,
630
+ deep: !0
631
+ }
632
+ ), Ae(se), (i, C) => {
633
+ var I;
634
+ const D = Oe("ENode");
635
+ return h.value && x.value ? (M(), L(Ke, {
636
+ key: 0,
637
+ hasFormItem: _(s).noFormItem !== !0 && ((I = q.value) == null ? void 0 : I.defaultSchema.input),
638
+ formItemProps: V.value,
639
+ onUpdateFormItemRef: m
640
+ }, {
641
+ default: P(() => [
642
+ (M(), L(Ve(h.value), ve({
643
+ ref_key: "componentInstance",
644
+ ref: S,
645
+ onVnodeMounted: re,
646
+ model: _(r)
647
+ }, { ...B.value }, {
648
+ [B.value.bindModel]: t.value,
649
+ ["onUpdate:" + B.value.bindModel]: C[0] || (C[0] = (E) => t.value = E),
650
+ [`onUpdate:${B.value.bindModel}` || ""]: Z,
651
+ "onUpdate:dynamicId": le
652
+ }), {
653
+ node: P((E) => [
654
+ T(D, ve(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"])) : De("", !0);
666
+ };
667
+ }
668
+ });
669
+ function Ze() {
670
+ const e = k(!1), a = Ee(), n = k({});
671
+ function o() {
672
+ return new Promise((d) => {
673
+ if (e.value)
674
+ d();
675
+ else {
676
+ const p = O(e, () => {
677
+ p(), d();
678
+ });
679
+ }
680
+ });
681
+ }
682
+ async function t(d = "default") {
683
+ var v;
684
+ await o();
685
+ const p = (v = n.value) == null ? void 0 : v[d];
686
+ if (!p) throw new Error(`表单 [name=${d}] 不存在`);
687
+ return p;
688
+ }
689
+ async function r(d, p) {
690
+ const v = await t(d);
691
+ return N(await p(v));
692
+ }
693
+ async function l(d = "default") {
694
+ return await r(d, (p) => p.getData());
695
+ }
696
+ function c(d, p = "default") {
697
+ var S;
698
+ a.setFormData(d, p);
699
+ const v = (S = n.value) == null ? void 0 : S[p];
700
+ v == null || v.clearValidate();
701
+ }
702
+ async function u(d = "default") {
703
+ return await r(d, async (p) => (await p.validate(), await p.getData()));
704
+ }
705
+ async function w(d) {
706
+ await o();
707
+ const p = {};
708
+ for (const v in n.value) {
709
+ const S = n.value[v];
710
+ S && (p[v] = N(await d(S)));
711
+ }
712
+ return p;
713
+ }
714
+ async function f() {
715
+ return await w((d) => d.getData());
716
+ }
717
+ function s(d) {
718
+ for (const p in d)
719
+ c(d[p], p);
720
+ }
721
+ async function b() {
722
+ return await w(async (d) => (await d.validate(), await d.getData()));
723
+ }
724
+ return {
725
+ ready: e,
726
+ pageManager: a,
727
+ forms: n,
728
+ getData: l,
729
+ setData: c,
730
+ validate: u,
731
+ getForms: f,
732
+ setForms: s,
733
+ validateAll: b,
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__ */ j({
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 = Y(() => import("./index-DgcFxYFp.js")), t = n, { ready: r, pageManager: l, forms: c, getData: u, setData: w, validate: f, getForms: s, setForms: b, validateAll: d, getFormInstance: p } = Ze(), v = e, S = X({
751
+ schemas: []
752
+ });
753
+ O(
754
+ () => v.pageSchema,
755
+ (h) => {
756
+ J(S, h);
757
+ },
758
+ {
759
+ immediate: !0,
760
+ deep: !0
761
+ }
762
+ ), O(
763
+ () => v.formData,
764
+ (h) => {
765
+ h && w(h);
766
+ },
767
+ {
768
+ immediate: !0,
769
+ deep: !0
770
+ }
771
+ ), O(
772
+ () => S.script,
773
+ (h) => {
774
+ h && l.setMethods(h, !0);
775
+ },
776
+ {
777
+ immediate: !0
778
+ }
779
+ ), $("slots", Fe()), $("pageManager", l), $("forms", c), $("pageSchema", S), $(
780
+ "disabled",
781
+ U(() => v.disabled)
782
+ );
783
+ const A = ae(), m = A == null ? void 0 : A.proxy;
784
+ function g() {
785
+ te(() => {
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: u,
793
+ setData: w,
794
+ validate: f,
795
+ getForms: s,
796
+ setForms: b,
797
+ validateAll: d,
798
+ getFormInstance: p
799
+ }), (h, x) => _(F).initialized.value ? (M(), L(Ie, {
800
+ key: 1,
801
+ onResolve: g
802
+ }, {
803
+ default: P(() => [
804
+ z("div", Qe, [
805
+ (M(!0), ye(Me, null, Re(S.schemas, (V, B) => (M(), L(_(qe), {
806
+ key: B,
807
+ sourceDateUrl: v.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(), ye("div", Ge));
819
+ }
820
+ });
821
+ function be(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))), be(t), n);
830
+ }
831
+ function ee(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() ? we(e, n) : a ? e() : te(e);
843
+ }
844
+ function lt(e = !1, a = {}) {
845
+ const {
846
+ truthyValue: n = !0,
847
+ falsyValue: o = !1
848
+ } = a, t = Ne(e), r = k(e);
849
+ function l(c) {
850
+ if (arguments.length)
851
+ return r.value = c, r.value;
852
+ {
853
+ const u = ee(n);
854
+ return r.value = r.value === u ? ee(o) : u, r.value;
855
+ }
856
+ }
857
+ return t ? l : [r, l];
858
+ }
859
+ function Ut(e, a, n) {
860
+ const o = O(e, (...t) => (te(() => o()), a(...t)), n);
861
+ return o;
862
+ }
863
+ const ue = et ? window : void 0;
864
+ function K(e) {
865
+ var a;
866
+ const n = ee(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 = ue) : [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, b, d) => (f.addEventListener(s, b, d), () => f.removeEventListener(s, b, d)), u = O(
877
+ () => [K(a), ee(t)],
878
+ ([f, s]) => {
879
+ if (l(), !f)
880
+ return;
881
+ const b = ot(s) ? { ...s } : s;
882
+ r.push(
883
+ ...n.flatMap((d) => o.map((p) => c(f, d, p, b)))
884
+ );
885
+ },
886
+ { immediate: !0, flush: "post" }
887
+ ), w = () => {
888
+ u(), l();
889
+ };
890
+ return be(w), w;
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 xe(...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 = ue,
900
+ eventName: r = "keydown",
901
+ passive: l = !1,
902
+ dedupe: c = !1
903
+ } = o, u = ct(a);
904
+ return it(t, r, (f) => {
905
+ f.repeat && ee(c) || u(f) && n(f);
906
+ }, l);
907
+ }
908
+ function me(e, a, n = {}) {
909
+ return xe(e, a, { ...n, eventName: "keydown" });
910
+ }
911
+ function he(e, a, n = {}) {
912
+ return xe(e, a, { ...n, eventName: "keyup" });
913
+ }
914
+ function ut() {
915
+ const e = k(!1), a = ae();
916
+ return a && we(() => {
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 = ue, ...t } = n;
929
+ let r;
930
+ const l = dt(() => o && "ResizeObserver" in o), c = () => {
931
+ r && (r.disconnect(), r = void 0);
932
+ }, u = U(() => {
933
+ const s = ee(e);
934
+ return Array.isArray(s) ? s.map((b) => K(b)) : [K(s)];
935
+ }), w = O(
936
+ u,
937
+ (s) => {
938
+ if (c(), l.value && o) {
939
+ r = new ResizeObserver(a);
940
+ for (const b of s)
941
+ b && r.observe(b, t);
942
+ }
943
+ },
944
+ { immediate: !0, flush: "post" }
945
+ ), f = () => {
946
+ c(), w();
947
+ };
948
+ return be(f), {
949
+ isSupported: l,
950
+ stop: f
951
+ };
952
+ }
953
+ function Tt(e, a = { width: 0, height: 0 }, n = {}) {
954
+ const { window: o = ue, box: t = "content-box" } = n, r = U(() => {
955
+ var s, b;
956
+ return (b = (s = K(e)) == null ? void 0 : s.namespaceURI) == null ? void 0 : b.includes("svg");
957
+ }), l = k(a.width), c = k(a.height), { stop: u } = pt(
958
+ e,
959
+ ([s]) => {
960
+ const b = t === "border-box" ? s.borderBoxSize : t === "content-box" ? s.contentBoxSize : s.devicePixelContentBoxSize;
961
+ if (o && r.value) {
962
+ const d = K(e);
963
+ if (d) {
964
+ const p = d.getBoundingClientRect();
965
+ l.value = p.width, c.value = p.height;
966
+ }
967
+ } else if (b) {
968
+ const d = Array.isArray(b) ? b : [b];
969
+ l.value = d.reduce((p, { inlineSize: v }) => p + v, 0), c.value = d.reduce((p, { blockSize: v }) => p + v, 0);
970
+ } else
971
+ l.value = s.contentRect.width, c.value = s.contentRect.height;
972
+ },
973
+ n
974
+ );
975
+ st(() => {
976
+ const s = K(e);
977
+ s && (l.value = "offsetWidth" in s ? s.offsetWidth : a.width, c.value = "offsetHeight" in s ? s.offsetHeight : a.height);
978
+ });
979
+ const w = O(
980
+ () => K(e),
981
+ (s) => {
982
+ l.value = s ? a.width : 0, c.value = s ? a.height : 0;
983
+ }
984
+ );
985
+ function f() {
986
+ u(), w();
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: u = !1,
999
+ eventName: w,
1000
+ deep: f = !1,
1001
+ defaultValue: s,
1002
+ shouldEmit: b
1003
+ } = o, d = ae(), p = n || (d == null ? void 0 : d.emit) || ((t = d == null ? void 0 : d.$emit) == null ? void 0 : t.bind(d)) || ((l = (r = d == null ? void 0 : d.proxy) == null ? void 0 : r.$emit) == null ? void 0 : l.bind(d == null ? void 0 : d.proxy));
1004
+ let v = w;
1005
+ a || (a = "modelValue"), v = v || `update:${a.toString()}`;
1006
+ const S = (g) => c ? typeof c == "function" ? c(g) : ft(g) : g, A = () => tt(e[a]) ? S(e[a]) : s, m = (g) => {
1007
+ b ? b(g) && p(v, g) : p(v, g);
1008
+ };
1009
+ if (u) {
1010
+ const g = A(), h = k(g);
1011
+ let x = !1;
1012
+ return O(
1013
+ () => e[a],
1014
+ (V) => {
1015
+ x || (x = !0, h.value = S(V), te(() => x = !1));
1016
+ }
1017
+ ), O(
1018
+ h,
1019
+ (V) => {
1020
+ !x && (V !== e[a] || f) && m(V);
1021
+ },
1022
+ { deep: f }
1023
+ ), h;
1024
+ } else
1025
+ return U({
1026
+ get() {
1027
+ return A();
1028
+ },
1029
+ set(g) {
1030
+ m(g);
1031
+ }
1032
+ });
1033
+ }
1034
+ function zt() {
1035
+ const { isDark: e } = de(), a = lt(e);
1036
+ return {
1037
+ isDark: e,
1038
+ toggleDark: a
1039
+ };
1040
+ }
1041
+ function mt() {
1042
+ const e = k(!1);
1043
+ return we(() => {
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
+ }), Ae(() => {
1070
+ n.disconnect();
1071
+ });
1072
+ }
1073
+ function yt() {
1074
+ const e = k(1), a = k(!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 de = je(yt);
1085
+ function gt() {
1086
+ const e = k(!1), a = k(!1), n = k(!1);
1087
+ return me(" ", () => {
1088
+ e.value = !0;
1089
+ }), he(" ", () => {
1090
+ e.value = !1;
1091
+ }), me("Shift", (o) => {
1092
+ o.preventDefault(), a.value = !0;
1093
+ }), he("Shift", () => {
1094
+ a.value = !1;
1095
+ }), me("Control", (o) => {
1096
+ o.preventDefault(), n.value = !0;
1097
+ }), he("Control", () => {
1098
+ n.value = !1;
1099
+ }), { pressSpace: e, pressShift: a, pressCtrl: n };
1100
+ }
1101
+ function Jt(e) {
1102
+ const { pressSpace: a } = de(), n = new Image(1, 1);
1103
+ n.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";
1104
+ let o = 0, t = 0;
1105
+ function r(u) {
1106
+ var w;
1107
+ a.value && (o = u.x, t = u.y, (w = u.dataTransfer) == null || w.setDragImage(document.createElement("div"), 0, 0));
1108
+ }
1109
+ function l(u) {
1110
+ if (u.preventDefault(), !u.x || !u.y || !a.value)
1111
+ return;
1112
+ const w = u.x - o, f = u.y - t;
1113
+ o = u.x, t = u.y, e.value && (e.value.scrollTop -= f, e.value.scrollLeft -= w);
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 } = de();
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__ */ j({
1150
+ __name: "index",
1151
+ setup(e, { expose: a }) {
1152
+ const n = F.getComponent("monacoEditor"), o = F.getComponent("modal"), t = k(null), r = k(!1), l = k(!1), c = k({}), u = H("pageSchema"), w = k(null), f = k("");
1153
+ function s() {
1154
+ l.value = !1;
1155
+ }
1156
+ function b() {
1157
+ r.value = !1;
1158
+ }
1159
+ function d() {
1160
+ r.value = !0, f.value = ce();
1161
+ }
1162
+ async function p() {
1163
+ try {
1164
+ let v = await w.value.validateAll();
1165
+ if (!Object.keys(v).length) {
1166
+ alert("请添加表单组件后再尝试!");
1167
+ return;
1168
+ }
1169
+ Object.keys(v).length === 1 && (v = v.default), c.value = JSON.stringify(v, null, 2), te(() => {
1170
+ var S;
1171
+ (S = t.value) == null || S.setValue(c.value);
1172
+ }), l.value = !0;
1173
+ } catch (v) {
1174
+ console.error(v);
1175
+ }
1176
+ }
1177
+ return a({
1178
+ handleOpen: d
1179
+ }), (v, S) => (M(), L(_(o), {
1180
+ modelValue: r.value,
1181
+ "onUpdate:modelValue": S[1] || (S[1] = (A) => r.value = A),
1182
+ title: "预览",
1183
+ class: "w-900px",
1184
+ width: "900px",
1185
+ onClose: b,
1186
+ onOk: p,
1187
+ okText: "表单数据"
1188
+ }, {
1189
+ default: P(() => [
1190
+ z("div", wt, [
1191
+ (M(), L(_(Xe), {
1192
+ key: f.value,
1193
+ ref_key: "kb",
1194
+ ref: w,
1195
+ "page-schema": _(u)
1196
+ }, null, 8, ["page-schema"])),
1197
+ T(_(o), {
1198
+ modelValue: l.value,
1199
+ "onUpdate:modelValue": S[0] || (S[0] = (A) => l.value = A),
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" }, It = { class: "epic-header-container" }, kt = { class: "epic-loading-box" }, Kt = /* @__PURE__ */ j({
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 = Y(() => import("./index-C-XUgjda.js")), t = Y(() => import("./index-ASoFJnMl.js")), r = Y(() => import("./index-U9gSTNR0.js")), l = Y(() => import("./index-ooVzYa5L.js")), c = Y(() => import("./index-DgcFxYFp.js")), u = Ee(), w = 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
+ ie(async () => {
1299
+ if (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 b(s.schemas), console.log(
1304
+ "%c [ innerDefaultSchema.schemas ]-155",
1305
+ "font-size:13px; background:pink; color:#bf2c9f;",
1306
+ s.schemas
1307
+ ));
1308
+ });
1309
+ async function b(y) {
1310
+ return await Promise.all(
1311
+ y.map(async (i) => {
1312
+ if (i && i.children && i.children.length && b(i.children), ["cascader", "checkbox", "select", "radio"].includes(i.type) && i.componentProps.dynamicId && f.updateSourceId === i.componentProps.dynamicId) {
1313
+ const D = f.source.find((E) => E.id === f.updateSourceId);
1314
+ let I = await ge({
1315
+ url: D.url,
1316
+ method: D.method,
1317
+ data: JSON.parse(D.body),
1318
+ params: JSON.parse(D.params),
1319
+ headers: JSON.parse(D.headers)
1320
+ });
1321
+ if (D && (D != null && D.dataPath)) {
1322
+ const W = D.dataPath.split(".").reduce((G, Q) => G[Q], I.data);
1323
+ i.componentProps.options = d(W).map((G) => ({
1324
+ label: G[D.dataKey],
1325
+ value: G[D.dataValue]
1326
+ }));
1327
+ } else
1328
+ i.componentProps.options = d(I.data).map((E) => ({
1329
+ label: E[D.dataKey],
1330
+ value: E[D.dataValue]
1331
+ }));
1332
+ }
1333
+ return i;
1334
+ })
1335
+ );
1336
+ }
1337
+ function d(y) {
1338
+ return y && Object.prototype.toString.call(y) === "[object Array]" ? y : [];
1339
+ }
1340
+ u.setDesignMode(), u.setDefaultComponentIds(s.schemas);
1341
+ const p = n, v = k(null), S = X({
1342
+ checkedNode: null,
1343
+ hoverNode: null,
1344
+ disableHover: !1,
1345
+ matched: []
1346
+ }), A = X({
1347
+ schemas: [],
1348
+ script: s.script
1349
+ }), { disabledZoom: m } = de();
1350
+ ie(() => {
1351
+ m.value = f.disabledZoom;
1352
+ }), ie(() => {
1353
+ const y = A.script;
1354
+ y && y !== "" && u.setMethods(y);
1355
+ }), $("pageSchema", A), $("revoke", w), $("pageManager", u), $(
1356
+ "designerProps",
1357
+ U(() => f)
1358
+ ), $("designer", {
1359
+ setCheckedNode: h,
1360
+ setHoverNode: x,
1361
+ setDisableHover: B,
1362
+ handleToggleDeviceMode: Z,
1363
+ reset: se,
1364
+ state: S
1365
+ }), pe.on("saveSourceData", (y) => {
1366
+ p("saveSourceData", y);
1367
+ }), pe.on("deleteSourceData", (y) => {
1368
+ p("deleteSourceData", y);
1369
+ }), pe.on("updateSourceData", (y) => {
1370
+ p("updateSourceData", y);
1371
+ });
1372
+ function g() {
1373
+ A.schemas = N(s.schemas), h(A.schemas[0]), w.push(A.schemas, "初始化撤销功能");
1374
+ }
1375
+ async function h(y = A.schemas[0]) {
1376
+ S.checkedNode = y, S.matched = ze(A.schemas, y.id);
1377
+ }
1378
+ async function x(y = null) {
1379
+ var i;
1380
+ if (!y || S.disableHover)
1381
+ return S.hoverNode = null, !1;
1382
+ if ((y == null ? void 0 : y.id) === ((i = S.hoverNode) == null ? void 0 : i.id))
1383
+ return !1;
1384
+ S.hoverNode = y;
1385
+ }
1386
+ function V() {
1387
+ te(() => {
1388
+ p("ready", { pageManager: u });
1389
+ });
1390
+ }
1391
+ async function B(y = !1) {
1392
+ S.disableHover = y;
1393
+ }
1394
+ function q(y) {
1395
+ J(A, N(y));
1396
+ }
1397
+ function re() {
1398
+ return Se(A);
1399
+ }
1400
+ function se() {
1401
+ ke(A.schemas, s.schemas) && A.script === s.script || (J(A.schemas, s.schemas), A.script = s.script, h(A.schemas[0]), w.push(A.schemas, "重置操作"), p("reset", A));
1402
+ }
1403
+ function fe() {
1404
+ p("save", Se(A));
1405
+ }
1406
+ function Z(y) {
1407
+ p("toggleDeviceMode", y);
1408
+ }
1409
+ function le() {
1410
+ console.log("%c [ ]-385", "font-size:13px; background:pink; color:#bf2c9f;", f), v.value.handleOpen();
1411
+ }
1412
+ return g(), a({
1413
+ revoke: w,
1414
+ setData: q,
1415
+ getData: re,
1416
+ reset: se,
1417
+ preview: le
1418
+ }), (y, i) => _(F).initialized.value ? (M(), L(Ie, {
1419
+ key: 1,
1420
+ onResolve: V
1421
+ }, {
1422
+ default: P(() => [
1423
+ z("div", Dt, [
1424
+ z("div", It, [
1425
+ R(y.$slots, "header", {}, () => [
1426
+ f.hiddenHeader ? De("", !0) : (M(), L(_(o), {
1427
+ key: 0,
1428
+ onPreview: le,
1429
+ onSave: fe
1430
+ }, {
1431
+ header: P(() => [
1432
+ R(y.$slots, "header-prefix")
1433
+ ]),
1434
+ prefix: P(() => [
1435
+ R(y.$slots, "header-prefix")
1436
+ ]),
1437
+ title: P(() => [
1438
+ R(y.$slots, "header-title")
1439
+ ]),
1440
+ "right-prefix": P(() => [
1441
+ R(y.$slots, "header-right-prefix")
1442
+ ]),
1443
+ "right-action": P(() => [
1444
+ R(y.$slots, "header-right-action")
1445
+ ]),
1446
+ "right-suffix": P(() => [
1447
+ R(y.$slots, "header-right-suffix")
1448
+ ]),
1449
+ _: 3
1450
+ }))
1451
+ ])
1452
+ ]),
1453
+ z("div", {
1454
+ class: Te(["epic-split-view-container", { "hidden-header": y.hiddenHeader }])
1455
+ }, [
1456
+ T(_(t)),
1457
+ T(_(r)),
1458
+ T(_(l))
1459
+ ], 2),
1460
+ T(St, {
1461
+ ref_key: "previewRef",
1462
+ ref: v
1463
+ }, null, 512)
1464
+ ])
1465
+ ]),
1466
+ fallback: P(() => [
1467
+ z("div", kt, [
1468
+ T(_(c))
1469
+ ])
1470
+ ]),
1471
+ _: 3
1472
+ })) : (M(), ye("div", At));
1473
+ }
1474
+ }), Et = {
1475
+ component: async () => await import("./index-if6rPeHv.js"),
1476
+ defaultSchema: {
1477
+ label: "代码编辑器",
1478
+ type: "monacoEditor",
1479
+ field: "monacoEditor",
1480
+ icon: "epic-icon-write",
1481
+ input: !0
1482
+ },
1483
+ config: {
1484
+ attribute: [
1485
+ {
1486
+ label: "字段名",
1487
+ type: "input",
1488
+ field: "field"
1489
+ },
1490
+ {
1491
+ label: "标题",
1492
+ type: "input",
1493
+ field: "label"
1494
+ },
1495
+ {
1496
+ label: "默认值",
1497
+ type: "monacoEditor",
1498
+ field: "componentProps.defaultValue"
1499
+ }
1500
+ ]
1501
+ },
1502
+ bindModel: "model-value"
1503
+ }, xt = {
1504
+ component: async () => await import("./index-DiDIFoTk.js"),
1505
+ defaultSchema: {
1506
+ label: "页面",
1507
+ type: "page",
1508
+ componentProps: {},
1509
+ children: []
1510
+ },
1511
+ config: {
1512
+ attribute: [
1513
+ {
1514
+ label: "页面名称",
1515
+ type: "input",
1516
+ componentProps: {
1517
+ placeholder: "请输入"
1518
+ },
1519
+ field: "componentProps.name"
1520
+ }
1521
+ ]
1522
+ }
1523
+ };
1524
+ function Ct(e) {
1525
+ e.component("EInputSize", async () => await import("./index-C4sdhgF2.js")), e.component("EColEditor", async () => await import("./index-BfSXPeVc.js")), e.component("EActionEditor", async () => await import("./index-WWXiJl3c.js")), e.component("ERuleEditor", async () => await import("./index-CJGTWlxP.js")), e.component("EOptionsEditor", async () => await import("./index-i0m3r1ds.js")), e.component("ENode", async () => await import("./index-me8_Rc_U.js")), e.component("EDataSource", async () => await import("./index-CCTMCqiz.js")), e.registerActivitybar({
1526
+ id: "component_view",
1527
+ title: "组件",
1528
+ icon: "icon--epic--extension-outline",
1529
+ component: async () => await import("./index-BkjzhhSi.js")
1530
+ }), e.registerActivitybar({
1531
+ id: "sound_code_view",
1532
+ title: "源码",
1533
+ icon: "icon--epic--sdk-outline-rounded",
1534
+ component: async () => await import("./index-3ZgPYrE2.js")
1535
+ }), e.registerActivitybar({
1536
+ id: "outline_view",
1537
+ title: "大纲",
1538
+ icon: "icon--epic--account-tree-outline-rounded",
1539
+ component: async () => await import("./outline-yy4pIEi3.js")
1540
+ }), e.registerRightSidebar({
1541
+ id: "attribute_view",
1542
+ title: "属性",
1543
+ component: async () => await import("./attributeView-C2nl9iK-.js")
1544
+ }), e.registerRightSidebar({
1545
+ id: "style_view",
1546
+ title: "样式",
1547
+ component: async () => await import("./styleView-yb0Xq3SX.js")
1548
+ }), e.registerRightSidebar({
1549
+ id: "event_view",
1550
+ title: "事件",
1551
+ component: async () => await import("./eventView-pHQ5eBv7.js")
1552
+ }), [Et, xt].forEach((n) => {
1553
+ e.registerComponent(n);
1554
+ });
1555
+ }
1556
+ Ct(F);
1557
+ export {
1558
+ Je as A,
1559
+ oe as B,
1560
+ We as C,
1561
+ ne as D,
1562
+ Le as E,
1563
+ gt as F,
1564
+ mt as G,
1565
+ ht as H,
1566
+ yt as I,
1567
+ qe as _,
1568
+ Ht as a,
1569
+ pt as b,
1570
+ Nt as c,
1571
+ J as d,
1572
+ Jt as e,
1573
+ $t as f,
1574
+ Ot as g,
1575
+ Tt as h,
1576
+ Wt as i,
1577
+ Bt as j,
1578
+ ce as k,
1579
+ Rt as l,
1580
+ N as m,
1581
+ Lt as n,
1582
+ ke as o,
1583
+ Vt as p,
1584
+ zt as q,
1585
+ Xe as r,
1586
+ Ft as s,
1587
+ Kt as t,
1588
+ de as u,
1589
+ Ee as v,
1590
+ Ut as w,
1591
+ He as x,
1592
+ ze as y,
1593
+ Mt as z
1594
+ };