@topconsultnpm/sdkui-react 6.21.0-dev2.53 → 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.
@@ -18,16 +18,17 @@ export declare const isDirectoryPickerSupported: () => boolean;
18
18
  export declare const isPdfExt: (ext: string | null | undefined) => boolean;
19
19
  /**
20
20
  * Estrae l'estensione completa da un nome file, gestendo estensioni composite
21
- * come .PDF.P7M, .DOCX.p7m, .xml.p7m, etc.
21
+ * a più livelli come .PDF.P7M, .XML.P7M.TS, etc.
22
22
  *
23
23
  * Esempi:
24
24
  * - "documento.pdf" -> ".pdf"
25
25
  * - "DCMT_123.PDF.P7M" -> ".PDF.P7M"
26
26
  * - "fattura.xml.p7m" -> ".xml.p7m"
27
+ * - "example.XML.P7M.TS" -> ".XML.P7M.TS"
27
28
  * - "file.tar.gz" -> ".gz" (tar.gz non è gestito come firma)
28
29
  * - "file" -> ""
29
30
  */
30
- export declare const getFullFileExtension: (fileName: string) => string;
31
+ export declare const getFullFileExtension: (fileName: string, depth?: number) => string;
31
32
  /**
32
33
  * Estrae il nome base del file (senza estensione completa).
33
34
  * Gestisce estensioni composite come .PDF.P7M
@@ -60,37 +60,40 @@ export const isPdfExt = (ext) => {
60
60
  };
61
61
  /**
62
62
  * Estensioni di firma/marca temporale note che possono avvolgere altre estensioni.
63
- * Es: file.pdf.p7m, file.xml.p7m, file.docx.p7m
63
+ * Es: file.pdf.p7m, file.xml.p7m, file.docx.p7m, file.xml.p7m.ts
64
64
  */
65
- const SIGNATURE_EXTENSIONS = new Set(['p7m', 'p7s', 'm7m', 'tsd', 'tsr']);
65
+ const SIGNATURE_EXTENSIONS = new Set(['p7m', 'p7s', 'm7m', 'tsd', 'tsr', 'ts']);
66
+ /** Profondità massima di ricorsione per la ricerca di estensioni composite */
67
+ const MAX_EXTENSION_DEPTH = 5;
66
68
  /**
67
69
  * Estrae l'estensione completa da un nome file, gestendo estensioni composite
68
- * come .PDF.P7M, .DOCX.p7m, .xml.p7m, etc.
70
+ * a più livelli come .PDF.P7M, .XML.P7M.TS, etc.
69
71
  *
70
72
  * Esempi:
71
73
  * - "documento.pdf" -> ".pdf"
72
74
  * - "DCMT_123.PDF.P7M" -> ".PDF.P7M"
73
75
  * - "fattura.xml.p7m" -> ".xml.p7m"
76
+ * - "example.XML.P7M.TS" -> ".XML.P7M.TS"
74
77
  * - "file.tar.gz" -> ".gz" (tar.gz non è gestito come firma)
75
78
  * - "file" -> ""
76
79
  */
