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