@topconsultnpm/sdkui-react 6.17.0-test10 → 6.17.0-test11

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.
Files changed (50) hide show
  1. package/lib/components/base/TMButton.d.ts +1 -0
  2. package/lib/components/base/TMButton.js +6 -6
  3. package/lib/components/base/TMCustomButton.d.ts +1 -1
  4. package/lib/components/base/TMCustomButton.js +28 -26
  5. package/lib/components/base/TMFileManagerDataGridView.js +1 -1
  6. package/lib/components/base/TMModal.d.ts +2 -0
  7. package/lib/components/base/TMModal.js +48 -3
  8. package/lib/components/base/TMPopUp.js +4 -1
  9. package/lib/components/base/TMWaitPanel.js +8 -2
  10. package/lib/components/choosers/TMDataListItemChooser.js +1 -1
  11. package/lib/components/choosers/TMMetadataChooser.js +3 -1
  12. package/lib/components/choosers/TMUserChooser.d.ts +4 -0
  13. package/lib/components/choosers/TMUserChooser.js +21 -5
  14. package/lib/components/editors/TMTextArea.d.ts +1 -0
  15. package/lib/components/editors/TMTextArea.js +43 -9
  16. package/lib/components/editors/TMTextBox.js +33 -3
  17. package/lib/components/editors/TMTextExpression.js +36 -28
  18. package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +30 -0
  19. package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +459 -0
  20. package/lib/components/features/assistant/ToppySpeechBubble.d.ts +9 -0
  21. package/lib/components/features/assistant/ToppySpeechBubble.js +117 -0
  22. package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -0
  23. package/lib/components/features/blog/TMBlogCommentForm.js +18 -6
  24. package/lib/components/features/documents/TMDcmtBlog.js +1 -1
  25. package/lib/components/features/documents/TMDcmtForm.js +5 -5
  26. package/lib/components/features/documents/TMDcmtPreview.js +45 -8
  27. package/lib/components/features/search/TMSearchQueryPanel.js +2 -3
  28. package/lib/components/features/search/TMSearchResult.js +12 -13
  29. package/lib/components/features/tasks/TMTaskForm.js +2 -2
  30. package/lib/components/features/workflow/TMWorkflowPopup.js +1 -1
  31. package/lib/components/forms/TMSaveForm.js +2 -2
  32. package/lib/components/grids/TMBlogsPost.d.ts +7 -5
  33. package/lib/components/grids/TMBlogsPost.js +56 -10
  34. package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
  35. package/lib/components/grids/TMBlogsPostUtils.js +10 -0
  36. package/lib/components/index.d.ts +1 -1
  37. package/lib/components/index.js +1 -1
  38. package/lib/helper/SDKUI_Localizator.d.ts +5 -0
  39. package/lib/helper/SDKUI_Localizator.js +50 -0
  40. package/lib/helper/TMIcons.d.ts +2 -0
  41. package/lib/helper/TMIcons.js +9 -0
  42. package/lib/helper/TMToppyMessage.js +2 -1
  43. package/lib/helper/dcmtsHelper.d.ts +2 -2
  44. package/lib/helper/dcmtsHelper.js +54 -25
  45. package/lib/helper/helpers.d.ts +1 -1
  46. package/lib/helper/helpers.js +10 -16
  47. package/lib/ts/types.d.ts +2 -0
  48. package/package.json +2 -2
  49. package/lib/components/features/assistant/ToppyHelpCenter.d.ts +0 -12
  50. package/lib/components/features/assistant/ToppyHelpCenter.js +0 -173
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface ToppySpeechBubbleProps {
3
+ align?: 'left' | 'right';
4
+ children: React.ReactNode;
5
+ className?: string;
6
+ onClose?: () => void;
7
+ }
8
+ declare const ToppySpeechBubble: React.ForwardRefExoticComponent<ToppySpeechBubbleProps & React.RefAttributes<HTMLDivElement>>;
9
+ export default ToppySpeechBubble;
@@ -0,0 +1,117 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { forwardRef } from 'react';
3
+ import styled from 'styled-components';
4
+ import { SDKUI_Localizator } from '../../../helper';
5
+ import { IconCloseOutline } from '../../../helper/TMIcons';
6
+ // Styled component
7
+ const Bubble = styled.div `
8
+ position: absolute;
9
+ bottom: 145px;
10
+ ${({ $align }) => ($align === 'left' ? 'left: 0px;' : 'right: 0px;')}
11
+ width: max-content;
12
+ padding: 10px;
13
+ background: linear-gradient(180deg, rgba(0, 113, 188, 0.45) 0%,rgba(27, 20, 100, 0.65) 100%);
14
+ border-radius: 18px;
15
+ box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
16
+ font-size: 14px;
17
+ line-height: 1.4;
18
+ color: #333;
19
+ z-index: 10000;
20
+
21
+ &::after {
22
+ transform: ${({ $align }) => ($align === 'left' ? 'skewX(15deg)' : 'skewX(-15deg)')};
23
+ content: "";
24
+ position: absolute;
25
+ top: 100%;
26
+ ${({ $align }) => ($align === 'left' ? 'left: 20px;' : 'right: 15px;')}
27
+ border-width: 32px 32px 0 0;
28
+ border-style: solid;
29
+ border-color: #FFFFFF transparent;
30
+ display: block;
31
+ width: 0;
32
+ height: 0;
33
+ z-index: 1;
34
+ }
35
+
36
+ &::before {
37
+ transform: ${({ $align }) => ($align === 'left' ? 'skewX(15deg)' : 'skewX(-15deg)')};
38
+ content: "";
39
+ position: absolute;
40
+ top: 100%;
41
+ ${({ $align }) => ($align === 'left' ? 'left: 20px;' : 'right: 15px;')}
42
+ border-width: 32px 32px 0 0;
43
+ border-style: solid;
44
+ border-color: rgba(27, 20, 100, 0.65) transparent;
45
+ display: block;
46
+ width: 0;
47
+ height: 0;
48
+ z-index: 2;
49
+ }
50
+ `;
51
+ const CloseButton = styled.button `
52
+ position: absolute;
53
+ top: -8px;
54
+ right: -8px;
55
+ width: 24px;
56
+ height: 24px;
57
+ border-radius: 50%;
58
+ border: 2px solid rgba(255, 255, 255, 0.9);
59
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
60
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4), 0 0 20px rgba(118, 75, 162, 0.2);
61
+ cursor: pointer;
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
66
+ z-index: 10001;
67
+ color: white;
68
+ font-size: 14px;
69
+
70
+ &:hover {
71
+ background: linear-gradient(135deg, #764ba2 0%, #f093fb 100%);
72
+ box-shadow: 0 6px 20px rgba(118, 75, 162, 0.6), 0 0 30px rgba(240, 147, 251, 0.4);
73
+ border-color: rgba(255, 255, 255, 1);
74
+ }
75
+
76
+ &:active {
77
+ transform: scale(0.95);
78
+ box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
79
+ }
80
+
81
+ &:focus {
82
+ outline: none;
83
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4), 0 0 0 3px rgba(102, 126, 234, 0.2);
84
+ }
85
+ `;
86
+ // Componente con forwardRef
87
+ const ToppySpeechBubble = forwardRef(({ align = 'right', children, className, onClose }, ref) => {
88
+ const isDraggingRef = React.useRef(false);
89
+ const mouseDownPosRef = React.useRef(null);
90
+ const handleMouseDown = (e) => {
91
+ isDraggingRef.current = false;
92
+ mouseDownPosRef.current = { x: e.clientX, y: e.clientY };
93
+ };
94
+ const handleMouseMove = (e) => {
95
+ if (!mouseDownPosRef.current)
96
+ return;
97
+ const deltaX = Math.abs(e.clientX - mouseDownPosRef.current.x);
98
+ const deltaY = Math.abs(e.clientY - mouseDownPosRef.current.y);
99
+ // Considera drag solo se il movimento supera 3px
100
+ if (deltaX > 3 || deltaY > 3) {
101
+ isDraggingRef.current = true;
102
+ }
103
+ };
104
+ const handleClick = (e) => {
105
+ if (isDraggingRef.current) {
106
+ e.stopPropagation();
107
+ e.preventDefault();
108
+ return;
109
+ }
110
+ onClose?.();
111
+ };
112
+ const handleMouseUp = () => {
113
+ mouseDownPosRef.current = null;
114
+ };
115
+ return (_jsxs(Bubble, { ref: ref, "$align": align, className: className, children: [onClose && (_jsx(CloseButton, { onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onClick: handleClick, "aria-label": SDKUI_Localizator.Minimize, title: SDKUI_Localizator.Minimize, type: "button", children: _jsx(IconCloseOutline, {}) })), children] }));
116
+ });
117
+ export default ToppySpeechBubble;
@@ -6,12 +6,14 @@ interface TMBlogCommentFormProps {
6
6
  participants: Array<UserDescriptor>;
7
7
  onClose: () => void;
8
8
  showAttachmentsSection?: boolean;
9
+ removeAndEditAttachment?: boolean;
9
10
  selectedAttachments?: Array<FileItem>;
10
11
  selectedAttachmentDid?: Array<number>;
11
12
  allFileItems?: FileItem;
12
13
  allArchivedDocumentsFileItems?: Array<FileItem>;
13
14
  onFilterCreated?: (predicate: (post: BlogPost) => boolean) => void;
14
15
  refreshCallback?: () => Promise<void>;
16
+ isCommentRequired?: boolean;
15
17
  }
