mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
refactor part 2
This commit is contained in:
@@ -39,10 +39,8 @@ export class MediaPlayerComponent implements OnChanges {
|
||||
|
||||
@Input()
|
||||
fileName: string;
|
||||
//
|
||||
// @Input()
|
||||
// nodeId: string;
|
||||
|
||||
/** media subtitles for the media player*/
|
||||
@Input()
|
||||
tracks: Track[] = [];
|
||||
|
||||
@@ -54,17 +52,12 @@ export class MediaPlayerComponent implements OnChanges {
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
const blobFile = changes['blobFile'];
|
||||
// const nodeId = changes['nodeId'];
|
||||
|
||||
if (blobFile && blobFile.currentValue) {
|
||||
this.urlFile = this.contentService.createTrustedUrl(this.blobFile);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (nodeId && nodeId.currentValue) {
|
||||
// this.viewUtils.generateMediaTracksRendition(this.nodeId).then((tracks) => this.tracks = tracks);
|
||||
// }
|
||||
|
||||
if (!this.urlFile && !this.blobFile) {
|
||||
throw new Error('Attribute urlFile or blobFile is required');
|
||||
}
|
||||
|
@@ -80,6 +80,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
|
||||
@Output()
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
@Output()
|
||||
close = new EventEmitter<any>();
|
||||
|
||||
page: number;
|
||||
displayPage: number;
|
||||
totalPages: number;
|
||||
@@ -511,6 +514,8 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
|
||||
.afterClosed().subscribe((password) => {
|
||||
if (password) {
|
||||
callback(password);
|
||||
} else {
|
||||
this.close.emit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<div *ngIf="isLoading"
|
||||
class="adf-viewer-main">
|
||||
class="adf-viewer-render-main"
|
||||
fxFlexOrder="1"
|
||||
fxFlex="1 1 auto">
|
||||
<div class="adf-viewer-render-layout-content adf-viewer__fullscreen-container">
|
||||
<div class="adf-viewer-render-content-container">
|
||||
<ng-container *ngIf="isLoading">
|
||||
@@ -17,7 +19,9 @@
|
||||
</div>
|
||||
|
||||
<div *ngIf="!isLoading"
|
||||
class="adf-viewer-main">
|
||||
class="adf-viewer-render-main"
|
||||
fxFlexOrder="1"
|
||||
fxFlex="1 1 auto">
|
||||
<div class="adf-viewer-render-layout-content adf-viewer__fullscreen-container">
|
||||
<div class="adf-viewer-render-content-container" [ngSwitch]="viewerType">
|
||||
<ng-container *ngSwitchCase="'external'">
|
||||
@@ -37,6 +41,7 @@
|
||||
[urlFile]="urlFile"
|
||||
[fileName]="fileName"
|
||||
[cacheType]="cacheTypeForContent"
|
||||
(close)="onClose()"
|
||||
(error)="onUnsupportedFile()">
|
||||
|
||||
</adf-pdf-viewer>
|
||||
@@ -44,6 +49,7 @@
|
||||
|
||||
<ng-container *ngSwitchCase="'image'">
|
||||
<adf-img-viewer [urlFile]="urlFile"
|
||||
[readOnly]="readOnly"
|
||||
[fileName]="fileName"
|
||||
[blobFile]="blobFile"
|
||||
(error)="onUnsupportedFile()"
|
||||
@@ -54,6 +60,7 @@
|
||||
<ng-container *ngSwitchCase="'media'">
|
||||
<adf-media-player id="adf-mdedia-player"
|
||||
[urlFile]="urlFile"
|
||||
[tracks]="tracks"
|
||||
[mimeType]="mimeType"
|
||||
[blobFile]="blobFile"
|
||||
[fileName]="fileName"
|
||||
|
@@ -16,7 +16,7 @@
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.adf-viewer-render-layout-content {
|
||||
&-layout-content {
|
||||
@extend .adf-full-screen;
|
||||
|
||||
position: relative;
|
||||
|
@@ -15,18 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//TODO BETTER APPROACH FOR IMG EXTENSION submit
|
||||
//TODO uncomment readOnly
|
||||
//TODO TO UNDERSTAND THE LEFT AND RIGHT SIDEBAR
|
||||
//TODO uncomment media load subtitle
|
||||
//TODO rename allowGoBack allow close button
|
||||
//TODO prevent momentous unknown format
|
||||
//TODO null propagation
|
||||
//TODO viewer widget specialization in process service cloud
|
||||
//TODO Test close dialog password scenario
|
||||
//TODO Remove unused CSS
|
||||
//TODO FIX documentation
|
||||
//TODO Fix core viewer widget
|
||||
//TODO FIX unit test
|
||||
|
||||
import {
|
||||
Component, EventEmitter,
|
||||
@@ -37,6 +27,7 @@ import { Subject } from 'rxjs';
|
||||
import { ViewUtilService } from '../services/view-util.service';
|
||||
import { AppExtensionService, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Track } from "../models/viewer.model";
|
||||
|
||||
@Component({
|
||||
selector: 'adf-viewer-render',
|
||||
@@ -99,6 +90,14 @@ export class ViewerRenderComponent implements OnChanges, OnInit, OnDestroy {
|
||||
@Input()
|
||||
isLoading = false;
|
||||
|
||||
/** Enable when where is possible the editing functionalities */
|
||||
@Input()
|
||||
readOnly = true;
|
||||
|
||||
/** media subtitles for the media player*/
|
||||
@Input()
|
||||
tracks: Track[] = [];
|
||||
|
||||
/** Emitted when the filename extension changes. */
|
||||
@Output()
|
||||
extensionChange = new EventEmitter<string>();
|
||||
@@ -107,6 +106,10 @@ export class ViewerRenderComponent implements OnChanges, OnInit, OnDestroy {
|
||||
@Output()
|
||||
submitFile = new EventEmitter<Blob>();
|
||||
|
||||
/** Emitted when the img is submitted in the img viewer. */
|
||||
@Output()
|
||||
close = new EventEmitter<boolean>();
|
||||
|
||||
extensionTemplates: { template: TemplateRef<any>; isVisible: boolean }[] = [];
|
||||
extension: string;
|
||||
|
||||
@@ -200,4 +203,8 @@ export class ViewerRenderComponent implements OnChanges, OnInit, OnDestroy {
|
||||
this.viewerType = 'unknown';
|
||||
}
|
||||
|
||||
onClose() {
|
||||
this.close.next(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user