rd-outer-component 0.1.65 → 0.1.66

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.
@@ -761,17 +761,23 @@ class CustomTextareaComponent {
761
761
  case 'required':
762
762
  return (msg ||
763
763
  `${this.translate.instant('please_enter')}${this.label.toLowerCase()}`);
764
+ case 'minlength':
764
765
  case 'minLength':
765
- return (msg ||
766
- `${this.translate.instant('length_cannot_be_less')}${this.minLength}`);
766
+ return msg
767
+ ? this.translate.instant(msg)
768
+ : `${this.translate.instant('length_cannot_be_less')}${this.control.errors[firstError]?.requiredLength ?? this.minLength}`;
769
+ case 'maxlength':
767
770
  case 'maxLength':
768
- return (msg ||
769
- `${this.translate.instant('length_cannot_exceed')}${this.maxLength}`);
771
+ return msg
772
+ ? this.translate.instant(msg)
773
+ : `${this.translate.instant('length_cannot_exceed')}${this.control.errors[firstError]?.requiredLength ?? this.maxLength}`;
774
+ case 'pattern':
775
+ return this.translate.instant(msg || 'invalid_format');
770
776
  case 'custom':
771
777
  return (this.control?.errors['custom'] ||
772
778
  this.translate.instant('validation_failed'));
773
779
  default:
774
- return (this.translate.instant(this.errorMessages[firstError]) ||
780
+ return (this.translate.instant(msg || 'validation_failed') ||
775
781
  this.translate.instant('validation_failed'));
776
782
  }
777
783
  }
@@ -788,8 +794,8 @@ class CustomTextareaComponent {
788
794
  this.required = false;
789
795
  this.nzAutosize = true;
790
796
  this.errorMessages = {
791
- pattern: 'Invalid format',
792
- custom: 'Validation failed',
797
+ pattern: 'invalid_format',
798
+ custom: 'validation_failed',
793
799
  };
794
800
  this.valueChange = new EventEmitter();
795
801
  this.focus = new EventEmitter();