UNPKG

@limetech/lime-elements

Version:
138 lines 4.82 kB
import { EventEmitter } from '../../stencil-public-runtime'; import { Languages } from '../date-picker/date.types'; import { ListItem } from '../list-item/list-item.types'; import { OfficeViewer } from './file-viewer.types'; /** * This is a smart component that automatically detects * the most common file types such as image, audio, video, and text, * and properly displays them in the browser. * The component is also capable to render the most common office files. * * :::note * Image files will always be contained in their containers, which means * they automatically increase or decrease in size to fill their containing box * whilst preserving their aspect-ratio. * * Text and PDF files will also always respect the width and height of the * container in which the `limel-file-viewer` is loaded. * ::: * * For some file types such as text and images, the component will display a * download button and a button to open the file in a new browser tab. * This will allow users to preview the file in a fullscreen mode with the * browser and take advantage of for example native zooming and panning * functionalities. * * @exampleComponent limel-example-file-viewer-basic * @exampleComponent limel-example-file-viewer-office * @exampleComponent limel-example-file-viewer-eml * @exampleComponent limel-example-file-viewer-filename * @exampleComponent limel-example-file-viewer-inbuilt-actions * @exampleComponent limel-example-file-viewer-custom-actions * @exampleComponent limel-example-file-viewer-with-picker * * @beta */ export declare class FileViewer { /** * Link to the file */ url: string; /** * The name of the file that must also contains its extension. * This overrides the filename that the `url` ends with. * Useful when the `url` does not contain the filename. * When specified, the `filename` will be used as filename of * the downloaded file. */ filename?: string; /** * An optional alternative text, mainly for assistive technologies and screen readers. * It is used for only image files, as an `alt` attribute. * Should optimally hold a description of the image, * which is also displayed on the page if the image can't be loaded for some reason. */ alt?: string; /** * Displays a button that allows the user to view the file * in fullscreen mode. * Not displayed for office files! */ allowFullscreen?: boolean; /** * Displays a button that allows the user to open the file * in a new browser tab. * Not displayed for office files! */ allowOpenInNewTab?: boolean; /** * Displays a button that allows the user to download the file. * Note that due to the browser's security policies, * the file should be hosted on the same domain * for the download button to work properly. * Not displayed for office files! */ allowDownload?: boolean; /** * Defines the localization for translations. */ language: Languages; /** * Defines the third-party viewer that should be used to render * the content of office files, such as word processing documents, * presentations, or spreadsheets. */ officeViewer: OfficeViewer; /** * An array of custom actions that can be displayed * as an action menu on the file which is being displayed. */ actions: ListItem[]; /** * Emitted when a custom action is selected from the action menu. */ action: EventEmitter<ListItem>; HostElement: HTMLLimelFileViewerElement; private fullscreen; private isFullscreen; private fileType; /** * True while the file is being loaded. */ private loading; private fileUrl; private email?; private pdfBlobUrl?; constructor(); disconnectedCallback(): void; componentWillLoad(): Promise<void>; render(): any; protected watchUrl(newUrl: string, oldUrl: string): Promise<void>; private renderFileViewer; private renderPdf; private renderImage; private renderVideo; private renderAudio; private renderText; private renderEmail; private renderOffice; private isOfficeFileAccessibleViaURL; private getOfficeViewerUrl; private renderNoFileSupportMessage; private renderFileNotFoundMessage; private renderButtons; private renderToggleFullscreenButton; private renderDownloadButton; private renderOpenInNewTabButton; private renderActionMenu; private createURL; private loadPdf; private loadEmail; private loadDefault; private revokePdfBlobUrl; private handleToggleFullscreen; private emitOnAction; private sanitizeUrl; private getTranslation; } //# sourceMappingURL=file-viewer.d.ts.map