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