epic-designer-gold 1.0.7 → 1.0.8

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