@monolith-forensics/monolith-ui 1.2.56 → 1.2.58
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.
|
@@ -125,9 +125,10 @@ const StyledInnerContainer = styled.div.attrs({
|
|
|
125
125
|
}
|
|
126
126
|
`;
|
|
127
127
|
const resolveViewerType = (file) => {
|
|
128
|
-
|
|
128
|
+
var _a, _b;
|
|
129
|
+
let ext = (_a = file === null || file === void 0 ? void 0 : file.ext) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
129
130
|
if (!ext) {
|
|
130
|
-
ext = file.name.split(".").pop();
|
|
131
|
+
ext = (_b = file.name.split(".").pop()) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
131
132
|
}
|
|
132
133
|
if (!ext) {
|
|
133
134
|
return ViewerTypes.Code;
|
|
@@ -159,6 +160,8 @@ export const FileViewer = ({ file, open, isPending, onClose }) => {
|
|
|
159
160
|
const [zoomFactor, setZoomFactor] = useState(1);
|
|
160
161
|
if (!open)
|
|
161
162
|
return null;
|
|
163
|
+
if (!file)
|
|
164
|
+
return null;
|
|
162
165
|
const viewerType = resolveViewerType(file);
|
|
163
166
|
const handleBackgroundClick = (e) => {
|
|
164
167
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
@@ -43,9 +43,9 @@ export const PdfViewer = ({ file, zoomFactor = 1, isPending }) => {
|
|
|
43
43
|
// viewport width
|
|
44
44
|
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) / 1.15;
|
|
45
45
|
if (isPending) {
|
|
46
|
-
return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading
|
|
46
|
+
return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading File..." })] }));
|
|
47
47
|
}
|
|
48
|
-
return (_jsxs(StyledContainer, { className: "PdfViewer", children: [loading && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading
|
|
48
|
+
return (_jsxs(StyledContainer, { className: "PdfViewer", children: [loading && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading File..." })] })), _jsx(StyledDocument, { file: file.url, onLoadStart: () => setLoading(true), onLoadSuccess: onDocumentLoadSuccess, loading: _jsx(_Fragment, {}), onClick: (e) => {
|
|
49
49
|
e.stopPropagation();
|
|
50
50
|
}, children: Array.from(new Array(numPages), (el, index) => (_jsx(StyledPage, { pageNumber: index + 1, scale: zoomFactor, width: vw }, `page_${index + 1}`))) })] }));
|
|
51
51
|
};
|