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

82 lines (81 loc) 57.7 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 i9 from '@asoftwareworld/form-builder-pro/common'; import { Constants, Icons, MaterialModule, AswPipeModule, AswMaskModule } from '@asoftwareworld/form-builder-pro/common'; import { AswConfirmDialog, AswConfirmDialogModule } from '@asoftwareworld/form-builder-pro/form-control/confirm-dialog'; import { AswTextDialog, AswSharedDialogModule } from '@asoftwareworld/form-builder-pro/form-control/shared'; import * as i1 from '@angular/material/dialog'; import * as i2 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i3 from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import * as i4 from '@angular/material/button'; import * as i5 from '@angular/material/input'; import * as i6 from '@angular/material/form-field'; import * as i7 from '@angular/material/tooltip'; import * as i8 from '@angular/material/icon'; import * as i10 from '@asoftwareworld/form-builder-pro/core'; import { AswTranslateModule } from '@asoftwareworld/form-builder-pro/core'; /** * @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 AswTextField { dialog; constants = Constants; icons = Icons; /** * TextField control */ control = null; propertyPersonalization = []; isPreviewTemplate = false; CSSFramework = CSSFrameworkEnum.Material; patterns = []; textFieldUpdateEvent = new EventEmitter(); textFieldDeleteEvent = new EventEmitter(); aswModelChange = new EventEmitter(); duplicateControl = new EventEmitter(); constructor(dialog) { this.dialog = dialog; } deleteTextFieldDialog(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.textFieldDeleteEvent.emit(control); } }); } editTextFieldDialog(control) { const dialogRef = this.dialog.open(AswTextDialog, { width: '80%', minWidth: '70vw', disableClose: true, data: { control, CSSFramework: this.CSSFramework, propertyPersonalization: this.propertyPersonalization, patterns: this.patterns } }); dialogRef.afterClosed().subscribe((result) => { if (result !== undefined) { this.textFieldUpdateEvent.emit(result); } }); } onChange(control) { this.aswModelChange.emit(control); } duplicateTextFieldControl(control) { this.duplicateControl.emit(control); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswTextField, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AswTextField, selector: "asw-textfield", inputs: { control: "control", propertyPersonalization: "propertyPersonalization", isPreviewTemplate: "isPreviewTemplate", CSSFramework: "CSSFramework", patterns: "patterns" }, outputs: { textFieldUpdateEvent: "textFieldUpdateEvent", textFieldDeleteEvent: "textFieldDeleteEvent", aswModelChange: "aswModelChange", duplicateControl: "duplicateControl" }, ngImport: i0, template: "<ng-container *ngIf=\"control as control\">\r\n <ng-container *ngIf=\"CSSFramework === 'material'; else bootstrap\">\r\n <ng-container [ngSwitch]=\"control.controlType\">\r\n <ng-container *ngSwitchCase=\"'textfield'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #textfield=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-icon *ngIf=\"textfield.invalid && (textfield.dirty || textfield.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"textfield.invalid && (textfield.dirty || textfield.touched)\">\r\n <ng-container *ngIf=\"textfield?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"textfield?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"textfield?.errors?.pattern\">\r\n {{control.customErrorMsg}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <textarea matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #input=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\"></textarea>\r\n <mat-icon *ngIf=\"input.invalid && (input.dirty || input.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"input.invalid && (input.dirty || input.touched)\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.pattern\">\r\n {{control.customErrorMsg}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern ? control.pattern : '^[A-Za-z0-9_\\+-]+(\\.[A-Za-z0-9_\\+-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.([A-Za-z]{2,4})$'}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #input=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-icon *ngIf=\"input.invalid && (input.dirty || input.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"input.invalid && (input.dirty || input.touched)\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{'Please enter a valid email address' | aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Email format should be xyz@example.com') | aswTranslate}}.\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'url'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern ? control.pattern : '^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$'}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #url=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-icon *ngIf=\"url.invalid && (url.dirty || url.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"url.invalid && (url.dirty || url.touched)\">\r\n <ng-container *ngIf=\"url?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"url?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"url?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Yikes! That\\'s not a valid URL') | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'phone-number'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #phoneNumber=\"ngModel\"\r\n aswMask=\"(000) 000-0000\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-icon *ngIf=\"phoneNumber.invalid && (phoneNumber.dirty || phoneNumber.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"phoneNumber.invalid && (phoneNumber.dirty || phoneNumber.touched)\">\r\n <ng-container *ngIf=\"phoneNumber?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"phoneNumber?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"phoneNumber?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Not a valid Phone Number') | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #bootstrap>\r\n <ng-container [ngSwitch]=\"control.controlType\">\r\n <ng-container *ngSwitchCase=\"'textfield'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(textfield.invalid && (textfield.dirty || textfield.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <input type=\"text\" \r\n class=\"asw-input-control {{control.customClass}}\" \r\n id=\"{{control.id}}\" \r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #textfield=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [class.asw-is-invalid]=\"textfield.invalid && (textfield.dirty || textfield.touched)\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <div *ngIf=\"textfield.invalid && (textfield.dirty || textfield.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"textfield?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"textfield?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"textfield?.errors?.pattern\">\r\n {{control.customErrorMsg}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(input.invalid && (input.dirty || input.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <textarea type=\"text\"\r\n [id]=\"control.id\"\r\n class=\"asw-input-control {{control.customClass}}\" \r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #input=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [class.asw-is-invalid]=\"input.invalid && (input.dirty || input.touched)\"\r\n [disabled]=\"control.isDisabled ? true : false\"></textarea>\r\n <div *ngIf=\"input.invalid && (input.dirty || input.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.pattern\">\r\n {{control.customErrorMsg}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(input.invalid && (input.dirty || input.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <input type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern ? control.pattern : '^[A-Za-z0-9_\\+-]+(\\.[A-Za-z0-9_\\+-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.([A-Za-z]{2,4})$'}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n class=\"asw-input-control {{control.customClass}}\" \r\n [(ngModel)]=\"control.value\"\r\n #input=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [class.asw-is-invalid]=\"input.invalid && (input.dirty || input.touched)\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <div *ngIf=\"input.invalid && (input.dirty || input.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{'Please enter a valid email address'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Email format should be xyz@example.com')| aswTranslate}}.\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'url'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(url.invalid && (url.dirty || url.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <input type=\"text\"\r\n [id]=\"control.id\"\r\n class=\"asw-input-control {{control.customClass}}\" \r\n pattern=\"{{control.pattern ? control.pattern : '^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$'}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #url=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [class.asw-is-invalid]=\"url.invalid && (url.dirty || url.touched)\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <div *ngIf=\"url.invalid && (url.dirty || url.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"url?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"url?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"url?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Yikes! That\\'s not a valid URL') | aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'phone-number'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(phoneNumber.invalid && (phoneNumber.dirty || phoneNumber.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <input type=\"text\"\r\n [id]=\"control.id\"\r\n class=\"asw-input-control {{control.customClass}}\" \r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #phoneNumber=\"ngModel\"\r\n aswMask=\"(000) 000-0000\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [class.asw-is-invalid]=\"phoneNumber.invalid && (phoneNumber.dirty || phoneNumber.touched)\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <div *ngIf=\"phoneNumber.invalid && (phoneNumber.dirty || phoneNumber.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"phoneNumber?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"phoneNumber?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"phoneNumber?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Not a valid Phone Number') | aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-template> \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)=\"duplicateTextFieldControl(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)=\"editTextFieldDialog(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)=\"deleteTextFieldDialog(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: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i3.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i6.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i9.AswMaskDirective, selector: "[aswMask]", inputs: ["aswMask", "specialCharacters", "patterns", "prefix", "sufix", "dropSpecialCharacters", "showMaskTyped", "showTemplate", "clearIfNotMatch"] }, { kind: "pipe", type: i10.AswTranslatePipe, name: "aswTranslate" }, { kind: "pipe", type: i9.AswSafeHtmlPipe, name: "aswSafeHtml" }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswTextField, decorators: [{ type: Component, args: [{ selector: 'asw-textfield', template: "<ng-container *ngIf=\"control as control\">\r\n <ng-container *ngIf=\"CSSFramework === 'material'; else bootstrap\">\r\n <ng-container [ngSwitch]=\"control.controlType\">\r\n <ng-container *ngSwitchCase=\"'textfield'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #textfield=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-icon *ngIf=\"textfield.invalid && (textfield.dirty || textfield.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"textfield.invalid && (textfield.dirty || textfield.touched)\">\r\n <ng-container *ngIf=\"textfield?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"textfield?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"textfield?.errors?.pattern\">\r\n {{control.customErrorMsg}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <textarea matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #input=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\"></textarea>\r\n <mat-icon *ngIf=\"input.invalid && (input.dirty || input.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"input.invalid && (input.dirty || input.touched)\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.pattern\">\r\n {{control.customErrorMsg}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern ? control.pattern : '^[A-Za-z0-9_\\+-]+(\\.[A-Za-z0-9_\\+-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.([A-Za-z]{2,4})$'}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #input=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-icon *ngIf=\"input.invalid && (input.dirty || input.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"input.invalid && (input.dirty || input.touched)\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{'Please enter a valid email address' | aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Email format should be xyz@example.com') | aswTranslate}}.\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'url'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern ? control.pattern : '^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$'}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #url=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-icon *ngIf=\"url.invalid && (url.dirty || url.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"url.invalid && (url.dirty || url.touched)\">\r\n <ng-container *ngIf=\"url?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"url?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"url?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Yikes! That\\'s not a valid URL') | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'phone-number'\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #phoneNumber=\"ngModel\"\r\n aswMask=\"(000) 000-0000\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-icon *ngIf=\"phoneNumber.invalid && (phoneNumber.dirty || phoneNumber.touched)\"\r\n class=\"asw-error\" matSuffix>error\r\n </mat-icon>\r\n <mat-error *ngIf=\"phoneNumber.invalid && (phoneNumber.dirty || phoneNumber.touched)\">\r\n <ng-container *ngIf=\"phoneNumber?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"phoneNumber?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"phoneNumber?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Not a valid Phone Number') | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #bootstrap>\r\n <ng-container [ngSwitch]=\"control.controlType\">\r\n <ng-container *ngSwitchCase=\"'textfield'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(textfield.invalid && (textfield.dirty || textfield.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <input type=\"text\" \r\n class=\"asw-input-control {{control.customClass}}\" \r\n id=\"{{control.id}}\" \r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #textfield=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [class.asw-is-invalid]=\"textfield.invalid && (textfield.dirty || textfield.touched)\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <div *ngIf=\"textfield.invalid && (textfield.dirty || textfield.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"textfield?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"textfield?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"textfield?.errors?.pattern\">\r\n {{control.customErrorMsg}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(input.invalid && (input.dirty || input.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <textarea type=\"text\"\r\n [id]=\"control.id\"\r\n class=\"asw-input-control {{control.customClass}}\" \r\n pattern=\"{{control.pattern}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #input=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [class.asw-is-invalid]=\"input.invalid && (input.dirty || input.touched)\"\r\n [disabled]=\"control.isDisabled ? true : false\"></textarea>\r\n <div *ngIf=\"input.invalid && (input.dirty || input.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.minlength\">\r\n {{'Sorry' | aswTranslate }}, {{control.label | aswTranslate}} {{'must be at least' | aswTranslate}} {{control.minlength}} {{'characters long'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.pattern\">\r\n {{control.customErrorMsg}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(input.invalid && (input.dirty || input.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <input type=\"text\"\r\n [id]=\"control.id\"\r\n pattern=\"{{control.pattern ? control.pattern : '^[A-Za-z0-9_\\+-]+(\\.[A-Za-z0-9_\\+-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.([A-Za-z]{2,4})$'}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n class=\"asw-input-control {{control.customClass}}\" \r\n [(ngModel)]=\"control.value\"\r\n #input=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n [minlength]=\"control.minlength\"\r\n [required]=\"control.isRequired\"\r\n [class.asw-is-invalid]=\"input.invalid && (input.dirty || input.touched)\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <div *ngIf=\"input.invalid && (input.dirty || input.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{'Please enter a valid email address'| aswTranslate}}.\r\n </ng-container>\r\n <ng-container *ngIf=\"input?.errors?.pattern\">\r\n {{(control.customErrorMsg ? control.customErrorMsg : 'Email format should be xyz@example.com')| aswTranslate}}.\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'url'\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(url.invalid && (url.dirty || url.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <input type=\"text\"\r\n [id]=\"control.id\"\r\n class=\"asw-input-control {{control.customClass}}\" \r\n pattern=\"{{control.pattern ? control.pattern : '^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$'}}\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n [(ngModel)]=\"control.value\"\r\n #url=\"ngModel\"\r\n (change)=\"onChange(control)\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [maxlength]=\"control.maxlength\"\r\n