16
18
  declare const TMBlogCommentForm: (props: TMBlogCommentFormProps) => import("react/jsx-runtime").JSX.Element;
17
19
  export default TMBlogCommentForm;
@@ -29,7 +29,7 @@ const getNonDirectoryFiles = (items, exclude) => {
29
29
  };
30
30
  const TMBlogCommentForm = (props) => {
31
31
  const maxLength = 1000;
32
- const { participants, selectedAttachments, selectedAttachmentDid, allFileItems, allArchivedDocumentsFileItems = [], onClose, context, showAttachmentsSection = true, onFilterCreated, refreshCallback } = props;
32
+ const { participants, selectedAttachments, selectedAttachmentDid, allFileItems, allArchivedDocumentsFileItems = [], onClose, context, showAttachmentsSection = true, removeAndEditAttachment = true, onFilterCreated, refreshCallback, isCommentRequired = false } = props;
33
33
  // Initialize state with combined array
34
34
  const [dataSource, setDataSource] = useState(() => [...getNonDirectoryFiles(allFileItems?.items || [], []), ...allArchivedDocumentsFileItems]);
35
35
  const [isEditorEnabled, setIsEditorEnabled] = useState(true);
@@ -216,8 +216,20 @@ const TMBlogCommentForm = (props) => {
216
216
  // Update the state with selected draft items
217
217
  setCurrentDraftAttachments(selectedDraftItems);
218
218
  };
219
- return _jsx(TMSaveForm, { id: 1, title: SDKUI_Localizator.AddNewComment, showTitleFormMode: false, showErrorCount: false, customSaveButton: _jsx("i", { className: 'dx-icon-send' }), customTooltipSaveButton: SDKUI_Localizator.Send, showUndoButton: false, hasNavigation: false, skipIsModifiedCheck: true, isModal: true, width: calcResponsiveSizes(deviceType, '800px', '800px', '95%'), height: '550px', formMode: FormModes.Create, validationItems: validationItems, exception: exception, isModified: calcIsModified(formData, formDataOrig), onSaveAsync: onSaveAsync, onClose: onCloseCallback, customToolbarElements: _jsx("div", { style: { display: 'flex', gap: '2px' }, children: _jsx(TMButton, { btnStyle: "toolbar", icon: isEditorEnabled ? _jsx("i", { className: 'dx-icon-font' }) : _jsx("i", { className: 'dx-icon-background' }), caption: isEditorEnabled ? SDKUI_Localizator.HideFormattingOptions : SDKUI_Localizator.ShowFormattingOptions, onClick: toggleEditorMode }) }), children: _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx("div", { style: { width: "100%", height: showAttachmentsSection ? "calc(100% - 60px)" : "100%" }, children: _jsx(TMHtmlEditor, { width: '100%', height: '100%', isEditorEnabled: isEditorEnabled, validationItems: validationItems, onValueChanged: onValueChanged, mentionsConfig: mentionsConfig, autoFocus: true, maxLength: maxLength }) }), showAttachmentsSection && _jsxs("div", { style: { display: 'flex', alignItems: 'center', height: '60px', marginTop: '10px' }, children: [_jsx("div", { style: {
220
- width: 'calc(100% - 60px)',
219
+ return _jsx(TMSaveForm, { id: 1, title: SDKUI_Localizator.AddNewComment, showTitleFormMode: false, showErrorCount: false, customSaveButton: _jsx("i", { className: 'dx-icon-send' }), customTooltipSaveButton: SDKUI_Localizator.Send, showUndoButton: false, hasNavigation: false, skipIsModifiedCheck: true, isModal: true, width: calcResponsiveSizes(deviceType, '800px', '800px', '95%'), height: '550px', formMode: FormModes.Create, validationItems: validationItems, exception: exception, isModified: calcIsModified(formData, formDataOrig), onSaveAsync: onSaveAsync, onClose: onCloseCallback, showCloseButton: isCommentRequired ? false : true, customToolbarElements: _jsx("div", { style: { display: 'flex', gap: '2px' }, children: _jsx(TMButton, { btnStyle: "toolbar", icon: isEditorEnabled ? _jsx("i", { className: 'dx-icon-font' }) : _jsx("i", { className: 'dx-icon-background' }), caption: isEditorEnabled ? SDKUI_Localizator.HideFormattingOptions : SDKUI_Localizator.ShowFormattingOptions, onClick: toggleEditorMode }) }), children: _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsxs("div", { style: { width: "100%", height: showAttachmentsSection ? `calc(100% - 60px)` : '100%' }, children: [isCommentRequired && _jsx("div", { style: {
220
+ padding: '10px',
221
+ width: '100%',
222
+ height: '30px',
223
+ backgroundColor: '#e8f5e9',
224
+ border: '1px solid #81c784',
225
+ borderRadius: '4px',
226
+ fontSize: '13px',
227
+ marginBottom: '10px',
228
+ color: '#2e7d32',
229
+ display: 'flex',
230
+ alignItems: 'center',
231
+ }, children: SDKUI_Localizator.InsertCommentToCompleteOperation }), _jsx("div", { style: { width: "100%", height: isCommentRequired ? `calc(100% - 40px)` : '100%' }, children: _jsx(TMHtmlEditor, { width: '100%', height: '100%', isEditorEnabled: isEditorEnabled, validationItems: validationItems, onValueChanged: onValueChanged, mentionsConfig: mentionsConfig, autoFocus: true, maxLength: maxLength }) })] }), showAttachmentsSection && _jsxs("div", { style: { display: 'flex', alignItems: 'center', height: '60px', marginTop: '10px' }, children: [_jsx("div", { style: {
232
+ width: `calc(100% - ${removeAndEditAttachment ? 60 : 0}px)`,
221
233
  overflowX: 'auto',
222
234
  whiteSpace: 'nowrap',
223
235
  height: '50px',
@@ -231,7 +243,7 @@ const TMBlogCommentForm = (props) => {
231
243
  const tooltipContent = (_jsxs("div", { style: { textAlign: 'left' }, children: [_jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Name, ":"] }), " ", draft.name ?? '-'] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Author, ":"] }), " ", draft.updaterName ?? '-'] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Version, ":"] }), " ", draft.version] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Size, ":"] }), " ", formatBytes(draft.size ?? 0)] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.CreationTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(draft.creationTime)] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.LastUpdateTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(draft.lastUpdateTime)] })] }));
