@arsedizioni/ars-utils 21.0.43 → 21.0.46
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.
|
@@ -43,7 +43,6 @@ import * as i5$2 from '@angular/material/datepicker';
|
|
|
43
43
|
import { MatDatepickerModule, MatCalendar } from '@angular/material/datepicker';
|
|
44
44
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
45
45
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
46
|
-
import { NgStyle } from '@angular/common';
|
|
47
46
|
import * as i7$1 from '@angular/material/badge';
|
|
48
47
|
import { MatBadgeModule } from '@angular/material/badge';
|
|
49
48
|
import * as i4$1 from '@angular/material/chips';
|
|
@@ -1969,7 +1968,34 @@ class FilePreviewComponent {
|
|
|
1969
1968
|
* Load completed
|
|
1970
1969
|
*/
|
|
1971
1970
|
loaded() {
|
|
1972
|
-
this.iframe()?.nativeElement
|
|
1971
|
+
const iframe = this.iframe()?.nativeElement;
|
|
1972
|
+
if (!iframe) {
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
try {
|
|
1976
|
+
iframe.contentWindow?.scrollTo(0, 0);
|
|
1977
|
+
// Resize and center single image
|
|
1978
|
+
if (!this.dialogData?.embed && iframe.contentDocument) {
|
|
1979
|
+
const images = iframe.contentDocument.querySelectorAll('img') || [];
|
|
1980
|
+
if (images.length === 1) {
|
|
1981
|
+
Object.assign(images[0].style, {
|
|
1982
|
+
position: 'absolute',
|
|
1983
|
+
top: '50%',
|
|
1984
|
+
left: '50%',
|
|
1985
|
+
transform: 'translate(-50%, -50%)',
|
|
1986
|
+
maxWidth: images[0].style.maxWidth || '100%',
|
|
1987
|
+
maxHeight: images[0].style.maxHeight || '100%'
|
|
1988
|
+
});
|
|
1989
|
+
const iframeBody = iframe.contentDocument.body;
|
|
1990
|
+
if (iframeBody && !iframeBody.style.height) {
|
|
1991
|
+
iframeBody.style.height = '100%';
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
catch (e) {
|
|
1997
|
+
console.error('Impossibile accedere al contenuto dell\'iframe:', e);
|
|
1998
|
+
}
|
|
1973
1999
|
}
|
|
1974
2000
|
/**
|
|
1975
2001
|
* Download manually
|
|
@@ -1996,7 +2022,7 @@ class FilePreviewComponent {
|
|
|
1996
2022
|
}
|
|
1997
2023
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: FilePreviewComponent, decorators: [{
|
|
1998
2024
|
type: Component,
|
|
1999
|
-
args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogContent,
|
|
2025
|
+
args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogContent, FlexLayoutModule, MatDialogActions, MatButtonModule, MatTooltipModule,
|
|
2000
2026
|
MatDialogClose, SafeUrlPipe], template: "<mat-dialog-content class=\"file-preview\" id=\"file-preview-scrollable\">\r\n <div class=\"content\">\r\n @if (!url()) {\r\n <div class=\"loading\">Caricamento in corso...</div>\r\n } @else {\r\n <iframe class=\"iframe\" #iframe (load)=\"loaded()\" [src]=\"url() | safeUrl\"></iframe>\r\n }\r\n </div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions id=\"file-preview-fixed\">\r\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"10px\" fxFill>\r\n <div fxFlex=\"50\">\r\n <button mat-stroked-button (click)=\"troubles()\"\r\n matTooltip=\"Fai click se non riesci a visualizzare l'anteprima dei file PDF\">Problemi con i PDF?</button>\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n <button mat-stroked-button (click)=\"download()\">Scarica</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\" >Chiudi</button>\r\n </div>\r\n </div>\r\n</mat-dialog-actions>", styles: [".file-preview{padding:0}.file-preview .content{height:100%;width:100%;overflow:hidden;background-color:var(--ars-filepreview-content-background-color, #f7faf8)}.file-preview .content .loading{animation:blinker 2s linear infinite;font-size:x-large;color:var(--ars-color-text, #191c1b);width:100%;height:100%;padding:20px}.file-preview .content .iframe{width:100%;height:100%;border:0;background-color:var(--ars-filepreview-content-background-color, #f7faf8)!important}@keyframes blinker{50%{opacity:0}}.mat-mdc-dialog-content{max-height:unset!important;padding:0!important}\n"] }]
|
|
2001
2027
|
}], propDecorators: { iframe: [{ type: i0.ViewChild, args: ['iframe', { isSignal: true }] }] } });
|
|
2002
2028
|
|