From 50ad33cdc91b704fc83d0593b93f2aa997b40368 Mon Sep 17 00:00:00 2001 From: Tomasz Gnyp Date: Tue, 19 Nov 2024 09:56:35 +0100 Subject: [PATCH] update readonly control status --- .../form/components/widgets/date-time/date-time.widget.ts | 6 +++--- .../src/lib/form/components/widgets/date/date.widget.ts | 6 +++--- .../lib/form/components/widgets/date/date-cloud.widget.ts | 6 +++--- .../components/widgets/dropdown/dropdown-cloud.widget.ts | 6 +++--- .../src/lib/form/widgets/dropdown/dropdown.widget.ts | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/core/src/lib/form/components/widgets/date-time/date-time.widget.ts b/lib/core/src/lib/form/components/widgets/date-time/date-time.widget.ts index 9e8c4474711..03b9a5458ae 100644 --- a/lib/core/src/lib/form/components/widgets/date-time/date-time.widget.ts +++ b/lib/core/src/lib/form/components/widgets/date-time/date-time.widget.ts @@ -87,9 +87,9 @@ export class DateTimeWidgetComponent extends WidgetComponent implements OnInit { private updateFormControlState(): void { this.datetimeInputControl.setValidators(this.isRequired() ? [Validators.required] : []); - if (this.field?.readOnly || this.readOnly) { - this.datetimeInputControl.disable({ emitEvent: false }); - } + this.field?.readOnly || this.readOnly + ? this.datetimeInputControl.disable({ emitEvent: false }) + : this.datetimeInputControl.enable({ emitEvent: false }); this.datetimeInputControl.updateValueAndValidity({ emitEvent: false }); } diff --git a/lib/core/src/lib/form/components/widgets/date/date.widget.ts b/lib/core/src/lib/form/components/widgets/date/date.widget.ts index 96b881cc5c0..30468ae642e 100644 --- a/lib/core/src/lib/form/components/widgets/date/date.widget.ts +++ b/lib/core/src/lib/form/components/widgets/date/date.widget.ts @@ -94,9 +94,9 @@ export class DateWidgetComponent extends WidgetComponent implements OnInit, Reac private updateFormControlState(): void { this.dateInputControl.setValidators(this.isRequired() ? [Validators.required] : []); - if (this.field?.readOnly || this.readOnly) { - this.dateInputControl.disable({ emitEvent: false }); - } + this.field?.readOnly || this.readOnly + ? this.dateInputControl.disable({ emitEvent: false }) + : this.dateInputControl.enable({ emitEvent: false }); this.dateInputControl.updateValueAndValidity({ emitEvent: false }); } diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.ts b/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.ts index 82e852aefa6..396a1965e15 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.ts @@ -102,9 +102,9 @@ export class DateCloudWidgetComponent extends WidgetComponent implements OnInit, private updateFormControlState(): void { this.dateInputControl.setValidators(this.isRequired() ? [Validators.required] : []); - if (this.field?.readOnly || this.readOnly) { - this.dateInputControl.disable({ emitEvent: false }); - } + this.field?.readOnly || this.readOnly + ? this.dateInputControl.disable({ emitEvent: false }) + : this.dateInputControl.enable({ emitEvent: false }); this.dateInputControl.updateValueAndValidity({ emitEvent: false }); } diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts index 2d601f9b35a..7b1fe79ce35 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts @@ -197,9 +197,9 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI private updateFormControlState(): void { this.dropdownControl.setValidators(this.isRequired() ? [Validators.required] : []); - if (this.field?.readOnly || this.readOnly) { - this.dropdownControl.disable({ emitEvent: false }); - } + this.field?.readOnly || this.readOnly + ? this.dropdownControl.disable({ emitEvent: false }) + : this.dropdownControl.enable({ emitEvent: false }); this.dropdownControl.updateValueAndValidity({ emitEvent: false }); } diff --git a/lib/process-services/src/lib/form/widgets/dropdown/dropdown.widget.ts b/lib/process-services/src/lib/form/widgets/dropdown/dropdown.widget.ts index f0801b525ad..f00f110ad3b 100644 --- a/lib/process-services/src/lib/form/widgets/dropdown/dropdown.widget.ts +++ b/lib/process-services/src/lib/form/widgets/dropdown/dropdown.widget.ts @@ -151,9 +151,9 @@ export class DropdownWidgetComponent extends WidgetComponent implements OnInit, private updateFormControlState(): void { this.dropdownControl.setValidators(this.isRequired() ? [this.customRequiredValidator(this.field)] : []); - if (this.field?.readOnly || this.readOnly) { - this.dropdownControl.disable({ emitEvent: false }); - } + this.field?.readOnly || this.readOnly + ? this.dropdownControl.disable({ emitEvent: false }) + : this.dropdownControl.enable({ emitEvent: false }); this.dropdownControl.updateValueAndValidity({ emitEvent: false }); }