@topconsultnpm/sdkui-react 6.19.0-dev1.35 → 6.19.0-dev1.36

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.
@@ -83,11 +83,12 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
83
83
  const [currentMetadataValues, setCurrentMetadataValues] = useState([]);
84
84
  const [dcmtFormLayoutMode, setDcmtFormLayoutMode] = useState(LayoutModes.Update);
85
85
  const [isModifiedBatchUpdate, setIsModifiedBatchUpdate] = useState(false);
86
+ const [sharedDcmtFile, setSharedDcmtFile] = useState(undefined);
86
87
  // State to control whether the export form (for exporting to Excel/CSV/txt and others) should be shown
87
88
  const [showExportForm, setShowExportForm] = useState(false);
88
89
  const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
89
90
  const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
90
- const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync } = useDcmtOperations();
91
+ const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, getDcmtFileAsync } = useDcmtOperations();
91
92
  const relatedDocuments = useRelatedDocuments({ selectedSearchResult, focusedItem, currentSearchResults });
92
93
  const { relatedDcmts, showRelatedDcmtsChooser, archiveType, isOpenDetails, isOpenMaster, isOpenArchiveRelationForm, archiveRelatedDcmtFormTID, archiveRelatedDcmtFormMids, relatedDcmtsChooserDataSource, showPairDcmtsModal, isPairingManyToMany, pairedSearchResults, manyToManyRelations, selectedManyToManyRelation, showManyToManyChooser, manyToManyChooserDataSource, showPairSearchModal, pairSearchModalTargetTID, pairSearchModalParentTID, pairSearchModalParentDID, pairSearchModalRelation, pairSearchModalInputMids, currentTIDHasDetailRelations, currentTIDHasMasterRelations, canArchiveMasterRelation, canArchiveDetailRelation, hasManyToManyRelation, setIsOpenDetails, setIsOpenMaster, setShowRelatedDcmtsChooser, setShowManyToManyChooser, setShowPairDcmtsModal, setShowPairSearchModal, setIsOpenArchiveRelationForm, setArchiveType, setArchiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormMids, pairFloatingActionConfig, pairSearchModalFloatingActionConfig, archiveMasterDocuments, archiveDetailDocuments, pairManyToMany, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, archiveRelatedDcmtHandler, executeManyToManyPairing, } = relatedDocuments;
93
94
  const deviceType = useDeviceType();
@@ -149,12 +150,19 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
149
150
  });
150
151
  }, [currentMetadataValues]);
151
152
  const openFormHandler = (layoutMode) => { setIsOpenDcmtForm(true); setDcmtFormLayoutMode(layoutMode); };
152
- const openSharedArchiveHandler = () => {
153
+ const openSharedArchiveHandler = async () => {
153
154
  const dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
154
155
  if (dcmts.length === 0) {
155
156
  ShowAlert({ message: "Nessun documento selezionato", mode: "warning", duration: 3000 });
156
157
  return;
157
158
  }
159
+ let dcmtFile = await getDcmtFileAsync(focusedItem.TID, focusedItem.DID, 'Archiviazione Condivisa', true);
160
+ if (dcmtFile) {
161
+ setSharedDcmtFile(dcmtFile?.file);
162
+ }
163
+ else {
164
+ ShowAlert({ message: "Il documento selezionato non ha un file associato per l'archiviazione condivisa.", mode: "error", duration: 5000 });
165
+ }
158
166
  setIsOpenSharedArchive(true);
159
167
  };
160
168
  const openTaskFormHandler = (onTaskCreated) => {
@@ -608,7 +616,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
608
616
  await onRefreshSearchAsync?.();
609
617
  } }), isOpenSharedArchive && _jsx(TMModal, { title: "Archiviazione condivisa", onClose: () => {
610
618
  setIsOpenSharedArchive(false);
611
- }, width: isMobile ? '90%' : '80%', height: isMobile ? '90%' : '80%', children: _jsx(TMArchive, { inputTID: focusedItem?.TID, inputMids: currentMetadataValues.filter(md => md.mid && md.mid > 100).map(md => ({ mid: md.mid, value: md.value ?? '' })), isSharedArchive: true, onSavedAsyncCallback: async (tid, did) => {
619
+ }, width: isMobile ? '90%' : '80%', height: isMobile ? '90%' : '80%', children: _jsx(TMArchive, { inputTID: focusedItem?.TID, inputMids: currentMetadataValues.filter(md => md.mid && md.mid > 100).map(md => ({ mid: md.mid, value: md.value ?? '' })), isSharedArchive: true, inputFile: sharedDcmtFile, onSavedAsyncCallback: async (tid, did) => {
612
620
  setIsOpenSharedArchive(false);
613
621
  await onRefreshSearchAsync?.();
614
622
  } }) })] }));
