@topconsultnpm/sdkui-react 6.21.0-dev2.54 → 6.21.0-dev2.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.
|
@@ -567,53 +567,6 @@ export const useDocumentOperations = (props) => {
|
|
|
567
567
|
onClick: () => openEditPdfCallback(selectedDcmtInfos, refreshDocumentPreview),
|
|
568
568
|
};
|
|
569
569
|
};
|
|
570
|
-
const printMenuItem = () => {
|
|
571
|
-
// Take the first document (used for validation checks)
|
|
572
|
-
const firstDoc = selectedDcmtInfos?.[0];
|
|
573
|
-
// Check if the selected document is a PDF
|
|
574
|
-
const isPdf = firstDoc?.FILEEXT?.toLowerCase() === "pdf";
|
|
575
|
-
return {
|
|
576
|
-
id: 'print',
|
|
577
|
-
icon: _jsx("i", { className: "dx-icon-print", style: { fontSize: '20px' } }),
|
|
578
|
-
name: SDKUI_Localizator.Print,
|
|
579
|
-
operationType: 'singleRow',
|
|
580
|
-
disabled: !isPdf || isDisabledForSingleRow(),
|
|
581
|
-
onClick: isPdf ? async () => {
|
|
582
|
-
const handlePrint = async (file, _dcmtInfo) => {
|
|
583
|
-
const fileURL = window.URL.createObjectURL(file);
|
|
584
|
-
// Usa un iframe nascosto con sandbox per:
|
|
585
|
-
// 1. Bloccare l'esecuzione di JavaScript nel PDF
|
|
586
|
-
// 2. Non aprire un nuovo tab
|
|
587
|
-
const printFrame = document.createElement('iframe');
|
|
588
|
-
printFrame.style.position = 'fixed';
|
|
589
|
-
printFrame.style.right = '0';
|
|
590
|
-
printFrame.style.bottom = '0';
|
|
591
|
-
printFrame.style.width = '0';
|
|
592
|
-
printFrame.style.height = '0';
|
|
593
|
-
printFrame.style.border = 'none';
|
|
594
|
-
// sandbox senza 'allow-scripts' blocca l'esecuzione di JS
|
|
595
|
-
/* printFrame.sandbox.add('allow-same-origin'); */
|
|
596
|
-
printFrame.src = fileURL;
|
|
597
|
-
document.body.appendChild(printFrame);
|
|
598
|
-
printFrame.onload = () => {
|
|
599
|
-
try {
|
|
600
|
-
printFrame.contentWindow?.focus();
|
|
601
|
-
printFrame.contentWindow?.print();
|
|
602
|
-
}
|
|
603
|
-
catch (e) {
|
|
604
|
-
console.error('Errore durante la stampa:', e);
|
|
605
|
-
}
|
|
606
|
-
// Cleanup dopo un delay per permettere la stampa
|
|
607
|
-
setTimeout(() => {
|
|
608
|
-
document.body.removeChild(printFrame);
|
|
609
|
-
window.URL.revokeObjectURL(fileURL);
|
|
610
|
-
}, 60000);
|
|
611
|
-
};
|
|
612
|
-
};
|
|
613
|
-
await downloadDcmtsAsync(selectedDcmtInfos, DownloadTypes.Dcmt, "download", handlePrint, undefined, true, undefined, true, false);
|
|
614
|
-
} : undefined,
|
|
615
|
-
};
|
|
616
|
-
};
|
|
617
570
|
const handleSignApprove = () => {
|
|
618
571
|
if (!onOpenS4TViewerRequest) {
|
|
619
572
|
ShowAlert({
|
|
@@ -1129,7 +1082,6 @@ export const useDocumentOperations = (props) => {
|
|
|
1129
1082
|
batchUpdateMenuItem(),
|
|
1130
1083
|
passToArchive(),
|
|
1131
1084
|
...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : []),
|
|
1132
|
-
...(!isMobile ? [printMenuItem()] : [])
|
|
1133
1085
|
]
|
|
1134
1086
|
},
|
|
1135
1087
|
signatureMenuItem(),
|
|
@@ -1173,7 +1125,6 @@ export const useDocumentOperations = (props) => {
|
|
|
1173
1125
|
commentFromWgMenuItem(false),
|
|
1174
1126
|
relationsMenuItem(true),
|
|
1175
1127
|
removeFromWgMenuItem(SDKUI_Localizator.RemoveFromWorkgroup),
|
|
1176
|
-
...(!isMobile ? [printMenuItem()] : [])
|
|
1177
1128
|
].sort((a, b) => a.name.localeCompare(b.name));
|
|
1178
1129
|
return [
|
|
1179
1130
|
...sortedItems,
|
|
@@ -1197,7 +1148,6 @@ export const useDocumentOperations = (props) => {
|
|
|
1197
1148
|
downloadFileMenuItem(),
|
|
1198
1149
|
downloadXMLAttachmentsMenuItem(),
|
|
1199
1150
|
...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : []),
|
|
1200
|
-
...(!isMobile ? [printMenuItem()] : [])
|
|
1201
1151
|
]
|
|
1202
1152
|
},
|
|
1203
1153
|
signatureMenuItem(),
|
|
@@ -1223,8 +1173,7 @@ export const useDocumentOperations = (props) => {
|
|
|
1223
1173
|
...(SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ? [createContextualTaskMenuItem()] : []),
|
|
1224
1174
|
downloadFileMenuItem(),
|
|
1225
1175
|
downloadXMLAttachmentsMenuItem(),
|
|
1226
|
-
...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : [])
|
|
1227
|
-
...(!isMobile ? [printMenuItem()] : [])
|
|
1176
|
+
...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : [])
|
|
1228
1177
|
]
|
|
1229
1178
|
},
|
|
1230
1179
|
signatureMenuItem(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.21.0-dev2.
|
|
3
|
+
"version": "6.21.0-dev2.56",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"lib"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@topconsultnpm/sdk-ts": "6.21.0-dev2.
|
|
43
|
+
"@topconsultnpm/sdk-ts": "6.21.0-dev2.9",
|
|
44
44
|
"@zip.js/zip.js": "2.8.26",
|
|
45
45
|
"buffer": "^6.0.3",
|
|
46
46
|
"devextreme": "^25.2.6",
|