@bizy/core 19.14.3 → 19.14.5
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.
package/fesm2022/bizy-core.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { isSameMonth, isSameDay } from 'date-fns';
|
|
|
12
12
|
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
|
|
13
13
|
import localeEs from '@angular/common/locales/es';
|
|
14
14
|
import * as i2$1 from '@angular/forms';
|
|
15
|
-
import { FormsModule,
|
|
15
|
+
import { FormsModule, FormBuilder, Validators } from '@angular/forms';
|
|
16
16
|
import flatpickr from 'flatpickr';
|
|
17
17
|
import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect/index.js';
|
|
18
18
|
import { Spanish } from 'flatpickr/dist/l10n/es.js';
|
|
@@ -2028,8 +2028,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
|
2028
2028
|
}] });
|
|
2029
2029
|
|
|
2030
2030
|
class BizyFilterSectionRangeOptionComponent {
|
|
2031
|
-
fb;
|
|
2032
|
-
ref;
|
|
2031
|
+
#fb = inject(FormBuilder);
|
|
2032
|
+
#ref = inject(ChangeDetectorRef);
|
|
2033
2033
|
id = `bizy-filter-section-range-option-${Math.random()}`;
|
|
2034
2034
|
disabled = false;
|
|
2035
2035
|
customClass = '';
|
|
@@ -2040,16 +2040,20 @@ class BizyFilterSectionRangeOptionComponent {
|
|
|
2040
2040
|
get activated$() {
|
|
2041
2041
|
return this.#activated.asObservable();
|
|
2042
2042
|
}
|
|
2043
|
-
form
|
|
2043
|
+
#form = this.#fb.group({
|
|
2044
|
+
minValue: [null],
|
|
2045
|
+
maxValue: [null]
|
|
2046
|
+
});
|
|
2047
|
+
;
|
|
2044
2048
|
set min(min) {
|
|
2045
2049
|
if (typeof min === 'undefined' || min === null) {
|
|
2046
2050
|
this.minValue.setValue(null);
|
|
2047
2051
|
}
|
|
2048
2052
|
else {
|
|
2049
|
-
this.minValue.setValue(min);
|
|
2053
|
+
this.minValue.setValue(Number(min));
|
|
2050
2054
|
}
|
|
2051
|
-
this.#activated.next(Boolean(min));
|
|
2052
|
-
this
|
|
2055
|
+
this.#activated.next(Boolean(min) || min === 0 || Boolean(this.maxValue.value) || this.maxValue.value === 0);
|
|
2056
|
+
this.#ref.detectChanges();
|
|
2053
2057
|
}
|
|
2054
2058
|
;
|
|
2055
2059
|
set max(max) {
|
|
@@ -2057,10 +2061,10 @@ class BizyFilterSectionRangeOptionComponent {
|
|
|
2057
2061
|
this.maxValue.setValue(null);
|
|
2058
2062
|
}
|
|
2059
2063
|
else {
|
|
2060
|
-
this.maxValue.setValue(max);
|
|
2064
|
+
this.maxValue.setValue(Number(max));
|
|
2061
2065
|
}
|
|
2062
|
-
this.#activated.next(Boolean(max));
|
|
2063
|
-
this
|
|
2066
|
+
this.#activated.next(Boolean(max) || max === 0 || Boolean(this.minValue.value) || this.minValue.value === 0);
|
|
2067
|
+
this.#ref.detectChanges();
|
|
2064
2068
|
}
|
|
2065
2069
|
;
|
|
2066
2070
|
set minLimit(min) {
|
|
@@ -2089,14 +2093,6 @@ class BizyFilterSectionRangeOptionComponent {
|
|
|
2089
2093
|
}
|
|
2090
2094
|
}
|
|
2091
2095
|
;
|
|
2092
|
-
constructor(fb, ref) {
|
|
2093
|
-
this.fb = fb;
|
|
2094
|
-
this.ref = ref;
|
|
2095
|
-
this.form = this.fb.group({
|
|
2096
|
-
minValue: [null],
|
|
2097
|
-
maxValue: [null]
|
|
2098
|
-
});
|
|
2099
|
-
}
|
|
2100
2096
|
setMinValue(value) {
|
|
2101
2097
|
let min = value === '' ? null : Number(value);
|
|
2102
2098
|
const max = this.maxValue.value === null || this.maxValue.value === '' ? null : Number(this.maxValue.value);
|
|
@@ -2107,8 +2103,8 @@ class BizyFilterSectionRangeOptionComponent {
|
|
|
2107
2103
|
min = this._minLimit;
|
|
2108
2104
|
}
|
|
2109
2105
|
this.onChange.emit({ min, max });
|
|
2110
|
-
this.#activated.next(Boolean(min) || Boolean(max));
|
|
2111
|
-
this
|
|
2106
|
+
this.#activated.next(Boolean(min) || Boolean(max) || min === 0 || max === 0);
|
|
2107
|
+
this.#ref.detectChanges();
|
|
2112
2108
|
}
|
|
2113
2109
|
setMaxValue(value) {
|
|
2114
2110
|
let max = !Boolean(value) && value !== 0 ? null : Number(value);
|
|
@@ -2120,21 +2116,21 @@ class BizyFilterSectionRangeOptionComponent {
|
|
|
2120
2116
|
max = this._maxLimit;
|
|
2121
2117
|
}
|
|
2122
2118
|
this.onChange.emit({ min, max });
|
|
2123
|
-
this.#activated.next(Boolean(min) || Boolean(max));
|
|
2124
|
-
this
|
|
2119
|
+
this.#activated.next(Boolean(min) || Boolean(max) || min === 0 || max === 0);
|
|
2120
|
+
this.#ref.detectChanges();
|
|
2125
2121
|
}
|
|
2126
2122
|
get minValue() {
|
|
2127
|
-
return this
|
|
2123
|
+
return this.#form.get('minValue');
|
|
2128
2124
|
}
|
|
2129
2125
|
get maxValue() {
|
|
2130
|
-
return this
|
|
2126
|
+
return this.#form.get('maxValue');
|
|
2131
2127
|
}
|
|
2132
2128
|
onClean = () => {
|
|
2133
2129
|
this.minValue.setValue(null);
|
|
2134
2130
|
this.maxValue.setValue(null);
|
|
2135
2131
|
this.onChange.emit({ min: null, max: null });
|
|
2136
2132
|
this.#activated.next(false);
|
|
2137
|
-
this
|
|
2133
|
+
this.#ref.detectChanges();
|
|
2138
2134
|
};
|
|
2139
2135
|
getId = () => {
|
|
2140
2136
|
return this.id;
|
|
@@ -2142,19 +2138,13 @@ class BizyFilterSectionRangeOptionComponent {
|
|
|
2142
2138
|
isActivated = () => {
|
|
2143
2139
|
return this.#activated.value;
|
|
2144
2140
|
};
|
|
2145
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterSectionRangeOptionComponent, deps: [
|
|
2141
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterSectionRangeOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2146
2142
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyFilterSectionRangeOptionComponent, isStandalone: true, selector: "bizy-filter-section-range-option", inputs: { id: "id", disabled: "disabled", customClass: "customClass", min: "min", max: "max", minLimit: "minLimit", maxLimit: "maxLimit" }, outputs: { onChange: "onChange" }, ngImport: i0, template: "<div \n class=\"bizy-filter-section-range-option {{customClass}}\"\n [id]=\"id\">\n\n <span class=\"bizy-filter-section-range-option__inputs\">\n\n <bizy-input\n class=\"bizy-filter-section-range-option__input\"\n type=\"number\"\n [value]=\"minValue.value\"\n (onChange)=\"setMinValue($event)\">\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=min-header]\"></ng-content>\n </ng-container>\n\n </bizy-input>\n\n <bizy-input\n class=\"bizy-filter-section-range-option__input\"\n type=\"number\"\n [value]=\"maxValue.value\"\n (onChange)=\"setMaxValue($event)\">\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=max-header]\"></ng-content>\n </ng-container>\n\n </bizy-input>\n\n </span>\n \n</div>", styles: [":host{font-size:1rem}.bizy-filter-section-range-option{display:flex;flex-direction:column;row-gap:1rem}.bizy-filter-section-range-option__inputs{display:flex;align-items:center;column-gap:.5rem}.bizy-filter-section-range-option__input{--bizy-input-background-color: #f3f3f3 !important}\n"], dependencies: [{ kind: "component", type: BizyInputComponent, selector: "bizy-input", inputs: ["id", "name", "type", "customClass", "placeholder", "debounceTime", "rows", "disabled", "readonly", "autofocus", "value"], outputs: ["valueChange", "onChange", "onEnter", "onBackspace", "onSelect", "onBlur", "onFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2147
2143
|
}
|
|
2148
2144
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterSectionRangeOptionComponent, decorators: [{
|
|
2149
2145
|
type: Component,
|
|
2150
2146
|
args: [{ selector: 'bizy-filter-section-range-option', imports: [BizyInputComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div \n class=\"bizy-filter-section-range-option {{customClass}}\"\n [id]=\"id\">\n\n <span class=\"bizy-filter-section-range-option__inputs\">\n\n <bizy-input\n class=\"bizy-filter-section-range-option__input\"\n type=\"number\"\n [value]=\"minValue.value\"\n (onChange)=\"setMinValue($event)\">\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=min-header]\"></ng-content>\n </ng-container>\n\n </bizy-input>\n\n <bizy-input\n class=\"bizy-filter-section-range-option__input\"\n type=\"number\"\n [value]=\"maxValue.value\"\n (onChange)=\"setMaxValue($event)\">\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=max-header]\"></ng-content>\n </ng-container>\n\n </bizy-input>\n\n </span>\n \n</div>", styles: [":host{font-size:1rem}.bizy-filter-section-range-option{display:flex;flex-direction:column;row-gap:1rem}.bizy-filter-section-range-option__inputs{display:flex;align-items:center;column-gap:.5rem}.bizy-filter-section-range-option__input{--bizy-input-background-color: #f3f3f3 !important}\n"] }]
|
|
2151
|
-
}],
|
|
2152
|
-
type: Inject,
|
|
2153
|
-
args: [FormBuilder]
|
|
2154
|
-
}] }, { type: i0.ChangeDetectorRef, decorators: [{
|
|
2155
|
-
type: Inject,
|
|
2156
|
-
args: [ChangeDetectorRef]
|
|
2157
|
-
}] }], propDecorators: { id: [{
|
|
2147
|
+
}], propDecorators: { id: [{
|
|
2158
2148
|
type: Input
|
|
2159
2149
|
}], disabled: [{
|
|
2160
2150
|
type: Input
|
|
@@ -4151,23 +4141,27 @@ class BizyValidatorService {
|
|
|
4151
4141
|
isUppercase = (value) => validator.isUppercase(value);
|
|
4152
4142
|
isMobilePhone = (data) => validator.isMobilePhone(data.value, data.locale);
|
|
4153
4143
|
isCUIT(cuit) {
|
|
4154
|
-
|
|
4155
|
-
const isCUIT = regex.test(String(cuit).toLowerCase());
|
|
4156
|
-
if (!isCUIT) {
|
|
4144
|
+
if (!cuit) {
|
|
4157
4145
|
return false;
|
|
4158
4146
|
}
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
return
|
|
4147
|
+
if (this.isString(cuit)) {
|
|
4148
|
+
cuit = cuit.replace(/[-]/g, '');
|
|
4149
|
+
}
|
|
4150
|
+
else {
|
|
4151
|
+
cuit = String(cuit);
|
|
4152
|
+
}
|
|
4153
|
+
// 20, 23, 24, 25, 26 y 27 Personas Físicas
|
|
4154
|
+
// 30, 33 y 34 Personas Jurídicas.
|
|
4155
|
+
if (!/^(20|23|24|25|26|27|30|33|34)\d{8}\d$/.test(cuit)) {
|
|
4156
|
+
return false;
|
|
4169
4157
|
}
|
|
4170
|
-
|
|
4158
|
+
const multipliers = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2];
|
|
4159
|
+
const digits = cuit.split('').map(Number);
|
|
4160
|
+
const checkDigit = digits[10];
|
|
4161
|
+
const sum = multipliers.reduce((acc, _multiplier, i) => acc + _multiplier * digits[i], 0);
|
|
4162
|
+
const mod11 = 11 - (sum % 11);
|
|
4163
|
+
const expectedDigit = mod11 === 11 ? 0 : mod11 === 10 ? 9 : mod11;
|
|
4164
|
+
return checkDigit === expectedDigit;
|
|
4171
4165
|
}
|
|
4172
4166
|
isDNI(dni) {
|
|
4173
4167
|
const regex = /(^[1-9]{1}[0-9]{7}$)/i;
|