@cannyminds/dms-file-viewers 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/viewers/AudioViewer.d.mts +6 -0
- package/dist/components/viewers/AudioViewer.d.ts +6 -0
- package/dist/components/viewers/DefaultViewer.d.mts +6 -0
- package/dist/components/viewers/DefaultViewer.d.ts +6 -0
- package/dist/components/viewers/ImageViewer.d.mts +6 -0
- package/dist/components/viewers/ImageViewer.d.ts +6 -0
- package/dist/components/viewers/PDFViewer.d.mts +28 -0
- package/dist/components/viewers/PDFViewer.d.ts +28 -0
- package/dist/components/viewers/TIFFViewer.d.mts +6 -0
- package/dist/components/viewers/TIFFViewer.d.ts +6 -0
- package/dist/components/viewers/TextViewer.d.mts +6 -0
- package/dist/components/viewers/TextViewer.d.ts +6 -0
- package/dist/components/viewers/VideoViewer.d.mts +6 -0
- package/dist/components/viewers/VideoViewer.d.ts +6 -0
- package/dist/index.d.mts +39 -0
- package/dist/index.d.ts +39 -0
- package/dist/types-CquKzJLE.d.mts +43 -0
- package/dist/types-CquKzJLE.d.ts +43 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { F as FileViewerProps } from '../../types-CquKzJLE.mjs';
|
|
3
|
+
|
|
4
|
+
interface PDFViewerMethods {
|
|
5
|
+
zoomIn: () => void;
|
|
6
|
+
zoomOut: () => void;
|
|
7
|
+
setZoom: (level: number) => void;
|
|
8
|
+
resetZoom: () => void;
|
|
9
|
+
getZoom: () => number;
|
|
10
|
+
goToPage: (page: number) => void;
|
|
11
|
+
getCurrentPage: () => number;
|
|
12
|
+
getTotalPages: () => number;
|
|
13
|
+
nextPage: () => void;
|
|
14
|
+
previousPage: () => void;
|
|
15
|
+
goToFirstPage: () => void;
|
|
16
|
+
goToLastPage: () => void;
|
|
17
|
+
searchText: (keyword: string) => Promise<any>;
|
|
18
|
+
nextResult: () => number;
|
|
19
|
+
previousResult: () => number;
|
|
20
|
+
goToResult: (index: number) => number;
|
|
21
|
+
stopSearch: () => void;
|
|
22
|
+
getSearchState: () => any;
|
|
23
|
+
getSelectedText: () => string;
|
|
24
|
+
clearSelection: () => void;
|
|
25
|
+
}
|
|
26
|
+
declare const PDFViewer: React.ForwardRefExoticComponent<Omit<FileViewerProps, "ref"> & React.RefAttributes<PDFViewerMethods>>;
|
|
27
|
+
|
|
28
|
+
export { PDFViewer, type PDFViewerMethods };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { F as FileViewerProps } from '../../types-CquKzJLE.js';
|
|
3
|
+
|
|
4
|
+
interface PDFViewerMethods {
|
|
5
|
+
zoomIn: () => void;
|
|
6
|
+
zoomOut: () => void;
|
|
7
|
+
setZoom: (level: number) => void;
|
|
8
|
+
resetZoom: () => void;
|
|
9
|
+
getZoom: () => number;
|
|
10
|
+
goToPage: (page: number) => void;
|
|
11
|
+
getCurrentPage: () => number;
|
|
12
|
+
getTotalPages: () => number;
|
|
13
|
+
nextPage: () => void;
|
|
14
|
+
previousPage: () => void;
|
|
15
|
+
goToFirstPage: () => void;
|
|
16
|
+
goToLastPage: () => void;
|
|
17
|
+
searchText: (keyword: string) => Promise<any>;
|
|
18
|
+
nextResult: () => number;
|
|
19
|
+
previousResult: () => number;
|
|
20
|
+
goToResult: (index: number) => number;
|
|
21
|
+
stopSearch: () => void;
|
|
22
|
+
getSearchState: () => any;
|
|
23
|
+
getSelectedText: () => string;
|
|
24
|
+
clearSelection: () => void;
|
|
25
|
+
}
|
|
26
|
+
declare const PDFViewer: React.ForwardRefExoticComponent<Omit<FileViewerProps, "ref"> & React.RefAttributes<PDFViewerMethods>>;
|
|
27
|
+
|
|
28
|
+
export { PDFViewer, type PDFViewerMethods };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { F as FileViewerProps, V as ViewerInfo, a as FileViewerComponent } from './types-CquKzJLE.mjs';
|
|
3
|
+
export { c as DynamicViewerImport, D as DynamicViewerRegistry, b as ViewerRegistry } from './types-CquKzJLE.mjs';
|
|
4
|
+
export { TextViewer } from './components/viewers/TextViewer.mjs';
|
|
5
|
+
export { ImageViewer } from './components/viewers/ImageViewer.mjs';
|
|
6
|
+
export { PDFViewer } from './components/viewers/PDFViewer.mjs';
|
|
7
|
+
export { VideoViewer } from './components/viewers/VideoViewer.mjs';
|
|
8
|
+
export { AudioViewer } from './components/viewers/AudioViewer.mjs';
|
|
9
|
+
export { TIFFViewer } from './components/viewers/TIFFViewer.mjs';
|
|
10
|
+
export { DefaultViewer } from './components/viewers/DefaultViewer.mjs';
|
|
11
|
+
|
|
12
|
+
interface FileViewerComponentProps extends Partial<FileViewerProps> {
|
|
13
|
+
customRegistry?: Record<string, ViewerInfo>;
|
|
14
|
+
loadingComponent?: React.ComponentType<{
|
|
15
|
+
fileName?: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
}>;
|
|
18
|
+
errorComponent?: React.ComponentType<{
|
|
19
|
+
error: Error;
|
|
20
|
+
retry: () => void;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
declare const FileViewer: React.FC<FileViewerComponentProps>;
|
|
24
|
+
|
|
25
|
+
interface FileIconProps {
|
|
26
|
+
ext?: string;
|
|
27
|
+
size?: number;
|
|
28
|
+
sx?: React.CSSProperties;
|
|
29
|
+
}
|
|
30
|
+
declare const FileIcon: React.FC<FileIconProps>;
|
|
31
|
+
|
|
32
|
+
declare const dynamicViewerRegistry: Record<string, ViewerInfo>;
|
|
33
|
+
declare const getViewerInfo: (extension: string) => ViewerInfo;
|
|
34
|
+
declare const getViewerComponent: (extension: string, customRegistry?: Record<string, ViewerInfo>) => Promise<FileViewerComponent>;
|
|
35
|
+
|
|
36
|
+
declare const getFileExtension: (fileName: string) => string;
|
|
37
|
+
declare const getMimeTypeFromExtension: (extension: string) => string;
|
|
38
|
+
|
|
39
|
+
export { FileIcon, FileViewer, FileViewerComponent, FileViewerProps, ViewerInfo, dynamicViewerRegistry, getFileExtension, getMimeTypeFromExtension, getViewerComponent, getViewerInfo };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { F as FileViewerProps, V as ViewerInfo, a as FileViewerComponent } from './types-CquKzJLE.js';
|
|
3
|
+
export { c as DynamicViewerImport, D as DynamicViewerRegistry, b as ViewerRegistry } from './types-CquKzJLE.js';
|
|
4
|
+
export { TextViewer } from './components/viewers/TextViewer.js';
|
|
5
|
+
export { ImageViewer } from './components/viewers/ImageViewer.js';
|
|
6
|
+
export { PDFViewer } from './components/viewers/PDFViewer.js';
|
|
7
|
+
export { VideoViewer } from './components/viewers/VideoViewer.js';
|
|
8
|
+
export { AudioViewer } from './components/viewers/AudioViewer.js';
|
|
9
|
+
export { TIFFViewer } from './components/viewers/TIFFViewer.js';
|
|
10
|
+
export { DefaultViewer } from './components/viewers/DefaultViewer.js';
|
|
11
|
+
|
|
12
|
+
interface FileViewerComponentProps extends Partial<FileViewerProps> {
|
|
13
|
+
customRegistry?: Record<string, ViewerInfo>;
|
|
14
|
+
loadingComponent?: React.ComponentType<{
|
|
15
|
+
fileName?: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
}>;
|
|
18
|
+
errorComponent?: React.ComponentType<{
|
|
19
|
+
error: Error;
|
|
20
|
+
retry: () => void;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
declare const FileViewer: React.FC<FileViewerComponentProps>;
|
|
24
|
+
|
|
25
|
+
interface FileIconProps {
|
|
26
|
+
ext?: string;
|
|
27
|
+
size?: number;
|
|
28
|
+
sx?: React.CSSProperties;
|
|
29
|
+
}
|
|
30
|
+
declare const FileIcon: React.FC<FileIconProps>;
|
|
31
|
+
|
|
32
|
+
declare const dynamicViewerRegistry: Record<string, ViewerInfo>;
|
|
33
|
+
declare const getViewerInfo: (extension: string) => ViewerInfo;
|
|
34
|
+
declare const getViewerComponent: (extension: string, customRegistry?: Record<string, ViewerInfo>) => Promise<FileViewerComponent>;
|
|
35
|
+
|
|
36
|
+
declare const getFileExtension: (fileName: string) => string;
|
|
37
|
+
declare const getMimeTypeFromExtension: (extension: string) => string;
|
|
38
|
+
|
|
39
|
+
export { FileIcon, FileViewer, FileViewerComponent, FileViewerProps, ViewerInfo, dynamicViewerRegistry, getFileExtension, getMimeTypeFromExtension, getViewerComponent, getViewerInfo };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface FileViewerProps {
|
|
2
|
+
file?: File;
|
|
3
|
+
url?: string;
|
|
4
|
+
fileName?: string;
|
|
5
|
+
fileSize?: number;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
width?: number | string;
|
|
10
|
+
height?: number | string;
|
|
11
|
+
onLoad?: () => void;
|
|
12
|
+
onError?: (error: Error) => void;
|
|
13
|
+
onPasswordRequest?: (fileName?: string) => Promise<string | null>;
|
|
14
|
+
showPageCount?: boolean;
|
|
15
|
+
showPageNavigation?: boolean;
|
|
16
|
+
showZoomControls?: boolean;
|
|
17
|
+
showDownload?: boolean;
|
|
18
|
+
showPrint?: boolean;
|
|
19
|
+
showSearch?: boolean;
|
|
20
|
+
showMetadata?: boolean;
|
|
21
|
+
showProperties?: boolean;
|
|
22
|
+
onMetadataClick?: () => void;
|
|
23
|
+
onPropertiesClick?: () => void;
|
|
24
|
+
onDownloadClick?: () => void;
|
|
25
|
+
onPrintClick?: () => void;
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
type FileViewerComponent = React.ComponentType<FileViewerProps>;
|
|
29
|
+
interface ViewerRegistry {
|
|
30
|
+
[extension: string]: FileViewerComponent;
|
|
31
|
+
}
|
|
32
|
+
type DynamicViewerImport = () => Promise<{
|
|
33
|
+
default: FileViewerComponent;
|
|
34
|
+
}>;
|
|
35
|
+
interface DynamicViewerRegistry {
|
|
36
|
+
[extension: string]: DynamicViewerImport;
|
|
37
|
+
}
|
|
38
|
+
interface ViewerInfo {
|
|
39
|
+
type: 'text' | 'image' | 'pdf' | 'video' | 'audio' | 'tiff' | 'default';
|
|
40
|
+
loader: DynamicViewerImport;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type { DynamicViewerRegistry as D, FileViewerProps as F, ViewerInfo as V, FileViewerComponent as a, ViewerRegistry as b, DynamicViewerImport as c };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface FileViewerProps {
|
|
2
|
+
file?: File;
|
|
3
|
+
url?: string;
|
|
4
|
+
fileName?: string;
|
|
5
|
+
fileSize?: number;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
width?: number | string;
|
|
10
|
+
height?: number | string;
|
|
11
|
+
onLoad?: () => void;
|
|
12
|
+
onError?: (error: Error) => void;
|
|
13
|
+
onPasswordRequest?: (fileName?: string) => Promise<string | null>;
|
|
14
|
+
showPageCount?: boolean;
|
|
15
|
+
showPageNavigation?: boolean;
|
|
16
|
+
showZoomControls?: boolean;
|
|
17
|
+
showDownload?: boolean;
|
|
18
|
+
showPrint?: boolean;
|
|
19
|
+
showSearch?: boolean;
|
|
20
|
+
showMetadata?: boolean;
|
|
21
|
+
showProperties?: boolean;
|
|
22
|
+
onMetadataClick?: () => void;
|
|
23
|
+
onPropertiesClick?: () => void;
|
|
24
|
+
onDownloadClick?: () => void;
|
|
25
|
+
onPrintClick?: () => void;
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
type FileViewerComponent = React.ComponentType<FileViewerProps>;
|
|
29
|
+
interface ViewerRegistry {
|
|
30
|
+
[extension: string]: FileViewerComponent;
|
|
31
|
+
}
|
|
32
|
+
type DynamicViewerImport = () => Promise<{
|
|
33
|
+
default: FileViewerComponent;
|
|
34
|
+
}>;
|
|
35
|
+
interface DynamicViewerRegistry {
|
|
36
|
+
[extension: string]: DynamicViewerImport;
|
|
37
|
+
}
|
|
38
|
+
interface ViewerInfo {
|
|
39
|
+
type: 'text' | 'image' | 'pdf' | 'video' | 'audio' | 'tiff' | 'default';
|
|
40
|
+
loader: DynamicViewerImport;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type { DynamicViewerRegistry as D, FileViewerProps as F, ViewerInfo as V, FileViewerComponent as a, ViewerRegistry as b, DynamicViewerImport as c };
|