@topconsultnpm/sdkui-react 6.21.0-dev1.8 → 6.21.0-dev2.10
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/NewComponents/ContextMenu/TMContextMenu.js +2 -2
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +43 -19
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +1 -1
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +79 -27
- package/lib/components/base/Styled.d.ts +76 -40
- package/lib/components/base/TMAccordionNew.d.ts +1 -0
- package/lib/components/base/TMAccordionNew.js +5 -5
- package/lib/components/base/TMAreaManager.js +47 -14
- package/lib/components/base/TMFileManagerDataGridView.js +2 -2
- package/lib/components/base/TMFileManagerUtils.d.ts +6 -2
- package/lib/components/base/TMPanel.js +1 -0
- package/lib/components/base/TMTreeView.d.ts +5 -3
- package/lib/components/choosers/TMDataListItemChooser.js +56 -2
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
- package/lib/components/choosers/TMDynDataListItemChooser.js +51 -23
- package/lib/components/editors/TMDateBox.js +4 -2
- package/lib/components/editors/TMDropDown.js +2 -2
- package/lib/components/editors/TMEditorStyled.d.ts +42 -10
- package/lib/components/editors/TMFormulaEditor.js +15 -3
- package/lib/components/editors/TMMetadataEditor.js +4 -3
- package/lib/components/editors/TMMetadataValues.js +1 -1
- package/lib/components/editors/TMTextArea.d.ts +2 -0
- package/lib/components/editors/TMTextArea.js +6 -3
- package/lib/components/features/archive/TMArchive.js +1 -1
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtBlog.js +2 -2
- package/lib/components/features/documents/TMDcmtForm.js +49 -21
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +259 -60
- package/lib/components/features/documents/TMDcmtPreview.d.ts +5 -3
- package/lib/components/features/documents/TMDragDropOverlay.js +7 -2
- package/lib/components/features/documents/TMFileUploader.js +5 -4
- package/lib/components/features/documents/TMMasterDetailDcmts.js +30 -56
- package/lib/components/features/documents/TMRelationViewer.js +1 -0
- package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
- package/lib/components/features/search/TMSearch.js +2 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +13 -1
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +3 -3
- package/lib/components/features/search/TMSearchResult.js +15 -2
- package/lib/components/features/search/TMViewHistoryDcmt.js +7 -2
- package/lib/components/features/workflow/TMWorkflowPopup.js +3 -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/WorkitemRecipientsEditor.d.ts +1 -1
- package/lib/components/features/workflow/diagram/xmlParser.js +13 -14
- package/lib/components/forms/Login/ChangePasswordInputs.d.ts +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +15 -5
- package/lib/components/forms/TMChooserForm.js +25 -2
- package/lib/components/grids/TMBlogAttachments.d.ts +1 -0
- package/lib/components/grids/TMBlogAttachments.js +38 -12
- package/lib/components/grids/TMBlogsPost.js +8 -2
- package/lib/components/grids/TMBlogsPostUtils.js +11 -17
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -2
- 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.d.ts +10 -6
- package/lib/components/query/TMQueryEditor.js +42 -5
- package/lib/components/query/TMQuerySummary.js +3 -2
- package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -2
- package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
- package/lib/components/viewers/TMDataListItemViewer.js +2 -2
- package/lib/components/viewers/TMTidViewer.js +1 -1
- package/lib/helper/GlobalStyles.js +6 -0
- package/lib/helper/SDKUI_Globals.d.ts +2 -0
- package/lib/helper/SDKUI_Localizator.d.ts +1 -0
- package/lib/helper/SDKUI_Localizator.js +10 -0
- package/lib/helper/TMPdfViewer.js +143 -86
- package/lib/helper/TMUtils.d.ts +4 -9
- package/lib/helper/TMUtils.js +12 -74
- package/lib/helper/checkinCheckoutManager.d.ts +6 -1
- package/lib/helper/checkinCheckoutManager.js +203 -9
- package/lib/helper/helpers.js +8 -6
- package/lib/hooks/useCheckInOutOperations.d.ts +1 -1
- package/lib/hooks/useCheckInOutOperations.js +9 -4
- package/lib/hooks/useDcmtOperations.d.ts +1 -0
- package/lib/hooks/useDcmtOperations.js +75 -5
- package/lib/hooks/useDocumentOperations.js +17 -4
- package/lib/hooks/useForm.js +20 -14
- package/lib/hooks/useInputDialog.d.ts +2 -0
- package/lib/hooks/useInputDialog.js +37 -0
- package/lib/hooks/useQueryParametersDialog.js +5 -5
- package/lib/services/platform_services.d.ts +1 -1
- package/lib/services/platform_services.js +8 -0
- package/lib/ts/types.d.ts +1 -0
- package/package.json +11 -12
|
@@ -79,11 +79,12 @@ const TMMetadataEditor = ({ isSelected = false, customLabel, isReadOnly, isLexPr
|
|
|
79
79
|
if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}" || queryOperator == QueryOperators.Custom || isEditable)
|
|
80
80
|
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', maxLength: isEditable ? undefined : maxLength, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
81
81
|
if (md?.dataDomain == MetadataDataDomains.DynamicDataList)
|
|
82
|
-
return _jsx(TMDynDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, layoutMode: layoutMode, isModifiedWhen: isModifiedWhenInternal(), label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, md: md, tid: tid, openChooserBySingleClick: openChooserBySingleClick, queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: multipleSelectionIsenabled, values: value ?
|
|
83
|
-
|
|
82
|
+
return _jsx(TMDynDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, layoutMode: layoutMode, isModifiedWhen: isModifiedWhenInternal(), label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, md: md, tid: tid, openChooserBySingleClick: openChooserBySingleClick, queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: multipleSelectionIsenabled, values: value ? value.split(',').filter(v => v.trim() !== '') : [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
|
|
83
|
+
const filteredIDs = IDs?.filter(id => id.trim() !== '');
|
|
84
|
+
if (!filteredIDs || filteredIDs.length <= 0)
|
|
84
85
|
onValueChanged?.(undefined);
|
|
85
86
|
else
|
|
86
|
-
onValueChanged?.(
|
|
87
|
+
onValueChanged?.(filteredIDs.join(","));
|
|
87
88
|
}, updateIsModalOpen: updateIsModalOpen });
|
|
88
89
|
if (md?.dataDomain == MetadataDataDomains.DataList)
|
|
89
90
|
return _jsx(TMDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', titleForm: md.nameLoc, readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, dataListId: md.dataListID, openChooserBySingleClick: openChooserBySingleClick, allowMultipleSelection: multipleSelectionIsenabled, values: value?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
|
|
@@ -769,5 +769,5 @@ const TMLayoutTabPanel = React.memo(({ tabItems }) => {
|
|
|
769
769
|
fontSize: '0.85em',
|
|
770
770
|
color: '#7f1d1d',
|
|
771
771
|
lineHeight: 1.4
|
|
772
|
-
}, children: error.message })] }, idx))) })] }), children: _jsx(StyledErrorBadge, { children: tabItem.errorCount > 99 ? '99+' : tabItem.errorCount }) }))] })), children: _jsx("div", { style: { width: '100%' }, children: tabItem.content }) }, `tab-${tabItem.layoutItemID}`))) }));
|
|
772
|
+
}, children: error.message })] }, idx))) })] }), children: _jsx(StyledErrorBadge, { children: tabItem.errorCount > 99 ? '99+' : tabItem.errorCount }) }))] })), children: _jsx("div", { style: { width: '100%', overflowX: 'auto' }, children: _jsx("div", { style: { minWidth: 'max-content' }, children: tabItem.content }) }) }, `tab-${tabItem.layoutItemID}`))) }));
|
|
773
773
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { useState, useEffect, useRef, useId } from 'react';
|
|
3
3
|
import { StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, StyledTextareaEditor } from './TMEditorStyled';
|
|
4
4
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
5
5
|
import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
|
|
@@ -28,7 +28,10 @@ const StyledTextAreaEditorButton = styled.div `
|
|
|
28
28
|
// Define the TMTextArea component
|
|
29
29
|
const TMTextArea = (props) => {
|
|
30
30
|
// Extract properties from the props object
|
|
31
|
-
const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true, autoCalculateRows = true, fillHeight = false } = props;
|
|
31
|
+
const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true, autoCalculateRows = true, fillHeight = false, name, id } = props;
|
|
32
|
+
// Generate a unique id if not provided
|
|
33
|
+
const autoId = useId();
|
|
34
|
+
const effectiveId = id ?? autoId;
|
|
32
35
|
// Reference to the textarea DOM element
|
|
33
36
|
const inputRef = useRef(null);
|
|
34
37
|
// Stores the textarea is focused
|
|
@@ -148,7 +151,7 @@ const TMTextArea = (props) => {
|
|
|
148
151
|
};
|
|
149
152
|
// Renders the textarea
|
|
150
153
|
const renderTextArea = () => {
|
|
151
|
-
const textareaElement = _jsxs(_Fragment, { children: [_jsx(StyledTextareaEditor, { ref: inputRef, autoFocus: autoFocus, readOnly: readOnly, disabled: disabled, value: currentValue, placeholder: placeHolder, rows: fillHeight ? undefined : calculatedRows, maxLength: maxLength, spellCheck: false, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
154
|
+
const textareaElement = _jsxs(_Fragment, { children: [_jsx(StyledTextareaEditor, { ref: inputRef, id: effectiveId, ...(name && { name }), autoFocus: autoFocus, readOnly: readOnly, disabled: disabled, value: currentValue, placeholder: placeHolder, rows: fillHeight ? undefined : calculatedRows, maxLength: maxLength, spellCheck: false, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
152
155
|
onBlur?.(currentValue); }, onChange: (e) => { setCurrentValue(e.target.value); onValueChanged?.(e); }, "$isMobile": deviceType === DeviceType.MOBILE, "$maxHeight": maxHeight, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$width": width, "$resize": resize, style: fillHeight ? { flex: 1, height: 0 } : undefined }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: calculatedRows === 1 ? (label.length > 0 ? '20px' : '7px') : (label.length > 0 ? '22px' : '7px'), pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
|
|
153
156
|
_jsx(StyledTextAreaEditorButton, { onClick: () => {
|
|
154
157
|
setShowFormulaItemsChooser(true);
|
|
@@ -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 = {
|
|
@@ -6,6 +6,7 @@ interface ITMDcmtBlogProps {
|
|
|
6
6
|
isVisible?: boolean;
|
|
7
7
|
fetchBlogDataTrigger?: number;
|
|
8
8
|
onRefreshBlogDatagrid?: () => Promise<void>;
|
|
9
|
+
showFloatingCommentButton?: boolean;
|
|
9
10
|
allTasks?: Array<TaskDescriptor>;
|
|
10
11
|
getAllTasks?: () => Promise<void>;
|
|
11
12
|
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
@@ -8,7 +8,7 @@ import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
|
8
8
|
import TMBlogsPost from '../../grids/TMBlogsPost';
|
|
9
9
|
import TMSpinner from '../../base/TMSpinner';
|
|
10
10
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
11
|
-
const TMDcmtBlog = ({ tid, did, isVisible, fetchBlogDataTrigger, onRefreshBlogDatagrid, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
11
|
+
const TMDcmtBlog = ({ tid, did, isVisible, fetchBlogDataTrigger, onRefreshBlogDatagrid, showFloatingCommentButton = true, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
12
12
|
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
|
13
13
|
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
|
|
14
14
|
const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
|
|
@@ -74,7 +74,7 @@ const TMDcmtBlog = ({ tid, did, isVisible, fetchBlogDataTrigger, onRefreshBlogDa
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
return (_jsxs("div", { style: { width: '100%', height: '100%' }, children: [_jsx(StyledContainer, { children: _jsx(StyledSectionContainer, { style: { position: 'relative' }, children: _jsx(StyledBoardContainer, { children: !did ? _jsx(TMNothingToShow, { text: `${SDKUI_Localizator.NoDcmtSelected}.`, secondText: `${SDKUI_Localizator.BlogCase} - ${SDKUI_Localizator.NotAvailable}`, icon: _jsx(IconBoard, { fontSize: 96 }) }) :
|
|
77
|
-
_jsx(TMBlogsPost, { context: { engine: 'SearchEngine', object: { tid, did } }, id: "dcmt-blog", displayMode: 'chat', scrollToSelected: true, posts: blogsDatasource, showExtendedAttachments: false, showFloatingCommentButton:
|
|
77
|
+
_jsx(TMBlogsPost, { context: { engine: 'SearchEngine', object: { tid, did } }, id: "dcmt-blog", displayMode: 'chat', scrollToSelected: true, posts: blogsDatasource, showExtendedAttachments: false, showFloatingCommentButton: showFloatingCommentButton, showCommentFormCallback: showCommentFormCallback, refreshCallback: refreshCallback, contextMenuParams: {
|
|
78
78
|
isShowHideFilterEnabled: true,
|
|
79
79
|
isShowHideIDEnaled: true,
|
|
80
80
|
isCommentEnabled: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
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
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import { AccessLevelsEx, AppModules, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { AccessLevelsEx, AppModules, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, DossierCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkingGroupCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import { FormModes, SearchResultContext } from '../../../ts';
|
|
6
6
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
7
7
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
@@ -114,6 +114,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
114
114
|
const [refreshPreviewTrigger, setRefreshPreviewTrigger] = useState(0);
|
|
115
115
|
const [wfError, setWfError] = useState(null);
|
|
116
116
|
const [metadataDcmtOrigin, setMetadataDcmtOrigin] = useState(null);
|
|
117
|
+
const { workflowApproveData, getWorkItemsByDID } = useWorkflowApprove();
|
|
117
118
|
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
118
119
|
const deviceType = useDeviceType();
|
|
119
120
|
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
@@ -235,7 +236,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
235
236
|
const handleReset = useCallback(() => {
|
|
236
237
|
setDcmtFile(null);
|
|
237
238
|
}, []);
|
|
238
|
-
const
|
|
239
|
+
const loadDocumentFormDataAsync = useCallback(async () => {
|
|
239
240
|
try {
|
|
240
241
|
setFetchError(false);
|
|
241
242
|
if (!TID)
|
|
@@ -254,12 +255,34 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
254
255
|
layoutMode === LayoutModes.Update
|
|
255
256
|
? LayoutCacheService.GetAsync(TID, LayoutModes.None)
|
|
256
257
|
: Promise.resolve(undefined),
|
|
257
|
-
// 4.
|
|
258
|
-
(() => {
|
|
259
|
-
|
|
260
|
-
const
|
|
258
|
+
// 4. FindAllReferencesAsync - Cerca riferimenti a WorkingGroup, Dossier e Workflow se presenti nel sistema e se allowButtonsRefs è abilitato
|
|
259
|
+
(async () => {
|
|
260
|
+
// Array per raccogliere le classi di riferimento da cercare
|
|
261
|
+
const refs = [];
|
|
262
|
+
// Recupera working groups, dossier e dati di approvazione workflow in parallelo
|
|
263
|
+
const [workingGroups, dossiers] = await Promise.all([
|
|
264
|
+
WorkingGroupCacheService.GetAllAsync(),
|
|
265
|
+
DossierCacheService.GetAllAsync(),
|
|
266
|
+
]);
|
|
267
|
+
// Aggiunge WorkingGroup se esistono WG diversi da quello di sistema (id=1)
|
|
268
|
+
if (workingGroups.filter(wg => wg.id !== 1).length > 0) {
|
|
269
|
+
refs.push(ObjectClasses.WorkingGroup);
|
|
270
|
+
}
|
|
271
|
+
// Aggiunge Dossier se ne esistono
|
|
272
|
+
if (dossiers.length > 0) {
|
|
273
|
+
refs.push(ObjectClasses.Dossier);
|
|
274
|
+
}
|
|
275
|
+
// Aggiunge Workflow se ci sono dati di approvazione presenti
|
|
276
|
+
if (workflowApproveData.length > 0) {
|
|
277
|
+
refs.push(ObjectClasses.Workflow);
|
|
278
|
+
}
|
|
279
|
+
// Recupera le preferenze utente per autoFindReferences e le merge con i refs già raccolti
|
|
280
|
+
const userRefs = SDKUI_Globals?.userSettings?.searchSettings?.autoFindReferences ?? [];
|
|
281
|
+
const mergedRefs = [...new Set([...refs, ...userRefs])];
|
|
282
|
+
// Verifica se ci sono riferimenti da cercare e se i bottoni sono abilitati
|
|
283
|
+
const hasRefs = allowButtonsRefs && Array.isArray(mergedRefs) && mergedRefs.length > 0;
|
|
261
284
|
return hasRefs
|
|
262
|
-
? SDK_Globals.tmSession?.NewSearchEngine().FindAllReferencesAsync(TID, DID,
|
|
285
|
+
? SDK_Globals.tmSession?.NewSearchEngine().FindAllReferencesAsync(TID, DID, mergedRefs) ?? Promise.resolve(undefined)
|
|
263
286
|
: Promise.resolve(undefined);
|
|
264
287
|
})()
|
|
265
288
|
];
|
|
@@ -342,8 +365,8 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
342
365
|
context: SearchResultContext.DCMT_FORM,
|
|
343
366
|
documentData: {
|
|
344
367
|
dtd: fromDTD,
|
|
345
|
-
selectedItems: currentDcmt ? [{ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, rowIndex: 0 }] : [],
|
|
346
|
-
focusedItem: currentDcmt ? { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, rowIndex: 0 } : undefined,
|
|
368
|
+
selectedItems: currentDcmt ? [{ TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, ISSIGNED: currentDcmt.isSigned ?? 0, rowIndex: 0 }] : [],
|
|
369
|
+
focusedItem: currentDcmt ? { TID: currentDcmt.tid, DID: currentDcmt.did, FILEEXT: currentDcmt.fileExt, ISSIGNED: currentDcmt.isSigned ?? 0, rowIndex: 0 } : undefined,
|
|
347
370
|
searchResult: currentSearchResults ? currentSearchResults[0] : undefined,
|
|
348
371
|
currentSearchResults,
|
|
349
372
|
currentMetadataValues: formData,
|
|
@@ -385,7 +408,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
385
408
|
},
|
|
386
409
|
callbacks: {
|
|
387
410
|
// Refresh operations (data consistency)
|
|
388
|
-
onRefreshSearchAsync,
|
|
411
|
+
onRefreshSearchAsync: loadDocumentFormDataAsync,
|
|
389
412
|
onSavedAsyncCallback,
|
|
390
413
|
// Workflow operations
|
|
391
414
|
onWFOperationCompleted,
|
|
@@ -413,7 +436,6 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
413
436
|
if (!allowButtonsRefs)
|
|
414
437
|
setDcmtReferences(undefined);
|
|
415
438
|
}, [allowButtonsRefs]);
|
|
416
|
-
const { workflowApproveData, getWorkItemsByDID } = useWorkflowApprove();
|
|
417
439
|
const fetchErrorShownRef = useRef(false);
|
|
418
440
|
useEffect(() => {
|
|
419
441
|
if (!TID)
|
|
@@ -467,12 +489,12 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
467
489
|
// Distinguish between initial load and navigation
|
|
468
490
|
if (isInitialLoading) {
|
|
469
491
|
// First load - keep isInitialLoading true
|
|
470
|
-
await
|
|
492
|
+
await loadDocumentFormDataAsync();
|
|
471
493
|
}
|
|
472
494
|
else {
|
|
473
495
|
// Navigation - use isNavigating instead
|
|
474
496
|
setIsNavigating(true);
|
|
475
|
-
await
|
|
497
|
+
await loadDocumentFormDataAsync();
|
|
476
498
|
}
|
|
477
499
|
}
|
|
478
500
|
catch (e) {
|
|
@@ -486,7 +508,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
486
508
|
}
|
|
487
509
|
};
|
|
488
510
|
run();
|
|
489
|
-
}, [TID, DID,
|
|
511
|
+
}, [TID, DID, loadDocumentFormDataAsync]);
|
|
490
512
|
useEffect(() => {
|
|
491
513
|
if (formData.length > 0) {
|
|
492
514
|
setValidationItems(validateMetadataList(formData));
|
|
@@ -495,14 +517,16 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
495
517
|
did: formData.find(o => o.mid == SystemMIDsAsNumber.DID)?.value,
|
|
496
518
|
fileCount: formData.find(o => o.mid == SystemMIDsAsNumber.FileCount)?.value,
|
|
497
519
|
fileSize: formData.find(o => o.mid == SystemMIDsAsNumber.FileSize)?.value,
|
|
498
|
-
fileExt: formData.find(o => o.mid == SystemMIDsAsNumber.FileExt)?.value
|
|
520
|
+
fileExt: formData.find(o => o.mid == SystemMIDsAsNumber.FileExt)?.value,
|
|
521
|
+
isSigned: formData.find(o => o.mid == SystemMIDsAsNumber.IsSigned)?.value?.toString() === '1' ? 1 : 0,
|
|
499
522
|
};
|
|
500
523
|
if (!currentDcmt ||
|
|
501
524
|
currentDcmt.tid !== newDcmt.tid ||
|
|
502
525
|
currentDcmt.did !== newDcmt.did ||
|
|
503
526
|
currentDcmt.fileExt !== newDcmt.fileExt ||
|
|
504
527
|
currentDcmt.fileSize !== newDcmt.fileSize ||
|
|
505
|
-
currentDcmt.fileCount !== newDcmt.fileCount
|
|
528
|
+
currentDcmt.fileCount !== newDcmt.fileCount ||
|
|
529
|
+
currentDcmt.isSigned !== newDcmt.isSigned) {
|
|
506
530
|
setCurrentDcmt(newDcmt);
|
|
507
531
|
}
|
|
508
532
|
}
|
|
@@ -1238,7 +1262,7 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1238
1262
|
},
|
|
1239
1263
|
{
|
|
1240
1264
|
id: 'tmDcmtPreview',
|
|
1241
|
-
name: SDKUI_Localizator.PreviewDocument,
|
|
1265
|
+
name: layoutMode === LayoutModes.Update ? SDKUI_Localizator.PreviewDocument : SDKUI_Localizator.UploadFile,
|
|
1242
1266
|
contentOptions: { component: tmDcmtPreview },
|
|
1243
1267
|
toolbarOptions: {
|
|
1244
1268
|
icon: _jsx(IconShow, { fontSize: 24 }),
|
|
@@ -1421,8 +1445,8 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1421
1445
|
position: 'relative',
|
|
1422
1446
|
overflow: 'hidden'
|
|
1423
1447
|
}, 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 &&
|
|
1448
|
+
? _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 })] })
|
|
1449
|
+
: _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
1450
|
_jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onClosePanelCallback: () => setIsOpenDistinctValues(false), onSelectionChanged: (e) => {
|
|
1427
1451
|
if (!e)
|
|
1428
1452
|
return;
|
|
@@ -1512,7 +1536,7 @@ const validateMaxLength = (mvd, value, validationItems) => {
|
|
|
1512
1536
|
};
|
|
1513
1537
|
//#endregion Validation
|
|
1514
1538
|
// Synchronizes panel visibility and toolbar button disabled states when panels become disabled
|
|
1515
|
-
const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled }) => {
|
|
1539
|
+
const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoardDisabled, isDcmtTasksDisabled, isPreviewDisabled }) => {
|
|
1516
1540
|
const { setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility } = useTMPanelManagerContext();
|
|
1517
1541
|
useEffect(() => {
|
|
1518
1542
|
// Aggiorna lo stato disabled del bottone toolbar
|
|
@@ -1520,6 +1544,7 @@ const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoar
|
|
|
1520
1544
|
setToolbarButtonDisabled('tmBlog', isBoardDisabled);
|
|
1521
1545
|
setToolbarButtonDisabled('tmWF', isWFDisabled);
|
|
1522
1546
|
setToolbarButtonDisabled('tmDcmtTasks', isDcmtTasksDisabled);
|
|
1547
|
+
setToolbarButtonDisabled('tmDcmtPreview', isPreviewDisabled);
|
|
1523
1548
|
// Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
|
|
1524
1549
|
if (isSysMetadataDisabled && panelVisibility['tmSysMetadata']) {
|
|
1525
1550
|
setPanelVisibilityById('tmSysMetadata', false);
|
|
@@ -1533,7 +1558,10 @@ const PanelDisabledStateHandler = ({ isWFDisabled, isSysMetadataDisabled, isBoar
|
|
|
1533
1558
|
if (isDcmtTasksDisabled && panelVisibility['tmDcmtTasks']) {
|
|
1534
1559
|
setPanelVisibilityById('tmDcmtTasks', false);
|
|
1535
1560
|
}
|
|
1536
|
-
|
|
1561
|
+
if (isPreviewDisabled && panelVisibility['tmDcmtPreview']) {
|
|
1562
|
+
setPanelVisibilityById('tmDcmtPreview', false);
|
|
1563
|
+
}
|
|
1564
|
+
}, [isSysMetadataDisabled, isBoardDisabled, isWFDisabled, isDcmtTasksDisabled, isPreviewDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
|
|
1537
1565
|
return null;
|
|
1538
1566
|
};
|
|
1539
1567
|
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, fromDTD, currentDcmt, layoutMode, dcmtFile, deviceType, isVisible, onFileUpload, openFileUploaderPdfEditor, enableDragDropOverlay = false, onScanRequest }) => {
|