epic-designer-gold 0.0.49 → 1.0.0
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-DvYRuXDB.js → attributeView-BhPj8bSe.js} +1 -1
- package/dist/{attributeView-CMbZBZIS.cjs → attributeView-C9gY9X-c.cjs} +1 -1
- package/dist/{index-WBW2xl-M.js → index-3ndHV3fl.js} +1 -1
- package/dist/index-B45xlt7e.js +4 -0
- package/dist/{index-BIfS14i1.cjs → index-BA5cmAC5.cjs} +1 -1
- package/dist/{index-2_PG24En.cjs → index-BmqAqj29.cjs} +1 -1
- package/dist/{index-CtK_8YxJ.cjs → index-C2HMY2I2.cjs} +2 -2
- package/dist/{index-C8eSqkwT.cjs → index-CE9DjYAW.cjs} +1 -1
- package/dist/{index-Bjj1uygU.js → index-CshPxldv.js} +1 -1
- package/dist/{index-FUj4O0Wm.cjs → index-CvF1WVts.cjs} +1 -1
- package/dist/{index-D0xByXxW.js → index-Cw3VVR9A.js} +1 -1
- package/dist/{index-SmoMBzHL.js → index-DMDLjlCJ.js} +1 -1
- package/dist/{index-Dy65ngnp.js → index-DNuLy9hB.js} +6 -6
- package/dist/{index-BsyFZeFI.cjs → index-DpitV6qp.cjs} +1 -1
- package/dist/{index-ijn3b5rF.js → index-DtWX93JN.js} +1 -1
- package/dist/{index-3oFTJubt.cjs → index-F6atymcD.cjs} +1 -1
- package/dist/index-G-yqaciQ.cjs +1 -0
- package/dist/{index-BizWKLWZ.js → index-N_JBxsiO.js} +1 -1
- package/dist/index-efmvTLGJ.js +194 -0
- package/dist/{index-zyeRTxj7.cjs → index-iQ5ZEvrv.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{styleView-CF34Ddn9.cjs → styleView-Dew56dxa.cjs} +1 -1
- package/dist/{styleView-BbQxI-Nr.js → styleView-SPW99MRS.js} +1 -1
- package/package.json +1 -1
- package/dist/index-CqirvAEP.js +0 -4
- package/dist/index-DiYy4kUz.js +0 -228
- package/dist/index-YV7i1gyI.cjs +0 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { defineComponent as $, inject as w, resolveComponent as M, openBlock as m, createBlock as E, unref as n, isRef as k, withCtx as B, createElementVNode as c, normalizeClass as D, createVNode as s, createCommentVNode as I, createElementBlock as _, ref as z, reactive as N, onMounted as A, watch as L, provide as R, Fragment as T, renderList as j, toDisplayString as F, withDirectives as q, vShow as G, createTextVNode as H } from "vue";
|
|
2
|
+
import { d as J } from "./vuedraggable.umd-D2S7Eo7p.js";
|
|
3
|
+
import { p as v, E as S } from "./js.cookie-oHpRFPCO.js";
|
|
4
|
+
import { _ as y } from "./icon.vue_vue_type_script_setup_true_lang-D3QdcReY.js";
|
|
5
|
+
import { n as C } from "./index-DNuLy9hB.js";
|
|
6
|
+
import "element-plus";
|
|
7
|
+
import { _ as K } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
|
+
const P = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "pl-4"
|
|
11
|
+
}, Q = /* @__PURE__ */ $({
|
|
12
|
+
name: "EOptionItem",
|
|
13
|
+
__name: "optionItem",
|
|
14
|
+
props: {
|
|
15
|
+
modelValue: {}
|
|
16
|
+
},
|
|
17
|
+
emits: ["update:modelValue"],
|
|
18
|
+
setup(x, { emit: g }) {
|
|
19
|
+
const b = x, f = v.getComponent("input"), r = w("tree", !1), i = C(b, "modelValue", g);
|
|
20
|
+
function h(t) {
|
|
21
|
+
const u = {
|
|
22
|
+
label: "",
|
|
23
|
+
value: ""
|
|
24
|
+
};
|
|
25
|
+
t.children ? t.children.push(u) : t.children = [u];
|
|
26
|
+
}
|
|
27
|
+
function o(t) {
|
|
28
|
+
i.value = i.value.filter((u, V) => V !== t);
|
|
29
|
+
}
|
|
30
|
+
return (t, u) => {
|
|
31
|
+
const V = M("EOptionItem");
|
|
32
|
+
return m(), E(n(J), {
|
|
33
|
+
modelValue: n(i),
|
|
34
|
+
"onUpdate:modelValue": u[0] || (u[0] = (l) => k(i) ? i.value = l : null),
|
|
35
|
+
"item-key": "id",
|
|
36
|
+
"component-data": {
|
|
37
|
+
type: "transition-group"
|
|
38
|
+
},
|
|
39
|
+
group: "option-list",
|
|
40
|
+
handle: ".handle",
|
|
41
|
+
animation: 200
|
|
42
|
+
}, {
|
|
43
|
+
item: B(({ element: l, index: a }) => [
|
|
44
|
+
c("div", null, [
|
|
45
|
+
c("div", {
|
|
46
|
+
class: D([n(r) ? "grid-cols-[16px_auto_auto_16px_16px]" : "grid-cols-[16px_auto_auto_16px]", "option-item text-16px grid text-$epic-text-secondary gap-2 items-center mb-2"])
|
|
47
|
+
}, [
|
|
48
|
+
s(n(y), {
|
|
49
|
+
class: "mr-2 cursor-move handle",
|
|
50
|
+
name: "icon--epic--drag"
|
|
51
|
+
}),
|
|
52
|
+
s(n(f), {
|
|
53
|
+
modelValue: l.label,
|
|
54
|
+
"onUpdate:modelValue": (e) => l.label = e,
|
|
55
|
+
value: l.label,
|
|
56
|
+
"onUpdate:value": (e) => l.label = e,
|
|
57
|
+
placeholder: "label"
|
|
58
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "value", "onUpdate:value"]),
|
|
59
|
+
s(n(f), {
|
|
60
|
+
modelValue: l.value,
|
|
61
|
+
"onUpdate:modelValue": (e) => l.value = e,
|
|
62
|
+
value: l.value,
|
|
63
|
+
"onUpdate:value": (e) => l.value = e,
|
|
64
|
+
placeholder: "value"
|
|
65
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "value", "onUpdate:value"]),
|
|
66
|
+
n(r) ? (m(), E(n(y), {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: "cursor-pointer text-lg!",
|
|
69
|
+
name: "icon--epic--add-rounded",
|
|
70
|
+
onClick: (e) => h(l)
|
|
71
|
+
}, null, 8, ["onClick"])) : I("", !0),
|
|
72
|
+
s(n(y), {
|
|
73
|
+
class: "hover:text-red cursor-pointer",
|
|
74
|
+
name: "icon--epic--delete-outline-rounded",
|
|
75
|
+
onClick: (e) => o(a)
|
|
76
|
+
}, null, 8, ["onClick"])
|
|
77
|
+
], 2),
|
|
78
|
+
l.children ? (m(), _("div", P, [
|
|
79
|
+
s(V, {
|
|
80
|
+
modelValue: l.children,
|
|
81
|
+
"onUpdate:modelValue": (e) => l.children = e
|
|
82
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
83
|
+
])) : I("", !0)
|
|
84
|
+
])
|
|
85
|
+
]),
|
|
86
|
+
_: 1
|
|
87
|
+
}, 8, ["modelValue"]);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}), W = { class: "" }, X = { class: "epic-tabs-box" }, Y = ["title", "onClick"], Z = { key: 0 }, ee = { class: "py-4 my-2 text-center text-gray-400 bg-white" }, le = { key: 1 }, te = /* @__PURE__ */ $({
|
|
91
|
+
__name: "index",
|
|
92
|
+
props: {
|
|
93
|
+
tree: { type: Boolean },
|
|
94
|
+
modelValue: {},
|
|
95
|
+
dynamicId: {},
|
|
96
|
+
type: {}
|
|
97
|
+
},
|
|
98
|
+
emits: ["update:modelValue", "update:EOptionsEditor"],
|
|
99
|
+
setup(x, { emit: g }) {
|
|
100
|
+
const b = v.getComponent("button"), f = v.getComponent("select"), r = z([]), p = N({
|
|
101
|
+
title: "静态"
|
|
102
|
+
}), i = x, h = g;
|
|
103
|
+
S.on("deleteSourceData", (a) => {
|
|
104
|
+
t.value === a && (t.value = "", o.value = []);
|
|
105
|
+
}), S.on("updateSource", (a) => {
|
|
106
|
+
r.value = v.sourceData.map((e) => ({
|
|
107
|
+
...e,
|
|
108
|
+
label: e.apiName,
|
|
109
|
+
value: e.id
|
|
110
|
+
}));
|
|
111
|
+
}), A(() => {
|
|
112
|
+
r.value = v.sourceData.map((a) => ({
|
|
113
|
+
...a,
|
|
114
|
+
label: a.apiName,
|
|
115
|
+
value: a.id
|
|
116
|
+
}));
|
|
117
|
+
});
|
|
118
|
+
const o = C(i, "modelValue", h), t = C(i, "dynamicId", h);
|
|
119
|
+
L(
|
|
120
|
+
() => t.value,
|
|
121
|
+
async () => {
|
|
122
|
+
t.value ? p.title = "动态" : p.title = "静态";
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
immediate: !0
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
const u = [
|
|
129
|
+
{
|
|
130
|
+
title: "静态"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
title: "动态"
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
async function V(a) {
|
|
137
|
+
p.title = a.title, a.title === "静态" ? (o.value = [], t.value = "") : (o.value = [], r.value = v.sourceData.map((e) => ({
|
|
138
|
+
...e,
|
|
139
|
+
label: e.apiName,
|
|
140
|
+
value: e.id
|
|
141
|
+
})));
|
|
142
|
+
}
|
|
143
|
+
i.modelValue, R("tree", i.tree);
|
|
144
|
+
function l() {
|
|
145
|
+
const a = N({
|
|
146
|
+
label: "",
|
|
147
|
+
value: ""
|
|
148
|
+
});
|
|
149
|
+
o.value.length ? o.value = [...o.value, a] : o.value = [a];
|
|
150
|
+
}
|
|
151
|
+
return (a, e) => {
|
|
152
|
+
var U;
|
|
153
|
+
return m(), _("div", W, [
|
|
154
|
+
c("div", null, [
|
|
155
|
+
c("div", X, [
|
|
156
|
+
(m(), _(T, null, j(u, (d, O) => c("div", {
|
|
157
|
+
class: D(["epic-tab cursor-pointer truncate", { checked: p.title === d.title }]),
|
|
158
|
+
key: O,
|
|
159
|
+
title: d.title,
|
|
160
|
+
onClick: (ae) => V(d)
|
|
161
|
+
}, F(d.title), 11, Y)), 64))
|
|
162
|
+
]),
|
|
163
|
+
p.title === "静态" ? (m(), _("div", Z, [
|
|
164
|
+
q(c("div", ee, "暂无选项", 512), [
|
|
165
|
+
[G, !((U = n(o)) != null && U.length)]
|
|
166
|
+
]),
|
|
167
|
+
s(Q, {
|
|
168
|
+
modelValue: n(o),
|
|
169
|
+
"onUpdate:modelValue": e[0] || (e[0] = (d) => k(o) ? o.value = d : null)
|
|
170
|
+
}, null, 8, ["modelValue"]),
|
|
171
|
+
s(n(b), { onClick: l }, {
|
|
172
|
+
default: B(() => e[2] || (e[2] = [
|
|
173
|
+
H("添加选项")
|
|
174
|
+
])),
|
|
175
|
+
_: 1
|
|
176
|
+
})
|
|
177
|
+
])) : (m(), _("div", le, [
|
|
178
|
+
e[3] || (e[3] = c("span", { style: { "font-size": "12px", "margin-bottom": "8px", display: "inline-block" } }, "数据源", -1)),
|
|
179
|
+
s(n(f), {
|
|
180
|
+
modelValue: n(t),
|
|
181
|
+
"onUpdate:modelValue": e[1] || (e[1] = (d) => k(t) ? t.value = d : null),
|
|
182
|
+
placeholder: "请选择数据源",
|
|
183
|
+
clearable: "",
|
|
184
|
+
options: r.value
|
|
185
|
+
}, null, 8, ["modelValue", "options"])
|
|
186
|
+
]))
|
|
187
|
+
])
|
|
188
|
+
]);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}), ce = /* @__PURE__ */ K(te, [["__scopeId", "data-v-21fb2159"]]);
|
|
192
|
+
export {
|
|
193
|
+
ce as default
|
|
194
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),F=require("./js.cookie-BH1G_HRi.cjs"),C=require("./index-CtK_8YxJ.cjs"),J=require("./icon.vue_vue_type_script_setup_true_lang-DJbUD5AQ.cjs"),G=require("./vuedraggable.umd-BqhSJIAi.cjs"),ee={class:"epic-widget-action-item whitespace-nowrap"},te={key:0,class:"flex items-center"},ne=e.defineComponent({__name:"previewWidgets",setup(A,{expose:R}){const u=e.inject("pageManager",{}),_=e.inject("pageSchema"),r=e.inject("designer"),h=e.inject("designerProps"),c=e.inject("revoke"),f=e.ref(null),w=e.ref(null),g=e.ref(null),M=e.ref(!1),l=e.ref(!1),a=e.ref(!0),i=e.ref("top"),{canvasScale:s,disabledZoom:k}=C.useStore();let n=null;const L=e.computed(()=>{const t=r.state.checkedNode;return!(!(t!=null&&t.id)||h.value.lockDefaultSchemaEdit&&u.defaultComponentIds.value.includes(t==null?void 0:t.id))}),T=e.computed(()=>{var S,N,V,m,O,H;const t=u.componentInstances.value,d=(S=r.state.checkedNode)==null?void 0:S.id;if((V=(N=r.state.checkedNode)==null?void 0:N.componentProps)!=null&&V.hidden)return null;const y=F.pluginManager.getComponentConfingByType((m=r.state.checkedNode)==null?void 0:m.type)??null;if(!d||!(t!=null&&t[d]))return null;if(y!=null&&y.defaultSchema.input&&((O=r.state.checkedNode)==null?void 0:O.noFormItem)!==!0)return(H=t[d+"formItem"])==null?void 0:H.$el;const o=t[d];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}),B=e.computed(()=>{var S,N,V,m;const t=u.componentInstances.value,d=(S=r.state.hoverNode)==null?void 0:S.id,y=F.pluginManager.getComponentConfingByType((N=r.state.hoverNode)==null?void 0:N.type)??null;if(!d||!(t!=null&&t[d]))return null;if(y!=null&&y.defaultSchema.input&&((V=r.state.hoverNode)==null?void 0:V.noFormItem)!==!0)return(m=t[d+"formItem"])==null?void 0:m.$el;const o=t[d];return(o==null?void 0:o.$el.nodeName)==="#text"?null:o==null?void 0:o.$el}),{mutationObserver:p,observerConfig:x}=Z(j),{startTimedQuery:v,stopTimedQuery:z}=C.useTimedQuery(j);e.watch(()=>T.value,t=>{if(t){M.value=!0,p.observe(t,x);const d=t.parentNode;d&&(d.ondragstart=()=>{a.value=!1,v()},d.ondragend=()=>{a.value=!0,z()}),j()}else M.value=!1});const{mutationObserver:P,observerConfig:E}=Z(q);e.watch(()=>B.value,t=>{t&&(P.observe(t,E),q())});let b=0;e.watch(()=>{var t;return(t=r.state.hoverNode)==null?void 0:t.id},t=>{if(t){l.value=!0,clearTimeout(b);return}b=setTimeout(()=>{l.value=!1},300)});let $=0,D=0;function j(){const t=T.value;if(!t||!n)return;const{top:d,left:y}=n==null?void 0:n.getBoundingClientRect(),{top:o,left:S,width:N,height:V}=t.getBoundingClientRect(),m=k.value?1:s.value,O=o-d+((n==null?void 0:n.scrollTop)??0)*m,H=S-y+((n==null?void 0:n.scrollLeft)??0)*m,W=V/m;f.value&&(f.value.style.width=`${N/m}px`,f.value.style.height=`${W}px`,f.value.style.top=`${O/m}px`,f.value.style.left=`${H/m}px`,I(O,H)),g.value&&(O<45&&W<100?(g.value.style.top="",g.value.style.bottom="-30px",g.value.style["border-radius"]="0px 0px 4px 4px",i.value="bottom"):O<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"))}function I(t,d){const y=T.value;if(!n||!y)return;const o=n.getBoundingClientRect(),{width:S}=y.getBoundingClientRect(),N=k.value?1:s.value,V=t/N-o.top;let m=d/N-o.left+S/N;m<o.width&&(m=0);const O=n.scrollTop-o.height/3+60,H=n.scrollTop+o.height/3*2,W=n.scrollLeft-o.width+200,U=n.scrollLeft+o.width-200;Math.abs(V-$)<10&&Math.abs(m-D)<10||($=V,D=m,!(V>O&&V<H&&m>W&&m<U)&&(n.scrollTop=V,n.scrollLeft=m))}function q(){var W,U;const t=B.value;if(!t)return;const{top:d,left:y}=(n==null?void 0:n.getBoundingClientRect())??{top:0,left:0},{top:o,left:S,width:N,height:V}=((W=t.getBoundingClientRect)==null?void 0:W.call(t))??((U=t.nextElementSibling)==null?void 0:U.getBoundingClientRect()),m=k.value?1:s.value,O=o-d+((n==null?void 0:n.scrollTop)??0)*m,H=S-y+((n==null?void 0:n.scrollLeft)??0)*m;w.value&&(w.value.style.width=`${N/m}px`,w.value.style.height=`${V/m}px`,w.value.style.top=`${O/m}px`,w.value.style.left=`${H/m}px`)}function Z(t){const d=window.MutationObserver,y={childList:!0,attributes:!0,subtree:!0};return{mutationObserver:new d(t),observerConfig:y}}function K(){var N;const t=C.findSchemaInfoById(_.schemas,((N=r.state.checkedNode)==null?void 0:N.id)??"root");if(!t)return!1;const{list:d,schema:y,index:o}=t,S=C.generateNewSchema(y);d.splice(o+1,0,S),r.setCheckedNode(S),c.push(_.schemas,"复制组件")}function X(){var S;const t=C.findSchemaInfoById(_.schemas,((S=r.state.checkedNode)==null?void 0:S.id)??"root");if(!t)return!1;let{list:d,schema:y,index:o}=t;d.splice(o,1),o===d.length&&o--,r.setCheckedNode(d[o]),c.push(_.schemas,"删除组件")}function Y(t){n=t,n==null||n.addEventListener("scroll",()=>{j()}),C.useResizeObserver(T,j),C.useResizeObserver(B,q)}return R({handleInit:Y}),(t,d)=>{var y,o,S,N,V;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives(e.createElementVNode("div",{ref_key:"selectorRef",ref:f,class:e.normalizeClass(["epic-checked-widget absolute pointer-events-none z-20",i.value+" "+(a.value?"transition-all":"")])},[e.createElementVNode("div",{class:"epic-widget-action-box",ref_key:"actionBoxRef",ref:g},[e.createElementVNode("div",ee,e.toDisplayString((o=e.unref(F.pluginManager).getComponentConfingByType(((y=e.unref(r).state.checkedNode)==null?void 0:y.type)??""))==null?void 0:o.defaultSchema.label),1),L.value?(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("div",{title:"复制",class:"epic-widget-action-item pointer-events-auto",onClick:K},[e.createVNode(e.unref(J._sfc_main),{name:"icon--epic--copy-all-outline-rounded"})]),e.createElementVNode("div",{title:"删除",class:"epic-widget-action-item pointer-events-auto",onClick:X},[e.createVNode(e.unref(J._sfc_main),{name:"icon--epic--delete-outline-rounded"})])])):e.createCommentVNode("",!0)],512)],2),[[e.vShow,M.value&&((S=e.unref(r).state.checkedNode)==null?void 0:S.id)!=="root"]]),e.withDirectives(e.createElementVNode("div",{ref_key:"hoverWidgetRef",ref:w,class:"epic-hover-widget absolute transition-all pointer-events-none z-998"},null,512),[[e.vShow,l.value&&((N=e.unref(r).state.checkedNode)==null?void 0:N.id)!==((V=e.unref(r).state.hoverNode)==null?void 0:V.id)]])],64)}}}),oe=e.defineComponent({name:"EditNodeItem",__name:"editNodeItem",props:{schemas:{}},emits:["update:schemas"],setup(A,{emit:R}){const u=e.inject("designer"),_=e.inject("pageSchema"),r=e.inject("revoke"),h=A,c=R,f=e.computed({get(){return h.schemas},set(a){c("update:schemas",a)}});function w(a){u.setCheckedNode(f.value[a]),u.setDisableHover(!0)}function g(){u.setDisableHover(),r.push(_.schemas,"拖拽组件")}function M(){r.push(_.schemas,"插入组件")}function l(a){var i,s,k;return a.id===((i=_.schemas[0])==null?void 0:i.id)||(k=(s=F.pluginManager.getComponentConfingByType(a.type))==null?void 0:s.editConstraints)!=null&&k.immovable?"unmover-item":"draggable-item"}return(a,i)=>(e.openBlock(),e.createBlock(e.unref(G.draggable),e.mergeProps({modelValue:f.value,"onUpdate:modelValue":i[0]||(i[0]=s=>f.value=s),"item-key":"id","component-data":{type:"transition-group"},class:"epic-draggable-range"},{animation:200,group:"edit-draggable",handle:".draggable-item",ghostClass:"moveing"},{onStart:i[1]||(i[1]=s=>w(s.oldIndex)),onEnd:i[2]||(i[2]=s=>g()),onAdd:i[3]||(i[3]=s=>{w(s.newIndex),M()})}),{item:e.withCtx(({element:s,index:k})=>[(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["widget-box",l(s)]),key:k},[e.createVNode(Q,{schema:s},null,8,["schema"])],2))]),_:1},16,["modelValue"]))}}),Q=e.defineComponent({name:"ENodeItem",__name:"nodeItem",props:{schema:{},name:{}},setup(A){const R=e.useAttrs(),u=e.inject("designer"),_=e.inject("pageManager",{}),r=e.inject("pageSchema",{}),h=e.ref(null);e.provide("nodeAttrs",R);const c=A,f=e.computed(()=>{var k,n,L,T,B;const l=_.componentInstances.value,a=(k=c.schema)==null?void 0:k.id,i=F.pluginManager.getComponentConfingByType((n=c.schema)==null?void 0:n.type)??null;if(!a||!(l!=null&&l[a]))return null;if(i!=null&&i.defaultSchema.input&&((L=c.schema)==null?void 0:L.noFormItem)!==!0)return(T=l[a+"formItem"])==null?void 0:T.$el;const s=l[a];return((B=s==null?void 0:s.$el)==null?void 0:B.nodeName)==="#text"?null:s==null?void 0:s.$el});e.watch(()=>f.value,l=>{l==null||l.addEventListener("click",w,!1),l==null||l.addEventListener("mouseover",g,!1),l==null||l.addEventListener("mouseout",M,!1)}),e.onUnmounted(()=>{var l,a,i;(l=f.value)==null||l.removeEventListener("click",w,!1),(a=f.value)==null||a.removeEventListener("mouseover",g,!1),(i=f.value)==null||i.removeEventListener("mouseout",M,!1)});function w(l){l.stopPropagation(),u.setCheckedNode(c.schema)}function g(l){var a;c.schema.id!==((a=r.schemas[0])==null?void 0:a.id)&&(l.stopPropagation(),u.setHoverNode(c.schema))}function M(l){l.stopPropagation(),u.setHoverNode(null)}return(l,a)=>{var s,k;const i=e.resolveComponent("ENodeItem");return e.openBlock(),e.createBlock(e.unref(C._sfc_main),{ref_key:"nodeRef",ref:h,componentSchema:c.schema},e.createSlots({_:2},[(k=(s=e.unref(F.pluginManager).getComponentConfingByType(c.schema.type))==null?void 0:s.editConstraints)!=null&&k.childImmovable?{name:"edit-node",fn:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.schema.children,n=>(e.openBlock(),e.createBlock(i,{key:n.id,schema:n},null,8,["schema"]))),128))]),key:"0"}:{name:"edit-node",fn:e.withCtx(()=>[c.schema.children?(e.openBlock(),e.createBlock(oe,{key:0,schemas:c.schema.children,"onUpdate:schemas":a[0]||(a[0]=n=>c.schema.children=n)},null,8,["schemas"])):e.createCommentVNode("",!0)]),key:"1"}]),1032,["componentSchema"])}}}),le={class:"min-w-750px rounded h-full"},ae=e.defineComponent({__name:"previewJson",setup(A,{expose:R}){const u=F.pluginManager.getComponent("modal"),_=F.pluginManager.getComponent("monacoEditor"),r={theme:"vs-light",selectOnLineNumbers:!0,minimap:{enabled:!1},readOnly:!0},h=e.ref(null),c=e.ref(!1),f=e.inject("pageSchema");function w(){c.value=!1}function g(){c.value=!0,h.value?h.value.setValue(JSON.stringify(f,null,2)):setTimeout(()=>{g()},300)}function M(l="epic-data.json"){const a=JSON.stringify(f,null,2);var i=`data:text/json;charset=utf-8,${encodeURIComponent(a)}`,s=document.createElement("a");s.setAttribute("href",i),s.setAttribute("download",l),s.click()}return R({handleOpen:g}),(l,a)=>(e.openBlock(),e.createBlock(e.unref(u),{modelValue:c.value,"onUpdate:modelValue":a[0]||(a[0]=i=>c.value=i),title:"查看数据",class:"w-900px",width:"900px",onClose:w,onOk:M,okText:"导出数据"},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.createVNode(e.unref(_),{ref_key:"monacoEditorRef",ref:h,class:"editor h-full",autoToggleTheme:"",readOnly:"",config:r,language:"json"},null,512)])]),_:1},8,["modelValue"]))}}),se={class:"epic-edit-toolbar flex items-center justify-between px-2"},re={class:"flex-1 h-full flex items-center"},ie={key:0,class:"epic-divider"},ce=["title","onClick"],de={class:"flex-1 h-full flex items-center justify-end"},ue={key:0,class:"flex items-center ml-12px"},fe={class:"pr-8px w-82px cursor-pointer"},me={class:"epic-device h-28px items-center gap-1 rounded-md border p-2px flex"},ve=["title","onClick"],pe=e.defineComponent({__name:"toolbar",setup(A){const R=F.pluginManager.getComponent("select"),{canvasScale:u,disabledZoom:_}=C.useStore(),r=e.ref("pc"),h=e.inject("pageSchema"),c=e.inject("designer"),f=e.inject("revoke"),w=e.ref(null),g=[{icon:"icon--epic--computer-outline-rounded",title:"pc",key:"pc"}],M=e.computed(()=>[{icon:"icon--epic--trash",title:"清空",on:n},{icon:"icon--epic--undo",title:"撤销",on:s,disabled:!f.recordList.value.length,divider:!0},{icon:"icon--epic--redo",title:"重做",on:k,disabled:!f.undoList.value.length}]),l=e.ref(null),a=e.computed({get(){return`${(u.value*100).toFixed(0)}%`},set(p){const x=parseFloat(p);u.value=x/100}}),i=[{label:"60%",value:"60%"},{label:"80%",value:"80%"},{label:"100%",value:"100%"},{label:"120%",value:"120%"},{label:"140%",value:"140%"}];function s(){const p=f.undo();p&&(C.deepCompareAndModify(h.schemas,p),c.setCheckedNode(h.schemas[0]))}function k(){const p=f.redo();p&&(C.deepCompareAndModify(h.schemas,p),c.setCheckedNode(h.schemas[0]))}function n(){c.reset()}function L(p){var z;const x=(z=p.target.files)==null?void 0:z[0];if(!x)return;p.target.value=null;const v=new FileReader;v.readAsText(x),v.onload=P=>{var E;T((E=P.target)==null?void 0:E.result)}}function T(p){try{let x=JSON.parse(p??"");x.schemas||(x=C.convertKFormData(x)),C.deepCompareAndModify(h,x)}catch(x){console.error(x)}}function B(p){c.handleToggleDeviceMode(p),r.value=p;const x={pc:{},pad:{width:"780px",mode:p},mobile:{width:"390px",mode:p}};h.canvas=x[p]}return(p,x)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",se,[e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,(v,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:z},[v.divider?(e.openBlock(),e.createElementBlock("div",ie)):e.createCommentVNode("",!0),e.createElementVNode("div",{title:v.title,class:e.normalizeClass(["epic-action-item text-base h-90% px-10px flex items-center cursor-pointer",{disabled:v.disabled}]),onClick:v.on},[e.createVNode(e.unref(J._sfc_main),{name:v.icon},null,8,["name"])],10,ce)],64))),128))]),e.withDirectives(e.createElementVNode("input",{type:"file",ref_key:"fileRef",ref:l,accept:".json,.txt",onChange:L},null,544),[[e.vShow,!1]]),e.createElementVNode("div",de,[e.unref(_)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ue,[e.createElementVNode("div",fe,[e.createVNode(e.unref(R),{value:a.value,"onUpdate:value":x[0]||(x[0]=v=>a.value=v),modelValue:a.value,"onUpdate:modelValue":x[1]||(x[1]=v=>a.value=v),options:i,size:"small"},null,8,["value","modelValue"])])])),e.createElementVNode("div",me,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(g,v=>e.createElementVNode("div",{key:v.key,title:v.title,class:e.normalizeClass(["epic-device-item h-full px-1 flex items-center cursor-pointer text-base transition-colors rounded-sm",{checked:v.key===r.value}]),onClick:z=>B(v.key)},[e.createVNode(e.unref(J._sfc_main),{name:v.icon},null,8,["name"])],10,ve)),64))])])]),e.createVNode(ae,{ref_key:"previewJson",ref:w},null,512)],64))}}),he={class:"h-full flex flex-col relative"},ge=["draggable"],xe=e.defineComponent({__name:"editScreenContainer",setup(A){const R=e.inject("pageSchema"),u=e.ref(null),_=e.ref(null),r=e.ref(null),{pressSpace:h,disabledZoom:c}=C.useStore(),{handleElementDragStart:f,handleElementDrag:w,handleElementDragEnd:g}=C.useElementDrag(u),{width:M,height:l}=C.useElementSize(u),{canvasScale:a,handleZoom:i}=C.useElementZoom(_);let s=0,k=0;const n=e.ref({}),L=e.ref({}),T=e.ref({}),B=e.shallowRef({width:0,height:0});e.watchEffect(x),e.watch(T,()=>{e.nextTick(p)});function p(){r.value&&(B.value={width:r.value.clientWidth,height:r.value.clientHeight})}function x(){var E,b;T.value={width:((E=R.canvas)==null?void 0:E.width)??"0",height:((b=R.canvas)==null?void 0:b.height)??"0"}}C.watchOnce(M,v),e.watch(B,v);function v(){let E=B.value.width||s,b=B.value.height||k;n.value={width:M.value+E+"px",height:l.value+b+"px"},L.value={width:E+"px",height:b+"px"},z()}function z(){e.nextTick(()=>{var j;let E=B.value.width||s;const $=(B.value.height||k)/2,D=E/2;(j=u.value)==null||j.scrollTo(D,$)})}C.useResizeObserver(u,P),C.useResizeObserver(_,P);function P(){var b;if(!u.value)return;const E=u.value.getBoundingClientRect();if(s=E.width-60,k=E.height-80,!c.value)if(B.value.width===0)a.value=1;else{const $=(s-20)/B.value.width,D=k/(B.value.height||((b=_.value)==null?void 0:b.clientHeight)||1),j=Math.abs($-1)<Math.abs(D-1);let I=1;j?I=$:I=D,($<1||D<1)&&(I=Math.min($,D)),I<1.4&&I>.5&&(a.value=I)}C.debounce(v,50)()}return(E,b)=>(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(pe),e.createElementVNode("div",{ref_key:"editScreenContainerRef",ref:u,class:e.normalizeClass(["flex-1 overflow-auto overflow-y-hidden epic-edit-screen-container",{"cursor-grab":e.unref(h)}]),draggable:e.unref(h),onWheel:b[0]||(b[0]=(...$)=>e.unref(i)&&e.unref(i)(...$)),onDragstart:b[1]||(b[1]=(...$)=>e.unref(f)&&e.unref(f)(...$)),onDragend:b[2]||(b[2]=(...$)=>e.unref(g)&&e.unref(g)(...$)),onDrag:b[3]||(b[3]=(...$)=>e.unref(w)&&e.unref(w)(...$))},[e.createElementVNode("div",{id:"canvasContainer",class:"flex items-center justify-center",style:e.normalizeStyle(n.value)},[e.createElementVNode("div",{ref_key:"draggableElRef",ref:_,class:"transition-all"},[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none":e.unref(h)}),style:e.normalizeStyle(L.value)},[e.renderSlot(E.$slots,"default")],6)],512)],4)],42,ge),e.createElementVNode("div",{ref_key:"sizeBoxRef",ref:r,class:"absolute top-0 pointer-events-none",style:e.normalizeStyle(T.value)},null,4)]))}}),ye={class:"epic-edit-canvas"},_e=e.defineComponent({__name:"index",setup(A){const R=e.ref(null),u=e.ref(null),_=e.inject("pageSchema"),r=e.computed(()=>_.schemas[0]),h=e.computed(()=>({width:"100%",height:"100%"}));return e.onMounted(()=>{var c;(c=u.value)==null||c.handleInit(R.value)}),(c,f)=>(e.openBlock(),e.createElementBlock("section",ye,[e.createVNode(xe,null,{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"epicEditRangeRef",ref:R,class:"epic-edit-range rounded-md overflow-auto relative",style:e.normalizeStyle(h.value)},[e.createVNode(Q,{schema:r.value},null,8,["schema"]),e.createVNode(ne,{ref_key:"ePreviewWidgetsRef",ref:u},null,512)],4)]),_:1})]))}});exports.default=_e;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),F=require("./js.cookie-BH1G_HRi.cjs"),C=require("./index-C2HMY2I2.cjs"),J=require("./icon.vue_vue_type_script_setup_true_lang-DJbUD5AQ.cjs"),G=require("./vuedraggable.umd-BqhSJIAi.cjs"),ee={class:"epic-widget-action-item whitespace-nowrap"},te={key:0,class:"flex items-center"},ne=e.defineComponent({__name:"previewWidgets",setup(A,{expose:R}){const u=e.inject("pageManager",{}),_=e.inject("pageSchema"),r=e.inject("designer"),h=e.inject("designerProps"),c=e.inject("revoke"),f=e.ref(null),w=e.ref(null),g=e.ref(null),M=e.ref(!1),l=e.ref(!1),a=e.ref(!0),i=e.ref("top"),{canvasScale:s,disabledZoom:k}=C.useStore();let n=null;const L=e.computed(()=>{const t=r.state.checkedNode;return!(!(t!=null&&t.id)||h.value.lockDefaultSchemaEdit&&u.defaultComponentIds.value.includes(t==null?void 0:t.id))}),T=e.computed(()=>{var S,N,V,m,O,H;const t=u.componentInstances.value,d=(S=r.state.checkedNode)==null?void 0:S.id;if((V=(N=r.state.checkedNode)==null?void 0:N.componentProps)!=null&&V.hidden)return null;const y=F.pluginManager.getComponentConfingByType((m=r.state.checkedNode)==null?void 0:m.type)??null;if(!d||!(t!=null&&t[d]))return null;if(y!=null&&y.defaultSchema.input&&((O=r.state.checkedNode)==null?void 0:O.noFormItem)!==!0)return(H=t[d+"formItem"])==null?void 0:H.$el;const o=t[d];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}),B=e.computed(()=>{var S,N,V,m;const t=u.componentInstances.value,d=(S=r.state.hoverNode)==null?void 0:S.id,y=F.pluginManager.getComponentConfingByType((N=r.state.hoverNode)==null?void 0:N.type)??null;if(!d||!(t!=null&&t[d]))return null;if(y!=null&&y.defaultSchema.input&&((V=r.state.hoverNode)==null?void 0:V.noFormItem)!==!0)return(m=t[d+"formItem"])==null?void 0:m.$el;const o=t[d];return(o==null?void 0:o.$el.nodeName)==="#text"?null:o==null?void 0:o.$el}),{mutationObserver:p,observerConfig:x}=Z(j),{startTimedQuery:v,stopTimedQuery:z}=C.useTimedQuery(j);e.watch(()=>T.value,t=>{if(t){M.value=!0,p.observe(t,x);const d=t.parentNode;d&&(d.ondragstart=()=>{a.value=!1,v()},d.ondragend=()=>{a.value=!0,z()}),j()}else M.value=!1});const{mutationObserver:P,observerConfig:E}=Z(q);e.watch(()=>B.value,t=>{t&&(P.observe(t,E),q())});let b=0;e.watch(()=>{var t;return(t=r.state.hoverNode)==null?void 0:t.id},t=>{if(t){l.value=!0,clearTimeout(b);return}b=setTimeout(()=>{l.value=!1},300)});let $=0,D=0;function j(){const t=T.value;if(!t||!n)return;const{top:d,left:y}=n==null?void 0:n.getBoundingClientRect(),{top:o,left:S,width:N,height:V}=t.getBoundingClientRect(),m=k.value?1:s.value,O=o-d+((n==null?void 0:n.scrollTop)??0)*m,H=S-y+((n==null?void 0:n.scrollLeft)??0)*m,W=V/m;f.value&&(f.value.style.width=`${N/m}px`,f.value.style.height=`${W}px`,f.value.style.top=`${O/m}px`,f.value.style.left=`${H/m}px`,I(O,H)),g.value&&(O<45&&W<100?(g.value.style.top="",g.value.style.bottom="-30px",g.value.style["border-radius"]="0px 0px 4px 4px",i.value="bottom"):O<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"))}function I(t,d){const y=T.value;if(!n||!y)return;const o=n.getBoundingClientRect(),{width:S}=y.getBoundingClientRect(),N=k.value?1:s.value,V=t/N-o.top;let m=d/N-o.left+S/N;m<o.width&&(m=0);const O=n.scrollTop-o.height/3+60,H=n.scrollTop+o.height/3*2,W=n.scrollLeft-o.width+200,U=n.scrollLeft+o.width-200;Math.abs(V-$)<10&&Math.abs(m-D)<10||($=V,D=m,!(V>O&&V<H&&m>W&&m<U)&&(n.scrollTop=V,n.scrollLeft=m))}function q(){var W,U;const t=B.value;if(!t)return;const{top:d,left:y}=(n==null?void 0:n.getBoundingClientRect())??{top:0,left:0},{top:o,left:S,width:N,height:V}=((W=t.getBoundingClientRect)==null?void 0:W.call(t))??((U=t.nextElementSibling)==null?void 0:U.getBoundingClientRect()),m=k.value?1:s.value,O=o-d+((n==null?void 0:n.scrollTop)??0)*m,H=S-y+((n==null?void 0:n.scrollLeft)??0)*m;w.value&&(w.value.style.width=`${N/m}px`,w.value.style.height=`${V/m}px`,w.value.style.top=`${O/m}px`,w.value.style.left=`${H/m}px`)}function Z(t){const d=window.MutationObserver,y={childList:!0,attributes:!0,subtree:!0};return{mutationObserver:new d(t),observerConfig:y}}function K(){var N;const t=C.findSchemaInfoById(_.schemas,((N=r.state.checkedNode)==null?void 0:N.id)??"root");if(!t)return!1;const{list:d,schema:y,index:o}=t,S=C.generateNewSchema(y);d.splice(o+1,0,S),r.setCheckedNode(S),c.push(_.schemas,"复制组件")}function X(){var S;const t=C.findSchemaInfoById(_.schemas,((S=r.state.checkedNode)==null?void 0:S.id)??"root");if(!t)return!1;let{list:d,schema:y,index:o}=t;d.splice(o,1),o===d.length&&o--,r.setCheckedNode(d[o]),c.push(_.schemas,"删除组件")}function Y(t){n=t,n==null||n.addEventListener("scroll",()=>{j()}),C.useResizeObserver(T,j),C.useResizeObserver(B,q)}return R({handleInit:Y}),(t,d)=>{var y,o,S,N,V;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives(e.createElementVNode("div",{ref_key:"selectorRef",ref:f,class:e.normalizeClass(["epic-checked-widget absolute pointer-events-none z-20",i.value+" "+(a.value?"transition-all":"")])},[e.createElementVNode("div",{class:"epic-widget-action-box",ref_key:"actionBoxRef",ref:g},[e.createElementVNode("div",ee,e.toDisplayString((o=e.unref(F.pluginManager).getComponentConfingByType(((y=e.unref(r).state.checkedNode)==null?void 0:y.type)??""))==null?void 0:o.defaultSchema.label),1),L.value?(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("div",{title:"复制",class:"epic-widget-action-item pointer-events-auto",onClick:K},[e.createVNode(e.unref(J._sfc_main),{name:"icon--epic--copy-all-outline-rounded"})]),e.createElementVNode("div",{title:"删除",class:"epic-widget-action-item pointer-events-auto",onClick:X},[e.createVNode(e.unref(J._sfc_main),{name:"icon--epic--delete-outline-rounded"})])])):e.createCommentVNode("",!0)],512)],2),[[e.vShow,M.value&&((S=e.unref(r).state.checkedNode)==null?void 0:S.id)!=="root"]]),e.withDirectives(e.createElementVNode("div",{ref_key:"hoverWidgetRef",ref:w,class:"epic-hover-widget absolute transition-all pointer-events-none z-998"},null,512),[[e.vShow,l.value&&((N=e.unref(r).state.checkedNode)==null?void 0:N.id)!==((V=e.unref(r).state.hoverNode)==null?void 0:V.id)]])],64)}}}),oe=e.defineComponent({name:"EditNodeItem",__name:"editNodeItem",props:{schemas:{}},emits:["update:schemas"],setup(A,{emit:R}){const u=e.inject("designer"),_=e.inject("pageSchema"),r=e.inject("revoke"),h=A,c=R,f=e.computed({get(){return h.schemas},set(a){c("update:schemas",a)}});function w(a){u.setCheckedNode(f.value[a]),u.setDisableHover(!0)}function g(){u.setDisableHover(),r.push(_.schemas,"拖拽组件")}function M(){r.push(_.schemas,"插入组件")}function l(a){var i,s,k;return a.id===((i=_.schemas[0])==null?void 0:i.id)||(k=(s=F.pluginManager.getComponentConfingByType(a.type))==null?void 0:s.editConstraints)!=null&&k.immovable?"unmover-item":"draggable-item"}return(a,i)=>(e.openBlock(),e.createBlock(e.unref(G.draggable),e.mergeProps({modelValue:f.value,"onUpdate:modelValue":i[0]||(i[0]=s=>f.value=s),"item-key":"id","component-data":{type:"transition-group"},class:"epic-draggable-range"},{animation:200,group:"edit-draggable",handle:".draggable-item",ghostClass:"moveing"},{onStart:i[1]||(i[1]=s=>w(s.oldIndex)),onEnd:i[2]||(i[2]=s=>g()),onAdd:i[3]||(i[3]=s=>{w(s.newIndex),M()})}),{item:e.withCtx(({element:s,index:k})=>[(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["widget-box",l(s)]),key:k},[e.createVNode(Q,{schema:s},null,8,["schema"])],2))]),_:1},16,["modelValue"]))}}),Q=e.defineComponent({name:"ENodeItem",__name:"nodeItem",props:{schema:{},name:{}},setup(A){const R=e.useAttrs(),u=e.inject("designer"),_=e.inject("pageManager",{}),r=e.inject("pageSchema",{}),h=e.ref(null);e.provide("nodeAttrs",R);const c=A,f=e.computed(()=>{var k,n,L,T,B;const l=_.componentInstances.value,a=(k=c.schema)==null?void 0:k.id,i=F.pluginManager.getComponentConfingByType((n=c.schema)==null?void 0:n.type)??null;if(!a||!(l!=null&&l[a]))return null;if(i!=null&&i.defaultSchema.input&&((L=c.schema)==null?void 0:L.noFormItem)!==!0)return(T=l[a+"formItem"])==null?void 0:T.$el;const s=l[a];return((B=s==null?void 0:s.$el)==null?void 0:B.nodeName)==="#text"?null:s==null?void 0:s.$el});e.watch(()=>f.value,l=>{l==null||l.addEventListener("click",w,!1),l==null||l.addEventListener("mouseover",g,!1),l==null||l.addEventListener("mouseout",M,!1)}),e.onUnmounted(()=>{var l,a,i;(l=f.value)==null||l.removeEventListener("click",w,!1),(a=f.value)==null||a.removeEventListener("mouseover",g,!1),(i=f.value)==null||i.removeEventListener("mouseout",M,!1)});function w(l){l.stopPropagation(),u.setCheckedNode(c.schema)}function g(l){var a;c.schema.id!==((a=r.schemas[0])==null?void 0:a.id)&&(l.stopPropagation(),u.setHoverNode(c.schema))}function M(l){l.stopPropagation(),u.setHoverNode(null)}return(l,a)=>{var s,k;const i=e.resolveComponent("ENodeItem");return e.openBlock(),e.createBlock(e.unref(C._sfc_main),{ref_key:"nodeRef",ref:h,componentSchema:c.schema},e.createSlots({_:2},[(k=(s=e.unref(F.pluginManager).getComponentConfingByType(c.schema.type))==null?void 0:s.editConstraints)!=null&&k.childImmovable?{name:"edit-node",fn:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.schema.children,n=>(e.openBlock(),e.createBlock(i,{key:n.id,schema:n},null,8,["schema"]))),128))]),key:"0"}:{name:"edit-node",fn:e.withCtx(()=>[c.schema.children?(e.openBlock(),e.createBlock(oe,{key:0,schemas:c.schema.children,"onUpdate:schemas":a[0]||(a[0]=n=>c.schema.children=n)},null,8,["schemas"])):e.createCommentVNode("",!0)]),key:"1"}]),1032,["componentSchema"])}}}),le={class:"min-w-750px rounded h-full"},ae=e.defineComponent({__name:"previewJson",setup(A,{expose:R}){const u=F.pluginManager.getComponent("modal"),_=F.pluginManager.getComponent("monacoEditor"),r={theme:"vs-light",selectOnLineNumbers:!0,minimap:{enabled:!1},readOnly:!0},h=e.ref(null),c=e.ref(!1),f=e.inject("pageSchema");function w(){c.value=!1}function g(){c.value=!0,h.value?h.value.setValue(JSON.stringify(f,null,2)):setTimeout(()=>{g()},300)}function M(l="epic-data.json"){const a=JSON.stringify(f,null,2);var i=`data:text/json;charset=utf-8,${encodeURIComponent(a)}`,s=document.createElement("a");s.setAttribute("href",i),s.setAttribute("download",l),s.click()}return R({handleOpen:g}),(l,a)=>(e.openBlock(),e.createBlock(e.unref(u),{modelValue:c.value,"onUpdate:modelValue":a[0]||(a[0]=i=>c.value=i),title:"查看数据",class:"w-900px",width:"900px",onClose:w,onOk:M,okText:"导出数据"},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.createVNode(e.unref(_),{ref_key:"monacoEditorRef",ref:h,class:"editor h-full",autoToggleTheme:"",readOnly:"",config:r,language:"json"},null,512)])]),_:1},8,["modelValue"]))}}),se={class:"epic-edit-toolbar flex items-center justify-between px-2"},re={class:"flex-1 h-full flex items-center"},ie={key:0,class:"epic-divider"},ce=["title","onClick"],de={class:"flex-1 h-full flex items-center justify-end"},ue={key:0,class:"flex items-center ml-12px"},fe={class:"pr-8px w-82px cursor-pointer"},me={class:"epic-device h-28px items-center gap-1 rounded-md border p-2px flex"},ve=["title","onClick"],pe=e.defineComponent({__name:"toolbar",setup(A){const R=F.pluginManager.getComponent("select"),{canvasScale:u,disabledZoom:_}=C.useStore(),r=e.ref("pc"),h=e.inject("pageSchema"),c=e.inject("designer"),f=e.inject("revoke"),w=e.ref(null),g=[{icon:"icon--epic--computer-outline-rounded",title:"pc",key:"pc"}],M=e.computed(()=>[{icon:"icon--epic--trash",title:"清空",on:n},{icon:"icon--epic--undo",title:"撤销",on:s,disabled:!f.recordList.value.length,divider:!0},{icon:"icon--epic--redo",title:"重做",on:k,disabled:!f.undoList.value.length}]),l=e.ref(null),a=e.computed({get(){return`${(u.value*100).toFixed(0)}%`},set(p){const x=parseFloat(p);u.value=x/100}}),i=[{label:"60%",value:"60%"},{label:"80%",value:"80%"},{label:"100%",value:"100%"},{label:"120%",value:"120%"},{label:"140%",value:"140%"}];function s(){const p=f.undo();p&&(C.deepCompareAndModify(h.schemas,p),c.setCheckedNode(h.schemas[0]))}function k(){const p=f.redo();p&&(C.deepCompareAndModify(h.schemas,p),c.setCheckedNode(h.schemas[0]))}function n(){c.reset()}function L(p){var z;const x=(z=p.target.files)==null?void 0:z[0];if(!x)return;p.target.value=null;const v=new FileReader;v.readAsText(x),v.onload=P=>{var E;T((E=P.target)==null?void 0:E.result)}}function T(p){try{let x=JSON.parse(p??"");x.schemas||(x=C.convertKFormData(x)),C.deepCompareAndModify(h,x)}catch(x){console.error(x)}}function B(p){c.handleToggleDeviceMode(p),r.value=p;const x={pc:{},pad:{width:"780px",mode:p},mobile:{width:"390px",mode:p}};h.canvas=x[p]}return(p,x)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",se,[e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,(v,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:z},[v.divider?(e.openBlock(),e.createElementBlock("div",ie)):e.createCommentVNode("",!0),e.createElementVNode("div",{title:v.title,class:e.normalizeClass(["epic-action-item text-base h-90% px-10px flex items-center cursor-pointer",{disabled:v.disabled}]),onClick:v.on},[e.createVNode(e.unref(J._sfc_main),{name:v.icon},null,8,["name"])],10,ce)],64))),128))]),e.withDirectives(e.createElementVNode("input",{type:"file",ref_key:"fileRef",ref:l,accept:".json,.txt",onChange:L},null,544),[[e.vShow,!1]]),e.createElementVNode("div",de,[e.unref(_)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ue,[e.createElementVNode("div",fe,[e.createVNode(e.unref(R),{value:a.value,"onUpdate:value":x[0]||(x[0]=v=>a.value=v),modelValue:a.value,"onUpdate:modelValue":x[1]||(x[1]=v=>a.value=v),options:i,size:"small"},null,8,["value","modelValue"])])])),e.createElementVNode("div",me,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(g,v=>e.createElementVNode("div",{key:v.key,title:v.title,class:e.normalizeClass(["epic-device-item h-full px-1 flex items-center cursor-pointer text-base transition-colors rounded-sm",{checked:v.key===r.value}]),onClick:z=>B(v.key)},[e.createVNode(e.unref(J._sfc_main),{name:v.icon},null,8,["name"])],10,ve)),64))])])]),e.createVNode(ae,{ref_key:"previewJson",ref:w},null,512)],64))}}),he={class:"h-full flex flex-col relative"},ge=["draggable"],xe=e.defineComponent({__name:"editScreenContainer",setup(A){const R=e.inject("pageSchema"),u=e.ref(null),_=e.ref(null),r=e.ref(null),{pressSpace:h,disabledZoom:c}=C.useStore(),{handleElementDragStart:f,handleElementDrag:w,handleElementDragEnd:g}=C.useElementDrag(u),{width:M,height:l}=C.useElementSize(u),{canvasScale:a,handleZoom:i}=C.useElementZoom(_);let s=0,k=0;const n=e.ref({}),L=e.ref({}),T=e.ref({}),B=e.shallowRef({width:0,height:0});e.watchEffect(x),e.watch(T,()=>{e.nextTick(p)});function p(){r.value&&(B.value={width:r.value.clientWidth,height:r.value.clientHeight})}function x(){var E,b;T.value={width:((E=R.canvas)==null?void 0:E.width)??"0",height:((b=R.canvas)==null?void 0:b.height)??"0"}}C.watchOnce(M,v),e.watch(B,v);function v(){let E=B.value.width||s,b=B.value.height||k;n.value={width:M.value+E+"px",height:l.value+b+"px"},L.value={width:E+"px",height:b+"px"},z()}function z(){e.nextTick(()=>{var j;let E=B.value.width||s;const $=(B.value.height||k)/2,D=E/2;(j=u.value)==null||j.scrollTo(D,$)})}C.useResizeObserver(u,P),C.useResizeObserver(_,P);function P(){var b;if(!u.value)return;const E=u.value.getBoundingClientRect();if(s=E.width-60,k=E.height-80,!c.value)if(B.value.width===0)a.value=1;else{const $=(s-20)/B.value.width,D=k/(B.value.height||((b=_.value)==null?void 0:b.clientHeight)||1),j=Math.abs($-1)<Math.abs(D-1);let I=1;j?I=$:I=D,($<1||D<1)&&(I=Math.min($,D)),I<1.4&&I>.5&&(a.value=I)}C.debounce(v,50)()}return(E,b)=>(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(pe),e.createElementVNode("div",{ref_key:"editScreenContainerRef",ref:u,class:e.normalizeClass(["flex-1 overflow-auto overflow-y-hidden epic-edit-screen-container",{"cursor-grab":e.unref(h)}]),draggable:e.unref(h),onWheel:b[0]||(b[0]=(...$)=>e.unref(i)&&e.unref(i)(...$)),onDragstart:b[1]||(b[1]=(...$)=>e.unref(f)&&e.unref(f)(...$)),onDragend:b[2]||(b[2]=(...$)=>e.unref(g)&&e.unref(g)(...$)),onDrag:b[3]||(b[3]=(...$)=>e.unref(w)&&e.unref(w)(...$))},[e.createElementVNode("div",{id:"canvasContainer",class:"flex items-center justify-center",style:e.normalizeStyle(n.value)},[e.createElementVNode("div",{ref_key:"draggableElRef",ref:_,class:"transition-all"},[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none":e.unref(h)}),style:e.normalizeStyle(L.value)},[e.renderSlot(E.$slots,"default")],6)],512)],4)],42,ge),e.createElementVNode("div",{ref_key:"sizeBoxRef",ref:r,class:"absolute top-0 pointer-events-none",style:e.normalizeStyle(T.value)},null,4)]))}}),ye={class:"epic-edit-canvas"},_e=e.defineComponent({__name:"index",setup(A){const R=e.ref(null),u=e.ref(null),_=e.inject("pageSchema"),r=e.computed(()=>_.schemas[0]),h=e.computed(()=>({width:"100%",height:"100%"}));return e.onMounted(()=>{var c;(c=u.value)==null||c.handleInit(R.value)}),(c,f)=>(e.openBlock(),e.createElementBlock("section",ye,[e.createVNode(xe,null,{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"epicEditRangeRef",ref:R,class:"epic-edit-range rounded-md overflow-auto relative",style:e.normalizeStyle(h.value)},[e.createVNode(Q,{schema:r.value},null,8,["schema"]),e.createVNode(ne,{ref_key:"ePreviewWidgetsRef",ref:u},null,512)],4)]),_:1})]))}});exports.default=_e;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C2HMY2I2.cjs"),a=require("./js.cookie-BH1G_HRi.cjs");exports.EBuilder=e._sfc_main$1;exports.EDesigner=e._sfc_main$2;exports.ENode=e._sfc_main;exports.capitalizeFirstLetter=e.capitalizeFirstLetter;exports.convertKFormData=e.convertKFormData;exports.debounce=e.debounce;exports.deepClone=e.deepClone;exports.deepCompareAndModify=e.deepCompareAndModify;exports.deepEqual=e.deepEqual;exports.findSchemaById=e.findSchemaById;exports.findSchemaInfoById=e.findSchemaInfoById;exports.findSchemas=e.findSchemas;exports.generateNewSchema=e.generateNewSchema;exports.getDarkState=e.getDarkState;exports.getFormFields=e.getFormFields;exports.getFormSchemas=e.getFormSchemas;exports.getMatchedById=e.getMatchedById;exports.getUUID=e.getUUID;exports.getValueByPath=e.getValueByPath;exports.initStore=e.initStore;exports.mapSchemas=e.mapSchemas;exports.recursionConvertedNode=e.recursionConvertedNode;exports.setValueByPath=e.setValueByPath;exports.useDark=e.useDark;exports.useElementDrag=e.useElementDrag;exports.useElementZoom=e.useElementZoom;exports.useKeyPress=e.useKeyPress;exports.usePageManager=e.usePageManager;exports.useRevoke=e.useRevoke;exports.useStore=e.useStore;exports.useTheme=e.useTheme;exports.useTimedQuery=e.useTimedQuery;exports.EventBus=a.EventBus;exports.PluginManager=a.PluginManager;exports.loadAsyncComponent=a.loadAsyncComponent;exports.pluginManager=a.pluginManager;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as s, r as t, _ as r, E as o, c as n, j as d, m, d as u, x as i, l as g, f as l, B as c, g as p, H as h, z as y, A as E, y as S, k as f, o as B, I as D, C as F, D as I, s as P, G as v, e as C, i as M, F as k, t as x, v as A, u as N, p as q, a as z } from "./index-
|
|
1
|
+
import { q as s, r as t, _ as r, E as o, c as n, j as d, m, d as u, x as i, l as g, f as l, B as c, g as p, H as h, z as y, A as E, y as S, k as f, o as B, I as D, C as F, D as I, s as P, G as v, e as C, i as M, F as k, t as x, v as A, u as N, p as q, a as z } from "./index-DNuLy9hB.js";
|
|
2
2
|
import { E as T, P as U, l as V, p as b } from "./js.cookie-oHpRFPCO.js";
|
|
3
3
|
export {
|
|
4
4
|
s as EBuilder,
|