epic-designer-gold 0.0.46 → 0.0.48

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