Skip to content

Commit 0d567c1

Browse files
committed
New attribute for empty region angular-ui-tree#153
1 parent de79651 commit 0d567c1

File tree

10 files changed

+44
-12
lines changed

10 files changed

+44
-12
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ If you write your own [$callbacks.accept](#accept) method, you have to check `da
144144
##### data-drag-delay
145145
Number of milliseconds a click must be held to start a drag. (default 0)
146146

147+
##### data-empty-place-holder-enabled
148+
If a tree is empty, there will be an empty place hoder which is used to drop node from other trees by default.
149+
- `true` (default): display an empty place holder if the tree is empty
150+
- `false`: do not display an empty place hoder
151+
147152
##### Example
148153
- turn on/off drag and drop.
149154
- Limit depth to 5

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-tree",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"homepage": "https://github.com/JimLiu/angular-ui-tree",
55
"authors": [
66
"Jim Liu <https://github.com/JimLiu>",

demo/dist/angular-ui-tree.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license Angular UI Tree v2.1.3
2+
* @license Angular UI Tree v2.1.4
33
* (c) 2010-2014. https://github.com/JimLiu/angular-ui-tree
44
* License: MIT
55
*/
@@ -303,6 +303,7 @@
303303
$scope.$callbacks = null;
304304

305305
$scope.dragEnabled = true;
306+
$scope.emptyPlaceHolderEnabled = true;
306307
$scope.maxDepth = 0;
307308
$scope.dragDelay = 0;
308309

@@ -319,7 +320,8 @@
319320
};
320321

321322
$scope.resetEmptyElement = function() {
322-
if ($scope.$nodesScope.$modelValue.length === 0) {
323+
if ($scope.$nodesScope.$modelValue.length === 0 &&
324+
$scope.emptyPlaceHolderEnabled) {
323325
$element.append($scope.$emptyElm);
324326
} else {
325327
$scope.$emptyElm.remove();
@@ -639,6 +641,13 @@
639641
}
640642
});
641643

644+
attrs.$observe('emptyPlaceHolderEnabled', function(val) {
645+
var ep = scope.$eval(val);
646+
if((typeof ep) == "boolean") {
647+
scope.emptyPlaceHolderEnabled = ep;
648+
}
649+
});
650+
642651
attrs.$observe('maxDepth', function(val) {
643652
var md = scope.$eval(val);
644653
if((typeof md) == "number") {

demo/dist/angular-ui-tree.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-ui-tree.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license Angular UI Tree v2.1.3
2+
* @license Angular UI Tree v2.1.4
33
* (c) 2010-2014. https://github.com/JimLiu/angular-ui-tree
44
* License: MIT
55
*/
@@ -303,6 +303,7 @@
303303
$scope.$callbacks = null;
304304

305305
$scope.dragEnabled = true;
306+
$scope.emptyPlaceHolderEnabled = true;
306307
$scope.maxDepth = 0;
307308
$scope.dragDelay = 0;
308309

@@ -319,7 +320,8 @@
319320
};
320321

321322
$scope.resetEmptyElement = function() {
322-
if ($scope.$nodesScope.$modelValue.length === 0) {
323+
if ($scope.$nodesScope.$modelValue.length === 0 &&
324+
$scope.emptyPlaceHolderEnabled) {
323325
$element.append($scope.$emptyElm);
324326
} else {
325327
$scope.$emptyElm.remove();
@@ -639,6 +641,13 @@
639641
}
640642
});
641643

644+
attrs.$observe('emptyPlaceHolderEnabled', function(val) {
645+
var ep = scope.$eval(val);
646+
if((typeof ep) == "boolean") {
647+
scope.emptyPlaceHolderEnabled = ep;
648+
}
649+
});
650+
642651
attrs.$observe('maxDepth', function(val) {
643652
var md = scope.$eval(val);
644653
if((typeof md) == "number") {

dist/angular-ui-tree.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Angular-NestedSortable",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"dependencies": {
55
"grunt": "~0.4.2",
66
"grunt-contrib-jshint": "~0.8.0",

source/controllers/treeCtrl.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
$scope.$callbacks = null;
1515

1616
$scope.dragEnabled = true;
17+
$scope.emptyPlaceHolderEnabled = true;
1718
$scope.maxDepth = 0;
1819
$scope.dragDelay = 0;
1920

@@ -30,7 +31,8 @@
3031
};
3132

3233
$scope.resetEmptyElement = function() {
33-
if ($scope.$nodesScope.$modelValue.length === 0) {
34+
if ($scope.$nodesScope.$modelValue.length === 0 &&
35+
$scope.emptyPlaceHolderEnabled) {
3436
$element.append($scope.$emptyElm);
3537
} else {
3638
$scope.$emptyElm.remove();

source/directives/uiTree.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
}
3838
});
3939

40+
attrs.$observe('emptyPlaceHolderEnabled', function(val) {
41+
var ep = scope.$eval(val);
42+
if((typeof ep) == "boolean") {
43+
scope.emptyPlaceHolderEnabled = ep;
44+
}
45+
});
46+
4047
attrs.$observe('maxDepth', function(val) {
4148
var md = scope.$eval(val);
4249
if((typeof md) == "number") {

source/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license Angular UI Tree v2.1.3
2+
* @license Angular UI Tree v2.1.4
33
* (c) 2010-2014. https://github.com/JimLiu/angular-ui-tree
44
* License: MIT
55
*/

0 commit comments

Comments
 (0)