@topconsultnpm/sdkui-react 6.20.0-dev1.3 → 6.20.0-dev1.30

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.
Files changed (64) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +3 -3
  2. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -0
  3. package/lib/components/NewComponents/ContextMenu/hooks.js +8 -4
  4. package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -1
  5. package/lib/components/NewComponents/ContextMenu/styles.js +41 -8
  6. package/lib/components/NewComponents/ContextMenu/types.d.ts +1 -0
  7. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +38 -30
  8. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +8 -0
  9. package/lib/components/NewComponents/FloatingMenuBar/styles.js +30 -19
  10. package/lib/components/base/TMAccordion.js +2 -2
  11. package/lib/components/base/TMCustomButton.js +41 -5
  12. package/lib/components/base/TMDataGrid.d.ts +2 -2
  13. package/lib/components/base/TMDataGrid.js +16 -5
  14. package/lib/components/editors/TMHtmlEditor.js +1 -1
  15. package/lib/components/editors/TMMetadataValues.js +20 -2
  16. package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -7
  17. package/lib/components/features/documents/TMDcmtBlog.js +29 -2
  18. package/lib/components/features/documents/TMDcmtForm.js +268 -168
  19. package/lib/components/features/documents/TMDcmtPreview.js +37 -66
  20. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
  21. package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +6 -11
  22. package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
  23. package/lib/components/features/search/TMSearchResult.js +74 -111
  24. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
  25. package/lib/components/features/search/TMSearchResultsMenuItems.js +26 -43
  26. package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
  27. package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
  28. package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
  29. package/lib/components/forms/Login/LoginValidatorService.js +7 -2
  30. package/lib/components/forms/Login/TMLoginForm.js +34 -6
  31. package/lib/css/tm-sdkui.css +1 -1
  32. package/lib/helper/SDKUI_Globals.d.ts +13 -14
  33. package/lib/helper/SDKUI_Globals.js +9 -0
  34. package/lib/helper/SDKUI_Localizator.d.ts +8 -0
  35. package/lib/helper/SDKUI_Localizator.js +98 -0
  36. package/lib/helper/TMPdfViewer.d.ts +8 -0
  37. package/lib/helper/TMPdfViewer.js +187 -0
  38. package/lib/helper/TMUtils.d.ts +3 -1
  39. package/lib/helper/TMUtils.js +51 -0
  40. package/lib/helper/checkinCheckoutManager.d.ts +85 -0
  41. package/lib/helper/checkinCheckoutManager.js +348 -0
  42. package/lib/helper/devextremeCustomMessages.d.ts +30 -0
  43. package/lib/helper/devextremeCustomMessages.js +30 -0
  44. package/lib/helper/helpers.js +7 -1
  45. package/lib/helper/index.d.ts +2 -0
  46. package/lib/helper/index.js +2 -0
  47. package/lib/helper/queryHelper.js +29 -0
  48. package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
  49. package/lib/hooks/useCheckInOutOperations.js +223 -0
  50. package/lib/services/platform_services.d.ts +1 -1
  51. package/package.json +5 -2
  52. package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
  53. package/lib/components/NewComponents/Notification/Notification.js +0 -60
  54. package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
  55. package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
  56. package/lib/components/NewComponents/Notification/index.d.ts +0 -2
  57. package/lib/components/NewComponents/Notification/index.js +0 -2
  58. package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
  59. package/lib/components/NewComponents/Notification/styles.js +0 -180
  60. package/lib/components/NewComponents/Notification/types.d.ts +0 -18
  61. package/lib/components/NewComponents/Notification/types.js +0 -1
  62. package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
  63. package/lib/helper/cicoHelper.d.ts +0 -31
  64. package/lib/helper/cicoHelper.js +0 -155
@@ -1,15 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import TMDcmtPreview from './TMDcmtPreview';
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
- import { ContextMenu } from 'devextreme-react';
4
+ import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
6
5
  import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
7
6
  import { DownloadTypes, FormModes, DcmtOperationTypes } from '../../../ts';
8
7
  import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
9
8
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
10
9
  import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
11
10
  import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
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';
11
+ import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, 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, getDcmtCicoStatus, IconFileDots } from '../../../helper';
13
12
  import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
14
13
  import { Gutters, TMColors } from '../../../utils/theme';
15
14
  import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
@@ -42,9 +41,15 @@ import TMToppyMessage from '../../../helper/TMToppyMessage';
42
41
  import { getTaskAssignedToMe } from '../tasks/TMTasksUtils';
43
42
  import TMCustomButton from '../../base/TMCustomButton';
44
43
  import ToppyDraggableHelpCenter from '../assistant/ToppyDraggableHelpCenter';
44
+ import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
45
+ import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
46
+ import TMDcmtCheckoutInfoForm from '../search/TMDcmtCheckoutInfoForm';
47
+ import styled from 'styled-components';
48
+ import { ContextMenu } from '../../NewComponents/ContextMenu';
45
49
  let abortControllerLocal = new AbortController();
46
50
  //#endregion
47
51
  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 = [], openS4TViewer = false, onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
