@solcre-org/core-ui 2.12.34 → 2.12.36

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.
@@ -6840,6 +6840,145 @@ class DynamicFieldsHelper {
6840
6840
  }
6841
6841
  }
6842
6842
 
6843
+ const VALIDATION_WEIGHTS = [2, 9, 8, 7, 6, 3, 4];
6844
+ const sanitizeInput = (input) => {
6845
+ if (input === undefined || input === null) {
6846
+ return '';
6847
+ }
6848
+ const raw = typeof input === 'number' ? input.toString() : String(input);
6849
+ return raw.replace(/\D+/g, '');
6850
+ };
6851
+ function transformUruguayanDocument(input) {
6852
+ let digits = sanitizeInput(input);
6853
+ if (digits.length === 6) {
6854
+ digits = `0${digits}`;
6855
+ }
6856
+ return digits;
6857
+ }
6858
+ function getUruguayanDocumentValidationDigit(input) {
6859
+ const digits = transformUruguayanDocument(input);
6860
+ let sum = 0;
6861
+ for (let i = 0; i < VALIDATION_WEIGHTS.length; i++) {
6862
+ const digit = Number.parseInt(digits.charAt(i) || '0', 10);
6863
+ sum += VALIDATION_WEIGHTS[i] * digit;
6864
+ }
6865
+ const checkDigit = (10 - (sum % 10)) % 10;
6866
+ return checkDigit.toString();
6867
+ }
6868
+ function validateUruguayanDocument(input) {
6869
+ const digits = transformUruguayanDocument(input);
6870
+ if (digits.length < 6) {
6871
+ return false;
6872
+ }
6873
+ const providedDigit = digits.slice(-1);
6874
+ const baseDigits = digits.slice(0, -1);
6875
+ return getUruguayanDocumentValidationDigit(baseDigits) === providedDigit;
6876
+ }
6877
+ function generateRandomUruguayanDocument() {
6878
+ const randomBase = Math.floor(Math.random() * 9000000) + 1000000;
6879
+ const baseDigits = randomBase.toString();
6880
+ const verificationDigit = getUruguayanDocumentValidationDigit(baseDigits);
6881
+ return `${baseDigits}${verificationDigit}`;
6882
+ }
6883
+ const transform = transformUruguayanDocument;
6884
+ const validationDigit = getUruguayanDocumentValidationDigit;
6885
+ const validateCi = validateUruguayanDocument;
6886
+ const random = generateRandomUruguayanDocument;
6887
+ const validate = validateUruguayanDocument;
6888
+ const getValidationDigit = getUruguayanDocumentValidationDigit;
6889
+ const getRandomCi = generateRandomUruguayanDocument;
6890
+ const UruguayanDocumentValidationHelper = {
6891
+ transform,
6892
+ validationDigit,
6893
+ getValidationDigit,
6894
+ validateCi,
6895
+ validate,
6896
+ random,
6897
+ getRandomCi,
6898
+ };
6899
+ const uruguayanDocumentValidator = (control) => {
6900
+ const value = control.value;
6901
+ if (!value) {
6902
+ return null;
6903
+ }
6904
+ return validateUruguayanDocument(value) ? null : { invalidUruguayanDocument: true };
6905
+ };
6906
+
6907
+ const toDate = (value) => {
6908
+ if (value === null || value === undefined) {
6909
+ return null;
6910
+ }
6911
+ if (value instanceof Date) {
6912
+ const cloned = new Date(value.getTime());
6913
+ return Number.isNaN(cloned.getTime()) ? null : cloned;
6914
+ }
6915
+ if (typeof value === 'number') {
6916
+ const dateFromNumber = new Date(value);
6917
+ return Number.isNaN(dateFromNumber.getTime()) ? null : dateFromNumber;
6918
+ }
6919
+ if (typeof value === 'string') {
6920
+ const dateFromString = new Date(value);
6921
+ return Number.isNaN(dateFromString.getTime()) ? null : dateFromString;
6922
+ }
6923
+ return null;
6924
+ };
6925
+ function calculateAge(birthDateInput, referenceInput = new Date()) {
6926
+ const birthDate = toDate(birthDateInput);
6927
+ const referenceDate = toDate(referenceInput);
6928
+ if (!birthDate || !referenceDate) {
6929
+ return Number.NaN;
6930
+ }
6931
+ let age = referenceDate.getFullYear() - birthDate.getFullYear();
6932
+ const hasNotHadBirthdayThisYear = referenceDate.getMonth() < birthDate.getMonth() ||
6933
+ (referenceDate.getMonth() === birthDate.getMonth() && referenceDate.getDate() < birthDate.getDate());
6934
+ if (hasNotHadBirthdayThisYear) {
6935
+ age -= 1;
6936
+ }
6937
+ return age;
6938
+ }
6939
+ function getLatestBirthDateForAge(age, referenceInput = new Date()) {
6940
+ const referenceDate = toDate(referenceInput);
6941
+ if (!referenceDate || !Number.isFinite(age)) {
6942
+ return null;
6943
+ }
6944
+ const latest = new Date(referenceDate.getTime());
6945
+ latest.setFullYear(latest.getFullYear() - Math.trunc(age));
6946
+ return latest;
6947
+ }
6948
+ function validateAge(birthDateInput, requiredAge, options = {}) {
6949
+ const comparison = options.comparison ?? 'min';
6950
+ const referenceDate = options.referenceDate ?? new Date();
6951
+ const age = calculateAge(birthDateInput, referenceDate);
6952
+ if (!Number.isFinite(age) || !Number.isFinite(requiredAge)) {
6953
+ return false;
6954
+ }
6955
+ switch (comparison) {
6956
+ case 'exact':
6957
+ return age === Math.trunc(requiredAge);
6958
+ case 'max':
6959
+ return age <= requiredAge;
6960
+ case 'min':
6961
+ default:
6962
+ return age >= requiredAge;
6963
+ }
6964
+ }
6965
+ const AgeValidationHelper = {
6966
+ calculateAge,
6967
+ validateAge,
6968
+ getLatestBirthDateForAge,
6969
+ };
6970
+ const ageValidator = (minimumAge) => {
6971
+ return (control) => {
6972
+ const value = control.value;
6973
+ if (!value) {
6974
+ return null;
6975
+ }
6976
+ return validateAge(value, minimumAge, { comparison: 'min' })
6977
+ ? null
6978
+ : { minimumAge: true };
6979
+ };
6980
+ };
6981
+
6843
6982
  class FileModel {
6844
6983
  id;
6845
6984
  filename;
@@ -13127,12 +13266,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
13127
13266
  // Este archivo es generado automáticamente por scripts/update-version.js
13128
13267
  // No edites manualmente este archivo
13129
13268
  const VERSION = {
13130
- full: '2.12.34',
13269
+ full: '2.12.36',
13131
13270
  major: 2,
13132
13271
  minor: 12,
13133
- patch: 34,
13134
- timestamp: '2025-09-16T18:07:10.500Z',
13135
- buildDate: '16/9/2025'
13272
+ patch: 36,
13273
+ timestamp: '2025-09-17T12:01:23.677Z',
13274
+ buildDate: '17/9/2025'
13136
13275
  };
13137
13276
 
13138
13277
  class MainNavComponent {
@@ -16110,5 +16249,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
16110
16249
  * Generated bundle index. Do not edit.
16111
16250
  */
16112
16251
 
16113
- export { ActiveFiltersComponent, AlertComponent, AlertContainerComponent, AlertService, AlertType, ApiConfigurationProvider, BaseFieldComponent, ButtonContext, ButtonSize, ButtonType, CacheBustingInterceptor, CardComponent, CarouselComponent, ChatMessagePosition, ChatMessageType, CheckboxFieldComponent, ConfigurationModel, ConfirmationDialogComponent, ConfirmationDialogService, CoreHostDirective, CoreManualRefreshComponent, CoreUiHttpLoaderFactory, CoreUiTranslateLoader, CoreUiTranslateService, DataListComponent, DataListItemComponent, DateFieldComponent, DateUtility, DatetimeFieldComponent, DialogActions, DocumentAction, DocumentDisplayMode, DropdownComponent, DropdownDirection, DropdownService, DynamicFieldDirective, DynamicFieldsHelper, FieldErrorsComponent, FieldType, FileFieldComponent, FileModel, FilePreviewActionType, FileTemplateModel, FileTemplateType, FileType, FileTypeModel, FileUploadService, FilterModalComponent, FilterService, FilterType, GalleryAnimationType, GalleryLayoutType, GalleryModalComponent, GalleryModalGlobalService, GenericButtonComponent, GenericChatComponent, GenericChatService, GenericDocumentationComponent, GenericGalleryComponent, GenericModalComponent, GenericPaginationComponent, GenericRatingComponent, GenericSidebarComponent, GenericSkeletonComponent, GenericStepsComponent, GenericTableComponent, GenericTabsComponent, GenericTimelineComponent, GlobalApiConfigService, HeaderComponent, HeaderConfigurationService, HeaderElementType, HeaderService, HttpLoaderFactory, ImageModalComponent, ImageModalService, ImagePreviewComponent, LayoutAuth, LayoutBreakpoint, LayoutComponent, LayoutService, LayoutStateService, LayoutType, LoaderComponent, LoaderService, MainNavComponent, MainNavService, ManualRefreshService, ModalMode, ModelApiService, MultiEntryFieldComponent, MultiEntryOutputFormat, NumberFieldComponent, NumberFieldConfigType, NumberFieldType, NumberRange, PERMISSION_ACTIONS_PROVIDER, PERMISSION_PROVIDER, PERMISSION_RESOURCES_PROVIDER, PaginationService, PasswordFieldComponent, PermissionEnumsService, PermissionModel, PermissionService, PermissionWrapperService, PermissionsActions, PermissionsInterceptor, PermissionsResources, ProgressBarComponent, ProgressBarSize, RatingService, RatingSize, RatingType, ResetPasswordModel, RoleModel, SelectFieldComponent, ServerSelectFieldComponent, ServerSelectService, SidebarCustomModalComponent, SidebarCustomModalService, SidebarHeight, SidebarMobileModalService, SidebarMobileType, SidebarPosition, SidebarService, SidebarState, SidebarTemplateRegistryService, SidebarVisibility, SidebarWidth, SkeletonAnimation, SkeletonService, SkeletonSize, SkeletonType, SmartFieldComponent, SortDirection, SortMode, StepSize, StepStatus, StepType, StepsService, SwitchFieldComponent, TableAction, TableActionService, TableDataService, TableSortService, TextAreaFieldComponent, TextFieldComponent, TimeFieldComponent, TimeInterval, TimelineService, TimelineStatus, TimelineType, TranslationMergeService, UsersModel, VERSION, equalToValidator, isSameDate, provideCoreUiTranslateLoader, providePermissionActions, providePermissionEnums, providePermissionResources, providePermissionService, providePermissionServiceFactory, provideTranslateLoader };
16252
+ export { ActiveFiltersComponent, AgeValidationHelper, AlertComponent, AlertContainerComponent, AlertService, AlertType, ApiConfigurationProvider, BaseFieldComponent, ButtonContext, ButtonSize, ButtonType, CacheBustingInterceptor, CardComponent, CarouselComponent, ChatMessagePosition, ChatMessageType, CheckboxFieldComponent, ConfigurationModel, ConfirmationDialogComponent, ConfirmationDialogService, CoreHostDirective, CoreManualRefreshComponent, CoreUiHttpLoaderFactory, CoreUiTranslateLoader, CoreUiTranslateService, DataListComponent, DataListItemComponent, DateFieldComponent, DateUtility, DatetimeFieldComponent, DialogActions, DocumentAction, DocumentDisplayMode, DropdownComponent, DropdownDirection, DropdownService, DynamicFieldDirective, DynamicFieldsHelper, FieldErrorsComponent, FieldType, FileFieldComponent, FileModel, FilePreviewActionType, FileTemplateModel, FileTemplateType, FileType, FileTypeModel, FileUploadService, FilterModalComponent, FilterService, FilterType, GalleryAnimationType, GalleryLayoutType, GalleryModalComponent, GalleryModalGlobalService, GenericButtonComponent, GenericChatComponent, GenericChatService, GenericDocumentationComponent, GenericGalleryComponent, GenericModalComponent, GenericPaginationComponent, GenericRatingComponent, GenericSidebarComponent, GenericSkeletonComponent, GenericStepsComponent, GenericTableComponent, GenericTabsComponent, GenericTimelineComponent, GlobalApiConfigService, HeaderComponent, HeaderConfigurationService, HeaderElementType, HeaderService, HttpLoaderFactory, ImageModalComponent, ImageModalService, ImagePreviewComponent, LayoutAuth, LayoutBreakpoint, LayoutComponent, LayoutService, LayoutStateService, LayoutType, LoaderComponent, LoaderService, MainNavComponent, MainNavService, ManualRefreshService, ModalMode, ModelApiService, MultiEntryFieldComponent, MultiEntryOutputFormat, NumberFieldComponent, NumberFieldConfigType, NumberFieldType, NumberRange, PERMISSION_ACTIONS_PROVIDER, PERMISSION_PROVIDER, PERMISSION_RESOURCES_PROVIDER, PaginationService, PasswordFieldComponent, PermissionEnumsService, PermissionModel, PermissionService, PermissionWrapperService, PermissionsActions, PermissionsInterceptor, PermissionsResources, ProgressBarComponent, ProgressBarSize, RatingService, RatingSize, RatingType, ResetPasswordModel, RoleModel, SelectFieldComponent, ServerSelectFieldComponent, ServerSelectService, SidebarCustomModalComponent, SidebarCustomModalService, SidebarHeight, SidebarMobileModalService, SidebarMobileType, SidebarPosition, SidebarService, SidebarState, SidebarTemplateRegistryService, SidebarVisibility, SidebarWidth, SkeletonAnimation, SkeletonService, SkeletonSize, SkeletonType, SmartFieldComponent, SortDirection, SortMode, StepSize, StepStatus, StepType, StepsService, SwitchFieldComponent, TableAction, TableActionService, TableDataService, TableSortService, TextAreaFieldComponent, TextFieldComponent, TimeFieldComponent, TimeInterval, TimelineService, TimelineStatus, TimelineType, TranslationMergeService, UruguayanDocumentValidationHelper, UsersModel, VERSION, ageValidator, calculateAge, equalToValidator, generateRandomUruguayanDocument, getLatestBirthDateForAge, getRandomCi, getUruguayanDocumentValidationDigit, getValidationDigit, isSameDate, provideCoreUiTranslateLoader, providePermissionActions, providePermissionEnums, providePermissionResources, providePermissionService, providePermissionServiceFactory, provideTranslateLoader, random, transform, transformUruguayanDocument, uruguayanDocumentValidator, validate, validateAge, validateCi, validateUruguayanDocument, validationDigit };
16114
16253
  //# sourceMappingURL=solcre-org-core-ui.mjs.map