232
244
  return _jsxs("div", { style: {
233
245
  display: 'inline-flex',
234
- alignItems: 'center', // <-- this centers content vertically
246
+ alignItems: 'center',
235
247
  padding: '4px 8px',
236
248
  margin: '4px',
237
249
  border: '1px solid #ddd',
@@ -258,7 +270,7 @@ const TMBlogCommentForm = (props) => {
258
270
  fontWeight: 'bold',
259
271
  marginRight: '8px',
260
272
  boxShadow: '1px 1px 2px #00000020',
261
- }, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Version, children: draft.version }) })), _jsx(TMTooltip, { content: SDKUI_Localizator.RemoveAttachment, children: _jsx("span", { onClick: () => removeAttachment(draft), style: {
273
+ }, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Version, children: draft.version }) })), removeAndEditAttachment && _jsx(TMTooltip, { content: SDKUI_Localizator.RemoveAttachment, children: _jsx("span", { onClick: () => removeAttachment(draft), style: {
262
274
  display: 'inline-flex',
263
275
  width: '20px',
264
276
  height: '20px',
@@ -270,7 +282,7 @@ const TMBlogCommentForm = (props) => {
270
282
  cursor: 'pointer',
271
283
  boxShadow: '1px 1px 2px #00000020',
272
284
  }, children: _jsx("span", { style: { fontSize: '15px' }, children: "\u00D7" }) }) })] }, draft.did);