52
+ const { showHistory, showHistoryCallback, hideHistoryCallback, showCheckoutInformationForm, commentFormState, hideCommentFormCallback, showCheckoutInformationFormCallback, hideCheckoutInformationFormCallback, copyCheckoutPathToClipboardCallback, handleCheckOutCallback, handleCheckInCallback, refreshPreviewTrigger, showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, } = useCheckInOutOperations();
48
53
  const [id, setID] = useState('');
49
54
  const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
50
55
  const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
@@ -68,6 +73,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
68
73
  const [layout, setLayout] = useState();
69
74
  const [customButtonsLayout, setCustomButtonsLayout] = useState();
70
75
  const [customButton, setCustomButton] = useState();
76
+ const [allUsers, setAllUsers] = useState([]);
71
77
  const appliedInputMidsRef = useRef(null);
72
78
  // Refs per evitare stale closure nei callback
73
79
  // I useCallback catturano i valori delle dipendenze al momento della creazione.
@@ -96,10 +102,18 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
96
102
  const [isInitialLoading, setIsInitialLoading] = useState(true);
97
103
  const [isNavigating, setIsNavigating] = useState(false);
98
104
  const [dcmtReferences, setDcmtReferences] = useState(undefined);
99
- // Dcmt Blog states
100
- const [blogsDatasource, setBlogsDatasource] = useState([]);
101
- const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
102
- const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
105
+ // Stato per triggerare il refresh del blog dall'esterno
106
+ const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
107
+ const triggerBlogRefresh = useCallback(async () => {
108
+ setRefreshBlogTrigger(prev => prev + 1);
109
+ }, []);
110
+ useEffect(() => {
111
+ const fetchAllUsers = async () => {
112
+ const users = await UserListCacheService.GetAllAsync();
113
+ setAllUsers(users ?? []);
114
+ };
115
+ fetchAllUsers();
116
+ }, []);
103
117
  useEffect(() => {
104
118
  if (!allowButtonsRefs)
105
119
  setDcmtReferences(undefined);
@@ -123,7 +137,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
123
137
  selectMIDs: selectMIDs,
124
138
  dtdResult: {
125
139
  rows: [rowValues],
126
- columns: selectMIDs.map(mid => ({ name: `MID_${mid}` }))
140
+ columns: selectMIDs.map(mid => ({ name: `MID_${mid}`, }))
127
141
  },
128
142
  dcmtsFound: 1,
129
143
  dcmtsReturned: 1
@@ -409,6 +423,21 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
409
423
  const workItemSetIDValue = useMemo(() => formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [formData]);
410
424
  // Valore derivato: true se formData ha elementi validi
411
425
  const hasFormData = useMemo(() => formData.length > 0 && formData.some(md => md.mid && md.mid > 99), [formData]);
426
+ const handleCheckOutOperationCallback = async (checkout) => {
427
+ if (!currentDcmt)
428
+ return;
429
+ await handleCheckOutCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, checkout, fromDTD?.name ?? SDKUI_Localizator.SearchResult, downloadDcmtsAsync, updateCurrentDcmt);
430
+ };
431
+ const handleCheckInOperationCallback = async () => {
432
+ if (!currentDcmt)
433
+ return;
434
+ await handleCheckInCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, fileName: fromDTD?.name ?? SDKUI_Localizator.SearchResult }, updateCurrentDcmt, undefined);
435
+ };
436
+ const copyCheckoutPathToClipboardOperationCallback = () => {
437
+ if (!currentDcmt)
438
+ return;
439
+ copyCheckoutPathToClipboardCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, fromDTD?.name ?? SDKUI_Localizator.SearchResult);
440
+ };
412
441
  useEffect(() => {
413
442
  const loadAllWfData = async () => {
414
443
  if (layoutMode !== LayoutModes.Update || !DID || fromDTD?.templateTID !== TemplateTIDs.WF_WIApprView) {
@@ -515,23 +544,20 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
515
544
  const items = [];
516
545
  const operationsItems = [];
517
546
  operationsItems.push({
518
- icon: svgToString(_jsx(IconDownload, {})),
519
- operationType: 'singleRow',
547
+ icon: _jsx(IconDownload, {}),
520
548
  disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes,
521
- text: SDKUI_Localizator.DownloadFile,
549
+ name: SDKUI_Localizator.DownloadFile,
522
550
  onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt, "download", undefined, undefined, true)
523
551
  }, {
524
- icon: svgToString(_jsx(IconDownload, {})),
525
- operationType: 'singleRow',
552
+ icon: _jsx(IconDownload, {}),
526
553
  disabled: !isXMLFileExt(currentDcmt?.fileExt),
527
- text: SDKUI_Localizator.DownloadXMLAttachments,
554
+ name: SDKUI_Localizator.DownloadXMLAttachments,
528
555
  onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, "download", undefined, openConfirmAttachmentsDialog, true)
529
556
  });
530
557
  if (layoutMode === LayoutModes.Update && DID) {
531
558
  operationsItems.push({
532
- icon: svgToString(_jsx(IconStar, {})),
533
- text: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
534
- operationType: 'singleRow',
559
+ icon: _jsx(IconStar, {}),
560
+ name: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
535
561
  disabled: false,
536
562
  onClick: async () => {
537
563
  await runOperationAsync(getDcmts(), DcmtOperationTypes.AddToFavs);
@@ -540,9 +566,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
540
566
  }
541
567
  if (onTaskCreateRequest && layoutMode === LayoutModes.Update && DID) {
542
568
  operationsItems.push({
543
- icon: svgToString(_jsx(IconActivity, {})),
544
- text: SDKUI_Localizator.CreateContextualTask,
545
- operationType: 'singleRow',
569
+ icon: _jsx(IconActivity, {}),
570
+ name: SDKUI_Localizator.CreateContextualTask,
546
571
  disabled: false,
547
572
  onClick: () => {
548
573
  const dcmt = getDcmts()[0];
@@ -559,76 +584,106 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
559
584
  }
560
585
  if (operationsItems.length > 0) {
561
586
  items.push({
562
- icon: svgToString(_jsx(IconCheck, {})),
563
- text: SDKUI_Localizator.DocumentOperations,
564
- items: operationsItems
587
+ icon: _jsx(IconCheck, {}),
588
+ name: SDKUI_Localizator.DocumentOperations,
589
+ submenu: operationsItems
590
+ });
591
+ }
592
+ if (fromDTD?.id !== SystemTIDs.Drafts) {
593
+ // Check in/Check out menu
594
+ const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
595
+ items.push({
596
+ icon: _jsx(IconFileDots, {}),
597
+ name: "Check in/Check out",
598
+ disabled: false,
599
+ submenu: [
600
+ {
601
+ name: 'Check out',
602
+ disabled: !cicoEnabled || checkoutStatus.isCheckedOut,
603
+ onClick: () => handleCheckOutOperationCallback(true),
604
+ },
605
+ {
606
+ name: 'Check in',
607
+ onClick: () => handleCheckInOperationCallback(),
608
+ disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode'
609
+ },
610
+ {
611
+ name: SDKUI_Localizator.CancelCheckOut,
612
+ disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode',
613
+ onClick: () => handleCheckOutOperationCallback(false),
614
+ },
615
+ {
616
+ name: SDKUI_Localizator.CheckoutInfo,
617
+ onClick: showCheckoutInformationFormCallback,
618
+ disabled: !checkoutStatus.isCheckedOut
619
+ },
620
+ {
621
+ name: SDKUI_Localizator.CopyCheckoutPath,
622
+ onClick: copyCheckoutPathToClipboardOperationCallback,
623
+ disabled: !checkoutStatus.isCheckedOut
624
+ },
625
+ {
626
+ name: SDKUI_Localizator.History,
627
+ disabled: !cicoEnabled,
628
+ onClick: showHistoryCallback,
629
+ },
630
+ ]
565
631
  });
566
632
  }
567
633
  if (allowRelations && layoutMode === LayoutModes.Update && DID) {
568
634
  const relationsItems = [
569
635
  {
570
- icon: svgToString(_jsx(IconPair, {})),
571
- text: SDKUI_Localizator.MatchManyDocumentsManyToMany,
572
- operationType: 'singleRow',
636
+ icon: _jsx(IconPair, {}),
637
+ name: SDKUI_Localizator.MatchManyDocumentsManyToMany,
573
638
  disabled: !hasManyToManyRelation,
574
639
  onClick: async () => await pairManyToMany?.(true)
575
640
  },
576
641
  {
577
- icon: svgToString(_jsx(IconUnpair, {})),
578
- text: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
579
- operationType: 'singleRow',
642
+ icon: _jsx(IconUnpair, {}),
643
+ name: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
580
644
  disabled: !hasManyToManyRelation,
581
645
  onClick: async () => await pairManyToMany?.(false)
582
646
  },
583
647
  {
584
- icon: svgToString(_jsx(IconArchiveMaster, {})),
585
- text: SDKUI_Localizator.ArchiveMasterDocument,
586
- operationType: 'singleRow',
587
- beginGroup: true,
648
+ icon: _jsx(IconArchiveMaster, {}),
649
+ name: SDKUI_Localizator.ArchiveMasterDocument,
588
650
  disabled: canArchiveMasterRelation !== true,
589
651
  onClick: async () => { if (TID)
590
652
  await archiveMasterDocuments?.(TID); }
591
653
  },
592
654
  {
593
- icon: svgToString(_jsx(IconArchiveDetail, {})),
594
- text: SDKUI_Localizator.ArchiveDetailDocument,
595
- operationType: 'singleRow',
655
+ icon: _jsx(IconArchiveDetail, {}),
656
+ name: SDKUI_Localizator.ArchiveDetailDocument,
596
657
  disabled: canArchiveDetailRelation !== true,
597
658
  onClick: async () => { if (TID)
598
659
  await archiveDetailDocuments?.(TID); }
599
660
  },
600
661
  {
601
- icon: svgToString(_jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' })),
602
- text: SDKUI_Localizator.DcmtsMaster,
603
- operationType: 'singleRow',
604
- visible: true,
605
- beginGroup: true,
662
+ icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }),
663
+ name: SDKUI_Localizator.DcmtsMaster,
606
664
  disabled: !currentTIDHasMasterRelations || isMasterDisabled,
607
665
  onClick: () => { if (!isMasterDisabled)
608
666
  setIsOpenMaster(!isOpenMaster); }
609
667
  },
610
668
  {
611
- icon: svgToString(_jsx(IconDetailDcmts, {})),
612
- text: SDKUI_Localizator.DcmtsDetail,
613
- operationType: 'singleRow',
669
+ icon: _jsx(IconDetailDcmts, {}),
670
+ name: SDKUI_Localizator.DcmtsDetail,
614
671
  disabled: !currentTIDHasDetailRelations || isDetailsDisabled,
615
- visible: true,
616
672
  onClick: () => { if (!isDetailsDisabled)
617
673
  setIsOpenDetails(!isOpenDetails); }
618
674
  }
619
675
  ];
620
676
  items.push({
621
- icon: svgToString(_jsx(IconRelation, {})),
622
- text: SDKUI_Localizator.Relations,
623
- items: relationsItems
677
+ icon: _jsx(IconRelation, {}),
678
+ name: SDKUI_Localizator.Relations,
679
+ submenu: relationsItems
624
680
  });
625
681
  }
626
682
  if (layoutMode === LayoutModes.Update && DID) {
627
683
  const fullTextItems = [
628
684
  {
629
- icon: svgToString(_jsx(IconInfo, {})),
630
- text: SDKUI_Localizator.IndexingInformation,
631
- operationType: 'singleRow',
685
+ icon: _jsx(IconInfo, {}),
686
+ name: SDKUI_Localizator.IndexingInformation,
632
687
  disabled: false,
633
688
  onClick: async () => {
634
689
  try {
@@ -646,18 +701,16 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
646
701
  }
647
702
  },
648
703
  {
649
- icon: svgToString(_jsx(IconArchiveDoc, {})),
650
- text: SDKUI_Localizator.IndexOrReindex,
651
- operationType: 'singleRow',
704
+ icon: _jsx(IconArchiveDoc, {}),
705
+ name: SDKUI_Localizator.IndexOrReindex,
652
706
  disabled: false,
653
707
  onClick: async () => {
654
708
  await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchReindex);
655
709
  }
656
710
  },
657
711
  {
658
- icon: svgToString(_jsx(IconDelete, {})),
659
- text: SDKUI_Localizator.IndexingDelete,
660
- operationType: 'singleRow',
712
+ icon: _jsx(IconDelete, {}),
713
+ name: SDKUI_Localizator.IndexingDelete,
661
714
  disabled: false,
662
715
  onClick: async () => {
663
716
  await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchPurge);
@@ -665,9 +718,9 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
665
718
  }
666
719
  ];
667
720
  items.push({
668
- icon: svgToString(_jsx(IconSearch, {})),
669
- text: SDKUI_Localizator.FullTextSearch,
670
- items: fullTextItems
721
+ icon: _jsx(IconSearch, {}),
722
+ name: SDKUI_Localizator.FullTextSearch,
723
+ submenu: fullTextItems
671
724
  });
672
725
  }
673
726
  // Aggiungi submenu "Bottoni personalizzati" se esistono customButtons
@@ -675,18 +728,19 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
675
728
  const customButtonsItems = customButtonsLayout.customButtons
676
729
  .filter((customButton) => customButton.isForUpdate && customButton.isForUpdate > 0)
677
730
  .map((customButton) => ({
678
- icon: svgToString(TMImageLibrary({ imageID: customButton.glyphID, showPath: true })),
679
- text: customButton.title || 'Bottone personalizzato',
731
+ icon: TMImageLibrary({ imageID: customButton.glyphID, showPath: false }),
732
+ name: customButton.title || 'Bottone personalizzato',
680
733
  onClick: () => setCustomButton(customButton)
681
734
  }));
682
735
  items.push({
683
- icon: svgToString(_jsx(IconCheck, {})),
684
- text: SDKUI_Localizator.CustomButtons,
685
- items: customButtonsItems
736
+ icon: _jsx(IconCheck, {}),
737
+ name: SDKUI_Localizator.CustomButtons,
738
+ submenu: customButtonsItems
686
739
  });
687
740
  }
688
741
  return items;
689
742
  }, [
743
+ fromDTD?.id,
690
744
  fromDTD?.perm?.canRetrieveFile,
691
745
  fromDTD?.description,
692
746
  currentDcmt?.fileExt,
@@ -712,8 +766,9 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
712
766
  openConfirmAttachmentsDialog
713
767
  ]);
714
768
  const isModified = useMemo(() => calcIsModified(formData, formDataOrig), [formData, formDataOrig]);
715
- 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 &&
716
- _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]);
769
+ 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 &&
770
+ _jsx(ContextMenu, { items: commandsMenuItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) }), layoutMode === LayoutModes.Ark &&
771
+ _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, commandsMenuItems, handlePassToSearch]);
717
772
  const handleUndo = useCallback(() => {
718
773
  setFormData(structuredClone(formDataOrig));
719
774
  }, [formDataOrig]);
