@ramesesinc/platform-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/action/AlertMessage.d.ts +8 -0
- package/dist/components/action/AlertMessage.js +19 -0
- package/dist/components/action/AlertMessage.tsx +38 -0
- package/dist/components/action/Button.d.ts +21 -0
- package/dist/components/action/Button.js +139 -0
- package/dist/components/action/Button.tsx +230 -0
- package/dist/components/action/CancelEdit.d.ts +9 -0
- package/dist/components/action/CancelEdit.js +21 -0
- package/dist/components/action/CancelEdit.tsx +40 -0
- package/dist/components/action/DeleteData.d.ts +13 -0
- package/dist/components/action/DeleteData.js +43 -0
- package/dist/components/action/DeleteData.tsx +73 -0
- package/dist/components/action/Edit.d.ts +9 -0
- package/dist/components/action/Edit.js +21 -0
- package/dist/components/action/Edit.tsx +40 -0
- package/dist/components/action/LookupPage.d.ts +16 -0
- package/dist/components/action/LookupPage.js +62 -0
- package/dist/components/action/LookupPage.tsx +113 -0
- package/dist/components/action/ProcessRunner.d.ts +62 -0
- package/dist/components/action/ProcessRunner.js +156 -0
- package/dist/components/action/ProcessRunner.tsx +337 -0
- package/dist/components/action/Refresh.d.ts +7 -0
- package/dist/components/action/Refresh.js +17 -0
- package/dist/components/action/Refresh.tsx +35 -0
- package/dist/components/action/SaveData.d.ts +10 -0
- package/dist/components/action/SaveData.js +54 -0
- package/dist/components/action/SaveData.tsx +74 -0
- package/dist/components/action/SelectData.d.ts +8 -0
- package/dist/components/action/SelectData.js +29 -0
- package/dist/components/action/SelectData.tsx +47 -0
- package/dist/components/action/Undo.d.ts +9 -0
- package/dist/components/action/Undo.js +31 -0
- package/dist/components/action/Undo.tsx +50 -0
- package/dist/components/action/UpdateContext.d.ts +9 -0
- package/dist/components/action/UpdateContext.js +21 -0
- package/dist/components/action/UpdateContext.tsx +40 -0
- package/dist/components/action/UpdateData.d.ts +9 -0
- package/dist/components/action/UpdateData.js +33 -0
- package/dist/components/action/UpdateData.tsx +49 -0
- package/dist/components/action/ViewBackPage.d.ts +9 -0
- package/dist/components/action/ViewBackPage.js +19 -0
- package/dist/components/action/ViewBackPage.tsx +46 -0
- package/dist/components/action/ViewPage.d.ts +14 -0
- package/dist/components/action/ViewPage.js +88 -0
- package/dist/components/action/ViewPage.tsx +141 -0
- package/dist/components/common/UIComponent.d.ts +11 -0
- package/dist/components/common/UIComponent.js +52 -0
- package/dist/components/common/UIComponent.tsx +84 -0
- package/dist/components/common/UIInput.d.ts +12 -0
- package/dist/components/common/UIInput.js +37 -0
- package/dist/components/common/UIInput.tsx +49 -0
- package/dist/components/common/UIMenu.d.ts +23 -0
- package/dist/components/common/UIMenu.js +61 -0
- package/dist/components/common/UIMenu.tsx +91 -0
- package/dist/components/index.d.ts +37 -0
- package/dist/components/index.js +44 -0
- package/dist/components/index.ts +51 -0
- package/dist/components/input/CodeEditor.d.ts +12 -0
- package/dist/components/input/CodeEditor.js +132 -0
- package/dist/components/input/CodeEditor.tsx +188 -0
- package/dist/components/input/DateField.d.ts +9 -0
- package/dist/components/input/DateField.js +140 -0
- package/dist/components/input/DateField.tsx +274 -0
- package/dist/components/input/DayPicker.d.ts +2 -0
- package/dist/components/input/DayPicker.js +5 -0
- package/dist/components/input/DayPicker.tsx +5 -0
- package/dist/components/input/HtmlCode.d.ts +8 -0
- package/dist/components/input/HtmlCode.js +157 -0
- package/dist/components/input/HtmlCode.tsx +203 -0
- package/dist/components/input/JsonCode.d.ts +9 -0
- package/dist/components/input/JsonCode.js +159 -0
- package/dist/components/input/JsonCode.tsx +205 -0
- package/dist/components/input/MonthPicker.d.ts +2 -0
- package/dist/components/input/MonthPicker.js +5 -0
- package/dist/components/input/MonthPicker.tsx +5 -0
- package/dist/components/input/ScriptCode.d.ts +8 -0
- package/dist/components/input/ScriptCode.js +153 -0
- package/dist/components/input/ScriptCode.tsx +195 -0
- package/dist/components/input/Select.d.ts +14 -0
- package/dist/components/input/Select.js +40 -0
- package/dist/components/input/Select.tsx +78 -0
- package/dist/components/input/SqlCode.d.ts +8 -0
- package/dist/components/input/SqlCode.js +121 -0
- package/dist/components/input/SqlCode.tsx +162 -0
- package/dist/components/input/StringDecision.d.ts +2 -0
- package/dist/components/input/StringDecision.js +34 -0
- package/dist/components/input/StringDecision.tsx +64 -0
- package/dist/components/input/Text.d.ts +7 -0
- package/dist/components/input/Text.js +39 -0
- package/dist/components/input/Text.tsx +57 -0
- package/dist/components/input/YearPicker.d.ts +8 -0
- package/dist/components/input/YearPicker.js +44 -0
- package/dist/components/input/YearPicker.tsx +81 -0
- package/dist/components/list/IconMenu.d.ts +14 -0
- package/dist/components/list/IconMenu.js +72 -0
- package/dist/components/list/IconMenu.tsx +115 -0
- package/dist/components/list/TabMenu.d.ts +10 -0
- package/dist/components/list/TabMenu.js +72 -0
- package/dist/components/list/TabMenu.tsx +127 -0
- package/dist/components/list/TreeMenu.d.ts +14 -0
- package/dist/components/list/TreeMenu.js +207 -0
- package/dist/components/list/TreeMenu.tsx +279 -0
- package/dist/components/list/TxnTaskList.d.ts +2 -0
- package/dist/components/list/TxnTaskList.js +77 -0
- package/dist/components/list/TxnTaskList.tsx +198 -0
- package/dist/components/output/Label.d.ts +8 -0
- package/dist/components/output/Label.js +33 -0
- package/dist/components/output/Label.tsx +51 -0
- package/dist/components/table/DataList.d.ts +88 -0
- package/dist/components/table/DataList.js +361 -0
- package/dist/components/table/DataList.tsx +782 -0
- package/dist/components/table/DataTable.d.ts +46 -0
- package/dist/components/table/DataTable.js +253 -0
- package/dist/components/table/DataTable.tsx +572 -0
- package/dist/components/table/ListHandler.d.ts +42 -0
- package/dist/components/table/ListHandler.js +197 -0
- package/dist/components/table/ListHandler.ts +276 -0
- package/dist/components/table/TableContext.d.ts +33 -0
- package/dist/components/table/TableContext.js +57 -0
- package/dist/components/table/TableContext.tsx +122 -0
- package/dist/components/view/ComponentView.d.ts +8 -0
- package/dist/components/view/ComponentView.js +78 -0
- package/dist/components/view/ComponentView.tsx +102 -0
- package/dist/components/view/FilterView.d.ts +2 -0
- package/dist/components/view/FilterView.js +14 -0
- package/dist/components/view/FilterView.tsx +21 -0
- package/dist/components/view/HtmlForm.d.ts +7 -0
- package/dist/components/view/HtmlForm.js +145 -0
- package/dist/components/view/HtmlForm.tsx +186 -0
- package/dist/components/view/HtmlView.d.ts +9 -0
- package/dist/components/view/HtmlView.js +85 -0
- package/dist/components/view/HtmlView.tsx +114 -0
- package/dist/components/view/IFrameView.d.ts +2 -0
- package/dist/components/view/IFrameView.js +34 -0
- package/dist/components/view/IFrameView.tsx +48 -0
- package/dist/components/view/Modal.d.ts +14 -0
- package/dist/components/view/Modal.js +28 -0
- package/dist/components/view/Modal.tsx +72 -0
- package/dist/components/view/PageView.d.ts +9 -0
- package/dist/components/view/PageView.js +90 -0
- package/dist/components/view/PageView.tsx +131 -0
- package/dist/components/view/PopupView.d.ts +9 -0
- package/dist/components/view/PopupView.js +91 -0
- package/dist/components/view/PopupView.tsx +160 -0
- package/dist/components/view/RootView.d.ts +8 -0
- package/dist/components/view/RootView.js +75 -0
- package/dist/components/view/RootView.tsx +109 -0
- package/dist/components/view/WizardView.d.ts +6 -0
- package/dist/components/view/WizardView.js +34 -0
- package/dist/components/view/WizardView.tsx +48 -0
- package/dist/core/AppContext.d.ts +25 -0
- package/dist/core/AppContext.js +159 -0
- package/dist/core/AuthContext.d.ts +13 -0
- package/dist/core/AuthContext.js +80 -0
- package/dist/core/ComponentCache.d.ts +15 -0
- package/dist/core/ComponentCache.js +25 -0
- package/dist/core/DataContext.d.ts +20 -0
- package/dist/core/DataContext.js +41 -0
- package/dist/core/DynamicComponent.d.ts +12 -0
- package/dist/core/DynamicComponent.js +30 -0
- package/dist/core/DynamicIcon.d.ts +6 -0
- package/dist/core/DynamicIcon.js +48 -0
- package/dist/core/DynamicTemplate.d.ts +4 -0
- package/dist/core/DynamicTemplate.js +17 -0
- package/dist/core/ErrorMessage.d.ts +5 -0
- package/dist/core/ErrorMessage.js +7 -0
- package/dist/core/EventHandler.d.ts +3 -0
- package/dist/core/EventHandler.js +1 -0
- package/dist/core/HtmlCache.d.ts +6 -0
- package/dist/core/HtmlCache.js +17 -0
- package/dist/core/Page.d.ts +6 -0
- package/dist/core/Page.js +141 -0
- package/dist/core/PageCache.d.ts +15 -0
- package/dist/core/PageCache.js +26 -0
- package/dist/core/PageContext.d.ts +49 -0
- package/dist/core/PageContext.js +207 -0
- package/dist/core/PageRegistry.d.ts +7 -0
- package/dist/core/PageRegistry.js +11 -0
- package/dist/core/PageViewContext.d.ts +45 -0
- package/dist/core/PageViewContext.js +277 -0
- package/dist/core/Panel.d.ts +16 -0
- package/dist/core/Panel.js +39 -0
- package/dist/core/RowContext.d.ts +11 -0
- package/dist/core/RowContext.js +16 -0
- package/dist/core/StepHandler.d.ts +9 -0
- package/dist/core/StepHandler.js +39 -0
- package/dist/core/UIDependHandler.d.ts +6 -0
- package/dist/core/UIDependHandler.js +31 -0
- package/dist/core/auth/index.d.ts +18 -0
- package/dist/core/auth/index.js +187 -0
- package/dist/core/auth/session.d.ts +4 -0
- package/dist/core/auth/session.js +45 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +1 -0
- package/dist/core/page-helper.d.ts +27 -0
- package/dist/core/page-helper.js +47 -0
- package/dist/hooks/useUrlParams.d.ts +11 -0
- package/dist/hooks/useUrlParams.js +164 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +69 -0
- package/dist/layouts/BorderLayout.d.ts +14 -0
- package/dist/layouts/BorderLayout.js +8 -0
- package/dist/layouts/CardLayout.d.ts +27 -0
- package/dist/layouts/CardLayout.js +36 -0
- package/dist/layouts/CenterLayout.d.ts +8 -0
- package/dist/layouts/CenterLayout.js +6 -0
- package/dist/layouts/GridLayout.d.ts +9 -0
- package/dist/layouts/GridLayout.js +5 -0
- package/dist/layouts/HPanel.d.ts +11 -0
- package/dist/layouts/HPanel.js +8 -0
- package/dist/layouts/HorizontalLayout.d.ts +11 -0
- package/dist/layouts/HorizontalLayout.js +6 -0
- package/dist/layouts/MainLayout.d.ts +6 -0
- package/dist/layouts/MainLayout.js +5 -0
- package/dist/layouts/PageLayout.d.ts +11 -0
- package/dist/layouts/PageLayout.js +6 -0
- package/dist/layouts/VPanel.d.ts +9 -0
- package/dist/layouts/VPanel.js +7 -0
- package/dist/layouts/XLayout.d.ts +10 -0
- package/dist/layouts/XLayout.js +10 -0
- package/dist/layouts/YLayout.d.ts +10 -0
- package/dist/layouts/YLayout.js +10 -0
- package/dist/lib/PlatformRoute.d.ts +5 -0
- package/dist/lib/PlatformRoute.js +288 -0
- package/dist/lib/WebPlatform.d.ts +13 -0
- package/dist/lib/WebPlatform.js +124 -0
- package/dist/lib/components/ActivityBar.d.ts +13 -0
- package/dist/lib/components/ActivityBar.js +39 -0
- package/dist/lib/components/CopyButton.d.ts +8 -0
- package/dist/lib/components/CopyButton.js +50 -0
- package/dist/lib/components/Header.d.ts +2 -0
- package/dist/lib/components/Header.js +74 -0
- package/dist/lib/components/QuickActionMenu.d.ts +18 -0
- package/dist/lib/components/QuickActionMenu.js +50 -0
- package/dist/lib/components/UserButton.d.ts +11 -0
- package/dist/lib/components/UserButton.js +66 -0
- package/dist/lib/layouts/BorderLayout.tsx +31 -0
- package/dist/lib/layouts/CardLayout.tsx +73 -0
- package/dist/lib/layouts/CenterLayout.tsx +20 -0
- package/dist/lib/layouts/GridLayout.tsx +20 -0
- package/dist/lib/layouts/HPanel.tsx +31 -0
- package/dist/lib/layouts/HorizontalLayout.tsx +29 -0
- package/dist/lib/layouts/MainLayout.tsx +16 -0
- package/dist/lib/layouts/PageLayout.tsx +29 -0
- package/dist/lib/layouts/VPanel.tsx +27 -0
- package/dist/lib/layouts/XLayout.tsx +29 -0
- package/dist/lib/layouts/YLayout.tsx +29 -0
- package/dist/lib/utils/BeanUtils.d.ts +3 -0
- package/dist/lib/utils/BeanUtils.js +75 -0
- package/dist/lib/utils/ComponentLoader.d.ts +13 -0
- package/dist/lib/utils/ComponentLoader.js +26 -0
- package/dist/lib/utils/ExprUtil.d.ts +7 -0
- package/dist/lib/utils/ExprUtil.js +44 -0
- package/dist/lib/utils/PageUtils.d.ts +6 -0
- package/dist/lib/utils/PageUtils.js +121 -0
- package/dist/lib/utils/ResourceLoader.d.ts +11 -0
- package/dist/lib/utils/ResourceLoader.js +37 -0
- package/dist/lib/utils/SectionProvider.d.ts +5 -0
- package/dist/lib/utils/SectionProvider.js +39 -0
- package/dist/lib/utils/initResourceLoader.d.ts +0 -0
- package/dist/lib/utils/initResourceLoader.js +95 -0
- package/dist/styles/index.css +38 -0
- package/dist/templates/BasicTemplate.d.ts +2 -0
- package/dist/templates/BasicTemplate.js +14 -0
- package/dist/templates/CrudFormTemplate.d.ts +2 -0
- package/dist/templates/CrudFormTemplate.js +38 -0
- package/dist/templates/DataListTemplate.d.ts +2 -0
- package/dist/templates/DataListTemplate.js +13 -0
- package/dist/templates/ExplorerTemplate.d.ts +10 -0
- package/dist/templates/ExplorerTemplate.js +17 -0
- package/dist/templates/TxnFormTemplate.d.ts +2 -0
- package/dist/templates/TxnFormTemplate.js +66 -0
- package/dist/templates/WizardTemplate.d.ts +9 -0
- package/dist/templates/WizardTemplate.js +37 -0
- package/dist/templates/index.d.ts +5 -0
- package/dist/templates/index.js +5 -0
- package/dist/types/action.d.ts +8 -0
- package/dist/types/action.js +1 -0
- package/dist/types/component.d.ts +18 -0
- package/dist/types/component.js +1 -0
- package/dist/types/list.d.ts +14 -0
- package/dist/types/list.js +1 -0
- package/dist/types/template.d.ts +6 -0
- package/dist/types/template.js +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { Button } from "@ramesesinc/client";
|
|
2
|
+
import { Eye, Newspaper, Pen, Plus } from "lucide-react";
|
|
3
|
+
import { useRouter } from "next/router";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { usePageContext } from "../../core/PageContext";
|
|
6
|
+
import { parseHashUrl } from "../../lib/utils/PageUtils";
|
|
7
|
+
|
|
8
|
+
const rootItems = [
|
|
9
|
+
{
|
|
10
|
+
id: "mytasklist",
|
|
11
|
+
title: "My Tasks",
|
|
12
|
+
},
|
|
13
|
+
{ id: "unassignedtasklist", title: "Unassigned" },
|
|
14
|
+
{ id: "assignedtasklist", title: "Active Tasks" },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const TxnTaskList = () => {
|
|
18
|
+
const [tasklist, setTaskList] = useState<Record<string, any[]>>({});
|
|
19
|
+
const [loading, setLoading] = useState(false);
|
|
20
|
+
const router = useRouter();
|
|
21
|
+
const url = router.asPath.replace(/^\/[^/]+\/[^/]+\//, "");
|
|
22
|
+
const pageContext = usePageContext();
|
|
23
|
+
|
|
24
|
+
const fetchData = async () => {
|
|
25
|
+
const { page, params } = parseHashUrl(url);
|
|
26
|
+
|
|
27
|
+
const data = {
|
|
28
|
+
api: "mongo/list",
|
|
29
|
+
params: {
|
|
30
|
+
schemaname: "tasks",
|
|
31
|
+
filter: { ...params },
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
setLoading(true);
|
|
36
|
+
const result = await pageContext?.execService(data.api, data.params);
|
|
37
|
+
const resData = (result?.data ? result?.data : result) ?? [];
|
|
38
|
+
const record = resData[0] ?? {};
|
|
39
|
+
|
|
40
|
+
const taskData: Record<string, any[]> = {};
|
|
41
|
+
rootItems.forEach((item) => {
|
|
42
|
+
if (record[item.id]) {
|
|
43
|
+
taskData[item.id] = record[item.id];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
setTaskList(taskData);
|
|
48
|
+
setLoading(false);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
fetchData();
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
55
|
+
const renderEmpty = (key: string, title: string) => (
|
|
56
|
+
<div key={key} className="mb-4">
|
|
57
|
+
<h5 className="font-bold mb-2">{title}</h5>
|
|
58
|
+
<p className="text-sm text-gray-400">No tasks available.</p>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const renderShowMore = (show: boolean, onToggle: () => void) => (
|
|
63
|
+
<p className="text-sm text-blue-500 cursor-pointer hover:underline flex justify-center mb-2" onClick={onToggle}>
|
|
64
|
+
{show ? "Show less" : "Show more"}
|
|
65
|
+
</p>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const [showAllMyTasks, setShowAllMyTasks] = useState(false);
|
|
69
|
+
|
|
70
|
+
const renderMyTasks = (tasks: any[]) => {
|
|
71
|
+
if (tasks.length === 0) return renderEmpty("mytasklist", "My Tasks");
|
|
72
|
+
|
|
73
|
+
const visibleTasks = showAllMyTasks ? tasks : tasks.slice(0, 5);
|
|
74
|
+
|
|
75
|
+
// ============= My Tasks =============
|
|
76
|
+
return (
|
|
77
|
+
<div className="">
|
|
78
|
+
<h5 className="font-bold mb-2 border-t border-b border-gray-200 py-2">My Tasks</h5>
|
|
79
|
+
{visibleTasks.map((task) => (
|
|
80
|
+
<div key={task.objid} className="p-3">
|
|
81
|
+
<div className="flex items-center justify-between">
|
|
82
|
+
<div className="flex items-center gap-4">
|
|
83
|
+
<Newspaper />
|
|
84
|
+
<div className="flex flex-col">
|
|
85
|
+
<p className="font-medium">{task.title}</p>
|
|
86
|
+
<div className="flex gap-2 items-center">
|
|
87
|
+
<Button size="sm" variant="text" radius="full" icon={<Eye size={16} />} className="text-xs gap-0">
|
|
88
|
+
View
|
|
89
|
+
</Button>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
<p className="text-sm text-gray-500">{task.elapsedtime}</p>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
))}
|
|
97
|
+
|
|
98
|
+
{tasks.length > 5 && renderShowMore(showAllMyTasks, () => setShowAllMyTasks(!showAllMyTasks))}
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const [showAllUnassigned, setShowAllUnassigned] = useState(false);
|
|
104
|
+
|
|
105
|
+
const renderUnassigned = (tasks: any[]) => {
|
|
106
|
+
if (tasks.length === 0) return renderEmpty("unassignedtasklist", "Unassigned");
|
|
107
|
+
|
|
108
|
+
const visibleTasks = showAllUnassigned ? tasks : tasks.slice(0, 5);
|
|
109
|
+
|
|
110
|
+
// ============= Unassigned Tasks =============
|
|
111
|
+
return (
|
|
112
|
+
<div className="">
|
|
113
|
+
<div className="border-t border-b border-gray-200 py-2">
|
|
114
|
+
<div className="flex items-center justify-between">
|
|
115
|
+
<h5 className="font-bold">Unassigned</h5>
|
|
116
|
+
<span className="text-gray-600 hover:bg-gray-200 rounded p-1 cursor-pointer flex items-center">
|
|
117
|
+
<Plus size={18} />
|
|
118
|
+
</span>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
{visibleTasks.map((task) => (
|
|
122
|
+
<div key={task.objid} className="p-3">
|
|
123
|
+
<div className="flex items-center gap-4">
|
|
124
|
+
<Newspaper />
|
|
125
|
+
<div className="flex items-center justify-between w-full">
|
|
126
|
+
<div>
|
|
127
|
+
<p className="font-medium">{task.title}</p>
|
|
128
|
+
<Button size="sm" variant="text" radius="full" icon={<Pen size={16} />} className="text-xs gap-0">
|
|
129
|
+
Assign to Me
|
|
130
|
+
</Button>
|
|
131
|
+
</div>
|
|
132
|
+
<p className="text-sm text-gray-500">{task.elapsedtime}</p>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
))}
|
|
137
|
+
|
|
138
|
+
{tasks.length > 5 && renderShowMore(showAllUnassigned, () => setShowAllUnassigned(!showAllUnassigned))}
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// ============= Assigned Tasks =============
|
|
144
|
+
const [showAllAssigned, setShowAllAssigned] = useState(false);
|
|
145
|
+
|
|
146
|
+
const renderAssigned = (tasks: any[]) => {
|
|
147
|
+
if (tasks.length === 0) return renderEmpty("assignedtasklist", "Active Tasks");
|
|
148
|
+
|
|
149
|
+
const visibleTasks = showAllAssigned ? tasks : tasks.slice(0, 5);
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<div className="">
|
|
153
|
+
<div className="flex items-center justify-between border-t border-b border-gray-200 py-2">
|
|
154
|
+
<h5 className="font-bold">Active Tasks</h5>
|
|
155
|
+
<span className="text-gray-600 hover:bg-gray-200 rounded p-1 cursor-pointer flex items-center">
|
|
156
|
+
<Plus size={18} />
|
|
157
|
+
</span>
|
|
158
|
+
</div>
|
|
159
|
+
{visibleTasks.map((task) => (
|
|
160
|
+
<div key={task.objid} className="flex items-center justify-between p-3 mb-2">
|
|
161
|
+
<div className="flex items-center gap-2">
|
|
162
|
+
<img src={`data:image/png;base64,${task.assignee.img}`} alt={task.assignee.name} className="w-10 h-10 rounded-full object-cover" />
|
|
163
|
+
<div>
|
|
164
|
+
<p className="font-medium">{task.title}</p>
|
|
165
|
+
{task.findings !== undefined && (
|
|
166
|
+
<span className="text-xs bg-yellow-100 text-yellow-700 rounded-full px-2 py-1">
|
|
167
|
+
{task.findings} finding{task.findings !== 1 ? "s" : ""}
|
|
168
|
+
</span>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
<p className="text-sm text-gray-500">{task.elapsedtime}</p>
|
|
173
|
+
</div>
|
|
174
|
+
))}
|
|
175
|
+
|
|
176
|
+
{tasks.length > 5 && renderShowMore(showAllAssigned, () => setShowAllAssigned(!showAllAssigned))}
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<div className="p-2">
|
|
183
|
+
{loading ? (
|
|
184
|
+
<div className="flex items-center justify-center h-24">
|
|
185
|
+
<div className="w-6 h-6 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin" />
|
|
186
|
+
</div>
|
|
187
|
+
) : (
|
|
188
|
+
<div className="overflow-y-auto h-[calc(100vh-154px)]">
|
|
189
|
+
{renderMyTasks(tasklist["mytasklist"] ?? [])}
|
|
190
|
+
{renderUnassigned(tasklist["unassignedtasklist"] ?? [])}
|
|
191
|
+
{renderAssigned(tasklist["assignedtasklist"] ?? [])}
|
|
192
|
+
</div>
|
|
193
|
+
)}
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export default TxnTaskList;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { usePageContext } from "../../core/PageContext";
|
|
4
|
+
import useDependHandler from "../../core/UIDependHandler";
|
|
5
|
+
import { render } from "../../lib/utils/ExprUtil";
|
|
6
|
+
import UIComponent from "../common/UIComponent";
|
|
7
|
+
const Label = (props) => {
|
|
8
|
+
const { depends, expr, html = false } = props !== null && props !== void 0 ? props : {};
|
|
9
|
+
const pageContext = usePageContext();
|
|
10
|
+
const binding = pageContext === null || pageContext === void 0 ? void 0 : pageContext.binding;
|
|
11
|
+
// Render the expression using ExprUtil
|
|
12
|
+
const renderExpression = (expression) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const data = (_a = pageContext === null || pageContext === void 0 ? void 0 : pageContext.getAllData()) !== null && _a !== void 0 ? _a : {};
|
|
15
|
+
return render(expression, data);
|
|
16
|
+
};
|
|
17
|
+
const initialValue = renderExpression(expr !== null && expr !== void 0 ? expr : "");
|
|
18
|
+
const [value, setValue] = useState(initialValue);
|
|
19
|
+
const onRefresh = () => {
|
|
20
|
+
const newValue = renderExpression(expr !== null && expr !== void 0 ? expr : "");
|
|
21
|
+
setValue(newValue);
|
|
22
|
+
};
|
|
23
|
+
useDependHandler({ name: depends, onRefresh });
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const newValue = renderExpression(expr !== null && expr !== void 0 ? expr : "");
|
|
26
|
+
setValue(newValue);
|
|
27
|
+
}, [binding === null || binding === void 0 ? void 0 : binding.raw, expr]);
|
|
28
|
+
const getPreferredValue = () => {
|
|
29
|
+
return value;
|
|
30
|
+
};
|
|
31
|
+
return (_jsx(_Fragment, { children: _jsx(UIComponent, Object.assign({}, (props !== null && props !== void 0 ? props : {}), { children: html ? _jsx("div", { dangerouslySetInnerHTML: { __html: getPreferredValue() } }) : getPreferredValue() })) }));
|
|
32
|
+
};
|
|
33
|
+
export default Label;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { usePageContext } from "../../core/PageContext";
|
|
3
|
+
import useDependHandler from "../../core/UIDependHandler";
|
|
4
|
+
import { render } from "../../lib/utils/ExprUtil";
|
|
5
|
+
import UIComponent from "../common/UIComponent";
|
|
6
|
+
|
|
7
|
+
type LabelProps = {
|
|
8
|
+
label?: string;
|
|
9
|
+
depends?: string;
|
|
10
|
+
expr?: string;
|
|
11
|
+
html?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Label = (props: LabelProps) => {
|
|
15
|
+
const { depends, expr, html = false } = props ?? {};
|
|
16
|
+
const pageContext = usePageContext();
|
|
17
|
+
const binding = pageContext?.binding;
|
|
18
|
+
|
|
19
|
+
// Render the expression using ExprUtil
|
|
20
|
+
const renderExpression = (expression: string) => {
|
|
21
|
+
const data = pageContext?.getAllData() ?? {};
|
|
22
|
+
return render(expression, data);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const initialValue = renderExpression(expr ?? "");
|
|
26
|
+
const [value, setValue] = useState(initialValue);
|
|
27
|
+
|
|
28
|
+
const onRefresh = () => {
|
|
29
|
+
const newValue = renderExpression(expr ?? "");
|
|
30
|
+
setValue(newValue);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
useDependHandler({ name: depends, onRefresh });
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const newValue = renderExpression(expr ?? "");
|
|
37
|
+
setValue(newValue);
|
|
38
|
+
}, [binding?.raw, expr]);
|
|
39
|
+
|
|
40
|
+
const getPreferredValue = () => {
|
|
41
|
+
return value;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<UIComponent {...(props ?? {})}>{html ? <div dangerouslySetInnerHTML={{ __html: getPreferredValue() }} /> : getPreferredValue()}</UIComponent>
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default Label;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ColumnDefinition } from "./DataTable";
|
|
3
|
+
import { DataConfig } from "./TableContext";
|
|
4
|
+
export interface FilterDefinition {
|
|
5
|
+
name: string;
|
|
6
|
+
component: string;
|
|
7
|
+
attr?: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export interface ActionDefinition {
|
|
10
|
+
label?: string;
|
|
11
|
+
icon?: string | React.ReactNode;
|
|
12
|
+
component: string;
|
|
13
|
+
attr: Record<string, any>;
|
|
14
|
+
variant?: "default" | "primary" | "danger";
|
|
15
|
+
show?: (row: any) => boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface BulkActionDefinition {
|
|
18
|
+
label: string;
|
|
19
|
+
icon?: string;
|
|
20
|
+
onClick: (selectedRows: any[]) => void;
|
|
21
|
+
variant?: "default" | "primary" | "danger";
|
|
22
|
+
}
|
|
23
|
+
export interface ToolbarActionDefinition {
|
|
24
|
+
label: string;
|
|
25
|
+
icon?: string;
|
|
26
|
+
component: string;
|
|
27
|
+
attr: Record<string, any>;
|
|
28
|
+
variant?: "default" | "primary";
|
|
29
|
+
}
|
|
30
|
+
export interface DataListAttr {
|
|
31
|
+
cols: ColumnDefinition[];
|
|
32
|
+
data: DataConfig;
|
|
33
|
+
rowsPerPage?: number;
|
|
34
|
+
disableTotalCount?: boolean;
|
|
35
|
+
title?: string;
|
|
36
|
+
emptyMessage?: string;
|
|
37
|
+
errorMessage?: string;
|
|
38
|
+
striped?: boolean;
|
|
39
|
+
bordered?: boolean;
|
|
40
|
+
hover?: boolean;
|
|
41
|
+
dense?: boolean;
|
|
42
|
+
showPagination?: boolean;
|
|
43
|
+
paginationPosition?: "top" | "bottom" | "both";
|
|
44
|
+
showPageInfo?: boolean;
|
|
45
|
+
showTotalCount?: boolean;
|
|
46
|
+
showRowsPerPage?: boolean;
|
|
47
|
+
rowsPerPageOptions?: number[];
|
|
48
|
+
searchable?: boolean;
|
|
49
|
+
searchPlaceholder?: string;
|
|
50
|
+
searchDebounce?: number;
|
|
51
|
+
onSearchChange?: (text: string) => void;
|
|
52
|
+
filters?: FilterDefinition[] | FilterDefinition[][];
|
|
53
|
+
showFilterPanel?: boolean;
|
|
54
|
+
onFilterChange?: (filters: Record<string, any>) => void;
|
|
55
|
+
sortable?: boolean;
|
|
56
|
+
defaultSort?: {
|
|
57
|
+
column: string;
|
|
58
|
+
direction: "asc" | "desc";
|
|
59
|
+
};
|
|
60
|
+
showSortIndicator?: boolean;
|
|
61
|
+
selectable?: boolean;
|
|
62
|
+
selectionMode?: "single" | "multiple";
|
|
63
|
+
onSelectionChange?: (selectedRows: any[]) => void;
|
|
64
|
+
selectOnRowClick?: boolean;
|
|
65
|
+
onRowClick?: (row: any, rowIndex: number) => void;
|
|
66
|
+
onRowDoubleClick?: (row: any, rowIndex: number) => void;
|
|
67
|
+
rowActions?: ActionDefinition[];
|
|
68
|
+
bulkActions?: BulkActionDefinition[];
|
|
69
|
+
showBulkActions?: boolean;
|
|
70
|
+
toolbarActions?: ToolbarActionDefinition[];
|
|
71
|
+
commonActions?: Record<string, any>;
|
|
72
|
+
showToolbar?: boolean;
|
|
73
|
+
toolbarTitle?: string;
|
|
74
|
+
showRefreshButton?: boolean;
|
|
75
|
+
showExportButton?: boolean;
|
|
76
|
+
onLoad?: () => void;
|
|
77
|
+
onError?: (error: any) => void;
|
|
78
|
+
onRefresh?: () => void;
|
|
79
|
+
onExport?: () => void;
|
|
80
|
+
className?: string;
|
|
81
|
+
rowClassName?: (row: any, rowIndex: number) => string;
|
|
82
|
+
depends?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface DataListProps {
|
|
85
|
+
attr: DataListAttr;
|
|
86
|
+
}
|
|
87
|
+
export declare const DataList: React.FC<DataListProps>;
|
|
88
|
+
export default DataList;
|