@topconsultnpm/sdkui-react 6.21.0-dev5.3 → 6.21.0-dev5.5

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.
@@ -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();
@@ -412,7 +413,10 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
412
413
  toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: false, orderNumber: 2, isActive: allInitialPanelVisibility['tmFormOrResult'] }
413
414
  }
414
415
  ], [tmTreeView, tmFormOrResult, focusedItem?.isDcmt, dtdMaster]);
415
- 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] })] }));
416
420
  };
417
421
  export default TMMasterDetailDcmts;
418
422
  /**
@@ -491,3 +495,94 @@ const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCrea
491
495
  }, fetchRemoteCertificates: fetchRemoteCertificates }, refreshKey) :
492
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)) }));
493
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,7 +100,8 @@ 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]
@@ -68,7 +68,9 @@ export const getMergePdfSelectionStats = (selectedDcmtInfos, selectedItemsFull,
68
68
  metadataOnlySelectedItems,
69
69
  hasMetadataOnlySelected: metadataOnlySelectedItems.length > 0,
70
70
  mergeableSelectedCount,
71
- hasEnoughPdfForMerge: mergeableSelectedCount >= MIN_PDF_FOR_MERGE,
71
+ // Merge possibile se: >= 2 file unibili OPPURE >= 1 file convertibile/metadata-only (verrà trasformato in PDF)
72
+ hasEnoughPdfForMerge: mergeableSelectedCount >= MIN_PDF_FOR_MERGE ||
73
+ (mergeableSelectedCount >= 1 && (convertibleSelectedItems.length > 0 || metadataOnlySelectedItems.length > 0)),
72
74
  };
73
75
  };
74
76
  // LAZY LOADING pdf-lib
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev5.3",
3
+ "version": "6.21.0-dev5.5",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",