from gitlab
This commit is contained in:
20
common/resources/lib/angular/treeview/LICENSE
Normal file
20
common/resources/lib/angular/treeview/LICENSE
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Steve
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
95
common/resources/lib/angular/treeview/angular.treeview.js
Normal file
95
common/resources/lib/angular/treeview/angular.treeview.js
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
@license Angular Treeview version 0.1.6
|
||||
ⓒ 2013 AHN JAE-HA http://github.com/eu81273/angular.treeview
|
||||
License: MIT
|
||||
|
||||
|
||||
[TREE attribute]
|
||||
angular-treeview: the treeview directive
|
||||
tree-id : each tree's unique id.
|
||||
tree-model : the tree model on $scope.
|
||||
node-id : each node's id
|
||||
node-label : each node's label
|
||||
node-children: each node's children
|
||||
|
||||
<div
|
||||
data-angular-treeview="true"
|
||||
data-tree-id="tree"
|
||||
data-tree-model="roleList"
|
||||
data-node-id="roleId"
|
||||
data-node-label="roleName"
|
||||
data-node-children="children" >
|
||||
</div>
|
||||
*/
|
||||
|
||||
(function ( angular ) {
|
||||
'use strict';
|
||||
|
||||
angular.module( 'angularTreeview', [] ).directive( 'treeModel', ['$compile', function( $compile ) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function ( scope, element, attrs ) {
|
||||
//tree id
|
||||
var treeId = attrs.treeId;
|
||||
|
||||
//tree model
|
||||
var treeModel = attrs.treeModel;
|
||||
|
||||
//node id
|
||||
var nodeId = attrs.nodeId || 'id';
|
||||
|
||||
//node label
|
||||
var nodeLabel = attrs.nodeLabel || 'label';
|
||||
|
||||
//children
|
||||
var nodeChildren = attrs.nodeChildren || 'children';
|
||||
|
||||
//tree template
|
||||
var template =
|
||||
'<ul>' +
|
||||
'<li data-ng-repeat="node in ' + treeModel + '">' +
|
||||
'<i ng-class="getGroupClass(node)" data-ng-click="' + treeId + '.selectNodeHead(node)"></i>' +
|
||||
'<span data-ng-class="getSelectedClass(node)" ng-dblclick="edit(node)" data-ng-click="' + treeId + '.selectNodeLabel(node)">{{node.' + nodeLabel + '}}</span>' +
|
||||
'<div data-ng-hide="node.collapsed" data-tree-id="' + treeId + '" data-tree-model="node.' + nodeChildren + '" data-node-id=' + nodeId + ' data-node-label=' + nodeLabel + ' data-node-children=' + nodeChildren + '></div>' +
|
||||
'</li>' +
|
||||
'</ul>';
|
||||
|
||||
//check tree id, tree model
|
||||
if( treeId && treeModel ) {
|
||||
//root node
|
||||
if( attrs.angularTreeview ) {
|
||||
|
||||
//create tree object if not exists
|
||||
scope[treeId] = scope[treeId] || {};
|
||||
|
||||
//if node head clicks,
|
||||
scope[treeId].selectNodeHead = scope[treeId].selectNodeHead || function( selectedNode ){
|
||||
|
||||
//Collapse or Expand
|
||||
selectedNode.collapsed = !selectedNode.collapsed;
|
||||
scope[treeId].selectNodeLabel(selectedNode);
|
||||
};
|
||||
|
||||
//if node label clicks,
|
||||
scope[treeId].selectNodeLabel = scope[treeId].selectNodeLabel || function( selectedNode ){
|
||||
|
||||
//remove highlight from previous node
|
||||
if( scope[treeId].currentNode && scope[treeId].currentNode.selected ) {
|
||||
scope[treeId].currentNode.selected = undefined;
|
||||
}
|
||||
|
||||
//set highlight to selected node
|
||||
selectedNode.selected = 'selected';
|
||||
|
||||
//set currentNode
|
||||
scope[treeId].currentNode = selectedNode;
|
||||
};
|
||||
}
|
||||
|
||||
//Rendering template.
|
||||
element.html('').append( $compile( template )( scope ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
}]);
|
||||
})( angular );
|
9
common/resources/lib/angular/treeview/angular.treeview.min.js
vendored
Normal file
9
common/resources/lib/angular/treeview/angular.treeview.min.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
@license Angular Treeview version 0.1.6
|
||||
ⓒ 2013 AHN JAE-HA http://github.com/eu81273/angular.treeview
|
||||
License: MIT
|
||||
*/
|
||||
|
||||
(function(f){f.module("angularTreeview",[]).directive("treeModel",function($compile){return{restrict:"A",link:function(b,h,c){var a=c.treeId,g=c.treeModel,e=c.nodeLabel||"label",d=c.nodeChildren||"children",e='<ul><li data-ng-repeat="node in '+g+'"><i class="collapsed" data-ng-show="node.'+d+'.length && node.collapsed" data-ng-click="'+a+'.selectNodeHead(node)"></i><i class="expanded" data-ng-show="node.'+d+'.length && !node.collapsed" data-ng-click="'+a+'.selectNodeHead(node)"></i><i class="normal" data-ng-hide="node.'+
|
||||
d+'.length"></i> <span data-ng-class="node.selected" data-ng-click="'+a+'.selectNodeLabel(node)">{{node.'+e+'}}</span><div data-ng-hide="node.collapsed" data-tree-id="'+a+'" data-tree-model="node.'+d+'" data-node-id='+(c.nodeId||"id")+" data-node-label="+e+" data-node-children="+d+"></div></li></ul>";a&&g&&(c.angularTreeview&&(b[a]=b[a]||{},b[a].selectNodeHead=b[a].selectNodeHead||function(a){a.collapsed=!a.collapsed},b[a].selectNodeLabel=b[a].selectNodeLabel||function(c){b[a].currentNode&&b[a].currentNode.selected&&
|
||||
(b[a].currentNode.selected=void 0);c.selected="selected";b[a].currentNode=c}),h.html('').append($compile(e)(b)))}}})})(angular);
|
@ -0,0 +1,99 @@
|
||||
div[angular-treeview] {
|
||||
/* prevent user selection */
|
||||
-moz-user-select: -moz-none;
|
||||
-khtml-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
/* default */
|
||||
font-family: Tahoma;
|
||||
font-size:13px;
|
||||
color: #555;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div[tree-model] ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div[tree-model] li {
|
||||
position: relative;
|
||||
padding: 0 0 0 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
div[tree-model] li .expanded {
|
||||
padding: 1px 10px;
|
||||
background-image: url("../img/folder.png");
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
div[tree-model] li .collapsed {
|
||||
padding: 1px 10px;
|
||||
background-image: url("../img/folder-closed.png");
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
div[tree-model] li .normal {
|
||||
padding: 1px 10px;
|
||||
background-image: url("../img/file.png");
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
div[tree-model] li i, div[tree-model] li span {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div[tree-model] li .selected {
|
||||
background-color: #aaddff;
|
||||
font-weight: bold;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
|
||||
div[tree-model] li .cut {
|
||||
font-weight: bold;
|
||||
color: gray
|
||||
}
|
||||
|
||||
/*
|
||||
.angular-ui-tree-handle {
|
||||
cursor: grab;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
min-height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
*/
|
||||
|
||||
.angular-ui-tree-handle {
|
||||
/* background: #f8faff; */
|
||||
/*
|
||||
color: #7c9eb2; */
|
||||
border: 1px solid #dae2ea;
|
||||
padding: 10px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.expanded-folder {
|
||||
padding: 1px 10px;
|
||||
background-image: url("../img/folder.png");
|
||||
background-repeat: no-repeat;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.collapsed-folder {
|
||||
padding: 1px 10px;
|
||||
background-image: url("../img/folder-closed.png");
|
||||
background-repeat: no-repeat;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
BIN
common/resources/lib/angular/treeview/img/file.png
Normal file
BIN
common/resources/lib/angular/treeview/img/file.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 263 B |
BIN
common/resources/lib/angular/treeview/img/folder-closed.png
Normal file
BIN
common/resources/lib/angular/treeview/img/folder-closed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 281 B |
BIN
common/resources/lib/angular/treeview/img/folder.png
Normal file
BIN
common/resources/lib/angular/treeview/img/folder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 289 B |
Reference in New Issue
Block a user