273
- })) : (_jsx("div", { style: { color: '#999', width: '100%', textAlign: 'center' }, children: SDKUI_Localizator.NoAttachments })) }), _jsx(TMTooltip, { content: SDKUI_Localizator.Attachments + ": " + currentDraftAttachments.length, children: _jsxs("div", { style: { position: 'relative', display: 'inline-block' }, children: [_jsx("i", { className: "dx-icon-attach", style: {
285
+ })) : (_jsx("div", { style: { color: '#999', width: '100%', textAlign: 'center' }, children: SDKUI_Localizator.NoAttachments })) }), removeAndEditAttachment && _jsx(TMTooltip, { content: SDKUI_Localizator.Attachments + ": " + currentDraftAttachments.length, children: _jsxs("div", { style: { position: 'relative', display: 'inline-block' }, children: [_jsx("i", { className: "dx-icon-attach", style: {
274
286
  width: '50px',
275
287
  height: '50px',
276
288
  marginLeft: '10px',
@@ -57,7 +57,7 @@ const TMDcmtBlog = ({ blogsDatasource, setBlogsDatasource, hasLoadedDataOnce, se
57
57
  isRefreshEnabled: true,
58
58
  isRestoreEnabled: true,
59
59
  isCreateContextualTask: false
60
- }, 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 })] }));
60
+ }, externalBlogPost: externalBlogPost, resetExternalBlogPost: resetExternalBlogPost, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, afterTaskSaved: refreshCallback }) }) }) }), (showCommentForm && tid && did) && _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid, did } }, onClose: () => setShowCommentForm(false), refreshCallback: refreshCallback, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [], onFilterCreated: handleFilterCreated })] }));
61
61
  };
62
62
  export default TMDcmtBlog;
