@topconsultnpm/sdkui-react 6.19.0-dev2.33 → 6.19.0-dev2.35

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.
@@ -59,6 +59,7 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
59
59
  dtd.init({ ...dtds[i] });
60
60
  const alias = tids?.[i].alias ?? '';
61
61
  dtd.customData2 = alias;
62
+ let mds;
62
63
  if (!qdShowOnlySelectItems) {
63
64
  dtd.metadata?.forEach((md) => {
64
65
  const mdWithKey = md;
@@ -66,6 +67,7 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
66
67
  mdWithKey.customData2 = alias;
67
68
  mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
68
69
  });
70
+ mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
69
71
  }
70
72
  else {
71
73
  let newMetadata = dtd.metadata?.filter(o => qd.select?.some(s => s.tid == dtd.id && s.mid == o.id && ((s.alias ?? '') == alias)));
@@ -75,8 +77,8 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
75
77
  mdWithKey.customData2 = alias;
76
78
  mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
77
79
  });
80
+ mds = filterMetadata ? newMetadata?.filter(filterMetadata) : newMetadata;
78
81
  }
79
- let mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
80
82
  dtdList.push({ ...dtd, metadata: mds });
81
83
  }
82
84
  }
@@ -14,6 +14,8 @@ interface ITMUserChooserProps extends ITMChooserProps {
14
14
  hideShowId?: boolean;
15
15
  /** Initial value for showChooser */
16
16
  initialShowChooser?: boolean;
17
+ /** Allow showing all users with toggle button */
18
+ allowShowAllUsers?: boolean;
17
19
  }
18
20
  declare const TMUserChooser: React.FunctionComponent<ITMUserChooserProps>;
19
21
  export default TMUserChooser;
@@ -24,6 +26,8 @@ interface ITMUserChooserFormProps extends ITMChooserFormProps<UserDescriptor> {
24
26
  hideRefresh?: boolean;
25
27
  /** Nascondi pulsante mostra ID */
26
28
  hideShowId?: boolean;
29
+ /** Allow showing all users with toggle button */
30
+ allowShowAllUsers?: boolean;
27
31
  }
28
32
  export declare const TMUserChooserForm: React.FunctionComponent<ITMUserChooserFormProps>;
29
33
  export declare const TMUserIdViewer: ({ userId, showIcon, noneSelectionText }: {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { OwnershipLevels, SDK_Localizator, UserLevels, UserListCacheService } from '@topconsultnpm/sdk-ts';
4
- import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels } from '../../helper';
4
+ import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels, IconShowAllUsersOff, IconShowAllUsers } from '../../helper';
5
5
  import { StyledDivHorizontal, StyledTooltipContainer, StyledTooltipSeparatorItem } from '../base/Styled';
6
6
  import TMSpinner from '../base/TMSpinner';
7
7
  import TMTooltip from '../base/TMTooltip';
@@ -9,7 +9,8 @@ import TMSummary from '../editors/TMSummary';
9
9
  import TMChooserForm from '../forms/TMChooserForm';
10
10
  import { TMColors } from '../../utils/theme';
11
11
  import { TMExceptionBoxManager } from '../base/TMPopUp';
