/*
 *  @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, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
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";
import * as i4 from "../../model/popup-config.model";
export class DejaPopupActionsComponent {
    constructor(config) {
        this.config = config;
    }
    ngOnInit() {
        if (this.config.actions.length) {
            this.buttons = this.config.actions;
        }
    }
    emit(action) {
        if (this.config.dejaPopupCom$) {
            action.target = this.config.id;
            this.config.dejaPopupCom$.next(action);
        }
    }
}
DejaPopupActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DejaPopupActionsComponent, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
DejaPopupActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: DejaPopupActionsComponent, selector: "deja-popup-actions", ngImport: i0, template: "<div class=\"deja-popup-spacer\">&nbsp;</div>\n<ng-container *ngFor=\"let but of buttons\">\n\n    <button type=\"button\" *ngIf=\"!but.label\" mat-icon-button (click)=\"emit(but)\">\n        <mat-icon *ngIf=\"but.icon\" color=\"primary\" role=\"img\" aria-hidden=\"true\">{{but.icon}}</mat-icon>\n    </button>\n\n    <button type=\"button\" *ngIf=\"but.label\" mat-raised-button color=\"primary\" [name]=\"but.name\" (click)=\"emit(but)\">\n        <mat-icon *ngIf=\"but.icon\" role=\"img\" aria-hidden=\"true\">{{but.icon}}</mat-icon>{{but.label}}\n    </button>\n\n</ng-container>", styles: [":host{display:flex;width:100%;height:100%}:host .deja-popup-spacer{flex:1 1 auto}:host button{margin-left:8px}:host button .mat-icon{line-height:18px;font-size:18px;height:18px;width:18px;margin-right:3px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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.1", ngImport: i0, type: DejaPopupActionsComponent, decorators: [{
            type: Component,
            args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'deja-popup-actions', template: "<div class=\"deja-popup-spacer\">&nbsp;</div>\n<ng-container *ngFor=\"let but of buttons\">\n\n    <button type=\"button\" *ngIf=\"!but.label\" mat-icon-button (click)=\"emit(but)\">\n        <mat-icon *ngIf=\"but.icon\" color=\"primary\" role=\"img\" aria-hidden=\"true\">{{but.icon}}</mat-icon>\n    </button>\n\n    <button type=\"button\" *ngIf=\"but.label\" mat-raised-button color=\"primary\" [name]=\"but.name\" (click)=\"emit(but)\">\n        <mat-icon *ngIf=\"but.icon\" role=\"img\" aria-hidden=\"true\">{{but.icon}}</mat-icon>{{but.label}}\n    </button>\n\n</ng-container>", styles: [":host{display:flex;width:100%;height:100%}:host .deja-popup-spacer{flex:1 1 auto}:host button{margin-left:8px}:host button .mat-icon{line-height:18px;font-size:18px;height:18px;width:18px;margin-right:3px}\n"] }]
        }], ctorParameters: function () { return [{ type: i4.DejaPopupConfig, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }]; } });
//#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