@@ -729,6 +784,60 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
729
784
  },
730
785
  });
731
786
  }, [isModal, id, layoutMode]);
787
+ // Funzione helper per ottenere e aggiornare i metadati con gestione errori centralizzata
788
+ const refreshMetadataAsync = useCallback(async () => {
789
+ let metadataResult = undefined;
790
+ let hasGetMetadataError = false;
791
+ try {
792
+ metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
793
+ }
794
+ catch (metadataError) {
795
+ hasGetMetadataError = true;
796
+ // Estrai ErrorCode dal campo detail se disponibile
797
+ let errorCode = undefined;
798
+ if (metadataError?.isApiException && metadataError?.response?.detail) {
799
+ try {
800
+ const detailObj = JSON.parse(metadataError.response.detail);
801
+ errorCode = detailObj?.ErrorCode;
802
+ }
803
+ catch (parseError) {
804
+ console.log("Impossibile parsare il detail dell'eccezione:", parseError);
805
+ }
806
+ }
807
+ // Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
808
+ if (errorCode === -5) {
809
+ TMMessageBoxManager.show({
810
+ message: SDKUI_Localizator.DcmtOutOfView,
811
+ buttons: [ButtonNames.OK],
812
+ });
813
+ }
814
+ else {
815
+ TMExceptionBoxManager.show({ exception: metadataError });
816
+ }
817
+ // Usa null per indicare al callback che c'è stato un errore e non deve ritentare
818
+ metadataResult = null;
819
+ }
820
+ // Aggiorna i metadati locali solo se non ci sono stati errori
821
+ if (!hasGetMetadataError && metadataResult && metadataResult !== null) {
822
+ await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
823
+ }
824
+ return { success: !hasGetMetadataError, result: metadataResult };
825
+ }, [TID, DID, setMetadataList]);
826
+ const updateCurrentDcmt = useCallback(async () => {
827
+ try {
828
+ TMSpinner.show({ description: 'Aggiornamento in corso...' });
829
+ const { success, result: metadataResult } = await refreshMetadataAsync();
830
+ if (!success)
831
+ onClose?.();
832
+ await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
833
+ }
834
+ catch (e) {
835
+ TMExceptionBoxManager.show({ exception: e });
836
+ }
837
+ finally {
838
+ TMSpinner.hide();
839
+ }
840
+ }, [refreshMetadataAsync, onClose]);
732
841
  const handleSave = useCallback(async () => {
733
842
  const ue = new UpdateEngineByID(SDK_Globals.tmSession);
734
843
  ue.DID = DID;
@@ -765,55 +874,20 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
765
874
  const savedFormData = structuredClone(formDataRef.current);
766
875
  setFormDataOrig(savedFormData);
767
876
  formDataOrigRef.current = savedFormData;
768
- // Tenta di ottenere i metadati aggiornati
769
- let metadataResult = undefined;
770
- let hasGetMetadataError = false;
771
- try {
772
- metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
773
- }
774
- catch (metadataError) {
775
- hasGetMetadataError = true;
776
- // Estrai ErrorCode dal campo detail se disponibile
777
- let errorCode = undefined;
778
- if (metadataError?.isApiException && metadataError?.response?.detail) {
779
- try {
780
- const detailObj = JSON.parse(metadataError.response.detail);
781
- errorCode = detailObj?.ErrorCode;
782
- }
783
- catch (parseError) {
784
- console.log("Impossibile parsare il detail dell'eccezione:", parseError);
785
- }
786
- }
787
- // Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
788
- if (errorCode === -5) {
789
- TMMessageBoxManager.show({
790
- message: SDKUI_Localizator.DcmtOutOfView,
791
- buttons: [ButtonNames.OK],
792
- });
793
- }
794
- else {
795
- TMExceptionBoxManager.show({ exception: metadataError });
796
- }
797
- // Usa null per indicare al callback che c'è stato un errore e non deve ritentare
798
- metadataResult = null;
799
- }
877
+ // Usa la funzione helper per ottenere i metadati aggiornati
878
+ const { success, result: metadataResult } = await refreshMetadataAsync();
800
879
  // Esegui sempre il callback:
801
880
  // - Se metadataResult è un oggetto: refresh normale
802
881
  // - Se metadataResult è null: GetMetadataAsync fallito, rimuove il documento dalla griglia senza ritentare
803
882
  // - Se metadataResult è undefined: nessun parametro passato, il callback può decidere cosa fare
804
883
  await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
805
884
  // Mostra messaggio di successo solo se non ci sono stati errori critici
806
- if (!hasGetMetadataError) {
807
- if (metadataResult && metadataResult !== null) {
808
- // Usa fromDTDRef.current invece di fromDTD per evitare stale closure.
809
- // fromDTD potrebbe essere undefined/vuoto nel callback se lo stato è cambiato,
810
- // mentre fromDTDRef.current contiene sempre il valore corrente sincronizzato tramite useEffect.
811
- await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
812
- }
885
+ if (success) {
813
886
  ShowAlert({ mode: 'success', title: 'Form di documento', message: 'Le modifiche sono state salvate con successo', duration: 3000 });
814
887
  }
815
- else
888
+ else {
816
889
  onClose?.();
890
+ }
817
891
  }
818
892
  catch (e) {
819
893
  TMExceptionBoxManager.show({ exception: e });
@@ -821,7 +895,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
821
895
  finally {
822
896
  TMSpinner.hide();
823
897
  }
824
- }, [DID, TID, getSpecificChangedKeysWithValues, onSavedAsyncCallback, onClose, setMetadataList]);
898
+ }, [DID, TID, getSpecificChangedKeysWithValues, refreshMetadataAsync, onSavedAsyncCallback, onClose]);
825
899
  const handleArchiveCompleted = useCallback(async () => {
826
900
  let firstBlock = true;
827
901
  let maxFileSize = 0;
@@ -1004,50 +1078,40 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1004
1078
  setShowAll(true);
1005
1079
  }
1006
1080
  }, [shouldShowAll, showAll]);
