You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.6 KiB
1 lines
3.6 KiB
import{a8 as c,H as i}from"./index-bVOhw2NF.js";import{c as s}from"./cloneDeep-C6NKQlMO.js";const u=c("pages",{state:()=>[{data:{...s(r)},current:{},preview:!1,initWidth:1920,initHeight:1080,initScale:1,theme:localStorage.getItem("vueuse-color-scheme")||"light",pageName:"页面1",activePage:!0}],getters:{pages:e=>e.$state,activePageIndex:e=>e.pages.findIndex(t=>t.activePage)},actions:{addPage(){this.pages.forEach(t=>{t.activePage=!1});const e={data:s(i(r)),current:{},preview:!1,initWidth:1920,initHeight:1080,initScale:1,theme:localStorage.getItem("vueuse-color-scheme")||"light",pageName:`页面${this.pages.length+1}`,activePage:!0};this.pages.push(e),this.toggle()},createCopy(e){this.pages.forEach(o=>{o.activePage=!1});const t=this.pages[e],a={...s(i(t)),pageName:`页面${this.pages.length+1}`,activePage:!0};this.pages.splice(e+1,0,a),this.toggle()},removePage(e){this.pages.length!==1&&(this.pages.splice(e,1),this.pages.forEach(t=>{t.activePage=!1}),this.pages[e-1].activePage=!0,this.toggle())},toggle(){const e=p();e.togglePage(),e.updateTheme(localStorage.getItem("vueuse-color-scheme")==="dark")},resetDatasets(){this.pages.forEach(e=>{e.data.elements.forEach(t=>{t.component==="es-group"?t.props.elements.forEach(a=>{a.props.datasets=a.initDatasets,a.dataSource.data=a.initDatasourceData}):(t.props.datasets=t.initDatasets,t.dataSource.data=t.initDatasourceData)})})}}}),r={container:{markline:{show:!0,color:""},guideLine:{horizontal:[],vertical:[]},snapToGrid:!1,gridSize:10,gridColor:"rgba(222,222,222,1)",gridOuterWidth:250,gridOuterHeight:250,gridTransform:{rotate:{x:36,y:172,z:10},scale:{x:1,y:1},skew:{x:-33,y:8},translate:{x:-109,y:-616}},style:{width:1920,height:1080,filter:"none",backgroundColor:"#f5f6f7",backgroundImage:"none",backgroundSize:"auto 100%",backgroundRepeat:"no-repeat",backgroundPosition:"center"},scaleRatio:60},globals:{variables:[],filters:[{name:"返回[info]、[values]和 [param]等数据",description:"仅供超级API 使用, 其它场景请勿使用",functionBody:"return result"}],apis:[]},elements:[]},p=c("editor",{state:()=>({data:{...s(r)},current:{},preview:!1,initWidth:1920,initHeight:1080,initScale:1,theme:localStorage.getItem("vueuse-color-scheme")||"light",pageName:"页面1",activePage:!0}),getters:{reversedElements:e=>[...e.data.elements].reverse()},actions:{togglePage(){const e=u();this.data=e.$state[e.activePageIndex].data,this.pageName=e.$state[e.activePageIndex].pageName,this.activePage=e.$state[e.activePageIndex].activePage,this.data.elements.forEach(t=>{t.selected=!1}),this.current={}},update(e){if(!e)return this.data={...s(r)};e&&!e.container&&(e.container={...s(r).container}),this.data=e||{}},updateTheme(e){e?(this.data.container.gridColor||(this.data.container.gridColor="#555"),this.data.container.style.backgroundColor==="#f5f6f7"&&(this.data.container.style.backgroundColor="#232324FF")):(this.data.container.gridColor||(this.data.container.gridColor="rgba(222,222,222,1)"),this.data.container.style.backgroundColor==="#232324FF"&&(this.data.container.style.backgroundColor="#f5f6f7"))},updateShape(){const e=this.current,t=e.rotate.x,a=e.rotate.y,o=e.rotate.z,n=e.scale.x,g=e.scale.y,d=e.scale.z,l=e.skew.x,h=e.skew.y;e.style&&(e.style.transform=`rotateX(${t}deg) rotateY(${a}deg) rotateZ(${o}deg) scaleX(${n}) scaleY(${g}) scaleZ(${d}) skewX(${l}deg) skewY(${h}deg)`)},updateStyle(e){const t=document.getElementById(`${e.id}-stylesheet`);if(t)t.textContent=e.props.styleSheet;else{const a=document.createElement("style");a.type="text/css",a.id=`${e.id}-stylesheet`,a.textContent=e.props.styleSheet,document.head.appendChild(a)}},updateDataSource(e){this.current.dataSource={...e,data:this.current.dataSource.data}}}});export{u as a,p as u};
|