@topconsultnpm/sdkui-react 6.19.0-dev2.27 → 6.19.0-dev2.29

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.
@@ -38,7 +38,18 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
38
38
  if (checkProps)
39
39
  throw Error('Le props qd | tids | dataSource devono essere in alternativa');
40
40
  try {
41
- if (qd) {
41
+ if (dataSource) {
42
+ // Se ho dataSource, aggiungo tutti i suoi metadati con uniqueKey
43
+ dataSource.forEach((md) => {
44
+ const mdWithKey = md;
45
+ mdWithKey.uniqueKey = `${mdWithKey.customData1 ?? 0}_${md.id}_${mdWithKey.customData2 ?? ''}`;
46
+ metadata.push(mdWithKey);
47
+ });
48
+ setDcmtTypes(dtdList);
49
+ setHasSysMetadata(allowSysMetadata && metadata.findIndex(md => md.isSystem == 1) >= 0);
50
+ return showSysMetadata ? metadata : metadata.filter(o => o.isSystem != 1);
51
+ }
52
+ else if (qd) {
42
53
  let tids = getTIDsByQd(qd);
43
54
  let inputTIDs = tids.map((item) => item.tid);
44
55
  TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DcmtType} ...` });
@@ -138,5 +149,7 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
138
149
  const cellRenderNameAndDesc = useCallback((data) => {
139
150
  return _jsx("p", { style: { textAlign: 'left', color: data.data.isRequired == 1 ? 'red' : '' }, children: data.value });
140
151
  }, []);
141
- return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, keyName: 'uniqueKey', selectedIDs: selectedIDs?.map((item) => `${item.tid}_${item.mid}_${item.aliasTID ?? ''}`), convertID: convertID, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
152
+ return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, keyName: 'uniqueKey', selectedIDs: selectedIDs?.map((item) => `${item.tid}_${item.mid}_${item.aliasTID ?? ''}`), convertID: convertID, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc,
153
+ // dataSource={dataSource}
154
+ getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
142
155
  };
@@ -4,11 +4,12 @@ import TMDcmtPreview from './TMDcmtPreview';
4
4
  import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, TID_DID, UpdateEngineByID, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
5
5
  import { ContextMenu } from 'devextreme-react';
6
6
  import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
7
- import { DownloadTypes, FormModes } from '../../../ts';
7
+ import { DownloadTypes, FormModes, DcmtOperationTypes } from '../../../ts';
8
8
  import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
9
9
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
10
+ import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
10
11
  import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
11
- import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary } from '../../../helper';
12
+ import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary, IconStar, IconRelation, IconInfo, IconArchiveDoc, IconDelete, IconPair, IconUnpair, IconArchiveMaster, IconArchiveDetail } from '../../../helper';
12
13
  import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
13
14
  import { Gutters, TMColors } from '../../../utils/theme';
14
15
  import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
@@ -27,6 +28,8 @@ import TMMasterDetailDcmts from './TMMasterDetailDcmts';
27
28
  import TMDcmtBlog from './TMDcmtBlog';
28
29
  import { useInputAttachmentsDialog } from '../../../hooks/useInputDialog';
29
30
  import TMModal from '../../base/TMModal';
31
+ import TMChooserForm from '../../forms/TMChooserForm';
32
+ import TMSearchResult from '../search/TMSearchResult';
30
33
  import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
31
34
  import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
32
35
  import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
@@ -41,7 +44,7 @@ import { getTaskAssignedToMe } from '../tasks/TMTasksUtils';
41
44
  import TMCustomButton from '../../base/TMCustomButton';
42
45
  let abortControllerLocal = new AbortController();
43
46
  //#endregion
44
- const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, showBackButton = true, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
47
+ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, showBackButton = true, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, onTaskCreateRequest, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
45
48
  const [id, setID] = useState('');
46
49
  const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
47
50
  const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
@@ -102,10 +105,44 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
102
105
  setDcmtReferences(undefined);
103
106
  }, [allowButtonsRefs]);
104
107
  const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
105
- const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
106
- // Custom hook to manage workflow approval data
108
+ const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync } = useDcmtOperations();
107
109
  const { workflowApproveData } = useWorkflowApprove();
110
+ const currentSearchResults = useMemo(() => {
111
+ if (!formData || formData.length === 0 || !TID || !DID)
112
+ return [];
113
+ const selectMIDs = [];
114
+ const rowValues = [];
115
+ formData.forEach(md => {
116
+ if (md.mid !== undefined) {
117
+ selectMIDs.push(md.mid);
118
+ rowValues.push(md.value);
119
+ }
120
+ });
121
+ const searchResult = {
122
+ fromTID: TID,
123
+ selectMIDs: selectMIDs,
124
+ dtdResult: {
125
+ rows: [rowValues],
126
+ columns: selectMIDs.map(mid => ({ name: `MID_${mid}` }))
127
+ },
128
+ dcmtsFound: 1,
129
+ dcmtsReturned: 1
130
+ };
131
+ return [searchResult];
132
+ }, [formData, TID, DID]);
133
+ const relatedDocuments = useRelatedDocuments({
134
+ selectedSearchResult: TID ? { fromTID: Number(TID) } : undefined,
135
+ focusedItem: currentDcmt ? { TID: currentDcmt.tid, DID: currentDcmt.did, rowIndex: 0 } : undefined,
136
+ currentSearchResults: currentSearchResults
137
+ });
138
+ const { relatedDcmts, showRelatedDcmtsChooser, archiveType, isOpenArchiveRelationForm, archiveRelatedDcmtFormTID, archiveRelatedDcmtFormMids, relatedDcmtsChooserDataSource, showManyToManyChooser, manyToManyChooserDataSource, manyToManyRelations, isPairingManyToMany, showPairDcmtsModal, pairedSearchResults, pairFloatingActionConfig, hasManyToManyRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, archiveMasterDocuments, archiveDetailDocuments, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, setShowRelatedDcmtsChooser, setShowManyToManyChooser, setShowPairDcmtsModal, setIsOpenArchiveRelationForm, setArchiveType, setArchiveRelatedDcmtFormTID, setArchiveRelatedDcmtFormMids, archiveRelatedDcmtHandler, executeManyToManyPairing } = relatedDocuments;
108
139
  const fetchErrorShownRef = useRef(false);
140
+ useEffect(() => {
141
+ if (!TID)
142
+ return;
143
+ checkRelatedDcmtsArchiveCapability();
144
+ checkManyToManyCapability();
145
+ }, [TID, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability]);
109
146
  const deviceType = useDeviceType();
110
147
  const getDcmts = useCallback(() => {
111
148
  return [{ TID: currentDcmt?.tid, DID: currentDcmt?.did, FILEEXT: currentDcmt?.fileExt }];
@@ -331,8 +368,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
331
368
  return;
332
369
  if (!formDataOrig || formDataOrig.length === 0)
333
370
  return;
334
- // Check if formData has actual user metadata (mid > 99), not just system metadata
335
- if (!formData.some(md => md.mid && md.mid > 99))
371
+ const hasUserMetadata = formData.some(md => md.mid && md.mid > 99);
372
+ if (!hasUserMetadata)
336
373
  return;
337
374
  if (appliedInputMidsRef.current && deepCompare(appliedInputMidsRef.current, inputMids))
338
375
  return;
@@ -466,15 +503,174 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
466
503
  const isApprView = useMemo(() => fromDTD?.templateTID === TemplateTIDs.WF_WIApprView, [fromDTD?.templateTID]);
467
504
  const workitemSetID = useMemo(() => workItems.find(o => o.did === Number(DID))?.setID || formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [workItems, DID, formData]);
468
505
  const approvalVID = useMemo(() => workItems.length > 0 ? Number(workItems[0].tid) : -1, [workItems]);
506
+ //here
469
507
  const commandsMenuItems = useMemo(() => {
470
508
  const items = [
471
- { icon: svgToString(_jsx(IconDownload, {})), operationType: 'singleRow', disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes, text: "Download file", onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt, "download") },
472
- { icon: svgToString(_jsx(IconDownload, {})), operationType: 'singleRow', disabled: !isXMLFileExt(currentDcmt?.fileExt), text: "Download allegati XML", onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, "download", undefined, openConfirmAttachmentsDialog) },
473
- ...(allowRelations && currentTIDHasMasterRelations ? [{ icon: svgToString(_jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' })), operationType: 'singleRow', disabled: isMasterDisabled, text: SDKUI_Localizator.DcmtsMaster, onClick: () => { if (!isMasterDisabled)
474
- setIsOpenMaster(!isOpenMaster); } }] : []),
475
- ...(allowRelations && currentTIDHasDetailRelations ? [{ icon: svgToString(_jsx(IconDetailDcmts, {})), operationType: 'singleRow', disabled: isDetailsDisabled, text: SDKUI_Localizator.DcmtsDetail, onClick: () => { if (!isDetailsDisabled)
476
- setIsOpenDetails(!isOpenDetails); } }] : []),
509
+ {
510
+ icon: svgToString(_jsx(IconDownload, {})),
511
+ operationType: 'singleRow',
512
+ disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes,
513
+ text: SDKUI_Localizator.DownloadFile,
514
+ onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt, "download")
515
+ },
516
+ {
517
+ icon: svgToString(_jsx(IconDownload, {})),
518
+ operationType: 'singleRow',
519
+ disabled: !isXMLFileExt(currentDcmt?.fileExt),
520
+ text: SDKUI_Localizator.DownloadXMLAttachments,
521
+ onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, "download", undefined, openConfirmAttachmentsDialog)
522
+ },
477
523
  ];
524
+ // Operations submenu
525
+ const operationsItems = [];
526
+ // Add to favorites
527
+ if (layoutMode === LayoutModes.Update && DID) {
528
+ operationsItems.push({
529
+ icon: svgToString(_jsx(IconStar, {})),
530
+ text: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
531
+ operationType: 'singleRow',
532
+ disabled: false,
533
+ onClick: async () => {
534
+ await runOperationAsync(getDcmts(), DcmtOperationTypes.AddToFavs);
535
+ },
536
+ });
537
+ }
538
+ // Create contextual task
539
+ if (onTaskCreateRequest && layoutMode === LayoutModes.Update && DID) {
540
+ operationsItems.push({
541
+ icon: svgToString(_jsx(IconActivity, {})),
542
+ text: SDKUI_Localizator.CreateContextualTask,
543
+ operationType: 'singleRow',
544
+ disabled: false,
545
+ onClick: () => {
546
+ const dcmt = getDcmts()[0];
547
+ const taskContext = {
548
+ document: {
549
+ tid: dcmt.TID,
550
+ did: dcmt.DID,
551
+ name: fromDTD?.description || ''
552
+ }
553
+ };
554
+ onTaskCreateRequest(taskContext);
555
+ }
556
+ });
557
+ }
558
+ // Add operations submenu if it has items
559
+ if (operationsItems.length > 0) {
560
+ items.push({
561
+ icon: svgToString(_jsx(IconCheck, {})),
562
+ text: SDKUI_Localizator.DocumentOperations,
563
+ items: operationsItems
564
+ });
565
+ }
566
+ // Relations submenu
567
+ if (allowRelations && layoutMode === LayoutModes.Update && DID) {
568
+ const relationsItems = [
569
+ {
570
+ icon: svgToString(_jsx(IconPair, {})),
571
+ text: SDKUI_Localizator.MatchManyDocumentsManyToMany,
572
+ operationType: 'singleRow',
573
+ disabled: !hasManyToManyRelation,
574
+ onClick: async () => await pairManyToMany?.(true)
575
+ },
576
+ {
577
+ icon: svgToString(_jsx(IconUnpair, {})),
578
+ text: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
579
+ operationType: 'singleRow',
580
+ disabled: !hasManyToManyRelation,
581
+ onClick: async () => await pairManyToMany?.(false)
582
+ },
583
+ {
584
+ icon: svgToString(_jsx(IconArchiveMaster, {})),
585
+ text: SDKUI_Localizator.ArchiveMasterDocument,
586
+ operationType: 'singleRow',
587
+ beginGroup: true,
588
+ disabled: canArchiveMasterRelation !== true,
589
+ onClick: async () => { if (TID)
590
+ await archiveMasterDocuments?.(TID); }
591
+ },
592
+ {
593
+ icon: svgToString(_jsx(IconArchiveDetail, {})),
594
+ text: SDKUI_Localizator.ArchiveDetailDocument,
595
+ operationType: 'singleRow',
596
+ disabled: canArchiveDetailRelation !== true,
597
+ onClick: async () => { if (TID)
598
+ await archiveDetailDocuments?.(TID); }
599
+ },
600
+ {
601
+ icon: svgToString(_jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' })),
602
+ text: SDKUI_Localizator.DcmtsMaster,
603
+ operationType: 'singleRow',
604
+ visible: true,
605
+ beginGroup: true,
606
+ disabled: !currentTIDHasMasterRelations || isMasterDisabled,
607
+ onClick: () => { if (!isMasterDisabled)
608
+ setIsOpenMaster(!isOpenMaster); }
609
+ },
610
+ {
611
+ icon: svgToString(_jsx(IconDetailDcmts, {})),
612
+ text: SDKUI_Localizator.DcmtsDetail,
613
+ operationType: 'singleRow',
614
+ disabled: !currentTIDHasDetailRelations || isDetailsDisabled,
615
+ visible: true,
616
+ onClick: () => { if (!isDetailsDisabled)
617
+ setIsOpenDetails(!isOpenDetails); }
618
+ }
619
+ ];
620
+ items.push({
621
+ icon: svgToString(_jsx(IconRelation, {})),
622
+ text: SDKUI_Localizator.Relations,
623
+ items: relationsItems
624
+ });
625
+ }
626
+ // Full text search submenu
627
+ if (layoutMode === LayoutModes.Update && DID) {
628
+ const fullTextItems = [
629
+ {
630
+ icon: svgToString(_jsx(IconInfo, {})),
631
+ text: SDKUI_Localizator.IndexingInformation,
632
+ operationType: 'singleRow',
633
+ disabled: false,
634
+ onClick: async () => {
635
+ try {
636
+ TMSpinner.show({ description: `${SDKUI_Localizator.Loading}...` });
637
+ const dcmts = getDcmts();
638
+ const msg = await SDK_Globals.tmSession?.NewSearchEngine().FreeSearchGetDcmtInfoAsync(dcmts[0].TID, dcmts[0].DID);
639
+ TMMessageBoxManager.show({ buttons: [ButtonNames.OK], message: msg, title: SDKUI_Localizator.IndexingInformation });
640
+ }
641
+ catch (e) {
642
+ TMExceptionBoxManager.show({ exception: e });
643
+ }
644
+ finally {
645
+ TMSpinner.hide();
646
+ }
647
+ }
648
+ },
649
+ {
650
+ icon: svgToString(_jsx(IconArchiveDoc, {})),
651
+ text: SDKUI_Localizator.IndexOrReindex,
652
+ operationType: 'singleRow',
653
+ disabled: false,
654
+ onClick: async () => {
655
+ await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchReindex);
656
+ }
657
+ },
658
+ {
659
+ icon: svgToString(_jsx(IconDelete, {})),
660
+ text: SDKUI_Localizator.IndexingDelete,
661
+ operationType: 'singleRow',
662
+ disabled: false,
663
+ onClick: async () => {
664
+ await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchPurge);
665
+ }
666
+ }
667
+ ];
668
+ items.push({
669
+ icon: svgToString(_jsx(IconSearch, {})),
670
+ text: SDKUI_Localizator.FullTextSearch,
671
+ items: fullTextItems
672
+ });
673
+ }
478
674
  // Aggiungi submenu "Bottoni personalizzati" se esistono customButtons
479
675
  if (customButtonsLayout?.customButtons && Array.isArray(customButtonsLayout.customButtons) && customButtonsLayout.customButtons.length > 0) {
480
676
  const customButtonsItems = customButtonsLayout.customButtons
@@ -491,7 +687,31 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
491
687
  });
492
688
  }
493
689
  return items;
494
- }, [fromDTD?.perm?.canRetrieveFile, currentDcmt?.fileExt, allowRelations, currentTIDHasMasterRelations, isMasterDisabled, currentTIDHasDetailRelations, isDetailsDisabled, customButtonsLayout, getDcmts, downloadDcmtsAsync, openConfirmAttachmentsDialog]);
690
+ }, [
691
+ fromDTD?.perm?.canRetrieveFile,
692
+ fromDTD?.description,
693
+ currentDcmt?.fileExt,
694
+ allowRelations,
695
+ currentTIDHasMasterRelations,
696
+ isMasterDisabled,
697
+ currentTIDHasDetailRelations,
698
+ isDetailsDisabled,
699
+ customButtonsLayout,
700
+ layoutMode,
701
+ TID,
702
+ DID,
703
+ onTaskCreateRequest,
704
+ hasManyToManyRelation,
705
+ canArchiveMasterRelation,
706
+ canArchiveDetailRelation,
707
+ pairManyToMany,
708
+ archiveMasterDocuments,
709
+ archiveDetailDocuments,
710
+ getDcmts,
711
+ downloadDcmtsAsync,
712
+ runOperationAsync,
713
+ openConfirmAttachmentsDialog
714
+ ]);
495
715
  const isModified = useMemo(() => calcIsModified(formData, formDataOrig), [formData, formDataOrig]);
496
716
  const formToolbar = useMemo(() => _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowNavigation && canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update && _jsx(IconMenuVertical, { id: `commands-detail-${id}`, color: 'white', cursor: 'pointer' }), layoutMode === LayoutModes.Update && _jsx(ContextMenu, { showEvent: 'click', dataSource: commandsMenuItems, target: `#commands-detail-${id}` }), layoutMode === LayoutModes.Ark &&
497
717
  _jsx(TMTooltip, { content: SDKUI_Localizator.PassToSearch, position: 'bottom', children: _jsx(IconSearch, { style: { cursor: 'pointer' }, onClick: handlePassToSearch }) })] }), [allowNavigation, canPrev, canNext, itemIndex, count, isModified, formMode, onPrev, onNext, layoutMode, id, commandsMenuItems, handlePassToSearch]);
