import * as i0 from '@angular/core';
import { EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
import * as i1 from '@angular/material/dialog';
import { CSSFrameworkEnum } from '@asoftwareworld/form-builder-pro/api';
import * as i9 from '@asoftwareworld/form-builder-pro/common';
import { Constants, Icons, MaterialModule, AswDirectiveModule, AswPipeModule } from '@asoftwareworld/form-builder-pro/common';
import { AswConfirmDialog, AswConfirmDialogModule } from '@asoftwareworld/form-builder-pro/form-control/confirm-dialog';
import { AswTextDialog, AswSharedDialogModule } from '@asoftwareworld/form-builder-pro/form-control/shared';
import { ObjectUtils } from '@asoftwareworld/form-builder-pro/utils';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i3 from '@angular/forms';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import * as i4 from '@angular/material/button';
import * as i5 from '@angular/material/input';
import * as i6 from '@angular/material/form-field';
import * as i7 from '@angular/material/tooltip';
import * as i8 from '@angular/material/icon';
import * as i10 from '@asoftwareworld/form-builder-pro/core';
import { AswTranslateModule } from '@asoftwareworld/form-builder-pro/core';

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */
class AswNumber {
    dialog;
    decimals = 100;
    constants = Constants;
    objectUtils = ObjectUtils;
    icons = Icons;
    /**
     * Number control
     */
    control = null;
    formControls = [];
    CSSFramework = CSSFrameworkEnum.Material;
    isPreviewTemplate = false;
    propertyPersonalization = [];
    patterns = [];
    numberUpdateEvent = new EventEmitter();
    numberDeleteEvent = new EventEmitter();
    aswModelChange = new EventEmitter();
    duplicateControl = new EventEmitter();
    numberInput;
    currencyInput;
    constructor(dialog) {
        this.dialog = dialog;
    }
    ngAfterViewInit() {
        switch (this.control?.controlType) {
            case 'number': {
                this.numberInput.valueChanges.subscribe(() => {
                    this.onChange(this.control ? this.control : null);
                });
                break;
            }
            case 'currency': {
                this.currencyInput.valueChanges.subscribe(() => {
                    this.onChange(this.control ? this.control : null);
                });
                break;
            }
        }
    }
    deleteNumberDialog(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.numberDeleteEvent.emit(control);
            }
        });
    }
    editNumberDialog(control) {
        const dialogRef = this.dialog.open(AswTextDialog, {
            width: '80%',
            disableClose: true,
            data: { control, CSSFramework: this.CSSFramework, propertyPersonalization: this.propertyPersonalization, patterns: this.patterns }
        });
        dialogRef.afterClosed().subscribe((result) => {
            if (result !== undefined) {
                this.numberUpdateEvent.emit(result);
            }
        });
    }
    onChange(control) {
        this.setParentCalculations(control, this.formControls);
        this.setChildCalculations(control, this.formControls);
        this.aswModelChange.emit(control);
    }
    setParentCalculations(control, formControls) {
        const calculationControls = formControls.filter((x) => x.controlType === 'calculation');
        calculationControls.forEach((calculation) => {
            const updateControls = calculation.operations.filter((x) => x.id === control.guid);
            updateControls.forEach((y) => {
                y.label = control.label;
                y.value = control.value;
            });
            calculation.value = this.objectUtils.calculateValue(calculation.operations);
        });
    }
    setChildCalculations(control, formControls) {
        const columnControls = formControls.filter((x) => x.controlType === 'columns');
        columnControls.forEach((columnControl) => {
            columnControl.columns.forEach((column) => {
                const calculationItems = column.components.filter((component) => component.controlType === 'calculation');
                if (calculationItems.length) {
                    this.setParentCalculations(control, column.components);
                }
                const columnItems = column.components.filter((component) => component.controlType === 'columns');
                if (columnItems.length) {
                    this.setChildCalculations(control, column.components);
                }
            });
        });
    }
    duplicateNumberControl(control) {
        this.duplicateControl.emit(control);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswNumber, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswNumber, selector: "asw-number", inputs: { control: "control", formControls: "formControls", CSSFramework: "CSSFramework", isPreviewTemplate: "isPreviewTemplate", propertyPersonalization: "propertyPersonalization", patterns: "patterns" }, outputs: { numberUpdateEvent: "numberUpdateEvent", numberDeleteEvent: "numberDeleteEvent", aswModelChange: "aswModelChange", duplicateControl: "duplicateControl" }, viewQueries: [{ propertyName: "numberInput", first: true, predicate: ["numberInput"], descendants: true }, { propertyName: "currencyInput", first: true, predicate: ["currencyInput"], descendants: true }], ngImport: i0, template: "<ng-container *ngIf=\"control as control\">\r\n    <ng-container *ngIf=\"CSSFramework === 'material'; else bootstrap\">\r\n        <ng-container [ngSwitch]=\"control.controlType\">\r\n            <ng-container *ngSwitchCase=\"'number'\">\r\n                <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n                    <mat-label>{{control.label}}</mat-label>\r\n                    <input matInput type=\"text\" aswNumbersOnly\r\n                        [id]=\"control.id\"\r\n                        [placeholder]=\"control.label\"\r\n                        pattern=\"{{control.pattern}}\"\r\n                        [(ngModel)]=\"control.value\"\r\n                        #numberInput=\"ngModel\"\r\n                        (ngModelChange)=\"onChange(control)\"\r\n                        [matTooltip]=\"control.tooltip\"\r\n                        [maxlength]=\"control.maxlength\"\r\n                        [minlength]=\"control.minlength\"\r\n                        [required]=\"control.isRequired\"\r\n                        [disabled]=\"control.isDisabled ? true : false\">\r\n                        <mat-icon *ngIf=\"numberInput.invalid && (numberInput.dirty || numberInput.touched)\"\r\n                            class=\"asw-error\" matSuffix>error\r\n                        </mat-icon>\r\n                    <mat-error *ngIf=\"numberInput.invalid && (numberInput.dirty || numberInput.touched)\">\r\n                        <ng-container *ngIf=\"numberInput?.errors?.required\">\r\n                            {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"numberInput?.errors?.minlength\">\r\n                            Sorry, {{control.label}} must be at least {{control.minlength}} characters long.\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"numberInput?.errors?.pattern\">\r\n                            {{control.customErrorMsg}}\r\n                        </ng-container>\r\n                    </mat-error>\r\n                </mat-form-field>\r\n            </ng-container>\r\n            <ng-container *ngSwitchCase=\"'currency'\">\r\n                <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n                    <mat-label>{{control.label}}</mat-label>\r\n                    <span matTextPrefix>{{control.currencySymbol}} </span>\r\n                    <input matInput type=\"text\" aswNumbersOnly\r\n                        [id]=\"control.id\"\r\n                        pattern=\"{{control.pattern}}\"\r\n                        [placeholder]=\"control.label\"\r\n                        [(ngModel)]=\"control.value\"\r\n                        #currencyInput=\"ngModel\"\r\n                        (ngModelChange)=\"onChange(control)\"\r\n                        [matTooltip]=\"control.tooltip\"\r\n                        [maxlength]=\"control.maxlength\"\r\n                        [minlength]=\"control.minlength\"\r\n                        [required]=\"control.isRequired\"\r\n                        [disabled]=\"control.isDisabled ? true : false\">\r\n                        <mat-icon *ngIf=\"currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)\"\r\n                            class=\"asw-error\" matSuffix>error\r\n                        </mat-icon>\r\n                    <mat-error *ngIf=\"currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)\">\r\n                        <ng-container *ngIf=\"currencyInput?.errors?.required\">\r\n                            {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"currencyInput?.errors?.minlength\">\r\n                            Sorry, {{control.label}} must be at least {{control.minlength}} characters long.\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"currencyInput?.errors?.pattern\">\r\n                            {{control.customErrorMsg}}\r\n                        </ng-container>\r\n                    </mat-error>\r\n                </mat-form-field>\r\n            </ng-container>\r\n        </ng-container>\r\n    </ng-container>\r\n    <ng-template #bootstrap>\r\n        <ng-container [ngSwitch]=\"control.controlType\">\r\n            <ng-container *ngSwitchCase=\"'number'\">\r\n                <div class=\"asw-mb-3\">\r\n                    <label for=\"{{control.id}}\" \r\n                    class=\"asw-input-label {{(numberInput.invalid && (numberInput.dirty || numberInput.touched)) ? 'asw-red-color' : ''}}\"\r\n                    [class.asw-invalid-label]=\"control.isRequired\">{{control.label}}</label>\r\n                    <input type=\"text\" aswNumbersOnly\r\n                        [id]=\"control.id\"\r\n                        class=\"asw-input-control {{control.customClass}}\" \r\n                        [placeholder]=\"control.label\"\r\n                        pattern=\"{{control.pattern}}\"\r\n                        [(ngModel)]=\"control.value\"\r\n                        #numberInput=\"ngModel\"\r\n                        (ngModelChange)=\"onChange(control)\"\r\n                        [matTooltip]=\"control.tooltip\"\r\n                        [maxlength]=\"control.maxlength\"\r\n                        [minlength]=\"control.minlength\"\r\n                        [required]=\"control.isRequired\"\r\n                        [class.asw-is-invalid]=\"numberInput.invalid && (numberInput.dirty || numberInput.touched)\"\r\n                        [disabled]=\"control.isDisabled ? true : false\">\r\n                    <div *ngIf=\"numberInput.invalid && (numberInput.dirty || numberInput.touched)\" class=\"invalid-feedback\">\r\n                        <ng-container *ngIf=\"numberInput?.errors?.required\">\r\n                            {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"numberInput?.errors?.minlength\">\r\n                            Sorry, {{control.label}} must be at least {{control.minlength}} characters long.\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"numberInput?.errors?.pattern\">\r\n                            {{control.customErrorMsg}}\r\n                        </ng-container>\r\n                    </div>\r\n                </div>\r\n            </ng-container>\r\n            <ng-container *ngSwitchCase=\"'currency'\">\r\n                <div class=\"asw-mb-3\">\r\n                    <label for=\"{{control.id}}\" \r\n                    class=\"asw-input-label {{(currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)) ? 'asw-red-color' : ''}}\"\r\n                    [class.asw-invalid-label]=\"control.isRequired\">{{control.label}}</label>\r\n                    <div class=\"input-group\">\r\n                        <span class=\"input-group-text\" matTextPrefix>{{control.currencySymbol}} </span>\r\n                        <input type=\"text\" aswNumbersOnly\r\n                            [id]=\"control.id\"\r\n                            class=\"asw-input-control {{control.customClass}}\"\r\n                            pattern=\"{{control.pattern}}\"\r\n                            [placeholder]=\"control.label\"\r\n                            [(ngModel)]=\"control.value\"\r\n                            #currencyInput=\"ngModel\"\r\n                            (ngModelChange)=\"onChange(control)\"\r\n                            [matTooltip]=\"control.tooltip\"\r\n                            [maxlength]=\"control.maxlength\"\r\n                            [minlength]=\"control.minlength\"\r\n                            [class.asw-is-invalid]=\"currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)\"\r\n                            [required]=\"control.isRequired\"\r\n                            [disabled]=\"control.isDisabled ? true : false\">\r\n                        <div *ngIf=\"currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)\" class=\"invalid-feedback\">\r\n                            <ng-container *ngIf=\"currencyInput?.errors?.required\">\r\n                                {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n                            </ng-container>\r\n                            <ng-container *ngIf=\"currencyInput?.errors?.minlength\">\r\n                                Sorry, {{control.label}} must be at least {{control.minlength}} characters long.\r\n                            </ng-container>\r\n                            <ng-container *ngIf=\"currencyInput?.errors?.pattern\">\r\n                                {{control.customErrorMsg}}\r\n                            </ng-container>\r\n                        </div>\r\n                    </div>\r\n                </div>\r\n            </ng-container>\r\n        </ng-container>\r\n    </ng-template>    \r\n    <div class=\"asw-row\" *ngIf=\"isPreviewTemplate\">\r\n        <div class=\"asw-col-md-12\" align=\"right\">\r\n            <button mat-icon-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Duplicate' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\" \r\n                    (click)=\"duplicateNumberControl(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)=\"editNumberDialog(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)=\"deleteNumberDialog(control)\">\r\n                <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n            </button>\r\n        </div>\r\n    </div>\r\n</ng-container>", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i3.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i6.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i6.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i9.AswNumberDirective, selector: "[aswNumbersOnly]" }, { kind: "pipe", type: i10.AswTranslatePipe, name: "aswTranslate" }, { kind: "pipe", type: i9.AswSafeHtmlPipe, name: "aswSafeHtml" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswNumber, decorators: [{
            type: Component,
            args: [{ selector: 'asw-number', template: "<ng-container *ngIf=\"control as control\">\r\n    <ng-container *ngIf=\"CSSFramework === 'material'; else bootstrap\">\r\n        <ng-container [ngSwitch]=\"control.controlType\">\r\n            <ng-container *ngSwitchCase=\"'number'\">\r\n                <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n                    <mat-label>{{control.label}}</mat-label>\r\n                    <input matInput type=\"text\" aswNumbersOnly\r\n                        [id]=\"control.id\"\r\n                        [placeholder]=\"control.label\"\r\n                        pattern=\"{{control.pattern}}\"\r\n                        [(ngModel)]=\"control.value\"\r\n                        #numberInput=\"ngModel\"\r\n                        (ngModelChange)=\"onChange(control)\"\r\n                        [matTooltip]=\"control.tooltip\"\r\n                        [maxlength]=\"control.maxlength\"\r\n                        [minlength]=\"control.minlength\"\r\n                        [required]=\"control.isRequired\"\r\n                        [disabled]=\"control.isDisabled ? true : false\">\r\n                        <mat-icon *ngIf=\"numberInput.invalid && (numberInput.dirty || numberInput.touched)\"\r\n                            class=\"asw-error\" matSuffix>error\r\n                        </mat-icon>\r\n                    <mat-error *ngIf=\"numberInput.invalid && (numberInput.dirty || numberInput.touched)\">\r\n                        <ng-container *ngIf=\"numberInput?.errors?.required\">\r\n                            {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"numberInput?.errors?.minlength\">\r\n                            Sorry, {{control.label}} must be at least {{control.minlength}} characters long.\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"numberInput?.errors?.pattern\">\r\n                            {{control.customErrorMsg}}\r\n                        </ng-container>\r\n                    </mat-error>\r\n                </mat-form-field>\r\n            </ng-container>\r\n            <ng-container *ngSwitchCase=\"'currency'\">\r\n                <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n                    <mat-label>{{control.label}}</mat-label>\r\n                    <span matTextPrefix>{{control.currencySymbol}} </span>\r\n                    <input matInput type=\"text\" aswNumbersOnly\r\n                        [id]=\"control.id\"\r\n                        pattern=\"{{control.pattern}}\"\r\n                        [placeholder]=\"control.label\"\r\n                        [(ngModel)]=\"control.value\"\r\n                        #currencyInput=\"ngModel\"\r\n                        (ngModelChange)=\"onChange(control)\"\r\n                        [matTooltip]=\"control.tooltip\"\r\n                        [maxlength]=\"control.maxlength\"\r\n                        [minlength]=\"control.minlength\"\r\n                        [required]=\"control.isRequired\"\r\n                        [disabled]=\"control.isDisabled ? true : false\">\r\n                        <mat-icon *ngIf=\"currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)\"\r\n                            class=\"asw-error\" matSuffix>error\r\n                        </mat-icon>\r\n                    <mat-error *ngIf=\"currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)\">\r\n                        <ng-container *ngIf=\"currencyInput?.errors?.required\">\r\n                            {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"currencyInput?.errors?.minlength\">\r\n                            Sorry, {{control.label}} must be at least {{control.minlength}} characters long.\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"currencyInput?.errors?.pattern\">\r\n                            {{control.customErrorMsg}}\r\n                        </ng-container>\r\n                    </mat-error>\r\n                </mat-form-field>\r\n            </ng-container>\r\n        </ng-container>\r\n    </ng-container>\r\n    <ng-template #bootstrap>\r\n        <ng-container [ngSwitch]=\"control.controlType\">\r\n            <ng-container *ngSwitchCase=\"'number'\">\r\n                <div class=\"asw-mb-3\">\r\n                    <label for=\"{{control.id}}\" \r\n                    class=\"asw-input-label {{(numberInput.invalid && (numberInput.dirty || numberInput.touched)) ? 'asw-red-color' : ''}}\"\r\n                    [class.asw-invalid-label]=\"control.isRequired\">{{control.label}}</label>\r\n                    <input type=\"text\" aswNumbersOnly\r\n                        [id]=\"control.id\"\r\n                        class=\"asw-input-control {{control.customClass}}\" \r\n                        [placeholder]=\"control.label\"\r\n                        pattern=\"{{control.pattern}}\"\r\n                        [(ngModel)]=\"control.value\"\r\n                        #numberInput=\"ngModel\"\r\n                        (ngModelChange)=\"onChange(control)\"\r\n                        [matTooltip]=\"control.tooltip\"\r\n                        [maxlength]=\"control.maxlength\"\r\n                        [minlength]=\"control.minlength\"\r\n                        [required]=\"control.isRequired\"\r\n                        [class.asw-is-invalid]=\"numberInput.invalid && (numberInput.dirty || numberInput.touched)\"\r\n                        [disabled]=\"control.isDisabled ? true : false\">\r\n                    <div *ngIf=\"numberInput.invalid && (numberInput.dirty || numberInput.touched)\" class=\"invalid-feedback\">\r\n                        <ng-container *ngIf=\"numberInput?.errors?.required\">\r\n                            {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"numberInput?.errors?.minlength\">\r\n                            Sorry, {{control.label}} must be at least {{control.minlength}} characters long.\r\n                        </ng-container>\r\n                        <ng-container *ngIf=\"numberInput?.errors?.pattern\">\r\n                            {{control.customErrorMsg}}\r\n                        </ng-container>\r\n                    </div>\r\n                </div>\r\n            </ng-container>\r\n            <ng-container *ngSwitchCase=\"'currency'\">\r\n                <div class=\"asw-mb-3\">\r\n                    <label for=\"{{control.id}}\" \r\n                    class=\"asw-input-label {{(currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)) ? 'asw-red-color' : ''}}\"\r\n                    [class.asw-invalid-label]=\"control.isRequired\">{{control.label}}</label>\r\n                    <div class=\"input-group\">\r\n                        <span class=\"input-group-text\" matTextPrefix>{{control.currencySymbol}} </span>\r\n                        <input type=\"text\" aswNumbersOnly\r\n                            [id]=\"control.id\"\r\n                            class=\"asw-input-control {{control.customClass}}\"\r\n                            pattern=\"{{control.pattern}}\"\r\n                            [placeholder]=\"control.label\"\r\n                            [(ngModel)]=\"control.value\"\r\n                            #currencyInput=\"ngModel\"\r\n                            (ngModelChange)=\"onChange(control)\"\r\n                            [matTooltip]=\"control.tooltip\"\r\n                            [maxlength]=\"control.maxlength\"\r\n                            [minlength]=\"control.minlength\"\r\n                            [class.asw-is-invalid]=\"currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)\"\r\n                            [required]=\"control.isRequired\"\r\n                            [disabled]=\"control.isDisabled ? true : false\">\r\n                        <div *ngIf=\"currencyInput.invalid && (currencyInput.dirty || currencyInput.touched)\" class=\"invalid-feedback\">\r\n                            <ng-container *ngIf=\"currencyInput?.errors?.required\">\r\n                                {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n                            </ng-container>\r\n                            <ng-container *ngIf=\"currencyInput?.errors?.minlength\">\r\n                                Sorry, {{control.label}} must be at least {{control.minlength}} characters long.\r\n                            </ng-container>\r\n                            <ng-container *ngIf=\"currencyInput?.errors?.pattern\">\r\n                                {{control.customErrorMsg}}\r\n                            </ng-container>\r\n                        </div>\r\n                    </div>\r\n                </div>\r\n            </ng-container>\r\n        </ng-container>\r\n    </ng-template>    \r\n    <div class=\"asw-row\" *ngIf=\"isPreviewTemplate\">\r\n        <div class=\"asw-col-md-12\" align=\"right\">\r\n            <button mat-icon-button \r\n                    type=\"button\" \r\n                    matTooltip=\"{{'FormControl.Duplicate' | aswTranslate}}\" \r\n                    [matTooltipPosition]=\"'below'\" \r\n                    (click)=\"duplicateNumberControl(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)=\"editNumberDialog(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)=\"deleteNumberDialog(control)\">\r\n                <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n            </button>\r\n        </div>\r\n    </div>\r\n</ng-container>" }]
        }], ctorParameters: function () { return [{ type: i1.MatDialog }]; }, propDecorators: { control: [{
                type: Input
            }], formControls: [{
                type: Input
            }], CSSFramework: [{
                type: Input
            }], isPreviewTemplate: [{
                type: Input
            }], propertyPersonalization: [{
                type: Input
            }], patterns: [{
                type: Input
            }], numberUpdateEvent: [{
                type: Output
            }], numberDeleteEvent: [{
                type: Output
            }], aswModelChange: [{
                type: Output
            }], duplicateControl: [{
                type: Output
            }], numberInput: [{
                type: ViewChild,
                args: ['numberInput']
            }], currencyInput: [{
                type: ViewChild,
                args: ['currencyInput']
            }] } });

/**
 * @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 AswNumberModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswNumberModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: AswNumberModule, declarations: [AswNumber], imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswDirectiveModule, AswSharedDialogModule, AswTranslateModule, AswPipeModule], exports: [AswNumber] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswNumberModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswDirectiveModule, AswSharedDialogModule, AswTranslateModule, AswPipeModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswNumberModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswDirectiveModule, AswSharedDialogModule, AswTranslateModule, AswPipeModule],
                    declarations: [AswNumber],
                    exports: [AswNumber]
                }]
        }] });

/**
 * @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 { AswNumber, AswNumberModule };
//# sourceMappingURL=asoftwareworld-form-builder-pro-form-control-number.mjs.map
