epic-designer-gold 0.0.22 → 0.0.23

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 (43) hide show
  1. package/dist/{attributeView-B8JS7SiW.cjs → attributeView-8NOrqlS1.cjs} +1 -1
  2. package/dist/{attributeView-oIH3-2FN.js → attributeView-BHuhrlM5.js} +8 -8
  3. package/dist/{index-nhr7ps1e.js → index-8kRf0Tni.js} +1 -1
  4. package/dist/index-9bx0Eg0-.cjs +1 -0
  5. package/dist/index-BHkCN6Gc.cjs +1 -0
  6. package/dist/{index-CrGWYheb.js → index-BcAPkz_3.js} +1 -1
  7. package/dist/{index-DskzasEn.js → index-BcRau_iO.js} +74 -74
  8. package/dist/{index-rby8nugJ.cjs → index-BfV0-xlv.cjs} +1 -1
  9. package/dist/index-BfWxzrQ0.js +675 -0
  10. package/dist/{index-DitKpeDV.cjs → index-BqP4q7kG.cjs} +1 -1
  11. package/dist/{index-BUkdmwKe.cjs → index-CI-wApqh.cjs} +2 -2
  12. package/dist/{index-C5yhSYKA.js → index-CNRYixnW.js} +198 -212
  13. package/dist/{index-CwXlSYIH.cjs → index-CtqoFTv7.cjs} +1 -1
  14. package/dist/{index-Bts_xVeS.cjs → index-DAQnePGW.cjs} +1 -1
  15. package/dist/{index-DiMAGPRY.js → index-DLXCQOpE.js} +1 -1
  16. package/dist/index-DMO6svHk.js +4 -0
  17. package/dist/{index-Bwmb5sha.cjs → index-DPQrSg6e.cjs} +1 -1
  18. package/dist/index-DzGESDFj.cjs +1 -0
  19. package/dist/{index-C5XNe5wE.js → index-R1sGzPDh.js} +1 -1
  20. package/dist/index-zFyk0fsI.js +665 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/style.css +1 -1
  24. package/dist/{styleView-BDUqyY8T.cjs → styleView-DevMh4gy.cjs} +1 -1
  25. package/dist/{styleView-CtfATcTc.js → styleView-Dq9MseMf.js} +1 -1
  26. package/package.json +1 -1
  27. package/dist/core/components/designer/src/modules/attributeView/eventView.vue.d.ts +0 -2
  28. package/dist/core/components/designer/src/modules/outline/outline.vue.d.ts +0 -2
  29. package/dist/core/components/designer/src/modules/sourceCode/index.vue.d.ts +0 -2
  30. package/dist/eventView-BL4A2PVd.cjs +0 -1
  31. package/dist/eventView-Ed_9JLnx.js +0 -64
  32. package/dist/index-05ByfwQb.js +0 -432
  33. package/dist/index-Bt6BXCcr.cjs +0 -1
  34. package/dist/index-CjrdkSiN.js +0 -682
  35. package/dist/index-CqdmlJ1d.cjs +0 -1
  36. package/dist/index-DWW8LGvj.js +0 -41
  37. package/dist/index-DZIjd60A.js +0 -4
  38. package/dist/index-D_CH15dJ.cjs +0 -1
  39. package/dist/index-GJSr_nl7.cjs +0 -1
  40. package/dist/outline-CJSEUbgc.cjs +0 -1
  41. package/dist/outline-yy4pIEi3.js +0 -54
  42. package/dist/tree.vue_vue_type_script_setup_true_lang-RWTXU6lO.cjs +0 -1
  43. package/dist/tree.vue_vue_type_script_setup_true_lang-uR4G8wa_.js +0 -242
