@nocobase/plugin-file-manager
Version:
Provides files storage services with files collection template and attachment field.
52 lines (51 loc) • 2.55 kB
TypeScript
/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import React from 'react';
import type { DocumentInitParameters } from 'pdfjs-dist/types/src/display/api';
export interface FilePreviewerProps {
file: any;
index: number;
list: any[];
open?: boolean;
onOpenChange?: (open: boolean) => void;
onSwitchIndex?: (index: number) => void;
onClose?: () => void;
onDownload: (file: any) => void;
}
export interface FilePreviewType {
match(file: any): boolean;
getThumbnailURL?: (file: any) => string | null;
Previewer?: React.ComponentType<FilePreviewerProps>;
}
export declare class FilePreviewTypes {
types: FilePreviewType[];
add(type: FilePreviewType): void;
getTypeByFile(file: any): Omit<FilePreviewType, 'match'> | undefined;
}
export declare const filePreviewTypes: FilePreviewTypes;
export declare function normalizePreviewFile(file: any): any;
export declare function getPreviewFileUrl(file: any): any;
export declare function getFileUrl(file: any): any;
export declare function matchMimetype(file: any, type: string): any;
export declare const getFileExt: (file: any, url?: string) => string;
export declare const isActiveContentFile: (file: any, url?: string) => boolean;
export declare const isPdfFile: (file: any, url?: string) => boolean;
export declare const isSameOriginUrl: (url?: string) => boolean;
export declare const getFileName: (file: any, url?: string) => any;
export declare const getDownloadFileName: (file: any, url?: string) => string;
export declare const getFallbackIcon: (file: any, url?: string) => string;
export declare const getPreviewThumbnailUrl: (file: any) => string;
export declare const wrapWithModalPreviewer: (Previewer: React.ComponentType<FilePreviewerProps>) => (props: FilePreviewerProps) => React.JSX.Element;
export declare const getPdfPreviewResourceOptions: () => Pick<DocumentInitParameters, 'cMapPacked' | 'cMapUrl' | 'standardFontDataUrl'>;
export declare const getPdfPreviewApiSrc: () => string;
export declare const getPdfPreviewWorkerSrc: () => string;
type PdfPreviewErrorCode = 'resources' | 'file' | 'document';
export declare const getPdfPreviewErrorCode: (error: unknown) => PdfPreviewErrorCode;
export declare const FilePreviewRenderer: (props: FilePreviewerProps) => React.JSX.Element;
export {};