1007
- const fetchBlogDataAsync = useCallback(async (tid, did) => {
1008
- try {
1009
- TMSpinner.show({ description: 'Caricamento - Bacheca...' });
1010
- const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
1011
- setBlogsDatasource(res ?? []);
1012
- setHasLoadedDataOnce(true);
1013
- setLastLoadedDid(did);
1014
- }
1015
- catch (e) {
1016
- let err = e;
1017
- TMExceptionBoxManager.show({ exception: err });
1018
- }
1019
- finally {
1020
- TMSpinner.hide();
1021
- }
1022
- }, []);
1023
1081
  const afterTaskSaved = useCallback(async (task, formMode, forceRefresh = false) => {
1024
1082
  const shouldRefresh = forceRefresh || (task && task.state === Task_States.Completed) || formMode === FormModes.Create || formMode === FormModes.Duplicate;
1025
1083
  if (TID && DID && shouldRefresh) {
1026
- await fetchBlogDataAsync(TID, DID);
1084
+ await triggerBlogRefresh();
1027
1085
  }
1028
- }, [TID, DID]);
1086
+ }, [TID, DID, triggerBlogRefresh]);
1087
+ const checkoutBadge = useMemo(() => {
1088
+ const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
1089
+ if (!cicoEnabled || !checkoutStatus.isCheckedOut)
1090
+ return null;
1091
+ return (_jsx(Ribbon, { "$isMobile": isMobile, children: _jsx(TMTooltip, { content: checkoutStatus.editLockTooltipText, position: "right", children: _jsx("span", { children: checkoutStatus.mode === 'editMode' ? SDKUI_Localizator.CheckOut : 'Locked' }) }) }));
1092
+ }, [formData, fromDTD, isMobile]);
1029
1093
  const tmDcmtForm = useMemo(() => {
1030
- return _jsx(_Fragment, { children: metadataValuesSource.length > 0 &&
1031
- _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
1032
- setFormData((prevItems) => prevItems.map((item) => {
1033
- const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
1034
- return newItem ? { ...item, ...newItem } : item;
1035
- }));
1036
- }, onAdvancedMenuClick: (e) => {
1037
- switch (e.button) {
1038
- case AdvancedMenuButtons.DistinctValues:
1039
- setIsOpenDistinctValues(!isOpenDistinctValues);
1040
- break;
1041
- case AdvancedMenuButtons.FormulaEditor:
1042
- setIsOpenFormulaEditor(!isOpenFormulaEditor);
1043
- break;
1044
- }
1045
- } }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: handleConfirmAction }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: handleUndo })] }) :
1046
- _jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: handleConfirmAction }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: handleClearForm }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: handleUndo })] }) }) }), customButton && _jsx(TMCustomButton, { button: customButton, formData: formData, selectedItems: [], onClose: () => setCustomButton(undefined) }), totalItems > listMaxItems &&
1047
- !isApprView &&
1048
- TID !== SystemTIDs.Drafts &&
1049
- !shouldShowAll &&
1050
- _jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), _jsx(ConfirmAttachmentsDialog, {})] }) });
1094
+ return _jsxs(_Fragment, { children: [checkoutBadge && _jsx("div", { style: { padding: '10px', display: 'flex', justifyContent: 'center' }, children: checkoutBadge }), metadataValuesSource.length > 0 &&
1095
+ _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
1096
+ setFormData((prevItems) => prevItems.map((item) => {
1097
+ const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
1098
+ return newItem ? { ...item, ...newItem } : item;
1099
+ }));
1100
+ }, onAdvancedMenuClick: (e) => {
1101
+ switch (e.button) {
1102
+ case AdvancedMenuButtons.DistinctValues:
1103
+ setIsOpenDistinctValues(!isOpenDistinctValues);
1104
+ break;
1105
+ case AdvancedMenuButtons.FormulaEditor:
1106
+ setIsOpenFormulaEditor(!isOpenFormulaEditor);
1107
+ break;
1108
+ }
1109
+ } }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: handleConfirmAction }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: handleUndo })] }) :
1110
+ _jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: handleConfirmAction }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: handleClearForm }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: handleUndo })] }) }) }), customButton && _jsx(TMCustomButton, { button: customButton, formData: formData, selectedItems: [], onClose: () => setCustomButton(undefined) }), totalItems > listMaxItems &&
1111
+ !isApprView &&
1112
+ TID !== SystemTIDs.Drafts &&
1113
+ !shouldShowAll &&
1114
+ _jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), _jsx(ConfirmAttachmentsDialog, {})] })] });
1051
1115
  }, [
1052
1116
  TID,
1053
1117
  DID,
@@ -1075,11 +1139,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1075
1139
  handleUndo,
1076
1140
  handleClearForm
1077
1141
  ]);
