Skip to content

Commit f72f54e

Browse files
committed
## v3.0.4
* Fixed: * Indent when error dragging in list. * Optimal `$watch` of tree-dnd. * Added: * Just only `plugin` when need *(increment speed init tree)*: * Filter. * Order By. * Drag & Drop. * Control of Tree. * In Demo: * Custom Options & Demo live. * Order By.
1 parent 8c02d31 commit f72f54e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+11505
-8741
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## v3.0.4
2+
* Fixed:
3+
* Indent when error dragging in list.
4+
* Optimal `$watch` of tree-dnd.
5+
* Added:
6+
* Just only `plugin` when need *(increment speed init tree)*:
7+
* Filter.
8+
* Order By.
9+
* Drag & Drop.
10+
* Control of Tree.
11+
* In Demo:
12+
* Custom Options & Demo live.
13+
* Order By.
14+
115
## v3.0.3
216
* Fix error dragDrop for Tree
317
* Optimal getElementChilds

DOCUMENTS.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,88 @@
1+
* Construct operation of the condition filter:
2+
* Object:
3+
```js
4+
{
5+
Test: 'a',
6+
Test3: '3',
7+
__condition__: 'and' // or AND, true
8+
// __condition__: 'or' // sample: 'OR', false, null
9+
}
10+
```
11+
* All will convert to:
12+
* If field: `__condition__` not exist then __condition__ = null;
13+
* When condition `or`:
14+
```js
15+
scope.filter = [
16+
{ field: 'Test', callbacks: 'a' },
17+
{ field: 'Test3', callbacks: '3' },
18+
]
119

20+
scope.filterOptions = {
21+
beginAnd: 'false'
22+
}
23+
```
24+
* When condition `and` *(all sample with `or`, just different in `scope.filterOptions`)*:
25+
```js
26+
scope.filterOptions = {
27+
beginAnd: true
28+
}
29+
```
30+
* Array:
31+
* Construct of filter:
32+
```js
33+
scope.filter = [
34+
{ field: 'Test', callbacks: 'a' },
35+
{ field: 'Test3', callbacks: '3' },
36+
]
37+
```
38+
* Multi condition:
39+
* Example: Test || Test3 || (Test4 && Test5)
40+
```js
41+
scope.filter = [
42+
{ field: 'Test', callbacks: 'a' },
43+
{ field: 'Test3', callbacks: '3' },
44+
[
45+
{ field: 'Test4', callbacks: 'a' },
46+
{ field: 'Test5', callbacks: 'a' }
47+
]
48+
]
49+
50+
scope.filterOptions = {
51+
beginAnd: 'false' // null
52+
}
53+
```
54+
* Example: Test && Test3 && (Test4 || Test5)
55+
```js
56+
scope.filter = [
57+
{ field: 'Test', callbacks: 'a' },
58+
{ field: 'Test3', callbacks: '3' },
59+
[
60+
{ field: 'Test4', callbacks: 'a' },
61+
{ field: 'Test5', callbacks: 'a' }
62+
]
63+
]
64+
65+
scope.filterOptions = {
66+
beginAnd: true // or `true`
67+
}
68+
```
69+
70+
* Example: Test && Test3 && (Test4 || (Test5 && Test6))
71+
```js
72+
scope.filter = [
73+
{ field: 'Test', callbacks: 'a' },
74+
{ field: 'Test3', callbacks: '3' },
75+
[
76+
{ field: 'Test4', callbacks: 'a' },
77+
[
78+
{ field: 'Test5', callbacks: 'a' },
79+
{ field: 'Test6', callbacks: 'a' }
80+
]
81+
]
82+
]
83+
```
84+
85+
286
### Orther:
387
* Function 'filter' & 'group by' not add in ng-repeate (it's slow & incompatible with $id($$hash) )
488
* Able add function to tree-dnd by:

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-tree-dnd",
3-
"version": "3.0.3",
3+
"version": "3.1.0",
44
"authors": ["Nguyễn Thiện Hùng"],
55
"homepage": "https://github.com/thienhung1989/angular-tree-dnd",
66
"description": "Display tree table (or list) & event DrapnDrop (allow drag multi tree-dnd include all type: table, ol, ul) by AngularJS, using CSS animation and Bootstrap style",

demo/basic/basic-frame.html

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
1-
<div class="row">
2-
<div class="col-xs-3">
3-
<ul basic-toolbars class="btn-group-vertical btn-sm">
4-
<li ng-repeat="toolbar in toolbars"
5-
ng-disabled="!toolbar.click"
6-
ng-click="!toolbar.click ? (false) : (toolbar.log) ? (log = getFn(toolbar.click)()) : getFn(toolbar.click)()"
7-
ng-class="toolbar.class || 'btn btn-success btn-sm'">
8-
{{ toolbar.click || toolbar.label }}
9-
<i ng-if="toolbar.log">(*)</i>
10-
</li>
11-
</ul>
12-
</div>
13-
<div class="col-xs-9" ng-include="'basic/basic.html'"></div>
14-
</div>
1+
<div ng-controller="BasicController">
2+
<div class="row">
3+
<div class="col-xs-3">
4+
<ul basic-toolbars class="btn-group-vertical btn-sm">
5+
<li ng-repeat="toolbar in toolbars"
6+
ng-disabled="!toolbar.click"
7+
ng-click="!toolbar.click ? (false) : (toolbar.log) ? (log = getFn(toolbar.click)()) : getFn(toolbar.click)()"
8+
ng-class="toolbar.class || 'btn btn-success btn-sm'">
9+
{{ toolbar.click || toolbar.label }} <i ng-if="toolbar.log">(*)</i>
10+
</li>
11+
</ul>
12+
</div>
1513

16-
<div class="row">
17-
<div class="col-xs-7" view-source="basic"></div>
14+
<div class="col-xs-9">
15+
<div class="row">
16+
<panel title="Tree-DnD Basic (Only Tree-Control)">
17+
<div ng-include="'basic/basic.html'">
18+
</div>
19+
</panel>
20+
</div>
21+
</div>
22+
</div>
1823

19-
<div class="col-xs-5">
20-
<h2>Generated Model</h2>
21-
<pre class="code">{{ tree_data | json }}</pre>
22-
</div>
23-
</div>
24+
<div class="row">
25+
<div class="col-xs-7" view-source="basic"></div>
26+
27+
<show-code source="dataDemo | json"></show-code>
28+
29+
<div class="col-xs-5">
30+
<panel title="Generated Model" type="success">
31+
<show-code source="tree_data | json" type="javascript"></show-code>
32+
</panel>
33+
</div>
34+
</div>
35+
</div>

demo/basic/basic-toolbar.js

Lines changed: 94 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,100 @@
1-
21
(function () {
3-
'use strict';
42
app.directive(
53
'basicToolbars', function () {
64
return {
7-
restrict: 'A',
8-
replace: true,
9-
link: function (scope, element, attrs) {
10-
// debug in demo
11-
scope.getFn = function(name){
12-
return scope.my_tree[name];
13-
}
14-
15-
scope.toolbars = [
16-
{
17-
class: 'btn btn-warning',
18-
label: '----- Effect -----'
19-
},
20-
{click: 'reload_data'},
21-
{click: 'remove_node'},
22-
{label: 'add_node'},
23-
{label: 'add_node_root'},
24-
{
25-
class: 'btn btn-warning',
26-
label: '----- Directive -----'
27-
},
28-
{click: 'expand_all'},
29-
{click: 'collapse_all'},
30-
{click: 'expand_node'},
31-
{click: 'collapse_node'},
32-
{label: 'expand_all_parents'},
33-
{click: 'select_first_node', log: true},
34-
{click: 'select_next_node', log: true},
35-
{click: 'select_prev_node', log: true},
36-
{click: 'select_next_sibling', log: true},
37-
{click: 'select_prev_sibling', log: true},
38-
{click: 'select_parent_node', log: true},
39-
{click: 'select_node', log: true},
40-
{click: 'deselect_node', log: true},
41-
{
42-
class: 'btn btn-warning',
43-
label: '----- Event -----'
44-
},
45-
{click: 'get_children', log: true},
46-
{click: 'get_closest_ancestor_next_sibling', log: true},
47-
{click: 'get_first_child', log: true},
48-
{click: 'get_first_node', log: true},
49-
{click: 'get_last_descendant', log: true},
50-
{click: 'get_next_node', log: true},
51-
{click: 'get_next_sibling', log: true},
52-
{click: 'get_parent', log: true},
53-
{click: 'get_prev_node', log: true},
54-
{click: 'get_prev_sibling', log: true},
55-
{click: 'get_selected_node', log: true},
56-
{click: 'get_siblings', log: true},
57-
];
58-
}
59-
}
60-
}
5+
restrict: 'A',
6+
replace: true,
7+
link: function (scope, element, attrs) {
8+
// debug in demo
9+
scope.getFn = function (name) {
10+
return scope.my_tree[name];
11+
}
12+
13+
scope.toolbars = [
14+
{
15+
class: 'btn btn-warning',
16+
label: '----- Effect -----'
17+
},
18+
{click: 'reload_data'},
19+
{click: 'remove_node'},
20+
{label: 'add_node'},
21+
{label: 'add_node_root'},
22+
{
23+
class: 'btn btn-warning',
24+
label: '----- Directive -----'
25+
},
26+
{click: 'expand_all'},
27+
{click: 'collapse_all'},
28+
{click: 'expand_node'},
29+
{click: 'collapse_node'},
30+
{label: 'expand_all_parents'},
31+
{click: 'select_first_node',
32+
log: true
33+
},
34+
{click: 'select_next_node',
35+
log: true
36+
},
37+
{click: 'select_prev_node',
38+
log: true
39+
},
40+
{click: 'select_next_sibling',
41+
log: true
42+
},
43+
{click: 'select_prev_sibling',
44+
log: true
45+
},
46+
{click: 'select_parent_node',
47+
log: true
48+
},
49+
{click: 'select_node',
50+
log: true
51+
},
52+
{click: 'deselect_node',
53+
log: true
54+
},
55+
{
56+
class: 'btn btn-warning',
57+
label: '----- Event -----'
58+
},
59+
{click: 'get_children',
60+
log: true
61+
},
62+
{click: 'get_closest_ancestor_next_sibling',
63+
log: true
64+
},
65+
{click: 'get_first_child',
66+
log: true
67+
},
68+
{click: 'get_first_node',
69+
log: true
70+
},
71+
{click: 'get_last_descendant',
72+
log: true
73+
},
74+
{click: 'get_next_node',
75+
log: true
76+
},
77+
{click: 'get_next_sibling',
78+
log: true
79+
},
80+
{click: 'get_parent',
81+
log: true
82+
},
83+
{click: 'get_prev_node',
84+
log: true
85+
},
86+
{click: 'get_prev_sibling',
87+
log: true
88+
},
89+
{click: 'get_selected_node',
90+
log: true
91+
},
92+
{click: 'get_siblings',
93+
log: true
94+
},
95+
];
96+
}
97+
}
98+
}
6199
);
62100
})();

demo/basic/basic.html

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
<tree-dnd
2-
tree-data="tree_data"
3-
tree-control="my_tree"
4-
5-
drag-enabled="true"
6-
primary-key="DemographicId"
7-
column-defs="col_defs"
8-
expand-on="expanding_property"
9-
10-
indent="30"
11-
indent-plus="20"
12-
indent-unit="px"
13-
14-
enable-hotkey="true"
15-
enable-drag="true"
16-
enable-status="true"
17-
enable-move="true"
18-
></tree-dnd>
1+
<tree-dnd
2+
tree-data="tree_data"
3+
tree-control="my_tree"
4+
primary-key="DemographicId"
5+
column-defs="col_defs"
6+
expand-on="expanding_property"
7+
></tree-dnd>

0 commit comments

Comments
 (0)