@topconsultnpm/sdkui-react 6.19.0-dev1.54 → 6.19.0-dev1.56
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.d.ts +11 -0
- package/lib/components/base/TMCustomButton.js +63 -0
- package/lib/components/base/TMLayout.d.ts +2 -1
- package/lib/components/base/TMLayout.js +2 -2
- package/lib/components/features/archive/TMArchive.d.ts +8 -0
- package/lib/components/features/archive/TMArchive.js +3 -3
- package/lib/components/features/documents/TMDcmtBlog.d.ts +8 -0
- package/lib/components/features/documents/TMDcmtBlog.js +3 -3
- package/lib/components/features/documents/TMDcmtForm.d.ts +8 -1
- package/lib/components/features/documents/TMDcmtForm.js +52 -21
- package/lib/components/features/documents/TMDcmtTasks.d.ts +12 -0
- package/lib/components/features/documents/TMDcmtTasks.js +24 -0
- package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +8 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.js +5 -5
- package/lib/components/features/search/TMSearch.d.ts +8 -1
- package/lib/components/features/search/TMSearch.js +3 -3
- package/lib/components/features/search/TMSearchResult.d.ts +8 -1
- package/lib/components/features/search/TMSearchResult.js +14 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +1 -1
- package/lib/components/features/tasks/TMTaskForm.d.ts +37 -0
- package/lib/components/features/tasks/TMTaskForm.js +291 -0
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +17 -0
- package/lib/components/features/tasks/TMTasksAgenda.js +107 -0
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +21 -0
- package/lib/components/features/tasks/TMTasksCalendar.js +240 -0
- package/lib/components/features/tasks/TMTasksHeader.d.ts +14 -0
- package/lib/components/features/tasks/TMTasksHeader.js +37 -0
- package/lib/components/features/tasks/TMTasksPanelContent.d.ts +19 -0
- package/lib/components/features/tasks/TMTasksPanelContent.js +64 -0
- package/lib/components/features/tasks/TMTasksUtils.d.ts +131 -0
- package/lib/components/features/tasks/TMTasksUtils.js +634 -0
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +32 -0
- package/lib/components/features/tasks/TMTasksUtilsView.js +107 -0
- package/lib/components/features/tasks/TMTasksView.d.ts +39 -0
- package/lib/components/features/tasks/TMTasksView.js +554 -0
- package/lib/components/features/workflow/TMWorkflowPopup.js +2 -2
- package/lib/components/grids/TMBlogAttachments.js +2 -2
- package/lib/components/grids/TMBlogsPost.d.ts +8 -5
- package/lib/components/grids/TMBlogsPost.js +28 -28
- package/lib/components/grids/TMBlogsPostUtils.js +1 -1
- package/lib/components/index.d.ts +8 -0
- package/lib/components/index.js +9 -0
- package/lib/helper/SDKUI_Localizator.d.ts +55 -4
- package/lib/helper/SDKUI_Localizator.js +536 -25
- package/lib/helper/TMCustomSearchBar.d.ts +8 -0
- package/lib/helper/TMCustomSearchBar.js +54 -0
- package/lib/helper/TMImageLibrary.d.ts +3 -2
- package/lib/helper/TMImageLibrary.js +230 -230
- package/lib/helper/TMToppyMessage.js +1 -1
- package/lib/helper/TMUtils.d.ts +10 -1
- package/lib/helper/TMUtils.js +42 -1
- package/lib/helper/dcmtsHelper.d.ts +2 -0
- package/lib/helper/dcmtsHelper.js +18 -0
- package/lib/stories/TMSDKUI_Localizator.stories.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LayoutCustomButtonDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { MetadataValueDescriptorEx } from '../..';
|
|
3
|
+
type TMCustomButtonProps = {
|
|
4
|
+
button: LayoutCustomButtonDescriptor;
|
|
5
|
+
isModal?: boolean;
|
|
6
|
+
formData?: MetadataValueDescriptorEx[];
|
|
7
|
+
selectedItems?: Array<any>;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare const TMCustomButton: (props: TMCustomButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export default TMCustomButton;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import TMModal from './TMModal';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { processButtonAttributes } from '../../helper/dcmtsHelper';
|
|
7
|
+
const IframeContainer = styled.div `
|
|
8
|
+
display: flex;
|
|
9
|
+
height: 100%;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
`;
|
|
12
|
+
const StyledIframe = styled.iframe `
|
|
13
|
+
border: none;
|
|
14
|
+
flex: 1;
|
|
15
|
+
`;
|
|
16
|
+
const TMCustomButton = (props) => {
|
|
17
|
+
const { button, isModal = true, formData, selectedItems, onClose } = props;
|
|
18
|
+
const { appName: scriptUrl, arguments: args } = button;
|
|
19
|
+
const iframeRef = useRef(null);
|
|
20
|
+
const attributes = processButtonAttributes(args, formData);
|
|
21
|
+
const [loading, setLoading] = useState(true);
|
|
22
|
+
const [error, setError] = useState(false);
|
|
23
|
+
const getTargetOrigin = (url) => {
|
|
24
|
+
if (!url)
|
|
25
|
+
return '*';
|
|
26
|
+
try {
|
|
27
|
+
const urlObj = new URL(url);
|
|
28
|
+
return urlObj.origin;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return '*';
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (iframeRef.current?.contentWindow) {
|
|
36
|
+
const mergedAttributes = { ...attributes, selectedItems: selectedItems };
|
|
37
|
+
iframeRef.current.contentWindow.postMessage({
|
|
38
|
+
"options": mergedAttributes,
|
|
39
|
+
"selectedItems": selectedItems,
|
|
40
|
+
"session": SDK_Globals.tmSession
|
|
41
|
+
}, getTargetOrigin(scriptUrl));
|
|
42
|
+
}
|
|
43
|
+
clearTimeout(timeoutIframe);
|
|
44
|
+
}, [loading, error, scriptUrl, attributes]);
|
|
45
|
+
const handleLoad = () => setLoading(false);
|
|
46
|
+
const handleError = () => {
|
|
47
|
+
setLoading(false);
|
|
48
|
+
setError(true);
|
|
49
|
+
};
|
|
50
|
+
// Timeout di sicurezza nel caso l'evento 'error' non venga chiamato
|
|
51
|
+
const timeoutIframe = setTimeout(() => {
|
|
52
|
+
if (loading)
|
|
53
|
+
handleError();
|
|
54
|
+
}, 5000); // 5 secondi
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!isModal && scriptUrl) {
|
|
57
|
+
window.open(scriptUrl, '_blank');
|
|
58
|
+
onClose?.();
|
|
59
|
+
}
|
|
60
|
+
}, [isModal, scriptUrl, onClose]);
|
|
61
|
+
return isModal ? (_jsx(TMModal, { title: button.title, width: '60%', height: '60%', resizable: true, onClose: onClose, children: _jsxs(IframeContainer, { children: [error && _jsx("div", { children: "Si \u00E8 verificato un errore nel caricamento del contenuto." }), !error && _jsx(StyledIframe, { ref: iframeRef, loading: 'lazy', onLoad: handleLoad, onError: handleError, src: scriptUrl })] }) })) : null;
|
|
62
|
+
};
|
|
63
|
+
export default TMCustomButton;
|
|
@@ -48,7 +48,8 @@ export interface ITMLayoutContainerProps {
|
|
|
48
48
|
alignItems?: string;
|
|
49
49
|
direction?: 'vertical' | 'horizontal';
|
|
50
50
|
onClick?: () => void;
|
|
51
|
+
onContextMenu?: (e: React.MouseEvent) => void;
|
|
51
52
|
}
|
|
52
|
-
declare const TMLayoutContainer: ({ gap, onClick, justifyContent, alignItems, children, direction }: ITMLayoutContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
declare const TMLayoutContainer: ({ gap, onClick, justifyContent, alignItems, children, direction, onContextMenu }: ITMLayoutContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
54
|
export { TMCard, TMLayoutItem, TMSplitterLayout };
|
|
54
55
|
export default TMLayoutContainer;
|
|
@@ -193,9 +193,9 @@ const TMSplitterLayout = ({ animation = false, showSeparator = true, separatorCo
|
|
|
193
193
|
const TMLayoutItem = ({ onClick, children, width = '100%', minWidth, maxWidth, maxHeight, height = '100%', minHeight }) => {
|
|
194
194
|
return (_jsx(StyledLayoutItem, { onClick: onClick, "$height": height, "$maxHeight": maxHeight, "$minHeight": minHeight, "$width": width, "$minWidth": minWidth, "$maxWidth": maxWidth, children: children }));
|
|
195
195
|
};
|
|
196
|
-
const TMLayoutContainer = ({ gap = 3, onClick, justifyContent = 'flex-start', alignItems = 'flex-start', children, direction = 'vertical' }) => {
|
|
196
|
+
const TMLayoutContainer = ({ gap = 3, onClick, justifyContent = 'flex-start', alignItems = 'flex-start', children, direction = 'vertical', onContextMenu }) => {
|
|
197
197
|
const renderedEls = () => { return (React.Children.map(children, child => (child))); };
|
|
198
|
-
return (_jsxs(StyledLayoutContainer, { "$alignItems": alignItems, "$justifyContent": justifyContent, onClick: onClick, "$direction": direction, style: { gap: gap }, children: [" ", renderedEls(), " "] }));
|
|
198
|
+
return (_jsxs(StyledLayoutContainer, { "$alignItems": alignItems, "$justifyContent": justifyContent, onClick: onClick, onContextMenu: onContextMenu, "$direction": direction, style: { gap: gap }, children: [" ", renderedEls(), " "] }));
|
|
199
199
|
};
|
|
200
200
|
export { TMCard, TMLayoutItem, TMSplitterLayout };
|
|
201
201
|
export default TMLayoutContainer;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
3
|
interface ITMArchiveProps {
|
|
3
4
|
inputFile?: File | null;
|
|
4
5
|
inputMids?: Array<{
|
|
@@ -16,6 +17,13 @@ interface ITMArchiveProps {
|
|
|
16
17
|
value: string;
|
|
17
18
|
}>) => void;
|
|
18
19
|
isSharedArchive?: boolean;
|
|
20
|
+
allTasks: Array<TaskDescriptor>;
|
|
21
|
+
getAllTasks?: () => Promise<void>;
|
|
22
|
+
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
23
|
+
addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
24
|
+
editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
25
|
+
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
26
|
+
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
19
27
|
}
|
|
20
28
|
declare const TMArchive: React.FunctionComponent<ITMArchiveProps>;
|
|
21
29
|
export default TMArchive;
|
|
@@ -12,7 +12,7 @@ import TMTreeSelector from '../search/TMTreeSelector';
|
|
|
12
12
|
import TMPanel from '../../base/TMPanel';
|
|
13
13
|
import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
|
|
14
14
|
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
|
15
|
-
const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, connectorFileSave = undefined, onSavedAsyncCallback, inputMids = [], enableDragDropOverlay = false, passToSearch, isSharedArchive = false, inputDID = undefined }) => {
|
|
15
|
+
const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, connectorFileSave = undefined, onSavedAsyncCallback, inputMids = [], enableDragDropOverlay = false, passToSearch, isSharedArchive = false, inputDID = undefined, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
16
16
|
const [currentTID, setCurrentTID] = useState(inputTID ?? 0);
|
|
17
17
|
const [mruTIDs, setMruTIDs] = useState([]);
|
|
18
18
|
const [currentMruTID, setCurrentMruTID] = useState(0);
|
|
@@ -77,9 +77,9 @@ 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 }, currentTID)
|
|
80
|
+
} : undefined, isSharedDcmt: isSharedArchive, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }, currentTID)
|
|
81
81
|
:
|
|
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]);
|
|
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 = {
|
|
84
84
|
'tmTreeSelector': true,
|
|
85
85
|
'tmRecentsManager': true,
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
3
|
interface ITMDcmtBlogProps {
|
|
3
4
|
tid: number | undefined;
|
|
4
5
|
did: number | undefined;
|
|
5
6
|
isVisible?: boolean;
|
|
7
|
+
allTasks?: Array<TaskDescriptor>;
|
|
8
|
+
getAllTasks?: () => Promise<void>;
|
|
9
|
+
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
10
|
+
addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
11
|
+
editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
12
|
+
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
13
|
+
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
6
14
|
}
|
|
7
15
|
declare const TMDcmtBlog: React.FC<ITMDcmtBlogProps>;
|
|
8
16
|
export default TMDcmtBlog;
|
|
@@ -8,7 +8,7 @@ import { TMNothingToShow } from './TMDcmtPreview';
|
|
|
8
8
|
import { IconBoard, SDKUI_Localizator } from '../../../helper';
|
|
9
9
|
import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
10
10
|
import TMBlogsPost from '../../grids/TMBlogsPost';
|
|
11
|
-
const TMDcmtBlog = ({ tid, did, isVisible }) => {
|
|
11
|
+
const TMDcmtBlog = ({ tid, did, isVisible, 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
|
|
@@ -78,9 +78,9 @@ const TMDcmtBlog = ({ tid, did, isVisible }) => {
|
|
|
78
78
|
isRefreshEnabled: true,
|
|
79
79
|
isRestoreEnabled: true,
|
|
80
80
|
isCreateContextualTask: false
|
|
81
|
-
}, externalBlogPost: externalBlogPost, resetExternalBlogPost: resetExternalBlogPost }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: refreshCallback, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], onFilterCreated: handleFilterCreated })] }));
|
|
81
|
+
}, externalBlogPost: externalBlogPost, resetExternalBlogPost: resetExternalBlogPost, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: refreshCallback, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], onFilterCreated: handleFilterCreated })] }));
|
|
82
82
|
};
|
|
83
83
|
export default TMDcmtBlog;
|
|
84
84
|
const StyledContainer = styled.div ` user-select: none; overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
|
|
85
85
|
const StyledSectionContainer = styled.div ` width: 100%; height: 100%; display:flex; flex-direction: column; `;
|
|
86
|
-
const StyledBoardContainer = styled.div `width: 100%; height: 100
|
|
86
|
+
const StyledBoardContainer = styled.div `width: 100%; height: 100%;`;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { LayoutModes, ObjectRef, SearchResultDescriptor, TaskDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { HomeBlogPost, LayoutModes, ObjectRef, SearchResultDescriptor, TaskDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { DcmtInfo, FormModes, MetadataValueDescriptorEx, TaskContext } from '../../../ts';
|
|
4
4
|
interface ITMDcmtFormProps {
|
|
5
|
+
allTasks?: Array<TaskDescriptor>;
|
|
6
|
+
getAllTasks?: () => Promise<void>;
|
|
7
|
+
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
8
|
+
addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
9
|
+
editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
10
|
+
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
11
|
+
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
5
12
|
TID?: number;
|
|
6
13
|
DID?: number;
|
|
7
14
|
layoutMode?: LayoutModes;
|
|
@@ -8,7 +8,7 @@ import { DownloadTypes, FormModes } from '../../../ts';
|
|
|
8
8
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
9
9
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
10
10
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
11
|
-
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 } from '../../../helper';
|
|
11
|
+
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 } from '../../../helper';
|
|
12
12
|
import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
|
|
13
13
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
14
14
|
import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
|
|
@@ -35,9 +35,13 @@ import ToppyHelpCenter from '../assistant/ToppyHelpCenter';
|
|
|
35
35
|
import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
36
36
|
import WFDiagram from '../workflow/diagram/WFDiagram';
|
|
37
37
|
import TMTooltip from '../../base/TMTooltip';
|
|
38
|
+
import TMDcmtTasks from './TMDcmtTasks';
|
|
39
|
+
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
40
|
+
import { getTaskAssignedToMe } from '../tasks/TMTasksUtils';
|
|
41
|
+
import TMCustomButton from '../../base/TMCustomButton';
|
|
38
42
|
let abortControllerLocal = new AbortController();
|
|
39
43
|
//#endregion
|
|
40
|
-
const TMDcmtForm = ({ 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, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
|
|
44
|
+
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, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
|
|
41
45
|
const [id, setID] = useState('');
|
|
42
46
|
const [showWaitPanelLocal, setShowWaitPanelLocal] = useState(false);
|
|
43
47
|
const [waitPanelTitleLocal, setWaitPanelTitleLocal] = useState('');
|
|
@@ -60,6 +64,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
60
64
|
const [showMoreInfoPopup, setShowMoreInfoPopup] = useState(false);
|
|
61
65
|
const [layout, setLayout] = useState();
|
|
62
66
|
const [customButtonsLayout, setCustomButtonsLayout] = useState();
|
|
67
|
+
const [customButton, setCustomButton] = useState();
|
|
63
68
|
const appliedInputMidsRef = useRef(null);
|
|
64
69
|
// Refs per evitare stale closure nei callback
|
|
65
70
|
// I useCallback catturano i valori delle dipendenze al momento della creazione.
|
|
@@ -470,14 +475,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
470
475
|
if (customButtonsLayout?.customButtons && Array.isArray(customButtonsLayout.customButtons) && customButtonsLayout.customButtons.length > 0) {
|
|
471
476
|
const customButtonsItems = customButtonsLayout.customButtons.map((customButton) => ({
|
|
472
477
|
text: customButton.title || 'Bottone personalizzato',
|
|
473
|
-
onClick: () =>
|
|
474
|
-
// Per ora, visualizziamo le proprietà del bottone in console e alert
|
|
475
|
-
console.log('Custom Button Properties:', customButton);
|
|
476
|
-
TMMessageBoxManager.show({
|
|
477
|
-
message: `Custom Button:\n${JSON.stringify(customButton, null, 2)}`,
|
|
478
|
-
buttons: [ButtonNames.OK],
|
|
479
|
-
});
|
|
480
|
-
}
|
|
478
|
+
onClick: () => setCustomButton(customButton)
|
|
481
479
|
}));
|
|
482
480
|
items.push({
|
|
483
481
|
icon: svgToString(_jsx(IconCheck, {})),
|
|
@@ -797,7 +795,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
797
795
|
break;
|
|
798
796
|
}
|
|
799
797
|
} }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: handleConfirmAction }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: handleUndo })] }) :
|
|
800
|
-
_jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: handleConfirmAction }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: handleClearForm }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: handleUndo })] }) }) }), totalItems > listMaxItems &&
|
|
798
|
+
_jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: handleConfirmAction }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: handleClearForm }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: handleUndo })] }) }) }), customButton && _jsx(TMCustomButton, { button: customButton, formData: formData, selectedItems: [], onClose: () => setCustomButton(undefined) }), totalItems > listMaxItems &&
|
|
801
799
|
!isApprView &&
|
|
802
800
|
TID !== SystemTIDs.Drafts &&
|
|
803
801
|
!shouldShowAll &&
|
|
@@ -829,7 +827,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
829
827
|
handleUndo,
|
|
830
828
|
handleClearForm
|
|
831
829
|
]);
|
|
832
|
-
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID }), [TID, DID]);
|
|
830
|
+
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks]);
|
|
833
831
|
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]);
|
|
834
832
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, fromDTD: fromDTD, layoutMode: layoutMode, onFileUpload: (file) => {
|
|
835
833
|
setDcmtFile(file);
|
|
@@ -873,13 +871,27 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
873
871
|
borderRadius: 8
|
|
874
872
|
}, children: SDKUI_Localizator.WorkItemTechnicalNote_SetID })] }));
|
|
875
873
|
}, [workflows, formData, workitemSetID, workItems, isWFDataLoading]);
|
|
874
|
+
const tmDcmtTasks = useMemo(() => {
|
|
875
|
+
const isReady = TID && DID && getAllTasks && deleteTaskByIdsCallback && addTaskCallback && editTaskCallback;
|
|
876
|
+
if (!isReady) {
|
|
877
|
+
return _jsx(TMToppyMessage, { message: SDKUI_Localizator.TasksEmpty });
|
|
878
|
+
}
|
|
879
|
+
return (_jsx(TMDcmtTasks, { taskContext: {
|
|
880
|
+
document: {
|
|
881
|
+
tid: Number(TID),
|
|
882
|
+
did: Number(DID),
|
|
883
|
+
name: fromDTD?.nameLoc ?? SDKUI_Localizator.Widget_Activities,
|
|
884
|
+
},
|
|
885
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback }));
|
|
886
|
+
}, [allTasks, TID, DID, fromDTD]);
|
|
876
887
|
const normalizedTID = TID !== undefined ? Number(TID) : undefined;
|
|
877
888
|
const defaultPanelDimensions = {
|
|
878
|
-
'tmDcmtForm': { width: '
|
|
879
|
-
'tmBlog': { width: '
|
|
880
|
-
'tmSysMetadata': { width: '
|
|
881
|
-
'tmDcmtPreview': { width: '
|
|
882
|
-
'tmWF': { width: '
|
|
889
|
+
'tmDcmtForm': { width: '16.66%', height: '100%' },
|
|
890
|
+
'tmBlog': { width: '16.66%', height: '100%' },
|
|
891
|
+
'tmSysMetadata': { width: '16.66%', height: '100%' },
|
|
892
|
+
'tmDcmtPreview': { width: '16.66%', height: '100%' },
|
|
893
|
+
'tmWF': { width: '16.66%', height: '100%' },
|
|
894
|
+
'tmDcmtTasks': { width: '16.66%', height: '100%' },
|
|
883
895
|
};
|
|
884
896
|
const allInitialPanelVisibility = {
|
|
885
897
|
'tmDcmtForm': true,
|
|
@@ -887,6 +899,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
887
899
|
'tmSysMetadata': false,
|
|
888
900
|
'tmDcmtPreview': true,
|
|
889
901
|
'tmWF': false,
|
|
902
|
+
'tmDcmtTasks': false,
|
|
890
903
|
};
|
|
891
904
|
const initialPanels = useMemo(() => [
|
|
892
905
|
{
|
|
@@ -952,7 +965,25 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
952
965
|
isActive: allInitialPanelVisibility['tmWF']
|
|
953
966
|
}
|
|
954
967
|
},
|
|
955
|
-
|
|
968
|
+
{
|
|
969
|
+
id: 'tmDcmtTasks',
|
|
970
|
+
name: SDKUI_Localizator.Widget_Activities,
|
|
971
|
+
contentOptions: {
|
|
972
|
+
component: tmDcmtTasks,
|
|
973
|
+
},
|
|
974
|
+
toolbarOptions: {
|
|
975
|
+
icon: _jsx(IconActivity, { fontSize: 24 }),
|
|
976
|
+
visible: layoutMode !== LayoutModes.Ark,
|
|
977
|
+
orderNumber: 6,
|
|
978
|
+
isActive: allInitialPanelVisibility['tmDcmtTasks'],
|
|
979
|
+
count: (TID && DID && allTasks && allTasks.length > 0) ?
|
|
980
|
+
getTaskAssignedToMe(allTasks).filter(task => task.iD1?.toString() === TID.toString()
|
|
981
|
+
&& task.iD2?.toString() === DID.toString()
|
|
982
|
+
&& task.state !== Task_States.Completed).length ?? 0
|
|
983
|
+
: 0
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
], [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID]);
|
|
956
987
|
// Retrieves the current document form setting based on the normalized TID
|
|
957
988
|
const getCurrentDcmtFormSetting = () => {
|
|
958
989
|
const settings = SDKUI_Globals.userSettings.dcmtFormSettings;
|
|
@@ -1098,9 +1129,9 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
1098
1129
|
} })), _jsxs(StyledReferenceButton, { onClick: () => handleNavigateToReference(ref), children: [_jsx("span", { children: label }), _jsx("span", { children: `"${ref.objName}"` })] }, `ref-${index}-${ref.objID}`)] }, `ref-frag-${index}-${ref.objID}`));
|
|
1099
1130
|
})] }) })), (showCommentForm && TID && DID) &&
|
|
1100
1131
|
_jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: TID, did: DID } }, onClose: () => setShowCommentForm(false), refreshCallback: handleCompleteMoreInfo, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [] }), isOpenDetails &&
|
|
1101
|
-
_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenDetails(false) }) }), isOpenMaster &&
|
|
1102
|
-
_jsxs(StyledModalContainer, { style: { backgroundColor: 'white' }, children: [_jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
|
1103
|
-
return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem }) }, `${index}-${dcmt.DID}`));
|
|
1132
|
+
_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenDetails(false), allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }), isOpenMaster &&
|
|
1133
|
+
_jsxs(StyledModalContainer, { style: { backgroundColor: 'white' }, children: [_jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
|
1134
|
+
return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }, `${index}-${dcmt.DID}`));
|
|
1104
1135
|
})] }), taskFormDialogComponent, s4TViewerDialogComponent] }));
|
|
1105
1136
|
};
|
|
1106
1137
|
return (_jsx(_Fragment, { children: (isModal && onClose)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TaskContext } from "../../../ts";
|
|
2
|
+
import { TaskDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
interface TMDcmtTasksProps {
|
|
4
|
+
taskContext: TaskContext;
|
|
5
|
+
allTasks: Array<TaskDescriptor>;
|
|
6
|
+
getAllTasks: () => Promise<void>;
|
|
7
|
+
deleteTaskByIdsCallback: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
8
|
+
addTaskCallback: (task: TaskDescriptor) => Promise<void>;
|
|
9
|
+
editTaskCallback: (task: TaskDescriptor) => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
declare const TMDcmtTasks: (props: TMDcmtTasksProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default TMDcmtTasks;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { IconMenuVertical, IconRefresh, SDKUI_Localizator, svgToString, TMCommandsContextMenu } from "../../../helper";
|
|
4
|
+
import { DeviceType, useDeviceType } from "../../base/TMDeviceProvider";
|
|
5
|
+
import { useTMPanelManagerContext } from "../../layout/panelManager/TMPanelManagerContext";
|
|
6
|
+
import TMPanel from "../../base/TMPanel";
|
|
7
|
+
import TMTasksPanelContent from "../tasks/TMTasksPanelContent";
|
|
8
|
+
const TMDcmtTasks = (props) => {
|
|
9
|
+
const { taskContext, allTasks, getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback } = props;
|
|
10
|
+
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
11
|
+
const deviceType = useDeviceType();
|
|
12
|
+
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
13
|
+
let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
|
|
14
|
+
const { togglePanelVisibility, toggleMaximize, countVisibleLeafPanels } = useTMPanelManagerContext();
|
|
15
|
+
const toolbar = useMemo(() => _jsxs(_Fragment, { children: [_jsx(IconMenuVertical, { id: "TMTaksPanel-Commands-Header", color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: '#TMTaksPanel-Commands-Header', showEvent: "click", menuItems: [
|
|
16
|
+
{
|
|
17
|
+
icon: svgToString(_jsx(IconRefresh, {})),
|
|
18
|
+
onClick: async () => await getAllTasks(),
|
|
19
|
+
text: SDKUI_Localizator.Refresh,
|
|
20
|
+
},
|
|
21
|
+
] })] }), []);
|
|
22
|
+
return _jsx("div", { style: { width: "100%", height: "100%", position: 'relative' }, children: _jsx(TMPanel, { title: SDKUI_Localizator.Widget_Activities, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onClose: countVisibleLeafPanels() > 1 ? () => togglePanelVisibility("tmDcmtTasks") : undefined, onMaximize: countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmDcmtTasks") : undefined, toolbar: toolbar, children: _jsx(TMTasksPanelContent, { id: "dcmtTasks", taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: () => { return Promise.resolve(); }, handleNavigateToDossiers: () => { return Promise.resolve(); } }) }) });
|
|
23
|
+
};
|
|
24
|
+
export default TMDcmtTasks;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { DcmtInfo, TaskContext } from '../../../ts';
|
|
4
4
|
import { DeviceContextProps } from '../../base/TMDeviceProvider';
|
|
5
5
|
interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
|
|
6
|
+
allTasks?: Array<TaskDescriptor>;
|
|
7
|
+
getAllTasks?: () => Promise<void>;
|
|
8
|
+
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
9
|
+
addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
10
|
+
editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
11
|
+
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
12
|
+
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
6
13
|
inputDcmts?: DcmtInfo[];
|
|
7
14
|
isForMaster?: boolean;
|
|
8
15
|
showCurrentDcmtIndicator?: boolean;
|
|
@@ -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
|
-
const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest }) => {
|
|
17
|
+
const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest }) => {
|
|
18
18
|
const [id, setID] = useState('');
|
|
19
19
|
const [focusedItem, setFocusedItem] = useState();
|
|
20
20
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
@@ -169,7 +169,7 @@ const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentD
|
|
|
169
169
|
_jsx(TMRelationViewerWrapper, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
|
|
170
170
|
// customItemRender={customItemRender}
|
|
171
171
|
allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged]);
|
|
172
|
-
const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest }), [focusedItem, deviceType]);
|
|
172
|
+
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 }), [focusedItem, deviceType, allTasks]);
|
|
173
173
|
const initialPanelDimensions = {
|
|
174
174
|
'tmTreeView': { width: '50%', height: '100%' },
|
|
175
175
|
'tmFormOrResult': { width: '50%', height: '100%' },
|
|
@@ -276,13 +276,13 @@ const TMRelationViewerWrapper = ({ inputDcmts, isForMaster, showCurrentDcmtIndic
|
|
|
276
276
|
}, [onFocusedItemChanged, setPanelVisibilityById, setToolbarButtonVisibility]);
|
|
277
277
|
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 }));
|
|
278
278
|
};
|
|
279
|
-
const TMFormOrResultWrapper = ({ deviceType, focusedItem, onTaskCreateRequest }) => {
|
|
279
|
+
const TMFormOrResultWrapper = ({ deviceType, focusedItem, onTaskCreateRequest, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
280
280
|
const { setPanelVisibilityById } = useTMPanelManagerContext();
|
|
281
281
|
return (_jsx(_Fragment, { children: focusedItem?.isDcmt ?
|
|
282
282
|
_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: () => {
|
|
283
283
|
setPanelVisibilityById('tmTreeView', true);
|
|
284
|
-
} }) :
|
|
284
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) :
|
|
285
285
|
_jsx(TMSearchResult, { groupId: 'tmFormOrResult', isClosable: deviceType !== DeviceType.MOBILE, context: SearchResultContext.METADATA_SEARCH, allowFloatingBar: false, allowRelations: false, openDcmtFormAsModal: true, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, onTaskCreateRequest: onTaskCreateRequest, onClose: () => {
|
|
286
286
|
setPanelVisibilityById('tmTreeView', true);
|
|
287
|
-
} }) }));
|
|
287
|
+
}, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }) }));
|
|
288
288
|
};
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DcmtTypeDescriptor, TaskDescriptor, ObjectRef } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { DcmtTypeDescriptor, TaskDescriptor, ObjectRef, HomeBlogPost } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { DcmtInfo, TaskContext } from '../../../ts';
|
|
4
4
|
import { TMSearchResultFloatingActionConfig } from './TMSearchResultFloatingActionButton';
|
|
5
5
|
interface ITMSearchProps {
|
|
6
|
+
allTasks?: Array<TaskDescriptor>;
|
|
7
|
+
getAllTasks?: () => Promise<void>;
|
|
8
|
+
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
9
|
+
addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
10
|
+
editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
11
|
+
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
12
|
+
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
6
13
|
isVisible?: boolean;
|
|
7
14
|
inputTID?: number;
|
|
8
15
|
inputSqdID?: number;
|
|
@@ -18,7 +18,7 @@ var TMSearchViews;
|
|
|
18
18
|
TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
|
|
19
19
|
TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
|
|
20
20
|
})(TMSearchViews || (TMSearchViews = {}));
|
|
21
|
-
const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openS4TViewer, onOpenS4TViewerRequest, showTodoDcmtForm, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick }) => {
|
|
21
|
+
const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openS4TViewer, onOpenS4TViewerRequest, showTodoDcmtForm, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick }) => {
|
|
22
22
|
const [allSQDs, setAllSQDs] = useState([]);
|
|
23
23
|
const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
|
|
24
24
|
const [currentSQD, setCurrentSQD] = useState();
|
|
@@ -177,7 +177,7 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, is
|
|
|
177
177
|
} }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids]);
|
|
178
178
|
const tmSavedQuerySelectorElement = useMemo(() => _jsxs(TabPanel, { width: "100%", height: "100%", showNavButtons: true, repaintChangesOnly: true, selectedIndex: currentSQDMode, onSelectedIndexChange: (index) => setCurrentSQDMode(index), children: [(currentTID || currentSQD) ? _jsx(Item, { title: fromDTD?.nameLoc, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: false, items: filteredByTIDSQDs, selectedId: currentSQD?.id, onRefreshData: () => { loadDataSQDsAsync(true); }, onItemClick: (sqd) => {
|
|
179
179
|
onSQDItemClick(sqd, setSQDAsync);
|
|
180
|
-
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.
|
|
180
|
+
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.AllFemale, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
|
|
181
181
|
onSQDItemClick(sqd, setSQDAsync);
|
|
182
182
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }), [currentSQDMode, currentTID, currentSQD, fromDTD, filteredByTIDSQDs, allSQDs]);
|
|
183
183
|
// --- PANEL DEFINITIONS ---
|
|
@@ -219,7 +219,7 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, is
|
|
|
219
219
|
toolbarOptions: { icon: _jsx(IconSavedQuery, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['TMSavedQuerySelector'] }
|
|
220
220
|
}
|
|
221
221
|
], [tmTreeSelectorElement, showSearchResults, tmRecentsManagerElement, tmSearchQueryPanelElement, tmSavedQuerySelectorElement, fromDTD, mruTIDs]);
|
|
222
|
-
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsync: onRefreshSearchAsync, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, onReferenceClick: onReferenceClick })] }));
|
|
222
|
+
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsync: onRefreshSearchAsync, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
|
|
223
223
|
};
|
|
224
224
|
export default TMSearch;
|
|
225
225
|
const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SearchResultDescriptor, DcmtTypeDescriptor, TaskDescriptor, WorkingGroupDescriptor, ObjectRef } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { SearchResultDescriptor, DcmtTypeDescriptor, TaskDescriptor, WorkingGroupDescriptor, ObjectRef, HomeBlogPost } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { DcmtInfo, SearchResultContext, TaskContext } from '../../../ts';
|
|
4
4
|
import { TMSearchResultFloatingActionConfig } from './TMSearchResultFloatingActionButton';
|
|
5
5
|
export declare const getSearchResultCountersSingleCategory: (searchResults: SearchResultDescriptor[]) => string;
|
|
6
6
|
interface ITMSearchResultProps {
|
|
7
|
+
allTasks?: Array<TaskDescriptor>;
|
|
8
|
+
getAllTasks?: () => Promise<void>;
|
|
9
|
+
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
10
|
+
addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
11
|
+
editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
|
|
12
|
+
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
13
|
+
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
7
14
|
context?: SearchResultContext;
|
|
8
15
|
title?: string;
|
|
9
16
|
searchResults: SearchResultDescriptor[] | undefined;
|