@@ -4,7 +4,7 @@ import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
4
4
  import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, SearchResultContext } from '../../../ts';
5
5
  export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
6
6
  export declare const signatureInformationCallback: (isMobile: boolean, inputDcmts: DcmtInfo[] | undefined) => Promise<void>;
7
- export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, openSharedArchiveHandler: () => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
7
+ export declare const getCommandsMenuItems: (isMobile: boolean, dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, showSearch: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, openSharedArchiveHandler: () => Promise<void>, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, openExportForm: () => void, handleToggleSearch: () => void, handleSignApprove: () => void, openWGsCopyMoveForm?: ((mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void), openCommentFormCallback?: ((documents: Array<DcmtInfo>) => void), openEditPdf?: ((documents: Array<DcmtInfo>) => void), openAddDocumentForm?: () => void, passToArchiveCallback?: (outputMids: Array<{
8
8
  mid: number;
9
9
  value: string;
10
10
  }>) => void, archiveMasterDocuments?: (tid: number | undefined) => Promise<void>, archiveDetailDocuments?: (tid: number | undefined) => Promise<void>, hasMasterRelation?: boolean, hasDetailRelation?: boolean, canArchiveMasterRelation?: boolean, canArchiveDetailRelation?: boolean, pairManyToManyDocuments?: (isPairing: boolean) => Promise<void>, hasManyToManyRelation?: boolean) => Array<TMDataGridContextMenuItem>;
@@ -406,13 +406,13 @@ export const getCommandsMenuItems = (isMobile, dtd, selectedItems, focusedItem,
406
406
  text: "Archiviazione condivisa",
407
407
  operationType: 'singleRow',
408
408
  disabled: disabledForSingleRow(selectedItems, focusedItem),
409
- onClick: () => { openSharedArchiveHandler(); }
409
+ onClick: async () => { await openSharedArchiveHandler(); }
410
410
  },
411
411
  {
412
412
  icon: svgToString(_jsx(IconSharedDcmt, {})),
413
413
  text: "Mostra documenti condivisi",
414
414
  operationType: 'multiRow',
415
- disabled: !hasManyToManyRelation || disabledForMultiRow(selectedItems, focusedItem),
415
+ disabled: disabledForMultiRow(selectedItems, focusedItem),
416
416
  onClick: () => ShowAlert({ message: "TODO Mostra documenti condivisi", mode: 'info', title: `${"TODO"}`, duration: 3000 })
417
417
  }
418
418
  ]
@@ -346,9 +346,11 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
346
346
  const searchEngine = SDK_Globals.tmSession?.NewSearchEngine();
347
347
  if (!focusedItem?.TID || !focusedItem?.DID) {
348
348
  ShowAlert({
349
- message: "Nessun documento selezionato per l'operazione molti-a-molti.",
349
+ message: isPairing
350
+ ? "Nessun documento selezionato per l'abbinamento molti a molti."
351
+ : "Nessun documento selezionato per il disabbinamento molti a molti.",
350
352
  mode: 'warning',
351
- title: 'Operazione molti-a-molti',
353
+ title: isPairing ? 'Abbina documenti molti a molti' : 'Disabbina documenti molti a molti',
352
354
  duration: 5000
353
355
  });
354
356
  return;
@@ -363,9 +365,11 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
363
365
  }
