epic-designer-gold 0.0.13 → 0.0.14

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