You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
21 KiB
Plaintext

11 months ago
(function(f){var B={event:{DRAG:"ztree_drag",DROP:"ztree_drop",REMOVE:"ztree_remove",RENAME:"ztree_rename"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},l={edit:{enable:false,editNameSelectAll:false,showRemoveBtn:true,showRenameBtn:true,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:false,isCopy:true,isMove:true,prev:true,next:true,inner:true,minMoveSize:5,borderMax:10,borderMin:-5,maxShowNodeNum:5,autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDrop:null,onRename:null}},w=function(C){var D=z.getRoot(C);D.curEditNode=null;D.curEditInput=null;D.curHoverNode=null;D.dragFlag=0;D.dragNodeShowBefore=[];D.dragMaskList=new Array();D.showHoverDom=true},c=function(C){},m=function(C){var D=C.treeObj;var E=p.event;D.bind(E.RENAME,function(F,H,G){u.apply(C.callback.onRename,[F,H,G])});D.bind(E.REMOVE,function(F,H,G){u.apply(C.callback.onRemove,[F,H,G])});D.bind(E.DRAG,function(G,F,I,H){u.apply(C.callback.onDrag,[F,I,H])});D.bind(E.DROP,function(I,H,K,J,L,G,F){u.apply(C.callback.onDrop,[H,K,J,L,G,F])})},y=function(C){var D=C.treeObj;var E=p.event;D.unbind(E.RENAME);D.unbind(E.REMOVE);D.unbind(E.DRAG);D.unbind(E.DROP)},n=function(J){var K=J.target,N=z.getSetting(J.data.treeId),L=J.relatedTarget,H="",D=null,E="",I="",C=null,G=null,F=null;if(u.eqs(J.type,"mouseover")){F=u.getMDom(N,K,[{tagName:"a",attrName:"treeNode"+p.id.A}]);if(F){H=F.parentNode.id;E="hoverOverNode"}}else{if(u.eqs(J.type,"mouseout")){F=u.getMDom(N,L,[{tagName:"a",attrName:"treeNode"+p.id.A}]);if(!F){H="remove";E="hoverOutNode"}}else{if(u.eqs(J.type,"mousedown")){F=u.getMDom(N,K,[{tagName:"a",attrName:"treeNode"+p.id.A}]);if(F){H=F.parentNode.id;E="mousedownNode"}}}}if(H.length>0){D=z.getNodeCache(N,H);switch(E){case"mousedownNode":C=k.onMousedownNode;break;case"hoverOverNode":C=k.onHoverOverNode;break;case"hoverOutNode":C=k.onHoverOutNode;break}}var M={stop:false,node:D,nodeEventType:E,nodeEventCallback:C,treeEventType:I,treeEventCallback:G};return M},v=function(E,I,H,C,G,D,F){if(!H){return}H.isHover=false;H.editNameFlag=false},j=function(D,C){C.cancelEditName=function(F){var E=z.getRoot(D),G=D.data.key.name,H=E.curEditNode;if(!E.curEditNode){return}i.cancelCurEditNode(D,F?F:H[G])};C.copyNode=function(I,H,G,J){if(!H){return null}if(I&&!I.isParent&&D.data.keep.leaf&&G===p.move.TYPE_INNER){return null}var E=u.clone(H);if(!I){I=null;G=p.move.TYPE_INNER}if(G==p.move.TYPE_INNER){function F(){i.addNodes(D,I,[E],J)}if(u.canAsync(D,I)){i.asyncNode(D,I,J,F)}else{F()}}else{i.addNodes(D,I.parentNode,[E],J);i.moveNode(D,I,E,G,false,J)}return E};C.editName=function(E){if(!E||!E.tId||E!==z.getNodeCache(D,E.tId)){return}if(E.parentTId){i.expandCollapseParentNode(D,E.getParentNode(),true)}i.editNode(D,E)};C.moveNode=function(G,F,E,I){if(!F){return F}if(G&&!G.isParent&&D.data.keep.leaf&&E===p.move.TYPE_INNER){return null}else{if(G&&((F.parentTId==G.tId&&E==p.move.TYPE_INNER)||f("#"+F.tId).find("#"+G.tId).length>0)){return null}else{if(!G){G=null}}}function H(){i.moveNode(D,G,F,E,false,I)}if(u.canAsync(D,G)&&E===p.move.TYPE_INNER){i.asyncNode(D,G,I,H)}else{H()}return F};C.setEditable=function(E){D.edit.enable=E;return this.refresh()}},o={setSonNodeLevel:function(F,C,H){if(!H){return}var G=F.data.key.children;H.level=(C)?C.level+1:0;if(!H[G]){return}for(var E=0,D=H[G].length;E<D;E++){if(H[G][E]){z.setSonNodeLevel(F,H,H[G][E])}}}},g={},k={onHoverOverNode:function(F,E){var D=z.getSetting(F.data.treeId),C=z.getRoot(D);if(C.curHoverNode!=E){k.onHoverOutNode(F)}C.curHoverNode=E;i.addHoverDom(D,E)},onHoverOutNode:function(F,E){var D=z.getSetting(F.data.treeId),C=z.getRoot(D);if(C.curHoverNode&&!z.isSelectedNode(D,C.curHoverNode)){i.removeTreeDom(D,C.curHoverNode);C.curHoverNode=null}},onMousedownNode:function(O,I){var W,T,N=z.getSetting(O.data.treeId),S=z.getRoot(N);if(O.bu