zentaopms/www/static/js/chartEditStore-8254eca3.js
2023-05-16 10:47:08 +08:00

2 lines
22 KiB
JavaScript

var H=Object.defineProperty,q=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var U=(t,e,a)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,x=(t,e)=>{for(var a in e||(e={}))Y.call(e,a)&&U(t,a,e[a]);if(N)for(var a of N(e))V.call(e,a)&&U(t,a,e[a]);return t},_=(t,e)=>q(t,W(e));import{au as K,av as z,aw as $,ax as X,ay as j,az as Z,a0 as R,aA as Q,as as E,aB as G,aC as J,aa as tt,aD as et,aE as at,aF as rt,i as y,aG as I,aq as D,ar as st,aH as ot}from"./index-67a30bc6.js";import{a as g,b as i,l as C}from"./plugin-463a9df8.js";var P=(t=>(t.ECHARTS="echarts",t.NAIVE_UI="naiveUI",t.COMMON="common",t.STATIC="static",t))(P||{});const Zt=[{label:"\u6B63\u5E38",value:"normal"},{label:"\u6B63\u7247\u53E0\u5E95",value:"multiply"},{label:"\u53E0\u52A0",value:"overlay"},{label:"\u6EE4\u8272",value:"screen"},{label:"\u53D8\u6697",value:"darken"},{label:"\u53D8\u4EAE",value:"lighten"},{label:"\u989C\u8272\u51CF\u6DE1",value:"color-dodge"},{label:"\u989C\u8272\u52A0\u6DF1",value:"color-burn;"},{label:"\u5F3A\u5149",value:"hard-light"},{label:"\u67D4\u5149",value:"soft-light"},{label:"\u5DEE\u503C",value:"difference"},{label:"\u6392\u9664",value:"exclusion"},{label:"\u8272\u76F8",value:"hue"},{label:"\u9971\u548C\u5EA6",value:"saturation"},{label:"\u989C\u8272",value:"color"},{label:"\u4EAE\u5EA6",value:"luminosity"}];var O=(t=>(t.ON_CLICK="click",t.ON_DBL_CLICK="dblclick",t.ON_MOUSE_ENTER="mouseenter",t.ON_MOUSE_LEAVE="mouseleave",t))(O||{}),B=(t=>(t.VNODE_MOUNTED="vnodeMounted",t.VNODE_BEFORE_MOUNT="vnodeBeforeMount",t))(B||{}),it=(t=>(t.CHARTS="Charts",t.TABLES="Tables",t.INFORMATIONS="Informations",t.DECORATES="Decorates",t))(it||{}),nt=(t=>(t.CHARTS="\u56FE\u8868",t.TABLES="\u5217\u8868",t.INFORMATIONS="\u4FE1\u606F",t.DECORATES="\u5C0F\u7EC4\u4EF6",t))(nt||{}),ct=(t=>(t[t.VIEW=0]="VIEW",t[t.CONFIG=1]="CONFIG",t))(ct||{});const ht={requestDataType:K.STATIC,requestHttpType:z.GET,requestUrl:"",requestInterval:void 0,requestIntervalUnit:$.SECOND,requestContentType:X.DEFAULT,requestParamsBodyType:j.NONE,requestSQLContent:{sql:"select * from where"},requestParams:{Body:{"form-data":{},"x-www-form-urlencoded":{},json:"",xml:""},Header:{},Params:{}}};class ut{constructor(){this.id=R(),this.isGroup=!1,this.attr=_(x({},Q),{zIndex:-1}),this.styles={filterShow:!1,hueRotate:0,saturate:1,contrast:1,brightness:1,opacity:1,rotateZ:0,rotateX:0,rotateY:0,skewX:0,skewY:0,blendMode:"normal",animations:[]},this.status={lock:!1,hide:!1},this.request=E(ht),this.filter=void 0,this.events={baseEvent:{[O.ON_CLICK]:void 0,[O.ON_DBL_CLICK]:void 0,[O.ON_MOUSE_ENTER]:void 0,[O.ON_MOUSE_LEAVE]:void 0},advancedEvents:{[B.VNODE_MOUNTED]:void 0,[B.VNODE_BEFORE_MOUNT]:void 0}}}}class lt extends ut{constructor(){super(...arguments),this.isGroup=!0,this.chartConfig={key:"group",chartKey:"group",conKey:"group",category:"group",categoryName:"group",package:"group",chartFrame:P.COMMON,title:Z,image:""},this.groupList=[],this.key="group",this.option={},this.id=R(),this.attr={w:0,h:0,x:0,y:0,offsetX:0,offsetY:0,zIndex:-1}}}const dt=["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"];var ft={color:dt};const gt=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"];var Ct={color:gt};const pt=["#fc97af","#87f7cf","#f7f494","#72ccff","#f7c5a0","#d4a4eb","#d2f5a6","#76f2f2"];var bt={color:pt};const St=["#893448","#d95850","#eb8146","#ffb248","#f2d643","#ebdba4"];var Tt={color:St};const vt=["#2ec7c9","#b6a2de","#5ab1ef","#ffb980","#d87a80","#8d98b3","#e5cf0d","#97b552","#95706d","#dc69aa","#07a2a4","#9a7fd1","#588dd5","#f5994e","#c05050","#59678c","#c9ab00","#7eb00a","#6f5553","#c14089"];var Lt={color:vt};const kt=["#9b8bba","#e098c7","#8fd3e8","#71669e","#cc70af","#7cb4cc"];var At={color:kt};const Et=["#e01f54","#5e4ea5","#f5e8c8","#b8d2c7","#c6b38e","#a4d8c2","#f3d999","#d3758f","#dcc392","#2e4783","#82b6e9","#ff6347","#a092f1","#0a915d","#eaf889","#6699FF","#ff6666","#3cb371","#d5b158","#38b6b6"];var Ot={color:Et};const wt=["#c12e34","#e6b600","#0098d9","#2b821d","#005eaa","#339ca8","#cda819","#32a487"];var It={color:wt};const Dt=["#d87c7c","#919e8b","#d7ab82","#6e7074","#61a0a8","#efa18d","#787464","#cc7e63","#724e58","#4b565b"];var mt={color:Dt};const Rt=["#3fb1e3","#6be6c1","#626c91","#a0a7e6","#c4ebad","#96dee8"];var xt={color:Rt};const _t=["#516b91","#59c4e6","#edafda","#93b7e3","#a5e7f0","#cbb0e3"];var yt={color:_t};const Bt=["#4ea397","#22c3aa","#7bd9a5","#d0648a","#f58db2","#f2b3c9"];var Ft={color:Bt};const Nt={show:!0,textStyle:{color:"#BFBFBF",fontSize:18},subtextStyle:{color:"#A2A2A2",fontSize:14}},Ut={show:!0,name:"",nameGap:15,nameTextStyle:{color:"#B9B8CE",fontSize:12},inverse:!1,axisLabel:{show:!0,fontSize:12,color:"#B9B8CE",rotate:0},position:"bottom",axisLine:{show:!0,lineStyle:{color:"#B9B8CE",width:1},onZero:!0},axisTick:{show:!0,length:5},splitLine:{show:!1,lineStyle:{color:"#484753",width:1,type:"solid"}}},Gt={show:!0,name:"",nameGap:15,nameTextStyle:{color:"#B9B8CE",fontSize:12},inverse:!1,axisLabel:{show:!0,fontSize:12,color:"#B9B8CE",rotate:0},position:"left",axisLine:{show:!0,lineStyle:{color:"#B9B8CE",width:1},onZero:!0},axisTick:{show:!0,length:5},splitLine:{show:!0,lineStyle:{color:"#484753",width:1,type:"solid"}}},Pt={show:!0,top:"5%",textStyle:{color:"#B9B8CE"}},Mt={show:!1,left:"10%",top:"60",right:"10%",bottom:"60"};var Ht={title:Nt,xAxis:Ut,yAxis:Gt,legend:Pt,grid:Mt};const Qt={dark:Ct,customed:ft,macarons:Lt,walden:xt,purplePassion:At,vintage:mt,chalk:bt,westeros:yt,wonderland:Ft,essos:Tt,shine:It,roma:Ot},qt="dark",Jt={dark:"\u660E\u4EAE",customed:"\u6697\u6DE1",macarons:"\u9A6C\u5361\u9F99",walden:"\u84DD\u7EFF",purplePassion:"\u6DF1\u7D2B",vintage:"\u590D\u53E4",chalk:"\u7C89\u9752",westeros:"\u7070\u7C89",wonderland:"\u9752\u8349",essos:"\u6A58\u7EA2",shine:"\u6DF1\u8272",roma:"\u7F57\u9A6C\u7EA2"},te={dark:"linear-gradient(to right, #4992ff 0%, #7cffb2 100%)",customed:"linear-gradient(to right, #5470c6 0%, #91cc75 100%)",macarons:"linear-gradient(to right, #2ec7c9 0%, #b6a2de 100%)",walden:"linear-gradient(to right, #3fb1e3 0%, #6be6c1 100%)",purplePassion:"linear-gradient(to right, #9b8bba 0%, #e098c7 100%)",vintage:"linear-gradient(to right, #d87c7c 0%, #919e8b 100%)",chalk:"linear-gradient(to right, #fc97af 0%, #87f7cf 100%)",westeros:"linear-gradient(to right, #516b91 0%, #edafda 100%)",wonderland:"linear-gradient(to right, #4ea397 0%, #22c3aa 100%)",essos:"linear-gradient(to right, #893448 0%, #d95850 100%)",shine:"linear-gradient(to right, #c12e34 0%, #0098d9 100%)",roma:"linear-gradient(to right, #e01f54 0%, #5e4ea5 100%)"},ee={dark:["#4992ff","#7cffb2","rgba(68, 181, 226, 0.3)","rgba(73, 146, 255, 0.5)","rgba(124, 255, 178, 0.5)"],customed:["#5470c6","#91cc75","rgba(84, 112, 198, 0.5)","rgba(84, 112, 198, 0.5)","rgba(145, 204, 117, 0.5)"],macarons:["#2ec7c9","#b6a2de","rgba(182, 162, 222, 0.3)","rgba(46, 199, 201, 0.5)","rgba(182, 162, 222, 0.5)"],walden:["#3fb1e3","#6be6c1","rgba(68, 181, 226, 0.3)","rgba(63, 177, 227, 0.5)","rgba(107, 230, 193, 0.5)"],purplePassion:["#9b8bba","#e098c7","rgba(182, 162, 222, 0.3)","rgba(155, 139, 186, 0.5)","rgba(237, 175, 218, 0.5)"],vintage:["#d87c7c","#919e8b","rgba(182, 162, 222, 0.3)","rgba(216, 124, 124, 0.5)","rgba(145, 158, 139, 0.5)"],chalk:["#fc97af","#87f7cf","rgba(135, 247, 207, 0.3)","rgba(252, 151, 175, 0.5)","rgba(135, 247, 207, 0.5)"],westeros:["#516b91","#edafda","rgba(81, 107, 145, 0.3)","rgba(81, 107, 145, 0.5)","rgba(89, 196, 230, 0.5)"],wonderland:["#4ea397","#22c3aa","rgba(68, 181, 226, 0.3)","rgba(78, 163, 151, 0.5)","rgba(34, 195, 170, 0.5)"],essos:["#893448","#d95850","rgba(137, 52, 72, 0.3)","rgba(137, 52, 72, 0.5)","rgba(217, 88, 80, 0.5)"],shine:["#c12e34","#0098d9","rgba(137, 52, 72, 0.3)","rgba(193, 46, 52, 0.5)","rgba(230, 182, 0, 0.5)"],roma:["#e01f54","#5e4ea5","rgba(137, 52, 72, 0.3)","rgba(224, 31, 84, 0.5)","rgba(94, 78, 165, 0.5)"]},Wt=_(x({},Ht),{dataset:null});var o=(t=>(t.ADD="add",t.DELETE="delete",t.UPDATE="update",t.MOVE="move",t.COPY="copy",t.CUT="cut",t.PASTE="paste",t.TOP="top",t.BOTTOM="bottom",t.UP="up",t.DOWN="down",t.GROUP="group",t.UN_GROUP="unGroup",t.LOCK="lock",t.UNLOCK="unLock",t.HIDE="hide",t.SHOW="show",t))(o||{}),d=(t=>(t.CANVAS="canvas",t.CHART="chart",t))(d||{}),Yt=(t=>(t.BACK_STACK="backStack",t.FORWARD_STACK="forwardStack",t))(Yt||{}),w=(t=>(t.ID="id",t.TARGET_TYPE="targetType",t.ACTION_TYPE="actionType",t.HISTORY_DATA="historyData",t))(w||{});const Vt=G({id:"useChartHistoryStore",state:()=>({backStack:[],forwardStack:[]}),getters:{getBackStack(){return this.backStack},getForwardStack(){return this.forwardStack}},actions:{createStackItem(t,e,a=d.CHART){this.pushBackStackItem(Object.freeze({[w.ID]:new Date().getTime().toString(),[w.HISTORY_DATA]:t,[w.ACTION_TYPE]:e,[w.TARGET_TYPE]:a}))},canvasInit(t){this.createStackItem([t],o.ADD,d.CANVAS)},pushBackStackItem(t,e=!1){t instanceof Array?this.backStack=[...this.backStack,...t]:this.backStack.push(t),this.backStack.splice(0,this.backStack.length-J),!e&&this.clearForwardStack()},pushForwardStack(t){t instanceof Array?this.forwardStack=[...this.forwardStack,...t]:this.forwardStack.push(t)},popBackStackItem(){if(this.backStack.length>0)return this.backStack.pop()},popForwardStack(){if(this.forwardStack.length>0)return this.forwardStack.pop()},clearForwardStack(){this.forwardStack=[]},clearBackStack(){const t=this.getBackStack[0];this.backStack=[t]},backAction(){try{if(g(),this.getBackStack.length>1){const t=this.popBackStackItem();if(!t){i();return}return this.pushForwardStack(t),i(),t}i()}catch(t){C()}},forwardAction(){try{if(g(),this.getForwardStack.length){const t=this.popForwardStack();if(!t){i();return}return this.pushBackStackItem(t,!0),i(),t}i()}catch(t){C()}},createAddHistory(t){this.createStackItem(t,o.ADD,d.CHART)},createUpdateHistory(t){this.createStackItem(t,o.UPDATE,d.CHART)},createDeleteHistory(t){this.createStackItem(t,o.DELETE,d.CHART)},createMoveHistory(t){this.createStackItem(t,o.MOVE,d.CHART)},createLayerHistory(t,e){this.createStackItem(t,e,d.CHART)},createPasteHistory(t){this.createStackItem(t,o.CUT,d.CHART)},createGroupHistory(t){this.createStackItem(t,o.GROUP,d.CHART)},createUnGroupHistory(t){this.createStackItem(t,o.UN_GROUP,d.CHART)},createLockHistory(t){this.createStackItem(t,o.LOCK,d.CHART)},createUnLockHistory(t){this.createStackItem(t,o.UNLOCK,d.CHART)},createHideHistory(t){this.createStackItem(t,o.HIDE,d.CHART)},createShowHistory(t){this.createStackItem(t,o.SHOW,d.CHART)}}});var F=(t=>(t.EDIT_LAYOUT_DOM="editLayoutDom",t.EDIT_CONTENT_DOM="editContentDom",t.OFFSET="offset",t.SCALE="scale",t.USER_SCALE="userScale",t.LOCK_SCALE="lockScale",t.IS_CREATE="isCreate",t.IS_DRAG="isDrag",t.IS_SELECT="isSelect",t))(F||{}),Kt=(t=>(t.WIDTH="width",t.HEIGHT="height",t.CHART_THEME_COLOR="chartThemeColor",t.CHART_THEME_SETTING="chartThemeSetting",t.BACKGROUND="background",t.BACKGROUND_IMAGE="backgroundImage",t.SELECT_COLOR="selectColor",t.PREVIEW_SCALE_TYPE="previewScaleType",t))(Kt||{}),F=(t=>(t.START_X="startX",t.START_Y="startY",t.X="x",t.Y="y",t))(F||{}),m=(t=>(t.EDIT_RANGE="editRange",t.EDIT_CANVAS="editCanvas",t.RIGHT_MENU_SHOW="rightMenuShow",t.MOUSE_POSITION="mousePosition",t.TARGET_CHART="targetChart",t.RECORD_CHART="recordChart",t.EDIT_CANVAS_CONFIG="editCanvasConfig",t.REQUEST_GLOBAL_CONFIG="requestGlobalConfig",t.COMPONENT_LIST="componentList",t))(m||{});const f=Vt(),zt=tt(),ae=G({id:"useChartEditStore",state:()=>({editCanvas:{editLayoutDom:null,editContentDom:null,offset:20,scale:1,userScale:1,lockScale:!1,isCreate:!1,isDrag:!1,isSelect:!1},rightMenuShow:!1,mousePosition:{startX:0,startY:0,x:0,y:0},targetChart:{hoverId:void 0,selectId:[]},recordChart:void 0,editCanvasConfig:{width:1920,height:1080,filterShow:!1,hueRotate:0,saturate:1,contrast:1,brightness:1,opacity:1,rotateZ:0,rotateX:0,rotateY:0,skewX:0,skewY:0,blendMode:"normal",background:void 0,backgroundImage:void 0,selectColor:!0,chartThemeColor:qt,chartThemeSetting:Wt,previewScaleType:et},requestGlobalConfig:{requestDataPond:[],requestOriginUrl:"",requestInterval:at,requestIntervalUnit:rt,requestParams:{Body:{"form-data":{},"x-www-form-urlencoded":{},json:"",xml:""},Header:{},Params:{}}},componentList:[]}),getters:{getMousePosition(){return this.mousePosition},getRightMenuShow(){return this.rightMenuShow},getEditCanvas(){return this.editCanvas},getEditCanvasConfig(){return this.editCanvasConfig},getTargetChart(){return this.targetChart},getRecordChart(){return this.recordChart},getRequestGlobalConfig(){return this.requestGlobalConfig},getComponentList(){return this.componentList},getStorageInfo(){return{[m.EDIT_CANVAS_CONFIG]:this.getEditCanvasConfig,[m.COMPONENT_LIST]:this.getComponentList,[m.REQUEST_GLOBAL_CONFIG]:this.getRequestGlobalConfig}}},actions:{setEditCanvas(t,e){this.editCanvas[t]=e},setEditCanvasConfig(t,e){this.editCanvasConfig[t]=e},setRightMenuShow(t){this.rightMenuShow=t},setTargetHoverChart(t){this.targetChart.hoverId=t},setTargetSelectChart(t,e=!1){if(!this.targetChart.selectId.find(a=>a===t)){if(!t){this.targetChart.selectId=[];return}if(e){if(y(t)){this.targetChart.selectId.push(t);return}if(I(t)){this.targetChart.selectId.push(...t);return}}else{if(y(t)){this.targetChart.selectId=[t];return}if(I(t)){this.targetChart.selectId=t;return}}}},setRecordChart(t){this.recordChart=E(t)},setMousePosition(t,e,a,r){t&&(this.mousePosition.x=t),e&&(this.mousePosition.y=e),a&&(this.mousePosition.startX=a),r&&(this.mousePosition.startY=r)},fetchTargetIndex(t){const e=t||this.getTargetChart.selectId.length&&this.getTargetChart.selectId[0]||void 0;if(!e)return i(),-1;const a=this.componentList.findIndex(r=>r.id===e);if(a!==-1)return a;{const r=this.getComponentList.length;for(let s=0;s<r;s++)if(this.getComponentList[s].isGroup){for(const c of this.getComponentList[s].groupList)if(c.id===e)return s}}return-1},idPreFormat(t){const e=[];return t?(y(t)&&e.push(t),I(t)&&e.push(...t),e):(e.push(...this.getTargetChart.selectId),e)},addComponentList(t,e=!1,a=!1){if(t instanceof Array){t.forEach(r=>{this.addComponentList(r,e,a)});return}if(a&&f.createAddHistory([t]),e){this.componentList.unshift(t);return}this.componentList.push(t)},removeComponentList(t,e=!0){try{const a=this.idPreFormat(t),r=[];if(!a.length)return;g(),a.forEach(s=>{const c=this.fetchTargetIndex(s);c!==-1&&(r.push(this.getComponentList[c]),this.componentList.splice(c,1))}),e&&f.createDeleteHistory(r),i();return}catch(a){C()}},resetComponentPosition(t,e){const a=this.fetchTargetIndex(t.id);if(a>-1){const r=this.getComponentList[a];e?r.attr=Object.assign(r.attr,{x:t.attr.x+t.attr.offsetX,y:t.attr.y+t.attr.offsetY}):r.attr=Object.assign(r.attr,{x:t.attr.x,y:t.attr.y})}},moveComponentList(t){f.createMoveHistory(t)},updateComponentList(t,e){t<1&&t>this.getComponentList.length||(this.componentList[t]=e)},setPageStyle(t,e){const a=this.getEditCanvas.editContentDom;a&&(a.style[t]=e)},setBothEnds(t=!1,e=!0){try{if(this.getTargetChart.selectId.length>1)return;g();const a=this.getComponentList.length;if(a<2){i();return}const r=this.fetchTargetIndex(),s=this.getComponentList[r];if(r!==-1){if(t&&r===0||!t&&r===a-1){i();return}const c=(u,l)=>{const n=E(u);return n.attr.zIndex=l,n};e&&f.createLayerHistory([c(s,r)],t?o.BOTTOM:o.TOP),this.addComponentList(s,t),this.getComponentList.splice(t?r+1:r,1),i();return}}catch(a){C()}},setTop(t=!0){this.setBothEnds(!1,t)},setBottom(t=!0){this.setBothEnds(!0,t)},wrap(t=!1,e=!0){try{if(this.getTargetChart.selectId.length>1)return;g();const a=this.getComponentList.length;if(a<2){i();return}const r=this.fetchTargetIndex();if(r!==-1){if(t&&r===0||!t&&r===a-1){i();return}const s=t?r-1:r+1,c=this.getComponentList[r],u=this.getComponentList[s];e&&f.createLayerHistory([c],t?o.DOWN:o.UP),this.updateComponentList(r,u),this.updateComponentList(s,c),i();return}}catch(a){C()}},setUp(t=!0){this.wrap(!1,t)},setDown(t=!0){this.wrap(!0,t)},setCopy(t=!1){try{if(this.getTargetChart.selectId.length>1||document.getElementsByClassName("n-modal-body-wrapper").length)return;g();const e=this.fetchTargetIndex();if(e!==-1){const a={charts:this.getComponentList[e],type:t?o.CUT:o.COPY};this.setRecordChart(a),window.$message.success(t?"\u526A\u5207\u56FE\u8868\u6210\u529F":"\u590D\u5236\u56FE\u8868\u6210\u529F\uFF01"),i()}}catch(e){C()}},setCut(){this.setCopy(!0)},setParse(){try{g();const t=this.getRecordChart;if(t===void 0){i();return}const e=s=>(s=E(s),s.attr.x=this.getMousePosition.x+30,s.attr.y=this.getMousePosition.y+30,s.id=R(),s.isGroup&&s.groupList.forEach(c=>{c.id=R()}),s),a=t.type===o.CUT;(Array.isArray(t.charts)?t.charts:[t.charts]).forEach(s=>{this.addComponentList(e(s),void 0,!0),a&&(this.setTargetSelectChart(s.id),this.removeComponentList(void 0,!0))}),a&&this.setRecordChart(void 0),i()}catch(t){C()}},setBackAndSetForwardHandle(t,e=!1){if(t.targetType===d.CANVAS){this.editCanvas=t.historyData[0];return}this.setTargetSelectChart();let a=t.historyData;I(a)&&a.forEach(h=>{this.setTargetSelectChart(h.id,!0)});const r=t.actionType===o.ADD,s=t.actionType===o.DELETE;if(r||s){if(r&&e||s&&!e){a.forEach(h=>{this.addComponentList(h)});return}a.forEach(h=>{this.removeComponentList(h.id,!1)});return}if(t.actionType===o.MOVE){a.forEach(h=>{this.resetComponentPosition(h,e)});return}const u=t.actionType===o.TOP,l=t.actionType===o.BOTTOM;if(u||l){if(!e){u&&this.getComponentList.pop(),l&&this.getComponentList.shift(),this.getComponentList.splice(a[0].attr.zIndex,0,a[0]);return}u&&this.setTop(!1),l&&this.setBottom(!1)}const n=t.actionType===o.UP,p=t.actionType===o.DOWN;if(n||p){if(n&&e||p&&!e){this.setUp(!1);return}this.setDown(!1);return}const S=t.actionType===o.GROUP,b=t.actionType===o.UN_GROUP;if(S||b){if(S&&e||b&&!e){const h=[];a.length>1?a.forEach(A=>{h.push(A.id)}):a[0].groupList.forEach(M=>{h.push(M.id)}),this.setGroup(h,!1);return}a.length>1?this.setUnGroup([a[0].id],void 0,!1):this.setUnGroup([a[0].groupList[0].id],void 0,!1);return}const T=t.actionType===o.LOCK,v=t.actionType===o.UNLOCK;if(T||v){if(T&&e||v&&!e){a.forEach(h=>{this.setLock(!h.status.lock,!1)});return}a.forEach(h=>{this.setUnLock(!1)});return}const L=t.actionType===o.HIDE,k=t.actionType===o.SHOW;if(L||k){if(L&&e||k&&!e){a.forEach(h=>{this.setHide(!h.status.hide,!1)});return}a.forEach(h=>{this.setShow(!1)});return}},setBack(){try{g();const t=f.backAction();if(!t){i();return}this.setBackAndSetForwardHandle(t),i()}catch(t){C()}},setForward(){try{g();const t=f.forwardAction();if(!t){i();return}this.setBackAndSetForwardHandle(t,!0),i()}catch(t){C()}},setMove(t){const e=this.fetchTargetIndex();if(e===-1)return;const a=this.getComponentList[e].attr,r=zt.getChartMoveDistance;switch(t){case D.ARROW_UP:a.y-=r;break;case D.ARROW_RIGHT:a.x+=r;break;case D.ARROW_DOWN:a.y+=r;break;case D.ARROW_LEFT:a.x-=r;break}},setGroup(t,e=!0){try{const a=this.idPreFormat(t)||this.getTargetChart.selectId;if(a.length<2)return;g();const r=new lt,s={l:this.getEditCanvasConfig.width,t:this.getEditCanvasConfig.height,r:0,b:0},c=[],u=[],l=[];a.forEach(n=>{const p=this.fetchTargetIndex(n);p!==-1&&this.getComponentList[p].isGroup?this.setUnGroup([n],S=>{S.forEach(b=>{this.addComponentList(b),l.push(b.id)})},!1):p!==-1&&l.push(n)}),l.forEach(n=>{const p=this.componentList.splice(this.fetchTargetIndex(n),1)[0],{x:S,y:b,w:T,h:v}=p.attr,{l:L,t:k,r:h,b:A}=s;s.l=L>S?S:L,s.t=k>b?b:k,s.r=h<S+T?S+T:h,s.b=A<b+v?b+v:A,c.push(p),u.push(st(p))}),e&&f.createGroupHistory(u),c.forEach(n=>{n.attr.x=n.attr.x-s.l,n.attr.y=n.attr.y-s.t,r.groupList.push(n)}),r.attr.x=s.l,r.attr.y=s.t,r.attr.w=s.r-s.l,r.attr.h=s.b-s.t,this.addComponentList(r),this.setTargetSelectChart(r.id),i()}catch(a){console.log(a),window.$message.error("\u521B\u5EFA\u5206\u7EC4\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01"),i()}},setUnGroup(t,e,a=!0){try{const r=t||this.getTargetChart.selectId;if(r.length!==1)return;g();const s=u=>{const l=this.getComponentList[u];!l.isGroup||(a&&f.createUnGroupHistory(E([l])),l.groupList.forEach(n=>{n.attr.x=n.attr.x+l.attr.x,n.attr.y=n.attr.y+l.attr.y,e||this.addComponentList(n)}),this.setTargetSelectChart(l.id),this.removeComponentList(l.id,!1),e&&e(l.groupList))},c=this.fetchTargetIndex(r[0]);c!==-1&&s(c),i()}catch(r){console.log(r),window.$message.error("\u89E3\u9664\u5206\u7EC4\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01"),i()}},setLock(t=!0,e=!0){try{if(this.getTargetChart.selectId.length>1)return;g();const a=this.fetchTargetIndex();if(a!==-1){const r=this.getComponentList[a];r.status.lock=t,e&&(t?f.createLockHistory([r]):f.createUnLockHistory([r])),this.updateComponentList(a,r),t&&this.setTargetSelectChart(void 0),i();return}}catch(a){C()}},setUnLock(t=!0){this.setLock(!1,t)},setHide(t=!0,e=!0){try{if(this.getTargetChart.selectId.length>1)return;g();const a=this.fetchTargetIndex();if(a!==-1){const r=this.getComponentList[a];r.status.hide=t,e&&(t?f.createHideHistory([r]):f.createShowHistory([r])),this.updateComponentList(a,r),i(),t&&this.setTargetSelectChart(void 0)}}catch(a){C()}},setShow(t=!0){this.setHide(!1,t)},setPageSize(t){this.setPageStyle("height",`${this.editCanvasConfig.height*t}px`),this.setPageStyle("width",`${this.editCanvasConfig.width*t}px`)},computedScale(){if(this.getEditCanvas.editLayoutDom){const t=this.getEditCanvas.editLayoutDom.clientWidth-this.getEditCanvas.offset*2-5,e=this.getEditCanvas.editLayoutDom.clientHeight-this.getEditCanvas.offset*4,a=this.editCanvasConfig.width,r=this.editCanvasConfig.height,s=parseFloat((a/r).toFixed(5));if(parseFloat((t/e).toFixed(5))>s){const u=parseFloat((e*s/a).toFixed(5));this.setScale(u>1?1:u)}else{const u=parseFloat((t/s/r).toFixed(5));this.setScale(u>1?1:u)}}else window.$message.warning("\u8BF7\u5148\u521B\u5EFA\u753B\u5E03\uFF0C\u518D\u8FDB\u884C\u7F29\u653E")},listenerScale(){const t=ot(this.computedScale,200);return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},setScale(t,e=!1){(!this.getEditCanvas.lockScale||e)&&(this.setPageSize(t),this.getEditCanvas.userScale=t,this.getEditCanvas.scale=t)}}});export{O as B,m as C,B as E,ct as F,Yt as H,it as P,Vt as a,P as b,Qt as c,ut as d,ee as e,qt as f,Wt as g,nt as h,F as i,o as j,d as k,lt as l,Kt as m,Zt as n,Jt as o,te as p,ae as u};