mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-18 00:10:14 +01:00
feat(app\components): create tree view component
This commit is contained in:
parent
77320b1f4b
commit
4dfd7e8c28
9 changed files with 99 additions and 0 deletions
|
|
@ -36,6 +36,7 @@
|
||||||
"leaflet-map": "^0.2.1",
|
"leaflet-map": "^0.2.1",
|
||||||
"lodash": "^4.12.0",
|
"lodash": "^4.12.0",
|
||||||
"ng2-bootstrap": "^1.0.16",
|
"ng2-bootstrap": "^1.0.16",
|
||||||
|
"ng2-branchy": "0.0.2-2",
|
||||||
"ng2-ckeditor": "^1.0.3",
|
"ng2-ckeditor": "^1.0.3",
|
||||||
"ng2-uploader": "^0.5.2",
|
"ng2-uploader": "^0.5.2",
|
||||||
"normalize.css": "^4.1.1",
|
"normalize.css": "^4.1.1",
|
||||||
|
|
|
||||||
25
src/app/pages/components/components.component.ts
Normal file
25
src/app/pages/components/components.component.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
import {RouteConfig} from '@angular/router-deprecated';
|
||||||
|
import {TreeView} from "./components/treeView";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'components',
|
||||||
|
pipes: [],
|
||||||
|
providers: [],
|
||||||
|
styles: [],
|
||||||
|
template: `<router-outlet></router-outlet>`
|
||||||
|
})
|
||||||
|
@RouteConfig([
|
||||||
|
{
|
||||||
|
name: 'TreeView',
|
||||||
|
component: TreeView,
|
||||||
|
path: '/tree-view',
|
||||||
|
useAsDefault: true
|
||||||
|
}
|
||||||
|
])
|
||||||
|
export class Components {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
1
src/app/pages/components/components.scss
Normal file
1
src/app/pages/components/components.scss
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
@import '../../theme/sass/treeView';
|
||||||
1
src/app/pages/components/components/treeView/index.ts
Normal file
1
src/app/pages/components/components/treeView/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './treeView.component';
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
import {BranchyComponent, TreeModel} from 'ng2-branchy';
|
||||||
|
import {BaCard} from "../../../../theme/components/baCard/baCard.component";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'tree-view',
|
||||||
|
directives: [BranchyComponent, BaCard],
|
||||||
|
template: require('./treeView.html'),
|
||||||
|
})
|
||||||
|
|
||||||
|
export class TreeView {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
private tree: TreeModel = {
|
||||||
|
value: 'Programming languages by programming paradigm',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
value: 'Object-oriented programming',
|
||||||
|
children: [
|
||||||
|
{value: 'Java'},
|
||||||
|
{value: 'C++'},
|
||||||
|
{value: 'C#'},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'Prototype-based programming',
|
||||||
|
children: [
|
||||||
|
{value: 'JavaScript'},
|
||||||
|
{value: 'CoffeeScript'},
|
||||||
|
{value: 'Lua'},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<div class="col-md-6">
|
||||||
|
<ba-card title="basic">
|
||||||
|
<branchy id="tree-view" [tree]="tree"></branchy>
|
||||||
|
</ba-card>
|
||||||
|
</div>
|
||||||
1
src/app/pages/components/index.ts
Normal file
1
src/app/pages/components/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './components.component';
|
||||||
27
src/app/theme/sass/_treeView.scss
Normal file
27
src/app/theme/sass/_treeView.scss
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#tree-view .tree {
|
||||||
|
& .node-value {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
& .folding {
|
||||||
|
&.node-expanded::before {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
&.node-collapsed::before {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
&.node-leaf::before {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
& .over-drop-target {
|
||||||
|
border: 4px solid ghostwhite;
|
||||||
|
}
|
||||||
|
& .node-value{
|
||||||
|
& .node-selected::after {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
&:after {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,3 +8,4 @@
|
||||||
@import "sass/socicon";
|
@import "sass/socicon";
|
||||||
@import "sass/table";
|
@import "sass/table";
|
||||||
@import "sass/form";
|
@import "sass/form";
|
||||||
|
@import "sass/treeView";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue