-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
614999c
commit c37a2a1
Showing
109 changed files
with
2,464 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
projects/docs-app/src/app/examples/basic-usage/basic-tree/basic-tree.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<tree-root [nodes]="nodes"></tree-root> |
Empty file.
25 changes: 25 additions & 0 deletions
25
projects/docs-app/src/app/examples/basic-usage/basic-tree/basic-tree.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { BasicTreeComponent } from './basic-tree.component'; | ||
|
||
describe('BasicTreeComponent', () => { | ||
let component: BasicTreeComponent; | ||
let fixture: ComponentFixture<BasicTreeComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ BasicTreeComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(BasicTreeComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
projects/docs-app/src/app/examples/basic-usage/basic-tree/basic-tree.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-basic-tree', | ||
templateUrl: './basic-tree.component.html', | ||
styleUrls: ['./basic-tree.component.scss'] | ||
}) | ||
export class BasicTreeComponent { | ||
|
||
nodes = [ | ||
{ | ||
name: 'root1', | ||
children: [ | ||
{ name: 'child1' }, | ||
{ name: 'child2' } | ||
] | ||
}, | ||
{ | ||
name: 'root2', | ||
children: [ | ||
{ name: 'child2.1', children: [] }, | ||
{ name: 'child2.2', children: [ | ||
{name: 'grandchild2.2.1'} | ||
] } | ||
] | ||
}, | ||
{ name: 'root3' }, | ||
{ name: 'root4', children: [] }, | ||
{ name: 'root5', children: null } | ||
]; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
projects/docs-app/src/app/examples/columns-example/columns-example.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<h1>Tree with columns</h1> | ||
|
||
<h2>Working tree</h2> | ||
|
||
<div class="demo-container"> | ||
<app-columns></app-columns> | ||
</div> | ||
|
||
<h2>How to implement</h2> | ||
|
||
<p>To create columns inside the tree we need to use the templating options of the tree and style them with css.</p> | ||
<p> | ||
The example component contains two parts. The header and the tree itself. The header is responsible for displaying the column header. | ||
This is needed to give the tree the grid style. If you just want the tree to have columns without any header you don't need to build a header. | ||
</p> | ||
|
||
<h3>#treeNodeWrapperTemplate</h3> | ||
<p> | ||
To show the tree in columns it's not needed to use the full templating option. But at least the <code>treeNodeWrapperTemplate</code> is needed. | ||
See also the <a [routerLink]="['/', 'fundamentals', 'templates']">Template Fundamentals</a>. | ||
</p> | ||
|
||
<h3>Column definition</h3> | ||
<p> | ||
The example uses a simple array <code>columns = ['city', 'zipCode']</code> to handle the columns. | ||
This array includes the property names that should be shown as columns and does not include the name, which is the first column. | ||
The name is handled differently as seen in the example. The columns array is just looped over and shown. | ||
In a more advanced example you could have the columns array as an input and also handle the name dynamically. | ||
</p> |
Empty file.
25 changes: 25 additions & 0 deletions
25
projects/docs-app/src/app/examples/columns-example/columns-example.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ColumnsExampleComponent } from './columns-example.component'; | ||
|
||
describe('ColumnsExampleComponent', () => { | ||
let component: ColumnsExampleComponent; | ||
let fixture: ComponentFixture<ColumnsExampleComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ColumnsExampleComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ColumnsExampleComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
projects/docs-app/src/app/examples/columns-example/columns-example.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-columns-example', | ||
templateUrl: './columns-example.component.html', | ||
styleUrls: ['./columns-example.component.scss'] | ||
}) | ||
export class ColumnsExampleComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
projects/docs-app/src/app/examples/columns-example/columns/columns.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<div class="base-tree-container"> | ||
<div #treeHeader class="tree-header"> | ||
<div class="tree-column tree-header-column"><span>Company name</span></div> | ||
<div | ||
*ngFor="let columnName of columns" | ||
class="tree-column tree-header-column"> | ||
<span>{{ columnName }}</span> | ||
</div> | ||
</div> | ||
<div class="tree-wrapper"> | ||
<tree-root | ||
#tree | ||
[options]="options" | ||
[nodes]="nodes"> | ||
<!-- Node wrapper template to control wrapper classes and cursor behaviour --> | ||
<ng-template #treeNodeWrapperTemplate let-node let-index="index"> | ||
<div class="tree-node-wrapper no-pointer"> | ||
<tree-node-expander [node]="node"></tree-node-expander> | ||
<div class="node-content-wrapper pointer" | ||
[class.node-content-wrapper-active]="node.isActive" | ||
[class.node-content-wrapper-focused]="node.isFocused" | ||
(click)="node.mouseAction('click', $event)" | ||
(dblclick)="node.mouseAction('dblClick', $event)" | ||
(contextmenu)="node.mouseAction('contextMenu', $event)" | ||
(treeDrop)="node.onDrop($event)" | ||
[treeAllowDrop]="node.allowDrop" | ||
[treeDrag]="node" | ||
[treeDragEnabled]="node.allowDrag()"> | ||
|
||
<div class="tree-column-wrapper"> | ||
<div class="tree-column" [title]="node.data.name"> | ||
<span>{{ node.data.name }}</span> | ||
</div> | ||
<div | ||
*ngFor="let columnName of columns" | ||
class="tree-column" | ||
[title]="node.data[columnName]"> | ||
<span>{{node.data[columnName]}}</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</ng-template> | ||
</tree-root> | ||
</div> | ||
</div> |
Oops, something went wrong.