1078
- const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { blogsDatasource: blogsDatasource, hasLoadedDataOnce: hasLoadedDataOnce, lastLoadedDid: lastLoadedDid, setBlogsDatasource: setBlogsDatasource, setHasLoadedDataOnce: setHasLoadedDataOnce, setLastLoadedDid: setLastLoadedDid, fetchBlogDataAsync: fetchBlogDataAsync, tid: TID, did: DID, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [blogsDatasource, hasLoadedDataOnce, lastLoadedDid, TID, DID, allTasks]);
1142
+ const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, allTasks: allTasks, fetchBlogDataTrigger: refreshBlogTrigger, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks, refreshBlogTrigger]);
1079
1143
  const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
1080
1144
  const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, fromDTD: fromDTD, layoutMode: layoutMode, onFileUpload: (file) => {
1081
1145
  setDcmtFile(file);
1082
- }, enableDragDropOverlay: enableDragDropOverlay }), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile]);
1146
+ }, enableDragDropOverlay: enableDragDropOverlay }, refreshPreviewTrigger), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile]);
1083
1147
  const tmWF = useMemo(() => {
1084
1148
  if (isWFDataLoading) {
1085
1149
  return (_jsx("div", { style: {
@@ -1344,23 +1408,23 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1344
1408
  height: '100%',
1345
1409
  position: 'relative',
1346
1410
  overflow: 'hidden'
1347
- }, children: [_jsxs("div", { style: { width: '100%', height: '100%', display: isOpenDetails || isOpenMaster ? 'none' : 'flex' }, children: [isNavigating && _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: false }), (fromDTD) && _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: [(groupId && groupId.length > 0)
1348
- ? _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
1349
- : _jsxs(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: defaultPanelDimensions, initialDimensions: defaultPanelDimensions, initialMobilePanelId: 'tmDcmtForm', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: [_jsx(WfButtonStateHandler, { isWFDisabled: isWFDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
1350
- _jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onSelectionChanged: (e) => {
1351
- if (!e)
1352
- return;
1353
- setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
1354
- } }), isOpenFormulaEditor &&
1355
- _jsx(TMFormulaEditor, { isModal: true, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
1356
- setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
1357
- setFocusedMetadataValue(prevState => ({
1358
- ...prevState,
1359
- isSelected: true,
1360
- isEditable: true,
1361
- value: FormulaHelper.addFormulaTag(newFormula.expression)
1362
- }));
1363
- } }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowMoreInfoPopup(false) }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }), _jsx(ToppyDraggableHelpCenter, { initialIsCollapsed: false, deviceType: deviceType, isVisible: (showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && !openS4TViewer, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [showToppyForApprove && (workItems.length === 1 ?
1411
+ }, children: [_jsxs("div", { style: { width: '100%', height: '100%', display: isOpenDetails || isOpenMaster ? 'none' : 'flex' }, children: [isNavigating && _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: false }), (fromDTD) && _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: [(groupId && groupId.length > 0)
1412
+ ? _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
1413
+ : _jsxs(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: defaultPanelDimensions, initialDimensions: defaultPanelDimensions, initialMobilePanelId: 'tmDcmtForm', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: [_jsx(WfButtonStateHandler, { isWFDisabled: isWFDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
1414
+ _jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onSelectionChanged: (e) => {
1415
+ if (!e)
1416
+ return;
1417
+ setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
1418
+ } }), isOpenFormulaEditor &&
1419
+ _jsx(TMFormulaEditor, { isModal: true, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
1420
+ setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
1421
+ setFocusedMetadataValue(prevState => ({
1422
+ ...prevState,
1423
+ isSelected: true,
1424
+ isEditable: true,
1425
+ value: FormulaHelper.addFormulaTag(newFormula.expression)
1426
+ }));
1427
+ } }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowMoreInfoPopup(false) }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }) }), _jsx(ToppyDraggableHelpCenter, { initialIsCollapsed: false, deviceType: deviceType, isVisible: (showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && !openS4TViewer, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [showToppyForApprove && (workItems.length === 1 ?
1364
1428
  _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true), dtd: fromDTD })
1365
1429
  :
1366
1430
  _jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Devi approvare ${workItems.length} workitem(s) per questo documento.`, `Vai alla sezione di approvazione.`] })), showToppyForCompleteMoreInfo && (_jsxs(_Fragment, { children: [_jsx("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: `${SDKUI_Localizator.MoreInfoCompleteRequestSentBy} ${taskMoreInfo?.fromName}!` }), _jsx(TMButton, { caption: SDKUI_Localizator.CommentAndComplete, color: 'success', showTooltip: false, onClick: () => {
@@ -1414,7 +1478,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1414
1478
  finally {
1415
1479
  TMSpinner.hide();
1416
1480
  }
1417
- }, 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: () => {
1481
+ }, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false })), (showHistory && fromDTD && currentDcmt) && _jsx(TMViewHistoryDcmt, { fromDTD: fromDTD, deviceType: deviceType, inputDcmt: { TID: currentDcmt.tid, DID: currentDcmt.did }, onClose: hideHistoryCallback, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showCheckoutInformationForm && fromDTD && currentDcmt) &&
1482
+ _jsx(TMDcmtCheckoutInfoForm, { dtdName: fromDTD.name ?? SDKUI_Localizator.SearchResult, selectedDcmtOrFocused: { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, onClose: hideCheckoutInformationFormCallback }), (commentFormState.show && currentDcmt) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: currentDcmt.tid, did: currentDcmt.did } }, onClose: hideCommentFormCallback, refreshCallback: triggerBlogRefresh, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], isCommentRequired: commentFormState.isRequired, removeAndEditAttachment: commentFormState.removeAndEditAttachment }), 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: () => {
1418
1483
  setIsOpenArchiveRelationForm(false);
1419
1484
  setArchiveType(undefined);
1420
1485
  setArchiveRelatedDcmtFormTID(undefined);
@@ -1448,8 +1513,11 @@ const applyMetadataFilter = (data, showAll, listMaxItems, TID) => {
1448
1513
  o.mid === SystemMIDsAsNumber.FileSize ||
1449
1514
  o.mid === SystemMIDsAsNumber.LastUpdateTime ||
1450
1515
  o.mid === SystemMIDsAsNumber.CreationTime;
1516
+ const chronologySystemFilter = (o) => baseFilter(o) ||
1517
+ o.mid === SystemMIDsAsNumber.FileExt ||
1518
+ o.mid === SystemMIDsAsNumber.FileSize;
1451
1519
  // Select the appropriate filter based on document type
1452
- const currentFilter = TID === SystemTIDs.Drafts ? draftFilter : baseFilter;
1520
+ const currentFilter = TID === SystemTIDs.Drafts ? draftFilter : TID === SystemTIDs.Chronology ? chronologySystemFilter : baseFilter;
1453
1521
  // Apply filter once
1454
1522
  const filteredData = data.filter(currentFilter);
1455
1523
  // Return all filtered data or slice to max items
@@ -1503,3 +1571,35 @@ const TMDcmtPreviewWrapper = ({ currentDcmt, layoutMode, fromDTD, dcmtFile, devi
1503
1571
  _jsx(TMDcmtPreview, { isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, dcmtData: currentDcmt, isResizingActive: isResizingActive }) :
1504
1572
  _jsx(TMFileUploader, { onFileUpload: onFileUpload, onClose: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType, isResizingActive: isResizingActive, enableDragDropOverlay: panelVisibility['tmDcmtPreview'] && enableDragDropOverlay }));
1505
1573
  };
1574
+ const Ribbon = styled.div `
1575
+ font-size: 0.85rem;
1576
+ font-weight: 600;
1577
+ color: #fff;
1578
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
1579
+ --f: .4em; /* control the folded part */
1580
+ position: absolute;
1581
+ top: 2px;
1582
+ left: 2px;
1583
+ z-index: 1200;
1584
+ line-height: 1.6;
1585
+ padding-inline: 0.8lh;
1586
+ padding-bottom: var(--f);
1587
+ border-image: conic-gradient(#0008 0 0) 51%/var(--f);
1588
+ clip-path: polygon(100% calc(100% - var(--f)),100% 100%,calc(100% - var(--f)) calc(100% - var(--f)),var(--f) calc(100% - var(--f)), 0 100%,0 calc(100% - var(--f)),999px calc(100% - var(--f) - 999px),calc(100% - 999px) calc(100% - var(--f) - 999px));
1589
+ transform: translate(calc((cos(45deg) - 1)*100%), -100%) rotate(-45deg);
1590
+ transform-origin: 100% 100%;
1591
+ background-color: rgba(217, 148, 13, 0.92);
1592
+ display: inline-block;
1593
+ padding-top: 0.1em;
1594
+ white-space: nowrap;
1595
+ transition: ${props => props.$isMobile ? 'none' : 'all 0.3s ease'};
1596
+ cursor: 'default';
1597
+
1598
+ ${props => !props.$isMobile && `
1599
+ &:hover {
1600
+ background-color: #d9940d;
1601
+ font-size: 1.1rem;
1602
+ transform: translate(calc((cos(45deg) - 1)*100%), -100%) rotate(-45deg) scale(1.05);
1603
+ }
1604
+ `}
1605
+ `;