@pipelinesolucoes/display 1.0.6 → 1.0.7
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.
|
@@ -11,4 +11,4 @@ export type VisualizadorPdfBaseProps = {
|
|
|
11
11
|
iconColor?: string;
|
|
12
12
|
scale?: number;
|
|
13
13
|
};
|
|
14
|
-
export declare function VisualizadorPdfBase({ fileUrl, width, height, iconColor, scale }: VisualizadorPdfBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function VisualizadorPdfBase({ fileUrl, width, height, iconColor, scale, }: VisualizadorPdfBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,8 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Box, IconButton, Stack, styled, Typography, useTheme } from "@mui/material";
|
|
5
5
|
import { Document, Page, pdfjs } from "react-pdf";
|
|
6
|
-
import ArrowCircleLeftIcon from
|
|
7
|
-
import ArrowCircleRightIcon from
|
|
6
|
+
import ArrowCircleLeftIcon from "@mui/icons-material/ArrowCircleLeft";
|
|
7
|
+
import ArrowCircleRightIcon from "@mui/icons-material/ArrowCircleRight";
|
|
8
|
+
if (typeof window !== "undefined") {
|
|
9
|
+
pdfjs.GlobalWorkerOptions.workerSrc = "/pdf.worker.min.mjs";
|
|
10
|
+
}
|
|
8
11
|
export const AnteriorIcon = styled(ArrowCircleLeftIcon, {
|
|
9
12
|
shouldForwardProp: (prop) => prop !== "iconColor",
|
|
10
13
|
})(({ iconColor }) => ({
|
|
@@ -17,19 +20,18 @@ export const ProximoIcon = styled(ArrowCircleRightIcon, {
|
|
|
17
20
|
color: iconColor,
|
|
18
21
|
fontSize: "24px",
|
|
19
22
|
}));
|
|
20
|
-
|
|
21
|
-
export function VisualizadorPdfBase({ fileUrl, width = '100%', height = "480px", iconColor = "black", scale = 1.5 }) {
|
|
23
|
+
export function VisualizadorPdfBase({ fileUrl, width = "100%", height = "480px", iconColor = "black", scale = 1.5, }) {
|
|
22
24
|
const theme = useTheme();
|
|
23
25
|
const [numPages, setNumPages] = useState(0);
|
|
24
26
|
const [pageNumber, setPageNumber] = useState(1);
|
|
25
27
|
return (_jsxs(Box, { sx: {
|
|
26
|
-
width
|
|
27
|
-
height
|
|
28
|
-
}, children: [_jsxs(Stack, { direction: "row", spacing: "16px", alignItems: "center", justifyContent: "center", padding: "16px", width: "100%", children: [_jsx(IconButton, { "aria-label": "botao anterior", disabled: pageNumber <= 1, onClick: () => setPageNumber((prev) => prev - 1), children: _jsx(AnteriorIcon, { iconColor: iconColor }) }), _jsxs(Typography, { variant: "caption", color: theme.palette.text.primary, children: ["P\u00E1gina ", pageNumber, " de ", numPages || "..."] }), _jsx(IconButton, { "aria-label": "botao proximo", disabled: pageNumber >= numPages, onClick: () => setPageNumber((prev) => prev + 1), children: _jsx(ProximoIcon, { iconColor: iconColor }) })] }), _jsx(Box, { sx: {
|
|
28
|
+
width,
|
|
29
|
+
height,
|
|
30
|
+
}, children: [_jsxs(Stack, { direction: "row", spacing: "16px", alignItems: "center", justifyContent: "center", padding: "16px", width: "100%", children: [_jsx(IconButton, { "aria-label": "botao anterior", disabled: pageNumber <= 1, onClick: () => setPageNumber((prev) => Math.max(prev - 1, 1)), children: _jsx(AnteriorIcon, { iconColor: iconColor }) }), _jsxs(Typography, { variant: "caption", color: theme.palette.text.primary, children: ["P\u00E1gina ", pageNumber, " de ", numPages || "..."] }), _jsx(IconButton, { "aria-label": "botao proximo", disabled: !numPages || pageNumber >= numPages, onClick: () => setPageNumber((prev) => Math.min(prev + 1, numPages)), children: _jsx(ProximoIcon, { iconColor: iconColor }) })] }), _jsx(Box, { sx: {
|
|
29
31
|
display: "flex",
|
|
30
32
|
justifyContent: "center",
|
|
31
33
|
overflow: "auto",
|
|
32
|
-
height: `calc(${height} -
|
|
34
|
+
height: `calc(${height} - 64px)`,
|
|
33
35
|
width: "100%",
|
|
34
36
|
}, children: _jsx(Document, { file: fileUrl, onLoadSuccess: ({ numPages }) => {
|
|
35
37
|
setNumPages(numPages);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisualizadorPdfBase.js","sourceRoot":"","sources":["../../src/components/VisualizadorPdfBase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AACtE,OAAO,oBAAoB,MAAM,sCAAsC,CAAC;AAExE,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,mBAAmB,EAAE;IACtD,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,WAAW;CAClD,CAAC,
|
|
1
|
+
{"version":3,"file":"VisualizadorPdfBase.js","sourceRoot":"","sources":["../../src/components/VisualizadorPdfBase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AACtE,OAAO,oBAAoB,MAAM,sCAAsC,CAAC;AAExE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,KAAK,CAAC,mBAAmB,CAAC,SAAS,GAAG,qBAAqB,CAAC;AAC9D,CAAC;AAED,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