Skip to content

Commit

Permalink
update readonly control status
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgny committed Nov 19, 2024
1 parent 7da876c commit 82cb763
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,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 });
}
Expand Down
6 changes: 3 additions & 3 deletions lib/core/src/lib/form/components/widgets/date/date.widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,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 });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,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 });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down

0 comments on commit 82cb763

Please sign in to comment.