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 CHANGED
@@ -4453,6 +4453,15 @@ var TASK_STATUS_META = {
4453
4453
  };
4454
4454
 
4455
4455
  // src/core/processApi.ts
4456
+ var normalizeProcessTasks = (value) => {
4457
+ if (Array.isArray(value)) return value;
4458
+ if (!value || typeof value !== "object") return [];
4459
+ if (Array.isArray(value.tasks)) return value.tasks;
4460
+ if (Array.isArray(value.list)) return value.list;
4461
+ if (Array.isArray(value.items)) return value.items;
4462
+ if (Array.isArray(value.records)) return value.records;
4463
+ return [];
4464
+ };
4456
4465
  async function getProcessBasic(request, formInstId) {
4457
4466
  const response = await request({
4458
4467
  url: `/workflow/instance/${formInstId}/basic`,
@@ -4462,10 +4471,10 @@ async function getProcessBasic(request, formInstId) {
4462
4471
  }
4463
4472
  async function getProcessProgress(request, formInstId) {
4464
4473
  const response = await request({
4465
- url: `/workflow/instance/${formInstId}`,
4474
+ url: `/workflow/instance/${formInstId}/all-tasks`,
4466
4475
  method: "get"
4467
4476
  });
4468
- return response.data || response.result || [];
4477
+ return normalizeProcessTasks(response.data || response.result);
4469
4478
  }
4470
4479
  async function checkUserApproval(request, formInstId) {
4471
4480
  const response = await request({
@@ -6059,15 +6068,16 @@ var ApprovalTimeline = ({
6059
6068
  showRemarks = true,
6060
6069
  compactMode = false
6061
6070
  }) => {
6062
- if (!tasks || tasks.length === 0) {
6071
+ const taskList = Array.isArray(tasks) ? tasks : [];
6072
+ if (taskList.length === 0) {
6063
6073
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `bg-white rounded-xl shadow-sm border border-gray-100 p-6 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { className: "text-sm text-gray-400 text-center", children: "\u6682\u65E0\u5BA1\u6279\u8BB0\u5F55" }) });
6064
6074
  }
6065
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `${className}`, children: tasks.map((task, index) => {
6075
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `${className}`, children: taskList.map((task, index) => {
6066
6076
  if (renderNode) {
6067
6077
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: renderNode(task, index) }, task.taskId);
6068
6078
  }
6069
6079
  const phase = getNodePhase(task);
6070
- const isLast = index === tasks.length - 1;
6080
+ const isLast = index === taskList.length - 1;
6071
6081
  const statusMeta = TASK_STATUS_META[task.status];
6072
6082
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex gap-4", children: [
6073
6083
  /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex flex-col items-center", children: [