ngx-dsxlibrary 1.21.18 → 1.21.20
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.
|
@@ -220,6 +220,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
220
220
|
}]
|
|
221
221
|
}] });
|
|
222
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Valores válidos para el tema de SweetAlert2.
|
|
225
|
+
* Esta constante permite autocompletado y validación en tiempo de compilación.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* // En environment.ts
|
|
230
|
+
* export const environment: EnvironmentConfig = {
|
|
231
|
+
* // ...otros campos
|
|
232
|
+
* sweetAlertTheme: 'dark', // ✅ Autocompletado disponible
|
|
233
|
+
* };
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
const SWEET_ALERT_THEMES = [
|
|
237
|
+
'auto',
|
|
238
|
+
'light',
|
|
239
|
+
'dark',
|
|
240
|
+
'default',
|
|
241
|
+
'bootstrap-4',
|
|
242
|
+
'borderless',
|
|
243
|
+
'bulma',
|
|
244
|
+
'material-ui',
|
|
245
|
+
'minimal',
|
|
246
|
+
'wordpress-admin',
|
|
247
|
+
];
|
|
223
248
|
/**
|
|
224
249
|
* Esquema de configuración del entorno - Fuente única de verdad (Single Source of Truth)
|
|
225
250
|
*
|
|
@@ -320,6 +345,7 @@ function validateEnvironmentConfig(environment) {
|
|
|
320
345
|
'Asegúrate de proporcionar una configuración válida usando provideEnvironment().');
|
|
321
346
|
}
|
|
322
347
|
// Obtener automáticamente todos los campos requeridos del schema
|
|
348
|
+
// Usamos keyof typeof ENVIRONMENT_SCHEMA para solo validar campos del schema base
|
|
323
349
|
const requiredFields = Object.keys(ENVIRONMENT_SCHEMA);
|
|
324
350
|
const missingFields = [];
|
|
325
351
|
const emptyFields = [];
|
|
@@ -536,18 +562,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
536
562
|
|
|
537
563
|
class AlertaService {
|
|
538
564
|
toastrService = inject(ToastrService);
|
|
565
|
+
/**
|
|
566
|
+
* Configuración del entorno inyectada (opcional).
|
|
567
|
+
* Se usa para obtener el tema global de SweetAlert2 desde el environment.
|
|
568
|
+
*/
|
|
569
|
+
environment = inject(ENVIRONMENT, { optional: true });
|
|
539
570
|
/**
|
|
540
571
|
* Tema visual por defecto para todas las alertas SweetAlert2.
|
|
541
|
-
*
|
|
572
|
+
* Se inicializa desde el environment si está configurado, o puede establecerse
|
|
573
|
+
* manualmente llamando a setDefaultTheme().
|
|
574
|
+
*
|
|
575
|
+
* **Prioridad de temas:**
|
|
576
|
+
* 1. Tema específico pasado en options de cada alerta
|
|
577
|
+
* 2. Tema establecido con setDefaultTheme()
|
|
578
|
+
* 3. Tema configurado en environment.sweetAlertTheme
|
|
579
|
+
* 4. Tema por defecto de SweetAlert2
|
|
542
580
|
*/
|
|
543
581
|
defaultTheme = undefined;
|
|
582
|
+
constructor() {
|
|
583
|
+
// Inicializar el tema desde el environment si está disponible
|
|
584
|
+
if (this.environment?.sweetAlertTheme) {
|
|
585
|
+
this.defaultTheme = this.environment.sweetAlertTheme;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
544
588
|
/**
|
|
545
589
|
* Permite establecer el theme global para todas las alertas SweetAlert2.
|
|
590
|
+
* Este tema sobrescribe el configurado en el environment.
|
|
591
|
+
*
|
|
546
592
|
* @param theme - Valor de theme válido para SweetAlert2 (por ejemplo: 'dark', 'minimal', etc).
|
|
593
|
+
*
|
|
594
|
+
* @example
|
|
595
|
+
* ```typescript
|
|
596
|
+
* // Cambiar el tema en tiempo de ejecución
|
|
597
|
+
* alertaService.setDefaultTheme('dark');
|
|
598
|
+
* ```
|
|
547
599
|
*/
|
|
548
600
|
setDefaultTheme(theme) {
|
|
549
601
|
this.defaultTheme = theme;
|
|
550
602
|
}
|
|
603
|
+
/**
|
|
604
|
+
* Obtiene el tema actual configurado para SweetAlert2.
|
|
605
|
+
* @returns El tema actual o undefined si no hay tema configurado.
|
|
606
|
+
*/
|
|
607
|
+
getDefaultTheme() {
|
|
608
|
+
return this.defaultTheme;
|
|
609
|
+
}
|
|
551
610
|
/**
|
|
552
611
|
* @param {number} toastrType - 1. Success 2. Info 3. Warning 4. Error
|
|
553
612
|
* @param {string} toastrTitle - Titulo de la alerta
|
|
@@ -681,7 +740,7 @@ class AlertaService {
|
|
|
681
740
|
imageWidth: showImage ? imageWidth : undefined,
|
|
682
741
|
imageHeight: showImage ? imageHeight : undefined,
|
|
683
742
|
imageAlt: showImage ? 'image alert' : undefined,
|
|
684
|
-
// Aplica el theme global o el específico
|
|
743
|
+
// Aplica el theme global o el específico (cast a SweetAlertTheme para compatibilidad)
|
|
685
744
|
...(alertTheme !== undefined && { theme: alertTheme }),
|
|
686
745
|
};
|
|
687
746
|
// Solo agrega el icono si está definido
|
|
@@ -745,7 +804,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
745
804
|
args: [{
|
|
746
805
|
providedIn: 'root',
|
|
747
806
|
}]
|
|
748
|
-
}] });
|
|
807
|
+
}], ctorParameters: () => [] });
|
|
749
808
|
|
|
750
809
|
const INITIAL_PARAMETERS = new InjectionToken('InitialParameters');
|
|
751
810
|
|
|
@@ -2816,5 +2875,5 @@ function CUICorrecto(cui) {
|
|
|
2816
2875
|
* Generated bundle index. Do not edit.
|
|
2817
2876
|
*/
|
|
2818
2877
|
|
|
2819
|
-
export { AlertaService, AppMessageErrorComponent, AuthorizeService, CACHE_KEYS, CacheService, CssV2Component, DsxAddToolsModule, ENVIRONMENT, EndpointService, ErrorHandlerService, INITIAL_PARAMETERS, IconDsxComponent, JsonHighlightPipe, JsonValuesDebujComponent, KpicardComponent, LoadingComponent, LoadingLottieComponent, NavbarDsxComponent, OnlyRangoPatternDirective, ParameterValuesService, PrimeNgModule, SecurityService, SelectAllOnFocusDirective, TruncatePipe, UtilityAddService, atLeastOneFieldRequiredValidator, createInitialCache, createTypedCacheProvider, cuiValidator, dateMinMaxValidator, dateRangeValidator, httpAuthorizeInterceptor, nitValidator, provideEnvironment, validateEnvironmentConfig };
|
|
2878
|
+
export { AlertaService, AppMessageErrorComponent, AuthorizeService, CACHE_KEYS, CacheService, CssV2Component, DsxAddToolsModule, ENVIRONMENT, EndpointService, ErrorHandlerService, INITIAL_PARAMETERS, IconDsxComponent, JsonHighlightPipe, JsonValuesDebujComponent, KpicardComponent, LoadingComponent, LoadingLottieComponent, NavbarDsxComponent, OnlyRangoPatternDirective, ParameterValuesService, PrimeNgModule, SWEET_ALERT_THEMES, SecurityService, SelectAllOnFocusDirective, TruncatePipe, UtilityAddService, atLeastOneFieldRequiredValidator, createInitialCache, createTypedCacheProvider, cuiValidator, dateMinMaxValidator, dateRangeValidator, httpAuthorizeInterceptor, nitValidator, provideEnvironment, validateEnvironmentConfig };
|
|
2820
2879
|
//# sourceMappingURL=ngx-dsxlibrary.mjs.map
|