@ascentgl/ads-ui 21.106.0 → 21.107.0
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.
|
@@ -4678,6 +4678,8 @@ class AdsSearchDropdownComponent extends AbstractDropdownComponent {
|
|
|
4678
4678
|
}
|
|
4679
4679
|
/** @ignore */
|
|
4680
4680
|
canShowError() {
|
|
4681
|
+
if (!this.showValidationError)
|
|
4682
|
+
return false;
|
|
4681
4683
|
if (this.skipValidationWhenEmpty && !this.displayControl.value) {
|
|
4682
4684
|
return false;
|
|
4683
4685
|
}
|
|
@@ -4732,7 +4734,15 @@ class AdsSearchDropdownComponent extends AbstractDropdownComponent {
|
|
|
4732
4734
|
/**
|
|
4733
4735
|
* sync display control statuses with value control status for proper error display
|
|
4734
4736
|
*/
|
|
4735
|
-
this.valueControlStatusSubscription = this.valueControl.statusChanges.subscribe(() =>
|
|
4737
|
+
this.valueControlStatusSubscription = this.valueControl.statusChanges.subscribe(() => {
|
|
4738
|
+
// Sync validators from valueControl to displayControl to handle dynamically added/removed validators.
|
|
4739
|
+
// Without this, displayControl keeps its original validators and canShowError() returns false
|
|
4740
|
+
// because displayControl.errors is null after updateValueAndValidity() re-runs its own (stale) validators.
|
|
4741
|
+
this.displayControl.setValidators(this.valueControl.validator);
|
|
4742
|
+
this.displayControl.setAsyncValidators(this.valueControl.asyncValidator);
|
|
4743
|
+
this.displayControl.updateValueAndValidity({ emitEvent: false });
|
|
4744
|
+
this.syncState();
|
|
4745
|
+
});
|
|
4736
4746
|
this.subscribeToDisplayedControlValueChanged();
|
|
4737
4747
|
/**
|
|
4738
4748
|
* listen to scroll to reposition the dropdown
|