Icard/angular-clarity-master(work.../node_modules/primeng/fesm2022/primeng-megamenu.mjs

1207 lines
65 KiB
JavaScript
Raw Normal View History

2024-07-16 15:23:22 +00:00
import * as i1 from '@angular/common';
import { isPlatformBrowser, DOCUMENT, CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { EventEmitter, forwardRef, numberAttribute, booleanAttribute, Component, ViewEncapsulation, Inject, Input, Output, ViewChild, signal, effect, PLATFORM_ID, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
import * as i2 from '@angular/router';
import { RouterModule } from '@angular/router';
import * as i5 from 'primeng/api';
import { PrimeTemplate, SharedModule } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
import { AngleDownIcon } from 'primeng/icons/angledown';
import { AngleRightIcon } from 'primeng/icons/angleright';
import * as i3 from 'primeng/ripple';
import { RippleModule } from 'primeng/ripple';
import * as i4 from 'primeng/tooltip';
import { TooltipModule } from 'primeng/tooltip';
import { ObjectUtils, UniqueComponentId } from 'primeng/utils';
class MegaMenuSub {
el;
megaMenu;
id;
items;
itemTemplate;
menuId;
ariaLabel;
ariaLabelledBy;
level = 0;
focusedItemId;
disabled = false;
orientation;
activeItem;
submenu;
tabindex = 0;
root = false;
itemClick = new EventEmitter();
itemMouseEnter = new EventEmitter();
menuFocus = new EventEmitter();
menuBlur = new EventEmitter();
menuKeydown = new EventEmitter();
menubarViewChild;
constructor(el, megaMenu) {
this.el = el;
this.megaMenu = megaMenu;
}
onItemClick(event, processedItem) {
this.getItemProp(processedItem, 'command', { originalEvent: event, item: processedItem.item });
this.itemClick.emit({ originalEvent: event, processedItem, isFocus: true });
}
getItemProp(processedItem, name, params = null) {
return processedItem && processedItem.item ? ObjectUtils.getItemValue(processedItem.item[name], params) : undefined;
}
getItemId(processedItem) {
return processedItem.item && processedItem.item?.id ? processedItem.item.id : `${this.menuId}_${processedItem.key}`;
}
getSubListId(processedItem) {
return `${this.getItemId(processedItem)}_list`;
}
getItemClass(processedItem) {
return {
...this.getItemProp(processedItem, 'class'),
'p-menuitem': true,
'p-menuitem-active p-highlight': this.isItemActive(processedItem),
'p-focus': this.isItemFocused(processedItem),
'p-disabled': this.isItemDisabled(processedItem)
};
}
getItemLabel(processedItem) {
return this.getItemProp(processedItem, 'label');
}
getSeparatorItemClass(processedItem) {
return {
...this.getItemProp(processedItem, 'class'),
'p-menuitem-separator': true
};
}
getColumnClass(processedItem) {
let length = this.isItemGroup(processedItem) ? processedItem.items.length : 0;
let columnClass;
switch (length) {
case 2:
columnClass = 'p-megamenu-col-6';
break;
case 3:
columnClass = 'p-megamenu-col-4';
break;
case 4:
columnClass = 'p-megamenu-col-3';
break;
case 6:
columnClass = 'p-megamenu-col-2';
break;
default:
columnClass = 'p-megamenu-col-12';
break;
}
return columnClass;
}
getSubmenuHeaderClass(processedItem) {
return {
'p-megamenu-submenu-header p-submenu-header': true,
'p-disabled': this.isItemDisabled(processedItem),
...this.getItemProp(processedItem, 'class')
};
}
isSubmenuVisible(submenu) {
if (this.submenu && !this.root) {
return this.isItemVisible(submenu);
}
else {
return true;
}
}
isItemVisible(processedItem) {
return this.getItemProp(processedItem, 'visible') !== false;
}
isItemActive(processedItem) {
return ObjectUtils.isNotEmpty(this.activeItem) ? this.activeItem.key === processedItem.key : false;
}
isItemDisabled(processedItem) {
return this.getItemProp(processedItem, 'disabled');
}
isItemFocused(processedItem) {
return this.focusedItemId === this.getItemId(processedItem);
}
isItemGroup(processedItem) {
return ObjectUtils.isNotEmpty(processedItem.items);
}
getAriaSetSize() {
return this.items.filter((processedItem) => this.isItemVisible(processedItem) && !this.getItemProp(processedItem, 'separator')).length;
}
getAriaPosInset(index) {
return index - this.items.slice(0, index).filter((processedItem) => this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')).length + 1;
}
onItemMouseEnter(param) {
const { event, processedItem } = param;
this.itemMouseEnter.emit({ originalEvent: event, processedItem });
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MegaMenuSub, deps: [{ token: i0.ElementRef }, { token: forwardRef(() => MegaMenu) }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: MegaMenuSub, selector: "p-megaMenuSub", inputs: { id: "id", items: "items", itemTemplate: "itemTemplate", menuId: "menuId", ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", level: ["level", "level", numberAttribute], focusedItemId: "focusedItemId", disabled: ["disabled", "disabled", booleanAttribute], orientation: "orientation", activeItem: "activeItem", submenu: "submenu", tabindex: ["tabindex", "tabindex", numberAttribute], root: ["root", "root", booleanAttribute] }, outputs: { itemClick: "itemClick", itemMouseEnter: "itemMouseEnter", menuFocus: "menuFocus", menuBlur: "menuBlur", menuKeydown: "menuKeydown" }, host: { classAttribute: "p-element" }, viewQueries: [{ propertyName: "menubarViewChild", first: true, predicate: ["menubar"], descendants: true, static: true }], ngImport: i0, template: `
<ul
*ngIf="isSubmenuVisible(submenu)"
#menubar
[ngClass]="{ 'p-megamenu-root-list': root, 'p-submenu-list p-megamenu-submenu': !root }"
[attr.role]="root ? 'menubar' : 'menu'"
[attr.id]="id"
[attr.aria-orientation]="orientation"
[tabindex]="tabindex"
[attr.aria-activedescendant]="focusedItemId"
[attr.data-pc-section]="root ? 'root' : 'submenu'"
(keydown)="menuKeydown.emit($event)"
(focus)="menuFocus.emit($event)"
(blur)="menuBlur.emit($event)"
>
<li *ngIf="submenu" [ngClass]="getSubmenuHeaderClass(submenu)" [style]="getItemProp(submenu, 'style')" role="presentation">{{ getItemLabel(submenu) }}</li>
<ng-template ngFor let-processedItem [ngForOf]="items" let-index="index">
<li
*ngIf="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
[attr.id]="getItemId(processedItem)"
[style]="getItemProp(processedItem, 'style')"
[ngClass]="getSeparatorItemClass(processedItem)"
role="separator"
[attr.data-pc-section]="'separator'"
></li>
<li
#listItem
*ngIf="isItemVisible(processedItem) && !getItemProp(processedItem, 'separator')"
role="menuitem"
[attr.id]="getItemId(processedItem)"
[attr.data-pc-section]="'menuitem'"
[attr.data-p-highlight]="isItemActive(processedItem)"
[attr.data-p-focused]="isItemFocused(processedItem)"
[attr.data-p-disabled]="isItemDisabled(processedItem)"
[attr.aria-label]="getItemLabel(processedItem)"
[attr.aria-disabled]="isItemDisabled(processedItem) || undefined"
[attr.aria-haspopup]="isItemGroup(processedItem) && !getItemProp(processedItem, 'to') ? 'menu' : undefined"
[attr.aria-expanded]="isItemGroup(processedItem) ? isItemActive(processedItem) : undefined"
[attr.aria-level]="level + 1"
[attr.aria-setsize]="getAriaSetSize()"
[attr.aria-posinset]="getAriaPosInset(index)"
[ngStyle]="getItemProp(processedItem, 'style')"
[ngClass]="getItemClass(processedItem)"
[class]="getItemProp(processedItem, 'styleClass')"
pTooltip
[tooltipOptions]="getItemProp(processedItem, 'tooltipOptions')"
>
<div class="p-menuitem-content" [attr.data-pc-section]="'content'" (click)="onItemClick($event, processedItem)" (mouseenter)="onItemMouseEnter({$event, processedItem})">
<ng-container *ngIf="!itemTemplate">
<a
*ngIf="!getItemProp(processedItem, 'routerLink')"
[attr.href]="getItemProp(processedItem, 'url')"
[attr.aria-hidden]="true"
[attr.data-automationid]="getItemProp(processedItem, 'automationId')"
[attr.data-pc-section]="'action'"
[target]="getItemProp(processedItem, 'target')"
[ngClass]="{ 'p-menuitem-link': true, 'p-disabled': getItemProp(processedItem, 'disabled') }"
[attr.tabindex]="-1"
pRipple
>
<span
*ngIf="getItemProp(processedItem, 'icon')"
class="p-menuitem-icon"
[ngClass]="getItemProp(processedItem, 'icon')"
[ngStyle]="getItemProp(processedItem, 'iconStyle')"
[attr.data-pc-section]="'icon'"
[attr.aria-hidden]="true"
[attr.tabindex]="-1"
>
</span>
<span *ngIf="getItemProp(processedItem, 'escape'); else htmlLabel" class="p-menuitem-text" [attr.data-pc-section]="'label'">
{{ getItemLabel(processedItem) }}
</span>
<ng-template #htmlLabel>
<span class="p-menuitem-text" [innerHTML]="getItemLabel(processedItem)" [attr.data-pc-section]="'label'"></span>
</ng-template>
<span class="p-menuitem-badge" *ngIf="getItemProp(processedItem, 'badge')" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span>
<ng-container *ngIf="isItemGroup(processedItem)">
<ng-container *ngIf="!megaMenu.submenuIconTemplate">
<AngleDownIcon [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" *ngIf="orientation === 'horizontal'" [attr.aria-hidden]="true" />
<AngleRightIcon [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" *ngIf="orientation === 'vertical'" [attr.aria-hidden]="true" />
</ng-container>
<ng-template *ngTemplateOutlet="megaMenu.submenuIconTemplate" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true"></ng-template>
</ng-container>
</a>
<a
*ngIf="getItemProp(processedItem, 'routerLink')"
[routerLink]="getItemProp(processedItem, 'routerLink')"
[attr.data-automationid]="getItemProp(processedItem, 'automationId')"
[attr.tabindex]="-1"
[attr.aria-hidden]="true"
[attr.data-pc-section]="'action'"
[queryParams]="getItemProp(processedItem, 'queryParams')"
[routerLinkActive]="'p-menuitem-link-active'"
[routerLinkActiveOptions]="getItemProp(processedItem, 'routerLinkActiveOptions') || { exact: false }"
[target]="getItemProp(processedItem, 'target')"
[ngClass]="{ 'p-menuitem-link': true, 'p-disabled': getItemProp(processedItem, 'disabled') }"
[fragment]="getItemProp(processedItem, 'fragment')"
[queryParamsHandling]="getItemProp(processedItem, 'queryParamsHandling')"
[preserveFragment]="getItemProp(processedItem, 'preserveFragment')"
[skipLocationChange]="getItemProp(processedItem, 'skipLocationChange')"
[replaceUrl]="getItemProp(processedItem, 'replaceUrl')"
[state]="getItemProp(processedItem, 'state')"
pRipple
>
<span
class="p-menuitem-icon"
*ngIf="getItemProp(processedItem, 'icon')"
[ngClass]="getItemProp(processedItem, 'icon')"
[ngStyle]="getItemProp(processedItem, 'iconStyle')"
[attr.data-pc-section]="'icon'"
[attr.aria-hidden]="true"
[attr.tabindex]="-1"
></span>
<span class="p-menuitem-text" *ngIf="getItemProp(processedItem, 'escape'); else htmlRouteLabel">{{ getItemLabel(processedItem) }}</span>
<ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="getItemLabel(processedItem)" [attr.data-pc-section]="'label'"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="getItemProp(processedItem, 'badge')" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span>
<ng-container *ngIf="isItemGroup(processedItem)">
<ng-container *ngIf="!megaMenu.submenuIconTemplate">
<AngleDownIcon [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" *ngIf="orientation === 'horizontal'" [attr.aria-hidden]="true" />
<AngleRightIcon [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" *ngIf="orientation === 'vertical'" [attr.aria-hidden]="true" />
</ng-container>
<ng-template *ngTemplateOutlet="megaMenu.submenuIconTemplate" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true"></ng-template>
</ng-container>
</a>
</ng-container>
<ng-container *ngIf="itemTemplate">
<ng-template *ngTemplateOutlet="itemTemplate; context: { $implicit: processedItem.item }"></ng-template>
</ng-container>
</div>
<div *ngIf="isItemVisible(processedItem) && isItemGroup(processedItem)" class="p-megamenu-panel" [attr.data-pc-section]="'panel'">
<div class="p-megamenu-grid" [attr.data-pc-section]="'grid'">
<div *ngFor="let col of processedItem.items" [ngClass]="getColumnClass(processedItem)">
<p-megaMenuSub
*ngFor="let submenu of col"
[id]="getSubListId(submenu)"
[submenu]="submenu"
[items]="submenu.items"
[itemTemplate]="itemTemplate"
[menuId]="menuId"
[focusedItemId]="focusedItemId"
[level]="level + 1"
[root]="false"
(itemClick)="itemClick.emit($event)"
(itemMouseEnter)="onItemMouseEnter($event)"
>
</p-megaMenuSub>
</div>
</div>
</div>
</li>
</ng-template>
</ul>
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => i1.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgForOf), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i0.forwardRef(() => i2.RouterLink), selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i0.forwardRef(() => i2.RouterLinkActive), selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "directive", type: i0.forwardRef(() => i3.Ripple), selector: "[pRipple]" }, { kind: "directive", type: i0.forwardRef(() => i4.Tooltip), selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: i0.forwardRef(() => AngleDownIcon), selector: "AngleDownIcon" }, { kind: "component", type: i0.forwardRef(() => AngleRightIcon), selector: "AngleRightIcon" }, { kind: "component", type: i0.forwardRef(() => MegaMenuSub), selector: "p-megaMenuSub", inputs: ["id", "items", "itemTemplate", "menuId", "ariaLabel", "ariaLabelledBy", "level", "focusedItemId", "disabled", "orientation", "activeItem", "submenu", "tabindex", "root"], outputs: ["itemClick", "itemMouseEnter", "menuFocus", "menuBlur", "menuKeydown"] }], encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MegaMenuSub, decorators: [{
type: Component,
args: [{
selector: 'p-megaMenuSub',
template: `
<ul
*ngIf="isSubmenuVisible(submenu)"
#menubar
[ngClass]="{ 'p-megamenu-root-list': root, 'p-submenu-list p-megamenu-submenu': !root }"
[attr.role]="root ? 'menubar' : 'menu'"
[attr.id]="id"
[attr.aria-orientation]="orientation"
[tabindex]="tabindex"
[attr.aria-activedescendant]="focusedItemId"
[attr.data-pc-section]="root ? 'root' : 'submenu'"
(keydown)="menuKeydown.emit($event)"
(focus)="menuFocus.emit($event)"
(blur)="menuBlur.emit($event)"
>
<li *ngIf="submenu" [ngClass]="getSubmenuHeaderClass(submenu)" [style]="getItemProp(submenu, 'style')" role="presentation">{{ getItemLabel(submenu) }}</li>
<ng-template ngFor let-processedItem [ngForOf]="items" let-index="index">
<li
*ngIf="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
[attr.id]="getItemId(processedItem)"
[style]="getItemProp(processedItem, 'style')"
[ngClass]="getSeparatorItemClass(processedItem)"
role="separator"
[attr.data-pc-section]="'separator'"
></li>
<li
#listItem
*ngIf="isItemVisible(processedItem) && !getItemProp(processedItem, 'separator')"
role="menuitem"
[attr.id]="getItemId(processedItem)"
[attr.data-pc-section]="'menuitem'"
[attr.data-p-highlight]="isItemActive(processedItem)"
[attr.data-p-focused]="isItemFocused(processedItem)"
[attr.data-p-disabled]="isItemDisabled(processedItem)"
[attr.aria-label]="getItemLabel(processedItem)"
[attr.aria-disabled]="isItemDisabled(processedItem) || undefined"
[attr.aria-haspopup]="isItemGroup(processedItem) && !getItemProp(processedItem, 'to') ? 'menu' : undefined"
[attr.aria-expanded]="isItemGroup(processedItem) ? isItemActive(processedItem) : undefined"
[attr.aria-level]="level + 1"
[attr.aria-setsize]="getAriaSetSize()"
[attr.aria-posinset]="getAriaPosInset(index)"
[ngStyle]="getItemProp(processedItem, 'style')"
[ngClass]="getItemClass(processedItem)"
[class]="getItemProp(processedItem, 'styleClass')"
pTooltip
[tooltipOptions]="getItemProp(processedItem, 'tooltipOptions')"
>
<div class="p-menuitem-content" [attr.data-pc-section]="'content'" (click)="onItemClick($event, processedItem)" (mouseenter)="onItemMouseEnter({$event, processedItem})">
<ng-container *ngIf="!itemTemplate">
<a
*ngIf="!getItemProp(processedItem, 'routerLink')"
[attr.href]="getItemProp(processedItem, 'url')"
[attr.aria-hidden]="true"
[attr.data-automationid]="getItemProp(processedItem, 'automationId')"
[attr.data-pc-section]="'action'"
[target]="getItemProp(processedItem, 'target')"
[ngClass]="{ 'p-menuitem-link': true, 'p-disabled': getItemProp(processedItem, 'disabled') }"
[attr.tabindex]="-1"
pRipple
>
<span
*ngIf="getItemProp(processedItem, 'icon')"
class="p-menuitem-icon"
[ngClass]="getItemProp(processedItem, 'icon')"
[ngStyle]="getItemProp(processedItem, 'iconStyle')"
[attr.data-pc-section]="'icon'"
[attr.aria-hidden]="true"
[attr.tabindex]="-1"
>
</span>
<span *ngIf="getItemProp(processedItem, 'escape'); else htmlLabel" class="p-menuitem-text" [attr.data-pc-section]="'label'">
{{ getItemLabel(processedItem) }}
</span>
<ng-template #htmlLabel>
<span class="p-menuitem-text" [innerHTML]="getItemLabel(processedItem)" [attr.data-pc-section]="'label'"></span>
</ng-template>
<span class="p-menuitem-badge" *ngIf="getItemProp(processedItem, 'badge')" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span>
<ng-container *ngIf="isItemGroup(processedItem)">
<ng-container *ngIf="!megaMenu.submenuIconTemplate">
<AngleDownIcon [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" *ngIf="orientation === 'horizontal'" [attr.aria-hidden]="true" />
<AngleRightIcon [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" *ngIf="orientation === 'vertical'" [attr.aria-hidden]="true" />
</ng-container>
<ng-template *ngTemplateOutlet="megaMenu.submenuIconTemplate" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true"></ng-template>
</ng-container>
</a>
<a
*ngIf="getItemProp(processedItem, 'routerLink')"
[routerLink]="getItemProp(processedItem, 'routerLink')"
[attr.data-automationid]="getItemProp(processedItem, 'automationId')"
[attr.tabindex]="-1"
[attr.aria-hidden]="true"
[attr.data-pc-section]="'action'"
[queryParams]="getItemProp(processedItem, 'queryParams')"
[routerLinkActive]="'p-menuitem-link-active'"
[routerLinkActiveOptions]="getItemProp(processedItem, 'routerLinkActiveOptions') || { exact: false }"
[target]="getItemProp(processedItem, 'target')"
[ngClass]="{ 'p-menuitem-link': true, 'p-disabled': getItemProp(processedItem, 'disabled') }"
[fragment]="getItemProp(processedItem, 'fragment')"
[queryParamsHandling]="getItemProp(processedItem, 'queryParamsHandling')"
[preserveFragment]="getItemProp(processedItem, 'preserveFragment')"
[skipLocationChange]="getItemProp(processedItem, 'skipLocationChange')"
[replaceUrl]="getItemProp(processedItem, 'replaceUrl')"
[state]="getItemProp(processedItem, 'state')"
pRipple
>
<span
class="p-menuitem-icon"
*ngIf="getItemProp(processedItem, 'icon')"
[ngClass]="getItemProp(processedItem, 'icon')"
[ngStyle]="getItemProp(processedItem, 'iconStyle')"
[attr.data-pc-section]="'icon'"
[attr.aria-hidden]="true"
[attr.tabindex]="-1"
></span>
<span class="p-menuitem-text" *ngIf="getItemProp(processedItem, 'escape'); else htmlRouteLabel">{{ getItemLabel(processedItem) }}</span>
<ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="getItemLabel(processedItem)" [attr.data-pc-section]="'label'"></span></ng-template>
<span class="p-menuitem-badge" *ngIf="getItemProp(processedItem, 'badge')" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span>
<ng-container *ngIf="isItemGroup(processedItem)">
<ng-container *ngIf="!megaMenu.submenuIconTemplate">
<AngleDownIcon [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" *ngIf="orientation === 'horizontal'" [attr.aria-hidden]="true" />
<AngleRightIcon [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" *ngIf="orientation === 'vertical'" [attr.aria-hidden]="true" />
</ng-container>
<ng-template *ngTemplateOutlet="megaMenu.submenuIconTemplate" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true"></ng-template>
</ng-container>
</a>
</ng-container>
<ng-container *ngIf="itemTemplate">
<ng-template *ngTemplateOutlet="itemTemplate; context: { $implicit: processedItem.item }"></ng-template>
</ng-container>
</div>
<div *ngIf="isItemVisible(processedItem) && isItemGroup(processedItem)" class="p-megamenu-panel" [attr.data-pc-section]="'panel'">
<div class="p-megamenu-grid" [attr.data-pc-section]="'grid'">
<div *ngFor="let col of processedItem.items" [ngClass]="getColumnClass(processedItem)">
<p-megaMenuSub
*ngFor="let submenu of col"
[id]="getSubListId(submenu)"
[submenu]="submenu"
[items]="submenu.items"
[itemTemplate]="itemTemplate"
[menuId]="menuId"
[focusedItemId]="focusedItemId"
[level]="level + 1"
[root]="false"
(itemClick)="itemClick.emit($event)"
(itemMouseEnter)="onItemMouseEnter($event)"
>
</p-megaMenuSub>
</div>
</div>
</div>
</li>
</ng-template>
</ul>
`,
encapsulation: ViewEncapsulation.None,
host: {
class: 'p-element'
}
}]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: MegaMenu, decorators: [{
type: Inject,
args: [forwardRef(() => MegaMenu)]
}] }], propDecorators: { id: [{
type: Input
}], items: [{
type: Input
}], itemTemplate: [{
type: Input
}], menuId: [{
type: Input
}], ariaLabel: [{
type: Input
}], ariaLabelledBy: [{
type: Input
}], level: [{
type: Input,
args: [{ transform: numberAttribute }]
}], focusedItemId: [{
type: Input
}], disabled: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], orientation: [{
type: Input
}], activeItem: [{
type: Input
}], submenu: [{
type: Input
}], tabindex: [{
type: Input,
args: [{ transform: numberAttribute }]
}], root: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], itemClick: [{
type: Output
}], itemMouseEnter: [{
type: Output
}], menuFocus: [{
type: Output
}], menuBlur: [{
type: Output
}], menuKeydown: [{
type: Output
}], menubarViewChild: [{
type: ViewChild,
args: ['menubar', { static: true }]
}] } });
/**
* MegaMenu is navigation component that displays submenus together.
* @group Components
*/
class MegaMenu {
document;
platformId;
el;
renderer;
config;
cd;
/**
* An array of menuitems.
* @group Props
*/
set model(value) {
this._model = value;
this._processedItems = this.createProcessedItems(this._model || []);
}
get model() {
return this._model;
}
/**
* Inline style of the element.
* @group Props
*/
style;
/**
* Class of the element.
* @group Props
*/
styleClass;
/**
* Defines the orientation.
* @group Props
*/
orientation = 'horizontal';
/**
* Current id state as a string.
* @group Props
*/
id;
/**
* Defines a string value that labels an interactive element.
* @group Props
*/
ariaLabel;
/**
* Identifier of the underlying input element.
* @group Props
*/
ariaLabelledBy;
/**
* When present, it specifies that the component should be disabled.
* @group Props
*/
disabled = false;
/**
* Index of the element in tabbing order.
* @group Props
*/
tabindex = 0;
templates;
menubutton;
rootmenu;
startTemplate;
endTemplate;
menuIconTemplate;
submenuIconTemplate;
itemTemplate;
outsideClickListener;
resizeListener;
dirty = false;
focused = false;
activeItem = signal(null);
focusedItemInfo = signal({ index: -1, level: 0, parentKey: '', item: null });
searchValue = '';
searchTimeout;
_processedItems;
_model;
get visibleItems() {
const processedItem = ObjectUtils.isNotEmpty(this.activeItem()) ? this.activeItem() : null;
return processedItem
? processedItem.items.reduce((items, col) => {
col.forEach((submenu) => {
submenu.items.forEach((a) => {
items.push(a);
});
});
return items;
}, [])
: this.processedItems;
}
get processedItems() {
if (!this._processedItems || !this._processedItems.length) {
this._processedItems = this.createProcessedItems(this.model || []);
}
return this._processedItems;
}
get focusedItemId() {
const focusedItem = this.focusedItemInfo();
return focusedItem?.item && focusedItem.item?.id ? focusedItem.item.id : ObjectUtils.isNotEmpty(focusedItem.key) ? `${this.id}_${focusedItem.key}` : null;
}
constructor(document, platformId, el, renderer, config, cd) {
this.document = document;
this.platformId = platformId;
this.el = el;
this.renderer = renderer;
this.config = config;
this.cd = cd;
effect(() => {
const activeItem = this.activeItem();
if (ObjectUtils.isNotEmpty(activeItem)) {
this.bindOutsideClickListener();
this.bindResizeListener();
}
else {
this.unbindOutsideClickListener();
this.unbindResizeListener();
}
});
}
ngOnInit() {
this.id = this.id || UniqueComponentId();
}
ngAfterContentInit() {
this.templates?.forEach((item) => {
switch (item.getType()) {
case 'start':
this.startTemplate = item.template;
break;
case 'end':
this.endTemplate = item.template;
break;
case 'menuicon':
this.menuIconTemplate = item.template;
break;
case 'submenuicon':
this.submenuIconTemplate = item.template;
break;
case 'item':
this.itemTemplate = item.template;
break;
default:
this.itemTemplate = item.template;
break;
}
});
}
createProcessedItems(items, level = 0, parent = {}, parentKey = '', columnIndex) {
const processedItems = [];
items &&
items.forEach((item, index) => {
const key = (parentKey !== '' ? parentKey + '_' : '') + (columnIndex !== undefined ? columnIndex + '_' : '') + index;
const newItem = {
item,
index,
level,
key,
parent,
parentKey,
columnIndex: columnIndex !== undefined ? columnIndex : parent.columnIndex !== undefined ? parent.columnIndex : index
};
newItem['items'] =
level === 0 && item.items && item.items.length > 0 ? item.items.map((_items, _index) => this.createProcessedItems(_items, level + 1, newItem, key, _index)) : this.createProcessedItems(item.items, level + 1, newItem, key);
processedItems.push(newItem);
});
return processedItems;
}
getItemProp(item, name) {
return item ? ObjectUtils.getItemValue(item[name]) : undefined;
}
onItemClick(event) {
const { originalEvent, processedItem } = event;
const grouped = this.isProcessedItemGroup(processedItem);
const root = ObjectUtils.isEmpty(processedItem.parent);
const selected = this.isSelected(processedItem);
if (selected) {
const { index, key, parentKey, item } = processedItem;
this.activeItem.set(null);
this.focusedItemInfo.set({ index, key, parentKey, item });
this.dirty = !root;
DomHandler.focus(this.rootmenu?.menubarViewChild?.nativeElement);
}
else {
if (grouped) {
this.onItemChange(event);
}
else {
const rootProcessedItem = root ? processedItem : this.activeItem();
this.hide(originalEvent);
this.changeFocusedItemInfo(originalEvent, rootProcessedItem ? rootProcessedItem.index : -1);
DomHandler.focus(this.rootmenu?.menubarViewChild?.nativeElement);
}
}
}
onItemMouseEnter(event) {
if (!DomHandler.isTouchDevice()) {
this.onItemChange(event);
}
}
scrollInView(index = -1) {
const id = index !== -1 ? `${this.id}_${index}` : this.focusedItemId;
const element = DomHandler.findSingle(this.rootmenu?.el.nativeElement, `li[id="${id}"]`);
if (element) {
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
}
}
onItemChange(event) {
const { processedItem, isFocus } = event;
if (ObjectUtils.isEmpty(processedItem))
return;
const { index, key, parentKey, items, item } = processedItem;
const grouped = ObjectUtils.isNotEmpty(items);
if (grouped) {
this.activeItem.set(processedItem);
}
this.focusedItemInfo.set({ index, key, parentKey, item });
grouped && (this.dirty = true);
isFocus && DomHandler.focus(this.rootmenu?.menubarViewChild?.nativeElement);
}
hide(event, isFocus) {
this.activeItem.set(null);
this.focusedItemInfo.set({ index: -1, key: '', parentKey: '', item: null });
isFocus && DomHandler.focus(this.rootmenu?.menubarViewChild?.nativeElement);
this.dirty = false;
}
onMenuFocus(event) {
this.focused = true;
if (this.focusedItemInfo().index === -1) {
const index = this.findFirstFocusedItemIndex();
const processedItem = this.findVisibleItem(index);
this.focusedItemInfo.set({ index, key: processedItem.key, parentKey: processedItem.parentKey, item: processedItem.item });
}
}
onMenuBlur(event) {
this.focused = false;
this.focusedItemInfo.set({ index: -1, level: 0, parentKey: '', item: null });
this.searchValue = '';
this.dirty = false;
}
onKeyDown(event) {
const metaKey = event.metaKey || event.ctrlKey;
switch (event.code) {
case 'ArrowDown':
this.onArrowDownKey(event);
break;
case 'ArrowUp':
this.onArrowUpKey(event);
break;
case 'ArrowLeft':
this.onArrowLeftKey(event);
break;
case 'ArrowRight':
this.onArrowRightKey(event);
break;
case 'Home':
this.onHomeKey(event);
break;
case 'End':
this.onEndKey(event);
break;
case 'Space':
this.onSpaceKey(event);
break;
case 'Enter':
this.onEnterKey(event);
break;
case 'Escape':
this.onEscapeKey(event);
break;
case 'Tab':
this.onTabKey(event);
break;
case 'PageDown':
case 'PageUp':
case 'Backspace':
case 'ShiftLeft':
case 'ShiftRight':
//NOOP
break;
default:
if (!metaKey && ObjectUtils.isPrintableCharacter(event.key)) {
this.searchItems(event, event.key);
}
break;
}
}
findFirstFocusedItemIndex() {
const selectedIndex = this.findSelectedItemIndex();
return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex;
}
findFirstItemIndex() {
return this.visibleItems.findIndex((processedItem) => this.isValidItem(processedItem));
}
findSelectedItemIndex() {
return this.visibleItems.findIndex((processedItem) => this.isValidSelectedItem(processedItem));
}
isProcessedItemGroup(processedItem) {
return processedItem && ObjectUtils.isNotEmpty(processedItem.items);
}
isSelected(processedItem) {
return ObjectUtils.isNotEmpty(this.activeItem()) ? this.activeItem().key === processedItem.key : false;
}
isValidSelectedItem(processedItem) {
return this.isValidItem(processedItem) && this.isSelected(processedItem);
}
isValidItem(processedItem) {
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
}
isItemDisabled(item) {
return this.getItemProp(item, 'disabled');
}
isItemSeparator(item) {
return this.getItemProp(item, 'separator');
}
isItemMatched(processedItem) {
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
}
isProccessedItemGroup(processedItem) {
return processedItem && ObjectUtils.isNotEmpty(processedItem.items);
}
searchItems(event, char) {
this.searchValue = (this.searchValue || '') + char;
let itemIndex = -1;
let matched = false;
if (this.focusedItemInfo().index !== -1) {
itemIndex = this.visibleItems.slice(this.focusedItemInfo().index).findIndex((processedItem) => this.isItemMatched(processedItem));
itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo().index).findIndex((processedItem) => this.isItemMatched(processedItem)) : itemIndex + this.focusedItemInfo().index;
}
else {
itemIndex = this.visibleItems.findIndex((processedItem) => this.isItemMatched(processedItem));
}
if (itemIndex !== -1) {
matched = true;
}
if (itemIndex === -1 && this.focusedItemInfo().index === -1) {
itemIndex = this.findFirstFocusedItemIndex();
}
if (itemIndex !== -1) {
this.changeFocusedItemInfo(event, itemIndex);
}
if (this.searchTimeout) {
clearTimeout(this.searchTimeout);
}
this.searchTimeout = setTimeout(() => {
this.searchValue = '';
this.searchTimeout = null;
}, 500);
return matched;
}
getProccessedItemLabel(processedItem) {
return processedItem ? this.getItemLabel(processedItem.item) : undefined;
}
getItemLabel(item) {
return this.getItemProp(item, 'label');
}
changeFocusedItemInfo(event, index) {
const processedItem = this.findVisibleItem(index);
if (ObjectUtils.isNotEmpty(processedItem)) {
const { key, parentKey, item } = processedItem;
this.focusedItemInfo.set({ index, key: key ? key : '', parentKey, item });
}
this.scrollInView();
}
onArrowDownKey(event) {
if (this.orientation === 'horizontal') {
if (ObjectUtils.isNotEmpty(this.activeItem()) && this.activeItem().key === this.focusedItemInfo().key) {
const { key, item } = this.activeItem();
this.focusedItemInfo.set({ index: -1, key: '', parentKey: key, item });
}
else {
const processedItem = this.findVisibleItem(this.focusedItemInfo().index);
const grouped = this.isProccessedItemGroup(processedItem);
if (grouped) {
const { parentKey, key, item } = processedItem;
this.onItemChange({ originalEvent: event, processedItem });
this.focusedItemInfo.set({ index: -1, key: key, parentKey: parentKey, item: item });
this.searchValue = '';
}
}
}
const itemIndex = this.focusedItemInfo().index !== -1 ? this.findNextItemIndex(this.focusedItemInfo().index) : this.findFirstFocusedItemIndex();
this.changeFocusedItemInfo(event, itemIndex);
event.preventDefault();
}
onArrowRightKey(event) {
const processedItem = this.findVisibleItem(this.focusedItemInfo().index);
const grouped = this.isProccessedItemGroup(processedItem);
if (grouped) {
if (this.orientation === 'vertical') {
if (ObjectUtils.isNotEmpty(this.activeItem()) && this.activeItem().key === processedItem.key) {
this.focusedItemInfo.set({ index: -1, key: '', parentKey: this.activeItem().key, item: processedItem.item });
}
else {
const processedItem = this.findVisibleItem(this.focusedItemInfo().index);
const grouped = this.isProccessedItemGroup(processedItem);
if (grouped) {
this.onItemChange({ originalEvent: event, processedItem });
this.focusedItemInfo.set({ index: -1, key: processedItem.key, parentKey: processedItem.parentKey, item: processedItem.item });
this.searchValue = '';
}
}
}
const itemIndex = this.focusedItemInfo().index !== -1 ? this.findNextItemIndex(this.focusedItemInfo().index) : this.findFirstFocusedItemIndex();
this.changeFocusedItemInfo(event, itemIndex);
}
else {
const columnIndex = processedItem.columnIndex + 1;
const itemIndex = this.visibleItems.findIndex((item) => item.columnIndex === columnIndex);
itemIndex !== -1 && this.changeFocusedItemInfo(event, itemIndex);
}
event.preventDefault();
}
onArrowUpKey(event) {
if (event.altKey && this.orientation === 'horizontal') {
if (this.focusedItemInfo().index !== -1) {
const processedItem = this.findVisibleItem(this.focusedItemInfo().index);
const grouped = this.isProccessedItemGroup(processedItem);
if (!grouped && ObjectUtils.isNotEmpty(this.activeItem)) {
if (this.focusedItemInfo().index === 0) {
this.focusedItemInfo.set({ index: this.activeItem().index, key: this.activeItem().key, parentKey: this.activeItem().parentKey, item: processedItem.item });
this.activeItem.set(null);
}
else {
this.changeFocusedItemInfo(event, this.findFirstItemIndex());
}
}
}
event.preventDefault();
}
else {
const itemIndex = this.focusedItemInfo().index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo().index) : this.findLastFocusedItemIndex();
this.changeFocusedItemInfo(event, itemIndex);
event.preventDefault();
}
}
onArrowLeftKey(event) {
const processedItem = this.findVisibleItem(this.focusedItemInfo().index);
const grouped = this.isProccessedItemGroup(processedItem);
if (grouped) {
if (this.orientation === 'horizontal') {
const itemIndex = this.focusedItemInfo().index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo().index) : this.findLastFocusedItemIndex();
this.changeFocusedItemInfo(event, itemIndex);
}
}
else {
if (this.orientation === 'vertical' && ObjectUtils.isNotEmpty(this.activeItem())) {
if (processedItem.columnIndex === 0) {
this.focusedItemInfo.set({ index: this.activeItem().index, key: this.activeItem().key, parentKey: this.activeItem().parentKey, item: processedItem.item });
this.activeItem.set(null);
}
}
const columnIndex = processedItem.columnIndex - 1;
const itemIndex = this.visibleItems.findIndex((item) => item.columnIndex === columnIndex);
itemIndex !== -1 && this.changeFocusedItemInfo(event, itemIndex);
}
event.preventDefault();
}
onHomeKey(event) {
this.changeFocusedItemInfo(event, this.findFirstItemIndex());
event.preventDefault();
}
onEndKey(event) {
this.changeFocusedItemInfo(event, this.findLastItemIndex());
event.preventDefault();
}
onSpaceKey(event) {
this.onEnterKey(event);
}
onEscapeKey(event) {
if (ObjectUtils.isNotEmpty(this.activeItem())) {
this.focusedItemInfo.set({ index: this.activeItem().index, key: this.activeItem().key, item: this.activeItem().item });
this.activeItem.set(null);
}
event.preventDefault();
}
onTabKey(event) {
if (this.focusedItemInfo().index !== -1) {
const processedItem = this.findVisibleItem(this.focusedItemInfo().index);
const grouped = this.isProccessedItemGroup(processedItem);
!grouped && this.onItemChange({ originalEvent: event, processedItem });
}
this.hide();
}
onEnterKey(event) {
if (this.focusedItemInfo().index !== -1) {
const element = DomHandler.findSingle(this.rootmenu?.el?.nativeElement, `li[id="${`${this.focusedItemId}`}"]`);
const anchorElement = element && DomHandler.findSingle(element, 'a[data-pc-section="action"]');
anchorElement ? anchorElement.click() : element && element.click();
const processedItem = this.visibleItems[this.focusedItemInfo().index];
const grouped = this.isProccessedItemGroup(processedItem);
!grouped && this.changeFocusedItemInfo(event, this.findFirstFocusedItemIndex());
}
event.preventDefault();
}
findVisibleItem(index) {
return ObjectUtils.isNotEmpty(this.visibleItems) ? this.visibleItems[index] : null;
}
findLastFocusedItemIndex() {
const selectedIndex = this.findSelectedItemIndex();
return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex;
}
findLastItemIndex() {
return ObjectUtils.findLastIndex(this.visibleItems, (processedItem) => this.isValidItem(processedItem));
}
findPrevItemIndex(index) {
const matchedItemIndex = index > 0 ? ObjectUtils.findLastIndex(this.visibleItems.slice(0, index), (processedItem) => this.isValidItem(processedItem)) : -1;
return matchedItemIndex > -1 ? matchedItemIndex : index;
}
findNextItemIndex(index) {
const matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex((processedItem) => this.isValidItem(processedItem)) : -1;
return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index;
}
bindResizeListener() {
if (isPlatformBrowser(this.platformId)) {
if (!this.resizeListener) {
this.resizeListener = this.renderer.listen(this.document.defaultView, 'resize', (event) => {
this.hide(event, true);
});
}
}
}
bindOutsideClickListener() {
if (isPlatformBrowser(this.platformId)) {
if (!this.outsideClickListener) {
this.outsideClickListener = this.renderer.listen(this.document, 'click', (event) => {
const isOutsideContainer = this.rootmenu?.el.nativeElement !== event.target && !this.rootmenu?.el.nativeElement.contains(event.target);
if (isOutsideContainer) {
this.hide();
}
});
}
}
}
unbindOutsideClickListener() {
if (this.outsideClickListener) {
this.outsideClickListener();
this.outsideClickListener = null;
}
}
unbindResizeListener() {
if (this.resizeListener) {
this.resizeListener();
this.resizeListener = null;
}
}
ngOnDestroy() {
this.unbindOutsideClickListener();
this.unbindResizeListener();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MegaMenu, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i5.PrimeNGConfig }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: MegaMenu, selector: "p-megaMenu", inputs: { model: "model", style: "style", styleClass: "styleClass", orientation: "orientation", id: "id", ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", disabled: ["disabled", "disabled", booleanAttribute], tabindex: ["tabindex", "tabindex", numberAttribute] }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "menubutton", first: true, predicate: ["menubutton"], descendants: true }, { propertyName: "rootmenu", first: true, predicate: ["rootmenu"], descendants: true }], ngImport: i0, template: `
<div
[ngClass]="{ 'p-megamenu p-component': true, 'p-megamenu-horizontal': orientation == 'horizontal', 'p-megamenu-vertical': orientation == 'vertical' }"
[class]="styleClass"
[ngStyle]="style"
[attr.data-pc-section]="'root'"
[attr.data-pc-name]="'megamenu'"
[attr.id]="id"
>
<div class="p-megamenu-start" *ngIf="startTemplate">
<ng-container *ngTemplateOutlet="startTemplate"></ng-container>
</div>
<p-megaMenuSub
#rootmenu
[itemTemplate]="itemTemplate"
[items]="processedItems"
[attr.id]="id + '_list'"
[menuId]="id"
[root]="true"
[orientation]="orientation"
[ariaLabel]="ariaLabel"
[disabled]="disabled"
[tabindex]="!disabled ? tabindex : -1"
[activeItem]="activeItem()"
[level]="0"
[ariaLabelledBy]="ariaLabelledBy"
[focusedItemId]="focused ? focusedItemId : undefined"
(itemClick)="onItemClick($event)"
(menuFocus)="onMenuFocus($event)"
(menuBlur)="onMenuBlur($event)"
(menuKeydown)="onKeyDown($event)"
(itemMouseEnter)="onItemMouseEnter($event)"
></p-megaMenuSub>
<div class="p-megamenu-end" *ngIf="endTemplate; else legacy">
<ng-container *ngTemplateOutlet="endTemplate"></ng-container>
</div>
<ng-template #legacy>
<div class="p-megamenu-end">
<ng-content></ng-content>
</div>
</ng-template>
</div>
`, isInline: true, styles: ["@layer primeng{.p-megamenu-root-list{margin:0;padding:0;list-style:none}.p-megamenu-root-list>.p-menuitem{position:relative}.p-megamenu .p-menuitem-link{cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-megamenu .p-menuitem-text{line-height:1}.p-megamenu-panel{display:none;position:absolute;width:auto;z-index:1}.p-megamenu-root-list>.p-menuitem-active>.p-megamenu-panel{display:block}.p-megamenu-submenu{margin:0;padding:0;list-style:none}.p-megamenu-horizontal{align-items:center}.p-megamenu-horizontal .p-megamenu-root-list{display:flex;align-items:center;flex-wrap:wrap}.p-megamenu-horizontal .p-megamenu-end{margin-left:auto;align-self:center}.p-megamenu-vertical .p-megamenu-root-list{flex-direction:column}.p-megamenu-vertical .p-megamenu-root-list>.p-menuitem-active>.p-megamenu-panel{left:100%;top:0}.p-megamenu-vertical .p-megamenu-root-list>.p-menuitem>.p-menuitem-content>.p-menuitem-link>.p-submenu-icon:not(svg){margin-left:auto}.p-megamenu-vertical .p-megamenu-root-list>.p-menuitem>.p-menuitem-content>.p-menuitem-link>.p-icon-wrapper{margin-left:auto}.p-megamenu-grid{display:flex}.p-megamenu-col-2,.p-megamenu-col-3,.p-megamenu-col-4,.p-megamenu-col-6,.p-megamenu-col-12{flex:0 0 auto;padding:.5rem}.p-megamenu-col-2{width:16.6667%}.p-megamenu-col-3{width:25%}.p-megamenu-col-4{width:33.3333%}.p-megamenu-col-6{width:50%}.p-megamenu-col-12{width:100%}}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: MegaMenuSub, selector: "p-megaMenuSub", inputs: ["id", "items", "itemTemplate", "menuId", "ariaLabel", "ariaLabelledBy", "level", "focusedItemId", "disabled", "orientation", "activeItem", "submenu", "tabindex", "root"], outputs: ["itemClick", "itemMouseEnter", "menuFocus", "menuBlur", "menuKeydown"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MegaMenu, decorators: [{
type: Component,
args: [{ selector: 'p-megaMenu', template: `
<div
[ngClass]="{ 'p-megamenu p-component': true, 'p-megamenu-horizontal': orientation == 'horizontal', 'p-megamenu-vertical': orientation == 'vertical' }"
[class]="styleClass"
[ngStyle]="style"
[attr.data-pc-section]="'root'"
[attr.data-pc-name]="'megamenu'"
[attr.id]="id"
>
<div class="p-megamenu-start" *ngIf="startTemplate">
<ng-container *ngTemplateOutlet="startTemplate"></ng-container>
</div>
<p-megaMenuSub
#rootmenu
[itemTemplate]="itemTemplate"
[items]="processedItems"
[attr.id]="id + '_list'"
[menuId]="id"
[root]="true"
[orientation]="orientation"
[ariaLabel]="ariaLabel"
[disabled]="disabled"
[tabindex]="!disabled ? tabindex : -1"
[activeItem]="activeItem()"
[level]="0"
[ariaLabelledBy]="ariaLabelledBy"
[focusedItemId]="focused ? focusedItemId : undefined"
(itemClick)="onItemClick($event)"
(menuFocus)="onMenuFocus($event)"
(menuBlur)="onMenuBlur($event)"
(menuKeydown)="onKeyDown($event)"
(itemMouseEnter)="onItemMouseEnter($event)"
></p-megaMenuSub>
<div class="p-megamenu-end" *ngIf="endTemplate; else legacy">
<ng-container *ngTemplateOutlet="endTemplate"></ng-container>
</div>
<ng-template #legacy>
<div class="p-megamenu-end">
<ng-content></ng-content>
</div>
</ng-template>
</div>
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
class: 'p-element'
}, styles: ["@layer primeng{.p-megamenu-root-list{margin:0;padding:0;list-style:none}.p-megamenu-root-list>.p-menuitem{position:relative}.p-megamenu .p-menuitem-link{cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-megamenu .p-menuitem-text{line-height:1}.p-megamenu-panel{display:none;position:absolute;width:auto;z-index:1}.p-megamenu-root-list>.p-menuitem-active>.p-megamenu-panel{display:block}.p-megamenu-submenu{margin:0;padding:0;list-style:none}.p-megamenu-horizontal{align-items:center}.p-megamenu-horizontal .p-megamenu-root-list{display:flex;align-items:center;flex-wrap:wrap}.p-megamenu-horizontal .p-megamenu-end{margin-left:auto;align-self:center}.p-megamenu-vertical .p-megamenu-root-list{flex-direction:column}.p-megamenu-vertical .p-megamenu-root-list>.p-menuitem-active>.p-megamenu-panel{left:100%;top:0}.p-megamenu-vertical .p-megamenu-root-list>.p-menuitem>.p-menuitem-content>.p-menuitem-link>.p-submenu-icon:not(svg){margin-left:auto}.p-megamenu-vertical .p-megamenu-root-list>.p-menuitem>.p-menuitem-content>.p-menuitem-link>.p-icon-wrapper{margin-left:auto}.p-megamenu-grid{display:flex}.p-megamenu-col-2,.p-megamenu-col-3,.p-megamenu-col-4,.p-megamenu-col-6,.p-megamenu-col-12{flex:0 0 auto;padding:.5rem}.p-megamenu-col-2{width:16.6667%}.p-megamenu-col-3{width:25%}.p-megamenu-col-4{width:33.3333%}.p-megamenu-col-6{width:50%}.p-megamenu-col-12{width:100%}}\n"] }]
}], ctorParameters: () => [{ type: Document, decorators: [{
type: Inject,
args: [DOCUMENT]
}] }, { type: undefined, decorators: [{
type: Inject,
args: [PLATFORM_ID]
}] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i5.PrimeNGConfig }, { type: i0.ChangeDetectorRef }], propDecorators: { model: [{
type: Input
}], style: [{
type: Input
}], styleClass: [{
type: Input
}], orientation: [{
type: Input
}], id: [{
type: Input
}], ariaLabel: [{
type: Input
}], ariaLabelledBy: [{
type: Input
}], disabled: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], tabindex: [{
type: Input,
args: [{ transform: numberAttribute }]
}], templates: [{
type: ContentChildren,
args: [PrimeTemplate]
}], menubutton: [{
type: ViewChild,
args: ['menubutton']
}], rootmenu: [{
type: ViewChild,
args: ['rootmenu']
}] } });
class MegaMenuModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MegaMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: MegaMenuModule, declarations: [MegaMenu, MegaMenuSub], imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon], exports: [MegaMenu, RouterModule, TooltipModule, SharedModule] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MegaMenuModule, imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon, RouterModule, TooltipModule, SharedModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MegaMenuModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon],
exports: [MegaMenu, RouterModule, TooltipModule, SharedModule],
declarations: [MegaMenu, MegaMenuSub]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { MegaMenu, MegaMenuModule, MegaMenuSub };
//# sourceMappingURL=primeng-megamenu.mjs.map