epic-designer-gold 0.0.8 → 0.0.10
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-DYltJe-a.cjs → attributeView-DU2TCl82.cjs} +1 -1
- package/dist/{attributeView-Dk2EmHZW.js → attributeView-u87puklW.js} +1 -1
- package/dist/{eventView-Ba0hP27z.js → eventView-3jlgsbYv.js} +1 -1
- package/dist/{eventView-BoaACVjO.cjs → eventView-DlM9PXFS.cjs} +1 -1
- package/dist/{index-DF9HRIW0.js → index-B44ldwiI.js} +8 -8
- package/dist/{index-DDJ5D8mV.js → index-BTe6WMoJ.js} +1 -1
- package/dist/index-BZ70tu0m.cjs +1 -0
- package/dist/{index-BeuOcsj8.cjs → index-Bhd9Utr6.cjs} +1 -1
- package/dist/index-Bk1B4RlV.cjs +1 -0
- package/dist/index-BxQ1aSj3.js +215 -0
- package/dist/{index-BVhjDWdX.cjs → index-C9dq3Qx9.cjs} +1 -1
- package/dist/{index-NhfJlz-p.cjs → index-CFryUxKc.cjs} +2 -2
- package/dist/{index-CZVWdeNF.cjs → index-CT6Df8VO.cjs} +1 -1
- package/dist/{index-DHblJXI8.js → index-CYPhbix8.js} +1 -1
- package/dist/{index-MEVHj2X7.cjs → index-CZeYVxo4.cjs} +1 -1
- package/dist/index-CgVTdX64.js +4 -0
- package/dist/{index-YpOtOenY.cjs → index-Cx2JsRRr.cjs} +1 -1
- package/dist/{index-J_nNkP8R.js → index-D6CL7QdF.js} +1 -1
- package/dist/{index-CFXmvMyl.js → index-DZxe3Mh2.js} +1 -1
- package/dist/{index-B70ZM-RH.js → index-DwxSF-EA.js} +1 -1
- package/dist/{index-CZaokqYw.js → index-FHuEonxg.js} +215 -193
- package/dist/{index-Bnxp-82r.js → index-GG-x1fxs.js} +1 -1
- package/dist/{index-BY7CyvD0.cjs → index-KbBptC7N.cjs} +1 -1
- package/dist/{index-B0o9Uauj.cjs → index-TLhJz2ch.cjs} +1 -1
- package/dist/{index-CsXf1tm6.js → index-r1WNNgF-.js} +1 -1
- package/dist/{index-DVWvjN5E.cjs → index-xDLPhT_Q.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{styleView-AFQHYzcB.cjs → styleView-C7t4u5ue.cjs} +1 -1
- package/dist/{styleView-t3KSRoDD.js → styleView-wqJjZQTl.js} +1 -1
- package/package.json +1 -1
- package/dist/index-BeWY4egz.js +0 -4
- package/dist/index-CmtFrV57.cjs +0 -1
- package/dist/index-D0L7sZbE.cjs +0 -1
- package/dist/index-Khkd8Z00.js +0 -205
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("./pluginManager-itCTrGag.cjs"),v=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("./pluginManager-itCTrGag.cjs"),v=require("./index-CFryUxKc.cjs"),k=require("./icon.vue_vue_type_script_setup_true_lang-DJbUD5AQ.cjs"),V={key:0,class:"epic-del-btn"},g=["onClick"],f=e.defineComponent({__name:"index",props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(c,{emit:r}){const u=_.pluginManager.getComponent("number"),s=c,d=r,o=e.computed({get(){return s.modelValue},set(n){d("update:modelValue",n)}});function p(){const n={type:"col",children:[],componentProps:{span:12},id:v.getUUID()};o.value.push(n)}function i(n){o.value=o.value.filter((m,t)=>n!==t)}return(n,m)=>(e.openBlock(),e.createElementBlock("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(t,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,class:"EColEditor-item"},[e.createVNode(e.unref(u),{value:t.componentProps.span,"onUpdate:value":l=>t.componentProps.span=l,modelValue:t.componentProps.span,"onUpdate:modelValue":l=>t.componentProps.span=l,style:{width:"100%"},min:1,max:24},null,8,["value","onUpdate:value","modelValue","onUpdate:modelValue"]),o.value.length>1?(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("span",{onClick:l=>i(a)},[e.createVNode(e.unref(k._sfc_main),{name:"icon-shanchu1"})],8,g)])):e.createCommentVNode("",!0)]))),128)),e.createElementVNode("div",{class:"add-btn",onClick:p}," 添加 ")]))}});exports.default=f;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as U, inject as L, openBlock as p, createElementBlock as g, Fragment as A, renderList as T, createElementVNode as i, toDisplayString as O, createVNode as C, unref as _, withCtx as R, createCommentVNode as G, createTextVNode as J, ref as E, computed as S, withDirectives as F, normalizeClass as j, vShow as P, reactive as H, createBlock as K, nextTick as Q, toRaw as z, watch as W } from "vue";
|
|
2
|
-
import { l as q, _ as X, k as Y, m as Z } from "./index-
|
|
2
|
+
import { l as q, _ as X, k as Y, m as Z } from "./index-B44ldwiI.js";
|
|
3
3
|
import { p as w } from "./pluginManager-D8PM7ICc.js";
|
|
4
4
|
import { _ as D } from "./icon.vue_vue_type_script_setup_true_lang-D3QdcReY.js";
|
|
5
5
|
import { d as ee } from "./vuedraggable.umd-D2S7Eo7p.js";
|
|
@@ -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-CFryUxKc.cjs");exports.default=e._sfc_main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),H=require("./pluginManager-itCTrGag.cjs"),C=require("./index-NhfJlz-p.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(F,{expose:M}){const f=e.inject("pageManager",{}),k=e.inject("pageSchema"),s=e.inject("designer"),g=e.inject("designerProps"),c=e.inject("revoke"),p=e.ref(null),S=e.ref(null),x=e.ref(null),R=e.ref(!1),l=e.ref(!1),a=e.ref(!0),i=e.ref("top"),{canvasScale:r,disabledZoom:b}=C.useStore();let n=null;const L=e.computed(()=>{const t=s.state.checkedNode;return!(!(t!=null&&t.id)||g.value.lockDefaultSchemaEdit&&f.defaultComponentIds.value.includes(t==null?void 0:t.id))}),T=e.computed(()=>{var B,V,$,m,O,D;const t=f.componentInstances.value,u=(B=s.state.checkedNode)==null?void 0:B.id;if(($=(V=s.state.checkedNode)==null?void 0:V.componentProps)!=null&&$.hidden)return null;const _=H.pluginManager.getComponentConfingByType((m=s.state.checkedNode)==null?void 0:m.type)??null;if(!u||!(t!=null&&t[u]))return null;if(_!=null&&_.defaultSchema.input&&((O=s.state.checkedNode)==null?void 0:O.noFormItem)!==!0)return(D=t[u+"formItem"])==null?void 0:D.$el;const o=t[u];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}),E=e.computed(()=>{var B,V,$,m;const t=f.componentInstances.value,u=(B=s.state.hoverNode)==null?void 0:B.id,_=H.pluginManager.getComponentConfingByType((V=s.state.hoverNode)==null?void 0:V.type)??null;if(!u||!(t!=null&&t[u]))return null;if(_!=null&&_.defaultSchema.input&&(($=s.state.hoverNode)==null?void 0:$.noFormItem)!==!0)return(m=t[u+"formItem"])==null?void 0:m.$el;const o=t[u];return(o==null?void 0:o.$el.nodeName)==="#text"?null:o==null?void 0:o.$el}),{mutationObserver:P,observerConfig:W}=Z(j),{startTimedQuery:d,stopTimedQuery:y}=C.useTimedQuery(j);e.watch(()=>T.value,t=>{if(t){R.value=!0,P.observe(t,W);const u=t.parentNode;u&&(u.ondragstart=()=>{a.value=!1,d()},u.ondragend=()=>{a.value=!0,y()}),j()}else R.value=!1});const{mutationObserver:v,observerConfig:w}=Z(q);e.watch(()=>E.value,t=>{t&&(v.observe(t,w),q())});let h=0;e.watch(()=>{var t;return(t=s.state.hoverNode)==null?void 0:t.id},t=>{if(t){l.value=!0,clearTimeout(h);return}h=setTimeout(()=>{l.value=!1},300)});let N=0,z=0;function j(){const t=T.value;if(!t||!n)return;const{top:u,left:_}=n==null?void 0:n.getBoundingClientRect(),{top:o,left:B,width:V,height:$}=t.getBoundingClientRect(),m=b.value?1:r.value,O=o-u+((n==null?void 0:n.scrollTop)??0)*m,D=B-_+((n==null?void 0:n.scrollLeft)??0)*m,I=$/m;p.value&&(p.value.style.width=`${V/m}px`,p.value.style.height=`${I}px`,p.value.style.top=`${O/m}px`,p.value.style.left=`${D/m}px`,A(O,D)),x.value&&(O<45&&I<100?(x.value.style.top="",x.value.style.bottom="-30px",x.value.style["border-radius"]="0px 0px 4px 4px",i.value="bottom"):O<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"))}function A(t,u){const _=T.value;if(!n||!_)return;const o=n.getBoundingClientRect(),{width:B}=_.getBoundingClientRect(),V=b.value?1:r.value,$=t/V-o.top;let m=u/V-o.left+B/V;m<o.width&&(m=0);const O=n.scrollTop-o.height/3+60,D=n.scrollTop+o.height/3*2,I=n.scrollLeft-o.width+200,U=n.scrollLeft+o.width-200;Math.abs($-N)<10&&Math.abs(m-z)<10||(N=$,z=m,!($>O&&$<D&&m>I&&m<U)&&(n.scrollTop=$,n.scrollLeft=m))}function q(){var I,U;const t=E.value;if(!t)return;const{top:u,left:_}=(n==null?void 0:n.getBoundingClientRect())??{top:0,left:0},{top:o,left:B,width:V,height:$}=((I=t.getBoundingClientRect)==null?void 0:I.call(t))??((U=t.nextElementSibling)==null?void 0:U.getBoundingClientRect()),m=b.value?1:r.value,O=o-u+((n==null?void 0:n.scrollTop)??0)*m,D=B-_+((n==null?void 0:n.scrollLeft)??0)*m;S.value&&(S.value.style.width=`${V/m}px`,S.value.style.height=`${$/m}px`,S.value.style.top=`${O/m}px`,S.value.style.left=`${D/m}px`)}function Z(t){const u=window.MutationObserver,_={childList:!0,attributes:!0,subtree:!0};return{mutationObserver:new u(t),observerConfig:_}}function K(){var V;const t=C.findSchemaInfoById(k.schemas,((V=s.state.checkedNode)==null?void 0:V.id)??"root");if(!t)return!1;const{list:u,schema:_,index:o}=t,B=C.generateNewSchema(_);u.splice(o+1,0,B),s.setCheckedNode(B),c.push(k.schemas,"复制组件")}function X(){var B;const t=C.findSchemaInfoById(k.schemas,((B=s.state.checkedNode)==null?void 0:B.id)??"root");if(!t)return!1;let{list:u,schema:_,index:o}=t;u.splice(o,1),o===u.length&&o--,s.setCheckedNode(u[o]),c.push(k.schemas,"删除组件")}function Y(t){n=t,n==null||n.addEventListener("scroll",()=>{j()}),C.useResizeObserver(T,j),C.useResizeObserver(E,q)}return M({handleInit:Y}),(t,u)=>{var _,o,B,V,$;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives(e.createElementVNode("div",{ref_key:"selectorRef",ref:p,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:x},[e.createElementVNode("div",ee,e.toDisplayString((o=e.unref(H.pluginManager).getComponentConfingByType(((_=e.unref(s).state.checkedNode)==null?void 0:_.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,R.value&&((B=e.unref(s).state.checkedNode)==null?void 0:B.id)!=="root"]]),e.withDirectives(e.createElementVNode("div",{ref_key:"hoverWidgetRef",ref:S,class:"epic-hover-widget absolute transition-all pointer-events-none z-998"},null,512),[[e.vShow,l.value&&((V=e.unref(s).state.checkedNode)==null?void 0:V.id)!==(($=e.unref(s).state.hoverNode)==null?void 0:$.id)]])],64)}}}),oe=e.defineComponent({name:"EditNodeItem",__name:"editNodeItem",props:{schemas:{}},emits:["update:schemas"],setup(F,{emit:M}){const f=e.inject("designer"),k=e.inject("pageSchema"),s=e.inject("revoke"),g=F,c=M,p=e.computed({get(){return g.schemas},set(a){c("update:schemas",a)}});function S(a){f.setCheckedNode(p.value[a]),f.setDisableHover(!0)}function x(){f.setDisableHover(),s.push(k.schemas,"拖拽组件")}function R(){s.push(k.schemas,"插入组件")}function l(a){var i,r,b;return a.id===((i=k.schemas[0])==null?void 0:i.id)||(b=(r=H.pluginManager.getComponentConfingByType(a.type))==null?void 0:r.editConstraints)!=null&&b.immovable?"unmover-item":"draggable-item"}return(a,i)=>(e.openBlock(),e.createBlock(e.unref(G.draggable),e.mergeProps({modelValue:p.value,"onUpdate:modelValue":i[0]||(i[0]=r=>p.value=r),"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]=r=>S(r.oldIndex)),onEnd:i[2]||(i[2]=r=>x()),onAdd:i[3]||(i[3]=r=>{S(r.newIndex),R()})}),{item:e.withCtx(({element:r,index:b})=>[(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["widget-box",l(r)]),key:b},[e.createVNode(Q,{schema:r},null,8,["schema"])],2))]),_:1},16,["modelValue"]))}}),Q=e.defineComponent({name:"ENodeItem",__name:"nodeItem",props:{schema:{},name:{}},setup(F){const M=e.useAttrs(),f=e.inject("designer"),k=e.inject("pageManager",{}),s=e.inject("pageSchema",{}),g=e.ref(null);e.provide("nodeAttrs",M);const c=F,p=e.computed(()=>{var b,n,L,T,E;const l=k.componentInstances.value,a=(b=c.schema)==null?void 0:b.id,i=H.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 r=l[a];return((E=r==null?void 0:r.$el)==null?void 0:E.nodeName)==="#text"?null:r==null?void 0:r.$el});e.watch(()=>p.value,l=>{l==null||l.addEventListener("click",S,!1),l==null||l.addEventListener("mouseover",x,!1),l==null||l.addEventListener("mouseout",R,!1)}),e.onUnmounted(()=>{var l,a,i;(l=p.value)==null||l.removeEventListener("click",S,!1),(a=p.value)==null||a.removeEventListener("mouseover",x,!1),(i=p.value)==null||i.removeEventListener("mouseout",R,!1)});function S(l){l.stopPropagation(),f.setCheckedNode(c.schema)}function x(l){var a;c.schema.id!==((a=s.schemas[0])==null?void 0:a.id)&&(l.stopPropagation(),f.setHoverNode(c.schema))}function R(l){l.stopPropagation(),f.setHoverNode(null)}return(l,a)=>{var r,b;const i=e.resolveComponent("ENodeItem");return e.openBlock(),e.createBlock(e.unref(C._sfc_main),{ref_key:"nodeRef",ref:g,componentSchema:c.schema},e.createSlots({_:2},[(b=(r=e.unref(H.pluginManager).getComponentConfingByType(c.schema.type))==null?void 0:r.editConstraints)!=null&&b.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(F,{expose:M}){const f=H.pluginManager.getComponent("modal"),k=H.pluginManager.getComponent("monacoEditor"),s={theme:"vs-light",selectOnLineNumbers:!0,minimap:{enabled:!1},readOnly:!0},g=e.ref(null),c=e.ref(!1),p=e.inject("pageSchema");function S(){c.value=!1}function x(){c.value=!0,g.value?g.value.setValue(JSON.stringify(p,null,2)):setTimeout(()=>{x()},300)}function R(l="epic-data.json"){const a=JSON.stringify(p,null,2);var i=`data:text/json;charset=utf-8,${encodeURIComponent(a)}`,r=document.createElement("a");r.setAttribute("href",i),r.setAttribute("download",l),r.click()}return M({handleOpen:x}),(l,a)=>(e.openBlock(),e.createBlock(e.unref(f),{modelValue:c.value,"onUpdate:modelValue":a[0]||(a[0]=i=>c.value=i),title:"查看数据",class:"w-900px",width:"900px",onClose:S,onOk:R,okText:"导出数据"},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.createVNode(e.unref(k),{ref_key:"monacoEditorRef",ref:g,class:"editor h-full",autoToggleTheme:"",readOnly:"",config:s,language:"json"},null,512)])]),_:1},8,["modelValue"]))}}),re={class:"epic-edit-toolbar flex items-center justify-between px-2"},se={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"},pe={class:"epic-device h-28px items-center gap-1 rounded-md border p-2px flex"},me=["title","onClick"],ve=e.defineComponent({__name:"toolbar",setup(F){const M=H.pluginManager.getComponent("select"),{canvasScale:f,disabledZoom:k}=C.useStore(),s=e.ref("pc"),g=e.inject("pageSchema"),c=e.inject("designer"),p=e.inject("revoke"),S=e.ref(null),x=[{icon:"icon--epic--computer-outline-rounded",title:"pc",key:"pc"},{icon:"icon--epic--tablet-android-outline-rounded",title:"平板",key:"pad"},{icon:"icon--epic--phone-iphone-outline-sharp",title:"手机",key:"mobile"}],R=e.computed(()=>[{icon:"icon--epic--code",title:"查看数据",on:()=>L()},{icon:"icon--epic--exit-to-app-rounded",title:"导入数据",on:T},{icon:"icon--epic--trash",title:"清空",on:n},{icon:"icon--epic--undo",title:"撤销",on:r,disabled:!p.recordList.value.length,divider:!0},{icon:"icon--epic--redo",title:"重做",on:b,disabled:!p.undoList.value.length}]),l=e.ref(null),a=e.computed({get(){return`${(f.value*100).toFixed(0)}%`},set(d){const y=parseFloat(d);f.value=y/100}}),i=[{label:"60%",value:"60%"},{label:"80%",value:"80%"},{label:"100%",value:"100%"},{label:"120%",value:"120%"},{label:"140%",value:"140%"}];function r(){const d=p.undo();d&&(C.deepCompareAndModify(g.schemas,d),c.setCheckedNode(g.schemas[0]))}function b(){const d=p.redo();d&&(C.deepCompareAndModify(g.schemas,d),c.setCheckedNode(g.schemas[0]))}function n(){c.reset()}function L(){S.value.handleOpen()}function T(){var d;(d=l.value)==null||d.click()}function E(d){var w;const y=(w=d.target.files)==null?void 0:w[0];if(!y)return;d.target.value=null;const v=new FileReader;v.readAsText(y),v.onload=h=>{var N;P((N=h.target)==null?void 0:N.result)}}function P(d){try{let y=JSON.parse(d??"");y.schemas||(y=C.convertKFormData(y)),C.deepCompareAndModify(g,y)}catch(y){console.error(y)}}function W(d){c.handleToggleDeviceMode(d),s.value=d;const y={pc:{},pad:{width:"780px",mode:d},mobile:{width:"390px",mode:d}};g.canvas=y[d]}return(d,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",re,[e.createElementVNode("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,(v,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w},[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:E},null,544),[[e.vShow,!1]]),e.createElementVNode("div",de,[e.unref(k)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ue,[e.createElementVNode("div",fe,[e.createVNode(e.unref(M),{value:a.value,"onUpdate:value":y[0]||(y[0]=v=>a.value=v),modelValue:a.value,"onUpdate:modelValue":y[1]||(y[1]=v=>a.value=v),options:i,size:"small"},null,8,["value","modelValue"])])])),e.createElementVNode("div",pe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(x,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===s.value}]),onClick:w=>W(v.key)},[e.createVNode(e.unref(J._sfc_main),{name:v.icon},null,8,["name"])],10,me)),64))])])]),e.createVNode(ae,{ref_key:"previewJson",ref:S},null,512)],64))}}),he={class:"h-full flex flex-col relative"},ge=["draggable"],xe=e.defineComponent({__name:"editScreenContainer",setup(F){const M=e.inject("pageSchema"),f=e.ref(null),k=e.ref(null),s=e.ref(null),{pressSpace:g,disabledZoom:c}=C.useStore(),{handleElementDragStart:p,handleElementDrag:S,handleElementDragEnd:x}=C.useElementDrag(f),{width:R,height:l}=C.useElementSize(f),{canvasScale:a,handleZoom:i}=C.useElementZoom(k);let r=0,b=0;const n=e.ref({}),L=e.ref({}),T=e.ref({}),E=e.shallowRef({width:0,height:0});e.watchEffect(W),e.watch(T,()=>{e.nextTick(P)});function P(){s.value&&(E.value={width:s.value.clientWidth,height:s.value.clientHeight})}function W(){var w,h;T.value={width:((w=M.canvas)==null?void 0:w.width)??"0",height:((h=M.canvas)==null?void 0:h.height)??"0"}}C.watchOnce(R,d),e.watch(E,d);function d(){let w=E.value.width||r,h=E.value.height||b;n.value={width:R.value+w+"px",height:l.value+h+"px"},L.value={width:w+"px",height:h+"px"},y()}function y(){e.nextTick(()=>{var j;let w=E.value.width||r;const N=(E.value.height||b)/2,z=w/2;(j=f.value)==null||j.scrollTo(z,N)})}C.useResizeObserver(f,v),C.useResizeObserver(k,v);function v(){var h;if(!f.value)return;const w=f.value.getBoundingClientRect();if(r=w.width-60,b=w.height-80,!c.value)if(E.value.width===0)a.value=1;else{const N=(r-20)/E.value.width,z=b/(E.value.height||((h=k.value)==null?void 0:h.clientHeight)||1),j=Math.abs(N-1)<Math.abs(z-1);let A=1;j?A=N:A=z,(N<1||z<1)&&(A=Math.min(N,z)),A<1.4&&A>.5&&(a.value=A)}C.debounce(d,50)()}return(w,h)=>(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(ve),e.createElementVNode("div",{ref_key:"editScreenContainerRef",ref:f,class:e.normalizeClass(["flex-1 overflow-auto overflow-y-hidden epic-edit-screen-container",{"cursor-grab":e.unref(g)}]),draggable:e.unref(g),onWheel:h[0]||(h[0]=(...N)=>e.unref(i)&&e.unref(i)(...N)),onDragstart:h[1]||(h[1]=(...N)=>e.unref(p)&&e.unref(p)(...N)),onDragend:h[2]||(h[2]=(...N)=>e.unref(x)&&e.unref(x)(...N)),onDrag:h[3]||(h[3]=(...N)=>e.unref(S)&&e.unref(S)(...N))},[e.createElementVNode("div",{id:"canvasContainer",class:"flex items-center justify-center",style:e.normalizeStyle(n.value)},[e.createElementVNode("div",{ref_key:"draggableElRef",ref:k,class:"transition-all"},[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none":e.unref(g)}),style:e.normalizeStyle(L.value)},[e.renderSlot(w.$slots,"default")],6)],512)],4)],42,ge),e.createElementVNode("div",{ref_key:"sizeBoxRef",ref:s,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(F){const M=e.ref(null),f=e.ref(null),k=e.inject("pageSchema"),s=e.computed(()=>k.schemas[0]),g=e.computed(()=>({width:"100%",height:"100%"}));return e.onMounted(()=>{var c;(c=f.value)==null||c.handleInit(M.value)}),(c,p)=>(e.openBlock(),e.createElementBlock("section",ye,[e.createVNode(xe,null,{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"epicEditRangeRef",ref:M,class:"epic-edit-range rounded-md overflow-auto relative",style:e.normalizeStyle(g.value)},[e.createVNode(Q,{schema:s.value},null,8,["schema"]),e.createVNode(ne,{ref_key:"ePreviewWidgetsRef",ref:f},null,512)],4)]),_:1})]))}});exports.default=_e;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),H=require("./pluginManager-itCTrGag.cjs"),C=require("./index-CFryUxKc.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(F,{expose:M}){const f=e.inject("pageManager",{}),k=e.inject("pageSchema"),s=e.inject("designer"),g=e.inject("designerProps"),c=e.inject("revoke"),p=e.ref(null),S=e.ref(null),x=e.ref(null),R=e.ref(!1),l=e.ref(!1),a=e.ref(!0),i=e.ref("top"),{canvasScale:r,disabledZoom:b}=C.useStore();let n=null;const L=e.computed(()=>{const t=s.state.checkedNode;return!(!(t!=null&&t.id)||g.value.lockDefaultSchemaEdit&&f.defaultComponentIds.value.includes(t==null?void 0:t.id))}),T=e.computed(()=>{var B,V,$,m,O,D;const t=f.componentInstances.value,u=(B=s.state.checkedNode)==null?void 0:B.id;if(($=(V=s.state.checkedNode)==null?void 0:V.componentProps)!=null&&$.hidden)return null;const _=H.pluginManager.getComponentConfingByType((m=s.state.checkedNode)==null?void 0:m.type)??null;if(!u||!(t!=null&&t[u]))return null;if(_!=null&&_.defaultSchema.input&&((O=s.state.checkedNode)==null?void 0:O.noFormItem)!==!0)return(D=t[u+"formItem"])==null?void 0:D.$el;const o=t[u];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}),E=e.computed(()=>{var B,V,$,m;const t=f.componentInstances.value,u=(B=s.state.hoverNode)==null?void 0:B.id,_=H.pluginManager.getComponentConfingByType((V=s.state.hoverNode)==null?void 0:V.type)??null;if(!u||!(t!=null&&t[u]))return null;if(_!=null&&_.defaultSchema.input&&(($=s.state.hoverNode)==null?void 0:$.noFormItem)!==!0)return(m=t[u+"formItem"])==null?void 0:m.$el;const o=t[u];return(o==null?void 0:o.$el.nodeName)==="#text"?null:o==null?void 0:o.$el}),{mutationObserver:P,observerConfig:W}=Z(j),{startTimedQuery:d,stopTimedQuery:y}=C.useTimedQuery(j);e.watch(()=>T.value,t=>{if(t){R.value=!0,P.observe(t,W);const u=t.parentNode;u&&(u.ondragstart=()=>{a.value=!1,d()},u.ondragend=()=>{a.value=!0,y()}),j()}else R.value=!1});const{mutationObserver:v,observerConfig:w}=Z(q);e.watch(()=>E.value,t=>{t&&(v.observe(t,w),q())});let h=0;e.watch(()=>{var t;return(t=s.state.hoverNode)==null?void 0:t.id},t=>{if(t){l.value=!0,clearTimeout(h);return}h=setTimeout(()=>{l.value=!1},300)});let N=0,z=0;function j(){const t=T.value;if(!t||!n)return;const{top:u,left:_}=n==null?void 0:n.getBoundingClientRect(),{top:o,left:B,width:V,height:$}=t.getBoundingClientRect(),m=b.value?1:r.value,O=o-u+((n==null?void 0:n.scrollTop)??0)*m,D=B-_+((n==null?void 0:n.scrollLeft)??0)*m,I=$/m;p.value&&(p.value.style.width=`${V/m}px`,p.value.style.height=`${I}px`,p.value.style.top=`${O/m}px`,p.value.style.left=`${D/m}px`,A(O,D)),x.value&&(O<45&&I<100?(x.value.style.top="",x.value.style.bottom="-30px",x.value.style["border-radius"]="0px 0px 4px 4px",i.value="bottom"):O<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"))}function A(t,u){const _=T.value;if(!n||!_)return;const o=n.getBoundingClientRect(),{width:B}=_.getBoundingClientRect(),V=b.value?1:r.value,$=t/V-o.top;let m=u/V-o.left+B/V;m<o.width&&(m=0);const O=n.scrollTop-o.height/3+60,D=n.scrollTop+o.height/3*2,I=n.scrollLeft-o.width+200,U=n.scrollLeft+o.width-200;Math.abs($-N)<10&&Math.abs(m-z)<10||(N=$,z=m,!($>O&&$<D&&m>I&&m<U)&&(n.scrollTop=$,n.scrollLeft=m))}function q(){var I,U;const t=E.value;if(!t)return;const{top:u,left:_}=(n==null?void 0:n.getBoundingClientRect())??{top:0,left:0},{top:o,left:B,width:V,height:$}=((I=t.getBoundingClientRect)==null?void 0:I.call(t))??((U=t.nextElementSibling)==null?void 0:U.getBoundingClientRect()),m=b.value?1:r.value,O=o-u+((n==null?void 0:n.scrollTop)??0)*m,D=B-_+((n==null?void 0:n.scrollLeft)??0)*m;S.value&&(S.value.style.width=`${V/m}px`,S.value.style.height=`${$/m}px`,S.value.style.top=`${O/m}px`,S.value.style.left=`${D/m}px`)}function Z(t){const u=window.MutationObserver,_={childList:!0,attributes:!0,subtree:!0};return{mutationObserver:new u(t),observerConfig:_}}function K(){var V;const t=C.findSchemaInfoById(k.schemas,((V=s.state.checkedNode)==null?void 0:V.id)??"root");if(!t)return!1;const{list:u,schema:_,index:o}=t,B=C.generateNewSchema(_);u.splice(o+1,0,B),s.setCheckedNode(B),c.push(k.schemas,"复制组件")}function X(){var B;const t=C.findSchemaInfoById(k.schemas,((B=s.state.checkedNode)==null?void 0:B.id)??"root");if(!t)return!1;let{list:u,schema:_,index:o}=t;u.splice(o,1),o===u.length&&o--,s.setCheckedNode(u[o]),c.push(k.schemas,"删除组件")}function Y(t){n=t,n==null||n.addEventListener("scroll",()=>{j()}),C.useResizeObserver(T,j),C.useResizeObserver(E,q)}return M({handleInit:Y}),(t,u)=>{var _,o,B,V,$;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives(e.createElementVNode("div",{ref_key:"selectorRef",ref:p,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:x},[e.createElementVNode("div",ee,e.toDisplayString((o=e.unref(H.pluginManager).getComponentConfingByType(((_=e.unref(s).state.checkedNode)==null?void 0:_.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,R.value&&((B=e.unref(s).state.checkedNode)==null?void 0:B.id)!=="root"]]),e.withDirectives(e.createElementVNode("div",{ref_key:"hoverWidgetRef",ref:S,class:"epic-hover-widget absolute transition-all pointer-events-none z-998"},null,512),[[e.vShow,l.value&&((V=e.unref(s).state.checkedNode)==null?void 0:V.id)!==(($=e.unref(s).state.hoverNode)==null?void 0:$.id)]])],64)}}}),oe=e.defineComponent({name:"EditNodeItem",__name:"editNodeItem",props:{schemas:{}},emits:["update:schemas"],setup(F,{emit:M}){const f=e.inject("designer"),k=e.inject("pageSchema"),s=e.inject("revoke"),g=F,c=M,p=e.computed({get(){return g.schemas},set(a){c("update:schemas",a)}});function S(a){f.setCheckedNode(p.value[a]),f.setDisableHover(!0)}function x(){f.setDisableHover(),s.push(k.schemas,"拖拽组件")}function R(){s.push(k.schemas,"插入组件")}function l(a){var i,r,b;return a.id===((i=k.schemas[0])==null?void 0:i.id)||(b=(r=H.pluginManager.getComponentConfingByType(a.type))==null?void 0:r.editConstraints)!=null&&b.immovable?"unmover-item":"draggable-item"}return(a,i)=>(e.openBlock(),e.createBlock(e.unref(G.draggable),e.mergeProps({modelValue:p.value,"onUpdate:modelValue":i[0]||(i[0]=r=>p.value=r),"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]=r=>S(r.oldIndex)),onEnd:i[2]||(i[2]=r=>x()),onAdd:i[3]||(i[3]=r=>{S(r.newIndex),R()})}),{item:e.withCtx(({element:r,index:b})=>[(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["widget-box",l(r)]),key:b},[e.createVNode(Q,{schema:r},null,8,["schema"])],2))]),_:1},16,["modelValue"]))}}),Q=e.defineComponent({name:"ENodeItem",__name:"nodeItem",props:{schema:{},name:{}},setup(F){const M=e.useAttrs(),f=e.inject("designer"),k=e.inject("pageManager",{}),s=e.inject("pageSchema",{}),g=e.ref(null);e.provide("nodeAttrs",M);const c=F,p=e.computed(()=>{var b,n,L,T,E;const l=k.componentInstances.value,a=(b=c.schema)==null?void 0:b.id,i=H.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 r=l[a];return((E=r==null?void 0:r.$el)==null?void 0:E.nodeName)==="#text"?null:r==null?void 0:r.$el});e.watch(()=>p.value,l=>{l==null||l.addEventListener("click",S,!1),l==null||l.addEventListener("mouseover",x,!1),l==null||l.addEventListener("mouseout",R,!1)}),e.onUnmounted(()=>{var l,a,i;(l=p.value)==null||l.removeEventListener("click",S,!1),(a=p.value)==null||a.removeEventListener("mouseover",x,!1),(i=p.value)==null||i.removeEventListener("mouseout",R,!1)});function S(l){l.stopPropagation(),f.setCheckedNode(c.schema)}function x(l){var a;c.schema.id!==((a=s.schemas[0])==null?void 0:a.id)&&(l.stopPropagation(),f.setHoverNode(c.schema))}function R(l){l.stopPropagation(),f.setHoverNode(null)}return(l,a)=>{var r,b;const i=e.resolveComponent("ENodeItem");return e.openBlock(),e.createBlock(e.unref(C._sfc_main),{ref_key:"nodeRef",ref:g,componentSchema:c.schema},e.createSlots({_:2},[(b=(r=e.unref(H.pluginManager).getComponentConfingByType(c.schema.type))==null?void 0:r.editConstraints)!=null&&b.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(F,{expose:M}){const f=H.pluginManager.getComponent("modal"),k=H.pluginManager.getComponent("monacoEditor"),s={theme:"vs-light",selectOnLineNumbers:!0,minimap:{enabled:!1},readOnly:!0},g=e.ref(null),c=e.ref(!1),p=e.inject("pageSchema");function S(){c.value=!1}function x(){c.value=!0,g.value?g.value.setValue(JSON.stringify(p,null,2)):setTimeout(()=>{x()},300)}function R(l="epic-data.json"){const a=JSON.stringify(p,null,2);var i=`data:text/json;charset=utf-8,${encodeURIComponent(a)}`,r=document.createElement("a");r.setAttribute("href",i),r.setAttribute("download",l),r.click()}return M({handleOpen:x}),(l,a)=>(e.openBlock(),e.createBlock(e.unref(f),{modelValue:c.value,"onUpdate:modelValue":a[0]||(a[0]=i=>c.value=i),title:"查看数据",class:"w-900px",width:"900px",onClose:S,onOk:R,okText:"导出数据"},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.createVNode(e.unref(k),{ref_key:"monacoEditorRef",ref:g,class:"editor h-full",autoToggleTheme:"",readOnly:"",config:s,language:"json"},null,512)])]),_:1},8,["modelValue"]))}}),re={class:"epic-edit-toolbar flex items-center justify-between px-2"},se={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"},pe={class:"epic-device h-28px items-center gap-1 rounded-md border p-2px flex"},me=["title","onClick"],ve=e.defineComponent({__name:"toolbar",setup(F){const M=H.pluginManager.getComponent("select"),{canvasScale:f,disabledZoom:k}=C.useStore(),s=e.ref("pc"),g=e.inject("pageSchema"),c=e.inject("designer"),p=e.inject("revoke"),S=e.ref(null),x=[{icon:"icon--epic--computer-outline-rounded",title:"pc",key:"pc"},{icon:"icon--epic--tablet-android-outline-rounded",title:"平板",key:"pad"},{icon:"icon--epic--phone-iphone-outline-sharp",title:"手机",key:"mobile"}],R=e.computed(()=>[{icon:"icon--epic--code",title:"查看数据",on:()=>L()},{icon:"icon--epic--exit-to-app-rounded",title:"导入数据",on:T},{icon:"icon--epic--trash",title:"清空",on:n},{icon:"icon--epic--undo",title:"撤销",on:r,disabled:!p.recordList.value.length,divider:!0},{icon:"icon--epic--redo",title:"重做",on:b,disabled:!p.undoList.value.length}]),l=e.ref(null),a=e.computed({get(){return`${(f.value*100).toFixed(0)}%`},set(d){const y=parseFloat(d);f.value=y/100}}),i=[{label:"60%",value:"60%"},{label:"80%",value:"80%"},{label:"100%",value:"100%"},{label:"120%",value:"120%"},{label:"140%",value:"140%"}];function r(){const d=p.undo();d&&(C.deepCompareAndModify(g.schemas,d),c.setCheckedNode(g.schemas[0]))}function b(){const d=p.redo();d&&(C.deepCompareAndModify(g.schemas,d),c.setCheckedNode(g.schemas[0]))}function n(){c.reset()}function L(){S.value.handleOpen()}function T(){var d;(d=l.value)==null||d.click()}function E(d){var w;const y=(w=d.target.files)==null?void 0:w[0];if(!y)return;d.target.value=null;const v=new FileReader;v.readAsText(y),v.onload=h=>{var N;P((N=h.target)==null?void 0:N.result)}}function P(d){try{let y=JSON.parse(d??"");y.schemas||(y=C.convertKFormData(y)),C.deepCompareAndModify(g,y)}catch(y){console.error(y)}}function W(d){c.handleToggleDeviceMode(d),s.value=d;const y={pc:{},pad:{width:"780px",mode:d},mobile:{width:"390px",mode:d}};g.canvas=y[d]}return(d,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",re,[e.createElementVNode("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,(v,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w},[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:E},null,544),[[e.vShow,!1]]),e.createElementVNode("div",de,[e.unref(k)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ue,[e.createElementVNode("div",fe,[e.createVNode(e.unref(M),{value:a.value,"onUpdate:value":y[0]||(y[0]=v=>a.value=v),modelValue:a.value,"onUpdate:modelValue":y[1]||(y[1]=v=>a.value=v),options:i,size:"small"},null,8,["value","modelValue"])])])),e.createElementVNode("div",pe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(x,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===s.value}]),onClick:w=>W(v.key)},[e.createVNode(e.unref(J._sfc_main),{name:v.icon},null,8,["name"])],10,me)),64))])])]),e.createVNode(ae,{ref_key:"previewJson",ref:S},null,512)],64))}}),he={class:"h-full flex flex-col relative"},ge=["draggable"],xe=e.defineComponent({__name:"editScreenContainer",setup(F){const M=e.inject("pageSchema"),f=e.ref(null),k=e.ref(null),s=e.ref(null),{pressSpace:g,disabledZoom:c}=C.useStore(),{handleElementDragStart:p,handleElementDrag:S,handleElementDragEnd:x}=C.useElementDrag(f),{width:R,height:l}=C.useElementSize(f),{canvasScale:a,handleZoom:i}=C.useElementZoom(k);let r=0,b=0;const n=e.ref({}),L=e.ref({}),T=e.ref({}),E=e.shallowRef({width:0,height:0});e.watchEffect(W),e.watch(T,()=>{e.nextTick(P)});function P(){s.value&&(E.value={width:s.value.clientWidth,height:s.value.clientHeight})}function W(){var w,h;T.value={width:((w=M.canvas)==null?void 0:w.width)??"0",height:((h=M.canvas)==null?void 0:h.height)??"0"}}C.watchOnce(R,d),e.watch(E,d);function d(){let w=E.value.width||r,h=E.value.height||b;n.value={width:R.value+w+"px",height:l.value+h+"px"},L.value={width:w+"px",height:h+"px"},y()}function y(){e.nextTick(()=>{var j;let w=E.value.width||r;const N=(E.value.height||b)/2,z=w/2;(j=f.value)==null||j.scrollTo(z,N)})}C.useResizeObserver(f,v),C.useResizeObserver(k,v);function v(){var h;if(!f.value)return;const w=f.value.getBoundingClientRect();if(r=w.width-60,b=w.height-80,!c.value)if(E.value.width===0)a.value=1;else{const N=(r-20)/E.value.width,z=b/(E.value.height||((h=k.value)==null?void 0:h.clientHeight)||1),j=Math.abs(N-1)<Math.abs(z-1);let A=1;j?A=N:A=z,(N<1||z<1)&&(A=Math.min(N,z)),A<1.4&&A>.5&&(a.value=A)}C.debounce(d,50)()}return(w,h)=>(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(ve),e.createElementVNode("div",{ref_key:"editScreenContainerRef",ref:f,class:e.normalizeClass(["flex-1 overflow-auto overflow-y-hidden epic-edit-screen-container",{"cursor-grab":e.unref(g)}]),draggable:e.unref(g),onWheel:h[0]||(h[0]=(...N)=>e.unref(i)&&e.unref(i)(...N)),onDragstart:h[1]||(h[1]=(...N)=>e.unref(p)&&e.unref(p)(...N)),onDragend:h[2]||(h[2]=(...N)=>e.unref(x)&&e.unref(x)(...N)),onDrag:h[3]||(h[3]=(...N)=>e.unref(S)&&e.unref(S)(...N))},[e.createElementVNode("div",{id:"canvasContainer",class:"flex items-center justify-center",style:e.normalizeStyle(n.value)},[e.createElementVNode("div",{ref_key:"draggableElRef",ref:k,class:"transition-all"},[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none":e.unref(g)}),style:e.normalizeStyle(L.value)},[e.renderSlot(w.$slots,"default")],6)],512)],4)],42,ge),e.createElementVNode("div",{ref_key:"sizeBoxRef",ref:s,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(F){const M=e.ref(null),f=e.ref(null),k=e.inject("pageSchema"),s=e.computed(()=>k.schemas[0]),g=e.computed(()=>({width:"100%",height:"100%"}));return e.onMounted(()=>{var c;(c=f.value)==null||c.handleInit(M.value)}),(c,p)=>(e.openBlock(),e.createElementBlock("section",ye,[e.createVNode(xe,null,{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"epicEditRangeRef",ref:M,class:"epic-edit-range rounded-md overflow-auto relative",style:e.normalizeStyle(g.value)},[e.createVNode(Q,{schema:s.value},null,8,["schema"]),e.createVNode(ne,{ref_key:"ePreviewWidgetsRef",ref:f},null,512)],4)]),_:1})]))}});exports.default=_e;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as B, computed as P, inject as O, openBlock as r, createElementBlock as u, Fragment as c, renderList as k, createElementVNode as d, toDisplayString as U, createVNode as g, unref as y, createCommentVNode as $, ref as C, watchEffect as T, createBlock as I, withCtx as M, createTextVNode as N } from "vue";
|
|
2
2
|
import { p as R } from "./pluginManager-D8PM7ICc.js";
|
|
3
|
-
import { _ as j, n as F, m as q } from "./index-
|
|
3
|
+
import { _ as j, n as F, m as q } from "./index-B44ldwiI.js";
|
|
4
4
|
import { _ as A } from "./icon.vue_vue_type_script_setup_true_lang-D3QdcReY.js";
|
|
5
5
|
const D = [
|
|
6
6
|
{ label: "string", value: "string" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as u, ref as p, inject as d, watch as f, toRaw as m, openBlock as g, createElementBlock as _, createVNode as h, unref as r } from "vue";
|
|
2
2
|
import { p as N } from "./pluginManager-D8PM7ICc.js";
|
|
3
|
-
import { o as y, d as k } from "./index-
|
|
3
|
+
import { o as y, d as k } from "./index-B44ldwiI.js";
|
|
4
4
|
const E = { class: "epic-sound-code" }, R = /* @__PURE__ */ u({
|
|
5
5
|
__name: "index",
|
|
6
6
|
setup(O) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
import { p as U } from "./pluginManager-D8PM7ICc.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-
|
|
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-B44ldwiI.js";
|
|
4
4
|
import { _ as ie } from "./icon.vue_vue_type_script_setup_true_lang-D3QdcReY.js";
|
|
5
5
|
import { d as Ee } from "./vuedraggable.umd-D2S7Eo7p.js";
|
|
6
6
|
const Fe = { class: "epic-widget-action-item whitespace-nowrap" }, Ie = {
|