ngx-dsxlibrary 2.21.18 → 2.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.
|
@@ -559,8 +559,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
559
559
|
args: [{ selector: 'app-pdf-preview', imports: [DialogModule], template: "<p-dialog\r\n header=\"Vista previa del documento de soporte\"\r\n [(visible)]=\"visible\"\r\n [style]=\"{ width: '80vw', height: '90vh' }\"\r\n [closable]=\"true\"\r\n [maximizable]=\"true\"\r\n>\r\n @if (pdfUrl) {\r\n <iframe\r\n [src]=\"pdfUrl\"\r\n width=\"100%\"\r\n height=\"100%\"\r\n style=\"border: none\"\r\n ></iframe>\r\n }\r\n</p-dialog>\r\n" }]
|
|
560
560
|
}], ctorParameters: () => [{ type: i1$3.DomSanitizer }], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], blob: [{ type: i0.Input, args: [{ isSignal: true, alias: "blob", required: false }] }] } });
|
|
561
561
|
|
|
562
|
-
/** SVG
|
|
563
|
-
const
|
|
562
|
+
/** SVG del icono help como fallback de emergencia */
|
|
563
|
+
const HELP_SVG = `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M440-200h80v-80h-80v80Zm40-400q-33 0-56.5 18.5T390-530l70 30q5-17 15-26.5t25-9.5q17 0 28.5 11.5T540-495q0 12-7.5 22T510-450q-35 24-52.5 44T440-340h80q0-22 12.5-39.5T570-412q30-21 40-41t10-42q0-51-35-88t-105-37q-60 0-94.5 29.5T340-510l70 30q8-25 23.5-37.5T480-530Zm0 500q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>`;
|
|
564
|
+
/**
|
|
565
|
+
* Servicio de carga de iconos SVG para `icon-dsx`.
|
|
566
|
+
*
|
|
567
|
+
* Flujo de resolución:
|
|
568
|
+
* 1) Intenta cargar el recurso solicitado en `mdio/{name}.svg`.
|
|
569
|
+
* 2) Si falla, registra un `console.warn` para depuración.
|
|
570
|
+
* 3) Usa `mdio/help.svg` como fallback visual para mantener buena UX.
|
|
571
|
+
* 4) Si también falla ese recurso, usa un SVG inline de `help` como último respaldo.
|
|
572
|
+
*
|
|
573
|
+
* Nota de mantenimiento:
|
|
574
|
+
* Los recursos SVG deben mantenerse actualizados en la carpeta de assets (`mdio`),
|
|
575
|
+
* de lo contrario se activará el fallback y el warning de ícono no encontrado.
|
|
576
|
+
*/
|
|
564
577
|
class IconDsxService {
|
|
565
578
|
http;
|
|
566
579
|
sanitizer;
|
|
@@ -569,14 +582,25 @@ class IconDsxService {
|
|
|
569
582
|
this.http = http;
|
|
570
583
|
this.sanitizer = sanitizer;
|
|
571
584
|
}
|
|
572
|
-
/**
|
|
585
|
+
/**
|
|
586
|
+
* Carga un SVG por nombre desde `mdio/{name}.svg` y retorna contenido seguro para renderizar.
|
|
587
|
+
*/
|
|
573
588
|
getIcon(name) {
|
|
574
589
|
if (this.cache.has(name)) {
|
|
575
590
|
return this.cache.get(name);
|
|
576
591
|
}
|
|
577
592
|
const iconPath = `mdio/${name}.svg`;
|
|
578
|
-
const
|
|
579
|
-
|
|
593
|
+
const helpIconPath = 'mdio/help.svg';
|
|
594
|
+
const request$ = this.http.get(iconPath, { responseType: 'text' }).pipe(map((svg) => this.sanitizer.bypassSecurityTrustHtml(svg)), catchError((error) => {
|
|
595
|
+
console.warn('[IconDsxService] Icono no encontrado, usando fallback', {
|
|
596
|
+
name,
|
|
597
|
+
path: iconPath,
|
|
598
|
+
status: error?.status,
|
|
599
|
+
message: error?.message,
|
|
600
|
+
});
|
|
601
|
+
return this.http.get(helpIconPath, { responseType: 'text' }).pipe(map((svg) => this.sanitizer.bypassSecurityTrustHtml(svg)), catchError(() => {
|
|
602
|
+
return of(this.sanitizer.bypassSecurityTrustHtml(HELP_SVG));
|
|
603
|
+
}));
|
|
580
604
|
}), shareReplay(1));
|
|
581
605
|
this.cache.set(name, request$);
|
|
582
606
|
return request$;
|