@bizy/core 19.13.7 → 19.14.1

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.
@@ -26,6 +26,7 @@ import Dashboard from '@uppy/dashboard';
26
26
  import XHRUpload from '@uppy/xhr-upload';
27
27
  import * as i1$1 from '@angular/router';
28
28
  import { NavigationEnd, NavigationStart, Router } from '@angular/router';
29
+ import validator from 'validator';
29
30
  import { Clipboard } from '@angular/cdk/clipboard';
30
31
  import { DeviceDetectorService } from 'ngx-device-detector';
31
32
  import * as i3 from '@angular/cdk/portal';
@@ -2930,52 +2931,249 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
2930
2931
  }] }] });
2931
2932
 
2932
2933
  class BizyValidatorService {
2933
- isEmail(email) {
2934
- const regex = /^(([^ñ<>()[\]\\.,;:\s@"]+(\.[^ñ<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
2935
- return regex.test(String(email).toLowerCase());
2936
- }
2937
- isPassFormat(pass) {
2938
- const formatRegex = /(?!.*012)(?!.*123)(?!.*234)(?!.*345)(?!.*456)(?!.*567)(?!.*678)(?!.*789)(?!.*987)(?!.*876)(?!.*765)(?!.*654)(?!.*543)(?!.*432)(?!.*321)(?!.*210)(?!.*(.)\1{2,})(?!(^\D+$))(?!(^\d+$))(^.{6,}$)/;
2939
- const excludeRegex = /[^'"]$/;
2940
- const _pass = String(pass).toLowerCase();
2941
- return formatRegex.test(_pass) && excludeRegex.test(_pass);
2942
- }
2943
- isNoSpecialCharacter(name) {
2944
- const regex = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
2945
- return regex.test(String(name).toLowerCase());
2946
- }
2934
+ isEmail = (value) => validator.isEmail(value);
2935
+ dateIsAfter = (data) => {
2936
+ if (!data || !data.date || !data.comparisonDate) {
2937
+ return false;
2938
+ }
2939
+ const date = new Date(data.date);
2940
+ const comparisonDate = new Date(data.comparisonDate);
2941
+ return validator.isAfter(date.toString(), comparisonDate.toString());
2942
+ };
2943
+ dateIsBefore = (data) => {
2944
+ if (!data || !data.date || !data.comparisonDate) {
2945
+ return false;
2946
+ }
2947
+ const date = new Date(data.date);
2948
+ const comparisonDate = new Date(data.comparisonDate);
2949
+ return validator.isBefore(date.toString(), comparisonDate.toString());
2950
+ };
2951
+ isAlpha = (value) => validator.isAlpha(value);
2952
+ isAlphanumeric = (value) => validator.isAlphanumeric(value);
2953
+ isNumeric = (value) => validator.isNumeric(value);
2947
2954
  isNumber(number) {
2948
- const regex = /^[0-9]*$/;
2949
- return regex.test(String(number).toLowerCase());
2950
- }
2951
- isPhoneNumber(number) {
2952
- const regex = /^\+{0,1}[0-9#*]+$/;
2955
+ const regex = /^-?\d+(\.\d+)?$/;
2953
2956
  return regex.test(String(number).toLowerCase());
2954
2957
  }
2955
2958
  isString(string) {
2956
2959
  return typeof string === 'string' || string instanceof String;
2957
2960
  }
2958
- isJSON(text) {
2959
- if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\/bfnrtu]/g, '@')
2960
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/g, ']')
2961
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
2962
- return true;
2961
+ isInteger = (value) => validator.isInt(value);
2962
+ isBoolean = (value) => validator.isBoolean(value);
2963
+ isCreditCard = (value) => validator.isCreditCard(value);
2964
+ isDataURI = (value) => validator.isDataURI(value);
2965
+ isURL = (value) => validator.isURL(value);
2966
+ isDate = (value) => validator.isDate(value);
2967
+ isJSON = (value) => validator.isJSON(value);
2968
+ isIP = (value, version) => validator.isIP(value, { version });
2969
+ isJWT = (value) => validator.isJWT(value);
2970
+ isLowercase = (value) => validator.isLowercase(value);
2971
+ isUppercase = (value) => validator.isUppercase(value);
2972
+ isMobilePhone = (data) => validator.isMobilePhone(data.value, data.locale);
2973
+ isCUIT(cuit) {
2974
+ const regex = /(^[0-9]{2}-[0-9]{8}-[0-9]$)/i;
2975
+ const isCUIT = regex.test(String(cuit).toLowerCase());
2976
+ if (!isCUIT) {
2977
+ return false;
2978
+ }
2979
+ cuit = String(cuit).replace(/[-_]/g, '');
2980
+ if (cuit.length == 11) {
2981
+ const mult = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2];
2982
+ let total = 0;
2983
+ for (let i = 0; i < mult.length; i++) {
2984
+ total += parseInt(cuit[i]) * mult[i];
2985
+ }
2986
+ const mod = total % 11;
2987
+ const digit = mod === 0 ? 0 : mod === 1 ? 9 : 11 - mod;
2988
+ return digit === parseInt(cuit[10]);
2963
2989
  }
2964
2990
  return false;
2965
2991
  }
2992
+ isDNI(dni) {
2993
+ const regex = /(^[1-9]{1}[0-9]{7}$)/i;
2994
+ return regex.test(String(dni).toLowerCase());
2995
+ }
2996
+ isCBU(cbu) {
2997
+ const _isLengthOk = (cbu) => {
2998
+ return cbu.length === 22;
2999
+ };
3000
+ const _isValidAccount = (account) => {
3001
+ if (account.length !== 14) {
3002
+ return false;
3003
+ }
3004
+ const sum = Number(account[0]) * 3 +
3005
+ Number(account[1]) * 9 +
3006
+ Number(account[2]) * 7 +
3007
+ Number(account[3]) * 1 +
3008
+ Number(account[4]) * 3 +
3009
+ Number(account[5]) * 9 +
3010
+ Number(account[6]) * 7 +
3011
+ Number(account[7]) * 1 +
3012
+ Number(account[8]) * 3 +
3013
+ Number(account[9]) * 9 +
3014
+ Number(account[10]) * 7 +
3015
+ Number(account[11]) * 1 +
3016
+ Number(account[12]) * 3;
3017
+ const diff = (10 - (sum % 10)) % 10; // The result of this should be only 1 digit
3018
+ const checksum = Number(account[13]);
3019
+ return diff === checksum;
3020
+ };
3021
+ const _isValidBankCode = (code) => {
3022
+ if (code.length !== 8) {
3023
+ return false;
3024
+ }
3025
+ const bank = code.substring(0, 3);
3026
+ const checksumOne = code[3];
3027
+ const branch = code.substring(4, 4 + 3);
3028
+ const checksumTwo = code[7];
3029
+ const sum = (Number(bank[0]) * 7) +
3030
+ (Number(bank[1]) * 1) +
3031
+ (Number(bank[2]) * 3) +
3032
+ (Number(checksumOne) * 9) +
3033
+ (Number(branch[0]) * 7) +
3034
+ (Number(branch[1]) * 1) +
3035
+ (Number(branch[2]) * 3);
3036
+ const diff = (10 - (sum % 10)) % 10; // The result of this should be only 1 digit
3037
+ return diff === Number(checksumTwo);
3038
+ };
3039
+ const bankCode = cbu.substring(0, 8);
3040
+ const accountCode = cbu.substring(8, 8 + 14);
3041
+ return (_isLengthOk(cbu) &&
3042
+ _isValidBankCode(bankCode) &&
3043
+ _isValidAccount(accountCode));
3044
+ }
2966
3045
  emailValidator() {
2967
3046
  return (control) => {
2968
- return !control.value || (control.value && this.isEmail(control.value)) ? null : { bizyEmail: true };
3047
+ return !control.value || (control.value && this.isEmail(control.value))
3048
+ ? null
3049
+ : { anuraEmail: true };
2969
3050
  };
2970
3051
  }
2971
- phoneNumberValidator() {
3052
+ mobilePhoneValidator(locale) {
2972
3053
  return (control) => {
2973
- return !control.value || (control.value && this.isPhoneNumber(control.value)) ? null : { bizyPhoneNumber: true };
3054
+ return !control.value || !locale ||
3055
+ (control.value && locale && this.isMobilePhone({ value: control.value, locale }))
3056
+ ? null
3057
+ : { anuraMobilePhone: true };
2974
3058
  };
2975
3059
  }
2976
3060
  numberValidator() {
2977
3061
  return (control) => {
2978
- return !control.value || (control.value && this.isNumber(control.value)) ? null : { bizyNumber: true };
3062
+ return !control.value || (control.value && this.isNumber(control.value))
3063
+ ? null
3064
+ : { anuraNumber: true };
3065
+ };
3066
+ }
3067
+ numericValidator() {
3068
+ return (control) => {
3069
+ return !control.value || (control.value && this.isNumeric(control.value))
3070
+ ? null
3071
+ : { anuraNumeric: true };
3072
+ };
3073
+ }
3074
+ dateIsAfterValidator(comparisonDate) {
3075
+ return (control) => {
3076
+ return !control.value || !comparisonDate || (control.value && comparisonDate && !this.dateIsAfter({ date: control.value, comparisonDate }))
3077
+ ? null
3078
+ : { anuraDateIsAfter: true };
3079
+ };
3080
+ }
3081
+ dateIsBeforeValidator(comparisonDate) {
3082
+ return (control) => {
3083
+ return !control.value || !comparisonDate || (control.value && comparisonDate && !this.dateIsBefore({ date: control.value, comparisonDate }))
3084
+ ? null
3085
+ : { anuraDateIsBefore: true };
3086
+ };
3087
+ }
3088
+ alphaValidator() {
3089
+ return (control) => {
3090
+ return !control.value || (control.value && this.isAlpha(control.value))
3091
+ ? null
3092
+ : { anuraAlpha: true };
3093
+ };
3094
+ }
3095
+ alphanumericValidator() {
3096
+ return (control) => {
3097
+ return !control.value || (control.value && this.isAlphanumeric(control.value))
3098
+ ? null
3099
+ : { anuraAlphanumeric: true };
3100
+ };
3101
+ }
3102
+ integerValidator() {
3103
+ return (control) => {
3104
+ return !control.value || (control.value && this.isInteger(control.value))
3105
+ ? null
3106
+ : { anuraInteger: true };
3107
+ };
3108
+ }
3109
+ dataURIValidator() {
3110
+ return (control) => {
3111
+ return !control.value || (control.value && this.isDataURI(control.value))
3112
+ ? null
3113
+ : { anuraDataURI: true };
3114
+ };
3115
+ }
3116
+ urlValidator() {
3117
+ return (control) => {
3118
+ return !control.value || (control.value && this.isURL(control.value))
3119
+ ? null
3120
+ : { anuraURL: true };
3121
+ };
3122
+ }
3123
+ jsonValidator() {
3124
+ return (control) => {
3125
+ return !control.value || (control.value && this.isJSON(control.value))
3126
+ ? null
3127
+ : { anuraJSON: true };
3128
+ };
3129
+ }
3130
+ jwtValidator() {
3131
+ return (control) => {
3132
+ return !control.value || (control.value && this.isJWT(control.value))
3133
+ ? null
3134
+ : { anuraJWT: true };
3135
+ };
3136
+ }
3137
+ lowerCaseValidator() {
3138
+ return (control) => {
3139
+ return !control.value || (control.value && this.isLowercase(control.value))
3140
+ ? null
3141
+ : { anuraLowerCase: true };
3142
+ };
3143
+ }
3144
+ upperCaseValidator() {
3145
+ return (control) => {
3146
+ return !control.value || (control.value && this.isUppercase(control.value))
3147
+ ? null
3148
+ : { anuraUpperCase: true };
3149
+ };
3150
+ }
3151
+ cuitValidator() {
3152
+ return (control) => {
3153
+ return !control.value || (control.value && this.isCUIT(control.value))
3154
+ ? null
3155
+ : { anuraCUIT: true };
3156
+ };
3157
+ }
3158
+ dniValidator() {
3159
+ return (control) => {
3160
+ return !control.value || (control.value && this.isDNI(control.value))
3161
+ ? null
3162
+ : { anuraDNI: true };
3163
+ };
3164
+ }
3165
+ cbuValidator() {
3166
+ return (control) => {
3167
+ return !control.value || (control.value && this.isCBU(control.value))
3168
+ ? null
3169
+ : { anuraCBU: true };
3170
+ };
3171
+ }
3172
+ creditCardValidator() {
3173
+ return (control) => {
3174
+ return !control.value || (control.value && this.isCreditCard(control.value))
3175
+ ? null
3176
+ : { anuraCreditCard: true };
2979
3177
  };
2980
3178
  }
2981
3179
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyValidatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -6278,18 +6476,28 @@ var BIZY_TAG_TYPE;
6278
6476
  class BizyTagComponent {
6279
6477
  id = `bizy-tag-${Math.random()}`;
6280
6478
  customClass = '';
6479
+ disabled = false;
6281
6480
  type = BIZY_TAG_TYPE.DEFAULT;
6282
6481
  onSelect = new EventEmitter();
6482
+ _focused = false;
6483
+ _onSelect(event) {
6484
+ if (this.disabled || !this._focused) {
6485
+ return;
6486
+ }
6487
+ this.onSelect.emit(event);
6488
+ }
6283
6489
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyTagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6284
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyTagComponent, isStandalone: true, selector: "bizy-tag", inputs: { id: "id", customClass: "customClass", type: "type" }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: "<button \n type=\"button\"\n [id]=\"id\"\n class=\"bizy-tag bizy-tag--{{type}} {{customClass}}\"\n (click)=\"onSelect.emit($event)\"\n (keyup.enter)=\"onSelect.emit($event)\">\n\n <ng-content></ng-content>\n\n</button>", styles: [":host{font-size:1rem}.bizy-tag{border:none;padding:var(--bizy-tag-padding);border-radius:.3rem;display:flex;justify-content:center;cursor:pointer;column-gap:.5rem;align-items:center;text-wrap:nowrap;width:fit-content}.bizy-tag--default{background-color:var(--bizy-tag-default-background-color)}::ng-deep .bizy-tag--default *{color:var(--bizy-tag-default-color)!important}.bizy-tag--info{background-color:var(--bizy-tag-info-background-color)}::ng-deep .bizy-tag--info *{color:var(--bizy-tag-info-color)!important}.bizy-tag--success{background-color:var(--bizy-tag-success-background-color)}::ng-deep .bizy-tag--success *{color:var(--bizy-tag-success-color)!important}.bizy-tag--warning{background-color:var(--bizy-tag-warning-background-color)}::ng-deep .bizy-tag--warning *{color:var(--bizy-tag-warning-color)!important}.bizy-tag--danger{background-color:var(--bizy-tag-danger-background-color)}::ng-deep .bizy-tag--danger *{color:var(--bizy-tag-danger-color)!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6490
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyTagComponent, isStandalone: true, selector: "bizy-tag", inputs: { id: "id", customClass: "customClass", disabled: "disabled", type: "type" }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: "<button \n type=\"button\"\n [id]=\"id\"\n (focus)=\"_focused = true\"\n (blur)=\"_focused = false\"\n [ngClass]=\"{'bizy-tag--disabled': disabled}\"\n class=\"bizy-tag bizy-tag--{{type}} {{customClass}}\"\n (click)=\"_focused = true; _onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\">\n\n <ng-content></ng-content>\n\n</button>", styles: [":host{font-size:1rem}.bizy-tag{border:none;padding:var(--bizy-tag-padding);border-radius:.3rem;display:flex;justify-content:center;cursor:pointer;column-gap:.5rem;align-items:center;text-wrap:nowrap;width:fit-content}.bizy-tag--default{background-color:var(--bizy-tag-default-background-color)}::ng-deep .bizy-tag--default *{color:var(--bizy-tag-default-color)!important}.bizy-tag--info{background-color:var(--bizy-tag-info-background-color)}::ng-deep .bizy-tag--info *{color:var(--bizy-tag-info-color)!important}.bizy-tag--success{background-color:var(--bizy-tag-success-background-color)}::ng-deep .bizy-tag--success *{color:var(--bizy-tag-success-color)!important}.bizy-tag--warning{background-color:var(--bizy-tag-warning-background-color)}::ng-deep .bizy-tag--warning *{color:var(--bizy-tag-warning-color)!important}.bizy-tag--danger{background-color:var(--bizy-tag-danger-background-color)}::ng-deep .bizy-tag--danger *{color:var(--bizy-tag-danger-color)!important}.bizy-tag--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6285
6491
  }
6286
6492
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyTagComponent, decorators: [{
6287
6493
  type: Component,
6288
- args: [{ selector: 'bizy-tag', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n [id]=\"id\"\n class=\"bizy-tag bizy-tag--{{type}} {{customClass}}\"\n (click)=\"onSelect.emit($event)\"\n (keyup.enter)=\"onSelect.emit($event)\">\n\n <ng-content></ng-content>\n\n</button>", styles: [":host{font-size:1rem}.bizy-tag{border:none;padding:var(--bizy-tag-padding);border-radius:.3rem;display:flex;justify-content:center;cursor:pointer;column-gap:.5rem;align-items:center;text-wrap:nowrap;width:fit-content}.bizy-tag--default{background-color:var(--bizy-tag-default-background-color)}::ng-deep .bizy-tag--default *{color:var(--bizy-tag-default-color)!important}.bizy-tag--info{background-color:var(--bizy-tag-info-background-color)}::ng-deep .bizy-tag--info *{color:var(--bizy-tag-info-color)!important}.bizy-tag--success{background-color:var(--bizy-tag-success-background-color)}::ng-deep .bizy-tag--success *{color:var(--bizy-tag-success-color)!important}.bizy-tag--warning{background-color:var(--bizy-tag-warning-background-color)}::ng-deep .bizy-tag--warning *{color:var(--bizy-tag-warning-color)!important}.bizy-tag--danger{background-color:var(--bizy-tag-danger-background-color)}::ng-deep .bizy-tag--danger *{color:var(--bizy-tag-danger-color)!important}\n"] }]
6494
+ args: [{ selector: 'bizy-tag', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n [id]=\"id\"\n (focus)=\"_focused = true\"\n (blur)=\"_focused = false\"\n [ngClass]=\"{'bizy-tag--disabled': disabled}\"\n class=\"bizy-tag bizy-tag--{{type}} {{customClass}}\"\n (click)=\"_focused = true; _onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\">\n\n <ng-content></ng-content>\n\n</button>", styles: [":host{font-size:1rem}.bizy-tag{border:none;padding:var(--bizy-tag-padding);border-radius:.3rem;display:flex;justify-content:center;cursor:pointer;column-gap:.5rem;align-items:center;text-wrap:nowrap;width:fit-content}.bizy-tag--default{background-color:var(--bizy-tag-default-background-color)}::ng-deep .bizy-tag--default *{color:var(--bizy-tag-default-color)!important}.bizy-tag--info{background-color:var(--bizy-tag-info-background-color)}::ng-deep .bizy-tag--info *{color:var(--bizy-tag-info-color)!important}.bizy-tag--success{background-color:var(--bizy-tag-success-background-color)}::ng-deep .bizy-tag--success *{color:var(--bizy-tag-success-color)!important}.bizy-tag--warning{background-color:var(--bizy-tag-warning-background-color)}::ng-deep .bizy-tag--warning *{color:var(--bizy-tag-warning-color)!important}.bizy-tag--danger{background-color:var(--bizy-tag-danger-background-color)}::ng-deep .bizy-tag--danger *{color:var(--bizy-tag-danger-color)!important}.bizy-tag--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}\n"] }]
6289
6495
  }], propDecorators: { id: [{
6290
6496
  type: Input
6291
6497
  }], customClass: [{
6292
6498
  type: Input
6499
+ }], disabled: [{
6500
+ type: Input
6293
6501
  }], type: [{
6294
6502
  type: Input
6295
6503
  }], onSelect: [{