rd-outer-component 0.1.64 → 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.
@@ -484,19 +484,25 @@ class CustomInputComponent {
484
484
  case 'precision':
485
485
  return (msg ||
486
486
  `${this.translate.instant('max_decimal_places')}${this.maskNumber}`);
487
+ case 'minlength':
487
488
  case 'minLength':
488
- return (msg ||
489
- `${this.translate.instant('length_cannot_be_less')}${this.minLength}`);
489
+ return msg
490
+ ? this.translate.instant(msg)
491
+ : `${this.translate.instant('length_cannot_be_less')}${this.control.errors[firstError]?.requiredLength ?? this.minLength}`;
492
+ case 'maxlength':
490
493
  case 'maxLength':
491
- return (msg ||
492
- `${this.translate.instant('length_cannot_exceed')}${this.maxLength}`);
494
+ return msg
495
+ ? this.translate.instant(msg)
496
+ : `${this.translate.instant('length_cannot_exceed')}${this.control.errors[firstError]?.requiredLength ?? this.maxLength}`;
497
+ case 'pattern':
498
+ return this.translate.instant(msg || 'invalid_format');
493
499
  case 'email':
494
500
  return msg || `${this.translate.instant('email_invalid')}`;
495
501
  case 'custom':
496
502
  return (this.control?.errors['custom'] ||
497
503
  this.translate.instant('validation_failed'));
498
504
  default:
499
- return (this.translate.instant(this.errorMessages[firstError]) ||
505
+ return (this.translate.instant(msg || 'validation_failed') ||
500
506
  this.translate.instant('validation_failed'));
501
507
  }
502
508
  }
@@ -523,8 +529,8 @@ class CustomInputComponent {
523
529
  this.required = false;
524
530
  this.size = 'default';
525
531
  this.errorMessages = {
526
- pattern: 'Invalid format',
527
- custom: 'Validation failed',
532
+ pattern: 'invalid_format',
533
+ custom: 'validation_failed',
528
534
  };
529
535
  this.valueChange = new EventEmitter();
530
536
  this.focus = new EventEmitter();
@@ -755,17 +761,23 @@ class CustomTextareaComponent {
755
761
  case 'required':
756
762
  return (msg ||
757
763
  `${this.translate.instant('please_enter')}${this.label.toLowerCase()}`);
764
+ case 'minlength':
758
765
  case 'minLength':
759
- return (msg ||
760
- `${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':
761
770
  case 'maxLength':
762
- return (msg ||
763
- `${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');
764
776
  case 'custom':
765
777
  return (this.control?.errors['custom'] ||
766
778
  this.translate.instant('validation_failed'));
767
779
  default:
768
- return (this.translate.instant(this.errorMessages[firstError]) ||
780
+ return (this.translate.instant(msg || 'validation_failed') ||
769
781
  this.translate.instant('validation_failed'));
770
782
  }
771
783
  }
@@ -782,8 +794,8 @@ class CustomTextareaComponent {
782
794
  this.required = false;
783
795
  this.nzAutosize = true;
784
796
  this.errorMessages = {
785
- pattern: 'Invalid format',
786
- custom: 'Validation failed',
797
+ pattern: 'invalid_format',
798
+ custom: 'validation_failed',
787
799
  };
788
800
  this.valueChange = new EventEmitter();
789
801
  this.focus = new EventEmitter();