@monolith-forensics/monolith-ui 1.2.55 → 1.2.56
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.
|
@@ -98,6 +98,9 @@ const StyledContainer = styled.div.attrs({ className: "FileViewer-container" })
|
|
|
98
98
|
|
|
99
99
|
&:hover {
|
|
100
100
|
background-color: ${(props) => props.theme.palette.primary.main};
|
|
101
|
+
border-radius: 10px;
|
|
102
|
+
border: 4px solid rgba(0, 0, 0, 0);
|
|
103
|
+
background-clip: padding-box;
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
2
|
import { useState } from "react";
|
|
14
3
|
import { Document, Page, pdfjs } from "react-pdf";
|
|
15
4
|
import "react-pdf/dist/esm/Page/AnnotationLayer.css";
|
|
@@ -17,7 +6,13 @@ import "react-pdf/dist/esm/Page/TextLayer.css";
|
|
|
17
6
|
import styled from "styled-components";
|
|
18
7
|
import Loader from "../../Loader";
|
|
19
8
|
pdfjs.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.mjs", import.meta.url).toString();
|
|
20
|
-
const StyledContainer = styled.div
|
|
9
|
+
const StyledContainer = styled.div.attrs({
|
|
10
|
+
className: "PdfViewer-container",
|
|
11
|
+
}) `
|
|
12
|
+
flex: 1 1 auto;
|
|
13
|
+
height: 0px;
|
|
14
|
+
width: 100%;
|
|
15
|
+
`;
|
|
21
16
|
const StyledDocument = styled(Document).attrs({
|
|
22
17
|
className: "PdfViewer-document",
|
|
23
18
|
}) ``;
|
|
@@ -34,18 +29,14 @@ const StyledLoader = styled.div `
|
|
|
34
29
|
align-items: center;
|
|
35
30
|
gap: 10px;
|
|
36
31
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
left: 50%;
|
|
40
|
-
transform: translate(-50%, -50%);
|
|
32
|
+
height: 100%;
|
|
33
|
+
margin: auto;
|
|
41
34
|
`;
|
|
42
35
|
export const PdfViewer = ({ file, zoomFactor = 1, isPending }) => {
|
|
43
36
|
const [loading, setLoading] = useState(true);
|
|
44
37
|
const [numPages, setNumPages] = useState();
|
|
45
38
|
const [pageNumber, setPageNumber] = useState(1);
|
|
46
|
-
function onDocumentLoadSuccess(
|
|
47
|
-
var { numPages } = _a, rest = __rest(_a, ["numPages"]);
|
|
48
|
-
console.log(rest);
|
|
39
|
+
function onDocumentLoadSuccess({ numPages }) {
|
|
49
40
|
setLoading(false);
|
|
50
41
|
setNumPages(numPages);
|
|
51
42
|
}
|
|
@@ -54,7 +45,7 @@ export const PdfViewer = ({ file, zoomFactor = 1, isPending }) => {
|
|
|
54
45
|
if (isPending) {
|
|
55
46
|
return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading PDF..." })] }));
|
|
56
47
|
}
|
|
57
|
-
return (
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
return (_jsxs(StyledContainer, { className: "PdfViewer", children: [loading && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading PDF..." })] })), _jsx(StyledDocument, { file: file.url, onLoadStart: () => setLoading(true), onLoadSuccess: onDocumentLoadSuccess, loading: _jsx(_Fragment, {}), onClick: (e) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
}, children: Array.from(new Array(numPages), (el, index) => (_jsx(StyledPage, { pageNumber: index + 1, scale: zoomFactor, width: vw }, `page_${index + 1}`))) })] }));
|
|
60
51
|
};
|