epic-designer-gold 0.0.35 → 0.0.37

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