@topconsultnpm/sdkui-react 6.21.0-dev1.3 → 6.21.0-dev1.31
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.
- package/lib/components/base/TMAreaManager.js +28 -11
- package/lib/components/base/TMPanel.js +1 -0
- package/lib/components/choosers/TMUserChooser.js +3 -1
- package/lib/components/editors/TMFormulaEditor.js +15 -3
- package/lib/components/features/archive/TMArchive.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.js +12 -8
- package/lib/components/features/documents/TMFileUploader.d.ts +1 -1
- package/lib/components/features/documents/TMFileUploader.js +3 -3
- package/lib/components/features/documents/TMMasterDetailDcmts.js +74 -21
- package/lib/components/features/documents/TMRelationViewer.d.ts +6 -1
- package/lib/components/features/documents/TMRelationViewer.js +44 -7
- package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
- package/lib/components/features/search/TMSearch.d.ts +1 -0
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchResult.d.ts +1 -0
- package/lib/components/features/search/TMSearchResult.js +18 -4
- package/lib/components/features/search/TMViewHistoryDcmt.js +6 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +5 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +7 -1
- package/lib/components/features/workflow/diagram/xmlParser.js +13 -14
- package/lib/components/forms/Login/TMLoginForm.js +15 -5
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/pages/TMPage.js +4 -2
- package/lib/components/query/TMQueryCountButton.d.ts +11 -0
- package/lib/components/query/TMQueryCountButton.js +32 -0
- package/lib/components/query/TMQueryEditor.js +41 -4
- package/lib/components/query/TMQuerySummary.js +3 -2
- package/lib/helper/SDKUI_Globals.d.ts +2 -0
- package/lib/helper/TMUtils.d.ts +1 -0
- package/lib/helper/TMUtils.js +12 -0
- package/lib/helper/checkinCheckoutManager.d.ts +1 -1
- package/lib/helper/checkinCheckoutManager.js +18 -4
- package/lib/hooks/useDcmtOperations.d.ts +1 -0
- package/lib/hooks/useDcmtOperations.js +75 -4
- package/lib/hooks/useDocumentOperations.d.ts +1 -0
- package/lib/hooks/useDocumentOperations.js +15 -10
- package/lib/hooks/useForm.js +20 -14
- package/lib/hooks/useInputDialog.d.ts +2 -0
- package/lib/hooks/useInputDialog.js +34 -0
- package/lib/hooks/useQueryParametersDialog.js +5 -5
- package/package.json +55 -55
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import FileManager, { Column, Details, ItemView, Permissions, Notifications, ContextMenu, Toolbar, Item } from 'devextreme-react/file-manager';
|
|
4
|
-
import { FileDescriptor, FileFormats, FileTransferModes, SDK_Localizator, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { FileDescriptor, FileFormats, FileTransferModes, SDK_Localizator, SDK_Globals, AppModules } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import CustomFileSystemProvider from 'devextreme/file_management/custom_provider';
|
|
6
6
|
import FileSystemError from "devextreme/file_management/error";
|
|
7
7
|
import Button from "devextreme/ui/button";
|
|
8
8
|
import { alert, confirm } from "devextreme/ui/dialog";
|
|
9
9
|
import { loadMessages } from 'devextreme/localization';
|
|
10
|
-
import { Globalization, IconAll, IconCloud, IconFolder, IconFolderForCSS, IconSelected, SDKUI_Localizator, svgToString } from '../../helper';
|
|
10
|
+
import { getFileManagerFolderColor, Globalization, IconAll, IconCloud, IconFolder, IconFolderForCSS, IconSelected, SDKUI_Localizator, svgToString } from '../../helper';
|
|
11
11
|
import { TMExceptionBoxManager } from './TMPopUp';
|
|
12
12
|
import ShowAlert from './TMAlert';
|
|
13
13
|
import { TMLayoutWaitingContainer } from './TMWaitPanel';
|
|
14
14
|
import TMCounterContainer, { CounterItemKey } from './TMCounterContainer';
|
|
15
15
|
import { IconPdf, IconTxt, IconXls, IconDocx, IconImage, IconZip, IconXml, IconMp4, IconEmail, IconPpt, IconSigned, IconExe, IconHtml, IconDwg, IconDicom, IconSlddrw } from '../../assets/thumbnails';
|
|
16
|
-
import { TMColors } from '../../utils/theme';
|
|
17
16
|
import styled from 'styled-components';
|
|
18
17
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
19
18
|
export class TMFileSystemItem {
|
|
@@ -25,8 +24,10 @@ export class TMFileSystemItem {
|
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
let abortController = new AbortController();
|
|
28
|
-
const
|
|
29
|
-
const
|
|
27
|
+
const generateSvgDataUrl = (color) => {
|
|
28
|
+
const svgString = encodeURIComponent(renderToStaticMarkup(_jsx(IconFolderForCSS, { fill: color })));
|
|
29
|
+
return `data:image/svg+xml,${svgString}`;
|
|
30
|
+
};
|
|
30
31
|
const StyledFileManagerWrapper = styled.div `
|
|
31
32
|
.dx-filemanager .dx-treeview-item .dx-icon-folder {
|
|
32
33
|
display: none !important;
|
|
@@ -44,7 +45,7 @@ const StyledFileManagerWrapper = styled.div `
|
|
|
44
45
|
width: 20px;
|
|
45
46
|
height: 20px;
|
|
46
47
|
transform: translateY(-50%);
|
|
47
|
-
background-image: url("${
|
|
48
|
+
background-image: url("${props => generateSvgDataUrl(props.$folderColor)}");
|
|
48
49
|
background-size: contain;
|
|
49
50
|
background-repeat: no-repeat;
|
|
50
51
|
display: inline-block;
|
|
@@ -390,7 +391,9 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
390
391
|
const deleteItem = async (item) => {
|
|
391
392
|
const ad = item.dataItem.dataItem;
|
|
392
393
|
const aid = ad.id;
|
|
393
|
-
const
|
|
394
|
+
const subFolderOld = item.parentPath === ad.name ? '' : item.parentPath.replace(ad.name + '/', '');
|
|
395
|
+
const subFolder = getSubFolder(item.parentPath, ad.name);
|
|
396
|
+
console.log("Delete item with subfolder: ", subFolder, " old subfolder: ", subFolderOld);
|
|
394
397
|
const tms = props.tmSession ?? SDK_Globals.tmSession;
|
|
395
398
|
if (item.isDirectory) {
|
|
396
399
|
await tms?.NewAreaEngine().DeleteFoldersAsync(aid, subFolder, [item.name]).catch((err) => { throw new FileSystemError(5, item, err.message ?? SDKUI_Localizator.GetFolderDeletionErrorMessage); });
|
|
@@ -594,16 +597,29 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
594
597
|
throw new FileSystemError(5, undefined, error.message ?? SDKUI_Localizator.Error);
|
|
595
598
|
}
|
|
596
599
|
};
|
|
600
|
+
const getSubFolder = (dir, startStr) => {
|
|
601
|
+
//Se devo controllare che inizi per il nome dell'area, se non inizia ritorno la dir così com'è (caso di file aperto da percorso completo)
|
|
602
|
+
if (startStr && !dir.startsWith(startStr)) {
|
|
603
|
+
return dir;
|
|
604
|
+
}
|
|
605
|
+
//In tutti gli altri casi rimuovo la prima cartella del percorso (che corrisponde al nome dell'area) e la restituisco come subfolder
|
|
606
|
+
const parts = dir.split("/");
|
|
607
|
+
console.log(parts);
|
|
608
|
+
let subFolder = parts.slice(1).join("/");
|
|
609
|
+
console.log(subFolder);
|
|
610
|
+
return subFolder;
|
|
611
|
+
};
|
|
597
612
|
const onCurrentDirectoryChanged = (e) => {
|
|
598
613
|
setCurrentRoute(e.directory.path);
|
|
599
614
|
setFocusedFileSystemItem(e.directory);
|
|
615
|
+
console.log("Current directory changed: ", e.directory);
|
|
600
616
|
if (e.directory.path === '' && e.directory.name === '')
|
|
601
617
|
return;
|
|
602
618
|
let ad = e.directory.dataItem.dataItem;
|
|
603
619
|
if (!ad)
|
|
604
620
|
return;
|
|
605
621
|
let aid = ad.id;
|
|
606
|
-
let subFolder = e.directory.path
|
|
622
|
+
let subFolder = getSubFolder(e.directory.path);
|
|
607
623
|
setAreaFolder(getAreaPath(aid, subFolder));
|
|
608
624
|
e.component.option("fileSystemProvider").getItems(e.directory).then((items) => {
|
|
609
625
|
setParentDirectoryFileSystemItems(items);
|
|
@@ -632,7 +648,7 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
632
648
|
};
|
|
633
649
|
const customizeIcon = useCallback((fileSystemItem) => {
|
|
634
650
|
if (fileSystemItem.isDirectory) {
|
|
635
|
-
return svgToString(_jsx(IconFolder, { fontSize: 20, color:
|
|
651
|
+
return svgToString(_jsx(IconFolder, { fontSize: 20, color: getFileManagerFolderColor(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER) }));
|
|
636
652
|
}
|
|
637
653
|
else {
|
|
638
654
|
const fileExtension = fileSystemItem.getFileExtension();
|
|
@@ -723,11 +739,12 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
723
739
|
alert(`"${e.name}" ${SDKUI_Localizator.FolderExist}`, SDKUI_Localizator.Attention);
|
|
724
740
|
}
|
|
725
741
|
};
|
|
726
|
-
|
|
742
|
+
const folderColor = getFileManagerFolderColor(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER);
|
|
743
|
+
return (_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: _jsxs(StyledFileManagerWrapper, { "$folderColor": folderColor, style: { width: "100%", height: "100%" }, children: [_jsxs(FileManager, { width: props.width, ref: fileManagerRef, height: `calc(${props.height} - 30px)`, onItemMoving: onItemCopying, onItemCopying: onItemCopying, onFileUploading: onFileUploading, fileSystemProvider: areaProvider, customizeThumbnail: customizeIcon, rootFolderName: SDK_Localizator.Areas, onSelectionChanged: onSelectionChanged, onDirectoryCreating: onDirectoryCreating, onFocusedItemChanged: onFocusedItemChanged, onSelectedFileOpened: onSelectedFileOpened, onContextMenuItemClick: onContextMenuItemClick,
|
|
727
744
|
/* onItemMoved={() => setCounter(counter => counter + 1)}
|
|
728
745
|
onItemCopied={() => setCounter(counter => counter + 1)}
|
|
729
746
|
onItemDeleted={() => setCounter(counter => counter - 1)}
|
|
730
747
|
onFileUploaded={() => setCounter(counter => counter + 1)} */
|
|
731
|
-
onCurrentDirectoryChanged: onCurrentDirectoryChanged, selectionMode: props.selectionMode === 'single' ? 'single' : selectionMode, children: [_jsxs(Toolbar, { children: [_jsx(Item, { name: "showNavPane", visible: true }), _jsx(Item, { name: "create", visible: true }), _jsx(Item, { name: "upload", visible: true }), _jsx(Item, { name: "separator", location: 'after' }), _jsx(Item, { name: "switchView", visible: true }), _jsx(Item, { name: "refresh", visible: true })] }), _jsx(ContextMenu, { items: ["create", "upload", "rename", "move", "copy", "delete", "refresh", "download"] }), _jsx(Permissions, { copy: focusedFileSystemItem && focusedFileSystemItem.name !== "" &&
|
|
748
|
+
onCurrentDirectoryChanged: onCurrentDirectoryChanged, selectionMode: props.selectionMode === 'single' ? 'single' : selectionMode, children: [_jsxs(Toolbar, { children: [_jsx(Item, { name: "showNavPane", visible: true }), _jsx(Item, { name: "create", visible: true }), _jsx(Item, { name: "upload", visible: true }), _jsx(Item, { name: "separator", location: 'after' }), _jsx(Item, { name: "switchView", visible: true }), _jsx(Item, { name: "refresh", visible: true })] }), _jsx(ContextMenu, { items: ["create", "upload", "rename", "move", "copy", "delete", "refresh", "download"] }), _jsx(Permissions, { copy: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, move: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, create: focusedFileSystemItem && focusedFileSystemItem.name !== "", upload: focusedFileSystemItem && focusedFileSystemItem.name !== "", rename: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, delete: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, download: true }), _jsx(ItemView, { children: _jsxs(Details, { children: [_jsx(Column, { dataField: "thumbnail", cssClass: 'file-thumbnail' }, "thumbnail"), _jsx(Column, { dataField: "name", caption: SDKUI_Localizator.Name }, "name"), _jsx(Column, { dataField: 'size', width: '120px', alignment: 'center', dataType: 'number', caption: SDKUI_Localizator.File_Size }, "size"), _jsx(Column, { dataField: 'dateModified', width: '160px', alignment: 'center', dataType: 'datetime', caption: SDKUI_Localizator.Date_Modified }, "dateModified")] }) }), _jsx(Notifications, { showPopup: true, showPanel: true })] }), _jsx("div", { style: { width: "100%", height: "30px", overflowY: "hidden" }, children: _jsx(TMCounterContainer, { items: counterValues }) })] }) }));
|
|
732
749
|
};
|
|
733
750
|
export default TMAreaManager;
|
|
@@ -26,6 +26,7 @@ const StyledPanelContainer = styled.div `
|
|
|
26
26
|
height: ${({ $isMaximized }) => $isMaximized ? `calc(100vh - 50px - (${Gutters.getGutters()}px * 2))` : '100%'};
|
|
27
27
|
z-index: ${({ $isMaximized }) => $isMaximized ? 2000 : 'auto'};
|
|
28
28
|
margin: ${({ $isMaximized }) => $isMaximized ? `${Gutters.getGutters()}px` : '0'};
|
|
29
|
+
outline: none;
|
|
29
30
|
/* transition: all 0.2s; */
|
|
30
31
|
`;
|
|
31
32
|
const StyledPanelHeader = styled.div `
|
|
@@ -37,7 +37,9 @@ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh
|
|
|
37
37
|
const dataColumns = useMemo(() => {
|
|
38
38
|
return [
|
|
39
39
|
{ dataField: 'domain', caption: SDKUI_Localizator.Domain, dataType: 'string' },
|
|
40
|
-
{ dataField: 'name', caption: SDKUI_Localizator.UserName, dataType: 'string' }
|
|
40
|
+
{ dataField: 'name', caption: SDKUI_Localizator.UserName, dataType: 'string' },
|
|
41
|
+
{ dataField: 'fn', caption: SDKUI_Localizator.User_FirstName, dataType: 'string' },
|
|
42
|
+
{ dataField: 'ln', caption: SDKUI_Localizator.User_LastName, dataType: 'string' }
|
|
41
43
|
];
|
|
42
44
|
}, []);
|
|
43
45
|
const getItems = async (refreshCache) => {
|
|
@@ -132,12 +132,24 @@ const TMFormulaEditor = (props) => {
|
|
|
132
132
|
const renderTreeViewItem = useCallback((item) => {
|
|
133
133
|
return (_jsxs(StyledDivHorizontal, { style: { display: 'flex', gap: '5px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }, children: [renderFormulaIcon(item.icon, item.tid, item.md), _jsx("p", { style: { verticalAlign: 'middle', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }, children: item.text })] }));
|
|
134
134
|
}, []);
|
|
135
|
+
const translateDescInFormula = (text) => {
|
|
136
|
+
switch (text) {
|
|
137
|
+
case `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithoutLogin})`:
|
|
138
|
+
return `[dbo].[TM_GetViewLink](NULL, NULL, NULL, 0, {@TID}, {@DID}, 1, NULL, 0)`;
|
|
139
|
+
case `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithLogin})`:
|
|
140
|
+
return `[dbo].[TM_GetViewLink](NULL, 'ASKLOGIN', NULL, 0, {@TID}, {@DID}, 1, NULL, 0)`;
|
|
141
|
+
case `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithDate})`:
|
|
142
|
+
return `[dbo].[TM_GetViewLink](NULL, NULL, NULL, 0, {@TID}, {@DID}, 1, CONVERT(VARCHAR, {@CreationTime}+30, 126), 0)`;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
return text;
|
|
146
|
+
};
|
|
135
147
|
const handleTreeViewItemClick = (e) => {
|
|
136
148
|
if (!e)
|
|
137
149
|
return;
|
|
138
150
|
if (e.itemData?.hasItems)
|
|
139
151
|
return;
|
|
140
|
-
insertText(e.itemData?.text);
|
|
152
|
+
insertText(translateDescInFormula(e.itemData?.text));
|
|
141
153
|
};
|
|
142
154
|
return (_jsx(TMApplyForm, { isModal: props.isModal, formMode: props.formMode, isModified: formData.expression !== formDataOrig.expression, exception: exception, validationItems: validationItems, title: SDKUI_Localizator.Formula, hasNavigation: false, showBack: props.showBack, height: '600px', width: '800px', onApply: () => applyData(), onClose: props.onClose, onUndo: () => {
|
|
143
155
|
setFormData(formDataOrig);
|
|
@@ -705,13 +717,13 @@ export class FormulaHelper {
|
|
|
705
717
|
static jsonItems_LoadFunctions_Link() {
|
|
706
718
|
let items = [{
|
|
707
719
|
id: '3_4_1',
|
|
708
|
-
text: `TM_GetViewLink (${SDKUI_Localizator.
|
|
720
|
+
text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithoutLogin})`,
|
|
709
721
|
icon: FormulaIconTypes.Function,
|
|
710
722
|
expanded: false,
|
|
711
723
|
hasItems: false,
|
|
712
724
|
}, {
|
|
713
725
|
id: '3_4_2',
|
|
714
|
-
text: `TM_GetViewLink (${SDKUI_Localizator.
|
|
726
|
+
text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithLogin})`,
|
|
715
727
|
icon: FormulaIconTypes.Function,
|
|
716
728
|
expanded: false,
|
|
717
729
|
hasItems: false,
|
|
@@ -77,7 +77,7 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
77
77
|
if (onDcmtTypeSelect)
|
|
78
78
|
onDcmtTypeSelect(tidToUse);
|
|
79
79
|
passToSearch(tidToUse, outputMids);
|
|
80
|
-
} : undefined, isSharedDcmt: isSharedArchive, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, currentTID, currentTID === inputTID ? inputDID : undefined), openFileUploaderPdfEditor: openFileUploaderPdfEditor, onScanRequest: onScanRequest }, currentTID)
|
|
80
|
+
} : undefined, showBackButton: false, isSharedDcmt: isSharedArchive, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, currentTID, currentTID === inputTID ? inputDID : undefined), openFileUploaderPdfEditor: openFileUploaderPdfEditor, onScanRequest: onScanRequest }, currentTID)
|
|
81
81
|
:
|
|
82
82
|
_jsx(TMPanel, { title: 'Archiviazione', allowMaximize: false, children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsx(StyledToppyTextContainer, { children: _jsx(StyledToppyText, { children: SDKUI_Localizator.DcmtTypeSelect }) }), _jsx(StyledToppyImage, { src: Logo, alt: 'Toppy' })] }) }), [currentTID, deviceType, mruTIDs, inputFile, currentInputMids, enableDragDropOverlay, isSharedArchive, allTasks]);
|
|
83
83
|
const allInitialPanelVisibility = {
|
|
@@ -1018,8 +1018,8 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1018
1018
|
}
|
|
1019
1019
|
}, [TID, DID, triggerBlogRefresh, onRefreshBlogDatagrid]);
|
|
1020
1020
|
const checkoutBadge = useMemo(() => {
|
|
1021
|
-
const {
|
|
1022
|
-
if (!
|
|
1021
|
+
const { checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
1022
|
+
if (!checkoutStatus.isCheckedOut)
|
|
1023
1023
|
return null;
|
|
1024
1024
|
return (_jsx(Ribbon, { "$isMobile": isMobile, children: _jsx(TMTooltip, { content: checkoutStatus.editLockTooltipText, position: "right", children: _jsx("span", { children: checkoutStatus.mode === 'editMode' ? SDKUI_Localizator.CheckOut : 'Locked' }) }) }));
|
|
1025
1025
|
}, [formData, fromDTD, isMobile]);
|
|
@@ -1238,7 +1238,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1238
1238
|
},
|
|
1239
1239
|
{
|
|
1240
1240
|
id: 'tmDcmtPreview',
|
|
1241
|
-
name: SDKUI_Localizator.PreviewDocument,
|
|
1241
|
+
name: layoutMode === LayoutModes.Update ? SDKUI_Localizator.PreviewDocument : SDKUI_Localizator.UploadFile,
|
|
1242
1242
|
contentOptions: { component: tmDcmtPreview },
|
|
1243
1243
|
toolbarOptions: {
|
|
1244
1244
|
icon: _jsx(IconShow, { fontSize: 24 }),
|
|
@@ -1421,8 +1421,8 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1421
1421
|
position: 'relative',
|
|
1422
1422
|
overflow: 'hidden'
|
|
1423
1423
|
}, 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)
|
|
1424
|
-
? _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
|
|
1425
|
-
: _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(PanelDisabledStateHandler, { isWFDisabled: isWFDisabled, isSysMetadataDisabled: isSysMetadataDisabled, isBoardDisabled: isBoardDisabled, isDcmtTasksDisabled: isDcmtTasksDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
|
|
1424
|
+
? _jsxs(_Fragment, { children: [_jsx(PanelDisabledStateHandler, { isWFDisabled: isWFDisabled, isSysMetadataDisabled: isSysMetadataDisabled, isBoardDisabled: isBoardDisabled, isDcmtTasksDisabled: isDcmtTasksDisabled, isPreviewDisabled: isPreviewDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] })
|
|
1425
|
+
: _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(PanelDisabledStateHandler, { isWFDisabled: isWFDisabled, isSysMetadataDisabled: isSysMetadataDisabled, isBoardDisabled: isBoardDisabled, isDcmtTasksDisabled: isDcmtTasksDisabled, isPreviewDisabled: isPreviewDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
|
|
1426
1426
|
_jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onClosePanelCallback: () => setIsOpenDistinctValues(false), onSelectionChanged: (e) => {
|
|
1427
1427
|
if (!e)
|
|
1428
1428
|
return;
|
|
@@ -1512,7 +1512,7 @@ const validateMaxLength = (mvd, value, validationItems) => {
|
|
|
1512
1512
|
};
|
|
1513
1513
|
//#endregion Validation
|
|
1514
1514
|
// Synchronizes panel visibility and toolbar button disabled states when panels become disabled
|
|
1515
|
-
const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled }) => {
|
|
1515
|
+
const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled, isPreviewDisabled }) => {
|
|
1516
1516
|
const { setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility } = useTMPanelManagerContext();
|
|
1517
1517
|
useEffect(() => {
|
|
1518
1518
|
// Aggiorna lo stato disabled del bottone toolbar
|
|
@@ -1520,6 +1520,7 @@ const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoar
|
|
|
1520
1520
|
setToolbarButtonDisabled('tmBlog', isBoardDisabled);
|
|
1521
1521
|
setToolbarButtonDisabled('tmWF', isWFDisabled);
|
|
1522
1522
|
setToolbarButtonDisabled('tmDcmtTasks', isDcmtTasksDisabled);
|
|
1523
|
+
setToolbarButtonDisabled('tmDcmtPreview', isPreviewDisabled);
|
|
1523
1524
|
// Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
|
|
1524
1525
|
if (isSysMetadataDisabled && panelVisibility['tmSysMetadata']) {
|
|
1525
1526
|
setPanelVisibilityById('tmSysMetadata', false);
|
|
@@ -1533,7 +1534,10 @@ const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoar
|
|
|
1533
1534
|
if (isDcmtTasksDisabled && panelVisibility['tmDcmtTasks']) {
|
|
1534
1535
|
setPanelVisibilityById('tmDcmtTasks', false);
|
|
1535
1536
|
}
|
|
1536
|
-
|
|
1537
|
+
if (isPreviewDisabled && panelVisibility['tmDcmtPreview']) {
|
|
1538
|
+
setPanelVisibilityById('tmDcmtPreview', false);
|
|
1539
|
+
}
|
|
1540
|
+
}, [isSysMetadataDisabled, isBoardDisabled, isWFDisabled, isDcmtTasksDisabled, isPreviewDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
|
|
1537
1541
|
return null;
|
|
1538
1542
|
};
|
|
1539
1543
|
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, fromDTD, currentDcmt, layoutMode, dcmtFile, deviceType, isVisible, onFileUpload, openFileUploaderPdfEditor, enableDragDropOverlay = false, onScanRequest }) => {
|
|
@@ -1541,7 +1545,7 @@ const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, fromDTD, currentDcmt, lay
|
|
|
1541
1545
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
1542
1546
|
return (layoutMode === LayoutModes.Update ?
|
|
1543
1547
|
_jsx(TMDcmtPreview, { dcmtData: currentDcmt, isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, isResizingActive: isResizingActive }, refreshPreviewTrigger) :
|
|
1544
|
-
_jsx(TMFileUploader, { fromDTD: fromDTD, onFileUpload: onFileUpload,
|
|
1548
|
+
_jsx(TMFileUploader, { fromDTD: fromDTD, onFileUpload: onFileUpload, openFileUploaderPdfEditor: openFileUploaderPdfEditor, 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, onScanRequest: onScanRequest }));
|
|
1545
1549
|
};
|
|
1546
1550
|
const Ribbon = styled.div `
|
|
1547
1551
|
font-size: 0.85rem;
|
|
@@ -4,7 +4,7 @@ import { DcmtTypeDescriptor } from '@topconsultnpm/sdk-ts';
|
|
|
4
4
|
interface ITMFileUploader {
|
|
5
5
|
fromDTD?: DcmtTypeDescriptor;
|
|
6
6
|
onFileUpload?: (file: File | null) => void;
|
|
7
|
-
|
|
7
|
+
openFileUploaderPdfEditor?: (fromDTD?: DcmtTypeDescriptor, file?: File | null, handleFile?: (file: File) => void) => void;
|
|
8
8
|
onClose?: () => void;
|
|
9
9
|
onScanRequest?: (onFileScanned: (file: File) => void) => void;
|
|
10
10
|
isRequired?: boolean;
|
|
@@ -23,7 +23,7 @@ const isScannerLicenseConfigured = () => {
|
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onFileUpload,
|
|
26
|
+
const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onFileUpload, openFileUploaderPdfEditor, onScanRequest, isRequired = false, defaultBlob = null, isResizingActive, showTMPanel = true, enableDragDropOverlay = false, showScannerIcon = true }) => {
|
|
27
27
|
const isBetaFeaturesEnabled = useBetaFeatures();
|
|
28
28
|
const [dragOver, setDragOver] = useState(false);
|
|
29
29
|
const [uploadedFile, setUploadedFile] = useState(defaultBlob);
|
|
@@ -101,11 +101,11 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
|
|
|
101
101
|
_jsx("div", { style: { backgroundColor: '#f6dbdb', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.error }, children: _jsxs("div", { children: [" ", 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] }) })] });
|
|
102
102
|
const innerContent = (_jsxs("div", { style: { width: '100%', height: '100%', padding: '2px', display: 'flex', flexDirection: 'column', gap: 10 }, children: [enableDragDropOverlay && _jsx(TMDragDropOverlay, { handleFile: handleFile, refocusAfterFileInput: refocusAfterFileInput }), content] }));
|
|
103
103
|
const toolbar = useMemo(() => {
|
|
104
|
-
return (_jsxs(_Fragment, { children: [(isPdfEditorAvailable(fromDTD, fileExt) &&
|
|
104
|
+
return (_jsxs(_Fragment, { children: [(isPdfEditorAvailable(fromDTD, fileExt) && openFileUploaderPdfEditor) && (_jsx(TMCommandsContextMenu, { target: "#TMPanel-FileUploader-Commands-Header", menuItems: [
|
|
105
105
|
{
|
|
106
106
|
icon: _jsx(IconEdit, {}),
|
|
107
107
|
text: 'PDF Editor',
|
|
108
|
-
onClick: () =>
|
|
108
|
+
onClick: () => openFileUploaderPdfEditor(fromDTD, uploadedFile, handleFile)
|
|
109
109
|
}
|
|
110
110
|
], showEvent: "click", children: _jsx(IconMenuVertical, { id: "TMPanel-FileUploader-Commands-Header", color: "white", cursor: "pointer" }) })), deviceType !== DeviceType.MOBILE && (_jsx(StyledHeaderIcon, { onClick: onClose, "$color": "white", children: _jsx(TMTooltip, { content: SDKUI_Localizator.Close, children: _jsx(IconCloseOutline, {}) }) }))] }));
|
|
111
111
|
}, [deviceType, fromDTD, onClose]);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { DcmtTypeListCacheService, LayoutModes, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import TMRelationViewer from './TMRelationViewer';
|
|
5
5
|
import TMContextMenu from '../../NewComponents/ContextMenu/TMContextMenu';
|
|
6
|
-
import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView } from '../../../helper';
|
|
6
|
+
import { IconMultipleSelection, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, IconMenuVertical, IconDataList, IconPreview, IconSearchCheck, IconBoard, IconDcmtTypeSys, IconShow, getMoreInfoTasksForDocument, isApprovalWorkflowView, searchResultToMetadataValues, IconRefresh } from '../../../helper';
|
|
7
7
|
import { FormModes, SearchResultContext } from '../../../ts';
|
|
8
8
|
import { TMColors } from '../../../utils/theme';
|
|
9
9
|
import ShowAlert from '../../base/TMAlert';
|
|
@@ -14,7 +14,7 @@ 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 } from '../..';
|
|
17
|
+
import { Spinner, TMButton } from '../..';
|
|
18
18
|
import { useDocumentOperations } from '../../../hooks/useDocumentOperations';
|
|
19
19
|
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 }) => {
|
|
20
20
|
const floatingBarContainerRef = useRef(null);
|
|
@@ -29,11 +29,55 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
29
29
|
const [contextMenuPosition, setContextMenuPosition] = useState({ x: 0, y: 0 });
|
|
30
30
|
const [dtdFocused, setDtdFocused] = useState();
|
|
31
31
|
const [refreshKey, setRefreshKey] = useState(0);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
// Separate refresh key for TMFormOrResultWrapper only (doesn't affect tmTreeView)
|
|
33
|
+
const [refreshKeyFormOrResult, setRefreshKeyFormOrResult] = useState(0);
|
|
34
|
+
/** State for transformed focusedItem metadata values (similar to formData in TMDcmtForm) */
|
|
35
|
+
const [focusedItemFormData, setFocusedItemFormData] = useState([]);
|
|
36
|
+
// Trigger operationItems refresh (after file substitution, etc.)
|
|
37
|
+
const [refreshOperationsTrigger, setRefreshOperationsTrigger] = useState(0);
|
|
38
|
+
// Increments trigger counter to force operationItems to re-calculate
|
|
39
|
+
const onRefreshOperationsDatagrid = useCallback(async () => {
|
|
40
|
+
setRefreshOperationsTrigger(prev => prev + 1);
|
|
41
|
+
}, []);
|
|
42
|
+
// Refresh ALL panels (tree view + search results) with fade-out -> update -> fade-in transition
|
|
43
|
+
const onRefreshAllPanels = async () => {
|
|
44
|
+
await dcmtUtility?.onRefreshPreviewForm?.(); // Refresh preview form data
|
|
45
|
+
setFocusedItem(undefined); // Clear focused item to avoid stale references
|
|
46
|
+
setTimeout(async () => {
|
|
47
|
+
setRefreshKey(prev => prev + 1); // Force re-render of tmTreeView
|
|
48
|
+
setRefreshKeyFormOrResult(prev => prev + 1); // Force re-render of TMFormOrResultWrapper
|
|
49
|
+
await onRefreshOperationsDatagrid(); // Refresh operation items
|
|
50
|
+
}, 200); // Wait for fade-out animation
|
|
36
51
|
};
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const fetchFocusedItemMetadata = async () => {
|
|
54
|
+
if (!focusedItem?.tid || !focusedItem?.did) {
|
|
55
|
+
setFocusedItemFormData([]);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const tid = focusedItem?.tid;
|
|
60
|
+
const did = focusedItem?.did;
|
|
61
|
+
const metadata = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(tid, did, true);
|
|
62
|
+
// Transform metadata to MetadataValueDescriptorEx[] (similar to setMetadataList in TMDcmtForm)
|
|
63
|
+
if (metadata) {
|
|
64
|
+
const dtdResult = metadata.dtdResult;
|
|
65
|
+
const rows = dtdResult?.rows ? dtdResult.rows[0] : [];
|
|
66
|
+
const mids = metadata.selectMIDs;
|
|
67
|
+
// Get DTD with metadata descriptors
|
|
68
|
+
const dtdWithMetadata = await DcmtTypeListCacheService.GetWithNotGrantedAsync(tid, did, metadata);
|
|
69
|
+
const mdList = dtdWithMetadata?.metadata ?? [];
|
|
70
|
+
const metadataList = searchResultToMetadataValues(tid, dtdResult, rows, mids, mdList, LayoutModes.Update);
|
|
71
|
+
setFocusedItemFormData(structuredClone(metadataList));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('Error fetching focusedItem metadata:', error);
|
|
76
|
+
setFocusedItemFormData([]);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
fetchFocusedItemMetadata();
|
|
80
|
+
}, [focusedItem?.tid, focusedItem?.did, refreshOperationsTrigger]);
|
|
37
81
|
// Load dtdFocused when focusedItem changes
|
|
38
82
|
useEffect(() => {
|
|
39
83
|
const loadDtdFocused = async () => {
|
|
@@ -83,17 +127,26 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
83
127
|
currentMetadataValues: [],
|
|
84
128
|
allUsers: [],
|
|
85
129
|
// searchResult: selectedSearchResult,
|
|
86
|
-
datagridUtility
|
|
130
|
+
datagridUtility: {
|
|
131
|
+
visibleItems: [],
|
|
132
|
+
onRefreshSearchAsyncDatagrid: onRefreshAllPanels,
|
|
133
|
+
onRefreshDataRowsAsync: onRefreshAllPanels,
|
|
134
|
+
refreshFocusedDataRowAsync: onRefreshAllPanels,
|
|
135
|
+
onRefreshBlogDatagrid: onRefreshAllPanels,
|
|
136
|
+
onRefreshPreviewDatagrid: onRefreshAllPanels,
|
|
137
|
+
refreshOperationsTrigger,
|
|
138
|
+
onRefreshOperationsDatagrid,
|
|
139
|
+
},
|
|
87
140
|
dcmtUtility: {
|
|
88
141
|
approvalVID: dcmtUtility?.approvalVID,
|
|
89
|
-
dcmtDataRowForCicoStatus:
|
|
142
|
+
dcmtDataRowForCicoStatus: focusedItemFormData, // Passa i metadata trasformati del focusedItem per le operazioni di CICO
|
|
90
143
|
selectedDcmtSearchResultRelations: dcmtUtility?.selectedDcmtSearchResultRelations,
|
|
91
144
|
dcmtTIDHasDetailRelations: dcmtUtility?.dcmtTIDHasDetailRelations,
|
|
92
145
|
dcmtTIDHasMasterRelations: dcmtUtility?.dcmtTIDHasMasterRelations,
|
|
93
|
-
updateCurrentDcmt:
|
|
146
|
+
updateCurrentDcmt: onRefreshAllPanels,
|
|
94
147
|
onCloseDcmtForm: dcmtUtility?.onCloseDcmtForm,
|
|
95
148
|
onRefreshBlogForm: dcmtUtility?.onRefreshBlogForm,
|
|
96
|
-
onRefreshPreviewForm:
|
|
149
|
+
onRefreshPreviewForm: onRefreshAllPanels,
|
|
97
150
|
taskFormDialogComponent: dcmtUtility?.taskFormDialogComponent,
|
|
98
151
|
s4TViewerDialogComponent: dcmtUtility?.s4TViewerDialogComponent
|
|
99
152
|
},
|
|
@@ -213,7 +266,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
213
266
|
}
|
|
214
267
|
}
|
|
215
268
|
];
|
|
216
|
-
const toolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowMultipleSelection && _jsx("p", { style: { color: TMColors.colorHeader, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${selectedItems.filter(item => item.isDcmt).length} selezionati` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(TMContextMenu, { items: commandsMenuItems, trigger: 'left', children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
|
|
269
|
+
const toolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowMultipleSelection && _jsx("p", { style: { color: TMColors.colorHeader, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${selectedItems.filter(item => item.isDcmt).length} selezionati` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshAllPanels }), _jsx(TMContextMenu, { items: commandsMenuItems, trigger: 'left', children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
|
|
217
270
|
const getTitle = () => isForMaster ? `${SDKUI_Localizator.DcmtsMaster} - ${dtdMaster?.nameLoc}` : SDKUI_Localizator.DcmtsDetail;
|
|
218
271
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
219
272
|
const tmTreeView = useMemo(() => _jsx(_Fragment, { children: !inputDcmts || inputDcmts.length === 0
|
|
@@ -225,14 +278,14 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
|
|
|
225
278
|
e.preventDefault();
|
|
226
279
|
setContextMenuPosition({ x: e.clientX, y: e.clientY });
|
|
227
280
|
setContextMenuVisible(true);
|
|
228
|
-
}, children: [_jsx(TMRelationViewerWrapper, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
|
|
281
|
+
}, children: [_jsx(TMRelationViewerWrapper, { refreshKey: refreshKey, inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
|
|
229
282
|
// customItemRender={customItemRender}
|
|
230
|
-
allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: onItemContextMenu }
|
|
283
|
+
allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged, onNoRelationsFound: handleNoRelationsFound, onItemContextMenu: onItemContextMenu, focusedItemFormData: focusedItemFormData }), _jsx(TMContextMenu, { items: operationItems, externalControl: {
|
|
231
284
|
visible: contextMenuVisible,
|
|
232
285
|
position: contextMenuPosition,
|
|
233
286
|
onClose: () => setContextMenuVisible(false)
|
|
234
|
-
} })] }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged, handleNoRelationsFound, onItemContextMenu, contextMenuVisible, contextMenuPosition, refreshKey]);
|
|
235
|
-
const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest }
|
|
287
|
+
} })] }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged, handleNoRelationsFound, onItemContextMenu, contextMenuVisible, contextMenuPosition, refreshKey, focusedItemFormData]);
|
|
288
|
+
const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { refreshKey: refreshKeyFormOrResult, deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, editPdfForm: editPdfForm, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, onRefreshSearchResults: onRefreshAllPanels }), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshAfterAddDcmtToFavs, refreshKeyFormOrResult]);
|
|
236
289
|
const initialPanelDimensions = {
|
|
237
290
|
'tmTreeView': { width: '50%', height: '100%' },
|
|
238
291
|
'tmFormOrResult': { width: '50%', height: '100%' },
|
|
@@ -318,7 +371,7 @@ export default TMMasterDetailDcmts;
|
|
|
318
371
|
* - Panel visibility toggling
|
|
319
372
|
* - Focus delay handling
|
|
320
373
|
*/
|
|
321
|
-
const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu }) => {
|
|
374
|
+
const TMRelationViewerWrapper = ({ refreshKey, inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, customItemRender, allowMultipleSelection, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onNoRelationsFound, onItemContextMenu, focusedItemFormData }) => {
|
|
322
375
|
const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
|
|
323
376
|
// Handle focused item changes with panel visibility management
|
|
324
377
|
const handleFocusedItemChanged = useCallback((item) => {
|
|
@@ -349,13 +402,13 @@ const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndic
|
|
|
349
402
|
onItemContextMenu?.(item, e);
|
|
350
403
|
}, 100);
|
|
351
404
|
}, [onItemContextMenu, handleFocusedItemChanged]);
|
|
352
|
-
return (_jsx(TMRelationViewer, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, initialShowZeroDcmts: showZeroDcmts, customItemRender: customItemRender, allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: onSelectedItemsChanged, maxDepthLevel: 1, invertMasterNavigation: false, onNoRelationsFound: onNoRelationsFound, onItemContextMenu: onContextMenu }));
|
|
405
|
+
return (_jsx(TMRelationViewer, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, initialShowZeroDcmts: showZeroDcmts, customItemRender: customItemRender, allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: onSelectedItemsChanged, maxDepthLevel: 1, invertMasterNavigation: false, onNoRelationsFound: onNoRelationsFound, onItemContextMenu: onContextMenu, focusedItemFormData: focusedItemFormData }, refreshKey));
|
|
353
406
|
};
|
|
354
|
-
const TMFormOrResultWrapper = ({ deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid }) => {
|
|
407
|
+
const TMFormOrResultWrapper = ({ refreshKey, deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, onRefreshAfterAddDcmtToFavs, editPdfForm, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, onRefreshSearchAsyncDatagrid, onRefreshSearchResults }) => {
|
|
355
408
|
const { setPanelVisibilityById } = useTMPanelManagerContext();
|
|
356
409
|
return (_jsx(_Fragment, { children: focusedItem?.isDcmt ?
|
|
357
410
|
_jsx(TMDcmtForm, { groupId: 'tmFormOrResult', TID: focusedItem?.tid, DID: focusedItem.did, allowButtonsRefs: true, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: false, onClose: () => { setPanelVisibilityById('tmTreeView', true); }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.tid, focusedItem?.did), openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, datagridUtility: {
|
|
358
411
|
onRefreshSearchAsyncDatagrid,
|
|
359
|
-
} }) :
|
|
360
|
-
_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, 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 }) }));
|
|
412
|
+
} }, refreshKey) :
|
|
413
|
+
_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, 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 }, refreshKey) }));
|
|
361
414
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DcmtTypeDescriptor, SearchResultDescriptor, DataColumnDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
-
import { DcmtInfo } from '../../../ts';
|
|
3
|
+
import { DcmtInfo, MetadataValueDescriptorEx } from '../../../ts';
|
|
4
4
|
import { ITMTreeItem } from '../../base/TMTreeView';
|
|
5
5
|
/**
|
|
6
6
|
* Tree item structure for relations
|
|
@@ -104,6 +104,11 @@ export interface TMRelationViewerProps {
|
|
|
104
104
|
* Use to show a context menu.
|
|
105
105
|
*/
|
|
106
106
|
onItemContextMenu?: (item: RelationTreeItem, e: React.MouseEvent) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Metadata values for the focused item
|
|
109
|
+
* (used in master-detail context)
|
|
110
|
+
*/
|
|
111
|
+
focusedItemFormData?: MetadataValueDescriptorEx[];
|
|
107
112
|
}
|
|
108
113
|
/**
|
|
109
114
|
* Check if document type has detail relations
|