import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { SmzMenuPipe } from './pipes/smz-menu.pipe';
import { GlobalInjector } from '../../common/services/global-injector';
import { Store } from '@ngxs/store';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "primeng/button";
import * as i3 from "./components/menu";
import * as i4 from "primeng/tooltip";
import * as i5 from "./directives/menu-item-actions.directive";
import * as i6 from "./pipes/smz-flatten-menu.pipe";
export class SmzMenuComponent {
    constructor() {
        this.buttonClass = '';
        this.styleClass = '';
        this.icon = 'pi pi-bars';
        this.behavior = 'overlay';
        this.menuItems = [];
    }
    toggle(event, actionMenu) {
        const items = this.callback != null ? this.callback(this.data) : this.items;
        const store = GlobalInjector.instance.get(Store);
        this.menuItems = new SmzMenuPipe(store).transform(items, this.data);
        actionMenu.toggle(event, this.data);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SmzMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: SmzMenuComponent, selector: "smz-menu", inputs: { items: "items", callback: "callback", data: "data", buttonClass: "buttonClass", styleClass: "styleClass", icon: "icon", behavior: "behavior" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"behavior\">\r\n\r\n  <ng-container *ngSwitchCase=\"'overlay'\">\r\n      <smz-menu-items #actionMenu [popup]=\"true\" [model]=\"menuItems\" appendTo=\"body\"></smz-menu-items>\r\n      <p-button id=\"action-button\" type=\"button\" [ngClass]=\"buttonClass\" [styleClass]=\"styleClass\" [icon]=\"icon\" (onClick)=\"toggle($event, actionMenu)\"></p-button>\r\n  </ng-container>\r\n\r\n  <ng-container *ngSwitchCase=\"'inline'\">\r\n    <div class=\"grid grid-nogutter items-center justify-start\">\r\n      <ng-container *ngFor=\"let item of (items | smzFlattenMenu : data)\">\r\n        <button *ngIf=\"item.visible\" pButton type=\"button\" smzMenuItemAction [item]=\"item\" [data]=\"data\" [icon]=\"item.icon\" class=\"p-button-rounded p-button-text\" [ngClass]=\"item.styleClass\" [disabled]=\"item.disabled\" [pTooltip]=\"item.tooltip\"></button>\r\n      </ng-container>\r\n    </div>\r\n  </ng-container>\r\n\r\n</ng-container>", 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.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i3.Menu, selector: "smz-menu-items", inputs: ["model", "popup", "style", "styleClass", "appendTo", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }, { kind: "directive", type: i4.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "directive", type: i5.SmzMenuItemActionsDirective, selector: "[smzMenuItemAction]", inputs: ["item", "data"], outputs: ["collapse"] }, { kind: "pipe", type: i6.SmzFlattenMenuPipe, name: "smzFlattenMenu" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SmzMenuComponent, decorators: [{
            type: Component,
            args: [{ selector: 'smz-menu', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container [ngSwitch]=\"behavior\">\r\n\r\n  <ng-container *ngSwitchCase=\"'overlay'\">\r\n      <smz-menu-items #actionMenu [popup]=\"true\" [model]=\"menuItems\" appendTo=\"body\"></smz-menu-items>\r\n      <p-button id=\"action-button\" type=\"button\" [ngClass]=\"buttonClass\" [styleClass]=\"styleClass\" [icon]=\"icon\" (onClick)=\"toggle($event, actionMenu)\"></p-button>\r\n  </ng-container>\r\n\r\n  <ng-container *ngSwitchCase=\"'inline'\">\r\n    <div class=\"grid grid-nogutter items-center justify-start\">\r\n      <ng-container *ngFor=\"let item of (items | smzFlattenMenu : data)\">\r\n        <button *ngIf=\"item.visible\" pButton type=\"button\" smzMenuItemAction [item]=\"item\" [data]=\"data\" [icon]=\"item.icon\" class=\"p-button-rounded p-button-text\" [ngClass]=\"item.styleClass\" [disabled]=\"item.disabled\" [pTooltip]=\"item.tooltip\"></button>\r\n      </ng-container>\r\n    </div>\r\n  </ng-container>\r\n\r\n</ng-container>" }]
        }], propDecorators: { items: [{
                type: Input
            }], callback: [{
                type: Input
            }], data: [{
                type: Input
            }], buttonClass: [{
                type: Input
            }], styleClass: [{
                type: Input
            }], icon: [{
                type: Input
            }], behavior: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 