Skip to content

Commit

Permalink
Release angular-ui-tree v2.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Mohr committed Jun 12, 2016
1 parent 60c52bd commit 46d1f40
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,10 @@
# 2.16.0

* Updated Angular references to include 1.5
* Fixed issue dragging and dropping a node into an empty tree
* Added new callback for a toggle event that fires when any node is expanded or collapsed.
* Fixed drag/drop error that occurred when the ng-app was attached to document.

# 2.15.0

* Remove scope dependency [#648](https://github.com/angular-ui-tree/angular-ui-tree/pull/648)
Expand Down
5 changes: 3 additions & 2 deletions bower.json
@@ -1,10 +1,11 @@
{
"name": "angular-ui-tree",
"version": "2.15.0",
"version": "2.16.0",
"homepage": "https://github.com/angular-ui-tree/angular-ui-tree",
"authors": [
"Jim Liu <https://github.com/JimLiu>",
"Voles <https://github.com/Voles>"
"Voles <https://github.com/Voles>",
"Stefan Mohr <https://github.com/StefanCodes>"
],
"description": "Tree directive for AngularJS",
"main": [
Expand Down
24 changes: 18 additions & 6 deletions dist/angular-ui-tree.js
@@ -1,5 +1,5 @@
/**
* @license Angular UI Tree v2.15.0
* @license Angular UI Tree v2.16.0
* (c) 2010-2016. https://github.com/angular-ui-tree/angular-ui-tree
* License: MIT
*/
Expand Down Expand Up @@ -130,6 +130,7 @@

$scope.toggle = function () {
$scope.collapsed = !$scope.collapsed;
$scope.$treeScope.$callbacks.toggle($scope.collapsed, $scope);
};

$scope.collapse = function () {
Expand Down Expand Up @@ -494,6 +495,15 @@

};

/**
* Callback is fired when a user toggles node (but after processing the toggle action)
* @param sourceNodeScope
* @param collapsed
*/
callbacks.toggle = function (collapsed, sourceNodeScope) {

};

scope.$watch(attrs.uiTree, function (newVal, oldVal) {
angular.forEach(newVal, function (value, key) {
if (callbacks[key]) {
Expand Down Expand Up @@ -546,8 +556,8 @@

angular.module('ui.tree')

.directive('uiTreeNode', ['treeConfig', 'UiTreeHelper', '$window', '$document', '$timeout', '$q', '$rootElement',
function (treeConfig, UiTreeHelper, $window, $document, $timeout, $q, $rootElement) {
.directive('uiTreeNode', ['treeConfig', 'UiTreeHelper', '$window', '$document', '$timeout', '$q',
function (treeConfig, UiTreeHelper, $window, $document, $timeout, $q) {
return {
require: ['^uiTreeNodes', '^uiTree'],
restrict: 'A',
Expand Down Expand Up @@ -727,7 +737,7 @@
dragElm.append(element);
}

$rootElement.append(dragElm);
$document.find('body').append(dragElm);

dragElm.css({
'left': eventObj.pageX - pos.offsetX + 'px',
Expand Down Expand Up @@ -764,6 +774,7 @@
targetNode,
targetElm,
isEmpty,
scrollDownBy,
targetOffset,
targetBefore;

Expand Down Expand Up @@ -808,8 +819,9 @@
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
if (bottom_scroll < eventObj.pageY && bottom_scroll <= document_height) {
window.scrollBy(0, 10);
if (bottom_scroll < eventObj.pageY && bottom_scroll < document_height) {
scrollDownBy = Math.min(document_height - bottom_scroll, 10);
window.scrollBy(0, scrollDownBy);
}

// to scroll top if cursor y-position is less than the top position the vertical scroll
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-ui-tree.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 46d1f40

Please sign in to comment.