1 | {"version":3,"file":"primeng-tabmenu.mjs","sources":["../../src/app/components/tabmenu/tabmenu.ts","../../src/app/components/tabmenu/primeng-tabmenu.ts"],"sourcesContent":["import {NgModule,Component,Input,ContentChildren,QueryList,AfterContentInit,AfterViewInit,AfterViewChecked,TemplateRef,ChangeDetectionStrategy, ViewEncapsulation, ViewChild, ElementRef} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {MenuItem} from 'primeng/api';\nimport {RippleModule} from 'primeng/ripple';\nimport {PrimeTemplate, SharedModule} from 'primeng/api';\nimport {RouterModule} from '@angular/router';\nimport {DomHandler} from 'primeng/dom';\nimport {TooltipModule} from 'primeng/tooltip';\n\n@Component({\n selector: 'p-tabMenu',\n template: `\n <div [ngClass]=\"'p-tabmenu p-component'\" [ngStyle]=\"style\" [class]=\"styleClass\">\n <ul #navbar class=\"p-tabmenu-nav p-reset\" role=\"tablist\">\n <li *ngFor=\"let item of model; let i = index\" role=\"tab\" [ngStyle]=\"item.style\" [class]=\"item.styleClass\" [attr.aria-selected]=\"activeItem==item\" [attr.aria-expanded]=\"activeItem==item\"\n [ngClass]=\"{'p-tabmenuitem':true,'p-disabled':item.disabled,'p-highlight':activeItem==item,'p-hidden': item.visible === false}\" pTooltip [tooltipOptions]=\"item.tooltipOptions\">\n <a *ngIf=\"!item.routerLink\" [attr.href]=\"item.url\" class=\"p-menuitem-link\" role=\"presentation\" (click)=\"itemClick($event,item)\" (keydown.enter)=\"itemClick($event,item)\" [attr.tabindex]=\"item.disabled ? null : '0'\"\n [attr.target]=\"item.target\" [attr.title]=\"item.title\" [attr.id]=\"item.id\" pRipple>\n <ng-container *ngIf=\"!itemTemplate\">\n <span class=\"p-menuitem-icon\" [ngClass]=\"item.icon\" *ngIf=\"item.icon\"></span>\n <span class=\"p-menuitem-text\" *ngIf=\"item.escape !== false; else htmlLabel\">{{item.label}}</span>\n <ng-template #htmlLabel><span class=\"p-menuitem-text\" [innerHTML]=\"item.label\"></span></ng-template>\n </ng-container>\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item, index: i}\"></ng-container>\n </a>\n <a *ngIf=\"item.routerLink\" [routerLink]=\"item.routerLink\" [queryParams]=\"item.queryParams\" [routerLinkActive]=\"'p-menuitem-link-active'\" [routerLinkActiveOptions]=\"item.routerLinkActiveOptions||{exact:false}\"\n role=\"presentation\" class=\"p-menuitem-link\" (click)=\"itemClick($event,item)\" (keydown.enter)=\"itemClick($event,item)\" [attr.tabindex]=\"item.disabled ? null : '0'\"\n [attr.target]=\"item.target\" [attr.title]=\"item.title\" [attr.id]=\"item.id\"\n [fragment]=\"item.fragment\" [queryParamsHandling]=\"item.queryParamsHandling\" [preserveFragment]=\"item.preserveFragment\" [skipLocationChange]=\"item.skipLocationChange\" [replaceUrl]=\"item.replaceUrl\" [state]=\"item.state\" pRipple>\n <ng-container *ngIf=\"!itemTemplate\">\n <span class=\"p-menuitem-icon\" [ngClass]=\"item.icon\" *ngIf=\"item.icon\"></span>\n <span class=\"p-menuitem-text\" *ngIf=\"item.escape !== false; else htmlRouteLabel\">{{item.label}}</span>\n <ng-template #htmlRouteLabel><span class=\"p-menuitem-text\" [innerHTML]=\"item.label\"></span></ng-template>\n </ng-container>\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: {$implicit: item, index: i}\"></ng-container>\n </a>\n </li>\n <li #inkbar class=\"p-tabmenu-ink-bar\"></li>\n </ul>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./tabmenu.css'],\n host: {\n 'class': 'p-element'\n }\n})\nexport class TabMenu implements AfterContentInit,AfterViewInit,AfterViewChecked {\n\n @Input() model: MenuItem[];\n\n @Input() activeItem: MenuItem;\n\n @Input() popup: boolean;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @ViewChild('navbar') navbar: ElementRef;\n\n @ViewChild('inkbar') inkbar: ElementRef;\n\n @ContentChildren(PrimeTemplate) templates: QueryList<any>;\n\n itemTemplate: TemplateRef<any>;\n\n tabChanged: boolean;\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch(item.getType()) {\n case 'item':\n this.itemTemplate = item.template;\n break;\n\n default:\n this.itemTemplate = item.template;\n break;\n }\n });\n }\n\n ngAfterViewInit() {\n this.updateInkBar();\n }\n\n ngAfterViewChecked() {\n if (this.tabChanged) {\n this.updateInkBar();\n this.tabChanged = false;\n }\n }\n\n itemClick(event: Event, item: MenuItem) {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n\n if (item.command) {\n item.command({\n originalEvent: event,\n item: item\n });\n }\n\n this.activeItem = item;\n this.tabChanged = true;\n }\n\n updateInkBar() {\n let tabHeader = DomHandler.findSingle(this.navbar.nativeElement, 'li.p-highlight');\n if (tabHeader) {\n this.inkbar.nativeElement.style.width = DomHandler.getWidth(tabHeader) + 'px';\n this.inkbar.nativeElement.style.left = DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.navbar.nativeElement).left + 'px';\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule,RouterModule,SharedModule,RippleModule,TooltipModule],\n exports: [TabMenu,RouterModule,SharedModule,TooltipModule],\n declarations: [TabMenu]\n})\nexport class TabMenuModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAgDa,OAAO;IAsBhB,kBAAkB;QACd,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI;YACxB,QAAO,IAAI,CAAC,OAAO,EAAE;gBACjB,KAAK,MAAM;oBACP,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;oBACtC,MAAM;gBAEN;oBACI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;oBACtC,MAAM;aACT;SACJ,CAAC,CAAC;KACN;IAED,eAAe;QACX,IAAI,CAAC,YAAY,EAAE,CAAC;KACvB;IAED,kBAAkB;QACd,IAAI,IAAI,CAAC,UAA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