mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-18 16:30:13 +01:00
feat(components): add tree view component
This commit is contained in:
parent
1c10938efe
commit
2e0fa1f4ed
11 changed files with 121 additions and 23 deletions
|
|
@ -43,7 +43,7 @@
|
||||||
"ng2-bootstrap": "1.1.16-11",
|
"ng2-bootstrap": "1.1.16-11",
|
||||||
"ng2-ckeditor": "1.1.5",
|
"ng2-ckeditor": "1.1.5",
|
||||||
"ng2-smart-table": "^0.3.2",
|
"ng2-smart-table": "^0.3.2",
|
||||||
"ng2-tree": "^0.0.2-7",
|
"ng2-tree": "^2.0.0-alpha.0",
|
||||||
"ngx-uploader": "^2.0.24",
|
"ngx-uploader": "^2.0.24",
|
||||||
"normalize.css": "^4.1.1",
|
"normalize.css": "^4.1.1",
|
||||||
"reflect-metadata": "^0.1.9",
|
"reflect-metadata": "^0.1.9",
|
||||||
|
|
|
||||||
12
src/app/pages/components/components.component.ts
Normal file
12
src/app/pages/components/components.component.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'components',
|
||||||
|
template: `<router-outlet></router-outlet>`
|
||||||
|
})
|
||||||
|
export class Components {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
24
src/app/pages/components/components.module.ts
Normal file
24
src/app/pages/components/components.module.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { NgaModule } from '../../theme/nga.module';
|
||||||
|
import { TreeModule } from 'ng2-tree';
|
||||||
|
|
||||||
|
import { routing } from './components.routing';
|
||||||
|
import { Components } from './components.component';
|
||||||
|
import { TreeView } from './components/treeView/treeView.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
NgaModule,
|
||||||
|
TreeModule,
|
||||||
|
routing
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
Components,
|
||||||
|
TreeView,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ComponentsModule {}
|
||||||
17
src/app/pages/components/components.routing.ts
Normal file
17
src/app/pages/components/components.routing.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { Components } from './components.component';
|
||||||
|
import { TreeView } from './components/treeView/treeView.component';
|
||||||
|
|
||||||
|
// noinspection TypeScriptValidateTypes
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: Components,
|
||||||
|
children: [
|
||||||
|
{ path: 'treeview', component: TreeView }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export const routing = RouterModule.forChild(routes);
|
||||||
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,36 @@
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
import {TreeModel} from 'ng2-tree';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'tree-view',
|
||||||
|
templateUrl: './treeView.html',
|
||||||
|
})
|
||||||
|
|
||||||
|
export class TreeView {
|
||||||
|
|
||||||
|
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'},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<div class="col-md-6">
|
||||||
|
<ba-card title="basic">
|
||||||
|
<tree id="tree-view" [tree]="tree"></tree>
|
||||||
|
</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';
|
||||||
|
|
@ -36,28 +36,28 @@ export const PAGES_MENU = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'components',
|
path: 'components',
|
||||||
// data: {
|
data: {
|
||||||
// menu: {
|
menu: {
|
||||||
// title: 'Components',
|
title: 'Components',
|
||||||
// icon: 'ion-gear-a',
|
icon: 'ion-gear-a',
|
||||||
// selected: false,
|
selected: false,
|
||||||
// expanded: false,
|
expanded: false,
|
||||||
// order: 250,
|
order: 250,
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'treeview',
|
path: 'treeview',
|
||||||
// data: {
|
data: {
|
||||||
// menu: {
|
menu: {
|
||||||
// title: 'Tree View',
|
title: 'Tree View',
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'charts',
|
path: 'charts',
|
||||||
data: {
|
data: {
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ export const routes: Routes = [
|
||||||
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
|
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
|
||||||
{ path: 'dashboard', loadChildren: 'app/pages/dashboard/dashboard.module#DashboardModule' },
|
{ path: 'dashboard', loadChildren: 'app/pages/dashboard/dashboard.module#DashboardModule' },
|
||||||
{ path: 'editors', loadChildren: 'app/pages/editors/editors.module#EditorsModule' },
|
{ path: 'editors', loadChildren: 'app/pages/editors/editors.module#EditorsModule' },
|
||||||
|
{ path: 'components', loadChildren: 'app/pages/components/components.module#ComponentsModule' },
|
||||||
{ path: 'charts', loadChildren: 'app/pages/charts/charts.module#ChartsModule' },
|
{ path: 'charts', loadChildren: 'app/pages/charts/charts.module#ChartsModule' },
|
||||||
{ path: 'ui', loadChildren: 'app/pages/ui/ui.module#UiModule' },
|
{ path: 'ui', loadChildren: 'app/pages/ui/ui.module#UiModule' },
|
||||||
{ path: 'forms', loadChildren: 'app/pages/forms/forms.module#FormsModule' },
|
{ path: 'forms', loadChildren: 'app/pages/forms/forms.module#FormsModule' },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue