@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
207 lines (199 loc) • 38.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 i11 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 i2$1 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/button-toggle';
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/tooltip';
import * as i12 from '@asoftwareworld/form-builder-pro/core';
import { AswTranslateModule } from '@asoftwareworld/form-builder-pro/core';
import { AswEditorModule } from '@asoftwareworld/form-builder-pro/editor';
/**
* @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 AswHeaderDialog {
formBuilder;
dialogRef;
data;
constants = Constants;
icons = Icons;
aswHeaderForm;
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.aswHeaderForm = this.formBuilder.group({
customClass: [],
label: ['', [Validators.required, Validators.minLength(2)]],
subtype: [],
style: []
});
}
editProperty(control) {
this.aswHeaderForm.setValue({
customClass: control.customClass ?? '',
label: control.label,
subtype: control.subtype,
style: control.style
});
}
onNoClick() {
this.dialogRef.close();
}
onSubmit() {
if (this.aswHeaderForm.invalid) {
return;
}
this.aswHeaderForm.value.controlType = this.control.controlType;
this.aswHeaderForm.value.id = this.control.id;
this.aswHeaderForm.value.guid = this.control.guid;
this.dialogRef.close(this.aswHeaderForm.value);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswHeaderDialog, 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: AswHeaderDialog, selector: "asw-header-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]=\"aswHeaderForm\" (ngSubmit)=\"onSubmit()\">\r\n <mat-dialog-content class=\"mat-typography\">\r\n <div class=\"asw-row\">\r\n <ng-container *ngIf=\"data.CSSFramework === 'material'; else bootstrap\">\r\n <div class=\"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 name=\"label\"\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=\"aswHeaderForm.get('label')?.hasError(validation.type) && (aswHeaderForm.get('label')?.dirty || aswHeaderForm.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=\"{{!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.Type' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"subtype\">\r\n <mat-option value=\"h1\">H1</mat-option>\r\n <mat-option value=\"h2\">H2</mat-option>\r\n <mat-option value=\"h3\">H3</mat-option>\r\n <mat-option value=\"h4\">H4</mat-option>\r\n <mat-option value=\"h5\">H5</mat-option>\r\n <mat-option value=\"h6\">H6</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"asw-col-md-6\">\r\n <h6 class=\"asw-fs-6 asw-my-2\">{{'FormControl.Style' | aswTranslate}}:</h6>\r\n <mat-button-toggle-group formControlName=\"style\" name=\"fontStyle\" aria-label=\"Font Style\">\r\n <mat-button-toggle value=\"asw-text-start\" aria-label=\"Text align left\">\r\n <span [innerHTML]=\"icons.justifyLeft | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n <mat-button-toggle value=\"asw-text-center\" aria-label=\"Text align center\">\r\n <span [innerHTML]=\"icons.justifyCenter | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n <mat-button-toggle value=\"asw-text-end\" aria-label=\"Text align right\">\r\n <span [innerHTML]=\"icons.justifyRight | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n </mat-button-toggle-group>\r\n </div>\r\n </ng-container>\r\n <ng-template #bootstrap>\r\n <div class=\"asw-col-md-12\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label asw-invalid-label {{(aswHeaderForm.get('label')?.invalid && (aswHeaderForm.get('label')?.dirty || aswHeaderForm.get('label')?.touched)) ? 'asw-red-color' : ''}}\">{{'FormControl.Label' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n name=\"label\"\r\n class=\"asw-input-control\"\r\n [class.asw-is-invalid]=\"(aswHeaderForm.get('label')?.invalid && (aswHeaderForm.get('label')?.dirty || aswHeaderForm.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=\"aswHeaderForm.get('label')?.hasError(validation.type) && (aswHeaderForm.get('label')?.dirty || aswHeaderForm.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=\"{{!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\">{{'FormControl.Type' | aswTranslate}}</label>\r\n <select formControlName=\"subtype\" class=\"asw-select\">\r\n <option value=\"h1\">H1</option>\r\n <option value=\"h2\">H2</option>\r\n <option value=\"h3\">H3</option>\r\n <option value=\"h4\">H4</option>\r\n <option value=\"h5\">H5</option>\r\n <option value=\"h6\">H6</option>\r\n </select>\r\n </div>\r\n </div>\r\n <div class=\"asw-col-md-6\">\r\n <h6 class=\"asw-fs-6 asw-my-2\">{{'FormControl.Style' | aswTranslate}}:</h6>\r\n <mat-button-toggle-group formControlName=\"style\" name=\"fontStyle\" aria-label=\"Font Style\">\r\n <mat-button-toggle value=\"asw-text-start\" aria-label=\"Text align left\">\r\n <span [innerHTML]=\"icons.justifyLeft | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n <mat-button-toggle value=\"asw-text-center\" aria-label=\"Text align center\">\r\n <span [innerHTML]=\"icons.justifyCenter | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n <mat-button-toggle value=\"asw-text-end\" aria-label=\"Text align right\">\r\n <span [innerHTML]=\"icons.justifyRight | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n </mat-button-toggle-group>\r\n </div>\r\n </ng-template>\r\n </div>\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-mb-1 asw-me-2\"\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: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.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.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: i6.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i6.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { 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: "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: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i11.AswSafeHtmlPipe, name: "aswSafeHtml" }, { kind: "pipe", type: i12.AswTranslatePipe, name: "aswTranslate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswHeaderDialog, decorators: [{
type: Component,
args: [{ selector: 'asw-header-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]=\"aswHeaderForm\" (ngSubmit)=\"onSubmit()\">\r\n <mat-dialog-content class=\"mat-typography\">\r\n <div class=\"asw-row\">\r\n <ng-container *ngIf=\"data.CSSFramework === 'material'; else bootstrap\">\r\n <div class=\"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 name=\"label\"\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=\"aswHeaderForm.get('label')?.hasError(validation.type) && (aswHeaderForm.get('label')?.dirty || aswHeaderForm.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=\"{{!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.Type' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"subtype\">\r\n <mat-option value=\"h1\">H1</mat-option>\r\n <mat-option value=\"h2\">H2</mat-option>\r\n <mat-option value=\"h3\">H3</mat-option>\r\n <mat-option value=\"h4\">H4</mat-option>\r\n <mat-option value=\"h5\">H5</mat-option>\r\n <mat-option value=\"h6\">H6</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"asw-col-md-6\">\r\n <h6 class=\"asw-fs-6 asw-my-2\">{{'FormControl.Style' | aswTranslate}}:</h6>\r\n <mat-button-toggle-group formControlName=\"style\" name=\"fontStyle\" aria-label=\"Font Style\">\r\n <mat-button-toggle value=\"asw-text-start\" aria-label=\"Text align left\">\r\n <span [innerHTML]=\"icons.justifyLeft | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n <mat-button-toggle value=\"asw-text-center\" aria-label=\"Text align center\">\r\n <span [innerHTML]=\"icons.justifyCenter | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n <mat-button-toggle value=\"asw-text-end\" aria-label=\"Text align right\">\r\n <span [innerHTML]=\"icons.justifyRight | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n </mat-button-toggle-group>\r\n </div>\r\n </ng-container>\r\n <ng-template #bootstrap>\r\n <div class=\"asw-col-md-12\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label asw-invalid-label {{(aswHeaderForm.get('label')?.invalid && (aswHeaderForm.get('label')?.dirty || aswHeaderForm.get('label')?.touched)) ? 'asw-red-color' : ''}}\">{{'FormControl.Label' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n name=\"label\"\r\n class=\"asw-input-control\"\r\n [class.asw-is-invalid]=\"(aswHeaderForm.get('label')?.invalid && (aswHeaderForm.get('label')?.dirty || aswHeaderForm.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=\"aswHeaderForm.get('label')?.hasError(validation.type) && (aswHeaderForm.get('label')?.dirty || aswHeaderForm.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=\"{{!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\">{{'FormControl.Type' | aswTranslate}}</label>\r\n <select formControlName=\"subtype\" class=\"asw-select\">\r\n <option value=\"h1\">H1</option>\r\n <option value=\"h2\">H2</option>\r\n <option value=\"h3\">H3</option>\r\n <option value=\"h4\">H4</option>\r\n <option value=\"h5\">H5</option>\r\n <option value=\"h6\">H6</option>\r\n </select>\r\n </div>\r\n </div>\r\n <div class=\"asw-col-md-6\">\r\n <h6 class=\"asw-fs-6 asw-my-2\">{{'FormControl.Style' | aswTranslate}}:</h6>\r\n <mat-button-toggle-group formControlName=\"style\" name=\"fontStyle\" aria-label=\"Font Style\">\r\n <mat-button-toggle value=\"asw-text-start\" aria-label=\"Text align left\">\r\n <span [innerHTML]=\"icons.justifyLeft | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n <mat-button-toggle value=\"asw-text-center\" aria-label=\"Text align center\">\r\n <span [innerHTML]=\"icons.justifyCenter | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n <mat-button-toggle value=\"asw-text-end\" aria-label=\"Text align right\">\r\n <span [innerHTML]=\"icons.justifyRight | aswSafeHtml\"></span>\r\n </mat-button-toggle>\r\n </mat-button-toggle-group>\r\n </div>\r\n </ng-template>\r\n </div>\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-mb-1 asw-me-2\"\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 AswHeader {
dialog;
constants = Constants;
icons = Icons;
/**
* Header control
*/
control = null;
CSSFramework = CSSFrameworkEnum.Material;
isPreviewTemplate = false;
propertyPersonalization = [];
headerUpdateEvent = new EventEmitter();
headerDeleteEvent = new EventEmitter();
duplicateControl = new EventEmitter();
constructor(dialog) {
this.dialog = dialog;
}
/**
* Delete header control based on control index
* @param control header control items
*/
deleteHeaderDialog(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.headerDeleteEvent.emit(control);
}
});
}
editHeaderDialog(control) {
const dialogRef = this.dialog.open(AswHeaderDialog, {
width: '50%',
disableClose: true,
data: { control, CSSFramework: this.CSSFramework, propertyPersonalization: this.propertyPersonalization }
});
dialogRef.afterClosed().subscribe((result) => {
if (result !== undefined) {
this.headerUpdateEvent.emit(result);
}
});
}
duplicateHeaderControl(control) {
this.duplicateControl.emit(control);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswHeader, deps: [{ token: i2.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.8", type: AswHeader, selector: "asw-header", inputs: { control: "control", CSSFramework: "CSSFramework", isPreviewTemplate: "isPreviewTemplate", propertyPersonalization: "propertyPersonalization" }, outputs: { headerUpdateEvent: "headerUpdateEvent", headerDeleteEvent: "headerDeleteEvent", duplicateControl: "duplicateControl" }, ngImport: i0, template: "<ng-container *ngIf=\"control as control\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'h1'\">\r\n <h1 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h1>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h2'\">\r\n <h2 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h2>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h3'\">\r\n <h3 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h3>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h4'\">\r\n <h4 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h4>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h5'\">\r\n <h5 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h5>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h6'\">\r\n <h6 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h6>\r\n </ng-container>\r\n </ng-container>\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)=\"duplicateHeaderControl(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)=\"editHeaderDialog(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)=\"deleteHeaderDialog(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$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i11.AswSafeHtmlPipe, name: "aswSafeHtml" }, { kind: "pipe", type: i12.AswTranslatePipe, name: "aswTranslate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswHeader, decorators: [{
type: Component,
args: [{ selector: 'asw-header', template: "<ng-container *ngIf=\"control as control\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'h1'\">\r\n <h1 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h1>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h2'\">\r\n <h2 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h2>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h3'\">\r\n <h3 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h3>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h4'\">\r\n <h4 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h4>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h5'\">\r\n <h5 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h5>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'h6'\">\r\n <h6 class=\"{{control.style}} {{control.customClass}}\">{{control.label | aswTranslate}}</h6>\r\n </ng-container>\r\n </ng-container>\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)=\"duplicateHeaderControl(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)=\"editHeaderDialog(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)=\"deleteHeaderDialog(control)\">\r\n <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n </button>\r\n </div>\r\n </div>\r\n</ng-container>" }]
}], ctorParameters: () => [{ type: i2.MatDialog }], propDecorators: { control: [{
type: Input
}], CSSFramework: [{
type: Input
}], isPreviewTemplate: [{
type: Input
}], propertyPersonalization: [{
type: Input
}], headerUpdateEvent: [{
type: Output
}], headerDeleteEvent: [{
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 AswHeaderModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswHeaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: AswHeaderModule, declarations: [AswHeader, AswHeaderDialog], imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswEditorModule, AswPipeModule, AswTranslateModule], exports: [AswHeader, AswHeaderDialog] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswHeaderModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswEditorModule, AswPipeModule, AswTranslateModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: AswHeaderModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswEditorModule, AswPipeModule, AswTranslateModule],
declarations: [AswHeader, AswHeaderDialog],
exports: [AswHeader, AswHeaderDialog]
}]
}] });
/**
* @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 { AswHeader, AswHeaderDialog, AswHeaderModule };
//# sourceMappingURL=asoftwareworld-form-builder-pro-form-control-header.mjs.map