-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toolbar: Accept documented template names #13814
- Loading branch information
Showing
4 changed files
with
144 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
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,134 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { MenuItem } from 'primeng/api'; | ||
import { Code } from '../../domain/code'; | ||
|
||
@Component({ | ||
selector: 'template-doc', | ||
template: ` <section class="py-3"> | ||
<app-docsectiontext [title]="title" [id]="id"></app-docsectiontext> | ||
<div class="card"> | ||
<p-toolbar> | ||
<ng-template pTemplate="start"> | ||
<p-button label="New" icon="pi pi-plus" class="mr-2"></p-button> | ||
<p-button label="Upload" icon="pi pi-upload" styleClass="p-button-success"></p-button> | ||
<i class="p-toolbar-separator pi pi-bars mr-2" style="vertical-align: middle"></i> | ||
<p-splitButton label="Save" icon="pi pi-check" [model]="items" styleClass="p-button-warning"></p-splitButton> | ||
</ng-template> | ||
<ng-template pTemplate="center"> | ||
<span class="text-primary font-semibold text-xl">Center</span> | ||
</ng-template> | ||
<ng-template pTemplate="end"> | ||
<p-button icon="pi pi-search" class="mr-2"></p-button> | ||
<p-button icon="pi pi-calendar" styleClass="p-button-success mr-2"></p-button> | ||
<p-button icon="pi pi-times" styleClass="p-button-danger"></p-button> | ||
</ng-template> | ||
</p-toolbar> | ||
</div> | ||
<app-code [code]="code" selector="toolbar-template-demo"></app-code> | ||
</section>` | ||
}) | ||
export class TemplateDoc implements OnInit { | ||
@Input() id: string; | ||
|
||
@Input() title: string; | ||
|
||
items: MenuItem[] | undefined; | ||
|
||
ngOnInit() { | ||
this.items = [ | ||
{ | ||
label: 'Update', | ||
icon: 'pi pi-refresh' | ||
}, | ||
{ | ||
label: 'Delete', | ||
icon: 'pi pi-times' | ||
}, | ||
{ | ||
label: 'Angular', | ||
icon: 'pi pi-external-link', | ||
url: 'http://angular.io' | ||
}, | ||
{ | ||
label: 'Router', | ||
icon: 'pi pi-upload', | ||
routerLink: '/fileupload' | ||
} | ||
]; | ||
} | ||
|
||
code: Code = { | ||
basic: ` | ||
<p-toolbar> | ||
<ng-template pTemplate="start"> | ||
<p-button label="New" icon="pi pi-plus" class="mr-2"></p-button> | ||
<p-button label="Upload" icon="pi pi-upload" styleClass="p-button-success"></p-button> | ||
<i class="p-toolbar-separator pi pi-bars mr-2" style="vertical-align: middle"></i> | ||
<p-splitButton label="Save" icon="pi pi-check" [model]="items" styleClass="p-button-warning"></p-splitButton> | ||
</ng-template> | ||
<ng-template pTemplate="center"> | ||
<span class="text-primary font-semibold text-xl">Center</span> | ||
</ng-template> | ||
<ng-template pTemplate="end"> | ||
<p-button icon="pi pi-search" class="mr-2"></p-button> | ||
<p-button icon="pi pi-calendar" styleClass="p-button-success mr-2"></p-button> | ||
<p-button icon="pi pi-times" styleClass="p-button-danger"></p-button> | ||
</ng-template> | ||
</p-toolbar>`, | ||
|
||
html: ` | ||
<ng-template class="card"> | ||
<p-toolbar> | ||
<ng-template pTemplate="start"> | ||
<p-button label="New" icon="pi pi-plus" class="mr-2"></p-button> | ||
<p-button label="Upload" icon="pi pi-upload" styleClass="p-button-success"></p-button> | ||
<i class="p-toolbar-separator pi pi-bars mr-2" style="vertical-align: middle"></i> | ||
<p-splitButton label="Save" icon="pi pi-check" [model]="items" styleClass="p-button-warning"></p-splitButton> | ||
</ng-template> | ||
<ng-template pTemplate="center"> | ||
<span class="text-primary font-semibold text-xl">Center</span> | ||
</ng-template> | ||
<ng-template pTemplate="end"> | ||
<p-button icon="pi pi-search" class="mr-2"></p-button> | ||
<p-button icon="pi pi-calendar" styleClass="p-button-success mr-2"></p-button> | ||
<p-button icon="pi pi-times" styleClass="p-button-danger"></p-button> | ||
</ng-template> | ||
</p-toolbar> | ||
</div>`, | ||
|
||
typescript: ` | ||
import { Component, OnInit } from '@angular/core'; | ||
import { MenuItem } from 'primeng/api'; | ||
@Component({ | ||
selector: 'toolbar-template-demo', | ||
templateUrl: './toolbar-template-demo.html' | ||
}) | ||
export class ToolbarTemplateDemo implements OnInit { | ||
items: MenuItem[] | undefined; | ||
ngOnInit() { | ||
this.items = [ | ||
{ | ||
label: 'Update', | ||
icon: 'pi pi-refresh' | ||
}, | ||
{ | ||
label: 'Delete', | ||
icon: 'pi pi-times' | ||
}, | ||
{ | ||
label: 'Angular', | ||
icon: 'pi pi-external-link', | ||
url: 'http://angular.io' | ||
}, | ||
{ | ||
label: 'Router', | ||
icon: 'pi pi-upload', | ||
routerLink: '/fileupload' | ||
} | ||
]; | ||
} | ||
}` | ||
}; | ||
} |
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