@@ -0,0 +1,675 @@
1
+ import { defineComponent as X, inject as L, ref as C, computed as U, watch as G, openBlock as M, createElementBlock as W, Fragment as q, withDirectives as ue, createElementVNode as w, normalizeClass as ee, toDisplayString as be, unref as f, createVNode as z, createCommentVNode as le, vShow as de, createBlock as te, mergeProps as Se, withCtx as oe, useAttrs as we, provide as Ce, onUnmounted as ke, resolveComponent as Ne, createSlots as $e, renderList as ve, shallowRef as Re, watchEffect as Te, nextTick as pe, normalizeStyle as se, renderSlot as Be, onMounted as Oe } from "vue";
2
+ import { p as J } from "./axios-ITY6Uw7A.js";
3
+ import { u as fe, a as Me, f as me, g as Le, b as ae, _ as De, d as ce, c as He, e as Ve, h as We, i as ze, w as Ae, j as Ee } from "./index-CNRYixnW.js";
4
+ import { _ as ie } from "./icon.vue_vue_type_script_setup_true_lang-D3QdcReY.js";
5
+ import { d as Ie } from "./vuedraggable.umd-D2S7Eo7p.js";
6
+ const Pe = { class: "epic-widget-action-item whitespace-nowrap" }, je = {
7
+ key: 0,
8
+ class: "flex items-center"
9
+ }, Fe = /* @__PURE__ */ X({
10
+ __name: "previewWidgets",
11
+ setup(Z, { expose: D }) {
12
+ const u = L("pageManager", {}), _ = L("pageSchema"), a = L("designer"), m = L("designerProps"), r = L("revoke"), d = C(null), N = C(null), g = C(null), H = C(!1), n = C(!1), s = C(!0), i = C("top"), { canvasScale: l, disabledZoom: b } = fe();
13
+ let t = null;
14
+ const I = U(() => {
15
+ const e = a.state.checkedNode;
16
+ return !(!(e != null && e.id) || m.value.lockDefaultSchemaEdit && u.defaultComponentIds.value.includes(e == null ? void 0 : e.id));
17
+ }), V = U(() => {
18
+ var k, $, T, v, A, F;
19
+ const e = u.componentInstances.value, c = (k = a.state.checkedNode) == null ? void 0 : k.id;
20
+ if ((T = ($ = a.state.checkedNode) == null ? void 0 : $.componentProps) != null && T.hidden)
21
+ return null;
22
+ const y = J.getComponentConfingByType((v = a.state.checkedNode) == null ? void 0 : v.type) ?? null;
23
+ if (!c || !(e != null && e[c]))
24
+ return null;
25
+ if (y != null && y.defaultSchema.input && ((A = a.state.checkedNode) == null ? void 0 : A.noFormItem) !== !0)
26
+ return (F = e[c + "formItem"]) == null ? void 0 : F.$el;
27
+ const o = e[c];
28
+ return !(o != null && o.$el) || (o == null ? void 0 : o.$el.nodeName) === "#text" || !(o != null && o.$el.getBoundingClientRect) ? null : o == null ? void 0 : o.$el;
29
+ }), R = U(() => {
30
+ var k, $, T, v;
31
+ const e = u.componentInstances.value, c = (k = a.state.hoverNode) == null ? void 0 : k.id, y = J.getComponentConfingByType(($ = a.state.hoverNode) == null ? void 0 : $.type) ?? null;
32
+ if (!c || !(e != null && e[c]))
33
+ return null;
34
+ if (y != null && y.defaultSchema.input && ((T = a.state.hoverNode) == null ? void 0 : T.noFormItem) !== !0)
35
+ return (v = e[c + "formItem"]) == null ? void 0 : v.$el;
36
+ const o = e[c];
37
+ return (o == null ? void 0 : o.$el.nodeName) === "#text" ? null : o == null ? void 0 : o.$el;
38
+ }), { mutationObserver: p, observerConfig: x } = he(E), { startTimedQuery: h, stopTimedQuery: P } = Me(E);
39
+ G(() => V.value, (e) => {
40
+ if (e) {
41
+ H.value = !0, p.observe(e, x);
42
+ const c = e.parentNode;
43
+ c && (c.ondragstart = () => {
44
+ s.value = !1, h();
45
+ }, c.ondragend = () => {
46
+ s.value = !0, P();
47
+ }), E();
48
+ } else
49
+ H.value = !1;
50
+ });
51
+ const { mutationObserver: Y, observerConfig: B } = he(re);
52
+ G(() => R.value, (e) => {
53
+ e && (Y.observe(e, B), re());
54
+ });
55
+ let S = 0;
56
+ G(() => {
57
+ var e;
58
+ return (e = a.state.hoverNode) == null ? void 0 : e.id;
59
+ }, (e) => {
60
+ if (e) {
61
+ n.value = !0, clearTimeout(S);
62
+ return;
63
+ }
64
+ S = setTimeout(() => {
65
+ n.value = !1;
66
+ }, 300);
67
+ });
68
+ let O = 0, j = 0;
69
+ function E() {
70
+ const e = V.value;
71
+ if (!e || !t) return;
72
+ const { top: c, left: y } = t == null ? void 0 : t.getBoundingClientRect(), { top: o, left: k, width: $, height: T } = e.getBoundingClientRect(), v = b.value ? 1 : l.value, A = o - c + ((t == null ? void 0 : t.scrollTop) ?? 0) * v, F = k - y + ((t == null ? void 0 : t.scrollLeft) ?? 0) * v, K = T / v;
73
+ d.value && (d.value.style.width = `${$ / v}px`, d.value.style.height = `${K}px`, d.value.style.top = `${A / v}px`, d.value.style.left = `${F / v}px`, Q(A, F)), g.value && (A < 45 && K < 100 ? (g.value.style.top = "", g.value.style.bottom = "-30px", g.value.style["border-radius"] = "0px 0px 4px 4px", i.value = "bottom") : A < 45 ? (g.value.style.top = "0px", g.value.style["border-radius"] = "0px 0px 4px 0", i.value = "center") : (g.value.style.top = "-30px", g.value.style["border-radius"] = "4px 4px 0px 0px", i.value = "top"));
74
+ }
75
+ function Q(e, c) {
76
+ const y = V.value;
77
+ if (!t || !y) return;
78
+ const o = t.getBoundingClientRect(), { width: k } = y.getBoundingClientRect(), $ = b.value ? 1 : l.value, T = e / $ - o.top;
79
+ let v = c / $ - o.left + k / $;
80
+ v < o.width && (v = 0);
81
+ const A = t.scrollTop - o.height / 3 + 60, F = t.scrollTop + o.height / 3 * 2, K = t.scrollLeft - o.width + 200, ne = t.scrollLeft + o.width - 200;
82
+ Math.abs(T - O) < 10 && Math.abs(v - j) < 10 || (O = T, j = v, !(T > A && T < F && v > K && v < ne) && (t.scrollTop = T, t.scrollLeft = v));
83
+ }
84
+ function re() {
85
+ var K, ne;
86
+ const e = R.value;
87
+ if (!e) return;
88
+ const { top: c, left: y } = (t == null ? void 0 : t.getBoundingClientRect()) ?? { top: 0, left: 0 }, { top: o, left: k, width: $, height: T } = ((K = e.getBoundingClientRect) == null ? void 0 : K.call(e)) ?? ((ne = e.nextElementSibling) == null ? void 0 : ne.getBoundingClientRect()), v = b.value ? 1 : l.value, A = o - c + ((t == null ? void 0 : t.scrollTop) ?? 0) * v, F = k - y + ((t == null ? void 0 : t.scrollLeft) ?? 0) * v;
89
+ N.value && (N.value.style.width = `${$ / v}px`, N.value.style.height = `${T / v}px`, N.value.style.top = `${A / v}px`, N.value.style.left = `${F / v}px`);
90
+ }
91
+ function he(e) {
92
+ const c = window.MutationObserver, y = {
93
+ childList: !0,
94
+ attributes: !0,
95
+ subtree: !0
96
+ };
97
+ return {
98
+ mutationObserver: new c(e),
99
+ observerConfig: y
100
+ };
101
+ }
102
+ function xe() {
103
+ var $;
104
+ const e = me(_.schemas, (($ = a.state.checkedNode) == null ? void 0 : $.id) ?? "root");
105
+ if (!e)
106
+ return !1;
107
+ const { list: c, schema: y, index: o } = e, k = Le(y);
108
+ c.splice(o + 1, 0, k), a.setCheckedNode(k), r.push(_.schemas, "复制组件");
109
+ }
110
+ function ye() {
111
+ var k;
112
+ const e = me(_.schemas, ((k = a.state.checkedNode) == null ? void 0 : k.id) ?? "root");
113
+ if (!e)
114
+ return !1;
115
+ let { list: c, schema: y, index: o } = e;
116
+ c.splice(o, 1), o === c.length && o--, a.setCheckedNode(c[o]), r.push(_.schemas, "删除组件");
117
+ }
118
+ function _e(e) {
119
+ t = e, t == null || t.addEventListener("scroll", () => {
120
+ E();
121
+ }), ae(V, E), ae(R, re);
122
+ }
123
+ return D({
124
+ handleInit: _e
125
+ }), (e, c) => {
126
+ var y, o, k, $, T;
127
+ return M(), W(q, null, [
128
+ ue(w("div", {
129
+ ref_key: "selectorRef",
130
+ ref: d,
131
+ class: ee(["epic-checked-widget absolute pointer-events-none z-20", i.value + " " + (s.value ? "transition-all" : "")])
132
+ }, [
133
+ w("div", {
134
+ class: "epic-widget-action-box",
135
+ ref_key: "actionBoxRef",
136
+ ref: g
137
+ }, [
138
+ w("div", Pe, be((o = f(J).getComponentConfingByType(((y = f(a).state.checkedNode) == null ? void 0 : y.type) ?? "")) == null ? void 0 : o.defaultSchema.label), 1),
139
+ I.value ? (M(), W("div", je, [
140
+ w("div", {
141
+ title: "复制",
142
+ class: "epic-widget-action-item pointer-events-auto",
143
+ onClick: xe
144
+ }, [
145
+ z(f(ie), { name: "icon--epic--copy-all-outline-rounded" })
146
+ ]),
147
+ w("div", {
148
+ title: "删除",
149
+ class: "epic-widget-action-item pointer-events-auto",
150
+ onClick: ye
151
+ }, [
152
+ z(f(ie), { name: "icon--epic--delete-outline-rounded" })
153
+ ])
154
+ ])) : le("", !0)
155
+ ], 512)
156
+ ], 2), [
157
+ [de, H.value && ((k = f(a).state.checkedNode) == null ? void 0 : k.id) !== "root"]
158
+ ]),
159
+ ue(w("div", {
160
+ ref_key: "hoverWidgetRef",
161
+ ref: N,
162
+ class: "epic-hover-widget absolute transition-all pointer-events-none z-998"
163
+ }, null, 512), [
164
+ [de, n.value && (($ = f(a).state.checkedNode) == null ? void 0 : $.id) !== ((T = f(a).state.hoverNode) == null ? void 0 : T.id)]
165
+ ])
166
+ ], 64);
167
+ };
168
+ }
169
+ }), Ue = /* @__PURE__ */ X({
170
+ name: "EditNodeItem",
171
+ __name: "editNodeItem",
172
+ props: {
173
+ schemas: {}
174
+ },
175
+ emits: ["update:schemas"],
176
+ setup(Z, { emit: D }) {
177
+ const u = L("designer"), _ = L("pageSchema"), a = L("revoke"), m = Z, r = D, d = U({
178
+ get() {
179
+ return m.schemas;
180
+ },
181
+ set(s) {
182
+ r("update:schemas", s);
183
+ }
184
+ });
185
+ function N(s) {
186
+ u.setCheckedNode(d.value[s]), u.setDisableHover(!0);
187
+ }
188
+ function g() {
189
+ u.setDisableHover(), a.push(_.schemas, "拖拽组件");
190
+ }
191
+ function H() {
192
+ a.push(_.schemas, "插入组件");
193
+ }
194
+ function n(s) {
195
+ var i, l, b;
196
+ return s.id === ((i = _.schemas[0]) == null ? void 0 : i.id) || (b = (l = J.getComponentConfingByType(s.type)) == null ? void 0 : l.editConstraints) != null && b.immovable ? "unmover-item" : "draggable-item";
197
+ }
198
+ return (s, i) => (M(), te(f(Ie), Se({
199
+ modelValue: d.value,
200
+ "onUpdate:modelValue": i[0] || (i[0] = (l) => d.value = l),
201
+ "item-key": "id",
202
+ "component-data": {
203
+ type: "transition-group"
204
+ },
205
+ class: "epic-draggable-range"
206
+ }, {
207
+ animation: 200,
208
+ group: "edit-draggable",
209
+ handle: ".draggable-item",
210
+ ghostClass: "moveing"
211
+ }, {
212
+ onStart: i[1] || (i[1] = (l) => N(l.oldIndex)),
213
+ onEnd: i[2] || (i[2] = (l) => g()),
214
+ onAdd: i[3] || (i[3] = (l) => {
215
+ N(l.newIndex), H();
216
+ })
217
+ }), {
218
+ item: oe(({ element: l, index: b }) => [
219
+ (M(), W("div", {
220
+ class: ee(["widget-box", n(l)]),
221
+ key: b
222
+ }, [
223
+ z(ge, { schema: l }, null, 8, ["schema"])
224
+ ], 2))
225
+ ]),
226
+ _: 1
227
+ }, 16, ["modelValue"]));
228
+ }
229
+ }), ge = /* @__PURE__ */ X({
230
+ name: "ENodeItem",
231
+ __name: "nodeItem",
232
+ props: {
233
+ schema: {},
234
+ name: {}
235
+ },
236
+ setup(Z) {
237
+ const D = we(), u = L("designer"), _ = L("pageManager", {}), a = L("pageSchema", {}), m = C(null);
238
+ Ce("nodeAttrs", D);
239
+ const r = Z, d = U(() => {
240
+ var b, t, I, V, R;
241
+ const n = _.componentInstances.value, s = (b = r.schema) == null ? void 0 : b.id, i = J.getComponentConfingByType((t = r.schema) == null ? void 0 : t.type) ?? null;
242
+ if (!s || !(n != null && n[s]))
243
+ return null;
244
+ if (i != null && i.defaultSchema.input && ((I = r.schema) == null ? void 0 : I.noFormItem) !== !0)
245
+ return (V = n[s + "formItem"]) == null ? void 0 : V.$el;
246
+ const l = n[s];
247
+ return ((R = l == null ? void 0 : l.$el) == null ? void 0 : R.nodeName) === "#text" ? null : l == null ? void 0 : l.$el;
248
+ });
249
+ G(() => d.value, (n) => {
250
+ n == null || n.addEventListener("click", N, !1), n == null || n.addEventListener("mouseover", g, !1), n == null || n.addEventListener("mouseout", H, !1);
251
+ }), ke(() => {
252
+ var n, s, i;
253
+ (n = d.value) == null || n.removeEventListener("click", N, !1), (s = d.value) == null || s.removeEventListener("mouseover", g, !1), (i = d.value) == null || i.removeEventListener("mouseout", H, !1);
254
+ });
255
+ function N(n) {
256
+ n.stopPropagation(), u.setCheckedNode(r.schema);
257
+ }
258
+ function g(n) {
259
+ var s;
260
+ r.schema.id !== ((s = a.schemas[0]) == null ? void 0 : s.id) && (n.stopPropagation(), u.setHoverNode(r.schema));
261
+ }
262
+ function H(n) {
263
+ n.stopPropagation(), u.setHoverNode(null);
264
+ }
265
+ return (n, s) => {
266
+ var l, b;
267
+ const i = Ne("ENodeItem");
268
+ return M(), te(f(De), {
269
+ ref_key: "nodeRef",
270
+ ref: m,
271
+ componentSchema: r.schema
272
+ }, $e({ _: 2 }, [
273
+ (b = (l = f(J).getComponentConfingByType(r.schema.type)) == null ? void 0 : l.editConstraints) != null && b.childImmovable ? {
274
+ name: "edit-node",
275
+ fn: oe(() => [
276
+ (M(!0), W(q, null, ve(r.schema.children, (t) => (M(), te(i, {
277
+ key: t.id,
278
+ schema: t
279
+ }, null, 8, ["schema"]))), 128))
280
+ ]),
281
+ key: "0"
282
+ } : {
283
+ name: "edit-node",
284
+ fn: oe(() => [
285
+ r.schema.children ? (M(), te(Ue, {
286
+ key: 0,
287
+ schemas: r.schema.children,
288
+ "onUpdate:schemas": s[0] || (s[0] = (t) => r.schema.children = t)
289
+ }, null, 8, ["schemas"])) : le("", !0)
290
+ ]),
291
+ key: "1"
292
+ }
293
+ ]), 1032, ["componentSchema"]);
294
+ };
295
+ }
296
+ }), Je = { class: "min-w-750px rounded h-full" }, Ze = /* @__PURE__ */ X({
297
+ __name: "previewJson",
298
+ setup(Z, { expose: D }) {
299
+ const u = J.getComponent("modal"), _ = J.getComponent("monacoEditor"), a = {
300
+ theme: "vs-light",
301
+ selectOnLineNumbers: !0,
302
+ minimap: {
303
+ enabled: !1
304
+ },
305
+ readOnly: !0
306
+ }, m = C(null), r = C(!1), d = L("pageSchema");
307
+ function N() {
308
+ r.value = !1;
309
+ }
310
+ function g() {
311
+ r.value = !0, m.value ? m.value.setValue(JSON.stringify(d, null, 2)) : setTimeout(() => {
312
+ g();
313
+ }, 300);
314
+ }
315
+ function H(n = "epic-data.json") {
316
+ const s = JSON.stringify(d, null, 2);
317
+ var i = `data:text/json;charset=utf-8,${encodeURIComponent(s)}`, l = document.createElement("a");
318
+ l.setAttribute("href", i), l.setAttribute("download", n), l.click();
319
+ }
320
+ return D({
321
+ handleOpen: g
322
+ }), (n, s) => (M(), te(f(u), {
323
+ modelValue: r.value,
324
+ "onUpdate:modelValue": s[0] || (s[0] = (i) => r.value = i),
325
+ title: "查看数据",
326
+ class: "w-900px",
327
+ width: "900px",
328
+ onClose: N,
329
+ onOk: H,
330
+ okText: "导出数据"
331
+ }, {
332
+ default: oe(() => [
333
+ w("div", Je, [
334
+ z(f(_), {
335
+ ref_key: "monacoEditorRef",
336
+ ref: m,
337
+ class: "editor h-full",
338
+ autoToggleTheme: "",
339
+ readOnly: "",
340
+ config: a,
341
+ language: "json"
342
+ }, null, 512)
343
+ ])
344
+ ]),
345
+ _: 1
346
+ }, 8, ["modelValue"]));
347
+ }
348
+ }), Qe = { class: "epic-edit-toolbar flex items-center justify-between px-2" }, Ke = { class: "flex-1 h-full flex items-center" }, Xe = {
349
+ key: 0,
350
+ class: "epic-divider"
351
+ }, Ye = ["title", "onClick"], qe = { class: "flex-1 h-full flex items-center justify-end" }, Ge = {
352
+ key: 0,
353
+ class: "flex items-center ml-12px"
354
+ }, et = { class: "pr-8px w-82px cursor-pointer" }, tt = { class: "epic-device h-28px items-center gap-1 rounded-md border p-2px flex" }, ot = ["title", "onClick"], nt = /* @__PURE__ */ X({
355
+ __name: "toolbar",
356
+ setup(Z) {
357
+ const D = J.getComponent("select"), { canvasScale: u, disabledZoom: _ } = fe(), a = C("pc"), m = L("pageSchema"), r = L("designer"), d = L("revoke"), N = C(null), g = [
358
+ {
359
+ icon: "icon--epic--computer-outline-rounded",
360
+ title: "pc",
361
+ key: "pc"
362
+ }
363
+ // {
364
+ // icon: "icon--epic--tablet-android-outline-rounded",
365
+ // title: "平板",
366
+ // key: "pad",
367
+ // },
368
+ // {
369
+ // icon: "icon--epic--phone-iphone-outline-sharp",
370
+ // title: "手机",
371
+ // key: "mobile",
372
+ // },
373
+ ], H = U(() => [
374
+ // {
375
+ // icon: "icon--epic--code",
376
+ // title: "查看数据",
377
+ // on: () => handlePreview(),
378
+ // },
379
+ // {
380
+ // icon: "icon--epic--exit-to-app-rounded",
381
+ // title: "导入数据",
382
+ // on: handleOpenFileSelector,
383
+ // },
384
+ {
385
+ icon: "icon--epic--trash",
386
+ title: "清空",
387
+ on: t
388
+ },
389
+ {
390
+ icon: "icon--epic--undo",
391
+ title: "撤销",
392
+ on: l,
393
+ disabled: !d.recordList.value.length,
394
+ divider: !0
395
+ },
396
+ {
397
+ icon: "icon--epic--redo",
398
+ title: "重做",
399
+ on: b,
400
+ disabled: !d.undoList.value.length
401
+ }
402
+ ]), n = C(null), s = U({
403
+ get() {
404
+ return `${(u.value * 100).toFixed(0)}%`;
405
+ },
406
+ set(p) {
407
+ const x = parseFloat(p);
408
+ u.value = x / 100;
409
+ }
410
+ }), i = [
411
+ {
412
+ label: "60%",
413
+ value: "60%"
414
+ },
415
+ {
416
+ label: "80%",
417
+ value: "80%"
418
+ },
419
+ {
420
+ label: "100%",
421
+ value: "100%"
422
+ },
423
+ {
424
+ label: "120%",
425
+ value: "120%"
426
+ },
427
+ {
428
+ label: "140%",
429
+ value: "140%"
430
+ }
431
+ ];
432
+ function l() {
433
+ const p = d.undo();
434
+ p && (ce(m.schemas, p), r.setCheckedNode(m.schemas[0]));
435
+ }
436
+ function b() {
437
+ const p = d.redo();
438
+ p && (ce(m.schemas, p), r.setCheckedNode(m.schemas[0]));
439
+ }
440
+ function t() {
441
+ r.reset();
442
+ }
443
+ function I(p) {
444
+ var P;
445
+ const x = (P = p.target.files) == null ? void 0 : P[0];
446
+ if (!x) return;
447
+ p.target.value = null;
448
+ const h = new FileReader();
449
+ h.readAsText(x), h.onload = (Y) => {
450
+ var B;
451
+ V((B = Y.target) == null ? void 0 : B.result);
452
+ };
453
+ }
454
+ function V(p) {
455
+ try {
456
+ let x = JSON.parse(p ?? "");
457
+ x.schemas || (x = He(x)), ce(m, x);
458
+ } catch (x) {
459
+ console.error(x);
460
+ }
461
+ }
462
+ function R(p) {
463
+ r.handleToggleDeviceMode(p), a.value = p;
464
+ const x = {
465
+ pc: {},
466
+ pad: {
467
+ width: "780px",
468
+ mode: p
469
+ },
470
+ mobile: {
471
+ width: "390px",
472
+ mode: p
473
+ }
474
+ };
475
+ m.canvas = x[p];
476
+ }
477
+ return (p, x) => (M(), W(q, null, [
478
+ w("div", Qe, [
479
+ w("div", Ke, [
480
+ (M(!0), W(q, null, ve(H.value, (h, P) => (M(), W(q, { key: P }, [
481
+ h.divider ? (M(), W("div", Xe)) : le("", !0),
482
+ w("div", {
483
+ title: h.title,
484
+ class: ee(["epic-action-item text-base h-90% px-10px flex items-center cursor-pointer", { disabled: h.disabled }]),
485
+ onClick: h.on
486
+ }, [
487
+ z(f(ie), {
488
+ name: h.icon
489
+ }, null, 8, ["name"])
490
+ ], 10, Ye)
491
+ ], 64))), 128))
492
+ ]),
493
+ ue(w("input", {
494
+ type: "file",
495
+ ref_key: "fileRef",
496
+ ref: n,
497
+ accept: ".json,.txt",
498
+ onChange: I
499
+ }, null, 544), [
500
+ [de, !1]
501
+ ]),
502
+ w("div", qe, [
503
+ f(_) ? le("", !0) : (M(), W("div", Ge, [
504
+ w("div", et, [
505
+ z(f(D), {
506
+ value: s.value,
507
+ "onUpdate:value": x[0] || (x[0] = (h) => s.value = h),
508
+ modelValue: s.value,
509
+ "onUpdate:modelValue": x[1] || (x[1] = (h) => s.value = h),
510
+ options: i,
511
+ size: "small"
512
+ }, null, 8, ["value", "modelValue"])
513
+ ])
514
+ ])),
515
+ w("div", tt, [
516
+ (M(), W(q, null, ve(g, (h) => w("div", {
517
+ key: h.key,
518
+ title: h.title,
519
+ class: ee(["epic-device-item h-full px-1 flex items-center cursor-pointer text-base transition-colors rounded-sm", { checked: h.key === a.value }]),
520
+ onClick: (P) => R(h.key)
521
+ }, [
522
+ z(f(ie), {
523
+ name: h.icon
524
+ }, null, 8, ["name"])
525
+ ], 10, ot)), 64))
526
+ ])
527
+ ])
528
+ ]),
529
+ z(Ze, {
530
+ ref_key: "previewJson",
531
+ ref: N
532
+ }, null, 512)
533
+ ], 64));
534
+ }
535
+ }), st = { class: "h-full flex flex-col relative" }, lt = ["draggable"], at = /* @__PURE__ */ X({
536
+ __name: "editScreenContainer",
537
+ setup(Z) {
538
+ const D = L("pageSchema"), u = C(null), _ = C(null), a = C(null), { pressSpace: m, disabledZoom: r } = fe(), {
539
+ handleElementDragStart: d,
540
+ handleElementDrag: N,
541
+ handleElementDragEnd: g
542
+ } = Ve(u), { width: H, height: n } = We(u), { canvasScale: s, handleZoom: i } = ze(_);
543
+ let l = 0, b = 0;
544
+ const t = C({}), I = C({}), V = C({}), R = Re({ width: 0, height: 0 });
545
+ Te(x), G(V, () => {
546
+ pe(p);
547
+ });
548
+ function p() {
549
+ a.value && (R.value = {
550
+ width: a.value.clientWidth,
551
+ height: a.value.clientHeight
552
+ });
553
+ }
554
+ function x() {
555
+ var B, S;
556
+ V.value = {
557
+ width: ((B = D.canvas) == null ? void 0 : B.width) ?? "0",
558
+ height: ((S = D.canvas) == null ? void 0 : S.height) ?? "0"
559
+ };
560
+ }
561
+ Ae(H, h), G(R, h);
562
+ function h() {
563
+ let B = R.value.width || l, S = R.value.height || b;
564
+ t.value = {
565
+ width: H.value + B + "px",
566
+ // 滚动框宽度,包含额外的宽度
567
+ height: n.value + S + "px"
568
+ // 滚动框高度,包含额外的高度
569
+ }, I.value = {
570
+ width: B + "px",
571
+ // 画布宽度
572
+ height: S + "px"
573
+ // 画布高度
574
+ }, P();
575
+ }
576
+ function P() {
577
+ pe(() => {
578
+ var E;
579
+ let B = R.value.width || l;
580
+ const O = (R.value.height || b) / 2, j = B / 2;
581
+ (E = u.value) == null || E.scrollTo(j, O);
582
+ });
583
+ }
584
+ ae(u, Y), ae(_, Y);
585
+ function Y() {
586
+ var S;
587
+ if (!u.value) return;
588
+ const B = u.value.getBoundingClientRect();
589
+ if (l = B.width - 60, b = B.height - 80, !r.value)
590
+ if (R.value.width === 0)
591
+ s.value = 1;
592
+ else {
593
+ const O = (l - 20) / R.value.width, j = b / (R.value.height || ((S = _.value) == null ? void 0 : S.clientHeight) || 1), E = Math.abs(O - 1) < Math.abs(j - 1);
594
+ let Q = 1;
595
+ E ? Q = O : Q = j, (O < 1 || j < 1) && (Q = Math.min(O, j)), Q < 1.4 && Q > 0.5 && (s.value = Q);
596
+ }
597
+ Ee(h, 50)();
598
+ }
599
+ return (B, S) => (M(), W("div", st, [
600
+ z(nt),
601
+ w("div", {
602
+ ref_key: "editScreenContainerRef",
603
+ ref: u,
604
+ class: ee(["flex-1 overflow-auto overflow-y-hidden epic-edit-screen-container", { "cursor-grab": f(m) }]),
605
+ draggable: f(m),
606
+ onWheel: S[0] || (S[0] = //@ts-ignore
607
+ (...O) => f(i) && f(i)(...O)),
608
+ onDragstart: S[1] || (S[1] = //@ts-ignore
609
+ (...O) => f(d) && f(d)(...O)),
610
+ onDragend: S[2] || (S[2] = //@ts-ignore
611
+ (...O) => f(g) && f(g)(...O)),
612
+ onDrag: S[3] || (S[3] = //@ts-ignore
613
+ (...O) => f(N) && f(N)(...O))
614
+ }, [
615
+ w("div", {
616
+ id: "canvasContainer",
617
+ class: "flex items-center justify-center",
618
+ style: se(t.value)
619
+ }, [
620
+ w("div", {
621
+ ref_key: "draggableElRef",
622
+ ref: _,
623
+ class: "transition-all"
624
+ }, [
625
+ w("div", {
626
+ class: ee({ "pointer-events-none": f(m) }),
627
+ style: se(I.value)
628
+ }, [
629
+ Be(B.$slots, "default")
630
+ ], 6)
631
+ ], 512)
632
+ ], 4)
633
+ ], 42, lt),
634
+ w("div", {
635
+ ref_key: "sizeBoxRef",
636
+ ref: a,
637
+ class: "absolute top-0 pointer-events-none",
638
+ style: se(V.value)
639
+ }, null, 4)
640
+ ]));
641
+ }
642
+ }), it = { class: "epic-edit-canvas" }, ft = /* @__PURE__ */ X({
643
+ __name: "index",
644
+ setup(Z) {
645
+ const D = C(null), u = C(null), _ = L("pageSchema"), a = U(() => _.schemas[0]), m = U(() => ({
646
+ width: "100%",
647
+ height: "100%"
648
+ }));
649
+ return Oe(() => {
650
+ var r;
651
+ (r = u.value) == null || r.handleInit(D.value);
652
+ }), (r, d) => (M(), W("section", it, [
653
+ z(at, null, {
654
+ default: oe(() => [
655
+ w("div", {
656
+ ref_key: "epicEditRangeRef",
657
+ ref: D,
658
+ class: "epic-edit-range rounded-md overflow-auto relative",
659
+ style: se(m.value)
660
+ }, [
661
+ z(ge, { schema: a.value }, null, 8, ["schema"]),
662
+ z(Fe, {
663
+ ref_key: "ePreviewWidgetsRef",
664
+ ref: u
665
+ }, null, 512)
666
+ ], 4)
667
+ ]),
668
+ _: 1
669
+ })
670
+ ]));
671
+ }
672
+ });
673
+ export {
674
+ ft as default
675
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),p=require("monaco-editor"),b=require("./index-BUkdmwKe.cjs"),h=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function v(l){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:()=>l[r]})}}return o.default=l,Object.freeze(o)}const i=v(p),_=a.defineComponent({__name:"index",props:{language:{default:"json"},readOnly:{type:Boolean,default:!1},valueFormat:{default:"string"},modelValue:{},config:{default:()=>({selectOnLineNumbers:!0,minimap:{enabled:!1}})},lineNumbers:{default:"on"},autoToggleTheme:{type:Boolean},theme:{default:"vs-light"}},emits:["update:modelValue"],setup(l,{expose:o,emit:r}){const t=l,s=r,c=a.ref(null);let e=null;const{isDark:f}=b.useTheme();function d(){f.value?i.editor.setTheme("vs-dark"):i.editor.setTheme("vs-light")}function m(u){e==null||e.setValue(u||"")}function g(u){const n=e==null?void 0:e.getPosition();n&&(e==null||e.executeEdits("",[{range:new i.Range(n.lineNumber,n.column,n.lineNumber,n.column),text:u}]),e==null||e.setPosition({...n,column:n.column+u.length}),e==null||e.focus())}return a.onMounted(()=>{e=i.editor.create(c.value,{value:u(),...t.config,language:t.language,readOnly:t.readOnly,lineNumbers:t.lineNumbers,theme:t.theme,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10},automaticLayout:!0}),t.autoToggleTheme&&a.watch(()=>f.value,()=>{a.nextTick(()=>d())},{immediate:!0});function u(){return t.valueFormat==="json"&&t.modelValue?JSON.stringify(t.modelValue,null,2):t.modelValue??""}e.onDidChangeModelContent(()=>{const n=e==null?void 0:e.getValue();if(t.valueFormat==="json"&&n){s("update:modelValue",JSON.parse(n));return}s("update:modelValue",n??"")})}),o({setValue:m,insertText:g}),(u,n)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"editContainer",ref:c,class:"epic-code-editor"},null,512))}}),y=h._export_sfc(_,[["__scopeId","data-v-3e2e893c"]]);exports.default=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),p=require("monaco-editor"),b=require("./index-CI-wApqh.cjs"),h=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function v(l){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:()=>l[r]})}}return o.default=l,Object.freeze(o)}const i=v(p),_=a.defineComponent({__name:"index",props:{language:{default:"json"},readOnly:{type:Boolean,default:!1},valueFormat:{default:"string"},modelValue:{},config:{default:()=>({selectOnLineNumbers:!0,minimap:{enabled:!1}})},lineNumbers:{default:"on"},autoToggleTheme:{type:Boolean},theme:{default:"vs-light"}},emits:["update:modelValue"],setup(l,{expose:o,emit:r}){const t=l,s=r,c=a.ref(null);let e=null;const{isDark:f}=b.useTheme();function d(){f.value?i.editor.setTheme("vs-dark"):i.editor.setTheme("vs-light")}function m(u){e==null||e.setValue(u||"")}function g(u){const n=e==null?void 0:e.getPosition();n&&(e==null||e.executeEdits("",[{range:new i.Range(n.lineNumber,n.column,n.lineNumber,n.column),text:u}]),e==null||e.setPosition({...n,column:n.column+u.length}),e==null||e.focus())}return a.onMounted(()=>{e=i.editor.create(c.value,{value:u(),...t.config,language:t.language,readOnly:t.readOnly,lineNumbers:t.lineNumbers,theme:t.theme,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10},automaticLayout:!0}),t.autoToggleTheme&&a.watch(()=>f.value,()=>{a.nextTick(()=>d())},{immediate:!0});function u(){return t.valueFormat==="json"&&t.modelValue?JSON.stringify(t.modelValue,null,2):t.modelValue??""}e.onDidChangeModelContent(()=>{const n=e==null?void 0:e.getValue();if(t.valueFormat==="json"&&n){s("update:modelValue",JSON.parse(n));return}s("update:modelValue",n??"")})}),o({setValue:m,insertText:g}),(u,n)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"editContainer",ref:c,class:"epic-code-editor"},null,512))}}),y=h._export_sfc(_,[["__scopeId","data-v-3e2e893c"]]);exports.default=y;