@ascentgl/ads-ui 21.114.4 → 21.114.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6085,7 +6085,15 @@ class AdsDatetimepickerComponent extends AbstractInputComponent {
|
|
|
6085
6085
|
*sync display control statuses with value control status for proper error display
|
|
6086
6086
|
* make sure "displayControl" disabled state and value are synchronized with "control" disabled state and value
|
|
6087
6087
|
*/
|
|
6088
|
-
this.subscriptions.push(this.valueControl.statusChanges.subscribe((status) =>
|
|
6088
|
+
this.subscriptions.push(this.valueControl.statusChanges.subscribe((status) => {
|
|
6089
|
+
// Sync validators from valueControl to displayControl to handle dynamically added/removed validators.
|
|
6090
|
+
// Without this, displayControl keeps its original validators and shows stale errors
|
|
6091
|
+
// (e.g. required error after Validators.required was removed from valueControl).
|
|
6092
|
+
this.displayControl.setValidators(this.valueControl.validator);
|
|
6093
|
+
this.displayControl.setAsyncValidators(this.valueControl.asyncValidator);
|
|
6094
|
+
this.displayControl.updateValueAndValidity({ emitEvent: false });
|
|
6095
|
+
this.syncState(status);
|
|
6096
|
+
}));
|
|
6089
6097
|
this.subscriptions.push(this.valueControl.valueChanges.subscribe(() => this.syncDisplayedValue()));
|
|
6090
6098
|
/**
|
|
6091
6099
|
* NOTE: registering display value change is needed to know when to focus time part of datetime if showTimePicker is false
|