@ascentgl/ads-ui 21.114.3 → 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.
@@ -4160,6 +4160,7 @@ class AdsInputDropdownComponent extends AbstractInputComponent {
4160
4160
  }
4161
4161
  /** @ignore */
4162
4162
  ngOnChanges(changes) {
4163
+ super.ngOnChanges(changes);
4163
4164
  if (changes.options && this.autoSelectSingleDropdownOption) {
4164
4165
  asapScheduler.schedule(() => {
4165
4166
  if (this.dropdownComponent?.displayedOptions.size === 1) {
@@ -5827,6 +5828,8 @@ class AdsDatetimepickerComponent extends AbstractInputComponent {
5827
5828
  }
5828
5829
  /** @ignore */
5829
5830
  canShowError() {
5831
+ if (!this.showValidationError)
5832
+ return false;
5830
5833
  return !!this.displayControl.errors && (this.displayControl.touched || this.immediateValidation);
5831
5834
  }
5832
5835
  /** @ignore */
@@ -6082,7 +6085,15 @@ class AdsDatetimepickerComponent extends AbstractInputComponent {
6082
6085
  *sync display control statuses with value control status for proper error display
6083
6086
  * make sure "displayControl" disabled state and value are synchronized with "control" disabled state and value
6084
6087
  */
6085
- this.subscriptions.push(this.valueControl.statusChanges.subscribe((status) => this.syncState(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
+ }));
6086
6097
  this.subscriptions.push(this.valueControl.valueChanges.subscribe(() => this.syncDisplayedValue()));
6087
6098
  /**
6088
6099
  * NOTE: registering display value change is needed to know when to focus time part of datetime if showTimePicker is false
@@ -11433,6 +11444,14 @@ class AdsTimeFieldComponent extends AdsInputDropdownComponent {
11433
11444
  /** @ignore */
11434
11445
  ngOnChanges(changes) {
11435
11446
  super.ngOnChanges(changes);
11447
+ // When immediateValidation is turned on, re-sync validators and revalidate
11448
+ // so dynamically added validators (e.g. Validators.required) surface errors.
11449
+ if (changes.immediateValidation && !changes.immediateValidation.isFirstChange() && this.immediateValidation) {
11450
+ if (!this.militaryTime()) {
11451
+ this.syncValidators();
11452
+ }
11453
+ this.valueControl.updateValueAndValidity({ emitEvent: false });
11454
+ }
11436
11455
  // When validation-suppression is turned off, revalidate internal controls too.
11437
11456
  if (changes.skipValidationWhenEmpty && !changes.skipValidationWhenEmpty.isFirstChange() && !this.skipValidationWhenEmpty) {
11438
11457
  this.valueControl.updateValueAndValidity({ emitEvent: false });