ngx-dsxlibrary 1.0.49 → 1.0.51

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.
@@ -1,6 +1,63 @@
1
- import { SweetAlertIcon } from 'sweetalert2';
1
+ import { SweetAlertIcon, SweetAlertResult } from 'sweetalert2';
2
2
  import { ResponseHttpModel } from '../models/src/response-http.model';
3
3
  import * as i0 from "@angular/core";
4
+ /**
5
+ * Configuración personalizable para las alertas visuales
6
+ *
7
+ * @property icono - Nombre del archivo de imagen ubicado en 'assets/dsxResource/'.
8
+ * Ejemplo: 'success-icon.png'. Por defecto usa 'icon/check02.png'.
9
+ *
10
+ * @property icon - Tipo de icono SweetAlert2 incorporado. Valores posibles:
11
+ * 'success' | 'error' | 'warning' | 'info' | 'question'.
12
+ * Por defecto: 'success'.
13
+ *
14
+ * @property showConfirmButton - Determina si se muestra el botón de confirmación.
15
+ * Cuando es true, desactiva el cierre automático.
16
+ * Por defecto: false.
17
+ *
18
+ * @property confirmButtonText - Texto personalizado para el botón de confirmación.
19
+ * Por defecto: 'Ok'.
20
+ *
21
+ * @property timer - Tiempo en milisegundos para el cierre automático de la alerta.
22
+ * Se ignora si showConfirmButton es true.
23
+ * Por defecto: 2000 (2 segundos).
24
+ *
25
+ * @property imageWidth - Ancho en píxeles para la imagen personalizada.
26
+ * Por defecto: 125.
27
+ *
28
+ * @property imageHeight - Alto en píxeles para la imagen personalizada.
29
+ * Por defecto: 125.
30
+ *
31
+ * @property showImage - Controla si se muestra la imagen personalizada.
32
+ * Cuando es false, solo se muestra el icono de SweetAlert2.
33
+ * Por defecto: true.
34
+ *
35
+ * @example
36
+ * // Ejemplo de configuración básica
37
+ * const options: AlertOptions = {
38
+ * icono: 'custom-icon.png',
39
+ * icon: 'warning',
40
+ * timer: 3000
41
+ * };
42
+ *
43
+ * @example
44
+ * // Ejemplo de alerta con botón de confirmación
45
+ * const confirmOptions: AlertOptions = {
46
+ * showConfirmButton: true,
47
+ * confirmButtonText: 'Aceptar',
48
+ * showImage: false
49
+ * };
50
+ */
51
+ interface AlertOptions {
52
+ icono?: string;
53
+ icon?: SweetAlertIcon;
54
+ showConfirmButton?: boolean;
55
+ confirmButtonText?: string;
56
+ timer?: number;
57
+ imageWidth?: number;
58
+ imageHeight?: number;
59
+ showImage?: boolean;
60
+ }
4
61
  export declare class AlertaService {
5
62
  private toastrService;
6
63
  /**
@@ -16,27 +73,44 @@ export declare class AlertaService {
16
73
  alertConfirm(title: string, text: string, icono: string): Promise<boolean>;
17
74
  alertaHtml(titleAlert: string, message: string, icono?: string, timer?: number): Promise<void>;
18
75
  /**
19
- * Muestra una alerta visual personalizada con SweetAlert2 con manejo inteligente de timer y botón de confirmación
76
+ * Muestra una alerta visual personalizada usando SweetAlert2 con múltiples opciones de configuración
77
+ *
78
+ * @param titleAlert Título principal de la alerta (requerido)
79
+ * @param messageHtml Mensaje en formato HTML (requerido)
80
+ * @param options Opciones configurables de la alerta (opcional)
20
81
  *
21
- * @param titleAlert - Título principal de la alerta
22
- * @param messageHtml - Mensaje descriptivo en formato HTML
23
- * @param icono - Nombre del archivo de imagen (default 'check02.png'), la ruta se carga desde assets/dsxResource/
24
- * @param icon - Tipo de icono: 'success' | 'error' | 'warning' | 'info' | 'question' (default 'success')
25
- * @param showConfirmButton - Muestra botón de confirmación (default false). Si es true, desactiva el timer
26
- * @param confirmButtonText - Texto personalizado para el botón (default 'Ok')
27
- * @param timer - Tiempo en ms para auto-cierre (default 2000). Se ignora si showConfirmButton es true
28
- * @returns Promise<void> que se resuelve cuando la alerta se muestra
82
+ * @returns Promise<SweetAlertResult> que se resuelve cuando el usuario interactúa con la alerta
83
+ * o cuando se cierra automáticamente. Puedes usar .then() para manejar la respuesta.
84
+ *
85
+ * @example
86
+ * // Alerta básica con icono de éxito y cierre automático
87
+ * alertaHtmlSuccess('Operación exitosa', 'Los datos se guardaron correctamente');
29
88
  *
30
89
  * @example
31
- * // Alerta con timer (se cierra automáticamente)
32
- * alertaHtmlSuccess('Éxito', 'Operación completada');
90
+ * // Alerta de error con imagen personalizada
91
+ * alertaHtmlSuccess('Error crítico', 'No se pudo conectar al servidor', {
92
+ * icono: 'error-icon.png',
93
+ * icon: 'error',
94
+ * timer: 5000
95
+ * });
33
96
  *
34
97
  * @example
35
- * // Alerta con botón de confirmación (persistente)
36
- * alertaHtmlSuccess('Confirmación', '¿Desea continuar?', 'question.png', 'question', 0, true, 'Continuar');
98
+ * // Alerta de confirmación con botón
99
+ * alertaHtmlSuccess('Confirmar acción', '¿Está seguro de eliminar este registro?', {
100
+ * showConfirmButton: true,
101
+ * confirmButtonText: 'Sí, eliminar',
102
+ * icon: 'warning',
103
+ * showImage: false
104
+ * }).then((result) => {
105
+ * if (result.isConfirmed) {
106
+ * // Lógica cuando el usuario confirma
107
+ * }
108
+ * });
37
109
  */
38
- alertaHtmlSuccess(titleAlert: string, messageHtml: string, icono?: string, icon?: SweetAlertIcon, showConfirmButton?: boolean, confirmButtonText?: string, timer?: number): Promise<void>;
110
+ alertaHtmlSuccess(titleAlert: string, messageHtml: string, options?: AlertOptions): Promise<SweetAlertResult>;
111
+ private configureTimer;
39
112
  toastrHttpResponse(response: ResponseHttpModel): void;
40
113
  static ɵfac: i0.ɵɵFactoryDeclaration<AlertaService, never>;
41
114
  static ɵprov: i0.ɵɵInjectableDeclaration<AlertaService>;
42
115
  }
