|
|
@ -1,5 +1,4 @@
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
AfterViewChecked,
|
|
|
|
|
|
|
|
AfterViewInit,
|
|
|
|
AfterViewInit,
|
|
|
|
ChangeDetectionStrategy,
|
|
|
|
ChangeDetectionStrategy,
|
|
|
|
ChangeDetectorRef,
|
|
|
|
ChangeDetectorRef,
|
|
|
@ -14,7 +13,6 @@ import {File} from "../../../../../api/models/File";
|
|
|
|
import {FileService} from "../../../../services/file/file.service";
|
|
|
|
import {FileService} from "../../../../services/file/file.service";
|
|
|
|
import {FileHelper} from "../../../../services/file/file.helper";
|
|
|
|
import {FileHelper} from "../../../../services/file/file.helper";
|
|
|
|
import {SafeResourceUrl} from "@angular/platform-browser";
|
|
|
|
import {SafeResourceUrl} from "@angular/platform-browser";
|
|
|
|
import {BehaviorSubject} from "rxjs";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
selector: "app-file-thumbnail",
|
|
|
|
selector: "app-file-thumbnail",
|
|
|
@ -22,10 +20,9 @@ import {BehaviorSubject} from "rxjs";
|
|
|
|
styleUrls: ["./file-thumbnail.component.scss"],
|
|
|
|
styleUrls: ["./file-thumbnail.component.scss"],
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
|
|
})
|
|
|
|
})
|
|
|
|
export class FileThumbnailComponent implements OnChanges, AfterViewInit, AfterViewChecked {
|
|
|
|
export class FileThumbnailComponent implements OnChanges, AfterViewInit {
|
|
|
|
|
|
|
|
|
|
|
|
@Input() file!: File;
|
|
|
|
@Input() file!: File;
|
|
|
|
@Input() public fileChanged: BehaviorSubject<void> = new BehaviorSubject<void>(undefined);
|
|
|
|
|
|
|
|
@Output() loadEnd = new EventEmitter<void>();
|
|
|
|
@Output() loadEnd = new EventEmitter<void>();
|
|
|
|
|
|
|
|
|
|
|
|
public thumbUrl: SafeResourceUrl | undefined;
|
|
|
|
public thumbUrl: SafeResourceUrl | undefined;
|
|
|
@ -34,7 +31,6 @@ export class FileThumbnailComponent implements OnChanges, AfterViewInit, AfterVi
|
|
|
|
public displayError = false;
|
|
|
|
public displayError = false;
|
|
|
|
|
|
|
|
|
|
|
|
private supportedThumbnailTypes = ["image", "video"];
|
|
|
|
private supportedThumbnailTypes = ["image", "video"];
|
|
|
|
private previousStatus = "imported";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private changeDetector: ChangeDetectorRef, private fileService: FileService) {
|
|
|
|
constructor(private changeDetector: ChangeDetectorRef, private fileService: FileService) {
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -45,13 +41,6 @@ export class FileThumbnailComponent implements OnChanges, AfterViewInit, AfterVi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ngAfterViewChecked(): void {
|
|
|
|
|
|
|
|
if (this.file && this.file.status != this.previousStatus) {
|
|
|
|
|
|
|
|
this.previousStatus = this.file.status;
|
|
|
|
|
|
|
|
this.changeDetector.markForCheck();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async ngOnChanges(changes: SimpleChanges) {
|
|
|
|
public async ngOnChanges(changes: SimpleChanges) {
|
|
|
|
if (changes["file"]) {
|
|
|
|
if (changes["file"]) {
|
|
|
|
this.thumbUrl = this.fileService.buildThumbnailUrl(this.file,
|
|
|
|
this.thumbUrl = this.fileService.buildThumbnailUrl(this.file,
|
|
|
@ -61,9 +50,6 @@ export class FileThumbnailComponent implements OnChanges, AfterViewInit, AfterVi
|
|
|
|
this.thumbnailSupported = this.getThumbnailSupported();
|
|
|
|
this.thumbnailSupported = this.getThumbnailSupported();
|
|
|
|
this.displayError = false;
|
|
|
|
this.displayError = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changes["fileChanged"]) {
|
|
|
|
|
|
|
|
this.fileChanged.subscribe(() => this.changeDetector.markForCheck());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public onImageLoadError(): void {
|
|
|
|
public onImageLoadError(): void {
|
|
|
|