import { Component, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, ElementRef, Input } from '@angular/core';
import { EuiDropdownButtonMenuService } from './eui-dropdown-button.service';
import * as i0 from "@angular/core";
import * as i1 from "./eui-dropdown-button.service";
import * as i2 from "@angular/material/menu";
import * as i3 from "@angular/common";
import * as i4 from "@ngx-translate/core";
const _c0 = ["childMenu"];
function EuiDropdownButtonChildMenuComponent_ng_container_2_button_1_span_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 7);
} if (rf & 2) {
    const item_r2 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵproperty("ngClass", item_r2.iconClass);
    i0.ɵɵattribute("aria-label", item_r2.iconLabel);
} }
function EuiDropdownButtonChildMenuComponent_ng_container_2_button_1_Template(rf, ctx) { if (rf & 1) {
    const _r8 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 5);
    i0.ɵɵlistener("keydown", function EuiDropdownButtonChildMenuComponent_ng_container_2_button_1_Template_button_keydown_0_listener($event) { i0.ɵɵrestoreView(_r8); const item_r2 = i0.ɵɵnextContext().$implicit; const ctx_r7 = i0.ɵɵnextContext(); return ctx_r7.onKeyDown($event, item_r2); })("click", function EuiDropdownButtonChildMenuComponent_ng_container_2_button_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r8); const item_r2 = i0.ɵɵnextContext().$implicit; const ctx_r10 = i0.ɵɵnextContext(); return ctx_r10.onClick(item_r2); });
    i0.ɵɵtemplate(1, EuiDropdownButtonChildMenuComponent_ng_container_2_button_1_span_1_Template, 1, 2, "span", 6);
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "translate");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const item_r2 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("id", item_r2.id)("disabled", item_r2.disabled);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", item_r2.iconClass);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 4, item_r2.label), " ");
} }
function EuiDropdownButtonChildMenuComponent_ng_container_2_ng_container_2_span_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 7);
} if (rf & 2) {
    const item_r2 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵproperty("ngClass", item_r2.iconClass);
    i0.ɵɵattribute("aria-label", item_r2.iconLabel);
} }
function EuiDropdownButtonChildMenuComponent_ng_container_2_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    const _r17 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "button", 8);
    i0.ɵɵlistener("keydown", function EuiDropdownButtonChildMenuComponent_ng_container_2_ng_container_2_Template_button_keydown_1_listener($event) { i0.ɵɵrestoreView(_r17); const item_r2 = i0.ɵɵnextContext().$implicit; const ctx_r16 = i0.ɵɵnextContext(); return ctx_r16.onKeyDown($event, item_r2); })("click", function EuiDropdownButtonChildMenuComponent_ng_container_2_ng_container_2_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r17); const item_r2 = i0.ɵɵnextContext().$implicit; const ctx_r19 = i0.ɵɵnextContext(); return ctx_r19.onClick(item_r2); });
    i0.ɵɵtemplate(2, EuiDropdownButtonChildMenuComponent_ng_container_2_ng_container_2_span_2_Template, 1, 2, "span", 6);
    i0.ɵɵtext(3);
    i0.ɵɵpipe(4, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(5, "eui-dropdown-button-child-menu", 9, 10);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const _r14 = i0.ɵɵreference(6);
    const item_r2 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("matMenuTriggerFor", _r14.childMenu)("id", item_r2.id)("disabled", item_r2.disabled);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", item_r2.iconClass);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(4, 6, item_r2.label), " ");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("menuItems", item_r2.children);
} }
function EuiDropdownButtonChildMenuComponent_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, EuiDropdownButtonChildMenuComponent_ng_container_2_button_1_Template, 4, 6, "button", 3);
    i0.ɵɵtemplate(2, EuiDropdownButtonChildMenuComponent_ng_container_2_ng_container_2_Template, 7, 8, "ng-container", 4);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const item_r2 = ctx.$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !item_r2.children);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", item_r2.children);
} }
export class EuiDropdownButtonChildMenuComponent {
    constructor(nestedItemService) {
        this.nestedItemService = nestedItemService;
    }
    /**
     * checks the keys pressed and calls the event emitter to emit the nested item
     * @param event The key event that is pressed
     * @param item The menu item passed
    */
    onKeyDown(event, item) {
        if (event.key === 'Enter') {
            this.nestedItemService.nestedItemSelect.emit(item);
        }
    }
    /**
     * Calls the event emitter to emit the nested item
     * @param item The menu item passed
    */
    onClick(item) {
        this.nestedItemService.nestedItemSelect.emit(item);
    }
}
/** @nocollapse */ EuiDropdownButtonChildMenuComponent.ɵfac = function EuiDropdownButtonChildMenuComponent_Factory(t) { return new (t || EuiDropdownButtonChildMenuComponent)(i0.ɵɵdirectiveInject(i1.EuiDropdownButtonMenuService)); };
/** @nocollapse */ EuiDropdownButtonChildMenuComponent.ɵcmp = i0.ɵɵdefineComponent({ type: EuiDropdownButtonChildMenuComponent, selectors: [["eui-dropdown-button-child-menu"]], viewQuery: function EuiDropdownButtonChildMenuComponent_Query(rf, ctx) { if (rf & 1) {
        i0.ɵɵstaticViewQuery(_c0, true);
    } if (rf & 2) {
        var _t;
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.childMenu = _t.first);
    } }, inputs: { menuItems: "menuItems" }, decls: 3, vars: 2, consts: [[3, "overlapTrigger"], ["childMenu", "matMenu"], [4, "ngFor", "ngForOf"], ["mat-menu-item", "", 3, "id", "disabled", "keydown", "click", 4, "ngIf"], [4, "ngIf"], ["mat-menu-item", "", 3, "id", "disabled", "keydown", "click"], ["class", "eui-menu-item__category-icon eui-icon", 3, "ngClass", 4, "ngIf"], [1, "eui-menu-item__category-icon", "eui-icon", 3, "ngClass"], ["mat-menu-item", "", 3, "matMenuTriggerFor", "id", "disabled", "keydown", "click"], [3, "menuItems"], ["menu", ""]], template: function EuiDropdownButtonChildMenuComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "mat-menu", 0, 1);
        i0.ɵɵtemplate(2, EuiDropdownButtonChildMenuComponent_ng_container_2_Template, 3, 2, "ng-container", 2);
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵproperty("overlapTrigger", false);
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngForOf", ctx.menuItems);
    } }, directives: [i2._MatMenu, i3.NgForOf, i3.NgIf, i2.MatMenuItem, i3.NgClass, i2.MatMenuTrigger, EuiDropdownButtonChildMenuComponent], pipes: [i4.TranslatePipe], styles: [".eui-dropdown-button-menu{display:inline-block}.eui-dropdown-button-menu__disabled{pointer-events:none}"], encapsulation: 2, changeDetection: 0 });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiDropdownButtonChildMenuComponent, [{
        type: Component,
        args: [{
                selector: 'eui-dropdown-button-child-menu',
                templateUrl: './eui-dropdown-button-child-menu.component.html',
                styleUrls: ['./styles/_index.scss'],
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
            }]
    }], function () { return [{ type: i1.EuiDropdownButtonMenuService }]; }, { menuItems: [{
            type: Input
        }], childMenu: [{
            type: ViewChild,
            args: ['childMenu', { static: true }]
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 