UNPKG

16.2 kBJavaScriptView Raw
1import * as i0 from '@angular/core';
2import { EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
3import * as i1 from '@angular/common';
4import { CommonModule } from '@angular/common';
5import * as i2$1 from '@angular/material/button';
6import { MatButtonModule } from '@angular/material/button';
7import * as i2 from '@angular/material/icon';
8import { MatIconModule } from '@angular/material/icon';
9import { MatListModule } from '@angular/material/list';
10import * as i4 from '@angular/material/menu';
11import { MatMenuModule } from '@angular/material/menu';
12import { MatTooltipModule } from '@angular/material/tooltip';
13import * as i3 from '@angular/material/divider';
14
15class TdDynamicMenuLinkComponent {
16 item;
17 itemClicked = new EventEmitter();
18 emitClicked() {
19 this.itemClicked.emit({ text: this.item.text, action: this.item.action });
20 }
21 static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDynamicMenuLinkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
22 static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdDynamicMenuLinkComponent, selector: "td-dynamic-menu-link", inputs: { item: "item" }, outputs: { itemClicked: "itemClicked" }, ngImport: i0, template: "<a\n *ngIf=\"item.link\"\n class=\"new-tab\"\n mat-menu-item\n [id]=\"item.id\"\n [href]=\"item.link\"\n [target]=\"item.newTab ? '_blank' : '_self'\"\n (click)=\"emitClicked()\"\n>\n <mat-icon\n *ngIf=\"item.svgIcon\"\n [class]=\"item.iconClasses\"\n [svgIcon]=\"item.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"item.icon\" [class]=\"item.iconClasses\">{{\n item.icon\n }}</mat-icon>\n <span>{{ item.text }}</span>\n <mat-icon *ngIf=\"item.newTab\" class=\"new-tab-icon\">launch</mat-icon>\n</a>\n<button\n *ngIf=\"item.action\"\n mat-menu-item\n [id]=\"item.id\"\n (click)=\"emitClicked()\"\n>\n <mat-icon\n *ngIf=\"item.svgIcon\"\n [class]=\"item.iconClasses\"\n [svgIcon]=\"item.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"item.icon\" [class]=\"item.iconClasses\">{{\n item.icon\n }}</mat-icon>\n <span>{{ item.text }}</span>\n</button>\n", styles: [".new-tab{display:flex;justify-content:flex-start;align-items:center}.new-tab span{flex:1}.new-tab .new-tab-icon{margin:0 0 0 16px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }] });
23}
24i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDynamicMenuLinkComponent, decorators: [{
25 type: Component,
26 args: [{ selector: 'td-dynamic-menu-link', template: "<a\n *ngIf=\"item.link\"\n class=\"new-tab\"\n mat-menu-item\n [id]=\"item.id\"\n [href]=\"item.link\"\n [target]=\"item.newTab ? '_blank' : '_self'\"\n (click)=\"emitClicked()\"\n>\n <mat-icon\n *ngIf=\"item.svgIcon\"\n [class]=\"item.iconClasses\"\n [svgIcon]=\"item.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"item.icon\" [class]=\"item.iconClasses\">{{\n item.icon\n }}</mat-icon>\n <span>{{ item.text }}</span>\n <mat-icon *ngIf=\"item.newTab\" class=\"new-tab-icon\">launch</mat-icon>\n</a>\n<button\n *ngIf=\"item.action\"\n mat-menu-item\n [id]=\"item.id\"\n (click)=\"emitClicked()\"\n>\n <mat-icon\n *ngIf=\"item.svgIcon\"\n [class]=\"item.iconClasses\"\n [svgIcon]=\"item.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"item.icon\" [class]=\"item.iconClasses\">{{\n item.icon\n }}</mat-icon>\n <span>{{ item.text }}</span>\n</button>\n", styles: [".new-tab{display:flex;justify-content:flex-start;align-items:center}.new-tab span{flex:1}.new-tab .new-tab-icon{margin:0 0 0 16px}\n"] }]
27 }], propDecorators: { item: [{
28 type: Input
29 }], itemClicked: [{
30 type: Output
31 }] } });
32
33class TdDynamicMenuItemComponent {
34 items;
35 itemClicked = new EventEmitter();
36 childMenu;
37 emitClicked(event) {
38 this.itemClicked.emit(event);
39 }
40 static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDynamicMenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
41 static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdDynamicMenuItemComponent, selector: "td-dynamic-menu-item", inputs: { items: "items" }, outputs: { itemClicked: "itemClicked" }, viewQueries: [{ propertyName: "childMenu", first: true, predicate: ["childMenu"], descendants: true, static: true }], ngImport: i0, template: "<mat-menu #childMenu=\"matMenu\" [overlapTrigger]=\"false\">\n <ng-template let-item let-index=\"index\" ngFor [ngForOf]=\"items\">\n <ng-container *ngIf=\"item.children && item.children.length > 0\">\n <button mat-menu-item [id]=\"item.id\" [matMenuTriggerFor]=\"menu.childMenu\">\n <mat-icon\n *ngIf=\"item.svgIcon\"\n [class]=\"item.iconClasses\"\n [svgIcon]=\"item.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"item.icon\" [class]=\"item.iconClasses\">{{\n item.icon\n }}</mat-icon>\n <span *ngIf=\"item.text\">\n {{ item.text }}\n </span>\n </button>\n <td-dynamic-menu-item\n #menu\n [items]=\"item.children\"\n ></td-dynamic-menu-item>\n </ng-container>\n <ng-container *ngIf=\"!item.children || item.children.length === 0\">\n <ng-container *ngIf=\"!item.link && !item.action\">\n <mat-divider class=\"group-divider\" *ngIf=\"index > 0\"></mat-divider>\n <div class=\"group-label tc-td-secondary text-sm\">{{ item.text }}</div>\n </ng-container>\n <ng-container *ngIf=\"item.link || item.action\">\n <div mat-menu-item class=\"pad-none\">\n <td-dynamic-menu-link\n [item]=\"item\"\n (itemClicked)=\"emitClicked($event)\"\n ></td-dynamic-menu-link>\n </div>\n </ng-container>\n </ng-container>\n </ng-template>\n</mat-menu>\n", styles: [".group-divider{margin:8px}.group-label{padding:16px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i4.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: TdDynamicMenuItemComponent, selector: "td-dynamic-menu-item", inputs: ["items"], outputs: ["itemClicked"] }, { kind: "component", type: TdDynamicMenuLinkComponent, selector: "td-dynamic-menu-link", inputs: ["item"], outputs: ["itemClicked"] }] });
42}
43i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDynamicMenuItemComponent, decorators: [{
44 type: Component,
45 args: [{ selector: 'td-dynamic-menu-item', template: "<mat-menu #childMenu=\"matMenu\" [overlapTrigger]=\"false\">\n <ng-template let-item let-index=\"index\" ngFor [ngForOf]=\"items\">\n <ng-container *ngIf=\"item.children && item.children.length > 0\">\n <button mat-menu-item [id]=\"item.id\" [matMenuTriggerFor]=\"menu.childMenu\">\n <mat-icon\n *ngIf=\"item.svgIcon\"\n [class]=\"item.iconClasses\"\n [svgIcon]=\"item.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"item.icon\" [class]=\"item.iconClasses\">{{\n item.icon\n }}</mat-icon>\n <span *ngIf=\"item.text\">\n {{ item.text }}\n </span>\n </button>\n <td-dynamic-menu-item\n #menu\n [items]=\"item.children\"\n ></td-dynamic-menu-item>\n </ng-container>\n <ng-container *ngIf=\"!item.children || item.children.length === 0\">\n <ng-container *ngIf=\"!item.link && !item.action\">\n <mat-divider class=\"group-divider\" *ngIf=\"index > 0\"></mat-divider>\n <div class=\"group-label tc-td-secondary text-sm\">{{ item.text }}</div>\n </ng-container>\n <ng-container *ngIf=\"item.link || item.action\">\n <div mat-menu-item class=\"pad-none\">\n <td-dynamic-menu-link\n [item]=\"item\"\n (itemClicked)=\"emitClicked($event)\"\n ></td-dynamic-menu-link>\n </div>\n </ng-container>\n </ng-container>\n </ng-template>\n</mat-menu>\n", styles: [".group-divider{margin:8px}.group-label{padding:16px}\n"] }]
46 }], propDecorators: { items: [{
47 type: Input
48 }], itemClicked: [{
49 type: Output
50 }], childMenu: [{
51 type: ViewChild,
52 args: ['childMenu', { static: true }]
53 }] } });
54
55class TdDynamicMenuComponent {
56 trigger;
57 items;
58 itemClicked = new EventEmitter();
59 emitClicked(event) {
60 this.itemClicked.emit(event);
61 }
62 static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDynamicMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
63 static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TdDynamicMenuComponent, selector: "td-dynamic-menu", inputs: { trigger: "trigger", items: "items" }, outputs: { itemClicked: "itemClicked" }, ngImport: i0, template: "<button\n *ngIf=\"!trigger.text\"\n mat-icon-button\n id=\"{{ trigger.id }}\"\n [matMenuTriggerFor]=\"menu.childMenu\"\n>\n <mat-icon\n *ngIf=\"trigger.svgIcon\"\n [class]=\"trigger.iconClasses\"\n [svgIcon]=\"trigger.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"trigger.icon\" [class]=\"trigger.iconClasses\">{{\n trigger.icon\n }}</mat-icon>\n</button>\n<button\n *ngIf=\"trigger.text\"\n mat-button\n id=\"{{ trigger.id }}\"\n [matMenuTriggerFor]=\"menu.childMenu\"\n>\n <mat-icon\n *ngIf=\"trigger.svgIcon\"\n [class]=\"trigger.iconClasses\"\n [svgIcon]=\"trigger.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"trigger.icon\" [class]=\"trigger.iconClasses\">{{\n trigger.icon\n }}</mat-icon>\n <span *ngIf=\"trigger.text\">\n {{ trigger.text }}\n </span>\n</button>\n\n<td-dynamic-menu-item\n #menu\n [items]=\"items\"\n (itemClicked)=\"emitClicked($event)\"\n></td-dynamic-menu-item>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: TdDynamicMenuItemComponent, selector: "td-dynamic-menu-item", inputs: ["items"], outputs: ["itemClicked"] }] });
64}
65i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TdDynamicMenuComponent, decorators: [{
66 type: Component,
67 args: [{ selector: 'td-dynamic-menu', template: "<button\n *ngIf=\"!trigger.text\"\n mat-icon-button\n id=\"{{ trigger.id }}\"\n [matMenuTriggerFor]=\"menu.childMenu\"\n>\n <mat-icon\n *ngIf=\"trigger.svgIcon\"\n [class]=\"trigger.iconClasses\"\n [svgIcon]=\"trigger.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"trigger.icon\" [class]=\"trigger.iconClasses\">{{\n trigger.icon\n }}</mat-icon>\n</button>\n<button\n *ngIf=\"trigger.text\"\n mat-button\n id=\"{{ trigger.id }}\"\n [matMenuTriggerFor]=\"menu.childMenu\"\n>\n <mat-icon\n *ngIf=\"trigger.svgIcon\"\n [class]=\"trigger.iconClasses\"\n [svgIcon]=\"trigger.svgIcon\"\n ></mat-icon>\n <mat-icon *ngIf=\"trigger.icon\" [class]=\"trigger.iconClasses\">{{\n trigger.icon\n }}</mat-icon>\n <span *ngIf=\"trigger.text\">\n {{ trigger.text }}\n </span>\n</button>\n\n<td-dynamic-menu-item\n #menu\n [items]=\"items\"\n (itemClicked)=\"emitClicked($event)\"\n></td-dynamic-menu-item>\n" }]
68 }], propDecorators: { trigger: [{
69 type: Input
70 }], items: [{
71 type: Input
72 }], itemClicked: [{
73 type: Output
74 }] } });
75
76class CovalentDynamicMenuModule {
77 static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CovalentDynamicMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
78 static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.2", ngImport: i0, type: CovalentDynamicMenuModule, declarations: [TdDynamicMenuComponent,
79 TdDynamicMenuItemComponent,
80 TdDynamicMenuLinkComponent], imports: [CommonModule,
81 MatButtonModule,
82 MatIconModule,
83 MatListModule,
84 MatMenuModule,
85 MatTooltipModule], exports: [TdDynamicMenuComponent,
86 TdDynamicMenuItemComponent,
87 TdDynamicMenuLinkComponent] });
88 static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CovalentDynamicMenuModule, imports: [CommonModule,
89 MatButtonModule,
90 MatIconModule,
91 MatListModule,
92 MatMenuModule,
93 MatTooltipModule] });
94}
95i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CovalentDynamicMenuModule, decorators: [{
96 type: NgModule,
97 args: [{
98 declarations: [
99 TdDynamicMenuComponent,
100 TdDynamicMenuItemComponent,
101 TdDynamicMenuLinkComponent,
102 ],
103 imports: [
104 CommonModule,
105 MatButtonModule,
106 MatIconModule,
107 MatListModule,
108 MatMenuModule,
109 MatTooltipModule,
110 ],
111 providers: [],
112 exports: [
113 TdDynamicMenuComponent,
114 TdDynamicMenuItemComponent,
115 TdDynamicMenuLinkComponent,
116 ],
117 }]
118 }] });
119
120/**
121 * Generated bundle index. Do not edit.
122 */
123
124export { CovalentDynamicMenuModule, TdDynamicMenuComponent, TdDynamicMenuItemComponent, TdDynamicMenuLinkComponent };
125//# sourceMappingURL=covalent-core-dynamic-menu.mjs.map