/**
 * @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
 */
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Constants, Icons } from '@asoftwareworld/form-builder-pro/common';
import { AswConfirmDialog } from '@asoftwareworld/form-builder-pro/form-control/confirm-dialog';
import * as i0 from "@angular/core";
import * as i1 from "@angular/material/dialog";
import * as i2 from "@angular/common";
import * as i3 from "@angular/material/divider";
import * as i4 from "@angular/material/tooltip";
import * as i5 from "@angular/material/button";
import * as i6 from "@asoftwareworld/form-builder-pro/core";
import * as i7 from "@asoftwareworld/form-builder-pro/common";
export class AswDivider {
    dialog;
    constants = Constants;
    icons = Icons;
    /**
     * Divider control
     */
    control;
    isPreviewTemplate = false;
    dividerDeleteEvent = new EventEmitter();
    duplicateControl = new EventEmitter();
    constructor(dialog) {
        this.dialog = dialog;
    }
    /**
     * Delete divider control based on control index
     * @param control divider control items
     */
    deleteDividerDialog(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.dividerDeleteEvent.emit(control);
            }
        });
    }
    duplicateDividerControl(control) {
        this.duplicateControl.emit(control);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswDivider, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswDivider, selector: "asw-divider", inputs: { control: "control", isPreviewTemplate: "isPreviewTemplate" }, outputs: { dividerDeleteEvent: "dividerDeleteEvent", duplicateControl: "duplicateControl" }, ngImport: i0, template: "<mat-divider></mat-divider>\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)=\"duplicateDividerControl(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.Delete'| aswTranslate}}\" \r\n                [matTooltipPosition]=\"'below'\" \r\n                (click)=\"deleteDividerDialog(control)\">\r\n            <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n</div>", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i6.AswTranslatePipe, name: "aswTranslate" }, { kind: "pipe", type: i7.AswSafeHtmlPipe, name: "aswSafeHtml" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswDivider, decorators: [{
            type: Component,
            args: [{ selector: 'asw-divider', template: "<mat-divider></mat-divider>\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)=\"duplicateDividerControl(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.Delete'| aswTranslate}}\" \r\n                [matTooltipPosition]=\"'below'\" \r\n                (click)=\"deleteDividerDialog(control)\">\r\n            <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n</div>" }]
        }], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { control: [{
                type: Input
            }], isPreviewTemplate: [{
                type: Input
            }], dividerDeleteEvent: [{
                type: Output
            }], duplicateControl: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 