sy-form-components 0.2.3 → 0.2.4
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/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4331,6 +4331,15 @@ var TASK_STATUS_META = {
|
|
|
4331
4331
|
};
|
|
4332
4332
|
|
|
4333
4333
|
// src/core/processApi.ts
|
|
4334
|
+
var normalizeProcessTasks = (value) => {
|
|
4335
|
+
if (Array.isArray(value)) return value;
|
|
4336
|
+
if (!value || typeof value !== "object") return [];
|
|
4337
|
+
if (Array.isArray(value.tasks)) return value.tasks;
|
|
4338
|
+
if (Array.isArray(value.list)) return value.list;
|
|
4339
|
+
if (Array.isArray(value.items)) return value.items;
|
|
4340
|
+
if (Array.isArray(value.records)) return value.records;
|
|
4341
|
+
return [];
|
|
4342
|
+
};
|
|
4334
4343
|
async function getProcessBasic(request, formInstId) {
|
|
4335
4344
|
const response = await request({
|
|
4336
4345
|
url: `/workflow/instance/${formInstId}/basic`,
|
|
@@ -4340,10 +4349,10 @@ async function getProcessBasic(request, formInstId) {
|
|
|
4340
4349
|
}
|
|
4341
4350
|
async function getProcessProgress(request, formInstId) {
|
|
4342
4351
|
const response = await request({
|
|
4343
|
-
url: `/workflow/instance/${formInstId}`,
|
|
4352
|
+
url: `/workflow/instance/${formInstId}/all-tasks`,
|
|
4344
4353
|
method: "get"
|
|
4345
4354
|
});
|
|
4346
|
-
return response.data || response.result
|
|
4355
|
+
return normalizeProcessTasks(response.data || response.result);
|
|
4347
4356
|
}
|
|
4348
4357
|
async function checkUserApproval(request, formInstId) {
|
|
4349
4358
|
const response = await request({
|
|
@@ -5937,15 +5946,16 @@ var ApprovalTimeline = ({
|
|
|
5937
5946
|
showRemarks = true,
|
|
5938
5947
|
compactMode = false
|
|
5939
5948
|
}) => {
|
|
5940
|
-
|
|
5949
|
+
const taskList = Array.isArray(tasks) ? tasks : [];
|
|
5950
|
+
if (taskList.length === 0) {
|
|
5941
5951
|
return /* @__PURE__ */ jsx77("div", { className: `bg-white rounded-xl shadow-sm border border-gray-100 p-6 ${className}`, children: /* @__PURE__ */ jsx77("p", { className: "text-sm text-gray-400 text-center", children: "\u6682\u65E0\u5BA1\u6279\u8BB0\u5F55" }) });
|
|
5942
5952
|
}
|
|
5943
|
-
return /* @__PURE__ */ jsx77("div", { className: `${className}`, children:
|
|
5953
|
+
return /* @__PURE__ */ jsx77("div", { className: `${className}`, children: taskList.map((task, index) => {
|
|
5944
5954
|
if (renderNode) {
|
|
5945
5955
|
return /* @__PURE__ */ jsx77("div", { children: renderNode(task, index) }, task.taskId);
|
|
5946
5956
|
}
|
|
5947
5957
|
const phase = getNodePhase(task);
|
|
5948
|
-
const isLast = index ===
|
|
5958
|
+
const isLast = index === taskList.length - 1;
|
|
5949
5959
|
const statusMeta = TASK_STATUS_META[task.status];
|
|
5950
5960
|
return /* @__PURE__ */ jsxs23("div", { className: "flex gap-4", children: [
|
|
5951
5961
|
/* @__PURE__ */ jsxs23("div", { className: "flex flex-col items-center", children: [
|