77
- export const getFullFileExtension = (fileName) => {
78
- if (!fileName)
80
+ export const getFullFileExtension = (fileName, depth = 0) => {
81
+ if (!fileName || depth > MAX_EXTENSION_DEPTH)
79
82
  return '';
80
83
  const lastDotIndex = fileName.lastIndexOf('.');
81
84
  if (lastDotIndex <= 0)
82
85
  return '';
83
86
  const lastExtension = fileName.substring(lastDotIndex + 1).toLowerCase();
84
- // Se l'ultima estensione è una firma/marca, cerca anche l'estensione precedente
87
+ // Se l'ultima estensione è una firma/marca, cerca ricorsivamente le estensioni precedenti
85
88
  if (SIGNATURE_EXTENSIONS.has(lastExtension)) {
86
- const nameWithoutSignature = fileName.substring(0, lastDotIndex);
87
- const secondLastDotIndex = nameWithoutSignature.lastIndexOf('.');
88
- if (secondLastDotIndex > 0) {
89
- // Restituisce entrambe le estensioni: .PDF.P7M
90
- return fileName.substring(secondLastDotIndex);
89
+ const nameWithoutLastExt = fileName.substring(0, lastDotIndex);
90
+ const innerExtension = getFullFileExtension(nameWithoutLastExt, depth + 1);
91
+ if (innerExtension) {
92
+ // Concatena l'estensione interna con quella corrente
93
+ return innerExtension + fileName.substring(lastDotIndex);
91
94
  }
92
95
  }
93
- // Estensione singola
96
+ // Estensione singola (o estensione base dopo le firme)
94
97
  return fileName.substring(lastDotIndex);
95
98
  };
96
99
  /**
@@ -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?";
@@ -23,7 +23,6 @@ import { useInputAttachmentsDialog, useInputCvtFormatDialog } from "./useInputDi
23
23
  import { useRelatedDocuments } from "./useRelatedDocuments";
24
24
  import { convertSearchResultDescriptorToFileItems, dcmtsFileCachePreview, getDcmtCicoStatus, getMoreInfoTasksForDocument, IconActivity, IconArchiveDetail, IconArchiveDoc, IconArchiveMaster, IconBatchUpdate, IconCheck, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconCopy, IconCustom, IconDelete, IconDetailDcmts, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconMoveToFolder, IconPair, IconPin, IconPlatform, IconPreview, IconRelation, IconSearch, IconShare, IconSharedDcmt, IconShow, IconSignaturePencil, IconStar, IconSubstFile, IconUndo, IconUnpair, IconUserGroupOutline, isPdfEditorAvailable, SDKUI_Localizator, searchResultToMetadataValues, TMImageLibrary } from '../helper';
25
25
  import { isXMLFileExt } from "../helper/dcmtsHelper";
26
- import { isPdfExt } from "../components/features/documents/copyAndMergeDcmtsShared";
27
26
  import TMCopyToFolderForm from "../components/features/documents/TMCopyToFolderForm";
28
27
  import TMMergeToPdfForm from "../components/features/documents/TMMergeToPdfForm";
29
28
  export const getSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat) => {
@@ -568,41 +567,6 @@ export const useDocumentOperations = (props) => {
568
567
  onClick: () => openEditPdfCallback(selectedDcmtInfos, refreshDocumentPreview),
569
568
  };
570
569
  };
571
- const printMenuItem = () => {
572
- const isPdf = isPdfExt(selectedDcmtInfos?.[0]?.FILEEXT);
573
- return {
574
- id: 'print',
575
- icon: _jsx("i", { className: "dx-icon-print", style: { fontSize: '20px' } }),
576
- name: SDKUI_Localizator.Print,
577
- operationType: 'singleRow',
578
- disabled: !isPdf || isDisabledForSingleRow(),
579
- onClick: isPdf ? async () => {
580
- const handlePrint = async (file, _dcmtInfo) => {
581
- const fileURL = window.URL.createObjectURL(file);
582
- // Usa un iframe nascosto per stampare senza aprire un nuovo tab
583
- const iframe = document.createElement('iframe');
584
- iframe.style.position = 'fixed';
585
- iframe.style.right = '0';
586
- iframe.style.bottom = '0';
587
- iframe.style.width = '0';
588
- iframe.style.height = '0';
589
- iframe.style.border = 'none';
590
- iframe.src = fileURL;
591
- document.body.appendChild(iframe);
592
- iframe.onload = () => {
593
- iframe.contentWindow?.focus();
594
- iframe.contentWindow?.print();
595
- // Rimuovi l'iframe dopo un breve delay per permettere la stampa
596
- setTimeout(() => {
597
- document.body.removeChild(iframe);
598
- window.URL.revokeObjectURL(fileURL);
599
- }, 1000);
600
- };
601
- };
602
- await downloadDcmtsAsync(selectedDcmtInfos, DownloadTypes.Dcmt, "download", handlePrint, undefined, true);
603
- } : undefined,
604
- };
605
- };
606
570
  const handleSignApprove = () => {
607
571
  if (!onOpenS4TViewerRequest) {
608
572
  ShowAlert({
@@ -1118,7 +1082,6 @@ export const useDocumentOperations = (props) => {
1118
1082
  batchUpdateMenuItem(),
1119
1083
  passToArchive(),
1120
1084
  ...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : []),
1121
- printMenuItem()
1122
1085
  ]
1123
1086
  },
1124
1087
  signatureMenuItem(),
@@ -1162,7 +1125,6 @@ export const useDocumentOperations = (props) => {
1162
1125
  commentFromWgMenuItem(false),
1163
1126
  relationsMenuItem(true),
1164
1127
  removeFromWgMenuItem(SDKUI_Localizator.RemoveFromWorkgroup),
1165
- printMenuItem()
1166
1128
  ].sort((a, b) => a.name.localeCompare(b.name));
1167
1129
  return [
1168
1130
  ...sortedItems,
@@ -1186,7 +1148,6 @@ export const useDocumentOperations = (props) => {
1186
1148
  downloadFileMenuItem(),
1187
1149
  downloadXMLAttachmentsMenuItem(),
1188
1150
  ...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : []),
1189
- printMenuItem()
1190
1151
  ]
1191
1152
  },
1192
1153
  signatureMenuItem(),
@@ -1212,8 +1173,7 @@ export const useDocumentOperations = (props) => {
1212
1173
  ...(SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ? [createContextualTaskMenuItem()] : []),
1213
1174
  downloadFileMenuItem(),
1214
1175
  downloadXMLAttachmentsMenuItem(),
1215
- ...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : []),
1216
- printMenuItem()
1176
+ ...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : [])
1217
1177
  ]
1218
1178
  },
1219
1179
  signatureMenuItem(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev2.53",
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.8",
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",