diff --git a/OrgChart.js b/OrgChart.js index 1cf71ec..0517b86 100644 --- a/OrgChart.js +++ b/OrgChart.js @@ -1 +1 @@ -var OrgChart=function(t,e){var r=this;if(this.element=t,this.config={lazyLoading:!0,enableDragDrop:!1,enableSearch:!0,nodeMenu:null,dragDropMenu:null,menu:null,toolbar:!1,nodeMouseClick:OrgChart.action.details,nodeMouseDbClick:OrgChart.none,mouseScrool:OrgChart.action.zoom,showXScroll:OrgChart.none,showYScroll:OrgChart.none,template:"ana",tags:{},nodeBinding:{},linkBinding:{},searchFields:[],nodes:[],levelSeparation:60,siblingSeparation:20,subtreeSeparation:40,mixedHierarchyNodesSeparation:15,padding:30,orientation:OrgChart.orientation.top,layout:OrgChart.normal,scaleInitial:1,scaleMin:.1,scaleMax:5,orderBy:null,editUI:null,searchUI:null,xScrollUI:null,yScrollUI:null,nodeMenuUI:null,toolbarUI:null,notifierUI:null,dragDropMenuUI:null,menuUI:null,exportUrl:"https://balkangraph.com/export",collapse:{},expand:{},align:OrgChart.CENTER,UI:null,anim:{func:OrgChart.anim.outPow,duration:200},zoom:{speed:120,smooth:12},roots:null,onUpdate:"",onRemove:"",onAdd:"",onRedraw:"",onImageUploaded:"",onUpdateTags:"",onClick:"",onDbClick:"",onExpCollClick:"",onExportStart:"",onExportEnd:"",onSearchClick:""},e)for(var i in this.config)"object"!=typeof e[i]||Array.isArray(e[i])?void 0!==e[i]&&(this.config[i]=e[i]):this.config[i]=OrgChart._mergeObject(this.config[i],e[i]);for(var a=["onUpdate","onRemove","onAdd","onRedraw","onImageUploaded","onUpdateTags","onClick","onDbClick","onExpCollClick","onExportStart","onExportEnd","onSearchClick"],n=0;nOrgChart.TEXT_THRESHOLD)for(var r=0;rOrgChart.IMAGES_THRESHOLD)for(r=0;rOrgChart.LINKS_THRESHOLD)for(r=0;rOrgChart.EXPCOLL_THRESHOLD)for(r=0;r',OrgChart.linkOpenTag='',OrgChart.secondLinkOpenTag='',OrgChart.expcollOpenTag='',OrgChart.groupNodesOpenTag='',OrgChart.linkFieldsOpenTag='',OrgChart.grCloseTag="",OrgChart.IT_IS_LONELY_HERE='{link}',OrgChart.RES={},OrgChart.RES.IT_IS_LONELY_HERE_LINK="It's lonely here, add your first node",OrgChart.MAXIMIZE='',OrgChart.MINIMIZE='',OrgChart.MAX_NODES_MESS="The evaluation version is limited to 200 nodes!
See more",OrgChart.OFFLINE_MESS="The evaluation version requires intermet connection!
See more",OrgChart.A4w=595,OrgChart.A4h=842,"undefined"!=typeof module&&(module.exports=OrgChart.VERSION),OrgChart.input=function(t,e,r,i,a){null==i&&(i=!1);var n=document.createElement("div"),o=document.createElement("div"),l=document.createElement("input"),s=document.createElement("hr"),h=document.createElement("button");if(h.innerHTML="Upload",h.style.position="absolute",h.style.right=0,n.style.margin="14px 14px 7px 14px",n.style.textAlign="left",n.style.position="relative",s.style.border="1px solid #d7d7d7",s.style.backgroundColor="#d7d7d7",s.style.display="block",s.style.width="100%",o.style.floa="left",o.style.color="#bcbcbc",l.style.border="none",l.style.outline="none",l.style.width="100%",a&&(l.style.width="80%"),l.style.fontSize="16px",l.readOnly=i,null!=e&&null!=e&&(l.value=e),null!=r&&null!=r&&(l.placeholder=r),null!=t&&null!=t&&(o.innerHTML=t),o.setAttribute("label",t),l.style.color="#7a7a7a",i||l.addEventListener("focus",function(){var t=this.parentNode.getElementsByTagName("hr")[0];t.style.border="1px solid #039BE5",OrgChart.anim(t,{width:10},{width:n.clientWidth},250,OrgChart.anim.inOutSin)}),h.addEventListener("click",function(){var e=this,t=document.createElement("INPUT");t.setAttribute("type","file"),t.style.display="none",t.onchange=function(){var t=this.files[0];OrgChart._events.publish("imageuploaded",[t,e.parentNode.querySelector("input")])},document.body.appendChild(t),t.click()}),l.addEventListener("blur",function(){this.parentNode.getElementsByTagName("hr")[0].style.border="1px solid #d7d7d7"}),n.appendChild(o),n.appendChild(l),a&&n.appendChild(h),n.appendChild(s),OrgChart.addValidation){var d={wrapper:n,label:o,input:l,hr:s};OrgChart.addValidation(t,e,d)}return n},OrgChart._intersects=function(t,e,r){var i=t.x-r.siblingSeparation/4,a=t.y,n=t.x+t.w+r.siblingSeparation/4,o=t.y;switch(r.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:i=t.x,a=t.y-r.siblingSeparation/4,n=t.x,o=t.y+t.h+r.siblingSeparation/4}var l,s,h,d=e.p,c=e.q,g=e.r,p=e.s;return 0!=(l=(n-i)*(p-c)-(g-d)*(o-a))&&(s=((a-o)*(g-i)+(n-i)*(p-a))/l,0<(h=((p-c)*(g-i)+(d-g)*(p-a))/l)&&h<1&&0',Object.assign(a.style,{cursor:"pointer",width:"34px",height:"34px",position:"absolute",top:"7px",right:"7px"}),Object.assign(n.style,{"overflow-x":"hidden","overflow-y":"auto"}),Object.assign(i.style,{"background-color":"#039BE5","min-height":"50px",textAlign:"center",position:"relative"}),Object.assign(o.style,{margin:"12px"}),this.wrapperElement.appendChild(e),e.appendChild(i),e.appendChild(n),n.appendChild(o),i.appendChild(a),OrgChart.htmlRipple(i);var l=this.fields,s=this.obj._get(t.id);t.isGroup&&(l=["Name"],s={Name:this.obj.config.tags[t.id].groupName});for(var h=0;h',this.wrapperElement.id="bgEditForm",Object.assign(a.style,{cursor:"pointer",width:"34px",height:"34px",position:"absolute",top:"7px",right:"7px"}),Object.assign(o.style,{"overflow-x":"hidden","overflow-y":"auto"}),Object.assign(r.style,{"background-color":"#039BE5","min-height":"50px",textAlign:"center",position:"relative"}),Object.assign(n.style,{margin:"14px 14px 7px",color:"#4285F4",cursor:"pointer"}),Object.assign(l.style,{margin:"14px 14px 7px",color:"rgb(188, 188, 188)"}),n.innerHTML="Add new field";var s=OrgChart._arrayContains(this.node.tags,"assistant")?"checked":"";l.innerHTML='
Assistant
',this.wrapperElement.appendChild(e),e.appendChild(r),e.appendChild(o),r.appendChild(a),OrgChart.htmlRipple(r);var h=this.fields,d=this.obj._get(t.id);t.isGroup&&(h=["Name"],d={Name:this.obj.config.tags[t.id].groupName});for(var c=0;c'+a+"  "+h+""}if(""!=r){this.wrapper=document.createElement("div"),Object.assign(this.wrapper.style,{opacity:0,"background-color":"#FFFEFF","box-shadow":"#DCDCDC 0px 1px 2px 0px",display:"inline-block",border:"1px solid #D7D7D7;border-radius:5px","z-index":1e3,position:"absolute","text-align":"left","user-select":"none"});var d=t-45;this.wrapper.style.left=d+"px",this.wrapper.style.top=e+"px",this.wrapper.innerHTML=r,this.obj.element.appendChild(this.wrapper),this.wrapper.style.left=d-this.wrapper.offsetWidth+"px";var c=t-this.wrapper.offsetWidth;OrgChart.anim(this.wrapper,{opacity:0,left:d-this.wrapper.offsetWidth},{opacity:1,left:c},300,OrgChart.anim.inOutPow);for(var g=this.wrapper.getElementsByTagName("div"),p=0;p'),e.fit&&(this.div.innerHTML+=''),e.zoom&&(this.div.innerHTML+=''),e.layout&&(this.div.innerHTML+='',this.layouts=document.createElement("div"),this.layouts.innerHTML='',this.obj.element.appendChild(this.layouts),Object.assign(this.layouts.style,{position:"absolute",width:"100%",left:"0",bottom:"-145px","box-shadow":"0px 1px 4px rgba(0,0,0,0.3)","background-color":"#f9f9f9",height:"123px","padding-top":"20px","border-top":"1px solid #cacaca"})),this.obj.element.appendChild(this.div),this.layoutBtn=this.div.querySelector('[data-tlbr="layout"]');var r=this.div.querySelector('[data-tlbr="plus"]'),i=this.div.querySelector('[data-tlbr="minus"]'),a=this.div.querySelector('[data-tlbr="fit"]'),n=this.div.querySelector('[data-tlbr="expand"]'),o=this;r&&r.addEventListener("click",function(){o.obj.zoom(!0,null,!0)}),i&&i.addEventListener("click",function(){o.obj.zoom(!1,null,!0)}),a&&a.addEventListener("click",function(){o.obj.fit()}),n&&n.addEventListener("click",function(){o.obj.expand(null,"all")}),this.layoutBtn&&this.layoutBtn.addEventListener("click",function(){o._visible?o.hideLayout():o.showLayout()}),this.layouts&&this.layouts.addEventListener("click",function(t){for(var e=t.target;e;){if(e.hasAttribute("data-layout")){e=e.getAttribute("data-layout"),o.obj.setLayout(OrgChart[e]);break}e=e.parentNode}})}},OrgChart.toolbarUI.prototype.showLayout=function(){this._visible=!0,this.layoutBtn.style.transform="rotate(180deg) translateX(0px) translateY(0px)",OrgChart.anim(this.div,{bottom:this.obj.config.padding},{bottom:this.obj.config.padding+145},this.obj.config.anim.duration,this.obj.config.anim.func),OrgChart.anim(this.layouts,{bottom:-145},{bottom:0},this.obj.config.anim.duration,this.obj.config.anim.func)},OrgChart.toolbarUI.prototype.hideLayout=function(){this._visible=!1,this.layoutBtn.style.transform="rotate(0deg) translateX(0px) translateY(0px)",OrgChart.anim(this.div,{bottom:this.obj.config.padding+145},{bottom:this.obj.config.padding},this.obj.config.anim.duration,this.obj.config.anim.func),OrgChart.anim(this.layouts,{bottom:0},{bottom:-145},this.obj.config.anim.duration,this.obj.config.anim.func)},OrgChart.notifierUI=function(){},OrgChart.notifierUI.prototype.init=function(t){this.obj=t},OrgChart.notifierUI.prototype.show=function(t,e){if(null!=t){1==t&&(t=OrgChart.MAX_NODES_MESS,e="#FFCA28"),2==t&&(t=OrgChart.OFFLINE_MESS,e="#FFCA28");var r=document.createElement("div");r.innerHTML=t,Object.assign(r.style,{position:"absolute","background-color":e,color:"#ffffff",padding:"15px","border-radius":"40px",opacity:0,overflow:"hidden","white-space":"nowrap","text-align":"center"}),this.obj.element.appendChild(r);var i=this.obj.width()/2-r.offsetWidth/2,a=this.obj.height()/2-r.offsetHeight/2;r.style.left=i+"px",r.style.top=a+"px";var n=r.offsetWidth;r.style.width="20px",OrgChart.anim(r,{opacity:0,width:10},{opacity:1,width:n},this.obj.config.anim.duration,this.obj.config.anim.func)}},OrgChart.icon={},OrgChart.icon.png=function(t,e,r){return''},OrgChart.icon.pdf=function(t,e,r){return''},OrgChart.icon.svg=function(t,e,r){return''},OrgChart.icon.csv=function(t,e,r){return''},OrgChart.icon.excel=function(t,e,r){return''},OrgChart.icon.edit=function(t,e,r){return''},OrgChart.icon.details=function(t,e,r){return''},OrgChart.icon.remove=function(t,e,r){return''},OrgChart.icon.add=function(t,e,r){return''},OrgChart.icon.search=function(t,e){return''},OrgChart.icon.addInGroup=function(t,e,r){return''},OrgChart.icon.addAsChild=function(t,e,r){return''},OrgChart.icon.xml=function(t,e,r){return''},OrgChart.prototype.exportPDF=function(t){t.mime="application/pdf",t.ext="pdf",this._export(t)},OrgChart.prototype.exportPNG=function(t){t.mime="image/png",t.ext="png",this._export(t)},OrgChart.prototype.exportSVG=function(t){t.ext="svg",t.mime="image/svg+xml",this._export(t)},OrgChart.prototype._export=function(o){var l=this;if(o.filename||(o.filename="OrgChart."+o.ext),null!=o.nodeId){var t=this.getBGNode(o.nodeId);t.isChildOfGroup&&(o.nodeId=t._groupParentNodeId)}var e={id:o.nodeId,expandChildren:o.expandChildren};this._draw(!1,OrgChart.action.exporting,e,function(t){var n=document.createElement("div");if(n.innerHTML=t,"svg"==o.ext){if(!1===OrgChart._events.publish("exportend",[l,o,n.innerHTML]))return!1;OrgChart._downloadFile(o.mime,n.innerHTML,o.filename)}else{if(null==o.margin&&(o.margin={top:"20px",bottom:"20px",left:"20px",right:"20px"}),null==o.landscape&&(o.landscape=!1),null==o.width){var e=n.querySelector("svg").getAttribute("width");o.width=e}if(null==o.height){var r=n.querySelector("svg").getAttribute("height");if(o.height=parseFloat(r),o.margin){var i=parseFloat(o.margin.bottom);o.height+=i;var a=parseFloat(o.margin.top);o.height+=a}}null==o.extraHtml&&(o.extraHtml=""),OrgChart._imgs2base64(n,"image","xlink:href",function(){if("pdf"==o.ext&&"A4"==o.format){var t=o.landscape?OrgChart.A4h:OrgChart.A4w,e=n.querySelector("svg"),r=parseFloat(e.getAttribute("width")),i=parseFloat(e.getAttribute("height"));i/=r/t,e.setAttribute("width",t),e.setAttribute("height",i),e.style.margin="0 auto",e.setAttribute("preserveAspectRatio","xMidYMin meet")}if(!1===OrgChart._events.publish("exportstart",[l,o,n.querySelector("svg")]))return!1;var a={content:''+o.extraHtml+n.innerHTML+"",options:o};a=JSON.stringify(a),OrgChart._ajax(l.config.exportUrl+"/v1","POST",a,"arraybuffer",function(t){if(!1===OrgChart._events.publish("exportend",[l,o,t]))return!1;OrgChart._downloadFile(o.mime,t,o.filename)})})}})},OrgChart.prototype.exportCSV=function(t){if(t||(t="OrgChart.csv"),!1===OrgChart._events.publish("exportstart",[this,"csv",t]))return!1;var e=OrgChart._json2csv(this.config.nodes);if(!1===OrgChart._events.publish("exportend",[this,"csv",t,e]))return!1;OrgChart._downloadFile("text/csv;charset=utf-8;",e,t)},OrgChart.prototype.exportXML=function(t){if(t||(t="OrgChart.xml"),!1===OrgChart._events.publish("exportstart",[this,"xml",t]))return!1;var e=OrgChart._json2xml(this.config.nodes);if(!1===OrgChart._events.publish("exportend",[this,"xml",t,e]))return!1;OrgChart._downloadFile("application/xml",e,t)},void 0===OrgChart&&(OrgChart={}),OrgChart._events=function(){var i={},a=i.hasOwnProperty;return{on:function(t,e){a.call(i,t)||(i[t]=[]);var r=i[t].push(e)-1;return{remove:function(){delete i[t][r]}}},publish:function(t,e){a.call(i,t)&&i[t].forEach(function(t){return 1==e.length?t(e[0]):2==e.length?t(e[0],e[1]):3==e.length?t(e[0],e[1],e[2]):4==e.length?t(e[0],e[1],e[2],e[3]):5==e.length?t(e[0],e[1],e[2],e[3],e[4]):void 0})}}}(),OrgChart.prototype.importCSV=function(){var h=this,t=document.createElement("INPUT");t.setAttribute("type","file"),t.setAttribute("accept",".csv"),t.style.display="none",t.onchange=function(t){var e=t.target,s=new FileReader;s.onload=function(){for(var t=s.result,e=OrgChart._csvToArray(t,","),r=[],i=1;ia[0]/10)return;if(l>a[1]/10)return}}else if(-1!=e.type.indexOf("touch")&&null==this._touch)return;for(var s=e.target;s!=t;){if(s.hasAttribute("control-expcoll-id")){var h=s.getAttribute("control-expcoll-id");return void this._expCollHandler(h)}if(s.hasAttribute("control-maxmin-id")){h=s.getAttribute("control-maxmin-id");return void this._maxMinHandler(h)}if(s.hasAttribute("node-id")){h=s.getAttribute("node-id");return void this._nodeClickHandler(h,e)}if(s.hasAttribute("control-node-menu-id")){h=s.getAttribute("control-node-menu-id");return void this._nodeMenuClickHandler(h,s,e)}if(s.hasAttribute("control-add"))return void this._lonelyButtonHandler();s=s.parentNode}},OrgChart.prototype._globalDbClickHandler=function(t,e){for(var r=e.target;r!=t;){if(r.hasAttribute("node-id")){var i=r.getAttribute("node-id");return void this._nodeDbClickHandler(i,e)}r=r.parentNode}},OrgChart.prototype._mouseScrollHandler=function(t,e){var r=this,i=!1,a=this.config.zoom.speed,n=this.config.zoom.smooth,o=0,l=this.getScale(),s=OrgChart._centerPointInPercent(r.getSvg(),e.pageX,e.pageY);var h=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,20)};e.preventDefault();var d=e.delta||e.wheelDelta;void 0===d&&(d=-e.detail),d=Math.max(-1,Math.min(1,d)),o+=-d*a,i||function t(){i=!0;var e=(o-l)/n;0'),n+=OrgChart.searchUI.createItem(s,l)}r.innerHTML=n;var h=i.querySelectorAll("[data-search-item-id]");for(o=0;o
'+OrgChart.icon.search(32,32)+'
'},OrgChart.searchUI.createItem=function(t,e){return'
'+t+'
'+e.textId+'
'+e.textInNode+'
'},OrgChart.searchUI.createSearchIcon=function(t){return'
'+OrgChart.icon.search(32,32)+"
"},void 0===OrgChart&&(OrgChart={}),OrgChart.server=function(t){this.config=t,this.visibleNodes=null,this.viewBox=null,this.action=null,this.actionParams=null,this.groupChildren={},this.nodes={},this.oldNodes={},this.maxX=null,this.maxY=null,this.minX=null,this.minY=null,this.root=null},OrgChart.server.prototype.read=function(t,r,i,e,a,n,o,l){var s=this;this.viewBox=e,this.action=a,this.actionParams=n;var h=this.maxX,d=this.maxY,c=this.minX,g=this.minY,p=this.root,f=this.nodes,u=this.groupChildren;if(t){var C=OrgChart.server._getResponse(r,i,this.visibleNodes,this.config,h,d,c,g,this.viewBox,p,this.action,this.actionParams,f,u,this.oldNodes);a!=OrgChart.action.exporting&&(this.maxX=h,this.maxY=d,this.minX=c,this.minY=g,this.root=p,this.nodes=f,this.groupChildren=u,this.visibleNodes=C.visibleNodes),o(C)}else this.oldNodes=f||null,this._read(function(t){h=t.maxX,d=t.maxY,c=t.minX,g=t.minY,p=t.roots[0],f=t.nodes,u=t.groupChildren;var e=OrgChart.server._getResponse(r,i,s.visibleNodes,s.config,h,d,c,g,s.viewBox,p,s.action,s.actionParams,f,u,s.oldNodes);e.notif=t.limit,a!=OrgChart.action.exporting&&(s.maxX=h,s.maxY=d,s.minX=c,s.minY=g,s.root=p,s.nodes=f,s.groupChildren=u,s.visibleNodes=e.visibleNodes),o(e)},l)},OrgChart.server.prototype._read=function(a,t){var n=this,o=OrgChart.server._createNodes(this.config,this.action,this.actionParams,this.oldNodes);t(o);var l=o.nodes,s=o.roots,e=OrgChart.remote;null==e&&(e=OrgChart.local),e._walk(s,this.config,function(t){OrgChart.server._doNotChangePositionOfClickedNodeIfAny(s,l,n.action,n.actionParams,n.oldNodes,n.config.orientation);var e={minX:null,minY:null,maxX:null,maxY:null};for(var r in l){var i=l[r];OrgChart.server._setMinMaxXY(i,e)}a({minX:e.minX,minY:e.minY,maxX:e.maxX,maxY:e.maxY,nodes:l,roots:s,groupChildren:o.groupChildren,limit:t})})},OrgChart.server.prototype.find=function(t){var r=this;if(null==t||null==t||""==t)return[];t=t.toLowerCase();for(var e,i,a,n=function(t){for(var e in r.config.nodeBinding)if(r.config.nodeBinding[e]==t)return!0;return!1},o=[],l=[],s=0;se.weight?1:0});for(s=0;s").splice(a,0,"")),d!=OrgChart.TAGS&&(d==OrgChart.ID?u=u+c+", ":OrgChart._fieldIsImg(this.config,d)?m=c:n(d)&&!OrgChart._fieldIsImg(this.config,d)?f=f+c+", ":OrgChart._fieldIsImg(this.config,d)||(C=C+c+", "))}u=u.slice(0,u.length-2),f=f.slice(0,f.length-2),C=C.slice(0,C.length-2);var y=OrgChart._getTemplate(o[s].tags,this.config.tags,this.config.template);l.push({id:o[s].id,node:new OrgChart.node(o[s],null,null,[],y),textId:u,textInNode:f,text:C,img:m})}}return l},void 0===OrgChart&&(OrgChart={}),OrgChart.server._createNodes=function(t,e,r,i){for(var a=t.nodes,n={},o=[],l=[],s=[],h={},d=!1,c=0;c=i.collapse.level){var c=!1;if(Array.isArray(i.expand.nodes))if(i.expand.allChildren){for(d=e[t.pid];null!=d;){if(-1!=i.expand.nodes.indexOf(d.id)){c=!0;break}d=e[d.pid]}c||(c=-1!=i.expand.nodes.indexOf(t.id))}else c=-1!=i.expand.nodes.indexOf(t.id);!c&&i.collapse.allChildren?(o.push(t.id),t.state=OrgChart.COLLAPSE):c||i.collapse.allChildren||h!=i.collapse.level||(o.push(t.id),t.state=OrgChart.COLLAPSE)}}}else if(r==OrgChart.action.expandCollapse&&(-1!=a.ids.indexOf(t.id)||"all"==a.ids)){if(a.state==OrgChart.COLLAPSE)o.push(t.id);else if(a.state==OrgChart.EXPAND){var g=o.indexOf(t.id);-1!=g&&o.splice(g,1)}t.state=a.state}},OrgChart.server._initGroupStates=function(t,e,r,i,a){if(r==OrgChart.action.exporting&&1==a.expandChildren&&t)OrgChart.server._setNodeGroupState(t,OrgChart.EXPAND,i.orientation);else{if(r==OrgChart.action.init&&t&&t.isGroup){var n=i.tags[t.id].groupState;OrgChart.server._setNodeGroupState(t,n,i.orientation)}r==OrgChart.action.groupMaxMin&&OrgChart.server._setNodeGroupState(e[a.id],a.state,i.orientation)}},OrgChart.server._initNodeSize=function(t,e,r){var i=OrgChart.t(e),a=i.size[0],n=i.size[1];if(t.isGroup&&t.groupState==OrgChart.EXPAND){var o=t.bgnodes.length,l=0,s=null,h=n=a=0,d=0;if(0==i.layout_type)switch(r){case OrgChart.orientation.top:case OrgChart.orientation.bottom:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom_left:l=1,s=o;for(var c=0;ci.level&&(i=e);for(var r=0;r=t._groupSettings._columns-1?(i=0,a++):i++}}},OrgChart.server._getResponse=function(t,e,r,i,a,n,o,l,s,h,d,c,g,p,f){var u={},C={top:null,left:null,bottom:null,right:null,minX:null,maxX:null,minY:null,maxY:null},m=[[],[],[]],O=a-o+2*i.padding,y=n-l+2*i.padding,x=OrgChart.getScale(s,t,e,i.scaleInitial,O,y);if(C.top=l-i.padding,C.left=o-i.padding,C.bottom=n+i.padding-e/x,C.right=a+i.padding-t/x,C.maxX=a,C.minX=o,C.maxY=n,C.minY=l,null==s&&i.align==OrgChart.CENTER){var v=Math.ceil(t/x),b=Math.ceil(e/x),w=0,_=0;if(v-2*i.padding>=a-o)switch(w=(a+o)/2-v/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:w=(o-a)/2-v/2}else switch(w=h.x-v/2+OrgChart.server._getNodeWidth(h,i)/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:(w=-(v/2-(o-a)/2))-i.padding&&(w=-i.padding)}if(b-2*i.padding>=n-l)switch(_=(n+l)/2-b/2,i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:_=(l-n)/2-b/2}else switch((_=-(b/2-(n-l)/2))>-i.padding&&(_=-i.padding),i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:(_=-(b/2-(l-n)/2))C.right?C.right:C.left),s[0]>C.right&&s[0]>C.left&&(s[0]=C.left>C.right?C.left:C.right),s[1]C.bottom?C.bottom:C.top),s[1]>C.bottom&&s[1]>C.top&&(s[1]=C.top>C.bottom?C.top:C.bottom));if(d==OrgChart.action.insert||d==OrgChart.action.expandCollapse||d==OrgChart.action.update||d==OrgChart.action.centerNode){var k=null;if(d==OrgChart.action.insert&&c&&null!=c.insertedNodeId&&null!=c.insertedNodeId)(k=g[c.insertedNodeId])||(k=g[p[c.insertedNodeId]]);else if(d==OrgChart.action.update&&c&&null!=c.visId&&null!=c.visId)(k=g[c.visId])||(k=g[p[c.visId]]);else if(d==OrgChart.action.expandCollapse&&c&&null!=c.id&&null!=c.id)(k=g[c.id])||(k=g[p[c.id]]),k=OrgChart.server._getMostDeepChild(k,g);else if(d==OrgChart.action.centerNode){switch(i.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:c.options.vertical||(k=g[c.id]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:c.options.horizontal||(k=g[c.id])}k&&(k||(k=g[p[c.id]]),k=OrgChart.server._getMostDeepChild(k,g))}if(k)switch(i.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:var S=k.y+k.h-s[3]+i.padding;s[1]S&&(s[1]=S);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:S=k.x-i.padding;s[0]>S&&(s[0]=S);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:S=k.x+k.w-s[2]+i.padding;s[0]e.maxX)&&(e.maxX=t.x+t.w),(null==e.maxY||null!=t.y&&t.y+t.h>e.maxY)&&(e.maxY=t.y+t.h)},void 0===OrgChart&&(OrgChart={}),OrgChart.templates={},OrgChart.templates.base={defs:"",size:[250,120],expandCollapseSize:30,linkAdjuster:{fromX:0,fromY:0,toX:0,toY:0},ripple:{radius:0,color:"#e6e6e6",rect:null},assistanseLink:'',svg:'{content}',link:'',pointer:'',node:'',plus:'',minus:'',nodeMenuButton:'',exportMenuButton:'



',img_0:'',link_field_0:'{val}'},OrgChart.templates.ana={defs:"",size:[250,120],linkAdjuster:{fromX:0,fromY:0,toX:0,toY:0},ripple:{radius:0,color:"#e6e6e6",rect:null},expandCollapseSize:30,svg:'{content}',link:'',secondLink:'',assistanseLink:'',pointer:'',node:'',plus:'',minus:'',nodeMenuButton:'',exportMenuButton:'



',img_0:'',link_field_0:'{val}',field_0:'{val}',field_1:'{val}'},OrgChart.templates.split=Object.assign({},OrgChart.templates.ana),OrgChart.templates.split.size=[10,10],OrgChart.templates.split.node='',OrgChart.templates.group_orange=Object.assign({},OrgChart.templates.base),OrgChart.templates.group_orange.size=[250,120],OrgChart.templates.group_orange.node='',OrgChart.templates.group_orange.groupPadding=[50,10,10,10],OrgChart.templates.group_orange.groupNodesSeparation=10,OrgChart.templates.group_orange.groupName='{val}',OrgChart.templates.group_yellow=Object.assign({},OrgChart.templates.group_orange),OrgChart.templates.group_yellow.node='',OrgChart.templates.group_yellow.groupName='{val}',OrgChart.templates.group_grey=Object.assign({},OrgChart.templates.group_orange),OrgChart.templates.group_grey.node='',OrgChart.templates.group_grey.groupName='{val}',OrgChart.templates.ula=Object.assign({},OrgChart.templates.ana),OrgChart.templates.ula.field_0='{val}',OrgChart.templates.ula.field_1='{val}',OrgChart.templates.ula.node='',OrgChart.templates.ula.img_0='',OrgChart.templates.ula.menu='',OrgChart.templates.ula.nodeMenuButton='',OrgChart.templates.olivia=Object.assign({},OrgChart.templates.ana),OrgChart.templates.olivia.field_0='{val}',OrgChart.templates.olivia.field_1='{val}',OrgChart.templates.olivia.defs='',OrgChart.templates.olivia.node='',OrgChart.templates.olivia.img_0='',OrgChart.templates.belinda=Object.assign({},OrgChart.templates.ana),OrgChart.templates.belinda.size=[180,180],OrgChart.templates.belinda.ripple={radius:90,color:"#e6e6e6",rect:null},OrgChart.templates.belinda.node='',OrgChart.templates.belinda.img_0='',OrgChart.templates.belinda.field_0='{val}',OrgChart.templates.belinda.field_1='{val}',OrgChart.templates.belinda.link='',OrgChart.templates.belinda.nodeMenuButton='',OrgChart.templates.rony=Object.assign({},OrgChart.templates.ana),OrgChart.templates.rony.svg='{content}',OrgChart.templates.rony.defs='',OrgChart.templates.rony.size=[180,250],OrgChart.templates.rony.ripple={color:"#F57C00",radius:5,rect:null},OrgChart.templates.rony.img_0='',OrgChart.templates.rony.node='',OrgChart.templates.rony.field_0='{val}',OrgChart.templates.rony.field_1='{val}',OrgChart.templates.rony.field_2='{val}',OrgChart.templates.rony.link='',OrgChart.templates.rony.plus='',OrgChart.templates.rony.minus='',OrgChart.templates.rony.nodeMenuButton='',OrgChart.templates.mery=Object.assign({},OrgChart.templates.ana),OrgChart.templates.mery.ripple={color:"#e6e6e6",radius:50,rect:null},OrgChart.templates.mery.node='',OrgChart.templates.mery.link='',OrgChart.templates.mery.img_0='',OrgChart.templates.mery.field_0='{val}',OrgChart.templates.mery.field_1='{val}',OrgChart.templates.mery.nodeMenuButton='',OrgChart.templates.polina=Object.assign({},OrgChart.templates.ana),OrgChart.templates.polina.size=[300,80],OrgChart.templates.polina.ripple={color:"#e6e6e6",radius:40,rect:null},OrgChart.templates.polina.node='',OrgChart.templates.polina.img_0='',OrgChart.templates.polina.field_0='{val}',OrgChart.templates.polina.field_1='{val}',OrgChart.templates.polina.link='',OrgChart.templates.polina.nodeMenuButton='',OrgChart.templates.mila=Object.assign({},OrgChart.templates.ana),OrgChart.templates.mila.node='',OrgChart.templates.mila.img_0='',OrgChart.templates.mila.field_0='{val}',OrgChart.templates.mila.nodeMenuButton='',OrgChart.templates.diva=Object.assign({},OrgChart.templates.ana),OrgChart.templates.diva.size=[200,170],OrgChart.templates.diva.node='',OrgChart.templates.diva.img_0='',OrgChart.templates.diva.field_0='{val}',OrgChart.templates.diva.field_1='{val}',OrgChart.templates.diva.pointer='',OrgChart.templates.diva.nodeMenuButton='',OrgChart.templates.luba=Object.assign({},OrgChart.templates.ana),OrgChart.templates.luba.svg='{content}',OrgChart.templates.luba.defs='',OrgChart.templates.luba.node='',OrgChart.templates.luba.img_0='',OrgChart.templates.luba.nodeMenuButton='',OrgChart.templates.luba.field_0='{val}',OrgChart.templates.luba.field_1='{val}',OrgChart.templates.luba.plus='',OrgChart.templates.luba.minus='',OrgChart.templates.luba.expandCollapseSize=36,OrgChart.templates.derek=Object.assign({},OrgChart.templates.ana),OrgChart.templates.derek.link='',OrgChart.templates.derek.field_0='{val}',OrgChart.templates.derek.field_1='{val}',OrgChart.templates.derek.node='',OrgChart.templates.derek.defs=' ',OrgChart.templates.derek.img_0='',OrgChart.templates.derek.minus='',OrgChart.templates.derek.plus='',OrgChart.templates.derek.nodeMenuButton='',OrgChart.templates.isla=Object.assign({},OrgChart.templates.ana),OrgChart.templates.isla.defs='',OrgChart.templates.isla.size=[180,120],OrgChart.templates.isla.node='',OrgChart.templates.isla.field_0='{val}',OrgChart.templates.isla.field_1='{val}',OrgChart.templates.isla.img_0='',OrgChart.templates.isla.minus='',OrgChart.templates.isla.plus='',OrgChart.templates.isla.nodeMenuButton='',OrgChart.templates.isla.ripple={radius:0,color:"#F57C00",rect:{x:0,y:20,width:180,height:100}},OrgChart.ui={_defsIds:{},defs:function(){var t="";for(var e in OrgChart.templates){var r=OrgChart.templates[e];r.defs?(OrgChart.ui._defsIds[e]=OrgChart._randomId(),t+=r.defs.replace("{randId}",OrgChart.ui._defsIds[e])):t+=r.defs}return""+t+""},css:function(){return''},lonely:function(t){return t.nodes&&t.nodes.length?"":OrgChart.IT_IS_LONELY_HERE.replace("{link}",OrgChart.RES.IT_IS_LONELY_HERE_LINK)},pointer:function(t,e,r){return e===OrgChart.action.exporting?"":OrgChart.t(t.template,r).pointer},node:function(t,e,r,i,a,n,o,l,s,h){var d=OrgChart.t(t.templateName,s),c=d.node.replaceAll("{w}",t.w).replaceAll("{h}",t.h);if(d.defs&&(c=c.replace("{randId}",OrgChart.ui._defsIds[t.templateName])),null==o&&(o=i.nodeBinding),t.isGroup){var g=i.tags[t.id].groupName;if(g)g=OrgChart._wrapText(g,d.groupName),c+=u=(u=d.groupName.replace("{val}",g)).replaceAll("{randId}",OrgChart._randomId()).replaceAll("{randId2}",OrgChart._randomId());c+=u}else for(var p in o){var f=o[p];if(e){var u,C=e[f];if("function"==typeof f&&(C=f(h,t)),null!=C&&null!=C&&null!=d[p])c+=u=(u=(OrgChart._lblIsImg(i,p)||"string"!=typeof C||(C=OrgChart._wrapText(C,d[p])),d[p].replace("{val}",C))).replaceAll("{randId}",OrgChart._randomId()).replaceAll("{randId2}",OrgChart._randomId())}}var m=OrgChart._getPosition(r,t,a,n),O="node";Array.isArray(t.tags)&&t.tags.length&&(O+=" "+t.tags.join(" ")),t.layout&&(O+=" tree-layout");var y=OrgChart.nodeOpenTag.replace("{id}",t.id).replace("{class}",O).replace("{level}",t.level).replace("{x}",m.x).replace("{y}",m.y),x=OrgChart._getOpacity(r,t);y=y.replace("{opacity}",x),t.isGroup||null==i.nodeMenu||"split"==t.templateName||l===OrgChart.action.exporting||(c+=d.nodeMenuButton.replace("{id}",t.id));var v=OrgChart.ui._renderGroupedNodes(t,d,i,r,o,a,n,l,s);return t.isGroup&&l!=OrgChart.action.exporting&&(t.groupState==OrgChart.EXPAND?c+=OrgChart.MINIMIZE.replace("{x}",t.w-45).replace("{id}",t.id):c+=OrgChart.MAXIMIZE.replace("{x}",t.w-45).replace("{id}",t.id)),c=y+c+v+OrgChart.grCloseTag},_renderGroupedNodes:function(t,e,r,i,a,n,o,l,s,h){var d="";if(t.isGroup&&t.groupState==OrgChart.EXPAND){e.groupPadding||console.error("groupPadding is not defined in template "+t.templateName);for(var c=0;ce.x&&(d="right");break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:case OrgChart.orientation.right:case OrgChart.orientation.right_top:d="top",t[s].y>e.y&&(d="bottom")}var c=OrgChart.t(e.templateName,a),g=r.levelSeparation;e.layout!=OrgChart.mixed&&e.layout!=OrgChart.tree||(g=r.mixedHierarchyNodesSeparation);var p={p:e.x+e.w/2+c.expandCollapseSize,q:e.y,r:e.x+e.w/2+c.expandCollapseSize,s:i.minY+g};switch(r.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([p.p,p.q]),l.push([p.r,e.y-g/3]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:p.q=e.y+e.h,p.s=i.maxY-g,l.push([p.p,p.q]),l.push([p.r,e.y+e.h+g/3]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:p.p=e.x,p.q=e.y+e.h/2+c.expandCollapseSize,p.r=i.minX-g,p.s=e.y+e.h/2+c.expandCollapseSize,l.push([p.p,p.q]),l.push([e.x-g/3,p.q]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:p.p=e.x+e.w,p.q=e.y+e.h/2+c.expandCollapseSize,p.r=i.maxX+g,p.s=e.y+e.h/2+c.expandCollapseSize,l.push([p.p,p.q]),l.push([e.x+e.w+g/3,p.q])}for(var f=e;null==h;){var u=!1,C=f.parent,m=C.leftNeighbor,O=C.rightNeighbor;if(C.id==s?h=C:OrgChart._intersects(C,p,r)&&(p=OrgChart._addPoint(C,l,r,p,d),u=!0),C.id!=s){for(;m;){if(m.id==s){h=m;break}OrgChart._intersects(m,p,r)&&(p=OrgChart._addPoint(m,l,r,p,d),u=!0),m=m.leftNeighbor}for(;O;){if(O.id==s){h=O;break}OrgChart._intersects(O,p,r)&&(p=OrgChart._addPoint(O,l,r,p,d),u=!0),O=O.rightNeighbor}}if(!u){var y=l[l.length-1][0],x=0;if(C.parent)switch(g=r.levelSeparation,C.parent.layout!=OrgChart.mixed&&C.parent.layout!=OrgChart.tree||(g=r.mixedHierarchyNodesSeparation),r.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:x=C.parent.y+C.parent.h+g*(2/3);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:x=C.parent.y-g*(2/3);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:y=C.parent.x+C.parent.w+g*(2/3),x=l[l.length-1][1];break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:y=C.parent.x-g*(2/3),x=l[l.length-1][1]}l.push([y,x])}f=C}switch(c=OrgChart.t(h.templateName,a),l.splice(l.length-1,1),r.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([h.x+h.w/2+c.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y+h.h]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:l.push([h.x+h.w/2+c.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:l.push([l[l.length-1][0],h.y+h.h/2+c.expandCollapseSize]),l.push([h.x+h.w,l[l.length-1][1]]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:l.push([l[l.length-1][0],h.y+h.h/2+c.expandCollapseSize]),l.push([h.x,l[l.length-1][1]])}l[0]="M"+l[0].join(",");for(var v=1;vr.right?r.right:r.left),e[0]>r.right&&e[0]>r.left&&(a[0]=r.left>r.right?r.left:r.right),e[1]r.bottom?r.bottom:r.top),e[1]>r.bottom&&e[1]>r.top&&(a[1]=r.top>r.bottom?r.top:r.bottom),e[0]!==a[0]||e[1]!==a[1]?OrgChart.anim(t,{viewBox:e},{viewBox:a},300,OrgChart.anim.outPow,function(){i&&i()}):i&&i()},OrgChart._randomId=function(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)},OrgChart._getClientXY=function(t){return-1==t.type.indexOf("touch")?{x:t.clientX,y:t.clientY}:t.changedTouches.length?{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}:void 0},OrgChart._getClientTouchesXY=function(t,e){return-1!=t.type.indexOf("touch")?t.touches.length"+e+"";var i=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("text")[0],a=parseFloat(i.getAttribute("x")),n=parseFloat(i.getAttribute("y")),o=i.getAttribute("text-anchor"),l=i.getAttribute("width"),s=i.getAttribute("text-overflow"),h="http://www.w3.org/2000/svg",d=r.getElementsByTagName("svg")[0].getElementsByTagName("text")[0];if(!l)return t;if(l=parseFloat(l),a||(a=0),n||(n=0),a||(o="start"),s||(s="ellipsis"),"ellipsis"==s){d.removeChild(d.firstChild),d.textContent=t;for(var c=d.getComputedTextLength(),g=2;l"+t+""+d.textContent:t}if("multiline"==s){var p=t.split(" "),f=d.getBBox().height;d.textContent="";var u=document.createElementNS(h,"tspan"),C=document.createTextNode(p[0]);u.setAttributeNS(null,"x",a),u.setAttributeNS(null,"y",n),u.setAttributeNS(null,"text-anchor",o),u.appendChild(C),d.appendChild(u);g=1;for(var m=1;ml)u.firstChild.data=u.firstChild.data.slice(0,O),(u=document.createElementNS(h,"tspan")).setAttributeNS(null,"x",a),u.setAttributeNS(null,"y",n+f*g),u.setAttributeNS(null,"text-anchor",o),C=document.createTextNode(p[m]),u.appendChild(C),d.appendChild(u),g++}var y="";if(null!=d.innerHTML)y=d.innerHTML,d.innerHTML="";else{var x="";for(m=d.childNodes.length-1;0<=m;m--)x=XMLSerializer().serializeToString(d.childNodes[m])+x,d.removeChild(d.childNodes[m]);y=x}return y}},OrgChart._downloadFile=function(t,e,r){var i=new Blob([e],{type:t});if(navigator.msSaveBlob)navigator.msSaveBlob(i,r);else{var a=document.createElement("a");if(void 0!==a.download){var n=URL.createObjectURL(i);a.setAttribute("href",n),a.setAttribute("download",r),a.style.visibility="hidden",document.body.appendChild(a),a.click(),document.body.removeChild(a)}}},OrgChart._getPosition=function(t,e,r,i){var a={x:e.x,y:e.y};if(null!=r&&(a.x=r),null!=i&&(a.y=i),t&&3==t.length){var n=t[0].indexOf(e.id);-1!=n&&null!=t[1][n].transform&&(null==r&&(a.x=t[1][n].transform[4]),null==i&&(a.y=t[1][n].transform[5]))}return a},OrgChart._getOpacity=function(t,e){var r=1;if(t&&3==t.length){var i=t[0].indexOf(e.id);-1!=i&&null!=t[1][i].opacity&&(r=t[1][i].opacity)}return r},OrgChart.t=function(t,e){var r=OrgChart.templates[t],i=null;if(null!=e&&r.scaleLessThen){var a=[];for(var n in r.scaleLessThen){var o=parseFloat(n);e'+(new XMLSerializer).serializeToString(e.documentElement)},OrgChart._xml2json=function(t){for(var e=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("node"),r=[],i=0;ir&&(l.pos=r),a||n()}function n(){a=!0;var t=(l.pos-l.bar.scrollLeft)/e;0r&&(l.pos=r),a||n()}function n(){a=!0;var t=(l.pos-l.bar.scrollTop)/e;0this.config.scaleMin||0!=t&&1!=t&&lthis.config.scaleMin){this._hideBeforeAnimation();var s=this;r?(clearTimeout(s._timeout),OrgChart.anim(this.getSvg(),{viewbox:this.getViewBox()},{viewbox:i},this.config.anim.duration,this.config.anim.func,function(){clearTimeout(s._timeout),s._timeout=setTimeout(function(){s._draw(!0,OrgChart.action.zoom)},500)})):(this.setViewBox(i),clearTimeout(s._timeout),s._timeout=setTimeout(function(){s._draw(!0,OrgChart.action.zoom)},500))}}; \ No newline at end of file +var OrgChart=function(t,e){var r=this;if(this.element=t,this.config={lazyLoading:!0,enableDragDrop:!1,enableSearch:!0,nodeMenu:null,dragDropMenu:null,menu:null,toolbar:!1,nodeMouseClick:OrgChart.action.details,nodeMouseDbClick:OrgChart.none,mouseScrool:OrgChart.action.zoom,showXScroll:OrgChart.none,showYScroll:OrgChart.none,template:"ana",tags:{},nodeBinding:{},linkBinding:{},searchFields:[],nodes:[],levelSeparation:60,siblingSeparation:20,subtreeSeparation:40,mixedHierarchyNodesSeparation:15,padding:30,orientation:OrgChart.orientation.top,layout:OrgChart.normal,scaleInitial:1,scaleMin:.1,scaleMax:5,orderBy:null,editUI:null,searchUI:null,xScrollUI:null,yScrollUI:null,nodeMenuUI:null,toolbarUI:null,notifierUI:null,dragDropMenuUI:null,menuUI:null,exportUrl:"https://balkangraph.com/export",collapse:{},expand:{},align:OrgChart.CENTER,UI:null,anim:{func:OrgChart.anim.outPow,duration:200},zoom:{speed:120,smooth:12},roots:null,onUpdate:"",onRemove:"",onAdd:"",onRedraw:"",onImageUploaded:"",onUpdateTags:"",onClick:"",onDbClick:"",onExpCollClick:"",onExportStart:"",onExportEnd:"",onSearchClick:"",onReady:""},e)for(var i in this.config)"object"!=typeof e[i]||Array.isArray(e[i])?void 0!==e[i]&&(this.config[i]=e[i]):this.config[i]=OrgChart._mergeObject(this.config[i],e[i]);for(var a=["onUpdate","onRemove","onAdd","onRedraw","onImageUploaded","onUpdateTags","onClick","onDbClick","onExpCollClick","onExportStart","onExportEnd","onSearchClick","onReady"],n=0;nOrgChart.TEXT_THRESHOLD)for(var r=0;rOrgChart.IMAGES_THRESHOLD)for(r=0;rOrgChart.LINKS_THRESHOLD)for(r=0;rOrgChart.EXPCOLL_THRESHOLD)for(r=0;r',OrgChart.linkOpenTag='',OrgChart.secondLinkOpenTag='',OrgChart.expcollOpenTag='',OrgChart.groupNodesOpenTag='',OrgChart.linkFieldsOpenTag='',OrgChart.grCloseTag="",OrgChart.IT_IS_LONELY_HERE='{link}',OrgChart.RES={},OrgChart.RES.IT_IS_LONELY_HERE_LINK="It's lonely here, add your first node",OrgChart.MAXIMIZE='',OrgChart.MINIMIZE='',OrgChart.MAX_NODES_MESS="The evaluation version is limited to 200 nodes!
See more",OrgChart.OFFLINE_MESS="The evaluation version requires intermet connection!
See more",OrgChart.A4w=595,OrgChart.A4h=842,"undefined"!=typeof module&&(module.exports=OrgChart.VERSION),OrgChart.input=function(t,e,r,i,a){null==i&&(i=!1);var n=document.createElement("div"),o=document.createElement("div"),l=document.createElement("input"),s=document.createElement("hr"),h=document.createElement("button");if(h.innerHTML="Upload",h.style.position="absolute",h.style.right=0,n.style.margin="14px 14px 7px 14px",n.style.textAlign="left",n.style.position="relative",s.style.border="1px solid #d7d7d7",s.style.backgroundColor="#d7d7d7",s.style.display="block",s.style.width="100%",o.style.floa="left",o.style.color="#bcbcbc",l.style.border="none",l.style.outline="none",l.style.width="100%",a&&(l.style.width="80%"),l.style.fontSize="16px",l.readOnly=i,null!=e&&null!=e&&(l.value=e),null!=r&&null!=r&&(l.placeholder=r),null!=t&&null!=t&&(o.innerHTML=t),o.setAttribute("label",t),l.style.color="#7a7a7a",i||l.addEventListener("focus",function(){var t=this.parentNode.getElementsByTagName("hr")[0];t.style.border="1px solid #039BE5",OrgChart.anim(t,{width:10},{width:n.clientWidth},250,OrgChart.anim.inOutSin)}),h.addEventListener("click",function(){var e=this,t=document.createElement("INPUT");t.setAttribute("type","file"),t.style.display="none",t.onchange=function(){var t=this.files[0];OrgChart._events.publish("imageuploaded",[t,e.parentNode.querySelector("input")])},document.body.appendChild(t),t.click()}),l.addEventListener("blur",function(){this.parentNode.getElementsByTagName("hr")[0].style.border="1px solid #d7d7d7"}),n.appendChild(o),n.appendChild(l),a&&n.appendChild(h),n.appendChild(s),OrgChart.addValidation){var d={wrapper:n,label:o,input:l,hr:s};OrgChart.addValidation(t,e,d)}return n},OrgChart._intersects=function(t,e,r){var i=t.x-r.siblingSeparation/4,a=t.y,n=t.x+t.w+r.siblingSeparation/4,o=t.y;switch(r.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:i=t.x,a=t.y-r.siblingSeparation/4,n=t.x,o=t.y+t.h+r.siblingSeparation/4}var l,s,h,d=e.p,c=e.q,g=e.r,p=e.s;return 0!=(l=(n-i)*(p-c)-(g-d)*(o-a))&&(s=((a-o)*(g-i)+(n-i)*(p-a))/l,0<(h=((p-c)*(g-i)+(d-g)*(p-a))/l)&&h<1&&0',Object.assign(a.style,{cursor:"pointer",width:"34px",height:"34px",position:"absolute",top:"7px",right:"7px"}),Object.assign(n.style,{"overflow-x":"hidden","overflow-y":"auto"}),Object.assign(i.style,{"background-color":"#039BE5","min-height":"50px",textAlign:"center",position:"relative"}),Object.assign(o.style,{margin:"12px"}),this.wrapperElement.appendChild(e),e.appendChild(i),e.appendChild(n),n.appendChild(o),i.appendChild(a),OrgChart.htmlRipple(i);var l=this.fields,s=this.obj._get(t.id);t.isGroup&&(l=["Name"],s={Name:this.obj.config.tags[t.id].groupName});for(var h=0;h',this.wrapperElement.id="bgEditForm",Object.assign(a.style,{cursor:"pointer",width:"34px",height:"34px",position:"absolute",top:"7px",right:"7px"}),Object.assign(o.style,{"overflow-x":"hidden","overflow-y":"auto"}),Object.assign(r.style,{"background-color":"#039BE5","min-height":"50px",textAlign:"center",position:"relative"}),Object.assign(n.style,{margin:"14px 14px 7px",color:"#4285F4",cursor:"pointer"}),Object.assign(l.style,{margin:"14px 14px 7px",color:"rgb(188, 188, 188)"}),n.innerHTML="Add new field";var s=OrgChart._arrayContains(this.node.tags,"assistant")?"checked":"";l.innerHTML='
Assistant
',this.wrapperElement.appendChild(e),e.appendChild(r),e.appendChild(o),r.appendChild(a),OrgChart.htmlRipple(r);var h=this.fields,d=this.obj._get(t.id);t.isGroup&&(h=["Name"],d={Name:this.obj.config.tags[t.id].groupName});for(var c=0;c'+a+"  "+h+""}if(""!=r){this.wrapper=document.createElement("div"),Object.assign(this.wrapper.style,{opacity:0,"background-color":"#FFFEFF","box-shadow":"#DCDCDC 0px 1px 2px 0px",display:"inline-block",border:"1px solid #D7D7D7;border-radius:5px","z-index":1e3,position:"absolute","text-align":"left","user-select":"none"});var d=t-45;this.wrapper.style.left=d+"px",this.wrapper.style.top=e+"px",this.wrapper.innerHTML=r,this.obj.element.appendChild(this.wrapper),this.wrapper.style.left=d-this.wrapper.offsetWidth+"px";var c=t-this.wrapper.offsetWidth;OrgChart.anim(this.wrapper,{opacity:0,left:d-this.wrapper.offsetWidth},{opacity:1,left:c},300,OrgChart.anim.inOutPow);for(var g=this.wrapper.getElementsByTagName("div"),p=0;p'),e.fit&&(this.div.innerHTML+=''),e.zoom&&(this.div.innerHTML+=''),e.layout&&(this.div.innerHTML+='',this.layouts=document.createElement("div"),this.layouts.innerHTML='',this.obj.element.appendChild(this.layouts),Object.assign(this.layouts.style,{position:"absolute",width:"100%",left:"0",bottom:"-145px","box-shadow":"0px 1px 4px rgba(0,0,0,0.3)","background-color":"#f9f9f9",height:"123px","padding-top":"20px","border-top":"1px solid #cacaca"})),this.obj.element.appendChild(this.div),this.layoutBtn=this.div.querySelector('[data-tlbr="layout"]');var r=this.div.querySelector('[data-tlbr="plus"]'),i=this.div.querySelector('[data-tlbr="minus"]'),a=this.div.querySelector('[data-tlbr="fit"]'),n=this.div.querySelector('[data-tlbr="expand"]'),o=this;r&&r.addEventListener("click",function(){o.obj.zoom(!0,null,!0)}),i&&i.addEventListener("click",function(){o.obj.zoom(!1,null,!0)}),a&&a.addEventListener("click",function(){o.obj.fit()}),n&&n.addEventListener("click",function(){o.obj.expand(null,"all")}),this.layoutBtn&&this.layoutBtn.addEventListener("click",function(){o._visible?o.hideLayout():o.showLayout()}),this.layouts&&this.layouts.addEventListener("click",function(t){for(var e=t.target;e;){if(e.hasAttribute("data-layout")){e=e.getAttribute("data-layout"),o.obj.setLayout(OrgChart[e]);break}e=e.parentNode}})}},OrgChart.toolbarUI.prototype.showLayout=function(){this._visible=!0,this.layoutBtn.style.transform="rotate(180deg) translateX(0px) translateY(0px)",OrgChart.anim(this.div,{bottom:this.obj.config.padding},{bottom:this.obj.config.padding+145},this.obj.config.anim.duration,this.obj.config.anim.func),OrgChart.anim(this.layouts,{bottom:-145},{bottom:0},this.obj.config.anim.duration,this.obj.config.anim.func)},OrgChart.toolbarUI.prototype.hideLayout=function(){this._visible=!1,this.layoutBtn.style.transform="rotate(0deg) translateX(0px) translateY(0px)",OrgChart.anim(this.div,{bottom:this.obj.config.padding+145},{bottom:this.obj.config.padding},this.obj.config.anim.duration,this.obj.config.anim.func),OrgChart.anim(this.layouts,{bottom:0},{bottom:-145},this.obj.config.anim.duration,this.obj.config.anim.func)},OrgChart.notifierUI=function(){},OrgChart.notifierUI.prototype.init=function(t){this.obj=t},OrgChart.notifierUI.prototype.show=function(t,e){if(null!=t){1==t&&(t=OrgChart.MAX_NODES_MESS,e="#FFCA28"),2==t&&(t=OrgChart.OFFLINE_MESS,e="#FFCA28");var r=document.createElement("div");r.innerHTML=t,Object.assign(r.style,{position:"absolute","background-color":e,color:"#ffffff",padding:"15px","border-radius":"40px",opacity:0,overflow:"hidden","white-space":"nowrap","text-align":"center"}),this.obj.element.appendChild(r);var i=this.obj.width()/2-r.offsetWidth/2,a=this.obj.height()/2-r.offsetHeight/2;r.style.left=i+"px",r.style.top=a+"px";var n=r.offsetWidth;r.style.width="20px",OrgChart.anim(r,{opacity:0,width:10},{opacity:1,width:n},this.obj.config.anim.duration,this.obj.config.anim.func)}},OrgChart.icon={},OrgChart.icon.png=function(t,e,r){return''},OrgChart.icon.pdf=function(t,e,r){return''},OrgChart.icon.svg=function(t,e,r){return''},OrgChart.icon.csv=function(t,e,r){return''},OrgChart.icon.excel=function(t,e,r){return''},OrgChart.icon.edit=function(t,e,r){return''},OrgChart.icon.details=function(t,e,r){return''},OrgChart.icon.remove=function(t,e,r){return''},OrgChart.icon.add=function(t,e,r){return''},OrgChart.icon.search=function(t,e){return''},OrgChart.icon.addInGroup=function(t,e,r){return''},OrgChart.icon.addAsChild=function(t,e,r){return''},OrgChart.icon.xml=function(t,e,r){return''},OrgChart.prototype.exportPDF=function(t){t.mime="application/pdf",t.ext="pdf",this._export(t)},OrgChart.prototype.exportPNG=function(t){t.mime="image/png",t.ext="png",this._export(t)},OrgChart.prototype.exportSVG=function(t){t.ext="svg",t.mime="image/svg+xml",this._export(t)},OrgChart.prototype._export=function(o){var l=this;if(o.filename||(o.filename="OrgChart."+o.ext),null!=o.nodeId){var t=this.getBGNode(o.nodeId);t.isChildOfGroup&&(o.nodeId=t._groupParentNodeId)}var e={id:o.nodeId,expandChildren:o.expandChildren};this._draw(!1,OrgChart.action.exporting,e,function(t){var n=document.createElement("div");if(n.innerHTML=t,"svg"==o.ext){if(!1===OrgChart._events.publish("exportend",[l,o,n.innerHTML]))return!1;OrgChart._downloadFile(o.mime,n.innerHTML,o.filename)}else{if(null==o.margin&&(o.margin={top:"20px",bottom:"20px",left:"20px",right:"20px"}),null==o.landscape&&(o.landscape=!1),null==o.width){var e=n.querySelector("svg").getAttribute("width");o.width=e}if(null==o.height){var r=n.querySelector("svg").getAttribute("height");if(o.height=parseFloat(r),o.margin){var i=parseFloat(o.margin.bottom);o.height+=i;var a=parseFloat(o.margin.top);o.height+=a}}null==o.extraHtml&&(o.extraHtml=""),OrgChart._imgs2base64(n,"image","xlink:href",function(){if("pdf"==o.ext&&"A4"==o.format){var t=o.landscape?OrgChart.A4h:OrgChart.A4w,e=n.querySelector("svg"),r=parseFloat(e.getAttribute("width")),i=parseFloat(e.getAttribute("height"));i/=r/t,e.setAttribute("width",t),e.setAttribute("height",i),e.style.margin="0 auto",e.setAttribute("preserveAspectRatio","xMidYMin meet")}if(!1===OrgChart._events.publish("exportstart",[l,o,n.querySelector("svg")]))return!1;var a={content:''+o.extraHtml+n.innerHTML+"",options:o};a=JSON.stringify(a),OrgChart._ajax(l.config.exportUrl+"/v1","POST",a,"arraybuffer",function(t){if(!1===OrgChart._events.publish("exportend",[l,o,t]))return!1;OrgChart._downloadFile(o.mime,t,o.filename)})})}})},OrgChart.prototype.exportCSV=function(t){if(t||(t="OrgChart.csv"),!1===OrgChart._events.publish("exportstart",[this,"csv",t]))return!1;var e=OrgChart._json2csv(this.config.nodes);if(!1===OrgChart._events.publish("exportend",[this,"csv",t,e]))return!1;OrgChart._downloadFile("text/csv;charset=utf-8;",e,t)},OrgChart.prototype.exportXML=function(t){if(t||(t="OrgChart.xml"),!1===OrgChart._events.publish("exportstart",[this,"xml",t]))return!1;var e=OrgChart._json2xml(this.config.nodes);if(!1===OrgChart._events.publish("exportend",[this,"xml",t,e]))return!1;OrgChart._downloadFile("application/xml",e,t)},void 0===OrgChart&&(OrgChart={}),OrgChart._events=function(){var i={},a=i.hasOwnProperty;return{on:function(t,e){a.call(i,t)||(i[t]=[]);var r=i[t].push(e)-1;return{remove:function(){delete i[t][r]}}},publish:function(t,e){a.call(i,t)&&i[t].forEach(function(t){return 1==e.length?t(e[0]):2==e.length?t(e[0],e[1]):3==e.length?t(e[0],e[1],e[2]):4==e.length?t(e[0],e[1],e[2],e[3]):5==e.length?t(e[0],e[1],e[2],e[3],e[4]):void 0})}}}(),OrgChart.prototype.importCSV=function(){var h=this,t=document.createElement("INPUT");t.setAttribute("type","file"),t.setAttribute("accept",".csv"),t.style.display="none",t.onchange=function(t){var e=t.target,s=new FileReader;s.onload=function(){for(var t=s.result,e=OrgChart._csvToArray(t,","),r=[],i=1;ia[0]/10)return;if(l>a[1]/10)return}}else if(-1!=e.type.indexOf("touch")&&null==this._touch)return;for(var s=e.target;s!=t;){if(s.hasAttribute("control-expcoll-id")){var h=s.getAttribute("control-expcoll-id");return void this._expCollHandler(h)}if(s.hasAttribute("control-maxmin-id")){h=s.getAttribute("control-maxmin-id");return void this._maxMinHandler(h)}if(s.hasAttribute("node-id")){h=s.getAttribute("node-id");return void this._nodeClickHandler(h,e)}if(s.hasAttribute("control-node-menu-id")){h=s.getAttribute("control-node-menu-id");return void this._nodeMenuClickHandler(h,s,e)}if(s.hasAttribute("control-add"))return void this._lonelyButtonHandler();s=s.parentNode}},OrgChart.prototype._globalDbClickHandler=function(t,e){for(var r=e.target;r!=t;){if(r.hasAttribute("node-id")){var i=r.getAttribute("node-id");return void this._nodeDbClickHandler(i,e)}r=r.parentNode}},OrgChart.prototype._mouseScrollHandler=function(t,e){var r=this,i=!1,a=this.config.zoom.speed,n=this.config.zoom.smooth,o=0,l=this.getScale(),s=OrgChart._centerPointInPercent(r.getSvg(),e.pageX,e.pageY);var h=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,20)};e.preventDefault();var d=e.delta||e.wheelDelta;void 0===d&&(d=-e.detail),d=Math.max(-1,Math.min(1,d)),o+=-d*a,i||function t(){i=!0;var e=(o-l)/n;0'),n+=OrgChart.searchUI.createItem(s,l)}r.innerHTML=n;var h=i.querySelectorAll("[data-search-item-id]");for(o=0;o
'+OrgChart.icon.search(32,32)+'
'},OrgChart.searchUI.createItem=function(t,e){return'
'+t+'
'+e.textId+'
'+e.textInNode+'
'},OrgChart.searchUI.createSearchIcon=function(t){return'
'+OrgChart.icon.search(32,32)+"
"},void 0===OrgChart&&(OrgChart={}),OrgChart.server=function(t){this.config=t,this.visibleNodes=null,this.viewBox=null,this.action=null,this.actionParams=null,this.groupChildren={},this.nodes={},this.oldNodes={},this.maxX=null,this.maxY=null,this.minX=null,this.minY=null,this.root=null},OrgChart.server.prototype.read=function(t,r,i,e,a,n,o,l){var s=this;this.viewBox=e,this.action=a,this.actionParams=n;var h=this.maxX,d=this.maxY,c=this.minX,g=this.minY,p=this.root,f=this.nodes,u=this.groupChildren;if(t){var C=OrgChart.server._getResponse(r,i,this.visibleNodes,this.config,h,d,c,g,this.viewBox,p,this.action,this.actionParams,f,u,this.oldNodes);a!=OrgChart.action.exporting&&(this.maxX=h,this.maxY=d,this.minX=c,this.minY=g,this.root=p,this.nodes=f,this.groupChildren=u,this.visibleNodes=C.visibleNodes),o(C)}else this.oldNodes=f||null,this._read(function(t){h=t.maxX,d=t.maxY,c=t.minX,g=t.minY,p=t.roots[0],f=t.nodes,u=t.groupChildren;var e=OrgChart.server._getResponse(r,i,s.visibleNodes,s.config,h,d,c,g,s.viewBox,p,s.action,s.actionParams,f,u,s.oldNodes);e.notif=t.limit,a!=OrgChart.action.exporting&&(s.maxX=h,s.maxY=d,s.minX=c,s.minY=g,s.root=p,s.nodes=f,s.groupChildren=u,s.visibleNodes=e.visibleNodes),o(e)},l)},OrgChart.server.prototype._read=function(a,t){var n=this,o=OrgChart.server._createNodes(this.config,this.action,this.actionParams,this.oldNodes);t(o);var l=o.nodes,s=o.roots,e=OrgChart.remote;null==e&&(e=OrgChart.local),e._walk(s,this.config,function(t){OrgChart.server._doNotChangePositionOfClickedNodeIfAny(s,l,n.action,n.actionParams,n.oldNodes,n.config.orientation);var e={minX:null,minY:null,maxX:null,maxY:null};for(var r in l){var i=l[r];OrgChart.server._setMinMaxXY(i,e)}a({minX:e.minX,minY:e.minY,maxX:e.maxX,maxY:e.maxY,nodes:l,roots:s,groupChildren:o.groupChildren,limit:t})})},OrgChart.server.prototype.find=function(t){var r=this;if(null==t||null==t||""==t)return[];t=t.toLowerCase();for(var e,i,a,n=function(t){for(var e in r.config.nodeBinding)if(r.config.nodeBinding[e]==t)return!0;return!1},o=[],l=[],s=0;se.weight?1:0});for(s=0;s").splice(a,0,"")),d!=OrgChart.TAGS&&(d==OrgChart.ID?u=u+c+", ":OrgChart._fieldIsImg(this.config,d)?m=c:n(d)&&!OrgChart._fieldIsImg(this.config,d)?f=f+c+", ":OrgChart._fieldIsImg(this.config,d)||(C=C+c+", "))}u=u.slice(0,u.length-2),f=f.slice(0,f.length-2),C=C.slice(0,C.length-2);var y=OrgChart._getTemplate(o[s].tags,this.config.tags,this.config.template);l.push({id:o[s].id,node:new OrgChart.node(o[s],null,null,[],y),textId:u,textInNode:f,text:C,img:m})}}return l},void 0===OrgChart&&(OrgChart={}),OrgChart.server._createNodes=function(t,e,r,i){for(var a=t.nodes,n={},o=[],l=[],s=[],h={},d=!1,c=0;c=i.collapse.level){var c=!1;if(Array.isArray(i.expand.nodes))if(i.expand.allChildren){for(d=e[t.pid];null!=d;){if(-1!=i.expand.nodes.indexOf(d.id)){c=!0;break}d=e[d.pid]}c||(c=-1!=i.expand.nodes.indexOf(t.id))}else c=-1!=i.expand.nodes.indexOf(t.id);!c&&i.collapse.allChildren?(o.push(t.id),t.state=OrgChart.COLLAPSE):c||i.collapse.allChildren||h!=i.collapse.level||(o.push(t.id),t.state=OrgChart.COLLAPSE)}}}else if(r==OrgChart.action.expandCollapse&&(-1!=a.ids.indexOf(t.id)||"all"==a.ids)){if(a.state==OrgChart.COLLAPSE)o.push(t.id);else if(a.state==OrgChart.EXPAND){var g=o.indexOf(t.id);-1!=g&&o.splice(g,1)}t.state=a.state}},OrgChart.server._initGroupStates=function(t,e,r,i,a){if(r==OrgChart.action.exporting&&1==a.expandChildren&&t)OrgChart.server._setNodeGroupState(t,OrgChart.EXPAND,i.orientation);else{if(r==OrgChart.action.init&&t&&t.isGroup){var n=i.tags[t.id].groupState;OrgChart.server._setNodeGroupState(t,n,i.orientation)}r==OrgChart.action.groupMaxMin&&OrgChart.server._setNodeGroupState(e[a.id],a.state,i.orientation)}},OrgChart.server._initNodeSize=function(t,e,r){var i=OrgChart.t(e),a=i.size[0],n=i.size[1];if(t.isGroup&&t.groupState==OrgChart.EXPAND){var o=t.bgnodes.length,l=0,s=null,h=n=a=0,d=0;if(0==i.layout_type)switch(r){case OrgChart.orientation.top:case OrgChart.orientation.bottom:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom_left:l=1,s=o;for(var c=0;ci.level&&(i=e);for(var r=0;r=t._groupSettings._columns-1?(i=0,a++):i++}}},OrgChart.server._getResponse=function(t,e,r,i,a,n,o,l,s,h,d,c,g,p,f){var u={},C={top:null,left:null,bottom:null,right:null,minX:null,maxX:null,minY:null,maxY:null},m=[[],[],[]],O=a-o+2*i.padding,y=n-l+2*i.padding,x=OrgChart.getScale(s,t,e,i.scaleInitial,O,y);if(C.top=l-i.padding,C.left=o-i.padding,C.bottom=n+i.padding-e/x,C.right=a+i.padding-t/x,C.maxX=a,C.minX=o,C.maxY=n,C.minY=l,null==s&&i.align==OrgChart.CENTER){var v=Math.ceil(t/x),b=Math.ceil(e/x),w=0,_=0;if(v-2*i.padding>=a-o)switch(w=(a+o)/2-v/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:w=(o-a)/2-v/2}else switch(w=h.x-v/2+OrgChart.server._getNodeWidth(h,i)/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:(w=-(v/2-(o-a)/2))-i.padding&&(w=-i.padding)}if(b-2*i.padding>=n-l)switch(_=(n+l)/2-b/2,i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:_=(l-n)/2-b/2}else switch((_=-(b/2-(n-l)/2))>-i.padding&&(_=-i.padding),i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:(_=-(b/2-(l-n)/2))C.right?C.right:C.left),s[0]>C.right&&s[0]>C.left&&(s[0]=C.left>C.right?C.left:C.right),s[1]C.bottom?C.bottom:C.top),s[1]>C.bottom&&s[1]>C.top&&(s[1]=C.top>C.bottom?C.top:C.bottom));if(d==OrgChart.action.insert||d==OrgChart.action.expandCollapse||d==OrgChart.action.update||d==OrgChart.action.centerNode){var k=null;if(d==OrgChart.action.insert&&c&&null!=c.insertedNodeId&&null!=c.insertedNodeId)(k=g[c.insertedNodeId])||(k=g[p[c.insertedNodeId]]);else if(d==OrgChart.action.update&&c&&null!=c.visId&&null!=c.visId)(k=g[c.visId])||(k=g[p[c.visId]]);else if(d==OrgChart.action.expandCollapse&&c&&null!=c.id&&null!=c.id)(k=g[c.id])||(k=g[p[c.id]]),k=OrgChart.server._getMostDeepChild(k,g);else if(d==OrgChart.action.centerNode){switch(i.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:c.options.vertical||(k=g[c.id]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:c.options.horizontal||(k=g[c.id])}k&&(k||(k=g[p[c.id]]),k=OrgChart.server._getMostDeepChild(k,g))}if(k)switch(i.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:var S=k.y+k.h-s[3]+i.padding;s[1]S&&(s[1]=S);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:S=k.x-i.padding;s[0]>S&&(s[0]=S);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:S=k.x+k.w-s[2]+i.padding;s[0]e.maxX)&&(e.maxX=t.x+t.w),(null==e.maxY||null!=t.y&&t.y+t.h>e.maxY)&&(e.maxY=t.y+t.h)},void 0===OrgChart&&(OrgChart={}),OrgChart.templates={},OrgChart.templates.base={defs:"",size:[250,120],expandCollapseSize:30,linkAdjuster:{fromX:0,fromY:0,toX:0,toY:0},ripple:{radius:0,color:"#e6e6e6",rect:null},assistanseLink:'',svg:'{content}',link:'',pointer:'',node:'',plus:'',minus:'',nodeMenuButton:'',exportMenuButton:'



',img_0:'',link_field_0:'{val}'},OrgChart.templates.ana={defs:"",size:[250,120],linkAdjuster:{fromX:0,fromY:0,toX:0,toY:0},ripple:{radius:0,color:"#e6e6e6",rect:null},expandCollapseSize:30,svg:'{content}',link:'',secondLink:'',assistanseLink:'',pointer:'',node:'',plus:'',minus:'',nodeMenuButton:'',exportMenuButton:'



',img_0:'',link_field_0:'{val}',field_0:'{val}',field_1:'{val}'},OrgChart.templates.split=Object.assign({},OrgChart.templates.ana),OrgChart.templates.split.size=[10,10],OrgChart.templates.split.node='',OrgChart.templates.group_orange=Object.assign({},OrgChart.templates.base),OrgChart.templates.group_orange.size=[250,120],OrgChart.templates.group_orange.node='',OrgChart.templates.group_orange.groupPadding=[50,10,10,10],OrgChart.templates.group_orange.groupNodesSeparation=10,OrgChart.templates.group_orange.groupName='{val}',OrgChart.templates.group_yellow=Object.assign({},OrgChart.templates.group_orange),OrgChart.templates.group_yellow.node='',OrgChart.templates.group_yellow.groupName='{val}',OrgChart.templates.group_grey=Object.assign({},OrgChart.templates.group_orange),OrgChart.templates.group_grey.node='',OrgChart.templates.group_grey.groupName='{val}',OrgChart.templates.ula=Object.assign({},OrgChart.templates.ana),OrgChart.templates.ula.field_0='{val}',OrgChart.templates.ula.field_1='{val}',OrgChart.templates.ula.node='',OrgChart.templates.ula.img_0='',OrgChart.templates.ula.menu='',OrgChart.templates.ula.nodeMenuButton='',OrgChart.templates.olivia=Object.assign({},OrgChart.templates.ana),OrgChart.templates.olivia.field_0='{val}',OrgChart.templates.olivia.field_1='{val}',OrgChart.templates.olivia.defs='',OrgChart.templates.olivia.node='',OrgChart.templates.olivia.img_0='',OrgChart.templates.belinda=Object.assign({},OrgChart.templates.ana),OrgChart.templates.belinda.size=[180,180],OrgChart.templates.belinda.ripple={radius:90,color:"#e6e6e6",rect:null},OrgChart.templates.belinda.node='',OrgChart.templates.belinda.img_0='',OrgChart.templates.belinda.field_0='{val}',OrgChart.templates.belinda.field_1='{val}',OrgChart.templates.belinda.link='',OrgChart.templates.belinda.nodeMenuButton='',OrgChart.templates.rony=Object.assign({},OrgChart.templates.ana),OrgChart.templates.rony.svg='{content}',OrgChart.templates.rony.defs='',OrgChart.templates.rony.size=[180,250],OrgChart.templates.rony.ripple={color:"#F57C00",radius:5,rect:null},OrgChart.templates.rony.img_0='',OrgChart.templates.rony.node='',OrgChart.templates.rony.field_0='{val}',OrgChart.templates.rony.field_1='{val}',OrgChart.templates.rony.field_2='{val}',OrgChart.templates.rony.link='',OrgChart.templates.rony.plus='',OrgChart.templates.rony.minus='',OrgChart.templates.rony.nodeMenuButton='',OrgChart.templates.mery=Object.assign({},OrgChart.templates.ana),OrgChart.templates.mery.ripple={color:"#e6e6e6",radius:50,rect:null},OrgChart.templates.mery.node='',OrgChart.templates.mery.link='',OrgChart.templates.mery.img_0='',OrgChart.templates.mery.field_0='{val}',OrgChart.templates.mery.field_1='{val}',OrgChart.templates.mery.nodeMenuButton='',OrgChart.templates.polina=Object.assign({},OrgChart.templates.ana),OrgChart.templates.polina.size=[300,80],OrgChart.templates.polina.ripple={color:"#e6e6e6",radius:40,rect:null},OrgChart.templates.polina.node='',OrgChart.templates.polina.img_0='',OrgChart.templates.polina.field_0='{val}',OrgChart.templates.polina.field_1='{val}',OrgChart.templates.polina.link='',OrgChart.templates.polina.nodeMenuButton='',OrgChart.templates.mila=Object.assign({},OrgChart.templates.ana),OrgChart.templates.mila.node='',OrgChart.templates.mila.img_0='',OrgChart.templates.mila.field_0='{val}',OrgChart.templates.mila.nodeMenuButton='',OrgChart.templates.diva=Object.assign({},OrgChart.templates.ana),OrgChart.templates.diva.size=[200,170],OrgChart.templates.diva.node='',OrgChart.templates.diva.img_0='',OrgChart.templates.diva.field_0='{val}',OrgChart.templates.diva.field_1='{val}',OrgChart.templates.diva.pointer='',OrgChart.templates.diva.nodeMenuButton='',OrgChart.templates.luba=Object.assign({},OrgChart.templates.ana),OrgChart.templates.luba.svg='{content}',OrgChart.templates.luba.defs='',OrgChart.templates.luba.node='',OrgChart.templates.luba.img_0='',OrgChart.templates.luba.nodeMenuButton='',OrgChart.templates.luba.field_0='{val}',OrgChart.templates.luba.field_1='{val}',OrgChart.templates.luba.plus='',OrgChart.templates.luba.minus='',OrgChart.templates.luba.expandCollapseSize=36,OrgChart.templates.derek=Object.assign({},OrgChart.templates.ana),OrgChart.templates.derek.link='',OrgChart.templates.derek.field_0='{val}',OrgChart.templates.derek.field_1='{val}',OrgChart.templates.derek.node='',OrgChart.templates.derek.defs=' ',OrgChart.templates.derek.img_0='',OrgChart.templates.derek.minus='',OrgChart.templates.derek.plus='',OrgChart.templates.derek.nodeMenuButton='',OrgChart.templates.isla=Object.assign({},OrgChart.templates.ana),OrgChart.templates.isla.defs='',OrgChart.templates.isla.size=[180,120],OrgChart.templates.isla.node='',OrgChart.templates.isla.field_0='{val}',OrgChart.templates.isla.field_1='{val}',OrgChart.templates.isla.img_0='',OrgChart.templates.isla.minus='',OrgChart.templates.isla.plus='',OrgChart.templates.isla.nodeMenuButton='',OrgChart.templates.isla.ripple={radius:0,color:"#F57C00",rect:{x:0,y:20,width:180,height:100}},OrgChart.ui={_defsIds:{},defs:function(){var t="";for(var e in OrgChart.templates){var r=OrgChart.templates[e];r.defs?(OrgChart.ui._defsIds[e]=OrgChart._randomId(),t+=r.defs.replace("{randId}",OrgChart.ui._defsIds[e])):t+=r.defs}return""+t+""},css:function(){return''},lonely:function(t){return t.nodes&&t.nodes.length?"":OrgChart.IT_IS_LONELY_HERE.replace("{link}",OrgChart.RES.IT_IS_LONELY_HERE_LINK)},pointer:function(t,e,r){return e===OrgChart.action.exporting?"":OrgChart.t(t.template,r).pointer},node:function(t,e,r,i,a,n,o,l,s,h){var d=OrgChart.t(t.templateName,s),c=d.node.replaceAll("{w}",t.w).replaceAll("{h}",t.h);if(d.defs&&(c=c.replace("{randId}",OrgChart.ui._defsIds[t.templateName])),null==o&&(o=i.nodeBinding),t.isGroup){var g=i.tags[t.id].groupName;if(g)g=OrgChart._wrapText(g,d.groupName),c+=u=(u=d.groupName.replace("{val}",g)).replaceAll("{randId}",OrgChart._randomId()).replaceAll("{randId2}",OrgChart._randomId());c+=u}else for(var p in o){var f=o[p];if(e){var u,C=e[f];if("function"==typeof f&&(C=f(h,t)),null!=C&&null!=C&&null!=d[p])c+=u=(u=(OrgChart._lblIsImg(i,p)||"string"!=typeof C||(C=OrgChart._wrapText(C,d[p])),d[p].replace("{val}",C))).replaceAll("{randId}",OrgChart._randomId()).replaceAll("{randId2}",OrgChart._randomId())}}var m=OrgChart._getPosition(r,t,a,n),O="node";Array.isArray(t.tags)&&t.tags.length&&(O+=" "+t.tags.join(" ")),t.layout&&(O+=" tree-layout");var y=OrgChart.nodeOpenTag.replace("{id}",t.id).replace("{class}",O).replace("{level}",t.level).replace("{x}",m.x).replace("{y}",m.y),x=OrgChart._getOpacity(r,t);y=y.replace("{opacity}",x),t.isGroup||null==i.nodeMenu||"split"==t.templateName||l===OrgChart.action.exporting||(c+=d.nodeMenuButton.replace("{id}",t.id));var v=OrgChart.ui._renderGroupedNodes(t,d,i,r,o,a,n,l,s);return t.isGroup&&l!=OrgChart.action.exporting&&(t.groupState==OrgChart.EXPAND?c+=OrgChart.MINIMIZE.replace("{x}",t.w-45).replace("{id}",t.id):c+=OrgChart.MAXIMIZE.replace("{x}",t.w-45).replace("{id}",t.id)),c=y+c+v+OrgChart.grCloseTag},_renderGroupedNodes:function(t,e,r,i,a,n,o,l,s,h){var d="";if(t.isGroup&&t.groupState==OrgChart.EXPAND){e.groupPadding||console.error("groupPadding is not defined in template "+t.templateName);for(var c=0;ce.x&&(d="right");break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:case OrgChart.orientation.right:case OrgChart.orientation.right_top:d="top",t[s].y>e.y&&(d="bottom")}var c=OrgChart.t(e.templateName,a),g=r.levelSeparation;e.layout!=OrgChart.mixed&&e.layout!=OrgChart.tree||(g=r.mixedHierarchyNodesSeparation);var p={p:e.x+e.w/2+c.expandCollapseSize,q:e.y,r:e.x+e.w/2+c.expandCollapseSize,s:i.minY+g};switch(r.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([p.p,p.q]),l.push([p.r,e.y-g/3]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:p.q=e.y+e.h,p.s=i.maxY-g,l.push([p.p,p.q]),l.push([p.r,e.y+e.h+g/3]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:p.p=e.x,p.q=e.y+e.h/2+c.expandCollapseSize,p.r=i.minX-g,p.s=e.y+e.h/2+c.expandCollapseSize,l.push([p.p,p.q]),l.push([e.x-g/3,p.q]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:p.p=e.x+e.w,p.q=e.y+e.h/2+c.expandCollapseSize,p.r=i.maxX+g,p.s=e.y+e.h/2+c.expandCollapseSize,l.push([p.p,p.q]),l.push([e.x+e.w+g/3,p.q])}for(var f=e;null==h;){var u=!1,C=f.parent,m=C.leftNeighbor,O=C.rightNeighbor;if(C.id==s?h=C:OrgChart._intersects(C,p,r)&&(p=OrgChart._addPoint(C,l,r,p,d),u=!0),C.id!=s){for(;m;){if(m.id==s){h=m;break}OrgChart._intersects(m,p,r)&&(p=OrgChart._addPoint(m,l,r,p,d),u=!0),m=m.leftNeighbor}for(;O;){if(O.id==s){h=O;break}OrgChart._intersects(O,p,r)&&(p=OrgChart._addPoint(O,l,r,p,d),u=!0),O=O.rightNeighbor}}if(!u){var y=l[l.length-1][0],x=0;if(C.parent)switch(g=r.levelSeparation,C.parent.layout!=OrgChart.mixed&&C.parent.layout!=OrgChart.tree||(g=r.mixedHierarchyNodesSeparation),r.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:x=C.parent.y+C.parent.h+g*(2/3);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:x=C.parent.y-g*(2/3);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:y=C.parent.x+C.parent.w+g*(2/3),x=l[l.length-1][1];break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:y=C.parent.x-g*(2/3),x=l[l.length-1][1]}l.push([y,x])}f=C}switch(c=OrgChart.t(h.templateName,a),l.splice(l.length-1,1),r.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([h.x+h.w/2+c.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y+h.h]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:l.push([h.x+h.w/2+c.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:l.push([l[l.length-1][0],h.y+h.h/2+c.expandCollapseSize]),l.push([h.x+h.w,l[l.length-1][1]]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:l.push([l[l.length-1][0],h.y+h.h/2+c.expandCollapseSize]),l.push([h.x,l[l.length-1][1]])}l[0]="M"+l[0].join(",");for(var v=1;vr.right?r.right:r.left),e[0]>r.right&&e[0]>r.left&&(a[0]=r.left>r.right?r.left:r.right),e[1]r.bottom?r.bottom:r.top),e[1]>r.bottom&&e[1]>r.top&&(a[1]=r.top>r.bottom?r.top:r.bottom),e[0]!==a[0]||e[1]!==a[1]?OrgChart.anim(t,{viewBox:e},{viewBox:a},300,OrgChart.anim.outPow,function(){i&&i()}):i&&i()},OrgChart._randomId=function(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)},OrgChart._getClientXY=function(t){return-1==t.type.indexOf("touch")?{x:t.clientX,y:t.clientY}:t.changedTouches.length?{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}:void 0},OrgChart._getClientTouchesXY=function(t,e){return-1!=t.type.indexOf("touch")?t.touches.length"+e+"";var i=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("text")[0],a=parseFloat(i.getAttribute("x")),n=parseFloat(i.getAttribute("y")),o=i.getAttribute("text-anchor"),l=i.getAttribute("width"),s=i.getAttribute("text-overflow"),h="http://www.w3.org/2000/svg",d=r.getElementsByTagName("svg")[0].getElementsByTagName("text")[0];if(!l)return t;if(l=parseFloat(l),a||(a=0),n||(n=0),a||(o="start"),s||(s="ellipsis"),"ellipsis"==s){d.removeChild(d.firstChild),d.textContent=t;for(var c=d.getComputedTextLength(),g=2;l"+t+""+d.textContent:t}if("multiline"==s){var p=t.split(" "),f=d.getBBox().height;d.textContent="";var u=document.createElementNS(h,"tspan"),C=document.createTextNode(p[0]);u.setAttributeNS(null,"x",a),u.setAttributeNS(null,"y",n),u.setAttributeNS(null,"text-anchor",o),u.appendChild(C),d.appendChild(u);g=1;for(var m=1;ml)u.firstChild.data=u.firstChild.data.slice(0,O),(u=document.createElementNS(h,"tspan")).setAttributeNS(null,"x",a),u.setAttributeNS(null,"y",n+f*g),u.setAttributeNS(null,"text-anchor",o),C=document.createTextNode(p[m]),u.appendChild(C),d.appendChild(u),g++}var y="";if(null!=d.innerHTML)y=d.innerHTML,d.innerHTML="";else{var x="";for(m=d.childNodes.length-1;0<=m;m--)x=XMLSerializer().serializeToString(d.childNodes[m])+x,d.removeChild(d.childNodes[m]);y=x}return y}},OrgChart._downloadFile=function(t,e,r){var i=new Blob([e],{type:t});if(navigator.msSaveBlob)navigator.msSaveBlob(i,r);else{var a=document.createElement("a");if(void 0!==a.download){var n=URL.createObjectURL(i);a.setAttribute("href",n),a.setAttribute("download",r),a.style.visibility="hidden",document.body.appendChild(a),a.click(),document.body.removeChild(a)}}},OrgChart._getPosition=function(t,e,r,i){var a={x:e.x,y:e.y};if(null!=r&&(a.x=r),null!=i&&(a.y=i),t&&3==t.length){var n=t[0].indexOf(e.id);-1!=n&&null!=t[1][n].transform&&(null==r&&(a.x=t[1][n].transform[4]),null==i&&(a.y=t[1][n].transform[5]))}return a},OrgChart._getOpacity=function(t,e){var r=1;if(t&&3==t.length){var i=t[0].indexOf(e.id);-1!=i&&null!=t[1][i].opacity&&(r=t[1][i].opacity)}return r},OrgChart.t=function(t,e){var r=OrgChart.templates[t],i=null;if(null!=e&&r.scaleLessThen){var a=[];for(var n in r.scaleLessThen){var o=parseFloat(n);e'+(new XMLSerializer).serializeToString(e.documentElement)},OrgChart._xml2json=function(t){for(var e=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("node"),r=[],i=0;ir&&(l.pos=r),a||n()}function n(){a=!0;var t=(l.pos-l.bar.scrollLeft)/e;0r&&(l.pos=r),a||n()}function n(){a=!0;var t=(l.pos-l.bar.scrollTop)/e;0this.config.scaleMin||0!=t&&1!=t&&lthis.config.scaleMin){this._hideBeforeAnimation();var s=this;r?(clearTimeout(s._timeout),OrgChart.anim(this.getSvg(),{viewbox:this.getViewBox()},{viewbox:i},this.config.anim.duration,this.config.anim.func,function(){clearTimeout(s._timeout),s._timeout=setTimeout(function(){s._draw(!0,OrgChart.action.zoom)},500)})):(this.setViewBox(i),clearTimeout(s._timeout),s._timeout=setTimeout(function(){s._draw(!0,OrgChart.action.zoom)},500))}}; \ No newline at end of file diff --git a/package.json b/package.json index 175ad28..7bc9ad4 100644 --- a/package.json +++ b/package.json @@ -1 +1 @@ -{"author":{"name":"BALKANGraph"},"bugs":{"email":"support@balkangraph.com","url":"https://github.com/BALKANGraph/OrgChartJS/issues"},"deprecated":false,"description":"Ultimate Organizational Chart JavaScript library, Interactive Diagrams","files":["OrgChart.js","package.json","README.md"],"homepage":"https://balkangraph.com/","keywords":["diagram","chart","tree","orgchart","graph","svg","hierarchy","family-tree","decision-tree","visualization","tree-layout","hierarchical","javascript","js","html","html5"],"license":"SEE LICENSE IN https://balkangraph.com","main":"OrgChart.js","name":"@balkangraph/orgchart.js","repository":{"type":"git","url":"https://github.com/BALKANGraph/OrgChartJS"},"version":"4.6.0","dependencies":{}} \ No newline at end of file +{"author":{"name":"BALKANGraph"},"bugs":{"email":"support@balkangraph.com","url":"https://github.com/BALKANGraph/OrgChartJS/issues"},"deprecated":false,"description":"Ultimate Organizational Chart JavaScript library, Interactive Diagrams","files":["OrgChart.js","package.json","README.md"],"homepage":"https://balkangraph.com/","keywords":["diagram","chart","tree","orgchart","graph","svg","hierarchy","family-tree","decision-tree","visualization","tree-layout","hierarchical","javascript","js","html","html5"],"license":"SEE LICENSE IN https://balkangraph.com","main":"OrgChart.js","name":"@balkangraph/orgchart.js","repository":{"type":"git","url":"https://github.com/BALKANGraph/OrgChartJS"},"version":"4.6.1","dependencies":{}} \ No newline at end of file