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

0 lines
47 KiB

2 years ago
  1. function bindTreeEvent(n,t){var i=t||$("#tree_menu");i.unbind("tree.click").on("tree.click",function(t){var r=t.node;if($(".jqtree-selected").length>0&&$(".jqtree-selected").removeClass("jqtree-selected"),i.tree("toggle",r),r.type==="c")typeof n=="function"&&n(r);else{try{closeNextnode(i,r)}catch(u){}closePrenode(i,r)}})}function closeNextnode(n,t){var i=t.getNextSibling();i&&(n.tree("closeNode",i),closeNextnode(n,i))}function closePrenode(n,t){var i=t.getPreviousSibling();i&&(n.tree("closeNode",i),closePrenode(n,i))}(function e(n,t,i){function r(u,e){var s,h,o;if(!t[u]){if(!n[u]){if(s=typeof require=="function"&&require,!e&&s)return s(u,!0);if(f)return f(u,!0);h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h;}o=t[u]={exports:{}};n[u][0].call(o.exports,function(t){var i=n[u][1][t];return r(i?i:t)},o,o.exports,e,n,t,i)}return t[u].exports}for(var f=typeof require=="function"&&require,u=0;u<i.length;u++)r(i[u]);return r})({1:[function(n,t){var r,u,f,i,e,o,s=function(n,t){function r(){this.constructor=n}for(var i in t)h.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n},h={}.hasOwnProperty;o=n("./node");i=o.Position;r=function(){function n(n){this.tree_widget=n;this.hovered_area=null;this.$ghost=null;this.hit_areas=[];this.is_dragging=!1;this.current_item=null}return n.prototype.mouseCapture=function(n){var i,t;return(i=$(n.target),!this.mustCaptureElement(i))?null:this.tree_widget.options.onIsMoveHandle&&!this.tree_widget.options.onIsMoveHandle(i)?null:(t=this.tree_widget._getNodeElement(i),t&&this.tree_widget.options.onCanMove&&(this.tree_widget.options.onCanMove(t.node)||(t=null)),this.current_item=t,this.current_item!==null)},n.prototype.mouseStart=function(n){var t;return this.refresh(),t=$(n.target).offset(),this.drag_element=new u(this.current_item.node,n.page_x-t.left,n.page_y-t.top,this.tree_widget.element),this.is_dragging=!0,this.current_item.$element.addClass("jqtree-moving"),!0},n.prototype.mouseDrag=function(n){var t,i;return this.drag_element.move(n.page_x,n.page_y),t=this.findHoveredArea(n.page_x,n.page_y),i=this.canMoveToArea(t),i&&t?(t.node.isFolder()||this.stopOpenFolderTimer(),this.hovered_area!==t&&(this.hovered_area=t,this.mustOpenFolderTimer(t)?this.startOpenFolderTimer(t.node):this.stopOpenFolderTimer(),this.updateDropHint())):(this.removeHover(),this.removeDropHint(),this.stopOpenFolderTimer()),!0},n.prototype.mustCaptureElement=function(n){return!n.is("input,select")},n.prototype.canMoveToArea=function(n){var t;if(n){if(this.tree_widget.options.onCanMoveTo){t=i.getName(n.position);return this.tree_widget.options.onCanMoveTo(this.current_item.node,n.node,t)}return!0}return!1},n.prototype.mouseStop=function(n){return this.moveItem(n),this.clear(),this.removeHover(),this.removeDropHint(),this.removeHitAreas(),this.current_item&&(this.current_item.$element.removeClass("jqtree-moving"),this.current_item=null),this.is_dragging=!1,!1},n.prototype.refresh=function(){return this.removeHitAreas(),this.current_item&&(this.generateHitAreas(),this.current_item=this.tree_widget._getNodeElementForNode(this.current_item.node),this.is_dragging)?this.current_item.$element.addClass("jqtree-moving"):void 0},n.prototype.removeHitAreas=function(){return this.hit_areas=[]},n.prototype.clear=function(){return this.drag_element.remove(),this.drag_element=null},n.prototype.removeDropHint=function(){if(this.previous_ghost)return this.previous_ghost.remove()},n.prototype.removeHover=function(){return this.hovered_area=null},n.prototype.generateHitAreas=function(){var n;return n=new f(this.tree_widget.tree,this.current_item.node,this.getTreeDimensions().bottom),this.hit_areas=n.generate()},n.prototype.findHoveredArea=function(n,t){var r,i,u,f,e;if(i=this.getTreeDimensions(),n<i.left||t<i.top||n>i.right||t>i.bottom)return null;for(f=0,u=this.hit_areas.length;f<u;)if(e=f+u>>1,r=this.hit_areas[e],t<r.top)u=e;else if(t>r.bottom)f=e+1;else return r;return null},n.prototype.mustOpenFolderTimer=function(n){var t;return t=n.node,t.isFolder()&&!t.is_open&&n.pos