@@ -1163,9 +1383,50 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1163
1383
  return (_jsx(StyledModalContainer, { children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }, `${index}-${dcmt.DID}`));
1164
1384
  })] }), taskFormDialogComponent, s4TViewerDialogComponent] }));
1165
1385
  };
1166
- return (_jsx(_Fragment, { children: (isModal && onClose)
1167
- ? _jsx(TMModal, { title: titleModal, onClose: handleClose, width: widthModal ?? '100%', height: heightModal ?? '100%', hidePopup: false, askClosingConfirm: true, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block', padding: "4px", position: 'relative' }, children: renderDcmtForm() }) })
1168
- : renderDcmtForm() }));
1386
+ return (_jsxs(_Fragment, { children: [(isModal && onClose)
1387
+ ? _jsx(TMModal, { title: titleModal, onClose: handleClose, width: widthModal ?? '100%', height: heightModal ?? '100%', hidePopup: false, askClosingConfirm: true, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block', padding: "4px", position: 'relative' }, children: renderDcmtForm() }) })
1388
+ : renderDcmtForm(), showRelatedDcmtsChooser && (_jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
1389
+ try {
1390
+ setShowRelatedDcmtsChooser(false);
1391
+ TMSpinner.show({ description: SDKUI_Localizator.Loading });
1392
+ const relation = relatedDcmts?.find(r => r.id === selectedRelation[0]);
1393
+ if (!relation || !archiveType)
1394
+ return;
1395
+ await archiveRelatedDcmtHandler(relation, archiveType);
1396
+ }
1397
+ catch (error) {
1398
+ TMExceptionBoxManager.show({ exception: error });
1399
+ }
1400
+ finally {
1401
+ TMSpinner.hide();
1402
+ }
1403
+ }, onClose: () => setShowRelatedDcmtsChooser(false), manageUseLocalizedName: false })), showManyToManyChooser && (_jsx(TMChooserForm, { dataSource: manyToManyChooserDataSource, onChoose: async (selectedRelation) => {
1404
+ try {
1405
+ setShowManyToManyChooser(false);
1406
+ TMSpinner.show({ description: SDKUI_Localizator.Loading });
1407
+ const relation = manyToManyRelations?.find(r => r.id === selectedRelation[0]);
1408
+ if (!relation)
1409
+ return;
1410
+ await executeManyToManyPairing(relation, isPairingManyToMany);
1411
+ }
1412
+ catch (error) {
1413
+ TMExceptionBoxManager.show({ exception: error });
1414
+ }
1415
+ finally {
1416
+ TMSpinner.hide();
1417
+ }
1418
+ }, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false })), isOpenArchiveRelationForm && (_jsx(TMDcmtForm, { isModal: true, titleModal: SDKUI_Localizator.Archive + ' - ' + (archiveType === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster), TID: archiveRelatedDcmtFormTID, layoutMode: LayoutModes.Ark, inputMids: archiveRelatedDcmtFormMids, showBackButton: false, allowButtonsRefs: false, onClose: () => {
1419
+ setIsOpenArchiveRelationForm(false);
1420
+ setArchiveType(undefined);
1421
+ setArchiveRelatedDcmtFormTID(undefined);
1422
+ setArchiveRelatedDcmtFormMids([]);
1423
+ }, onSavedAsyncCallback: async (tid, did) => {
1424
+ setIsOpenArchiveRelationForm(false);
1425
+ setArchiveType(undefined);
1426
+ setArchiveRelatedDcmtFormTID(undefined);
1427
+ setArchiveRelatedDcmtFormMids([]);
1428
+ await fetchData();
1429
+ }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })), showPairDcmtsModal && (_jsx(TMModal, { title: (isPairingManyToMany ? "Abbina" : "Disabbina") + " documenti", onClose: () => setShowPairDcmtsModal(false), width: isMobile ? '90%' : '50%', height: isMobile ? '90%' : '70%', children: _jsx(TMSearchResult, { searchResults: pairedSearchResults, onRefreshSearchAsync: async () => await fetchData(), onTaskCreateRequest: onTaskCreateRequest, allowFloatingBar: false, floatingActionConfig: pairFloatingActionConfig, showBackButton: false, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }))] }));
1169
1430
  };
1170
1431
  export default TMDcmtForm;
1171
1432
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.19.0-dev2.27",
3
+ "version": "6.19.0-dev2.29",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",