ngx-dsxlibrary 2.21.30 → 2.21.31
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.
|
@@ -2497,9 +2497,47 @@ class UtilityAddService {
|
|
|
2497
2497
|
return;
|
|
2498
2498
|
// Marca todos los controles (incluyendo anidados en FormGroup/FormArray)
|
|
2499
2499
|
control.markAllAsTouched();
|
|
2500
|
+
// Reporta en consola los campos inválidos solo en desarrollo.
|
|
2501
|
+
if (!this.environment.production) {
|
|
2502
|
+
const invalidControls = this.getInvalidControls(control);
|
|
2503
|
+
if (invalidControls.length > 0) {
|
|
2504
|
+
console.warn('UtilityAddService.checkFormValid: campos inválidos detectados:');
|
|
2505
|
+
invalidControls.forEach(({ path, errors }) => {
|
|
2506
|
+
console.warn(`- ${path}`, errors);
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2500
2510
|
// Muestra un mensaje de alerta
|
|
2501
2511
|
this._serviceAlerta.toastrAlerts(3, 'Formulario', 'Validaciones pendientes', 2);
|
|
2502
2512
|
}
|
|
2513
|
+
getInvalidControls(control, parentPath = '') {
|
|
2514
|
+
const controls = control.controls;
|
|
2515
|
+
if (!controls) {
|
|
2516
|
+
return control.invalid
|
|
2517
|
+
? [
|
|
2518
|
+
{
|
|
2519
|
+
path: parentPath || '(raiz)',
|
|
2520
|
+
errors: control.errors,
|
|
2521
|
+
},
|
|
2522
|
+
]
|
|
2523
|
+
: [];
|
|
2524
|
+
}
|
|
2525
|
+
const invalidControls = [];
|
|
2526
|
+
if (Array.isArray(controls)) {
|
|
2527
|
+
controls.forEach((childControl, index) => {
|
|
2528
|
+
const childPath = parentPath ? `${parentPath}[${index}]` : `[${index}]`;
|
|
2529
|
+
invalidControls.push(...this.getInvalidControls(childControl, childPath));
|
|
2530
|
+
});
|
|
2531
|
+
return invalidControls;
|
|
2532
|
+
}
|
|
2533
|
+
Object.entries(controls).forEach(([controlName, childControl]) => {
|
|
2534
|
+
const childPath = parentPath
|
|
2535
|
+
? `${parentPath}.${controlName}`
|
|
2536
|
+
: controlName;
|
|
2537
|
+
invalidControls.push(...this.getInvalidControls(childControl, childPath));
|
|
2538
|
+
});
|
|
2539
|
+
return invalidControls;
|
|
2540
|
+
}
|
|
2503
2541
|
/**
|
|
2504
2542
|
* Extrae valores únicos de un campo específico de un array de objetos.
|
|
2505
2543
|
*
|
|
@@ -6466,7 +6504,7 @@ function asyncExistsValidator(serviceMethod, options = {}) {
|
|
|
6466
6504
|
return (control) => {
|
|
6467
6505
|
if (!control.value)
|
|
6468
6506
|
return of(null);
|
|
6469
|
-
return of(control.value).pipe(debounceTime(
|
|
6507
|
+
return of(control.value).pipe(debounceTime(800), distinctUntilChanged(), switchMap((value) => {
|
|
6470
6508
|
const resolvedId = currentId ?? 0;
|
|
6471
6509
|
return serviceMethod(value, resolvedId);
|
|
6472
6510
|
}), map((exists) => {
|