@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
184 lines • 128 kB
JavaScript
/**
* @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, Inject } from '@angular/core';
import { Validators } from '@angular/forms';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Constants, Icons } from '@asoftwareworld/form-builder-pro/common';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
import * as i2 from "@angular/material/dialog";
import * as i3 from "@angular/common";
import * as i4 from "@angular/material/core";
import * as i5 from "@angular/material/button";
import * as i6 from "@angular/material/checkbox";
import * as i7 from "@angular/material/input";
import * as i8 from "@angular/material/form-field";
import * as i9 from "@angular/material/select";
import * as i10 from "@angular/material/slide-toggle";
import * as i11 from "@angular/material/tabs";
import * as i12 from "@angular/material/tooltip";
import * as i13 from "@angular/material/icon";
import * as i14 from "@asoftwareworld/form-builder-pro/common";
import * as i15 from "@asoftwareworld/form-builder-pro/editor";
import * as i16 from "@asoftwareworld/form-builder-pro/core";
export class AswMultiSelectDialog {
formBuilder;
dialogRef;
data;
constants = Constants;
aswEditMultiselectForm;
status;
icons = Icons;
control;
labelType = 'label';
constructor(formBuilder, dialogRef, data) {
this.formBuilder = formBuilder;
this.dialogRef = dialogRef;
this.data = data;
this.aswEditMultiselectForm = this.formBuilder.group({
id: ['', [Validators.required]],
customClass: [],
tooltip: [''],
label: ['', [Validators.required, Validators.minLength(2)]],
style: [''],
options: this.formBuilder.array([this.createOption()]),
isRequired: [false],
isDisabled: [false],
labelType: ['label'],
apiUrl: [''],
body: [],
method: [],
headers: []
});
}
ngOnInit() {
this.control = this.data.control;
this.setValue(this.control);
}
get options() {
return this.aswEditMultiselectForm.get('options');
}
createOption() {
return this.formBuilder.group({
key: ['', [Validators.required, Validators.minLength(1), Validators.maxLength(50)]],
value: ['', [Validators.required, Validators.minLength(1), Validators.maxLength(999)]],
isChecked: [false],
hideControl: []
});
}
addNewOption() {
this.options.push(this.createOption());
}
onNoClick() {
this.dialogRef.close();
}
removeOption(index) {
this.options.removeAt(index);
}
onSubmit() {
if (this.aswEditMultiselectForm.invalid) {
return;
}
const value = [];
this.aswEditMultiselectForm.value.options.forEach((element, index) => {
if (typeof element.hideControl === 'string') {
element.hideControl = this.control.options[index].hideControl;
}
if (element.isChecked) {
value.push(element.key);
}
});
this.aswEditMultiselectForm.value.value = value;
this.aswEditMultiselectForm.value.controlType = this.control.controlType;
this.aswEditMultiselectForm.value.guid = this.control.guid;
this.dialogRef.close(this.aswEditMultiselectForm.value);
}
setValue(control) {
this.aswEditMultiselectForm.patchValue({
id: control.id,
customClass: control.customClass ?? '',
tooltip: control.tooltip,
label: control.label,
style: control.style,
isRequired: control.isRequired,
value: control.value ?? '',
isDisabled: control.isDisabled,
labelType: control.labelType ?? '',
apiUrl: control.apiUrl ?? '',
method: control.method ?? '',
headers: control.headers ?? '',
body: control.body ?? {}
});
this.labelType = control.labelType ? control.labelType : 'label';
// Populate options array
const optionsArray = this.aswEditMultiselectForm.get('options');
optionsArray.clear(); // Clear existing options
control.options.forEach((option) => {
optionsArray.push(this.formBuilder.group({
key: [option.key, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]],
value: [option.value, [Validators.required, Validators.minLength(1), Validators.maxLength(999)]],
isChecked: [option.isChecked || false],
hideControl: [option.hideControl ? option.hideControl.label : option.hideControl || []]
}));
});
// const optionFormGroup = control.options.map((option: any) => this.formBuilder.group(option));
// const optionFormArray = this.formBuilder.array(optionFormGroup);
// this.aswEditMultiselectForm.setControl('options', optionFormArray);
}
onLabelTypeChange(item) {
if (item.value) {
this.labelType = item.value;
}
else {
this.labelType = item.target.value;
}
}
onStatusChange(event) {
this.status = event.checked ? true : false;
if (event.checked === undefined) {
this.status = event.target.checked ? true : false;
}
}
onKey(event, index) {
let isError = false;
this.options.controls.filter((element, elementIndex) => {
if (element.value.key === event.target.value && index !== elementIndex) {
isError = true;
}
});
if (isError) {
this.options.controls[index].get('key')?.setErrors({ unique: true });
}
}
getApiData(data) {
this.control.body = data.body;
this.control.headers = data.headers;
this.control.method = data.method;
this.control.apiUrl = data.apiUrl;
if (data.responseData?.value) {
this.control.options = data.responseData.value;
this.setValue(this.control);
}
else {
this.control.options = data.responseData;
this.setValue(this.control);
}
}
onControlChange(event, selectControl) {
this.data.allControls.forEach((control) => {
if (event.target.value === control.label) {
selectControl.value.hideControl = control;
}
});
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswMultiSelectDialog, deps: [{ token: i1.FormBuilder }, { token: i2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AswMultiSelectDialog, selector: "asw-multi-select-dialog", ngImport: i0, template: "<div class=\"asw-dialog-header\">\r\n <div class=\"asw-edit-row-dialog\">\r\n <div class=\"asw-dialog-header clearfix\">\r\n <div class=\"asw-dialog-about\">\r\n <h1 mat-dialog-title class=\"asw-m-0\">{{'FormControl.Edit' | aswTranslate}} {{(control.controlType != 'checkbox' ? control.label : 'Checkbox') | aswTranslate}}</h1>\r\n </div>\r\n </div>\r\n </div>\r\n <button mat-icon-button (click)=\"onNoClick()\" aria-label=\"Close dialog\" class=\"asw-mt-2 asw-me-2\">\r\n <div [innerHTML]=\"icons.close | aswSafeHtml\"></div>\r\n </button>\r\n</div>\r\n<form [formGroup]=\"aswEditMultiselectForm\" (ngSubmit)=\"onSubmit()\">\r\n <div mat-dialog-content class=\"mat-typography\">\r\n <mat-tab-group dynamicHeight mat-stretch-tabs=\"false\">\r\n <mat-tab label=\"{{'FormControl.Properties' | aswTranslate}}\">\r\n <div class=\"asw-row asw-px-2 asw-py-3\">\r\n <ng-container *ngIf=\"data.CSSFramework === 'material'; else bootstrap\">\r\n <ng-container *ngIf=\"control.labelType !== undefined\">\r\n <div class=\"asw-col-md-12\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.LabelType' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"labelType\" matTooltip=\"{{'FormControl.SelectLabelType' | aswTranslate}}\" \r\n (selectionChange)=\"onLabelTypeChange($event)\">\r\n <mat-option value=\"label\">Simple Label</mat-option>\r\n <mat-option value=\"text-editor\">Text Editor</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n <div class=\"{{control.controlType != 'checkbox' ? 'asw-col-md-6' : 'asw-col-md-12'}}\">\r\n <ng-container *ngIf=\"labelType === 'label'; else aswEditor\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Label' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n placeholder=\"{{'FormControl.Label' | aswTranslate}}\"\r\n matTooltip=\"{{'FormControl.Label' | aswTranslate}}\"\r\n formControlName=\"label\" required>\r\n <mat-icon *ngIf=\"aswEditMultiselectForm.get('Label')?.invalid && (aswEditMultiselectForm.get('Label')?.dirty || aswEditMultiselectForm.get('Label')?.touched)\"\r\n class=\"asw-error\" matSuffix>error</mat-icon>\r\n <mat-error *ngFor=\"let validation of constants.accountValidationMessages.label\">\r\n <ng-container *ngIf=\"aswEditMultiselectForm.get('label')?.hasError(validation.type) && (aswEditMultiselectForm.get('label')?.dirty || aswEditMultiselectForm.get('label')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-template #aswEditor>\r\n <asw-editor autofocus=\"true\" id=\"asw-editor\" formControlName=\"label\" [config]=\"constants.aswEditorConfig\"></asw-editor>\r\n <ng-container *ngFor=\"let validation of constants.accountValidationMessages.label\">\r\n <mat-error *ngIf=\"aswEditMultiselectForm.get('label')?.hasError(validation.type) && (aswEditMultiselectForm.get('label')?.dirty || aswEditMultiselectForm.get('label')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </mat-error>\r\n </ng-container>\r\n </ng-template>\r\n </div>\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('customCSSClass')\">\r\n <div class=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.UniqueId' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n name=\"id\"\r\n placeholder=\"{{'FormControl.UniqueId' | aswTranslate}}\"\r\n matTooltip=\"{{'FormControl.UniqueId' | aswTranslate}}\"\r\n formControlName=\"id\" required>\r\n <mat-icon *ngIf=\"aswEditMultiselectForm.get('id')?.invalid && (aswEditMultiselectForm.get('id')?.dirty || aswEditMultiselectForm.get('id')?.touched)\"\r\n class=\"asw-error\" matSuffix>error</mat-icon>\r\n <mat-error *ngFor=\"let validation of constants.accountValidationMessages.id\">\r\n <ng-container *ngIf=\"aswEditMultiselectForm.get('id')?.hasError(validation.type) && (aswEditMultiselectForm.get('id')?.dirty || aswEditMultiselectForm.get('id')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('customCSSClass')\">\r\n <div class=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.CustomCSSClass' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n name=\"customClass\"\r\n placeholder=\"{{'FormControl.CustomCSSClass' | aswTranslate}}\"\r\n matTooltip=\"{{'FormControl.CustomCSSClass' | aswTranslate}}\"\r\n formControlName=\"customClass\">\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n <div class=\"{{control.controlType != 'checkbox' ? 'asw-col-md-6' : 'asw-col-md-12'}}\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Tooltip' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n placeholder=\"{{'FormControl.Tooltip' | aswTranslate}}\"\r\n matTooltip=\"{{'FormControl.Tooltip' | aswTranslate}}\"\r\n formControlName=\"tooltip\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"asw-col-md-12\" *ngIf=\"control.controlType != 'checkbox'\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Style' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"style\" matTooltip=\"{{'FormControl.Style' | aswTranslate}}\">\r\n <mat-option value=\"fill\">Fill</mat-option>\r\n <mat-option value=\"outline\">Outline</mat-option> \r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n <ng-template #bootstrap>\r\n <ng-container *ngIf=\"control.labelType !== undefined\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label\">{{'FormControl.LabelType' | aswTranslate}}</label>\r\n <select formControlName=\"labelType\" class=\"asw-select\" matTooltip=\"{{'FormControl.SelectLabelType' | aswTranslate}}\"\r\n (change)=\"onLabelTypeChange($event)\">\r\n <option value=\"label\">Simple Label</option>\r\n <option value=\"text-editor\">Text Editor</option>\r\n </select>\r\n </div>\r\n </ng-container>\r\n <div class=\"asw-col-md-12\">\r\n <ng-container *ngIf=\"labelType === 'label'; else aswEditor\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label asw-invalid-label {{(aswEditMultiselectForm.get('label')?.invalid && (aswEditMultiselectForm.get('label')?.dirty || aswEditMultiselectForm.get('label')?.touched)) ? 'asw-red-color' : ''}}\">{{'FormControl.Label' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n class=\"asw-input-control\"\r\n [class.asw-is-invalid]=\"(aswEditMultiselectForm.get('label')?.invalid && (aswEditMultiselectForm.get('label')?.dirty || aswEditMultiselectForm.get('label')?.touched))\"\r\n matTooltip=\"{{'FormControl.Label' | aswTranslate}}\"\r\n formControlName=\"label\" required>\r\n <div *ngFor=\"let validation of constants.accountValidationMessages.label\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"aswEditMultiselectForm.get('label')?.hasError(validation.type) && (aswEditMultiselectForm.get('label')?.dirty || aswEditMultiselectForm.get('label')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-template #aswEditor>\r\n <asw-editor autofocus=\"true\" id=\"asw-editor\" formControlName=\"label\" [config]=\"constants.aswEditorConfig\"></asw-editor>\r\n <ng-container *ngFor=\"let validation of constants.accountValidationMessages.label\" class=\"invalid-feedback\">\r\n <div *ngIf=\"aswEditMultiselectForm.get('label')?.hasError(validation.type) && (aswEditMultiselectForm.get('label')?.dirty || aswEditMultiselectForm.get('label')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </div>\r\n </ng-container>\r\n </ng-template>\r\n </div>\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('uniqueId')\">\r\n <div class=\"asw-col-md-6\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label asw-invalid-label {{(aswEditMultiselectForm.get('id')?.invalid && (aswEditMultiselectForm.get('id')?.dirty || aswEditMultiselectForm.get('id')?.touched)) ? 'asw-red-color' : ''}}\">{{'FormControl.UniqueId' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n name=\"id\"\r\n class=\"asw-input-control\"\r\n [class.asw-is-invalid]=\"(aswEditMultiselectForm.get('id')?.invalid && (aswEditMultiselectForm.get('id')?.dirty || aswEditMultiselectForm.get('id')?.touched))\"\r\n matTooltip=\"{{'FormControl.UniqueId' | aswTranslate}}\"\r\n formControlName=\"id\" required>\r\n <div *ngFor=\"let validation of constants.accountValidationMessages.id\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"aswEditMultiselectForm.get('id')?.hasError(validation.type) && (aswEditMultiselectForm.get('id')?.dirty || aswEditMultiselectForm.get('id')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('customCSSClass')\">\r\n <div class=\"asw-col-md-6\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label\">{{'FormControl.CustomCSSClass' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n name=\"customClass\"\r\n class=\"asw-input-control\"\r\n matTooltip=\"{{'FormControl.CustomCSSClass' | aswTranslate}}\"\r\n formControlName=\"customClass\">\r\n </div>\r\n </div>\r\n </ng-container>\r\n <div class=\"asw-col-md-12\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label\">{{'FormControl.Tooltip' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n class=\"asw-input-control\"\r\n matTooltip=\"{{'FormControl.Tooltip' | aswTranslate}}\"\r\n formControlName=\"tooltip\">\r\n </div>\r\n </div>\r\n </ng-template>\r\n <div class=\"asw-col-md-12\">\r\n <table class=\"asw-table asw-table-sm asw-table-bordered\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>{{'FormControl.Key' | aswTranslate}}</th>\r\n <th>{{'FormControl.Value' | aswTranslate}}</th>\r\n <th>\r\n {{'FormControl.hideControl' | aswTranslate}}\r\n <span [innerHTML]=\"icons.info | aswSafeHtml\" matTooltip=\"{{'FormControl.hideControlInfo' | aswTranslate}}\"></span>\r\n </th>\r\n <th></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <ng-container formArrayName=\"options\">\r\n <tr *ngFor=\"let option of options.controls; let index = index; let last=last;\" \r\n [formGroupName]=\"index\">\r\n <td class=\"asw-text-center\">\r\n <mat-checkbox color=\"primary\" formControlName=\"isChecked\"></mat-checkbox>\r\n </td>\r\n <td>\r\n <input type=\"text\"\r\n placeholder=\"{{'FormControl.OptionKey' | aswTranslate}} {{index+1}}\"\r\n class=\"asw-input-control\"\r\n formControlName=\"key\"\r\n matTooltip=\"{{'FormControl.OptionKey' | aswTranslate}} {{index+1}}\"\r\n minlength=\"1\"\r\n maxlength=\"50\"\r\n (keyup)=\"onKey($event, index)\"\r\n pattern=\"^[a-zA-Z0-9_\\-]{1,50}$\"\r\n [class.asw-is-invalid]=\"options.controls[index].get('key')?.invalid && (options.controls[index].get('key')?.dirty || options.controls[index].get('key')?.touched)\"\r\n required>\r\n <ng-container *ngFor=\"let validation of constants.accountValidationMessages.key\">\r\n <mat-error *ngIf=\"options.controls[index].get('key')?.hasError(validation.type) && (options.controls[index].get('key')?.dirty || options.controls[index].get('key')?.touched || options.controls[index].get('key')?.errors?.unique)\">\r\n {{validation.message | aswTranslate}}\r\n </mat-error>\r\n </ng-container>\r\n </td>\r\n <td>\r\n <input type=\"text\"\r\n placeholder=\"{{'FormControl.OptionValue' | aswTranslate}} {{index+1}}\"\r\n formControlName=\"value\"\r\n class=\"asw-input-control\"\r\n matTooltip=\"{{'FormControl.OptionValue' | aswTranslate}} {{index+1}}\"\r\n minlength=\"1\"\r\n maxlength=\"999\"\r\n [class.asw-is-invalid]=\"options.controls[index].get('value')?.invalid && (options.controls[index].get('value')?.dirty || options.controls[index].get('value')?.touched)\"\r\n required>\r\n <ng-container *ngFor=\"let validation of constants.accountValidationMessages.value\">\r\n <mat-error *ngIf=\"options.controls[index].get('value')?.hasError(validation.type) && (options.controls[index].get('value')?.dirty || options.controls[index].get('value')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </mat-error>\r\n </ng-container>\r\n </td>\r\n <td>\r\n <!-- <input class=\"asw-input-control\" formControlName=\"hideControl\" [matAutocomplete]=\"headerKey\">\r\n <mat-autocomplete #headerKey=\"matAutocomplete\">\r\n @for(control of filteredControlKeys[index] | async; track control) {\r\n <mat-option [value]=\"control\">\r\n {{ control.label }}\r\n </mat-option>\r\n }\r\n </mat-autocomplete> -->\r\n <select formControlName=\"hideControl\"\r\n (change)=\"onControlChange($event, option)\"\r\n matTooltip=\"{{'FormControl.hideControl' | aswTranslate}} {{index+1}}\" \r\n class=\"asw-select\">\r\n <option *ngFor=\"let control of data.allControls\" [value]=\"control.label\">\r\n {{control.label}}\r\n </option>\r\n </select>\r\n <!-- <mat-form-field appearance=\"outline\">\r\n <mat-select formControlName=\"hideControl\" multiple>\r\n @for (control of data.allControls; track control) {\r\n <mat-option [value]=\"control\">{{control.label}}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field> -->\r\n <!-- <input type=\"text\"\r\n placeholder=\"{{'FormControl.OptionValue' | aswTranslate}} {{index+1}}\"\r\n formControlName=\"value\"\r\n class=\"asw-input-control\"\r\n matTooltip=\"{{'FormControl.OptionValue' | aswTranslate}} {{index+1}}\"\r\n minlength=\"1\"\r\n maxlength=\"999\"\r\n [class.asw-is-invalid]=\"options.controls[index].get('value')?.invalid && (options.controls[index].get('value')?.dirty || options.controls[index].get('value')?.touched)\"\r\n > -->\r\n </td>\r\n <td class=\"asw-text-center\"> \r\n <button mat-icon-button *ngIf=\"index != 0\"\r\n type=\"button\" \r\n matTooltip=\"{{'FormControl.Delete' | aswTranslate}}\" \r\n [matTooltipPosition]=\"'below'\" \r\n (click)=\"removeOption(index)\">\r\n <span [innerHTML]=\"icons.delete2 | aswSafeHtml\"></span>\r\n </button>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n <tr>\r\n <td colspan=\"4\">\r\n <button class=\"asw-button asw-button-sm asw-button-primary\"\r\n type=\"button\" \r\n matTooltip=\"{{'FormControl.Add' | aswTranslate}}\" \r\n [matTooltipPosition]=\"'below'\"\r\n (click)=\"addNewOption()\">\r\n <span class=\"asw-icon asw-me-1\" [innerHTML]=\"icons.add | aswSafeHtml\"></span>\r\n {{'FormControl.AddOption' | aswTranslate}}\r\n </button>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n <ng-container *ngIf=\"data.CSSFramework === 'material'; else bootstrap1\">\r\n <div class=\"asw-col-md-3\">\r\n <mat-slide-toggle color=\"primary\"\r\n #isActive\r\n formControlName=\"isRequired\"\r\n (change)=\"onStatusChange($event)\">\r\n {{(status ? 'FormControl.Required' : 'FormControl.NotRequired') | aswTranslate}}\r\n </mat-slide-toggle>\r\n </div>\r\n <div class=\"asw-col-md-3\">\r\n <mat-slide-toggle color=\"primary\"\r\n #isDisable\r\n formControlName=\"isDisabled\">\r\n {{'FormControl.Readonly' | aswTranslate}}\r\n </mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <ng-template #bootstrap1>\r\n <div class=\"asw-col-md-2\">\r\n <div class=\"asw-mb-3\">\r\n <div class=\"asw-form-check asw-form-switch\">\r\n <input class=\"asw-form-check-input\" \r\n type=\"checkbox\" \r\n #isActive\r\n id=\"isActive\" \r\n formControlName=\"isRequired\"\r\n (change)=\"onStatusChange($event)\">\r\n <label class=\"asw-form-check-label\" for=\"isActive\">\r\n {{(status ? 'FormControl.Required' : 'FormControl.NotRequired') | aswTranslate}}\r\n </label>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"asw-col-md-2\">\r\n <div class=\"asw-mb-3\">\r\n <div class=\"asw-form-check asw-form-switch\">\r\n <input class=\"asw-form-check-input\" \r\n type=\"checkbox\"\r\n id=\"isDisable\" \r\n #isDisable\r\n formControlName=\"isDisabled\"\r\n (change)=\"onStatusChange($event)\">\r\n <label class=\"asw-form-check-label\" for=\"isDisable\">\r\n {{'FormControl.Readonly' | aswTranslate}}\r\n </label>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n </div>\r\n </mat-tab>\r\n <mat-tab label=\"{{'FormControl.API' | aswTranslate}}\">\r\n <asw-api-communicator (apiResponse)=\"getApiData($event)\" [CSSFramework]=\"data.CSSFramework\"></asw-api-communicator>\r\n </mat-tab>\r\n </mat-tab-group>\r\n </div>\r\n <div mat-dialog-actions align=\"end\">\r\n <button type=\"button\"\r\n class=\"asw-button asw-button-danger asw-me-2 asw-mb-1\"\r\n (click)=\"onNoClick()\">\r\n {{'FormControl.No' | aswTranslate}}\r\n </button>\r\n <button type=\"submit\"\r\n class=\"asw-button asw-button-primary asw-mb-1\"\r\n cdkFocusInitial>\r\n {{'FormControl.Yes' | aswTranslate}}\r\n </button>\r\n </div>\r\n</form>", dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.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: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i6.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i7.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: i8.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i8.MatLabel, selector: "mat-label" }, { kind: "directive", type: i8.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i8.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i9.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "component", type: i11.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i11.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i12.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i13.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i14.AswCommunicatorApi, selector: "asw-api-communicator", inputs: ["CSSFramework"], outputs: ["apiResponse"] }, { kind: "component", type: i15.AswEditor, selector: "asw-editor", inputs: ["id", "config", "placeholder", "tabIndex"], outputs: ["html", "viewMode", "blur", "focus"] }, { kind: "pipe", type: i16.AswTranslatePipe, name: "aswTranslate" }, { kind: "pipe", type: i14.AswSafeHtmlPipe, name: "aswSafeHtml" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswMultiSelectDialog, decorators: [{
type: Component,
args: [{ selector: 'asw-multi-select-dialog', template: "<div class=\"asw-dialog-header\">\r\n <div class=\"asw-edit-row-dialog\">\r\n <div class=\"asw-dialog-header clearfix\">\r\n <div class=\"asw-dialog-about\">\r\n <h1 mat-dialog-title class=\"asw-m-0\">{{'FormControl.Edit' | aswTranslate}} {{(control.controlType != 'checkbox' ? control.label : 'Checkbox') | aswTranslate}}</h1>\r\n </div>\r\n </div>\r\n </div>\r\n <button mat-icon-button (click)=\"onNoClick()\" aria-label=\"Close dialog\" class=\"asw-mt-2 asw-me-2\">\r\n <div [innerHTML]=\"icons.close | aswSafeHtml\"></div>\r\n </button>\r\n</div>\r\n<form [formGroup]=\"aswEditMultiselectForm\" (ngSubmit)=\"onSubmit()\">\r\n <div mat-dialog-content class=\"mat-typography\">\r\n <mat-tab-group dynamicHeight mat-stretch-tabs=\"false\">\r\n <mat-tab label=\"{{'FormControl.Properties' | aswTranslate}}\">\r\n <div class=\"asw-row asw-px-2 asw-py-3\">\r\n <ng-container *ngIf=\"data.CSSFramework === 'material'; else bootstrap\">\r\n <ng-container *ngIf=\"control.labelType !== undefined\">\r\n <div class=\"asw-col-md-12\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.LabelType' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"labelType\" matTooltip=\"{{'FormControl.SelectLabelType' | aswTranslate}}\" \r\n (selectionChange)=\"onLabelTypeChange($event)\">\r\n <mat-option value=\"label\">Simple Label</mat-option>\r\n <mat-option value=\"text-editor\">Text Editor</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n <div class=\"{{control.controlType != 'checkbox' ? 'asw-col-md-6' : 'asw-col-md-12'}}\">\r\n <ng-container *ngIf=\"labelType === 'label'; else aswEditor\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Label' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n placeholder=\"{{'FormControl.Label' | aswTranslate}}\"\r\n matTooltip=\"{{'FormControl.Label' | aswTranslate}}\"\r\n formControlName=\"label\" required>\r\n <mat-icon *ngIf=\"aswEditMultiselectForm.get('Label')?.invalid && (aswEditMultiselectForm.get('Label')?.dirty || aswEditMultiselectForm.get('Label')?.touched)\"\r\n class=\"asw-error\" matSuffix>error</mat-icon>\r\n <mat-error *ngFor=\"let validation of constants.accountValidationMessages.label\">\r\n <ng-container *ngIf=\"aswEditMultiselectForm.get('label')?.hasError(validation.type) && (aswEditMultiselectForm.get('label')?.dirty || aswEditMultiselectForm.get('label')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-template #aswEditor>\r\n <asw-editor autofocus=\"true\" id=\"asw-editor\" formControlName=\"label\" [config]=\"constants.aswEditorConfig\"></asw-editor>\r\n <ng-container *ngFor=\"let validation of constants.accountValidationMessages.label\">\r\n <mat-error *ngIf=\"aswEditMultiselectForm.get('label')?.hasError(validation.type) && (aswEditMultiselectForm.get('label')?.dirty || aswEditMultiselectForm.get('label')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </mat-error>\r\n </ng-container>\r\n </ng-template>\r\n </div>\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('customCSSClass')\">\r\n <div class=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.UniqueId' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n name=\"id\"\r\n placeholder=\"{{'FormControl.UniqueId' | aswTranslate}}\"\r\n matTooltip=\"{{'FormControl.UniqueId' | aswTranslate}}\"\r\n formControlName=\"id\" required>\r\n <mat-icon *ngIf=\"aswEditMultiselectForm.get('id')?.invalid && (aswEditMultiselectForm.get('id')?.dirty || aswEditMultiselectForm.get('id')?.touched)\"\r\n class=\"asw-error\" matSuffix>error</mat-icon>\r\n <mat-error *ngFor=\"let validation of constants.accountValidationMessages.id\">\r\n <ng-container *ngIf=\"aswEditMultiselectForm.get('id')?.hasError(validation.type) && (aswEditMultiselectForm.get('id')?.dirty || aswEditMultiselectForm.get('id')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('customCSSClass')\">\r\n <div class=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.CustomCSSClass' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n