import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../../../../../../../common/menu-item-actions/menu-item-actions.directive";
import * as i3 from "../../../../../../../common/is-visible-pipe/is-visible.pipe";
import * as i4 from "../../../../../../../common/url-checker/url-checker.pipe";
import * as i5 from "../pipes/has-child.pipe";
export class AthenaHorizontalMenuNodeComponent {
    constructor() {
        this.collapse = new EventEmitter();
        this.isAnyMenuExpanded = false;
    }
    ngOnInit() { }
    toogleOnly(item, menu) {
        this.collapseAll(menu);
        item.expanded = !item.expanded;
        this.isAnyMenuExpanded = item.expanded;
    }
    collapseAll(menu) {
        menu.forEach(x => {
            x.expanded = false;
            if (x.items != null && x.items.length > 0) {
                this.collapseAll(x.items);
            }
        });
        this.isAnyMenuExpanded = false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AthenaHorizontalMenuNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: AthenaHorizontalMenuNodeComponent, selector: "[smz-ui-athena-horizontal-menu-node]", inputs: { item: "item", index: "index", currentUrl: "currentUrl" }, outputs: { collapse: "collapse" }, ngImport: i0, template: `
      <ng-container *ngFor="let subItem of item.items | isVisible; let subItemIndex = index;">

          <ng-container [ngSwitch]="subItem | hasChild">

            <ng-container *ngSwitchCase="false">
                <li [ngClass]="{ 'active-menuitem': currentUrl | urlChecker : subItem.routerLink }">
                    <a class="p-ripple" menuItemAction [item]="subItem" [parent]="item" [breadcrumbs]="true" [tabindex]="subItemIndex" (collapse)="collapse.emit()">
                        <i *ngIf="subItem.icon" class="layout-menuitem-icon" [ngClass]="subItem.icon"></i>
                        <span>{{ subItem.label }}</span>
                        <span class="p-ink"></span>
                    </a>
                </li>
            </ng-container>

            <ng-container *ngSwitchCase="true">
                <li [ngClass]="{ 'active-menuitem' : subItem.expanded }">
                    <a class="p-ripple" [tabindex]="subItemIndex" (click)="toogleOnly(subItem, subItem.items)">
                        <i *ngIf="subItem.icon" class="layout-menuitem-icon" [ngClass]="subItem.icon"></i>
                        <span>{{ subItem.label }}</span>
                        <i class="pi pi-fw pi-angle-down layout-menuitem-toggler"></i>
                        <span class="p-ink"></span>
                    </a>

                    <ng-container *ngIf="subItem.expanded">
                      <ul smz-ui-athena-horizontal-menu-node [item]="subItem" [currentUrl]="currentUrl" (collapse)="collapse.emit()"
                              role="menu" style="z-index: 100;" class="smz-ui-athena-horizontal-menu-node"></ul>
                    </ng-container>

                </li>
            </ng-container>

          </ng-container>

      </ng-container>
  `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.MenuItemActionsDirective, selector: "[menuItemAction]", inputs: ["item", "parent", "breadcrumbs"], outputs: ["collapse"] }, { kind: "component", type: AthenaHorizontalMenuNodeComponent, selector: "[smz-ui-athena-horizontal-menu-node]", inputs: ["item", "index", "currentUrl"], outputs: ["collapse"] }, { kind: "pipe", type: i3.IsVisiblePipe, name: "isVisible" }, { kind: "pipe", type: i4.UrlCheckerPipe, name: "urlChecker" }, { kind: "pipe", type: i5.HasChildPipe, name: "hasChild" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: AthenaHorizontalMenuNodeComponent, decorators: [{
            type: Component,
            args: [{
                    selector: '[smz-ui-athena-horizontal-menu-node]',
                    template: `
      <ng-container *ngFor="let subItem of item.items | isVisible; let subItemIndex = index;">

          <ng-container [ngSwitch]="subItem | hasChild">

            <ng-container *ngSwitchCase="false">
                <li [ngClass]="{ 'active-menuitem': currentUrl | urlChecker : subItem.routerLink }">
                    <a class="p-ripple" menuItemAction [item]="subItem" [parent]="item" [breadcrumbs]="true" [tabindex]="subItemIndex" (collapse)="collapse.emit()">
                        <i *ngIf="subItem.icon" class="layout-menuitem-icon" [ngClass]="subItem.icon"></i>
                        <span>{{ subItem.label }}</span>
                        <span class="p-ink"></span>
                    </a>
                </li>
            </ng-container>

            <ng-container *ngSwitchCase="true">
                <li [ngClass]="{ 'active-menuitem' : subItem.expanded }">
                    <a class="p-ripple" [tabindex]="subItemIndex" (click)="toogleOnly(subItem, subItem.items)">
                        <i *ngIf="subItem.icon" class="layout-menuitem-icon" [ngClass]="subItem.icon"></i>
                        <span>{{ subItem.label }}</span>
                        <i class="pi pi-fw pi-angle-down layout-menuitem-toggler"></i>
                        <span class="p-ink"></span>
                    </a>

                    <ng-container *ngIf="subItem.expanded">
                      <ul smz-ui-athena-horizontal-menu-node [item]="subItem" [currentUrl]="currentUrl" (collapse)="collapse.emit()"
                              role="menu" style="z-index: 100;" class="smz-ui-athena-horizontal-menu-node"></ul>
                    </ng-container>

                </li>
            </ng-container>

          </ng-container>

      </ng-container>
  `,
                }]
        }], ctorParameters: () => [], propDecorators: { item: [{
                type: Input
            }], index: [{
                type: Input
            }], currentUrl: [{
                type: Input
            }], collapse: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 