63
63
  const StyledContainer = styled.div ` user-select: none; overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
@@ -34,7 +34,6 @@ import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManag
34
34
  import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
35
35
  import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
36
36
  import { useWorkflowApprove } from '../../../hooks/useWorkflowApprove';
37
- import ToppyHelpCenter from '../assistant/ToppyHelpCenter';
38
37
  import TMBlogCommentForm from '../blog/TMBlogCommentForm';
39
38
  import WFDiagram from '../workflow/diagram/WFDiagram';
40
39
  import TMTooltip from '../../base/TMTooltip';
@@ -42,6 +41,7 @@ import TMDcmtTasks from './TMDcmtTasks';
42
41
  import TMToppyMessage from '../../../helper/TMToppyMessage';
43
42
  import { getTaskAssignedToMe } from '../tasks/TMTasksUtils';
44
43
  import TMCustomButton from '../../base/TMCustomButton';
44
+ import ToppyDraggableHelpCenter from '../assistant/ToppyDraggableHelpCenter';
45
45
  let abortControllerLocal = new AbortController();
46
46
  //#endregion
47
47
  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 = [], onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
@@ -497,8 +497,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
497
497
  const isMasterDisabled = useMemo(() => layoutMode !== LayoutModes.Update || !DID, [layoutMode, DID]);
498
498
  const isWFDisabled = useMemo(() => layoutMode !== LayoutModes.Update || fetchError || workItems.length <= 0, [layoutMode, fetchError, workItems.length]);
499
499
  const showToppyForApprove = useMemo(() => layoutMode === LayoutModes.Update && !fetchError && workItems.length > 0 && !isOpenDetails && !isOpenMaster, [layoutMode, fetchError, workItems.length, isOpenDetails, isOpenMaster]);
500
- const showToppyForCompleteMoreInfo = useMemo(() => layoutMode === LayoutModes.Update && isTaskMoreInfo(taskMoreInfo?.name) && taskMoreInfo?.state !== Task_States.Completed, [layoutMode, taskMoreInfo?.name, taskMoreInfo?.state]);
501
- const showToppyForReferences = useMemo(() => allowButtonsRefs && layoutMode === LayoutModes.Update && dcmtReferences && dcmtReferences.length > 0 && !isOpenDetails && !isOpenMaster, [allowButtonsRefs, layoutMode, dcmtReferences, isOpenDetails, isOpenMaster]);
500
+ const showToppyForCompleteMoreInfo = useMemo(() => layoutMode === LayoutModes.Update && !!isTaskMoreInfo(taskMoreInfo?.name) && taskMoreInfo?.state !== Task_States.Completed, [layoutMode, taskMoreInfo?.name, taskMoreInfo?.state]);
501
+ const showToppyForReferences = useMemo(() => allowButtonsRefs && layoutMode === LayoutModes.Update && !!(dcmtReferences && dcmtReferences.length > 0) && !isOpenDetails && !isOpenMaster, [allowButtonsRefs, layoutMode, dcmtReferences, isOpenDetails, isOpenMaster]);
502
502
  const isMobile = useMemo(() => deviceType === DeviceType.MOBILE, [deviceType]);
503
503
  const isApprView = useMemo(() => fromDTD?.templateTID === TemplateTIDs.WF_WIApprView, [fromDTD?.templateTID]);
504
504
  const workitemSetID = useMemo(() => workItems.find(o => o.did === Number(DID))?.setID || formData.find(o => o.md?.name === WorkItemMetadataNames.WI_SetID)?.value, [workItems, DID, formData]);
@@ -1353,7 +1353,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1353
1353
  isEditable: true,
1354
1354
  value: FormulaHelper.addFormulaTag(newFormula.expression)
1355
1355
  }));
1356
- } }), 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 })] }), (showToppyForApprove || showToppyForCompleteMoreInfo || showToppyForReferences) && (_jsx(ToppyHelpCenter, { deviceType: deviceType, usePortal: false, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [showToppyForApprove && (workItems.length === 1 ?
1356
+ } }), 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, content: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [showToppyForApprove && (workItems.length === 1 ?
1357
1357
  _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onSignApprove: handleSignApprove, onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), onMoreInfo: () => setShowMoreInfoPopup(true), dtd: fromDTD })
1358
1358
  :
1359
1359
  _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: () => {
@@ -1368,7 +1368,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1368
1368
  backgroundColor: 'rgba(255,255,255,0.2)',
1369
1369
  margin: '6px 0'
1370
1370
  } })), _jsxs(StyledReferenceButton, { onClick: () => handleNavigateToReference(ref), children: [_jsx("span", { children: label }), _jsx("span", { children: `"${ref.objName}"` })] }, `ref-${index}-${ref.objID}`)] }, `ref-frag-${index}-${ref.objID}`));
1371
- })] }) }))] }), (showCommentForm && TID && DID) &&
1371
+ })] }) })] }), (showCommentForm && TID && DID) &&
1372
1372
  _jsx(TMBlogCommentForm, { context: { engine: 'SearchEngine', object: { tid: TID, did: DID } }, onClose: () => setShowCommentForm(false), refreshCallback: handleCompleteMoreInfo, participants: [], showAttachmentsSection: false, allArchivedDocumentsFileItems: [] }), isOpenDetails &&
1373
1373
  _jsx(StyledModalContainer, { 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 &&
1374
1374
  _jsxs(StyledModalContainer, { 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) => {
@@ -15,11 +15,18 @@ import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSa
15
15
  import { StyledAnimatedComponentOpacity } from '../../base/Styled';
16
16
  import TMPanel from '../../base/TMPanel';
17
17
  import TMTooltip from '../../base/TMTooltip';
18
+ const ErrorContent = ({ error, isAbortError, onRetry }) => {
19
+ if (isAbortError) {
20
+ return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [_jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), _jsxs(StyledPreviewNotAvailable, { children: [_jsx("div", { children: error }), _jsx("div", { children: SDKUI_Localizator.PreviewNotAvailable })] }), _jsx(TMButton, { caption: SDKUI_Localizator.TryAgain, onClick: onRetry, showTooltip: false })] }) }));
21
+ }
22
+ return _jsx(TMNothingToShow, { icon: _jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), text: error });
23
+ };
18
24
  const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev, onClosePanel, onNext, onPrev, allowMaximize = true, onMaximizePanel }) => {
19
25
  const [dcmtBlob, setDcmtBlob] = useState(undefined);
20
26
  const [showPreview, setShowPreview] = useState(false);
21
27
  const [isFromCache, setIsFromCache] = useState(false);
22
28
  const [error, setError] = useState('');
29
+ const [isAbortError, setIsAbortError] = useState(false);
23
30
  const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, getDcmtFileAsync, clearDcmtsFileCache, removeDcmtsFileCache, isDcmtFileInCache } = useDcmtOperations();
24
31
  const cacheKey = dcmtData ? `${dcmtData.tid}-${dcmtData.did}` : '00';
25
32
  const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false);
@@ -29,6 +36,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
29
36
  setLastLoadedDid(undefined); // Reset
30
37
  setDcmtBlob(undefined);
31
38
  setError('');
39
+ setIsAbortError(false);
32
40
  setShowPreview(false);
33
41
  return;
34
42
  }
@@ -42,6 +50,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
42
50
  if (shouldFetch) {
43
51
  setDcmtBlob(undefined);
44
52
  setError('');
53
+ setIsAbortError(false);
45
54
  if ((extensionHandler(dcmtData.fileExt) !== FileExtensionHandler.NONE) && ((dcmtData.fileSize ?? 0) <= (SDKUI_Globals.userSettings.searchSettings.previewThreshold * 1024))) {
46
55
  loadDocumentWithCache();
47
56
  setShowPreview(true);
@@ -65,15 +74,19 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
65
74
  let dcmtFile = await getDcmtFileAsync({ TID: dcmtData?.tid, DID: dcmtData?.did, FILEEXT: dcmtData?.fileExt }, rfo, 'Anteprima', false);
66
75
  setDcmtBlob(dcmtFile?.file);
67
76
  setIsFromCache(!!dcmtFile?.isFromCache);
77
+ setError('');
78
+ setIsAbortError(false);
68
79
  }
69
80
  catch (ex) {
70
81
  const err = ex;
71
82
  if (err.name === 'CanceledError') {
72
83
  setError('Operazione annullata.');
84
+ setIsAbortError(true);
73
85
  ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
74
86
  }
75
87
  else {
76
88
  setError(getExceptionMessage(ex));
89
+ setIsAbortError(false);
77
90
  TMExceptionBoxManager.show({ exception: ex });
78
91
  }
79
92
  }
@@ -101,6 +114,9 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
101
114
  const reOpenDcmt = async () => {
102
115
  removeDcmtsFileCache(cacheKey);
103
116
  setIsFromCache(false);
117
+ setError('');
118
+ setIsAbortError(false);
119
+ setDcmtBlob(undefined);
104
120
  try {
105
121
  await loadDocumentWithCache();
106
122
  }
@@ -112,7 +128,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
112
128
  { icon: _jsx(IconCloseCircle, {}), text: SDKUI_Localizator.RemoveFromCache, onClick: () => { removeDcmtsFileCache(cacheKey); setIsFromCache(false); } },
113
129
  { icon: _jsx(IconClear, {}), text: SDKUI_Localizator.ClearCache, onClick: () => { clearDcmtsFileCache(); setIsFromCache(false); } },
114
130
  ] }, "btn13") }), _jsx(StyledHeaderIcon, { onClick: reOpenDcmt, "$color": TMColors.primaryColor, children: _jsx(TMTooltip, { content: SDKUI_Localizator.ReopenDocument, children: _jsx(IconRefresh, {}) }) })] }), children: error
115
- ? _jsx(TMNothingToShow, { icon: _jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), text: error })
131
+ ? _jsx(ErrorContent, { error: error, isAbortError: isAbortError, onRetry: reOpenDcmt })
116
132
  : renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
117
133
  };
118
134
  export default TMDcmtPreview;
@@ -148,11 +164,12 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
148
164
  }, []);
149
165
  useEffect(() => {
150
166
  if (fileBlob) {
151
- const url = URL.createObjectURL(fileBlob);
152
- setBlobUrl(url);
153
167
  setFileType(fileBlob.type);
154
168
  setFormattedXml(undefined);
155
- if (fileBlob.type.includes("xml")) {
169
+ const fileName = fileBlob.name || '';
170
+ const fileExtension = fileName.split('.').pop()?.toLowerCase() || '';
171
+ const isConfigFile = ['config', 'cfg'].includes(fileExtension);
172
+ if (fileBlob.type.includes("xml") && !isConfigFile) {
156
173
  fileBlob.text().then((text) => {
157
174
  const parser = new DOMParser();
158
175
  const xmlDoc = parser.parseFromString(text, "application/xml");
@@ -169,10 +186,28 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
169
186
  .replace(/</g, "&lt;")
170
187
  .replace(/>/g, "&gt;")}</pre>`);
