1 | import { Component, ChangeDetectionStrategy, ViewEncapsulation, ElementRef, Input, ContentChildren, NgModule } from '@angular/core';
|
2 | import { CommonModule } from '@angular/common';
|
3 | import { PrimeTemplate } from 'primeng/api';
|
4 |
|
5 | class Toolbar {
|
6 | constructor(el) {
|
7 | this.el = el;
|
8 | }
|
9 | getBlockableElement() {
|
10 | return this.el.nativeElement.children[0];
|
11 | }
|
12 | ngAfterContentInit() {
|
13 | this.templates.forEach((item) => {
|
14 | switch (item.getType()) {
|
15 | case 'left':
|
16 | this.leftTemplate = item.template;
|
17 | break;
|
18 | case 'right':
|
19 | this.rightTemplate = item.template;
|
20 | break;
|
21 | }
|
22 | });
|
23 | }
|
24 | }
|
25 | Toolbar.decorators = [
|
26 | { type: Component, args: [{
|
27 | selector: 'p-toolbar',
|
28 | template: `
|
29 | <div [ngClass]="'p-toolbar p-component'" [ngStyle]="style" [class]="styleClass" role="toolbar">
|
30 | <ng-content></ng-content>
|
31 | <div class="p-toolbar-group-left" *ngIf="leftTemplate">
|
32 | <ng-container *ngTemplateOutlet="leftTemplate"></ng-container>
|
33 | </div>
|
34 | <div class="p-toolbar-group-right" *ngIf="rightTemplate">
|
35 | <ng-container *ngTemplateOutlet="rightTemplate"></ng-container>
|
36 | </div>
|
37 | </div>
|
38 | `,
|
39 | changeDetection: ChangeDetectionStrategy.OnPush,
|
40 | encapsulation: ViewEncapsulation.None,
|
41 | styles: [".p-toolbar{-ms-flex-pack:justify;-ms-flex-wrap:wrap;flex-wrap:wrap;justify-content:space-between}.p-toolbar,.p-toolbar-group-left,.p-toolbar-group-right{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}"]
|
42 | },] }
|
43 | ];
|
44 | Toolbar.ctorParameters = () => [
|
45 | { type: ElementRef }
|
46 | ];
|
47 | Toolbar.propDecorators = {
|
48 | style: [{ type: Input }],
|
49 | styleClass: [{ type: Input }],
|
50 | templates: [{ type: ContentChildren, args: [PrimeTemplate,] }]
|
51 | };
|
52 | class ToolbarModule {
|
53 | }
|
54 | ToolbarModule.decorators = [
|
55 | { type: NgModule, args: [{
|
56 | imports: [CommonModule],
|
57 | exports: [Toolbar],
|
58 | declarations: [Toolbar]
|
59 | },] }
|
60 | ];
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | export { Toolbar, ToolbarModule };
|
67 |
|