mx-framework-plus 1.1.9 → 1.2.0
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.
|
@@ -7159,9 +7159,14 @@ const $e = {
|
|
|
7159
7159
|
this.closeImg = document.createElement("img"), this.closeImg.setAttribute("src", this.closeImage), this.closeImg.setAttribute("title", "Close"), this.closeImg.style.marginLeft = "2px", this.closeImg.style.cursor = "default", this.closeImg.style.display = "none", this.buttons.appendChild(this.closeImg), mxEvent.addGestureListeners(
|
|
7160
7160
|
this.closeImg,
|
|
7161
7161
|
mxUtils.bind(this, async function(o) {
|
|
7162
|
-
if (this.fireEvent(new mxEventObject(mxEvent.CLOSE, "event", o)), this.destroyOnClose)
|
|
7163
|
-
|
|
7164
|
-
|
|
7162
|
+
if (this.fireEvent(new mxEventObject(mxEvent.CLOSE, "event", o)), this.destroyOnClose) {
|
|
7163
|
+
let r = !0;
|
|
7164
|
+
return window.changeSchedule() && (r = await window.changeSchedule()), r && this.destroy(), !1;
|
|
7165
|
+
} else {
|
|
7166
|
+
let r = !0;
|
|
7167
|
+
window.changeSchedule() && (r = await window.changeSchedule()), r && this.setVisible(!1);
|
|
7168
|
+
}
|
|
7169
|
+
mxEvent.consume(o);
|
|
7165
7170
|
})
|
|
7166
7171
|
);
|
|
7167
7172
|
}, l.pupAry = t, t && t.length > 0) {
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
* vue-router v4.6.4
|
|
32
32
|
* (c) 2025 Eduardo San Martin Morote
|
|
33
33
|
* @license MIT
|
|
34
|
-
*/function Be(){return r.inject(Qt)}const De={init(t){let e=["/js/mxClient.js"];return new Promise(a=>{const s=document.getElementsByTagName("script");let o=!1;for(let x=0;x<s.length;x++)s[x].src.includes("mxClient.js")&&(o=!0);if(o)return a();let h=e.map(x=>{let S=document.createElement("script");return S.type="text/javascript",S.async=!1,S.src=x,document.head.appendChild(S),S}).pop();h.onload=a})}},Te=[{title:"新建",image:null,code:"new",iconCls:"iconfont icon-new",isBorder:!0,children:[{iconClass:"",code:"add",iconCls:"iconfont icon-binding-label",title:"标签",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",style:"",child:!0},{iconClass:"",code:"add",iconCls:"iconfont icon-Imagefile",title:"图片",name:"grNewImg",canNotUse:!1,type:"kitUI:PictureWidget",style:"",child:!0},{code:"add",title:"矩形",image:null,iconCls:"iconfont icon-rectangle",type:"kitUI:ShapeRectWidget"},{code:"add",image:null,iconCls:"iconfont icon-rotundity",title:"圆形",type:"kitUI:ShapeCircleWidget"},{code:"add",iconCls:"iconfont icon-triangle",image:null,title:"等腰三角形",type:"kitUI:ShapeTriangleWidget"},{code:"add",iconCls:"iconfont icon-lingxing1",title:"棱形",disable:!1,type:"shape:Polygon"},{code:"add",iconCls:"iconfont icon-duobianxing-01",title:"正五边形",disable:!1,type:"shape:Pentagon"},{code:"add",iconCls:"iconfont icon-ziyuan",title:"正六边形",disable:!1,type:"shape:Hexagon"},{code:"add",iconCls:"iconfont icon-duobianxing",title:"任意多边形",disable:!1,type:"shape:Polygons"}]},{title:"复制",image:null,code:"copy",iconCls:"iconfont icon-copy"},{title:"克隆",image:null,code:"clone",iconCls:"iconfont icon-clone"},{title:"剪切",image:null,code:"cut",iconCls:"iconfont icon-cut"},{title:"粘贴",image:null,code:"paste",iconCls:"iconfont icon-paste"},{title:"删除",code:"del",image:null,iconCls:"iconfont icon-delete",isBorder:!0},{title:"排列",code:"order",image:null,iconCls:"iconfont icon-arrange",isBorder:!0,children:[{iconClass:"",code:"alignLeft",iconCls:"iconfont icon-left-align",title:"左对齐",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignCenterHorizontal",iconCls:"iconfont icon-horizontal-center",title:"水平居中",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignRight",iconCls:"iconfont icon-right-align",title:"右对齐",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignCellsTop",iconCls:"iconfont icon-top-align",title:"顶端对齐",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignCenterVertical",iconCls:"iconfont icon-vertical-center",title:"垂直居中",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignCellsBottom",iconCls:"iconfont icon-bottom-align",title:"底端对齐",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0}]},{title:"图层",code:"view",image:null,iconCls:"iconfont icon-view",isBorder:!0,children:[{title:"置顶",code:"toUp",image:null,iconCls:"iconfont icon-top"},{title:"置底",code:"toDown",image:null,iconCls:"iconfont icon-bottom",isBorder:!0},{title:"上一层",code:"upOne",image:null,iconCls:"iconfont icon-top"},{title:"下一层",code:"downOne",image:null,iconCls:"iconfont icon-bottom",isBorder:!0}]},{title:"编辑",code:"edit",image:null,disable:!0,iconCls:"iconfont icon-edit"}],Xt={components:{},props:{menus:{type:Array,default:Te},isShow:{type:Boolean,default:!1},isPreview:{type:Boolean,default:!1},currentIndex:{type:Number,default:0}},data(){return{graph:null,yhz:null,cell:null,loadCells:null,scale:1,pageShortcuts:!1,timeLineMap:[],updateRaf:null,keys:Math.random().toString(36).substring(2),compMap:[],pupAry:[],resizeObserver:null,isShowPup:!1,wndAry:[],thisObj:new Map,centeredWindow:[]}},watch:{isPreview:{handler(t,e){let a=this;a.yhz&&(a.yhz.isPreview(!t),a.$nextTick(()=>{t?(a.keys=Math.random().toString(36).substring(2),a.graph.refresh(),a.scheduleUpdateOverlay(),a.timeLineMap.length>0&&a.timeLineMap.forEach(s=>{s.cell.setVisible(!1)})):(a.timeLineMap.length>0&&a.timeLineMap.forEach(s=>{s.cell.setVisible(!0)}),a.centeredWindow&&a.centeredWindow.forEach(o=>{o&&(o.setVisible(!1),o.destroy())}))}))},immediate:!0,deep:!0}},methods:{getStyle(t){let e=this,s=t.cell.style||{};return e.yhz.scheduleBorder(s)},handleshowAndHide(t,e){},dynamicComponent(t){return this.compMap.get(t)},scheduleUpdateOverlay(){let t=this;this.updateRaf&&cancelAnimationFrame(this.updateRaf),this.updateRaf=requestAnimationFrame(()=>{t.$nextTick(()=>{var a=t.graph.getModel().cells,s=Object.values(a);let o=s.filter(m=>m.crtype=="schedule");for(let m=0;m<o.length;m++){let h=o[m];t.graph.view.validateCell(h)}}),this.$forceUpdate(),this.updateRaf=null})},async addTimeLine({cellAry:t,scheduleCombination:e}){let a=this;a.$nextTick(()=>{for(let s=0;s<t.length;s++){let o=t[s],m={id:o.id,cell:o,other:o.other,compId:o.id,show:!0};a.timeLineMap.push(m),a.thisObj.set(o.id,e)}a.compMap=Object.freeze(a.thisObj),this.$forceUpdate()})},removeKeyUpDown(){let t=this;t.yhz&&t.yhz.removeKeyUpDown()},keyUpdownEvent(){let t=this;t.yhz&&(t.yhz.keyUpdownEvent(),console.log("绑定键盘事件"))},addCode(t){let e=this;e.yhz&&e.yhz.addCode({code:t})},setPageShortcuts(t){let e=this;e.yhz&&(e.yhz.setPageShortcuts(t),e.pageShortcuts=t)},setIsPreview(t){let e=this;e.yhz&&(e.onResize(),e.yhz.isPreview(t))},clearUndo(){let t=this;if(t.yhz)return t.yhz.clearUndo()},zoomHome(){let t=this;t.graph.zoomTo(1),t.yhz.changePageSize()},redo(){let t=this;if(t.yhz)return t.handelEvent({key:"unre"}),t.yhz.redo()},undo(){let t=this;if(t.yhz)return t.handelEvent({key:"unre"}),t.yhz.undo()},canRedo(){let t=this;return t.yhz?t.yhz.canRedo():!1},canUndo(){let t=this;return t.yhz?t.yhz.canUndo():!1},view(){let t=this,e=this.cell,a={background:"#000",color:"#fff",border:"1px solid #fff"};t.yhz.updateCell(e,a)},changeSize(t){this.yhz.changePageSize(t)},preview(){Be().push({path:"/preview"})},contextmenus(t,e){e&&(this.yhz.addEvent(e),t.preventDefault(),t.stopPropagation())},changeTimeLineShow(){let t=this,e=[],a=t.graph.getModel();Object.values(a.cells).forEach(o=>{e.push(o.id)}),t.timeLineMap=t.timeLineMap.filter(o=>e.includes(o.id))},handelEvent(t){let e=this;e.cell=t.val,t.key=="delete"&&e.changeTimeLineShow(),e.$emit("handelEvent",t)},loadJson(){this.yhz.loadJson()},async loadXml(t,e){let a=this;t?a.yhz.fromXmlToView(t):a.yhz.initCanvas(null,a.$refs.transparentRectRef)},async init(){let t=this,e=t.$refs.geEditor;const a=new ze(t);if(!t.graph){let s=await a.init({container:e,menus:t.menus,pageShortcuts:t.pageShortcuts});t.graph=s,t.delCell(s),t.yhz=a,t.$emit("handelEvent",{key:"init",mygraph:s,yhz:a}),setTimeout(()=>{a.isPreview(!t.isPreview)},0)}},delCell(t){let e=this;t.addListener(mxEvent.DELETE_CELLS,(a,s)=>{const o=s.properties.cells;let m=[];o&&o.length>0&&(o.forEach(h=>{m.push(h.id)}),e.timeLineMap.forEach(h=>{m.includes(h.id)&&(h.show=!1)}))})},onResize(){let t=this;t.yhz&&(t.yhz.changePageSize(),t.yhz.getFloatingPosition())},clearCanvas(){let t=this;t.yhz&&t.yhz.clearCanvas()},openPupop(t,e=!0){let a=this;if(mxWindow.prototype.installCloseHandler=function(){this.closeImg=document.createElement("img"),this.closeImg.setAttribute("src",this.closeImage),this.closeImg.setAttribute("title","Close"),this.closeImg.style.marginLeft="2px",this.closeImg.style.cursor="default",this.closeImg.style.display="none",this.buttons.appendChild(this.closeImg),mxEvent.addGestureListeners(this.closeImg,mxUtils.bind(this,async function(s){if(this.fireEvent(new mxEventObject(mxEvent.CLOSE,"event",s)),this.destroyOnClose)return await window.changeSchedule()&&this.destroy(),!1;await window.changeSchedule()&&this.setVisible(!1),mxEvent.consume(s)}))},a.pupAry=t,t&&t.length>0){a.centeredWindow&&a.centeredWindow.forEach(m=>{m&&(m.setVisible(!1),m.destroy())});let s=[];t.forEach((o,m)=>{var h=document.createElement("div");if(o.type==="img"){h.style.overflow="auto",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center";var x=document.createElement("img");x.src=o.path,h.appendChild(x)}else if(o.type==="time"){let{el:P}=o.vnode;h.style.overflow="auto",h.style.width="100%",h.style.height="100%",h.appendChild(P)}else{h.style.overflow="auto",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center";var S=o.pathHtml;h.appendChild(S)}let b=0,y=0;if(o.isCenter=="false")b=o.left,y=o.top;else{var C=document.getElementById("app"),D=C.clientWidth,z=C.clientHeight;b=(D-o.width)/2,y=(z-o.height)/2}b<0&&(b=0),y<0&&(y=0);var B=document.createElement("div");let k=document.querySelectorAll(".mx-window-mask");var T=new mxWindow(o.title,h,b,y,o.width,o.height,!1,!0,"mxWindowTitle");T.setClosable(!0),T.setMaximizable(!0),T.setScrollable(!0),T.setResizable(!0),T.setVisible(e),T.constrainWithinViewport=!0,T.addListener(mxEvent.CLOSE,function(P,F){return a.isShowPup=!1,k=document.querySelectorAll(".mx-window-mask"),k&&k.length>0&&k.forEach(j=>{j.style.display="none",j.remove()}),!1}),T.addListener(mxEvent.MOVE,function(P,F){var j=T.getX(),H=T.getY(),I=T.getElement().offsetWidth,Z=T.getElement().offsetHeight,K=document.documentElement.clientWidth,ee=document.documentElement.clientHeight,ne=0,oe=0,re=K-I,se=ee-Z;j=Math.max(ne,Math.min(j,re)),H=Math.max(oe,Math.min(H,se)),T.setLocation(j,H)}),T.div&&k.length==0&&(T.div.style.zIndex=2e3+m,B.className="mx-window-mask",B.style.zIndex=30+m,document.body.appendChild(B),B.style.display="block"),s.push(T)}),a.centeredWindow=s,a.wndAry=s}},getWindowInfo(){let t=this,e=t.wndAry;e&&e.length>0&&e.forEach((a,s)=>{if(a){let o=t.pupAry[s];o&&t.openPupop([o],a.isVisible())}})},debounce(t,e=200){let a=null;return function(...s){clearTimeout(a),a=setTimeout(()=>{t.apply(this,s)},e)}},debouncedScroll(t){let e=this;if(e.graph){var a=e.graph.container;a.addEventListener("scroll",function(){console.log("元素滚动:",a.scrollTop,a.scrollLeft)})}}},mounted(){let t=this,e=t.$refs.geEditor;De.init().then(()=>{t.init()}),t.resizeObserver=new ResizeObserver(a=>{t.onResize(null)}),t.resizeObserver.observe(e),window.addEventListener("resize",t.getWindowInfo)},unmounted(){let t=this;t.resizeObserver&&t.resizeObserver.disconnect(),t.isShowPup=!1,t.centeredWindow&&t.centeredWindow.forEach(a=>{a&&(a.setVisible(!1),a.destroy())}),window.removeEventListener("resize",t.getWindowInfo)}},Zt=["id"],Jt={key:0,class:"transparentRect"},qt=["id"];function Kt(t,e,a,s,o,m){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["main-gd",{"show-scroll":a.isPreview}]),ref:"mainGd"},[r.createElementVNode("div",{class:r.normalizeClass(["main-body",{"hidden-scroll":a.isPreview}]),ref:"geEditor",id:a.currentIndex},null,10,Zt),a.isShow?(r.openBlock(),r.createElementBlock("div",Jt)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(o.timeLineMap,(h,x)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:h.id+o.keys,id:h.id,style:r.normalizeStyle([{position:"absolute"},m.getStyle(h)]),class:r.normalizeClass(h.id)},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(m.dynamicComponent(h.compId)),{id:h.other.timeId+"",thisTab:h.other.thisTab},null,8,["id","thisTab"]))],14,qt)),[[r.vShow,o.timeLineMap.length>0&&a.isPreview]])),128))],2)}const $t=q(Xt,[["render",Kt]]),ea={components:{},props:{menus:{type:Array,default:Te},isShow:{type:Boolean,default:!1},isPreview:{type:Boolean,default:!0},currentIndex:{type:Number,default:0}},data(){return{graph:null,yhz:null,cell:null,loadCells:null,scale:1,pageShortcuts:!1,timeLineMap:[],compMap:[],pupAry:[],resizeObserver:null,isShowPup:!1}},watch:{isPreview:{handler(t,e){let a=this;a.yhz&&(a.yhz.isPreview(!t),a.$nextTick(()=>{t?(a.keys=Math.random().toString(36).substring(2),a.graph.refresh(),a.scheduleUpdateOverlay()):window.centeredWindow&&window.centeredWindow.forEach(o=>{o&&(o.setVisible(!1),o.destroy())})}))},immediate:!0,deep:!0}},methods:{dynamicComponent(t){return this.compMap[t]},scheduleUpdateOverlay(){let t=this;this.updateRaf&&cancelAnimationFrame(this.updateRaf),this.updateRaf=requestAnimationFrame(()=>{t.$nextTick(()=>{var a=t.graph.getModel().cells,s=Object.values(a);let o=s.filter(m=>m.crtype=="schedule");for(let m=0;m<o.length;m++){let h=o[m];t.graph.view.validateCell(h)}}),this.$forceUpdate(),this.updateRaf=null})},async addTimeLine({cellAry:t,scheduleCombination:e}){let a=this;a.$nextTick(()=>{let s={};for(let o=0;o<t.length;o++){let m=t[o],h={id:m.id,cell:m,other:m.other,compId:m.id,show:!0};a.timeLineMap.push(h),s[m.id]=e}a.compMap=Object.freeze(s),this.$forceUpdate()})},removeKeyUpDown(){let t=this;t.yhz&&t.yhz.removeKeyUpDown()},keyUpdownEvent(){let t=this;t.yhz&&t.yhz.keyUpdownEvent()},addCode(t){let e=this;e.yhz&&e.yhz.addCode({code:t})},setPageShortcuts(t){let e=this;e.yhz&&(e.yhz.setPageShortcuts(t),e.pageShortcuts=t)},setIsPreview(t){let e=this;e.yhz&&(e.onResize(),e.yhz.isPreview(t))},clearUndo(){let t=this;if(t.yhz)return t.yhz.clearUndo()},zoomHome(){let t=this;t.graph.zoomTo(1),t.yhz.changePageSize()},redo(){let t=this;if(t.yhz)return t.handelEvent({key:"unre"}),t.yhz.redo()},undo(){let t=this;if(t.yhz)return t.handelEvent({key:"unre"}),t.yhz.undo()},canRedo(){let t=this;return t.yhz?t.yhz.canRedo():!1},canUndo(){let t=this;return t.yhz?t.yhz.canUndo():!1},view(){let t=this,e=this.cell,a={background:"#000",color:"#fff",border:"1px solid #fff"};t.yhz.updateCell(e,a)},changeSize(t){this.yhz.changePageSize(t)},preview(){Be().push({path:"/preview"})},contextmenus(t,e){e&&(this.yhz.addEvent(e),t.preventDefault(),t.stopPropagation())},handelEvent(t){let e=this;e.cell=t.val,e.$emit("handelEvent",t)},loadJson(){this.yhz.loadJson()},async loadXml(t,e){let a=this;t?a.yhz.fromXmlToView(t):a.yhz.initCanvas(null,a.$refs.transparentRectRef)},async init(){let t=this,e=t.$refs.geEditor;const a=new ze(t);if(!t.graph){let s=await a.init({container:e,menus:t.menus,pageShortcuts:t.pageShortcuts});t.graph=s,t.yhz=a,t.$emit("handelEvent",{key:"init",mygraph:s,yhz:a}),setTimeout(()=>{a.isPreview(!t.isPreview)},0)}},onResize(){let t=this;t.yhz&&t.yhz.changePageSize()},clearCanvas(){let t=this;t.yhz&&t.yhz.clearCanvas()},openPupop(t,e=!0){let a=this;if(a.pupAry=t,t&&t.length>0){window.centeredWindow&&window.centeredWindow.forEach(m=>{m&&(m.setVisible(!1),m.destroy())});let s=[];t.forEach(o=>{var m=document.createElement("div");if(o.type==="img"){m.style.overflow="auto",m.style.width="100%",m.style.height="100%",m.style.display="flex",m.style.justifyContent="center",m.style.alignItems="center";var h=document.createElement("img");h.src=o.path,m.appendChild(h)}else if(o.type==="time"){let{el:B}=o.vnode;m.style.overflow="auto",m.style.width="100%",m.style.height="100%",m.appendChild(B)}else{m.style.overflow="auto",m.style.width="100%",m.style.height="100%";var x=o.pathHtml;m.appendChild(x)}let S=0,b=0;if(o.isCenter=="false")S=o.left,b=o.top;else{var y=document.getElementById("app"),C=y.clientWidth,D=y.clientHeight;S=(C-o.width)/2,b=(D-o.height)/2}var z=new mxWindow(o.title,m,S,b,o.width,o.height,!0,!0,"mxWindowTitle");z.setClosable(!0),z.setMaximizable(!1),z.setResizable(!0),z.setVisible(e),z.constrainWithinViewport=!0,z.addListener(mxEvent.CLOSE,function(B,k){a.isShowPup=!1}),z.addListener(mxEvent.MOVE,function(B,k){var T=z.getX(),P=z.getY(),F=z.getElement().offsetWidth,j=z.getElement().offsetHeight,H=document.documentElement.clientWidth,I=document.documentElement.clientHeight,Z=0,K=0,ee=H-F,ne=I-j;T=Math.max(Z,Math.min(T,ee)),P=Math.max(K,Math.min(P,ne)),z.setLocation(T,P)}),s.push(z)}),window.centeredWindow=s,a.wndAry=s}}},mounted(){let t=this;De.init().then(()=>{t.init()}),t.resizeObserver=new ResizeObserver(e=>{e.forEach(a=>{const{width:s,height:o}=a.contentRect;t.onResize(),t.openPupop(t.pupAry)})}),t.resizeObserver.observe(t.$refs.geEditor)},unmounted(){let t=this;t.resizeObserver&&t.resizeObserver.disconnect(),t.isShowPup=!1,window.centeredWindow&&window.centeredWindow.forEach(a=>{a&&(a.setVisible(!1),a.destroy())})}},ta={class:"main-gd",ref:"mainGd"},aa=["id"],la={key:0,class:"transparentRect"},na=["id"];function ia(t,e,a,s,o,m){return r.openBlock(),r.createElementBlock("div",ta,[r.createElementVNode("div",{class:"main-body",ref:"geEditor",id:a.currentIndex},[a.isShow?(r.openBlock(),r.createElementBlock("div",la)):r.createCommentVNode("",!0),o.timeLineMap.length>0&&a.isPreview?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:1},r.renderList(o.timeLineMap,(h,x)=>(r.openBlock(),r.createElementBlock("div",{key:h.id,id:h.id,class:r.normalizeClass(h.id),style:r.normalizeStyle([{position:"absolute"},{zIndex:0}])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(m.dynamicComponent(h.compId)),{id:h.other.timeId+"",thisTab:h.other.thisTab},null,8,["id","thisTab"]))],10,na))),128)):r.createCommentVNode("",!0)],8,aa)],512)}const oa=q(ea,[["render",ia]]);J.mxCodeSvg=$t,J.mxCodeSvgPreview=oa,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})});
|
|
34
|
+
*/function Be(){return r.inject(Qt)}const De={init(t){let e=["/js/mxClient.js"];return new Promise(a=>{const s=document.getElementsByTagName("script");let o=!1;for(let x=0;x<s.length;x++)s[x].src.includes("mxClient.js")&&(o=!0);if(o)return a();let h=e.map(x=>{let S=document.createElement("script");return S.type="text/javascript",S.async=!1,S.src=x,document.head.appendChild(S),S}).pop();h.onload=a})}},Te=[{title:"新建",image:null,code:"new",iconCls:"iconfont icon-new",isBorder:!0,children:[{iconClass:"",code:"add",iconCls:"iconfont icon-binding-label",title:"标签",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",style:"",child:!0},{iconClass:"",code:"add",iconCls:"iconfont icon-Imagefile",title:"图片",name:"grNewImg",canNotUse:!1,type:"kitUI:PictureWidget",style:"",child:!0},{code:"add",title:"矩形",image:null,iconCls:"iconfont icon-rectangle",type:"kitUI:ShapeRectWidget"},{code:"add",image:null,iconCls:"iconfont icon-rotundity",title:"圆形",type:"kitUI:ShapeCircleWidget"},{code:"add",iconCls:"iconfont icon-triangle",image:null,title:"等腰三角形",type:"kitUI:ShapeTriangleWidget"},{code:"add",iconCls:"iconfont icon-lingxing1",title:"棱形",disable:!1,type:"shape:Polygon"},{code:"add",iconCls:"iconfont icon-duobianxing-01",title:"正五边形",disable:!1,type:"shape:Pentagon"},{code:"add",iconCls:"iconfont icon-ziyuan",title:"正六边形",disable:!1,type:"shape:Hexagon"},{code:"add",iconCls:"iconfont icon-duobianxing",title:"任意多边形",disable:!1,type:"shape:Polygons"}]},{title:"复制",image:null,code:"copy",iconCls:"iconfont icon-copy"},{title:"克隆",image:null,code:"clone",iconCls:"iconfont icon-clone"},{title:"剪切",image:null,code:"cut",iconCls:"iconfont icon-cut"},{title:"粘贴",image:null,code:"paste",iconCls:"iconfont icon-paste"},{title:"删除",code:"del",image:null,iconCls:"iconfont icon-delete",isBorder:!0},{title:"排列",code:"order",image:null,iconCls:"iconfont icon-arrange",isBorder:!0,children:[{iconClass:"",code:"alignLeft",iconCls:"iconfont icon-left-align",title:"左对齐",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignCenterHorizontal",iconCls:"iconfont icon-horizontal-center",title:"水平居中",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignRight",iconCls:"iconfont icon-right-align",title:"右对齐",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignCellsTop",iconCls:"iconfont icon-top-align",title:"顶端对齐",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignCenterVertical",iconCls:"iconfont icon-vertical-center",title:"垂直居中",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0},{iconClass:"",code:"alignCellsBottom",iconCls:"iconfont icon-bottom-align",title:"底端对齐",name:"grNewLabel",canNotUse:!1,type:"kitUI:BoundLabelWidget",child:!0}]},{title:"图层",code:"view",image:null,iconCls:"iconfont icon-view",isBorder:!0,children:[{title:"置顶",code:"toUp",image:null,iconCls:"iconfont icon-top"},{title:"置底",code:"toDown",image:null,iconCls:"iconfont icon-bottom",isBorder:!0},{title:"上一层",code:"upOne",image:null,iconCls:"iconfont icon-top"},{title:"下一层",code:"downOne",image:null,iconCls:"iconfont icon-bottom",isBorder:!0}]},{title:"编辑",code:"edit",image:null,disable:!0,iconCls:"iconfont icon-edit"}],Xt={components:{},props:{menus:{type:Array,default:Te},isShow:{type:Boolean,default:!1},isPreview:{type:Boolean,default:!1},currentIndex:{type:Number,default:0}},data(){return{graph:null,yhz:null,cell:null,loadCells:null,scale:1,pageShortcuts:!1,timeLineMap:[],updateRaf:null,keys:Math.random().toString(36).substring(2),compMap:[],pupAry:[],resizeObserver:null,isShowPup:!1,wndAry:[],thisObj:new Map,centeredWindow:[]}},watch:{isPreview:{handler(t,e){let a=this;a.yhz&&(a.yhz.isPreview(!t),a.$nextTick(()=>{t?(a.keys=Math.random().toString(36).substring(2),a.graph.refresh(),a.scheduleUpdateOverlay(),a.timeLineMap.length>0&&a.timeLineMap.forEach(s=>{s.cell.setVisible(!1)})):(a.timeLineMap.length>0&&a.timeLineMap.forEach(s=>{s.cell.setVisible(!0)}),a.centeredWindow&&a.centeredWindow.forEach(o=>{o&&(o.setVisible(!1),o.destroy())}))}))},immediate:!0,deep:!0}},methods:{getStyle(t){let e=this,s=t.cell.style||{};return e.yhz.scheduleBorder(s)},handleshowAndHide(t,e){},dynamicComponent(t){return this.compMap.get(t)},scheduleUpdateOverlay(){let t=this;this.updateRaf&&cancelAnimationFrame(this.updateRaf),this.updateRaf=requestAnimationFrame(()=>{t.$nextTick(()=>{var a=t.graph.getModel().cells,s=Object.values(a);let o=s.filter(m=>m.crtype=="schedule");for(let m=0;m<o.length;m++){let h=o[m];t.graph.view.validateCell(h)}}),this.$forceUpdate(),this.updateRaf=null})},async addTimeLine({cellAry:t,scheduleCombination:e}){let a=this;a.$nextTick(()=>{for(let s=0;s<t.length;s++){let o=t[s],m={id:o.id,cell:o,other:o.other,compId:o.id,show:!0};a.timeLineMap.push(m),a.thisObj.set(o.id,e)}a.compMap=Object.freeze(a.thisObj),this.$forceUpdate()})},removeKeyUpDown(){let t=this;t.yhz&&t.yhz.removeKeyUpDown()},keyUpdownEvent(){let t=this;t.yhz&&(t.yhz.keyUpdownEvent(),console.log("绑定键盘事件"))},addCode(t){let e=this;e.yhz&&e.yhz.addCode({code:t})},setPageShortcuts(t){let e=this;e.yhz&&(e.yhz.setPageShortcuts(t),e.pageShortcuts=t)},setIsPreview(t){let e=this;e.yhz&&(e.onResize(),e.yhz.isPreview(t))},clearUndo(){let t=this;if(t.yhz)return t.yhz.clearUndo()},zoomHome(){let t=this;t.graph.zoomTo(1),t.yhz.changePageSize()},redo(){let t=this;if(t.yhz)return t.handelEvent({key:"unre"}),t.yhz.redo()},undo(){let t=this;if(t.yhz)return t.handelEvent({key:"unre"}),t.yhz.undo()},canRedo(){let t=this;return t.yhz?t.yhz.canRedo():!1},canUndo(){let t=this;return t.yhz?t.yhz.canUndo():!1},view(){let t=this,e=this.cell,a={background:"#000",color:"#fff",border:"1px solid #fff"};t.yhz.updateCell(e,a)},changeSize(t){this.yhz.changePageSize(t)},preview(){Be().push({path:"/preview"})},contextmenus(t,e){e&&(this.yhz.addEvent(e),t.preventDefault(),t.stopPropagation())},changeTimeLineShow(){let t=this,e=[],a=t.graph.getModel();Object.values(a.cells).forEach(o=>{e.push(o.id)}),t.timeLineMap=t.timeLineMap.filter(o=>e.includes(o.id))},handelEvent(t){let e=this;e.cell=t.val,t.key=="delete"&&e.changeTimeLineShow(),e.$emit("handelEvent",t)},loadJson(){this.yhz.loadJson()},async loadXml(t,e){let a=this;t?a.yhz.fromXmlToView(t):a.yhz.initCanvas(null,a.$refs.transparentRectRef)},async init(){let t=this,e=t.$refs.geEditor;const a=new ze(t);if(!t.graph){let s=await a.init({container:e,menus:t.menus,pageShortcuts:t.pageShortcuts});t.graph=s,t.delCell(s),t.yhz=a,t.$emit("handelEvent",{key:"init",mygraph:s,yhz:a}),setTimeout(()=>{a.isPreview(!t.isPreview)},0)}},delCell(t){let e=this;t.addListener(mxEvent.DELETE_CELLS,(a,s)=>{const o=s.properties.cells;let m=[];o&&o.length>0&&(o.forEach(h=>{m.push(h.id)}),e.timeLineMap.forEach(h=>{m.includes(h.id)&&(h.show=!1)}))})},onResize(){let t=this;t.yhz&&(t.yhz.changePageSize(),t.yhz.getFloatingPosition())},clearCanvas(){let t=this;t.yhz&&t.yhz.clearCanvas()},openPupop(t,e=!0){let a=this;if(mxWindow.prototype.installCloseHandler=function(){this.closeImg=document.createElement("img"),this.closeImg.setAttribute("src",this.closeImage),this.closeImg.setAttribute("title","Close"),this.closeImg.style.marginLeft="2px",this.closeImg.style.cursor="default",this.closeImg.style.display="none",this.buttons.appendChild(this.closeImg),mxEvent.addGestureListeners(this.closeImg,mxUtils.bind(this,async function(s){if(this.fireEvent(new mxEventObject(mxEvent.CLOSE,"event",s)),this.destroyOnClose){let o=!0;return window.changeSchedule()&&(o=await window.changeSchedule()),o&&this.destroy(),!1}else{let o=!0;window.changeSchedule()&&(o=await window.changeSchedule()),o&&this.setVisible(!1)}mxEvent.consume(s)}))},a.pupAry=t,t&&t.length>0){a.centeredWindow&&a.centeredWindow.forEach(m=>{m&&(m.setVisible(!1),m.destroy())});let s=[];t.forEach((o,m)=>{var h=document.createElement("div");if(o.type==="img"){h.style.overflow="auto",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center";var x=document.createElement("img");x.src=o.path,h.appendChild(x)}else if(o.type==="time"){let{el:P}=o.vnode;h.style.overflow="auto",h.style.width="100%",h.style.height="100%",h.appendChild(P)}else{h.style.overflow="auto",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center";var S=o.pathHtml;h.appendChild(S)}let b=0,y=0;if(o.isCenter=="false")b=o.left,y=o.top;else{var C=document.getElementById("app"),D=C.clientWidth,z=C.clientHeight;b=(D-o.width)/2,y=(z-o.height)/2}b<0&&(b=0),y<0&&(y=0);var B=document.createElement("div");let k=document.querySelectorAll(".mx-window-mask");var T=new mxWindow(o.title,h,b,y,o.width,o.height,!1,!0,"mxWindowTitle");T.setClosable(!0),T.setMaximizable(!0),T.setScrollable(!0),T.setResizable(!0),T.setVisible(e),T.constrainWithinViewport=!0,T.addListener(mxEvent.CLOSE,function(P,F){return a.isShowPup=!1,k=document.querySelectorAll(".mx-window-mask"),k&&k.length>0&&k.forEach(j=>{j.style.display="none",j.remove()}),!1}),T.addListener(mxEvent.MOVE,function(P,F){var j=T.getX(),H=T.getY(),I=T.getElement().offsetWidth,Z=T.getElement().offsetHeight,K=document.documentElement.clientWidth,ee=document.documentElement.clientHeight,ne=0,oe=0,re=K-I,se=ee-Z;j=Math.max(ne,Math.min(j,re)),H=Math.max(oe,Math.min(H,se)),T.setLocation(j,H)}),T.div&&k.length==0&&(T.div.style.zIndex=2e3+m,B.className="mx-window-mask",B.style.zIndex=30+m,document.body.appendChild(B),B.style.display="block"),s.push(T)}),a.centeredWindow=s,a.wndAry=s}},getWindowInfo(){let t=this,e=t.wndAry;e&&e.length>0&&e.forEach((a,s)=>{if(a){let o=t.pupAry[s];o&&t.openPupop([o],a.isVisible())}})},debounce(t,e=200){let a=null;return function(...s){clearTimeout(a),a=setTimeout(()=>{t.apply(this,s)},e)}},debouncedScroll(t){let e=this;if(e.graph){var a=e.graph.container;a.addEventListener("scroll",function(){console.log("元素滚动:",a.scrollTop,a.scrollLeft)})}}},mounted(){let t=this,e=t.$refs.geEditor;De.init().then(()=>{t.init()}),t.resizeObserver=new ResizeObserver(a=>{t.onResize(null)}),t.resizeObserver.observe(e),window.addEventListener("resize",t.getWindowInfo)},unmounted(){let t=this;t.resizeObserver&&t.resizeObserver.disconnect(),t.isShowPup=!1,t.centeredWindow&&t.centeredWindow.forEach(a=>{a&&(a.setVisible(!1),a.destroy())}),window.removeEventListener("resize",t.getWindowInfo)}},Zt=["id"],Jt={key:0,class:"transparentRect"},qt=["id"];function Kt(t,e,a,s,o,m){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["main-gd",{"show-scroll":a.isPreview}]),ref:"mainGd"},[r.createElementVNode("div",{class:r.normalizeClass(["main-body",{"hidden-scroll":a.isPreview}]),ref:"geEditor",id:a.currentIndex},null,10,Zt),a.isShow?(r.openBlock(),r.createElementBlock("div",Jt)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(o.timeLineMap,(h,x)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:h.id+o.keys,id:h.id,style:r.normalizeStyle([{position:"absolute"},m.getStyle(h)]),class:r.normalizeClass(h.id)},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(m.dynamicComponent(h.compId)),{id:h.other.timeId+"",thisTab:h.other.thisTab},null,8,["id","thisTab"]))],14,qt)),[[r.vShow,o.timeLineMap.length>0&&a.isPreview]])),128))],2)}const $t=q(Xt,[["render",Kt]]),ea={components:{},props:{menus:{type:Array,default:Te},isShow:{type:Boolean,default:!1},isPreview:{type:Boolean,default:!0},currentIndex:{type:Number,default:0}},data(){return{graph:null,yhz:null,cell:null,loadCells:null,scale:1,pageShortcuts:!1,timeLineMap:[],compMap:[],pupAry:[],resizeObserver:null,isShowPup:!1}},watch:{isPreview:{handler(t,e){let a=this;a.yhz&&(a.yhz.isPreview(!t),a.$nextTick(()=>{t?(a.keys=Math.random().toString(36).substring(2),a.graph.refresh(),a.scheduleUpdateOverlay()):window.centeredWindow&&window.centeredWindow.forEach(o=>{o&&(o.setVisible(!1),o.destroy())})}))},immediate:!0,deep:!0}},methods:{dynamicComponent(t){return this.compMap[t]},scheduleUpdateOverlay(){let t=this;this.updateRaf&&cancelAnimationFrame(this.updateRaf),this.updateRaf=requestAnimationFrame(()=>{t.$nextTick(()=>{var a=t.graph.getModel().cells,s=Object.values(a);let o=s.filter(m=>m.crtype=="schedule");for(let m=0;m<o.length;m++){let h=o[m];t.graph.view.validateCell(h)}}),this.$forceUpdate(),this.updateRaf=null})},async addTimeLine({cellAry:t,scheduleCombination:e}){let a=this;a.$nextTick(()=>{let s={};for(let o=0;o<t.length;o++){let m=t[o],h={id:m.id,cell:m,other:m.other,compId:m.id,show:!0};a.timeLineMap.push(h),s[m.id]=e}a.compMap=Object.freeze(s),this.$forceUpdate()})},removeKeyUpDown(){let t=this;t.yhz&&t.yhz.removeKeyUpDown()},keyUpdownEvent(){let t=this;t.yhz&&t.yhz.keyUpdownEvent()},addCode(t){let e=this;e.yhz&&e.yhz.addCode({code:t})},setPageShortcuts(t){let e=this;e.yhz&&(e.yhz.setPageShortcuts(t),e.pageShortcuts=t)},setIsPreview(t){let e=this;e.yhz&&(e.onResize(),e.yhz.isPreview(t))},clearUndo(){let t=this;if(t.yhz)return t.yhz.clearUndo()},zoomHome(){let t=this;t.graph.zoomTo(1),t.yhz.changePageSize()},redo(){let t=this;if(t.yhz)return t.handelEvent({key:"unre"}),t.yhz.redo()},undo(){let t=this;if(t.yhz)return t.handelEvent({key:"unre"}),t.yhz.undo()},canRedo(){let t=this;return t.yhz?t.yhz.canRedo():!1},canUndo(){let t=this;return t.yhz?t.yhz.canUndo():!1},view(){let t=this,e=this.cell,a={background:"#000",color:"#fff",border:"1px solid #fff"};t.yhz.updateCell(e,a)},changeSize(t){this.yhz.changePageSize(t)},preview(){Be().push({path:"/preview"})},contextmenus(t,e){e&&(this.yhz.addEvent(e),t.preventDefault(),t.stopPropagation())},handelEvent(t){let e=this;e.cell=t.val,e.$emit("handelEvent",t)},loadJson(){this.yhz.loadJson()},async loadXml(t,e){let a=this;t?a.yhz.fromXmlToView(t):a.yhz.initCanvas(null,a.$refs.transparentRectRef)},async init(){let t=this,e=t.$refs.geEditor;const a=new ze(t);if(!t.graph){let s=await a.init({container:e,menus:t.menus,pageShortcuts:t.pageShortcuts});t.graph=s,t.yhz=a,t.$emit("handelEvent",{key:"init",mygraph:s,yhz:a}),setTimeout(()=>{a.isPreview(!t.isPreview)},0)}},onResize(){let t=this;t.yhz&&t.yhz.changePageSize()},clearCanvas(){let t=this;t.yhz&&t.yhz.clearCanvas()},openPupop(t,e=!0){let a=this;if(a.pupAry=t,t&&t.length>0){window.centeredWindow&&window.centeredWindow.forEach(m=>{m&&(m.setVisible(!1),m.destroy())});let s=[];t.forEach(o=>{var m=document.createElement("div");if(o.type==="img"){m.style.overflow="auto",m.style.width="100%",m.style.height="100%",m.style.display="flex",m.style.justifyContent="center",m.style.alignItems="center";var h=document.createElement("img");h.src=o.path,m.appendChild(h)}else if(o.type==="time"){let{el:B}=o.vnode;m.style.overflow="auto",m.style.width="100%",m.style.height="100%",m.appendChild(B)}else{m.style.overflow="auto",m.style.width="100%",m.style.height="100%";var x=o.pathHtml;m.appendChild(x)}let S=0,b=0;if(o.isCenter=="false")S=o.left,b=o.top;else{var y=document.getElementById("app"),C=y.clientWidth,D=y.clientHeight;S=(C-o.width)/2,b=(D-o.height)/2}var z=new mxWindow(o.title,m,S,b,o.width,o.height,!0,!0,"mxWindowTitle");z.setClosable(!0),z.setMaximizable(!1),z.setResizable(!0),z.setVisible(e),z.constrainWithinViewport=!0,z.addListener(mxEvent.CLOSE,function(B,k){a.isShowPup=!1}),z.addListener(mxEvent.MOVE,function(B,k){var T=z.getX(),P=z.getY(),F=z.getElement().offsetWidth,j=z.getElement().offsetHeight,H=document.documentElement.clientWidth,I=document.documentElement.clientHeight,Z=0,K=0,ee=H-F,ne=I-j;T=Math.max(Z,Math.min(T,ee)),P=Math.max(K,Math.min(P,ne)),z.setLocation(T,P)}),s.push(z)}),window.centeredWindow=s,a.wndAry=s}}},mounted(){let t=this;De.init().then(()=>{t.init()}),t.resizeObserver=new ResizeObserver(e=>{e.forEach(a=>{const{width:s,height:o}=a.contentRect;t.onResize(),t.openPupop(t.pupAry)})}),t.resizeObserver.observe(t.$refs.geEditor)},unmounted(){let t=this;t.resizeObserver&&t.resizeObserver.disconnect(),t.isShowPup=!1,window.centeredWindow&&window.centeredWindow.forEach(a=>{a&&(a.setVisible(!1),a.destroy())})}},ta={class:"main-gd",ref:"mainGd"},aa=["id"],la={key:0,class:"transparentRect"},na=["id"];function ia(t,e,a,s,o,m){return r.openBlock(),r.createElementBlock("div",ta,[r.createElementVNode("div",{class:"main-body",ref:"geEditor",id:a.currentIndex},[a.isShow?(r.openBlock(),r.createElementBlock("div",la)):r.createCommentVNode("",!0),o.timeLineMap.length>0&&a.isPreview?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:1},r.renderList(o.timeLineMap,(h,x)=>(r.openBlock(),r.createElementBlock("div",{key:h.id,id:h.id,class:r.normalizeClass(h.id),style:r.normalizeStyle([{position:"absolute"},{zIndex:0}])},[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(m.dynamicComponent(h.compId)),{id:h.other.timeId+"",thisTab:h.other.thisTab},null,8,["id","thisTab"]))],10,na))),128)):r.createCommentVNode("",!0)],8,aa)],512)}const oa=q(ea,[["render",ia]]);J.mxCodeSvg=$t,J.mxCodeSvgPreview=oa,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})});
|