171
188
  });
189
+ setBlobUrl(undefined);
190
+ }
191
+ else if (isConfigFile) {
192
+ fileBlob.text().then((text) => {
193
+ const escapedText = text
194
+ .replace(/&/g, "&amp;")
195
+ .replace(/</g, "&lt;")
196
+ .replace(/>/g, "&gt;");
197
+ setFormattedXml(`<pre style="font-family: monospace; white-space: pre-wrap; line-height: 1.5; margin: 0; padding: 10px;">${escapedText}</pre>`);
198
+ }).catch((error) => {
199
+ console.error("Error reading text file:", error);
200
+ setFormattedXml(`<div style="color: red;">Error reading file</div>`);
201
+ });
202
+ setBlobUrl(undefined);
203
+ }
204
+ else {
205
+ const url = URL.createObjectURL(fileBlob);
206
+ setBlobUrl(url);
207
+ return () => {
208
+ URL.revokeObjectURL(url);
209
+ };
172
210
  }
173
- return () => {
174
- URL.revokeObjectURL(url);
175
- };
176
211
  }
177
212
  else {
178
213
  setBlobUrl(undefined);
@@ -225,7 +260,9 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
225
260
  display: 'inline-block'
226
261
  }, children: SDKUI_Localizator.OpenInNewTab })] })] }));
227
262
  }
228
- return (_jsx("iframe", { srcDoc: fileType?.includes("xml") && formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !fileType?.includes("xml") || !formattedXml ? blobUrl : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }));
263
+ return (_jsx("iframe", { srcDoc: formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !formattedXml
264
+ ? (fileType === 'application/pdf' ? `${blobUrl}#view=FitH&scrollbar=1` : blobUrl)
265
+ : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }, blobUrl));
229
266
  };
230
267
  const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
231
268
  const containerRef = useRef(null);
@@ -3,7 +3,6 @@ import { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts';
4
4
  import styled from 'styled-components';
5
5
  import TMSearchQueryEditor from './TMSearchQueryEditor';
6
- import Toppy from '../../../assets/Toppy-generico.png';
7
6
  import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit, IconEasy, IconAdvanced, deepCompare, IconSearch, IconClear, getDefaultOperator, prepareQdForSearchAsync, IsParametricQuery, SDKUI_Globals, IconArrowRight, IconMenuCAArchive, getListMaxItems } from '../../../helper';
8
7
  import { useQueryParametersDialog } from '../../../hooks/useQueryParametersDialog';
9
8
  import { FormModes } from '../../../ts';
@@ -13,7 +12,6 @@ import ShowAlert from '../../base/TMAlert';
13
12
  import TMButton from '../../base/TMButton';
14
13
  import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
15
14
  import TMDropDownMenu from '../../base/TMDropDownMenu';
16
- import TMLayoutContainer from '../../base/TMLayout';
17
15
  import { TMExceptionBoxManager } from '../../base/TMPopUp';
18
16
  import TMSpinner from '../../base/TMSpinner';
19
17
  import TMPanel from '../../base/TMPanel';
@@ -22,6 +20,7 @@ import { TMMetadataChooserForm } from '../../choosers/TMMetadataChooser';
22
20
  import TMQueryEditor from '../../query/TMQueryEditor';
23
21
  import TMSavedQueryForm from './TMSavedQueryForm';
24
22
  import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
23
+ import TMToppyMessage from '../../../helper/TMToppyMessage';
25
24
  const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback }) => {
26
25
  const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
27
26
  const [qd, setQd] = useState();
@@ -329,7 +328,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
329
328
  _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, qd: qd, selectedIDs: qd?.select?.map((item) => ({ tid: item.tid, mid: item.mid })), onClose: handleCloseOutputConfig, onChoose: handleChooseOutput }), showOrderByConfig &&
330
329
  _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, qd: qd, selectedIDs: qd?.orderBy?.map((item) => ({ tid: item.tid, mid: item.mid })), onClose: handleCloseOrderByConfig, onChoose: handleChooseOrderBy })] })
331
330
  :
332
- _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsx(StyledToppyTextContainer, { children: _jsx(StyledToppyText, { title: SDKUI_Localizator.DcmtTypeSelectOrQuickSearch, children: SDKUI_Localizator.DcmtTypeSelectOrQuickSearch }) }), _jsx(StyledToppyImage, { src: Toppy, alt: 'Toppy' })] }), showSqdForm &&
331
+ _jsx(TMToppyMessage, { message: SDKUI_Localizator.DcmtTypeSelectOrQuickSearch, titleTooltip: SDKUI_Localizator.DcmtTypeSelectOrQuickSearch }), showSqdForm &&
333
332
  _jsx(StyledModalContainer, { style: { backgroundColor: `${TMColors.backgroundColorHeader}12` }, children: _jsx(TMSavedQueryForm, { height: '50%', width: '50%', id: formModeSqdForm === FormModes.Create ? -1 : SQD?.id, title: 'Ricerca rapida', formMode: formModeSqdForm, showBackButton: true, qd: qd, isAdvancedSearch: showAdvancedSearch, isModal: false, onClose: () => { setShowSqdForm(false); }, onSaved: onSqdSaved }) })] }), showDistinctValuesPanel &&
