/**
 * SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
 * Copyright (C) 2021 SalesAgility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
 * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License
 * version 3, these Appropriate Legal Notices must retain the display of the
 * "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Supercharged by SuiteCRM".
 */
import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../image/image.component";
import * as i3 from "@ng-bootstrap/ng-bootstrap";
function DropdownSubmenuComponent_scrm_image_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "scrm-image", 5);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("image", ctx_r0.item.icon);
} }
function DropdownSubmenuComponent_div_5_li_2_scrm_image_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "scrm-image", 5);
} if (rf & 2) {
    const subItem_r3 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("image", subItem_r3.icon);
} }
function DropdownSubmenuComponent_div_5_li_2_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "li", 9)(1, "a", 10);
    i0.ɵɵlistener("click", function DropdownSubmenuComponent_div_5_li_2_Template_a_click_1_listener() { const restoredCtx = i0.ɵɵrestoreView(_r7); const subItem_r3 = restoredCtx.$implicit; const ctx_r6 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r6.click(subItem_r3)); });
    i0.ɵɵtemplate(2, DropdownSubmenuComponent_div_5_li_2_scrm_image_2_Template, 1, 1, "scrm-image", 2);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const subItem_r3 = ctx.$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", subItem_r3 && subItem_r3.klass);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", subItem_r3.icon);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", subItem_r3 && subItem_r3.label, " ");
} }
function DropdownSubmenuComponent_div_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 6)(1, "ul", 7);
    i0.ɵɵtemplate(2, DropdownSubmenuComponent_div_5_li_2_Template, 4, 3, "li", 8);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngbCollapse", ctx_r1.isCollapsed);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngForOf", ctx_r1.item.items);
} }
const _c0 = ["*"];
class DropdownSubmenuComponent {
    constructor() {
        this.itemClicked = new EventEmitter();
        this.isCollapsed = true;
    }
    ngOnInit() {
    }
    click(item) {
        if (item && item.onClick) {
            item.onClick();
        }
        this.itemClicked.emit(true);
    }
    static { this.ɵfac = function DropdownSubmenuComponent_Factory(t) { return new (t || DropdownSubmenuComponent)(); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DropdownSubmenuComponent, selectors: [["scrm-dropdown-submenu"]], inputs: { item: "item" }, outputs: { itemClicked: "item-clicked" }, ngContentSelectors: _c0, decls: 8, vars: 3, consts: [[1, "dropdown-submenu-items-container"], [1, "dropdown-submenu-parent-button", "dropdown-item", "dropdown-toggle", 3, "click"], [3, "image", 4, "ngIf"], [3, "ngbCollapse", 4, "ngIf"], [1, "dropdown-submenu-extra"], [3, "image"], [3, "ngbCollapse"], [1, "dropdown-submenu", "pl-2", "mb-1"], ["class", "dropdown-submenu-item dropdown-item", 4, "ngFor", "ngForOf"], [1, "dropdown-submenu-item", "dropdown-item"], [1, "action-link", "dropdown-submenu-item-link", 3, "ngClass", "click"]], template: function DropdownSubmenuComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef();
            i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "a", 1);
            i0.ɵɵlistener("click", function DropdownSubmenuComponent_Template_a_click_2_listener() { return ctx.isCollapsed = !ctx.isCollapsed; });
            i0.ɵɵtemplate(3, DropdownSubmenuComponent_scrm_image_3_Template, 1, 1, "scrm-image", 2);
            i0.ɵɵtext(4);
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(5, DropdownSubmenuComponent_div_5_Template, 3, 2, "div", 3);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(6, "div", 4);
            i0.ɵɵprojection(7);
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵadvance(3);
            i0.ɵɵproperty("ngIf", ctx.item && ctx.item.icon);
            i0.ɵɵadvance(1);
            i0.ɵɵtextInterpolate1(" ", ctx.item && ctx.item.label, " ");
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", ctx.item && ctx.item.items.length);
        } }, dependencies: [i1.NgClass, i1.NgForOf, i1.NgIf, i2.ImageComponent, i3.NgbCollapse], encapsulation: 2 }); }
}
export { DropdownSubmenuComponent };
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DropdownSubmenuComponent, [{
        type: Component,
        args: [{ selector: 'scrm-dropdown-submenu', template: "<! --\n/**\n* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.\n* Copyright (C) 2021 SalesAgility Ltd.\n*\n* This program is free software; you can redistribute it and/or modify it under\n* the terms of the GNU Affero General Public License version 3 as published by the\n* Free Software Foundation with the addition of the following permission added\n* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK\n* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE\n* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.\n*\n* This program is distributed in the hope that it will be useful, but WITHOUT\n* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\n* details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program.  If not, see http://www.gnu.org/licenses.\n*\n* In accordance with Section 7(b) of the GNU Affero General Public License\n* version 3, these Appropriate Legal Notices must retain the display of the\n* \"Supercharged by SuiteCRM\" logo. If the display of the logos is not reasonably\n* feasible for technical reasons, the Appropriate Legal Notices must display\n* the words \"Supercharged by SuiteCRM\".\n*/\n-->\n<div>\n    <div class=\"dropdown-submenu-items-container\">\n        <a (click)=\"isCollapsed = !isCollapsed\"\n           class=\"dropdown-submenu-parent-button dropdown-item dropdown-toggle\"\n        >\n            <scrm-image *ngIf=\"item && item.icon\" [image]=\"item.icon\"></scrm-image>\n            {{item && item.label}}\n        </a>\n        <div *ngIf=\"item && item.items.length\" [ngbCollapse]=\"isCollapsed\">\n            <ul class=\"dropdown-submenu pl-2 mb-1\">\n\n                <li *ngFor=\"let subItem of item.items\" class=\"dropdown-submenu-item dropdown-item\">\n\n                    <a class=\"action-link dropdown-submenu-item-link\"\n                       [ngClass]=\"subItem && subItem.klass\"\n                       (click)=\"click(subItem)\">\n                        <scrm-image *ngIf=\"subItem.icon\" [image]=\"subItem.icon\"></scrm-image>\n                        {{subItem && subItem.label}}\n                    </a>\n                </li>\n            </ul>\n        </div>\n    </div>\n    <div class=\"dropdown-submenu-extra\">\n        <ng-content></ng-content>\n    </div>\n</div>\n" }]
    }], function () { return []; }, { item: [{
            type: Input
        }], itemClicked: [{
            type: Output,
            args: ['item-clicked']
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 