@acontplus/ng-components 2.1.20 → 2.1.22
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.
|
@@ -1793,6 +1793,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
1793
1793
|
class AlertDialogService {
|
|
1794
1794
|
dialog = inject(MatDialog);
|
|
1795
1795
|
zIndexService = inject(DialogZIndexService);
|
|
1796
|
+
// Trackear solo los AlertDialogs abiertos
|
|
1797
|
+
openAlertDialogs = [];
|
|
1796
1798
|
defaultOptions = {
|
|
1797
1799
|
width: '400px',
|
|
1798
1800
|
showConfirmButton: true,
|
|
@@ -1874,9 +1876,9 @@ class AlertDialogService {
|
|
|
1874
1876
|
*/
|
|
1875
1877
|
fire(options) {
|
|
1876
1878
|
const mergedOptions = { ...this.defaultOptions, ...options };
|
|
1877
|
-
// Si allowMultiple es false (por defecto), cerrar
|
|
1879
|
+
// Si allowMultiple es false (por defecto), cerrar solo los AlertDialogs existentes
|
|
1878
1880
|
if (!mergedOptions.allowMultiple) {
|
|
1879
|
-
this.
|
|
1881
|
+
this.closeAllAlertDialogs();
|
|
1880
1882
|
}
|
|
1881
1883
|
// Configuración especial para modo toast
|
|
1882
1884
|
if (mergedOptions.layout === 'toast') {
|
|
@@ -1915,6 +1917,15 @@ class AlertDialogService {
|
|
|
1915
1917
|
restoreFocus: true,
|
|
1916
1918
|
hasBackdrop: mergedOptions.layout !== 'toast', // Los toasts NO tienen backdrop
|
|
1917
1919
|
});
|
|
1920
|
+
// Trackear este AlertDialog
|
|
1921
|
+
this.openAlertDialogs.push(dialogRef);
|
|
1922
|
+
// Limpiar del tracking cuando se cierre
|
|
1923
|
+
dialogRef.afterClosed().subscribe(() => {
|
|
1924
|
+
const index = this.openAlertDialogs.indexOf(dialogRef);
|
|
1925
|
+
if (index > -1) {
|
|
1926
|
+
this.openAlertDialogs.splice(index, 1);
|
|
1927
|
+
}
|
|
1928
|
+
});
|
|
1918
1929
|
// Aplicar z-index dinámico usando el servicio centralizado
|
|
1919
1930
|
if (mergedOptions.forceToTop) {
|
|
1920
1931
|
// Si se requiere forzar al tope, usar forceToTop
|
|
@@ -2098,10 +2109,28 @@ class AlertDialogService {
|
|
|
2098
2109
|
});
|
|
2099
2110
|
}
|
|
2100
2111
|
/**
|
|
2101
|
-
* Cerrar
|
|
2112
|
+
* Cerrar solo los AlertDialogs abiertos (no afecta otros diálogos)
|
|
2113
|
+
*/
|
|
2114
|
+
closeAllAlertDialogs() {
|
|
2115
|
+
// Crear una copia del array para evitar problemas de concurrencia
|
|
2116
|
+
const dialogsToClose = [...this.openAlertDialogs];
|
|
2117
|
+
dialogsToClose.forEach(dialogRef => {
|
|
2118
|
+
if (dialogRef && !dialogRef.componentInstance) {
|
|
2119
|
+
// Solo cerrar si el diálogo aún está abierto
|
|
2120
|
+
dialogRef.close();
|
|
2121
|
+
}
|
|
2122
|
+
});
|
|
2123
|
+
// Limpiar el array
|
|
2124
|
+
this.openAlertDialogs = [];
|
|
2125
|
+
}
|
|
2126
|
+
/**
|
|
2127
|
+
* Cerrar TODOS los diálogos abiertos (incluyendo otros servicios)
|
|
2128
|
+
* ⚠️ Usar con cuidado - afecta todos los diálogos de MatDialog
|
|
2102
2129
|
*/
|
|
2103
2130
|
closeAll() {
|
|
2104
2131
|
this.dialog.closeAll();
|
|
2132
|
+
// También limpiar nuestro tracking
|
|
2133
|
+
this.openAlertDialogs = [];
|
|
2105
2134
|
}
|
|
2106
2135
|
/**
|
|
2107
2136
|
* Cerrar solo los toasts activos (mantener otros diálogos abiertos)
|
|
@@ -3908,7 +3937,7 @@ function formatDateToString(date) {
|
|
|
3908
3937
|
const dateZone = tzDate(date, 'America/Guayaquil');
|
|
3909
3938
|
return format({
|
|
3910
3939
|
date: dateZone,
|
|
3911
|
-
format: 'YYYY-MM-DD
|
|
3940
|
+
format: 'YYYY-MM-DD HH:mm:ss',
|
|
3912
3941
|
tz: 'America/Guayaquil',
|
|
3913
3942
|
});
|
|
3914
3943
|
}
|
|
@@ -4065,7 +4094,6 @@ class DateRangePicker {
|
|
|
4065
4094
|
to: this.mapDate(range.endDate || range.startDate),
|
|
4066
4095
|
};
|
|
4067
4096
|
this.onChange(dateRange);
|
|
4068
|
-
this.dateRangeSelected.emit(dateRange);
|
|
4069
4097
|
}
|
|
4070
4098
|
}
|
|
4071
4099
|
onPickerShow() {
|