@topconsultnpm/sdkui-react 6.21.0-dev2.54 → 6.21.0-dev2.55
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/components/forms/TMResultDialog.d.ts +1 -1
- package/lib/components/forms/TMResultDialog.js +2 -4
- package/lib/helper/SDKUI_Localizator.d.ts +0 -1
- package/lib/helper/SDKUI_Localizator.js +0 -10
- package/lib/hooks/useDcmtOperations.d.ts +1 -1
- package/lib/hooks/useDcmtOperations.js +8 -8
- package/lib/hooks/useDocumentOperations.js +1 -52
- package/package.json +2 -2
|
@@ -16,5 +16,5 @@ interface ITMResultDialogProps {
|
|
|
16
16
|
declare const TMResultDialog: React.FC<ITMResultDialogProps>;
|
|
17
17
|
export default TMResultDialog;
|
|
18
18
|
export declare class TMResultManager {
|
|
19
|
-
static show(result: ResultInfo[], title: string, id1Caption: string | undefined, id2Caption: string | undefined, customMsg?: string, customDuration?: number
|
|
19
|
+
static show(result: ResultInfo[], title: string, id1Caption: string | undefined, id2Caption: string | undefined, customMsg?: string, customDuration?: number): void;
|
|
20
20
|
}
|
|
@@ -29,13 +29,11 @@ const TMResultDialog = ({ title, result, id1Caption, id2Caption }) => {
|
|
|
29
29
|
};
|
|
30
30
|
export default TMResultDialog;
|
|
31
31
|
export class TMResultManager {
|
|
32
|
-
static show(result, title, id1Caption, id2Caption, customMsg, customDuration
|
|
32
|
+
static show(result, title, id1Caption, id2Caption, customMsg, customDuration) {
|
|
33
33
|
const warningsCount = result.filter(o => o.resultType == ResultTypes.WARNING).length;
|
|
34
34
|
const errorsCount = result.filter(o => o.resultType == ResultTypes.ERROR).length;
|
|
35
35
|
if (warningsCount <= 0 && errorsCount <= 0) {
|
|
36
|
-
|
|
37
|
-
ShowAlert({ message: customMsg && customMsg.length > 0 ? customMsg : SDKUI_Localizator.OperationSuccess, mode: 'success', duration: customDuration && customDuration > 0 ? customDuration : 3000, title: title });
|
|
38
|
-
}
|
|
36
|
+
ShowAlert({ message: customMsg && customMsg.length > 0 ? customMsg : SDKUI_Localizator.OperationSuccess, mode: 'success', duration: customDuration && customDuration > 0 ? customDuration : 3000, title: title });
|
|
39
37
|
return;
|
|
40
38
|
}
|
|
41
39
|
let container = document.createElement('div');
|
|
@@ -597,7 +597,6 @@ export declare class SDKUI_Localizator {
|
|
|
597
597
|
static get Previous(): "Vorherige" | "Previous" | "Anterior" | "Précédent" | "Precedente";
|
|
598
598
|
static get Priority(): string;
|
|
599
599
|
static get PriorityLegend(): "Legende der Prioritäten" | "Priority Legend" | "Leyenda de prioridades" | "Légende des priorités" | "Lenda das prioridades" | "Legenda delle priorità";
|
|
600
|
-
static get Print(): "Drucken" | "Print" | "Imprimir" | "Imprimer" | "Stampa";
|
|
601
600
|
static get ProceedAnyway(): "Dennoch fortfahren?" | "Proceed anyway?" | "¿Proceder de todos modos?" | "Procéder quand même ?" | "Prosseguir mesmo assim?" | "Procedere comunque?";
|
|
602
601
|
static get ProcessedItems(): "Durchdachte Elemente" | "Processed items" | "Elementos elaborados" | "Items traités" | "Itens processados" | "Elementi elaborati";
|
|
603
602
|
static get Properties(): "Eigenschaften" | "Properties" | "Propiedades" | "Propriétés" | "Propriedades" | "Proprietà";
|
|
@@ -5942,16 +5942,6 @@ export class SDKUI_Localizator {
|
|
|
5942
5942
|
default: return "Legenda delle priorità";
|
|
5943
5943
|
}
|
|
5944
5944
|
}
|
|
5945
|
-
static get Print() {
|
|
5946
|
-
switch (this._cultureID) {
|
|
5947
|
-
case CultureIDs.De_DE: return "Drucken";
|
|
5948
|
-
case CultureIDs.En_US: return "Print";
|
|
5949
|
-
case CultureIDs.Es_ES: return "Imprimir";
|
|
5950
|
-
case CultureIDs.Fr_FR: return "Imprimer";
|
|
5951
|
-
case CultureIDs.Pt_PT: return "Imprimir";
|
|
5952
|
-
default: return "Stampa";
|
|
5953
|
-
}
|
|
5954
|
-
}
|
|
5955
5945
|
static get ProceedAnyway() {
|
|
5956
5946
|
switch (this._cultureID) {
|
|
5957
5947
|
case CultureIDs.De_DE: return "Dennoch fortfahren?";
|
|
@@ -19,7 +19,7 @@ export interface UseDcmtOperationsReturn {
|
|
|
19
19
|
waitPanelTextSecondary: string;
|
|
20
20
|
waitPanelValueSecondary: number;
|
|
21
21
|
waitPanelMaxValueSecondary: number;
|
|
22
|
-
downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File, dcmtInfo: DcmtInfo) => void | Promise<void>, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean, retrieveOptions?: RetrieveFormatOptions, useCache?: boolean
|
|
22
|
+
downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File, dcmtInfo: DcmtInfo) => void | Promise<void>, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean, retrieveOptions?: RetrieveFormatOptions, useCache?: boolean) => Promise<void>;
|
|
23
23
|
getDcmtFileAsync: (inputDcmt: DcmtInfo | undefined, rfo: RetrieveFileOptions, operationTitle: string, keepWaitPanelPrimary: boolean, bypassCache?: boolean) => Promise<{
|
|
24
24
|
file: File | undefined;
|
|
25
25
|
isFromCache: boolean;
|
|
@@ -75,7 +75,7 @@ export const useDcmtOperations = () => {
|
|
|
75
75
|
const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
|
|
76
76
|
const { OpenFileDialog } = useFileDialog();
|
|
77
77
|
const [selectFileSource, FileSourceDialog] = useFileSourceDialog();
|
|
78
|
-
const _downloadDcmtsAsync = async (inputDcmts, downloadMode = "download", onFileDownloaded, skipConfirmation = false, retrieveOptions, useCache = true
|
|
78
|
+
const _downloadDcmtsAsync = async (inputDcmts, downloadMode = "download", onFileDownloaded, skipConfirmation = false, retrieveOptions, useCache = true) => {
|
|
79
79
|
if (inputDcmts === undefined)
|
|
80
80
|
return;
|
|
81
81
|
if (inputDcmts.length <= 0)
|
|
@@ -189,9 +189,9 @@ export const useDcmtOperations = () => {
|
|
|
189
189
|
setWaitPanelMaxValueSecondary(0);
|
|
190
190
|
setWaitPanelValueSecondary(0);
|
|
191
191
|
setShowWaitPanel(false);
|
|
192
|
-
TMResultManager.show(result, operationTitle, "TID", "DID"
|
|
192
|
+
TMResultManager.show(result, operationTitle, "TID", "DID");
|
|
193
193
|
};
|
|
194
|
-
const _downloadAttachmentsAsync = async (inputDcmts, confirmAttachments
|
|
194
|
+
const _downloadAttachmentsAsync = async (inputDcmts, confirmAttachments) => {
|
|
195
195
|
if (inputDcmts === undefined)
|
|
196
196
|
return;
|
|
197
197
|
if (inputDcmts.length !== 1)
|
|
@@ -239,7 +239,7 @@ export const useDcmtOperations = () => {
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
TMResultManager.show(result, operationTitle, "TID", "DID"
|
|
242
|
+
TMResultManager.show(result, operationTitle, "TID", "DID");
|
|
243
243
|
}
|
|
244
244
|
catch (ex) {
|
|
245
245
|
TMSpinner.hide();
|
|
@@ -251,11 +251,11 @@ export const useDcmtOperations = () => {
|
|
|
251
251
|
TMExceptionBoxManager.show({ exception: err });
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
|
-
const downloadDcmtsAsync = async (inputDcmts, downloadType = DownloadTypes.Attachment, downloadMode = "download", onFileDownloaded, confirmAttachments, skipConfirmation = false, retrieveOptions, useCache = true
|
|
254
|
+
const downloadDcmtsAsync = async (inputDcmts, downloadType = DownloadTypes.Attachment, downloadMode = "download", onFileDownloaded, confirmAttachments, skipConfirmation = false, retrieveOptions, useCache = true) => {
|
|
255
255
|
switch (downloadType) {
|
|
256
|
-
case DownloadTypes.Dcmt: return await _downloadDcmtsAsync(inputDcmts, downloadMode, onFileDownloaded, skipConfirmation, retrieveOptions, useCache
|
|
257
|
-
case DownloadTypes.Attachment: return await _downloadAttachmentsAsync(inputDcmts, confirmAttachments
|
|
258
|
-
default: return await _downloadDcmtsAsync(inputDcmts, undefined, undefined, skipConfirmation, retrieveOptions, useCache
|
|
256
|
+
case DownloadTypes.Dcmt: return await _downloadDcmtsAsync(inputDcmts, downloadMode, onFileDownloaded, skipConfirmation, retrieveOptions, useCache);
|
|
257
|
+
case DownloadTypes.Attachment: return await _downloadAttachmentsAsync(inputDcmts, confirmAttachments);
|
|
258
|
+
default: return await _downloadDcmtsAsync(inputDcmts, undefined, undefined, skipConfirmation, retrieveOptions, useCache);
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
const uploadDcmtsAsync = async (inputDcmts, operationTitle, operType, actionAfterOperationAsync) => {
|
|
@@ -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.55",
|
|
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",
|