epic-designer-gold 0.0.22 → 0.0.24

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