@rytass/bpm-core-react 0.17.6 → 0.17.7

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/chunks/{FormBuilderView-aBcA-_tt.cjs → FormBuilderView-CUOyS07f.cjs} +2 -2
  3. package/dist/chunks/{FormBuilderView-aBcA-_tt.cjs.map → FormBuilderView-CUOyS07f.cjs.map} +1 -1
  4. package/dist/chunks/{FormBuilderView-BYL42M0d.js → FormBuilderView-ClLnQ1e_.js} +2 -2
  5. package/dist/chunks/{FormBuilderView-BYL42M0d.js.map → FormBuilderView-ClLnQ1e_.js.map} +1 -1
  6. package/dist/chunks/{FormRendererView-cZGOOjU5.js → FormRendererView-BsTwZkqU.js} +207 -198
  7. package/dist/chunks/FormRendererView-BsTwZkqU.js.map +1 -0
  8. package/dist/chunks/FormRendererView-GpsE03np.cjs +4 -0
  9. package/dist/chunks/FormRendererView-GpsE03np.cjs.map +1 -0
  10. package/dist/chunks/approver-filled-form-D1DmqDVP.cjs +2 -0
  11. package/dist/chunks/approver-filled-form-D1DmqDVP.cjs.map +1 -0
  12. package/dist/chunks/approver-filled-form-DuQGPtNB.js +95 -0
  13. package/dist/chunks/approver-filled-form-DuQGPtNB.js.map +1 -0
  14. package/dist/chunks/{compose-DOEaPfEC.cjs → compose-DjEJi5Dv.cjs} +2 -2
  15. package/dist/chunks/{compose-DOEaPfEC.cjs.map → compose-DjEJi5Dv.cjs.map} +1 -1
  16. package/dist/chunks/{compose-v1Vcw9hE.js → compose-WekGZj74.js} +4 -4
  17. package/dist/chunks/{compose-v1Vcw9hE.js.map → compose-WekGZj74.js.map} +1 -1
  18. package/dist/chunks/{designer-DBBrktom.js → designer-D87ILhjz.js} +1664 -1182
  19. package/dist/chunks/designer-D87ILhjz.js.map +1 -0
  20. package/dist/chunks/designer-DESS0CMl.cjs +65 -0
  21. package/dist/chunks/designer-DESS0CMl.cjs.map +1 -0
  22. package/dist/chunks/detail-D49NuNCn.cjs +2 -0
  23. package/dist/chunks/detail-D49NuNCn.cjs.map +1 -0
  24. package/dist/chunks/{detail-B_bSg31B.js → detail-URwxkcro.js} +1036 -847
  25. package/dist/chunks/detail-URwxkcro.js.map +1 -0
  26. package/dist/chunks/{providers-H_vPRsSN.js → providers-B_d5tbCL.js} +178 -167
  27. package/dist/chunks/providers-B_d5tbCL.js.map +1 -0
  28. package/dist/chunks/providers-chuJvMgv.cjs +2 -0
  29. package/dist/chunks/providers-chuJvMgv.cjs.map +1 -0
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/next/index.cjs +1 -1
  33. package/dist/next/index.js +1 -1
  34. package/dist/next/workflow-chat-route.cjs +1 -0
  35. package/dist/next/workflow-chat-route.cjs.map +1 -1
  36. package/dist/next/workflow-chat-route.d.cts +1 -1
  37. package/dist/next/workflow-chat-route.d.ts +1 -1
  38. package/dist/next/workflow-chat-route.js +1 -1
  39. package/dist/next/workflow-chat-route.js.map +1 -1
  40. package/dist/pages/instances/detail/index.cjs +1 -1
  41. package/dist/pages/instances/detail/index.js +1 -1
  42. package/dist/pages/templates/compose/index.cjs +1 -1
  43. package/dist/pages/templates/compose/index.js +1 -1
  44. package/dist/pages/templates/designer/index.cjs +1 -1
  45. package/dist/pages/templates/designer/index.js +1 -1
  46. package/dist/views/forms/builder/index.cjs +1 -1
  47. package/dist/views/forms/builder/index.js +1 -1
  48. package/dist/views/forms/renderer/FormRendererView.d.cts +16 -1
  49. package/dist/views/forms/renderer/FormRendererView.d.ts +16 -1
  50. package/dist/views/forms/renderer/index.cjs +1 -1
  51. package/dist/views/forms/renderer/index.js +1 -1
  52. package/dist/views/inbox/index.cjs +1 -1
  53. package/dist/views/inbox/index.cjs.map +1 -1
  54. package/dist/views/inbox/index.js +109 -99
  55. package/dist/views/inbox/index.js.map +1 -1
  56. package/dist/views/instances/approver-filled-form.d.cts +76 -0
  57. package/dist/views/instances/approver-filled-form.d.ts +76 -0
  58. package/dist/views/instances/detail/index.cjs +1 -1
  59. package/dist/views/instances/detail/index.js +1 -1
  60. package/dist/views/instances/detail/sections/InstanceFormSection.d.cts +30 -2
  61. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +30 -2
  62. package/dist/views/instances/detail/sections/InstanceHistorySection.d.cts +4 -1
  63. package/dist/views/instances/detail/sections/InstanceHistorySection.d.ts +4 -1
  64. package/dist/views/instances/detail/sections/InstanceTasksSection.d.cts +21 -0
  65. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +21 -0
  66. package/dist/views/instances/detail/sections/container-helpers.d.cts +1 -1
  67. package/dist/views/instances/detail/sections/container-helpers.d.ts +1 -1
  68. package/dist/views/instances/detail/sections/shared.d.cts +11 -2
  69. package/dist/views/instances/detail/sections/shared.d.ts +11 -2
  70. package/dist/views/instances/new/index.cjs +1 -1
  71. package/dist/views/instances/new/index.cjs.map +1 -1
  72. package/dist/views/instances/new/index.js +88 -87
  73. package/dist/views/instances/new/index.js.map +1 -1
  74. package/dist/views/instances/viewer-field-access.d.cts +22 -0
  75. package/dist/views/instances/viewer-field-access.d.ts +22 -0
  76. package/dist/views/templates/compose/index.cjs +1 -1
  77. package/dist/views/templates/compose/index.js +1 -1
  78. package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.cts +33 -0
  79. package/dist/views/templates/designer/field-access-matrix/FieldAccessMatrixDrawer.d.ts +33 -0
  80. package/dist/views/templates/designer/field-access-matrix/FieldAccessNodeSection.d.cts +20 -0
  81. package/dist/views/templates/designer/field-access-matrix/FieldAccessNodeSection.d.ts +20 -0
  82. package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.cts +22 -0
  83. package/dist/views/templates/designer/field-access-matrix/field-access-copy.d.ts +22 -0
  84. package/dist/views/templates/designer/index.cjs +1 -1
  85. package/dist/views/templates/designer/index.js +1 -1
  86. package/package.json +3 -3
  87. package/dist/chunks/FormRendererView-DRFi_IH7.cjs +0 -4
  88. package/dist/chunks/FormRendererView-DRFi_IH7.cjs.map +0 -1
  89. package/dist/chunks/FormRendererView-cZGOOjU5.js.map +0 -1
  90. package/dist/chunks/designer-CTXMqCD2.cjs +0 -65
  91. package/dist/chunks/designer-CTXMqCD2.cjs.map +0 -1
  92. package/dist/chunks/designer-DBBrktom.js.map +0 -1
  93. package/dist/chunks/detail-BQSVgVlO.cjs +0 -2
  94. package/dist/chunks/detail-BQSVgVlO.cjs.map +0 -1
  95. package/dist/chunks/detail-B_bSg31B.js.map +0 -1
  96. package/dist/chunks/providers-DP7b0TMN.cjs +0 -2
  97. package/dist/chunks/providers-DP7b0TMN.cjs.map +0 -1
  98. package/dist/chunks/providers-H_vPRsSN.js.map +0 -1
@@ -5,20 +5,22 @@ import { t as n } from "./bpm-form-field-Cao0rMol.js";
5
5
  import { t as r } from "./use-bpm-member-D57LKe_u.js";
6
6
  import { t as i } from "./format-member-label-DudVI55w.js";
7
7
  import { t as a } from "./task-node-label-CWZgOBj0.js";
8
- import { o, t as s } from "./FormRendererView-cZGOOjU5.js";
8
+ import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p, t as ee, u as m } from "./approver-filled-form-DuQGPtNB.js";
9
+ import { o as te, t as ne } from "./FormRendererView-BsTwZkqU.js";
9
10
  import '../style.css';import '../detail.css';/* empty css */
