@topconsultnpm/sdkui-react 6.20.0-dev1.14 → 6.20.0-dev1.16
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/TMCustomButton.js +0 -1
- package/lib/components/base/TMDataGrid.d.ts +2 -2
- package/lib/components/base/TMDataGrid.js +15 -4
- package/lib/components/features/documents/TMDcmtForm.js +146 -63
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
- package/lib/components/features/search/TMSearchResult.js +21 -195
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +3 -3
- package/lib/components/forms/Login/TMLoginForm.js +2 -0
- package/lib/helper/SDKUI_Localizator.d.ts +1 -0
- package/lib/helper/SDKUI_Localizator.js +10 -0
- package/lib/helper/checkinCheckoutManager.d.ts +30 -1
- package/lib/helper/checkinCheckoutManager.js +109 -29
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.js +7 -1
- package/lib/helper/queryHelper.js +17 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/package.json +1 -1
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +0 -4
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +0 -187
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +0 -11
- package/lib/components/NewComponents/ContextMenu/hooks.js +0 -48
- package/lib/components/NewComponents/ContextMenu/index.d.ts +0 -2
- package/lib/components/NewComponents/ContextMenu/index.js +0 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +0 -27
- package/lib/components/NewComponents/ContextMenu/styles.js +0 -308
- package/lib/components/NewComponents/ContextMenu/types.d.ts +0 -26
- package/lib/components/NewComponents/ContextMenu/types.js +0 -1
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +0 -4
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +0 -370
- package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +0 -2
- package/lib/components/NewComponents/FloatingMenuBar/index.js +0 -2
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +0 -38
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +0 -267
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +0 -30
- package/lib/components/NewComponents/FloatingMenuBar/types.js +0 -1
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -39,8 +39,8 @@ export interface TMDataGridProps<T> extends IDataGridOptions {
|
|
|
39
39
|
showFilterPanel?: boolean;
|
|
40
40
|
/** Show the load panel */
|
|
41
41
|
showLoadPanel?: boolean;
|
|
42
|
-
/** Show the column chooser */
|
|
43
|
-
|
|
42
|
+
/** Show the header column chooser in context menu */
|
|
43
|
+
showHeaderColumnChooser?: boolean;
|
|
44
44
|
/** Show the search panel */
|
|
45
45
|
showSearchPanel?: boolean;
|
|
46
46
|
/** Show the group panel */
|
|
@@ -16,9 +16,9 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
16
16
|
// main properties
|
|
17
17
|
keyExpr = 'id', dataSource, focusedRowEnabled = true, hoverStateEnabled = true, focusedRowKey, selectedRowKeys = [],
|
|
18
18
|
// custom options
|
|
19
|
-
dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = true, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before', searchPanelFocusStarting = false, counterConfig = { show: false, items: new Map() }, onHasFiltersChange,
|
|
19
|
+
dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = true, showHeaderColumnChooser = false, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before', searchPanelFocusStarting = false, counterConfig = { show: false, items: new Map() }, onHasFiltersChange,
|
|
20
20
|
// events and callbacks
|
|
21
|
-
onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onCellDblClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, onKeyDown, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring,
|
|
21
|
+
onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onCellDblClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, onKeyDown, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring, grouping, groupPanel, filterRow, headerFilter, editing, rowDragging, masterDetail,
|
|
22
22
|
// other properties
|
|
23
23
|
disabled = false, autoNavigateToFocusedRow = true, columnResizingMode = 'widget', columnHidingEnabled = true, columnAutoWidth = true, allowColumnResizing = true, allowColumnReordering = true, showBorders = true, showRowLines = SDKUI_Globals.userSettings?.themeSettings.gridSettings.showRowLines === 1, showColumnLines = SDKUI_Globals.userSettings?.themeSettings.gridSettings.showColumnLines === 1, showColumnHeaders = true, rowAlternationEnabled = false, wordWrapEnabled = false, noDataText,
|
|
24
24
|
// styles
|
|
@@ -146,7 +146,18 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
146
146
|
e.items = [...updatedContextMenuItems];
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
// Add column chooser to header context menu
|
|
150
|
+
if (e.target === 'header' && showHeaderColumnChooser) {
|
|
151
|
+
e.items = e.items || [];
|
|
152
|
+
e.items.push({
|
|
153
|
+
text: SDKUI_Localizator.ShowColumnSelection,
|
|
154
|
+
icon: 'columnchooser',
|
|
155
|
+
onItemClick: () => {
|
|
156
|
+
internalRef.current?.instance().showColumnChooser();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}, [updateContextMenuItems, onContextMenuPreparing, showHeaderColumnChooser]);
|
|
150
161
|
// Handle toolbar preparation, especially for the search panel
|
|
151
162
|
const onToolbarPreparingCallback = useCallback((e) => {
|
|
152
163
|
if (e === undefined || e.toolbarOptions === undefined || e.toolbarOptions.items === undefined)
|
|
@@ -223,7 +234,7 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
223
234
|
// other properties
|
|
224
235
|
disabled: disabled, autoNavigateToFocusedRow: autoNavigateToFocusedRow, focusedRowKey: focusedRowKey, columnHidingEnabled: columnHidingEnabled, columnResizingMode: columnResizingMode, columnAutoWidth: columnAutoWidth, allowColumnResizing: allowColumnResizing, allowColumnReordering: allowColumnReordering, showBorders: showBorders, showRowLines: showRowLines, showColumnLines: showColumnLines, showColumnHeaders: showColumnHeaders, rowAlternationEnabled: rowAlternationEnabled, wordWrapEnabled: wordWrapEnabled, noDataText: noDataText,
|
|
225
236
|
// styles
|
|
226
|
-
width: width, height: height, style: { userSelect: 'none' }, children: [dataColumns.map((column, index) => (_jsx(Column, { ...column }, column.caption + index.toString()))), sorting && _jsx(Sorting, { ...sorting }), selection && _jsx(Selection, { ...selection }), scrolling && _jsx(Scrolling, { ...scrolling }), summary && _jsx(Summary, { ...summary }), showHeaderFilter && _jsx(HeaderFilter, { visible: true, ...headerFilter }), rowDragging && _jsx(RowDragging, { ...rowDragging }), filterRow && _jsx(FilterRow, { ...filterRow }), showFilterPanel && _jsx(FilterPanel, { visible: true }),
|
|
237
|
+
width: width, height: height, style: { userSelect: 'none' }, children: [dataColumns.map((column, index) => (_jsx(Column, { ...column }, column.caption + index.toString()))), sorting && _jsx(Sorting, { ...sorting }), selection && _jsx(Selection, { ...selection }), scrolling && _jsx(Scrolling, { ...scrolling }), summary && _jsx(Summary, { ...summary }), showHeaderFilter && _jsx(HeaderFilter, { visible: true, ...headerFilter }), rowDragging && _jsx(RowDragging, { ...rowDragging }), filterRow && _jsx(FilterRow, { ...filterRow }), showFilterPanel && _jsx(FilterPanel, { visible: true }), showHeaderColumnChooser && _jsx(ColumnChooser, { enabled: !showHeaderColumnChooser, mode: "select", position: { my: 'center', at: 'center', of: window } }), stateStoring && _jsx(StateStoring, { ...stateStoring }), groupPanel && _jsx(GroupPanel, { ...groupPanel }), _jsx(Grouping, { contextMenuEnabled: true, ...grouping }), _jsx(LoadPanel, { enabled: showLoadPanel }), _jsx(SearchPanel, { visible: showSearchPanel, searchVisibleColumnsOnly: true, highlightSearchText: true }), editing && _jsx(Editing, { ...editing }), paging && _jsx(Paging, { ...paging }), pager && _jsx(Pager, { ...pager, visible: totalRecordCount > pageSize }), masterDetail && _jsx(MasterDetail, { ...masterDetail })] }) }), counterConfig.show && _jsx("div", { style: { width: "100%", height: "25px", display: "flex", alignItems: "center", gap: "15px", backgroundColor: "#e0e0e0" }, children: _jsx(TMCounterContainer, { items: counterValues, bgColorContainer: counterConfig.bgColorContainer, bgColorItem: counterConfig.bgColorItem, hoverColorItem: counterConfig.hoverColorItem, textColorItem: counterConfig.textColorItem }) })] });
|
|
227
238
|
});
|
|
228
239
|
export default TMDataGrid;
|
|
229
240
|
const getRecordCount = (dataSource) => {
|
|
@@ -9,7 +9,7 @@ import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
|
9
9
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
10
10
|
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
11
11
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
12
|
-
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary, IconStar, IconRelation, IconInfo, IconArchiveDoc, IconDelete, IconPair, IconUnpair, IconArchiveMaster, IconArchiveDetail } from '../../../helper';
|
|
12
|
+
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary, IconStar, IconRelation, IconInfo, IconArchiveDoc, IconDelete, IconPair, IconUnpair, IconArchiveMaster, IconArchiveDetail, getDcmtCicoStatus, IconFileDots } from '../../../helper';
|
|
13
13
|
import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
|
|
14
14
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
15
15
|
import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
|
|
@@ -42,9 +42,13 @@ import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
|
42
42
|
import { getTaskAssignedToMe } from '../tasks/TMTasksUtils';
|
|
43
43
|
import TMCustomButton from '../../base/TMCustomButton';
|
|
44
44
|
import ToppyDraggableHelpCenter from '../assistant/ToppyDraggableHelpCenter';
|
|
45
|
+
import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
|
|
46
|
+
import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
|
|
47
|
+
import TMDcmtCheckoutInfoForm from '../search/TMDcmtCheckoutInfoForm';
|
|
45
48
|
let abortControllerLocal = new AbortController();
|
|
46
49
|
//#endregion
|
|
47
50
|
const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, showBackButton = true, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, onTaskCreateRequest, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], openS4TViewer = false, onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
|
|
51
|
+
const { showHistory, showHistoryCallback, hideHistoryCallback, showCheckoutInformationForm, commentFormState, hideCommentFormCallback, showCheckoutInformationFormCallback, hideCheckoutInformationFormCallback, copyCheckoutPathToClipboardCallback, handleCheckOutCallback, handleCheckInCallback, refreshPreviewTrigger, showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, } = useCheckInOutOperations();
|
|
48
52
|
const [id, setID] = useState('');
|
|
49
53
|
const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
|
|
50
54
|
const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
|
|
@@ -124,7 +128,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
124
128
|
selectMIDs: selectMIDs,
|
|
125
129
|
dtdResult: {
|
|
126
130
|
rows: [rowValues],
|
|
127
|
-
columns: selectMIDs.map(mid => ({ name: `MID_${mid}
|
|
131
|
+
columns: selectMIDs.map(mid => ({ name: `MID_${mid}`, }))
|
|
128
132
|
},
|
|
129
133
|
dcmtsFound: 1,
|
|
130
134
|
dcmtsReturned: 1
|
|
@@ -242,7 +246,6 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
242
246
|
}
|
|
243
247
|
// Carica DTD e metadata
|
|
244
248
|
let dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(TID, DID, getMetadataResult);
|
|
245
|
-
console.log('GetWithNotGrantedAsync DTD:', dtd);
|
|
246
249
|
setFromDTD(dtd);
|
|
247
250
|
if (layoutMode === LayoutModes.Update || (layoutMode === LayoutModes.Ark && DID)) {
|
|
248
251
|
await setMetadataList(dtd?.metadata ?? [], getMetadataResult);
|
|
@@ -411,6 +414,21 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
411
414
|
const workItemSetIDValue = useMemo(() => formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [formData]);
|
|
412
415
|
// Valore derivato: true se formData ha elementi validi
|
|
413
416
|
const hasFormData = useMemo(() => formData.length > 0 && formData.some(md => md.mid && md.mid > 99), [formData]);
|
|
417
|
+
const handleCheckOutOperationCallback = async (checkout) => {
|
|
418
|
+
if (!currentDcmt)
|
|
419
|
+
return;
|
|
420
|
+
await handleCheckOutCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, checkout, fromDTD?.name ?? SDKUI_Localizator.SearchResult, downloadDcmtsAsync, updateCurrentDcmt);
|
|
421
|
+
};
|
|
422
|
+
const handleCheckInOperationCallback = async () => {
|
|
423
|
+
if (!currentDcmt)
|
|
424
|
+
return;
|
|
425
|
+
await handleCheckInCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, fileName: fromDTD?.name ?? SDKUI_Localizator.SearchResult }, updateCurrentDcmt, undefined);
|
|
426
|
+
};
|
|
427
|
+
const copyCheckoutPathToClipboardOperationCallback = () => {
|
|
428
|
+
if (!currentDcmt)
|
|
429
|
+
return;
|
|
430
|
+
copyCheckoutPathToClipboardCallback({ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, fromDTD?.name ?? SDKUI_Localizator.SearchResult);
|
|
431
|
+
};
|
|
414
432
|
useEffect(() => {
|
|
415
433
|
const loadAllWfData = async () => {
|
|
416
434
|
if (layoutMode !== LayoutModes.Update || !DID || fromDTD?.templateTID !== TemplateTIDs.WF_WIApprView) {
|
|
@@ -566,6 +584,51 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
566
584
|
items: operationsItems
|
|
567
585
|
});
|
|
568
586
|
}
|
|
587
|
+
// Check in/Check out menu
|
|
588
|
+
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, [], fromDTD);
|
|
589
|
+
items.push({
|
|
590
|
+
icon: svgToString(_jsx(IconFileDots, {})),
|
|
591
|
+
text: "Check in/Check out",
|
|
592
|
+
disabled: false,
|
|
593
|
+
items: [
|
|
594
|
+
{
|
|
595
|
+
icon: "edit",
|
|
596
|
+
text: 'Check out',
|
|
597
|
+
disabled: !cicoEnabled || checkoutStatus.isCheckedOut,
|
|
598
|
+
onClick: () => handleCheckOutOperationCallback(true),
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
icon: "unlock",
|
|
602
|
+
text: 'Check in',
|
|
603
|
+
onClick: () => handleCheckInOperationCallback(),
|
|
604
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode'
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
icon: "remove",
|
|
608
|
+
text: SDKUI_Localizator.CancelCheckOut,
|
|
609
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode',
|
|
610
|
+
onClick: () => handleCheckOutOperationCallback(false),
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
icon: "info",
|
|
614
|
+
text: SDKUI_Localizator.CheckoutInfo,
|
|
615
|
+
onClick: showCheckoutInformationFormCallback,
|
|
616
|
+
disabled: !checkoutStatus.isCheckedOut
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
icon: "copy",
|
|
620
|
+
text: SDKUI_Localizator.CopyCheckoutPath,
|
|
621
|
+
onClick: copyCheckoutPathToClipboardOperationCallback,
|
|
622
|
+
disabled: !checkoutStatus.isCheckedOut
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
icon: "clock",
|
|
626
|
+
text: SDKUI_Localizator.History,
|
|
627
|
+
disabled: !cicoEnabled,
|
|
628
|
+
onClick: showHistoryCallback,
|
|
629
|
+
},
|
|
630
|
+
]
|
|
631
|
+
});
|
|
569
632
|
if (allowRelations && layoutMode === LayoutModes.Update && DID) {
|
|
570
633
|
const relationsItems = [
|
|
571
634
|
{
|
|
@@ -731,6 +794,60 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
731
794
|
},
|
|
732
795
|
});
|
|
733
796
|
}, [isModal, id, layoutMode]);
|
|
797
|
+
// Funzione helper per ottenere e aggiornare i metadati con gestione errori centralizzata
|
|
798
|
+
const refreshMetadataAsync = useCallback(async () => {
|
|
799
|
+
let metadataResult = undefined;
|
|
800
|
+
let hasGetMetadataError = false;
|
|
801
|
+
try {
|
|
802
|
+
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
|
|
803
|
+
}
|
|
804
|
+
catch (metadataError) {
|
|
805
|
+
hasGetMetadataError = true;
|
|
806
|
+
// Estrai ErrorCode dal campo detail se disponibile
|
|
807
|
+
let errorCode = undefined;
|
|
808
|
+
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
809
|
+
try {
|
|
810
|
+
const detailObj = JSON.parse(metadataError.response.detail);
|
|
811
|
+
errorCode = detailObj?.ErrorCode;
|
|
812
|
+
}
|
|
813
|
+
catch (parseError) {
|
|
814
|
+
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
818
|
+
if (errorCode === -5) {
|
|
819
|
+
TMMessageBoxManager.show({
|
|
820
|
+
message: SDKUI_Localizator.DcmtOutOfView,
|
|
821
|
+
buttons: [ButtonNames.OK],
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
TMExceptionBoxManager.show({ exception: metadataError });
|
|
826
|
+
}
|
|
827
|
+
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
828
|
+
metadataResult = null;
|
|
829
|
+
}
|
|
830
|
+
// Aggiorna i metadati locali solo se non ci sono stati errori
|
|
831
|
+
if (!hasGetMetadataError && metadataResult && metadataResult !== null) {
|
|
832
|
+
await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
|
|
833
|
+
}
|
|
834
|
+
return { success: !hasGetMetadataError, result: metadataResult };
|
|
835
|
+
}, [TID, DID, setMetadataList]);
|
|
836
|
+
const updateCurrentDcmt = useCallback(async () => {
|
|
837
|
+
try {
|
|
838
|
+
TMSpinner.show({ description: 'Aggiornamento in corso...' });
|
|
839
|
+
const { success, result: metadataResult } = await refreshMetadataAsync();
|
|
840
|
+
if (!success)
|
|
841
|
+
onClose?.();
|
|
842
|
+
await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
|
|
843
|
+
}
|
|
844
|
+
catch (e) {
|
|
845
|
+
TMExceptionBoxManager.show({ exception: e });
|
|
846
|
+
}
|
|
847
|
+
finally {
|
|
848
|
+
TMSpinner.hide();
|
|
849
|
+
}
|
|
850
|
+
}, [refreshMetadataAsync, onClose]);
|
|
734
851
|
const handleSave = useCallback(async () => {
|
|
735
852
|
const ue = new UpdateEngineByID(SDK_Globals.tmSession);
|
|
736
853
|
ue.DID = DID;
|
|
@@ -767,55 +884,20 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
767
884
|
const savedFormData = structuredClone(formDataRef.current);
|
|
768
885
|
setFormDataOrig(savedFormData);
|
|
769
886
|
formDataOrigRef.current = savedFormData;
|
|
770
|
-
//
|
|
771
|
-
|
|
772
|
-
let hasGetMetadataError = false;
|
|
773
|
-
try {
|
|
774
|
-
metadataResult = await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, DID, true);
|
|
775
|
-
}
|
|
776
|
-
catch (metadataError) {
|
|
777
|
-
hasGetMetadataError = true;
|
|
778
|
-
// Estrai ErrorCode dal campo detail se disponibile
|
|
779
|
-
let errorCode = undefined;
|
|
780
|
-
if (metadataError?.isApiException && metadataError?.response?.detail) {
|
|
781
|
-
try {
|
|
782
|
-
const detailObj = JSON.parse(metadataError.response.detail);
|
|
783
|
-
errorCode = detailObj?.ErrorCode;
|
|
784
|
-
}
|
|
785
|
-
catch (parseError) {
|
|
786
|
-
console.log("Impossibile parsare il detail dell'eccezione:", parseError);
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
// Se ErrorCode è -5, mostra messaggio personalizzato, altrimenti mostra l'eccezione originale
|
|
790
|
-
if (errorCode === -5) {
|
|
791
|
-
TMMessageBoxManager.show({
|
|
792
|
-
message: SDKUI_Localizator.DcmtOutOfView,
|
|
793
|
-
buttons: [ButtonNames.OK],
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
else {
|
|
797
|
-
TMExceptionBoxManager.show({ exception: metadataError });
|
|
798
|
-
}
|
|
799
|
-
// Usa null per indicare al callback che c'è stato un errore e non deve ritentare
|
|
800
|
-
metadataResult = null;
|
|
801
|
-
}
|
|
887
|
+
// Usa la funzione helper per ottenere i metadati aggiornati
|
|
888
|
+
const { success, result: metadataResult } = await refreshMetadataAsync();
|
|
802
889
|
// Esegui sempre il callback:
|
|
803
890
|
// - Se metadataResult è un oggetto: refresh normale
|
|
804
891
|
// - Se metadataResult è null: GetMetadataAsync fallito, rimuove il documento dalla griglia senza ritentare
|
|
805
892
|
// - Se metadataResult è undefined: nessun parametro passato, il callback può decidere cosa fare
|
|
806
893
|
await onSavedAsyncCallback?.(TID, DID, metadataResult === null ? null : metadataResult);
|
|
807
894
|
// Mostra messaggio di successo solo se non ci sono stati errori critici
|
|
808
|
-
if (
|
|
809
|
-
if (metadataResult && metadataResult !== null) {
|
|
810
|
-
// Usa fromDTDRef.current invece di fromDTD per evitare stale closure.
|
|
811
|
-
// fromDTD potrebbe essere undefined/vuoto nel callback se lo stato è cambiato,
|
|
812
|
-
// mentre fromDTDRef.current contiene sempre il valore corrente sincronizzato tramite useEffect.
|
|
813
|
-
await setMetadataList(fromDTDRef.current?.metadata ?? [], metadataResult);
|
|
814
|
-
}
|
|
895
|
+
if (success) {
|
|
815
896
|
ShowAlert({ mode: 'success', title: 'Form di documento', message: 'Le modifiche sono state salvate con successo', duration: 3000 });
|
|
816
897
|
}
|
|
817
|
-
else
|
|
898
|
+
else {
|
|
818
899
|
onClose?.();
|
|
900
|
+
}
|
|
819
901
|
}
|
|
820
902
|
catch (e) {
|
|
821
903
|
TMExceptionBoxManager.show({ exception: e });
|
|
@@ -823,7 +905,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
823
905
|
finally {
|
|
824
906
|
TMSpinner.hide();
|
|
825
907
|
}
|
|
826
|
-
}, [DID, TID, getSpecificChangedKeysWithValues, onSavedAsyncCallback, onClose
|
|
908
|
+
}, [DID, TID, getSpecificChangedKeysWithValues, refreshMetadataAsync, onSavedAsyncCallback, onClose]);
|
|
827
909
|
const handleArchiveCompleted = useCallback(async () => {
|
|
828
910
|
let firstBlock = true;
|
|
829
911
|
let maxFileSize = 0;
|
|
@@ -1065,7 +1147,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1065
1147
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
|
|
1066
1148
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, fromDTD: fromDTD, layoutMode: layoutMode, onFileUpload: (file) => {
|
|
1067
1149
|
setDcmtFile(file);
|
|
1068
|
-
}, enableDragDropOverlay: enableDragDropOverlay }), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile]);
|
|
1150
|
+
}, enableDragDropOverlay: enableDragDropOverlay }, refreshPreviewTrigger), [currentDcmt, dcmtFile, deviceType, fromDTD, layoutMode, inputFile, enableDragDropOverlay, setDcmtFile]);
|
|
1069
1151
|
const tmWF = useMemo(() => {
|
|
1070
1152
|
if (isWFDataLoading) {
|
|
1071
1153
|
return (_jsx("div", { style: {
|
|
@@ -1330,23 +1412,23 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1330
1412
|
height: '100%',
|
|
1331
1413
|
position: 'relative',
|
|
1332
1414
|
overflow: 'hidden'
|
|
1333
|
-
}, children: [_jsxs("div", { style: { width: '100%', height: '100%', display: isOpenDetails || isOpenMaster ? 'none' : 'flex' }, children: [isNavigating && _jsx(Spinner, { description: SDKUI_Localizator.Loading, flat: false }), (fromDTD) &&
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1415
|
+
}, 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)
|
|
1416
|
+
? _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })
|
|
1417
|
+
: _jsxs(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: defaultPanelDimensions, initialDimensions: defaultPanelDimensions, initialMobilePanelId: 'tmDcmtForm', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: [_jsx(WfButtonStateHandler, { isWFDisabled: isWFDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showDcmtFormSidebar })] }), isOpenDistinctValues &&
|
|
1418
|
+
_jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onSelectionChanged: (e) => {
|
|
1419
|
+
if (!e)
|
|
1420
|
+
return;
|
|
1421
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
|
|
1422
|
+
} }), isOpenFormulaEditor &&
|
|
1423
|
+
_jsx(TMFormulaEditor, { isModal: true, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
|
|
1424
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
|
|
1425
|
+
setFocusedMetadataValue(prevState => ({
|
|
1426
|
+
...prevState,
|
|
1427
|
+
isSelected: true,
|
|
1428
|
+
isEditable: true,
|
|
1429
|
+
value: FormulaHelper.addFormulaTag(newFormula.expression)
|
|
1430
|
+
}));
|
|
1431
|
+
} }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { deviceType: deviceType, onCompleted: handleWFOperationCompleted, TID: approvalVID, DID: DID, onClose: () => setShowMoreInfoPopup(false) }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }) }), _jsx(ToppyDraggableHelpCenter, { initialIsCollapsed: false, deviceType: deviceType, isVisible: (showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && !openS4TViewer, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [showToppyForApprove && (workItems.length === 1 ?
|
|
1350
1432
|
_jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true), dtd: fromDTD })
|
|
1351
1433
|
:
|
|
1352
1434
|
_jsxs("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: [`Devi approvare ${workItems.length} workitem(s) per questo documento.`, `Vai alla sezione di approvazione.`] })), showToppyForCompleteMoreInfo && (_jsxs(_Fragment, { children: [_jsx("div", { style: { padding: 10, color: 'white', maxWidth: '180px', borderRadius: 10, background: '#1B1464 0% 0% no-repeat padding-box', border: '1px solid #FFFFFF' }, children: `${SDKUI_Localizator.MoreInfoCompleteRequestSentBy} ${taskMoreInfo?.fromName}!` }), _jsx(TMButton, { caption: SDKUI_Localizator.CommentAndComplete, color: 'success', showTooltip: false, onClick: () => {
|
|
@@ -1400,7 +1482,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1400
1482
|
finally {
|
|
1401
1483
|
TMSpinner.hide();
|
|
1402
1484
|
}
|
|
1403
|
-
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false })),
|
|
1485
|
+
}, onClose: () => setShowManyToManyChooser(false), manageUseLocalizedName: false })), (showHistory && fromDTD && currentDcmt) && _jsx(TMViewHistoryDcmt, { fromDTD: fromDTD, deviceType: deviceType, inputDcmt: { TID: currentDcmt.tid, DID: currentDcmt.did }, onClose: hideHistoryCallback, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showCheckoutInformationForm && fromDTD && currentDcmt) &&
|
|
1486
|
+
_jsx(TMDcmtCheckoutInfoForm, { dtdName: fromDTD.name ?? SDKUI_Localizator.SearchResult, selectedDcmtOrFocused: { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt }, onClose: hideCheckoutInformationFormCallback }), (commentFormState.show && currentDcmt) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: currentDcmt.tid, did: currentDcmt.did } }, onClose: hideCommentFormCallback, refreshCallback: triggerBlogRefresh, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], isCommentRequired: commentFormState.isRequired, removeAndEditAttachment: commentFormState.removeAndEditAttachment }), isOpenArchiveRelationForm && (_jsx(TMDcmtForm, { isModal: true, titleModal: SDKUI_Localizator.Archive + ' - ' + (archiveType === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster), TID: archiveRelatedDcmtFormTID, layoutMode: LayoutModes.Ark, inputMids: archiveRelatedDcmtFormMids, showBackButton: false, allowButtonsRefs: false, onClose: () => {
|
|
1404
1487
|
setIsOpenArchiveRelationForm(false);
|
|
1405
1488
|
setArchiveType(undefined);
|
|
1406
1489
|
setArchiveRelatedDcmtFormTID(undefined);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DcmtInfo } from "../../../ts";
|
|
2
|
+
interface TMDcmtCheckoutInfoFormProps {
|
|
3
|
+
dtdName: string;
|
|
4
|
+
selectedDcmtOrFocused: DcmtInfo;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const TMDcmtCheckoutInfoForm: (props: TMDcmtCheckoutInfoFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default TMDcmtCheckoutInfoForm;
|
|
@@ -12,7 +12,7 @@ import TMTooltip from "../../base/TMTooltip";
|
|
|
12
12
|
import TMTextBox from "../../editors/TMTextBox";
|
|
13
13
|
import ShowAlert from "../../base/TMAlert";
|
|
14
14
|
import { TMExceptionBoxManager } from "../../base/TMPopUp";
|
|
15
|
-
const
|
|
15
|
+
const TMDcmtCheckoutInfoForm = (props) => {
|
|
16
16
|
const { dtdName, selectedDcmtOrFocused, onClose } = props;
|
|
17
17
|
const [initialDcmtCheckoutFolder, setInitialDcmtCheckoutFolder] = useState("");
|
|
18
18
|
const [initialDcmtCheckoutName, setInitialDcmtCheckoutName] = useState("");
|
|
@@ -126,4 +126,4 @@ const TMSearchResultCheckoutInfoForm = (props) => {
|
|
|
126
126
|
e.currentTarget.style.color = TMColors.primary;
|
|
127
127
|
}, children: SDKUI_Localizator.Cancel })] })] }) }) }) }) });
|
|
128
128
|
};
|
|
129
|
-
export default
|
|
129
|
+
export default TMDcmtCheckoutInfoForm;
|