-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14025 from siddhareddy/treetable-size-gridlines-docs
Treetable: size,gridlines documentation
- Loading branch information
Showing
4 changed files
with
278 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { Component, Input, OnInit, ViewChild } from '@angular/core'; | ||
import { TreeNode } from 'primeng/api'; | ||
import { Code } from '../../domain/code'; | ||
import { AppDocSectionTextComponent } from '../../layout/doc/docsectiontext/app.docsectiontext.component'; | ||
import { NodeService } from '../../service/nodeservice'; | ||
|
||
@Component({ | ||
selector: 'gridlines-doc', | ||
template: ` <section class="py-4"> | ||
<app-docsectiontext [title]="title" [id]="id" [level]="3" #docsectiontext> | ||
<p>Adding <i>p-treetable-gridlines</i> class displays grid lines.</p> | ||
</app-docsectiontext> | ||
<div class="card"> | ||
<p-treeTable [value]="files" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }" styleClass="p-treetable-gridlines"> | ||
<ng-template pTemplate="header"> | ||
<tr> | ||
<th>Name</th> | ||
<th>Size</th> | ||
<th>Type</th> | ||
</tr> | ||
</ng-template> | ||
<ng-template pTemplate="body" let-rowNode let-rowData="rowData"> | ||
<tr [ttRow]="rowNode"> | ||
<td> | ||
<p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler> | ||
{{ rowData.name }} | ||
</td> | ||
<td>{{ rowData.size }}</td> | ||
<td>{{ rowData.type }}</td> | ||
</tr> | ||
</ng-template> | ||
</p-treeTable> | ||
</div> | ||
<app-code [code]="code" selector="tree-table-basic-demo"></app-code> | ||
</section>` | ||
}) | ||
export class GridlinesDoc implements OnInit { | ||
@Input() id: string; | ||
|
||
@Input() title: string; | ||
|
||
@ViewChild('docsectiontext', { static: true }) docsectiontext: AppDocSectionTextComponent; | ||
|
||
files!: TreeNode[]; | ||
|
||
constructor(private nodeService: NodeService) {} | ||
|
||
ngOnInit() { | ||
this.nodeService.getFilesystem().then((files) => (this.files = files)); | ||
} | ||
|
||
code: Code = { | ||
basic: ` | ||
<p-treeTable [value]="files" [scrollable]="true" [tableStyle]="{'min-width':'50rem'}" styleClass="p-treetable-gridlines"> | ||
<ng-template pTemplate="header"> | ||
<tr> | ||
<th>Name</th> | ||
<th>Size</th> | ||
<th>Type</th> | ||
</tr> | ||
</ng-template> | ||
<ng-template pTemplate="body" let-rowNode let-rowData="rowData"> | ||
<tr [ttRow]="rowNode"> | ||
<td> | ||
<p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler> | ||
{{ rowData.name }} | ||
</td> | ||
<td>{{ rowData.size }}</td> | ||
<td>{{ rowData.type }}</td> | ||
</tr> | ||
</ng-template> | ||
</p-treeTable>`, | ||
|
||
html: ` | ||
<div class="card"> | ||
<p-treeTable [value]="files" [scrollable]="true" [tableStyle]="{'min-width':'50rem'}"> | ||
<ng-template pTemplate="header"> | ||
<tr> | ||
<th>Name</th> | ||
<th>Size</th> | ||
<th>Type</th> | ||
</tr> | ||
</ng-template> | ||
<ng-template pTemplate="body" let-rowNode let-rowData="rowData"> | ||
<tr [ttRow]="rowNode"> | ||
<td> | ||
<p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler> | ||
{{ rowData.name }} | ||
</td> | ||
<td>{{ rowData.size }}</td> | ||
<td>{{ rowData.type }}</td> | ||
</tr> | ||
</ng-template> | ||
</p-treeTable> | ||
</div>`, | ||
|
||
typescript: ` | ||
import { Component, OnInit } from '@angular/core'; | ||
import { TreeNode } from 'primeng/api'; | ||
import { NodeService } from '../../service/nodeservice'; | ||
@Component({ | ||
selector: 'tree-table-gridlines-demo', | ||
templateUrl: './tree-table-gridlines-demo.html' | ||
}) | ||
export class TreeTableGridlinesDemo implements OnInit { | ||
files!: TreeNode[]; | ||
constructor(private nodeService: NodeService) {} | ||
ngOnInit() { | ||
this.nodeService.getFilesystem().then((files) => (this.files = files)); | ||
} | ||
}`, | ||
|
||
service: ['NodeService'] | ||
}; | ||
} |
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,143 @@ | ||
import { Component, Input, OnInit, ViewChild } from '@angular/core'; | ||
import { TreeNode } from 'primeng/api'; | ||
import { Code } from '../../domain/code'; | ||
import { AppDocSectionTextComponent } from '../../layout/doc/docsectiontext/app.docsectiontext.component'; | ||
import { NodeService } from '../../service/nodeservice'; | ||
|
||
@Component({ | ||
selector: 'size-doc', | ||
template: ` <section class="py-4"> | ||
<app-docsectiontext [title]="title" [id]="id" [level]="3" #docsectiontext> | ||
<p>In addition to a regular treetable, alternatives with alternative sizes are available. Add <i>p-treetable-sm</i> class to reduce the size of treetable or <i>p-treetable-lg</i> to enlarge it. </p> | ||
</app-docsectiontext> | ||
<div class="card"> | ||
<div class="flex justify-content-center mb-3"> | ||
<p-selectButton [options]="sizes" [(ngModel)]="selectedSize" [multiple]="false" optionLabel="name" optionValue="class"></p-selectButton> | ||
</div> | ||
<p-treeTable [value]="files" [scrollable]="true" [tableStyle]="{ 'min-width': '50rem' }" [styleClass]="selectedSize"> | ||
<ng-template pTemplate="header"> | ||
<tr> | ||
<th>Name</th> | ||
<th>Size</th> | ||
<th>Type</th> | ||
</tr> | ||
</ng-template> | ||
<ng-template pTemplate="body" let-rowNode let-rowData="rowData"> | ||
<tr [ttRow]="rowNode"> | ||
<td> | ||
<p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler> | ||
{{ rowData.name }} | ||
</td> | ||
<td>{{ rowData.size }}</td> | ||
<td>{{ rowData.type }}</td> | ||
</tr> | ||
</ng-template> | ||
</p-treeTable> | ||
</div> | ||
<app-code [code]="code" selector="tree-table-basic-demo"></app-code> | ||
</section>` | ||
}) | ||
export class SizeDoc implements OnInit { | ||
@Input() id: string; | ||
|
||
@Input() title: string; | ||
|
||
@ViewChild('docsectiontext', { static: true }) docsectiontext: AppDocSectionTextComponent; | ||
|
||
files!: TreeNode[]; | ||
|
||
sizes!: any[]; | ||
|
||
selectedSize: any = ''; | ||
|
||
constructor(private nodeService: NodeService) {} | ||
|
||
ngOnInit() { | ||
this.nodeService.getFilesystem().then((files) => (this.files = files)); | ||
|
||
this.sizes = [ | ||
{ name: 'Small', class: 'p-treetable-sm' }, | ||
{ name: 'Normal', class: '' }, | ||
{ name: 'Large', class: 'p-treetable-lg' } | ||
]; | ||
} | ||
|
||
code: Code = { | ||
basic: ` | ||
<div class="flex justify-content-center mb-3"> | ||
<p-selectButton [options]="sizes" [(ngModel)]="selectedSize" [multiple]="false" optionLabel="name" optionValue="class"></p-selectButton> | ||
</div> | ||
<p-treeTable [value]="files" [scrollable]="true" [tableStyle]="{'min-width':'50rem'}" [styleClass]="selectedSize"> | ||
<ng-template pTemplate="header"> | ||
<tr> | ||
<th>Name</th> | ||
<th>Size</th> | ||
<th>Type</th> | ||
</tr> | ||
</ng-template> | ||
<ng-template pTemplate="body" let-rowNode let-rowData="rowData"> | ||
<tr [ttRow]="rowNode"> | ||
<td> | ||
<p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler> | ||
{{ rowData.name }} | ||
</td> | ||
<td>{{ rowData.size }}</td> | ||
<td>{{ rowData.type }}</td> | ||
</tr> | ||
</ng-template> | ||
</p-treeTable>`, | ||
|
||
html: ` | ||
<div class="card"> | ||
<p-treeTable [value]="files" [scrollable]="true" [tableStyle]="{'min-width':'50rem'}" [styleClass]="selectedSize"> | ||
<ng-template pTemplate="header"> | ||
<tr> | ||
<th>Name</th> | ||
<th>Size</th> | ||
<th>Type</th> | ||
</tr> | ||
</ng-template> | ||
<ng-template pTemplate="body" let-rowNode let-rowData="rowData"> | ||
<tr [ttRow]="rowNode"> | ||
<td> | ||
<p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler> | ||
{{ rowData.name }} | ||
</td> | ||
<td>{{ rowData.size }}</td> | ||
<td>{{ rowData.type }}</td> | ||
</tr> | ||
</ng-template> | ||
</p-treeTable> | ||
</div>`, | ||
|
||
typescript: ` | ||
import { Component, OnInit } from '@angular/core'; | ||
import { TreeNode } from 'primeng/api'; | ||
import { NodeService } from '../../service/nodeservice'; | ||
@Component({ | ||
selector: 'tree-table-size-demo', | ||
templateUrl: './tree-table-size-demo.html' | ||
}) | ||
export class TreeTableSizeDemo implements OnInit { | ||
files!: TreeNode[]; | ||
sizes!: any[]; | ||
selectedSize: any = ''; | ||
constructor(private nodeService: NodeService) {} | ||
ngOnInit() { | ||
this.nodeService.getFilesystem().then((files) => (this.files = files)); | ||
this.sizes = [ | ||
{ name: 'Small', class: 'p-treetable-sm' }, | ||
{ name: 'Normal', class: '' }, | ||
{ name: 'Large', class: 'p-treetable-lg' } | ||
]; | ||
} | ||
}`, | ||
|
||
service: ['NodeService'] | ||
}; | ||
} |
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