10
- import { Fragment as c, forwardRef as l, useCallback as u, useEffect as d, useImperativeHandle as f, useMemo as p, useRef as m, useState as h } from "react";
11
- import { AutoComplete as ee, Badge as g, Button as _, Input as v, Modal as y, PageHeader as te, Section as b, SectionGroup as ne, Select as x, Stepper as re, Table as ie, Textarea as ae, Tooltip as S, Typography as C } from "@mezzanine-ui/react";
12
- import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
13
- import { cancelAdhocDirective as oe, cancelApprovalInstance as se, configureAdhocCompletionNotification as ce, configureAdhocStageNotification as le, decideTask as ue, listAdhocDirectives as de, listAttachments as fe, listTaskDecisions as pe, listWorkflowWebhookDeliveries as me, readApprovalInstance as he, readAttachmentDownloadUrl as ge, readAttachmentPreviewUrl as _e, readInstanceSignatures as ve, requestAdhocCountersign as ye, requestAdhocPreApproval as be, resolveMemberProfiles as xe, resubmitApprovalInstance as Se, retryWorkflowWebhookDelivery as Ce, searchMembers as we, uploadAttachment as Te } from "@rytass/bpm-core-client/workflow";
14
- import Ee from "@mezzanine-ui/react/ContentHeader";
15
- import { CheckedIcon as De, ChevronLeftIcon as Oe, ChevronRightIcon as ke, DangerousOutlineIcon as Ae, DownloadIcon as D, FileSearchIcon as je, NotificationUnreadIcon as Me, PlusIcon as Ne, RefreshCcwIcon as Pe, ResetIcon as O, ShareIcon as Fe, UserIcon as Ie, ZoomInIcon as Le, ZoomOutIcon as Re } from "@mezzanine-ui/icons";
16
- import { buildFormRendererValues as ze, focusFormRendererField as Be, readFormDataSourceErrorMessage as Ve, validateFormRendererValues as k } from "@rytass/bpm-core-client/form";
17
- import { Background as He, Controls as Ue, Handle as We, Position as A, ReactFlow as Ge } from "@xyflow/react";
18
- import * as Ke from "dagre";
19
- import { Document as qe, Page as Je } from "react-pdf";
20
- import { stepClasses as j } from "@mezzanine-ui/core/stepper";
21
- var M = {
11
+ import { Fragment as re, forwardRef as h, useCallback as ie, useEffect as g, useImperativeHandle as ae, useMemo as _, useRef as oe, useState as v } from "react";
12
+ import { AutoComplete as se, Badge as ce, Button as y, Description as b, DescriptionContent as le, InlineMessage as x, Input as ue, Message as de, Modal as S, PageHeader as fe, Section as pe, SectionGroup as me, Select as C, Stepper as he, Table as ge, Textarea as _e, Tooltip as ve, Typography as w } from "@mezzanine-ui/react";
13
+ import { Fragment as ye, jsx as T, jsxs as E } from "react/jsx-runtime";
14
+ import { cancelAdhocDirective as be, cancelApprovalInstance as xe, configureAdhocCompletionNotification as Se, configureAdhocStageNotification as Ce, decideTask as we, listAdhocDirectives as Te, listAttachments as Ee, listTaskDecisions as D, listWorkflowWebhookDeliveries as De, readApprovalInstance as Oe, readAttachmentDownloadUrl as ke, readAttachmentPreviewUrl as Ae, readInstanceSignatures as je, requestAdhocCountersign as Me, requestAdhocPreApproval as Ne, resolveMemberProfiles as Pe, resubmitApprovalInstance as Fe, retryWorkflowWebhookDelivery as Ie, searchMembers as O, uploadAttachment as Le } from "@rytass/bpm-core-client/workflow";
15
+ import Re from "@mezzanine-ui/react/ContentHeader";
16
+ import { CheckedIcon as ze, ChevronLeftIcon as Be, ChevronRightIcon as Ve, DangerousOutlineIcon as He, DownloadIcon as Ue, FileSearchIcon as We, NotificationUnreadIcon as Ge, PlusIcon as Ke, RefreshCcwIcon as k, ResetIcon as qe, ShareIcon as Je, UserIcon as Ye, ZoomInIcon as Xe, ZoomOutIcon as A } from "@mezzanine-ui/icons";
17
+ import { readNodeFillableFieldKeys as Ze, readRevealedFieldKeys as Qe, readTopLevelFieldKey as $e, resolveFieldAccess as et } from "@rytass/bpm-core-shared";
18
+ import { buildFormRendererValues as tt, focusFormRendererField as nt, readFormDataSourceErrorMessage as rt, validateFormRendererValues as j } from "@rytass/bpm-core-client/form";
19
+ import { Background as M, Controls as it, Handle as at, Position as N, ReactFlow as ot } from "@xyflow/react";
20
+ import * as P from "dagre";
21
+ import { Document as st, Page as ct } from "react-pdf";
22
+ import { stepClasses as F } from "@mezzanine-ui/core/stepper";
23
+ var I = {
22
24
  root: "bpm_root_ehm7w",
23
25
  toolbar: "bpm_toolbar_R-tis",
24
26
  pageControls: "bpm_pageControls_jM-rC",
@@ -27,56 +29,56 @@ var M = {
27
29
  viewport: "bpm_viewport_DQXms",
28
30
  page: "bpm_page_Cv5Rg",
29
31
  state: "bpm_state_bpgp3"
30
- }, Ye = 760, Xe = 920, N = 320, P = 32, F = .75, Ze = 1.75, I = .25;
31
- function Qe({ filename: e, fileUrl: t, onDownload: n }) {
32
- let r = m(null), [i, a] = h(null), [o, s] = h(1), [c, l] = h(1), [f, ee] = h(Ye);
33
- d(() => {
32
+ }, lt = 760, ut = 920, dt = 320, ft = 32, pt = .75, L = 1.75, mt = .25;
33
+ function ht({ filename: e, fileUrl: t, onDownload: n }) {
34
+ let r = oe(null), [i, a] = v(null), [o, s] = v(1), [c, l] = v(1), [u, d] = v(lt);
35
+ g(() => {
34
36
  let e = r.current;
35
37
  if (!e || typeof ResizeObserver > "u") return;
36
38
  let t = new ResizeObserver((e) => {
37
39
  let t = e[0]?.contentRect.width;
38
- t && ee(t);
40
+ t && d(t);
39
41
  });
40
42
  return t.observe(e), () => t.disconnect();
41
- }, []), d(() => {
43
+ }, []), g(() => {
42
44
  a(null), s(1), l(1);
43
45
  }, [t]);
44
- let g = p(() => {
45
- let e = Math.max(N, f - P);
46
- return Math.round(Math.min(Xe, e) * c);
47
- }, [c, f]), v = u((e) => {
46
+ let f = _(() => {
47
+ let e = Math.max(dt, u - ft);
48
+ return Math.round(Math.min(ut, e) * c);
49
+ }, [c, u]), p = ie((e) => {
48
50
  a(e.numPages), s(1);
49
- }, []), y = o > 1, te = i !== null && o < i, b = c > F, ne = c < Ze, x = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, re = `${Math.round(c * 100)}%`;
51
+ }, []), ee = o > 1, m = i !== null && o < i, te = c > pt, ne = c < L, re = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, h = `${Math.round(c * 100)}%`;
50
52
  return /* @__PURE__ */ E("section", {
51
53
  "aria-label": `${e} PDF 預覽`,
52
- className: M.root,
54
+ className: I.root,
53
55
  children: [/* @__PURE__ */ E("div", {
54
- className: M.toolbar,
56
+ className: I.toolbar,
55
57
  children: [
56
58
  /* @__PURE__ */ E("div", {
57
- className: M.pageControls,
59
+ className: I.pageControls,
58
60
  "aria-label": "頁面切換",
59
61
  children: [
60
- /* @__PURE__ */ T(_, {
62
+ /* @__PURE__ */ T(y, {
61
63
  "aria-label": "上一頁",
62
- disabled: !y,
63
- icon: Oe,
64
+ disabled: !ee,
65
+ icon: Be,
64
66
  onClick: () => {
65
67
  s((e) => Math.max(1, e - 1));
66
68
  },
67
69
  size: "minor",
68
70
  variant: "base-secondary"
69
71
  }),
70
- /* @__PURE__ */ T(C, {
71
- className: M.counter,
72
+ /* @__PURE__ */ T(w, {
73
+ className: I.counter,
72
74
  component: "span",
73
75
  variant: "body",
74
- children: x
76
+ children: re
75
77
  }),
76
- /* @__PURE__ */ T(_, {
78
+ /* @__PURE__ */ T(y, {
77
79
  "aria-label": "下一頁",
78
- disabled: !te,
79
- icon: ke,
80
+ disabled: !m,
81
+ icon: Ve,
80
82
  onClick: () => {
81
83
  s((e) => i === null ? e : Math.min(i, e + 1));
82
84
  },
@@ -86,39 +88,39 @@ function Qe({ filename: e, fileUrl: t, onDownload: n }) {
86
88
  ]
87
89
  }),
88
90
  /* @__PURE__ */ E("div", {
89
- className: M.zoomControls,
91
+ className: I.zoomControls,
90
92
  "aria-label": "縮放",
91
93
  children: [
92
- /* @__PURE__ */ T(_, {
94
+ /* @__PURE__ */ T(y, {
93
95
  "aria-label": "縮小",
94
- disabled: !b,
95
- icon: Re,
96
+ disabled: !te,
97
+ icon: A,
96
98
  onClick: () => {
97
- l((e) => Math.max(F, e - I));
99
+ l((e) => Math.max(pt, e - mt));
98
100
  },
99
101
  size: "minor",
100
102
  variant: "base-secondary"
101
103
  }),
102
- /* @__PURE__ */ T(C, {
103
- className: M.counter,
104
+ /* @__PURE__ */ T(w, {
105
+ className: I.counter,
104
106
  component: "span",
105
107
  variant: "body",
106
- children: re
108
+ children: h
107
109
  }),
108
- /* @__PURE__ */ T(_, {
110
+ /* @__PURE__ */ T(y, {
109
111
  "aria-label": "放大",
110
112
  disabled: !ne,
111
- icon: Le,
113
+ icon: Xe,
112
114
  onClick: () => {
113
- l((e) => Math.min(Ze, e + I));
115
+ l((e) => Math.min(L, e + mt));
114
116
  },
115
117
  size: "minor",
116
118
  variant: "base-secondary"
117
119
  })
118
120
  ]
119
121
  }),
120
- n ? /* @__PURE__ */ T(_, {
121
- icon: D,
122
+ n ? /* @__PURE__ */ T(y, {
123
+ icon: Ue,
122
124
  iconType: "leading",
123
125
  onClick: n,
124
126
  size: "minor",
@@ -127,31 +129,31 @@ function Qe({ filename: e, fileUrl: t, onDownload: n }) {
127
129
  }) : null
128
130
  ]
129
131
  }), /* @__PURE__ */ T("div", {
130
- className: M.viewport,
132
+ className: I.viewport,
131
133
  ref: r,
132
- children: /* @__PURE__ */ T(qe, {
133
- error: /* @__PURE__ */ T(L, { message: "PDF 無法載入。" }),
134
+ children: /* @__PURE__ */ T(st, {
135
+ error: /* @__PURE__ */ T(R, { message: "PDF 無法載入。" }),
134
136
  file: t,
135
- loading: /* @__PURE__ */ T(L, { message: "正在載入 PDF..." }),
136
- noData: /* @__PURE__ */ T(L, { message: "沒有可預覽的 PDF。" }),
137
- onLoadSuccess: v,
137
+ loading: /* @__PURE__ */ T(R, { message: "正在載入 PDF..." }),
138
+ noData: /* @__PURE__ */ T(R, { message: "沒有可預覽的 PDF。" }),
139
+ onLoadSuccess: p,
138
140
  suspense: !1,
139
- children: /* @__PURE__ */ T(Je, {
140
- className: M.page,
141
- loading: /* @__PURE__ */ T(L, { message: "正在載入頁面..." }),
141
+ children: /* @__PURE__ */ T(ct, {
142
+ className: I.page,
143
+ loading: /* @__PURE__ */ T(R, { message: "正在載入頁面..." }),
142
144
  pageNumber: o,
143
145
  renderAnnotationLayer: !0,
144
146
  renderTextLayer: !0,
145
- width: g
147
+ width: f
146
148
  })
147
149
  })
148
150
  })]
149
151
  });
150
152
  }
151
- function L({ message: e }) {
153
+ function R({ message: e }) {
152
154
  return /* @__PURE__ */ T("div", {
153
- className: M.state,
154
- children: /* @__PURE__ */ T(C, {
155
+ className: I.state,
156
+ children: /* @__PURE__ */ T(w, {
155
157
  color: "text-neutral",
156
158
  variant: "body",
157
159
  children: e
@@ -160,113 +162,117 @@ function L({ message: e }) {
160
162
  }
161
163
  //#endregion
162
164
  //#region src/views/instances/detail/submitted-by.ts
163
- function $e({ initiatorMemberId: e, submittedByMemberId: t }) {
165
+ function gt({ initiatorMemberId: e, submittedByMemberId: t }) {
164
166
  return t && t !== e ? t : null;
165
167
  }
166
- function et(e, t) {
167
- let n = $e(e);
168
+ function _t(e, t) {
169
+ let n = gt(e);
168
170
  if (!n || !e.initiatorMemberId) return null;
169
171
  let r = (e) => t.get(e)?.name ?? e;
170
172
  return `由 ${r(n)} 代 ${r(e.initiatorMemberId)} 送出`;
171
173
  }
172
174
  //#endregion
173
175
  //#region src/views/instances/detail/sections/shared.ts
174
- function tt(e) {
175
- let t = R(e, "from"), n = R(e, "to"), r = R(e, "reason");
176
+ function vt(e) {
177
+ let t = z(e, "from"), n = z(e, "to"), r = z(e, "reason");
176
178
  return !t || !n || !r ? null : {
177
179
  from: t,
178
180
  reason: r,
179
- ruleId: R(e, "ruleId"),
181
+ ruleId: z(e, "ruleId"),
180
182
  to: n
181
183
  };
182
184
  }
183
- function nt(e) {
185
+ function yt(e) {
184
186
  try {
185
187
  let t = JSON.parse(e);
186
- return Array.isArray(t) ? t.map((e) => at(e) ? tt(e) : null).filter((e) => e !== null) : [];
188
+ return Array.isArray(t) ? t.map((e) => xt(e) ? vt(e) : null).filter((e) => e !== null) : [];
187
189
  } catch {
188
190
  return [];
189
191
  }
190
192
  }
191
- function R(e, t) {
193
+ function z(e, t) {
192
194
  let n = e[t];
193
195
  return typeof n == "string" ? n : null;
194
196
  }
195
- function rt(e, t) {
197
+ function B(e, t) {
196
198
  let n = e[t];
197
199
  return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
198
200
  }
199
- function it(e, t) {
201
+ function bt(e, t) {
200
202
  let n = e[t];
201
203
  return typeof n == "number" ? n : null;
202
204
  }
203
- function z(e) {
205
+ function V(e) {
204
206
  return typeof e == "string" && e.trim().length > 0;
205
207
  }
206
- function at(e) {
208
+ function xt(e) {
207
209
  return typeof e == "object" && !!e;
208
210
  }
209
- function ot(e) {
211
+ function St(e) {
210
212
  return e.status === "PENDING" || e.status === "IN_PROGRESS";
211
213
  }
212
- function B(e) {
213
- return Ve(e) || (e instanceof Error ? e.message : "發生未知錯誤");
214
+ function H(e) {
215
+ return rt(e) || (e instanceof Error ? e.message : "發生未知錯誤");
214
216
  }
215
- function st(e) {
217
+ function U(e) {
216
218
  return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
217
219
  }
218
- function ct(e) {
220
+ function W(e) {
219
221
  return e.length > 16 ? `${e.slice(0, 12)}...` : e;
220
222
  }
221
- function lt(e) {
223
+ function Ct(e) {
222
224
  return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
223
225
  }
224
- function V(e) {
226
+ function wt(e) {
225
227
  return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
226
228
  }
227
- function ut(e) {
229
+ function Tt(e) {
228
230
  return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
229
231
  }
230
- function H(e) {
232
+ function G(e) {
231
233
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
232
234
  }
233
- function dt(e, t) {
235
+ function Et(e, t) {
234
236
  return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
235
237
  }
236
- function U(e, t) {
238
+ function K(e, t) {
237
239
  if (!e) return "-";
238
240
  let n = t.get(e);
239
241
  return n ? i(n.name, n.email, "fullwidth") : e;
240
242
  }
241
- function W(e, t = /* @__PURE__ */ new Map()) {
242
- let n = nt(e.delegationChainJson);
243
- if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => U(e, t)).join("、")}` : "未指定";
244
- let r = U(e.assigneeMemberId, t), i = U(e.originalAssigneeMemberId, t);
243
+ function Dt(e, t = /* @__PURE__ */ new Map()) {
244
+ let n = yt(e.delegationChainJson);
245
+ if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => K(e, t)).join("、")}` : "未指定";
246
+ let r = K(e.assigneeMemberId, t), i = K(e.originalAssigneeMemberId, t);
245
247
  return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
246
248
  }
247
- function ft(e, t) {
249
+ function Ot(e, t) {
248
250
  return t ? e.assigneeMemberId === t || (e.openCandidateMemberIds ?? e.candidateMemberIds).includes(t) : !1;
249
251
  }
250
- function G(e, t) {
252
+ function kt(e, t) {
253
+ let n = e.filter((e) => Ot(e, t) && (e.status === "PENDING" || e.status === "IN_PROGRESS"));
254
+ return n.find((e) => !e.isAdhoc) ?? n[0] ?? null;
255
+ }
256
+ function At(e, t) {
251
257
  if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
252
258
  if (t.data.returnBehavior.allowedTargets === "ANY") return e.nodes.filter((e) => e.id !== t.id).map((e) => ({
253
259
  id: e.id,
254
- name: `${e.data.label}(${H(e.type)})`
260
+ name: `${e.data.label}(${G(e.type)})`
255
261
  }));
256
262
  let n = t.data.returnBehavior.allowedTargets === "INITIATOR" ? e.nodes.find((e) => e.type === "startEvent")?.id : e.edges.find((e) => e.target === t.id)?.source, r = e.nodes.find((e) => e.id === n);
257
263
  return r ? [{
258
264
  id: r.id,
259
- name: `${r.data.label}(${H(r.type)})`
265
+ name: `${r.data.label}(${G(r.type)})`
260
266
  }] : [];
261
267
  }
262
- function pt(e) {
268
+ function q(e) {
263
269
  return {
264
270
  email: e.email,
265
271
  id: e.memberId,
266
272
  name: i(e.name, e.email, "dot")
267
273
  };
268
274
  }
269
- function mt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
275
+ function jt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
270
276
  if (t) {
271
277
  let e = n.trim();
272
278
  return e ? {
@@ -291,11 +297,11 @@ function mt({ memberIds: e, useWebhookTarget: t, webhookUrl: n }) {
291
297
  valid: !1
292
298
  };
293
299
  }
294
- function ht(e) {
300
+ function Mt(e) {
295
301
  return !!e;
296
302
  }
297
- function gt(e) {
298
- if (!at(e)) return null;
303
+ function Nt(e) {
304
+ if (!xt(e)) return null;
299
305
  let t = e.email, n = e.id, r = e.name;
300
306
  return typeof n == "string" && typeof r == "string" ? {
301
307
  email: typeof t == "string" ? t : null,
@@ -303,7 +309,7 @@ function gt(e) {
303
309
  name: r
304
310
  } : null;
305
311
  }
306
- function _t(e, t) {
312
+ function Pt(e, t) {
307
313
  let n = e.trim().toLocaleLowerCase();
308
314
  if (!n) return null;
309
315
  let r = t.filter((e) => [
@@ -313,21 +319,21 @@ function _t(e, t) {
313
319
  ].some((e) => e.toLocaleLowerCase().includes(n)));
314
320
  return r.length === 1 ? r[0] ?? null : null;
315
321
  }
316
- function K(e) {
317
- return z(e) ? {
322
+ function J(e) {
323
+ return V(e) ? {
318
324
  text: e,
319
325
  type: "text"
320
326
  } : null;
321
327
  }
322
- function q(e, t, n = "neutral") {
323
- return z(t) ? {
328
+ function Ft(e, t, n = "neutral") {
329
+ return V(t) ? {
324
330
  label: e,
325
331
  text: t,
326
332
  tone: n,
327
333
  type: "comment"
328
334
  } : null;
329
335
  }
330
- function vt(e, t, n, r) {
336
+ function It(e, t, n, r) {
331
337
  let i = t ? n.get(t) : null;
332
338
  return {
333
339
  email: i?.email ?? null,
@@ -337,43 +343,43 @@ function vt(e, t, n, r) {
337
343
  type: "member"
338
344
  };
339
345
  }
340
- function J(e) {
346
+ function Y(e) {
341
347
  return !!e;
342
348
  }
343
- function Y(e) {
349
+ function X(e) {
344
350
  let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
345
351
  return t === -1 ? e.length : t;
346
352
  }
347
- function yt(e) {
348
- return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || bt(e) || Z(e.eventType, wt(e));
353
+ function Z(e) {
354
+ return e.eventType === "INSTANCE_STARTED" || e.eventType === "INSTANCE_CANCELLED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED" || e.eventType === "TASK_CANDIDATE_ACTIVATED" || e.eventType === "TASK_REASSIGNED" || Lt(e) || Q(e.eventType, Ut(e));
349
355
  }
350
- function bt(e) {
351
- return e.eventType === "TASK_CREATED" && rt(wt(e), "sequentialCandidateMemberIds").length > 0;
356
+ function Lt(e) {
357
+ return e.eventType === "TASK_CREATED" && B(Ut(e), "sequentialCandidateMemberIds").length > 0;
352
358
  }
353
- function xt(e) {
359
+ function Rt(e) {
354
360
  if (e.eventType !== "TASK_CANDIDATE_ACTIVATED" && e.eventType !== "TASK_CREATED") return [];
355
- let t = wt(e);
361
+ let t = Ut(e);
356
362
  return [
357
- ...rt(t, "sequentialCandidateMemberIds"),
358
- R(t, "candidateMemberId"),
359
- R(t, "previousMemberId")
360
- ].filter(z);
363
+ ...B(t, "sequentialCandidateMemberIds"),
364
+ z(t, "candidateMemberId"),
365
+ z(t, "previousMemberId")
366
+ ].filter(V);
361
367
  }
362
- var X = /* @__PURE__ */ new Set([
368
+ var zt = /* @__PURE__ */ new Set([
363
369
  "SERVICE_TASK_EXECUTED",
364
370
  "SERVICE_TASK_FAILED",
365
371
  "WEBHOOK_DELIVERY_RETRIED"
366
372
  ]);
367
- function Z(e, t) {
368
- return X.has(e) && R(t, "action") === "NOTIFY_WEBHOOK";
373
+ function Q(e, t) {
374
+ return zt.has(e) && z(t, "action") === "NOTIFY_WEBHOOK";
369
375
  }
370
- function St(e) {
371
- return R(e, "endpointLabel") ?? R(e, "endpointKey") ?? "外部系統";
376
+ function Bt(e) {
377
+ return z(e, "endpointLabel") ?? z(e, "endpointKey") ?? "外部系統";
372
378
  }
373
- function Ct(e) {
379
+ function Vt(e) {
374
380
  return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
375
381
  }
376
- function Q(e, t) {
382
+ function Ht(e, t) {
377
383
  if (e === "INSTANCE_STARTED") return "案件已發起";
378
384
  if (e === "INSTANCE_CANCELLED") return "案件已取消";
379
385
  if (e === "INSTANCE_EXPIRED") return "案件逾期,已由系統終止";
@@ -382,170 +388,179 @@ function Q(e, t) {
382
388
  if (e === "TOKEN_ADVANCED") return "流程已前進";
383
389
  if (e === "TASK_CREATED") return "待簽任務已建立";
384
390
  if (e === "TASK_CANDIDATE_ACTIVATED") return "輪到下一位簽核";
385
- if (e === "TASK_DECIDED") return Ct(R(t, "action"));
391
+ if (e === "TASK_DECIDED") return Vt(z(t, "action"));
386
392
  if (e === "SLA_TRIGGERED") return "時限提醒已觸發";
387
393
  if (e === "TASK_REASSIGNED") return "管理者改派待辦";
388
- if (Z(e, t)) {
389
- let n = St(t);
394
+ if (Q(e, t)) {
395
+ let n = Bt(t);
390
396
  return e === "SERVICE_TASK_EXECUTED" ? `已通知外部系統:${n}` : e === "SERVICE_TASK_FAILED" ? `通知外部系統失敗:${n}` : `管理者重新傳送外部系統通知:${n}`;
391
397
  }
392
398
  return e;
393
399
  }
394
- function wt(e) {
400
+ function Ut(e) {
395
401
  try {
396
402
  let t = JSON.parse(e.payloadJson);
397
- return at(t) ? t : {};
403
+ return xt(t) ? t : {};
398
404
  } catch {
399
405
  return {};
400
406
  }
401
407
  }
402
- function Tt(e, t) {
403
- return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && Z(e.eventType, t) || R(t, "action") === "REJECTED" || R(t, "instanceState") === "REJECTED";
408
+ function Wt(e, t) {
409
+ return e.eventType === "SLA_TRIGGERED" || e.eventType === "INSTANCE_EXPIRED" || e.eventType === "SERVICE_TASK_FAILED" && Q(e.eventType, t) || z(t, "action") === "REJECTED" || z(t, "instanceState") === "REJECTED";
404
410
  }
405
- function Et(e) {
411
+ function Gt(e) {
406
412
  return t(e);
407
413
  }
408
- function Dt(e, t, n, r) {
409
- if (e.eventType === "INSTANCE_STARTED") return et({
414
+ function Kt(e, t, n, r) {
415
+ if (e.eventType === "INSTANCE_STARTED") return _t({
410
416
  initiatorMemberId: e.actorMemberId,
411
- submittedByMemberId: R(t, "submittedByMemberId")
417
+ submittedByMemberId: z(t, "submittedByMemberId")
412
418
  }, r);
413
419
  if (e.eventType === "TASK_CANDIDATE_ACTIVATED") {
414
- let e = R(t, "candidateMemberId"), n = R(t, "previousMemberId");
420
+ let e = z(t, "candidateMemberId"), n = z(t, "previousMemberId");
415
421
  if (!e) return null;
416
- let i = U(e, r);
417
- return n ? `輪到:${i}(前一位:${U(n, r)})` : `輪到:${i}`;
422
+ let i = K(e, r);
423
+ return n ? `輪到:${i}(前一位:${K(n, r)})` : `輪到:${i}`;
418
424
  }
419
425
  if (e.eventType === "TASK_CREATED") {
420
- let e = rt(t, "sequentialCandidateMemberIds");
421
- if (e.length) return `簽核順序:${e.map((e) => U(e, r)).join(" → ")}`;
422
- let n = R(t, "assigneeMemberId"), i = R(t, "originalAssigneeMemberId");
426
+ let e = B(t, "sequentialCandidateMemberIds");
427
+ if (e.length) return `簽核順序:${e.map((e) => K(e, r)).join(" → ")}`;
428
+ let n = z(t, "assigneeMemberId"), i = z(t, "originalAssigneeMemberId");
423
429
  if (!n) {
424
- let e = rt(t, "candidateMemberIds");
425
- return e.length ? `候選簽核人:${e.map((e) => U(e, r)).join("、")}` : null;
430
+ let e = B(t, "candidateMemberIds");
431
+ return e.length ? `候選簽核人:${e.map((e) => K(e, r)).join("、")}` : null;
426
432
  }
427
- let a = U(n, r), o = U(i, r);
433
+ let a = K(n, r), o = K(i, r);
428
434
  return i && i !== n ? `待簽人:${a}(原簽核人:${o})` : `待簽人:${a}`;
429
435
  }
430
436
  if (e.eventType === "TASK_DECIDED") {
431
- let e = R(t, "action"), n = R(t, "comment"), i = e ? `決議:${ut(e)}` : null, a = R(t, "transferToMemberId");
432
- return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(z).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(z).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${U(a, r)}`].filter(z).join(" · ") : i;
437
+ let e = z(t, "action"), n = z(t, "comment"), i = e ? `決議:${Tt(e)}` : null, a = z(t, "transferToMemberId");
438
+ return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(V).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(V).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${K(a, r)}`].filter(V).join(" · ") : i;
433
439
  }
434
440
  if (e.eventType === "TOKEN_ADVANCED") {
435
- let e = R(t, "action");
436
- if (e) return `流程結果:${ut(e)}`;
437
- let r = it(t, "arrivedCount"), i = it(t, "requiredCount");
441
+ let e = z(t, "action");
442
+ if (e) return `流程結果:${Tt(e)}`;
443
+ let r = bt(t, "arrivedCount"), i = bt(t, "requiredCount");
438
444
  if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
439
- let a = R(t, "fromNodeId"), o = R(t, "toNodeId");
440
- if (a && o) return `由 ${dt(a, n)} 前進至 ${dt(o, n)}`;
445
+ let a = z(t, "fromNodeId"), o = z(t, "toNodeId");
446
+ if (a && o) return `由 ${Et(a, n)} 前進至 ${Et(o, n)}`;
441
447
  }
442
448
  if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
443
- let e = R(t, "state");
444
- return e ? `案件狀態:${lt(e)}` : null;
449
+ let e = z(t, "state");
450
+ return e ? `案件狀態:${Ct(e)}` : null;
445
451
  }
446
452
  return null;
447
453
  }
448
- function Ot(e, t, n, r, i, a, o) {
449
- if (e.eventType !== "TASK_DECIDED") return [K(Dt(e, t, n, o))].filter(J);
450
- let s = e.taskId ? r.get(e.taskId) : null, c = R(t, "action") ?? s?.action ?? null, l = R(t, "comment") ?? s?.comment ?? null, u = R(t, "transferToMemberId") ?? s?.transferToMemberId ?? null, d = R(t, "signatureId") ?? s?.signatureId ?? null, f = d ? i.get(d) : null;
454
+ function qt(e, t, n, r, i, a, o, s = null) {
455
+ if (e.eventType !== "TASK_DECIDED") return [J(Kt(e, t, n, o))].filter(Y);
456
+ let c = e.taskId ? r.get(e.taskId) : null, l = z(t, "action") ?? c?.action ?? null, u = z(t, "comment") ?? c?.comment ?? null, d = z(t, "transferToMemberId") ?? c?.transferToMemberId ?? null, f = z(t, "signatureId") ?? c?.signatureId ?? null, p = f ? i.get(f) : null;
451
457
  return [
452
- K(c ? `決議:${ut(c)}` : null),
453
- c === "REJECTED" ? q("拒絕原因", l ?? "-", "danger") : null,
454
- c === "APPROVED" ? q("同意說明", l) : null,
455
- c === "RETURNED" ? q("退回說明", l ?? "-") : null,
456
- c === "TRANSFERRED" ? K(`轉派給:${U(u, o)}`) : null,
457
- c === "TRANSFERRED" ? q("轉派說明", l ?? "-") : null,
458
- f ? K(a?.valid ? `簽章:已驗證(${ct(f.signedPayloadHash)})` : `簽章:待檢查(${ct(f.signedPayloadHash)})`) : null
459
- ].filter(J);
460
- }
461
- function $(e, t, n, r, i) {
458
+ J(l ? `決議:${Tt(l)}` : null),
459
+ l === "REJECTED" ? Ft("拒絕原因", u ?? "-", "danger") : null,
460
+ l === "APPROVED" ? Ft("同意說明", u) : null,
461
+ l === "RETURNED" ? Ft("退回說明", u ?? "-") : null,
462
+ l === "TRANSFERRED" ? J(`轉派給:${K(d, o)}`) : null,
463
+ l === "TRANSFERRED" ? Ft("轉派說明", u ?? "-") : null,
464
+ J(Jt(t, s)),
465
+ p ? J(a?.valid ? `簽章:已驗證(${W(p.signedPayloadHash)})` : `簽章:待檢查(${W(p.signedPayloadHash)})`) : null
466
+ ].filter(Y);
467
+ }
468
+ function Jt(e, t) {
469
+ let n = e.changedFieldKeys;
470
+ if (!Array.isArray(n)) return null;
471
+ let r = n.filter((e) => typeof e == "string" && e !== "");
472
+ if (r.length === 0) return null;
473
+ let i = r.map((e) => t?.fields.find((t) => t.fieldKey === e)?.label || e);
474
+ return `補填 ${r.length} 個欄位:${i.join("、")}`;
475
+ }
476
+ function Yt(e, t, n, r, i) {
462
477
  if (e.type === "startEvent" || i.has(e.id)) return !1;
463
478
  if (r === "REJECTED") return !0;
464
- let a = Rt(e, t, n, r);
479
+ let a = on(e, t, n, r);
465
480
  return a.tone === "neutral" || a.tone === "waiting";
466
481
  }
467
- function kt(e, t, n, r, i) {
482
+ function Xt(e, t, n, r, i) {
468
483
  if (r !== "RUNNING" && r !== "REJECTED") return [];
469
- let a = e.nodes.filter((e) => $(e, t, n, r, i)), o = At(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
484
+ let a = e.nodes.filter((e) => Yt(e, t, n, r, i)), o = Zt(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
470
485
  return a.filter((e) => o.has(e.id)).sort((e, t) => {
471
486
  let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
472
487
  return n === r ? e.position.x === t.position.x ? e.position.y === t.position.y ? (s.get(e.id) ?? 0) - (s.get(t.id) ?? 0) : e.position.y - t.position.y : e.position.x - t.position.x : n - r;
473
488
  });
474
489
  }
475
- function At(e, t, n, r, i) {
490
+ function Zt(e, t, n, r, i) {
476
491
  let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
477
492
  let n = [...e.get(t.source) ?? [], t.target];
478
493
  return new Map(e).set(t.source, n);
479
494
  }, /* @__PURE__ */ new Map());
480
- return jt(e, n, r, i).reduce((e, t) => Pt(e, Mt(t, o, a)), /* @__PURE__ */ new Map());
495
+ return Qt(e, n, r, i).reduce((e, t) => tn(e, $t(t, o, a)), /* @__PURE__ */ new Map());
481
496
  }
482
- function jt(e, t, n, r) {
483
- let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(ot).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
497
+ function Qt(e, t, n, r) {
498
+ let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(St).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [.../* @__PURE__ */ new Set([
484
499
  ...i,
485
500
  ...a,
486
501
  ...o
487
502
  ])], c = e.nodes.filter((e) => e.type === "startEvent").map((e) => e.id);
488
503
  return s.length > 0 ? s : c;
489
504
  }
490
- function Mt(e, t, n) {
491
- return Nt([{
505
+ function $t(e, t, n) {
506
+ return en([{
492
507
  distance: 0,
493
508
  nodeId: e
494
509
  }], t, n);
495
510
  }
496
- function Nt(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
511
+ function en(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
497
512
  let [a, ...o] = e;
498
513
  if (!a) return i;
499
- if (r.has(a.nodeId)) return Nt(o, t, n, r, i);
514
+ if (r.has(a.nodeId)) return en(o, t, n, r, i);
500
515
  let s = new Set(r).add(a.nodeId), c = n.has(a.nodeId) ? new Map(i).set(a.nodeId, Math.min(i.get(a.nodeId) ?? a.distance, a.distance)) : i;
501
- return Nt([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
516
+ return en([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
502
517
  distance: a.distance + 1,
503
518
  nodeId: e
504
519
  }))], t, n, s, c);
505
520
  }
506
- function Pt(e, t) {
521
+ function tn(e, t) {
507
522
  return [...t.entries()].reduce((e, [t, n]) => new Map(e).set(t, Math.min(e.get(t) ?? n, n)), e);
508
523
  }
509
- function Ft(e) {
524
+ function nn(e) {
510
525
  return e.type === "userTask" ? `未來簽核:${e.data.label}` : e.type === "serviceTask" ? `未來知會:${e.data.label}` : e.type === "exclusiveGateway" ? `未來分流:${e.data.label}` : e.type === "parallelGateway" ? `未來匯合:${e.data.label}` : e.type === "endEvent" ? `流程完成:${e.data.label}` : `未來節點:${e.data.label}`;
511
526
  }
512
- function It(e, t, n, r, i, a, o, s, c) {
513
- let l = e.filter(yt).map((e) => {
514
- let t = wt(e), n = e.nodeId ? dt(e.nodeId, r) : null;
527
+ function rn(e, t, n, r, i, a, o, s, c, l = null) {
528
+ let u = e.filter(Z).map((e) => {
529
+ let t = Ut(e), n = e.nodeId ? Et(e.nodeId, r) : null;
515
530
  return {
516
531
  descriptionParts: [
517
- K(n ? `節點:${n}` : "節點:全流程"),
518
- vt("操作者", e.actorMemberId, a, "系統"),
519
- K(`時間:${Et(e.createdAt)}`),
520
- ...Ot(e, t, r, o, s, c, a)
521
- ].filter(J),
522
- error: Tt(e, t),
532
+ J(n ? `節點:${n}` : "節點:全流程"),
533
+ It("操作者", e.actorMemberId, a, "系統"),
534
+ J(`時間:${Gt(e.createdAt)}`),
535
+ ...qt(e, t, r, o, s, c, a, l)
536
+ ].filter(Y),
537
+ error: Wt(e, t),
523
538
  id: e.id,
524
- title: Q(e.eventType, t)
539
+ title: Ht(e.eventType, t)
525
540
  };
526
- }), u = t.filter(ot).map((e) => ({
541
+ }), d = t.filter(St).map((e) => ({
527
542
  descriptionParts: [
528
- K(`節點:${dt(e.nodeId, r)}`),
529
- vt("處理者", e.assigneeMemberId, a, "未指定"),
530
- K(`建立時間:${Et(e.createdAt)}`)
531
- ].filter(J),
543
+ J(`節點:${Et(e.nodeId, r)}`),
544
+ It("處理者", e.assigneeMemberId, a, "未指定"),
545
+ J(`建立時間:${Gt(e.createdAt)}`)
546
+ ].filter(Y),
532
547
  error: !1,
533
548
  id: `pending-task-${e.id}`,
534
549
  title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
535
- })), d = new Set([...e.filter(yt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(z)), f = r ? kt(r, t, n, i, d).map((e) => ({
536
- descriptionParts: [K(`${H(e.type)} · 尚未抵達`)].filter(J),
550
+ })), f = new Set([...e.filter(Z).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(V)), p = r ? Xt(r, t, n, i, f).map((e) => ({
551
+ descriptionParts: [J(`${G(e.type)} · 尚未抵達`)].filter(Y),
537
552
  error: !1,
538
553
  forcePending: !0,
539
554
  id: `future-node-${e.id}`,
540
- title: Ft(e)
555
+ title: nn(e)
541
556
  })) : [];
542
557
  return [
543
- ...l,
544
558
  ...u,
545
- ...f
559
+ ...d,
560
+ ...p
546
561
  ];
547
562
  }
548
- var Lt = {
563
+ var an = {
549
564
  APPROVED: {
550
565
  statusLabel: "已完成",
551
566
  tone: "completed"
@@ -563,20 +578,20 @@ var Lt = {
563
578
  tone: "cancelled"
564
579
  }
565
580
  };
566
- function Rt(e, t, n, r) {
581
+ function on(e, t, n, r) {
567
582
  let i = t.filter((t) => t.nodeId === e.id), a = i.find((e) => e.status === "PENDING" || e.status === "IN_PROGRESS"), o = i.find((e) => e.status === "CANCELLED"), s = i.find((e) => e.status === "COMPLETED"), c = n.filter((t) => t.currentNodeId === e.id), l = c.find((e) => e.status === "ACTIVE"), u = c.find((e) => e.status === "WAITING");
568
583
  if (a) return {
569
- secondaryLabel: `處理者 ${W(a)}`,
584
+ secondaryLabel: `處理者 ${Dt(a)}`,
570
585
  statusLabel: "待處理",
571
586
  tone: "current"
572
587
  };
573
588
  if (o) return {
574
- secondaryLabel: `已取消 ${W(o)}`,
589
+ secondaryLabel: `已取消 ${Dt(o)}`,
575
590
  statusLabel: "已取消",
576
591
  tone: "cancelled"
577
592
  };
578
593
  if (s) return {
579
- secondaryLabel: `已完成 ${W(s)}`,
594
+ secondaryLabel: `已完成 ${Dt(s)}`,
580
595
  statusLabel: "已完成",
581
596
  tone: "completed"
582
597
  };
@@ -595,47 +610,47 @@ function Rt(e, t, n, r) {
595
610
  statusLabel: "已發起",
596
611
  tone: "completed"
597
612
  };
598
- let d = e.type === "endEvent" ? Lt[r] : void 0;
613
+ let d = e.type === "endEvent" ? an[r] : void 0;
599
614
  return d ? {
600
615
  ...d,
601
616
  secondaryLabel: r
602
617
  } : {
603
- secondaryLabel: H(e.type),
618
+ secondaryLabel: G(e.type),
604
619
  statusLabel: "未抵達",
605
620
  tone: "neutral"
606
621
  };
607
622
  }
608
623
  //#endregion
609
624
  //#region src/views/instances/detail/sections/container-helpers.ts
610
- async function zt({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks: r }) {
625
+ async function sn({ activityLogs: e, adhocDirectives: t = [], instance: n, tasks: r }) {
611
626
  let i = [...new Set([
612
627
  n?.initiatorMemberId ?? null,
613
628
  n?.submittedByMemberId ?? null,
614
629
  ...e.map((e) => e.actorMemberId),
615
- ...e.flatMap(xt),
630
+ ...e.flatMap(Rt),
616
631
  ...r.map((e) => e.assigneeMemberId),
617
632
  ...r.map((e) => e.originalAssigneeMemberId),
618
633
  ...r.flatMap((e) => e.candidateMemberIds),
619
- ...r.flatMap((e) => nt(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
620
- ...t.flatMap((e) => [e.createdByMemberId, ...Bt(e.targetValueJson)])
621
- ].filter(z))];
634
+ ...r.flatMap((e) => yt(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
635
+ ...t.flatMap((e) => [e.createdByMemberId, ...cn(e.targetValueJson)])
636
+ ].filter(V))];
622
637
  try {
623
- return await xe(i);
638
+ return await Pe(i);
624
639
  } catch {
625
640
  return [];
626
641
  }
627
642
  }
628
- function Bt(e) {
643
+ function cn(e) {
629
644
  try {
630
645
  return (JSON.parse(e).memberIds ?? []).filter((e) => typeof e == "string");
631
646
  } catch {
632
647
  return [];
633
648
  }
634
649
  }
635
- async function Vt(e) {
636
- return (await Promise.all(e.map((e) => pe(e.id)))).flat();
650
+ async function ln(e) {
651
+ return (await Promise.all(e.map((e) => D(e.id)))).flat();
637
652
  }
638
- function Ht(e) {
653
+ function un(e) {
639
654
  return e.reduce((e, t) => {
640
655
  let n = e.get(t.taskId), r = !n || new Date(t.decidedAt).getTime() > new Date(n.decidedAt).getTime() ? t : n;
641
656
  return new Map(e).set(t.taskId, r);
@@ -643,56 +658,85 @@ function Ht(e) {
643
658
  }
644
659
  //#endregion
645
660
  //#region src/views/instances/detail/sections/InstanceFormSection.tsx
646
- var Ut = {
661
+ var $ = {
647
662
  display: "grid",
648
663
  gap: 16
649
- }, Wt = {
664
+ }, dn = {
650
665
  display: "flex",
651
666
  flexWrap: "wrap",
652
667
  gap: 8
653
668
  };
654
- function Gt({ canResubmitInstance: e, deciding: t, error: n, instance: r, loading: i, onDataSourceStateChange: a, onResubmitFormChange: o, onResubmitInstance: c, onUploadAttachment: l, resubmitFormData: u, resubmitFormErrors: d }) {
669
+ function fn({ canResubmitInstance: e, deciding: t, error: n, fieldAccess: r, fieldLabelMarkers: i, fill: a = null, instance: o, loading: s, onDataSourceStateChange: c, onResubmitFormChange: l, onReloadAfterConflict: d = null, onResubmitInstance: f, onUploadAttachment: p, resubmitFormData: ee, resubmitFormErrors: m }) {
670
+ let te = o?.formDefinitionSnapshot.schema, re = o?.workflowSnapshot, h = _(() => e && te && re ? u(te, re) : a?.schema ?? te, [
671
+ e,
672
+ a?.schema,
673
+ te,
674
+ re
675
+ ]), ie = !e && a !== null;
655
676
  return /* @__PURE__ */ E("div", {
656
- style: Ut,
677
+ style: $,
657
678
  children: [
658
- n ? /* @__PURE__ */ T(C, {
679
+ n ? /* @__PURE__ */ T(w, {
659
680
  color: "text-error",
660
681
  variant: "body",
661
682
  children: n
662
683
  }) : null,
663
- i ? /* @__PURE__ */ T(C, {
684
+ s ? /* @__PURE__ */ T(w, {
664
685
  color: "text-neutral",
665
686
  variant: "body",
666
687
  children: "載入中..."
667
688
  }) : null,
668
- r?.formDefinitionSnapshot.schema && r.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(s, {
689
+ d ? /* @__PURE__ */ E("div", {
690
+ style: $,
691
+ children: [/* @__PURE__ */ T(x, {
692
+ content: "表單在你填寫期間被更新了,你填的內容還在。請重新載入後確認再同意。",
693
+ severity: "error"
694
+ }), /* @__PURE__ */ T("div", {
695
+ style: dn,
696
+ children: /* @__PURE__ */ T(y, {
697
+ disabled: s,
698
+ icon: k,
699
+ iconType: "leading",
700
+ onClick: d,
701
+ variant: "base-secondary",
702
+ children: "重新載入"
703
+ })
704
+ })]
705
+ }) : null,
706
+ ie && a.fieldCount > 0 ? /* @__PURE__ */ T(x, {
707
+ content: `本關需要你補填 ${a.fieldCount} 個欄位,按「同意」時會一起送出並納入簽章。`,
708
+ severity: "info"
709
+ }) : null,
710
+ h && o?.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ E(ye, { children: [/* @__PURE__ */ T(ne, {
669
711
  dataSourceContext: e ? {
670
- instanceId: r.id,
712
+ instanceId: o.id,
671
713
  kind: "runtime"
672
714
  } : void 0,
673
- dataSourceInitialValues: r.formData,
674
- errors: d,
715
+ dataSourceInitialValues: o.formData,
716
+ errors: ie ? a.errors : m,
717
+ ...!e && r ? { fieldAccess: r } : {},
718
+ ...!e && i ? { fieldLabelMarkers: i } : {},
675
719
  onChange: (e) => {
676
- o(e);
720
+ ie ? a.onChange(e) : l(e);
677
721
  },
678
- onDataSourceStateChange: a,
679
- onUploadAttachment: e ? l : void 0,
680
- optionSnapshots: r.formDataOptionSnapshot,
722
+ onDataSourceStateChange: c,
723
+ onUploadAttachment: e ? p : void 0,
724
+ optionSnapshots: o.formDataOptionSnapshot,
681
725
  readonly: !e,
682
- schema: r.formDefinitionSnapshot.schema,
683
- uiSchema: r.formDefinitionSnapshot.uiSchema,
684
- value: e ? u : r.formData
726
+ schema: h,
727
+ uiSchema: o.formDefinitionSnapshot.uiSchema,
728
+ value: e ? ee : ie ? a.value : o.formData
685
729
  }), e ? /* @__PURE__ */ T("div", {
686
- style: Wt,
687
- children: /* @__PURE__ */ T(_, {
730
+ style: dn,
731
+ children: /* @__PURE__ */ T(y, {
688
732
  disabled: t,
689
- icon: Pe,
733
+ icon: k,
690
734
  iconType: "leading",
691
- onClick: c,
735
+ onClick: f,
692
736
  variant: "base-primary",
693
737
  children: "重新送出"
694
738
  })
695
- }) : null] }) : /* @__PURE__ */ T(C, {
739
+ }) : null] }) : /* @__PURE__ */ T(w, {
696
740
  color: "text-neutral",
697
741
  variant: "body",
698
742
  children: "此案件沒有可顯示的表單快照。"
@@ -702,20 +746,20 @@ function Gt({ canResubmitInstance: e, deciding: t, error: n, instance: r, loadin
702
746
  }
703
747
  //#endregion
704
748
  //#region src/views/instances/detail/sections/InstanceAttachmentsSection.tsx
705
- var Kt = {
749
+ var pn = {
706
750
  display: "grid",
707
751
  gap: 16
708
752
  };
709
- function qt({ attachments: e, onDownload: n, onPreview: r }) {
710
- let i = p(() => e.map((e) => ({
753
+ function mn({ attachments: e, onDownload: n, onPreview: r }) {
754
+ let i = _(() => e.map((e) => ({
711
755
  attachment: e,
712
756
  createdAt: e.createdAt,
713
757
  filename: e.filename,
714
758
  id: e.id,
715
759
  key: e.id,
716
760
  mimeType: e.mimeType,
717
- sizeLabel: st(Number(e.sizeBytes))
718
- })), [e]), a = p(() => [
761
+ sizeLabel: U(Number(e.sizeBytes))
762
+ })), [e]), a = _(() => [
719
763
  {
720
764
  dataIndex: "filename",
721
765
  key: "filename",
@@ -736,7 +780,7 @@ function qt({ attachments: e, onDownload: n, onPreview: r }) {
736
780
  },
737
781
  {
738
782
  key: "createdAt",
739
- render: (e) => /* @__PURE__ */ T(C, {
783
+ render: (e) => /* @__PURE__ */ T(w, {
740
784
  component: "span",
741
785
  variant: "body",
742
786
  children: t(e.createdAt)
@@ -744,16 +788,16 @@ function qt({ attachments: e, onDownload: n, onPreview: r }) {
744
788
  title: "上傳時間",
745
789
  width: 220
746
790
  }
747
- ], []), o = p(() => ({
791
+ ], []), o = _(() => ({
748
792
  render: (e) => [...e.mimeType === "application/pdf" ? [{
749
- icon: je,
793
+ icon: We,
750
794
  iconType: "leading",
751
795
  name: "預覽",
752
796
  onClick: () => {
753
797
  r(e.attachment);
754
798
  }
755
799
  }] : [], {
756
- icon: D,
800
+ icon: Ue,
757
801
  iconType: "leading",
758
802
  name: "下載",
759
803
  onClick: () => {
@@ -764,17 +808,17 @@ function qt({ attachments: e, onDownload: n, onPreview: r }) {
764
808
  width: 160
765
809
  }), [n, r]);
766
810
  return /* @__PURE__ */ E("div", {
767
- style: Kt,
768
- children: [/* @__PURE__ */ T(C, {
811
+ style: pn,
812
+ children: [/* @__PURE__ */ T(w, {
769
813
  component: "h2",
770
814
  variant: "h3",
771
815
  children: "附件"
772
- }), i.length > 0 ? /* @__PURE__ */ T(ie, {
816
+ }), i.length > 0 ? /* @__PURE__ */ T(ge, {
773
817
  actions: o,
774
818
  columns: a,
775
819
  dataSource: i,
776
820
  fullWidth: !0
777
- }) : /* @__PURE__ */ T(C, {
821
+ }) : /* @__PURE__ */ T(w, {
778
822
  color: "text-neutral",
779
823
  variant: "body",
780
824
  children: "此案件沒有附件。"
@@ -783,58 +827,59 @@ function qt({ attachments: e, onDownload: n, onPreview: r }) {
783
827
  }
784
828
  //#endregion
785
829
  //#region src/views/instances/detail/sections/InstanceTasksSection.tsx
786
- var Jt = {
830
+ var hn = {
787
831
  display: "grid",
788
832
  gap: 12,
789
833
  width: "100%"
790
- }, Yt = {
834
+ }, gn = {
791
835
  minWidth: "100%",
792
836
  width: "100%"
793
- }, Xt = {
837
+ }, _n = {
794
838
  display: "grid",
795
839
  gap: 12,
796
840
  width: "100%"
797
- }, Zt = { marginTop: 12 }, Qt = { marginTop: 24 };
798
- function $t(e) {
841
+ }, vn = { marginTop: 12 }, yn = { marginTop: 24 };
842
+ function bn(e) {
799
843
  e && (e.style.width = "100%");
800
844
  }
801
- var en = {
845
+ var xn = {
802
846
  COMPLETION_NOTIFY: "結案通知",
803
847
  COUNTERSIGN: "臨時會簽",
804
848
  PRE_APPROVAL: "臨時加簽",
805
849
  STAGE_NOTIFY: "階段完成通知"
806
- }, tn = {
850
+ }, Sn = {
807
851
  COMPLETION_NOTIFY: "本張單到達結案狀態(核准 / 拒絕 / 取消)後,通知指定對象。",
808
852
  COUNTERSIGN: "指定對象會併入下一層簽核,下一層需所有人都完成才會繼續。",
809
853
  PRE_APPROVAL: "指定對象需先完成加簽,本階段才會往下一層繼續。",
810
854
  STAGE_NOTIFY: "本階段完成後(不論通過與否)通知指定對象。"
811
- }, nn = [{
855
+ }, Cn = [{
812
856
  id: "REJECT_INSTANCE",
813
857
  name: "加簽拒絕時整單駁回"
814
858
  }, {
815
859
  id: "RETURN_TO_ORIGIN",
816
860
  name: "加簽拒絕時退回給我重新處理"
817
- }], rn = [{
861
+ }], wn = [{
818
862
  id: "MEMBER",
819
863
  name: "指定成員"
820
864
  }, {
821
865
  id: "WEBHOOK",
822
866
  name: "Webhook"
823
- }], an = l(function({ adhocDirectives: e, currentMemberId: r, instance: i, memberProfilesById: o, onChanged: s, tasks: c }, l) {
824
- let [u, d] = h(!1), [m, g] = h(null), [te, b] = h(""), [ne, re] = h(!1), [S, se] = h(""), [de, fe] = h(null), [pe, me] = h(!1), [he, ge] = h(""), [_e, ve] = h(!1), [xe, Se] = h(null), [Ce, Te] = h(""), [Ee, De] = h(null), [Oe, ke] = h(!1), [Ae, D] = h([]), [je, Me] = h(!1), [Ne, Pe] = h(""), [O, Fe] = h([]), [Ie, Le] = h(!1), [Re, ze] = h([]), [Be, Ve] = h(!1), [k, He] = h("COUNTERSIGN"), [Ue, We] = h("REJECT_INSTANCE"), [A, Ge] = h(!1), [Ke, qe] = h("MEMBER"), [Je, j] = h(""), M = S.trim(), Ye = he.trim(), Xe = Ce.trim(), N = p(() => c.find((e) => ft(e, r) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [r, c]), P = p(() => N && i ? i.workflowSnapshot.nodes.find((e) => e.id === N.nodeId) ?? null : null, [N, i]), F = p(() => P && i ? G(i.workflowSnapshot, P) : [], [P, i]), Ze = P?.type === "userTask" && P.data.returnBehavior.allowReturn, I = P?.type === "userTask" && P.data.allowReject !== !1, Qe = P?.type === "userTask" && P.data.allowTransfer !== !1, L = P?.type === "userTask" && P.data.returnBehavior.requireComment === !0, $e = P?.type === "userTask" && P.data.allowAddSigner, et = p(() => e.filter((e) => e.status === "PENDING"), [e]), tt = F.find((e) => e.id === xe) ?? F[0] ?? null, nt = p(() => c.map((e) => ({
867
+ }], Tn = h(function({ adhocDirectives: e, currentMemberId: r, fill: i = null, instance: o, memberProfilesById: s, onChanged: c, onFillApproveError: l, tasks: u }, d) {
868
+ let [f, p] = v(!1), [ee, m] = v(null), [te, ne] = v(""), [re, h] = v(!1), [ie, g] = v(""), [oe, x] = v(null), [de, fe] = v(!1), [pe, me] = v(""), [he, ve] = v(!1), [xe, Te] = v(null), [Ee, D] = v(""), [De, Oe] = v(null), [ke, Ae] = v(!1), [je, Pe] = v([]), [Fe, Ie] = v(!1), [Le, Re] = v(""), [ze, Be] = v([]), [Ve, He] = v(!1), [Ue, We] = v([]), [Ge, Ke] = v(!1), [k, qe] = v("COUNTERSIGN"), [Je, Ye] = v("REJECT_INSTANCE"), [Xe, A] = v(!1), [Ze, Qe] = v("MEMBER"), [$e, et] = v(""), tt = ie.trim(), nt = pe.trim(), rt = Ee.trim(), j = _(() => kt(u, r), [r, u]), M = _(() => j && o ? o.workflowSnapshot.nodes.find((e) => e.id === j.nodeId) ?? null : null, [j, o]), it = _(() => M && o ? At(o.workflowSnapshot, M) : [], [M, o]), at = M?.type === "userTask" && M.data.returnBehavior.allowReturn, N = M?.type === "userTask" && M.data.allowReject !== !1, ot = M?.type === "userTask" && M.data.allowTransfer !== !1, P = M?.type === "userTask" && M.data.returnBehavior.requireComment === !0, st = M?.type === "userTask" && M.data.allowAddSigner, ct = _(() => e.filter((e) => e.status === "PENDING"), [e]), F = it.find((e) => e.id === xe) ?? it[0] ?? null, I = _(() => u.map((e) => ({
825
869
  ...e,
826
- assigneeLabel: W(e, o),
870
+ assigneeLabel: Dt(e, s),
871
+ fillFieldCount: Dn(e, o?.workflowSnapshot ?? null),
827
872
  key: e.id,
828
873
  nodeLabel: a({
829
874
  ...e,
830
- nodeLabel: dt(e.nodeId, i?.workflowSnapshot ?? null)
875
+ nodeLabel: Et(e.nodeId, o?.workflowSnapshot ?? null)
831
876
  }),
832
- statusLabel: V(e.status)
877
+ statusLabel: wt(e.status)
833
878
  })), [
834
- i,
835
879
  o,
836
- c
837
- ]), R = p(() => [
880
+ s,
881
+ u
882
+ ]), lt = _(() => [
838
883
  {
839
884
  dataIndex: "nodeLabel",
840
885
  key: "nodeLabel",
@@ -844,7 +889,7 @@ var en = {
844
889
  {
845
890
  key: "assigneeMemberId",
846
891
  title: "處理者",
847
- render: (e) => /* @__PURE__ */ T(C, {
892
+ render: (e) => /* @__PURE__ */ T(w, {
848
893
  component: "span",
849
894
  variant: "body",
850
895
  children: e.assigneeLabel
@@ -857,9 +902,19 @@ var en = {
857
902
  title: "狀態",
858
903
  width: 120
859
904
  },
905
+ {
906
+ key: "fill",
907
+ render: (e) => e.fillFieldCount > 0 ? /* @__PURE__ */ T(ce, {
908
+ size: "sub",
909
+ text: `需補填 ${e.fillFieldCount} 欄`,
910
+ variant: "dot-warning"
911
+ }) : null,
912
+ title: "補填",
913
+ width: 140
914
+ },
860
915
  {
861
916
  key: "createdAt",
862
- render: (e) => /* @__PURE__ */ T(C, {
917
+ render: (e) => /* @__PURE__ */ T(w, {
863
918
  component: "span",
864
919
  variant: "body",
865
920
  children: t(e.createdAt)
@@ -867,13 +922,13 @@ var en = {
867
922
  title: "建立時間",
868
923
  width: 220
869
924
  }
870
- ], []), rt = p(() => et.map((e) => ({
925
+ ], []), ut = _(() => ct.map((e) => ({
871
926
  ...e,
872
- createdByLabel: U(e.createdByMemberId, o),
927
+ createdByLabel: K(e.createdByMemberId, s),
873
928
  key: e.id,
874
- targetLabel: on(e, o),
875
- typeLabel: en[e.type]
876
- })), [o, et]), it = p(() => [
929
+ targetLabel: En(e, s),
930
+ typeLabel: xn[e.type]
931
+ })), [s, ct]), dt = _(() => [
877
932
  {
878
933
  dataIndex: "typeLabel",
879
934
  key: "typeLabel",
@@ -882,7 +937,7 @@ var en = {
882
937
  },
883
938
  {
884
939
  key: "targetLabel",
885
- render: (e) => /* @__PURE__ */ T(C, {
940
+ render: (e) => /* @__PURE__ */ T(w, {
886
941
  component: "span",
887
942
  variant: "body",
888
943
  children: e.targetLabel
@@ -892,7 +947,7 @@ var en = {
892
947
  },
893
948
  {
894
949
  key: "createdByLabel",
895
- render: (e) => /* @__PURE__ */ T(C, {
950
+ render: (e) => /* @__PURE__ */ T(w, {
896
951
  component: "span",
897
952
  variant: "body",
898
953
  children: e.createdByLabel
@@ -902,7 +957,7 @@ var en = {
902
957
  },
903
958
  {
904
959
  key: "createdAt",
905
- render: (e) => /* @__PURE__ */ T(C, {
960
+ render: (e) => /* @__PURE__ */ T(w, {
906
961
  component: "span",
907
962
  variant: "body",
908
963
  children: t(e.createdAt)
@@ -912,324 +967,342 @@ var en = {
912
967
  },
913
968
  {
914
969
  key: "actions",
915
- render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ T(_, {
916
- disabled: A,
917
- onClick: () => void Ct(e.id),
970
+ render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ T(y, {
971
+ disabled: Xe,
972
+ onClick: () => void Tt(e.id),
918
973
  size: "minor",
919
974
  variant: "destructive-secondary",
920
975
  children: "撤回"
921
- }) : /* @__PURE__ */ T(w, {}),
976
+ }) : /* @__PURE__ */ T(ye, {}),
922
977
  title: "操作",
923
978
  width: 100
924
979
  }
925
- ], [A, r]);
926
- async function z({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: i = null }) {
927
- if (!r || !N || e === "REJECTED" && !I || e === "TRANSFERRED" && !Qe) return !1;
928
- d(!0), g(null);
980
+ ], [Xe, r]);
981
+ async function ft({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: a = null }) {
982
+ if (!r || !j || e === "REJECTED" && !N || e === "TRANSFERRED" && !ot) return !1;
983
+ p(!0), m(null);
984
+ let o = e === "APPROVED" && i !== null && !j.isAdhoc ? {
985
+ expectedFormDataFingerprint: i.expectedFormDataFingerprint,
986
+ formData: i.formData
987
+ } : null;
929
988
  try {
930
- await ue({
989
+ await we({
931
990
  action: e,
932
991
  comment: t,
933
992
  decidedByMemberId: r,
993
+ fill: o,
934
994
  returnToNodeId: n,
935
- taskId: N.id,
936
- transferToMemberId: i
937
- }), me(!1), ve(!1), Me(!1), se(""), ge(""), Te(""), De(null), Se(null), fe(null);
995
+ taskId: j.id,
996
+ transferToMemberId: a
997
+ }), fe(!1), ve(!1), Ie(!1), g(""), me(""), D(""), Oe(null), Te(null), x(null);
938
998
  } catch (e) {
939
- return g(B(e)), d(!1), !1;
999
+ return p(!1), o !== null && e instanceof Error && l?.(e.message) === !0 ? (h(!1), !1) : (m(H(e)), !1);
940
1000
  }
941
1001
  try {
942
- await s();
1002
+ await c();
943
1003
  } catch (e) {
944
- g(B(e));
1004
+ m(H(e));
945
1005
  } finally {
946
- d(!1);
1006
+ p(!1);
947
1007
  }
948
1008
  return !0;
949
1009
  }
950
- function at() {
951
- r && N && (g(null), b(""), re(!0));
1010
+ function pt() {
1011
+ r && j && (m(null), h(!0));
952
1012
  }
953
- function ot() {
954
- u || (re(!1), b(""));
1013
+ function L() {
1014
+ f || (h(!1), ne(""));
955
1015
  }
956
- async function st() {
957
- u || await z({
1016
+ async function mt() {
1017
+ f || await ft({
958
1018
  action: "APPROVED",
959
1019
  comment: te.trim() || null
960
- }) && (re(!1), b(""));
1020
+ }) && (h(!1), ne(""));
961
1021
  }
962
- function ct() {
963
- I && (se(""), fe(null), me(!0));
1022
+ function ht() {
1023
+ N && (g(""), x(null), fe(!0));
964
1024
  }
965
- function lt() {
966
- u || (me(!1), se(""), fe(null));
1025
+ function R() {
1026
+ f || (fe(!1), g(""), x(null));
967
1027
  }
968
- function ut() {
969
- ge(""), Se(F[0]?.id ?? null), ve(!0);
1028
+ function gt() {
1029
+ me(""), Te(it[0]?.id ?? null), ve(!0);
970
1030
  }
971
- function H() {
972
- u || (ve(!1), ge(""), Se(null));
1031
+ function _t() {
1032
+ f || (ve(!1), me(""), Te(null));
973
1033
  }
974
- function K() {
975
- Qe && (Te(""), De(null), Me(!0), vt(""));
1034
+ function vt() {
1035
+ ot && (D(""), Oe(null), Ie(!0), z(""));
976
1036
  }
977
- function q() {
978
- u || (Me(!1), Te(""), De(null));
1037
+ function yt() {
1038
+ f || (Ie(!1), D(""), Oe(null));
979
1039
  }
980
- async function vt(e) {
981
- ke(!0);
1040
+ async function z(e) {
1041
+ Ae(!0);
982
1042
  try {
983
- D((await we(e)).filter((e) => e.memberId !== r).map(pt));
1043
+ Pe((await O(e)).filter((e) => e.memberId !== r).map(q));
984
1044
  } catch (e) {
985
- g(B(e));
1045
+ m(H(e));
986
1046
  } finally {
987
- ke(!1);
1047
+ Ae(!1);
988
1048
  }
989
1049
  }
990
- async function J() {
991
- I && (M ? await z({
1050
+ async function B() {
1051
+ N && (tt ? await ft({
992
1052
  action: "REJECTED",
993
- comment: M
994
- }) : fe("請輸入拒絕原因"));
1053
+ comment: tt
1054
+ }) : x("請輸入拒絕原因"));
995
1055
  }
996
- async function Y() {
997
- Qe && (Ee ? await z({
1056
+ async function bt() {
1057
+ ot && (De ? await ft({
998
1058
  action: "TRANSFERRED",
999
- comment: Xe || null,
1000
- transferToMemberId: Ee.id
1001
- }) : g("請選擇轉派對象"));
1059
+ comment: rt || null,
1060
+ transferToMemberId: De.id
1061
+ }) : m("請選擇轉派對象"));
1002
1062
  }
1003
- async function yt() {
1004
- await z({
1063
+ async function V() {
1064
+ await ft({
1005
1065
  action: "RETURNED",
1006
- comment: Ye || null,
1007
- returnToNodeId: tt?.id ?? null
1066
+ comment: nt || null,
1067
+ returnToNodeId: F?.id ?? null
1008
1068
  });
1009
1069
  }
1010
- function bt() {
1011
- Pe(""), Fe([]), We("REJECT_INSTANCE"), qe("MEMBER"), j("");
1070
+ function xt() {
1071
+ Re(""), Be([]), Ye("REJECT_INSTANCE"), Qe("MEMBER"), et("");
1012
1072
  }
1013
- function xt(e) {
1014
- He(e), bt(), Ve(!0), Z("");
1073
+ function St(e) {
1074
+ qe(e), xt(), Ke(!0), W("");
1015
1075
  }
1016
- function X() {
1017
- A || (Ve(!1), bt());
1076
+ function U() {
1077
+ Xe || (Ke(!1), xt());
1018
1078
  }
1019
- async function Z(e) {
1020
- Le(!0);
1079
+ async function W(e) {
1080
+ He(!0);
1021
1081
  try {
1022
- ze((await we(e)).map(pt));
1082
+ We((await O(e)).map(q));
1023
1083
  } catch (e) {
1024
- g(B(e));
1084
+ m(H(e));
1025
1085
  } finally {
1026
- Le(!1);
1086
+ He(!1);
1027
1087
  }
1028
1088
  }
1029
- async function St() {
1030
- if (!N) return;
1031
- let e = (k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY") && Ke === "WEBHOOK", t = mt({
1032
- memberIds: O.map((e) => e.id),
1089
+ async function Ct() {
1090
+ if (!j) return;
1091
+ let e = (k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY") && Ze === "WEBHOOK", t = jt({
1092
+ memberIds: ze.map((e) => e.id),
1033
1093
  useWebhookTarget: e,
1034
- webhookUrl: Je
1094
+ webhookUrl: $e
1035
1095
  });
1036
1096
  if (!t.valid) {
1037
- g(t.error);
1097
+ m(t.error);
1038
1098
  return;
1039
1099
  }
1040
- let { target: n } = t, r = Ne.trim() || null;
1041
- Ge(!0), g(null);
1100
+ let { target: n } = t, r = Le.trim() || null;
1101
+ A(!0), m(null);
1042
1102
  try {
1043
- k === "COUNTERSIGN" ? await ye({
1103
+ k === "COUNTERSIGN" ? await Me({
1044
1104
  comment: r,
1045
1105
  target: n,
1046
- taskId: N.id
1047
- }) : k === "PRE_APPROVAL" ? await be({
1106
+ taskId: j.id
1107
+ }) : k === "PRE_APPROVAL" ? await Ne({
1048
1108
  comment: r,
1049
- onReject: Ue,
1109
+ onReject: Je,
1050
1110
  target: n,
1051
- taskId: N.id
1052
- }) : k === "STAGE_NOTIFY" ? await le({
1111
+ taskId: j.id
1112
+ }) : k === "STAGE_NOTIFY" ? await Ce({
1053
1113
  target: n,
1054
- taskId: N.id
1055
- }) : await ce({
1114
+ taskId: j.id
1115
+ }) : await Se({
1056
1116
  target: n,
1057
- taskId: N.id
1058
- }), Ve(!1), bt(), await s();
1117
+ taskId: j.id
1118
+ }), Ke(!1), xt(), await c();
1059
1119
  } catch (e) {
1060
- g(B(e));
1120
+ m(H(e));
1061
1121
  } finally {
1062
- Ge(!1);
1122
+ A(!1);
1063
1123
  }
1064
1124
  }
1065
- async function Ct(e) {
1066
- Ge(!0), g(null);
1125
+ async function Tt(e) {
1126
+ A(!0), m(null);
1067
1127
  try {
1068
- await oe(e), await s();
1128
+ await be(e), await c();
1069
1129
  } catch (e) {
1070
- g(B(e));
1130
+ m(H(e));
1071
1131
  } finally {
1072
- Ge(!1);
1132
+ A(!1);
1073
1133
  }
1074
1134
  }
1075
- f(l, () => ({
1076
- canAddSignerCurrentTask: $e,
1077
- canRejectCurrentTask: I,
1078
- canReturnCurrentTask: Ze,
1079
- canTransferCurrentTask: Qe,
1080
- deciding: u,
1081
- handleApprove: at,
1082
- hasCurrentTask: N !== null,
1083
- openAdhocModal: xt,
1084
- openRejectModal: ct,
1085
- openReturnModal: ut,
1086
- openTransferModal: K
1135
+ ae(d, () => ({
1136
+ canAddSignerCurrentTask: st,
1137
+ canRejectCurrentTask: N,
1138
+ canReturnCurrentTask: at,
1139
+ canTransferCurrentTask: ot,
1140
+ deciding: f,
1141
+ handleApprove: pt,
1142
+ hasCurrentTask: j !== null,
1143
+ openAdhocModal: St,
1144
+ openRejectModal: ht,
1145
+ openReturnModal: gt,
1146
+ openTransferModal: vt
1087
1147
  }), [
1088
- $e,
1089
- I,
1090
- Ze,
1091
- Qe,
1092
- r,
1148
+ st,
1093
1149
  N,
1094
- u
1150
+ at,
1151
+ ot,
1152
+ r,
1153
+ j,
1154
+ f
1095
1155
  ]);
1096
- let Q = k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY", wt = Q && Ke === "WEBHOOK" ? !Je.trim() : O.length === 0, Tt = nn.find((e) => e.id === Ue) ?? nn[0], Et = rn.find((e) => e.id === Ke) ?? rn[0];
1097
- return /* @__PURE__ */ E(w, { children: [
1098
- /* @__PURE__ */ T(C, {
1156
+ let G = k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY", Ot = G && Ze === "WEBHOOK" ? !$e.trim() : ze.length === 0, J = Cn.find((e) => e.id === Je) ?? Cn[0], Ft = wn.find((e) => e.id === Ze) ?? wn[0];
1157
+ return /* @__PURE__ */ E(ye, { children: [
1158
+ /* @__PURE__ */ T(w, {
1099
1159
  component: "h2",
1100
1160
  variant: "h3",
1101
1161
  children: "任務"
1102
1162
  }),
1103
- m ? /* @__PURE__ */ T(C, {
1163
+ ee ? /* @__PURE__ */ T(w, {
1104
1164
  color: "text-error",
1105
1165
  variant: "body",
1106
- children: m
1166
+ children: ee
1107
1167
  }) : null,
1108
1168
  /* @__PURE__ */ T("div", {
1109
- style: Zt,
1110
- children: /* @__PURE__ */ T(ie, {
1111
- columns: R,
1112
- dataSource: nt,
1169
+ style: vn,
1170
+ children: /* @__PURE__ */ T(ge, {
1171
+ columns: lt,
1172
+ dataSource: I,
1113
1173
  fullWidth: !0
1114
1174
  })
1115
1175
  }),
1116
- et.length > 0 ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(C, {
1176
+ ct.length > 0 ? /* @__PURE__ */ E(ye, { children: [/* @__PURE__ */ T(w, {
1117
1177
  component: "h3",
1118
- style: Qt,
1178
+ style: yn,
1119
1179
  variant: "h3",
1120
1180
  children: "待生效的臨時設定"
1121
1181
  }), /* @__PURE__ */ T("div", {
1122
- style: Zt,
1123
- children: /* @__PURE__ */ T(ie, {
1124
- columns: it,
1125
- dataSource: rt,
1182
+ style: vn,
1183
+ children: /* @__PURE__ */ T(ge, {
1184
+ columns: dt,
1185
+ dataSource: ut,
1126
1186
  fullWidth: !0
1127
1187
  })
1128
1188
  })] }) : null,
1129
- /* @__PURE__ */ E(y, {
1189
+ /* @__PURE__ */ E(S, {
1130
1190
  cancelText: "取消",
1131
1191
  confirmText: "送出同意",
1132
- loading: u,
1192
+ loading: f,
1133
1193
  modalType: "standard",
1134
- onCancel: ot,
1135
- onClose: ot,
1136
- onConfirm: () => void st(),
1137
- open: ne,
1194
+ onCancel: L,
1195
+ onClose: L,
1196
+ onConfirm: () => void mt(),
1197
+ open: re,
1138
1198
  showModalFooter: !0,
1139
1199
  showModalHeader: !0,
1140
1200
  size: "regular",
1141
1201
  supportingText: "可以留下同意的說明,內容會記錄在簽核歷程;不填也可以直接送出。",
1142
1202
  title: "簽核意見",
1143
- children: [m ? /* @__PURE__ */ T(C, {
1144
- color: "text-error",
1145
- role: "alert",
1146
- variant: "body",
1147
- children: m
1148
- }) : null, /* @__PURE__ */ T("div", {
1149
- style: Jt,
1150
- children: /* @__PURE__ */ T(n, {
1151
- label: "簽核意見",
1152
- name: "approveComment",
1153
- children: /* @__PURE__ */ T(ae, {
1154
- autoFocus: !0,
1155
- onChange: (e) => b(e.target.value),
1156
- placeholder: "選填,例如補充核准的條件或提醒事項",
1157
- ref: $t,
1158
- resize: "vertical",
1159
- rows: 4,
1160
- style: Yt,
1161
- value: te
1203
+ children: [
1204
+ ee ? /* @__PURE__ */ T(w, {
1205
+ color: "text-error",
1206
+ role: "alert",
1207
+ variant: "body",
1208
+ children: ee
1209
+ }) : null,
1210
+ i !== null && i.summary.length > 0 ? /* @__PURE__ */ E("div", {
1211
+ style: hn,
1212
+ children: [/* @__PURE__ */ T(w, {
1213
+ variant: "body",
1214
+ children: "將一併送出的補填欄位:"
1215
+ }), i.summary.map((e) => /* @__PURE__ */ T(b, {
1216
+ title: e.label,
1217
+ children: /* @__PURE__ */ T(le, { children: e.text })
1218
+ }, e.fieldKey))]
1219
+ }) : null,
1220
+ /* @__PURE__ */ T("div", {
1221
+ style: hn,
1222
+ children: /* @__PURE__ */ T(n, {
1223
+ label: "簽核意見",
1224
+ name: "approveComment",
1225
+ children: /* @__PURE__ */ T(_e, {
1226
+ autoFocus: !0,
1227
+ onChange: (e) => ne(e.target.value),
1228
+ placeholder: "選填,例如補充核准的條件或提醒事項",
1229
+ ref: bn,
1230
+ resize: "vertical",
1231
+ rows: 4,
1232
+ style: gn,
1233
+ value: te
1234
+ })
1162
1235
  })
1163
1236
  })
1164
- })]
1237
+ ]
1165
1238
  }),
1166
- /* @__PURE__ */ T(y, {
1239
+ /* @__PURE__ */ T(S, {
1167
1240
  cancelText: "取消",
1168
1241
  confirmButtonProps: {
1169
- disabled: !M,
1242
+ disabled: !tt,
1170
1243
  variant: "destructive-primary"
1171
1244
  },
1172
1245
  confirmText: "送出拒絕",
1173
- loading: u,
1246
+ loading: f,
1174
1247
  modalStatusType: "error",
1175
1248
  modalType: "standard",
1176
- onCancel: lt,
1177
- onClose: lt,
1178
- onConfirm: () => void J(),
1179
- open: pe,
1249
+ onCancel: R,
1250
+ onClose: R,
1251
+ onConfirm: () => void B(),
1252
+ open: de,
1180
1253
  showModalFooter: !0,
1181
1254
  showModalHeader: !0,
1182
1255
  size: "regular",
1183
1256
  supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
1184
1257
  title: "拒絕原因",
1185
1258
  children: /* @__PURE__ */ E("div", {
1186
- style: Jt,
1259
+ style: hn,
1187
1260
  children: [/* @__PURE__ */ T(n, {
1188
1261
  label: "拒絕原因",
1189
1262
  name: "rejectReason",
1190
1263
  required: !0,
1191
- children: /* @__PURE__ */ T(ae, {
1264
+ children: /* @__PURE__ */ T(_e, {
1192
1265
  autoFocus: !0,
1193
1266
  onChange: (e) => {
1194
- se(e.target.value), fe(null);
1267
+ g(e.target.value), x(null);
1195
1268
  },
1196
1269
  placeholder: "請說明拒絕原因",
1197
- ref: $t,
1270
+ ref: bn,
1198
1271
  resize: "vertical",
1199
1272
  rows: 4,
1200
- style: Yt,
1201
- type: de ? "error" : "default",
1202
- value: S
1273
+ style: gn,
1274
+ type: oe ? "error" : "default",
1275
+ value: ie
1203
1276
  })
1204
- }), de ? /* @__PURE__ */ T(C, {
1277
+ }), oe ? /* @__PURE__ */ T(w, {
1205
1278
  color: "text-error",
1206
1279
  variant: "body",
1207
- children: de
1280
+ children: oe
1208
1281
  }) : null]
1209
1282
  })
1210
1283
  }),
1211
- /* @__PURE__ */ T(y, {
1284
+ /* @__PURE__ */ T(S, {
1212
1285
  cancelText: "取消",
1213
- confirmButtonProps: { disabled: !Ee },
1286
+ confirmButtonProps: { disabled: !De },
1214
1287
  confirmText: "送出轉派",
1215
- loading: u,
1288
+ loading: f,
1216
1289
  modalType: "standard",
1217
- onCancel: q,
1218
- onClose: q,
1219
- onConfirm: () => void Y(),
1220
- open: je,
1290
+ onCancel: yt,
1291
+ onClose: yt,
1292
+ onConfirm: () => void bt(),
1293
+ open: Fe,
1221
1294
  showModalFooter: !0,
1222
1295
  showModalHeader: !0,
1223
1296
  size: "regular",
1224
1297
  supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
1225
1298
  title: "轉派簽核",
1226
1299
  children: /* @__PURE__ */ E("div", {
1227
- style: Xt,
1300
+ style: _n,
1228
1301
  children: [/* @__PURE__ */ T(n, {
1229
1302
  label: "轉派對象",
1230
1303
  name: "transferToMemberId",
1231
1304
  required: !0,
1232
- children: /* @__PURE__ */ T(ee, {
1305
+ children: /* @__PURE__ */ T(se, {
1233
1306
  asyncData: !0,
1234
1307
  disabledOptionsFilter: !0,
1235
1308
  emptyText: "沒有符合的成員",
@@ -1239,147 +1312,147 @@ var en = {
1239
1312
  name: "transfer-member-search",
1240
1313
  spellCheck: !1
1241
1314
  },
1242
- loading: Oe,
1315
+ loading: ke,
1243
1316
  loadingText: "搜尋成員中...",
1244
1317
  mode: "single",
1245
- onChange: (e) => De(gt(e)),
1246
- onSearch: vt,
1247
- onSearchTextChange: (e) => De(_t(e, Ae)),
1318
+ onChange: (e) => Oe(Nt(e)),
1319
+ onSearch: z,
1320
+ onSearchTextChange: (e) => Oe(Pt(e, je)),
1248
1321
  onVisibilityChange: (e) => {
1249
- e && vt("");
1322
+ e && z("");
1250
1323
  },
1251
- options: [...Ae],
1324
+ options: [...je],
1252
1325
  placeholder: "搜尋姓名或信箱",
1253
1326
  searchDebounceTime: 300,
1254
- value: Ee
1327
+ value: De
1255
1328
  })
1256
1329
  }), /* @__PURE__ */ T(n, {
1257
1330
  label: "轉派說明",
1258
1331
  name: "transferComment",
1259
- children: /* @__PURE__ */ T(ae, {
1260
- onChange: (e) => Te(e.target.value),
1332
+ children: /* @__PURE__ */ T(_e, {
1333
+ onChange: (e) => D(e.target.value),
1261
1334
  placeholder: "可補充轉派原因",
1262
- ref: $t,
1335
+ ref: bn,
1263
1336
  resize: "vertical",
1264
1337
  rows: 4,
1265
- style: Yt,
1266
- value: Ce
1338
+ style: gn,
1339
+ value: Ee
1267
1340
  })
1268
1341
  })]
1269
1342
  })
1270
1343
  }),
1271
- /* @__PURE__ */ T(y, {
1344
+ /* @__PURE__ */ T(S, {
1272
1345
  cancelText: "取消",
1273
- confirmButtonProps: { disabled: !tt || L && !Ye },
1346
+ confirmButtonProps: { disabled: !F || P && !nt },
1274
1347
  confirmText: "送出退回",
1275
- loading: u,
1348
+ loading: f,
1276
1349
  modalType: "standard",
1277
- onCancel: H,
1278
- onClose: H,
1279
- onConfirm: () => void yt(),
1280
- open: _e,
1350
+ onCancel: _t,
1351
+ onClose: _t,
1352
+ onConfirm: () => void V(),
1353
+ open: he,
1281
1354
  showModalFooter: !0,
1282
1355
  showModalHeader: !0,
1283
1356
  size: "regular",
1284
1357
  supportingText: "退回後,流程會回到指定節點並等待重新處理。",
1285
1358
  title: "退回簽核",
1286
1359
  children: /* @__PURE__ */ E("div", {
1287
- style: Xt,
1360
+ style: _n,
1288
1361
  children: [/* @__PURE__ */ T(n, {
1289
1362
  label: "退回節點",
1290
1363
  name: "returnTargetNodeId",
1291
1364
  required: !0,
1292
- children: /* @__PURE__ */ T(x, {
1365
+ children: /* @__PURE__ */ T(C, {
1293
1366
  clearable: !1,
1294
1367
  fullWidth: !0,
1295
- onChange: (e) => Se(e?.id ?? null),
1296
- options: [...F],
1368
+ onChange: (e) => Te(e?.id ?? null),
1369
+ options: [...it],
1297
1370
  placeholder: "選擇退回節點",
1298
- value: tt
1371
+ value: F
1299
1372
  })
1300
1373
  }), /* @__PURE__ */ T(n, {
1301
- hintText: L ? "此關卡設定退回時必須填寫意見。" : void 0,
1374
+ hintText: P ? "此關卡設定退回時必須填寫意見。" : void 0,
1302
1375
  label: "退回說明",
1303
1376
  name: "returnComment",
1304
- required: L,
1305
- children: /* @__PURE__ */ T(ae, {
1306
- onChange: (e) => ge(e.target.value),
1307
- placeholder: L ? "請說明退回原因" : "可補充需要修改的內容",
1308
- ref: $t,
1377
+ required: P,
1378
+ children: /* @__PURE__ */ T(_e, {
1379
+ onChange: (e) => me(e.target.value),
1380
+ placeholder: P ? "請說明退回原因" : "可補充需要修改的內容",
1381
+ ref: bn,
1309
1382
  resize: "vertical",
1310
1383
  rows: 4,
1311
- style: Yt,
1312
- value: he
1384
+ style: gn,
1385
+ value: pe
1313
1386
  })
1314
1387
  })]
1315
1388
  })
1316
1389
  }),
1317
- /* @__PURE__ */ T(y, {
1390
+ /* @__PURE__ */ T(S, {
1318
1391
  cancelText: "取消",
1319
- confirmButtonProps: { disabled: wt },
1392
+ confirmButtonProps: { disabled: Ot },
1320
1393
  confirmText: "送出",
1321
- loading: A,
1394
+ loading: Xe,
1322
1395
  modalType: "standard",
1323
- onCancel: X,
1324
- onClose: X,
1325
- onConfirm: () => void St(),
1326
- open: Be,
1396
+ onCancel: U,
1397
+ onClose: U,
1398
+ onConfirm: () => void Ct(),
1399
+ open: Ge,
1327
1400
  showModalFooter: !0,
1328
1401
  showModalHeader: !0,
1329
1402
  size: "regular",
1330
- supportingText: tn[k],
1331
- title: en[k],
1403
+ supportingText: Sn[k],
1404
+ title: xn[k],
1332
1405
  children: /* @__PURE__ */ E("div", {
1333
- style: Xt,
1406
+ style: _n,
1334
1407
  children: [
1335
- Q ? /* @__PURE__ */ T(n, {
1408
+ G ? /* @__PURE__ */ T(n, {
1336
1409
  label: "通知時機",
1337
1410
  name: "adhocNotifyMode",
1338
1411
  required: !0,
1339
- children: /* @__PURE__ */ T(x, {
1412
+ children: /* @__PURE__ */ T(C, {
1340
1413
  clearable: !1,
1341
1414
  fullWidth: !0,
1342
- onChange: (e) => He(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1415
+ onChange: (e) => qe(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1343
1416
  options: [{
1344
1417
  id: "STAGE_NOTIFY",
1345
- name: en.STAGE_NOTIFY
1418
+ name: xn.STAGE_NOTIFY
1346
1419
  }, {
1347
1420
  id: "COMPLETION_NOTIFY",
1348
- name: en.COMPLETION_NOTIFY
1421
+ name: xn.COMPLETION_NOTIFY
1349
1422
  }],
1350
1423
  value: {
1351
1424
  id: k,
1352
- name: en[k]
1425
+ name: xn[k]
1353
1426
  }
1354
1427
  })
1355
1428
  }) : null,
1356
- Q ? /* @__PURE__ */ T(n, {
1429
+ G ? /* @__PURE__ */ T(n, {
1357
1430
  label: "通知對象類型",
1358
1431
  name: "adhocTargetKind",
1359
1432
  required: !0,
1360
- children: /* @__PURE__ */ T(x, {
1433
+ children: /* @__PURE__ */ T(C, {
1361
1434
  clearable: !1,
1362
1435
  fullWidth: !0,
1363
- onChange: (e) => qe(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1364
- options: [...rn],
1365
- value: Et
1436
+ onChange: (e) => Qe(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1437
+ options: [...wn],
1438
+ value: Ft
1366
1439
  })
1367
1440
  }) : null,
1368
- Q && Ke === "WEBHOOK" ? /* @__PURE__ */ T(n, {
1441
+ G && Ze === "WEBHOOK" ? /* @__PURE__ */ T(n, {
1369
1442
  label: "Webhook URL",
1370
1443
  name: "adhocWebhookUrl",
1371
1444
  required: !0,
1372
- children: /* @__PURE__ */ T(v, {
1445
+ children: /* @__PURE__ */ T(ue, {
1373
1446
  fullWidth: !0,
1374
- onChange: (e) => j(e.target.value),
1447
+ onChange: (e) => et(e.target.value),
1375
1448
  placeholder: "https://example.com/webhook",
1376
- value: Je
1449
+ value: $e
1377
1450
  })
1378
1451
  }) : /* @__PURE__ */ T(n, {
1379
- label: Q ? "通知對象" : "簽核對象",
1452
+ label: G ? "通知對象" : "簽核對象",
1380
1453
  name: "adhocMemberId",
1381
1454
  required: !0,
1382
- children: /* @__PURE__ */ T(ee, {
1455
+ children: /* @__PURE__ */ T(se, {
1383
1456
  asyncData: !0,
1384
1457
  disabledOptionsFilter: !0,
1385
1458
  emptyText: "沒有符合的成員",
@@ -1389,45 +1462,45 @@ var en = {
1389
1462
  name: "adhoc-member-search",
1390
1463
  spellCheck: !1
1391
1464
  },
1392
- loading: Ie,
1465
+ loading: Ve,
1393
1466
  loadingText: "搜尋成員中...",
1394
1467
  menuMaxHeight: 320,
1395
1468
  mode: "multiple",
1396
- onChange: (e) => Fe(e.map(gt).filter(ht)),
1397
- onSearch: Z,
1469
+ onChange: (e) => Be(e.map(Nt).filter(Mt)),
1470
+ onSearch: W,
1398
1471
  onVisibilityChange: (e) => {
1399
- e && Z("");
1472
+ e && W("");
1400
1473
  },
1401
- options: [...Re],
1474
+ options: [...Ue],
1402
1475
  overflowStrategy: "wrap",
1403
1476
  placeholder: "搜尋姓名或信箱,可加入多位",
1404
1477
  searchDebounceTime: 300,
1405
- value: [...O]
1478
+ value: [...ze]
1406
1479
  })
1407
1480
  }),
1408
1481
  k === "PRE_APPROVAL" ? /* @__PURE__ */ T(n, {
1409
1482
  label: "拒簽處理方式",
1410
1483
  name: "adhocOnReject",
1411
1484
  required: !0,
1412
- children: /* @__PURE__ */ T(x, {
1485
+ children: /* @__PURE__ */ T(C, {
1413
1486
  clearable: !1,
1414
1487
  fullWidth: !0,
1415
- onChange: (e) => We(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1416
- options: [...nn],
1417
- value: Tt
1488
+ onChange: (e) => Ye(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1489
+ options: [...Cn],
1490
+ value: J
1418
1491
  })
1419
1492
  }) : null,
1420
- Q ? null : /* @__PURE__ */ T(n, {
1493
+ G ? null : /* @__PURE__ */ T(n, {
1421
1494
  label: "說明",
1422
1495
  name: "adhocComment",
1423
- children: /* @__PURE__ */ T(ae, {
1424
- onChange: (e) => Pe(e.target.value),
1496
+ children: /* @__PURE__ */ T(_e, {
1497
+ onChange: (e) => Re(e.target.value),
1425
1498
  placeholder: "可補充原因",
1426
- ref: $t,
1499
+ ref: bn,
1427
1500
  resize: "vertical",
1428
1501
  rows: 3,
1429
- style: Yt,
1430
- value: Ne
1502
+ style: gn,
1503
+ value: Le
1431
1504
  })
1432
1505
  })
1433
1506
  ]
@@ -1435,31 +1508,36 @@ var en = {
1435
1508
  })
1436
1509
  ] });
1437
1510
  });
1438
- function on(e, t) {
1511
+ function En(e, t) {
1439
1512
  try {
1440
1513
  let n = JSON.parse(e.targetValueJson);
1441
- if (n.memberIds?.length) return n.memberIds.map((e) => U(e, t)).join("、");
1514
+ if (n.memberIds?.length) return n.memberIds.map((e) => K(e, t)).join("、");
1442
1515
  if (n.webhookUrl) return n.webhookUrl;
1443
1516
  if (n.positionId) return `職位 ${n.positionId}`;
1444
1517
  if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
1445
1518
  } catch {}
1446
1519
  return e.targetKind;
1447
1520
  }
1521
+ function Dn(e, t) {
1522
+ if (e.isAdhoc || e.status !== "PENDING" && e.status !== "IN_PROGRESS") return 0;
1523
+ let n = t?.nodes.find((t) => t.id === e.nodeId);
1524
+ return n?.type === "userTask" ? Ze(n).size : 0;
1525
+ }
1448
1526
  //#endregion
1449
1527
  //#region src/views/instances/detail/sections/InstanceSignaturesSection.tsx
1450
- var sn = {
1528
+ var On = {
1451
1529
  display: "grid",
1452
1530
  gap: 16
1453
1531
  };
1454
- function cn({ signatureVerification: e, signatures: n }) {
1455
- let r = p(() => n.map((e) => ({
1532
+ function kn({ signatureVerification: e, signatures: n }) {
1533
+ let r = _(() => n.map((e) => ({
1456
1534
  algorithm: e.algorithm,
1457
- hashLabel: ct(e.signedPayloadHash),
1535
+ hashLabel: W(e.signedPayloadHash),
1458
1536
  key: e.id,
1459
1537
  keyVersion: e.keyVersion,
1460
1538
  signedAtLabel: t(e.signedAt),
1461
1539
  signerMemberId: e.signerMemberId
1462
- })), [n]), i = p(() => [
1540
+ })), [n]), i = _(() => [
1463
1541
  {
1464
1542
  dataIndex: "signerMemberId",
1465
1543
  key: "signerMemberId",
@@ -1492,19 +1570,19 @@ function cn({ signatureVerification: e, signatures: n }) {
1492
1570
  }
1493
1571
  ], []);
1494
1572
  return /* @__PURE__ */ E("div", {
1495
- style: sn,
1573
+ style: On,
1496
1574
  children: [
1497
- /* @__PURE__ */ T(C, {
1575
+ /* @__PURE__ */ T(w, {
1498
1576
  component: "h2",
1499
1577
  variant: "h3",
1500
1578
  children: "簽章"
1501
1579
  }),
1502
- /* @__PURE__ */ T(C, {
1580
+ /* @__PURE__ */ T(w, {
1503
1581
  color: e?.valid ? "text-success" : "text-error",
1504
1582
  variant: "body",
1505
1583
  children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
1506
1584
  }),
1507
- r.length > 0 ? /* @__PURE__ */ T(ie, {
1585
+ r.length > 0 ? /* @__PURE__ */ T(ge, {
1508
1586
  columns: i,
1509
1587
  dataSource: r,
1510
1588
  fullWidth: !0
@@ -1514,14 +1592,14 @@ function cn({ signatureVerification: e, signatures: n }) {
1514
1592
  }
1515
1593
  //#endregion
1516
1594
  //#region src/views/instances/detail/sections/InstanceHistorySection.tsx
1517
- var ln = {
1595
+ var An = {
1518
1596
  display: "grid",
1519
1597
  gap: 16
1520
- }, un = {
1598
+ }, jn = {
1521
1599
  cursor: "help",
1522
1600
  textDecoration: "underline dotted",
1523
1601
  textUnderlineOffset: 3
1524
- }, dn = {
1602
+ }, Mn = {
1525
1603
  borderLeftColor: "var(--mzn-color-border)",
1526
1604
  borderLeftStyle: "solid",
1527
1605
  borderLeftWidth: 2,
@@ -1530,41 +1608,41 @@ var ln = {
1530
1608
  marginTop: 4,
1531
1609
  paddingLeft: 8,
1532
1610
  whiteSpace: "pre-wrap"
1533
- }, fn = { color: "var(--mzn-color-text-secondary)" }, pn = {
1534
- ...dn,
1611
+ }, Nn = { color: "var(--mzn-color-text-secondary)" }, Pn = {
1612
+ ...Mn,
1535
1613
  borderLeftColor: "var(--mzn-color-text-error)",
1536
1614
  color: "var(--mzn-color-text-error)"
1537
1615
  };
1538
- function mn(...e) {
1539
- return e.filter((e) => z(e ?? null)).join(" ");
1616
+ function Fn(...e) {
1617
+ return e.filter((e) => V(e ?? null)).join(" ");
1540
1618
  }
1541
- var hn = l(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: l = "number", ...u }, d) {
1542
- let f = r ? "pending" : o, p = t.filter((e) => e.type !== "comment"), m = t.filter((e) => e.type === "comment");
1619
+ var In = h(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: o = "pending", title: s, type: c = "number", ...l }, u) {
1620
+ let d = r ? "pending" : o, f = t.filter((e) => e.type !== "comment"), p = t.filter((e) => e.type === "comment");
1543
1621
  return /* @__PURE__ */ E("div", {
1544
- ...u,
1545
- className: mn(j.host, l === "dot" ? j.dot : null, n && f !== "processing" ? j.error : null, a === "horizontal" ? j.horizontal : null, l === "number" ? j.number : null, f === "pending" ? j.pending : null, f === "processing" ? j.processing : null, n && f === "processing" ? j.processingError : null, !n && f === "succeeded" ? j.succeeded : null, a === "vertical" ? j.vertical : null, e),
1546
- ref: d,
1547
- children: [l === "dot" ? /* @__PURE__ */ T("span", { className: mn(j.statusIndicator, j.statusIndicatorDot) }) : /* @__PURE__ */ T("span", {
1548
- className: j.statusIndicator,
1622
+ ...l,
1623
+ className: Fn(F.host, c === "dot" ? F.dot : null, n && d !== "processing" ? F.error : null, a === "horizontal" ? F.horizontal : null, c === "number" ? F.number : null, d === "pending" ? F.pending : null, d === "processing" ? F.processing : null, n && d === "processing" ? F.processingError : null, !n && d === "succeeded" ? F.succeeded : null, a === "vertical" ? F.vertical : null, e),
1624
+ ref: u,
1625
+ children: [c === "dot" ? /* @__PURE__ */ T("span", { className: Fn(F.statusIndicator, F.statusIndicatorDot) }) : /* @__PURE__ */ T("span", {
1626
+ className: F.statusIndicator,
1549
1627
  children: i + 1
1550
1628
  }), /* @__PURE__ */ E("div", {
1551
- className: j.textContainer,
1629
+ className: F.textContainer,
1552
1630
  children: [
1553
- /* @__PURE__ */ E(C, {
1554
- className: j.title,
1631
+ /* @__PURE__ */ E(w, {
1632
+ className: F.title,
1555
1633
  variant: "label-primary-highlight",
1556
- children: [s, /* @__PURE__ */ T("span", { className: j.titleConnectLine })]
1634
+ children: [s, /* @__PURE__ */ T("span", { className: F.titleConnectLine })]
1557
1635
  }),
1558
- p.length > 0 ? /* @__PURE__ */ T(C, {
1559
- className: j.description,
1636
+ f.length > 0 ? /* @__PURE__ */ T(w, {
1637
+ className: F.description,
1560
1638
  variant: "caption",
1561
- children: p.map((e, t) => /* @__PURE__ */ E(c, { children: [t > 0 ? " · " : null, gn(e)] }, `${e.type}-${t}`))
1639
+ children: f.map((e, t) => /* @__PURE__ */ E(re, { children: [t > 0 ? " · " : null, Ln(e)] }, `${e.type}-${t}`))
1562
1640
  }) : null,
1563
- m.map((e, t) => /* @__PURE__ */ E(C, {
1564
- style: e.tone === "danger" ? pn : dn,
1641
+ p.map((e, t) => /* @__PURE__ */ E(w, {
1642
+ style: e.tone === "danger" ? Pn : Mn,
1565
1643
  variant: "body",
1566
1644
  children: [/* @__PURE__ */ E("span", {
1567
- style: e.tone === "danger" ? void 0 : fn,
1645
+ style: e.tone === "danger" ? void 0 : Nn,
1568
1646
  children: [e.label, ":"]
1569
1647
  }), e.text]
1570
1648
  }, `comment-${t}`))
@@ -1572,44 +1650,44 @@ var hn = l(function({ className: e, descriptionParts: t, error: n, forcePending:
1572
1650
  })]
1573
1651
  });
1574
1652
  });
1575
- function gn(e) {
1576
- return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ E(w, { children: [
1653
+ function Ln(e) {
1654
+ return e.type === "text" ? e.text : e.email?.trim() ? /* @__PURE__ */ E(ye, { children: [
1577
1655
  e.prefix,
1578
1656
  ":",
1579
- /* @__PURE__ */ T(S, {
1657
+ /* @__PURE__ */ T(ve, {
1580
1658
  title: e.email,
1581
1659
  children: ({ ref: t, ...n }) => /* @__PURE__ */ T("span", {
1582
1660
  ...n,
1583
1661
  "data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
1584
1662
  ref: t,
1585
- style: un,
1663
+ style: jn,
1586
1664
  children: e.label
1587
1665
  })
1588
1666
  })
1589
1667
  ] }) : `${e.prefix}:${e.label}`;
1590
1668
  }
1591
- function _n({ activityLogs: e, instanceState: t, memberProfilesById: n, signatureVerification: r, signaturesById: i, taskDecisionsByTaskId: a, tasks: o, workflowSnapshot: s, workflowTokens: c }) {
1592
- let l = It(e, o, c, s, t, n, a, i, r), u = Y(l), d = l.map((e) => ({
1669
+ function Rn({ activityLogs: e, formSchema: t = null, instanceState: n, memberProfilesById: r, signatureVerification: i, signaturesById: a, taskDecisionsByTaskId: o, tasks: s, workflowSnapshot: c, workflowTokens: l }) {
1670
+ let u = rn(e, s, l, c, n, r, o, a, i, t), d = X(u), f = u.map((e) => ({
1593
1671
  ...e,
1594
- descriptionParts: e.descriptionParts.filter(J)
1672
+ descriptionParts: e.descriptionParts.filter(Y)
1595
1673
  }));
1596
1674
  return /* @__PURE__ */ E("div", {
1597
- style: ln,
1598
- children: [/* @__PURE__ */ T(C, {
1675
+ style: An,
1676
+ children: [/* @__PURE__ */ T(w, {
1599
1677
  component: "h2",
1600
1678
  variant: "h3",
1601
1679
  children: "歷程"
1602
- }), d.length > 0 ? /* @__PURE__ */ T(re, {
1603
- currentStep: u,
1680
+ }), f.length > 0 ? /* @__PURE__ */ T(he, {
1681
+ currentStep: d,
1604
1682
  orientation: "vertical",
1605
1683
  type: "dot",
1606
- children: d.map((e) => /* @__PURE__ */ T(hn, {
1684
+ children: f.map((e) => /* @__PURE__ */ T(In, {
1607
1685
  descriptionParts: e.descriptionParts,
1608
1686
  error: e.error,
1609
1687
  forcePending: e.forcePending,
1610
1688
  title: e.title
1611
1689
  }, e.id))
1612
- }) : /* @__PURE__ */ T(C, {
1690
+ }) : /* @__PURE__ */ T(w, {
1613
1691
  color: "text-neutral",
1614
1692
  variant: "body",
1615
1693
  children: "尚無歷程紀錄。"
@@ -1618,30 +1696,30 @@ function _n({ activityLogs: e, instanceState: t, memberProfilesById: n, signatur
1618
1696
  }
1619
1697
  //#endregion
1620
1698
  //#region src/views/instances/detail/sections/InstanceWebhookDeliveriesSection.tsx
1621
- var vn = {
1699
+ var zn = {
1622
1700
  display: "grid",
1623
1701
  gap: 16
1624
- }, yn = {
1702
+ }, Bn = {
1625
1703
  display: "grid",
1626
1704
  gap: 2
1627
- }, bn = {
1705
+ }, Vn = {
1628
1706
  overflowWrap: "anywhere",
1629
1707
  whiteSpace: "pre-wrap"
1630
1708
  };
1631
- function xn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1632
- let [r, i] = h(null), [a, o] = h(!1), [s, c] = h(null), l = p(() => e.map((e) => ({
1709
+ function Hn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1710
+ let [r, i] = v(null), [a, o] = v(!1), [s, c] = v(null), l = _(() => e.map((e) => ({
1633
1711
  delivery: e,
1634
1712
  key: e.id
1635
- })), [e]), u = p(() => [
1713
+ })), [e]), u = _(() => [
1636
1714
  {
1637
1715
  key: "endpoint",
1638
1716
  render: ({ delivery: e }) => /* @__PURE__ */ E("div", {
1639
- style: yn,
1640
- children: [/* @__PURE__ */ T(C, {
1717
+ style: Bn,
1718
+ children: [/* @__PURE__ */ T(w, {
1641
1719
  component: "span",
1642
1720
  variant: "body",
1643
1721
  children: e.endpointLabel ?? e.endpointKey
1644
- }), /* @__PURE__ */ E(C, {
1722
+ }), /* @__PURE__ */ E(w, {
1645
1723
  color: "text-neutral",
1646
1724
  component: "span",
1647
1725
  variant: "caption",
@@ -1660,13 +1738,13 @@ function xn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1660
1738
  },
1661
1739
  {
1662
1740
  key: "status",
1663
- render: ({ delivery: e }) => /* @__PURE__ */ T(Sn, { status: e.status }),
1741
+ render: ({ delivery: e }) => /* @__PURE__ */ T(Un, { status: e.status }),
1664
1742
  title: "狀態",
1665
1743
  width: 120
1666
1744
  },
1667
1745
  {
1668
1746
  key: "attemptCount",
1669
- render: ({ delivery: e }) => /* @__PURE__ */ T(C, {
1747
+ render: ({ delivery: e }) => /* @__PURE__ */ T(w, {
1670
1748
  component: "span",
1671
1749
  variant: "body",
1672
1750
  children: e.attemptCount
@@ -1677,20 +1755,20 @@ function xn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1677
1755
  {
1678
1756
  key: "lastError",
1679
1757
  render: ({ delivery: e }) => e.lastErrorCode && e.status !== "SENT" ? /* @__PURE__ */ E("div", {
1680
- style: yn,
1681
- children: [/* @__PURE__ */ T(C, {
1758
+ style: Bn,
1759
+ children: [/* @__PURE__ */ T(w, {
1682
1760
  color: "text-error",
1683
1761
  component: "span",
1684
1762
  variant: "body",
1685
1763
  children: e.lastErrorCode
1686
- }), e.lastErrorDetail ? /* @__PURE__ */ T(C, {
1764
+ }), e.lastErrorDetail ? /* @__PURE__ */ T(w, {
1687
1765
  color: "text-neutral",
1688
1766
  component: "span",
1689
- style: bn,
1767
+ style: Vn,
1690
1768
  variant: "caption",
1691
1769
  children: e.lastErrorDetail
1692
1770
  }) : null]
1693
- }) : /* @__PURE__ */ T(C, {
1771
+ }) : /* @__PURE__ */ T(w, {
1694
1772
  color: "text-neutral",
1695
1773
  component: "span",
1696
1774
  variant: "body",
@@ -1701,18 +1779,18 @@ function xn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1701
1779
  },
1702
1780
  {
1703
1781
  key: "time",
1704
- render: ({ delivery: e }) => /* @__PURE__ */ T(C, {
1782
+ render: ({ delivery: e }) => /* @__PURE__ */ T(w, {
1705
1783
  component: "span",
1706
1784
  variant: "body",
1707
- children: Cn(e)
1785
+ children: Wn(e)
1708
1786
  }),
1709
1787
  title: "時間",
1710
1788
  width: 220
1711
1789
  }
1712
- ], [n]), d = p(() => ({
1790
+ ], [n]), d = _(() => ({
1713
1791
  render: ({ delivery: e }) => e.status === "FAILED" && e.attemptCount > 0 ? [{
1714
1792
  disabled: () => a,
1715
- icon: O,
1793
+ icon: qe,
1716
1794
  iconType: "leading",
1717
1795
  name: "重新傳送",
1718
1796
  onClick: () => {
@@ -1735,29 +1813,29 @@ function xn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1735
1813
  }
1736
1814
  }
1737
1815
  return /* @__PURE__ */ E("div", {
1738
- style: vn,
1816
+ style: zn,
1739
1817
  children: [
1740
- /* @__PURE__ */ T(C, {
1818
+ /* @__PURE__ */ T(w, {
1741
1819
  component: "h2",
1742
1820
  variant: "h3",
1743
1821
  children: "外部系統通知"
1744
1822
  }),
1745
- s ? /* @__PURE__ */ T(C, {
1823
+ s ? /* @__PURE__ */ T(w, {
1746
1824
  color: "text-error",
1747
1825
  variant: "body",
1748
1826
  children: s
1749
1827
  }) : null,
1750
- l.length > 0 ? /* @__PURE__ */ T(ie, {
1828
+ l.length > 0 ? /* @__PURE__ */ T(ge, {
1751
1829
  actions: d,
1752
1830
  columns: u,
1753
1831
  dataSource: l,
1754
1832
  fullWidth: !0
1755
- }) : /* @__PURE__ */ T(C, {
1833
+ }) : /* @__PURE__ */ T(w, {
1756
1834
  color: "text-neutral",
1757
1835
  variant: "body",
1758
1836
  children: "此案件沒有外部系統通知。"
1759
1837
  }),
1760
- /* @__PURE__ */ T(y, {
1838
+ /* @__PURE__ */ T(S, {
1761
1839
  cancelText: "取消",
1762
1840
  confirmText: "重新傳送",
1763
1841
  loading: a,
@@ -1771,7 +1849,7 @@ function xn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1771
1849
  showModalHeader: !0,
1772
1850
  supportingText: "會以相同的投遞編號重新送出,接收端可據此避免重複處理。",
1773
1851
  title: "重新傳送通知",
1774
- children: /* @__PURE__ */ E(C, {
1852
+ children: /* @__PURE__ */ E(w, {
1775
1853
  variant: "body",
1776
1854
  children: [
1777
1855
  "確定要重新通知「",
@@ -1783,30 +1861,49 @@ function xn({ deliveries: e, onRetry: t, readNodeLabel: n }) {
1783
1861
  ]
1784
1862
  });
1785
1863
  }
1786
- function Sn({ status: e }) {
1787
- return e === "SENT" ? /* @__PURE__ */ T(g, {
1864
+ function Un({ status: e }) {
1865
+ return e === "SENT" ? /* @__PURE__ */ T(ce, {
1788
1866
  size: "sub",
1789
1867
  text: "已送達",
1790
1868
  variant: "dot-success"
1791
- }) : e === "FAILED" ? /* @__PURE__ */ T(g, {
1869
+ }) : e === "FAILED" ? /* @__PURE__ */ T(ce, {
1792
1870
  size: "sub",
1793
1871
  text: "失敗",
1794
1872
  variant: "dot-error"
1795
- }) : /* @__PURE__ */ T(g, {
1873
+ }) : /* @__PURE__ */ T(ce, {
1796
1874
  size: "sub",
1797
1875
  text: e === "PENDING" ? "等待傳送" : "傳送中",
1798
1876
  variant: "dot-info"
1799
1877
  });
1800
1878
  }
1801
- function Cn(e) {
1879
+ function Wn(e) {
1802
1880
  return e.sentAt ? `送達:${t(e.sentAt)}` : e.status === "PENDING" && e.nextRetryAt ? `下次重試:${t(e.nextRetryAt)}` : e.lastAttemptAt ? `最後嘗試:${t(e.lastAttemptAt)}` : `建立:${t(e.createdAt)}`;
1803
1881
  }
1804
1882
  //#endregion
1883
+ //#region src/views/instances/viewer-field-access.ts
1884
+ function Gn(e, t) {
1885
+ let n = new Map(t.map((e) => [e.id, e]));
1886
+ return new Set(e.filter((e) => e.eventType === "TASK_CREATED").map((e) => e.taskId === null ? void 0 : n.get(e.taskId)).filter((e) => e !== void 0 && !e.isAdhoc).map((e) => e.nodeId));
1887
+ }
1888
+ function Kn({ activityLogs: e, actingTask: t, instance: n, tasks: r }) {
1889
+ let i = n.workflowSnapshot;
1890
+ return et({
1891
+ definition: i,
1892
+ fieldKeys: (n.formDefinitionSnapshot.schema?.fields ?? []).map((e) => e.fieldKey),
1893
+ isAdhocTask: t?.isAdhoc ?? !1,
1894
+ nodeId: t?.nodeId ?? null,
1895
+ revealedFieldKeys: Qe(i, Gn(e, r))
1896
+ });
1897
+ }
1898
+ //#endregion
1805
1899
  //#region src/views/instances/detail/InstanceDetailView.tsx
1806
- var wn = 3e3, Tn = 40, En = 184, Dn = 96, On = {
1900
+ function qn(e) {
1901
+ return `還有 ${new Set(Object.keys(e).map($e)).size} 個補填欄位需要完成`;
1902
+ }
1903
+ var Jn = 3e3, Yn = 40, Xn = 184, Zn = 96, Qn = {
1807
1904
  display: "grid",
1808
1905
  gap: 16
1809
- }, kn = {
1906
+ }, $n = {
1810
1907
  background: "#f8fafc",
1811
1908
  border: "1px solid #e2e8f0",
1812
1909
  borderRadius: 8,
@@ -1814,7 +1911,7 @@ var wn = 3e3, Tn = 40, En = 184, Dn = 96, On = {
1814
1911
  minHeight: 440,
1815
1912
  overflow: "hidden",
1816
1913
  width: "min(80vw, 1040px)"
1817
- }, An = {
1914
+ }, er = {
1818
1915
  background: "#ffffff",
1819
1916
  border: "1px solid #cbd5e1",
1820
1917
  borderRadius: 8,
@@ -1824,24 +1921,24 @@ var wn = 3e3, Tn = 40, En = 184, Dn = 96, On = {
1824
1921
  minHeight: 82,
1825
1922
  padding: 12,
1826
1923
  width: 184
1827
- }, jn = {
1924
+ }, tr = {
1828
1925
  borderRadius: 999,
1829
1926
  fontSize: 12,
1830
1927
  fontWeight: 600,
1831
1928
  justifySelf: "start",
1832
1929
  lineHeight: "18px",
1833
1930
  padding: "0 8px"
1834
- }, Mn = {
1931
+ }, nr = {
1835
1932
  color: "#64748b",
1836
1933
  fontSize: 12,
1837
1934
  overflow: "hidden",
1838
1935
  textOverflow: "ellipsis",
1839
1936
  whiteSpace: "nowrap"
1840
- }, Nn = { opacity: 0 }, Pn = {
1937
+ }, rr = { opacity: 0 }, ir = {
1841
1938
  display: "flex",
1842
1939
  flexWrap: "wrap",
1843
1940
  gap: 8
1844
- }, Fn = {
1941
+ }, ar = {
1845
1942
  alignItems: "center",
1846
1943
  background: "#ffffff",
1847
1944
  border: "1px solid #cbd5e1",
@@ -1853,29 +1950,29 @@ var wn = 3e3, Tn = 40, En = 184, Dn = 96, On = {
1853
1950
  gap: 6,
1854
1951
  lineHeight: "20px",
1855
1952
  padding: "4px 8px"
1856
- }, In = {
1953
+ }, or = {
1857
1954
  display: "grid",
1858
1955
  gap: 16
1859
- }, Ln = { workflowRuntime: qn };
1860
- function Rn({ instanceId: i, showAttachments: a = !0, showForm: s = !0, showHistory: c = !0, showSignatures: l = !0, showTasks: f = !0, showWebhookDeliveries: ee = !0 }) {
1861
- let { member: g } = e(), v = g?.memberId ?? null, x = ee && r(g), [re, ie] = h([]), [S, oe] = h(null), [ce, le] = h([]), [ue, pe] = h([]), [ye, be] = h([]), [xe, we] = h([]), [Oe, ke] = h(null), [D, je] = h([]), [O, Le] = h([]), [Re, Ve] = h([]), [We, A] = h(null), [Ke, qe] = h(!0), [Je, j] = h(!1), [M, Ye] = h(!1), [Xe, N] = h(""), [P, F] = h(!1), [Ze, I] = h({}), [L, $e] = h({}), [tt, nt] = h({}), [R, rt] = h(null), [it, at] = h(null), [ot, st] = h([]), ct = Xe.trim(), V = m(null), ut = m(0), H = xe.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
1862
- d(() => {
1863
- X();
1864
- }, [v, i]), d(() => {
1865
- if (!x || !H || ut.current >= Tn) return;
1956
+ }, sr = { workflowRuntime: _r };
1957
+ function cr({ instanceId: i, showAttachments: a = !0, showForm: ne = !0, showHistory: re = !0, showSignatures: h = !0, showTasks: ae = !0, showWebhookDeliveries: se = !0 }) {
1958
+ let { member: ce } = e(), b = ce?.memberId ?? null, le = se && r(ce), [x, ue] = v([]), [C, he] = v(null), [ge, ve] = v([]), [be, Se] = v([]), [Ce, we] = v([]), [D, Me] = v([]), [Ne, Pe] = v(null), [O, Be] = v([]), [Ve, Ue] = v([]), [We, qe] = v([]), [Xe, A] = v(null), [Qe, $e] = v(!0), [et, rt] = v(!1), [at, N] = v(!1), [P, st] = v(""), [ct, F] = v(!1), [I, lt] = v({}), [ut, dt] = v({}), [ft, pt] = v({}), [L, mt] = v(null), [R, gt] = v(null), [vt, yt] = v([]), z = P.trim(), B = oe(null), bt = oe(0), xt = D.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS");
1959
+ g(() => {
1960
+ Zt();
1961
+ }, [b, i]), g(() => {
1962
+ if (!le || !xt || bt.current >= Yn) return;
1866
1963
  let e = setTimeout(() => {
1867
- ut.current += 1, Ct();
1868
- }, wn);
1964
+ bt.current += 1, en();
1965
+ }, Jn);
1869
1966
  return () => clearTimeout(e);
1870
1967
  }, [
1871
- x,
1872
- H,
1873
- xe
1874
- ]), d(() => {
1875
- $e(S?.formData ?? {}), nt({});
1876
- }, [S]);
1877
- let U = u((e, t) => {
1878
- nt((n) => {
1968
+ le,
1969
+ xt,
1970
+ D
1971
+ ]), g(() => {
1972
+ dt(C?.formData ?? {}), pt({});
1973
+ }, [C]);
1974
+ let St = ie((e, t) => {
1975
+ pt((n) => {
1879
1976
  let r = n[e];
1880
1977
  return r?.hasValue === t.hasValue && r.status === t.status ? n : {
1881
1978
  ...n,
@@ -1885,356 +1982,448 @@ function Rn({ instanceId: i, showAttachments: a = !0, showForm: s = !0, showHist
1885
1982
  }
1886
1983
  };
1887
1984
  });
1888
- }, []), W = p(() => D.find((e) => ft(e, v) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [v, D]), G = p(() => W && S ? S.workflowSnapshot.nodes.find((e) => e.id === W.nodeId) ?? null : null, [W, S]), pt = G?.type === "userTask" && G.data.returnBehavior.allowReturn, mt = G?.type === "userTask" && G.data.allowReject !== !1, ht = G?.type === "userTask" && G.data.allowTransfer !== !1, gt = G?.type === "userTask" && G.data.allowAddSigner, _t = !(!S || S.initiatorMemberId !== v || S.state !== "RUNNING" && S.state !== "RETURNED"), K = !!(S && S.initiatorMemberId === v && S.state === "RETURNED"), q = p(() => new Map(Re.map((e) => [e.memberId, e])), [Re]), vt = p(() => Ht(ce), [ce]), J = p(() => new Map(ye.map((e) => [e.id, e])), [ye]), Y = p(() => S ? Un(S.workflowSnapshot) : null, [S]), yt = p(() => S && Y ? Hn(Y, D, O, S.state) : [], [
1889
- S,
1890
- Y,
1891
- D,
1985
+ }, []), U = _(() => kt(O, b), [b, O]), W = _(() => U && C ? C.workflowSnapshot.nodes.find((e) => e.id === U.nodeId) ?? null : null, [U, C]), wt = W?.type === "userTask" && W.data.returnBehavior.allowReturn, Tt = W?.type === "userTask" && W.data.allowReject !== !1, G = W?.type === "userTask" && W.data.allowTransfer !== !1, Dt = W?.type === "userTask" && W.data.allowAddSigner, Ot = !(!C || C.initiatorMemberId !== b || C.state !== "RUNNING" && C.state !== "RETURNED"), At = !!(C && C.initiatorMemberId === b && C.state === "RETURNED"), q = _(() => U && !U.isAdhoc && W?.type === "userTask" && Ze(W).size > 0 ? W : null, [U, W]), jt = q ? U?.id ?? null : null, [Mt, Nt] = v({}), [Pt, J] = v({}), [Ft, It] = v(!1);
1986
+ g(() => {
1987
+ Nt({}), J({}), It(!1);
1988
+ }, [jt]);
1989
+ let Y = C?.formDefinitionSnapshot.schema ?? null, X = _(() => q && Y ? o(Y, q) : null, [q, Y]), Z = _(() => X && C ? tt(X.fields, {
1990
+ ...C.formData,
1991
+ ...Mt
1992
+ }) : null, [
1993
+ Mt,
1994
+ X,
1995
+ C
1996
+ ]), Lt = _(() => q && X && Z && C ? c({
1997
+ draft: Mt,
1998
+ node: q,
1999
+ schema: X,
2000
+ stored: C.formData,
2001
+ values: Z
2002
+ }) : {}, [
2003
+ Mt,
2004
+ q,
2005
+ X,
2006
+ Z,
2007
+ C
2008
+ ]), Rt = _(() => C ? Kn({
2009
+ activityLogs: x,
2010
+ actingTask: U,
2011
+ instance: C,
2012
+ tasks: O
2013
+ }) : void 0, [
2014
+ x,
2015
+ U,
2016
+ C,
1892
2017
  O
1893
- ]), bt = p(() => Y ? Wn(Y) : [], [Y]), xt = p(() => S ? Bn(S.workflowSnapshot) : [], [S]);
1894
- async function X() {
1895
- qe(!0), A(null);
2018
+ ]), zt = _(() => C ? d(C.workflowSnapshot, q) : void 0, [q, C]), Q = _(() => new Map(We.map((e) => [e.memberId, e])), [We]), Bt = _(() => q && Z && Y && C?.formDataFingerprint ? {
2019
+ expectedFormDataFingerprint: C.formDataFingerprint,
2020
+ formData: p(Lt, q),
2021
+ summary: l(Y, q, Lt, new Map([...Q.keys()].map((e) => [e, K(e, Q)])))
2022
+ } : null, [
2023
+ Lt,
2024
+ q,
2025
+ Z,
2026
+ C,
2027
+ Q,
2028
+ Y
2029
+ ]);
2030
+ function Vt(e) {
2031
+ if (!q) return;
2032
+ let t = Ze(q), n = Object.entries(e).filter(([e, n]) => t.has(e) && JSON.stringify(n) !== JSON.stringify(Z?.[e]));
2033
+ Nt((e) => ({
2034
+ ...e,
2035
+ ...Object.fromEntries(n)
2036
+ })), J({});
2037
+ }
2038
+ function Ht() {
2039
+ if (q && !C?.formDataFingerprint) de.error("無法確認表單版本,請重新整理頁面後再同意。");
2040
+ else {
2041
+ if (q && Z && Y && C?.formDefinitionSnapshot.uiSchema) {
2042
+ let e = j({
2043
+ schema: m(Y, q),
2044
+ uiSchema: C.formDefinitionSnapshot.uiSchema,
2045
+ values: Z
2046
+ });
2047
+ if (!e.valid) {
2048
+ J(e.errors), e.firstInvalidFieldKey && nt(e.firstInvalidFieldKey), de.warning(qn(e.errors));
2049
+ return;
2050
+ }
2051
+ }
2052
+ B.current?.handleApprove();
2053
+ }
2054
+ }
2055
+ function Ut(e) {
2056
+ if (!q || !Y) return !1;
2057
+ if (ee(e)) return It(!0), !0;
2058
+ let t = s(e, Y, q);
2059
+ return t ? (J(t), nt(Object.keys(t)[0] ?? ""), de.warning(qn(t)), !0) : !1;
2060
+ }
2061
+ async function Wt() {
2062
+ await Zt(), It(!1);
2063
+ }
2064
+ let Gt = _(() => un(ge), [ge]), Kt = _(() => new Map(Ce.map((e) => [e.id, e])), [Ce]), qt = _(() => C ? pr(C.workflowSnapshot) : null, [C]), Jt = _(() => C && qt ? fr(qt, O, Ve, C.state) : [], [
2065
+ C,
2066
+ qt,
2067
+ O,
2068
+ Ve
2069
+ ]), Yt = _(() => qt ? mr(qt) : [], [qt]), Xt = _(() => C ? ur(C.workflowSnapshot) : [], [C]);
2070
+ async function Zt() {
2071
+ $e(!0), A(null);
1896
2072
  try {
1897
- let e = await he(i);
1898
- ie(e.activityLogs), oe(e.instance), je(e.tasks), Le(e.workflowTokens);
1899
- let t = await de(e.instance.id), [n, r, a, o, s] = await Promise.all([
1900
- Vt(e.tasks),
1901
- zt({
2073
+ let e = await Oe(i);
2074
+ ue(e.activityLogs), he(e.instance), Be(e.tasks), Ue(e.workflowTokens);
2075
+ let t = await Te(e.instance.id), [n, r, a, o, s] = await Promise.all([
2076
+ ln(e.tasks),
2077
+ sn({
1902
2078
  ...e,
1903
2079
  adhocDirectives: t
1904
2080
  }),
1905
- fe(e.instance.id),
1906
- ve(e.instance.id),
1907
- Z(e.instance.id)
2081
+ Ee(e.instance.id),
2082
+ je(e.instance.id),
2083
+ Qt(e.instance.id)
1908
2084
  ]);
1909
- le(n), Ve(r), pe(a), be(o.signatures), ke(o.verification), st(t), we(s);
2085
+ ve(n), qe(r), Se(a), we(o.signatures), Pe(o.verification), yt(t), Me(s);
1910
2086
  } catch (e) {
1911
- A(B(e));
2087
+ A(H(e));
1912
2088
  } finally {
1913
- qe(!1);
2089
+ $e(!1);
1914
2090
  }
1915
2091
  }
1916
- async function Z(e) {
1917
- return x ? me(e).catch(() => []) : [];
2092
+ async function Qt(e) {
2093
+ return le ? De(e).catch(() => []) : [];
1918
2094
  }
1919
- async function St(e) {
1920
- await Ce(e.id), ut.current = 0, await X();
2095
+ async function $t(e) {
2096
+ await Ie(e.id), bt.current = 0, await Zt();
1921
2097
  }
1922
- async function Ct() {
1923
- let e = await Z(i);
1924
- e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? we(e) : await X();
2098
+ async function en() {
2099
+ let e = await Qt(i);
2100
+ e.some((e) => e.status === "PENDING" || e.status === "DELIVERY_IN_PROGRESS") ? Me(e) : await Zt();
1925
2101
  }
1926
- async function Q(e, t) {
1927
- if (!v) throw Error("尚未登入,無法上傳附件");
1928
- return { id: (await Te({
2102
+ async function tn(e, t) {
2103
+ if (!b) throw Error("尚未登入,無法上傳附件");
2104
+ return { id: (await Le({
1929
2105
  file: t,
1930
2106
  formFieldPath: `form.${e.fieldKey}`
1931
2107
  })).id };
1932
2108
  }
1933
- async function wt(e) {
1934
- if (!v) return;
1935
- let t = await ge({ id: e.id });
2109
+ async function nn(e) {
2110
+ if (!b) return;
2111
+ let t = await ke({ id: e.id });
1936
2112
  window.open(t, "_blank", "noopener,noreferrer");
1937
2113
  }
1938
- async function Tt(e) {
1939
- if (!v) return;
1940
- let t = await _e({ id: e.id });
1941
- rt(e), at(t);
2114
+ async function rn(e) {
2115
+ if (!b) return;
2116
+ let t = await Ae({ id: e.id });
2117
+ mt(e), gt(t);
1942
2118
  }
1943
- async function Et() {
1944
- if (v && S && _t) {
1945
- j(!0), A(null), I({});
2119
+ async function an() {
2120
+ if (b && C && Ot) {
2121
+ rt(!0), A(null), lt({});
1946
2122
  try {
1947
- await se({
1948
- cancelledByMemberId: v,
1949
- comment: ct || null,
1950
- instanceId: S.id
1951
- }), N(""), F(!1), await X();
2123
+ await xe({
2124
+ cancelledByMemberId: b,
2125
+ comment: z || null,
2126
+ instanceId: C.id
2127
+ }), st(""), F(!1), await Zt();
1952
2128
  } catch (e) {
1953
- A(B(e));
2129
+ A(H(e));
1954
2130
  } finally {
1955
- j(!1);
2131
+ rt(!1);
1956
2132
  }
1957
2133
  }
1958
2134
  }
1959
- async function Dt() {
1960
- if (!v || !S || !K) return;
1961
- j(!0), A(null), I({});
1962
- let e = o(Object.values(tt));
2135
+ async function on() {
2136
+ if (!b || !C || !At) return;
2137
+ rt(!0), A(null), lt({});
2138
+ let e = te(Object.values(ft));
1963
2139
  if (e) {
1964
- A(e), j(!1);
2140
+ A(e), rt(!1);
1965
2141
  return;
1966
2142
  }
1967
- let t = S.formDefinitionSnapshot.schema ? ze(S.formDefinitionSnapshot.schema.fields, L) : L;
1968
- if (S.formDefinitionSnapshot.schema && S.formDefinitionSnapshot.uiSchema) {
1969
- let e = k({
1970
- schema: S.formDefinitionSnapshot.schema,
1971
- uiSchema: S.formDefinitionSnapshot.uiSchema,
1972
- values: t
2143
+ let t = C.formDefinitionSnapshot.schema ? u(C.formDefinitionSnapshot.schema, C.workflowSnapshot) : null, n = f(t ? tt(t.fields, ut) : ut, C.workflowSnapshot);
2144
+ if (t && C.formDefinitionSnapshot.uiSchema) {
2145
+ let e = j({
2146
+ schema: t,
2147
+ uiSchema: C.formDefinitionSnapshot.uiSchema,
2148
+ values: n
1973
2149
  });
1974
2150
  if (!e.valid) {
1975
- I(e.errors), A("請先補齊必填欄位。"), e.firstInvalidFieldKey && Be(e.firstInvalidFieldKey), j(!1);
2151
+ lt(e.errors), A("請先補齊必填欄位。"), e.firstInvalidFieldKey && nt(e.firstInvalidFieldKey), rt(!1);
1976
2152
  return;
1977
2153
  }
1978
2154
  }
1979
2155
  try {
1980
- await Se({
1981
- formData: t,
1982
- initiatorMemberId: v,
1983
- instanceId: S.id,
1984
- title: S.title
1985
- }), await X();
2156
+ await Fe({
2157
+ formData: n,
2158
+ initiatorMemberId: b,
2159
+ instanceId: C.id,
2160
+ title: C.title
2161
+ }), await Zt();
1986
2162
  } catch (e) {
1987
- A(B(e));
2163
+ A(H(e));
1988
2164
  } finally {
1989
- j(!1);
2165
+ rt(!1);
1990
2166
  }
1991
2167
  }
1992
- let Ot = V.current?.deciding ?? !1, $ = Je || Ot;
1993
- return /* @__PURE__ */ E(w, { children: [
1994
- /* @__PURE__ */ T(te, { children: /* @__PURE__ */ E(Ee, {
1995
- description: S ? [
1996
- lt(S.state),
1997
- t(S.startedAt),
1998
- et(S, q)
1999
- ].filter(z).join(" · ") : "載入案件內容。",
2000
- title: S?.title ?? "簽核案件",
2168
+ let cn = B.current?.deciding ?? !1, $ = et || cn;
2169
+ return /* @__PURE__ */ E(ye, { children: [
2170
+ /* @__PURE__ */ T(fe, { children: /* @__PURE__ */ E(Re, {
2171
+ description: C ? [
2172
+ Ct(C.state),
2173
+ t(C.startedAt),
2174
+ _t(C, Q)
2175
+ ].filter(V).join(" · ") : "載入案件內容。",
2176
+ title: C?.title ?? "簽核案件",
2001
2177
  children: [
2002
- S ? /* @__PURE__ */ T(_, {
2178
+ C ? /* @__PURE__ */ T(y, {
2003
2179
  "aria-label": "查看流程圖",
2004
- icon: Fe,
2180
+ icon: Je,
2005
2181
  iconType: "icon-only",
2006
- onClick: () => Ye(!0),
2182
+ onClick: () => N(!0),
2007
2183
  title: "查看流程圖",
2008
2184
  variant: "base-secondary",
2009
2185
  children: "流程圖"
2010
2186
  }) : null,
2011
- _t ? /* @__PURE__ */ T(_, {
2187
+ Ot ? /* @__PURE__ */ T(y, {
2012
2188
  disabled: $,
2013
- icon: Ae,
2189
+ icon: He,
2014
2190
  iconType: "leading",
2015
2191
  onClick: () => F(!0),
2016
2192
  variant: "destructive-secondary",
2017
2193
  children: "取消案件"
2018
2194
  }) : null,
2019
- W ? /* @__PURE__ */ E(w, { children: [
2020
- gt ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(_, {
2195
+ U ? /* @__PURE__ */ E(ye, { children: [
2196
+ Dt ? /* @__PURE__ */ E(ye, { children: [/* @__PURE__ */ T(y, {
2021
2197
  disabled: $,
2022
- icon: Ne,
2198
+ icon: Ke,
2023
2199
  iconType: "leading",
2024
- onClick: () => V.current?.openAdhocModal("COUNTERSIGN"),
2200
+ onClick: () => B.current?.openAdhocModal("COUNTERSIGN"),
2025
2201
  variant: "base-secondary",
2026
2202
  children: "會簽"
2027
- }, "adhoc-countersign"), /* @__PURE__ */ T(_, {
2203
+ }, "adhoc-countersign"), /* @__PURE__ */ T(y, {
2028
2204
  disabled: $,
2029
- icon: Ne,
2205
+ icon: Ke,
2030
2206
  iconType: "leading",
2031
- onClick: () => V.current?.openAdhocModal("PRE_APPROVAL"),
2207
+ onClick: () => B.current?.openAdhocModal("PRE_APPROVAL"),
2032
2208
  variant: "base-secondary",
2033
2209
  children: "加簽"
2034
2210
  }, "adhoc-pre-approval")] }) : null,
2035
- /* @__PURE__ */ T(_, {
2211
+ /* @__PURE__ */ T(y, {
2036
2212
  disabled: $,
2037
- icon: Me,
2213
+ icon: Ge,
2038
2214
  iconType: "leading",
2039
- onClick: () => V.current?.openAdhocModal("STAGE_NOTIFY"),
2215
+ onClick: () => B.current?.openAdhocModal("STAGE_NOTIFY"),
2040
2216
  variant: "base-secondary",
2041
2217
  children: "通知設定"
2042
2218
  }, "adhoc-notify"),
2043
- pt ? /* @__PURE__ */ T(_, {
2219
+ wt ? /* @__PURE__ */ T(y, {
2044
2220
  disabled: $,
2045
- icon: Pe,
2221
+ icon: k,
2046
2222
  iconType: "leading",
2047
- onClick: () => V.current?.openReturnModal(),
2223
+ onClick: () => B.current?.openReturnModal(),
2048
2224
  variant: "base-secondary",
2049
2225
  children: "退回"
2050
2226
  }, "task-return") : null,
2051
- ht ? /* @__PURE__ */ T(_, {
2227
+ G ? /* @__PURE__ */ T(y, {
2052
2228
  disabled: $,
2053
- icon: Ie,
2229
+ icon: Ye,
2054
2230
  iconType: "leading",
2055
- onClick: () => V.current?.openTransferModal(),
2231
+ onClick: () => B.current?.openTransferModal(),
2056
2232
  variant: "base-secondary",
2057
2233
  children: "轉派"
2058
2234
  }, "task-transfer") : null,
2059
- mt ? /* @__PURE__ */ T(_, {
2235
+ Tt ? /* @__PURE__ */ T(y, {
2060
2236
  disabled: $,
2061
- icon: Ae,
2237
+ icon: He,
2062
2238
  iconType: "leading",
2063
- onClick: () => V.current?.openRejectModal(),
2239
+ onClick: () => B.current?.openRejectModal(),
2064
2240
  variant: "destructive-secondary",
2065
2241
  children: "拒絕"
2066
2242
  }, "task-reject") : null,
2067
- /* @__PURE__ */ T(_, {
2243
+ /* @__PURE__ */ T(y, {
2068
2244
  disabled: $,
2069
- icon: De,
2245
+ icon: ze,
2070
2246
  iconType: "leading",
2071
- onClick: () => V.current?.handleApprove(),
2247
+ onClick: Ht,
2072
2248
  variant: "base-primary",
2073
2249
  children: "同意"
2074
2250
  }, "task-approve")
2075
2251
  ] }) : null
2076
2252
  ]
2077
2253
  }) }),
2078
- /* @__PURE__ */ E(ne, { children: [
2079
- s ? /* @__PURE__ */ T(b, { children: /* @__PURE__ */ T(Gt, {
2080
- canResubmitInstance: K,
2081
- deciding: Je,
2082
- error: We,
2083
- instance: S,
2084
- loading: Ke,
2085
- onDataSourceStateChange: U,
2254
+ /* @__PURE__ */ E(me, { children: [
2255
+ ne ? /* @__PURE__ */ T(pe, { children: /* @__PURE__ */ T(fn, {
2256
+ canResubmitInstance: At,
2257
+ deciding: et,
2258
+ error: Xe,
2259
+ fieldAccess: Rt,
2260
+ fieldLabelMarkers: zt,
2261
+ fill: X && Z && q ? {
2262
+ errors: Pt,
2263
+ fieldCount: Ze(q).size,
2264
+ onChange: Vt,
2265
+ schema: X,
2266
+ value: Z
2267
+ } : null,
2268
+ instance: C,
2269
+ loading: Qe,
2270
+ onDataSourceStateChange: St,
2271
+ onReloadAfterConflict: Ft ? () => void Wt() : null,
2086
2272
  onResubmitFormChange: (e) => {
2087
- $e(e), I({});
2273
+ dt(e), lt({});
2088
2274
  },
2089
- onResubmitInstance: () => void Dt(),
2090
- onUploadAttachment: Q,
2091
- resubmitFormData: L,
2092
- resubmitFormErrors: Ze
2275
+ onResubmitInstance: () => void on(),
2276
+ onUploadAttachment: tn,
2277
+ resubmitFormData: ut,
2278
+ resubmitFormErrors: I
2093
2279
  }) }) : null,
2094
- a ? /* @__PURE__ */ T(b, { children: /* @__PURE__ */ T(qt, {
2095
- attachments: ue,
2280
+ a ? /* @__PURE__ */ T(pe, { children: /* @__PURE__ */ T(mn, {
2281
+ attachments: be,
2096
2282
  onDownload: (e) => {
2097
- wt(e);
2283
+ nn(e);
2098
2284
  },
2099
2285
  onPreview: (e) => {
2100
- Tt(e);
2286
+ rn(e);
2101
2287
  }
2102
2288
  }) }) : null,
2103
- f ? /* @__PURE__ */ T(b, { children: /* @__PURE__ */ T(an, {
2104
- adhocDirectives: ot,
2105
- currentMemberId: v,
2106
- instance: S,
2107
- memberProfilesById: q,
2108
- onChanged: X,
2109
- ref: V,
2110
- tasks: D
2289
+ ae ? /* @__PURE__ */ T(pe, { children: /* @__PURE__ */ T(Tn, {
2290
+ adhocDirectives: vt,
2291
+ currentMemberId: b,
2292
+ fill: Bt,
2293
+ instance: C,
2294
+ memberProfilesById: Q,
2295
+ onChanged: Zt,
2296
+ onFillApproveError: Ut,
2297
+ ref: B,
2298
+ tasks: O
2111
2299
  }) }) : null,
2112
- l ? /* @__PURE__ */ T(b, { children: /* @__PURE__ */ T(cn, {
2113
- signatureVerification: Oe,
2114
- signatures: ye
2300
+ h ? /* @__PURE__ */ T(pe, { children: /* @__PURE__ */ T(kn, {
2301
+ signatureVerification: Ne,
2302
+ signatures: Ce
2115
2303
  }) }) : null,
2116
- x && xe.length > 0 ? /* @__PURE__ */ T(b, { children: /* @__PURE__ */ T(xn, {
2117
- deliveries: xe,
2118
- onRetry: St,
2119
- readNodeLabel: (e) => dt(e, S?.workflowSnapshot ?? null)
2304
+ le && D.length > 0 ? /* @__PURE__ */ T(pe, { children: /* @__PURE__ */ T(Hn, {
2305
+ deliveries: D,
2306
+ onRetry: $t,
2307
+ readNodeLabel: (e) => Et(e, C?.workflowSnapshot ?? null)
2120
2308
  }) }) : null,
2121
- c ? /* @__PURE__ */ T(b, { children: /* @__PURE__ */ T(_n, {
2122
- activityLogs: re,
2123
- instanceState: S?.state ?? "RUNNING",
2124
- memberProfilesById: q,
2125
- signatureVerification: Oe,
2126
- signaturesById: J,
2127
- taskDecisionsByTaskId: vt,
2128
- tasks: D,
2129
- workflowSnapshot: S?.workflowSnapshot ?? null,
2130
- workflowTokens: O
2309
+ re ? /* @__PURE__ */ T(pe, { children: /* @__PURE__ */ T(Rn, {
2310
+ activityLogs: x,
2311
+ formSchema: Y,
2312
+ instanceState: C?.state ?? "RUNNING",
2313
+ memberProfilesById: Q,
2314
+ signatureVerification: Ne,
2315
+ signaturesById: Kt,
2316
+ taskDecisionsByTaskId: Gt,
2317
+ tasks: O,
2318
+ workflowSnapshot: C?.workflowSnapshot ?? null,
2319
+ workflowTokens: Ve
2131
2320
  }) }) : null
2132
2321
  ] }),
2133
- S ? /* @__PURE__ */ T(y, {
2322
+ C ? /* @__PURE__ */ T(S, {
2134
2323
  modalType: "standard",
2135
- onClose: () => Ye(!1),
2136
- open: M,
2324
+ onClose: () => N(!1),
2325
+ open: at,
2137
2326
  showModalHeader: !0,
2138
2327
  size: "wide",
2139
- supportingText: `${lt(S.state)} · ${t(S.startedAt)}`,
2328
+ supportingText: `${Ct(C.state)} · ${t(C.startedAt)}`,
2140
2329
  title: "流程圖",
2141
2330
  children: /* @__PURE__ */ E("div", {
2142
- style: On,
2331
+ style: Qn,
2143
2332
  children: [/* @__PURE__ */ T("div", {
2144
- style: kn,
2145
- children: /* @__PURE__ */ E(Ge, {
2146
- edges: bt,
2333
+ style: $n,
2334
+ children: /* @__PURE__ */ E(ot, {
2335
+ edges: Yt,
2147
2336
  fitView: !0,
2148
2337
  fitViewOptions: { padding: .18 },
2149
2338
  maxZoom: 1.2,
2150
2339
  minZoom: .2,
2151
- nodes: yt,
2340
+ nodes: Jt,
2152
2341
  nodesDraggable: !1,
2153
2342
  nodesFocusable: !1,
2154
- nodeTypes: Ln,
2343
+ nodeTypes: sr,
2155
2344
  panOnDrag: !0,
2156
2345
  proOptions: { hideAttribution: !0 },
2157
- children: [/* @__PURE__ */ T(He, {}), /* @__PURE__ */ T(Ue, { showInteractive: !1 })]
2346
+ children: [/* @__PURE__ */ T(M, {}), /* @__PURE__ */ T(it, { showInteractive: !1 })]
2158
2347
  })
2159
- }), xt.length > 0 ? /* @__PURE__ */ T("div", {
2160
- style: Pn,
2161
- children: xt.map((e) => /* @__PURE__ */ T("span", {
2162
- style: Fn,
2348
+ }), Xt.length > 0 ? /* @__PURE__ */ T("div", {
2349
+ style: ir,
2350
+ children: Xt.map((e) => /* @__PURE__ */ T("span", {
2351
+ style: ar,
2163
2352
  children: e
2164
2353
  }, e))
2165
2354
  }) : null]
2166
2355
  })
2167
2356
  }) : null,
2168
- /* @__PURE__ */ T(y, {
2357
+ /* @__PURE__ */ T(S, {
2169
2358
  modalType: "standard",
2170
2359
  onClose: () => {
2171
- rt(null), at(null);
2360
+ mt(null), gt(null);
2172
2361
  },
2173
- open: !!(R && it),
2362
+ open: !!(L && R),
2174
2363
  showModalHeader: !0,
2175
2364
  size: "wide",
2176
- supportingText: R?.filename ?? void 0,
2365
+ supportingText: L?.filename ?? void 0,
2177
2366
  title: "PDF 預覽",
2178
- children: it ? /* @__PURE__ */ T(Qe, {
2179
- filename: R?.filename ?? "PDF 預覽",
2180
- fileUrl: it,
2181
- onDownload: R ? () => void wt(R) : void 0
2367
+ children: R ? /* @__PURE__ */ T(ht, {
2368
+ filename: L?.filename ?? "PDF 預覽",
2369
+ fileUrl: R,
2370
+ onDownload: L ? () => void nn(L) : void 0
2182
2371
  }) : null
2183
2372
  }),
2184
- /* @__PURE__ */ T(y, {
2373
+ /* @__PURE__ */ T(S, {
2185
2374
  cancelText: "保留案件",
2186
2375
  confirmButtonProps: { variant: "destructive-primary" },
2187
2376
  confirmText: "確認取消",
2188
- loading: Je,
2377
+ loading: et,
2189
2378
  modalStatusType: "error",
2190
2379
  modalType: "standard",
2191
2380
  onCancel: () => F(!1),
2192
2381
  onClose: () => F(!1),
2193
- onConfirm: () => void Et(),
2194
- open: P,
2382
+ onConfirm: () => void an(),
2383
+ open: ct,
2195
2384
  showModalFooter: !0,
2196
2385
  showModalHeader: !0,
2197
2386
  supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
2198
2387
  title: "取消案件",
2199
2388
  children: /* @__PURE__ */ E("div", {
2200
- style: In,
2201
- children: [/* @__PURE__ */ E(C, {
2389
+ style: or,
2390
+ children: [/* @__PURE__ */ E(w, {
2202
2391
  variant: "body",
2203
2392
  children: [
2204
2393
  "確定要取消「",
2205
- S?.title ?? "",
2394
+ C?.title ?? "",
2206
2395
  "」嗎?"
2207
2396
  ]
2208
2397
  }), /* @__PURE__ */ T(n, {
2209
2398
  label: "取消原因",
2210
2399
  name: "cancelComment",
2211
- children: /* @__PURE__ */ T(ae, {
2212
- onChange: (e) => N(e.target.value),
2400
+ children: /* @__PURE__ */ T(_e, {
2401
+ onChange: (e) => st(e.target.value),
2213
2402
  placeholder: "可填寫取消原因",
2214
2403
  resize: "vertical",
2215
2404
  rows: 3,
2216
- value: Xe
2405
+ value: P
2217
2406
  })
2218
2407
  })]
2219
2408
  })
2220
2409
  })
2221
2410
  ] });
2222
2411
  }
2223
- function zn(e) {
2412
+ function lr(e) {
2224
2413
  return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
2225
2414
  }
2226
- function Bn(e) {
2227
- return e.edges.map(zn).filter((e) => e.trim().length > 0);
2415
+ function ur(e) {
2416
+ return e.edges.map(lr).filter((e) => e.trim().length > 0);
2228
2417
  }
2229
- function Vn(e) {
2418
+ function dr(e) {
2230
2419
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
2231
2420
  }
2232
- function Hn(e, t, n, r) {
2421
+ function fr(e, t, n, r) {
2233
2422
  return e.nodes.map((e) => {
2234
- let i = Rt(e, t, n, r);
2423
+ let i = on(e, t, n, r);
2235
2424
  return {
2236
2425
  data: {
2237
- kindLabel: Vn(e.type),
2426
+ kindLabel: dr(e.type),
2238
2427
  label: e.data.label,
2239
2428
  secondaryLabel: i.secondaryLabel,
2240
2429
  statusLabel: i.statusLabel,
@@ -2242,42 +2431,42 @@ function Hn(e, t, n, r) {
2242
2431
  },
2243
2432
  id: e.id,
2244
2433
  position: e.position,
2245
- sourcePosition: A.Right,
2246
- targetPosition: A.Left,
2434
+ sourcePosition: N.Right,
2435
+ targetPosition: N.Left,
2247
2436
  type: "workflowRuntime"
2248
2437
  };
2249
2438
  });
2250
2439
  }
2251
- function Un(e) {
2252
- let t = new Ke.graphlib.Graph();
2440
+ function pr(e) {
2441
+ let t = new P.graphlib.Graph();
2253
2442
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
2254
2443
  nodesep: 56,
2255
2444
  rankdir: "LR",
2256
2445
  ranksep: 120
2257
2446
  }), e.nodes.forEach((e) => {
2258
2447
  t.setNode(e.id, {
2259
- height: Dn,
2260
- width: En
2448
+ height: Zn,
2449
+ width: Xn
2261
2450
  });
2262
2451
  }), e.edges.forEach((e) => {
2263
2452
  t.setEdge(e.source, e.target);
2264
- }), Ke.layout(t), {
2453
+ }), P.layout(t), {
2265
2454
  ...e,
2266
2455
  nodes: e.nodes.map((e) => {
2267
2456
  let n = t.node(e.id);
2268
2457
  return n ? {
2269
2458
  ...e,
2270
2459
  position: {
2271
- x: n.x - En / 2,
2272
- y: n.y - Dn / 2
2460
+ x: n.x - Xn / 2,
2461
+ y: n.y - Zn / 2
2273
2462
  }
2274
2463
  } : e;
2275
2464
  })
2276
2465
  };
2277
2466
  }
2278
- function Wn(e) {
2467
+ function mr(e) {
2279
2468
  return e.edges.map((e) => {
2280
- let t = zn(e);
2469
+ let t = lr(e);
2281
2470
  return {
2282
2471
  animated: !1,
2283
2472
  id: e.id,
@@ -2305,25 +2494,25 @@ function Wn(e) {
2305
2494
  };
2306
2495
  });
2307
2496
  }
2308
- function Gn(e) {
2497
+ function hr(e) {
2309
2498
  return e === "current" ? {
2310
- ...An,
2499
+ ...er,
2311
2500
  border: "1px solid var(--mzn-color-primary, #0057ff)",
2312
2501
  boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
2313
2502
  } : e === "completed" ? {
2314
- ...An,
2503
+ ...er,
2315
2504
  border: "1px solid #16a34a"
2316
2505
  } : e === "cancelled" ? {
2317
- ...An,
2506
+ ...er,
2318
2507
  border: "1px solid #dc2626",
2319
2508
  opacity: .72
2320
2509
  } : e === "waiting" ? {
2321
- ...An,
2510
+ ...er,
2322
2511
  border: "1px dashed #64748b"
2323
- } : An;
2512
+ } : er;
2324
2513
  }
2325
- function Kn(e) {
2326
- let t = jn;
2514
+ function gr(e) {
2515
+ let t = tr;
2327
2516
  return e === "current" ? {
2328
2517
  ...t,
2329
2518
  background: "#eff6ff",
@@ -2346,17 +2535,17 @@ function Kn(e) {
2346
2535
  color: "#64748b"
2347
2536
  };
2348
2537
  }
2349
- function qn({ data: e }) {
2538
+ function _r({ data: e }) {
2350
2539
  return /* @__PURE__ */ E("div", {
2351
- style: Gn(e.tone),
2540
+ style: hr(e.tone),
2352
2541
  children: [
2353
- /* @__PURE__ */ T(We, {
2542
+ /* @__PURE__ */ T(at, {
2354
2543
  isConnectable: !1,
2355
- position: A.Left,
2356
- style: Nn,
2544
+ position: N.Left,
2545
+ style: rr,
2357
2546
  type: "target"
2358
2547
  }),
2359
- /* @__PURE__ */ T(C, {
2548
+ /* @__PURE__ */ T(w, {
2360
2549
  component: "span",
2361
2550
  ellipsis: !0,
2362
2551
  title: e.label,
@@ -2364,24 +2553,24 @@ function qn({ data: e }) {
2364
2553
  children: e.label
2365
2554
  }),
2366
2555
  /* @__PURE__ */ T("span", {
2367
- style: Kn(e.tone),
2556
+ style: gr(e.tone),
2368
2557
  children: e.statusLabel
2369
2558
  }),
2370
2559
  /* @__PURE__ */ T("span", {
2371
2560
  title: e.secondaryLabel,
2372
- style: Mn,
2561
+ style: nr,
2373
2562
  children: e.secondaryLabel || e.kindLabel
2374
2563
  }),
2375
- /* @__PURE__ */ T(We, {
2564
+ /* @__PURE__ */ T(at, {
2376
2565
  isConnectable: !1,
2377
- position: A.Right,
2378
- style: Nn,
2566
+ position: N.Right,
2567
+ style: rr,
2379
2568
  type: "source"
2380
2569
  })
2381
2570
  ]
2382
2571
  });
2383
2572
  }
2384
2573
  //#endregion
2385
- export { an as a, cn as i, xn as n, qt as o, _n as r, Gt as s, Rn as t };
2574
+ export { Tn as a, kn as i, Hn as n, mn as o, Rn as r, fn as s, cr as t };
2386
2575
 
2387
- //# sourceMappingURL=detail-B_bSg31B.js.map
2576
+ //# sourceMappingURL=detail-URwxkcro.js.map