Skip to content

Commit d07777b

Browse files
committed
Up new version 3.0.6.
- Fix error: type === 'object'. - Add new demo.
1 parent d4143cc commit d07777b

File tree

174 files changed

+30326
-17862
lines changed

Some content is hidden

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

174 files changed

+30326
-17862
lines changed

.bowerrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"directory": "demo/framework/vendor"
2+
"directory": "demo/libs/vendor"
33
}

bower.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{
22
"name": "angular-tree-dnd",
3-
"version": "3.0.5",
4-
"authors": ["Nguyễn Thiện Hùng"],
3+
"version": "3.0.6",
4+
"authors": [
5+
"Nguyễn Thiện Hùng"
6+
],
57
"homepage": "https://github.com/thienhung1989/angular-tree-dnd",
6-
"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",
8+
"description": "Display tree table (or list) & event DrapnDrop (allow drag multi tree-dnd include all type: table, ol, ul) by AngularJS",
79
"main": [
810
"dist/ng-tree-dnd.css",
9-
"dist/ng-tree-dnd.js",
10-
"dist/ng-tree-dnd.min.css",
11-
"dist/ng-tree-dnd.min.js",
12-
"dist/ng-tree-dnd.min.js.map"
11+
"dist/ng-tree-dnd.js"
1312
],
1413
"licence": "MIT",
1514
"keywords": [
@@ -46,11 +45,14 @@
4645
"src"
4746
],
4847
"dependencies": {
49-
"angular": ">=1.2.1"
48+
"angular": "~1.2"
5049
},
5150
"devDependencies": {
52-
"angular-mocks": ">= 1.2.1",
53-
"angular-route": ">= 1.2.1",
54-
"bootstrap-css": ">=3.2.0"
51+
"angular-mocks": "~1.2",
52+
"angular-route": "~1.2",
53+
"angular-animate": "~1.2",
54+
"angular-bootstrap": "^0.12",
55+
"bootstrap-css": "^3.3",
56+
"angularjs-toaster": "*"
5557
}
5658
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,21 @@ body {
6767
border-color: #faebcc;
6868
background-image: -webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);
6969
background-image: linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);
70+
}
71+
72+
73+
.tree-dnd-node {
74+
border-radius: 4px !important;
75+
}
76+
77+
.tree-dnd-nodes .tree-dnd-node {
78+
border-radius: 4px !important;
79+
}
80+
81+
.tab-pane {
82+
padding: 10px;
83+
border: solid #ddd;
84+
margin-top: -1px;
85+
border-width: 0 1px 1px 1px;
86+
border-radius: 0 0 4px 4px;
7087
}
Lines changed: 99 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,59 @@
11
var app, deps;
22

3-
deps = ['ntt.TreeDnD', 'ngRoute'];
3+
deps = ['ntt.TreeDnD', 'ngRoute', 'toaster', 'ngAnimate', 'ui.bootstrap'];
44