116
+ export {};
Binary file
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "ngx-dsxlibrary",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "Libreria para control de código automatizado.",
5
5
  "author": "DevSoftXela",
6
6
  "peerDependencies": {
7
- "@angular/common": "^19.1.0",
8
- "@angular/core": "^19.1.0"
7
+ "@angular/common": "^19.2.14",
8
+ "@angular/core": "19.2.14"
9
9
  },
10
10
  "dependencies": {
11
11
  "tslib": "^2.3.0"
@@ -33,14 +33,14 @@
33
33
  "types": "./src/lib/injections/index.d.ts",
34
34
  "default": "./fesm2022/ngx-dsxlibrary-src-lib-injections.mjs"
35
35
  },
36
- "./src/lib/interceptors": {
37
- "types": "./src/lib/interceptors/index.d.ts",
38
- "default": "./fesm2022/ngx-dsxlibrary-src-lib-interceptors.mjs"
39
- },
40
36
  "./src/lib/models": {
41
37
  "types": "./src/lib/models/index.d.ts",
42
38
  "default": "./fesm2022/ngx-dsxlibrary-src-lib-models.mjs"
43
39
  },
40
+ "./src/lib/interceptors": {
41
+ "types": "./src/lib/interceptors/index.d.ts",
42
+ "default": "./fesm2022/ngx-dsxlibrary-src-lib-interceptors.mjs"
43
+ },
44
44
  "./src/lib/pipe": {
45
45
  "types": "./src/lib/pipe/index.d.ts",
46
46
  "default": "./fesm2022/ngx-dsxlibrary-src-lib-pipe.mjs"
Binary file