epic-designer-gold 1.0.28 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{attributeView-BqtDAlQn.js → attributeView-CSiGWdPc.js} +1 -1
  2. package/dist/{attributeView-BXAZCzjN.cjs → attributeView-UzP3tU2D.cjs} +1 -1
  3. package/dist/{index-BLP-aOxR.js → index-B2RMcVgD.js} +1 -1
  4. package/dist/{index-CfNqnQwZ.cjs → index-B8exdhvc.cjs} +1 -1
  5. package/dist/{index-Bca_A9gK.cjs → index-BENF2JDS.cjs} +1 -1
  6. package/dist/{index-gdly69qM.js → index-BbTWJKHb.js} +140 -140
  7. package/dist/{index-kTMEQOpq.js → index-BhICtIH5.js} +360 -368
  8. package/dist/index-BhMVNODR.js +43 -0
  9. package/dist/index-BwLkOBWy.cjs +10 -0
  10. package/dist/index-C9PHR_YC.js +4 -0
  11. package/dist/index-CU1ZFiwn.cjs +1 -0
  12. package/dist/{index-B4_XV0sh.cjs → index-CZFPJ6vM.cjs} +1 -1
  13. package/dist/{index-D-EiABAK.js → index-Cmfhlo_3.js} +1 -1
  14. package/dist/{index-CURN8hNC.cjs → index-D2GF87Tg.cjs} +1 -1
  15. package/dist/{index-UFxVHTZ9.cjs → index-DEBQD_h0.cjs} +1 -1
  16. package/dist/{index-DNEhlg9r.cjs → index-Dk0fyxAJ.cjs} +1 -1
  17. package/dist/{index-CvD6bD_0.js → index-DymbM-qI.js} +1 -1
  18. package/dist/{index-arLwKBPE.js → index-RL7vrExY.js} +1 -1
  19. package/dist/{index-UJyLHIXT.js → index-lCYWKDlK.js} +1 -1
  20. package/dist/{index-B9A0eWKG.cjs → index-n6H8b6fT.cjs} +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/{selectPage-vm_pZlz-.js → selectPage-Bm45M31g.js} +47 -47
  24. package/dist/selectPage-CrdVWKGk.cjs +1 -0
  25. package/dist/style.css +1 -1
  26. package/dist/{styleView-pnZNe-no.cjs → styleView-CrBDikDV.cjs} +1 -1
  27. package/dist/{styleView-DWhRTeHv.js → styleView-DONajUQ-.js} +1 -1
  28. package/dist/ui/elementPlus/index.cjs +1 -1
  29. package/dist/ui/elementPlus/index.js +52 -45
  30. package/package.json +1 -1
  31. package/dist/index-CfqqBphl.cjs +0 -1
  32. package/dist/index-DOWqiyzN.cjs +0 -10
  33. package/dist/index-DSujK9zM.js +0 -4
  34. package/dist/index-DjPTgDpJ.js +0 -43
  35. package/dist/selectPage-DufSfwTA.cjs +0 -1
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as S, inject as f, computed as V, ref as C, watchEffect as N, openBlock as s, createElementBlock as l, Fragment as E, renderList as U, normalizeClass as v, toDisplayString as B, createCommentVNode as y, createElementVNode as D, createVNode as x, unref as h, nextTick as g } from "vue";
2
- import { _ as z } from "./index-kTMEQOpq.js";
2
+ import { _ as z } from "./index-BhICtIH5.js";
3
3
  import { p as F, i as b, s as m } from "./pluginManager-BCnrHPYv.js";
4
4
  import { u as L } from "./index-B1s67XDZ.js";
5
5
  const T = ["title"], $ = /* @__PURE__ */ S({
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),k=require("./index-DOWqiyzN.cjs"),l=require("./pluginManager-DWHAX8kP.cjs"),g=require("./index-BoL2PSBk.cjs"),b=["title"],B=e.defineComponent({__name:"attributeView",setup(P){const{t:s}=g.useLocale(),d=e.inject("designer"),u=e.inject("pageSchema"),f=e.inject("revoke"),h=l.pluginManager.getComponentConfings(),c=e.computed(()=>d.state.checkedNode);function y(n){var a;return typeof n.show=="boolean"?n.show:typeof n.show=="function"?(a=n.show)==null?void 0:a.call(n,{values:c.value}):!0}const i=e.ref([]);e.watchEffect(()=>{var o,t,r;const n=(o=d.state.checkedNode)==null?void 0:o.type;if(!d.state.checkedNode||!n)return[];const a=((t=h[n])==null?void 0:t.config.attribute)??[];i.value=[{label:s("componentId"),type:"input",field:"id",componentProps:{disabled:!0}},...a],d.state.checkedNode.id===((r=u.schemas[0])==null?void 0:r.id)&&i.value.push({label:s("canvasWidth"),type:"EInputSize",field:"canvas.width",editData:u},{label:s("canvasHeight"),type:"EInputSize",field:"canvas.height",editData:u})});function m(n,a,o,t=c.value){typeof o.onChange=="function"&&o.onChange({value:n,values:t,componentAttributes:i}),o.changeSync?l.setValueByPath(t,a,n):e.nextTick(()=>{l.setValueByPath(t,a,n)}),f.push(u.schemas,s("editComponentProperties"))}function v(n,a,o=c.value){e.nextTick(()=>{l.setValueByPath(o,"componentProps.dynamicId",n)})}return(n,a)=>{var o;return e.openBlock(),e.createElementBlock("div",{class:"epic-attribute-view",key:(o=c.value)==null?void 0:o.id},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,t=>{var r;return e.openBlock(),e.createElementBlock("div",{key:t.field},[y(t)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["epic-attr-item",t.layout])},[t.label?(e.openBlock(),e.createElementBlock("div",{key:0,class:"epic-attr-label",title:t.label},e.toDisplayString(t.label),9,b)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["epic-attr-input",{"block!":t.layout==="vertical"}])},[e.createVNode(e.unref(k._sfc_main),{componentSchema:{...t,componentProps:{...t.componentProps,...t.field==="componentProps.defaultValue"?(r=c.value)==null?void 0:r.componentProps:{},input:!1,field:void 0,hidden:!1},show:!0,noFormItem:!0},dynamicId:e.unref(l.getValueByPath)(t.editData??c.value,"componentProps.dynamicId"),"model-value":e.unref(l.getValueByPath)(t.editData??c.value,t.field),"onUpdate:modelValue":p=>m(p,t.field,t,t.editData),"onUpdate:dynamicId":p=>v(p)},null,8,["componentSchema","dynamicId","model-value","onUpdate:modelValue","onUpdate:dynamicId"])],2)],2)):e.createCommentVNode("",!0)])}),128))])}}});exports.default=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),k=require("./index-BwLkOBWy.cjs"),l=require("./pluginManager-DWHAX8kP.cjs"),g=require("./index-BoL2PSBk.cjs"),b=["title"],B=e.defineComponent({__name:"attributeView",setup(P){const{t:s}=g.useLocale(),d=e.inject("designer"),u=e.inject("pageSchema"),f=e.inject("revoke"),h=l.pluginManager.getComponentConfings(),c=e.computed(()=>d.state.checkedNode);function y(n){var a;return typeof n.show=="boolean"?n.show:typeof n.show=="function"?(a=n.show)==null?void 0:a.call(n,{values:c.value}):!0}const i=e.ref([]);e.watchEffect(()=>{var o,t,r;const n=(o=d.state.checkedNode)==null?void 0:o.type;if(!d.state.checkedNode||!n)return[];const a=((t=h[n])==null?void 0:t.config.attribute)??[];i.value=[{label:s("componentId"),type:"input",field:"id",componentProps:{disabled:!0}},...a],d.state.checkedNode.id===((r=u.schemas[0])==null?void 0:r.id)&&i.value.push({label:s("canvasWidth"),type:"EInputSize",field:"canvas.width",editData:u},{label:s("canvasHeight"),type:"EInputSize",field:"canvas.height",editData:u})});function m(n,a,o,t=c.value){typeof o.onChange=="function"&&o.onChange({value:n,values:t,componentAttributes:i}),o.changeSync?l.setValueByPath(t,a,n):e.nextTick(()=>{l.setValueByPath(t,a,n)}),f.push(u.schemas,s("editComponentProperties"))}function v(n,a,o=c.value){e.nextTick(()=>{l.setValueByPath(o,"componentProps.dynamicId",n)})}return(n,a)=>{var o;return e.openBlock(),e.createElementBlock("div",{class:"epic-attribute-view",key:(o=c.value)==null?void 0:o.id},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,t=>{var r;return e.openBlock(),e.createElementBlock("div",{key:t.field},[y(t)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["epic-attr-item",t.layout])},[t.label?(e.openBlock(),e.createElementBlock("div",{key:0,class:"epic-attr-label",title:t.label},e.toDisplayString(t.label),9,b)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["epic-attr-input",{"block!":t.layout==="vertical"}])},[e.createVNode(e.unref(k._sfc_main),{componentSchema:{...t,componentProps:{...t.componentProps,...t.field==="componentProps.defaultValue"?(r=c.value)==null?void 0:r.componentProps:{},input:!1,field:void 0,hidden:!1},show:!0,noFormItem:!0},dynamicId:e.unref(l.getValueByPath)(t.editData??c.value,"componentProps.dynamicId"),"model-value":e.unref(l.getValueByPath)(t.editData??c.value,t.field),"onUpdate:modelValue":p=>m(p,t.field,t,t.editData),"onUpdate:dynamicId":p=>v(p)},null,8,["componentSchema","dynamicId","model-value","onUpdate:modelValue","onUpdate:dynamicId"])],2)],2)):e.createCommentVNode("",!0)])}),128))])}}});exports.default=B;
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as g, ref as p, onMounted as h, watch as v, nextTick as V, openBlock as _, createElementBlock as T } from "vue";
2
2
  import * as a from "monaco-editor";