334
333
  _jsx(TMDistinctValues, { isModal: true, tid: focusedTidMid?.tid, mid: focusedTidMid?.mid, separator: ',', onClosePanelCallback: () => setShowDistinctValuesPanel(false), onSelectionChanged: (e) => {
335
334
  if (!e)
@@ -31,7 +31,6 @@ import TMDcmtBlog from '../documents/TMDcmtBlog';
31
31
  import TMDcmtIcon from '../documents/TMDcmtIcon';
32
32
  import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
33
33
  import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
34
- import ToppyHelpCenter from '../assistant/ToppyHelpCenter';
35
34
  import TMAccordion from '../../base/TMAccordion';
36
35
  import TMDataGridExportForm from '../../base/TMDataGridExportForm';
37
36
  import TMSearchResultFloatingActionButton from './TMSearchResultFloatingActionButton';
@@ -43,6 +42,7 @@ import TMSearch from './TMSearch';
43
42
  import TMArchive from '../archive/TMArchive';
44
43
  import { TMResultManager } from '../../forms/TMResultDialog';
45
44
  import TMCustomButton from '../../base/TMCustomButton';
45
+ import ToppyDraggableHelpCenter from '../assistant/ToppyDraggableHelpCenter';
46
46
  //#region Helper Methods
47
47
  export const getSearchResultCountersSingleCategory = (searchResults) => {
48
48
  // let totDcmtTypes = searchResults.length;
@@ -584,18 +584,17 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
584
584
  setIsOpenBatchUpdate(false);
585
585
  setIsModifiedBatchUpdate(false);
586
586
  await refreshSelectionDataRowsAsync();
587
- }, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), (showToppyForApprove && !showApprovePopup && !showRejectPopup && !showReAssignPopup && !showMoreInfoPopup && !openS4TViewer && !showTodoDcmtForm) &&
588
- _jsx(ToppyHelpCenter, { deviceType: deviceType, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => {
589
- setShowApprovePopup(true);
590
- }, onSignApprove: () => {
591
- handleSignApprove();
592
- }, onReject: () => {
593
- setShowRejectPopup(true);
594
- }, onReAssign: () => {
595
- setShowReAssignPopup(true);
596
- }, onMoreInfo: () => {
597
- setShowMoreInfoPopup(true);
598
- }, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), customButton && _jsx(TMCustomButton, { button: customButton, formData: currentMetadataValues, selectedItems: selectedItems, onClose: () => setCustomButton(undefined) }), showRelatedDcmtsChooser &&
587
+ }, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }), _jsx(ToppyDraggableHelpCenter, { initialIsCollapsed: false, deviceType: deviceType, usePortal: true, isVisible: showToppyForApprove && !showApprovePopup && !showRejectPopup && !showReAssignPopup && !showMoreInfoPopup && !openS4TViewer && !showTodoDcmtForm, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => {
588
+ setShowApprovePopup(true);
589
+ }, onSignApprove: () => {
590
+ handleSignApprove();
591
+ }, onReject: () => {
592
+ setShowRejectPopup(true);
593
+ }, onReAssign: () => {
594
+ setShowReAssignPopup(true);
595
+ }, onMoreInfo: () => {
596
+ setShowMoreInfoPopup(true);
597
+ }, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), customButton && _jsx(TMCustomButton, { button: customButton, formData: currentMetadataValues, selectedItems: selectedItems, onClose: () => setCustomButton(undefined) }), showRelatedDcmtsChooser &&
599
598
  _jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
600
599
  try {
601
600
  setShowRelatedDcmtsChooser(false);
@@ -163,7 +163,7 @@ const TMTaskForm = (props) => {
163
163
  newTaskDescriptor.isNew = 0;
164
164
  editTaskCallback(newTaskDescriptor);
165
165
  }
166
- else if (formDataOrig && formMode === FormModes.Create && taskContext?.dossier && currentTask) {
166
+ else if (formDataOrig && formMode === FormModes.Create && taskContext?.dossier && taskContext?.dossier?.origin === 'DossierAction' && currentTask) {
167
167
  setFieldsReadOnly({
168
168
  name: true,
169
169
  description: false,
@@ -378,7 +378,7 @@ const TMTaskForm = (props) => {
378
378
  if (formData.pdG !== PdGs.None)
379
379
  e.currentTarget.style.backgroundColor = '#f5f5f7';
380
380
  }, children: [_jsx("span", { style: { display: 'flex', alignItems: 'center' }, children: getPdgsIconMap().get(formData.pdG) }), _jsx("span", { children: getOriginLabel(formData.pdG, formData.iD1Name) })] }) }) }) }) })), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.Name, value: formData?.name ?? '', readOnly: fieldsReadOnly.name, autoFocus: true, maxLength: 100, isModifiedWhen: formData?.name !== formDataOrig?.name, onValueChanged: (e) => { setFormData({ ...formData ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }) }) }), _jsx("div", { style: { width: '100%' }, children: _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: formData?.description ?? '', maxLength: 200, readOnly: fieldsReadOnly.description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { setFormData({ ...formData ?? {}, description: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description), resize: false }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: (formMode === FormModes.Create || !areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) ?
381
- _jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo_Female, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo_Female), onValueChanged: (newValue) => {
381
+ _jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowShowAllUsers: !!taskContext?.dossier, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo_Female, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo_Female), onValueChanged: (newValue) => {
382
382
  if (newValue === undefined)
383
383
  return;
384
384
  setFormData({ ...formData ?? {}, toID: newValue[0] });
@@ -80,7 +80,7 @@ export const WorkFlowOperationButtons = (props) => {
80
80
  setIsSignWorkflow(false);
81
81
  }
82
82
  }, [dtd]);
83
- return (_jsx(StyledWorkFlowOperationButtonsContainer, { "$isMobile": isMobile, children: isSignWorkflow ? (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconSignaturePencil, {}), caption: SDKUI_Localizator.SignatureAndApprove, width: "160px", disabled: signApproveDisable, onClick: () => !signApproveDisable && onSignApprove?.(), advancedColor: "#1a9a49", color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: "info" })] })) : (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove?.(), advancedColor: "#1a9a49", color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign?.(), advancedColor: TMColors.tertiary, color: "tertiary" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: "info" })] })) }));
83
+ return (_jsx(StyledWorkFlowOperationButtonsContainer, { "$isMobile": isMobile, children: isSignWorkflow ? (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconSignaturePencil, {}), caption: SDKUI_Localizator.SignatureAndApprove, width: "160px", disabled: signApproveDisable, onClick: () => !signApproveDisable && onSignApprove?.(), onMouseDown: e => e.stopPropagation(), advancedColor: "#1a9a49", color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), onMouseDown: e => e.stopPropagation(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), onMouseDown: e => e.stopPropagation(), advancedColor: TMColors.info, color: "info" })] })) : (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove?.(), advancedColor: "#1a9a49", color: "success" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject?.(), advancedColor: TMColors.error, color: "error" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign?.(), advancedColor: TMColors.tertiary, color: "tertiary" }), _jsx(TMButton, { btnStyle: isMobile ? 'toolbar' : 'advanced', showTooltip: isMobile, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: "180px", disabled: infoDisable, onClick: () => !infoDisable && onMoreInfo?.(), advancedColor: TMColors.info, color: "info" })] })) }));
84
84
  };
