@corp-products/ui-components 4.1.5 → 4.1.6
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.
|
@@ -45,7 +45,7 @@ import * as i1$5 from 'primeng/toggleswitch';
|
|
|
45
45
|
import { ToggleSwitchModule } from 'primeng/toggleswitch';
|
|
46
46
|
import * as i1$6 from '@ng-bootstrap/ng-bootstrap';
|
|
47
47
|
import { NgbDatepickerI18n, NgbCalendarIslamicUmalqura, NgbDatepickerModule, NgbCalendar, NgbCalendarGregorian, NgbDate } from '@ng-bootstrap/ng-bootstrap';
|
|
48
|
-
import { trigger, state,
|
|
48
|
+
import { trigger, state, transition, style, animate } from '@angular/animations';
|
|
49
49
|
import '@angular/localize/init';
|
|
50
50
|
import * as i2$4 from 'primeng/accordion';
|
|
51
51
|
import { AccordionModule } from 'primeng/accordion';
|
|
@@ -766,6 +766,7 @@ var ErrorsWithValuesKeysEnum;
|
|
|
766
766
|
ErrorsWithValuesKeysEnum["maxSize"] = "MAX_SIZE";
|
|
767
767
|
ErrorsWithValuesKeysEnum["maxFiles"] = "MAX_FILES";
|
|
768
768
|
ErrorsWithValuesKeysEnum["allowedTypes"] = "ALLOWED_TYPES";
|
|
769
|
+
ErrorsWithValuesKeysEnum["maxRepeatedChars"] = "MAX_REPEATED_CHARS";
|
|
769
770
|
})(ErrorsWithValuesKeysEnum || (ErrorsWithValuesKeysEnum = {}));
|
|
770
771
|
|
|
771
772
|
class FormValidationService {
|
|
@@ -800,6 +801,9 @@ class FormValidationService {
|
|
|
800
801
|
requiredLength: val?.requiredLength,
|
|
801
802
|
actualLength: val?.actualLength,
|
|
802
803
|
}),
|
|
804
|
+
maxRepeatedChars: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.maxRepeatedChars, {
|
|
805
|
+
maxRepeats: val?.maxRepeats,
|
|
806
|
+
}),
|
|
803
807
|
min: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.min, { min: val?.min }),
|
|
804
808
|
max: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.max, { max: val?.max }),
|
|
805
809
|
maxSize: (val) => this.getTranslation(ErrorsWithValuesKeysEnum.maxSize, { size: val?.requiredLength }),
|
|
@@ -827,6 +831,28 @@ function numbersOnlyValidator(control) {
|
|
|
827
831
|
return isNumbersOnly ? null : { numbersOnly: true };
|
|
828
832
|
}
|
|
829
833
|
|
|
834
|
+
function maxRepeatedCharsValidator(maxRepeats = 3) {
|
|
835
|
+
return (control) => {
|
|
836
|
+
const value = control.value;
|
|
837
|
+
if (!value)
|
|
838
|
+
return null;
|
|
839
|
+
const str = value.toString();
|
|
840
|
+
let count = 1;
|
|
841
|
+
for (let i = 1; i < str.length; i++) {
|
|
842
|
+
if (str[i] === str[i - 1]) {
|
|
843
|
+
count++;
|
|
844
|
+
if (count > maxRepeats) {
|
|
845
|
+
return { maxRepeatedChars: { maxRepeats } };
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
count = 1;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return null;
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
|
|
830
856
|
/**
|
|
831
857
|
* Validator to check if the control value is a valid Saudi phone number.
|
|
832
858
|
* Valid formats: 05XXXXXXXX (10 digits) or 009665XXXXXXXX (14 digits)
|
|
@@ -2904,5 +2930,5 @@ const notFutureDateValidator = (dateKey) => (control) => {
|
|
|
2904
2930
|
* Generated bundle index. Do not edit.
|
|
2905
2931
|
*/
|
|
2906
2932
|
|
|
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 };
|
|
2933
|
+
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
2934
|
//# sourceMappingURL=corp-products-ui-components.mjs.map
|