epic-designer-gold 1.0.8 → 1.0.10

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