12
- const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon, width, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton, initialShowChooser = false }) => {
12
+ import TMButton from '../base/TMButton';
13
+ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon, width, dataSource, backgroundColor, openChooserBySingleClick, buttons = [], disabled = false, showBorder = true, hideRefresh = false, hideShowId = false, elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, validationItems = [], onValueChanged, showClearButton, initialShowChooser = false, allowShowAllUsers = false }) => {
13
14
  const [showChooser, setShowChooser] = useState(initialShowChooser);
14
15
  useEffect(() => {
15
16
  setShowChooser(initialShowChooser);
@@ -20,13 +21,15 @@ const TMUserChooser = ({ labelColor, titleForm, filter, readOnly = false, icon,
20
21
  return (_jsxs(StyledDivHorizontal, { style: { minWidth: '125px', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [values && values.length > 0 && _jsx(TMUserIdViewer, { userId: values?.[0], showIcon: true, noneSelectionText: '' }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
21
22
  };
22
23
  return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, width: width, disabled: disabled, placeHolder: placeHolder, readOnly: readOnly, labelColor: labelColor, icon: icon, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
23
- _jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, onClose: () => {
24
+ _jsx(TMUserChooserForm, { title: titleForm, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, dataSource: dataSource, filter: filter, selectedIDs: values, hideRefresh: hideRefresh, hideShowId: hideShowId, allowShowAllUsers: allowShowAllUsers, onClose: () => {
24
25
  setShowChooser(false);
25
26
  summaryInputRef.current?.focus();
26
27
  }, onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
27
28
  };
28
29
  export default TMUserChooser;
29
- export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh = false, hideShowId = false, startWithShowOnlySelectedItems = true, filter, title, hasShowOnlySelectedItems, width, height, selectedIDs, dataSource, onClose, onChoose }) => {
30
+ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh = false, hideShowId = false, startWithShowOnlySelectedItems = true, filter, title, hasShowOnlySelectedItems, width, height, selectedIDs, dataSource, onClose, onChoose, allowShowAllUsers = false }) => {
31
+ const [currentDataSource, setCurrentDataSource] = useState(dataSource);
32
+ const [showingAllUsers, setShowingAllUsers] = useState(false);
30
33
  const dataColumns = useMemo(() => {
31
34
  return [
32
35
  { dataField: 'domain', caption: SDKUI_Localizator.Domain, dataType: 'string' },
@@ -42,6 +45,18 @@ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh
42
45
  TMSpinner.hide();
43
46
  return users;
44
47
  };
48
+ const handleToggleAllUsers = () => {
49
+ if (showingAllUsers) {
50
+ // Torna indietro: ripristina il dataSource originale
51
+ setCurrentDataSource(dataSource);
52
+ setShowingAllUsers(false);
53
+ }
54
+ else {
55
+ // Mostra tutti: rimuove il dataSource per usare getItems
56
+ setCurrentDataSource(undefined);
57
+ setShowingAllUsers(true);
58
+ }
59
+ };
45
60
  const getTitle = () => {
46
61
  let title = SDK_Localizator.Users;
47
62
  if (title)
@@ -49,7 +64,8 @@ export const TMUserChooserForm = ({ allowMultipleSelection, columns, hideRefresh
49
64
  return title;
50
65
  };
51
66
  const cellRenderIcon = (data) => _jsx(TMUserIcon, { ud: data.data });
52
- return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: allowMultipleSelection, startWithShowOnlySelectedItems: startWithShowOnlySelectedItems, hasShowOnlySelectedItems: hasShowOnlySelectedItems, width: width, height: height, manageUseLocalizedName: false, columns: columns ?? dataColumns, showDefaultColumns: false, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: dataSource, getItems: getItems, hasShowId: !hideShowId, hideRefresh: hideRefresh, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
67
+ const customButton = (allowShowAllUsers && dataSource) ? (_jsx(TMButton, { btnStyle: 'toolbar', caption: showingAllUsers ? SDKUI_Localizator.HideAll : SDKUI_Localizator.ShowAll, onClick: handleToggleAllUsers, icon: showingAllUsers ? _jsx(IconShowAllUsersOff, {}) : _jsx(IconShowAllUsers, {}) })) : undefined;
68
+ return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: allowMultipleSelection, startWithShowOnlySelectedItems: startWithShowOnlySelectedItems, hasShowOnlySelectedItems: hasShowOnlySelectedItems, width: width, height: height, manageUseLocalizedName: false, columns: columns ?? dataColumns, showDefaultColumns: false, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: currentDataSource, getItems: getItems, hasShowId: !hideShowId, hideRefresh: hideRefresh, customButtons: customButton, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
53
69
  };
54
70
  export const TMUserIdViewer = ({ userId, showIcon = false, noneSelectionText = `<${SDKUI_Localizator.NoneSelection}>` }) => {
55
71
  const [ud, setUd] = useState();
@@ -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; `;
@@ -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] });
@@ -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
  }
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useRef, useState } from "react";
3
- import { DossierEngine, LayoutModes, ResultTypes, SDK_Globals, WorkingGroupEngine } from "@topconsultnpm/sdk-ts";
3
+ import { DossierEngine, LayoutModes, ResultTypes, SDK_Globals, TaskDescriptor, WorkingGroupEngine } from "@topconsultnpm/sdk-ts";
4
4
  import { ContextMenu } from "devextreme-react";
5
- import { SDKUI_Localizator, Globalization, getExceptionMessage, TMConditionalWrapper } from "../../helper";
5
+ import { SDKUI_Localizator, Globalization, getExceptionMessage, TMConditionalWrapper, calcResponsiveSizes } from "../../helper";
6
6
  import TMToppyMessage from "../../helper/TMToppyMessage";
7
7
  import { useDcmtOperations } from "../../hooks/useDcmtOperations";
8
- import { DownloadTypes } from "../../ts";
8
+ import { DownloadTypes, FormModes } from "../../ts";
9
9
  import { TMColors } from "../../utils/theme";
10
10
  import ShowAlert from "../base/TMAlert";
11
11
  import { TMMessageBoxManager, ButtonNames } from "../base/TMPopUp";
@@ -14,12 +14,14 @@ import { TMLayoutWaitingContainer } from "../base/TMWaitPanel";
14
14
  import TMHtmlContentDisplay from "../editors/TMHtmlContentDisplay";
15
15
  import TMDcmtForm from "../features/documents/TMDcmtForm";
16
16
  import { TMResultManager } from "../forms/TMResultDialog";
17
- import { isHeaderFullyHidden, TMBlogsFilterCategoryId, getDcmtTypeDescriptor, findFileItemByDraftID, BlogPostTitle, NewBadge } from "./TMBlogsPostUtils";
17
+ import { isHeaderFullyHidden, TMBlogsFilterCategoryId, getDcmtTypeDescriptor, findFileItemByDraftID, BlogPostTitle, NewBadge, stripHtml } from "./TMBlogsPostUtils";
18
18
  import TMBlogAttachments from "./TMBlogAttachments";
19
19
  import TMBlogHeader from "./TMBlogHeader";
20
+ import TMTaskForm from "../features/tasks/TMTaskForm";
21
+ import { useDeviceType } from "../base/TMDeviceProvider";
20
22
  let localAbortController = new AbortController();
21
23
  const TMBlogsPost = (props) => {
22
- const { scrollToSelected, id, posts, displayMode = "stacked", height = "100%", width = "100%", scrollToBottom = true, header, showExtendedAttachments = true, treeFs, draftLatestInfoMap, archivedDocumentMap, context, contextMenuParams = {
24
+ const { scrollToSelected, id, posts, displayMode = "stacked", height = "100%", width = "100%", scrollToBottom = true, header, showExtendedAttachments = true, treeFs, draftLatestInfoMap, archivedDocumentMap, context, participants, contextMenuParams = {
23
25
  isShowHideFilterEnabled: true,
24
26
  isShowHideIDEnaled: true,
25
27
  isCommentEnabled: false,
@@ -30,8 +32,10 @@ const TMBlogsPost = (props) => {
30
32
  isRestoreEnabled: false,
31
33
  isRefreshEnabled: false,
32
34
  isCreateContextualTask: false,
33
- }, showFloatingCommentButton = false, showCommentFormCallback, showTaskFormCallback, refreshCallback, showId, setShowId, refreshHomePageNews, markBlogAsRead, externalBlogPost, resetExternalBlogPost, updateSelectedBlogPosts, visible = true, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, } = props;
35
+ }, showFloatingCommentButton = false, showCommentFormCallback, refreshCallback, showId, setShowId, refreshHomePageNews, markBlogAsRead, externalBlogPost, resetExternalBlogPost, visible = true, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, afterTaskSaved, handleNavigateToWGs, handleNavigateToDossiers, } = props;
34
36
  const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
37
+ // Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
38
+ const deviceType = useDeviceType();
35
39
  const bottomRef = useRef(null);
36
40
  const containerRef = useRef(null);
37
41
  // State to manage the layout mode of the document form
@@ -58,6 +62,10 @@ const TMBlogsPost = (props) => {
58
62
  const [focusedItem, setFocusedItem] = useState(undefined);
59
63
  // State to manage the focused file
60
64
  const [focusedAttachment, setFocusedAttachment] = useState(undefined);
65
+ const [taskContext, setTaskContext] = useState(undefined);
66
+ const [currentTask, setCurrentTask] = useState(new TaskDescriptor());
67
+ // State to manage show task form selected file
68
+ const [showTaskForm, setShowTaskForm] = useState(false);
61
69
  // State to manage show selected file
62
70
  const [dcmtForm, setDcmtForm] = useState({ show: false, dcmt: undefined });
63
71
  const [anchorEl, setAnchorEl] = useState(null);
@@ -79,11 +87,26 @@ const TMBlogsPost = (props) => {
79
87
  markBlogAsRead(item[0]);
80
88
  }
81
89
  setSelectedItem(item ? item : []);
82
- updateSelectedBlogPosts?.(item ? item : []);
83
90
  };
84
91
  const handleFocusedAttachment = (attachment) => {
85
92
  setFocusedAttachment(attachment);
86
93
  };
94
+ useEffect(() => {
95
+ if (context === undefined)
96
+ return;
97
+ if (context.engine === 'WorkingGroupEngine' && context.object) {
98
+ setTaskContext({ workingGroup: { id: context?.object?.id ?? 0, name: context?.object?.name ?? '' } });
99
+ return;
100
+ }
101
+ if (context.engine === 'DossierEngine' && context.object) {
102
+ setTaskContext({ dossier: { id: context?.object?.id ?? 0, name: context?.object?.name ?? '' } });
103
+ return;
104
+ }
105
+ if (context.engine === 'SearchEngine' && context.object) {
106
+ setTaskContext({ document: { tid: context?.object?.tid ?? 0, did: context?.object?.did ?? 0, name: '' } });
107
+ return;
108
+ }
109
+ }, [context]);
87
110
  useEffect(() => {
88
111
  if (externalBlogPost && externalBlogPost.id) {
89
112
  const foundPost = blogPosts.find(post => post.id === externalBlogPost.id);
@@ -434,6 +457,27 @@ const TMBlogsPost = (props) => {
434
457
  }
435
458
  });
436
459
  };
460
+ const openTaskFormCallback = useCallback((targetItem) => {
461
+ const task = new TaskDescriptor();
462
+ const cleanText = stripHtml(targetItem?.description ?? '');
463
+ task.name = cleanText.slice(0, 100);
464
+ setCurrentTask(task);
465
+ setShowTaskForm(true);
466
+ }, []);
467
+ const closeTaskFormCallback = useCallback(() => {
468
+ setShowTaskForm(false);
469
+ }, []);
470
+ const onSavedTaskFormCallback = (task) => {
471
+ if (task) {
472
+ addTaskCallback?.(task);
473
+ setShowTaskForm(false);
474
+ afterTaskSaved?.(task, FormModes.Create);
475
+ ShowAlert({ message: SDKUI_Localizator.TaskSavedSuccessfully.replaceParams(task.name ?? '-'), mode: 'success', title: SDKUI_Localizator.Widget_Activities, duration: 3000 });
476
+ }
477
+ else {
478
+ ShowAlert({ message: SDKUI_Localizator.TaskSaveError, mode: 'error', title: SDKUI_Localizator.Widget_Activities, duration: 3000 });
479
+ }
480
+ };
437
481
  // Open document form
438
482
  const openDcmtForm = (dcmtInfo) => {
439
483
  setDcmtForm({ show: true, dcmt: dcmtInfo });
@@ -507,11 +551,11 @@ const TMBlogsPost = (props) => {
507
551
  onClick: () => { copyInClipboard(targetItem); }
508
552
  });
509
553
  }
510
- if (contextMenuParams.isCreateContextualTask && showTaskFormCallback) {
554
+ if (contextMenuParams.isCreateContextualTask) {
511
555
  menuItems.push({
512
556
  text: SDKUI_Localizator.CreateContextualTask,
513
557
  icon: 'plus',
514
- onClick: () => showTaskFormCallback(),
558
+ onClick: () => openTaskFormCallback(targetItem),
515
559
  disabled: isGroupArchived ? true : false,
516
560
  beginGroup: true
517
561
  });
@@ -614,7 +658,7 @@ const TMBlogsPost = (props) => {
614
658
  boxShadow: isFocused ? "0 4px 12px rgba(19, 85, 150, 0.6)" : "none",
615
659
  cursor: 'pointer',
616
660
  }, children: [_jsx(BlogPostTitle, { displayMode: displayMode, layoutMode: layoutMode, blogPost: blogPost, isSelected: isSelected, isOwnComment: isOwnComment, searchText: searchText, isSys: isSys, isHomeBlogPost: isHomeBlogPost, showId: localShowId, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), isNew && _jsx(NewBadge, { layoutMode: layoutMode }), _jsx("div", { style: { fontSize: '1rem', color: "#000", marginTop: "10px", overflow: "hidden" }, children: _jsx(TMHtmlContentDisplay, { markup: blogPost.description ?? '-', searchText: searchText, isSelected: isSelected }) }), showExtendedAttachments && blogPost.attachments && blogPost.attachments.length > 0 && (_jsx(TMBlogAttachments, { contextMenuParams: contextMenuParams, attachments: blogPost.attachments, layoutMode: layoutMode, isSelected: isSelected, searchText: searchText, dcmtTypeDescriptors: dcmtTypeDescriptors, treeFs: treeFs, draftLatestInfoMap: draftLatestInfoMap, archivedDocumentMap: archivedDocumentMap, context: context, handleAttachmentFocus: handleFocusedAttachment, openDcmtForm: openDcmtForm }))] }, `${id}-blogpost-${blogPost.id}`) })] }, "blog-post-wrapper-" + id + "-" + blogPost.id);
617
- }), _jsx("div", { ref: bottomRef }), anchorEl && _jsx("div", { style: { position: 'fixed', zIndex: 9999 }, children: _jsx(ContextMenu, { dataSource: menuItems, target: anchorEl, onHiding: closeContextMenu }) })] }), (dcmtForm.dcmt && dcmtForm.dcmt.TID && dcmtForm.dcmt.DID) && _jsx(TMDcmtForm, { TID: Number(dcmtForm.dcmt.TID), DID: Number(dcmtForm.dcmt.DID), layoutMode: LayoutModes.Update, onClose: closeDcmtForm, isClosable: true, titleModal: SDKUI_Localizator.Attachment + ": " + dcmtForm.dcmt.fileName, isModal: true, widthModal: "95%", heightModal: "95%", allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showFloatingCommentButton && showCommentFormCallback && !(context?.engine === 'WorkingGroupEngine' && context?.object?.customData1 === 1)) && _jsx("button", { style: {
661
+ }), _jsx("div", { ref: bottomRef }), anchorEl && _jsx("div", { style: { position: 'fixed', zIndex: 9999 }, children: _jsx(ContextMenu, { dataSource: menuItems, target: anchorEl, onHiding: closeContextMenu }) })] }), (showTaskForm && handleNavigateToWGs && handleNavigateToDossiers && getAllTasks && deleteTaskByIdsCallback && addTaskCallback && editTaskCallback) && _jsx("div", { style: { height: "100%", width: "100%" }, children: _jsx(TMTaskForm, { id: -1, title: SDKUI_Localizator.ContextualTask, isModal: true, width: calcResponsiveSizes(deviceType, '700px', '700px', '95%'), height: calcResponsiveSizes(deviceType, '670px', '80%', '95%'), formMode: FormModes.Create, visualizedTasks: [], currentTask: currentTask, setCurrentTask: () => { }, selectedRowKeys: [], handleFocusedRowKeyChange: () => { }, onStatusChanged: () => { }, onSaved: onSavedTaskFormCallback, onClose: () => closeTaskFormCallback(), onCancel: () => closeTaskFormCallback(), usersList: participants, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, isContextualCreate: true, taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback }) }), (dcmtForm.dcmt && dcmtForm.dcmt.TID && dcmtForm.dcmt.DID) && _jsx(TMDcmtForm, { TID: Number(dcmtForm.dcmt.TID), DID: Number(dcmtForm.dcmt.DID), layoutMode: LayoutModes.Update, onClose: closeDcmtForm, isClosable: true, titleModal: SDKUI_Localizator.Attachment + ": " + dcmtForm.dcmt.fileName, isModal: true, widthModal: "95%", heightModal: "95%", allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), (showFloatingCommentButton && showCommentFormCallback && !(context?.engine === 'WorkingGroupEngine' && context?.object?.customData1 === 1)) && _jsx("button", { style: {
618
662
  position: 'absolute',
619
663
  bottom: '18px',
620
664
  right: '20px',
@@ -110,4 +110,5 @@ interface BlogPostTitleProps {
110
110
  handleNavigateToDossiers?: (blogPost: BlogPost | HomeBlogPost) => void;
111
111
  }
112
112
  export declare const BlogPostTitle: (props: BlogPostTitleProps) => import("react/jsx-runtime").JSX.Element;
113
+ export declare const stripHtml: (html: string) => string;
113
114
  export {};
@@ -248,3 +248,13 @@ export const BlogPostTitle = (props) => {
248
248
  ...getCompactEllipsisStyle(layoutMode)
249
249
  }, children: highlightText(subtitle, searchText, isSelected) }))] })] });
250
250
  };
251
+ export const stripHtml = (html) => {
252
+ try {
253
+ const doc = new DOMParser().parseFromString(html, 'text/html');
254
+ return doc.body.textContent || '';
255
+ }
256
+ catch (error) {
257
+ // Se qualcosa va storto, restituisci l'HTML originale
258
+ return html;
259
+ }
260
+ };
@@ -285,6 +285,7 @@ export declare class SDKUI_Localizator {
285
285
  static get GoToToday(): "Gehe zu heute" | "Go to today" | "Ir a hoy" | "Aller à aujourd'hui" | "Ir para hoje" | "Vai a oggi";
286
286
  static get Grids(): string;
287
287
  static get Hide_CompleteName(): "Vollständigen Namen ausblenden" | "Hide full name" | "Ocultar nombre completo" | "Masquer le nom complet" | "Ocultar nome completo" | "Nascondi nome completo";
288
+ static get HideAll(): "Alle ausblenden" | "Hide all" | "Ocultar todo" | "Masquer tout" | "Ocultar tudo" | "Nascondi tutti";
288
289
  static get HideFloatingBar(): string;
289
290
  static get HideFilters(): string;
290
291
  static get HideLeftPanel(): "Linkes Panel ausblenden" | "Hide left panel" | "Ocultar panel izquierdo" | "Masquer le panneau de gauche" | "Ocultar painel esquerdo" | "Nascondi il pannello sinistro";
@@ -2779,6 +2779,16 @@ export class SDKUI_Localizator {
2779
2779
  default: return "Nascondi nome completo";
2780
2780
  }
2781
2781
  }
2782
+ static get HideAll() {
2783
+ switch (this._cultureID) {
2784
+ case CultureIDs.De_DE: return "Alle ausblenden";
2785
+ case CultureIDs.En_US: return "Hide all";
2786
+ case CultureIDs.Es_ES: return "Ocultar todo";
2787
+ case CultureIDs.Fr_FR: return "Masquer tout";
2788
+ case CultureIDs.Pt_PT: return "Ocultar tudo";
2789
+ default: return "Nascondi tutti";
2790
+ }
2791
+ }
2782
2792
  static get HideFloatingBar() {
2783
2793
  switch (this._cultureID) {
2784
2794
  case CultureIDs.De_DE: return "Floating-Leiste ausblenden";
@@ -134,6 +134,8 @@ declare function IconImport(props: React.SVGProps<SVGSVGElement>): import("react
134
134
  declare function IconPalette(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
135
135
  declare function IconFastSearch(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
136
136
  declare function IconUserGroup(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
137
+ export declare function IconShowAllUsers(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
138
+ export declare function IconShowAllUsersOff(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
137
139
  declare function IconUserGroupOutline(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
138
140
  declare function IconBoard(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
139
141
  declare function IconActivity(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -405,6 +405,15 @@ function IconFastSearch(props) {
405
405
  function IconUserGroup(props) {
406
406
  return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 640 512", fill: "currentColor", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M352 128c0 70.7-57.3 128-128 128S96 198.7 96 128 153.3 0 224 0s128 57.3 128 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4c98.5 0 178.3 79.8 178.3 178.3 0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM609.3 512H471.4c5.4-9.4 8.6-20.3 8.6-32v-8c0-60.7-27.1-115.2-69.8-151.8 2.4-.1 4.7-.2 7.1-.2h61.4c89.1 0 161.3 72.2 161.3 161.3 0 17-13.8 30.7-30.7 30.7zM432 256c-31 0-59-12.6-79.3-32.9 19.7-26.6 31.3-59.5 31.3-95.1 0-26.8-6.6-52.1-18.3-74.3C384.3 40.1 407.2 32 432 32c61.9 0 112 50.1 112 112s-50.1 112-112 112z" }), " "] }));
407
407
  }
408
+ export function IconShowAllUsers(props) {
409
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", fontSize: props.fontSize ? props.fontSize : FONTSIZE, ...props, children: _jsx("path", { fill: "currentColor", d: "M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5S5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05c1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5" }) }));
410
+ }
411
+ export function IconShowAllUsersOff(props) {
412
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", fontSize: props.fontSize ? props.fontSize : FONTSIZE, ...props, children: _jsx("path", { fill: "currentColor", d: "M15 8c0-1.42-.5-2.73-1.33-3.76c.42-.14.86-.24 1.33-.24c2.21 0 4 1.79 4 4s-1.79 4-4 4h-.18l-.77-.77c.6-.94.95-2.05.95-3.23m7.83 12H23v-3c0-2.18-3.58-3.47-6.34-3.87c1.1.75 1.95 1.71 2.23 2.94zM7.24 4.41a3.996 3.996 0 0 1 5.35 5.35zM9.17 12H9c-2.21 0-4-1.79-4-4v-.17L.69 3.51L2.1 2.1l19.8 19.8l-1.41 1.41L17 19.83V20H1v-3c0-2.66 5.33-4 8-4c.37 0 .8.03 1.25.08z" }) }));
413
+ }
414
+ function IconUserGroupSlash(props) {
415
+ return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 640 512", fill: "currentColor", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M352 128c0 70.7-57.3 128-128 128S96 198.7 96 128 153.3 0 224 0s128 57.3 128 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4c98.5 0 178.3 79.8 178.3 178.3 0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM609.3 512H471.4c5.4-9.4 8.6-20.3 8.6-32v-8c0-60.7-27.1-115.2-69.8-151.8 2.4-.1 4.7-.2 7.1-.2h61.4c89.1 0 161.3 72.2 161.3 161.3 0 17-13.8 30.7-30.7 30.7zM432 256c-31 0-59-12.6-79.3-32.9 19.7-26.6 31.3-59.5 31.3-95.1 0-26.8-6.6-52.1-18.3-74.3C384.3 40.1 407.2 32 432 32c61.9 0 112 50.1 112 112s-50.1 112-112 112z" }), " ", _jsx("line", { x1: "0", y1: "512", x2: "640", y2: "0", stroke: "currentColor", strokeWidth: "40" }), " "] }));
416
+ }
408
417
  function IconUserGroupOutline(props) {
409
418
  return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 640 512", fill: "white", stroke: "black", strokeWidth: "40", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M352 128c0 70.7-57.3 128-128 128S96 198.7 96 128 153.3 0 224 0s128 57.3 128 128zM0 482.3C0 383.8 79.8 304 178.3 304h91.4c98.5 0 178.3 79.8 178.3 178.3 0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3zM609.3 512H471.4c5.4-9.4 8.6-20.3 8.6-32v-8c0-60.7-27.1-115.2-69.8-151.8 2.4-.1 4.7-.2 7.1-.2h61.4c89.1 0 161.3 72.2 161.3 161.3 0 17-13.8 30.7-30.7 30.7zM432 256c-31 0-59-12.6-79.3-32.9 19.7-26.6 31.3-59.5 31.3-95.1 0-26.8-6.6-52.1-18.3-74.3C384.3 40.1 407.2 32 432 32c61.9 0 112 50.1 112 112s-50.1 112-112 112z" }), " "] }));
410
419
  }
package/lib/ts/types.d.ts CHANGED
@@ -112,6 +112,7 @@ export type TaskContext = {
112
112
  dossier?: {
113
113
  id: number;
114
114
  name: string;
115
+ origin?: string;
115
116
  };
116
117
  document?: {
117
118
  tid: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.19.0-dev2.33",
3
+ "version": "6.19.0-dev2.35",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",