epic-designer-gold 0.0.34 → 0.0.36

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