{"version":3,"file":"primeng-megamenu.mjs","sources":["../../src/app/components/megamenu/megamenu.ts","../../src/app/components/megamenu/primeng-megamenu.ts"],"sourcesContent":["import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { AfterContentInit, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, Inject, Input, NgModule, PLATFORM_ID, QueryList, Renderer2, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { LicenseManager, MegaMenuItem, MenuItem, PrimeTemplate, SharedModule } from 'primeng/api';\nimport { AngleDownIcon } from 'primeng/icons/angledown';\nimport { AngleRightIcon } from 'primeng/icons/angleright';\nimport { RippleModule } from 'primeng/ripple';\nimport { TooltipModule } from 'primeng/tooltip';\n\n@Component({\n selector: 'p-megaMenu',\n template: `\n
\n
\n \n
\n \n
\n \n
\n \n
\n \n
\n
\n
\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./megamenu.css'],\n host: {\n class: 'p-element'\n }\n})\nexport class MegaMenu implements AfterContentInit, AfterViewInit {\n @Input() model: MegaMenuItem[];\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() orientation: string = 'horizontal';\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n activeItem: any;\n\n documentClickListener: () => void | null;\n\n startTemplate: TemplateRef;\n\n endTemplate: TemplateRef;\n\n submenuIconTemplate: TemplateRef;\n\n constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef) {}\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch (item.getType()) {\n case 'start':\n this.startTemplate = item.template;\n break;\n\n case 'submenuicon':\n this.submenuIconTemplate = item.template;\n break;\n\n case 'end':\n this.endTemplate = item.template;\n break;\n }\n });\n }\n\n ngAfterViewInit() {\n LicenseManager.check();\n }\n\n onCategoryMouseEnter(event, menuitem: MegaMenuItem) {\n if (menuitem.disabled) {\n event.preventDefault();\n return;\n }\n\n if (this.activeItem) {\n this.activeItem = menuitem;\n }\n }\n\n onCategoryClick(event, item: MenuItem | MegaMenuItem) {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n\n if (!item.url && !item.routerLink) {\n event.preventDefault();\n }\n\n if (item.command) {\n item.command({\n originalEvent: event,\n item: item\n });\n }\n\n if (item.items) {\n if (this.activeItem && this.activeItem === item) {\n this.activeItem = null;\n this.unbindDocumentClickListener();\n } else {\n this.activeItem = item;\n this.bindDocumentClickListener();\n }\n }\n }\n\n itemClick(event: MouseEvent, item: MenuItem | MegaMenuItem) {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n\n if (!item.url && !item.routerLink) {\n event.preventDefault();\n }\n\n if (item.command) {\n item.command({\n originalEvent: event,\n item: item\n });\n }\n\n this.activeItem = null;\n }\n\n getColumnClass(menuitem: MegaMenuItem) {\n let length = menuitem.items ? menuitem.items.length : 0;\n let columnClass;\n switch (length) {\n case 2:\n columnClass = 'p-megamenu-col-6';\n break;\n\n case 3:\n columnClass = 'p-megamenu-col-4';\n break;\n\n case 4:\n columnClass = 'p-megamenu-col-3';\n break;\n\n case 6:\n columnClass = 'p-megamenu-col-2';\n break;\n\n default:\n columnClass = 'p-megamenu-col-12';\n break;\n }\n\n return columnClass;\n }\n\n bindDocumentClickListener() {\n if (isPlatformBrowser(this.platformId)) {\n if (!this.documentClickListener) {\n this.documentClickListener = this.renderer.listen(this.document, 'click', (event) => {\n if (this.el && !this.el.nativeElement.contains(event.target)) {\n this.activeItem = null;\n this.unbindDocumentClickListener();\n this.cd.markForCheck();\n }\n });\n }\n }\n }\n\n unbindDocumentClickListener() {\n if (this.documentClickListener) {\n this.documentClickListener();\n this.documentClickListener = null;\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon],\n exports: [MegaMenu, RouterModule, TooltipModule, SharedModule],\n declarations: [MegaMenu]\n})\nexport class MegaMenuModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAuKa,QAAQ,CAAA;IAqBjB,WAAsC,CAAA,QAAkB,EAA+B,UAAe,EAAS,EAAc,EAAS,QAAmB,EAAS,EAAqB,EAAA;AAAjJ,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;AAA+B,QAAA,IAAU,CAAA,UAAA,GAAV,UAAU,CAAK;AAAS,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;AAAS,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAW;AAAS,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAmB;AAd9K,QAAA,IAAW,CAAA,WAAA,GAAW,YAAY,CAAC;KAc+I;IAE3L,kBAAkB,GAAA;QACd,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AAC5B,YAAA,QAAQ,IAAI,CAAC,OAAO,EAAE;AAClB,gBAAA,KAAK,OAAO;AACR,oBAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC;oBACnC,MAAM;AAEV,gBAAA,KAAK,aAAa;AACd,oBAAA,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC;oBACzC,MAAM;AAEV,gBAAA,KAAK,KAAK;AACN,oBAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC;oBACjC,MAAM;AACb,aAAA;AACL,SAAC,CAAC,CAAC;KACN;IAED,eAAe,GAAA;QACX,cAAc,CAAC,KAAK,EAAE,CAAC;KAC1B;IAED,oBAAoB,CAAC,KAAK,EAAE,QAAsB,EAAA;QAC9C,IAAI,QAAQ,CAAC,QAAQ,EAAE;YACnB,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,OAAO;AACV,SAAA;QAED,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