@ascentgl/ads-ui 21.18.0 → 21.19.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.
@@ -2535,14 +2535,18 @@ class AbstractBaseComponent {
2535
2535
  else if (this.displayControl.untouched) {
2536
2536
  this.displayControl.markAsTouched();
2537
2537
  }
2538
- if (this.valueControl.valid !== this.displayControl.valid) {
2539
- // If configured, do not surface validation errors when value is empty.
2540
- if (this.skipValidationWhenEmpty && this.isEmptyValue(this.valueControl.value)) {
2541
- this.displayControl.setErrors(null);
2538
+ // If configured, treat empty value as "no validation" state.
2539
+ if (this.skipValidationWhenEmpty && this.isEmptyValue(this.valueControl.value)) {
2540
+ if (this.valueControl.errors) {
2541
+ this.valueControl.setErrors(null);
2542
2542
  }
2543
- else {
2544
- this.displayControl.setErrors(this.valueControl.errors);
2543
+ if (this.displayControl.errors) {
2544
+ this.displayControl.setErrors(null);
2545
2545
  }
2546
+ return;
2547
+ }
2548
+ if (this.valueControl.valid !== this.displayControl.valid) {
2549
+ this.displayControl.setErrors(this.valueControl.errors);
2546
2550
  }
2547
2551
  }
2548
2552
  /** @ignore */
@@ -2551,6 +2555,8 @@ class AbstractBaseComponent {
2551
2555
  }
2552
2556
  /** @ignore */
2553
2557
  canShowError() {
2558
+ if (this.skipValidationWhenEmpty && this.isEmptyValue(this.valueControl.value))
2559
+ return false;
2554
2560
  return !!this.valueControl.errors && (this.valueControl.touched || this.immediateValidation);
2555
2561
  }
2556
2562
  /** @ignore */