{"version":3,"sources":["../../src/app/components/tabmenu/tabmenu.ts"],"names":["TabMenu","prototype","ngAfterContentInit","_this","this","templates","forEach","item","getType","itemTemplate","template","ngAfterViewInit","updateInkBar","ngAfterViewChecked","tabChanged","itemClick","event","disabled","preventDefault","command","originalEvent","activeItem","tabHeader","DomHandler","findSingle","navbar","nativeElement","inkbar","style","width","getWidth","left","getOffset","Component","args","selector","changeDetection","ChangeDetectionStrategy","OnPush","encapsulation","ViewEncapsulation","None","Input","ViewChild","ContentChildren","PrimeTemplate","NgModule","imports","CommonModule","RouterModule","SharedModule","RippleModule","exports","declarations"],"mappings":"uoBA4CA,SAAAA,YAsBIA,EAAAC,UAAAC,mBAAA,WAAA,IAAAC,EAAAC,KACIA,KAAKC,UAAUC,SAAQ,SAACC,GACpB,OAAOA,EAAKC,WACR,IAAK,OAIL,QACIL,EAAKM,aAAeF,EAAKG,cAMzCV,EAAAC,UAAAU,gBAAA,WACIP,KAAKQ,gBAGTZ,EAAAC,UAAAY,mBAAA,WACQT,KAAKU,aACLV,KAAKQ,eACLR,KAAKU,YAAa,IAI1Bd,EAAAC,UAAAc,UAAA,SAAUC,EAAcT,GAChBA,EAAKU,SACLD,EAAME,kBAINX,EAAKY,SACLZ,EAAKY,QAAQ,CACTC,cAAeJ,EACfT,KAAMA,IAIdH,KAAKiB,WAAad,EAClBH,KAAKU,YAAa,IAGtBd,EAAAC,UAAAW,aAAA,WACI,IAAIU,EAAYC,EAAAA,WAAWC,WAAWpB,KAAKqB,OAAOC,cAAe,kBAC7DJ,IACAlB,KAAKuB,OAAOD,cAAcE,MAAMC,MAAQN,EAAAA,WAAWO,SAASR,GAAa,KACzElB,KAAKuB,OAAOD,cAAcE,MAAMG,KAAOR,EAAAA,WAAWS,UAAUV,GAAWS,KAAOR,EAAAA,WAAWS,UAAU5B,KAAKqB,OAAOC,eAAeK,KAAO,gCAxGhJE,EAAAA,UAASC,KAAA,CAAC,CACPC,SAAU,YACVzB,SAAU,u0FA8BV0B,gBAAiBC,EAAAA,wBAAwBC,OACzCC,cAAeC,EAAAA,kBAAkBC,sbAKhCC,EAAAA,0BAEAA,EAAAA,qBAEAA,EAAAA,qBAEAA,EAAAA,0BAEAA,EAAAA,sBAEAC,EAAAA,UAAST,KAAA,CAAC,0BAEVS,EAAAA,UAAST,KAAA,CAAC,6BAEVU,EAAAA,gBAAeV,KAAA,CAACW,EAAAA,wBA8DrB,iCALCC,EAAAA,SAAQZ,KAAA,CAAC,CACNa,QAAS,CAACC,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,cACjDC,QAAS,CAACpD,EAAQiD,EAAAA,aAAaC,EAAAA,cAC/BG,aAAc,CAACrD","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';\n\n@Component({\n selector: 'p-tabMenu',\n template: `\n
\n \n
\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./tabmenu.css']\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;\n\n itemTemplate: TemplateRef;\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],\n exports: [TabMenu,RouterModule,SharedModule],\n declarations: [TabMenu]\n})\nexport class TabMenuModule { }\n"]}