3
- import { h as b } from "./index-kTMEQOpq.js";
3
+ import { h as b } from "./index-BhICtIH5.js";
4
4
  import { _ as y } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
5
  const x = /* @__PURE__ */ g({
6
6
  __name: "index",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./pluginManager-DWHAX8kP.cjs"),H=require("./index-DOWqiyzN.cjs"),Q=require("element-plus"),ee=require("./icon.vue_vue_type_script_setup_true_lang-DJbUD5AQ.cjs"),we=require("./vuedraggable.umd-BqhSJIAi.cjs"),Ce={class:"epic-widget-action-item whitespace-nowrap"},Ne={key:0,class:"flex items-center"},_e={key:0,title:"单元格操作",class:"epic-widget-action-item pointer-events-auto"},be=e.defineComponent({__name:"previewWidgets",setup(Z,{expose:L}){const v=e.inject("pageManager",{}),o=e.inject("pageSchema"),n=e.inject("designer"),w=e.inject("designerProps"),i=e.inject("revoke"),g=e.ref(null),R=e.ref(null),N=e.ref(null),z=e.ref(!1),c=e.ref(!1),d=e.ref(!0),h=e.ref("top"),{canvasScale:u,disabledZoom:T}=H.useStore();let s=null;const P=e.computed(()=>{const t=n.state.checkedNode;return!(!(t!=null&&t.id)||w.value.lockDefaultSchemaEdit&&v.defaultComponentIds.value.includes(t==null?void 0:t.id)||t.type==="table-cell")}),j=e.computed(()=>{const t=n.state.checkedNode;return(t==null?void 0:t.type)==="eTd"});e.computed(()=>{const t=n.state.checkedNode;return(t==null?void 0:t.type)==="table"});const $=e.computed(()=>{var C,b,V,m,O,A;const t=v.componentInstances.value,r=(C=n.state.checkedNode)==null?void 0:C.id;if((V=(b=n.state.checkedNode)==null?void 0:b.componentProps)!=null&&V.hidden)return null;const y=l.pluginManager.getComponentConfingByType((m=n.state.checkedNode)==null?void 0:m.type)??null;if(!r||!(t!=null&&t[r]))return null;if(y!=null&&y.defaultSchema.input&&((O=n.state.checkedNode)==null?void 0:O.noFormItem)!==!0)return(A=t[r+"formItem"])==null?void 0:A.$el;const a=t[r];return!(a!=null&&a.$el)||(a==null?void 0:a.$el.nodeName)==="#text"||!(a!=null&&a.$el.getBoundingClientRect)?null:a==null?void 0:a.$el}),x=e.computed(()=>{var C,b,V,m;const t=v.componentInstances.value,r=(C=n.state.hoverNode)==null?void 0:C.id,y=l.pluginManager.getComponentConfingByType((b=n.state.hoverNode)==null?void 0:b.type)??null;if(!r||!(t!=null&&t[r]))return null;if(y!=null&&y.defaultSchema.input&&((V=n.state.hoverNode)==null?void 0:V.noFormItem)!==!0)return(m=t[r+"formItem"])==null?void 0:m.$el;const a=t[r];return(a==null?void 0:a.$el.nodeName)==="#text"?null:a==null?void 0:a.$el}),{mutationObserver:_,observerConfig:k}=ae(F),{startTimedQuery:q,stopTimedQuery:G}=H.useTimedQuery(F);e.watch(()=>$.value,t=>{if(t){z.value=!0,_.observe(t,k);const r=t.parentNode;r&&(r.ondragstart=()=>{d.value=!1,q()},r.ondragend=()=>{d.value=!0,G()}),F()}else z.value=!1});const{mutationObserver:M,observerConfig:E}=ae(oe);e.watch(()=>x.value,t=>{t&&(M.observe(t,E),oe())});let U=0;e.watch(()=>{var t;return(t=n.state.hoverNode)==null?void 0:t.id},t=>{if(t){c.value=!0,clearTimeout(U);return}U=setTimeout(()=>{c.value=!1},300)});let J=0,K=0;function F(){const t=$.value;if(!t||!s)return;const{top:r,left:y}=s==null?void 0:s.getBoundingClientRect(),{top:a,left:C,width:b,height:V}=t.getBoundingClientRect(),m=T.value?1:u.value,O=a-r+((s==null?void 0:s.scrollTop)??0)*m,A=C-y+((s==null?void 0:s.scrollLeft)??0)*m,W=V/m;g.value&&(g.value.style.width=`${b/m}px`,g.value.style.height=`${W}px`,g.value.style.top=`${O/m}px`,g.value.style.left=`${A/m}px`,ve(O,A)),N.value&&(O<45&&W<100?(N.value.style.top="",N.value.style.bottom="-30px",N.value.style["border-radius"]="0px 0px 4px 4px",h.value="bottom"):O<45?(N.value.style.top="0px",N.value.style["border-radius"]="0px 0px 4px 0",h.value="center"):(N.value.style.top="-30px",N.value.style["border-radius"]="4px 4px 0px 0px",h.value="top"))}function ve(t,r){const y=$.value;if(!s||!y)return;const a=s.getBoundingClientRect(),{width:C}=y.getBoundingClientRect(),b=T.value?1:u.value,V=t/b-a.top;let m=r/b-a.left+C/b;m<a.width&&(m=0);const O=s.scrollTop-a.height/3+60,A=s.scrollTop+a.height/3*2,W=s.scrollLeft-a.width+200,X=s.scrollLeft+a.width-200;Math.abs(V-J)<10&&Math.abs(m-K)<10||(J=V,K=m,!(V>O&&V<A&&m>W&&m<X)&&(s.scrollTop=V,s.scrollLeft=m))}function oe(){var W,X;const t=x.value;if(!t)return;const{top:r,left:y}=(s==null?void 0:s.getBoundingClientRect())??{top:0,left:0},{top:a,left:C,width:b,height:V}=((W=t.getBoundingClientRect)==null?void 0:W.call(t))??((X=t.nextElementSibling)==null?void 0:X.getBoundingClientRect()),m=T.value?1:u.value,O=a-r+((s==null?void 0:s.scrollTop)??0)*m,A=C-y+((s==null?void 0:s.scrollLeft)??0)*m;R.value&&(R.value.style.width=`${b/m}px`,R.value.style.height=`${V/m}px`,R.value.style.top=`${O/m}px`,R.value.style.left=`${A/m}px`)}function ae(t){const r=window.MutationObserver,y={childList:!0,attributes:!0,subtree:!0};return{mutationObserver:new r(t),observerConfig:y}}function ge(t){var r,y,a,C,b,V,m,O,A,W,X,se,re,ie,ce,de,ue,fe;if(t==="right"){const f=n.state.matched.find(I=>I.type==="eTable"),S=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),B=(y=l.findSchemaInfoById(o.schemas,((r=n.state.checkedNode)==null?void 0:r.id)??"root"))==null?void 0:y.index;(a=S.list)==null||a[0].children.forEach(I=>{var D;(D=I.children)==null||D.splice(B+1,0,{type:"eTd",id:"eTd_"+l.getUUID(),children:[]})}),i.push(o.schemas,"添加右列")}else if(t==="left"){const f=n.state.matched.find(I=>I.type==="eTable"),S=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),B=(b=l.findSchemaInfoById(o.schemas,((C=n.state.checkedNode)==null?void 0:C.id)??"root"))==null?void 0:b.index;(V=S.list)==null||V[0].children.forEach(I=>{var D;B===0?I.children.unshift({type:"eTd",id:"eTd_"+l.getUUID(),children:[]}):(D=I.children)==null||D.splice(B-1,0,{type:"eTd",id:"eTd_"+l.getUUID(),children:[]})}),i.push(o.schemas,"添加左列")}else if(t==="top"){const f=n.state.matched.find(p=>p.type==="eTable"),S=n.state.matched.find(p=>p.type==="eTr"),B=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),I=l.findSchemaInfoById(o.schemas,(S==null?void 0:S.id)??"root"),D=l.findSchemaInfoById(o.schemas,((m=n.state.checkedNode)==null?void 0:m.id)??"root");I.index===0?(O=B.list)==null||O[0].children.unshift({type:"eTr",id:"eTr_"+l.getUUID(),children:l.deepClone(D.list).map(p=>(p.id="eTd_"+l.getUUID(),p.children=[],p))}):(A=B.list)==null||A[0].children.splice(I.index-1,0,{type:"eTr",id:"eTr_"+l.getUUID(),children:l.deepClone(D.list).map(p=>(p.id="eTd_"+l.getUUID(),p.children=[],p))}),i.push(o.schemas,"添加上列")}else if(t==="bottom"){const f=n.state.matched.find(p=>p.type==="eTable"),S=n.state.matched.find(p=>p.type==="eTr"),B=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),I=l.findSchemaInfoById(o.schemas,(S==null?void 0:S.id)??"root"),D=l.findSchemaInfoById(o.schemas,((W=n.state.checkedNode)==null?void 0:W.id)??"root");(X=B.list)==null||X[0].children.splice(I.index+1,0,{type:"eTr",id:"eTr_"+l.getUUID(),children:l.deepClone(D.list).map(p=>(p.id="eTd_"+l.getUUID(),p.children=[],p))}),i.push(o.schemas,"添加下列")}else if(t==="merge-right"){n.state.matched.find(I=>I.type==="eTr");const f=l.findSchemaInfoById(o.schemas,((se=n.state.checkedNode)==null?void 0:se.id)??"root");if(f.index===f.list.length-1)return;const S=f.list[f.index],B=f.list[f.index+1];S.colspan=(S.colspan||1)+(B.colspan||1),f.list.splice(f.index+1,1),i.push(o.schemas,"向右合并")}else if(t==="merge-bottom"){const f=n.state.matched.find(p=>p.type==="eTable"),S=n.state.matched.find(p=>p.type==="eTr");l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root");const B=l.findSchemaInfoById(o.schemas,(S==null?void 0:S.id)??"root"),D=l.findSchemaInfoById(o.schemas,((re=n.state.checkedNode)==null?void 0:re.id)??"root").index;if(B.index!==B.list.length-1){const p=B.list[B.index];let te=0,ne=0;p.children.forEach((Y,le)=>{Y.colSpan||(Y.colSpan=1),ne=ne+Y.colSpan,ne===D+1&&(te=le)}),p.children[te].rowSpan=(p.children[te].rowSpan||1)+1;const Se=B.list[B.index+p.children[te].rowSpan-1];let he=0,me=0;p.children.forEach((Y,le)=>{Y.colSpan||(Y.colSpan=1),me=me+Y.colSpan,ne===D+1&&(he=le)}),Se.children.splice(he,1)}i.push(o.schemas,"向下合并")}else if(t==="delete-col"){const f=n.state.matched.find(I=>I.type==="eTable"),S=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),B=(ce=l.findSchemaInfoById(o.schemas,((ie=n.state.checkedNode)==null?void 0:ie.id)??"root"))==null?void 0:ce.index;(de=S.list)==null||de[0].children.forEach(I=>{var D;(D=I.children)==null||D.splice(B,1)}),i.push(o.schemas,"删除当前列")}else if(t==="delete-row"){const f=n.state.matched.find(D=>D.type==="eTable"),S=n.state.matched.find(D=>D.type==="eTr"),B=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),I=l.findSchemaInfoById(o.schemas,(S==null?void 0:S.id)??"root");l.findSchemaInfoById(o.schemas,((ue=n.state.checkedNode)==null?void 0:ue.id)??"root"),(fe=B.list)==null||fe[0].children.splice(I.index,1),i.push(o.schemas,"删除当前行")}}function xe(){var b;const t=l.findSchemaInfoById(o.schemas,((b=n.state.checkedNode)==null?void 0:b.id)??"root");if(!t)return!1;const{list:r,schema:y,index:a}=t,C=l.generateNewSchema(y);r.splice(a+1,0,C),n.setCheckedNode(C),i.push(o.schemas,"复制组件")}function ye(){var C;const t=l.findSchemaInfoById(o.schemas,((C=n.state.checkedNode)==null?void 0:C.id)??"root");if(!t)return!1;let{list:r,schema:y,index:a}=t;r.splice(a,1),a===r.length&&a--,n.setCheckedNode(r[a]),i.push(o.schemas,"删除组件")}function ke(t){s=t,s==null||s.addEventListener("scroll",()=>{F()}),H.useResizeObserver($,F),H.useResizeObserver(x,oe)}return L({handleInit:ke}),(t,r)=>{var y,a,C,b,V;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives(e.createElementVNode("div",{ref_key:"selectorRef",ref:g,class:e.normalizeClass(["epic-checked-widget absolute pointer-events-none z-20",h.value+" "+(d.value?"transition-all":"")])},[e.createElementVNode("div",{class:"epic-widget-action-box",ref_key:"actionBoxRef",ref:N},[e.createElementVNode("div",Ce,e.toDisplayString((a=e.unref(l.pluginManager).getComponentConfingByType(((y=e.unref(n).state.checkedNode)==null?void 0:y.type)??""))==null?void 0:a.defaultSchema.label),1),P.value?(e.openBlock(),e.createElementBlock("div",Ne,[P.value&&!j.value?(e.openBlock(),e.createElementBlock("div",{key:0,title:"复制",class:"epic-widget-action-item pointer-events-auto",onClick:xe},[e.createVNode(e.unref(ee._sfc_main),{name:"icon--epic--copy-all-outline-rounded"})])):e.createCommentVNode("",!0),e.createVNode(e.unref(Q.ElDropdown),{onCommand:ge,trigger:"click"},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(Q.ElDropdownMenu),null,{default:e.withCtx(()=>[e.createVNode(e.unref(Q.ElDropdownItem),{command:"left"},{default:e.withCtx(()=>r[0]||(r[0]=[e.createTextVNode("添加左列")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"right"},{default:e.withCtx(()=>r[1]||(r[1]=[e.createTextVNode("添加右列")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"top"},{default:e.withCtx(()=>r[2]||(r[2]=[e.createTextVNode("添加上列")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"bottom"},{default:e.withCtx(()=>r[3]||(r[3]=[e.createTextVNode("添加下列")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"delete-row",divided:""},{default:e.withCtx(()=>r[4]||(r[4]=[e.createTextVNode("删除当前行")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"delete-col"},{default:e.withCtx(()=>r[5]||(r[5]=[e.createTextVNode("删除当前列")])),_:1})]),_:1})]),default:e.withCtx(()=>[j.value?(e.openBlock(),e.createElementBlock("div",_e,[e.createVNode(e.unref(ee._sfc_main),{name:"icon--epic--window-outline"})])):e.createCommentVNode("",!0)]),_:1}),P.value&&!j.value?(e.openBlock(),e.createElementBlock("div",{key:1,title:"删除",class:"epic-widget-action-item pointer-events-auto",onClick:ye},[e.createVNode(e.unref(ee._sfc_main),{name:"icon--epic--delete-outline-rounded"})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],512)],2),[[e.vShow,z.value&&((C=e.unref(n).state.checkedNode)==null?void 0:C.id)!=="root"]]),e.withDirectives(e.createElementVNode("div",{ref_key:"hoverWidgetRef",ref:R,class:"epic-hover-widget absolute transition-all pointer-events-none z-998"},null,512),[[e.vShow,c.value&&((b=e.unref(n).state.checkedNode)==null?void 0:b.id)!==((V=e.unref(n).state.hoverNode)==null?void 0:V.id)]])],64)}}}),Be=e.defineComponent({name:"EditNodeItem",__name:"editNodeItem",props:{schemas:{}},emits:["update:schemas"],setup(Z,{emit:L}){const v=e.inject("designer"),o=e.inject("pageSchema"),n=e.inject("revoke"),w=Z,i=L,g=e.computed({get(){return w.schemas},set(d){i("update:schemas",d)}});function R(d){v.setCheckedNode(g.value[d]),v.setDisableHover(!0)}function N(){v.setDisableHover(),n.push(o.schemas,"拖拽组件")}function z(){n.push(o.schemas,"插入组件")}function c(d){var h,u,T;return d.id===((h=o.schemas[0])==null?void 0:h.id)||(T=(u=l.pluginManager.getComponentConfingByType(d.type))==null?void 0:u.editConstraints)!=null&&T.immovable?"unmover-item":"draggable-item"}return(d,h)=>(e.openBlock(),e.createBlock(e.unref(we.draggable),e.mergeProps({modelValue:g.value,"onUpdate:modelValue":h[0]||(h[0]=u=>g.value=u),"item-key":"id","component-data":{type:"transition-group"},class:"epic-draggable-range"},{animation:200,group:"edit-draggable",handle:".draggable-item",ghostClass:"moveing"},{onStart:h[1]||(h[1]=u=>R(u.oldIndex)),onEnd:h[2]||(h[2]=u=>N()),onAdd:h[3]||(h[3]=u=>{R(u.newIndex),z()})}),{item:e.withCtx(({element:u,index:T})=>[(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["widget-box",c(u)]),key:T},[e.createVNode(pe,{schema:u},null,8,["schema"])],2))]),_:1},16,["modelValue"]))}}),pe=e.defineComponent({name:"ENodeItem",__name:"nodeItem",props:{schema:{},name:{}},setup(Z){const L=e.useAttrs(),v=e.inject("designer"),o=e.inject("pageManager",{}),n=e.inject("pageSchema",{}),w=e.ref(null);e.provide("nodeAttrs",L);const i=Z,g=e.computed(()=>{var T,s,P,j,$;const c=o.componentInstances.value,d=(T=i.schema)==null?void 0:T.id,h=l.pluginManager.getComponentConfingByType((s=i.schema)==null?void 0:s.type)??null;if(!d||!(c!=null&&c[d]))return null;if(h!=null&&h.defaultSchema.input&&((P=i.schema)==null?void 0:P.noFormItem)!==!0)return(j=c[d+"formItem"])==null?void 0:j.$el;const u=c[d];return(($=u==null?void 0:u.$el)==null?void 0:$.nodeName)==="#text"?null:u==null?void 0:u.$el});e.watch(()=>g.value,c=>{c==null||c.addEventListener("click",R,!1),c==null||c.addEventListener("mouseover",N,!1),c==null||c.addEventListener("mouseout",z,!1)}),e.onUnmounted(()=>{var c,d,h;(c=g.value)==null||c.removeEventListener("click",R,!1),(d=g.value)==null||d.removeEventListener("mouseover",N,!1),(h=g.value)==null||h.removeEventListener("mouseout",z,!1)});function R(c){c.stopPropagation(),v.setCheckedNode(i.schema)}function N(c){var d;i.schema.id!==((d=n.schemas[0])==null?void 0:d.id)&&(c.stopPropagation(),v.setHoverNode(i.schema))}function z(c){c.stopPropagation(),v.setHoverNode(null)}return(c,d)=>{var u,T;const h=e.resolveComponent("ENodeItem");return e.openBlock(),e.createBlock(e.unref(H._sfc_main),{ref_key:"nodeRef",ref:w,componentSchema:i.schema},e.createSlots({_:2},[(T=(u=e.unref(l.pluginManager).getComponentConfingByType(i.schema.type))==null?void 0:u.editConstraints)!=null&&T.childImmovable?{name:"edit-node",fn:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.schema.children,s=>(e.openBlock(),e.createBlock(h,{key:s.id,schema:s},null,8,["schema"]))),128))]),key:"0"}:{name:"edit-node",fn:e.withCtx(()=>[i.schema.children?(e.openBlock(),e.createBlock(Be,{key:0,schemas:i.schema.children,"onUpdate:schemas":d[0]||(d[0]=s=>i.schema.children=s)},null,8,["schemas"])):e.createCommentVNode("",!0)]),key:"1"}]),1032,["componentSchema"])}}}),Ie={class:"min-w-750px rounded h-full"},Te=e.defineComponent({__name:"previewJson",setup(Z,{expose:L}){const v=l.pluginManager.getComponent("modal"),o=l.pluginManager.getComponent("monacoEditor"),n={theme:"vs-light",selectOnLineNumbers:!0,minimap:{enabled:!1},readOnly:!0},w=e.ref(null),i=e.ref(!1),g=e.inject("pageSchema");function R(){i.value=!1}function N(){i.value=!0,w.value?w.value.setValue(JSON.stringify(g,null,2)):setTimeout(()=>{N()},300)}function z(c="epic-data.json"){const d=JSON.stringify(g,null,2);var h=`data:text/json;charset=utf-8,${encodeURIComponent(d)}`,u=document.createElement("a");u.setAttribute("href",h),u.setAttribute("download",c),u.click()}return L({handleOpen:N}),(c,d)=>(e.openBlock(),e.createBlock(e.unref(v),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=h=>i.value=h),title:"查看数据",class:"w-900px",width:"900px",onClose:R,onOk:z,okText:"导出数据"},{default:e.withCtx(()=>[e.createElementVNode("div",Ie,[e.createVNode(e.unref(o),{ref_key:"monacoEditorRef",ref:w,class:"editor h-full",autoToggleTheme:"",readOnly:"",config:n,language:"json"},null,512)])]),_:1},8,["modelValue"]))}}),Ve={class:"epic-edit-toolbar flex items-center justify-between px-2"},Ee={class:"flex-1 h-full flex items-center"},De={key:0,class:"epic-divider"},Re=["title","onClick"],$e={class:"flex-1 h-full flex items-center justify-end"},Me={key:0,class:"flex items-center ml-12px"},Ue={class:"pr-8px w-82px cursor-pointer"},Le={class:"epic-device h-28px items-center gap-1 rounded-md border p-2px flex"},ze=["title","onClick"],Oe=e.defineComponent({__name:"toolbar",setup(Z){const L=l.pluginManager.getComponent("select"),{canvasScale:v,disabledZoom:o}=H.useStore(),n=e.ref("pc"),w=e.inject("pageSchema"),i=e.inject("designer"),g=e.inject("revoke"),R=e.ref(null),N=[{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"}],z=e.computed(()=>[{icon:"icon--epic--trash",title:"清空",on:s},{icon:"icon--epic--undo",title:"撤销",on:u,disabled:!g.recordList.value.length,divider:!0},{icon:"icon--epic--redo",title:"重做",on:T,disabled:!g.undoList.value.length}]),c=e.ref(null),d=e.computed({get(){return`${(v.value*100).toFixed(0)}%`},set(x){const _=parseFloat(x);v.value=_/100}}),h=[{label:"60%",value:"60%"},{label:"80%",value:"80%"},{label:"100%",value:"100%"},{label:"120%",value:"120%"},{label:"140%",value:"140%"}];function u(){const x=g.undo();x&&(l.deepCompareAndModify(w.schemas,x),i.setCheckedNode(w.schemas[0]))}function T(){const x=g.redo();x&&(l.deepCompareAndModify(w.schemas,x),i.setCheckedNode(w.schemas[0]))}function s(){i.reset()}function P(x){var q;const _=(q=x.target.files)==null?void 0:q[0];if(!_)return;x.target.value=null;const k=new FileReader;k.readAsText(_),k.onload=G=>{var M;j((M=G.target)==null?void 0:M.result)}}function j(x){try{let _=JSON.parse(x??"");_.schemas||(_=l.convertKFormData(_)),l.deepCompareAndModify(w,_)}catch(_){console.error(_)}}function $(x){i.handleToggleDeviceMode(x),n.value=x;const _={pc:{},pad:{width:"780px",mode:x},mobile:{width:"390px",height:"844px",mode:x}};w.canvas=_[x],console.log("%c [ pageSchema ]-248","font-size:13px; background:pink; color:#bf2c9f;",w)}return(x,_)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Ve,[e.createElementVNode("div",Ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,(k,q)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:q},[k.divider?(e.openBlock(),e.createElementBlock("div",De)):e.createCommentVNode("",!0),e.createElementVNode("div",{title:k.title,class:e.normalizeClass(["epic-action-item text-base h-90% px-10px flex items-center cursor-pointer",{disabled:k.disabled}]),onClick:k.on},[e.createVNode(e.unref(ee._sfc_main),{name:k.icon},null,8,["name"])],10,Re)],64))),128))]),e.withDirectives(e.createElementVNode("input",{type:"file",ref_key:"fileRef",ref:c,accept:".json,.txt",onChange:P},null,544),[[e.vShow,!1]]),e.createElementVNode("div",$e,[e.unref(o)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("div",Ue,[e.createVNode(e.unref(L),{value:d.value,"onUpdate:value":_[0]||(_[0]=k=>d.value=k),modelValue:d.value,"onUpdate:modelValue":_[1]||(_[1]=k=>d.value=k),options:h,size:"small"},null,8,["value","modelValue"])])])),e.createElementVNode("div",Le,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(N,k=>e.createElementVNode("div",{key:k.key,title:k.title,class:e.normalizeClass(["epic-device-item h-full px-1 flex items-center cursor-pointer text-base transition-colors rounded-sm",{checked:k.key===n.value}]),onClick:q=>$(k.key)},[e.createVNode(e.unref(ee._sfc_main),{name:k.icon},null,8,["name"])],10,ze)),64))])])]),e.createVNode(Te,{ref_key:"previewJson",ref:R},null,512)],64))}}),He={class:"h-full flex flex-col relative"},je=["draggable"],Fe=e.defineComponent({__name:"editScreenContainer",setup(Z){const L=e.inject("pageSchema"),v=e.ref(null),o=e.ref(null),n=e.ref(null),{pressSpace:w,disabledZoom:i}=H.useStore(),{handleElementDragStart:g,handleElementDrag:R,handleElementDragEnd:N}=H.useElementDrag(v),{width:z,height:c}=H.useElementSize(v),{canvasScale:d,handleZoom:h}=H.useElementZoom(o);let u=0,T=0;const s=e.ref({}),P=e.ref({}),j=e.ref({}),$=e.shallowRef({width:0,height:0});e.watchEffect(_),e.watch(j,()=>{e.nextTick(x)});function x(){n.value&&($.value={width:n.value.clientWidth,height:n.value.clientHeight})}function _(){var M,E;j.value={width:((M=L.canvas)==null?void 0:M.width)??"0",height:((E=L.canvas)==null?void 0:E.height)??"0"}}H.watchOnce(z,k),e.watch($,k);function k(){let M=$.value.width||u,E=$.value.height||T;s.value={width:z.value+M+"px",height:c.value+E+"px"},P.value={width:M+"px",height:E+"px"},q()}function q(){e.nextTick(()=>{var K;let M=$.value.width||u;const U=($.value.height||T)/2,J=M/2;(K=v.value)==null||K.scrollTo(J,U)})}H.useResizeObserver(v,G),H.useResizeObserver(o,G);function G(){var E;if(!v.value)return;const M=v.value.getBoundingClientRect();if(u=M.width-60,T=M.height-80,!i.value)if($.value.width===0)d.value=1;else{const U=(u-20)/$.value.width,J=T/($.value.height||((E=o.value)==null?void 0:E.clientHeight)||1),K=Math.abs(U-1)<Math.abs(J-1);let F=1;K?F=U:F=J,(U<1||J<1)&&(F=Math.min(U,J)),F<1.4&&F>.5&&(d.value=F)}H.debounce(k,50)()}return(M,E)=>(e.openBlock(),e.createElementBlock("div",He,[e.createVNode(Oe),e.createElementVNode("div",{ref_key:"editScreenContainerRef",ref:v,class:e.normalizeClass(["flex-1 overflow-auto overflow-y-hidden epic-edit-screen-container",{"cursor-grab":e.unref(w)}]),draggable:e.unref(w),onWheel:E[0]||(E[0]=(...U)=>e.unref(h)&&e.unref(h)(...U)),onDragstart:E[1]||(E[1]=(...U)=>e.unref(g)&&e.unref(g)(...U)),onDragend:E[2]||(E[2]=(...U)=>e.unref(N)&&e.unref(N)(...U)),onDrag:E[3]||(E[3]=(...U)=>e.unref(R)&&e.unref(R)(...U))},[e.createElementVNode("div",{id:"canvasContainer",class:"flex items-center justify-center",style:e.normalizeStyle(s.value)},[e.createElementVNode("div",{ref_key:"draggableElRef",ref:o,class:"transition-all"},[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none":e.unref(w)}),style:e.normalizeStyle(P.value)},[e.renderSlot(M.$slots,"default")],6)],512)],4)],42,je),e.createElementVNode("div",{ref_key:"sizeBoxRef",ref:n,class:"absolute top-0 pointer-events-none",style:e.normalizeStyle(j.value)},null,4)]))}}),Ae={class:"epic-edit-canvas"},Pe=e.defineComponent({__name:"index",setup(Z){const L=e.ref(null),v=e.ref(null),o=e.inject("pageSchema"),n=e.computed(()=>o.schemas[0]),w=e.computed(()=>({width:"100%",height:"100%"}));return e.onMounted(()=>{var i;(i=v.value)==null||i.handleInit(L.value)}),(i,g)=>(e.openBlock(),e.createElementBlock("section",Ae,[e.createVNode(Fe,null,{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"epicEditRangeRef",ref:L,class:"epic-edit-range rounded-md overflow-auto relative",style:e.normalizeStyle(w.value)},[e.createVNode(pe,{schema:n.value},null,8,["schema"]),e.createVNode(be,{ref_key:"ePreviewWidgetsRef",ref:v},null,512)],4)]),_:1})]))}});exports.default=Pe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./pluginManager-DWHAX8kP.cjs"),H=require("./index-BwLkOBWy.cjs"),Q=require("element-plus"),ee=require("./icon.vue_vue_type_script_setup_true_lang-DJbUD5AQ.cjs"),we=require("./vuedraggable.umd-BqhSJIAi.cjs"),Ce={class:"epic-widget-action-item whitespace-nowrap"},Ne={key:0,class:"flex items-center"},_e={key:0,title:"单元格操作",class:"epic-widget-action-item pointer-events-auto"},be=e.defineComponent({__name:"previewWidgets",setup(Z,{expose:L}){const v=e.inject("pageManager",{}),o=e.inject("pageSchema"),n=e.inject("designer"),C=e.inject("designerProps"),i=e.inject("revoke"),g=e.ref(null),R=e.ref(null),N=e.ref(null),z=e.ref(!1),c=e.ref(!1),d=e.ref(!0),h=e.ref("top"),{canvasScale:u,disabledZoom:T}=H.useStore();let s=null;const P=e.computed(()=>{const t=n.state.checkedNode;return!(!(t!=null&&t.id)||C.value.lockDefaultSchemaEdit&&v.defaultComponentIds.value.includes(t==null?void 0:t.id)||t.type==="table-cell")}),j=e.computed(()=>{const t=n.state.checkedNode;return(t==null?void 0:t.type)==="eTd"});e.computed(()=>{const t=n.state.checkedNode;return(t==null?void 0:t.type)==="table"});const $=e.computed(()=>{var w,b,V,m,O,A;const t=v.componentInstances.value,r=(w=n.state.checkedNode)==null?void 0:w.id;if((V=(b=n.state.checkedNode)==null?void 0:b.componentProps)!=null&&V.hidden)return null;const y=l.pluginManager.getComponentConfingByType((m=n.state.checkedNode)==null?void 0:m.type)??null;if(!r||!(t!=null&&t[r]))return null;if(y!=null&&y.defaultSchema.input&&((O=n.state.checkedNode)==null?void 0:O.noFormItem)!==!0)return(A=t[r+"formItem"])==null?void 0:A.$el;const a=t[r];return!(a!=null&&a.$el)||(a==null?void 0:a.$el.nodeName)==="#text"||!(a!=null&&a.$el.getBoundingClientRect)?null:a==null?void 0:a.$el}),x=e.computed(()=>{var w,b,V,m;const t=v.componentInstances.value,r=(w=n.state.hoverNode)==null?void 0:w.id,y=l.pluginManager.getComponentConfingByType((b=n.state.hoverNode)==null?void 0:b.type)??null;if(!r||!(t!=null&&t[r]))return null;if(y!=null&&y.defaultSchema.input&&((V=n.state.hoverNode)==null?void 0:V.noFormItem)!==!0)return(m=t[r+"formItem"])==null?void 0:m.$el;const a=t[r];return(a==null?void 0:a.$el.nodeName)==="#text"?null:a==null?void 0:a.$el}),{mutationObserver:_,observerConfig:k}=ae(F),{startTimedQuery:q,stopTimedQuery:G}=H.useTimedQuery(F);e.watch(()=>$.value,t=>{if(t){z.value=!0,_.observe(t,k);const r=t.parentNode;r&&(r.ondragstart=()=>{d.value=!1,q()},r.ondragend=()=>{d.value=!0,G()}),F()}else z.value=!1});const{mutationObserver:M,observerConfig:E}=ae(oe);e.watch(()=>x.value,t=>{t&&(M.observe(t,E),oe())});let U=0;e.watch(()=>{var t;return(t=n.state.hoverNode)==null?void 0:t.id},t=>{if(t){c.value=!0,clearTimeout(U);return}U=setTimeout(()=>{c.value=!1},300)});let J=0,K=0;function F(){const t=$.value;if(!t||!s)return;const{top:r,left:y}=s==null?void 0:s.getBoundingClientRect(),{top:a,left:w,width:b,height:V}=t.getBoundingClientRect(),m=T.value?1:u.value,O=a-r+((s==null?void 0:s.scrollTop)??0)*m,A=w-y+((s==null?void 0:s.scrollLeft)??0)*m,W=V/m;g.value&&(g.value.style.width=`${b/m}px`,g.value.style.height=`${W}px`,g.value.style.top=`${O/m}px`,g.value.style.left=`${A/m}px`,ve(O,A)),N.value&&(O<45&&W<100?(N.value.style.top="",N.value.style.bottom="-30px",N.value.style["border-radius"]="0px 0px 4px 4px",h.value="bottom"):O<45?(N.value.style.top="0px",N.value.style["border-radius"]="0px 0px 4px 0",h.value="center"):(N.value.style.top="-30px",N.value.style["border-radius"]="4px 4px 0px 0px",h.value="top"))}function ve(t,r){const y=$.value;if(!s||!y)return;const a=s.getBoundingClientRect(),{width:w}=y.getBoundingClientRect(),b=T.value?1:u.value,V=t/b-a.top;let m=r/b-a.left+w/b;m<a.width&&(m=0);const O=s.scrollTop-a.height/3+60,A=s.scrollTop+a.height/3*2,W=s.scrollLeft-a.width+200,X=s.scrollLeft+a.width-200;Math.abs(V-J)<10&&Math.abs(m-K)<10||(J=V,K=m,!(V>O&&V<A&&m>W&&m<X)&&(s.scrollTop=V,s.scrollLeft=m))}function oe(){var W,X;const t=x.value;if(!t)return;const{top:r,left:y}=(s==null?void 0:s.getBoundingClientRect())??{top:0,left:0},{top:a,left:w,width:b,height:V}=((W=t.getBoundingClientRect)==null?void 0:W.call(t))??((X=t.nextElementSibling)==null?void 0:X.getBoundingClientRect()),m=T.value?1:u.value,O=a-r+((s==null?void 0:s.scrollTop)??0)*m,A=w-y+((s==null?void 0:s.scrollLeft)??0)*m;R.value&&(R.value.style.width=`${b/m}px`,R.value.style.height=`${V/m}px`,R.value.style.top=`${O/m}px`,R.value.style.left=`${A/m}px`)}function ae(t){const r=window.MutationObserver,y={childList:!0,attributes:!0,subtree:!0};return{mutationObserver:new r(t),observerConfig:y}}function ge(t){var r,y,a,w,b,V,m,O,A,W,X,se,re,ie,ce,de,ue,fe;if(t==="right"){const f=n.state.matched.find(I=>I.type==="eTable"),S=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),B=(y=l.findSchemaInfoById(o.schemas,((r=n.state.checkedNode)==null?void 0:r.id)??"root"))==null?void 0:y.index;(a=S.list)==null||a[0].children.forEach(I=>{var D;(D=I.children)==null||D.splice(B+1,0,{type:"eTd",id:"eTd_"+l.getUUID(),children:[]})}),i.push(o.schemas,"添加右列")}else if(t==="left"){const f=n.state.matched.find(I=>I.type==="eTable"),S=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),B=(b=l.findSchemaInfoById(o.schemas,((w=n.state.checkedNode)==null?void 0:w.id)??"root"))==null?void 0:b.index;(V=S.list)==null||V[0].children.forEach(I=>{var D;B===0?I.children.unshift({type:"eTd",id:"eTd_"+l.getUUID(),children:[]}):(D=I.children)==null||D.splice(B-1,0,{type:"eTd",id:"eTd_"+l.getUUID(),children:[]})}),i.push(o.schemas,"添加左列")}else if(t==="top"){const f=n.state.matched.find(p=>p.type==="eTable"),S=n.state.matched.find(p=>p.type==="eTr"),B=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),I=l.findSchemaInfoById(o.schemas,(S==null?void 0:S.id)??"root"),D=l.findSchemaInfoById(o.schemas,((m=n.state.checkedNode)==null?void 0:m.id)??"root");I.index===0?(O=B.list)==null||O[0].children.unshift({type:"eTr",id:"eTr_"+l.getUUID(),children:l.deepClone(D.list).map(p=>(p.id="eTd_"+l.getUUID(),p.children=[],p))}):(A=B.list)==null||A[0].children.splice(I.index-1,0,{type:"eTr",id:"eTr_"+l.getUUID(),children:l.deepClone(D.list).map(p=>(p.id="eTd_"+l.getUUID(),p.children=[],p))}),i.push(o.schemas,"添加上列")}else if(t==="bottom"){const f=n.state.matched.find(p=>p.type==="eTable"),S=n.state.matched.find(p=>p.type==="eTr"),B=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),I=l.findSchemaInfoById(o.schemas,(S==null?void 0:S.id)??"root"),D=l.findSchemaInfoById(o.schemas,((W=n.state.checkedNode)==null?void 0:W.id)??"root");(X=B.list)==null||X[0].children.splice(I.index+1,0,{type:"eTr",id:"eTr_"+l.getUUID(),children:l.deepClone(D.list).map(p=>(p.id="eTd_"+l.getUUID(),p.children=[],p))}),i.push(o.schemas,"添加下列")}else if(t==="merge-right"){n.state.matched.find(I=>I.type==="eTr");const f=l.findSchemaInfoById(o.schemas,((se=n.state.checkedNode)==null?void 0:se.id)??"root");if(f.index===f.list.length-1)return;const S=f.list[f.index],B=f.list[f.index+1];S.colspan=(S.colspan||1)+(B.colspan||1),f.list.splice(f.index+1,1),i.push(o.schemas,"向右合并")}else if(t==="merge-bottom"){const f=n.state.matched.find(p=>p.type==="eTable"),S=n.state.matched.find(p=>p.type==="eTr");l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root");const B=l.findSchemaInfoById(o.schemas,(S==null?void 0:S.id)??"root"),D=l.findSchemaInfoById(o.schemas,((re=n.state.checkedNode)==null?void 0:re.id)??"root").index;if(B.index!==B.list.length-1){const p=B.list[B.index];let te=0,ne=0;p.children.forEach((Y,le)=>{Y.colSpan||(Y.colSpan=1),ne=ne+Y.colSpan,ne===D+1&&(te=le)}),p.children[te].rowSpan=(p.children[te].rowSpan||1)+1;const Se=B.list[B.index+p.children[te].rowSpan-1];let he=0,me=0;p.children.forEach((Y,le)=>{Y.colSpan||(Y.colSpan=1),me=me+Y.colSpan,ne===D+1&&(he=le)}),Se.children.splice(he,1)}i.push(o.schemas,"向下合并")}else if(t==="delete-col"){const f=n.state.matched.find(I=>I.type==="eTable"),S=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),B=(ce=l.findSchemaInfoById(o.schemas,((ie=n.state.checkedNode)==null?void 0:ie.id)??"root"))==null?void 0:ce.index;(de=S.list)==null||de[0].children.forEach(I=>{var D;(D=I.children)==null||D.splice(B,1)}),i.push(o.schemas,"删除当前列")}else if(t==="delete-row"){const f=n.state.matched.find(D=>D.type==="eTable"),S=n.state.matched.find(D=>D.type==="eTr"),B=l.findSchemaInfoById(o.schemas,(f==null?void 0:f.id)??"root"),I=l.findSchemaInfoById(o.schemas,(S==null?void 0:S.id)??"root");l.findSchemaInfoById(o.schemas,((ue=n.state.checkedNode)==null?void 0:ue.id)??"root"),(fe=B.list)==null||fe[0].children.splice(I.index,1),i.push(o.schemas,"删除当前行")}}function xe(){var b;const t=l.findSchemaInfoById(o.schemas,((b=n.state.checkedNode)==null?void 0:b.id)??"root");if(!t)return!1;const{list:r,schema:y,index:a}=t,w=l.generateNewSchema(y);r.splice(a+1,0,w),n.setCheckedNode(w),i.push(o.schemas,"复制组件")}function ye(){var w;const t=l.findSchemaInfoById(o.schemas,((w=n.state.checkedNode)==null?void 0:w.id)??"root");if(!t)return!1;let{list:r,schema:y,index:a}=t;r.splice(a,1),a===r.length&&a--,n.setCheckedNode(r[a]),i.push(o.schemas,"删除组件")}function ke(t){s=t,s==null||s.addEventListener("scroll",()=>{F()}),H.useResizeObserver($,F),H.useResizeObserver(x,oe)}return L({handleInit:ke}),(t,r)=>{var y,a,w,b,V;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.withDirectives(e.createElementVNode("div",{ref_key:"selectorRef",ref:g,class:e.normalizeClass(["epic-checked-widget absolute pointer-events-none z-20",h.value+" "+(d.value?"transition-all":"")])},[e.createElementVNode("div",{class:"epic-widget-action-box",ref_key:"actionBoxRef",ref:N},[e.createElementVNode("div",Ce,e.toDisplayString((a=e.unref(l.pluginManager).getComponentConfingByType(((y=e.unref(n).state.checkedNode)==null?void 0:y.type)??""))==null?void 0:a.defaultSchema.label),1),P.value?(e.openBlock(),e.createElementBlock("div",Ne,[P.value&&!j.value?(e.openBlock(),e.createElementBlock("div",{key:0,title:"复制",class:"epic-widget-action-item pointer-events-auto",onClick:xe},[e.createVNode(e.unref(ee._sfc_main),{name:"icon--epic--copy-all-outline-rounded"})])):e.createCommentVNode("",!0),e.createVNode(e.unref(Q.ElDropdown),{onCommand:ge,trigger:"click"},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(Q.ElDropdownMenu),null,{default:e.withCtx(()=>[e.createVNode(e.unref(Q.ElDropdownItem),{command:"left"},{default:e.withCtx(()=>r[0]||(r[0]=[e.createTextVNode("添加左列")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"right"},{default:e.withCtx(()=>r[1]||(r[1]=[e.createTextVNode("添加右列")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"top"},{default:e.withCtx(()=>r[2]||(r[2]=[e.createTextVNode("添加上列")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"bottom"},{default:e.withCtx(()=>r[3]||(r[3]=[e.createTextVNode("添加下列")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"delete-row",divided:""},{default:e.withCtx(()=>r[4]||(r[4]=[e.createTextVNode("删除当前行")])),_:1}),e.createVNode(e.unref(Q.ElDropdownItem),{command:"delete-col"},{default:e.withCtx(()=>r[5]||(r[5]=[e.createTextVNode("删除当前列")])),_:1})]),_:1})]),default:e.withCtx(()=>[j.value?(e.openBlock(),e.createElementBlock("div",_e,[e.createVNode(e.unref(ee._sfc_main),{name:"icon--epic--window-outline"})])):e.createCommentVNode("",!0)]),_:1}),P.value&&!j.value?(e.openBlock(),e.createElementBlock("div",{key:1,title:"删除",class:"epic-widget-action-item pointer-events-auto",onClick:ye},[e.createVNode(e.unref(ee._sfc_main),{name:"icon--epic--delete-outline-rounded"})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],512)],2),[[e.vShow,z.value&&((w=e.unref(n).state.checkedNode)==null?void 0:w.id)!=="root"]]),e.withDirectives(e.createElementVNode("div",{ref_key:"hoverWidgetRef",ref:R,class:"epic-hover-widget absolute transition-all pointer-events-none z-998"},null,512),[[e.vShow,c.value&&((b=e.unref(n).state.checkedNode)==null?void 0:b.id)!==((V=e.unref(n).state.hoverNode)==null?void 0:V.id)]])],64)}}}),Be=e.defineComponent({name:"EditNodeItem",__name:"editNodeItem",props:{schemas:{}},emits:["update:schemas"],setup(Z,{emit:L}){const v=e.inject("designer"),o=e.inject("pageSchema"),n=e.inject("revoke"),C=Z,i=L,g=e.computed({get(){return C.schemas},set(d){i("update:schemas",d)}});function R(d){v.setCheckedNode(g.value[d]),v.setDisableHover(!0)}function N(){v.setDisableHover(),n.push(o.schemas,"拖拽组件")}function z(){n.push(o.schemas,"插入组件")}function c(d){var h,u,T;return d.id===((h=o.schemas[0])==null?void 0:h.id)||(T=(u=l.pluginManager.getComponentConfingByType(d.type))==null?void 0:u.editConstraints)!=null&&T.immovable?"unmover-item":"draggable-item"}return(d,h)=>(e.openBlock(),e.createBlock(e.unref(we.draggable),e.mergeProps({modelValue:g.value,"onUpdate:modelValue":h[0]||(h[0]=u=>g.value=u),"item-key":"id","component-data":{type:"transition-group"},class:"epic-draggable-range"},{animation:200,group:"edit-draggable",handle:".draggable-item",ghostClass:"moveing"},{onStart:h[1]||(h[1]=u=>R(u.oldIndex)),onEnd:h[2]||(h[2]=u=>N()),onAdd:h[3]||(h[3]=u=>{R(u.newIndex),z()})}),{item:e.withCtx(({element:u,index:T})=>[(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["widget-box",c(u)]),key:T},[e.createVNode(pe,{schema:u},null,8,["schema"])],2))]),_:1},16,["modelValue"]))}}),pe=e.defineComponent({name:"ENodeItem",__name:"nodeItem",props:{schema:{},name:{}},setup(Z){const L=e.useAttrs(),v=e.inject("designer"),o=e.inject("pageManager",{}),n=e.inject("pageSchema",{}),C=e.ref(null);e.provide("nodeAttrs",L);const i=Z,g=e.computed(()=>{var T,s,P,j,$;const c=o.componentInstances.value,d=(T=i.schema)==null?void 0:T.id,h=l.pluginManager.getComponentConfingByType((s=i.schema)==null?void 0:s.type)??null;if(!d||!(c!=null&&c[d]))return null;if(h!=null&&h.defaultSchema.input&&((P=i.schema)==null?void 0:P.noFormItem)!==!0)return(j=c[d+"formItem"])==null?void 0:j.$el;const u=c[d];return(($=u==null?void 0:u.$el)==null?void 0:$.nodeName)==="#text"?null:u==null?void 0:u.$el});e.watch(()=>g.value,c=>{c==null||c.addEventListener("click",R,!1),c==null||c.addEventListener("mouseover",N,!1),c==null||c.addEventListener("mouseout",z,!1)}),e.onUnmounted(()=>{var c,d,h;(c=g.value)==null||c.removeEventListener("click",R,!1),(d=g.value)==null||d.removeEventListener("mouseover",N,!1),(h=g.value)==null||h.removeEventListener("mouseout",z,!1)});function R(c){c.stopPropagation(),v.setCheckedNode(i.schema)}function N(c){var d;i.schema.id!==((d=n.schemas[0])==null?void 0:d.id)&&(c.stopPropagation(),v.setHoverNode(i.schema))}function z(c){c.stopPropagation(),v.setHoverNode(null)}return(c,d)=>{var u,T;const h=e.resolveComponent("ENodeItem");return e.openBlock(),e.createBlock(e.unref(H._sfc_main),{ref_key:"nodeRef",ref:C,componentSchema:i.schema},e.createSlots({_:2},[(T=(u=e.unref(l.pluginManager).getComponentConfingByType(i.schema.type))==null?void 0:u.editConstraints)!=null&&T.childImmovable?{name:"edit-node",fn:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.schema.children,s=>(e.openBlock(),e.createBlock(h,{key:s.id,schema:s},null,8,["schema"]))),128))]),key:"0"}:{name:"edit-node",fn:e.withCtx(()=>[i.schema.children?(e.openBlock(),e.createBlock(Be,{key:0,schemas:i.schema.children,"onUpdate:schemas":d[0]||(d[0]=s=>i.schema.children=s)},null,8,["schemas"])):e.createCommentVNode("",!0)]),key:"1"}]),1032,["componentSchema"])}}}),Ie={class:"min-w-750px rounded h-full"},Te=e.defineComponent({__name:"previewJson",setup(Z,{expose:L}){const v=l.pluginManager.getComponent("modal"),o=l.pluginManager.getComponent("monacoEditor"),n={theme:"vs-light",selectOnLineNumbers:!0,minimap:{enabled:!1},readOnly:!0},C=e.ref(null),i=e.ref(!1),g=e.inject("pageSchema");function R(){i.value=!1}function N(){i.value=!0,C.value?C.value.setValue(JSON.stringify(g,null,2)):setTimeout(()=>{N()},300)}function z(c="epic-data.json"){const d=JSON.stringify(g,null,2);var h=`data:text/json;charset=utf-8,${encodeURIComponent(d)}`,u=document.createElement("a");u.setAttribute("href",h),u.setAttribute("download",c),u.click()}return L({handleOpen:N}),(c,d)=>(e.openBlock(),e.createBlock(e.unref(v),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=h=>i.value=h),title:"查看数据",class:"w-900px",width:"900px",onClose:R,onOk:z,okText:"导出数据"},{default:e.withCtx(()=>[e.createElementVNode("div",Ie,[e.createVNode(e.unref(o),{ref_key:"monacoEditorRef",ref:C,class:"editor h-full",autoToggleTheme:"",readOnly:"",config:n,language:"json"},null,512)])]),_:1},8,["modelValue"]))}}),Ve={class:"epic-edit-toolbar flex items-center justify-between px-2"},Ee={class:"flex-1 h-full flex items-center"},De={key:0,class:"epic-divider"},Re=["title","onClick"],$e={class:"flex-1 h-full flex items-center justify-end"},Me={key:0,class:"flex items-center ml-12px"},Ue={class:"pr-8px w-82px cursor-pointer"},Le={class:"epic-device h-28px items-center gap-1 rounded-md border p-2px flex"},ze=["title","onClick"],Oe=e.defineComponent({__name:"toolbar",setup(Z){const L=l.pluginManager.getComponent("select"),{canvasScale:v,disabledZoom:o}=H.useStore(),n=e.ref("pc"),C=e.inject("pageSchema"),i=e.inject("designer"),g=e.inject("revoke"),R=e.ref(null),N=[{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"}],z=e.computed(()=>[{icon:"icon--epic--trash",title:"清空",on:s},{icon:"icon--epic--undo",title:"撤销",on:u,disabled:!g.recordList.value.length,divider:!0},{icon:"icon--epic--redo",title:"重做",on:T,disabled:!g.undoList.value.length}]),c=e.ref(null),d=e.computed({get(){return`${(v.value*100).toFixed(0)}%`},set(x){const _=parseFloat(x);v.value=_/100}}),h=[{label:"60%",value:"60%"},{label:"80%",value:"80%"},{label:"100%",value:"100%"},{label:"120%",value:"120%"},{label:"140%",value:"140%"}];function u(){const x=g.undo();x&&(l.deepCompareAndModify(C.schemas,x),i.setCheckedNode(C.schemas[0]))}function T(){const x=g.redo();x&&(l.deepCompareAndModify(C.schemas,x),i.setCheckedNode(C.schemas[0]))}function s(){i.reset()}function P(x){var q;const _=(q=x.target.files)==null?void 0:q[0];if(!_)return;x.target.value=null;const k=new FileReader;k.readAsText(_),k.onload=G=>{var M;j((M=G.target)==null?void 0:M.result)}}function j(x){try{let _=JSON.parse(x??"");_.schemas||(_=l.convertKFormData(_)),l.deepCompareAndModify(C,_)}catch(_){console.error(_)}}function $(x){i.handleToggleDeviceMode(x),n.value=x;const _={pc:{},pad:{width:"780px",mode:x},mobile:{width:"390px",height:"844px",mode:x}};C.canvas=_[x]}return(x,_)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Ve,[e.createElementVNode("div",Ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,(k,q)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:q},[k.divider?(e.openBlock(),e.createElementBlock("div",De)):e.createCommentVNode("",!0),e.createElementVNode("div",{title:k.title,class:e.normalizeClass(["epic-action-item text-base h-90% px-10px flex items-center cursor-pointer",{disabled:k.disabled}]),onClick:k.on},[e.createVNode(e.unref(ee._sfc_main),{name:k.icon},null,8,["name"])],10,Re)],64))),128))]),e.withDirectives(e.createElementVNode("input",{type:"file",ref_key:"fileRef",ref:c,accept:".json,.txt",onChange:P},null,544),[[e.vShow,!1]]),e.createElementVNode("div",$e,[e.unref(o)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("div",Ue,[e.createVNode(e.unref(L),{value:d.value,"onUpdate:value":_[0]||(_[0]=k=>d.value=k),modelValue:d.value,"onUpdate:modelValue":_[1]||(_[1]=k=>d.value=k),options:h,size:"small"},null,8,["value","modelValue"])])])),e.createElementVNode("div",Le,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(N,k=>e.createElementVNode("div",{key:k.key,title:k.title,class:e.normalizeClass(["epic-device-item h-full px-1 flex items-center cursor-pointer text-base transition-colors rounded-sm",{checked:k.key===n.value}]),onClick:q=>$(k.key)},[e.createVNode(e.unref(ee._sfc_main),{name:k.icon},null,8,["name"])],10,ze)),64))])])]),e.createVNode(Te,{ref_key:"previewJson",ref:R},null,512)],64))}}),He={class:"h-full flex flex-col relative"},je=["draggable"],Fe=e.defineComponent({__name:"editScreenContainer",setup(Z){const L=e.inject("pageSchema"),v=e.ref(null),o=e.ref(null),n=e.ref(null),{pressSpace:C,disabledZoom:i}=H.useStore(),{handleElementDragStart:g,handleElementDrag:R,handleElementDragEnd:N}=H.useElementDrag(v),{width:z,height:c}=H.useElementSize(v),{canvasScale:d,handleZoom:h}=H.useElementZoom(o);let u=0,T=0;const s=e.ref({}),P=e.ref({}),j=e.ref({}),$=e.shallowRef({width:0,height:0});e.watchEffect(_),e.watch(j,()=>{e.nextTick(x)});function x(){n.value&&($.value={width:n.value.clientWidth,height:n.value.clientHeight})}function _(){var M,E;j.value={width:((M=L.canvas)==null?void 0:M.width)??"0",height:((E=L.canvas)==null?void 0:E.height)??"0"}}H.watchOnce(z,k),e.watch($,k);function k(){let M=$.value.width||u,E=$.value.height||T;s.value={width:z.value+M+"px",height:c.value+E+"px"},P.value={width:M+"px",height:E+"px"},q()}function q(){e.nextTick(()=>{var K;let M=$.value.width||u;const U=($.value.height||T)/2,J=M/2;(K=v.value)==null||K.scrollTo(J,U)})}H.useResizeObserver(v,G),H.useResizeObserver(o,G);function G(){var E;if(!v.value)return;const M=v.value.getBoundingClientRect();if(u=M.width-60,T=M.height-80,!i.value)if($.value.width===0)d.value=1;else{const U=(u-20)/$.value.width,J=T/($.value.height||((E=o.value)==null?void 0:E.clientHeight)||1),K=Math.abs(U-1)<Math.abs(J-1);let F=1;K?F=U:F=J,(U<1||J<1)&&(F=Math.min(U,J)),F<1.4&&F>.5&&(d.value=F)}H.debounce(k,50)()}return(M,E)=>(e.openBlock(),e.createElementBlock("div",He,[e.createVNode(Oe),e.createElementVNode("div",{ref_key:"editScreenContainerRef",ref:v,class:e.normalizeClass(["flex-1 overflow-auto overflow-y-hidden epic-edit-screen-container",{"cursor-grab":e.unref(C)}]),draggable:e.unref(C),onWheel:E[0]||(E[0]=(...U)=>e.unref(h)&&e.unref(h)(...U)),onDragstart:E[1]||(E[1]=(...U)=>e.unref(g)&&e.unref(g)(...U)),onDragend:E[2]||(E[2]=(...U)=>e.unref(N)&&e.unref(N)(...U)),onDrag:E[3]||(E[3]=(...U)=>e.unref(R)&&e.unref(R)(...U))},[e.createElementVNode("div",{id:"canvasContainer",class:"flex items-center justify-center",style:e.normalizeStyle(s.value)},[e.createElementVNode("div",{ref_key:"draggableElRef",ref:o,class:"transition-all"},[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none":e.unref(C)}),style:e.normalizeStyle(P.value)},[e.renderSlot(M.$slots,"default")],6)],512)],4)],42,je),e.createElementVNode("div",{ref_key:"sizeBoxRef",ref:n,class:"absolute top-0 pointer-events-none",style:e.normalizeStyle(j.value)},null,4)]))}}),Ae={class:"epic-edit-canvas"},Pe=e.defineComponent({__name:"index",setup(Z){const L=e.ref(null),v=e.ref(null),o=e.inject("pageSchema"),n=e.computed(()=>o.schemas[0]),C=e.computed(()=>({width:"100%",height:"100%"}));return e.onMounted(()=>{var i;(i=v.value)==null||i.handleInit(L.value)}),(i,g)=>(e.openBlock(),e.createElementBlock("section",Ae,[e.createVNode(Fe,null,{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"epicEditRangeRef",ref:L,class:"epic-edit-range rounded-md overflow-auto relative",style:e.normalizeStyle(C.value)},[e.createVNode(pe,{schema:n.value},null,8,["schema"]),e.createVNode(be,{ref_key:"ePreviewWidgetsRef",ref:v},null,512)],4)]),_:1})]))}});exports.default=Pe;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),p=require("monaco-editor"),b=require("./index-DOWqiyzN.cjs"),h=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function v(l){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:()=>l[r]})}}return o.default=l,Object.freeze(o)}const i=v(p),_=a.defineComponent({__name:"index",props:{language:{default:"json"},readOnly:{type:Boolean,default:!1},valueFormat:{default:"string"},modelValue:{},config:{default:()=>({selectOnLineNumbers:!0,minimap:{enabled:!1}})},lineNumbers:{default:"on"},autoToggleTheme:{type:Boolean},theme:{default:"vs-light"}},emits:["update:modelValue"],setup(l,{expose:o,emit:r}){const t=l,s=r,c=a.ref(null);let e=null;const{isDark:f}=b.useTheme();function d(){f.value?i.editor.setTheme("vs-dark"):i.editor.setTheme("vs-light")}function m(u){e==null||e.setValue(u||"")}function g(u){const n=e==null?void 0:e.getPosition();n&&(e==null||e.executeEdits("",[{range:new i.Range(n.lineNumber,n.column,n.lineNumber,n.column),text:u}]),e==null||e.setPosition({...n,column:n.column+u.length}),e==null||e.focus())}return a.onMounted(()=>{e=i.editor.create(c.value,{value:u(),...t.config,language:t.language,readOnly:t.readOnly,lineNumbers:t.lineNumbers,theme:t.theme,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10},automaticLayout:!0}),t.autoToggleTheme&&a.watch(()=>f.value,()=>{a.nextTick(()=>d())},{immediate:!0});function u(){return t.valueFormat==="json"&&t.modelValue?JSON.stringify(t.modelValue,null,2):t.modelValue??""}e.onDidChangeModelContent(()=>{const n=e==null?void 0:e.getValue();if(t.valueFormat==="json"&&n){s("update:modelValue",JSON.parse(n));return}s("update:modelValue",n??"")})}),o({setValue:m,insertText:g}),(u,n)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"editContainer",ref:c,class:"epic-code-editor"},null,512))}}),y=h._export_sfc(_,[["__scopeId","data-v-3e2e893c"]]);exports.default=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),p=require("monaco-editor"),b=require("./index-BwLkOBWy.cjs"),h=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function v(l){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:()=>l[r]})}}return o.default=l,Object.freeze(o)}const i=v(p),_=a.defineComponent({__name:"index",props:{language:{default:"json"},readOnly:{type:Boolean,default:!1},valueFormat:{default:"string"},modelValue:{},config:{default:()=>({selectOnLineNumbers:!0,minimap:{enabled:!1}})},lineNumbers:{default:"on"},autoToggleTheme:{type:Boolean},theme:{default:"vs-light"}},emits:["update:modelValue"],setup(l,{expose:o,emit:r}){const t=l,s=r,c=a.ref(null);let e=null;const{isDark:f}=b.useTheme();function d(){f.value?i.editor.setTheme("vs-dark"):i.editor.setTheme("vs-light")}function m(u){e==null||e.setValue(u||"")}function g(u){const n=e==null?void 0:e.getPosition();n&&(e==null||e.executeEdits("",[{range:new i.Range(n.lineNumber,n.column,n.lineNumber,n.column),text:u}]),e==null||e.setPosition({...n,column:n.column+u.length}),e==null||e.focus())}return a.onMounted(()=>{e=i.editor.create(c.value,{value:u(),...t.config,language:t.language,readOnly:t.readOnly,lineNumbers:t.lineNumbers,theme:t.theme,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10},automaticLayout:!0}),t.autoToggleTheme&&a.watch(()=>f.value,()=>{a.nextTick(()=>d())},{immediate:!0});function u(){return t.valueFormat==="json"&&t.modelValue?JSON.stringify(t.modelValue,null,2):t.modelValue??""}e.onDidChangeModelContent(()=>{const n=e==null?void 0:e.getValue();if(t.valueFormat==="json"&&n){s("update:modelValue",JSON.parse(n));return}s("update:modelValue",n??"")})}),o({setValue:m,insertText:g}),(u,n)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"editContainer",ref:c,class:"epic-code-editor"},null,512))}}),y=h._export_sfc(_,[["__scopeId","data-v-3e2e893c"]]);exports.default=y;