@rxap/forms 13.0.7 → 13.1.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.
@@ -14,7 +14,7 @@ import { ToggleSubject } from '@rxap/utilities/rxjs';
14
14
  import * as i2$1 from '@angular/router';
15
15
  import { Router } from '@angular/router';
16
16
  import { ConfirmClick } from '@rxap/directives';
17
- import { isMobilePhone, isEmail, isURL, isIP } from '@rxap/validator';
17
+ import { isMobilePhone, isEmail, isURL, isIP, isPort, isUUID } from '@rxap/validator';
18
18
 
19
19
  function getControlValue(control) {
20
20
  if (control.getRawValue) {
@@ -2732,6 +2732,42 @@ function IsIP({ message, version } = {}) {
2732
2732
  };
2733
2733
  }
2734
2734
 
2735
+ function IsPort({ message } = {}) {
2736
+ return (control) => {
2737
+ if (control.value === null) {
2738
+ return null;
2739
+ }
2740
+ if (!(typeof control.value === 'string' && isPort(control.value))) {
2741
+ return {
2742
+ isPort: {
2743
+ expected: `A valid port number between 1 and 65535`,
2744
+ actual: control.value,
2745
+ message
2746
+ }
2747
+ };
2748
+ }
2749
+ return null;
2750
+ };
2751
+ }
2752
+
2753
+ function IsUUID({ message, version = 'all' } = {}) {
2754
+ return (control) => {
2755
+ if (control.value === null) {
2756
+ return null;
2757
+ }
2758
+ if (!(typeof control.value === 'string' && isUUID(control.value, version))) {
2759
+ return {
2760
+ isUuid: {
2761
+ expected: version === 'all' ? `A valid uuid` : `A valid uuid version ${version}`,
2762
+ actual: control.value,
2763
+ message
2764
+ }
2765
+ };
2766
+ }
2767
+ return null;
2768
+ };
2769
+ }
2770
+
2735
2771
  const RxapValidators = {
2736
2772
  IsNumber: _IsNumber,
2737
2773
  IsBoolean,
@@ -2745,7 +2781,9 @@ const RxapValidators = {
2745
2781
  IsPhoneNumber,
2746
2782
  IsEmail,
2747
2783
  IsUrl,
2748
- IsIP
2784
+ IsIP,
2785
+ IsPort,
2786
+ IsUUID,
2749
2787
  };
2750
2788
 
2751
2789
  // endregion