@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
1 lines • 64.3 kB
Source Map (JSON)
{"version":3,"file":"asoftwareworld-form-builder-pro-form-control-datepicker.mjs","sources":["../../src/components/form-control/datepicker/datepicker-dialog.ts","../../src/components/form-control/datepicker/datepicker-dialog.html","../../src/components/form-control/datepicker/datepicker.ts","../../src/components/form-control/datepicker/datepicker.html","../../src/components/form-control/datepicker/datepicker.module.ts","../../src/components/form-control/datepicker/public_api.ts","../../src/components/form-control/datepicker/asoftwareworld-form-builder-pro-form-control-datepicker.ts"],"sourcesContent":["/**\n * @license\n * Copyright ASW (A Software World) All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file\n */\n\nimport { Component, Inject, OnInit } from '@angular/core';\nimport { FormBuilder, FormGroup, Validators } from '@angular/forms';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { Constants, Icons } from '@asoftwareworld/form-builder-pro/common';\nimport { DateControl } from './date-control';\n\n@Component({\n selector: 'asw-datepicker-dialog',\n templateUrl: './datepicker-dialog.html'\n})\nexport class AswDatepickerDialog implements OnInit {\n constants: any = Constants;\n icons = Icons;\n aswDatepickerForm!: FormGroup;\n status!: boolean;\n disabled!: boolean;\n isDisableWeekendDates = false;\n control!: DateControl;\n isMinMaxEnabled = true;\n constructor(\n private formBuilder: FormBuilder,\n public dialogRef: MatDialogRef<AswDatepickerDialog>,\n @Inject(MAT_DIALOG_DATA) public data: any\n ) {}\n\n ngOnInit(): void {\n this.control = this.data.control;\n this.validateFormBuilder();\n this.editProperty(this.control);\n }\n\n validateFormBuilder(): void {\n this.aswDatepickerForm = this.formBuilder.group({\n id: ['', [Validators.required]],\n customClass: [],\n tooltip: [''],\n minDate: [''],\n maxDate: [''],\n label: ['', [Validators.required, Validators.minLength(2)]],\n value: [''],\n type: ['date'],\n mode: ['auto'],\n defaultView: ['month'],\n style: ['', [Validators.required]],\n isRequired: [false],\n isDisabled: [false],\n isDisableWeekendDates: [false],\n yearSelector: [true],\n twelveHour: [false]\n });\n }\n\n editProperty(control: DateControl): void {\n if (control.type === 'time') {\n this.isMinMaxEnabled = false;\n }\n this.aswDatepickerForm.setValue({\n id: control.id,\n customClass: control.customClass ?? '',\n minDate: control.minDate ?? '',\n maxDate: control.maxDate ?? '',\n tooltip: control.tooltip,\n label: control.label,\n value: control.value ?? '',\n style: control.style,\n type: control.type,\n mode: control.mode,\n defaultView: control.defaultView,\n isRequired: control.isRequired,\n isDisabled: control.isDisabled,\n isDisableWeekendDates: control.isDisableWeekendDates,\n twelveHour: control.twelveHour,\n yearSelector: control.yearSelector\n });\n }\n\n onNoClick(): void {\n this.dialogRef.close();\n }\n\n onSubmit(): void {\n this.aswDatepickerForm.value.controlType = this.control.controlType;\n this.aswDatepickerForm.value.guid = this.control.guid;\n this.dialogRef.close(this.aswDatepickerForm.value);\n }\n\n onStatusChange(event: any): void {\n this.status = event.checked ? true : false;\n }\n\n onChange(event: any): void {\n this.disabled = event.checked ? true : false;\n if (event.checked === undefined) {\n this.status = event.target.checked ? true : false;\n }\n }\n\n onChangeWeekendDateFilter(event: any): void {\n this.isDisableWeekendDates = event.checked ? true : false;\n if (event.checked === undefined) {\n this.status = event.target.checked ? true : false;\n }\n }\n\n onTypeChange(event: any): void {\n if (event.value) {\n this.isMinMaxEnabled = event.value === 'time' ? false : true;\n } else {\n this.isMinMaxEnabled = event.target.value === 'time' ? false : true;\n }\n }\n}\n","<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]=\"aswDatepickerForm\" (ngSubmit)=\"onSubmit()\">\r\n <mat-dialog-content class=\"mat-typography\">\r\n <div class=\"asw-row asw-px-2 asw-py-3\">\r\n <ng-container *ngIf=\"data.CSSFramework === 'material'; else bootstrap\">\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('uniqueId')\">\r\n <div class=\"asw-col-md-12\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.UniqueId' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n name=\"id\"\r\n placeholder=\"{{'FormControl.UniqueId' | aswTranslate}}\"\r\n matTooltip=\"{{'FormControl.UniqueId' | aswTranslate}}\"\r\n formControlName=\"id\" required>\r\n <mat-error *ngFor=\"let validation of constants.accountValidationMessages.id\">\r\n <ng-container *ngIf=\"aswDatepickerForm.get('id')?.hasError(validation.type) && (aswDatepickerForm.get('id')?.dirty || aswDatepickerForm.get('id')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n <div class=\"asw-col-md-6\">\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=\"aswDatepickerForm.get('label')?.hasError(validation.type) && (aswDatepickerForm.get('label')?.dirty || aswDatepickerForm.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 <div class=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Tooltip' | aswTranslate}}</mat-label>\r\n <input matInput type=\"text\"\r\n placeholder=\"{{'FormControl.Tooltip' | aswTranslate}}\"\r\n matTooltip=\"{{'FormControl.Tooltip' | aswTranslate}}\"\r\n formControlName=\"tooltip\">\r\n </mat-form-field>\r\n </div>\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('customCSSClass')\">\r\n <div class=\"asw-col-md-12\">\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-4\">\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=\"type\" \r\n matTooltip=\"{{'FormControl.SelectType' | aswTranslate}}\" \r\n (selectionChange)=\"onTypeChange($event)\">\r\n <mat-option value=\"date\">Date</mat-option>\r\n <mat-option value=\"time\">Time</mat-option>\r\n <mat-option value=\"datetime\">Datetime</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-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.Mode' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"mode\" matTooltip=\"{{'FormControl.SelectMode' | aswTranslate}}\">\r\n <mat-option value=\"auto\">Auto</mat-option>\r\n <mat-option value=\"portrait\">Portrait</mat-option>\r\n <mat-option value=\"landscape\">Landscape</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-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.DefaultView' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"defaultView\" matTooltip=\"{{'FormControl.SelectDefaultView' | aswTranslate}}\">\r\n <mat-option value=\"clock\">Clock</mat-option>\r\n <mat-option value=\"month\">Month</mat-option>\r\n <mat-option value=\"year\">Year</mat-option>\r\n <mat-option value=\"multi-year\">Multi Year</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <ng-container *ngIf=\"isMinMaxEnabled\">\r\n <div class=\"asw-col-md-6\">\r\n <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n <mat-label>{{'FormControl.MinDate' | aswTranslate}}</mat-label>\r\n <input matInput name=\"minDate\" placeholder=\"{{'FormControl.MinDate' | aswTranslate}}\" \r\n matTooltip=\"{{'FormControl.MinDate' | aswTranslate}}\"\r\n formControlName=\"minDate\" [matDatepicker]=\"minDate\">\r\n <mat-datepicker-toggle matSuffix [for]=\"minDate\"></mat-datepicker-toggle>\r\n <mat-datepicker #minDate></mat-datepicker>\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.MaxDate' | aswTranslate}}</mat-label>\r\n <input matInput name=\"maxDate\" placeholder=\"{{'FormControl.MaxDate' | aswTranslate}}\" \r\n matTooltip=\"{{'FormControl.MaxDate' | aswTranslate}}\"\r\n formControlName=\"maxDate\" [matDatepicker]=\"maxDate\">\r\n <mat-datepicker-toggle matSuffix [for]=\"maxDate\"></mat-datepicker-toggle>\r\n <mat-datepicker #maxDate></mat-datepicker>\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 <input matInput name=\"value\" placeholder=\"{{'FormControl.Value' | aswTranslate}}\" \r\n matTooltip=\"{{'FormControl.Value' | aswTranslate}}\"\r\n formControlName=\"value\" [matDatepicker]=\"picker\">\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker></mat-datepicker>\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.Style' | aswTranslate}}</mat-label>\r\n <mat-select formControlName=\"style\" matTooltip=\"{{'FormControl.SelectStyle' | aswTranslate}}\">\r\n <mat-option value=\"fill\">Fill</mat-option>\r\n <mat-option value=\"outline\">Outline</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <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 \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 (change)=\"onChange($event)\">\r\n {{(disabled ? 'FormControl.Disabled' : 'FormControl.Enabled') | 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 #isDisableWeekendDates\r\n formControlName=\"isDisableWeekendDates\"\r\n (change)=\"onChangeWeekendDateFilter($event)\">\r\n {{(isDisableWeekendDates ? 'FormControl.DisabledWeekend' : 'FormControl.EnabledWeekend') | aswTranslate}}\r\n </mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <ng-template #bootstrap>\r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('uniqueId')\">\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 {{(aswDatepickerForm.get('id')?.invalid && (aswDatepickerForm.get('id')?.dirty || aswDatepickerForm.get('id')?.touched)) ? 'asw-red-color' : ''}}\">{{'FormControl.UniqueId' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n name=\"id\"\r\n class=\"asw-input-control\"\r\n [class.asw-is-invalid]=\"(aswDatepickerForm.get('id')?.invalid && (aswDatepickerForm.get('id')?.dirty || aswDatepickerForm.get('id')?.touched))\"\r\n matTooltip=\"{{'FormControl.UniqueId' | aswTranslate}}\"\r\n formControlName=\"id\" required>\r\n <div *ngFor=\"let validation of constants.accountValidationMessages.id\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"aswDatepickerForm.get('id')?.hasError(validation.type) && (aswDatepickerForm.get('id')?.dirty || aswDatepickerForm.get('id')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <div class=\"asw-col-md-6\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label asw-invalid-label {{(aswDatepickerForm.get('label')?.invalid && (aswDatepickerForm.get('label')?.dirty || aswDatepickerForm.get('label')?.touched)) ? 'asw-red-color' : ''}}\">{{'FormControl.Label' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n class=\"asw-input-control\"\r\n [class.asw-is-invalid]=\"(aswDatepickerForm.get('label')?.invalid && (aswDatepickerForm.get('label')?.dirty || aswDatepickerForm.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=\"aswDatepickerForm.get('label')?.hasError(validation.type) && (aswDatepickerForm.get('label')?.dirty || aswDatepickerForm.get('label')?.touched)\">\r\n {{validation.message | aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"asw-col-md-6\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label\">{{'FormControl.Tooltip' | aswTranslate}}</label>\r\n <input type=\"text\"\r\n class=\"asw-input-control\"\r\n matTooltip=\"{{'FormControl.Tooltip' | aswTranslate}}\"\r\n formControlName=\"tooltip\">\r\n </div>\r\n </div>\r\n <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 <input matInput name=\"value\" class=\"asw-input-control\"\r\n matTooltip=\"{{'FormControl.Value' | aswTranslate}}\"\r\n formControlName=\"value\" [matDatepicker]=\"picker\">\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\" class=\"asw-date-picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker></mat-datepicker>\r\n </div>\r\n </div>\r\n <div class=\"asw-col-md-4\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label\">{{'FormControl.Type' | aswTranslate}}</label>\r\n <select formControlName=\"type\" class=\"asw-select\" matNativeControl\r\n matTooltip=\"{{'FormControl.SelectType' | aswTranslate}}\" \r\n (change)=\"onTypeChange($event)\">\r\n <option value=\"date\">Date</option>\r\n <option value=\"time\">Time</option>\r\n <option value=\"datetime\">Datetime</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 <label class=\"asw-input-label\">{{'FormControl.Mode' | aswTranslate}}</label>\r\n <select formControlName=\"mode\" class=\"asw-select\" matNativeControl matTooltip=\"{{'FormControl.SelectMode' | aswTranslate}}\">\r\n <option value=\"auto\">Auto</option>\r\n <option value=\"portrait\">Portrait</option>\r\n <option value=\"landscape\">Landscape</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 <label class=\"asw-input-label\">{{'FormControl.Type' | aswTranslate}}</label>\r\n <select formControlName=\"defaultView\" class=\"asw-select\" matNativeControl matTooltip=\"{{'FormControl.SelectDefaultView' | aswTranslate}}\">\r\n <option value=\"clock\">Clock</option>\r\n <option value=\"month\">Month</option>\r\n <option value=\"year\">Year</option>\r\n <option value=\"multi-year\">Multi Year</option>\r\n </select>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"isMinMaxEnabled\">\r\n <div class=\"asw-col-md-6\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label\">{{'FormControl.MinDate' | aswTranslate}}</label>\r\n <input name=\"minDate\" class=\"asw-input-control\"\r\n matTooltip=\"{{'FormControl.MinDate' | aswTranslate}}\"\r\n formControlName=\"minDate\" [matDatepicker]=\"minDate\">\r\n <mat-datepicker-toggle matSuffix [for]=\"minDate\" class=\"asw-date-picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #minDate></mat-datepicker>\r\n </div>\r\n </div>\r\n <div class=\"asw-col-md-6\">\r\n <div class=\"asw-mb-3\">\r\n <label class=\"asw-input-label\">{{'FormControl.MaxDate' | aswTranslate}}</label>\r\n <input name=\"maxDate\" class=\"asw-input-control\"\r\n matTooltip=\"{{'FormControl.MaxDate' | aswTranslate}}\"\r\n formControlName=\"maxDate\" [matDatepicker]=\"maxDate\">\r\n <mat-datepicker-toggle matSuffix [for]=\"maxDate\" class=\"asw-date-picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #maxDate></mat-datepicker>\r\n </div>\r\n </div>\r\n </ng-container> \r\n <ng-container *ngIf=\"!data.propertyPersonalization.includes('customCSSClass')\">\r\n <div class=\"asw-col-md-12\">\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-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-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 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 id=\"isDisableWeekendDates\" \r\n #isDisableWeekendDates\r\n formControlName=\"isDisableWeekendDates\"\r\n (change)=\"onChangeWeekendDateFilter($event)\">\r\n <label class=\"asw-form-check-label\" for=\"isDisableWeekendDates\">\r\n {{(isDisableWeekendDates ? 'FormControl.DisabledWeekend' : 'FormControl.EnabledWeekend') | aswTranslate}}\r\n </label>\r\n </div>\r\n </div>\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\" class=\"asw-button asw-button-danger asw-mb-1 asw-me-2\" (click)=\"onNoClick()\">\r\n {{'FormControl.No' | aswTranslate}}\r\n </button>\r\n <button type=\"submit\" class=\"asw-button asw-button-primary asw-mb-1\" cdkFocusInitial>\r\n {{'FormControl.Yes' | aswTranslate}}\r\n </button>\r\n </mat-dialog-actions>\r\n</form>","/**\n * @license\n * Copyright ASW (A Software World) All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file\n */\n\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { CSSFrameworkEnum } from '@asoftwareworld/form-builder-pro/api';\nimport { Constants, Icons } from '@asoftwareworld/form-builder-pro/common';\nimport { AswCalendarView, AswDatetimepickerFilterType, AswDatetimepickerMode, AswDatetimepickerType } from '@asoftwareworld/form-builder-pro/datetimepicker';\nimport { AswConfirmDialog } from '@asoftwareworld/form-builder-pro/form-control/confirm-dialog';\nimport { DateControl } from './date-control';\nimport { AswDatepickerDialog } from './datepicker-dialog';\n\n@Component({\n selector: 'asw-datepicker',\n templateUrl: './datepicker.html'\n})\nexport class AswDatepicker {\n constants: any = Constants;\n icons = Icons;\n multiYearSelector = true;\n touchUi = false;\n timeInterval = 1;\n timeInput = true;\n\n /**\n * Datepicker control\n */\n @Input() control: DateControl | null = null;\n @Input() CSSFramework: CSSFrameworkEnum = CSSFrameworkEnum.Material;\n @Input() isPreviewTemplate = false;\n @Input() propertyPersonalization: string[] = [];\n\n @Output() datepickerUpdateEvent = new EventEmitter<DateControl>();\n @Output() datepickerDeleteEvent = new EventEmitter<DateControl>();\n @Output() dateChange = new EventEmitter<DateControl>();\n @Output() duplicateControl = new EventEmitter<DateControl>();\n\n constructor(public dialog: MatDialog) {}\n\n /**\n * Delete datepicker control based on control index\n * @param control datepicker control items\n */\n deleteDatepickerDialog(control: DateControl): void {\n const dialogRef = this.dialog.open(AswConfirmDialog, {\n width: '350px',\n data: { name: control.controlType, message: this.constants.messages.waringMessage }\n });\n dialogRef.afterClosed().subscribe((result) => {\n if (result !== undefined) {\n this.datepickerDeleteEvent.emit(control);\n }\n });\n }\n\n editDatepickerDialog(control: DateControl): void {\n const dialogRef = this.dialog.open(AswDatepickerDialog, {\n width: '60%',\n minWidth: '60vw',\n disableClose: true,\n data: { control, CSSFramework: this.CSSFramework, propertyPersonalization: this.propertyPersonalization }\n });\n dialogRef.afterClosed().subscribe((result) => {\n if (result !== undefined) {\n this.datepickerUpdateEvent.emit(result);\n }\n });\n }\n\n onDateChange(control: DateControl): void {\n this.dateChange.emit(control);\n }\n\n duplicateDatepickerControl(control: DateControl): void {\n this.duplicateControl.emit(control);\n }\n\n weekendsDatesFilter = (date: any | null): boolean => {\n if (date === null) {\n return true;\n }\n const day = date.day();\n // Prevent Saturday and Sunday from being selected.\n return day !== 0 && day !== 6;\n };\n}\n","<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=\"'datepicker'\">\r\n <ng-container *ngIf=\"control.isDisableWeekendDates\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <asw-datetimepicker #picker\r\n [type]=\"control.type\"\r\n [mode]=\"control.mode\"\r\n [multiYearSelector]=\"multiYearSelector\"\r\n [startView]=\"control.defaultView\"\r\n [twelvehour]=\"control.twelveHour\"\r\n [timeInterval]=\"timeInterval\"\r\n [touchUi]=\"touchUi\"\r\n [timeInput]=\"timeInput\">\r\n </asw-datetimepicker>\r\n <input matInput \r\n [aswDatetimepicker]=\"picker\" \r\n #input=\"ngModel\"\r\n [id]=\"control.id\"\r\n [(ngModel)]=\"control.value\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n (dateChange)=\"onDateChange(control)\"\r\n [min]=\"control.minDate\" \r\n [max]=\"control.maxDate\"\r\n [aswDatetimepickerFilter]=\"weekendsDatesFilter\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <asw-datetimepicker-toggle [for]=\"picker\" matSuffix></asw-datetimepicker-toggle>\r\n <mat-error *ngIf=\"input.invalid && (input.dirty || input.touched)\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngIf=\"!control.isDisableWeekendDates\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label | aswTranslate}}</mat-label>\r\n <asw-datetimepicker #datetimePicker\r\n [type]=\"control.type\"\r\n [mode]=\"control.mode\"\r\n [multiYearSelector]=\"multiYearSelector\"\r\n [startView]=\"control.defaultView\"\r\n [twelvehour]=\"control.twelveHour\"\r\n [timeInterval]=\"timeInterval\"\r\n [touchUi]=\"touchUi\"\r\n [timeInput]=\"timeInput\">\r\n </asw-datetimepicker>\r\n <input matInput \r\n #input=\"ngModel\"\r\n [aswDatetimepicker]=\"datetimePicker\"\r\n [id]=\"control.id\"\r\n [(ngModel)]=\"control.value\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n (dateChange)=\"onDateChange(control)\"\r\n [min]=\"control.minDate\" \r\n [max]=\"control.maxDate\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <asw-datetimepicker-toggle [for]=\"datetimePicker\" matSuffix></asw-datetimepicker-toggle>\r\n <mat-error *ngIf=\"input.invalid && (input.dirty || input.touched)\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\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=\"'datepicker'\">\r\n <ng-container *ngIf=\"control.isDisableWeekendDates\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(input.invalid && (input.dirty || input.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <asw-datetimepicker #picker\r\n [type]=\"control.type\"\r\n [mode]=\"control.mode\"\r\n [multiYearSelector]=\"multiYearSelector\"\r\n [startView]=\"control.defaultView\"\r\n [twelvehour]=\"control.twelveHour\"\r\n [timeInterval]=\"timeInterval\"\r\n [touchUi]=\"touchUi\"\r\n [timeInput]=\"timeInput\">\r\n </asw-datetimepicker>\r\n <input \r\n [aswDatetimepicker]=\"picker\" \r\n #input=\"ngModel\"\r\n [id]=\"control.id\"\r\n class=\"asw-input-control {{control.customClass}}\"\r\n [class.asw-is-invalid]=\"input.invalid && (input.dirty || input.touched)\"\r\n [(ngModel)]=\"control.value\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n (dateChange)=\"onDateChange(control)\"\r\n [min]=\"control.minDate\" \r\n [max]=\"control.maxDate\"\r\n [aswDatetimepickerFilter]=\"weekendsDatesFilter\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <asw-datetimepicker-toggle [for]=\"picker\" matSuffix class=\"asw-date-picker\"></asw-datetimepicker-toggle>\r\n <div *ngIf=\"input.invalid && (input.dirty || input.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!control.isDisableWeekendDates\">\r\n <div class=\"asw-mb-3\">\r\n <label for=\"{{control.id}}\" \r\n class=\"asw-input-label {{(input.invalid && (input.dirty || input.touched)) ? 'asw-red-color' : ''}}\"\r\n [class.asw-invalid-label]=\"control.isRequired\">{{control.label | aswTranslate}}</label>\r\n <input \r\n [aswDatetimepicker]=\"datetimePicker\" \r\n #input=\"ngModel\"\r\n class=\"asw-input-control {{control.customClass}}\"\r\n [class.asw-is-invalid]=\"input.invalid && (input.dirty || input.touched)\"\r\n [id]=\"control.id\"\r\n [(ngModel)]=\"control.value\"\r\n [matTooltip]=\"control.tooltip | aswTranslate\"\r\n [placeholder]=\"control.label | aswTranslate\"\r\n (dateChange)=\"onDateChange(control)\"\r\n [min]=\"control.minDate\" \r\n [max]=\"control.maxDate\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <asw-datetimepicker-toggle [for]=\"datetimePicker\" matSuffix class=\"asw-date-picker\"></asw-datetimepicker-toggle>\r\n <asw-datetimepicker #datetimePicker\r\n [type]=\"control.type\"\r\n [mode]=\"control.mode\"\r\n [multiYearSelector]=\"multiYearSelector\"\r\n [startView]=\"control.defaultView\"\r\n [twelvehour]=\"control.twelveHour\"\r\n [timeInterval]=\"timeInterval\"\r\n [touchUi]=\"touchUi\"\r\n [timeInput]=\"timeInput\">\r\n </asw-datetimepicker>\r\n <div *ngIf=\"input.invalid && (input.dirty || input.touched)\" class=\"invalid-feedback\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label | aswTranslate}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n <!-- <ng-container *ngSwitchCase=\"'daterange'\">\r\n <ng-container *ngIf=\"control.isDisableWeekendDates\">\r\n <mat-form-field [appearance]=\"control.style\" class=\"asw-width-100 {{control.customClass}}\">\r\n <mat-label>{{control.label}}</mat-label>\r\n <mat-date-range-input [(ngModel)]=\"control.value\"\r\n [rangePicker]=\"picker\"\r\n #input=\"ngModel\"\r\n [id]=\"control.id\"\r\n (dateChange)=\"onDateChange(control)\"\r\n [matTooltip]=\"control.tooltip\"\r\n [min]=\"control.minDate\" \r\n [max]=\"control.maxDate\"\r\n [dateFilter]=\"weekendsDatesFilter\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <input matStartDate >\r\n <input matEndDate >\r\n </mat-date-range-input> \r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-date-range-picker #picker></mat-date-range-picker>\r\n <mat-error *ngIf=\"input.invalid && (input.dirty || input.touched)\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n <ng-container *ngIf=\"!control.isDisableWeekendDates\">\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 \r\n [matDatepicker]=\"picker\" \r\n #input=\"ngModel\"\r\n [id]=\"control.id\"\r\n [(ngModel)]=\"control.value\"\r\n [matTooltip]=\"control.tooltip\"\r\n [placeholder]=\"control.label\"\r\n (dateChange)=\"onDateChange(control)\"\r\n [min]=\"control.minDate\" \r\n [max]=\"control.maxDate\"\r\n [required]=\"control.isRequired\"\r\n [disabled]=\"control.isDisabled ? true : false\">\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker></mat-datepicker>\r\n <mat-error *ngIf=\"input.invalid && (input.dirty || input.touched)\">\r\n <ng-container *ngIf=\"input?.errors?.required\">\r\n {{control.label}} {{'FormControl.IsRequired' | aswTranslate}}\r\n </ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n </ng-container> -->\r\n </ng-container>\r\n </ng-template>\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)=\"duplicateDatepickerControl(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)=\"editDatepickerDialog(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)=\"deleteDatepickerDialog(control)\">\r\n <div [innerHTML]=\"icons.delete2 | aswSafeHtml\"></div>\r\n </button>\r\n </div>\r\n </div>\r\n</ng-container>","/**\n * @license\n * Copyright ASW (A Software World) All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file\n */\n\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';\nimport { AswPipeModule, ASW_DATETIME_FORMATS, MaterialModule, AswMomentDatetimeModule } from '@asoftwareworld/form-builder-pro/common';\nimport { AswTranslateModule } from '@asoftwareworld/form-builder-pro/core';\nimport { AswConfirmDialogModule } from '@asoftwareworld/form-builder-pro/form-control/confirm-dialog';\nimport { AswDatetimepickerModule } from '@asoftwareworld/form-builder-pro/datetimepicker';\nimport { AswDatepicker } from './datepicker';\nimport { AswDatepickerDialog } from './datepicker-dialog';\n\n@NgModule({\n imports: [CommonModule, FormsModule, AswMomentDatetimeModule, ReactiveFormsModule, MaterialModule, AswConfirmDialogModule, AswTranslateModule, AswPipeModule, AswDatetimepickerModule],\n declarations: [AswDatepicker, AswDatepickerDialog],\n exports: [AswDatepicker, AswDatepickerDialog],\n providers: [\n { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'fill' } },\n {\n provide: ASW_DATETIME_FORMATS,\n useValue: {\n parse: {\n dateInput: 'YYYY-MM-DD',\n monthInput: 'MMMM',\n yearInput: 'YYYY',\n timeInput: 'HH:mm',\n datetimeInput: 'YYYY-MM-DD HH:mm'\n },\n display: {\n dateInput: 'YYYY-MM-DD',\n monthInput: 'MMMM',\n yearInput: 'YYYY',\n timeInput: 'HH:mm',\n datetimeInput: 'YYYY-MM-DD HH:mm',\n monthYearLabel: 'YYYY MMMM',\n dateA11yLabel: 'LL',\n monthYearA11yLabel: 'MMMM YYYY',\n popupHeaderDateLabel: 'MMM DD, ddd'\n }\n }\n }\n ]\n})\nexport class AswDatepickerModule {}\n","/**\n * @license\n * Copyright ASW (A Software World) All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file\n */\n\nexport * from './datepicker';\nexport * from './date-control';\nexport * from './datepicker-dialog';\nexport * from './datepicker.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i3","i1","i2","i4","i5","i6","i7","i8","i9","i10"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAMG;MAYU,mBAAmB,CAAA;AAUhB,IAAA,WAAA;AACD,IAAA,SAAA;AACyB,IAAA,IAAA;IAXpC,SAAS,GAAQ,SAAS;IAC1B,KAAK,GAAG,KAAK;AACb,IAAA,iBAAiB;AACjB,IAAA,MAAM;AACN,IAAA,QAAQ;IACR,qBAAqB,GAAG,KAAK;AAC7B,IAAA,OAAO;IACP,eAAe,GAAG,IAAI;AACtB,IAAA,WAAA,CACY,WAAwB,EACzB,SAA4C,EACnB,IAAS,EAAA;QAFjC,IAAW,CAAA,WAAA,GAAX,WAAW;QACZ,IAAS,CAAA,SAAA,GAAT,SAAS;QACgB,IAAI,CAAA,IAAA,GAAJ,IAAI;;IAGxC,QAAQ,GAAA;QACJ,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO;QAChC,IAAI,CAAC,mBAAmB,EAAE;AAC1B,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;;IAGnC,mBAAmB,GAAA;QACf,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YAC5C,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC/B,YAAA,WAAW,EAAE,EAAE;YACf,OAAO,EAAE,CAAC,EAAE,CAAC;YACb,OAAO,EAAE,CAAC,EAAE,CAAC;YACb,OAAO,EAAE,CAAC,EAAE,CAAC;AACb,YAAA,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3D,KAAK,EAAE,CA