UNPKG

@alfresco/adf-core

Version:
180 lines (179 loc) 10 kB
import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { AppConfigService } from '../../app-config'; import { CloseButtonPosition, Track } from '../models/viewer.model'; import { ViewUtilService } from '../services/view-util.service'; import { ViewerMoreActionsComponent } from './viewer-more-actions.component'; import { ViewerOpenWithComponent } from './viewer-open-with.component'; import { ViewerSidebarComponent } from './viewer-sidebar.component'; import { ViewerToolbarComponent } from './viewer-toolbar.component'; import * as i0 from "@angular/core"; export declare class ViewerComponent<T> implements OnDestroy, OnInit, OnChanges { private el; dialog: MatDialog; private viewUtilsService; private appConfigService; private thumbnailService; get isInline(): boolean; toolbar: ViewerToolbarComponent; sidebar: ViewerSidebarComponent; mnuOpenWith: ViewerOpenWithComponent; mnuMoreActions: ViewerMoreActionsComponent; viewerTemplateExtensions: TemplateRef<any>; get CloseButtonPosition(): typeof CloseButtonPosition; /** * If you want to load an external file that does not come from ACS you * can use this URL to specify where to load the file from. */ urlFile: string; /** Loads a Blob File */ blobFile: Blob; /** Hide or show the viewer */ showViewer: boolean; /** Allows `back` navigation */ allowGoBack: boolean; /** Toggles the 'Full Screen' feature. */ allowFullScreen: boolean; /** Hide or show the toolbar */ showToolbar: boolean; /** * If `true` then show the Viewer as a full page over the current content. * Otherwise, fit inside the parent div. */ overlayMode: boolean; /** * Toggles before/next navigation. You can use the arrow buttons to navigate * between documents in the collection. */ allowNavigate: boolean; /** Toggles the "before" ("<") button. Requires `allowNavigate` to be enabled. */ canNavigateBefore: boolean; /** Toggles the next (">") button. Requires `allowNavigate` to be enabled. */ canNavigateNext: boolean; /** Allow the left the sidebar. */ allowLeftSidebar: boolean; /** Allow the right sidebar. */ allowRightSidebar: boolean; /** Toggles right sidebar visibility. Requires `allowRightSidebar` to be set to `true`. */ showRightSidebar: boolean; /** Toggles left sidebar visibility. Requires `allowLeftSidebar` to be set to `true`. */ showLeftSidebar: boolean; /** The template for the right sidebar. The template context contains the loaded node data. */ sidebarRightTemplate: TemplateRef<any>; /** The template for the left sidebar. The template context contains the loaded node data. */ sidebarLeftTemplate: TemplateRef<any>; /** Enable when where is possible the editing functionalities */ readOnly: boolean; /** * Controls which actions are enabled in the viewer. * Example: * { rotate: true, crop: false } will enable rotation but disable cropping. */ allowedEditActions: { [key: string]: boolean; }; /** media subtitles for the media player*/ tracks: Track[]; /** Overload mimeType*/ mimeType: string; /** * Context object available for binding by the local sidebarRightTemplate with let declarations. */ sidebarRightTemplateContext: T; /** * Context object available for binding by the local sidebarLeftTemplate with let declarations. */ sidebarLeftTemplateContext: T; /** * Change the close button position Right/Left. */ closeButtonPosition: CloseButtonPosition; /** Toggles the 'Info Button' */ hideInfoButton: boolean; /** Template containing ViewerExtensionDirective instances providing different viewer extensions based on supported file extension. */ viewerExtensions: TemplateRef<any>; /** Identifier of a node that is opened by the viewer. */ nodeId: string; /** Original node mime type, should be provided when renditions mime type is different. */ nodeMimeType: string; /** Custom error message to be displayed in the viewer. */ customError: string; /** Toggles dividers visibility */ showToolbarDividers: boolean; /** * Enable dialog box to allow user to download the previewed file, in case the preview is not responding for a set period of time. */ enableDownloadPrompt: boolean; /** * Enable reminder dialogs to prompt user to download the file, in case the preview is not responding for a set period of time. */ enableDownloadPromptReminder: boolean; /** * Initial time in seconds to wait before giving the first prompt to user to download the file */ downloadPromptDelay: number; /** * Time in seconds to wait before giving the second and consequent reminders to the user to download the file. */ downloadPromptReminderDelay: number; /** * Emitted when user clicks on download button on download prompt dialog. */ downloadFile: EventEmitter<void>; /** Emitted when user clicks 'Navigate Before' ("<") button. */ navigateBefore: EventEmitter<KeyboardEvent | MouseEvent>; /** Emitted when user clicks 'Navigate Next' (">") button. */ navigateNext: EventEmitter<KeyboardEvent | MouseEvent>; /** Emitted when the viewer close */ showViewerChange: EventEmitter<boolean>; /** Emitted when the img is submitted in the img viewer. */ submitFile: EventEmitter<Blob>; private closeViewer; private keyDown$; private isDialogVisible; private _fileName; private _fileNameWithoutExtension; private _fileExtension; displayName: string; displayTitle: string; downloadPromptTimer: number; downloadPromptReminderTimer: number; mimeTypeIconUrl: string; private readonly destroyRef; /** Override Content title. */ set title(title: string); /** Override Content filename. */ set fileName(fileName: string); get fileName(): string; get fileExtension(): string; get fileNameWithoutExtension(): string; constructor(el: ElementRef, dialog: MatDialog, viewUtilsService: ViewUtilService, appConfigService: AppConfigService); ngOnChanges(changes: SimpleChanges): void; ngOnInit(): void; private closeOverlayManager; onNavigateBeforeClick(event: MouseEvent | KeyboardEvent): void; onNavigateNextClick(event: MouseEvent | KeyboardEvent): void; /** * close the viewer */ onClose(): void; toggleRightSidebar(): void; toggleLeftSidebar(): void; handleKeyboardEvent(event: KeyboardEvent): void; /** * Triggers full screen mode with a main content area displayed. */ enterFullScreen(): void; onSubmitFile(newImageBlob: Blob): void; ngOnDestroy(): void; getDisplayTruncatedValue(value: string): string; private configureAndInitDownloadPrompt; private configureDownloadPromptProperties; private initDownloadPrompt; private showOrClearDownloadPrompt; clearDownloadPromptTimeouts(): void; private showDownloadPrompt; private resetLoadingSpinner; static ɵfac: i0.ɵɵFactoryDeclaration<ViewerComponent<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ViewerComponent<any>, "adf-viewer", never, { "urlFile": { "alias": "urlFile"; "required": false; }; "blobFile": { "alias": "blobFile"; "required": false; }; "showViewer": { "alias": "showViewer"; "required": false; }; "allowGoBack": { "alias": "allowGoBack"; "required": false; }; "allowFullScreen": { "alias": "allowFullScreen"; "required": false; }; "showToolbar": { "alias": "showToolbar"; "required": false; }; "overlayMode": { "alias": "overlayMode"; "required": false; }; "allowNavigate": { "alias": "allowNavigate"; "required": false; }; "canNavigateBefore": { "alias": "canNavigateBefore"; "required": false; }; "canNavigateNext": { "alias": "canNavigateNext"; "required": false; }; "allowLeftSidebar": { "alias": "allowLeftSidebar"; "required": false; }; "allowRightSidebar": { "alias": "allowRightSidebar"; "required": false; }; "showRightSidebar": { "alias": "showRightSidebar"; "required": false; }; "showLeftSidebar": { "alias": "showLeftSidebar"; "required": false; }; "sidebarRightTemplate": { "alias": "sidebarRightTemplate"; "required": false; }; "sidebarLeftTemplate": { "alias": "sidebarLeftTemplate"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "allowedEditActions": { "alias": "allowedEditActions"; "required": false; }; "tracks": { "alias": "tracks"; "required": false; }; "mimeType": { "alias": "mimeType"; "required": false; }; "sidebarRightTemplateContext": { "alias": "sidebarRightTemplateContext"; "required": false; }; "sidebarLeftTemplateContext": { "alias": "sidebarLeftTemplateContext"; "required": false; }; "closeButtonPosition": { "alias": "closeButtonPosition"; "required": false; }; "hideInfoButton": { "alias": "hideInfoButton"; "required": false; }; "viewerExtensions": { "alias": "viewerExtensions"; "required": false; }; "nodeId": { "alias": "nodeId"; "required": false; }; "nodeMimeType": { "alias": "nodeMimeType"; "required": false; }; "customError": { "alias": "customError"; "required": false; }; "showToolbarDividers": { "alias": "showToolbarDividers"; "required": false; }; "title": { "alias": "title"; "required": false; }; "fileName": { "alias": "fileName"; "required": false; }; }, { "downloadFile": "downloadFile"; "navigateBefore": "navigateBefore"; "navigateNext": "navigateNext"; "showViewerChange": "showViewerChange"; "submitFile": "submitFile"; }, ["toolbar", "sidebar", "mnuOpenWith", "mnuMoreActions", "viewerTemplateExtensions"], ["adf-viewer-toolbar", "adf-viewer-toolbar-actions", "adf-viewer-open-with", "adf-viewer-toolbar-custom-actions", "adf-viewer-more-actions", "adf-viewer-sidebar", "adf-viewer-sidebar"], true, never>; }