85
85
  export const WorkFlowApproveRejectPopUp = ({ TID = 0, DID = 0, deviceType = DeviceType.DESKTOP, isReject, selectedItems = [], onClose, onCompleted }) => {
86
86
  const [commentValue, setCommentValue] = useState('');
@@ -11,7 +11,7 @@ import { TMColors } from '../../utils/theme';
11
11
  import TMValidationItemsList from '../grids/TMValidationItemsList';
12
12
  import TMModal from '../base/TMModal';
13
13
  import { DeviceType, useDeviceType } from '../base/TMDeviceProvider';
14
- const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipIsModifiedCheck = false, title, children, isModal, exception, customToolbarElements, hasNavigation, showSaveButton = true, customSaveButton, customTooltipSaveButton, showBackButton, showWarningsCount = true, showErrorCount = true, showUndoButton = true, onClose, onSaveAsync, onNext, onPrev, canNext, canPrev, isModified, onShowList, validationItems = [], onUndo, onCancel, width, height, askClosingConfirm = false, showTitleFormMode = true }) => {
14
+ const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipIsModifiedCheck = false, title, children, isModal, exception, customToolbarElements, hasNavigation, showSaveButton = true, customSaveButton, customTooltipSaveButton, showBackButton, showWarningsCount = true, showErrorCount = true, showUndoButton = true, onClose, onSaveAsync, onNext, onPrev, canNext, canPrev, isModified, onShowList, validationItems = [], onUndo, onCancel, width, height, askClosingConfirm = false, showTitleFormMode = true, showCloseButton = true }) => {
15
15
  const [showList, setShowList] = useState(true);
16
16
  const [showErrorGrid, setShowErrorGrid] = useState(false);
17
17
  const deviceType = useDeviceType();
@@ -110,7 +110,7 @@ const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipI
110
110
  _jsx("div", { style: { width: '100%', height: '100%', marginTop: '50px', display: 'flex', alignItems: 'center', justifyContent: 'center', flexDirection: 'column', color: getColor('error') }, children: 'Si è verificato un errore' })
111
111
  : _jsx(_Fragment, { children: children }) }), showErrorGrid && validationItems.length > 0 ? _jsx(TMCard, { scrollY: true, padding: false, showBorder: false, children: _jsx(TMValidationItemsList, { validationItems: validationItems }) }) : _jsx(_Fragment, {})] }) }), (isModal && onClose) && _jsx("div", { id: "TMSaveFormShowConfirmForClose-" + id })] }));
112
112
  };
113
- return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: `${title}${showTitleFormMode ? ` - ${LocalizeFormModes(formMode)}` : ''}`, onClose: doClose, width: width ?? '100%', height: height ?? '100%', hidePopup: false, askClosingConfirm: askClosingConfirm, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block' }, children: renderSaveForm() }) }) })
113
+ return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: `${title}${showTitleFormMode ? ` - ${LocalizeFormModes(formMode)}` : ''}`, onClose: doClose, width: width ?? '100%', height: height ?? '100%', hidePopup: false, askClosingConfirm: askClosingConfirm, showCloseButton: showCloseButton, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block' }, children: renderSaveForm() }) }) })
114
114
  : renderSaveForm() }));
115
115
  };
116
116
  export default TMSaveForm;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { BlogPost, HomeBlogPost, TaskDescriptor } from "@topconsultnpm/sdk-ts";
3
- import { DcmtInfo } from "../../ts";
2
+ import { BlogPost, HomeBlogPost, TaskDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
3
+ import { DcmtInfo, FormModes } from "../../ts";
4
4
  import { FileItem } from "../base/TMFileManagerUtils";
5
5
  import { TMBlogsPostHeader, TMBlogContextDescriptor } from "./TMBlogsPostUtils";
6
6
  interface TMBlogsPostProps {
@@ -41,6 +41,10 @@ interface TMBlogsPostProps {
41
41
  }>;
42
42
  /** Context descriptor for the blog component */
43
43
  context?: TMBlogContextDescriptor;
44
+ /** Array of participants */
45
+ participants?: Array<UserDescriptor>;
46
+ /** Callback function to be executed when a task is saved */
47
+ afterTaskSaved?: (task: TaskDescriptor | undefined, formMode: FormModes | undefined, forceRefresh?: boolean) => Promise<void>;
44
48
  /** Optional context menu params */
45
49
  contextMenuParams?: {
46
50
  isShowHideFilterEnabled: boolean;
@@ -74,14 +78,12 @@ interface TMBlogsPostProps {
74
78
  externalBlogPost?: BlogPost;
75
79
  /** Optional function to reset the external blog post */
76
80
  resetExternalBlogPost?: () => void;
77
- /** Optional function to update the selected blog post */
78
- updateSelectedBlogPosts?: (blogPosts: Array<BlogPost>) => void;
79
81
  visible?: boolean;
80
82
  allTasks?: Array<TaskDescriptor>;
81
83
  getAllTasks?: () => Promise<void>;
82
84
  deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
83
- addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
84
85
  editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
86
+ addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
85
87
  handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
86
88
  handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
87
89
  }