Skip to content

Commit

Permalink
Build v2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels Dequeker committed Jun 2, 2015
1 parent 17084a0 commit 0762c17
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
# 2.5.0

* Prevents child node scope with no children to be counted in depth [#388](https://github.com/angular-ui-tree/angular-ui-tree/pull/388)
* Fix callback errors when we have intermediate isolated scopes [#423](https://github.com/angular-ui-tree/angular-ui-tree/pull/423)
* Rename API attribute for toggling the empty placeholder [#450](https://github.com/angular-ui-tree/angular-ui-tree/pull/450)

# 2.4.0

* Added JSCS validation task [#441](https://github.com/angular-ui-tree/angular-ui-tree/pull/441)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "AngularJS UI Tree",
"version": "2.4.0",
"version": "2.5.0",
"homepage": "https://github.com/angular-ui-tree/angular-ui-tree",
"authors": [
"Jim Liu <https://github.com/JimLiu>",
Expand Down
33 changes: 19 additions & 14 deletions dist/angular-ui-tree.js
@@ -1,5 +1,5 @@
/**
* @license Angular UI Tree v2.4.0
* @license Angular UI Tree v2.5.0
* (c) 2010-2015. https://github.com/angular-ui-tree/angular-ui-tree
* License: MIT
*/
Expand All @@ -14,7 +14,7 @@
nodesClass: 'angular-ui-tree-nodes',
nodeClass: 'angular-ui-tree-node',
handleClass: 'angular-ui-tree-handle',
placeHolderClass: 'angular-ui-tree-placeholder',
placeholderClass: 'angular-ui-tree-placeholder',
dragClass: 'angular-ui-tree-drag',
dragThreshold: 3,
levelThreshold: 30
Expand Down Expand Up @@ -162,7 +162,7 @@
for (i = 0; i < nodes.length; i++) {
childNodes = nodes[i].$childNodesScope;

if (childNodes) {
if (childNodes && childNodes.childNodesCount() > 0) {
count = 1;
countSubDepth(childNodes);
}
Expand Down Expand Up @@ -306,7 +306,7 @@
$scope.$callbacks = null;

$scope.dragEnabled = true;
$scope.emptyPlaceHolderEnabled = true;
$scope.emptyPlaceholderEnabled = true;
$scope.maxDepth = 0;
$scope.dragDelay = 0;
$scope.cloneEnabled = false;
Expand All @@ -324,15 +324,17 @@
$scope.$emptyElm.remove();
};

$scope.resetEmptyElement = function () {
if ($scope.$nodesScope.$modelValue.length === 0 &&
$scope.emptyPlaceHolderEnabled) {
this.resetEmptyElement = function () {
if ((!$scope.$nodesScope.$modelValue || $scope.$nodesScope.$modelValue.length === 0) &&
$scope.emptyPlaceholderEnabled) {
$element.append($scope.$emptyElm);
} else {
$scope.$emptyElm.remove();
}
};

$scope.resetEmptyElement = this.resetEmptyElement;

var collapseOrExpand = function (scope, collapsed) {
var i, subScope,
nodes = scope.childNodes();
Expand Down Expand Up @@ -367,7 +369,7 @@
restrict: 'A',
scope: true,
controller: 'TreeController',
link: function (scope, element, attrs) {
link: function (scope, element, attrs, ctrl) {
var callbacks = {
accept: null,
beforeDrag: null
Expand All @@ -385,9 +387,11 @@
}

scope.$watch('$nodesScope.$modelValue.length', function () {
if (scope.$nodesScope.$modelValue) {
scope.resetEmptyElement();
if (!scope.$nodesScope.$modelValue) {
return;
}

ctrl.resetEmptyElement();
}, true);

scope.$watch(attrs.dragEnabled, function (val) {
Expand All @@ -396,9 +400,10 @@
}
});

scope.$watch(attrs.emptyPlaceHolderEnabled, function (val) {
scope.$watch(attrs.emptyPlaceholderEnabled, function (val) {
if ((typeof val) == 'boolean') {
scope.emptyPlaceHolderEnabled = val;
scope.emptyPlaceholderEnabled = val;
ctrl.resetEmptyElement();
}
});

Expand Down Expand Up @@ -634,11 +639,11 @@
if (tagName.toLowerCase() === 'tr') {
placeElm = angular.element($window.document.createElement(tagName));
tdElm = angular.element($window.document.createElement('td'))
.addClass(config.placeHolderClass);
.addClass(config.placeholderClass);
placeElm.append(tdElm);
} else {
placeElm = angular.element($window.document.createElement(tagName))
.addClass(config.placeHolderClass);
.addClass(config.placeholderClass);
}
hiddenPlaceElm = angular.element($window.document.createElement(tagName));
if (config.hiddenClass) {
Expand Down

0 comments on commit 0762c17

Please sign in to comment.