epic-designer-gold 1.0.8 → 1.0.9

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