UNPKG

@asoftwareworld/form-builder-pro

Version:

ASW Form Builder Pro helps you with rapid development and designed web forms which includes several controls. The key feature of Form Builder is to make your content attractive and effective. We can customize our control at run time and preview the same b

136 lines (130 loc) 11.6 kB
import * as i0 from '@angular/core'; import { EventEmitter, Output, Input, Component, NgModule } from '@angular/core'; import { CSSFrameworkEnum } from '@asoftwareworld/form-builder-pro/api'; import * as i6 from '@asoftwareworld/form-builder-pro/common'; import { Constants, Icons, 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 i1 from '@angular/material/dialog'; import { MatDialogModule } from '@angular/material/dialog'; import * as i2 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i3 from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button'; import * as i4 from '@angular/material/tooltip'; import { MatTooltipModule } 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'; import { MatDividerModule } from '@angular/material/divider'; /** * @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 AswDrawing { dialog; constants = Constants; icons = Icons; control; CSSFramework = CSSFrameworkEnum.Material; isPreviewTemplate = false; drawingUpdateEvent = new EventEmitter(); drawingDeleteEvent = new EventEmitter(); duplicateControl = new EventEmitter(); constructor(dialog) { this.dialog = dialog; } deleteDrawingDialog(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.drawingDeleteEvent.emit(control); } }); } drawingImageDialog(control) { const dialogRef = this.dialog.open(AswImageDrawing, { width: '80%', minWidth: '80vw', disableClose: true, data: control }); dialogRef.afterClosed().subscribe((result) => { if (result !== undefined) { this.drawingUpdateEvent.emit(result); } }); } editDrawingDialog(control) { const dialogRef = this.dialog.open(AswDigitalDialog, { width: '50%', disableClose: true, data: { control, CSSFramework: this.CSSFramework } }); dialogRef.afterClosed().subscribe((result) => { if (result !== undefined) { this.drawingUpdateEvent.emit(result); } }); } duplicateDrawingControl(control) { this.duplicateControl.emit(control); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswDrawing, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AswDrawing, selector: "asw-drawing", inputs: { control: "control", CSSFramework: "CSSFramework", isPreviewTemplate: "isPreviewTemplate" }, outputs: { drawingUpdateEvent: "drawingUpdateEvent", drawingDeleteEvent: "drawingDeleteEvent", 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.DrawImage' | aswTranslate}}\" \r\n [matTooltipPosition]=\"'below'\"\r\n (click)=\"drawingImageDialog(control)\">\r\n <span [innerHTML]=\"icons.draw | aswSafeHtml\"></span>\r\n {{'FormControl.DrawImage' | 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)=\"duplicateDrawingControl(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)=\"editDrawingDialog(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)=\"deleteDrawingDialog(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] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i5.AswTranslatePipe, name: "aswTranslate" }, { kind: "pipe", type: i6.AswSafeHtmlPipe, name: "aswSafeHtml" }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswDrawing, decorators: [{ type: Component, args: [{ selector: 'asw-drawing', 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.DrawImage' | aswTranslate}}\" \r\n [matTooltipPosition]=\"'below'\"\r\n (click)=\"drawingImageDialog(control)\">\r\n <span [innerHTML]=\"icons.draw | aswSafeHtml\"></span>\r\n {{'FormControl.DrawImage' | 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)=\"duplicateDrawingControl(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)=\"editDrawingDialog(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)=\"deleteDrawingDialog(control)\">\r\n <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n </button>\r\n </div>\r\n </div>\r\n</ng-container>" }] }], ctorParameters: () => [{ type: i1.MatDialog }], propDecorators: { control: [{ type: Input }], CSSFramework: [{ type: Input }], isPreviewTemplate: [{ type: Input }], drawingUpdateEvent: [{ type: Output }], drawingDeleteEvent: [{ 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 AswDrawingModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswDrawingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AswDrawingModule, declarations: [AswDrawing], imports: [CommonModule, FormsModule, ReactiveFormsModule, MatDialogModule, AswImageDrawingModule, AswConfirmDialogModule, MatButtonModule, AswSharedDialogModule, MatTooltipModule, MatDividerModule, AswTranslateModule, AswPipeModule], exports: [AswDrawing] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswDrawingModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, MatDialogModule, AswImageDrawingModule, AswConfirmDialogModule, MatButtonModule, AswSharedDialogModule, MatTooltipModule, MatDividerModule, AswTranslateModule, AswPipeModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswDrawingModule, decorators: [{ type: NgModule, args: [{ imports: [CommonModule, FormsModule, ReactiveFormsModule, MatDialogModule, AswImageDrawingModule, AswConfirmDialogModule, MatButtonModule, AswSharedDialogModule, MatTooltipModule, MatDividerModule, AswTranslateModule, AswPipeModule], declarations: [AswDrawing], exports: [AswDrawing] }] }] }); /** * @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 { AswDrawing, AswDrawingModule }; //# sourceMappingURL=asoftwareworld-form-builder-pro-form-control-drawing.mjs.map