@corp-products/ui-components 4.1.5 → 4.1.7
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.
|
@@ -766,6 +766,8 @@ var ErrorsWithValuesKeysEnum;
|
|
|
766
766
|
ErrorsWithValuesKeysEnum["maxSize"] = "MAX_SIZE";
|
|
767
767
|
ErrorsWithValuesKeysEnum["maxFiles"] = "MAX_FILES";
|
|
768
768
|
ErrorsWithValuesKeysEnum["allowedTypes"] = "ALLOWED_TYPES";
|
|
769
|
+
ErrorsWithValuesKeysEnum["emailDomain"] = "EMAIL_DOMAIN";
|
|
770
|
+
ErrorsWithValuesKeysEnum["maxRepeatedChars"] = "MAX_REPEATED_CHARS";
|
|
769
771
|
})(ErrorsWithValuesKeysEnum || (ErrorsWithValuesKeysEnum = {}));
|
|
770
772
|
|
|
771
773
|
class FormValidationService {
|
|
@@ -800,11 +802,15 @@ class FormValidationService {
|
|
|
800
802
|
requiredLength: val?.requiredLength,
|
|
801
803
|
actualLength: val?.actualLength,
|
|
802
804
|
}),
|
|
805
|
+
maxRepeatedChars: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.maxRepeatedChars, {
|
|
806
|
+
maxRepeats: val?.maxRepeats,
|
|
807
|
+
}),
|
|
803
808
|
min: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.min, { min: val?.min }),
|
|
804
809
|
max: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.max, { max: val?.max }),
|
|
805
810
|
maxSize: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.maxSize, { size: val?.requiredLength }),
|
|
806
811
|
maxFiles: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.maxFiles, { size: val?.requiredLength }),
|
|
807
812
|
allowedTypes: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.allowedTypes, { types: val?.join(', ') }),
|
|
813
|
+
emailDomain: () => this.getTranslation(ErrorsWithValuesKeysEnum.emailDomain),
|
|
808
814
|
};
|
|
809
815
|
return messages[errorKey](errorValue);
|
|
810
816
|
}
|
|
@@ -827,6 +833,28 @@ function numbersOnlyValidator(control) {
|
|
|
827
833
|
return isNumbersOnly ? null : { numbersOnly: true };
|
|
828
834
|
}
|
|
829
835
|
|
|
836
|
+
function maxRepeatedCharsValidator(maxRepeats = 3) {
|
|
837
|
+
return (control) => {
|
|
838
|
+
const value = control.value;
|
|
839
|
+
if (!value)
|
|
840
|
+
return null;
|
|
841
|
+
const str = value.toString();
|
|
842
|
+
let count = 1;
|
|
843
|
+
for (let i = 1; i < str.length; i++) {
|
|
844
|
+
if (str[i] === str[i - 1]) {
|
|
845
|
+
count++;
|
|
846
|
+
if (count > maxRepeats) {
|
|
847
|
+
return { maxRepeatedChars: { maxRepeats } };
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
count = 1;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return null;
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
|
|
830
858
|
/**
|
|
831
859
|
* Validator to check if the control value is a valid Saudi phone number.
|
|
832
860
|
* Valid formats: 05XXXXXXXX (10 digits) or 009665XXXXXXXX (14 digits)
|
|
@@ -2904,5 +2932,5 @@ const notFutureDateValidator = (dateKey) => (control) => {
|
|
|
2904
2932
|
* Generated bundle index. Do not edit.
|
|
2905
2933
|
*/
|
|
2906
2934
|
|
|
2907
|
-
export { AlertDialogComponent, AlertDialogService, AppAccordionComponent, AppBreadcrumbComponent, AppButtonComponent, AppDropdownMenuComponent, AppTabsComponent, AutoCompleteComponent, BasicErrorKeysEnum, BottomSheetComponent, ConfirmationDialogComponent, ConfirmationDialogService, DatePickerComponent, DualCalendarComponent, DynamicFormComponent, DynamicSidebarService, DynamicSidebarV2Service, ErrorsWithValuesKeysEnum, FormFieldTypeEnum, FormUtils, FormValidationService, IcoMoonIconComponent, InputComponent, MONTHS_GREGORIAN, MONTHS_HIJRI, ReadMoreComponent, SelectButtonComponent, SelectComponent, SideBarComponent, SidebarConfigDefaults, SwitchComponent, UploadStatus, UserAutocompleteCardComponent, UserInfoComponent, ValidationErrorsPipe, WEEKDAYS, dateRangeValidator, emailStcValidator, getGregorianMonthName, getHijriMonthName, getWeekdayName, notFutureDateValidator, numbersOnlyValidator, saudiPhoneValidator };
|
|
2935
|
+
export { AlertDialogComponent, AlertDialogService, AppAccordionComponent, AppBreadcrumbComponent, AppButtonComponent, AppDropdownMenuComponent, AppTabsComponent, AutoCompleteComponent, BasicErrorKeysEnum, BottomSheetComponent, ConfirmationDialogComponent, ConfirmationDialogService, DatePickerComponent, DualCalendarComponent, DynamicFormComponent, DynamicSidebarService, DynamicSidebarV2Service, ErrorsWithValuesKeysEnum, FormFieldTypeEnum, FormUtils, FormValidationService, IcoMoonIconComponent, InputComponent, MONTHS_GREGORIAN, MONTHS_HIJRI, ReadMoreComponent, SelectButtonComponent, SelectComponent, SideBarComponent, SidebarConfigDefaults, SwitchComponent, UploadStatus, UserAutocompleteCardComponent, UserInfoComponent, ValidationErrorsPipe, WEEKDAYS, dateRangeValidator, emailStcValidator, getGregorianMonthName, getHijriMonthName, getWeekdayName, maxRepeatedCharsValidator, notFutureDateValidator, numbersOnlyValidator, saudiPhoneValidator };
|
|
2908
2936
|
//# sourceMappingURL=corp-products-ui-components.mjs.map
|