import * as i0 from '@angular/core';
import { EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
import * as i1 from '@angular/material/dialog';
import { CSSFrameworkEnum } from '@asoftwareworld/form-builder-pro/api';
import * as i6 from '@asoftwareworld/form-builder-pro/common';
import { Constants, Icons, MaterialModule, AswPipeModule } from '@asoftwareworld/form-builder-pro/common';
import { AswConfirmDialog, AswConfirmDialogModule } from '@asoftwareworld/form-builder-pro/form-control/confirm-dialog';
import { AswDigitalDialog, AswSharedDialogModule } from '@asoftwareworld/form-builder-pro/form-control/shared';
import { AswImageDrawing, AswImageDrawingModule } from '@asoftwareworld/form-builder-pro/image-drawing';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i3 from '@angular/material/button';
import * as i4 from '@angular/material/tooltip';
import * as i5 from '@asoftwareworld/form-builder-pro/core';
import { AswTranslateModule } from '@asoftwareworld/form-builder-pro/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */
class AswSignature {
    dialog;
    constants = Constants;
    icons = Icons;
    control;
    CSSFramework = CSSFrameworkEnum.Material;
    isPreviewTemplate = false;
    signatureUpdateEvent = new EventEmitter();
    signatureDeleteEvent = new EventEmitter();
    duplicateControl = new EventEmitter();
    constructor(dialog) {
        this.dialog = dialog;
    }
    deleteSignatureDialog(control) {
        const dialogRef = this.dialog.open(AswConfirmDialog, {
            width: '350px',
            data: { name: control.controlType, message: this.constants.messages.waringMessage }
        });
        dialogRef.afterClosed().subscribe((result) => {
            if (result !== undefined) {
                this.signatureDeleteEvent.emit(control);
            }
        });
    }
    signatureDialog(control) {
        const dialogRef = this.dialog.open(AswImageDrawing, {
            width: '80%',
            disableClose: true,
            data: control
        });
        dialogRef.afterClosed().subscribe((result) => {
            if (result !== undefined) {
                this.signatureUpdateEvent.emit(result);
            }
        });
    }
    editSignatureDialog(control) {
        const dialogRef = this.dialog.open(AswDigitalDialog, {
            width: '50%',
            disableClose: true,
            data: { control, CSSFramework: this.CSSFramework }
        });
        dialogRef.afterClosed().subscribe((result) => {
            if (result !== undefined) {
                this.signatureUpdateEvent.emit(result);
            }
        });
    }
    duplicateSignatureControl(control) {
        this.duplicateControl.emit(control);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswSignature, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswSignature, selector: "asw-signature", inputs: { control: "control", CSSFramework: "CSSFramework", isPreviewTemplate: "isPreviewTemplate" }, outputs: { signatureUpdateEvent: "signatureUpdateEvent", signatureDeleteEvent: "signatureDeleteEvent", duplicateControl: "duplicateControl" }, ngImport: i0, template: "<ng-container *ngIf=\"control as control\">\r\n    <div class=\"{{control.class}}\">\r\n        <img class=\"asw-img-thumbnail\" src=\"{{control.imageUrl}}\" [height]=\"control.height\" [width]=\"control.width\"/>\r\n        <div class=\"asw-my-2\" *ngIf=\"control.isUploadHide\">\r\n            <button mat-stroked-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Signature' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\"\r\n                    (click)=\"signatureDialog(control)\">\r\n                <span [innerHTML]=\"icons.gesture | aswSafeHtml\"></span>\r\n                {{'FormControl.Signature' | aswTranslate}}\r\n            </button>\r\n        </div>\r\n    </div>\r\n    <div class=\"asw-row\" *ngIf=\"isPreviewTemplate\">\r\n        <div class=\"asw-col-md-12\" align=\"right\">\r\n            <button mat-icon-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Duplicate' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\" \r\n                    (click)=\"duplicateSignatureControl(control)\">\r\n                <div [innerHTML]=\"icons.contentCopy | aswSafeHtml\"></div>\r\n            </button>\r\n            <button mat-icon-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Edit' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\"\r\n                    (click)=\"editSignatureDialog(control)\">\r\n                <div [innerHTML]=\"icons.edit | aswSafeHtml\"></div>\r\n            </button>\r\n            <button mat-icon-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Delete' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\"\r\n                    (click)=\"deleteSignatureDialog(control)\">\r\n                <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n            </button>\r\n        </div>\r\n    </div>\r\n</ng-container>", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i5.AswTranslatePipe, name: "aswTranslate" }, { kind: "pipe", type: i6.AswSafeHtmlPipe, name: "aswSafeHtml" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswSignature, decorators: [{
            type: Component,
            args: [{ selector: 'asw-signature', template: "<ng-container *ngIf=\"control as control\">\r\n    <div class=\"{{control.class}}\">\r\n        <img class=\"asw-img-thumbnail\" src=\"{{control.imageUrl}}\" [height]=\"control.height\" [width]=\"control.width\"/>\r\n        <div class=\"asw-my-2\" *ngIf=\"control.isUploadHide\">\r\n            <button mat-stroked-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Signature' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\"\r\n                    (click)=\"signatureDialog(control)\">\r\n                <span [innerHTML]=\"icons.gesture | aswSafeHtml\"></span>\r\n                {{'FormControl.Signature' | aswTranslate}}\r\n            </button>\r\n        </div>\r\n    </div>\r\n    <div class=\"asw-row\" *ngIf=\"isPreviewTemplate\">\r\n        <div class=\"asw-col-md-12\" align=\"right\">\r\n            <button mat-icon-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Duplicate' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\" \r\n                    (click)=\"duplicateSignatureControl(control)\">\r\n                <div [innerHTML]=\"icons.contentCopy | aswSafeHtml\"></div>\r\n            </button>\r\n            <button mat-icon-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Edit' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\"\r\n                    (click)=\"editSignatureDialog(control)\">\r\n                <div [innerHTML]=\"icons.edit | aswSafeHtml\"></div>\r\n            </button>\r\n            <button mat-icon-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Delete' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\"\r\n                    (click)=\"deleteSignatureDialog(control)\">\r\n                <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n            </button>\r\n        </div>\r\n    </div>\r\n</ng-container>" }]
        }], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { control: [{
                type: Input
            }], CSSFramework: [{
                type: Input
            }], isPreviewTemplate: [{
                type: Input
            }], signatureUpdateEvent: [{
                type: Output
            }], signatureDeleteEvent: [{
                type: Output
            }], duplicateControl: [{
                type: Output
            }] } });

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */
class AswSignatureModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswSignatureModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: AswSignatureModule, declarations: [AswSignature], imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswImageDrawingModule, AswConfirmDialogModule, AswSharedDialogModule, AswTranslateModule, AswPipeModule], exports: [AswSignature] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswSignatureModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswImageDrawingModule, AswConfirmDialogModule, AswSharedDialogModule, AswTranslateModule, AswPipeModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswSignatureModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswImageDrawingModule, AswConfirmDialogModule, AswSharedDialogModule, AswTranslateModule, AswPipeModule],
                    declarations: [AswSignature],
                    exports: [AswSignature]
                }]
        }] });

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */

/**
 * Generated bundle index. Do not edit.
 */

export { AswSignature, AswSignatureModule };
//# sourceMappingURL=asoftwareworld-form-builder-pro-form-control-signature.mjs.map