364
366
  if (!qd) {
365
367
  ShowAlert({
366
- message: "Nessuna query di recupero associata alla relazione molti-a-molti.",
368
+ message: isPairing
369
+ ? "Nessuna query di recupero associata alla relazione di abbinamento molti a molti."
370
+ : "Nessuna query di recupero associata alla relazione di disabbinamento molti a molti.",
367
371
  mode: 'warning',
368
- title: 'Operazione molti-a-molti',
372
+ title: isPairing ? 'Abbina documenti molti a molti' : 'Disabbina documenti molti a molti',
369
373
  duration: 5000
370
374
  });
371
375
  return;
@@ -470,7 +474,7 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
470
474
  ShowAlert({
471
475
  message: "Nessun documento abbinato trovato.",
472
476
  mode: 'warning',
473
- title: 'Operazione molti-a-molti',
477
+ title: 'Disabbina documenti molti a molti',
474
478
  duration: 5000
475
479
  });
476
480
  return;
@@ -494,7 +498,7 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
494
498
  ShowAlert({
495
499
  message: "Nessun documento trovato.",
496
500
  mode: 'warning',
497
- title: 'Operazione molti-a-molti',
501
+ title: 'Abbina documenti molti a molti',
498
502
  duration: 5000
499
503
  });
500
504
  openPairSearchModal(relation, targetTID, qd);
@@ -519,7 +523,7 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
519
523
  ShowAlert({
520
524
  message: "Nessun documento da abbinare. Tutti i documenti risultanti sono già abbinati.",
521
525
  mode: 'warning',
522
- title: 'Operazione molti-a-molti',
526
+ title: 'Abbina documenti molti a molti',
523
527
  duration: 5000
524
528
  });
525
529
  openPairSearchModal(relation, targetTID, qd);
@@ -537,9 +541,11 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
537
541
  return;
538
542
  if (!relations.some(r => r.relationType === RelationTypes.ManyToMany)) {
539
543
  ShowAlert({
540
- message: "Nessuna relazione molti-a-molti definita nel sistema.",
544
+ message: isPairing
545
+ ? "Nessuna relazione di abbinamento molti a molti definita nel sistema."
546
+ : "Nessuna relazione di disabbinamento molti a molti definita nel sistema.",
541
547
  mode: 'warning',
542
- title: 'Operazione molti-a-molti',
548
+ title: isPairing ? 'Abbina documenti molti a molti' : 'Disabbina documenti molti a molti',
543
549
  duration: 5000
544
550
  });
545
551
  return;
@@ -547,9 +553,11 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
547
553
  const manyToManyRels = relations.filter(r => r.relationType === RelationTypes.ManyToMany);
548
554
  if (!manyToManyRels.some(r => r.masterTID === selectedSearchResult?.fromTID || r.detailTID === selectedSearchResult?.fromTID)) {
549
555
  ShowAlert({
550
- message: "Nessuna relazione molti-a-molti definita per il tipo di documento selezionato.",
556
+ message: isPairing
557
+ ? "Nessuna relazione di abbinamento molti a molti definita per il tipo di documento selezionato."
558
+ : "Nessuna relazione di disabbinamento molti a molti definita per il tipo di documento selezionato.",
551
559
  mode: 'warning',
552
- title: 'Operazione molti-a-molti',
560
+ title: isPairing ? 'Abbina documenti molti a molti' : 'Disabbina documenti molti a molti',
553
561
  duration: 5000
554
562
  });
555
563
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.19.0-dev1.35",
3
+ "version": "6.19.0-dev1.36",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",