mind-elixir-yg 1.1.23 → 1.1.25
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.
- package/dist/MindElixir.js +2 -2
- package/package.json +1 -1
- package/dist/test.html +0 -342
package/dist/MindElixir.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</div>`,p.innerHTML=`${E.Z[e].autoCaseList}<div style='padding-bottom:10px'>
|
|
25
25
|
<input type="text" id="searchInput" placeholder="搜索用例...">
|
|
26
26
|
<div style='overflow: auto;'>
|
|
27
|
-
<select id="autoCase" style='height:26px'>
|
|
27
|
+
<select id="autoCase" style='height:26px;width:210px'>
|
|
28
28
|
${r.selectCaseList.map(e=>`<option value=${e.id} >${e.name}</option>`).join("")}
|
|
29
29
|
</select>
|
|
30
30
|
<span class="autoCase-add">添加</span>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<div class="button-container"><svg class="icon" aria-hidden="true">
|
|
35
35
|
<use xlink:href="#icon-close"></use>
|
|
36
36
|
</svg></div>
|
|
37
|
-
`,h.appendChild(t),h.appendChild(c),h.appendChild(i),h.appendChild(s),h.appendChild(d),r.showSelectCaseList&&h.appendChild(p),h.appendChild(l),h.hidden=!0,r.container.append(h),e=h.querySelectorAll(".size");const u=h.querySelector(".bold"),f=h.querySelector(".button-container"),m=h.querySelector(".font"),b=r.container.querySelector(".nm-tag"),g=r.container.querySelector(".nm-icon"),x=r.container.querySelector(".nm-remarks"),v=(h.querySelector(".nm-caseresult"),h.onclick=e=>{if(r.currentNode){const t=r.currentNode.nodeObj,i=e.target;var n;"palette"===i.className?(t.style||(t.style={}),a(".palette","nmenu-selected"),i.className="palette nmenu-selected","font"===o?"#ffffff"===i.dataset.color?t.style.color="":t.style.color=i.dataset.color:"background"===o&&("#ffffff"===i.dataset.color?t.style.background="":t.style.background=i.dataset.color),r.updateNodeStyle(t)):"background"===i.className?(a(".palette","nmenu-selected"),o="background",i.className="background selected",i.previousElementSibling.className="font",t.style&&t.style.background&&(h.querySelector('.palette[data-color="'+t.style.background+'"]').className="palette nmenu-selected")):"font"===i.className?(a(".palette","nmenu-selected"),o="font",i.className="font selected",i.nextElementSibling.className="background",t.style&&t.style.color&&(h.querySelector('.palette[data-color="'+t.style.color+'"]').className="palette nmenu-selected")):"case-pass"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,2):"case-notpass"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,3):"case-block"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,4):"case-notrun"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,1):"case-ignore"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,5):"case-null"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,""):"priority-one"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,1):"priority-two"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,2):"priority-three"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,3):"priority-four"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,4):"priority-five"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,5):"priority-null"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,""):"autoCase-null"===i.className?r.updateNodRelationAutoCase(r.currentNode.nodeObj,"",""):"autoCase-add"===i.className&&(e=v.value,n=v.options[v.selectedIndex].text,r.updateNodRelationAutoCase(r.currentNode.nodeObj,e,n))}},document.getElementById("autoCase")),y=(v&&v.addEventListener("change",function(){var e=v.options[v.selectedIndex];r.updateNodRelationAutoCase(r.currentNode.nodeObj,e.value,e.text)}),document.getElementById("searchInput"));y&&y.addEventListener("input",function(e){for(var n=e.target.value.toLowerCase(),t=document.getElementById("autoCase").options,i=0;i<t.length;i++){var o=t[i];o.text.toLowerCase().includes(n)?o.style.display="":o.style.display="none"}}),Array.from(e).map(e=>{e.onclick=e=>{r.currentNode.nodeObj.style||(r.currentNode.nodeObj.style={}),a(".size","size-selected");const n=e.currentTarget;r.currentNode.nodeObj.style.fontSize=n.dataset.size,n.className="size size-selected",r.updateNodeStyle(r.currentNode.nodeObj)}}),u.onclick=e=>{r.currentNode.nodeObj.style||(r.currentNode.nodeObj.style={}),"bold"===r.currentNode.nodeObj.style.fontWeight?(delete r.currentNode.nodeObj.style.fontWeight,e.currentTarget.className="bold"):(r.currentNode.nodeObj.style.fontWeight="bold",e.currentTarget.className="bold size-selected"),r.updateNodeStyle(r.currentNode.nodeObj)},b.onchange=e=>{r.currentNode&&(e.target.value?(e=e.target.value.split(","),r.updateNodeTags(r.currentNode.nodeObj,e)):r.updateNodeTags(r.currentNode.nodeObj,""))},g.onchange=e=>{r.currentNode&&(e.target.value?(e=e.target.value.split(","),r.updateNodeIcons(r.currentNode.nodeObj,e)):r.updateNodeIcons(r.currentNode.nodeObj,""))},x.onchange=e=>{r.currentNode&&(e.target.value?(e=e.target.value,r.updateNodeRemark(r.currentNode.nodeObj,e)):r.updateNodeRemark(r.currentNode.nodeObj,""))};let n="open";f.onclick=e=>{"open"===n?(n="close",h.className="close",f.innerHTML='<svg class="icon" aria-hidden="true"><use xlink:href="#icon-menu"></use></svg>'):(n="open",h.className="",f.innerHTML='<svg class="icon" aria-hidden="true"><use xlink:href="#icon-close"></use></svg>')},r.bus.addListener("unselectNode",function(){h.hidden=!0}),r.bus.addListener("selectNode",function(e){h.hidden=!1,a(".palette","nmenu-selected"),a(".size","size-selected"),a(".bold","size-selected"),o="font",m.className="font selected",m.nextElementSibling.className="background",e.style&&(e.style.fontSize&&(h.querySelector('.size[data-size="'+e.style.fontSize+'"]').className="size size-selected"),e.style.fontWeight&&(h.querySelector(".bold").className="bold size-selected"),e.style.color&&(h.querySelector('.palette[data-color="'+e.style.color+'"]').className="palette nmenu-selected")),e.tags?b.value=e.tags.join(","):b.value="",e.icons?g.value=e.icons.join(","):g.value="",e.remarks?x.value=e.remarks:x.value=""})}if(this.keypress){var n=this;const o={13:()=>{n.insertSibling()},9:()=>{n.addChild()},113:()=>{n.beginEdit()},38:()=>{n.selectPrevSibling()},40:()=>{n.selectNextSibling()},37:()=>{n.currentNode&&("rhs"===n.currentNode.offsetParent.offsetParent.className?n.selectParent():"lhs"!==n.currentNode.offsetParent.offsetParent.className&&!n.currentNode.nodeObj.root||n.selectFirstChild())},39:()=>{n.currentNode&&("rhs"===n.currentNode.offsetParent.offsetParent.className||n.currentNode.nodeObj.root?n.selectFirstChild():"lhs"===n.currentNode.offsetParent.offsetParent.className&&n.selectParent())},33(){n.moveUpNode()},34(){n.moveDownNode()},67(e){(e.metaKey||e.ctrlKey)&&(n.waitCopy=n.currentNode)},86(e){n.waitCopy&&(e.metaKey||e.ctrlKey)&&(n.copyNode(n.waitCopy,n.currentNode),n.waitCopy=null)},90:e=>{n.allowUndo&&(e.metaKey||e.ctrlKey)&&n.undo()},187:e=>{!e.metaKey&&!e.ctrlKey||1.6<n.scaleVal||n.scale(n.scaleVal+=.2)},189:e=>{!e.metaKey&&!e.ctrlKey||n.scaleVal<.6||n.scale(n.scaleVal-=.2)}};n.map.onkeydown=e=>{e.preventDefault(),n.editable&&e.target===e.currentTarget&&(8===e.keyCode||46===e.keyCode?n.currentLink?n.removeLink():n.removeNode():o[e.keyCode]&&o[e.keyCode](e))}}(0,N.tq)()&&this.mobileMenu?(0,j.Z)(this):this.contextMenu&&(0,C.Z)(this,this.contextMenuOption),this.draggable&&M(this),this.toCenter(),this.layout(),this.linkDiv(),this.overflowHidden||(0,k.Z)(this)}},u.LEFT=n.RL,u.RIGHT=n.pX,u.SIDE=n.VW,u.version="0.17.0",u.E=i.YZ,u.new=e=>({nodeData:{id:(0,N.DO)(),topic:e||"new topic",root:!0,children:[]},linkData:{}});const m=u},3164:(e,n,t)=>{"use strict";t.d(n,{UG:()=>o,KW:()=>a,dl:()=>s,nb:()=>l,ji:()=>d,xG:()=>c,kS:()=>p,jl:()=>h,Rg:()=>u,Lj:()=>f,gw:()=>m,bA:()=>b,h7:()=>g,Tn:()=>x,nA:()=>v,Nb:()=>y,Qi:()=>N,_F:()=>w,Ut:()=>k,dJ:()=>C,uj:()=>L,du:()=>E,$8:()=>S,jS:()=>$,i_:()=>M,A2:()=>j,bi:()=>O});var i=t(9842);function r(e){return e.isFocusMode?e.nodeDataBackup:e.nodeData}const o=function(e,n){if(e){if("string"==typeof e)return this.selectNode((0,i.YZ)(e));this.currentNode&&(this.currentNode.className=""),e.className="selected",this.currentNode=e,n?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj)}},a=function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},s=function(){if(this.currentNode&&"meroot"!==this.currentNode.dataset.nodeid){var n=this.currentNode.parentElement.parentElement.nextSibling;let e;var t=this.currentNode.parentElement.parentElement;if("rhs"===t.className||"lhs"===t.className){var i=this.mindElixirBox.querySelectorAll("."+t.className),t=Array.from(i).indexOf(t);if(!(t+1<i.length))return!1;e=i[t+1].firstChild.firstChild}else{if(!n)return!1;e=n.firstChild.firstChild}return this.selectNode(e),!0}},l=function(){if(this.currentNode&&"meroot"!==this.currentNode.dataset.nodeid){var n=this.currentNode.parentElement.parentElement.previousSibling;let e;var t=this.currentNode.parentElement.parentElement;if("rhs"===t.className||"lhs"===t.className){var i=this.mindElixirBox.querySelectorAll("."+t.className),t=Array.from(i).indexOf(t);if(!(0<=t-1))return!1;e=i[t-1].firstChild.firstChild}else{if(!n)return!1;e=n.firstChild.firstChild}return this.selectNode(e),!0}},d=function(){var e;!this.currentNode||(e=this.currentNode.parentElement.nextSibling)&&e.firstChild&&(e=e.firstChild.firstChild.firstChild,this.selectNode(e))},c=function(){var e;!this.currentNode||"meroot"===this.currentNode.dataset.nodeid||(e=this.currentNode.parentElement.parentElement.parentElement.previousSibling)&&(e=e.firstChild,this.selectNode(e))},p=function(){var e={nodeData:r(this),linkData:this.linkData};return JSON.stringify(e,(e,n)=>{if("parent"!==e)return"from"===e||"to"===e?n.nodeObj.id:n})},h=function(){var e={nodeData:r(this),linkData:this.linkData};return JSON.parse(JSON.stringify(e,(e,n)=>{if("parent"!==e)return"from"===e||"to"===e?n.nodeObj.id:n}))},u=function(){var e=r(this);let o="# "+e.topic+"\n\n";return function n(t,i){for(let e=0;e<t.length;e++)o+=i<=6?"".padStart(i,"#")+" "+t[e].topic+"\n\n":"".padStart(i-7,"\t")+"- "+t[e].topic+"\n",t[e].children&&n(t[e].children,i+1)}(e.children,2),o},f=function(){this.editable=!0},m=function(){this.editable=!1},b=function(e){this.scaleVal=e,this.map.style.transform="scale("+e+")"},g=function(){this.container.scrollTo(1e4-this.container.offsetWidth/2,3e4-this.container.offsetHeight/2)},x=function(e,n){this.container.scrollTo(e,n)},v=function(){this.direction=0,this.init()},y=function(){this.direction=1,this.init()},N=function(){this.direction=2,this.init()},w=function(e){this.scale(e)},k=function(e){this.scale(e)};const C=function(e){e.nodeObj.root||(null===this.tempDirection&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.nodeData.root=!0,this.initRight())},L=function(){this.isFocusMode=!1,null!==this.tempDirection&&(delete this.nodeData.root,this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.init())},E=function(){this.direction=0,this.init()},S=function(){this.direction=1,this.init()},$=function(){this.direction=2,this.init()},M=function(e){this.locale=e,this.init()},j=function(e,n){const t=e.nodeObj;"boolean"==typeof n?t.expanded=n:!1!==t.expanded?t.expanded=!1:t.expanded=!0,this.layout(),this.linkDiv(),this.bus.fire("expandNode",t)},O=function(){this.addParentLink(this.nodeData),this.layout(),this.linkDiv()}},2327:(e,n,t)=>{"use strict";t.d(n,{Z:()=>function(n){var i=this.primaryNodeHorizontalGap||S.SJ,r=this.primaryNodeVerticalGap||S.jQ;const o=this.root,a=(o.style.cssText=`top:${3e4-o.offsetHeight/2}px;left:${1e4-o.offsetWidth/2}px;`,this.box.children);this.svg2nd.innerHTML="";let t=0,s,l=0,d=0,c=0,p=0,h=0,u;if(this.direction===S.VW){let n=0,t=0,i=0,o=0;for(let e=0;e<a.length;e++){var f=a[e];"lhs"===f.className?(p+=f.offsetHeight+r,i+=f.offsetHeight,n+=1):(h+=f.offsetHeight+r,o+=f.offsetHeight,t+=1)}l=p>h?(u=3e4-Math.max(p)/2,s="r",(p-o)/(t-1)):(u=3e4-Math.max(h)/2,s="l",(h-i)/(n-1))}else{for(let e=0;e<a.length;e++){var m=a[e];t+=m.offsetHeight+r}u=3e4-t/2}let b="";for(let e=0;e<a.length;e++){let n,t;const y=a[e];var g=y.offsetHeight;if("lhs"===y.className){y.style.top=u+d+"px",y.style.left=1e4-o.offsetWidth/2-i-y.offsetWidth+"px",n=1e4-o.offsetWidth/2-i-15,t=u+d+g/2;let e=1e4;2===this.primaryLinkStyle?(this.direction===S.VW&&(e=1e4-o.offsetWidth/6),t<1e4?b+=`M ${e} 10000
|
|
37
|
+
`,h.appendChild(t),h.appendChild(c),h.appendChild(i),h.appendChild(s),h.appendChild(d),r.showSelectCaseList&&h.appendChild(p),h.appendChild(l),h.hidden=!0,r.container.append(h),e=h.querySelectorAll(".size");const u=h.querySelector(".bold"),f=h.querySelector(".button-container"),m=h.querySelector(".font"),b=r.container.querySelector(".nm-tag"),g=r.container.querySelector(".nm-icon"),x=r.container.querySelector(".nm-remarks"),v=(h.querySelector(".nm-caseresult"),h.onclick=e=>{if(r.currentNode){const t=r.currentNode.nodeObj,i=e.target;var n;"palette"===i.className?(t.style||(t.style={}),a(".palette","nmenu-selected"),i.className="palette nmenu-selected","font"===o?"#ffffff"===i.dataset.color?t.style.color="":t.style.color=i.dataset.color:"background"===o&&("#ffffff"===i.dataset.color?t.style.background="":t.style.background=i.dataset.color),r.updateNodeStyle(t)):"background"===i.className?(a(".palette","nmenu-selected"),o="background",i.className="background selected",i.previousElementSibling.className="font",t.style&&t.style.background&&(h.querySelector('.palette[data-color="'+t.style.background+'"]').className="palette nmenu-selected")):"font"===i.className?(a(".palette","nmenu-selected"),o="font",i.className="font selected",i.nextElementSibling.className="background",t.style&&t.style.color&&(h.querySelector('.palette[data-color="'+t.style.color+'"]').className="palette nmenu-selected")):"case-pass"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,2):"case-notpass"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,3):"case-block"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,4):"case-notrun"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,1):"case-ignore"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,5):"case-null"===i.className?r.updateNodeCaseStatus(r.currentNode.nodeObj,""):"priority-one"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,1):"priority-two"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,2):"priority-three"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,3):"priority-four"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,4):"priority-five"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,5):"priority-null"===i.className?r.updateNodeCasePriority(r.currentNode.nodeObj,""):"autoCase-null"===i.className?r.updateNodRelationAutoCase(r.currentNode.nodeObj,"",""):"autoCase-add"===i.className&&(e=v.value,n=v.options[v.selectedIndex].text,r.updateNodRelationAutoCase(r.currentNode.nodeObj,e,n))}},document.getElementById("autoCase")),y=(v&&v.addEventListener("change",function(){var e=v.options[v.selectedIndex];r.updateNodRelationAutoCase(r.currentNode.nodeObj,e.value,e.text)}),document.getElementById("searchInput"));y&&y.addEventListener("input",function(e){if(v){const v=document.getElementById("autoCase");v.selectedIndex=-1}for(var n=e.target.value.toLowerCase(),t=document.getElementById("autoCase").options,i=0;i<t.length;i++){var o=t[i],r=o.text.toLowerCase();r.includes(n)?o.style.display="":o.style.display="none"}}),Array.from(e).map(e=>{e.onclick=e=>{r.currentNode.nodeObj.style||(r.currentNode.nodeObj.style={}),a(".size","size-selected");const n=e.currentTarget;r.currentNode.nodeObj.style.fontSize=n.dataset.size,n.className="size size-selected",r.updateNodeStyle(r.currentNode.nodeObj)}}),u.onclick=e=>{r.currentNode.nodeObj.style||(r.currentNode.nodeObj.style={}),"bold"===r.currentNode.nodeObj.style.fontWeight?(delete r.currentNode.nodeObj.style.fontWeight,e.currentTarget.className="bold"):(r.currentNode.nodeObj.style.fontWeight="bold",e.currentTarget.className="bold size-selected"),r.updateNodeStyle(r.currentNode.nodeObj)},b.onchange=e=>{r.currentNode&&(e.target.value?(e=e.target.value.split(","),r.updateNodeTags(r.currentNode.nodeObj,e)):r.updateNodeTags(r.currentNode.nodeObj,""))},g.onchange=e=>{r.currentNode&&(e.target.value?(e=e.target.value.split(","),r.updateNodeIcons(r.currentNode.nodeObj,e)):r.updateNodeIcons(r.currentNode.nodeObj,""))},x.onchange=e=>{r.currentNode&&(e.target.value?(e=e.target.value,r.updateNodeRemark(r.currentNode.nodeObj,e)):r.updateNodeRemark(r.currentNode.nodeObj,""))};let n="open";f.onclick=e=>{"open"===n?(n="close",h.className="close",f.innerHTML='<svg class="icon" aria-hidden="true"><use xlink:href="#icon-menu"></use></svg>'):(n="open",h.className="",f.innerHTML='<svg class="icon" aria-hidden="true"><use xlink:href="#icon-close"></use></svg>')},r.bus.addListener("unselectNode",function(){h.hidden=!0}),r.bus.addListener("selectNode",function(e){h.hidden=!1,a(".palette","nmenu-selected"),a(".size","size-selected"),a(".bold","size-selected"),o="font",m.className="font selected",m.nextElementSibling.className="background",e.style&&(e.style.fontSize&&(h.querySelector('.size[data-size="'+e.style.fontSize+'"]').className="size size-selected"),e.style.fontWeight&&(h.querySelector(".bold").className="bold size-selected"),e.style.color&&(h.querySelector('.palette[data-color="'+e.style.color+'"]').className="palette nmenu-selected")),e.tags?b.value=e.tags.join(","):b.value="",e.icons?g.value=e.icons.join(","):g.value="",e.remarks?x.value=e.remarks:x.value=""})}if(this.keypress){var n=this;const o={13:()=>{n.insertSibling()},9:()=>{n.addChild()},113:()=>{n.beginEdit()},38:()=>{n.selectPrevSibling()},40:()=>{n.selectNextSibling()},37:()=>{n.currentNode&&("rhs"===n.currentNode.offsetParent.offsetParent.className?n.selectParent():"lhs"!==n.currentNode.offsetParent.offsetParent.className&&!n.currentNode.nodeObj.root||n.selectFirstChild())},39:()=>{n.currentNode&&("rhs"===n.currentNode.offsetParent.offsetParent.className||n.currentNode.nodeObj.root?n.selectFirstChild():"lhs"===n.currentNode.offsetParent.offsetParent.className&&n.selectParent())},33(){n.moveUpNode()},34(){n.moveDownNode()},67(e){(e.metaKey||e.ctrlKey)&&(n.waitCopy=n.currentNode)},86(e){n.waitCopy&&(e.metaKey||e.ctrlKey)&&(n.copyNode(n.waitCopy,n.currentNode),n.waitCopy=null)},90:e=>{n.allowUndo&&(e.metaKey||e.ctrlKey)&&n.undo()},187:e=>{!e.metaKey&&!e.ctrlKey||1.6<n.scaleVal||n.scale(n.scaleVal+=.2)},189:e=>{!e.metaKey&&!e.ctrlKey||n.scaleVal<.6||n.scale(n.scaleVal-=.2)}};n.map.onkeydown=e=>{e.preventDefault(),n.editable&&e.target===e.currentTarget&&(8===e.keyCode||46===e.keyCode?n.currentLink?n.removeLink():n.removeNode():o[e.keyCode]&&o[e.keyCode](e))}}(0,N.tq)()&&this.mobileMenu?(0,j.Z)(this):this.contextMenu&&(0,C.Z)(this,this.contextMenuOption),this.draggable&&M(this),this.toCenter(),this.layout(),this.linkDiv(),this.overflowHidden||(0,k.Z)(this)}},u.LEFT=n.RL,u.RIGHT=n.pX,u.SIDE=n.VW,u.version="0.17.0",u.E=i.YZ,u.new=e=>({nodeData:{id:(0,N.DO)(),topic:e||"new topic",root:!0,children:[]},linkData:{}});const m=u},3164:(e,n,t)=>{"use strict";t.d(n,{UG:()=>o,KW:()=>a,dl:()=>s,nb:()=>l,ji:()=>d,xG:()=>c,kS:()=>p,jl:()=>h,Rg:()=>u,Lj:()=>f,gw:()=>m,bA:()=>b,h7:()=>g,Tn:()=>x,nA:()=>v,Nb:()=>y,Qi:()=>N,_F:()=>w,Ut:()=>k,dJ:()=>C,uj:()=>L,du:()=>E,$8:()=>S,jS:()=>$,i_:()=>M,A2:()=>j,bi:()=>O});var i=t(9842);function r(e){return e.isFocusMode?e.nodeDataBackup:e.nodeData}const o=function(e,n){if(e){if("string"==typeof e)return this.selectNode((0,i.YZ)(e));this.currentNode&&(this.currentNode.className=""),e.className="selected",this.currentNode=e,n?this.bus.fire("selectNewNode",e.nodeObj):this.bus.fire("selectNode",e.nodeObj)}},a=function(){this.currentNode&&(this.currentNode.className=""),this.currentNode=null,this.bus.fire("unselectNode")},s=function(){if(this.currentNode&&"meroot"!==this.currentNode.dataset.nodeid){var n=this.currentNode.parentElement.parentElement.nextSibling;let e;var t=this.currentNode.parentElement.parentElement;if("rhs"===t.className||"lhs"===t.className){var i=this.mindElixirBox.querySelectorAll("."+t.className),t=Array.from(i).indexOf(t);if(!(t+1<i.length))return!1;e=i[t+1].firstChild.firstChild}else{if(!n)return!1;e=n.firstChild.firstChild}return this.selectNode(e),!0}},l=function(){if(this.currentNode&&"meroot"!==this.currentNode.dataset.nodeid){var n=this.currentNode.parentElement.parentElement.previousSibling;let e;var t=this.currentNode.parentElement.parentElement;if("rhs"===t.className||"lhs"===t.className){var i=this.mindElixirBox.querySelectorAll("."+t.className),t=Array.from(i).indexOf(t);if(!(0<=t-1))return!1;e=i[t-1].firstChild.firstChild}else{if(!n)return!1;e=n.firstChild.firstChild}return this.selectNode(e),!0}},d=function(){var e;!this.currentNode||(e=this.currentNode.parentElement.nextSibling)&&e.firstChild&&(e=e.firstChild.firstChild.firstChild,this.selectNode(e))},c=function(){var e;!this.currentNode||"meroot"===this.currentNode.dataset.nodeid||(e=this.currentNode.parentElement.parentElement.parentElement.previousSibling)&&(e=e.firstChild,this.selectNode(e))},p=function(){var e={nodeData:r(this),linkData:this.linkData};return JSON.stringify(e,(e,n)=>{if("parent"!==e)return"from"===e||"to"===e?n.nodeObj.id:n})},h=function(){var e={nodeData:r(this),linkData:this.linkData};return JSON.parse(JSON.stringify(e,(e,n)=>{if("parent"!==e)return"from"===e||"to"===e?n.nodeObj.id:n}))},u=function(){var e=r(this);let o="# "+e.topic+"\n\n";return function n(t,i){for(let e=0;e<t.length;e++)o+=i<=6?"".padStart(i,"#")+" "+t[e].topic+"\n\n":"".padStart(i-7,"\t")+"- "+t[e].topic+"\n",t[e].children&&n(t[e].children,i+1)}(e.children,2),o},f=function(){this.editable=!0},m=function(){this.editable=!1},b=function(e){this.scaleVal=e,this.map.style.transform="scale("+e+")"},g=function(){this.container.scrollTo(1e4-this.container.offsetWidth/2,3e4-this.container.offsetHeight/2)},x=function(e,n){this.container.scrollTo(e,n)},v=function(){this.direction=0,this.init()},y=function(){this.direction=1,this.init()},N=function(){this.direction=2,this.init()},w=function(e){this.scale(e)},k=function(e){this.scale(e)};const C=function(e){e.nodeObj.root||(null===this.tempDirection&&(this.tempDirection=this.direction),this.isFocusMode||(this.nodeDataBackup=this.nodeData,this.isFocusMode=!0),this.nodeData=e.nodeObj,this.nodeData.root=!0,this.initRight())},L=function(){this.isFocusMode=!1,null!==this.tempDirection&&(delete this.nodeData.root,this.nodeData=this.nodeDataBackup,this.direction=this.tempDirection,this.tempDirection=null,this.init())},E=function(){this.direction=0,this.init()},S=function(){this.direction=1,this.init()},$=function(){this.direction=2,this.init()},M=function(e){this.locale=e,this.init()},j=function(e,n){const t=e.nodeObj;"boolean"==typeof n?t.expanded=n:!1!==t.expanded?t.expanded=!1:t.expanded=!0,this.layout(),this.linkDiv(),this.bus.fire("expandNode",t)},O=function(){this.addParentLink(this.nodeData),this.layout(),this.linkDiv()}},2327:(e,n,t)=>{"use strict";t.d(n,{Z:()=>function(n){var i=this.primaryNodeHorizontalGap||S.SJ,r=this.primaryNodeVerticalGap||S.jQ;const o=this.root,a=(o.style.cssText=`top:${3e4-o.offsetHeight/2}px;left:${1e4-o.offsetWidth/2}px;`,this.box.children);this.svg2nd.innerHTML="";let t=0,s,l=0,d=0,c=0,p=0,h=0,u;if(this.direction===S.VW){let n=0,t=0,i=0,o=0;for(let e=0;e<a.length;e++){var f=a[e];"lhs"===f.className?(p+=f.offsetHeight+r,i+=f.offsetHeight,n+=1):(h+=f.offsetHeight+r,o+=f.offsetHeight,t+=1)}l=p>h?(u=3e4-Math.max(p)/2,s="r",(p-o)/(t-1)):(u=3e4-Math.max(h)/2,s="l",(h-i)/(n-1))}else{for(let e=0;e<a.length;e++){var m=a[e];t+=m.offsetHeight+r}u=3e4-t/2}let b="";for(let e=0;e<a.length;e++){let n,t;const y=a[e];var g=y.offsetHeight;if("lhs"===y.className){y.style.top=u+d+"px",y.style.left=1e4-o.offsetWidth/2-i-y.offsetWidth+"px",n=1e4-o.offsetWidth/2-i-15,t=u+d+g/2;let e=1e4;2===this.primaryLinkStyle?(this.direction===S.VW&&(e=1e4-o.offsetWidth/6),t<1e4?b+=`M ${e} 10000
|
|
38
38
|
L ${e} ${t+20}
|
|
39
39
|
C ${e} ${t} ${e} ${t} ${e-20} ${t}
|
|
40
40
|
L ${n} `+t:b+=`M ${e} 10000
|
package/package.json
CHANGED
package/dist/test.html
DELETED
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
7
|
-
<title>Document</title>
|
|
8
|
-
<style>
|
|
9
|
-
/* 想要菜单相对父组件显示需要在外层添加 position: relative; */
|
|
10
|
-
.outer {
|
|
11
|
-
position: relative;
|
|
12
|
-
margin: 50px;
|
|
13
|
-
}
|
|
14
|
-
#map {
|
|
15
|
-
height: 500px;
|
|
16
|
-
overflow: auto;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<div class="outer">
|
|
22
|
-
<div id="map"></div>
|
|
23
|
-
</div>
|
|
24
|
-
<script type="text/javascript" src="./MindElixir.js"></script>
|
|
25
|
-
</body>
|
|
26
|
-
<script>
|
|
27
|
-
var data = {
|
|
28
|
-
nodeData: {
|
|
29
|
-
id: 'root',
|
|
30
|
-
topic: 'Mind Elixir',
|
|
31
|
-
root: true,
|
|
32
|
-
children: [
|
|
33
|
-
{
|
|
34
|
-
topic: '什么是 Minde Elixir',
|
|
35
|
-
id: 'bd4313fbac40284b',
|
|
36
|
-
direction: 0,
|
|
37
|
-
expanded: true,
|
|
38
|
-
children: [
|
|
39
|
-
{
|
|
40
|
-
topic: '一个网页版思维导图应用程序',
|
|
41
|
-
id: 'beeb823afd6d2114',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
topic: '免费',
|
|
45
|
-
id: 'c1f068377de9f3a0',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
topic: '即将开源',
|
|
49
|
-
id: 'c1f06d38a09f23ca',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
topic: '无框架依赖',
|
|
53
|
-
id: 'c1f06e4cbcf16463',
|
|
54
|
-
expanded: true,
|
|
55
|
-
children: [],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
topic: '两步轻松接入已有项目',
|
|
59
|
-
id: 'c1f1f11a7fbf7550',
|
|
60
|
-
children: [
|
|
61
|
-
{
|
|
62
|
-
topic: "import MindElixir from 'mind-elixir'",
|
|
63
|
-
id: 'c1f1e245b0a89f9b',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
topic: 'new MindElixir({...}).init()',
|
|
67
|
-
id: 'c1f1ebc7072c8928',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
topic: '使用简单',
|
|
73
|
-
id: 'c1f0723c07b408d7',
|
|
74
|
-
expanded: true,
|
|
75
|
-
children: [
|
|
76
|
-
{
|
|
77
|
-
topic: '操作手感类似其他主流思维导图应用',
|
|
78
|
-
id: 'c1f09612fd89920d',
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
topic: '基本操作',
|
|
86
|
-
id: 'bd1b66c4b56754d9',
|
|
87
|
-
direction: 0,
|
|
88
|
-
expanded: true,
|
|
89
|
-
children: [
|
|
90
|
-
{
|
|
91
|
-
topic: 'tab 新建子节点',
|
|
92
|
-
id: 'bd1b6892bcab126a',
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
topic: 'enter 新建同级节点',
|
|
96
|
-
id: 'bd1b6b632a434b27',
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
topic: 'del 删除节点',
|
|
100
|
-
id: 'bd1b983085187c0a',
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
topic: '专注',
|
|
106
|
-
id: 'bd1b9b94a9a7a913',
|
|
107
|
-
direction: 1,
|
|
108
|
-
expanded: true,
|
|
109
|
-
children: [
|
|
110
|
-
{
|
|
111
|
-
topic: '点击右键,专注模式',
|
|
112
|
-
id: 'bd1bb2ac4bbab458',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
topic: '需要取消专注时同样通过右键菜单,点击取消专注',
|
|
116
|
-
id: 'bd1bb4b14d6697c3',
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
topic: '左侧菜单',
|
|
122
|
-
id: 'bd1b9d1816ede134',
|
|
123
|
-
direction: 0,
|
|
124
|
-
expanded: true,
|
|
125
|
-
children: [
|
|
126
|
-
{
|
|
127
|
-
topic: '选择节点分布方式',
|
|
128
|
-
id: 'bd1ba11e620c3c1a',
|
|
129
|
-
expanded: true,
|
|
130
|
-
children: [
|
|
131
|
-
{
|
|
132
|
-
topic: '左侧分布',
|
|
133
|
-
id: 'bd1c1cb51e6745d3',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
topic: '右侧分布',
|
|
137
|
-
id: 'bd1c1e12fd603ff6',
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
topic: '左右分布',
|
|
141
|
-
id: 'bd1c1f03def5c97b',
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
topic: '下方菜单',
|
|
149
|
-
id: 'bd1ba66996df4ba4',
|
|
150
|
-
direction: 1,
|
|
151
|
-
expanded: true,
|
|
152
|
-
children: [
|
|
153
|
-
{
|
|
154
|
-
topic: '全屏',
|
|
155
|
-
id: 'bd1ba81d9bc95a7e',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
topic: '定位到中点',
|
|
159
|
-
id: 'bd1babdd5c18a7a2',
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
topic: '画布缩小',
|
|
163
|
-
id: 'bd1bae68e0ab186e',
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
topic: '画布放大',
|
|
167
|
-
id: 'bd1bb06377439977',
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
topic: '节点连接',
|
|
173
|
-
id: 'bd1beff607711025',
|
|
174
|
-
direction: 0,
|
|
175
|
-
expanded: true,
|
|
176
|
-
children: [
|
|
177
|
-
{
|
|
178
|
-
topic: '点击右键菜单——连接',
|
|
179
|
-
id: 'bd1bf320da90046a',
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
topic: '然后直接点击连接目标',
|
|
183
|
-
id: 'bd1bf6f94ff2e642',
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
topic: '可以通过贝塞尔曲线控制点修改连线弧度',
|
|
187
|
-
id: 'bd1c0c4a487bd036',
|
|
188
|
-
},
|
|
189
|
-
],
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
topic: '节点样式修改',
|
|
193
|
-
id: 'bd1c217f9d0b20bd',
|
|
194
|
-
direction: 0,
|
|
195
|
-
expanded: true,
|
|
196
|
-
children: [
|
|
197
|
-
{
|
|
198
|
-
topic: '字体大小',
|
|
199
|
-
id: 'bd1c24420cd2c2f5',
|
|
200
|
-
style: {
|
|
201
|
-
fontSize: '32',
|
|
202
|
-
color: '#3298db',
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
topic: '字体颜色',
|
|
207
|
-
id: 'bd1c2a59b9a2739c',
|
|
208
|
-
style: {
|
|
209
|
-
color: '#c0392c',
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
topic: '背景颜色',
|
|
214
|
-
id: 'bd1c2de33f057eb4',
|
|
215
|
-
style: {
|
|
216
|
-
color: '#bdc3c7',
|
|
217
|
-
background: '#2c3e50',
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
topic: '添加标签',
|
|
222
|
-
id: 'bd1cff58364436d0',
|
|
223
|
-
tags: ['已完成'],
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
topic: '添加图标',
|
|
227
|
-
id: 'bd1d0317f7e8a61a',
|
|
228
|
-
icons: ['😂'],
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
topic: '文字加粗',
|
|
232
|
-
id: 'bd41fd4ca32322a4',
|
|
233
|
-
style: {
|
|
234
|
-
fontWeight: 'bold',
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
],
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
topic: '节点拖拽',
|
|
241
|
-
id: 'bd1f03fee1f63bc6',
|
|
242
|
-
direction: 1,
|
|
243
|
-
expanded: true,
|
|
244
|
-
children: [
|
|
245
|
-
{
|
|
246
|
-
topic: '将一个节点拖拽到另一个节点,会成为另一个节点的子节点',
|
|
247
|
-
id: 'bd1f07c598e729dc',
|
|
248
|
-
},
|
|
249
|
-
],
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
topic: '未来功能',
|
|
253
|
-
id: 'bd1facea32a1967c',
|
|
254
|
-
direction: 1,
|
|
255
|
-
expanded: true,
|
|
256
|
-
children: [
|
|
257
|
-
{
|
|
258
|
-
topic: '节点插入图片',
|
|
259
|
-
id: 'bd1fb1ec53010749',
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
topic: '自由节点',
|
|
263
|
-
id: 'bd42d3e3bee992b9',
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
topic: '样式优化',
|
|
267
|
-
id: 'beeb7f3db6ad6496',
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
topic: '导出数据',
|
|
273
|
-
id: 'beeb7586973430db',
|
|
274
|
-
direction: 1,
|
|
275
|
-
expanded: true,
|
|
276
|
-
children: [
|
|
277
|
-
{
|
|
278
|
-
topic: 'JSON',
|
|
279
|
-
id: 'beeb784cc189375f',
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
topic: 'HTML',
|
|
283
|
-
id: 'beeb7a6bec2d68f5',
|
|
284
|
-
},
|
|
285
|
-
],
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
topic: '注意',
|
|
289
|
-
id: 'bd42dad21aaf6bae',
|
|
290
|
-
direction: 0,
|
|
291
|
-
style: {
|
|
292
|
-
background: '#f1c40e',
|
|
293
|
-
},
|
|
294
|
-
expanded: true,
|
|
295
|
-
children: [
|
|
296
|
-
{
|
|
297
|
-
topic: '暂时只能手动保存',
|
|
298
|
-
id: 'bd42e1d0163ebf04',
|
|
299
|
-
expanded: true,
|
|
300
|
-
children: [
|
|
301
|
-
{
|
|
302
|
-
topic: '点击右上角保存',
|
|
303
|
-
id: 'bd42e619051878b3',
|
|
304
|
-
expanded: true,
|
|
305
|
-
children: [],
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
topic: 'ctrl + S 保存',
|
|
309
|
-
id: 'bd42e97d7ac35e99',
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
},
|
|
313
|
-
],
|
|
314
|
-
},
|
|
315
|
-
],
|
|
316
|
-
expanded: true,
|
|
317
|
-
},
|
|
318
|
-
linkData: {},
|
|
319
|
-
}
|
|
320
|
-
console.log('MindElixir.SIDE', MindElixir.SIDE)
|
|
321
|
-
let mind = new MindElixir({
|
|
322
|
-
el: '#map',
|
|
323
|
-
direction: MindElixir.SIDE,
|
|
324
|
-
data: {
|
|
325
|
-
nodeData: {
|
|
326
|
-
id: 'root',
|
|
327
|
-
topic: 'Mind Elixir',
|
|
328
|
-
root: true,
|
|
329
|
-
children:[]
|
|
330
|
-
},
|
|
331
|
-
linkData: {},
|
|
332
|
-
},
|
|
333
|
-
draggable: true,
|
|
334
|
-
contextMenu: true,
|
|
335
|
-
toolBar: true,
|
|
336
|
-
nodeMenu: true,
|
|
337
|
-
keypress: true,
|
|
338
|
-
})
|
|
339
|
-
mind.init()
|
|
340
|
-
console.log('test E function', E('bd4313fbac40284b'))
|
|
341
|
-
</script>
|
|
342
|
-
</html>
|