@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
217 lines (209 loc) • 41.5 kB
JavaScript
import * as i0 from '@angular/core';
import { Inject, Component, EventEmitter, Output, Input, NgModule } from '@angular/core';
import { CSSFrameworkEnum } from '@asoftwareworld/form-builder-pro/api';
import * as i12 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 * as i1 from '@angular/forms';
import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
import * as i2 from '@angular/material/dialog';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import * as i3 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i4 from '@angular/material/core';
import * as i5 from '@angular/material/button';
import * as i6 from '@angular/material/input';
import * as i7 from '@angular/material/form-field';
import * as i8 from '@angular/material/select';
import * as i9 from '@angular/material/slide-toggle';
import * as i10 from '@angular/material/tooltip';
import * as i11 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 AswSlideToggleDialog {
formBuilder;
dialogRef;
data;
constants = Constants;
aswEditSlideToggleForm;
status;
icons = Icons;
control;
constructor(formBuilder, dialogRef, data) {
this.formBuilder = formBuilder;
this.dialogRef = dialogRef;
this.data = data;
}
ngOnInit() {
this.control = this.data.control;
this.validateFormBuilder();
this.editProperty(this.control);
}
validateFormBuilder() {
this.aswEditSlideToggleForm = this.formBuilder.group({
customClass: [],
label: ['', [Validators.required, Validators.minLength(2)]],
color: [],
value: [false],
isRequired: [false],
isDisabled: [false]
});
}
editProperty(control) {
this.aswEditSlideToggleForm.setValue({
customClass: control.customClass ?? '',
label: control.label,
color: control.color,
value: control.value ? true : false,
isRequired: control.isRequired,
isDisabled: control.isDisabled
});
}
onNoClick() {
this.dialogRef.close();
}
onSubmit() {
if (this.aswEditSlideToggleForm.invalid) {
return;
}
this.aswEditSlideToggleForm.value.controlType = this.control.controlType;
this.aswEditSlideToggleForm.value.id = this.control.id;
this.aswEditSlideToggleForm.value.guid = this.control.guid;
this.dialogRef.close(this.aswEditSlideToggleForm.value);
}
onStatusChange(event) {
this.status = event.checked ? true : false;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswSlideToggleDialog, 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: AswSlideToggleDialog, selector: "asw-slide-toggle-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.label | 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]=\"aswEditSlideToggleForm\" (ngSubmit)=\"onSubmit()\">\r\n <mat-dialog-content class=\"mat-typography\">\r\n <ng-container *ngIf=\"data.CSSFramework === 'material'; else bootstrap\">\r\n <div class=\"asw-row\">\r\n <div class=\"{{!data.propertyPersonalization.includes('customCSSClass') ? 'asw-col-md-6' : 'asw-col-md-12'}}\">\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-error *ngFor=\"let validation of constants.accountValidationMessages.label\">\r\n <ng-container *ngIf=\"aswEditSlideToggleForm.get('label')?.hasError(validation.type) && (aswEditSlideToggleForm.get('label')?.dirty || aswEditSlideToggleForm.get('label')?.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 *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=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Value' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"value\" matTooltip=\"{{'FormControl.SelectValue' | aswTranslate}}\">\r\n <mat-option value=\"true\">True</mat-option>\r\n <mat-option value=\"false\">False</mat-option>\r\n </mat-select> \r\n </mat-form-field>\r\n </div>\r\n <div class=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Color' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"color\" matTooltip=\"{{'FormControl.SelectColor' | aswTranslate}}\">\r\n <mat-option value=\"primary\">Primary</mat-option>\r\n <mat-option value=\"accent\">Accent</mat-option>\r\n <mat-option value=\"warn\">Warn</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"asw-col-md-4\">\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-4\">\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 </div>\r\n </ng-container>\r\n <ng-template #bootstrap>\r\n <div class=\"asw-row\">\r\n <div class=\"{{!data.propertyPersonalization.includes('customCSSClass') ? 'asw-col-md-6' : 'asw-col-md-12'}}\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label asw-invalid-label {{(aswEditSlideToggleForm.get('label')?.invalid && (aswEditSlideToggleForm.get('label')?.dirty || aswEditSlideToggleForm.get('label')?.touched)) ? 'asw-red-color' : ''}}\">{{'FormControl.Label' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n matTooltip=\"{{'FormControl.Label' | aswTranslate}}\"\r\n class=\"asw-input-control\"\r\n [class.asw-is-invalid]=\"(aswEditSlideToggleForm.get('label')?.invalid && (aswEditSlideToggleForm.get('label')?.dirty || aswEditSlideToggleForm.get('label')?.touched))\"\r\n formControlName=\"label\" required>\r\n <div *ngFor=\"let validation of constants.accountValidationMessages.label\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"aswEditSlideToggleForm.get('label')?.hasError(validation.type) && (aswEditSlideToggleForm.get('label')?.dirty || aswEditSlideToggleForm.get('label')?.touched)\">\r\n {{validation.message |aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\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.Value' | aswTranslate}}</label>\r\n <select formControlName=\"value\" \r\n class=\"asw-select\" \r\n matTooltip=\"{{'FormControl.SelectValue' | aswTranslate}}\">\r\n <option value=\"true\">True</option>\r\n <option value=\"false\">False</option>\r\n </select> \r\n </div>\r\n </div>\r\n <div class=\"asw-col-md-4\">\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-4\">\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 </div>\r\n </div>\r\n </ng-template> \r\n </mat-dialog-content>\r\n <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 </mat-dialog-actions>\r\n</form>\r\n\r\n", 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.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { 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: "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: i6.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: i7.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatLabel, selector: "mat-label" }, { kind: "directive", type: i7.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i8.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: i9.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: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i11.AswTranslatePipe, name: "aswTranslate" }, { kind: "pipe", type: i12.AswSafeHtmlPipe, name: "aswSafeHtml" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswSlideToggleDialog, decorators: [{
type: Component,
args: [{ selector: 'asw-slide-toggle-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.label | 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]=\"aswEditSlideToggleForm\" (ngSubmit)=\"onSubmit()\">\r\n <mat-dialog-content class=\"mat-typography\">\r\n <ng-container *ngIf=\"data.CSSFramework === 'material'; else bootstrap\">\r\n <div class=\"asw-row\">\r\n <div class=\"{{!data.propertyPersonalization.includes('customCSSClass') ? 'asw-col-md-6' : 'asw-col-md-12'}}\">\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-error *ngFor=\"let validation of constants.accountValidationMessages.label\">\r\n <ng-container *ngIf=\"aswEditSlideToggleForm.get('label')?.hasError(validation.type) && (aswEditSlideToggleForm.get('label')?.dirty || aswEditSlideToggleForm.get('label')?.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 *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=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Value' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"value\" matTooltip=\"{{'FormControl.SelectValue' | aswTranslate}}\">\r\n <mat-option value=\"true\">True</mat-option>\r\n <mat-option value=\"false\">False</mat-option>\r\n </mat-select> \r\n </mat-form-field>\r\n </div>\r\n <div class=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Color' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"color\" matTooltip=\"{{'FormControl.SelectColor' | aswTranslate}}\">\r\n <mat-option value=\"primary\">Primary</mat-option>\r\n <mat-option value=\"accent\">Accent</mat-option>\r\n <mat-option value=\"warn\">Warn</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"asw-col-md-4\">\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-4\">\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 </div>\r\n </ng-container>\r\n <ng-template #bootstrap>\r\n <div class=\"asw-row\">\r\n <div class=\"{{!data.propertyPersonalization.includes('customCSSClass') ? 'asw-col-md-6' : 'asw-col-md-12'}}\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label asw-invalid-label {{(aswEditSlideToggleForm.get('label')?.invalid && (aswEditSlideToggleForm.get('label')?.dirty || aswEditSlideToggleForm.get('label')?.touched)) ? 'asw-red-color' : ''}}\">{{'FormControl.Label' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n matTooltip=\"{{'FormControl.Label' | aswTranslate}}\"\r\n class=\"asw-input-control\"\r\n [class.asw-is-invalid]=\"(aswEditSlideToggleForm.get('label')?.invalid && (aswEditSlideToggleForm.get('label')?.dirty || aswEditSlideToggleForm.get('label')?.touched))\"\r\n formControlName=\"label\" required>\r\n <div *ngFor=\"let validation of constants.accountValidationMessages.label\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"aswEditSlideToggleForm.get('label')?.hasError(validation.type) && (aswEditSlideToggleForm.get('label')?.dirty || aswEditSlideToggleForm.get('label')?.touched)\">\r\n {{validation.message |aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\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.Value' | aswTranslate}}</label>\r\n <select formControlName=\"value\" \r\n class=\"asw-select\" \r\n matTooltip=\"{{'FormControl.SelectValue' | aswTranslate}}\">\r\n <option value=\"true\">True</option>\r\n <option value=\"false\">False</option>\r\n </select> \r\n </div>\r\n </div>\r\n <div class=\"asw-col-md-4\">\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-4\">\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 </div>\r\n </div>\r\n </ng-template> \r\n </mat-dialog-content>\r\n <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 </mat-dialog-actions>\r\n</form>\r\n\r\n" }]
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.MatDialogRef }, { type: undefined, decorators: [{
type: Inject,
args: [MAT_DIALOG_DATA]
}] }] });
/**
* @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 AswSlideToggle {
dialog;
constants = Constants;
icons = Icons;
/**
* SlideToggle control
*/
control = null;
CSSFramework = CSSFrameworkEnum.Material;
isPreviewTemplate = false;
propertyPersonalization = [];
slidetoggleUpdateEvent = new EventEmitter();
slidetoggleDeleteEvent = new EventEmitter();
selectionChange = new EventEmitter();
duplicateControl = new EventEmitter();
constructor(dialog) {
this.dialog = dialog;
}
deleteSlideToggleDialog(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.slidetoggleDeleteEvent.emit(control);
}
});
}
editSlideToggleDialog(control) {
const dialogRef = this.dialog.open(AswSlideToggleDialog, {
width: '50%',
disableClose: true,
data: { control, CSSFramework: this.CSSFramework, propertyPersonalization: this.propertyPersonalization }
});
dialogRef.afterClosed().subscribe((result) => {
if (result !== undefined) {
this.slidetoggleUpdateEvent.emit(result);
}
});
}
onChange(event, control) {
control.value = event.checked === undefined ? event.target.checked : event.checked;
this.selectionChange.emit(control);
}
duplicateSlideToggleControl(control) {
this.duplicateControl.emit(control);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswSlideToggle, deps: [{ token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AswSlideToggle, selector: "asw-slide-toggle", inputs: { control: "control", CSSFramework: "CSSFramework", isPreviewTemplate: "isPreviewTemplate", propertyPersonalization: "propertyPersonalization" }, outputs: { slidetoggleUpdateEvent: "slidetoggleUpdateEvent", slidetoggleDeleteEvent: "slidetoggleDeleteEvent", selectionChange: "selectionChange", duplicateControl: "duplicateControl" }, ngImport: i0, template: "<ng-container *ngIf=\"control as control\">\r\n <ng-container *ngIf=\"CSSFramework === 'material'; else bootstrap\">\r\n <mat-slide-toggle [color]=\"control.color\"\r\n [class]=\"control.customClass\"\r\n [required]=\"control.isRequired\"\r\n (change)=\"onChange($event, control)\"\r\n [checked]=\"control.value\"\r\n [disabled]=\"control.isDisabled ? true : false\">{{control.label | aswTranslate}}\r\n </mat-slide-toggle>\r\n </ng-container>\r\n <ng-template #bootstrap>\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 [class]=\"control.customClass\"\r\n [required]=\"control.isRequired\"\r\n (change)=\"onChange($event, control)\"\r\n [checked]=\"control.value\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <label class=\"asw-form-check-label\" for=\"isDisable\">\r\n {{control.label | aswTranslate}}\r\n </label>\r\n </div>\r\n </div>\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)=\"duplicateSlideToggleControl(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)=\"editSlideToggleDialog(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)=\"deleteSlideToggleDialog(control)\">\r\n <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n </button>\r\n </div>\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i9.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: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i11.AswTranslatePipe, name: "aswTranslate" }, { kind: "pipe", type: i12.AswSafeHtmlPipe, name: "aswSafeHtml" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswSlideToggle, decorators: [{
type: Component,
args: [{ selector: 'asw-slide-toggle', template: "<ng-container *ngIf=\"control as control\">\r\n <ng-container *ngIf=\"CSSFramework === 'material'; else bootstrap\">\r\n <mat-slide-toggle [color]=\"control.color\"\r\n [class]=\"control.customClass\"\r\n [required]=\"control.isRequired\"\r\n (change)=\"onChange($event, control)\"\r\n [checked]=\"control.value\"\r\n [disabled]=\"control.isDisabled ? true : false\">{{control.label | aswTranslate}}\r\n </mat-slide-toggle>\r\n </ng-container>\r\n <ng-template #bootstrap>\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 [class]=\"control.customClass\"\r\n [required]=\"control.isRequired\"\r\n (change)=\"onChange($event, control)\"\r\n [checked]=\"control.value\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <label class=\"asw-form-check-label\" for=\"isDisable\">\r\n {{control.label | aswTranslate}}\r\n </label>\r\n </div>\r\n </div>\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)=\"duplicateSlideToggleControl(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)=\"editSlideToggleDialog(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)=\"deleteSlideToggleDialog(control)\">\r\n <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n </button>\r\n </div>\r\n </div>\r\n</ng-container>\r\n" }]
}], ctorParameters: () => [{ type: i2.MatDialog }], propDecorators: { control: [{
type: Input
}], CSSFramework: [{
type: Input
}], isPreviewTemplate: [{
type: Input
}], propertyPersonalization: [{
type: Input
}], slidetoggleUpdateEvent: [{
type: Output
}], slidetoggleDeleteEvent: [{
type: Output
}], selectionChange: [{
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
*/
/**
* @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 AswSlideToggleModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswSlideToggleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AswSlideToggleModule, declarations: [AswSlideToggle, AswSlideToggleDialog], imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswTranslateModule, AswPipeModule], exports: [AswSlideToggle, AswSlideToggleDialog] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswSlideToggleModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswTranslateModule, AswPipeModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswSlideToggleModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswTranslateModule, AswPipeModule],
declarations: [AswSlideToggle, AswSlideToggleDialog],
exports: [AswSlideToggle, AswSlideToggleDialog]
}]
}] });
/**
* @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 { AswSlideToggle, AswSlideToggleDialog, AswSlideToggleModule };
//# sourceMappingURL=asoftwareworld-form-builder-pro-form-control-slide-toggle.mjs.map