@ramesesinc/platform-core 0.1.5 → 0.1.8
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/LookupPage.js +9 -31
- package/dist/components/action/ViewPage.d.ts +2 -0
- package/dist/components/action/ViewPage.js +25 -31
- package/dist/components/common/UIComponent.js +4 -3
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/table/DataList.js +2 -2
- package/dist/components/view/PopupView.d.ts +13 -0
- package/dist/components/view/PopupView.js +25 -20
- package/dist/core/DataContext.d.ts +7 -4
- package/dist/core/DataContext.js +16 -4
- package/dist/core/Page.js +25 -26
- package/dist/core/PageCache.js +16 -3
- package/dist/core/PageContext.js +90 -18
- package/dist/core/PageViewContext.d.ts +13 -1
- package/dist/core/PageViewContext.js +89 -5
- package/dist/core/PopupContext.d.ts +49 -0
- package/dist/core/PopupContext.js +380 -0
- package/dist/core/RowContext.js +1 -1
- package/dist/core/WindowContext.d.ts +15 -0
- package/dist/core/WindowContext.js +28 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/index.css +25 -7
- package/dist/lib/utils/BeanUtils.js +7 -7
- package/dist/templates/DataListTemplate.js +7 -2
- package/dist/templates/ExplorerTemplate.js +1 -1
- package/package.json +5 -5
- package/dist/components/action/AlertMessage.tsx +0 -38
- package/dist/components/action/Button.tsx +0 -230
- package/dist/components/action/CancelEdit.tsx +0 -40
- package/dist/components/action/DeleteData.tsx +0 -73
- package/dist/components/action/Edit.tsx +0 -40
- package/dist/components/action/LookupPage.tsx +0 -113
- package/dist/components/action/ProcessRunner.tsx +0 -337
- package/dist/components/action/Refresh.tsx +0 -35
- package/dist/components/action/SaveData.tsx +0 -74
- package/dist/components/action/SelectData.tsx +0 -47
- package/dist/components/action/Undo.tsx +0 -50
- package/dist/components/action/UpdateContext.tsx +0 -40
- package/dist/components/action/UpdateData.tsx +0 -49
- package/dist/components/action/ViewBackPage.tsx +0 -46
- package/dist/components/action/ViewPage.tsx +0 -141
- package/dist/components/common/UIComponent.tsx +0 -86
- package/dist/components/common/UIInput.tsx +0 -49
- package/dist/components/common/UIMenu.tsx +0 -91
- package/dist/components/index.ts +0 -51
- package/dist/components/input/CodeEditor.tsx +0 -188
- package/dist/components/input/DateField.tsx +0 -274
- package/dist/components/input/DayPicker.tsx +0 -5
- package/dist/components/input/HtmlCode.tsx +0 -203
- package/dist/components/input/JsonCode.tsx +0 -205
- package/dist/components/input/MonthPicker.tsx +0 -5
- package/dist/components/input/ScriptCode.tsx +0 -195
- package/dist/components/input/Select.tsx +0 -78
- package/dist/components/input/SqlCode.tsx +0 -162
- package/dist/components/input/StringDecision.tsx +0 -64
- package/dist/components/input/Text.tsx +0 -57
- package/dist/components/input/YearPicker.tsx +0 -81
- package/dist/components/list/IconMenu.tsx +0 -115
- package/dist/components/list/TabMenu.tsx +0 -127
- package/dist/components/list/TreeMenu.tsx +0 -279
- package/dist/components/list/TxnTaskList.tsx +0 -198
- package/dist/components/output/Label.tsx +0 -50
- package/dist/components/table/DataList.tsx +0 -820
- package/dist/components/table/DataTable.tsx +0 -572
- package/dist/components/table/ListHandler.ts +0 -276
- package/dist/components/table/TableContext.tsx +0 -122
- package/dist/components/view/ComponentView.tsx +0 -102
- package/dist/components/view/FilterView.tsx +0 -21
- package/dist/components/view/HtmlForm.tsx +0 -176
- package/dist/components/view/HtmlView.tsx +0 -98
- package/dist/components/view/IFrameView.tsx +0 -48
- package/dist/components/view/Modal.tsx +0 -72
- package/dist/components/view/PageView.tsx +0 -131
- package/dist/components/view/PopupView.tsx +0 -160
- package/dist/components/view/RootView.tsx +0 -109
- package/dist/components/view/WizardView.tsx +0 -48
- package/dist/lib/layouts/BorderLayout.tsx +0 -31
- package/dist/lib/layouts/CardLayout.tsx +0 -73
- package/dist/lib/layouts/CenterLayout.tsx +0 -20
- package/dist/lib/layouts/GridLayout.tsx +0 -20
- package/dist/lib/layouts/HPanel.tsx +0 -31
- package/dist/lib/layouts/HorizontalLayout.tsx +0 -29
- package/dist/lib/layouts/MainLayout.tsx +0 -16
- package/dist/lib/layouts/PageLayout.tsx +0 -29
- package/dist/lib/layouts/VPanel.tsx +0 -27
- package/dist/lib/layouts/XLayout.tsx +0 -29
- package/dist/lib/layouts/YLayout.tsx +0 -29
- package/dist/lib/layouts/index.ts +0 -13
- /package/dist/components/action/{UpdateContext.d.ts → UpdateState.d.ts} +0 -0
- /package/dist/components/action/{UpdateContext.js → UpdateState.js} +0 -0
|
@@ -1,198 +0,0 @@
|
|
|
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;
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
depends?: string;
|
|
9
|
-
expr?: string;
|
|
10
|
-
html?: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const Label = (props: LabelProps) => {
|
|
14
|
-
const { depends, expr, html = false } = props ?? {};
|
|
15
|
-
const pageContext = usePageContext();
|
|
16
|
-
const binding = pageContext?.binding;
|
|
17
|
-
|
|
18
|
-
// Render the expression using ExprUtil
|
|
19
|
-
const renderExpression = (expression: string) => {
|
|
20
|
-
const data = pageContext?.getAllData() ?? {};
|
|
21
|
-
return render(expression, data);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const initialValue = renderExpression(expr ?? "");
|
|
25
|
-
const [value, setValue] = useState(initialValue);
|
|
26
|
-
|
|
27
|
-
const onRefresh = () => {
|
|
28
|
-
const newValue = renderExpression(expr ?? "");
|
|
29
|
-
setValue(newValue);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
useDependHandler({ name: depends, onRefresh });
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const newValue = renderExpression(expr ?? "");
|
|
36
|
-
setValue(newValue);
|
|
37
|
-
}, [binding?.raw, expr]);
|
|
38
|
-
|
|
39
|
-
const getPreferredValue = () => {
|
|
40
|
-
return value;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<>
|
|
45
|
-
<UIComponent {...(props ?? {})}>{html ? <div dangerouslySetInnerHTML={{ __html: getPreferredValue() }} /> : getPreferredValue()}</UIComponent>
|
|
46
|
-
</>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export default Label;
|