/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
import { ChangeDetectionStrategy, Component, EventEmitter, HostListener, Input, Output } from '@angular/core';
import { DejaPopupAction } from '../../model/popup-action.model';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/material/button";
import * as i3 from "@angular/material/icon";
export class DejaPopupBoxComponent {
    constructor() {
        this.action = new EventEmitter();
        this.showActions = false;
        this.buttonClose = {
            name: 'toolbar-close',
            icon: 'close',
            label: 'Close'
        };
        this.buttonFullscreen = {
            name: 'toolbar-fullscreen',
            icon: 'fullscreen',
            label: 'Fullscreen'
        };
        this.buttonMinimize = {
            name: 'toolbar-minify',
            icon: 'remove',
            label: 'Minify'
        };
    }
    onMouseEnter() {
        this.showActions = true;
    }
    onMouseLeave() {
        this.showActions = false;
    }
    doEmit(action) {
        action.target = 'popup-tray';
        this.dialog.componentInstance.isMinified = !this.dialog.componentInstance.isMinified;
        action.panelClass = this.dialog.componentInstance.config.dialogPanelId;
        this.action.emit(action);
    }
    doClose() {
        this.dialog.close();
        const a = new DejaPopupAction('tray-refresh', 'popup-tray');
        this.action.emit(a);
    }
}
DejaPopupBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DejaPopupBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
DejaPopupBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: DejaPopupBoxComponent, selector: "deja-popup-box", inputs: { dialog: "dialog" }, outputs: { action: "action" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" } }, ngImport: i0, template: "<span class=\"deja-popup-box-title\">{{dialog.componentInstance.config.title}}</span>\n\n<span *ngIf=\"showActions\" class=\"deja-popup-box-actions\">\n    <span class=\"deja-popup-box-content\">\n        <button type=\"button\" *ngIf=\"!dialog.componentInstance.isMinified\" mat-icon-button (click)=\"doEmit(buttonMinimize)\" tabindex=\"0\">\n            <mat-icon aria-label=\"buttonMinimize.label\">{{buttonMinimize.icon}}</mat-icon>\n        </button>\n        <button type=\"button\" *ngIf=\"dialog.componentInstance.isMinified\" mat-icon-button (click)=\"doEmit(buttonFullscreen)\" tabindex=\"0\">\n            <mat-icon aria-label=\"buttonFullscreen.label\">{{buttonFullscreen.icon}}</mat-icon>\n        </button>\n        <button type=\"button\" mat-icon-button (click)=\"doClose()\" tabindex=\"0\">\n            <mat-icon aria-label=\"buttonClose.label\">{{buttonClose.icon}}</mat-icon>\n        </button>\n    </span>\n</span>", styles: [":host{line-height:36px;font-size:.8rem;margin:0 1px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .deja-popup-box-title{padding:0 .8rem}:host .deja-popup-box-actions{position:absolute;width:100%;top:0;left:0;text-align:right}:host .deja-popup-box-actions .deja-popup-box-content{padding-right:1rem}:host .deja-popup-box-actions .deja-popup-box-content button{width:18px;height:18px;line-height:18px}:host .deja-popup-box-actions .deja-popup-box-content button .mat-icon{line-height:18px;font-size:18px;height:18px;width:18px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button],             button[mat-fab], button[mat-mini-fab], button[mat-stroked-button],             button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: DejaPopupBoxComponent, decorators: [{
            type: Component,
            args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'deja-popup-box', template: "<span class=\"deja-popup-box-title\">{{dialog.componentInstance.config.title}}</span>\n\n<span *ngIf=\"showActions\" class=\"deja-popup-box-actions\">\n    <span class=\"deja-popup-box-content\">\n        <button type=\"button\" *ngIf=\"!dialog.componentInstance.isMinified\" mat-icon-button (click)=\"doEmit(buttonMinimize)\" tabindex=\"0\">\n            <mat-icon aria-label=\"buttonMinimize.label\">{{buttonMinimize.icon}}</mat-icon>\n        </button>\n        <button type=\"button\" *ngIf=\"dialog.componentInstance.isMinified\" mat-icon-button (click)=\"doEmit(buttonFullscreen)\" tabindex=\"0\">\n            <mat-icon aria-label=\"buttonFullscreen.label\">{{buttonFullscreen.icon}}</mat-icon>\n        </button>\n        <button type=\"button\" mat-icon-button (click)=\"doClose()\" tabindex=\"0\">\n            <mat-icon aria-label=\"buttonClose.label\">{{buttonClose.icon}}</mat-icon>\n        </button>\n    </span>\n</span>", styles: [":host{line-height:36px;font-size:.8rem;margin:0 1px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .deja-popup-box-title{padding:0 .8rem}:host .deja-popup-box-actions{position:absolute;width:100%;top:0;left:0;text-align:right}:host .deja-popup-box-actions .deja-popup-box-content{padding-right:1rem}:host .deja-popup-box-actions .deja-popup-box-content button{width:18px;height:18px;line-height:18px}:host .deja-popup-box-actions .deja-popup-box-content button .mat-icon{line-height:18px;font-size:18px;height:18px;width:18px}\n"] }]
        }], propDecorators: { dialog: [{
                type: Input
            }], action: [{
                type: Output
            }], onMouseEnter: [{
                type: HostListener,
                args: ['mouseenter']
            }], onMouseLeave: [{
                type: HostListener,
                args: ['mouseleave']
            }] } });
//# sourceMappingURL=data:application/json;base64, 