🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

angular-ui-tree

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-ui-tree - npm Package Compare versions

Comparing version

to
2.20.0

.github/ISSUE_TEMPLATE.md

2

bower.json
{
"name": "angular-ui-tree",
"version": "2.19.0",
"version": "2.20.0",
"homepage": "https://github.com/angular-ui-tree/angular-ui-tree",

@@ -5,0 +5,0 @@ "authors": [

@@ -0,1 +1,7 @@

#2.20.0
* Performance Improvements by skipping dragDelay when no delay is specified
* Corrected error with ESC key not cancelling drag [#799](https://github.com/angular-ui-tree/angular-ui-tree/issues/799)
* Corrected error where dropping on a noDrop clone tree would add node to second tree [Example of Error](http://gfycat.com/EverlastingCanineCleanerwrasse)
#2.19.0

@@ -7,3 +13,3 @@

* Enable setting a numeric value for the expand-on-hover attribute.
* Enable setting a numeric value for the expand-on-hover attribute [#812](https://github.com/angular-ui-tree/angular-ui-tree/pull/812)

@@ -10,0 +16,0 @@ # 2.17.0

@@ -36,3 +36,4 @@ # Contributing Guidelines

9. Update the website by running `$ gulp website` (runs the ghpages plugin)
10. Announce the release on [Gitter](https://gitter.im/angular-ui-tree/angular-ui-tree)
Our intention is to keep working on this document. Happy coding!
/**
* @license Angular UI Tree v2.17.0
* @license Angular UI Tree v2.20.0
* (c) 2010-2016. https://github.com/angular-ui-tree/angular-ui-tree
* License: MIT
*/
!function(){"use strict";angular.module("ui.tree",[]).constant("treeConfig",{treeClass:"angular-ui-tree",emptyTreeClass:"angular-ui-tree-empty",hiddenClass:"angular-ui-tree-hidden",nodesClass:"angular-ui-tree-nodes",nodeClass:"angular-ui-tree-node",handleClass:"angular-ui-tree-handle",placeholderClass:"angular-ui-tree-placeholder",dragClass:"angular-ui-tree-drag",dragThreshold:3,levelThreshold:30,defaultCollapsed:!1})}(),function(){"use strict";angular.module("ui.tree").controller("TreeHandleController",["$scope","$element",function(e,n){this.scope=e,e.$element=n,e.$nodeScope=null,e.$type="uiTreeHandle"}])}(),function(){"use strict";angular.module("ui.tree").controller("TreeNodeController",["$scope","$element",function(e,n){function t(e){var n,o,l,r=0,a=e.childNodes();if(!a||0===a.length)return 0;for(l=a.length-1;l>=0;l--)n=a[l],o=1+t(n),r=Math.max(r,o);return r}this.scope=e,e.$element=n,e.$modelValue=null,e.$parentNodeScope=null,e.$childNodesScope=null,e.$parentNodesScope=null,e.$treeScope=null,e.$handleScope=null,e.$type="uiTreeNode",e.$$allowNodeDrop=!1,e.collapsed=!1,e.expandOnHover=!1,e.init=function(t){var o=t[0];e.$treeScope=t[1]?t[1].scope:null,e.$parentNodeScope=o.scope.$nodeScope,e.$modelValue=o.scope.$modelValue[e.$index],e.$parentNodesScope=o.scope,o.scope.initSubNode(e),n.on("$destroy",function(){o.scope.destroySubNode(e)})},e.index=function(){return e.$parentNodesScope.$modelValue.indexOf(e.$modelValue)},e.dragEnabled=function(){return!(e.$treeScope&&!e.$treeScope.dragEnabled)},e.isSibling=function(n){return e.$parentNodesScope==n.$parentNodesScope},e.isChild=function(n){var t=e.childNodes();return t&&t.indexOf(n)>-1},e.prev=function(){var n=e.index();return n>0?e.siblings()[n-1]:null},e.siblings=function(){return e.$parentNodesScope.childNodes()},e.childNodesCount=function(){return e.childNodes()?e.childNodes().length:0},e.hasChild=function(){return e.childNodesCount()>0},e.childNodes=function(){return e.$childNodesScope&&e.$childNodesScope.$modelValue?e.$childNodesScope.childNodes():null},e.accept=function(n,t){return e.$childNodesScope&&e.$childNodesScope.$modelValue&&e.$childNodesScope.accept(n,t)},e.remove=function(){return e.$parentNodesScope.removeNode(e)},e.toggle=function(){e.collapsed=!e.collapsed,e.$treeScope.$callbacks.toggle(e.collapsed,e)},e.collapse=function(){e.collapsed=!0},e.expand=function(){e.collapsed=!1},e.depth=function(){var n=e.$parentNodeScope;return n?n.depth()+1:1},e.maxSubDepth=function(){return e.$childNodesScope?t(e.$childNodesScope):0}}])}(),function(){"use strict";angular.module("ui.tree").controller("TreeNodesController",["$scope","$element",function(e,n){this.scope=e,e.$element=n,e.$modelValue=null,e.$nodeScope=null,e.$treeScope=null,e.$type="uiTreeNodes",e.$nodesMap={},e.nodropEnabled=!1,e.maxDepth=0,e.cloneEnabled=!1,e.initSubNode=function(n){return n.$modelValue?void(e.$nodesMap[n.$modelValue.$$hashKey]=n):null},e.destroySubNode=function(n){return n.$modelValue?void(e.$nodesMap[n.$modelValue.$$hashKey]=null):null},e.accept=function(n,t){return e.$treeScope.$callbacks.accept(n,e,t)},e.beforeDrag=function(n){return e.$treeScope.$callbacks.beforeDrag(n)},e.isParent=function(n){return n.$parentNodesScope==e},e.hasChild=function(){return e.$modelValue.length>0},e.safeApply=function(e){var n=this.$root.$$phase;"$apply"==n||"$digest"==n?e&&"function"==typeof e&&e():this.$apply(e)},e.removeNode=function(n){var t=e.$modelValue.indexOf(n.$modelValue);return t>-1?(e.safeApply(function(){e.$modelValue.splice(t,1)[0]}),e.$treeScope.$callbacks.removed(n)):null},e.insertNode=function(n,t){e.safeApply(function(){e.$modelValue.splice(n,0,t)})},e.childNodes=function(){var n,t=[];if(e.$modelValue)for(n=0;n<e.$modelValue.length;n++)t.push(e.$nodesMap[e.$modelValue[n].$$hashKey]);return t},e.depth=function(){return e.$nodeScope?e.$nodeScope.depth():0},e.outOfDepth=function(n){var t=e.maxDepth||e.$treeScope.maxDepth;return t>0?e.depth()+n.maxSubDepth()+1>t:!1}}])}(),function(){"use strict";angular.module("ui.tree").controller("TreeController",["$scope","$element",function(e,n){this.scope=e,e.$element=n,e.$nodesScope=null,e.$type="uiTree",e.$emptyElm=null,e.$callbacks=null,e.dragEnabled=!0,e.emptyPlaceholderEnabled=!0,e.maxDepth=0,e.dragDelay=0,e.cloneEnabled=!1,e.nodropEnabled=!1,e.isEmpty=function(){return e.$nodesScope&&e.$nodesScope.$modelValue&&0===e.$nodesScope.$modelValue.length},e.place=function(n){e.$nodesScope.$element.append(n),e.$emptyElm.remove()},this.resetEmptyElement=function(){e.$nodesScope.$modelValue&&0!==e.$nodesScope.$modelValue.length||!e.emptyPlaceholderEnabled?e.$emptyElm.remove():n.append(e.$emptyElm)},e.resetEmptyElement=this.resetEmptyElement}])}(),function(){"use strict";angular.module("ui.tree").directive("uiTree",["treeConfig","$window",function(e,n){return{restrict:"A",scope:!0,controller:"TreeController",link:function(t,o,l,r){var a,i,d,c={accept:null,beforeDrag:null},u={};angular.extend(u,e),u.treeClass&&o.addClass(u.treeClass),"table"===o.prop("tagName").toLowerCase()?(t.$emptyElm=angular.element(n.document.createElement("tr")),i=o.find("tr"),d=i.length>0?angular.element(i).children().length:1e6,a=angular.element(n.document.createElement("td")).attr("colspan",d),t.$emptyElm.append(a)):t.$emptyElm=angular.element(n.document.createElement("div")),u.emptyTreeClass&&t.$emptyElm.addClass(u.emptyTreeClass),t.$watch("$nodesScope.$modelValue.length",function(e){angular.isNumber(e)&&r.resetEmptyElement()},!0),t.$watch(l.dragEnabled,function(e){"boolean"==typeof e&&(t.dragEnabled=e)}),t.$watch(l.emptyPlaceholderEnabled,function(e){"boolean"==typeof e&&(t.emptyPlaceholderEnabled=e,r.resetEmptyElement())}),t.$watch(l.nodropEnabled,function(e){"boolean"==typeof e&&(t.nodropEnabled=e)}),t.$watch(l.cloneEnabled,function(e){"boolean"==typeof e&&(t.cloneEnabled=e)}),t.$watch(l.maxDepth,function(e){"number"==typeof e&&(t.maxDepth=e)}),t.$watch(l.dragDelay,function(e){"number"==typeof e&&(t.dragDelay=e)}),c.accept=function(e,n){return!(n.nodropEnabled||n.$treeScope.nodropEnabled||n.outOfDepth(e))},c.beforeDrag=function(){return!0},c.expandTimeoutStart=function(){},c.expandTimeoutCancel=function(){},c.expandTimeoutEnd=function(){},c.removed=function(){},c.dropped=function(){},c.dragStart=function(){},c.dragMove=function(){},c.dragStop=function(){},c.beforeDrop=function(){},c.toggle=function(){},t.$watch(l.uiTree,function(e){angular.forEach(e,function(e,n){c[n]&&"function"==typeof e&&(c[n]=e)}),t.$callbacks=c},!0)}}}])}(),function(){"use strict";angular.module("ui.tree").directive("uiTreeHandle",["treeConfig",function(e){return{require:"^uiTreeNode",restrict:"A",scope:!0,controller:"TreeHandleController",link:function(n,t,o,l){var r={};angular.extend(r,e),r.handleClass&&t.addClass(r.handleClass),n!=l.scope&&(n.$nodeScope=l.scope,l.scope.$handleScope=n)}}}])}(),function(){"use strict";angular.module("ui.tree").directive("uiTreeNode",["treeConfig","UiTreeHelper","$window","$document","$timeout","$q",function(e,n,t,o,l,r){return{require:["^uiTreeNodes","^uiTree"],restrict:"A",controller:"TreeNodeController",link:function(a,i,d,c){var u,s,p,f,m,h,$,g,b,v,N,y,S,x,E,T,C,w,D,X,A,H,Y,O,V={},k="ontouchstart"in window,I=null,M=document.body,P=document.documentElement;angular.extend(V,e),V.nodeClass&&i.addClass(V.nodeClass),a.init(c),a.collapsed=!!n.getNodeAttribute(a,"collapsed")||e.defaultCollapsed,a.expandOnHover=!!n.getNodeAttribute(a,"expandOnHover"),a.sourceOnly=a.nodropEnabled||a.$treeScope.nodropEnabled,a.$watch(d.collapsed,function(e){"boolean"==typeof e&&(a.collapsed=e)}),a.$watch("collapsed",function(e){n.setNodeAttribute(a,"collapsed",e),d.$set("collapsed",e)}),a.$watch(d.expandOnHover,function(e){("boolean"==typeof e||"number"==typeof e)&&(a.expandOnHover=e)}),a.$watch("expandOnHover",function(e){n.setNodeAttribute(a,"expandOnHover",e),d.$set("expandOnHover",e)}),a.$on("angular-ui-tree:collapse-all",function(){a.collapsed=!0}),a.$on("angular-ui-tree:expand-all",function(){a.collapsed=!1}),v=function(e){if((k||2!==e.button&&3!==e.which)&&!(e.uiTreeDragging||e.originalEvent&&e.originalEvent.uiTreeDragging)){var l,r,d,c,v,N,y,S,x,E=angular.element(e.target);if(l=n.treeNodeHandlerContainerOfElement(E),l&&(E=angular.element(l)),r=i.clone(),S=n.elementIsTreeNode(E),x=n.elementIsTreeNodeHandle(E),(S||x)&&!(S&&n.elementContainsTreeNodeHandler(E)||(d=E.prop("tagName").toLowerCase(),"input"==d||"textarea"==d||"button"==d||"select"==d))){for(O=angular.element(e.target);O&&O[0]&&O[0]!==i;){if(n.nodrag(O))return;O=O.parent()}a.beforeDrag(a)&&(e.uiTreeDragging=!0,e.originalEvent&&(e.originalEvent.uiTreeDragging=!0),e.preventDefault(),v=n.eventObj(e),u=!0,s=n.dragInfo(a),c=i.prop("tagName"),"tr"===c.toLowerCase()?(f=angular.element(t.document.createElement(c)),N=angular.element(t.document.createElement("td")).addClass(V.placeholderClass).attr("colspan",i[0].children.length),f.append(N)):f=angular.element(t.document.createElement(c)).addClass(V.placeholderClass),m=angular.element(t.document.createElement(c)),V.hiddenClass&&m.addClass(V.hiddenClass),p=n.positionStarted(v,i),f.css("height",n.height(i)+"px"),h=angular.element(t.document.createElement(a.$parentNodesScope.$element.prop("tagName"))).addClass(a.$parentNodesScope.$element.attr("class")).addClass(V.dragClass),h.css("width",n.width(i)+"px"),h.css("z-index",9999),y=(i[0].querySelector(".angular-ui-tree-handle")||i[0]).currentStyle,y&&(document.body.setAttribute("ui-tree-cursor",o.find("body").css("cursor")||""),o.find("body").css({cursor:y.cursor+"!important"})),a.sourceOnly&&f.css("display","none"),i.after(f),i.after(m),h.append(s.isClone()&&a.sourceOnly?r:i),o.find("body").append(h),h.css({left:v.pageX-p.offsetX+"px",top:v.pageY-p.offsetY+"px"}),$={placeholder:f,dragging:h},D(),a.$apply(function(){a.$treeScope.$callbacks.dragStart(s.eventArgs($,p))}),g=Math.max(M.scrollHeight,M.offsetHeight,P.clientHeight,P.scrollHeight,P.offsetHeight),b=Math.max(M.scrollWidth,M.offsetWidth,P.clientWidth,P.scrollWidth,P.offsetWidth))}}},N=function(e){var o,r,i,d,c,m,v,N,y,S,x,E,T,C,w,D,X,A=n.eventObj(e);if(h){if(e.preventDefault(),t.getSelection?t.getSelection().removeAllRanges():t.document.selection&&t.document.selection.empty(),i=A.pageX-p.offsetX,d=A.pageY-p.offsetY,0>i&&(i=0),0>d&&(d=0),d+10>g&&(d=g-10),i+10>b&&(i=b-10),h.css({left:i+"px",top:d+"px"}),c=window.pageYOffset||t.document.documentElement.scrollTop,m=c+(window.innerHeight||t.document.clientHeight||t.document.clientHeight),m<A.pageY&&g>m&&(w=Math.min(g-m,10),window.scrollBy(0,w)),c>A.pageY&&window.scrollBy(0,-10),n.positionMoved(e,p,u),u)return void(u=!1);if(N=n.offset(h).left-n.offset(f).left>=V.threshold,y=A.pageX-(t.pageXOffset||t.document.body.scrollLeft||t.document.documentElement.scrollLeft)-(t.document.documentElement.clientLeft||0),S=A.pageY-(t.pageYOffset||t.document.body.scrollTop||t.document.documentElement.scrollTop)-(t.document.documentElement.clientTop||0),angular.isFunction(h.hide)?h.hide():(x=h[0].style.display,h[0].style.display="none"),t.document.elementFromPoint(y,S),T=angular.element(t.document.elementFromPoint(y,S)),Y=n.treeNodeHandlerContainerOfElement(T),Y&&(T=angular.element(Y)),angular.isFunction(h.show)?h.show():h[0].style.display=x,H=!(n.elementIsTreeNodeHandle(T)||n.elementIsTreeNode(T)||n.elementIsTreeNodes(T)||n.elementIsTree(T)||n.elementIsPlaceholder(T)),H&&(f.remove(),I&&(I.resetEmptyElement(),I=null)),p.dirAx&&p.distAxX>=V.levelThreshold&&(p.distAxX=0,p.distX>0&&(o=s.prev(),o&&!o.collapsed&&o.accept(a,o.childNodesCount())&&(o.$childNodesScope.$element.append(f),s.moveTo(o.$childNodesScope,o.childNodes(),o.childNodesCount()))),p.distX<0&&(r=s.next(),r||(v=s.parentNode(),v&&v.$parentNodesScope.accept(a,v.index()+1)&&(v.$element.after(f),s.moveTo(v.$parentNodesScope,v.siblings(),v.index()+1))))),!p.dirAx){if(n.elementIsTree(T)?E=T.controller("uiTree").scope:n.elementIsTreeNodeHandle(T)?E=T.controller("uiTreeHandle").scope:n.elementIsTreeNode(T)?E=T.controller("uiTreeNode").scope:n.elementIsTreeNodes(T)?E=T.controller("uiTreeNodes").scope:n.elementIsPlaceholder(T)?E=T.controller("uiTreeNodes").scope:T.controller("uiTreeNode")&&(E=T.controller("uiTreeNode").scope),C=!1,!E)return;if(!E.$treeScope||E.$parent.nodropEnabled||E.$treeScope.nodropEnabled||f.css("display",""),"uiTree"==E.$type&&E.dragEnabled&&(C=E.isEmpty()),"uiTreeHandle"==E.$type&&(E=E.$nodeScope),"uiTreeNode"!=E.$type&&!C)return;I&&f.parent()[0]!=I.$element[0]&&(I.resetEmptyElement(),I=null),C?(I=E,E.$nodesScope.accept(a,0)&&(E.place(f),s.moveTo(E.$nodesScope,E.$nodesScope.childNodes(),0))):E.dragEnabled()&&(angular.isDefined(a.expandTimeoutOn)&&a.expandTimeoutOn!==E.id&&(l.cancel(a.expandTimeout),delete a.expandTimeout,delete a.expandTimeoutOn,a.$callbacks.expandTimeoutCancel()),E.collapsed&&(a.expandOnHover===!0||angular.isNumber(a.expandOnHover)&&0===a.expandOnHover?E.collapsed=!1:a.expandOnHover!==!1&&angular.isNumber(a.expandOnHover)&&a.expandOnHover>0&&angular.isUndefined(a.expandTimeoutOn)&&(a.expandTimeoutOn=E.$id,a.$callbacks.expandTimeoutStart(),a.expandTimeout=l(function(){a.$callbacks.expandTimeoutEnd(),E.collapsed=!1},a.expandOnHover))),T=E.$element,D=n.offset(T),X=E.horizontal?A.pageX<D.left+n.width(T)/2:A.pageY<D.top+n.height(T)/2,E.$parentNodesScope.accept(a,E.index())?X?(T[0].parentNode.insertBefore(f[0],T[0]),s.moveTo(E.$parentNodesScope,E.siblings(),E.index())):(T.after(f),s.moveTo(E.$parentNodesScope,E.siblings(),E.index()+1)):!X&&E.accept(a,E.childNodesCount())?(E.$childNodesScope.$element.append(f),s.moveTo(E.$childNodesScope,E.childNodes(),E.childNodesCount())):H=!0)}a.$apply(function(){a.$treeScope.$callbacks.dragMove(s.eventArgs($,p))})}},y=function(e){var n=s.eventArgs($,p);e.preventDefault(),X(),l.cancel(a.expandTimeout),a.$treeScope.$apply(function(){r.when(a.$treeScope.$callbacks.beforeDrop(n)).then(function(e){e!==!1&&a.$$allowNodeDrop&&!H?(s.apply(),a.$treeScope.$callbacks.dropped(n)):w()})["catch"](function(){w()})["finally"](function(){m.replaceWith(a.$element),f.remove(),h&&(h.remove(),h=null),a.$treeScope.$callbacks.dragStop(n),a.$$allowNodeDrop=!1,s=null;var e=document.body.getAttribute("ui-tree-cursor");null!==e&&(o.find("body").css({cursor:e}),document.body.removeAttribute("ui-tree-cursor"))})})},S=function(e){a.dragEnabled()&&v(e)},x=function(e){N(e)},E=function(e){a.$$allowNodeDrop=!0,y(e)},T=function(e){y(e)},C=function(){var e;return{exec:function(n,t){t||(t=0),this.cancel(),e=l(n,t)},cancel:function(){l.cancel(e)}}}(),w=function(){i.bind("touchstart mousedown",function(e){C.exec(function(){S(e)},a.dragDelay||0)}),i.bind("touchend touchcancel mouseup",function(){C.cancel()})},w(),D=function(){angular.element(o).bind("touchend",E),angular.element(o).bind("touchcancel",E),angular.element(o).bind("touchmove",x),angular.element(o).bind("mouseup",E),angular.element(o).bind("mousemove",x),angular.element(o).bind("mouseleave",T)},X=function(){angular.element(o).unbind("touchend",E),angular.element(o).unbind("touchcancel",E),angular.element(o).unbind("touchmove",x),angular.element(o).unbind("mouseup",E),angular.element(o).unbind("mousemove",x),angular.element(o).unbind("mouseleave",T)},A=function(e){27==e.keyCode&&(a.$$allowNodeDrop=!1,y(e))},angular.element(t.document).bind("keydown",A),a.$on("$destroy",function(){angular.element(t.document).unbind("keydown",A)})}}}])}(),function(){"use strict";angular.module("ui.tree").directive("uiTreeNodes",["treeConfig","$window",function(e){return{require:["ngModel","?^uiTreeNode","^uiTree"],restrict:"A",scope:!0,controller:"TreeNodesController",link:function(n,t,o,l){var r={},a=l[0],i=l[1],d=l[2];angular.extend(r,e),r.nodesClass&&t.addClass(r.nodesClass),i?(i.scope.$childNodesScope=n,n.$nodeScope=i.scope):d.scope.$nodesScope=n,n.$treeScope=d.scope,a&&(a.$render=function(){n.$modelValue=a.$modelValue}),n.$watch(function(){return o.maxDepth},function(e){"number"==typeof e&&(n.maxDepth=e)}),n.$watch(function(){return o.nodropEnabled},function(e){"undefined"!=typeof e&&(n.nodropEnabled=!0)},!0),o.$observe("horizontal",function(e){n.horizontal="undefined"!=typeof e})}}}])}(),function(){"use strict";function e(e,n){if(void 0===n)return null;for(var t=n.parentNode,o=1,l="function"==typeof t.setAttribute&&t.hasAttribute(e)?t:null;t&&"function"==typeof t.setAttribute&&!t.hasAttribute(e);){if(t=t.parentNode,l=t,t===document.documentElement){l=null;break}o++}return l}angular.module("ui.tree").factory("UiTreeHelper",["$document","$window","treeConfig",function(n,t,o){return{nodesData:{},setNodeAttribute:function(e,n,t){if(!e.$modelValue)return null;var o=this.nodesData[e.$modelValue.$$hashKey];o||(o={},this.nodesData[e.$modelValue.$$hashKey]=o),o[n]=t},getNodeAttribute:function(e,n){if(!e.$modelValue)return null;var t=this.nodesData[e.$modelValue.$$hashKey];return t?t[n]:null},nodrag:function(e){return"undefined"!=typeof e.attr("data-nodrag")?"false"!==e.attr("data-nodrag"):!1},eventObj:function(e){var n=e;return void 0!==e.targetTouches?n=e.targetTouches.item(0):void 0!==e.originalEvent&&void 0!==e.originalEvent.targetTouches&&(n=e.originalEvent.targetTouches.item(0)),n},dragInfo:function(e){return{source:e,sourceInfo:{cloneModel:e.$treeScope.cloneEnabled===!0?angular.copy(e.$modelValue):void 0,nodeScope:e,index:e.index(),nodesScope:e.$parentNodesScope},index:e.index(),siblings:e.siblings().slice(0),parent:e.$parentNodesScope,moveTo:function(e,n,t){this.parent=e,this.siblings=n.slice(0);var o=this.siblings.indexOf(this.source);o>-1&&(this.siblings.splice(o,1),this.source.index()<t&&t--),this.siblings.splice(t,0,this.source),this.index=t},parentNode:function(){return this.parent.$nodeScope},prev:function(){return this.index>0?this.siblings[this.index-1]:null},next:function(){return this.index<this.siblings.length-1?this.siblings[this.index+1]:null},isClone:function(){return this.source.$treeScope.cloneEnabled===!0},clonedNode:function(e){return angular.copy(e)},isDirty:function(){return this.source.$parentNodesScope!=this.parent||this.source.index()!=this.index},isForeign:function(){return this.source.$treeScope!==this.parent.$treeScope},eventArgs:function(e,n){return{source:this.sourceInfo,dest:{index:this.index,nodesScope:this.parent},elements:e,pos:n}},apply:function(){var e=this.source.$modelValue;this.parent.nodropEnabled||this.parent.$treeScope.nodropEnabled||this.isDirty()&&(this.isClone()&&this.isForeign()?this.parent.insertNode(this.index,this.sourceInfo.cloneModel):(this.source.remove(),this.parent.insertNode(this.index,e)))}}},height:function(e){return e.prop("scrollHeight")},width:function(e){return e.prop("scrollWidth")},offset:function(e){var o=e[0].getBoundingClientRect();return{width:e.prop("offsetWidth"),height:e.prop("offsetHeight"),top:o.top+(t.pageYOffset||n[0].body.scrollTop||n[0].documentElement.scrollTop),left:o.left+(t.pageXOffset||n[0].body.scrollLeft||n[0].documentElement.scrollLeft)}},positionStarted:function(e,n){var t={},o=e.pageX,l=e.pageY;return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(o=e.originalEvent.touches[0].pageX,l=e.originalEvent.touches[0].pageY),t.offsetX=o-this.offset(n).left,t.offsetY=l-this.offset(n).top,t.startX=t.lastX=o,t.startY=t.lastY=l,t.nowX=t.nowY=t.distX=t.distY=t.dirAx=0,t.dirX=t.dirY=t.lastDirX=t.lastDirY=t.distAxX=t.distAxY=0,t},positionMoved:function(e,n,t){var o,l=e.pageX,r=e.pageY;return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(l=e.originalEvent.touches[0].pageX,r=e.originalEvent.touches[0].pageY),n.lastX=n.nowX,n.lastY=n.nowY,n.nowX=l,n.nowY=r,n.distX=n.nowX-n.lastX,n.distY=n.nowY-n.lastY,n.lastDirX=n.dirX,n.lastDirY=n.dirY,n.dirX=0===n.distX?0:n.distX>0?1:-1,n.dirY=0===n.distY?0:n.distY>0?1:-1,o=Math.abs(n.distX)>Math.abs(n.distY)?1:0,t?(n.dirAx=o,void(n.moving=!0)):(n.dirAx!==o?(n.distAxX=0,n.distAxY=0):(n.distAxX+=Math.abs(n.distX),0!==n.dirX&&n.dirX!==n.lastDirX&&(n.distAxX=0),n.distAxY+=Math.abs(n.distY),0!==n.dirY&&n.dirY!==n.lastDirY&&(n.distAxY=0)),void(n.dirAx=o))},elementIsTreeNode:function(e){return"undefined"!=typeof e.attr("ui-tree-node")},elementIsTreeNodeHandle:function(e){return"undefined"!=typeof e.attr("ui-tree-handle")},elementIsTree:function(e){return"undefined"!=typeof e.attr("ui-tree")},elementIsTreeNodes:function(e){return"undefined"!=typeof e.attr("ui-tree-nodes")},elementIsPlaceholder:function(e){return e.hasClass(o.placeholderClass)},elementContainsTreeNodeHandler:function(e){return e[0].querySelectorAll("[ui-tree-handle]").length>=1},treeNodeHandlerContainerOfElement:function(n){return e("ui-tree-handle",n[0])}}}])}();
!function(){"use strict";angular.module("ui.tree",[]).constant("treeConfig",{treeClass:"angular-ui-tree",emptyTreeClass:"angular-ui-tree-empty",hiddenClass:"angular-ui-tree-hidden",nodesClass:"angular-ui-tree-nodes",nodeClass:"angular-ui-tree-node",handleClass:"angular-ui-tree-handle",placeholderClass:"angular-ui-tree-placeholder",dragClass:"angular-ui-tree-drag",dragThreshold:3,levelThreshold:30,defaultCollapsed:!1})}(),function(){"use strict";angular.module("ui.tree").controller("TreeHandleController",["$scope","$element",function(e,n){this.scope=e,e.$element=n,e.$nodeScope=null,e.$type="uiTreeHandle"}])}(),function(){"use strict";angular.module("ui.tree").controller("TreeNodeController",["$scope","$element",function(e,n){function t(e){var n,o,l,r=0,a=e.childNodes();if(!a||0===a.length)return 0;for(l=a.length-1;l>=0;l--)n=a[l],o=1+t(n),r=Math.max(r,o);return r}this.scope=e,e.$element=n,e.$modelValue=null,e.$parentNodeScope=null,e.$childNodesScope=null,e.$parentNodesScope=null,e.$treeScope=null,e.$handleScope=null,e.$type="uiTreeNode",e.$$allowNodeDrop=!1,e.collapsed=!1,e.expandOnHover=!1,e.init=function(t){var o=t[0];e.$treeScope=t[1]?t[1].scope:null,e.$parentNodeScope=o.scope.$nodeScope,e.$modelValue=o.scope.$modelValue[e.$index],e.$parentNodesScope=o.scope,o.scope.initSubNode(e),n.on("$destroy",function(){o.scope.destroySubNode(e)})},e.index=function(){return e.$parentNodesScope.$modelValue.indexOf(e.$modelValue)},e.dragEnabled=function(){return!(e.$treeScope&&!e.$treeScope.dragEnabled)},e.isSibling=function(n){return e.$parentNodesScope==n.$parentNodesScope},e.isChild=function(n){var t=e.childNodes();return t&&t.indexOf(n)>-1},e.prev=function(){var n=e.index();return n>0?e.siblings()[n-1]:null},e.siblings=function(){return e.$parentNodesScope.childNodes()},e.childNodesCount=function(){return e.childNodes()?e.childNodes().length:0},e.hasChild=function(){return e.childNodesCount()>0},e.childNodes=function(){return e.$childNodesScope&&e.$childNodesScope.$modelValue?e.$childNodesScope.childNodes():null},e.accept=function(n,t){return e.$childNodesScope&&e.$childNodesScope.$modelValue&&e.$childNodesScope.accept(n,t)},e.remove=function(){return e.$parentNodesScope.removeNode(e)},e.toggle=function(){e.collapsed=!e.collapsed,e.$treeScope.$callbacks.toggle(e.collapsed,e)},e.collapse=function(){e.collapsed=!0},e.expand=function(){e.collapsed=!1},e.depth=function(){var n=e.$parentNodeScope;return n?n.depth()+1:1},e.maxSubDepth=function(){return e.$childNodesScope?t(e.$childNodesScope):0}}])}(),function(){"use strict";angular.module("ui.tree").controller("TreeNodesController",["$scope","$element",function(e,n){this.scope=e,e.$element=n,e.$modelValue=null,e.$nodeScope=null,e.$treeScope=null,e.$type="uiTreeNodes",e.$nodesMap={},e.nodropEnabled=!1,e.maxDepth=0,e.cloneEnabled=!1,e.initSubNode=function(n){return n.$modelValue?void(e.$nodesMap[n.$modelValue.$$hashKey]=n):null},e.destroySubNode=function(n){return n.$modelValue?void(e.$nodesMap[n.$modelValue.$$hashKey]=null):null},e.accept=function(n,t){return e.$treeScope.$callbacks.accept(n,e,t)},e.beforeDrag=function(n){return e.$treeScope.$callbacks.beforeDrag(n)},e.isParent=function(n){return n.$parentNodesScope==e},e.hasChild=function(){return e.$modelValue.length>0},e.safeApply=function(e){var n=this.$root.$$phase;"$apply"==n||"$digest"==n?e&&"function"==typeof e&&e():this.$apply(e)},e.removeNode=function(n){var t=e.$modelValue.indexOf(n.$modelValue);return t>-1?(e.safeApply(function(){e.$modelValue.splice(t,1)[0]}),e.$treeScope.$callbacks.removed(n)):null},e.insertNode=function(n,t){e.safeApply(function(){e.$modelValue.splice(n,0,t)})},e.childNodes=function(){var n,t=[];if(e.$modelValue)for(n=0;n<e.$modelValue.length;n++)t.push(e.$nodesMap[e.$modelValue[n].$$hashKey]);return t},e.depth=function(){return e.$nodeScope?e.$nodeScope.depth():0},e.outOfDepth=function(n){var t=e.maxDepth||e.$treeScope.maxDepth;return t>0?e.depth()+n.maxSubDepth()+1>t:!1}}])}(),function(){"use strict";angular.module("ui.tree").controller("TreeController",["$scope","$element",function(e,n){this.scope=e,e.$element=n,e.$nodesScope=null,e.$type="uiTree",e.$emptyElm=null,e.$callbacks=null,e.dragEnabled=!0,e.emptyPlaceholderEnabled=!0,e.maxDepth=0,e.dragDelay=0,e.cloneEnabled=!1,e.nodropEnabled=!1,e.isEmpty=function(){return e.$nodesScope&&e.$nodesScope.$modelValue&&0===e.$nodesScope.$modelValue.length},e.place=function(n){e.$nodesScope.$element.append(n),e.$emptyElm.remove()},this.resetEmptyElement=function(){e.$nodesScope.$modelValue&&0!==e.$nodesScope.$modelValue.length||!e.emptyPlaceholderEnabled?e.$emptyElm.remove():n.append(e.$emptyElm)},e.resetEmptyElement=this.resetEmptyElement}])}(),function(){"use strict";angular.module("ui.tree").directive("uiTree",["treeConfig","$window",function(e,n){return{restrict:"A",scope:!0,controller:"TreeController",link:function(t,o,l,r){var a,i,d,c={accept:null,beforeDrag:null},u={};angular.extend(u,e),u.treeClass&&o.addClass(u.treeClass),"table"===o.prop("tagName").toLowerCase()?(t.$emptyElm=angular.element(n.document.createElement("tr")),i=o.find("tr"),d=i.length>0?angular.element(i).children().length:1e6,a=angular.element(n.document.createElement("td")).attr("colspan",d),t.$emptyElm.append(a)):t.$emptyElm=angular.element(n.document.createElement("div")),u.emptyTreeClass&&t.$emptyElm.addClass(u.emptyTreeClass),t.$watch("$nodesScope.$modelValue.length",function(e){angular.isNumber(e)&&r.resetEmptyElement()},!0),t.$watch(l.dragEnabled,function(e){"boolean"==typeof e&&(t.dragEnabled=e)}),t.$watch(l.emptyPlaceholderEnabled,function(e){"boolean"==typeof e&&(t.emptyPlaceholderEnabled=e,r.resetEmptyElement())}),t.$watch(l.nodropEnabled,function(e){"boolean"==typeof e&&(t.nodropEnabled=e)}),t.$watch(l.cloneEnabled,function(e){"boolean"==typeof e&&(t.cloneEnabled=e)}),t.$watch(l.maxDepth,function(e){"number"==typeof e&&(t.maxDepth=e)}),t.$watch(l.dragDelay,function(e){"number"==typeof e&&(t.dragDelay=e)}),c.accept=function(e,n){return!(n.nodropEnabled||n.$treeScope.nodropEnabled||n.outOfDepth(e))},c.beforeDrag=function(){return!0},c.expandTimeoutStart=function(){},c.expandTimeoutCancel=function(){},c.expandTimeoutEnd=function(){},c.removed=function(){},c.dropped=function(){},c.dragStart=function(){},c.dragMove=function(){},c.dragStop=function(){},c.beforeDrop=function(){},c.toggle=function(){},t.$watch(l.uiTree,function(e){angular.forEach(e,function(e,n){c[n]&&"function"==typeof e&&(c[n]=e)}),t.$callbacks=c},!0)}}}])}(),function(){"use strict";angular.module("ui.tree").directive("uiTreeHandle",["treeConfig",function(e){return{require:"^uiTreeNode",restrict:"A",scope:!0,controller:"TreeHandleController",link:function(n,t,o,l){var r={};angular.extend(r,e),r.handleClass&&t.addClass(r.handleClass),n!=l.scope&&(n.$nodeScope=l.scope,l.scope.$handleScope=n)}}}])}(),function(){"use strict";angular.module("ui.tree").directive("uiTreeNode",["treeConfig","UiTreeHelper","$window","$document","$timeout","$q",function(e,n,t,o,l,r){return{require:["^uiTreeNodes","^uiTree"],restrict:"A",controller:"TreeNodeController",link:function(a,i,d,c){var u,s,p,f,m,h,g,$,b,v,N,y,S,x,E,T,C,w,D,X,A,H,Y,O,V,k={},I="ontouchstart"in window,M=null,P=document.body,L=document.documentElement;angular.extend(k,e),k.nodeClass&&i.addClass(k.nodeClass),a.init(c),a.collapsed=!!n.getNodeAttribute(a,"collapsed")||e.defaultCollapsed,a.expandOnHover=!!n.getNodeAttribute(a,"expandOnHover"),a.sourceOnly=a.nodropEnabled||a.$treeScope.nodropEnabled,a.$watch(d.collapsed,function(e){"boolean"==typeof e&&(a.collapsed=e)}),a.$watch("collapsed",function(e){n.setNodeAttribute(a,"collapsed",e),d.$set("collapsed",e)}),a.$watch(d.expandOnHover,function(e){("boolean"==typeof e||"number"==typeof e)&&(a.expandOnHover=e)}),a.$watch("expandOnHover",function(e){n.setNodeAttribute(a,"expandOnHover",e),d.$set("expandOnHover",e)}),a.$on("angular-ui-tree:collapse-all",function(){a.collapsed=!0}),a.$on("angular-ui-tree:expand-all",function(){a.collapsed=!1}),v=function(e){if((I||2!==e.button&&3!==e.which)&&!(e.uiTreeDragging||e.originalEvent&&e.originalEvent.uiTreeDragging)){var l,r,d,c,v,N,y,S,x,E=angular.element(e.target);if(l=n.treeNodeHandlerContainerOfElement(E),l&&(E=angular.element(l)),r=i.clone(),S=n.elementIsTreeNode(E),x=n.elementIsTreeNodeHandle(E),(S||x)&&!(S&&n.elementContainsTreeNodeHandler(E)||(d=E.prop("tagName").toLowerCase(),"input"==d||"textarea"==d||"button"==d||"select"==d))){for(O=angular.element(e.target);O&&O[0]&&O[0]!==i&&!V;){if(O[0].attributes&&(V=O[0].attributes["ui-tree"]),n.nodrag(O))return;O=O.parent()}a.beforeDrag(a)&&(e.uiTreeDragging=!0,e.originalEvent&&(e.originalEvent.uiTreeDragging=!0),e.preventDefault(),v=n.eventObj(e),u=!0,s=n.dragInfo(a),c=i.prop("tagName"),"tr"===c.toLowerCase()?(f=angular.element(t.document.createElement(c)),N=angular.element(t.document.createElement("td")).addClass(k.placeholderClass).attr("colspan",i[0].children.length),f.append(N)):f=angular.element(t.document.createElement(c)).addClass(k.placeholderClass),m=angular.element(t.document.createElement(c)),k.hiddenClass&&m.addClass(k.hiddenClass),p=n.positionStarted(v,i),f.css("height",n.height(i)+"px"),h=angular.element(t.document.createElement(a.$parentNodesScope.$element.prop("tagName"))).addClass(a.$parentNodesScope.$element.attr("class")).addClass(k.dragClass),h.css("width",n.width(i)+"px"),h.css("z-index",9999),y=(i[0].querySelector(".angular-ui-tree-handle")||i[0]).currentStyle,y&&(document.body.setAttribute("ui-tree-cursor",o.find("body").css("cursor")||""),o.find("body").css({cursor:y.cursor+"!important"})),a.sourceOnly&&f.css("display","none"),i.after(f),i.after(m),h.append(s.isClone()&&a.sourceOnly?r:i),o.find("body").append(h),h.css({left:v.pageX-p.offsetX+"px",top:v.pageY-p.offsetY+"px"}),g={placeholder:f,dragging:h},D(),a.$apply(function(){a.$treeScope.$callbacks.dragStart(s.eventArgs(g,p))}),$=Math.max(P.scrollHeight,P.offsetHeight,L.clientHeight,L.scrollHeight,L.offsetHeight),b=Math.max(P.scrollWidth,P.offsetWidth,L.clientWidth,L.scrollWidth,L.offsetWidth))}}},N=function(e){var o,r,i,d,c,m,v,N,y,S,x,E,T,C,w,D,X,A=n.eventObj(e);if(h){if(e.preventDefault(),t.getSelection?t.getSelection().removeAllRanges():t.document.selection&&t.document.selection.empty(),i=A.pageX-p.offsetX,d=A.pageY-p.offsetY,0>i&&(i=0),0>d&&(d=0),d+10>$&&(d=$-10),i+10>b&&(i=b-10),h.css({left:i+"px",top:d+"px"}),c=window.pageYOffset||t.document.documentElement.scrollTop,m=c+(window.innerHeight||t.document.clientHeight||t.document.clientHeight),m<A.pageY&&$>m&&(w=Math.min($-m,10),window.scrollBy(0,w)),c>A.pageY&&window.scrollBy(0,-10),n.positionMoved(e,p,u),u)return void(u=!1);if(N=n.offset(h).left-n.offset(f).left>=k.threshold,y=A.pageX-(t.pageXOffset||t.document.body.scrollLeft||t.document.documentElement.scrollLeft)-(t.document.documentElement.clientLeft||0),S=A.pageY-(t.pageYOffset||t.document.body.scrollTop||t.document.documentElement.scrollTop)-(t.document.documentElement.clientTop||0),angular.isFunction(h.hide)?h.hide():(x=h[0].style.display,h[0].style.display="none"),t.document.elementFromPoint(y,S),T=angular.element(t.document.elementFromPoint(y,S)),Y=n.treeNodeHandlerContainerOfElement(T),Y&&(T=angular.element(Y)),angular.isFunction(h.show)?h.show():h[0].style.display=x,H=!(n.elementIsTreeNodeHandle(T)||n.elementIsTreeNode(T)||n.elementIsTreeNodes(T)||n.elementIsTree(T)||n.elementIsPlaceholder(T)),H&&(f.remove(),M&&(M.resetEmptyElement(),M=null),s.resetParent()),p.dirAx&&p.distAxX>=k.levelThreshold&&(p.distAxX=0,p.distX>0&&(o=s.prev(),o&&!o.collapsed&&o.accept(a,o.childNodesCount())&&(o.$childNodesScope.$element.append(f),s.moveTo(o.$childNodesScope,o.childNodes(),o.childNodesCount()))),p.distX<0&&(r=s.next(),r||(v=s.parentNode(),v&&v.$parentNodesScope.accept(a,v.index()+1)&&(v.$element.after(f),s.moveTo(v.$parentNodesScope,v.siblings(),v.index()+1))))),!p.dirAx){if(n.elementIsTree(T)?E=T.controller("uiTree").scope:n.elementIsTreeNodeHandle(T)?E=T.controller("uiTreeHandle").scope:n.elementIsTreeNode(T)?E=T.controller("uiTreeNode").scope:n.elementIsTreeNodes(T)?E=T.controller("uiTreeNodes").scope:n.elementIsPlaceholder(T)?E=T.controller("uiTreeNodes").scope:T.controller("uiTreeNode")&&(E=T.controller("uiTreeNode").scope),C=!1,!E)return;if(!E.$treeScope||E.$parent.nodropEnabled||E.$treeScope.nodropEnabled||f.css("display",""),"uiTree"===E.$type&&E.dragEnabled&&(C=E.isEmpty()),"uiTreeHandle"===E.$type&&(E=E.$nodeScope),"uiTreeNode"!==E.$type&&!C)return;M&&f.parent()[0]!=M.$element[0]&&(M.resetEmptyElement(),M=null),C?(M=E,E.$nodesScope.accept(a,0)&&(E.place(f),s.moveTo(E.$nodesScope,E.$nodesScope.childNodes(),0))):E.dragEnabled()&&(angular.isDefined(a.expandTimeoutOn)&&a.expandTimeoutOn!==E.id&&(l.cancel(a.expandTimeout),delete a.expandTimeout,delete a.expandTimeoutOn,a.$callbacks.expandTimeoutCancel()),E.collapsed&&(a.expandOnHover===!0||angular.isNumber(a.expandOnHover)&&0===a.expandOnHover?E.collapsed=!1:a.expandOnHover!==!1&&angular.isNumber(a.expandOnHover)&&a.expandOnHover>0&&angular.isUndefined(a.expandTimeoutOn)&&(a.expandTimeoutOn=E.$id,a.$callbacks.expandTimeoutStart(),a.expandTimeout=l(function(){a.$callbacks.expandTimeoutEnd(),E.collapsed=!1},a.expandOnHover))),T=E.$element,D=n.offset(T),X=E.horizontal?A.pageX<D.left+n.width(T)/2:A.pageY<D.top+n.height(T)/2,E.$parentNodesScope.accept(a,E.index())?X?(T[0].parentNode.insertBefore(f[0],T[0]),s.moveTo(E.$parentNodesScope,E.siblings(),E.index())):(T.after(f),s.moveTo(E.$parentNodesScope,E.siblings(),E.index()+1)):!X&&E.accept(a,E.childNodesCount())?(E.$childNodesScope.$element.append(f),s.moveTo(E.$childNodesScope,E.childNodes(),E.childNodesCount())):(H=!0,s.resetParent()))}a.$apply(function(){a.$treeScope.$callbacks.dragMove(s.eventArgs(g,p))})}},y=function(e){var n=s.eventArgs(g,p);e.preventDefault(),X(),l.cancel(a.expandTimeout),a.$treeScope.$apply(function(){r.when(a.$treeScope.$callbacks.beforeDrop(n)).then(function(e){e!==!1&&a.$$allowNodeDrop&&!H?(s.apply(),a.$treeScope.$callbacks.dropped(n)):w()})["catch"](function(){w()})["finally"](function(){m.replaceWith(a.$element),f.remove(),h&&(h.remove(),h=null),a.$treeScope.$callbacks.dragStop(n),a.$$allowNodeDrop=!1,s=null;var e=document.body.getAttribute("ui-tree-cursor");null!==e&&(o.find("body").css({cursor:e}),document.body.removeAttribute("ui-tree-cursor"))})})},S=function(e){a.dragEnabled()&&v(e)},x=function(e){N(e)},E=function(e){a.$$allowNodeDrop=!0,y(e)},T=function(e){y(e)},C=function(){var e;return{exec:function(n,t){t||(t=0),this.cancel(),e=l(n,t)},cancel:function(){l.cancel(e)}}}(),A=function(e){27===e.keyCode&&E(e)},w=function(){i.bind("touchstart mousedown",function(e){a.dragDelay>0?C.exec(function(){S(e)},a.dragDelay):S(e)}),i.bind("touchend touchcancel mouseup",function(){a.dragDelay>0&&C.cancel()})},w(),D=function(){angular.element(o).bind("touchend",E),angular.element(o).bind("touchcancel",E),angular.element(o).bind("touchmove",x),angular.element(o).bind("mouseup",E),angular.element(o).bind("mousemove",x),angular.element(o).bind("mouseleave",T),angular.element(o).bind("keydown",A)},X=function(){angular.element(o).unbind("touchend",E),angular.element(o).unbind("touchcancel",E),angular.element(o).unbind("touchmove",x),angular.element(o).unbind("mouseup",E),angular.element(o).unbind("mousemove",x),angular.element(o).unbind("mouseleave",T),angular.element(o).unbind("keydown",A)}}}}])}(),function(){"use strict";angular.module("ui.tree").directive("uiTreeNodes",["treeConfig","$window",function(e){return{require:["ngModel","?^uiTreeNode","^uiTree"],restrict:"A",scope:!0,controller:"TreeNodesController",link:function(n,t,o,l){var r={},a=l[0],i=l[1],d=l[2];angular.extend(r,e),r.nodesClass&&t.addClass(r.nodesClass),i?(i.scope.$childNodesScope=n,n.$nodeScope=i.scope):d.scope.$nodesScope=n,n.$treeScope=d.scope,a&&(a.$render=function(){n.$modelValue=a.$modelValue}),n.$watch(function(){return o.maxDepth},function(e){"number"==typeof e&&(n.maxDepth=e)}),n.$watch(function(){return o.nodropEnabled},function(e){"undefined"!=typeof e&&(n.nodropEnabled=!0)},!0),o.$observe("horizontal",function(e){n.horizontal="undefined"!=typeof e})}}}])}(),function(){"use strict";function e(e,n){if(void 0===n)return null;for(var t=n.parentNode,o=1,l="function"==typeof t.setAttribute&&t.hasAttribute(e)?t:null;t&&"function"==typeof t.setAttribute&&!t.hasAttribute(e);){if(t=t.parentNode,l=t,t===document.documentElement){l=null;break}o++}return l}angular.module("ui.tree").factory("UiTreeHelper",["$document","$window","treeConfig",function(n,t,o){return{nodesData:{},setNodeAttribute:function(e,n,t){if(!e.$modelValue)return null;var o=this.nodesData[e.$modelValue.$$hashKey];o||(o={},this.nodesData[e.$modelValue.$$hashKey]=o),o[n]=t},getNodeAttribute:function(e,n){if(!e.$modelValue)return null;var t=this.nodesData[e.$modelValue.$$hashKey];return t?t[n]:null},nodrag:function(e){return"undefined"!=typeof e.attr("data-nodrag")?"false"!==e.attr("data-nodrag"):!1},eventObj:function(e){var n=e;return void 0!==e.targetTouches?n=e.targetTouches.item(0):void 0!==e.originalEvent&&void 0!==e.originalEvent.targetTouches&&(n=e.originalEvent.targetTouches.item(0)),n},dragInfo:function(e){return{source:e,sourceInfo:{cloneModel:e.$treeScope.cloneEnabled===!0?angular.copy(e.$modelValue):void 0,nodeScope:e,index:e.index(),nodesScope:e.$parentNodesScope},index:e.index(),siblings:e.siblings().slice(0),parent:e.$parentNodesScope,resetParent:function(){this.parent=e.$parentNodesScope},moveTo:function(e,n,t){this.parent=e,this.siblings=n.slice(0);var o=this.siblings.indexOf(this.source);o>-1&&(this.siblings.splice(o,1),this.source.index()<t&&t--),this.siblings.splice(t,0,this.source),this.index=t},parentNode:function(){return this.parent.$nodeScope},prev:function(){return this.index>0?this.siblings[this.index-1]:null},next:function(){return this.index<this.siblings.length-1?this.siblings[this.index+1]:null},isClone:function(){return this.source.$treeScope.cloneEnabled===!0},clonedNode:function(e){return angular.copy(e)},isDirty:function(){return this.source.$parentNodesScope!=this.parent||this.source.index()!=this.index},isForeign:function(){return this.source.$treeScope!==this.parent.$treeScope},eventArgs:function(e,n){return{source:this.sourceInfo,dest:{index:this.index,nodesScope:this.parent},elements:e,pos:n}},apply:function(){var e=this.source.$modelValue;this.parent.nodropEnabled||this.parent.$treeScope.nodropEnabled||this.isDirty()&&(this.isClone()&&this.isForeign()?this.parent.insertNode(this.index,this.sourceInfo.cloneModel):(this.source.remove(),this.parent.insertNode(this.index,e)))}}},height:function(e){return e.prop("scrollHeight")},width:function(e){return e.prop("scrollWidth")},offset:function(e){var o=e[0].getBoundingClientRect();return{width:e.prop("offsetWidth"),height:e.prop("offsetHeight"),top:o.top+(t.pageYOffset||n[0].body.scrollTop||n[0].documentElement.scrollTop),left:o.left+(t.pageXOffset||n[0].body.scrollLeft||n[0].documentElement.scrollLeft)}},positionStarted:function(e,n){var t={},o=e.pageX,l=e.pageY;return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(o=e.originalEvent.touches[0].pageX,l=e.originalEvent.touches[0].pageY),t.offsetX=o-this.offset(n).left,t.offsetY=l-this.offset(n).top,t.startX=t.lastX=o,t.startY=t.lastY=l,t.nowX=t.nowY=t.distX=t.distY=t.dirAx=0,t.dirX=t.dirY=t.lastDirX=t.lastDirY=t.distAxX=t.distAxY=0,t},positionMoved:function(e,n,t){var o,l=e.pageX,r=e.pageY;return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(l=e.originalEvent.touches[0].pageX,r=e.originalEvent.touches[0].pageY),n.lastX=n.nowX,n.lastY=n.nowY,n.nowX=l,n.nowY=r,n.distX=n.nowX-n.lastX,n.distY=n.nowY-n.lastY,n.lastDirX=n.dirX,n.lastDirY=n.dirY,n.dirX=0===n.distX?0:n.distX>0?1:-1,n.dirY=0===n.distY?0:n.distY>0?1:-1,o=Math.abs(n.distX)>Math.abs(n.distY)?1:0,t?(n.dirAx=o,void(n.moving=!0)):(n.dirAx!==o?(n.distAxX=0,n.distAxY=0):(n.distAxX+=Math.abs(n.distX),0!==n.dirX&&n.dirX!==n.lastDirX&&(n.distAxX=0),n.distAxY+=Math.abs(n.distY),0!==n.dirY&&n.dirY!==n.lastDirY&&(n.distAxY=0)),void(n.dirAx=o))},elementIsTreeNode:function(e){return"undefined"!=typeof e.attr("ui-tree-node")},elementIsTreeNodeHandle:function(e){return"undefined"!=typeof e.attr("ui-tree-handle")},elementIsTree:function(e){return"undefined"!=typeof e.attr("ui-tree")},elementIsTreeNodes:function(e){return"undefined"!=typeof e.attr("ui-tree-nodes")},elementIsPlaceholder:function(e){return e.hasClass(o.placeholderClass)},elementContainsTreeNodeHandler:function(e){return e[0].querySelectorAll("[ui-tree-handle]").length>=1},treeNodeHandlerContainerOfElement:function(n){return e("ui-tree-handle",n[0])}}}])}();

@@ -36,3 +36,3 @@ (function () {

$scope.data = [{
$scope.dataBoolean = [{
'id': 1,

@@ -56,7 +56,28 @@ 'title': 'node1',

'title': 'node2',
'nodrop': true, // An arbitrary property to check in custom template for nodrop-enabled
'nodes': []
}];
$scope.dataNumber = [{
'id': 1,
'title': 'node1',
'nodes': [
{
'id': 11,
'title': 'node1.1',
'nodes': [
{
'id': 111,
'title': 'node1.1.1',
'nodes': []
}
]
}
]
}, {
'id': 2,
'title': 'node2',
'nodes': []
}];
}]);
}());
{
"name": "angular-ui-tree",
"version": "2.19.0",
"version": "2.20.0",
"description": "An AngularJS UI component that can sort nested lists, provides drag & drop support and doesn't depend on jQuery",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -385,6 +385,9 @@ Angular UI Tree

##### data-expand-on-hover (type: boolean)
##### data-expand-on-hover (type: boolean, number)
Causes the node to expand (if it contains child nodes and was collapsed) when dragging a node over it.
This lets users drag and drop items into a nested tree in a single drag operation, instead of having to expand all the nodes to the destination first.
The target node will immediately expand when `true` is provided.
When a number (in milliseconds) is specified, the target node will expand after the specified amount of milliseconds.
#### Properties of scope

@@ -391,0 +394,0 @@ ##### $element (type: AngularElement)

@@ -21,2 +21,3 @@ (function () {

//Called by uiTreeNode Directive on load.
$scope.init = function (controllersArr) {

@@ -26,14 +27,20 @@ var treeNodesCtrl = controllersArr[0];

// find the scope of it's parent node
//Find the scope of it's parent node.
$scope.$parentNodeScope = treeNodesCtrl.scope.$nodeScope;
// modelValue for current node
//modelValue for current node.
$scope.$modelValue = treeNodesCtrl.scope.$modelValue[$scope.$index];
$scope.$parentNodesScope = treeNodesCtrl.scope;
treeNodesCtrl.scope.initSubNode($scope); // init sub nodes
//Init sub nodes.
treeNodesCtrl.scope.initSubNode($scope);
$element.on('$destroy', function () {
treeNodesCtrl.scope.destroySubNode($scope); // destroy sub nodes
//Destroy sub nodes.
treeNodesCtrl.scope.destroySubNode($scope);
});
};
//Return the index of child node in parent node (nodesScope).
$scope.index = function () {

@@ -56,2 +63,3 @@ return $scope.$parentNodesScope.$modelValue.indexOf($scope.$modelValue);

//TODO(jcarter): This method is on uiTreeHelper already.
$scope.prev = function () {

@@ -65,2 +73,3 @@ var index = $scope.index();

//Calls childNodes on parent.
$scope.siblings = function () {

@@ -67,0 +76,0 @@ return $scope.$parentNodesScope.childNodes();

@@ -62,2 +62,3 @@ (function () {

//Called in apply method of UiTreeHelper.dragInfo.
$scope.removeNode = function (node) {

@@ -74,2 +75,3 @@ var index = $scope.$modelValue.indexOf(node.$modelValue);

//Called in apply method of UiTreeHelper.dragInfo.
$scope.insertNode = function (index, nodeData) {

@@ -76,0 +78,0 @@ $scope.safeApply(function () {

@@ -16,8 +16,10 @@ (function () {

},
config = {},
tdElm,
$trElm,
emptyElmColspan;
config = {},
tdElm,
$trElm,
emptyElmColspan;
//Adding configured class to uiTree.
angular.extend(config, treeConfig);
if (config.treeClass) {

@@ -27,10 +29,14 @@ element.addClass(config.treeClass);

//Determining if uiTree is on a table.
if (element.prop('tagName').toLowerCase() === 'table') {
scope.$emptyElm = angular.element($window.document.createElement('tr'));
$trElm = element.find('tr');
// If we can find a tr, then we can use its td children as the empty element colspan.
//If we can find a tr, then we can use its td children as the empty element colspan.
if ($trElm.length > 0) {
emptyElmColspan = angular.element($trElm).children().length;
} else {
// If not, by setting a huge colspan we make sure it takes full width.
//If not, by setting a huge colspan we make sure it takes full width.
//TODO(jcarter): Check for negative side effects.
emptyElmColspan = 1000000;

@@ -37,0 +43,0 @@ }

@@ -13,7 +13,10 @@ (function () {

link: function (scope, element, attrs, controllersArr) {
// todo startPos is unused
var config = {},
hasTouch = 'ontouchstart' in window,
startPos, firstMoving, dragInfo, pos,
placeElm, hiddenPlaceElm, dragElm,
firstMoving,
dragInfo,
pos,
placeElm,
hiddenPlaceElm,
dragElm,
treeScope = null,

@@ -43,12 +46,17 @@ elements, // As a parameter for callbacks

isHandleChild,
el;
el,
isUiTreeRoot;
//Adding configured class to ui-tree-node.
angular.extend(config, treeConfig);
if (config.nodeClass) {
element.addClass(config.nodeClass);
}
//Call init function in nodeCtrl, sets parent node and sets up sub nodes.
scope.init(controllersArr);
scope.collapsed = !!UiTreeHelper.getNodeAttribute(scope, 'collapsed') || treeConfig.defaultCollapsed;
scope.expandOnHover = !!UiTreeHelper.getNodeAttribute(scope, 'expandOnHover');
scope.expandOnHover = !!UiTreeHelper.getNodeAttribute(scope, 'expandOnHover');
scope.sourceOnly = scope.nodropEnabled || scope.$treeScope.nodropEnabled;

@@ -62,2 +70,3 @@

//Watches to trigger behavior based on actions and settings.
scope.$watch('collapsed', function (val) {

@@ -74,3 +83,3 @@ UiTreeHelper.setNodeAttribute(scope, 'collapsed', val);

scope.$watch('expandOnHover', function (val) {
scope.$watch('expandOnHover', function (val) {
UiTreeHelper.setNodeAttribute(scope, 'expandOnHover', val);

@@ -89,7 +98,10 @@ attrs.$set('expandOnHover', val);

/**
* Called when the user has grabbed a node and started dragging it
* @param e
* Called when the user has grabbed a node and started dragging it.
*
* @param {MouseEvent} e event that is triggered by DOM.
* @return undefined?
*/
dragStart = function (e) {
// disable right click
//Disable right click.
if (!hasTouch && (e.button === 2 || e.which === 3)) {

@@ -99,3 +111,3 @@ return;

// event has already fired in other scope
//Event has already fired in other scope.
if (e.uiTreeDragging || (e.originalEvent && e.originalEvent.uiTreeDragging)) {

@@ -105,11 +117,16 @@ return;

// the node being dragged
//The node being dragged.
var eventElm = angular.element(e.target),
isHandleChild, cloneElm, eventElmTagName, tagName,
eventObj, tdElm, hStyle,
isHandleChild,
cloneElm,
eventElmTagName,
tagName,
eventObj,
tdElm,
hStyle,
isTreeNode,
isTreeNodeHandle;
// if the target element is a child element of a ui-tree-handle,
// use the containing handle element as target element
//If the target element is a child element of a ui-tree-handle,
// use the containing handle element as target element.
isHandleChild = UiTreeHelper.treeNodeHandlerContainerOfElement(eventElm);

@@ -124,2 +141,3 @@ if (isHandleChild) {

//If we are not triggering mousedown on our uiTree or any of it's parts, return.
if (!isTreeNode && !isTreeNodeHandle) {

@@ -129,2 +147,3 @@ return;

//If we are not triggering mousedown on our uiTree or any of it's parts, return.
if (isTreeNode && UiTreeHelper.elementContainsTreeNodeHandler(eventElm)) {

@@ -134,14 +153,23 @@ return;

//Dragging not allowed on inputs or buttons.
eventElmTagName = eventElm.prop('tagName').toLowerCase();
if (eventElmTagName == 'input' ||
eventElmTagName == 'textarea' ||
eventElmTagName == 'button' ||
eventElmTagName == 'select') { // if it's a input or button, ignore it
eventElmTagName == 'textarea' ||
eventElmTagName == 'button' ||
eventElmTagName == 'select') {
return;
}
// check if it or it's parents has a 'data-nodrag' attribute
//Check if it or it's parents has a 'data-nodrag' attribute
el = angular.element(e.target);
while (el && el[0] && el[0] !== element) {
if (UiTreeHelper.nodrag(el)) { // if the node mark as `nodrag`, DONOT drag it.
//TODO(jcarter): This may be breaking the changing nest level within self.
while (el && el[0] && el[0] !== element && !isUiTreeRoot) {
//Checking that I can access attributes.
if (el[0].attributes) {
isUiTreeRoot = el[0].attributes['ui-tree'];
}
//If the node mark as `nodrag`, DONOT drag it.
if (UiTreeHelper.nodrag(el)) {
return;

@@ -152,2 +180,3 @@ }

//If users beforeDrag calback returns falsey, do not initiate.
if (!scope.beforeDrag(scope)) {

@@ -157,3 +186,4 @@ return;

e.uiTreeDragging = true; // stop event bubbling
//Set property checked at start of function to prevent running logic again.
e.uiTreeDragging = true;
if (e.originalEvent) {

@@ -163,19 +193,33 @@ e.originalEvent.uiTreeDragging = true;

e.preventDefault();
//Get original event if TouchEvent.
eventObj = UiTreeHelper.eventObj(e);
//Set boolean used to specify beginning of move.
firstMoving = true;
//Setting drag info properties and methods in scope of node being moved.
dragInfo = UiTreeHelper.dragInfo(scope);
//Determine tage name of element ui-tree-node is on.
tagName = element.prop('tagName');
if (tagName.toLowerCase() === 'tr') {
//Create a new table column as placeholder.
placeElm = angular.element($window.document.createElement(tagName));
//Create a column placeholder and set colspan to whole row length.
tdElm = angular.element($window.document.createElement('td'))
.addClass(config.placeholderClass)
.attr('colspan', element[0].children.length);
.addClass(config.placeholderClass)
.attr('colspan', element[0].children.length);
placeElm.append(tdElm);
} else {
//If not a table just duplicate element and add placeholder class.
placeElm = angular.element($window.document.createElement(tagName))
.addClass(config.placeholderClass);
.addClass(config.placeholderClass);
}
//Create a hidden placeholder and add class from config.
hiddenPlaceElm = angular.element($window.document.createElement(tagName));

@@ -186,11 +230,13 @@ if (config.hiddenClass) {

//Getting starting position of element being moved.
pos = UiTreeHelper.positionStarted(eventObj, element);
placeElm.css('height', UiTreeHelper.height(element) + 'px');
//Creating drag element to represent node.
dragElm = angular.element($window.document.createElement(scope.$parentNodesScope.$element.prop('tagName')))
.addClass(scope.$parentNodesScope.$element.attr('class')).addClass(config.dragClass);
.addClass(scope.$parentNodesScope.$element.attr('class')).addClass(config.dragClass);
dragElm.css('width', UiTreeHelper.width(element) + 'px');
dragElm.css('z-index', 9999);
// Prevents cursor to change rapidly in Opera 12.16 and IE when dragging an element
//Prevents cursor to change rapidly in Opera 12.16 and IE when dragging an element.
hStyle = (element[0].querySelector('.angular-ui-tree-handle') || element[0]).currentStyle;

@@ -202,5 +248,8 @@ if (hStyle) {

//If tree is sourceOnly (noDragDrop) don't show placeholder when moving about it.
if (scope.sourceOnly) {
placeElm.css('display', 'none');
}
//Insert placeholder.
element.after(placeElm);

@@ -214,4 +263,6 @@ element.after(hiddenPlaceElm);

//Create drag element.
$document.find('body').append(dragElm);
//Set drag elements position on screen.
dragElm.css({

@@ -226,4 +277,6 @@ 'left': eventObj.pageX - pos.offsetX + 'px',

//Create all drag/move bindings.
bindDragMoveEvents();
// Fire dragStart callback
//Fire dragStart callback.
scope.$apply(function () {

@@ -233,2 +286,3 @@ scope.$treeScope.$callbacks.dragStart(dragInfo.eventArgs(elements, pos));

//Get bounds of document.
document_height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);

@@ -258,5 +312,7 @@ document_width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);

//If check ensures that drag element was created.
if (dragElm) {
e.preventDefault();
//Deselect anything (text, etc.) that was selected when move began.
if ($window.getSelection) {

@@ -268,6 +324,7 @@ $window.getSelection().removeAllRanges();

//Get top left positioning of element being moved.
leftElmPos = eventObj.pageX - pos.offsetX;
topElmPos = eventObj.pageY - pos.offsetY;
//dragElm can't leave the screen on the left
//dragElm can't leave the screen on the left.
if (leftElmPos < 0) {

@@ -277,3 +334,3 @@ leftElmPos = 0;

//dragElm can't leave the screen on the top
//dragElm can't leave the screen on the top.
if (topElmPos < 0) {

@@ -283,3 +340,3 @@ topElmPos = 0;

//dragElm can't leave the screen on the bottom
//dragElm can't leave the screen on the bottom.
if ((topElmPos + 10) > document_height) {

@@ -289,3 +346,3 @@ topElmPos = document_height - 10;

//dragElm can't leave the screen on the right
//dragElm can't leave the screen on the right.
if ((leftElmPos + 10) > document_width) {

@@ -295,2 +352,3 @@ leftElmPos = document_width - 10;

//Updating element being moved css.
dragElm.css({

@@ -301,6 +359,7 @@ 'left': leftElmPos + 'px',

//Getting position to top and bottom of page.
top_scroll = window.pageYOffset || $window.document.documentElement.scrollTop;
bottom_scroll = top_scroll + (window.innerHeight || $window.document.clientHeight || $window.document.clientHeight);
// to scroll down if cursor y-position is greater than the bottom position the vertical scroll
//To scroll down if cursor y-position is greater than the bottom position the vertical scroll
if (bottom_scroll < eventObj.pageY && bottom_scroll < document_height) {

@@ -311,3 +370,3 @@ scrollDownBy = Math.min(document_height - bottom_scroll, 10);

// to scroll top if cursor y-position is less than the top position the vertical scroll
//To scroll top if cursor y-position is less than the top position the vertical scroll
if (top_scroll > eventObj.pageY) {

@@ -317,2 +376,3 @@ window.scrollBy(0, -10);

//Calling service to update position coordinates based on move.
UiTreeHelper.positionMoved(e, pos, firstMoving);

@@ -324,17 +384,16 @@ if (firstMoving) {

// check if add it as a child node first
// todo decrease is unused
//Setting X point for elementFromPoint.
decrease = (UiTreeHelper.offset(dragElm).left - UiTreeHelper.offset(placeElm).left) >= config.threshold;
targetX = eventObj.pageX - ($window.pageXOffset ||
$window.document.body.scrollLeft ||
$window.document.documentElement.scrollLeft) -
($window.document.documentElement.clientLeft || 0);
$window.document.body.scrollLeft ||
$window.document.documentElement.scrollLeft) -
($window.document.documentElement.clientLeft || 0);
targetY = eventObj.pageY - ($window.pageYOffset ||
$window.document.body.scrollTop ||
$window.document.documentElement.scrollTop) -
($window.document.documentElement.clientTop || 0);
$window.document.body.scrollTop ||
$window.document.documentElement.scrollTop) -
($window.document.documentElement.clientTop || 0);
// Select the drag target. Because IE does not support CSS 'pointer-events: none', it will always
//Select the drag target. Because IE does not support CSS 'pointer-events: none', it will always
// pick the drag element itself as the target. To prevent this, we hide the drag element while

@@ -349,9 +408,11 @@ // selecting the target.

// when using elementFromPoint() inside an iframe, you have to call
//When using elementFromPoint() inside an iframe, you have to call
// elementFromPoint() twice to make sure IE8 returns the correct value
//MDN: The elementFromPoint() method of the Document interface returns the topmost element at the specified coordinates.
$window.document.elementFromPoint(targetX, targetY);
//Set target element (element in specified x/y coordinates).
targetElm = angular.element($window.document.elementFromPoint(targetX, targetY));
// if the target element is a child element of a ui-tree-handle,
//If the target element is a child element of a ui-tree-handle,
// use the containing handle element as target element

@@ -369,15 +430,16 @@ isHandleChild = UiTreeHelper.treeNodeHandlerContainerOfElement(targetElm);

//This checks if angularUiTree attributes are found on element.
outOfBounds = !UiTreeHelper.elementIsTreeNodeHandle(targetElm) &&
!UiTreeHelper.elementIsTreeNode(targetElm) &&
!UiTreeHelper.elementIsTreeNodes(targetElm) &&
!UiTreeHelper.elementIsTree(targetElm) &&
!UiTreeHelper.elementIsPlaceholder(targetElm);
!UiTreeHelper.elementIsTreeNode(targetElm) &&
!UiTreeHelper.elementIsTreeNodes(targetElm) &&
!UiTreeHelper.elementIsTree(targetElm) &&
!UiTreeHelper.elementIsPlaceholder(targetElm);
// Detect out of bounds condition, update drop target display, and prevent drop
//Detect out of bounds condition, update drop target display, and prevent drop, also reset parent to source.
if (outOfBounds) {
// Remove the placeholder
//Remove the placeholder.
placeElm.remove();
// If the target was an empty tree, replace the empty element placeholder
//If the target was an empty tree, replace the empty element placeholder.
if (treeScope) {

@@ -387,2 +449,5 @@ treeScope.resetEmptyElement();

}
//Reset parent to source parent.
dragInfo.resetParent();
}

@@ -421,2 +486,3 @@

if (!pos.dirAx) {
//Assigning scope to target you are moving draggable to.
if (UiTreeHelper.elementIsTree(targetElm)) {

@@ -433,8 +499,10 @@ targetNode = targetElm.controller('uiTree').scope;

} else if (targetElm.controller('uiTreeNode')) {
// is a child element of a node
//Is a child element of a node.
targetNode = targetElm.controller('uiTreeNode').scope;
}
// check it's new position
//Check it's new position.
isEmpty = false;
//Exit if target is not a uiTree or child of one.
if (!targetNode) {

@@ -444,3 +512,3 @@ return;

// Show the placeholder if it was hidden for nodrop-enabled and this is a new tree
//Show the placeholder if it was hidden for nodrop-enabled and this is a new tree
if (targetNode.$treeScope && !targetNode.$parent.nodropEnabled && !targetNode.$treeScope.nodropEnabled) {

@@ -450,16 +518,18 @@ placeElm.css('display', '');

if (targetNode.$type == 'uiTree' && targetNode.dragEnabled) {
isEmpty = targetNode.isEmpty(); // Check if it's empty tree
//Set whether target tree is empty or not.
if (targetNode.$type === 'uiTree' && targetNode.dragEnabled) {
isEmpty = targetNode.isEmpty();
}
if (targetNode.$type == 'uiTreeHandle') {
//If target is a handle set new target to handle's node.
if (targetNode.$type === 'uiTreeHandle') {
targetNode = targetNode.$nodeScope;
}
if (targetNode.$type != 'uiTreeNode'
&& !isEmpty) { // Check if it is a uiTreeNode or it's an empty tree
//Check if it is a uiTreeNode or it's an empty tree.
if (targetNode.$type !== 'uiTreeNode' && !isEmpty) {
return;
}
// if placeholder move from empty tree, reset it.
//If placeholder move from empty tree, reset it.
if (treeScope && placeElm.parent()[0] != treeScope.$element[0]) {

@@ -470,3 +540,4 @@ treeScope.resetEmptyElement();

if (isEmpty) { // it's an empty tree
//It's an empty tree
if (isEmpty) {
treeScope = targetNode;

@@ -477,3 +548,6 @@ if (targetNode.$nodesScope.accept(scope, 0)) {

}
} else if (targetNode.dragEnabled()) { // drag enabled
//Not empty and drag enabled.
} else if (targetNode.dragEnabled()) {
//Setting/Resetting data for exanding on hover.
if (angular.isDefined(scope.expandTimeoutOn) && scope.expandTimeoutOn !== targetNode.id) {

@@ -487,2 +561,3 @@ $timeout.cancel(scope.expandTimeout);

//Determining if expansion is needed.
if (targetNode.collapsed) {

@@ -492,2 +567,4 @@ if (scope.expandOnHover === true || (angular.isNumber(scope.expandOnHover) && scope.expandOnHover === 0)) {

} else if (scope.expandOnHover !== false && angular.isNumber(scope.expandOnHover) && scope.expandOnHover > 0) {
//Triggering expansion.
if (angular.isUndefined(scope.expandTimeoutOn)) {

@@ -506,3 +583,4 @@ scope.expandTimeoutOn = targetNode.$id;

targetElm = targetNode.$element; // Get the element of ui-tree-node
//Get the element of ui-tree-node
targetElm = targetNode.$element;
targetOffset = UiTreeHelper.offset(targetElm);

@@ -520,3 +598,5 @@ targetBefore = targetNode.horizontal ? eventObj.pageX < (targetOffset.left + UiTreeHelper.width(targetElm) / 2)

}
} else if (!targetBefore && targetNode.accept(scope, targetNode.childNodesCount())) { // we have to check if it can add the dragging node as a child
//We have to check if it can add the dragging node as a child.
} else if (!targetBefore && targetNode.accept(scope, targetNode.childNodesCount())) {
targetNode.$childNodesScope.$element.append(placeElm);

@@ -526,2 +606,3 @@ dragInfo.moveTo(targetNode.$childNodesScope, targetNode.childNodes(), targetNode.childNodesCount());

outOfBounds = true;
dragInfo.resetParent();
}

@@ -531,2 +612,3 @@ }

//Triggering dragMove callback.
scope.$apply(function () {

@@ -539,6 +621,11 @@ scope.$treeScope.$callbacks.dragMove(dragInfo.eventArgs(elements, pos));

dragEnd = function (e) {
var dragEventArgs = dragInfo.eventArgs(elements, pos);
e.preventDefault();
//TODO(jcarter): Is dragStart need to be unbound?
unbindDragMoveEvents();
//This cancel the collapse/expand login running.
$timeout.cancel(scope.expandTimeout);

@@ -548,13 +635,20 @@

$q.when(scope.$treeScope.$callbacks.beforeDrop(dragEventArgs))
// promise resolved (or callback didn't return false)
//Promise resolved (or callback didn't return false)
.then(function (allowDrop) {
if (allowDrop !== false && scope.$$allowNodeDrop && !outOfBounds) { // node drop accepted)
if (allowDrop !== false && scope.$$allowNodeDrop && !outOfBounds) {
//Node drop accepted.
dragInfo.apply();
// fire the dropped callback only if the move was successful
//Fire the dropped callback only if the move was successful.
scope.$treeScope.$callbacks.dropped(dragEventArgs);
} else { // drop canceled - revert the node to its original position
} else {
//Drop canceled - revert the node to its original position.
bindDragStartEvents();
}
})
// promise rejected - revert the node to its original position
//Promise rejected - revert the node to its original position.
.catch(function () {

@@ -564,9 +658,14 @@ bindDragStartEvents();

.finally(function () {
//Replace placeholder with newly dropped element.
hiddenPlaceElm.replaceWith(scope.$element);
placeElm.remove();
if (dragElm) { // drag element is attached to the mouse pointer
//Remove drag element if still in DOM.
if (dragElm) {
dragElm.remove();
dragElm = null;
}
//Fire dragStope callback.
scope.$treeScope.$callbacks.dragStop(dragEventArgs);

@@ -576,3 +675,3 @@ scope.$$allowNodeDrop = false;

// Restore cursor in Opera 12.16 and IE
//Restore cursor in Opera 12.16 and IE
var oldCur = document.body.getAttribute('ui-tree-cursor');

@@ -622,14 +721,28 @@ if (oldCur !== null) {

})();
keydownHandler = function (e) {
if (e.keyCode === 27) {
dragEndEvent(e);
}
};
/**
* Binds the mouse/touch events to enable drag start for this node
* Binds the mouse/touch events to enable drag start for this node.
*/
//This is outside of bindDragMoveEvents because of the potential for a delay setting.
bindDragStartEvents = function () {
element.bind('touchstart mousedown', function (e) {
dragDelay.exec(function () {
//Don't call drag delay if no delay was specified.
if (scope.dragDelay > 0) {
dragDelay.exec(function () {
dragStartEvent(e);
}, scope.dragDelay);
} else {
dragStartEvent(e);
}, scope.dragDelay || 0);
}
});
element.bind('touchend touchcancel mouseup', function () {
dragDelay.cancel();
if (scope.dragDelay > 0) {
dragDelay.cancel();
}
});

@@ -649,6 +762,7 @@ };

angular.element($document).bind('mouseleave', dragCancelEvent);
angular.element($document).bind('keydown', keydownHandler);
};
/**
* Unbinds mouse/touch events that handle moving/dropping this dragged node
* Unbinds mouse/touch events that handle moving/dropping this dragged node.
*/

@@ -662,17 +776,4 @@ unbindDragMoveEvents = function () {

angular.element($document).unbind('mouseleave', dragCancelEvent);
angular.element($document).unbind('keydown', keydownHandler);
};
keydownHandler = function (e) {
if (e.keyCode == 27) {
scope.$$allowNodeDrop = false;
dragEnd(e);
}
};
angular.element($window.document).bind('keydown', keydownHandler);
//unbind handler that retains scope
scope.$on('$destroy', function () {
angular.element($window.document).unbind('keydown', keydownHandler);
});
}

@@ -682,3 +783,2 @@ };

]);
})();
/**
* @license Angular UI Tree v2.19.0
* @license Angular UI Tree v2.20.0
* (c) 2010-2016. https://github.com/angular-ui-tree/angular-ui-tree

@@ -4,0 +4,0 @@ * License: MIT

@@ -62,5 +62,6 @@ (function () {

/**
* get the event object for touches
* @param {[type]} e [description]
* @return {[type]} [description]
* Get the event object for touches.
*
* @param {MouseEvent|TouchEvent} e MouseEvent or TouchEvent that kicked off dragX method.
* @return {MouseEvent|TouchEvent} Object returned as original event object.
*/

@@ -70,3 +71,5 @@ eventObj: function (e) {

if (e.targetTouches !== undefined) {
//Set obj equal to the first Touch object in the TouchList.
obj = e.targetTouches.item(0);
//Logic to set obj to original TouchEvent.
} else if (e.originalEvent !== undefined && e.originalEvent.targetTouches !== undefined) {

@@ -78,2 +81,7 @@ obj = e.originalEvent.targetTouches.item(0);

/**
* Generate object used to store data about node being moved.
*
* {angular.$scope} node Scope of the node that is being moved.
*/
dragInfo: function (node) {

@@ -89,11 +97,20 @@ return {

index: node.index(),
//Slice(0) just duplicates an array.
siblings: node.siblings().slice(0),
parent: node.$parentNodesScope,
// Move the node to a new position
//Reset parent to source parent.
resetParent: function() {
this.parent = node.$parentNodesScope;
},
//Move the node to a new position, determining where the node will be inserted to when dropped happens here.
moveTo: function (parent, siblings, index) {
this.parent = parent;
//Duplicate siblings array.
this.siblings = siblings.slice(0);
// If source node is in the target nodes
//If source node is in the target nodes
var i = this.siblings.indexOf(this.source);

@@ -111,2 +128,3 @@ if (i > -1) {

//Get parent nodes nodeScope.
parentNode: function () {

@@ -116,2 +134,3 @@ return this.parent.$nodeScope;

//Get previous sibling node.
prev: function () {

@@ -125,2 +144,3 @@ if (this.index > 0) {

//Get next sibling node.
next: function () {

@@ -134,2 +154,3 @@ if (this.index < this.siblings.length - 1) {

//Return what cloneEnabled is set to on uiTree.
isClone: function () {

@@ -139,2 +160,3 @@ return this.source.$treeScope.cloneEnabled === true;

//Returns a copy of node passed in.
clonedNode: function (node) {

@@ -144,2 +166,3 @@ return angular.copy(node);

//Returns true if parent or index have changed (move happened within any uiTree).
isDirty: function () {

@@ -150,2 +173,3 @@ return this.source.$parentNodesScope != this.parent ||

//Return whether node has a new parent (set on moveTo method).
isForeign: function () {

@@ -155,2 +179,3 @@ return this.source.$treeScope !== this.parent.$treeScope;

//Sets arguments passed to user callbacks.
eventArgs: function (elements, pos) {

@@ -168,2 +193,3 @@ return {

//Method that actually manipulates the node being moved.
apply: function () {

@@ -173,3 +199,3 @@

// nodrop enabled on tree or parent
//Nodrop enabled on tree or parent
if (this.parent.nodropEnabled || this.parent.$treeScope.nodropEnabled) {

@@ -179,3 +205,3 @@ return;

// node was dropped in the same place - do nothing
//Node was dropped in the same place - do nothing.
if (!this.isDirty()) {

@@ -185,6 +211,7 @@ return;

// cloneEnabled and cross-tree so copy and do not remove from source
//CloneEnabled and cross-tree so copy and do not remove from source.
if (this.isClone() && this.isForeign()) {
this.parent.insertNode(this.index, this.sourceInfo.cloneModel);
} else { // Any other case, remove and reinsert
//Any other case, remove and reinsert.
} else {
this.source.remove();

@@ -263,5 +290,6 @@ this.parent.insertNode(this.index, nodeData);

var pos = {},
pageX = e.pageX,
pageY = e.pageY;
pageX = e.pageX,
pageY = e.pageY;
//Check to set correct data for TouchEvents
if (e.originalEvent && e.originalEvent.touches && (e.originalEvent.touches.length > 0)) {

@@ -281,5 +309,8 @@ pageX = e.originalEvent.touches[0].pageX;

positionMoved: function (e, pos, firstMoving) {
var pageX = e.pageX,
pageY = e.pageY,
newAx;
pageY = e.pageY,
newAx;
//If there are multiple touch points, choose one to use as X and Y.
if (e.originalEvent && e.originalEvent.touches && (e.originalEvent.touches.length > 0)) {

@@ -289,26 +320,27 @@ pageX = e.originalEvent.touches[0].pageX;

}
// mouse position last events
//Mouse position last event.
pos.lastX = pos.nowX;
pos.lastY = pos.nowY;
// mouse position this events
//Mouse position this event.
pos.nowX = pageX;
pos.nowY = pageY;
// distance mouse moved between events
//Distance mouse moved between events.
pos.distX = pos.nowX - pos.lastX;
pos.distY = pos.nowY - pos.lastY;
// direction mouse was moving
//Direction mouse was moving.
pos.lastDirX = pos.dirX;
pos.lastDirY = pos.dirY;
// direction mouse is now moving (on both axis)
//Direction mouse is now moving (on both axis).
pos.dirX = pos.distX === 0 ? 0 : pos.distX > 0 ? 1 : -1;
pos.dirY = pos.distY === 0 ? 0 : pos.distY > 0 ? 1 : -1;
// axis mouse is now moving on
//Axis mouse is now moving on.
newAx = Math.abs(pos.distX) > Math.abs(pos.distY) ? 1 : 0;
// do nothing on first move
//Do nothing on first move.
if (firstMoving) {

@@ -320,3 +352,3 @@ pos.dirAx = newAx;

// calc distance moved on this axis (and direction)
//Calc distance moved on this axis (and direction).
if (pos.dirAx !== newAx) {

@@ -330,3 +362,2 @@ pos.distAxX = 0;

}
pos.distAxY += Math.abs(pos.distY);

@@ -337,3 +368,2 @@ if (pos.dirY !== 0 && pos.dirY !== pos.lastDirY) {

}
pos.dirAx = newAx;

@@ -369,4 +399,6 @@ },

// TODO: optimize this loop
//(Jcarter): Suggest adding a parent element property on uiTree, then all these bubble
// to <html> can trigger to stop when they reach the parent.
function findFirstParentElementWithAttribute(attributeName, childObj) {
// undefined if the mouse leaves the browser window
//Undefined if the mouse leaves the browser window
if (childObj === undefined) {

@@ -376,8 +408,9 @@ return null;

var testObj = childObj.parentNode,
count = 1,
// check for setAttribute due to exception thrown by Firefox when a node is dragged outside the browser window
res = (typeof testObj.setAttribute === 'function' && testObj.hasAttribute(attributeName)) ? testObj : null;
count = 1,
//Check for setAttribute due to exception thrown by Firefox when a node is dragged outside the browser window
res = (typeof testObj.setAttribute === 'function' && testObj.hasAttribute(attributeName)) ? testObj : null;
while (testObj && typeof testObj.setAttribute === 'function' && !testObj.hasAttribute(attributeName)) {
testObj = testObj.parentNode;
res = testObj;
//Stop once we reach top of page.
if (testObj === document.documentElement) {

@@ -389,6 +422,5 @@ res = null;

}
return res;
}
})();
})();

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet