@topconsultnpm/sdkui-react 6.19.0-dev1.53 → 6.19.0-dev1.55

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.

Potentially problematic release.


This version of @topconsultnpm/sdkui-react might be problematic. Click here for more details.

Files changed (35) hide show
  1. package/lib/components/base/TMLayout.d.ts +2 -1
  2. package/lib/components/base/TMLayout.js +2 -2
  3. package/lib/components/features/documents/TMDcmtBlog.js +1 -1
  4. package/lib/components/features/search/TMSearch.js +1 -1
  5. package/lib/components/features/search/TMSearchResult.js +10 -1
  6. package/lib/components/features/tasks/TMTaskForm.d.ts +33 -0
  7. package/lib/components/features/tasks/TMTaskForm.js +291 -0
  8. package/lib/components/features/tasks/TMTasksAgenda.d.ts +17 -0
  9. package/lib/components/features/tasks/TMTasksAgenda.js +107 -0
  10. package/lib/components/features/tasks/TMTasksCalendar.d.ts +21 -0
  11. package/lib/components/features/tasks/TMTasksCalendar.js +240 -0
  12. package/lib/components/features/tasks/TMTasksHeader.d.ts +14 -0
  13. package/lib/components/features/tasks/TMTasksHeader.js +37 -0
  14. package/lib/components/features/tasks/TMTasksPanelContent.d.ts +19 -0
  15. package/lib/components/features/tasks/TMTasksPanelContent.js +74 -0
  16. package/lib/components/features/tasks/TMTasksUtils.d.ts +130 -0
  17. package/lib/components/features/tasks/TMTasksUtils.js +602 -0
  18. package/lib/components/features/tasks/TMTasksUtilsView.d.ts +32 -0
  19. package/lib/components/features/tasks/TMTasksUtilsView.js +107 -0
  20. package/lib/components/features/tasks/TMTasksView.d.ts +37 -0
  21. package/lib/components/features/tasks/TMTasksView.js +555 -0
  22. package/lib/components/features/workflow/TMWorkflowPopup.js +2 -2
  23. package/lib/components/grids/TMBlogsPost.js +27 -27
  24. package/lib/components/grids/TMBlogsPostUtils.js +1 -1
  25. package/lib/components/index.d.ts +8 -0
  26. package/lib/components/index.js +9 -0
  27. package/lib/helper/SDKUI_Localizator.d.ts +54 -4
  28. package/lib/helper/SDKUI_Localizator.js +526 -25
  29. package/lib/helper/TMCustomSearchBar.d.ts +8 -0
  30. package/lib/helper/TMCustomSearchBar.js +54 -0
  31. package/lib/helper/TMToppyMessage.js +1 -1
  32. package/lib/helper/TMUtils.d.ts +10 -1
  33. package/lib/helper/TMUtils.js +42 -1
  34. package/lib/stories/TMSDKUI_Localizator.stories.js +1 -1
  35. package/package.json +1 -1
@@ -0,0 +1,107 @@
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 } 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
+ };
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import { AssignedTab, TaskViewType } from "./TMTasksUtils";
3
+ import { TaskDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
4
+ import { DcmtInfo, 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
+ visualizedTasks: Array<TaskDescriptor>;
13
+ activeComponent: TaskViewType;
14
+ activeTabIndex: AssignedTab;
15
+ setActiveTabIndex: React.Dispatch<React.SetStateAction<AssignedTab>>;
16
+ currentTask: TaskDescriptor | null;
17
+ setCurrentTask: React.Dispatch<React.SetStateAction<TaskDescriptor | null>>;
18
+ assignedToMeCount: number;
19
+ assignedByMeCount: number;
20
+ allTasksFilteredCount: number;
21
+ showId: boolean;
22
+ setShowId: React.Dispatch<React.SetStateAction<boolean>>;
23
+ showSearch: boolean;
24
+ setShowSearch: React.Dispatch<React.SetStateAction<boolean>>;
25
+ showContextualWG: boolean;
26
+ setShowContextualWG: React.Dispatch<React.SetStateAction<boolean>>;
27
+ showContextualDossier: boolean;
28
+ setShowContextualDossier: React.Dispatch<React.SetStateAction<boolean>>;
29
+ handleNavigateToWGs: (workGroupId: number) => void;
30
+ handleNavigateToDossiers: (dossierId: number) => void;
31
+ taskContext?: TaskContext;
32
+ usersList?: Array<UserDescriptor>;
33
+ onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
34
+ s4TViewerDialogComponent?: React.ReactNode;
35
+ }
36
+ declare const TMTasksView: (props: TMTasksViewProps) => import("react/jsx-runtime").JSX.Element;
37
+ export default TMTasksView;