@topconsultnpm/sdkui-react 6.20.0-dev1.23 → 6.20.0-dev1.24
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/lib/helper/TMPdfViewer.js +10 -1
- package/package.json +2 -2
|
@@ -6,7 +6,6 @@ import { LoadIndicator } from 'devextreme-react/load-indicator';
|
|
|
6
6
|
import { IconCloseOutline } from "./TMIcons";
|
|
7
7
|
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
8
8
|
import { TMColors } from "../utils/theme";
|
|
9
|
-
pdfjs.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();
|
|
10
9
|
const PDFViewerContainer = styled.div `
|
|
11
10
|
width: 100%;
|
|
12
11
|
height: 100%;
|
|
@@ -64,6 +63,16 @@ const TMPdfViewer = (props) => {
|
|
|
64
63
|
(window.matchMedia?.('(hover: none) and (pointer: coarse)').matches ?? false) ||
|
|
65
64
|
// Touch-capable devices excluding desktop OS
|
|
66
65
|
(navigator.maxTouchPoints > 1 && !/Win|Mac|Linux x86_64/i.test(userAgent));
|
|
66
|
+
// Configura il worker PDF.js solo per mobile (react-pdf)
|
|
67
|
+
if (isMobileDevice && !pdfjs.GlobalWorkerOptions.workerSrc) {
|
|
68
|
+
try {
|
|
69
|
+
pdfjs.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.warn('Worker PDF.js locale non disponibile, uso CDN fallback');
|
|
73
|
+
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.js`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
67
76
|
setIsMobile(isMobileDevice);
|
|
68
77
|
};
|
|
69
78
|
checkIsMobile();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.20.0-dev1.
|
|
3
|
+
"version": "6.20.0-dev1.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devextreme-react": "25.1.7",
|
|
46
46
|
"exceljs": "^4.4.0",
|
|
47
47
|
"htmlparser2": "^10.0.0",
|
|
48
|
-
"pdfjs-dist": "
|
|
48
|
+
"pdfjs-dist": "5.4.296",
|
|
49
49
|
"react-pdf": "^10.3.0",
|
|
50
50
|
"react-router-dom": "^6.15.0",
|
|
51
51
|
"styled-components": "^6.1.1"
|