55
app = angular.module('TreeDnDTest', deps)
6-
.config(
7-
[
8-
'$routeProvider',
9-
function ($routeProvider) {
10-
$routeProvider
11-
.when(
12-
'/basic', {
13-
templateUrl: 'basic/basic-frame.html',
14-
controller: 'BasicController'
15-
}
16-
)
17-
.when(
18-
'/filter', {
19-
templateUrl: 'filter/filter-frame.html',
20-
controller: 'FilterController'
21-
}
22-
)
23-
.when(
24-
'/list', {
25-
templateUrl: 'list/list-frame.html',
26-
controller: 'ListController'
27-
}
28-
)
29-
.when(
30-
'/multi', {
31-
templateUrl: 'multi/multi-frame.html',
32-
controller: 'MultiController'
33-
}
34-
)
35-
.when(
36-
'/custom-options', {
37-
templateUrl: 'custom/custom-frame.html',
38-
controller: 'CustomController'
39-
}
40-
)
41-
.otherwise({redirectTo: '/basic'});
42-
}]
43-
).
44-
directive(
45-
'navigation', function ($rootScope, $location) {
6+
.config(['$routeProvider', function ($routeProvider) {
7+
$routeProvider
8+
.when('/table', {
9+
templateUrl: 'routers/filter/filter-frame.html',
10+
controller: 'FilterController'
11+
})
12+
.when('/list', {
13+
templateUrl: 'routers/list/list-frame.html',
14+
controller: 'ListController'
15+
})
16+
.when('/multi', {
17+
templateUrl: 'routers/multi/multi-frame.html',
18+
controller: 'MultiController'
19+
})
20+
.when('/event', {
21+
templateUrl: 'routers/basic/basic-frame.html',
22+
controller: 'BasicController'
23+
})
24+
.when('/custom', {
25+
templateUrl: 'routers/custom/custom-frame.html',
26+
controller: 'CustomController'
27+
})
28+
.otherwise({redirectTo: '/table'});
29+
}])
30+
.directive('navigation', function ($rootScope, $location) {
4631
return {
4732
template: '<li ng-repeat="option in options" ng-class="{active: isActive(option)}">' +
4833
' <a ng-href="{{option.href}}">{{option.label}}</a>' +
4934
'</li>',
5035
link: function (scope, element, attr) {
5136
scope.options = [
5237
{
53-
label: 'Basic',
54-
href: '#/basic'
55-
},
56-
{
57-
label: 'Filter',
58-
href: '#/filter'
38+
label: 'Table & Filter',
39+
href: '#/table'
5940
},
6041
{
6142
label: 'List Tree',
6243
href: '#/list'
6344
},
6445
{
65-
label: 'Multi',
46+
label: 'Advanced',
6647
href: '#/multi'
6748
},
49+
{
50+
label: 'Events',
51+
href: '#/event'
52+
},
6853
{
6954

70-
label: 'Custom Options',
71-
href: '#/custom-options'
55+
label: 'Custom',
56+
href: '#/custom'
7257
},
7358
{
7459
label: 'Github',
@@ -87,14 +72,13 @@ app = angular.module('TreeDnDTest', deps)
8772
);
8873
}
8974
};
90-
}
91-
).directive(
92-
'panel', function () {
75+
})
76+
.directive('panel', function () {
9377
return {
94-
restrict: 'E',
95-
scope: true,
96-
replace: true,
97-
template: '<div class="panel" ng-class="\'panel-\' + type">' +
78+
restrict: 'E',
79+
scope: true,
80+
replace: true,
81+
template: '<div class="panel" ng-class="\'panel-\' + type">' +
9882
' <div ng-if="title && title.length > 0" class="panel-heading">' +
9983
' <h3 class="panel-title">{{ title }}</h3>' +
10084
' </div>' +
@@ -103,44 +87,52 @@ app = angular.module('TreeDnDTest', deps)
10387
transclude: true,
10488
link: function fnPost(scope, element, attrs) {
10589
scope.title = attrs.title || '';
106-
scope.type = attrs.type || 'info';
90+
scope.type = attrs.type || 'info';
10791
}
10892
};
109-
}
110-
).directive(
111-
'showCode', [
112-
'$compile', '$timeout', function ($compile, $timeout) {
113-
return {
114-
restrict: 'E',
115-
replace: true,
116-
link: function (scope, element, attr) {
117-
var _temp =
118-
[
119-
'<pre class="line-numbers">',
120-
'<code class="language-' + (attr.type || 'markup') + '">',
121-
'{{ data }}',
122-
'</code>',
123-
'</pre>'].join('')
124-
;
125-
scope.data = '';
93+
})
94+
.directive('showCode', ['$compile', '$timeout', function ($compile, $timeout) {
95+
return {
96+
restrict: 'E',
97+
replace: true,
98+
link: function (scope, element, attr) {
99+
var _temp =
100+
[
101+
'<pre class="line-numbers">',
102+
'<code class="language-' + (attr.type || 'markup') + '">',
103+
'{{ data }}',
104+
'</code>',
105+
'</pre>'].join('')
106+
;
107+
scope.data = '';
126108

127-
scope.$watch(
128-
attr.source, function (val) {
129-
if (val) {
130-
scope.data = val;
131-
element.html('');
132-
element.append($compile(_temp)(scope));
133-
$timeout(Prism.highlightAll, 0);
134-
}
135-
}, true
136-
);
137-
}
138-
};
139-
}]
140-
).factory(
141-
'DataDemo', function () {
109+
scope.$watch(
110+
attr.source, function (val) {
111+
if (val) {
112+
scope.data = val;
113+
element.html('');
114+
element.append($compile(_temp)(scope));
115+
$timeout(Prism.highlightAll, 0);
116+
}
117+
}, true
118+
);
119+
}
120+
};
121+
}])
122+
.directive('staticInclude', function ($http, $templateCache, $compile) {
123+
return function (scope, element, attrs) {
124+
var templatePath = attrs.staticInclude;
125+
$http.get(templatePath, {cache: $templateCache}).success(function (response) {
126+
var contents = element.html(response).contents();
127+
// console.log(contents);
128+
element.replaceWith(contents);
129+
$compile(contents)(scope);
130+
});
131+
};
132+
})
133+
.factory('DataDemo', function () {
142134
return {
143-
getDatas: function () {
135+
getDatas: function () {
144136
return [
145137
{
146138
'DemographicId': 1,
@@ -302,29 +294,29 @@ app = angular.module('TreeDnDTest', deps)
302294
}
303295

304296
console.time('Generate_BigData');
305-
var data = [], opt = {
297+
var data = [], opt = {
306298
amount: 0,
307299
deptMax: deptMax,
308300
limit: number
309301
}, patern,
310-
fnGenerate = fn || function (parent, cloned, _opt) {
311-
'use strict';
312-
var keyO = Object.keys(cloned),
313-
lenO = keyO.length;
314-
if (keyParent) {
315-
cloned[keyParent] = parent && parent[keyId] || null;
316-
}
302+
fnGenerate = fn || function (parent, cloned, _opt) {
303+
'use strict';
304+
var keyO = Object.keys(cloned),
305+
lenO = keyO.length;
306+
if (keyParent) {
307+
cloned[keyParent] = parent && parent[keyId] || null;
308+
}
317309

318-
cloned[keyId] = _opt.amount;
310+
cloned[keyId] = _opt.amount;
319311

320-
for (var i = 0; i < lenO; i++) {
321-
if (keyO[i] !== keyParent && keyO[i] !== keyId) {
322-
cloned[keyO[i]] += '#' + _opt.amount;
323-
}
312+
for (var i = 0; i < lenO; i++) {
313+
if (keyO[i] !== keyParent && keyO[i] !== keyId) {
314+
cloned[keyO[i]] += '#' + _opt.amount;
324315
}
316+
}
325317

326-
return cloned;
327-
};
318+
return cloned;
319+
};
328320

329321

330322
while (opt.amount < number) {
@@ -337,5 +329,4 @@ app = angular.module('TreeDnDTest', deps)
337329
return data;
338330
}
339331
}
340-
}
341-
);
332+
});

demo/basic/basic-frame.html

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)