kwikid-forms 0.5.11 → 0.5.12

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.
@@ -856,6 +856,9 @@
856
856
  case "pattern":
857
857
  errorMessage = fieldLabel + " is in incorrect format!";
858
858
  break;
859
+ case "onlyWhitespaces":
860
+ errorMessage = fieldLabel + " can't contain only empty spaces!";
861
+ break;
859
862
  default:
860
863
  errorMessage = fieldLabel + ": " + errorType;
861
864
  break;
@@ -2698,6 +2701,7 @@
2698
2701
  (kwikidToolkit.checkObjectKeyExists(field, "validators") &&
2699
2702
  kwikidToolkit.checkObjectKeyExists(field.validators, "required") &&
2700
2703
  field.validators.required)) {
2704
+ validators.push(NoWhitespacesValidator());
2701
2705
  validators.push(i3.Validators.required);
2702
2706
  }
2703
2707
  if (kwikidToolkit.checkObjectKeyExists(field, "validators") &&
@@ -2722,6 +2726,10 @@
2722
2726
  }
2723
2727
  }
2724
2728
  }
2729
+ if (kwikidToolkit.checkObjectKeyExists(field, "validators") &&
2730
+ kwikidToolkit.checkObjectKeyExists(field.validators, "whitespace")) {
2731
+ validators.push(NoWhitespacesValidator());
2732
+ }
2725
2733
  return validators;
2726
2734
  };
2727
2735
  FormValidation.prototype.getFormFieldsValidationErrors = function (formGroup) {
@@ -2781,6 +2789,15 @@
2781
2789
  __decorate([
2782
2790
  kwikidToolkit.logMethod
2783
2791
  ], FormValidation.prototype, "getFormFieldsInvalidControls", null);
2792
+ function NoWhitespacesValidator() {
2793
+ return function (control) {
2794
+ var value = control.value;
2795
+ if (!value || typeof value !== "string") {
2796
+ return null;
2797
+ }
2798
+ return kwikidToolkit.hasWhitespacesOnly(value) ? { onlyWhitespaces: true } : null;
2799
+ };
2800
+ }
2784
2801
 
2785
2802
  var KwikIDFormViewService = /** @class */ (function () {
2786
2803
  function KwikIDFormViewService() {