wrapper-7b831916.js 6.3 KB

1
  1. import{g as O}from"./storage-08161d54.js";import"./querySelectorAll-a0b713c4.js";import{aq as W,d as f,o as i,c as l,F as P,p as q,ap as _,u as r,ar as E,ao as v,as as N,A as m,at as G,au as V,av as C,aw as X,B as Y,f as M,V as S,ax as Z,l as ee,h as F,ay as te,az as oe,aA as A,m as re,b as I,$ as L,w as ne,aB as se,aC as T,aD as ae,ae as ie}from"./index-ec08eff7.js";import{u as ce,f as le,a as ue}from"./index-9645f0b1.js";import{u as H}from"./useLifeHandler.hook-b2f35a4a.js";import{u as b,C as de}from"./chartEditStore-bf521111.js";import{l as R}from"./listen-42d046d4.js";import"./project.api-52997dcb.js";import"./SettingItem-e3862b0b.js";/* empty css */import"./SettingItemBox-76552639.js";import"./CollapseItem.vue_vue_type_script_setup_true_lang-9f643b07.js";import"./icon-97832eae.js";import"./index.esm.min-3e14e69f.js";import"./plugin-56cc5b01.js";import"./fileTypeEnum-21359a08.js";const z=(e,t)=>({zIndex:t+1,left:`${e.x}px`,top:`${e.y}px`}),x=(e,t)=>({width:`${t?t*e.w:e.w}px`,height:`${t?t*e.h:e.h}px`}),j=e=>({display:e.hide?"none":"block"}),J=e=>{const t={};return e&&e.overFlowHidden&&(t.overflow="hidden"),t},pe=e=>{const t=e.selectColor?{background:e.background}:{background:`url(${e.backgroundImage}) center center / cover no-repeat !important`};return{position:"relative",width:e.width?`${e.width||100}px`:"100%",height:e.height?`${e.height}px`:"100%",...t}},ye=()=>{window.$KeyboardActive={ctrl:!1,space:!1},document.onkeydown=e=>{const{keyCode:t}=e;if(t==32&&e.target==document.body&&e.preventDefault(),[17,32].includes(t)&&window.$KeyboardActive)switch(t){case 17:window.$KeyboardActive.ctrl=!0;break;case 32:window.$KeyboardActive.space=!0;const n=document.querySelector(".go-preview");n&&n.style.position==="absolute"&&(n.style.cursor="move");break}},document.onkeyup=e=>{const{keyCode:t}=e;if(t==32&&e.target==document.body&&e.preventDefault(),[17,32].includes(t)&&window.$KeyboardActive)switch(t){case 17:window.$KeyboardActive.ctrl=!1;break;case 32:window.$KeyboardActive.space=!1;break}const n=document.querySelector(".go-preview");n&&(n.style.cursor="default")}};let $=[0,0],D=[0,0];const B=e=>{var u,p;const t=document.querySelector(".go-preview");if(!t||t.style.position!=="absolute"||!((u=window.$KeyboardActive)!=null&&u.space))return;e.preventDefault(),e.stopPropagation(),(p=document.activeElement)==null||p.blur();const n=e.screenX,o=e.screenY,c=R(window,"mousemove",W(s=>{const d=s.screenX-n,h=s.screenY-o,[y,g]=$,[k,w]=D;if($=[g,d],D=[w,h],t){const Q=t.style.left?Number(t.style.left.split("px")[0]):0,U=t.style.top?Number(t.style.top.split("px")[0]):0;t.style.left=Q+(g>y?Math.abs(g-y):-Math.abs(g-y))+"px",t.style.top=U+(w>k?Math.abs(w-k):-Math.abs(w-k))+"px"}},20)),a=R(window,"mouseup",()=>{$=[0,0],D=[0,0],c(),a()})},ve=f({__name:"index",props:{groupData:{type:Object,required:!0},themeSetting:{type:Object,required:!0},themeColor:{type:Object,required:!0},groupIndex:{type:Number,required:!0}},setup(e){return(t,n)=>(i(),l("div",{class:_(r(E)(e.groupData.styles.animations)),style:v({...r(x)(e.groupData.attr),...r(C)(e.groupData.styles)})},[(i(!0),l(P,null,q(e.groupData.groupList,o=>(i(),l("div",{class:_(["chart-item",r(E)(o.styles.animations)]),key:o.id,style:v({...r(z)(o.attr,e.groupIndex),...r(j)(o.status),...r(J)(o.preview),...r(N)(o.styles)})},[(i(),m(Y(o.chartConfig.chartKey),G({id:o.id,chartConfig:o,themeSetting:e.themeSetting,themeColor:e.themeColor,style:{...r(x)(o.attr),...r(C)(o.styles),...r(X)(o.styles)}},V(r(H)(o))),null,16,["id","chartConfig","themeSetting","themeColor","style"]))],6))),128))],6))}});const me=M(ve,[["__scopeId","data-v-6e91b444"]]),fe=f({__name:"index",setup(e){const{initDataPond:t,clearMittDataPondMap:n}=ce(),o=b(),c=S(()=>o.editCanvasConfig.chartThemeSetting),a=S(()=>Z(o.editCanvasConfig.chartCustomThemeColorInfo)[o.editCanvasConfig.chartThemeColor]);return n(),ee(()=>{t(b)}),(u,p)=>(i(!0),l(P,null,q(r(o).componentList,(s,d)=>(i(),l("div",{class:_(["chart-item",r(E)(s.styles.animations)]),key:s.id,style:v({...r(z)(s.attr,d),...r(X)(s.styles),...r(j)(s.status),...r(J)(s.preview),...r(N)(s.styles),...r(x)(s.attr)})},[s.isGroup?(i(),m(r(me),{key:0,groupData:s,groupIndex:d,themeSetting:c.value,themeColor:a.value},null,8,["groupData","groupIndex","themeSetting","themeColor"])):(i(),m(Y(s.chartConfig.chartKey),G({key:1,id:s.id,chartConfig:s,themeSetting:c.value,themeColor:a.value,style:{...r(x)(s.attr),...r(C)(s.styles)}},V(r(H)(s))),null,16,["id","chartConfig","themeSetting","themeColor","style"]))],6))),128))}});const K=M(fe,[["__scopeId","data-v-358684c5"]]),he=e=>{const t=F(!1),n=setInterval(()=>{var o;if((o=window.$vue)!=null&&o.component){clearInterval(n);const c=a=>{window.$vue.component(a.chartConfig.chartKey)||window.$vue.component(a.chartConfig.chartKey,le(a.chartConfig))};e.componentList.forEach(async a=>{a.isGroup?a.groupList.forEach(u=>{c(u)}):c(a)}),t.value=!0}},200);return{show:t}},ge=e=>{const t=b();t.requestGlobalConfig=e[de.REQUEST_GLOBAL_CONFIG]},we=f({__name:"suspenseIndex",async setup(e){let t,n;[t,n]=te(()=>O()),await t,n();const o=b();oe(`预览-${o.editCanvasConfig.projectName}`);const c=S(()=>({overflow:"hidden",...pe(o.editCanvasConfig),...C(o.editCanvasConfig)})),a=S(()=>{const d=o.editCanvasConfig.previewScaleType;return d===A.SCROLL_Y||d===A.SCROLL_X});ge(o);const{entityRef:u,previewRef:p}=ue(o),{show:s}=he(o);return ye(),(d,h)=>(i(),l("div",{class:_(`go-preview ${r(o).editCanvasConfig.previewScaleType}`),onMousedown:h[0]||(h[0]=(...y)=>r(B)&&r(B)(...y))},[a.value?(i(),l("div",{key:0,ref_key:"entityRef",ref:u,class:"go-preview-entity"},[re("div",{ref_key:"previewRef",ref:p,class:"go-preview-scale"},[r(s)?(i(),l("div",{key:0,style:v(c.value)},[I(r(K))],4)):L("",!0)],512)],512)):(i(),l("div",{key:1,ref_key:"previewRef",ref:p,class:"go-preview-scale"},[r(s)?(i(),l("div",{key:0,style:v(c.value)},[I(r(K))],4)):L("",!0)],512))],34))}});const _e=M(we,[["__scopeId","data-v-c8c8cb5b"]]),Ce=f({__name:"index",setup(e){return(t,n)=>(i(),m(se,null,{default:ne(()=>[I(_e)]),_:1}))}}),Pe=f({__name:"wrapper",setup(e){let t=F(Date.now());try{[T.JSON,T.CHART_TO_PREVIEW].forEach(o=>{!window.opener||!window.opener.addEventListener||window.opener.addEventListener(o,async c=>{const a=await O();ae(ie.GO_CHART_STORAGE_LIST,[{...c.detail,id:a.id}]),t.value=Date.now()})})}catch(n){console.log(n)}return(n,o)=>(i(),m(Ce,{key:r(t)}))}});export{Pe as default};