@topconsultnpm/sdkui-react 6.21.0-t4 → 6.21.0

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.
@@ -197,6 +197,7 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
197
197
  onClick: item.onClick,
198
198
  disabled: item.disabled,
199
199
  isPinned: isPinned,
200
+ visible: item.visible,
200
201
  });
201
202
  }
202
203
  // Recursively process submenus
@@ -321,7 +322,7 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
321
322
  }
322
323
  });
323
324
  }, [maxItems]);
324
- // Get current item state (disabled and onClick) from contextMenuItems
325
+ // Get current item state (disabled, onClick, visible) from contextMenuItems
325
326
  const getCurrentItemState = useCallback((itemId) => {
326
327
  const findInItems = (items) => {
327
328
  for (let i = 0; i < items.length; i++) {
@@ -341,7 +342,8 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
341
342
  const foundItem = findInItems(contextMenuItems);
342
343
  return {
343
344
  disabled: foundItem?.disabled,
344
- onClick: foundItem?.onClick
345
+ onClick: foundItem?.onClick,
346
+ visible: foundItem?.visible
345
347
  };
346
348
  }, [contextMenuItems]);
347
349
  // Remove trailing separators from items array
@@ -842,6 +844,14 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
842
844
  onClick: toggleOrientation,
843
845
  },
844
846
  ], trigger: "right", children: _jsx(S.GripHandle, { "$orientation": state.orientation, onMouseDown: handleMouseDown, onTouchStart: handleTouchStart, onDoubleClick: handleGripDoubleClick, children: _jsx(IconDraggableDots, {}) }) }), _jsx(S.Separator, { "$orientation": state.orientation }), state.items.map((item, index) => {
847
+ // Check visibility for non-separator items
848
+ if (!item.isSeparator) {
849
+ const currentState = getCurrentItemState(item.id);
850
+ // If contextMenuItems defines visible as false, don't render this item
851
+ if (currentState.visible === false) {
852
+ return null;
853
+ }
854
+ }
845
855
  // Handle separator items
846
856
  if (item.isSeparator) {
847
857
  return (_jsx(S.DraggableItem, { "$isDragging": state.draggedItemIndex === index, "$isDragOver": dragOverIndex === index && state.draggedItemIndex !== index, draggable: enableConfigMode, onDragStart: (e) => handleDragStart(e, index), onDragEnter: (e) => handleDragEnter(e, index), onDragOver: handleDragOver, onDragLeave: (e) => handleDragLeave(e, index), onDrop: (e) => handleDrop(e, index), onDragEnd: handleDragEnd, children: enableConfigMode ? (_jsx(ContextMenu, { items: getSeparatorRightClickMenuItems(index), trigger: "right", children: _jsx(S.ItemSeparator, { "$orientation": state.orientation, "$isConfigMode": false }) })) : (_jsx(S.ItemSeparator, { "$orientation": state.orientation, "$isConfigMode": false })) }, item.id));
@@ -9,6 +9,7 @@ export interface TMFloatingMenuItem {
9
9
  isSeparator?: boolean;
10
10
  isToggle?: boolean;
11
11
  staticItem?: React.ReactNode;
12
+ visible?: boolean;
12
13
  }
13
14
  export interface TMFloatingMenuBarProps {
14
15
  containerRef: React.RefObject<HTMLElement | null>;
@@ -14,10 +14,11 @@ import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/p
14
14
  import TMSearchResult from '../search/TMSearchResult';
15
15
  import TMDcmtForm from './TMDcmtForm';
16
16
  import { TMNothingToShow } from './TMDcmtPreview';
17
- import { Spinner, TMButton, TMLayoutWaitingContainer } from '../..';
17
+ import { TMButton, TMLayoutWaitingContainer } from '../..';
18
18
  import { useDocumentOperations } from '../../../hooks/useDocumentOperations';
19
19
  import TMToppyMessage from '../../../helper/TMToppyMessage';
20
20
  import TMPanel from '../../base/TMPanel';
21
+ import sixLogo from '../../../assets/six.png';
21
22
  const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, datagridUtility, dcmtUtility, fetchRemoteCertificates }) => {
22
23
  const floatingBarContainerRef = useRef(null);
23
24
  const [focusedItem, setFocusedItem] = useState();
@@ -31,6 +32,10 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
31
32
  const [contextMenuPosition, setContextMenuPosition] = useState({ x: 0, y: 0 });
32
33
  // Track if TMRelationViewer is loading (used to disable context menu during loading)
33
34
  const [isRelationViewerLoading, setIsRelationViewerLoading] = useState(false);
35
+ // Track if loading has ever been TRUE (to distinguish initial false from post-load false)
36
+ const hasLoadingBeenTrueRef = useRef(false);
37
+ // Track the previous loading state to detect transitions
38
+ const prevIsRelationViewerLoadingRef = useRef(false);
34
39
  const [dtdFocused, setDtdFocused] = useState();
35
40
  const [refreshKey, setRefreshKey] = useState(0);
36
41
  // Separate refresh key for TMFormOrResultWrapper only (doesn't affect tmTreeView)
@@ -39,6 +44,21 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
39
44
  const [focusedItemFormData, setFocusedItemFormData] = useState([]);
40
45
  // Trigger operationItems refresh (after file substitution, etc.)
41
46
  const [refreshOperationsTrigger, setRefreshOperationsTrigger] = useState(0);
47
+ // Safety net: when TMRelationViewer finishes loading (transition from TRUE to FALSE),
48
+ // hide the spinner regardless of whether a document was focused or not.
49
+ // This handles edge cases where no document gets isRoot=true.
50
+ useEffect(() => {
51
+ const prevLoading = prevIsRelationViewerLoadingRef.current;
52
+ prevIsRelationViewerLoadingRef.current = isRelationViewerLoading;
53
+ if (isRelationViewerLoading) {
54
+ // Loading started - mark that we've seen a true state
55
+ hasLoadingBeenTrueRef.current = true;
56
+ }
57
+ else if (prevLoading && hasLoadingBeenTrueRef.current && isCheckingFirstLoad) {
58
+ // Transition from TRUE to FALSE (loading completed) - hide spinner
59
+ setIsCheckingFirstLoad(false);
60
+ }
61
+ }, [isRelationViewerLoading, isCheckingFirstLoad]);
42
62
  // Increments trigger counter to force operationItems to re-calculate
43
63
  const onRefreshOperationsDatagrid = useCallback(async () => {
44
64
  setRefreshOperationsTrigger(prev => prev + 1);
@@ -258,6 +278,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
258
278
  useEffect(() => {
259
279
  if (noRelationsOnFirstLoad) {
260
280
  setNoRelationsOnFirstLoad(false);
281
+ setIsCheckingFirstLoad(false); // Hide spinner before navigating back
261
282
  ShowAlert({
262
283
  message: SDKUI_Localizator.RelatedDcmtsNotFound,
263
284
  title: SDKUI_Localizator.RelationsNotFound,
@@ -392,7 +413,10 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
392
413
  toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: false, orderNumber: 2, isActive: allInitialPanelVisibility['tmFormOrResult'] }
393
414
  }
394
415
  ], [tmTreeView, tmFormOrResult, focusedItem?.isDcmt, dtdMaster]);
395
- return (_jsxs("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: [isCheckingFirstLoad && (_jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: true })), _jsxs("div", { style: isCheckingFirstLoad ? { position: 'absolute', width: 0, height: 0, overflow: 'hidden', opacity: 0, pointerEvents: 'none' } : { width: '100%', height: '100%' }, children: [_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmTreeView', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }) }), renderDcmtOperations, renderFloatingBar] })] }));
416
+ return (_jsxs("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: [isCheckingFirstLoad && (_jsx(TMLoadingOverlay, { onCancel: () => {
417
+ setIsCheckingFirstLoad(false);
418
+ onBack?.();
419
+ } })), _jsxs("div", { style: isCheckingFirstLoad ? { position: 'absolute', width: 0, height: 0, overflow: 'hidden', opacity: 0, pointerEvents: 'none' } : { width: '100%', height: '100%' }, children: [_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmTreeView', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }) }), renderDcmtOperations, renderFloatingBar] })] }));
396
420
  };
397
421
  export default TMMasterDetailDcmts;
398
422
  /**
@@ -471,3 +495,94 @@ const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCrea
471
495
  }, fetchRemoteCertificates: fetchRemoteCertificates }, refreshKey) :
472
496
  focusedItem?.searchResult === undefined ? (_jsx(TMPanel, { title: SDKUI_Localizator.SearchResult, children: _jsx(TMToppyMessage, { message: SDKUI_Localizator.SelectDocumentToViewSearchResults }) })) : (_jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, showDcmtFormSidebar: false, autoFocusFirstRow: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, enablePinIcons: false, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, showBackButton: false, onRefreshSearchAsyncDatagrid: onRefreshSearchResults, onReferenceClick: handleNavigateToReference, fetchRemoteCertificates: fetchRemoteCertificates }, refreshKey)) }));
473
497
  };
498
+ const TMLoadingOverlay = ({ onCancel, description, cancelText }) => {
499
+ return (_jsx("div", { style: {
500
+ position: 'absolute',
501
+ top: 0,
502
+ left: 0,
503
+ width: '100%',
504
+ height: '100%',
505
+ backgroundColor: 'rgba(248, 250, 252, 0.92)',
506
+ zIndex: 1000,
507
+ display: 'flex',
508
+ justifyContent: 'center',
509
+ alignItems: 'center',
510
+ }, children: _jsxs("div", { style: {
511
+ display: 'flex',
512
+ flexDirection: 'column',
513
+ alignItems: 'center',
514
+ gap: '16px',
515
+ padding: '24px 32px',
516
+ background: '#fcfcfc',
517
+ borderRadius: '8px',
518
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.1)',
519
+ }, children: [_jsxs("div", { style: { position: 'relative', width: '80px', height: '80px' }, children: [_jsx("img", { style: {
520
+ position: 'absolute',
521
+ top: '50%',
522
+ left: '50%',
523
+ transform: 'translate(-54%, -54%)'
524
+ }, src: sixLogo, width: 35, alt: "" }), _jsx("style", { children: `
525
+ @keyframes tmSpinnerRotate {
526
+ 0% { transform: rotate(0deg); }
527
+ 100% { transform: rotate(360deg); }
528
+ }
529
+ .tm-spinner-animation {
530
+ display: inline-block;
531
+ width: 80px;
532
+ height: 80px;
533
+ position: absolute;
534
+ top: 50%;
535
+ left: 50%;
536
+ transform: translate(-50%, -50%);
537
+ }
538
+ .tm-spinner-animation div {
539
+ animation: tmSpinnerRotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
540
+ transform-origin: 40px 40px;
541
+ }
542
+ .tm-spinner-animation div:after {
543
+ content: " ";
544
+ display: block;
545
+ position: absolute;
546
+ width: 7px;
547
+ height: 7px;
548
+ border-radius: 50%;
549
+ background: #0c448e;
550
+ margin: -4px 0 0 -4px;
551
+ }
552
+ .tm-spinner-animation div:nth-child(1) { animation-delay: -0.036s; }
553
+ .tm-spinner-animation div:nth-child(1):after { top: 63px; left: 63px; background: #f7a51f; }
554
+ .tm-spinner-animation div:nth-child(2) { animation-delay: -0.072s; }
555
+ .tm-spinner-animation div:nth-child(2):after { top: 68px; left: 56px; background: #f7a51f; }
556
+ .tm-spinner-animation div:nth-child(3) { animation-delay: -0.108s; }
557
+ .tm-spinner-animation div:nth-child(3):after { top: 71px; left: 48px; background: #d3237b; }
558
+ .tm-spinner-animation div:nth-child(4) { animation-delay: -0.144s; }
559
+ .tm-spinner-animation div:nth-child(4):after { top: 72px; left: 40px; background: #d3237b; }
560
+ .tm-spinner-animation div:nth-child(5) { animation-delay: -0.18s; }
561
+ .tm-spinner-animation div:nth-child(5):after { top: 71px; left: 32px; background: #d12a1c; }
562
+ .tm-spinner-animation div:nth-child(6) { animation-delay: -0.216s; }
563
+ .tm-spinner-animation div:nth-child(6):after { top: 68px; left: 24px; background: #d12a1c; }
564
+ .tm-spinner-animation div:nth-child(7) { animation-delay: -0.252s; }
565
+ .tm-spinner-animation div:nth-child(7):after { top: 63px; left: 17px; background: #782b7d; }
566
+ .tm-spinner-animation div:nth-child(8) { animation-delay: -0.288s; }
567
+ .tm-spinner-animation div:nth-child(8):after { top: 56px; left: 12px; background: #782b7d; }
568
+ ` }), _jsxs("div", { className: "tm-spinner-animation", children: [_jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {})] })] }), _jsx("span", { style: { fontSize: '14px', color: '#334155', textAlign: 'center' }, children: description ?? SDKUI_Localizator.Loading }), onCancel && (_jsx("button", { onClick: onCancel, style: {
569
+ marginTop: '4px',
570
+ padding: '8px 24px',
571
+ fontSize: '13px',
572
+ fontWeight: 500,
573
+ color: '#64748b',
574
+ background: 'transparent',
575
+ border: '1.5px solid #cbd5e1',
576
+ borderRadius: '6px',
577
+ cursor: 'pointer',
578
+ transition: 'all 0.2s ease',
579
+ }, onMouseEnter: (e) => {
580
+ e.currentTarget.style.background = '#f1f5f9';
581
+ e.currentTarget.style.borderColor = '#94a3b8';
582
+ e.currentTarget.style.color = '#475569';
583
+ }, onMouseLeave: (e) => {
584
+ e.currentTarget.style.background = 'transparent';
585
+ e.currentTarget.style.borderColor = '#cbd5e1';
586
+ e.currentTarget.style.color = '#64748b';
587
+ }, children: cancelText ?? SDKUI_Localizator.Cancel }))] }) }));
588
+ };
@@ -100,15 +100,18 @@ const TMMergeToPdfForm = (props) => {
100
100
  });
101
101
  return null;
102
102
  }
103
- if (pdfDcmtInfosToDownload.length < MIN_PDF_FOR_MERGE) {
103
+ // Permetti merge anche con 1 solo file se convertibile o metadata-only
104
+ if (!hasEnoughPdfForMerge) {
104
105
  TMMessageBoxManager.show({
105
106
  message: SDKUI_Localizator.OnlyOnePdfOrConvertibleFileMergeBlocked.replaceParams(MIN_PDF_FOR_MERGE.toString()),
106
107
  buttons: [ButtonNames.OK]
107
108
  });
108
109
  return null;
109
110
  }
110
- // Mappa per lookup veloce di FILECOUNT e FILEEXT da selectedItemsFull
111
- const fileInfoMap = new Map(selectedItemsFull.map(d => [`${d.TID}_${d.DID}`, { fileExt: d.FILEEXT, fileCount: d.FILECOUNT }]));
111
+ // Mappa per lookup veloce di FILECOUNT e FILEEXT
112
+ const fileInfoMap = new Map(showTMRelationViewer
113
+ ? selectedItemsRelationViewer.map(d => [`${d.tid}_${d.did}`, { fileExt: d.fileExt ?? null, fileCount: d.fileCount ?? null }])
114
+ : selectedItemsFull.map(d => [`${d.TID}_${d.DID}`, { fileExt: d.FILEEXT, fileCount: d.FILECOUNT }]));
112
115
  // Mappa per i risultati: mantiene l'ordine originale
113
116
  const pdfFilesMap = new Map();
114
117
  // Identifica documenti di soli metadati e documenti con file
@@ -24,6 +24,7 @@ export interface RelationTreeItem extends ITMTreeItem {
24
24
  searchResult?: SearchResultDescriptor[];
25
25
  itemsCount?: number;
26
26
  fileExt?: string;
27
+ fileCount?: number;
27
28
  }
28
29
  /**
29
30
  * Props for TMRelationViewer component
@@ -146,6 +147,8 @@ export declare const hasMasterRelations: (dTID: number | undefined) => Promise<b
146
147
  export declare const getDisplayValueByColumn: (col: DataColumnDescriptor | undefined, value: any) => any;
147
148
  /**
148
149
  * Convert SearchResultDescriptor to structured data source with metadata
150
+ * For each document, fetches complete metadata using GetMetadataAsync to ensure
151
+ * all metadata properties (isSpecialSearchOutput, permissions, etc.) are available
149
152
  */
150
153
  export declare const searchResultToDataSource: (searchResult: SearchResultDescriptor | undefined, hideSysMetadata?: boolean) => Promise<any[]>;
151
154
  export declare const DEFAULT_RELATION_EXPAND_LEVEL = 4;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
- import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService } from "@topconsultnpm/sdk-ts";
4
- import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus, IconChevronDown, IconChevronRight, SDKUI_Localizator, buildDcmtDisplayName, SDKUI_Globals } from '../../../helper';
3
+ import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService, LayoutModes } from "@topconsultnpm/sdk-ts";
4
+ import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus, IconChevronDown, IconChevronRight, SDKUI_Localizator, buildDcmtDisplayName, SDKUI_Globals, searchResultToMetadataValues } from '../../../helper';
5
5
  import ShowAlert from '../../base/TMAlert';
6
6
  import TMToppyMessage from '../../../helper/TMToppyMessage';
7
7
  import { TMColors } from '../../../utils/theme';
@@ -88,41 +88,77 @@ export const getDisplayValueByColumn = (col, value) => {
88
88
  };
89
89
  /**
90
90
  * Convert SearchResultDescriptor to structured data source with metadata
91
+ * For each document, fetches complete metadata using GetMetadataAsync to ensure
92
+ * all metadata properties (isSpecialSearchOutput, permissions, etc.) are available
91
93
  */
92
94
  export const searchResultToDataSource = async (searchResult, hideSysMetadata) => {
93
95
  const rows = searchResult?.dtdResult?.rows ?? [];
94
- const tid = searchResult?.fromTID;
95
- // IMPORTANT: Pass true to get full metadata with all properties (isSpecialSearchOutput, etc.)
96
- const dtd = await DcmtTypeListCacheService.GetAsync(tid, true);
97
96
  const output = [];
97
+ // Find TID and DID column indices
98
+ const columns = searchResult?.dtdResult?.columns ?? [];
99
+ const tidColIndex = columns.findIndex(col => col.caption?.toUpperCase() === 'TID');
100
+ const didColIndex = columns.findIndex(col => col.caption?.toUpperCase() === 'DID');
98
101
  for (let index = 0; index < rows.length; index++) {
99
- const item = { rowIndex: index };
100
102
  const row = rows[index];
101
- for (let i = 0; i < row.length; i++) {
102
- const column = searchResult?.dtdResult?.columns?.[i];
103
- const mid = Number(column?.extendedProperties?.["MID"] ?? "0");
104
- if (hideSysMetadata && mid < 100)
105
- continue;
106
- // For system metadata (MID <= 100), use UPPERCASE caption as key
107
- // For custom metadata (MID > 100), use caption as key but handle duplicates
108
- let key = column?.caption ?? '';
109
- if (mid <= 100) {
110
- key = key.toUpperCase();
103
+ // Extract TID and DID from row
104
+ const tid = tidColIndex >= 0 ? Number(row[tidColIndex]) : searchResult?.fromTID;
105
+ const did = didColIndex >= 0 ? Number(row[didColIndex]) : undefined;
106
+ // Fetch complete metadata for this specific document (like getFilteredMetadata does)
107
+ const metadata = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(tid, did, true);
108
+ if (metadata) {
109
+ // Get full DTD with metadata for this document
110
+ const dtdResult = metadata.dtdResult;
111
+ const metadataRows = dtdResult?.rows?.[0] ?? [];
112
+ const mids = metadata.selectMIDs;
113
+ const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(tid, did, metadata);
114
+ const mdList = dtdWithMetadata?.metadata ?? [];
115
+ // Convert to MetadataValueDescriptorEx array
116
+ const metadataList = searchResultToMetadataValues(tid, dtdResult, metadataRows, mids, mdList, LayoutModes.Update);
117
+ // Convert to DcmtMetadataMap format (like getFilteredMetadata does)
118
+ const item = { rowIndex: index };
119
+ for (const mvd of metadataList) {
120
+ if (hideSysMetadata && mvd.mid !== undefined && mvd.mid < 100)
121
+ continue;
122
+ const key = mvd.mid !== undefined && mvd.mid <= 100
123
+ ? (mvd.md?.name ?? '').toUpperCase()
124
+ : (mvd.md?.name ?? '');
125
+ if (key) {
126
+ item[key] = {
127
+ md: mvd.md,
128
+ value: mvd.value
129
+ };
130
+ }
111
131
  }
112
- else {
113
- // If key already exists with a different MID, append MID to make it unique
114
- if (item[key] !== undefined && item[key]?.md?.id !== mid) {
115
- key = `${key}_${mid}`;
132
+ output.push(item);
133
+ }
134
+ else {
135
+ // Fallback: use original row data with basic parsing
136
+ const item = { rowIndex: index };
137
+ const fallbackTid = searchResult?.fromTID;
138
+ const dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(fallbackTid, undefined, searchResult);
139
+ for (let i = 0; i < row.length; i++) {
140
+ const column = searchResult?.dtdResult?.columns?.[i];
141
+ const mid = Number(column?.extendedProperties?.["MID"] ?? "0");
142
+ if (hideSysMetadata && mid < 100)
143
+ continue;
144
+ let key = column?.caption ?? '';
145
+ if (mid <= 100) {
146
+ key = key.toUpperCase();
147
+ }
148
+ else {
149
+ if (item[key] !== undefined && item[key]?.md?.id !== mid) {
150
+ key = `${key}_${mid}`;
151
+ }
116
152
  }
153
+ const value = row[i];
154
+ const md = dtd?.metadata?.find(o => o.id == mid);
155
+ item[key] = {
156
+ md: md,
157
+ value: getDisplayValueByColumn(column, value)
158
+ };
117
159
  }
118
- const value = row[i];
119
- const md = dtd?.metadata?.find(o => o.id == mid);
120
- item[key] = {
121
- md: md,
122
- value: getDisplayValueByColumn(column, value)
123
- };
160
+ output.push(item);
124
161
  }
125
- output.push(item);
126
162
  }
127
163
  return output;
128
164
  };
@@ -273,6 +309,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
273
309
  hidden: false,
274
310
  name: row?.SYS_Abstract?.value || row?.SYS_SUBJECT?.value || `Documento ${did}`,
275
311
  fileExt: row?.FILEEXT?.value,
312
+ fileCount: row?.FILECOUNT?.value,
276
313
  // Note: Recursive loading on expansion is handled by calculateItemsForNode
277
314
  });
278
315
  }
@@ -282,7 +319,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
282
319
  }
283
320
  }
284
321
  catch (error) {
285
- console.error('Error loading detail documents:', error);
322
+ console.error('Error loading detail documents:', error);
286
323
  }
287
324
  return items;
288
325
  }, [allowedTIDs]);
@@ -357,6 +394,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
357
394
  values: row,
358
395
  searchResult: [searchResult],
359
396
  fileExt: row?.FILEEXT?.value,
397
+ fileCount: row?.FILECOUNT?.value,
360
398
  // Leave items and itemsCount undefined so TMTreeView shows expand arrow based on isExpandible
361
399
  // Children will be loaded lazily by calculateItemsForNode when expanded
362
400
  expanded: false,
@@ -437,71 +475,82 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
437
475
  const setupInitialTreeExpansion = (tree) => {
438
476
  if (tree.length === 0)
439
477
  return tree;
440
- // ALWAYS expand the first container (even if empty, to show infoMessage)
441
- const firstRootContainer = tree[0];
442
- if (!firstRootContainer)
443
- return tree;
444
- // Create a deep copy of the first container with expanded=true, isRoot=true
445
- let newFirstContainer = {
446
- ...firstRootContainer,
447
- expanded: true,
448
- isRoot: true
449
- };
450
- // 2. Find first document/container and expand it
451
- const firstRootItems = newFirstContainer.items;
452
- if (firstRootItems && firstRootItems.length > 0) {
453
- const firstDocOrContainer = firstRootItems[0];
454
- if (firstDocOrContainer.isDcmt) {
455
- // First item is a document - expand it and mark as root for focus
456
- let newFirstDoc = {
457
- ...firstDocOrContainer,
458
- expanded: true,
459
- isRoot: true
460
- };
461
- // 3. Expand first correlation folder ONLY if there's exactly one
462
- const docItems = newFirstDoc.items;
463
- const containerChildren = docItems?.filter(child => child.isContainer) ?? [];
464
- if (containerChildren.length === 1 && docItems && docItems.length > 0 && docItems[0].isContainer) {
465
- const newFirstCorrelation = { ...docItems[0], expanded: true };
466
- newFirstDoc = {
467
- ...newFirstDoc,
468
- items: [newFirstCorrelation, ...docItems.slice(1)]
469
- };
478
+ // Find the first container with documents (not empty)
479
+ // This ensures we focus on an actual document, not an empty container
480
+ const findFirstNonEmptyContainerIndex = () => {
481
+ for (let i = 0; i < tree.length; i++) {
482
+ const container = tree[i];
483
+ if (!container.isZero && container.items && Array.isArray(container.items) && container.items.length > 0) {
484
+ return i;
470
485
  }
471
- // Update the container's items
472
- newFirstContainer = {
473
- ...newFirstContainer,
474
- items: [newFirstDoc, ...firstRootItems.slice(1)]
475
- };
476
486
  }
477
- else if (firstDocOrContainer.isContainer) {
478
- // First item is a container (correlation folder)
479
- // Count how many sibling containers there are
480
- const siblingContainers = firstRootItems.filter(child => child.isContainer);
481
- const shouldExpand = siblingContainers.length === 1;
482
- let newFirstCorrelation = {
483
- ...firstDocOrContainer,
484
- expanded: shouldExpand
485
- };
486
- // Find first document inside this container and mark for focus
487
- const containerItems = newFirstCorrelation.items;
488
- if (containerItems && containerItems.length > 0 && containerItems[0].isDcmt) {
489
- const newFirstDoc = { ...containerItems[0], isRoot: true };
490
- newFirstCorrelation = {
491
- ...newFirstCorrelation,
492
- items: [newFirstDoc, ...containerItems.slice(1)]
493
- };
487
+ return 0; // Fallback to first container if all are empty
488
+ };
489
+ const targetContainerIndex = findFirstNonEmptyContainerIndex();
490
+ // Process all containers, but only mark the target one for focus
491
+ const result = tree.map((container, index) => {
492
+ const isTargetContainer = index === targetContainerIndex;
493
+ const isFirstContainer = index === 0;
494
+ // Always expand the first container (even if empty, to show infoMessage)
495
+ // Also expand the target container if different
496
+ const shouldExpand = isFirstContainer || isTargetContainer;
497
+ if (!shouldExpand && !isTargetContainer) {
498
+ return container; // Keep non-target containers as-is
499
+ }
500
+ // Create a copy with expanded state
501
+ let newContainer = {
502
+ ...container,
503
+ expanded: shouldExpand,
504
+ isRoot: isTargetContainer // Only mark target container as root
505
+ };
506
+ // Only process items for the target container (the one with documents)
507
+ if (isTargetContainer) {
508
+ const containerItems = newContainer.items;
509
+ if (containerItems && containerItems.length > 0) {
510
+ const firstDocOrContainer = containerItems[0];
511
+ if (firstDocOrContainer.isDcmt) {
512
+ // First item is a document - expand it and mark as root for focus
513
+ let newFirstDoc = {
514
+ ...firstDocOrContainer,
515
+ expanded: true,
516
+ isRoot: true
517
+ };
518
+ // NOTE: Le cartelle di correlazione rimangono con expanded: false.
519
+ // Verranno espanse solo tramite il pulsante "espandi n livelli" o espansione manuale.
520
+ // Update the container's items
521
+ newContainer = {
522
+ ...newContainer,
523
+ items: [newFirstDoc, ...containerItems.slice(1)]
524
+ };
525
+ }
526
+ else if (firstDocOrContainer.isContainer) {
527
+ // First item is a container (correlation folder)
528
+ // NOTE: Le cartelle di correlazione rimangono con expanded: false.
529
+ // Verranno espanse solo tramite il pulsante "espandi n livelli" o espansione manuale.
530
+ let newFirstCorrelation = {
531
+ ...firstDocOrContainer,
532
+ expanded: false
533
+ };
534
+ // Find first document inside this container and mark for focus
535
+ const correlationItems = newFirstCorrelation.items;
536
+ if (correlationItems && correlationItems.length > 0 && correlationItems[0].isDcmt) {
537
+ const newFirstDoc = { ...correlationItems[0], isRoot: true };
538
+ newFirstCorrelation = {
539
+ ...newFirstCorrelation,
540
+ items: [newFirstDoc, ...correlationItems.slice(1)]
541
+ };
542
+ }
543
+ // Update the container's items
544
+ newContainer = {
545
+ ...newContainer,
546
+ items: [newFirstCorrelation, ...containerItems.slice(1)]
547
+ };
548
+ }
494
549
  }
495
- // Update the container's items
496
- newFirstContainer = {
497
- ...newFirstContainer,
498
- items: [newFirstCorrelation, ...firstRootItems.slice(1)]
499
- };
500
550
  }
501
- }
502
- // If firstRootItems is empty/undefined, the container is still expanded (will show infoMessage)
503
- // Return new tree with the modified first container
504
- return [newFirstContainer, ...tree.slice(1)];
551
+ return newContainer;
552
+ });
553
+ return result;
505
554
  };
506
555
  /**
507
556
  * Main data loading function
@@ -670,7 +719,8 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
670
719
  searchResult: result ? [result] : [],
671
720
  items: relatedDocs,
672
721
  itemsCount: relatedDocs.length,
673
- fileExt: docRow?.FILEEXT?.value
722
+ fileExt: docRow?.FILEEXT?.value,
723
+ fileCount: docRow?.FILECOUNT?.value
674
724
  };
675
725
  // Check if a type container for this TID already exists in the tree
676
726
  const existingContainer = tree.find(c => c.tid === dcmt.TID && c.isContainer);
@@ -1130,9 +1180,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
1130
1180
  transition: 'opacity 0.2s ease-in-out',
1131
1181
  textDecoration: isLogicallyDeleted ? 'line-through' : 'none'
1132
1182
  };
1133
- const documentStyle = customDocumentStyle
1134
- ? { ...defaultDocumentStyle, ...customDocumentStyle(item) }
1135
- : defaultDocumentStyle;
1183
+ const documentStyle = customDocumentStyle ? { ...defaultDocumentStyle, ...customDocumentStyle(item) } : defaultDocumentStyle;
1136
1184
  const textDecoration = isLogicallyDeleted ? 'line-through' : 'none';
1137
1185
  const textColor = isLogicallyDeleted ? 'gray' : undefined;
1138
1186
  const defaultMetadataContent = item.values && (() => {
@@ -1165,9 +1213,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
1165
1213
  }, children: value }))] }, `${key}_${index}`));
1166
1214
  }) }));
1167
1215
  })();
1168
- const metadataContent = customDocumentContent
1169
- ? customDocumentContent(item, defaultMetadataContent || _jsx(_Fragment, {}))
1170
- : defaultMetadataContent;
1216
+ const metadataContent = customDocumentContent ? customDocumentContent(item, defaultMetadataContent || _jsx(_Fragment, {})) : defaultMetadataContent;
1171
1217
  // Calculate checkout status for non-root documents
1172
1218
  let checkoutStatusIcon = null;
1173
1219
  if (item.values && item.dtd) {
@@ -1225,6 +1271,8 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
1225
1271
  /**
1226
1272
  * Recursively set the `expanded` property on every node that has children loaded.
1227
1273
  * Nodes without `items` are left untouched (will be loaded lazily on user click).
1274
+ * NOTE: Solo i nodi con figli già caricati (isLoaded o hasChildren) vengono espansi.
1275
+ * I nodi con isExpandible ma senza figli caricati rimangono chiusi.
1228
1276
  */
1229
1277
  const setExpandedRecursively = useCallback((nodes, expanded) => {
1230
1278
  if (!nodes || !Array.isArray(nodes))
@@ -1232,8 +1280,9 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
1232
1280
  return nodes.map(node => {
1233
1281
  const hasChildren = Array.isArray(node.items) && node.items.length > 0;
1234
1282
  const newItems = hasChildren ? setExpandedRecursively(node.items, expanded) : node.items;
1235
- // Only toggle expansion if the node is expandable (container/doc with children or marked expandible)
1236
- const canExpand = hasChildren || node.isExpandible;
1283
+ // Only toggle expansion if the node has children already loaded.
1284
+ // Nodes with isExpandible but no loaded children stay collapsed (will be loaded lazily).
1285
+ const canExpand = hasChildren || node.isLoaded;
1237
1286
  return { ...node, expanded: canExpand ? expanded : node.expanded, items: newItems };
1238
1287
  });
1239
1288
  }, []);
@@ -224,7 +224,6 @@ export const generateTargetFileName = async (file, dcmtInfo, options) => {
224
224
  case 'onlyCustomMetadata': {
225
225
  try {
226
226
  const filteredMetadata = await getFilteredMetadata(dcmtInfo.TID, dcmtInfo.DID, separatorChar);
227
- console.log("filteredMetadata for TID:", dcmtInfo.TID, "DID:", dcmtInfo.DID, "is", filteredMetadata);
228
227
  if (filteredMetadata) {
229
228
  if (fileNamingMode === 'documentTypeAndCustomMetadata') {
230
229
  const typeName = await getTypeName(dcmtInfo.TID);
@@ -17,11 +17,15 @@ export const isMetadataOnlyDcmt = (fileExt, fileCount) => {
17
17
  * @param showTMRelationViewer - Se true, usa selectedItemsRelationViewer, altrimenti selectedDcmtInfos
18
18
  */
19
19
  export const getMergePdfSelectionStats = (selectedDcmtInfos, selectedItemsFull, selectedItemsRelationViewer, showTMRelationViewer) => {
20
- // Mappa per lookup veloce di FILECOUNT da selectedItemsFull (usato solo per isMetadataOnly)
21
- const fileCountMap = new Map(selectedItemsFull.map(d => [`${d.TID}_${d.DID}`, d.FILECOUNT]));
22
- // Pre-calcolo delle informazioni sui documenti selezionati
23
- const docs = showTMRelationViewer
24
- ? selectedItemsRelationViewer
20
+ /**
21
+ * Pre-calcola info documenti selezionati in base alla sorgente dati:
22
+ * - RelationViewer (showTMRelationViewer=true): usa IRelatedDcmt con itemsCount/fileExt
23
+ * - Griglia documenti (showTMRelationViewer=false): usa DcmtInfo + lookup FILECOUNT da selectedItemsFull
24
+ */
25
+ let docs;
26
+ if (showTMRelationViewer) {
27
+ // Sorgente: RelationViewer - itemsCount e fileExt disponibili direttamente su IRelatedDcmt
28
+ docs = selectedItemsRelationViewer
25
29
  .filter(i => i.isDcmt)
26
30
  .map(i => {
27
31
  const ext = i.fileExt ?? undefined;
@@ -30,21 +34,25 @@ export const getMergePdfSelectionStats = (selectedDcmtInfos, selectedItemsFull,
30
34
  ext,
31
35
  isPdf: isPdfExt(ext),
32
36
  isConvertible: isConvertibleToPdfExt(ext),
33
- isMetadataOnly: isMetadataOnlyDcmt(ext, null)
37
+ isMetadataOnly: isMetadataOnlyDcmt(ext, i.fileCount)
34
38
  };
35
- })
36
- : selectedDcmtInfos.map(d => {
39
+ });
40
+ }
41
+ else {
42
+ // Sorgente: Griglia documenti - FILECOUNT richiede lookup da selectedItemsFull
43
+ const fileCountMap = new Map(selectedItemsFull.map(d => [`${d.TID}_${d.DID}`, d.FILECOUNT]));
44
+ docs = selectedDcmtInfos.map(d => {
37
45
  const ext = d.FILEEXT ?? undefined;
38
46
  const key = `${d.TID}_${d.DID}`;
39
- const fileCount = fileCountMap.get(key);
40
47
  return {
41
48
  key,
42
49
  ext,
43
50
  isPdf: isPdfExt(ext),
44
51
  isConvertible: isConvertibleToPdfExt(ext),
45
- isMetadataOnly: isMetadataOnlyDcmt(ext, fileCount)
52
+ isMetadataOnly: isMetadataOnlyDcmt(ext, fileCountMap.get(key))
46
53
  };
47
54
  });
55
+ }
48
56
  // Elementi convertibili: file con estensione convertibile (esclusi documenti di soli metadati)
49
57
  const convertibleSelectedItems = docs
50
58
  .filter(i => i.isConvertible && !i.isMetadataOnly)
@@ -68,7 +76,9 @@ export const getMergePdfSelectionStats = (selectedDcmtInfos, selectedItemsFull,
68
76
  metadataOnlySelectedItems,
69
77
  hasMetadataOnlySelected: metadataOnlySelectedItems.length > 0,
70
78
  mergeableSelectedCount,
71
- hasEnoughPdfForMerge: mergeableSelectedCount >= MIN_PDF_FOR_MERGE,
79
+ // Merge possibile se: >= 2 file unibili OPPURE >= 1 file convertibile/metadata-only (verrà trasformato in PDF)
80
+ hasEnoughPdfForMerge: mergeableSelectedCount >= MIN_PDF_FOR_MERGE ||
81
+ (mergeableSelectedCount >= 1 && (convertibleSelectedItems.length > 0 || metadataOnlySelectedItems.length > 0)),
72
82
  };
73
83
  };
74
84
  // LAZY LOADING pdf-lib
@@ -1,6 +1,7 @@
1
1
  import { ArrowSymbol, DiagramItemTypes } from './interfaces';
2
2
  import { CultureIDs, Severities, WFAppTypes, WorkItemSetRules, WorkItemStatus } from '@topconsultnpm/sdk-ts';
3
3
  import { parseQueryDescriptorXml, serializeQueryDescriptorXml } from './queryDescriptorParser'; // Import the new parser
4
+ import { generateUUID } from '../../../../helper/helpers';
4
5
  import { parseMetadataValuesXml, serializeMetadataValuesToXml } from './metadataParser';
5
6
  // Funzione helper per escapare i caratteri XML speciali (necessaria per i campi stringa)
6
7
  const escapeXml = (unsafe) => {
@@ -293,7 +294,7 @@ export const parseWfDiagramXml = (xmlString) => {
293
294
  // Parsing Connections
294
295
  const connectionsXML = rootElement.querySelectorAll("Connections > Connection");
295
296
  connectionsXML.forEach((connectionXML) => {
296
- const connectionId = connectionXML.querySelector("ID")?.textContent || crypto.randomUUID();
297
+ const connectionId = connectionXML.querySelector("ID")?.textContent || generateUUID();
297
298
  // Leggi il valore numerico di OutputStatus dall'XML
298
299
  const xmlOutputStatus = parseInt(connectionXML.querySelector("OutputStatus")?.textContent || "0", 10);
299
300
  const connection = {
@@ -135,6 +135,7 @@ declare function IconImport(props: React.SVGProps<SVGSVGElement>): React.JSX.Ele
135
135
  declare function IconPalette(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
136
136
  declare function IconFastSearch(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
137
137
  declare function IconUserGroup(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
138
+ export declare function IconCertificateBadge(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
138
139
  export declare function IconShowAllUsers(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
139
140
  export declare function IconShowAllUsersOff(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
140
141
  declare function IconUserGroupOutline(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
@@ -408,6 +408,9 @@ function IconFastSearch(props) {
408
408
  function IconUserGroup(props) {
409
409
  return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 640 512", fill: "currentColor", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M352 128c0 70.7-57.3 128-128 128S96 198.7 96 128 153.3 0 224 0s128 57.3 128 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4c98.5 0 178.3 79.8 178.3 178.3 0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM609.3 512H471.4c5.4-9.4 8.6-20.3 8.6-32v-8c0-60.7-27.1-115.2-69.8-151.8 2.4-.1 4.7-.2 7.1-.2h61.4c89.1 0 161.3 72.2 161.3 161.3 0 17-13.8 30.7-30.7 30.7zM432 256c-31 0-59-12.6-79.3-32.9 19.7-26.6 31.3-59.5 31.3-95.1 0-26.8-6.6-52.1-18.3-74.3C384.3 40.1 407.2 32 432 32c61.9 0 112 50.1 112 112s-50.1 112-112 112z" }), " "] }));
410
410
  }
411
+ export function IconCertificateBadge(props) {
412
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 -960 960 960", fill: "currentColor", height: "1em", width: "1em", ...props, children: _jsx("path", { d: "M395-475q-35-35-35-85t35-85q35-35 85-35t85 35q35 35 35 85t-35 85q-35 35-85 35t-85-35ZM240-40v-309q-38-42-59-96t-21-115q0-134 93-227t227-93q134 0 227 93t93 227q0 61-21 115t-59 96v309l-240-80-240 80Zm410-350q70-70 70-170t-70-170q-70-70-170-70t-170 70q-70 70-70 170t70 170q70 70 170 70t170-70ZM320-159l160-41 160 41v-124q-35 20-75.5 31.5T480-240q-44 0-84.5-11.5T320-283v124Zm160-62Z" }) }));
413
+ }
411
414
  export function IconShowAllUsers(props) {
412
415
  return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", fontSize: props.fontSize ? props.fontSize : FONTSIZE, ...props, children: _jsx("path", { fill: "currentColor", d: "M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5S5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05c1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5" }) }));
413
416
  }
@@ -16,6 +16,9 @@ declare const getColor: (color: ColorsType) => string;
16
16
  /**
17
17
  * Genera un Universally Unique Identifier (UUID) versione 4.
18
18
  * Simile a Guid.NewGuid() in C#.
19
+ * Usa crypto.randomUUID() quando disponibile (HTTPS / localhost) e ricade
20
+ * su crypto.getRandomValues() — disponibile anche in contesti non sicuri (HTTP) —
21
+ * cosi funziona indipendentemente dal protocollo, senza dipendenze esterne.
19
22
  * @returns {string} Un UUID in formato stringa.
20
23
  */
21
24
  export declare const generateUUID: () => string;
@@ -103,10 +103,29 @@ const getColor = (color) => {
103
103
  /**
104
104
  * Genera un Universally Unique Identifier (UUID) versione 4.
105
105
  * Simile a Guid.NewGuid() in C#.
106
+ * Usa crypto.randomUUID() quando disponibile (HTTPS / localhost) e ricade
107
+ * su crypto.getRandomValues() — disponibile anche in contesti non sicuri (HTTP) —
108
+ * cosi funziona indipendentemente dal protocollo, senza dipendenze esterne.
106
109
  * @returns {string} Un UUID in formato stringa.
107
110
  */
108
111
  export const generateUUID = () => {
109
- return crypto.randomUUID();
112
+ // 1) Nativo: disponibile solo in secure context (HTTPS o localhost)
113
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
114
+ return crypto.randomUUID();
115
+ }
116
+ // 2) Fallback crittografico, funziona anche in HTTP
117
+ if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
118
+ const b = crypto.getRandomValues(new Uint8Array(16));
119
+ b[6] = (b[6] & 0x0f) | 0x40; // versione 4
120
+ b[8] = (b[8] & 0x3f) | 0x80; // variante 10xx
121
+ const h = Array.from(b, x => x.toString(16).padStart(2, '0'));
122
+ return `${h[0]}${h[1]}${h[2]}${h[3]}-${h[4]}${h[5]}-${h[6]}${h[7]}-${h[8]}${h[9]}-${h.slice(10).join('')}`;
123
+ }
124
+ // 3) Ultima spiaggia (ambienti senza Web Crypto)
125
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
126
+ const r = (Math.random() * 16) | 0;
127
+ return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
128
+ });
110
129
  };
111
130
  const makeID = (length) => {
112
131
  let result = '';
@@ -21,7 +21,7 @@ import { useDcmtOperations } from "./useDcmtOperations";
21
21
  import useFloatingBarPinnedItems from "./useFloatingBarPinnedItems";
22
22
  import { useInputAttachmentsDialog, useInputCvtFormatDialog } from "./useInputDialog";
23
23
  import { useRelatedDocuments } from "./useRelatedDocuments";
24
- import { convertSearchResultDescriptorToFileItems, dcmtsFileCachePreview, getDcmtCicoStatus, getMoreInfoTasksForDocument, IconActivity, IconArchiveDetail, IconArchiveDoc, IconArchiveMaster, IconBatchUpdate, IconCheck, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconCopy, IconCustom, IconDelete, IconDetailDcmts, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconImport, IconInfo, IconMenuCAArchive, IconMoveToFolder, IconPair, IconPin, IconPlatform, IconPreview, IconRelation, IconSearch, IconShare, IconSharedDcmt, IconShow, IconSignaturePencil, IconStar, IconSubstFile, IconUndo, IconUnpair, IconUserGroupOutline, isConvertibleToPdfExt, isPdfEditorAvailable, S4T_USER_REGISTRY_MASTER, SDKUI_Globals, SDKUI_Localizator, searchResultToMetadataValues, TMImageLibrary } from '../helper';
24
+ import { convertSearchResultDescriptorToFileItems, dcmtsFileCachePreview, getDcmtCicoStatus, getMoreInfoTasksForDocument, IconActivity, IconArchiveDetail, IconArchiveDoc, IconArchiveMaster, IconBatchUpdate, IconCheck, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconCopy, IconCustom, IconDelete, IconDetailDcmts, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconMoveToFolder, IconPair, IconPin, IconPlatform, IconPreview, IconRelation, IconSearch, IconShare, IconSharedDcmt, IconShow, IconSignaturePencil, IconStar, IconSubstFile, IconUndo, IconUnpair, IconUserGroupOutline, isConvertibleToPdfExt, isPdfEditorAvailable, S4T_USER_REGISTRY_MASTER, SDKUI_Globals, SDKUI_Localizator, searchResultToMetadataValues, TMImageLibrary, IconCertificateBadge } from '../helper';
25
25
  import { isXMLFileExt } from "../helper/dcmtsHelper";
26
26
  import TMCopyToFolderForm from "../components/features/documents/TMCopyToFolderForm";
27
27
  import TMMergeToPdfForm from "../components/features/documents/TMMergeToPdfForm";
@@ -620,7 +620,7 @@ export const useDocumentOperations = (props) => {
620
620
  },
621
621
  {
622
622
  id: 'sign-sync',
623
- icon: _jsx(IconImport, {}),
623
+ icon: _jsx(IconCertificateBadge, {}),
624
624
  name: SDKUI_Localizator.ImportCertificates,
625
625
  operationType: 'multiRow',
626
626
  // Visibile solo per tipo documento 'S4T_certificate_registry' con metadato 'email' e se la callback fetchRemoteCertificates è definita
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-t4",
3
+ "version": "6.21.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -20,7 +20,6 @@
20
20
  "@storybook/addon-docs": "^10.3.5",
21
21
  "@storybook/addon-onboarding": "^10.3.5",
22
22
  "@storybook/react-vite": "^10.3.5",
23
- "@types/htmlparser2": "^3.10.7",
24
23
  "@types/node": "^24.12.2",
25
24
  "@types/react": "^18.3.3",
26
25
  "@types/react-dom": "^18.3.3",
@@ -40,7 +39,7 @@
40
39
  "lib"
41
40
  ],
42
41
  "dependencies": {
43
- "@topconsultnpm/sdk-ts": "6.21.0-t4",
42
+ "@topconsultnpm/sdk-ts": "6.21.0",
44
43
  "@zip.js/zip.js": "2.8.26",
45
44
  "buffer": "^6.0.3",
46
45
  "devextreme": "^25.2.6",
@@ -49,7 +48,6 @@
49
48
  "htmlparser2": "^10.0.0",
50
49
  "pdf-lib": "^1.17.1",
51
50
  "react-pdf": "^10.4.1",
52
- "react-router-dom": "^6.15.0",
53
51
  "react-window": "^2.2.7",
54
52
  "styled-components": "^6.1.1"
55
53
  },