@topconsultnpm/sdkui-react 6.19.0-dev1.9 → 6.19.0-dev2.2

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 (116) hide show
  1. package/lib/components/base/Styled.d.ts +1 -0
  2. package/lib/components/base/Styled.js +40 -0
  3. package/lib/components/base/TMCustomButton.d.ts +11 -0
  4. package/lib/components/base/TMCustomButton.js +63 -0
  5. package/lib/components/base/TMFileManagerDataGridView.js +4 -1
  6. package/lib/components/base/TMLayout.d.ts +2 -1
  7. package/lib/components/base/TMLayout.js +2 -2
  8. package/lib/components/base/TMPopUp.js +5 -18
  9. package/lib/components/base/TMTreeView.js +3 -2
  10. package/lib/components/editors/TMHtmlEditor.d.ts +5 -0
  11. package/lib/components/editors/TMHtmlEditor.js +72 -12
  12. package/lib/components/editors/TMMetadataValues.js +90 -40
  13. package/lib/components/features/archive/TMArchive.d.ts +10 -0
  14. package/lib/components/features/archive/TMArchive.js +56 -25
  15. package/lib/components/features/blog/TMBlogCommentForm.d.ts +4 -4
  16. package/lib/components/features/blog/TMBlogCommentForm.js +76 -51
  17. package/lib/components/features/documents/TMDcmtBlog.d.ts +15 -0
  18. package/lib/components/features/documents/TMDcmtBlog.js +21 -33
  19. package/lib/components/features/documents/TMDcmtForm.d.ts +17 -3
  20. package/lib/components/features/documents/TMDcmtForm.js +205 -46
  21. package/lib/components/features/documents/TMDcmtTasks.d.ts +13 -0
  22. package/lib/components/features/documents/TMDcmtTasks.js +24 -0
  23. package/lib/components/features/documents/TMDragDropOverlay.js +2 -1
  24. package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +8 -1
  25. package/lib/components/features/documents/TMMasterDetailDcmts.js +6 -6
  26. package/lib/components/features/documents/TMRelationViewer.d.ts +53 -3
  27. package/lib/components/features/documents/TMRelationViewer.js +232 -85
  28. package/lib/components/features/search/TMSearch.d.ts +10 -1
  29. package/lib/components/features/search/TMSearch.js +14 -5
  30. package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -1
  31. package/lib/components/features/search/TMSearchQueryPanel.js +36 -7
  32. package/lib/components/features/search/TMSearchResult.d.ts +10 -1
  33. package/lib/components/features/search/TMSearchResult.js +140 -422
  34. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -2
  35. package/lib/components/features/search/TMSearchResultsMenuItems.js +33 -8
  36. package/lib/components/features/tasks/TMTaskForm.d.ts +38 -0
  37. package/lib/components/features/tasks/TMTaskForm.js +386 -0
  38. package/lib/components/features/tasks/TMTasksAgenda.d.ts +17 -0
  39. package/lib/components/features/tasks/TMTasksAgenda.js +107 -0
  40. package/lib/components/features/tasks/TMTasksCalendar.d.ts +21 -0
  41. package/lib/components/features/tasks/TMTasksCalendar.js +240 -0
  42. package/lib/components/features/tasks/TMTasksHeader.d.ts +14 -0
  43. package/lib/components/features/tasks/TMTasksHeader.js +37 -0
  44. package/lib/components/features/tasks/TMTasksPanelContent.d.ts +20 -0
  45. package/lib/components/features/tasks/TMTasksPanelContent.js +65 -0
  46. package/lib/components/features/tasks/TMTasksUtils.d.ts +132 -0
  47. package/lib/components/features/tasks/TMTasksUtils.js +634 -0
  48. package/lib/components/features/tasks/TMTasksUtilsView.d.ts +39 -0
  49. package/lib/components/features/tasks/TMTasksUtilsView.js +118 -0
  50. package/lib/components/features/tasks/TMTasksView.d.ts +40 -0
  51. package/lib/components/features/tasks/TMTasksView.js +560 -0
  52. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +3 -1
  53. package/lib/components/features/workflow/TMWorkflowPopup.js +19 -6
  54. package/lib/components/features/workflow/diagram/RecipientList.js +4 -3
  55. package/lib/components/forms/Login/Chooser.js +1 -1
  56. package/lib/components/forms/TMChooserForm.d.ts +1 -1
  57. package/lib/components/forms/TMChooserForm.js +2 -2
  58. package/lib/components/grids/TMBlogAttachments.d.ts +42 -0
  59. package/lib/components/grids/TMBlogAttachments.js +43 -0
  60. package/lib/components/grids/TMBlogHeader.d.ts +31 -0
  61. package/lib/components/grids/TMBlogHeader.js +41 -0
  62. package/lib/components/grids/{TMBlogs.d.ts → TMBlogsPost.d.ts} +42 -58
  63. package/lib/components/grids/TMBlogsPost.js +628 -0
  64. package/lib/components/grids/{TMBlogsUtils.d.ts → TMBlogsPostUtils.d.ts} +61 -47
  65. package/lib/components/grids/{TMBlogsUtils.js → TMBlogsPostUtils.js} +146 -124
  66. package/lib/components/index.d.ts +14 -1
  67. package/lib/components/index.js +15 -1
  68. package/lib/components/layout/panelManager/TMPanelManagerContext.js +7 -0
  69. package/lib/components/settings/SettingsAppearance.js +8 -0
  70. package/lib/components/viewers/TMTidViewer.js +20 -2
  71. package/lib/css/tm-sdkui.css +1 -1
  72. package/lib/helper/SDKUI_Globals.d.ts +4 -1
  73. package/lib/helper/SDKUI_Globals.js +10 -1
  74. package/lib/helper/SDKUI_Localizator.d.ts +62 -4
  75. package/lib/helper/SDKUI_Localizator.js +618 -25
  76. package/lib/helper/TMCustomSearchBar.d.ts +8 -0
  77. package/lib/helper/TMCustomSearchBar.js +54 -0
  78. package/lib/helper/TMIcons.d.ts +2 -0
  79. package/lib/helper/TMIcons.js +6 -0
  80. package/lib/helper/TMImageLibrary.d.ts +3 -2
  81. package/lib/helper/TMImageLibrary.js +230 -230
  82. package/lib/helper/TMToppyMessage.d.ts +7 -0
  83. package/lib/helper/TMToppyMessage.js +42 -0
  84. package/lib/helper/TMUtils.d.ts +10 -1
  85. package/lib/helper/TMUtils.js +42 -1
  86. package/lib/helper/dcmtsHelper.d.ts +2 -0
  87. package/lib/helper/dcmtsHelper.js +18 -0
  88. package/lib/helper/helpers.js +1 -0
  89. package/lib/helper/index.d.ts +1 -0
  90. package/lib/helper/index.js +1 -0
  91. package/lib/hooks/useRelatedDocuments.d.ts +72 -0
  92. package/lib/hooks/useRelatedDocuments.js +655 -0
  93. package/lib/index.d.ts +1 -0
  94. package/lib/index.js +1 -0
  95. package/lib/ts/types.d.ts +14 -0
  96. package/lib/ts/types.js +15 -0
  97. package/lib/utils/theme.d.ts +1 -0
  98. package/lib/utils/theme.js +1 -0
  99. package/package.json +7 -7
  100. package/lib/components/grids/TMBlogs.js +0 -721
  101. package/lib/stories/TMButton.stories.d.ts +0 -4
  102. package/lib/stories/TMButton.stories.js +0 -29
  103. package/lib/stories/TMDataGrid.stories.d.ts +0 -9
  104. package/lib/stories/TMDataGrid.stories.js +0 -310
  105. package/lib/stories/TMHtmlContentDisplay.stories.d.ts +0 -6
  106. package/lib/stories/TMHtmlContentDisplay.stories.js +0 -45
  107. package/lib/stories/TMHtmlEditor.stories.d.ts +0 -6
  108. package/lib/stories/TMHtmlEditor.stories.js +0 -49
  109. package/lib/stories/TMIcons.stories.d.ts +0 -4
  110. package/lib/stories/TMIcons.stories.js +0 -13
  111. package/lib/stories/TMSDKUI_Localizator.stories.d.ts +0 -4
  112. package/lib/stories/TMSDKUI_Localizator.stories.js +0 -123
  113. package/lib/stories/TMStoriesUtils.d.ts +0 -1
  114. package/lib/stories/TMStoriesUtils.js +0 -10
  115. package/lib/stories/TMUserAvatar.stories.d.ts +0 -6
  116. package/lib/stories/TMUserAvatar.stories.js +0 -20
@@ -0,0 +1,118 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { PdGs, Priorities, SDK_Globals, Task_States } from '@topconsultnpm/sdk-ts';
4
+ import { Extended_Task_States, FilterCategoryId, filterTreeTask, gotoPDGExtendedLabel, prioritiesResourceData, taskIsExpiringSoon } from "./TMTasksUtils";
5
+ import { getPdgsIconMap, SDKUI_Localizator, TMConditionalWrapper } from "../../../helper";
6
+ import { FormModes } from "../../../ts";
7
+ import TMTooltip from "../../base/TMTooltip";
8
+ const taskStateIconClassMap = () => {
9
+ return new Map([
10
+ [Task_States.None, "dx-icon-isblank"],
11
+ [Task_States.NotStarted, "dx-icon-isblank"],
12
+ [Task_States.InProgress, "dx-icon-refresh"],
13
+ [Task_States.Completed, "dx-icon-check"],
14
+ [Task_States.Waiting, "dx-icon-taskstop"],
15
+ [Task_States.Deferred, "dx-icon-clock"],
16
+ ]);
17
+ };
18
+ export const taskStateIconMap = (fontSize = 20) => {
19
+ return new Map([
20
+ [Task_States.None, _jsx("i", { style: { fontSize }, className: taskStateIconClassMap().get(Task_States.None) }, "Task_States-None")],
21
+ [Task_States.NotStarted, _jsx("i", { style: { fontSize }, className: taskStateIconClassMap().get(Task_States.NotStarted) }, "Task_States-NotStarted")],
22
+ [Task_States.InProgress, _jsx("i", { style: { fontSize }, className: taskStateIconClassMap().get(Task_States.InProgress) }, "Task_States-InProgress")],
23
+ [Task_States.Completed, _jsx("i", { style: { fontSize }, className: taskStateIconClassMap().get(Task_States.Completed) }, "Task_States-Completed")],
24
+ [Task_States.Waiting, _jsx("i", { style: { fontSize }, className: taskStateIconClassMap().get(Task_States.Waiting) }, "Task_States-Waiting")],
25
+ [Task_States.Deferred, _jsx("i", { style: { fontSize }, className: taskStateIconClassMap().get(Task_States.Deferred) }, "Task_States-Deferred")]
26
+ ]);
27
+ };
28
+ export const calculateNumberOfDays = (startTime, endTime) => {
29
+ if (startTime && endTime) {
30
+ const diffTime = Math.abs(endTime.getTime() - startTime.getTime()); // Get the time difference in milliseconds
31
+ const diffDays = Math.ceil(diffTime / (1000 * 3600 * 24)); // Convert milliseconds to days
32
+ return diffDays;
33
+ }
34
+ return 0; // Return 0 if either startTime or endTime is missing
35
+ };
36
+ export const renderTaskIcons = (taskData) => {
37
+ const { stateLabel, stateTooltipLabel, pdg, ID1Name, endTime, remTime, isNew, numberOfDays } = taskData;
38
+ return (_jsxs(_Fragment, { children: [_jsxs(TMTooltip, { content: stateTooltipLabel, children: [" ", _jsx("div", { children: taskStateIconMap().get(stateLabel) })] }), _jsxs(TMTooltip, { content: gotoPDGExtendedLabel(false, pdg ?? PdGs.None, ID1Name), children: [" ", _jsx("div", { children: getPdgsIconMap().get(pdg) })] }), (stateLabel !== Task_States.Completed && endTime && taskIsExpiringSoon(endTime, remTime)) && _jsx(TMTooltip, { content: SDKUI_Localizator.Expiring, children: _jsx("i", { style: { fontSize: "24px" }, className: "dx-icon-warning" }) }), numberOfDays > 1 && _jsx("i", { title: SDKUI_Localizator.ActivityOverMultipleDays.replaceParams(numberOfDays), style: { fontSize: 20 }, className: "dx-icon-unselectall" }), isNew && _jsx(TMTooltip, { content: SDKUI_Localizator.NewAssignedActivity, children: _jsx("i", { style: { fontSize: "24px" }, className: "dx-icon-bell" }) })] }));
39
+ };
40
+ export const TMActionCalendar = (props) => {
41
+ const { currentTask, openTaskForm, onDeleteCallback } = props;
42
+ const [editButtonColor, setEditButtonColor] = useState('#ffc107');
43
+ const [deleteButtonColor, setDeleteButtonColor] = useState('#dc3545');
44
+ const handleMouseEnter = (colorSetter, hoverColor) => {
45
+ colorSetter(hoverColor);
46
+ };
47
+ const handleMouseLeave = (colorSetter, originalColor) => {
48
+ colorSetter(originalColor);
49
+ };
50
+ const showDeleteButton = currentTask.fromID === SDK_Globals.tmSession?.SessionDescr?.userID;
51
+ const renderButton = (color, setColor, hoverColor, originalColor, iconClass, onClickHandler) => (_jsx("div", { style: {
52
+ fontSize: '3rem',
53
+ color: '#fff',
54
+ padding: '10px',
55
+ backgroundColor: color,
56
+ display: 'flex',
57
+ justifyContent: 'center',
58
+ alignItems: 'center',
59
+ width: '50px',
60
+ height: '50px',
61
+ transition: 'background-color 0.3s',
62
+ cursor: 'pointer'
63
+ }, onClick: (e) => { e.stopPropagation(); onClickHandler(); }, onMouseEnter: () => handleMouseEnter(setColor, hoverColor), onMouseLeave: () => handleMouseLeave(setColor, originalColor), children: _jsx("i", { className: iconClass }) }));
64
+ const onDeleteBtnCallback = (currentTask) => {
65
+ if (currentTask && currentTask.id) {
66
+ onDeleteCallback([currentTask.id]);
67
+ }
68
+ };
69
+ return (_jsxs("div", { style: { width: '30%', display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: 'default' }, children: [renderButton(editButtonColor, setEditButtonColor, '#e0a800', '#ffc107', 'dx-icon-edit', () => openTaskForm(FormModes.Update, currentTask)), showDeleteButton && (renderButton(deleteButtonColor, setDeleteButtonColor, '#c82333', '#dc3545', 'dx-icon-trash', () => onDeleteBtnCallback(currentTask)))] }));
70
+ };
71
+ export const priorityLegend = () => _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: prioritiesResourceData.map((priority) => (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx("span", { style: { backgroundColor: priority.color, width: '12px', height: '12px', display: 'inline-block', marginRight: '5px', borderRadius: '50%' } }), _jsx("span", { style: { fontSize: '14px' }, children: priority.text })] }, priority.text))) });
72
+ export const highlightTaskText = (text, search, taskId) => {
73
+ if (!search)
74
+ return text;
75
+ const regex = new RegExp(`(${search})`, 'gi');
76
+ const parts = text.split(regex);
77
+ return parts.map((part, index) => part.toLowerCase() === search.toLowerCase() ? (_jsx("span", { style: { color: "#fff", backgroundColor: '#0f6cbd' }, children: part }, taskId + "-" + index)) : (part));
78
+ };
79
+ export const treeFilterDataSource = (allTasks) => {
80
+ const allStatesLength = filterTreeTask(allTasks, [FilterCategoryId.AllStates]).length ?? 0;
81
+ const allPrioritiesLength = filterTreeTask(allTasks, [FilterCategoryId.AllPriorities]).length ?? 0;
82
+ const expiringLength = filterTreeTask(allTasks, [FilterCategoryId.Expiring]).length ?? 0;
83
+ const newAssignedLength = filterTreeTask(allTasks, [FilterCategoryId.NewAssignedActivities]).length ?? 0;
84
+ const newNotStartedLength = filterTreeTask(allTasks, [FilterCategoryId.New]).length ?? 0;
85
+ const inProgressLength = filterTreeTask(allTasks, [FilterCategoryId.InProgress]).length ?? 0;
86
+ const completedLength = filterTreeTask(allTasks, [FilterCategoryId.Completed]).length ?? 0;
87
+ const pendingLength = filterTreeTask(allTasks, [FilterCategoryId.Pending]).length ?? 0;
88
+ const postponedLength = filterTreeTask(allTasks, [FilterCategoryId.Postponed]).length ?? 0;
89
+ const lowLength = filterTreeTask(allTasks, [FilterCategoryId.Low]).length ?? 0;
90
+ const highLength = filterTreeTask(allTasks, [FilterCategoryId.High]).length ?? 0;
91
+ return [
92
+ { id: FilterCategoryId.AllStates, label: SDKUI_Localizator.AllStates + " (" + allStatesLength + ")", value: SDKUI_Localizator.AllStates, expanded: true },
93
+ { id: FilterCategoryId.AllPriorities, label: SDKUI_Localizator.AllPriorities + " (" + allPrioritiesLength + ")", value: SDKUI_Localizator.AllPriorities, expanded: true },
94
+ {
95
+ id: FilterCategoryId.Expiring, label: SDKUI_Localizator.Expiring + " (" + expiringLength + ")", value: Extended_Task_States.Expiring, categoryId: 1, tooltipContent: (_jsxs(_Fragment, { children: [_jsx("div", { style: { textAlign: "center" }, children: SDKUI_Localizator.ViewExpiringTasks }), _jsx("hr", {}), _jsxs("div", { style: { textAlign: "left" }, children: [SDKUI_Localizator.TaskConsideredExpiring, ":", _jsxs("ul", { children: [_jsxs("li", { children: ["- ", SDKUI_Localizator.EndDateMatchesToday] }), _jsxs("li", { children: ["- ", SDKUI_Localizator.EndDateSetForTomorrow] }), _jsxs("li", { children: ["- ", SDKUI_Localizator.ReminderSetForToday] })] })] })] }))
96
+ },
97
+ { id: FilterCategoryId.NewAssignedActivities, label: SDKUI_Localizator.NewAssignedActivities + " (" + newAssignedLength + ")", value: Extended_Task_States.NewAssignedActivities, categoryId: FilterCategoryId.AllStates },
98
+ { id: FilterCategoryId.New, label: SDKUI_Localizator.NewFemale + " (" + newNotStartedLength + ")", value: Task_States.NotStarted, categoryId: FilterCategoryId.AllStates },
99
+ { id: FilterCategoryId.InProgress, label: SDKUI_Localizator.InProgress + " (" + inProgressLength + ")", value: Task_States.InProgress, categoryId: FilterCategoryId.AllStates },
100
+ { id: FilterCategoryId.Completed, label: SDKUI_Localizator.Completed + " (" + completedLength + ")", value: Task_States.Completed, categoryId: FilterCategoryId.AllStates },
101
+ { id: FilterCategoryId.Pending, label: SDKUI_Localizator.Pending + " (" + pendingLength + ")", value: Task_States.Waiting, categoryId: FilterCategoryId.AllStates },
102
+ { id: FilterCategoryId.Postponed, label: SDKUI_Localizator.Postponed + " (" + postponedLength + ")", value: Task_States.Deferred, categoryId: FilterCategoryId.AllStates },
103
+ // Low = Low + Normal for backwards compatibility with version 5
104
+ { id: FilterCategoryId.Low, label: SDKUI_Localizator.Low + " (" + lowLength + ")", value: Priorities.Low, categoryId: FilterCategoryId.AllPriorities },
105
+ { id: FilterCategoryId.High, label: SDKUI_Localizator.High + " (" + highLength + ")", value: Priorities.High, categoryId: FilterCategoryId.AllPriorities },
106
+ ];
107
+ };
108
+ export const renderContextBlock = ({ condition, pdg, label, isMobile }) => {
109
+ if (!condition || !label)
110
+ return null;
111
+ return (_jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: (children) => (_jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children })), children: _jsx("div", { style: {
112
+ width: isMobile ? '100%' : '50%',
113
+ display: 'flex',
114
+ alignItems: 'center',
115
+ color: "#2559A5",
116
+ marginTop: 10
117
+ }, children: _jsxs(TMTooltip, { content: label, children: [_jsx("span", { children: getPdgsIconMap().get(pdg) }), "\u00A0", _jsx("span", { children: label })] }) }) }));
118
+ };
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import { AssignedTab, TaskViewType } from "./TMTasksUtils";
3
+ import { HomeBlogPost, TaskDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
4
+ import { DcmtInfo, FormModes, TaskContext } from "../../../ts";
5
+ interface TMTasksViewProps {
6
+ id: string;
7
+ allTasks: Array<TaskDescriptor>;
8
+ getAllTasks: () => Promise<void>;
9
+ deleteTaskByIdsCallback: (deletedTaskIds: Array<number>) => Promise<void>;
10
+ addTaskCallback: (task: TaskDescriptor) => Promise<void>;
11
+ editTaskCallback: (task: TaskDescriptor) => Promise<void>;
12
+ handleNavigateToWGs: (value: HomeBlogPost | number) => Promise<void>;
13
+ handleNavigateToDossiers: (value: HomeBlogPost | number) => Promise<void>;
14
+ visualizedTasks: Array<TaskDescriptor>;
15
+ activeComponent: TaskViewType;
16
+ activeTabIndex: AssignedTab;
17
+ setActiveTabIndex: React.Dispatch<React.SetStateAction<AssignedTab>>;
18
+ currentTask: TaskDescriptor | null;
19
+ setCurrentTask: React.Dispatch<React.SetStateAction<TaskDescriptor | null>>;
20
+ assignedToMeCount: number;
21
+ assignedByMeCount: number;
22
+ allTasksFilteredCount: number;
23
+ showId: boolean;
24
+ setShowId: React.Dispatch<React.SetStateAction<boolean>>;
25
+ showSearch: boolean;
26
+ setShowSearch: React.Dispatch<React.SetStateAction<boolean>>;
27
+ showContextualWG: boolean;
28
+ setShowContextualWG: React.Dispatch<React.SetStateAction<boolean>>;
29
+ showContextualDossier: boolean;
30
+ setShowContextualDossier: React.Dispatch<React.SetStateAction<boolean>>;
31
+ showContextualDocument: boolean;
32
+ setShowContextualDocument: React.Dispatch<React.SetStateAction<boolean>>;
33
+ taskContext?: TaskContext;
34
+ usersList?: Array<UserDescriptor>;
35
+ onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
36
+ s4TViewerDialogComponent?: React.ReactNode;
37
+ afterTaskSaved?: (task: TaskDescriptor | undefined, formMode: FormModes | undefined, forceRefresh?: boolean) => Promise<void>;
38
+ }
39
+ declare const TMTasksView: (props: TMTasksViewProps) => import("react/jsx-runtime").JSX.Element;
40
+ export default TMTasksView;