ngx-dsxlibrary 1.21.17 → 1.21.19

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.
@@ -27,6 +27,7 @@ import { AutoCompleteModule } from 'primeng/autocomplete';
27
27
  import { AutoFocusModule } from 'primeng/autofocus';
28
28
  import { AvatarModule } from 'primeng/avatar';
29
29
  import { AvatarGroupModule } from 'primeng/avatargroup';
30
+ import { CardModule } from 'primeng/card';
30
31
  import { CheckboxModule } from 'primeng/checkbox';
31
32
  import { DatePickerModule } from 'primeng/datepicker';
32
33
  import { DialogModule } from 'primeng/dialog';
@@ -219,6 +220,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
219
220
  }]
220
221
  }] });
221
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
+ ];
222
248
  /**
223
249
  * Esquema de configuración del entorno - Fuente única de verdad (Single Source of Truth)
224
250
  *
@@ -319,6 +345,7 @@ function validateEnvironmentConfig(environment) {
319
345
  'Asegúrate de proporcionar una configuración válida usando provideEnvironment().');
320
346
  }
321
347
  // Obtener automáticamente todos los campos requeridos del schema
348
+ // Usamos keyof typeof ENVIRONMENT_SCHEMA para solo validar campos del schema base
322
349
  const requiredFields = Object.keys(ENVIRONMENT_SCHEMA);
323
350
  const missingFields = [];
324
351
  const emptyFields = [];
@@ -535,18 +562,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
535
562
 
536
563
  class AlertaService {
537
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 });
538
570
  /**
539
571
  * Tema visual por defecto para todas las alertas SweetAlert2.
540
- * Puedes cambiarlo desde tu app llamando a setDefaultTheme().
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
541
580
  */
542
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
+ }
543
588
  /**
544
589
  * Permite establecer el theme global para todas las alertas SweetAlert2.
590
+ * Este tema sobrescribe el configurado en el environment.
591
+ *
545
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
+ * ```
546
599
  */
547
600
  setDefaultTheme(theme) {
548
601
  this.defaultTheme = theme;
549
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
+ }
550
610
  /**
551
611
  * @param {number} toastrType - 1. Success 2. Info 3. Warning 4. Error
552
612
  * @param {string} toastrTitle - Titulo de la alerta
@@ -744,7 +804,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
744
804
  args: [{
745
805
  providedIn: 'root',
746
806
  }]
747
- }] });
807
+ }], ctorParameters: () => [] });
748
808
 
749
809
  const INITIAL_PARAMETERS = new InjectionToken('InitialParameters');
750
810
 
@@ -1814,6 +1874,7 @@ const PRIME_NG_MODULES = [
1814
1874
  AvatarGroupModule,
1815
1875
  AvatarModule,
1816
1876
  ButtonModule,
1877
+ CardModule,
1817
1878
  CheckboxModule,
1818
1879
  DatePickerModule,
1819
1880
  DialogModule,
@@ -1854,6 +1915,7 @@ class PrimeNgModule {
1854
1915
  AvatarGroupModule,
1855
1916
  AvatarModule,
1856
1917
  ButtonModule,
1918
+ CardModule,
1857
1919
  CheckboxModule,
1858
1920
  DatePickerModule,
1859
1921
  DialogModule,
@@ -1891,6 +1953,7 @@ class PrimeNgModule {
1891
1953
  AvatarGroupModule,
1892
1954
  AvatarModule,
1893
1955
  ButtonModule,
1956
+ CardModule,
1894
1957
  CheckboxModule,
1895
1958
  DatePickerModule,
1896
1959
  DialogModule,
@@ -2812,5 +2875,5 @@ function CUICorrecto(cui) {
2812
2875
  * Generated bundle index. Do not edit.
2813
2876
  */
2814
2877
 
2815
- 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 };
2816
2879
  //# sourceMappingURL=ngx-dsxlibrary.mjs.map