epic-designer-gold 0.0.46 → 0.0.48

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