angular-ui-tree
Advanced tools
Comparing version
{ | ||
"name": "angular-ui-tree", | ||
"version": "2.10.0", | ||
"version": "2.11.0", | ||
"homepage": "https://github.com/angular-ui-tree/angular-ui-tree", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -0,9 +1,21 @@ | ||
# 2.11.0 | ||
* Reset placeholder display attribute instead of changing it to block [#631](https://github.com/angular-ui-tree/angular-ui-tree/issues/631) | ||
* Firefox issue where tree offset is wrong if scrolled horizontally [#626](https://github.com/angular-ui-tree/angular-ui-tree/issues/626) | ||
* Fix `Cannot read property '$type' of undefined"` error / issue [#674](https://github.com/angular-ui-tree/angular-ui-tree/issues/674) | ||
* Remove line which sets the placeholder width explicitly [#642](https://github.com/angular-ui-tree/angular-ui-tree/issues/642) | ||
* Added a demo using a table [#656](https://github.com/angular-ui-tree/angular-ui-tree/issues/656) | ||
* Fix drop placeholder for tables [#654](https://github.com/angular-ui-tree/angular-ui-tree/issues/654) | ||
* Fix empty tree element for tables [#655](https://github.com/angular-ui-tree/angular-ui-tree/issues/655) | ||
* Fix `Cannot read property 'childNodes' of undefined` [#650](https://github.com/angular-ui-tree/angular-ui-tree/issues/650) | ||
* Remove duplicate license entry in package.json [#658](https://github.com/angular-ui-tree/angular-ui-tree/issues/658) | ||
# 2.10.0 | ||
* Fix crashing `$nodesScope.$modelValue.length` watch [#574](https://github.com/angular-ui-tree/angular-ui-tree/issues/574) | ||
* Fix crashing $nodesScope.$modelValue.length watch [#574](https://github.com/angular-ui-tree/angular-ui-tree/issues/574) | ||
* Fix out of depth calculation [#582](https://github.com/angular-ui-tree/angular-ui-tree/issues/582) | ||
* Update default styling to work with tables [#572](https://github.com/angular-ui-tree/angular-ui-tree/issues/572) | ||
* Call the `dragStart` callback after setting up the variables [#587](https://github.com/angular-ui-tree/angular-ui-tree/issues/587) | ||
* Call the dragStart callback after setting up the variables [#587](https://github.com/angular-ui-tree/angular-ui-tree/issues/587) | ||
* Add Angular 1.4.x as dependency [#592](https://github.com/angular-ui-tree/angular-ui-tree/issues/592) | ||
* Put drag element to the `$rootElement` instead of the `body` [#612](https://github.com/angular-ui-tree/angular-ui-tree/issues/612) | ||
* Put drag element to the $rootElement instead of the body [#612](https://github.com/angular-ui-tree/angular-ui-tree/issues/612) | ||
* Add support for Browserify/Webpack [#614](https://github.com/angular-ui-tree/angular-ui-tree/issues/614) | ||
@@ -10,0 +22,0 @@ |
/** | ||
* @license Angular UI Tree v2.10.0 | ||
* @license Angular UI Tree v2.11.0 | ||
* (c) 2010-2015. https://github.com/angular-ui-tree/angular-ui-tree | ||
@@ -378,3 +378,6 @@ * License: MIT | ||
}, | ||
config = {}; | ||
config = {}, | ||
tdElm, | ||
$trElm, | ||
emptyElmColspan; | ||
@@ -386,3 +389,19 @@ angular.extend(config, treeConfig); | ||
scope.$emptyElm = angular.element($window.document.createElement('div')); | ||
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 ($trElm.length > 0) { | ||
emptyElmColspan = angular.element($trElm).children().length; | ||
} else { | ||
// If not, by setting a huge colspan we make sure it takes full width. | ||
emptyElmColspan = 1000000; | ||
} | ||
tdElm = angular.element($window.document.createElement('td')) | ||
.attr('colspan', emptyElmColspan); | ||
scope.$emptyElm.append(tdElm); | ||
} else { | ||
scope.$emptyElm = angular.element($window.document.createElement('div')); | ||
} | ||
if (config.emptyTreeClass) { | ||
@@ -635,3 +654,3 @@ scope.$emptyElm.addClass(config.emptyTreeClass); | ||
tagName = scope.$element.prop('tagName'); | ||
tagName = element.prop('tagName'); | ||
@@ -641,3 +660,4 @@ if (tagName.toLowerCase() === 'tr') { | ||
tdElm = angular.element($window.document.createElement('td')) | ||
.addClass(config.placeholderClass); | ||
.addClass(config.placeholderClass) | ||
.attr('colspan', element[0].children.length); | ||
placeElm.append(tdElm); | ||
@@ -653,13 +673,12 @@ } else { | ||
pos = UiTreeHelper.positionStarted(eventObj, scope.$element); | ||
placeElm.css('height', UiTreeHelper.height(scope.$element) + 'px'); | ||
placeElm.css('width', UiTreeHelper.width(scope.$element) + 'px'); | ||
pos = UiTreeHelper.positionStarted(eventObj, element); | ||
placeElm.css('height', UiTreeHelper.height(element) + 'px'); | ||
dragElm = angular.element($window.document.createElement(scope.$parentNodesScope.$element.prop('tagName'))) | ||
.addClass(scope.$parentNodesScope.$element.attr('class')).addClass(config.dragClass); | ||
dragElm.css('width', UiTreeHelper.width(scope.$element) + 'px'); | ||
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 | ||
hStyle = (scope.$element[0].querySelector('.angular-ui-tree-handle') || scope.$element[0]).currentStyle; | ||
hStyle = (element[0].querySelector('.angular-ui-tree-handle') || element[0]).currentStyle; | ||
if (hStyle) { | ||
@@ -673,8 +692,8 @@ document.body.setAttribute('ui-tree-cursor', $document.find('body').css('cursor') || ''); | ||
} | ||
scope.$element.after(placeElm); | ||
scope.$element.after(hiddenPlaceElm); | ||
element.after(placeElm); | ||
element.after(hiddenPlaceElm); | ||
if (dragInfo.isClone() && scope.sourceOnly) { | ||
dragElm.append(cloneElm); | ||
} else { | ||
dragElm.append(scope.$element); | ||
dragElm.append(element); | ||
} | ||
@@ -787,5 +806,13 @@ | ||
decrease = (UiTreeHelper.offset(dragElm).left - UiTreeHelper.offset(placeElm).left) >= config.threshold; | ||
targetX = eventObj.pageX - $window.document.body.scrollLeft; | ||
targetY = eventObj.pageY - (window.pageYOffset || $window.document.documentElement.scrollTop); | ||
targetX = eventObj.pageX - ($window.pageXOffset || | ||
$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); | ||
// Select the drag target. Because IE does not support CSS 'pointer-events: none', it will always | ||
@@ -813,3 +840,3 @@ // pick the drag element itself as the target. To prevent this, we hide the drag element while | ||
outOfBounds = !(targetElm.scope().$type); | ||
outOfBounds = !targetElm.scope() || !(targetElm.scope().$type); | ||
@@ -869,3 +896,3 @@ // Detect out of bounds condition, update drop target display, and prevent drop | ||
if (targetNode.$treeScope && !targetNode.$parent.nodropEnabled && !targetNode.$treeScope.nodropEnabled) { | ||
placeElm.css('display', 'block'); | ||
placeElm.css('display', ''); | ||
} | ||
@@ -936,3 +963,3 @@ | ||
// roll back elements changed | ||
hiddenPlaceElm.replaceWith(scope.$element); | ||
hiddenPlaceElm.replaceWith(element); | ||
placeElm.remove(); | ||
@@ -939,0 +966,0 @@ |
/** | ||
* @license Angular UI Tree v2.10.0 | ||
* @license Angular UI Tree v2.11.0 | ||
* (c) 2010-2015. 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})}(),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,i=e.childNodes();if(!i||0===i.length)return 0;for(l=i.length-1;l>=0;l--)n=i[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.$$apply=!1,e.collapsed=!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.removeNode=function(){var n=e.remove();return e.$callbacks.removed(n),n},e.remove=function(){return e.$parentNodesScope.removeNode(e)},e.toggle=function(){e.collapsed=!e.collapsed},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]}),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;var t=function(e,n){var o,l,r=e.childNodes();for(o=0;o<r.length;o++)n?r[o].collapse():r[o].expand(),l=r[o].$childNodesScope,l&&t(l,n)};e.collapseAll=function(){t(e.$nodesScope,!0)},e.expandAll=function(){t(e.$nodesScope,!1)}}])}(),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 i={accept:null,beforeDrag:null},a={};angular.extend(a,e),a.treeClass&&o.addClass(a.treeClass),t.$emptyElm=angular.element(n.document.createElement("div")),a.emptyTreeClass&&t.$emptyElm.addClass(a.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)}),i.accept=function(e,n,t){return!(n.nodropEnabled||n.outOfDepth(e))},i.beforeDrag=function(e){return!0},i.removed=function(e){},i.dropped=function(e){},i.dragStart=function(e){},i.dragMove=function(e){},i.dragStop=function(e){},i.beforeDrop=function(e){},t.$watch(l.uiTree,function(e,n){angular.forEach(e,function(e,n){i[n]&&"function"==typeof e&&(i[n]=e)}),t.$callbacks=i},!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","$rootElement",function(e,n,t,o,l,r){return{require:["^uiTreeNodes","^uiTree"],restrict:"A",controller:"TreeNodeController",link:function(i,a,d,c){var s,u,p,f,h,$,m,g,b,y,v,S,N,E,x,C,w,T,D,X,Y={},A="ontouchstart"in window,V=null,k=document.body,H=document.documentElement;angular.extend(Y,e),Y.nodeClass&&a.addClass(Y.nodeClass),i.init(c),i.collapsed=!!n.getNodeAttribute(i,"collapsed"),i.sourceOnly=i.nodropEnabled||i.$treeScope.nodropEnabled,i.$watch(d.collapsed,function(e){"boolean"==typeof e&&(i.collapsed=e)}),i.$watch("collapsed",function(e){n.setNodeAttribute(i,"collapsed",e),d.$set("collapsed",e)}),y=function(e){if((A||2!=e.button&&3!=e.which)&&!(e.uiTreeDragging||e.originalEvent&&e.originalEvent.uiTreeDragging)){var l,d,c,y,v,S=angular.element(e.target),N=S.scope(),w=a.clone();if(N&&N.$type&&!("uiTreeNode"!=N.$type&&"uiTreeHandle"!=N.$type||"uiTreeNode"==N.$type&&N.$handleScope||(l=S.prop("tagName").toLowerCase(),"input"==l||"textarea"==l||"button"==l||"select"==l))){for(;S&&S[0]&&S[0]!=a;){if(n.nodrag(S))return;S=S.parent()}i.beforeDrag(i)&&(e.uiTreeDragging=!0,e.originalEvent&&(e.originalEvent.uiTreeDragging=!0),e.preventDefault(),c=n.eventObj(e),s=!0,u=n.dragInfo(i),d=i.$element.prop("tagName"),"tr"===d.toLowerCase()?(f=angular.element(t.document.createElement(d)),y=angular.element(t.document.createElement("td")).addClass(Y.placeholderClass),f.append(y)):f=angular.element(t.document.createElement(d)).addClass(Y.placeholderClass),h=angular.element(t.document.createElement(d)),Y.hiddenClass&&h.addClass(Y.hiddenClass),p=n.positionStarted(c,i.$element),f.css("height",n.height(i.$element)+"px"),f.css("width",n.width(i.$element)+"px"),$=angular.element(t.document.createElement(i.$parentNodesScope.$element.prop("tagName"))).addClass(i.$parentNodesScope.$element.attr("class")).addClass(Y.dragClass),$.css("width",n.width(i.$element)+"px"),$.css("z-index",9999),v=(i.$element[0].querySelector(".angular-ui-tree-handle")||i.$element[0]).currentStyle,v&&(document.body.setAttribute("ui-tree-cursor",o.find("body").css("cursor")||""),o.find("body").css({cursor:v.cursor+"!important"})),i.sourceOnly&&f.css("display","none"),i.$element.after(f),i.$element.after(h),$.append(u.isClone()&&i.sourceOnly?w:i.$element),r.append($),$.css({left:c.pageX-p.offsetX+"px",top:c.pageY-p.offsetY+"px"}),m={placeholder:f,dragging:$},i.$apply(function(){i.$treeScope.$callbacks.dragStart(u.eventArgs(m,p))}),angular.element(o).bind("touchend",x),angular.element(o).bind("touchcancel",x),angular.element(o).bind("touchmove",E),angular.element(o).bind("mouseup",x),angular.element(o).bind("mousemove",E),angular.element(o).bind("mouseleave",C),g=Math.max(k.scrollHeight,k.offsetHeight,H.clientHeight,H.scrollHeight,H.offsetHeight),b=Math.max(k.scrollWidth,k.offsetWidth,H.clientWidth,H.scrollWidth,H.offsetWidth))}}},v=function(e){var o,l,r,a,d,c,h,y,v,S,N,E,x,C,w,T,D=n.eventObj(e);if($){if(e.preventDefault(),t.getSelection?t.getSelection().removeAllRanges():t.document.selection&&t.document.selection.empty(),r=D.pageX-p.offsetX,a=D.pageY-p.offsetY,0>r&&(r=0),0>a&&(a=0),a+10>g&&(a=g-10),r+10>b&&(r=b-10),$.css({left:r+"px",top:a+"px"}),d=window.pageYOffset||t.document.documentElement.scrollTop,c=d+(window.innerHeight||t.document.clientHeight||t.document.clientHeight),c<D.pageY&&g>=c&&window.scrollBy(0,10),d>D.pageY&&window.scrollBy(0,-10),n.positionMoved(e,p,s),s)return void(s=!1);if(y=n.offset($).left-n.offset(f).left>=Y.threshold,v=D.pageX-t.document.body.scrollLeft,S=D.pageY-(window.pageYOffset||t.document.documentElement.scrollTop),angular.isFunction($.hide)?$.hide():(N=$[0].style.display,$[0].style.display="none"),t.document.elementFromPoint(v,S),x=angular.element(t.document.elementFromPoint(v,S)),angular.isFunction($.show)?$.show():$[0].style.display=N,X=!x.scope().$type,X&&(f.remove(),V&&(V.resetEmptyElement(),V=null)),p.dirAx&&p.distAxX>=Y.levelThreshold&&(p.distAxX=0,p.distX>0&&(o=u.prev(),o&&!o.collapsed&&o.accept(i,o.childNodesCount())&&(o.$childNodesScope.$element.append(f),u.moveTo(o.$childNodesScope,o.childNodes(),o.childNodesCount()))),p.distX<0&&(l=u.next(),l||(h=u.parentNode(),h&&h.$parentNodesScope.accept(i,h.index()+1)&&(h.$element.after(f),u.moveTo(h.$parentNodesScope,h.siblings(),h.index()+1))))),!p.dirAx){if(E=x.scope(),C=!1,!E)return;if(!E.$treeScope||E.$parent.nodropEnabled||E.$treeScope.nodropEnabled||f.css("display","block"),"uiTree"==E.$type&&E.dragEnabled&&(C=E.isEmpty()),"uiTreeHandle"==E.$type&&(E=E.$nodeScope),"uiTreeNode"!=E.$type&&!C)return;V&&f.parent()[0]!=V.$element[0]&&(V.resetEmptyElement(),V=null),C?(V=E,E.$nodesScope.accept(i,0)&&(E.place(f),u.moveTo(E.$nodesScope,E.$nodesScope.childNodes(),0))):E.dragEnabled()&&(x=E.$element,w=n.offset(x),T=E.horizontal?D.pageX<w.left+n.width(x)/2:D.pageY<w.top+n.height(x)/2,E.$parentNodesScope.accept(i,E.index())?T?(x[0].parentNode.insertBefore(f[0],x[0]),u.moveTo(E.$parentNodesScope,E.siblings(),E.index())):(x.after(f),u.moveTo(E.$parentNodesScope,E.siblings(),E.index()+1)):!T&&E.accept(i,E.childNodesCount())?(E.$childNodesScope.$element.append(f),u.moveTo(E.$childNodesScope,E.childNodes(),E.childNodesCount())):X=!0)}i.$apply(function(){i.$treeScope.$callbacks.dragMove(u.eventArgs(m,p))})}},S=function(e){e.preventDefault(),$&&(i.$treeScope.$apply(function(){i.$treeScope.$callbacks.beforeDrop(u.eventArgs(m,p))}),h.replaceWith(i.$element),f.remove(),$.remove(),$=null,i.$$apply&&!X?i.$treeScope.$apply(function(){u.apply(),i.$treeScope.$callbacks.dropped(u.eventArgs(m,p))}):T(),i.$treeScope.$apply(function(){i.$treeScope.$callbacks.dragStop(u.eventArgs(m,p))}),i.$$apply=!1,u=null);var n=document.body.getAttribute("ui-tree-cursor");null!==n&&(o.find("body").css({cursor:n}),document.body.removeAttribute("ui-tree-cursor")),angular.element(o).unbind("touchend",x),angular.element(o).unbind("touchcancel",x),angular.element(o).unbind("touchmove",E),angular.element(o).unbind("mouseup",x),angular.element(o).unbind("mousemove",E),angular.element(t.document.body).unbind("mouseleave",C)},N=function(e){i.dragEnabled()&&y(e)},E=function(e){v(e)},x=function(e){i.$$apply=!0,S(e)},C=function(e){S(e)},w=function(){var e;return{exec:function(n,t){t||(t=0),this.cancel(),e=l(n,t)},cancel:function(){l.cancel(e)}}}(),T=function(){a.bind("touchstart mousedown",function(e){w.exec(function(){N(e)},i.dragDelay||0)}),a.bind("touchend touchcancel mouseup",function(){w.cancel()})},T(),D=function(e){27==e.keyCode&&(i.$$apply=!1,S(e))},angular.element(t.document.body).bind("keydown",D),i.$on("$destroy",function(){angular.element(t.document.body).unbind("keydown",D)})}}}])}(),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={},i=l[0],a=l[1],d=l[2];angular.extend(r,e),r.nodesClass&&t.addClass(r.nodesClass),a?(a.scope.$childNodesScope=n,n.$nodeScope=a.scope):d.scope.$nodesScope=n,n.$treeScope=d.scope,i&&(i.$render=function(){n.$modelValue=i.$modelValue}),n.$watch(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";angular.module("ui.tree").factory("UiTreeHelper",["$document","$window",function(e,n){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,angular.copy(e)):(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(t){var o=t[0].getBoundingClientRect();return{width:t.prop("offsetWidth"),height:t.prop("offsetHeight"),top:o.top+(n.pageYOffset||e[0].body.scrollTop||e[0].documentElement.scrollTop),left:o.left+(n.pageXOffset||e[0].body.scrollLeft||e[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))}}}])}(); | ||
!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})}(),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,i=e.childNodes();if(!i||0===i.length)return 0;for(l=i.length-1;l>=0;l--)n=i[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.$$apply=!1,e.collapsed=!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.removeNode=function(){var n=e.remove();return e.$callbacks.removed(n),n},e.remove=function(){return e.$parentNodesScope.removeNode(e)},e.toggle=function(){e.collapsed=!e.collapsed},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]}),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;var t=function(e,n){var o,l,r=e.childNodes();for(o=0;o<r.length;o++)n?r[o].collapse():r[o].expand(),l=r[o].$childNodesScope,l&&t(l,n)};e.collapseAll=function(){t(e.$nodesScope,!0)},e.expandAll=function(){t(e.$nodesScope,!1)}}])}(),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 i,a,d,c={accept:null,beforeDrag:null},s={};angular.extend(s,e),s.treeClass&&o.addClass(s.treeClass),"table"===o.prop("tagName").toLowerCase()?(t.$emptyElm=angular.element(n.document.createElement("tr")),a=o.find("tr"),d=a.length>0?angular.element(a).children().length:1e6,i=angular.element(n.document.createElement("td")).attr("colspan",d),t.$emptyElm.append(i)):t.$emptyElm=angular.element(n.document.createElement("div")),s.emptyTreeClass&&t.$emptyElm.addClass(s.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,t){return!(n.nodropEnabled||n.outOfDepth(e))},c.beforeDrag=function(e){return!0},c.removed=function(e){},c.dropped=function(e){},c.dragStart=function(e){},c.dragMove=function(e){},c.dragStop=function(e){},c.beforeDrop=function(e){},t.$watch(l.uiTree,function(e,n){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","$rootElement",function(e,n,t,o,l,r){return{require:["^uiTreeNodes","^uiTree"],restrict:"A",controller:"TreeNodeController",link:function(i,a,d,c){var s,u,p,f,h,m,$,g,b,y,v,S,N,E,x,C,T,w,X,D,Y={},A="ontouchstart"in window,V=null,H=document.body,k=document.documentElement;angular.extend(Y,e),Y.nodeClass&&a.addClass(Y.nodeClass),i.init(c),i.collapsed=!!n.getNodeAttribute(i,"collapsed"),i.sourceOnly=i.nodropEnabled||i.$treeScope.nodropEnabled,i.$watch(d.collapsed,function(e){"boolean"==typeof e&&(i.collapsed=e)}),i.$watch("collapsed",function(e){n.setNodeAttribute(i,"collapsed",e),d.$set("collapsed",e)}),y=function(e){if((A||2!=e.button&&3!=e.which)&&!(e.uiTreeDragging||e.originalEvent&&e.originalEvent.uiTreeDragging)){var l,d,c,y,v,S=angular.element(e.target),N=S.scope(),T=a.clone();if(N&&N.$type&&!("uiTreeNode"!=N.$type&&"uiTreeHandle"!=N.$type||"uiTreeNode"==N.$type&&N.$handleScope||(l=S.prop("tagName").toLowerCase(),"input"==l||"textarea"==l||"button"==l||"select"==l))){for(;S&&S[0]&&S[0]!=a;){if(n.nodrag(S))return;S=S.parent()}i.beforeDrag(i)&&(e.uiTreeDragging=!0,e.originalEvent&&(e.originalEvent.uiTreeDragging=!0),e.preventDefault(),c=n.eventObj(e),s=!0,u=n.dragInfo(i),d=a.prop("tagName"),"tr"===d.toLowerCase()?(f=angular.element(t.document.createElement(d)),y=angular.element(t.document.createElement("td")).addClass(Y.placeholderClass).attr("colspan",a[0].children.length),f.append(y)):f=angular.element(t.document.createElement(d)).addClass(Y.placeholderClass),h=angular.element(t.document.createElement(d)),Y.hiddenClass&&h.addClass(Y.hiddenClass),p=n.positionStarted(c,a),f.css("height",n.height(a)+"px"),m=angular.element(t.document.createElement(i.$parentNodesScope.$element.prop("tagName"))).addClass(i.$parentNodesScope.$element.attr("class")).addClass(Y.dragClass),m.css("width",n.width(a)+"px"),m.css("z-index",9999),v=(a[0].querySelector(".angular-ui-tree-handle")||a[0]).currentStyle,v&&(document.body.setAttribute("ui-tree-cursor",o.find("body").css("cursor")||""),o.find("body").css({cursor:v.cursor+"!important"})),i.sourceOnly&&f.css("display","none"),a.after(f),a.after(h),u.isClone()&&i.sourceOnly?m.append(T):m.append(a),r.append(m),m.css({left:c.pageX-p.offsetX+"px",top:c.pageY-p.offsetY+"px"}),$={placeholder:f,dragging:m},i.$apply(function(){i.$treeScope.$callbacks.dragStart(u.eventArgs($,p))}),angular.element(o).bind("touchend",x),angular.element(o).bind("touchcancel",x),angular.element(o).bind("touchmove",E),angular.element(o).bind("mouseup",x),angular.element(o).bind("mousemove",E),angular.element(o).bind("mouseleave",C),g=Math.max(H.scrollHeight,H.offsetHeight,k.clientHeight,k.scrollHeight,k.offsetHeight),b=Math.max(H.scrollWidth,H.offsetWidth,k.clientWidth,k.scrollWidth,k.offsetWidth))}}},v=function(e){var o,l,r,a,d,c,h,y,v,S,N,E,x,C,T,w,X=n.eventObj(e);if(m){if(e.preventDefault(),t.getSelection?t.getSelection().removeAllRanges():t.document.selection&&t.document.selection.empty(),r=X.pageX-p.offsetX,a=X.pageY-p.offsetY,0>r&&(r=0),0>a&&(a=0),a+10>g&&(a=g-10),r+10>b&&(r=b-10),m.css({left:r+"px",top:a+"px"}),d=window.pageYOffset||t.document.documentElement.scrollTop,c=d+(window.innerHeight||t.document.clientHeight||t.document.clientHeight),c<X.pageY&&g>=c&&window.scrollBy(0,10),d>X.pageY&&window.scrollBy(0,-10),n.positionMoved(e,p,s),s)return void(s=!1);if(y=n.offset(m).left-n.offset(f).left>=Y.threshold,v=X.pageX-(t.pageXOffset||t.document.body.scrollLeft||t.document.documentElement.scrollLeft)-(t.document.documentElement.clientLeft||0),S=X.pageY-(t.pageYOffset||t.document.body.scrollTop||t.document.documentElement.scrollTop)-(t.document.documentElement.clientTop||0),angular.isFunction(m.hide)?m.hide():(N=m[0].style.display,m[0].style.display="none"),t.document.elementFromPoint(v,S),x=angular.element(t.document.elementFromPoint(v,S)),angular.isFunction(m.show)?m.show():m[0].style.display=N,D=!x.scope()||!x.scope().$type,D&&(f.remove(),V&&(V.resetEmptyElement(),V=null)),p.dirAx&&p.distAxX>=Y.levelThreshold&&(p.distAxX=0,p.distX>0&&(o=u.prev(),o&&!o.collapsed&&o.accept(i,o.childNodesCount())&&(o.$childNodesScope.$element.append(f),u.moveTo(o.$childNodesScope,o.childNodes(),o.childNodesCount()))),p.distX<0&&(l=u.next(),l||(h=u.parentNode(),h&&h.$parentNodesScope.accept(i,h.index()+1)&&(h.$element.after(f),u.moveTo(h.$parentNodesScope,h.siblings(),h.index()+1))))),!p.dirAx){if(E=x.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;V&&f.parent()[0]!=V.$element[0]&&(V.resetEmptyElement(),V=null),C?(V=E,E.$nodesScope.accept(i,0)&&(E.place(f),u.moveTo(E.$nodesScope,E.$nodesScope.childNodes(),0))):E.dragEnabled()&&(x=E.$element,T=n.offset(x),w=E.horizontal?X.pageX<T.left+n.width(x)/2:X.pageY<T.top+n.height(x)/2,E.$parentNodesScope.accept(i,E.index())?w?(x[0].parentNode.insertBefore(f[0],x[0]),u.moveTo(E.$parentNodesScope,E.siblings(),E.index())):(x.after(f),u.moveTo(E.$parentNodesScope,E.siblings(),E.index()+1)):!w&&E.accept(i,E.childNodesCount())?(E.$childNodesScope.$element.append(f),u.moveTo(E.$childNodesScope,E.childNodes(),E.childNodesCount())):D=!0)}i.$apply(function(){i.$treeScope.$callbacks.dragMove(u.eventArgs($,p))})}},S=function(e){e.preventDefault(),m&&(i.$treeScope.$apply(function(){i.$treeScope.$callbacks.beforeDrop(u.eventArgs($,p))}),h.replaceWith(a),f.remove(),m.remove(),m=null,i.$$apply&&!D?i.$treeScope.$apply(function(){u.apply(),i.$treeScope.$callbacks.dropped(u.eventArgs($,p))}):w(),i.$treeScope.$apply(function(){i.$treeScope.$callbacks.dragStop(u.eventArgs($,p))}),i.$$apply=!1,u=null);var n=document.body.getAttribute("ui-tree-cursor");null!==n&&(o.find("body").css({cursor:n}),document.body.removeAttribute("ui-tree-cursor")),angular.element(o).unbind("touchend",x),angular.element(o).unbind("touchcancel",x),angular.element(o).unbind("touchmove",E),angular.element(o).unbind("mouseup",x),angular.element(o).unbind("mousemove",E),angular.element(t.document.body).unbind("mouseleave",C)},N=function(e){i.dragEnabled()&&y(e)},E=function(e){v(e)},x=function(e){i.$$apply=!0,S(e)},C=function(e){S(e)},T=function(){var e;return{exec:function(n,t){t||(t=0),this.cancel(),e=l(n,t)},cancel:function(){l.cancel(e)}}}(),w=function(){a.bind("touchstart mousedown",function(e){T.exec(function(){N(e)},i.dragDelay||0)}),a.bind("touchend touchcancel mouseup",function(){T.cancel()})},w(),X=function(e){27==e.keyCode&&(i.$$apply=!1,S(e))},angular.element(t.document.body).bind("keydown",X),i.$on("$destroy",function(){angular.element(t.document.body).unbind("keydown",X)})}}}])}(),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={},i=l[0],a=l[1],d=l[2];angular.extend(r,e),r.nodesClass&&t.addClass(r.nodesClass),a?(a.scope.$childNodesScope=n,n.$nodeScope=a.scope):d.scope.$nodesScope=n,n.$treeScope=d.scope,i&&(i.$render=function(){n.$modelValue=i.$modelValue}),n.$watch(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";angular.module("ui.tree").factory("UiTreeHelper",["$document","$window",function(e,n){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,angular.copy(e)):(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(t){var o=t[0].getBoundingClientRect();return{width:t.prop("offsetWidth"),height:t.prop("offsetHeight"),top:o.top+(n.pageYOffset||e[0].body.scrollTop||e[0].documentElement.scrollTop),left:o.left+(n.pageXOffset||e[0].body.scrollLeft||e[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))}}}])}(); |
@@ -10,4 +10,4 @@ describe('the Basic example page', function () { | ||
it('should render a tree with 3 root nodes', function () { | ||
basicExamplePage.rootNodes.count().then(function (meetupCount) { | ||
expect(meetupCount).toEqual(3); | ||
basicExamplePage.rootNodes.count().then(function (rootNodeCount) { | ||
expect(rootNodeCount).toEqual(3); | ||
}); | ||
@@ -17,4 +17,4 @@ }); | ||
it('should show 2 subnodes for the first root node', function () { | ||
basicExamplePage.firstSubNodes.count().then(function (meetupCount) { | ||
expect(meetupCount).toEqual(2); | ||
basicExamplePage.firstSubNodes.count().then(function (rootNodeCount) { | ||
expect(rootNodeCount).toEqual(2); | ||
}); | ||
@@ -21,0 +21,0 @@ }); |
@@ -28,2 +28,6 @@ (function () { | ||
}) | ||
.when('/table-example', { | ||
controller: 'TableExampleCtrl', | ||
templateUrl: 'views/table-example.html' | ||
}) | ||
.otherwise({ | ||
@@ -30,0 +34,0 @@ redirectTo: '/basic-example' |
@@ -29,3 +29,4 @@ module.exports = function(config) { | ||
'karma-phantomjs-launcher', | ||
'karma-jasmine' | ||
'karma-jasmine', | ||
'karma-coverage' | ||
], | ||
@@ -35,3 +36,4 @@ | ||
preprocessors: { | ||
'**/*.html': 'ng-html2js' | ||
'**/*.html': 'ng-html2js', | ||
'source/**/!(*spec).js': ['coverage'] | ||
}, | ||
@@ -53,5 +55,13 @@ | ||
port: 9876, | ||
reporters: 'dots', | ||
singleRun: true | ||
reporters: ['dots', 'coverage'], | ||
singleRun: true, | ||
coverageReporter: { | ||
dir: 'coverage', | ||
reporters: [{ | ||
type: 'lcov', | ||
subdir: 'lcov' | ||
}] | ||
} | ||
}); | ||
}; |
{ | ||
"name": "angular-ui-tree", | ||
"version": "2.10.0", | ||
"version": "2.11.0", | ||
"description": "An AngularJS UI component that can sort nested lists, provides drag & drop support and doesn't depend on jQuery", | ||
@@ -10,6 +10,7 @@ "license": "MIT", | ||
}, | ||
"license": "SEE LICENSE IN LICENSE", | ||
"main": "index.js", | ||
"devDependencies": { | ||
"codacy-coverage": "^1.1.3", | ||
"connect-livereload": "^0.5.2", | ||
"coveralls": "^2.11.4", | ||
"del": "^1.2.0", | ||
@@ -31,2 +32,3 @@ "gulp": "^3.9.0", | ||
"karma": "^0.12.24", | ||
"karma-coverage": "^0.5.3", | ||
"karma-firefox-launcher": "^0.1.3", | ||
@@ -44,4 +46,6 @@ "karma-jasmine": "~0.1.0", | ||
"scripts": { | ||
"test": "gulp build && gulp test:e2e" | ||
"test": "gulp build && gulp test:e2e", | ||
"coveralls": "cat ./coverage/lcov/lcov.info | coveralls", | ||
"codacy": "cat ./coverage/lcov/lcov.info | codacy-coverage --verbose" | ||
} | ||
} |
@@ -16,3 +16,6 @@ (function () { | ||
}, | ||
config = {}; | ||
config = {}, | ||
tdElm, | ||
$trElm, | ||
emptyElmColspan; | ||
@@ -24,3 +27,19 @@ angular.extend(config, treeConfig); | ||
scope.$emptyElm = angular.element($window.document.createElement('div')); | ||
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 ($trElm.length > 0) { | ||
emptyElmColspan = angular.element($trElm).children().length; | ||
} else { | ||
// If not, by setting a huge colspan we make sure it takes full width. | ||
emptyElmColspan = 1000000; | ||
} | ||
tdElm = angular.element($window.document.createElement('td')) | ||
.attr('colspan', emptyElmColspan); | ||
scope.$emptyElm.append(tdElm); | ||
} else { | ||
scope.$emptyElm = angular.element($window.document.createElement('div')); | ||
} | ||
if (config.emptyTreeClass) { | ||
@@ -27,0 +46,0 @@ scope.$emptyElm.addClass(config.emptyTreeClass); |
@@ -116,3 +116,3 @@ (function () { | ||
tagName = scope.$element.prop('tagName'); | ||
tagName = element.prop('tagName'); | ||
@@ -122,3 +122,4 @@ if (tagName.toLowerCase() === 'tr') { | ||
tdElm = angular.element($window.document.createElement('td')) | ||
.addClass(config.placeholderClass); | ||
.addClass(config.placeholderClass) | ||
.attr('colspan', element[0].children.length); | ||
placeElm.append(tdElm); | ||
@@ -134,13 +135,12 @@ } else { | ||
pos = UiTreeHelper.positionStarted(eventObj, scope.$element); | ||
placeElm.css('height', UiTreeHelper.height(scope.$element) + 'px'); | ||
placeElm.css('width', UiTreeHelper.width(scope.$element) + 'px'); | ||
pos = UiTreeHelper.positionStarted(eventObj, element); | ||
placeElm.css('height', UiTreeHelper.height(element) + 'px'); | ||
dragElm = angular.element($window.document.createElement(scope.$parentNodesScope.$element.prop('tagName'))) | ||
.addClass(scope.$parentNodesScope.$element.attr('class')).addClass(config.dragClass); | ||
dragElm.css('width', UiTreeHelper.width(scope.$element) + 'px'); | ||
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 | ||
hStyle = (scope.$element[0].querySelector('.angular-ui-tree-handle') || scope.$element[0]).currentStyle; | ||
hStyle = (element[0].querySelector('.angular-ui-tree-handle') || element[0]).currentStyle; | ||
if (hStyle) { | ||
@@ -154,8 +154,8 @@ document.body.setAttribute('ui-tree-cursor', $document.find('body').css('cursor') || ''); | ||
} | ||
scope.$element.after(placeElm); | ||
scope.$element.after(hiddenPlaceElm); | ||
element.after(placeElm); | ||
element.after(hiddenPlaceElm); | ||
if (dragInfo.isClone() && scope.sourceOnly) { | ||
dragElm.append(cloneElm); | ||
} else { | ||
dragElm.append(scope.$element); | ||
dragElm.append(element); | ||
} | ||
@@ -268,5 +268,13 @@ | ||
decrease = (UiTreeHelper.offset(dragElm).left - UiTreeHelper.offset(placeElm).left) >= config.threshold; | ||
targetX = eventObj.pageX - $window.document.body.scrollLeft; | ||
targetY = eventObj.pageY - (window.pageYOffset || $window.document.documentElement.scrollTop); | ||
targetX = eventObj.pageX - ($window.pageXOffset || | ||
$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); | ||
// Select the drag target. Because IE does not support CSS 'pointer-events: none', it will always | ||
@@ -294,3 +302,3 @@ // pick the drag element itself as the target. To prevent this, we hide the drag element while | ||
outOfBounds = !(targetElm.scope().$type); | ||
outOfBounds = !targetElm.scope() || !(targetElm.scope().$type); | ||
@@ -350,3 +358,3 @@ // Detect out of bounds condition, update drop target display, and prevent drop | ||
if (targetNode.$treeScope && !targetNode.$parent.nodropEnabled && !targetNode.$treeScope.nodropEnabled) { | ||
placeElm.css('display', 'block'); | ||
placeElm.css('display', ''); | ||
} | ||
@@ -417,3 +425,3 @@ | ||
// roll back elements changed | ||
hiddenPlaceElm.replaceWith(scope.$element); | ||
hiddenPlaceElm.replaceWith(element); | ||
placeElm.remove(); | ||
@@ -420,0 +428,0 @@ |
/** | ||
* @license Angular UI Tree v2.10.0 | ||
* @license Angular UI Tree v2.11.0 | ||
* (c) 2010-2015. https://github.com/angular-ui-tree/angular-ui-tree | ||
@@ -4,0 +4,0 @@ * License: MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
209141
3.1%61
3.39%0
-100%0
-100%4045
2.28%27
12.5%