@topconsultnpm/sdkui-react 6.21.0-dev1.3 → 6.21.0-dev1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/base/TMAreaManager.js +18 -3
- 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/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
|
@@ -390,7 +390,9 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
390
390
|
const deleteItem = async (item) => {
|
|
391
391
|
const ad = item.dataItem.dataItem;
|
|
392
392
|
const aid = ad.id;
|
|
393
|
-
const
|
|
393
|
+
const subFolderOld = item.parentPath === ad.name ? '' : item.parentPath.replace(ad.name + '/', '');
|
|
394
|
+
const subFolder = getSubFolder(item.parentPath, ad.name);
|
|
395
|
+
console.log("Delete item with subfolder: ", subFolder, " old subfolder: ", subFolderOld);
|
|
394
396
|
const tms = props.tmSession ?? SDK_Globals.tmSession;
|
|
395
397
|
if (item.isDirectory) {
|
|
396
398
|
await tms?.NewAreaEngine().DeleteFoldersAsync(aid, subFolder, [item.name]).catch((err) => { throw new FileSystemError(5, item, err.message ?? SDKUI_Localizator.GetFolderDeletionErrorMessage); });
|
|
@@ -594,16 +596,29 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
594
596
|
throw new FileSystemError(5, undefined, error.message ?? SDKUI_Localizator.Error);
|
|
595
597
|
}
|
|
596
598
|
};
|
|
599
|
+
const getSubFolder = (dir, startStr) => {
|
|
600
|
+
//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)
|
|
601
|
+
if (startStr && !dir.startsWith(startStr)) {
|
|
602
|
+
return dir;
|
|
603
|
+
}
|
|
604
|
+
//In tutti gli altri casi rimuovo la prima cartella del percorso (che corrisponde al nome dell'area) e la restituisco come subfolder
|
|
605
|
+
const parts = dir.split("/");
|
|
606
|
+
console.log(parts);
|
|
607
|
+
let subFolder = parts.slice(1).join("/");
|
|
608
|
+
console.log(subFolder);
|
|
609
|
+
return subFolder;
|
|
610
|
+
};
|
|
597
611
|
const onCurrentDirectoryChanged = (e) => {
|
|
598
612
|
setCurrentRoute(e.directory.path);
|
|
599
613
|
setFocusedFileSystemItem(e.directory);
|
|
614
|
+
console.log("Current directory changed: ", e.directory);
|
|
600
615
|
if (e.directory.path === '' && e.directory.name === '')
|
|
601
616
|
return;
|
|
602
617
|
let ad = e.directory.dataItem.dataItem;
|
|
603
618
|
if (!ad)
|
|
604
619
|
return;
|
|
605
620
|
let aid = ad.id;
|
|
606
|
-
let subFolder = e.directory.path
|
|
621
|
+
let subFolder = getSubFolder(e.directory.path);
|
|
607
622
|
setAreaFolder(getAreaPath(aid, subFolder));
|
|
608
623
|
e.component.option("fileSystemProvider").getItems(e.directory).then((items) => {
|
|
609
624
|
setParentDirectoryFileSystemItems(items);
|
|
@@ -728,6 +743,6 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
728
743
|
onItemCopied={() => setCounter(counter => counter + 1)}
|
|
729
744
|
onItemDeleted={() => setCounter(counter => counter - 1)}
|
|
730
745
|
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 !== "" &&
|
|
746
|
+
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"] }), "const primo = areasRoots.values().next().value;", _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
747
|
};
|
|
733
748
|
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
|
|
@@ -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, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes } from "@topconsultnpm/sdk-ts";
|
|
4
|
-
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo } from '../../../helper';
|
|
3
|
+
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus } from '../../../helper';
|
|
5
5
|
import { TMColors } from '../../../utils/theme';
|
|
6
6
|
import { StyledDivHorizontal, StyledBadge } from '../../base/Styled';
|
|
7
7
|
import TMTreeView from '../../base/TMTreeView';
|
|
@@ -136,7 +136,7 @@ export const searchResultToDataSource = async (searchResult, hideSysMetadata) =>
|
|
|
136
136
|
}
|
|
137
137
|
return output;
|
|
138
138
|
};
|
|
139
|
-
const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems, showMainDocument = true, labelMainContainer, onNoRelationsFound, onItemContextMenu, }) => {
|
|
139
|
+
const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems, showMainDocument = true, labelMainContainer, onNoRelationsFound, onItemContextMenu, focusedItemFormData = [] }) => {
|
|
140
140
|
// State
|
|
141
141
|
const [dcmtTypes, setDcmtTypes] = useState([]);
|
|
142
142
|
const [treeData, setTreeData] = useState([]);
|
|
@@ -160,6 +160,16 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
160
160
|
const userInteractedWithStaticItemsRef = React.useRef(false);
|
|
161
161
|
// Ref to track the last inputKey for which we set the focused item
|
|
162
162
|
const lastFocusedInputRef = React.useRef('');
|
|
163
|
+
// State for all users (used for checkout status display)
|
|
164
|
+
const [allUsers, setAllUsers] = useState([]);
|
|
165
|
+
// Load all users for checkout status resolution
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
const fetchAllUsers = async () => {
|
|
168
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
169
|
+
setAllUsers(users ?? []);
|
|
170
|
+
};
|
|
171
|
+
fetchAllUsers();
|
|
172
|
+
}, []);
|
|
163
173
|
/**
|
|
164
174
|
* Generate a stable key from inputDcmts to detect real changes
|
|
165
175
|
*/
|
|
@@ -234,6 +244,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
234
244
|
dcmtDetails.push({
|
|
235
245
|
tid: tid,
|
|
236
246
|
did: did,
|
|
247
|
+
dtd: dtd,
|
|
237
248
|
isLogDel: isLogDel,
|
|
238
249
|
key: `${tid}_${did}_${searchResult.relationID}_${mTID}_${mDID}_${rowGUID}`,
|
|
239
250
|
isDcmt: true,
|
|
@@ -247,7 +258,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
247
258
|
expanded: false,
|
|
248
259
|
hidden: false,
|
|
249
260
|
name: row?.SYS_Abstract?.value || row?.SYS_SUBJECT?.value || `Documento ${did}`,
|
|
250
|
-
fileExt: row?.FILEEXT?.value
|
|
261
|
+
fileExt: row?.FILEEXT?.value,
|
|
251
262
|
// Note: Recursive loading on expansion is handled by calculateItemsForNode
|
|
252
263
|
});
|
|
253
264
|
}
|
|
@@ -260,7 +271,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
260
271
|
console.error('❌ Error loading detail documents:', error);
|
|
261
272
|
}
|
|
262
273
|
return items;
|
|
263
|
-
}, [allowedTIDs]);
|
|
274
|
+
}, [allowedTIDs, focusedItemFormData, focusedItem?.dtd?.id]);
|
|
264
275
|
/**
|
|
265
276
|
* Recursively retrieve master documents
|
|
266
277
|
*/
|
|
@@ -319,6 +330,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
319
330
|
dcmtMasters.push({
|
|
320
331
|
tid: tid,
|
|
321
332
|
did: did,
|
|
333
|
+
dtd: dtd,
|
|
322
334
|
isLogDel: isLogDel,
|
|
323
335
|
key: `${tid}_${did}_${searchResult.relationID}_${dTID}_${dDID}_${rowGUID}`,
|
|
324
336
|
isDcmt: true,
|
|
@@ -609,12 +621,14 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
609
621
|
name: docRow?.SYS_Abstract?.value || docRow?.SYS_SUBJECT?.value || `Documento ${isForMaster ? 'Dettaglio' : 'Master'}`,
|
|
610
622
|
tid: dcmt.TID,
|
|
611
623
|
did: dcmt.DID,
|
|
624
|
+
dtd: dtd,
|
|
612
625
|
isDcmt: true,
|
|
613
626
|
isContainer: false,
|
|
614
627
|
expanded: false,
|
|
615
628
|
isZero: dcmt.DID === 0,
|
|
616
629
|
isMaster: !isForMaster,
|
|
617
630
|
isLoaded: true,
|
|
631
|
+
isLogDel: docRow?.ISLOGDEL?.value,
|
|
618
632
|
hidden: false,
|
|
619
633
|
values: docRow,
|
|
620
634
|
searchResult: result ? [result] : [],
|
|
@@ -1080,8 +1094,31 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
1080
1094
|
const metadataContent = customDocumentContent
|
|
1081
1095
|
? customDocumentContent(item, defaultMetadataContent || _jsx(_Fragment, {}))
|
|
1082
1096
|
: defaultMetadataContent;
|
|
1083
|
-
|
|
1084
|
-
|
|
1097
|
+
// Calculate checkout status for non-root documents
|
|
1098
|
+
let checkoutStatusIcon = null;
|
|
1099
|
+
if (item.values && item.dtd) {
|
|
1100
|
+
// Convert item.values to flat format expected by getDcmtCicoStatus
|
|
1101
|
+
const flatValues = {};
|
|
1102
|
+
if (item.values) {
|
|
1103
|
+
for (const key of Object.keys(item.values)) {
|
|
1104
|
+
const entry = item.values[key];
|
|
1105
|
+
if (entry?.md?.id && item.tid) {
|
|
1106
|
+
// Create TID_MID key format for metadata
|
|
1107
|
+
flatValues[`${item.tid}_${entry.md.id}`] = entry.value;
|
|
1108
|
+
}
|
|
1109
|
+
// Also add direct key for system properties
|
|
1110
|
+
flatValues[key] = entry?.value;
|
|
1111
|
+
}
|
|
1112
|
+
flatValues.TID = item.tid;
|
|
1113
|
+
flatValues.DID = item.did;
|
|
1114
|
+
}
|
|
1115
|
+
const { checkoutStatus } = getDcmtCicoStatus(flatValues, allUsers, item.dtd);
|
|
1116
|
+
if (checkoutStatus.isCheckedOut && checkoutStatus.icon) {
|
|
1117
|
+
checkoutStatusIcon = checkoutStatus.icon;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
return (_jsxs("div", { onDoubleClick: handleDoubleClick, style: documentStyle, children: [item.did && item.tid && showCurrentDcmtIndicator && inputDcmts?.some(d => d.DID === item.did && d.TID === item.tid) ? _jsx(IconBackhandIndexPointingRight, { fontSize: 22, overflow: 'visible' }) : _jsx(_Fragment, {}), item.values && (_jsx(TMDcmtIcon, { tid: item.values?.TID?.value, did: item.values?.DID?.value, fileExtension: item.values?.FILEEXT?.value, fileCount: item.values?.FILECOUNT?.value, isLexProt: item.values?.IsLexProt?.value, isMail: item.values?.ISMAIL?.value, isShared: item.values?.ISSHARED?.value, isSigned: item.values?.ISSIGNED?.value, downloadMode: 'openInNewWindow' })), checkoutStatusIcon, metadataContent] }));
|
|
1121
|
+
}, [onDocumentDoubleClick, showCurrentDcmtIndicator, inputDcmts, customMainContainerContent, customDocumentStyle, customDocumentContent, showMetadataNames, showMainDocument, focusedItemFormData, focusedItem?.dtd, allUsers]);
|
|
1085
1122
|
/**
|
|
1086
1123
|
* Wrapper renderer that handles custom rendering if provided
|
|
1087
1124
|
*/
|
|
@@ -201,7 +201,7 @@ const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch =
|
|
|
201
201
|
alignItems: 'center',
|
|
202
202
|
justifyContent: 'center',
|
|
203
203
|
minWidth: 0
|
|
204
|
-
}, children: [_jsx("p", { style: {
|
|
204
|
+
}, children: [_jsx("p", { title: sqd.name, style: {
|
|
205
205
|
fontSize: '1rem',
|
|
206
206
|
fontWeight: sqd.id === 1 ? 600 : 'normal',
|
|
207
207
|
whiteSpace: 'nowrap',
|
|
@@ -27,6 +27,7 @@ interface ITMSearchProps {
|
|
|
27
27
|
openS4TViewer?: boolean;
|
|
28
28
|
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: (() => Promise<void>)) => void;
|
|
29
29
|
onOpenPdfEditorRequest?: ((dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void);
|
|
30
|
+
openFileUploaderPdfEditor?: (fromDTD?: DcmtTypeDescriptor, file?: File | null, handleFile?: (file: File) => void) => void;
|
|
30
31
|
showTodoDcmtForm?: boolean;
|
|
31
32
|
showToppyDraggableHelpCenter?: boolean;
|
|
32
33
|
toppyHelpCenterUsePortal?: boolean;
|