@rytass/bpm-core-react 0.3.0 → 0.3.2

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 (184) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/README.md +13 -1
  3. package/dist/chunks/app-navigation-BSkMsEhy.js +268 -0
  4. package/dist/chunks/app-navigation-BSkMsEhy.js.map +1 -0
  5. package/dist/chunks/app-navigation-KnlJCUp1.cjs +2 -0
  6. package/dist/chunks/app-navigation-KnlJCUp1.cjs.map +1 -0
  7. package/dist/chunks/approval-instance-list-page-CVXgE2K3.cjs +2 -0
  8. package/dist/chunks/approval-instance-list-page-CVXgE2K3.cjs.map +1 -0
  9. package/dist/chunks/{approval-instance-list-page-BgE4vQw8.js → approval-instance-list-page-CqNdoZqx.js} +103 -99
  10. package/dist/chunks/approval-instance-list-page-CqNdoZqx.js.map +1 -0
  11. package/dist/chunks/builder-CMlJfQHE.cjs +3 -0
  12. package/dist/chunks/builder-CMlJfQHE.cjs.map +1 -0
  13. package/dist/chunks/{builder-Du_0apkh.js → builder-D950gct_.js} +436 -432
  14. package/dist/chunks/builder-D950gct_.js.map +1 -0
  15. package/dist/chunks/categories-5yEM3p3N.cjs +2 -0
  16. package/dist/chunks/categories-5yEM3p3N.cjs.map +1 -0
  17. package/dist/chunks/categories-BIpOG451.js +387 -0
  18. package/dist/chunks/categories-BIpOG451.js.map +1 -0
  19. package/dist/chunks/dashboard-page-1K_jQXQk.cjs +2 -0
  20. package/dist/chunks/dashboard-page-1K_jQXQk.cjs.map +1 -0
  21. package/dist/chunks/dashboard-page-R_T2OEiE.js +122 -0
  22. package/dist/chunks/dashboard-page-R_T2OEiE.js.map +1 -0
  23. package/dist/chunks/delegations-B2j-wNEO.js +646 -0
  24. package/dist/chunks/delegations-B2j-wNEO.js.map +1 -0
  25. package/dist/chunks/delegations-CsB9ozLu.cjs +2 -0
  26. package/dist/chunks/delegations-CsB9ozLu.cjs.map +1 -0
  27. package/dist/chunks/delegations-CvtwTXNP.cjs +2 -0
  28. package/dist/chunks/delegations-CvtwTXNP.cjs.map +1 -0
  29. package/dist/chunks/delegations-dKodb0WW.js +573 -0
  30. package/dist/chunks/delegations-dKodb0WW.js.map +1 -0
  31. package/dist/chunks/detail-BcGAqJ_R.js +1523 -0
  32. package/dist/chunks/detail-BcGAqJ_R.js.map +1 -0
  33. package/dist/chunks/detail-CqjqLd65.cjs +2 -0
  34. package/dist/chunks/detail-CqjqLd65.cjs.map +1 -0
  35. package/dist/chunks/{format-date-time-hKLVMxq4.cjs → format-date-time-26_pFvv4.cjs} +2 -2
  36. package/dist/chunks/{format-date-time-hKLVMxq4.cjs.map → format-date-time-26_pFvv4.cjs.map} +1 -1
  37. package/dist/chunks/notifications-2swRqDPF.js +198 -0
  38. package/dist/chunks/notifications-2swRqDPF.js.map +1 -0
  39. package/dist/chunks/notifications-BaYDebFt.cjs +2 -0
  40. package/dist/chunks/notifications-BaYDebFt.cjs.map +1 -0
  41. package/dist/chunks/{orgs-c29y74w2.js → orgs-CuHxxd_n.js} +665 -661
  42. package/dist/chunks/orgs-CuHxxd_n.js.map +1 -0
  43. package/dist/chunks/orgs-YMiVLNvL.cjs +2 -0
  44. package/dist/chunks/orgs-YMiVLNvL.cjs.map +1 -0
  45. package/dist/chunks/routes-config-2aKbWq2H.cjs +2 -0
  46. package/dist/chunks/routes-config-2aKbWq2H.cjs.map +1 -0
  47. package/dist/chunks/routes-config-dxahImVe.js +43 -0
  48. package/dist/chunks/routes-config-dxahImVe.js.map +1 -0
  49. package/dist/chunks/templates-DTkbSgFY.cjs +2 -0
  50. package/dist/chunks/templates-DTkbSgFY.cjs.map +1 -0
  51. package/dist/chunks/{templates-Dn9QHFSy.js → templates-DoDWM68t.js} +136 -132
  52. package/dist/chunks/templates-DoDWM68t.js.map +1 -0
  53. package/dist/chunks/users-3ySyUW4u.cjs +2 -0
  54. package/dist/chunks/users-3ySyUW4u.cjs.map +1 -0
  55. package/dist/chunks/users-sMfrSjRQ.js +219 -0
  56. package/dist/chunks/users-sMfrSjRQ.js.map +1 -0
  57. package/dist/components/app-navigation.d.ts +17 -10
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.ts +1 -0
  61. package/dist/index.js +101 -99
  62. package/dist/index.js.map +1 -1
  63. package/dist/lib/notification-drawer-provider.d.ts +1 -1
  64. package/dist/lib/notification-unread-provider.d.ts +1 -1
  65. package/dist/lib/providers.d.ts +1 -1
  66. package/dist/lib/routes-config.d.ts +96 -0
  67. package/dist/next/index.cjs +1 -1
  68. package/dist/next/index.cjs.map +1 -1
  69. package/dist/next/index.d.ts +1 -0
  70. package/dist/next/index.js +22 -21
  71. package/dist/next/index.js.map +1 -1
  72. package/dist/pages/admin/delegations/index.cjs +1 -1
  73. package/dist/pages/admin/delegations/index.js +1 -1
  74. package/dist/pages/admin/orgs/index.cjs +1 -1
  75. package/dist/pages/admin/orgs/index.js +1 -1
  76. package/dist/pages/admin/users/index.cjs +1 -1
  77. package/dist/pages/admin/users/index.js +1 -1
  78. package/dist/pages/delegations/index.cjs +1 -1
  79. package/dist/pages/delegations/index.js +1 -1
  80. package/dist/pages/forms/builder/index.cjs +1 -1
  81. package/dist/pages/forms/builder/index.js +1 -1
  82. package/dist/pages/instances/detail/index.cjs +1 -1
  83. package/dist/pages/instances/detail/index.js +1 -1
  84. package/dist/pages/settings/notifications/index.cjs +1 -1
  85. package/dist/pages/settings/notifications/index.js +1 -1
  86. package/dist/pages/templates/categories/index.cjs +1 -1
  87. package/dist/pages/templates/categories/index.js +1 -1
  88. package/dist/pages/templates/index.cjs +1 -1
  89. package/dist/pages/templates/index.js +1 -1
  90. package/dist/views/admin/delegations/index.cjs +1 -1
  91. package/dist/views/admin/delegations/index.js +1 -1
  92. package/dist/views/admin/index.cjs +1 -1
  93. package/dist/views/admin/index.js +3 -3
  94. package/dist/views/admin/orgs/index.cjs +1 -1
  95. package/dist/views/admin/orgs/index.js +1 -1
  96. package/dist/views/admin/users/index.cjs +1 -1
  97. package/dist/views/admin/users/index.js +1 -1
  98. package/dist/views/cc/index.cjs +1 -1
  99. package/dist/views/cc/index.js +1 -1
  100. package/dist/views/dashboard/index.cjs +1 -1
  101. package/dist/views/dashboard/index.js +1 -1
  102. package/dist/views/delegations/index.cjs +1 -1
  103. package/dist/views/delegations/index.js +1 -1
  104. package/dist/views/forms/builder/index.cjs +1 -1
  105. package/dist/views/forms/builder/index.js +1 -1
  106. package/dist/views/forms/index.cjs +1 -1
  107. package/dist/views/forms/index.cjs.map +1 -1
  108. package/dist/views/forms/index.js +84 -80
  109. package/dist/views/forms/index.js.map +1 -1
  110. package/dist/views/inbox/index.cjs +1 -1
  111. package/dist/views/inbox/index.cjs.map +1 -1
  112. package/dist/views/inbox/index.js +83 -79
  113. package/dist/views/inbox/index.js.map +1 -1
  114. package/dist/views/instances/detail/index.cjs +1 -1
  115. package/dist/views/instances/detail/index.js +1 -1
  116. package/dist/views/instances/new/index.cjs +1 -1
  117. package/dist/views/instances/new/index.cjs.map +1 -1
  118. package/dist/views/instances/new/index.js +107 -100
  119. package/dist/views/instances/new/index.js.map +1 -1
  120. package/dist/views/search/index.cjs +1 -1
  121. package/dist/views/search/index.js +1 -1
  122. package/dist/views/sent/index.cjs +1 -1
  123. package/dist/views/sent/index.js +1 -1
  124. package/dist/views/settings/index.cjs +1 -1
  125. package/dist/views/settings/index.js +1 -1
  126. package/dist/views/settings/notifications/index.cjs +1 -1
  127. package/dist/views/settings/notifications/index.js +1 -1
  128. package/dist/views/templates/categories/index.cjs +1 -1
  129. package/dist/views/templates/categories/index.js +1 -1
  130. package/dist/views/templates/designer/index.cjs +6 -6
  131. package/dist/views/templates/designer/index.cjs.map +1 -1
  132. package/dist/views/templates/designer/index.js +758 -754
  133. package/dist/views/templates/designer/index.js.map +1 -1
  134. package/dist/views/templates/index.cjs +1 -1
  135. package/dist/views/templates/index.js +2 -2
  136. package/dist/views/templates/versions/index.cjs +1 -1
  137. package/dist/views/templates/versions/index.cjs.map +1 -1
  138. package/dist/views/templates/versions/index.js +47 -43
  139. package/dist/views/templates/versions/index.js.map +1 -1
  140. package/package.json +3 -3
  141. package/dist/chunks/app-navigation-BRRFCkxZ.cjs +0 -2
  142. package/dist/chunks/app-navigation-BRRFCkxZ.cjs.map +0 -1
  143. package/dist/chunks/app-navigation-rxhpHCch.js +0 -262
  144. package/dist/chunks/app-navigation-rxhpHCch.js.map +0 -1
  145. package/dist/chunks/approval-instance-list-page-2vUWc5-c.cjs +0 -2
  146. package/dist/chunks/approval-instance-list-page-2vUWc5-c.cjs.map +0 -1
  147. package/dist/chunks/approval-instance-list-page-BgE4vQw8.js.map +0 -1
  148. package/dist/chunks/builder-B8X-m6C5.cjs +0 -3
  149. package/dist/chunks/builder-B8X-m6C5.cjs.map +0 -1
  150. package/dist/chunks/builder-Du_0apkh.js.map +0 -1
  151. package/dist/chunks/categories-DG4k7S8V.js +0 -383
  152. package/dist/chunks/categories-DG4k7S8V.js.map +0 -1
  153. package/dist/chunks/categories-DshBQG33.cjs +0 -2
  154. package/dist/chunks/categories-DshBQG33.cjs.map +0 -1
  155. package/dist/chunks/dashboard-page-CTBwpu_D.js +0 -114
  156. package/dist/chunks/dashboard-page-CTBwpu_D.js.map +0 -1
  157. package/dist/chunks/dashboard-page-DcDiWQp2.cjs +0 -2
  158. package/dist/chunks/dashboard-page-DcDiWQp2.cjs.map +0 -1
  159. package/dist/chunks/delegations-BAZQbElH.js +0 -642
  160. package/dist/chunks/delegations-BAZQbElH.js.map +0 -1
  161. package/dist/chunks/delegations-DzrckrPp.js +0 -569
  162. package/dist/chunks/delegations-DzrckrPp.js.map +0 -1
  163. package/dist/chunks/delegations-Z8hTajLj.cjs +0 -2
  164. package/dist/chunks/delegations-Z8hTajLj.cjs.map +0 -1
  165. package/dist/chunks/delegations-hb9JoVZe.cjs +0 -2
  166. package/dist/chunks/delegations-hb9JoVZe.cjs.map +0 -1
  167. package/dist/chunks/detail-DilI0PPe.js +0 -1519
  168. package/dist/chunks/detail-DilI0PPe.js.map +0 -1
  169. package/dist/chunks/detail-DuRg3Y7b.cjs +0 -2
  170. package/dist/chunks/detail-DuRg3Y7b.cjs.map +0 -1
  171. package/dist/chunks/notifications-B2Lk3grg.js +0 -194
  172. package/dist/chunks/notifications-B2Lk3grg.js.map +0 -1
  173. package/dist/chunks/notifications-C8ADhnxF.cjs +0 -2
  174. package/dist/chunks/notifications-C8ADhnxF.cjs.map +0 -1
  175. package/dist/chunks/orgs-CGv3VNDR.cjs +0 -2
  176. package/dist/chunks/orgs-CGv3VNDR.cjs.map +0 -1
  177. package/dist/chunks/orgs-c29y74w2.js.map +0 -1
  178. package/dist/chunks/templates-Cd0WFheA.cjs +0 -2
  179. package/dist/chunks/templates-Cd0WFheA.cjs.map +0 -1
  180. package/dist/chunks/templates-Dn9QHFSy.js.map +0 -1
  181. package/dist/chunks/users-B-trMu0E.cjs +0 -2
  182. package/dist/chunks/users-B-trMu0E.cjs.map +0 -1
  183. package/dist/chunks/users-itVXXRj7.js +0 -215
  184. package/dist/chunks/users-itVXXRj7.js.map +0 -1
@@ -0,0 +1,1523 @@
1
+ "use client";
2
+ import { n as e } from "./auth-provider-Bnox5gsx.js";
3
+ import { t } from "./format-date-time-CB-LxzqT.js";
4
+ import { t as n } from "./app-navigation-BSkMsEhy.js";
5
+ import { r } from "./routes-config-dxahImVe.js";
6
+ import { t as i } from "./bpm-form-field-Cao0rMol.js";
7
+ import { t as a } from "./FormRendererView-DrHsuSVo.js";
8
+ import { Fragment as o, forwardRef as s, useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
9
+ import { AutoComplete as p, Button as m, Modal as h, PageHeader as ee, Section as g, SectionGroup as te, Select as ne, Stepper as re, Table as ie, Textarea as _, Tooltip as ae, Typography as v } from "@mezzanine-ui/react";
10
+ import { Fragment as oe, jsx as y, jsxs as b } from "react/jsx-runtime";
11
+ import { cancelApprovalInstance as se, decideTask as ce, listAttachments as le, listTaskDecisions as ue, readApprovalInstance as de, readAttachmentDownloadUrl as fe, readAttachmentPreviewUrl as pe, readInstanceSignatures as me, resolveMemberProfiles as x, resubmitApprovalInstance as he, searchMembers as ge, uploadAttachment as _e } from "@rytass/bpm-core-client/workflow";
12
+ import { CheckedIcon as ve, ChevronLeftIcon as ye, ChevronRightIcon as be, DangerousOutlineIcon as xe, DownloadIcon as Se, FileSearchIcon as Ce, RefreshCcwIcon as we, ShareIcon as Te, UserIcon as Ee, ZoomInIcon as De, ZoomOutIcon as Oe } from "@mezzanine-ui/icons";
13
+ import ke from "@mezzanine-ui/react/ContentHeader";
14
+ import { focusFormRendererField as Ae, validateFormRendererValues as je } from "@rytass/bpm-core-client/form";
15
+ import { Background as Me, Controls as Ne, Handle as Pe, Position as S, ReactFlow as Fe } from "@xyflow/react";
16
+ import * as Ie from "dagre";
17
+ import { stepClasses as C } from "@mezzanine-ui/core/stepper";
18
+ import { Document as Le, Page as w } from "react-pdf";
19
+ import '../detail.css';var T = {
20
+ root: "bpm_root_ehm7w",
21
+ toolbar: "bpm_toolbar_R-tis",
22
+ pageControls: "bpm_pageControls_jM-rC",
23
+ zoomControls: "bpm_zoomControls_7RAbJ",
24
+ counter: "bpm_counter_ILUsD",
25
+ viewport: "bpm_viewport_DQXms",
26
+ page: "bpm_page_Cv5Rg",
27
+ state: "bpm_state_bpgp3"
28
+ }, E = 760, Re = 920, ze = 320, Be = 32, Ve = .75, D = 1.75, He = .25;
29
+ function Ue({ filename: e, fileUrl: t, onDownload: n }) {
30
+ let r = d(null), [i, a] = f(null), [o, s] = f(1), [p, h] = f(1), [ee, g] = f(E);
31
+ l(() => {
32
+ let e = r.current;
33
+ if (!e || typeof ResizeObserver > "u") return;
34
+ let t = new ResizeObserver((e) => {
35
+ let t = e[0]?.contentRect.width;
36
+ t && g(t);
37
+ });
38
+ return t.observe(e), () => t.disconnect();
39
+ }, []), l(() => {
40
+ a(null), s(1), h(1);
41
+ }, [t]);
42
+ let te = u(() => {
43
+ let e = Math.max(ze, ee - Be);
44
+ return Math.round(Math.min(Re, e) * p);
45
+ }, [p, ee]), ne = c((e) => {
46
+ a(e.numPages), s(1);
47
+ }, []), re = o > 1, ie = i !== null && o < i, _ = p > Ve, ae = p < D, oe = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, se = `${Math.round(p * 100)}%`;
48
+ return /* @__PURE__ */ b("section", {
49
+ "aria-label": `${e} PDF 預覽`,
50
+ className: T.root,
51
+ children: [/* @__PURE__ */ b("div", {
52
+ className: T.toolbar,
53
+ children: [
54
+ /* @__PURE__ */ b("div", {
55
+ className: T.pageControls,
56
+ "aria-label": "頁面切換",
57
+ children: [
58
+ /* @__PURE__ */ y(m, {
59
+ "aria-label": "上一頁",
60
+ disabled: !re,
61
+ icon: ye,
62
+ onClick: () => {
63
+ s((e) => Math.max(1, e - 1));
64
+ },
65
+ size: "minor",
66
+ variant: "base-secondary"
67
+ }),
68
+ /* @__PURE__ */ y(v, {
69
+ className: T.counter,
70
+ component: "span",
71
+ variant: "body",
72
+ children: oe
73
+ }),
74
+ /* @__PURE__ */ y(m, {
75
+ "aria-label": "下一頁",
76
+ disabled: !ie,
77
+ icon: be,
78
+ onClick: () => {
79
+ s((e) => i === null ? e : Math.min(i, e + 1));
80
+ },
81
+ size: "minor",
82
+ variant: "base-secondary"
83
+ })
84
+ ]
85
+ }),
86
+ /* @__PURE__ */ b("div", {
87
+ className: T.zoomControls,
88
+ "aria-label": "縮放",
89
+ children: [
90
+ /* @__PURE__ */ y(m, {
91
+ "aria-label": "縮小",
92
+ disabled: !_,
93
+ icon: Oe,
94
+ onClick: () => {
95
+ h((e) => Math.max(Ve, e - He));
96
+ },
97
+ size: "minor",
98
+ variant: "base-secondary"
99
+ }),
100
+ /* @__PURE__ */ y(v, {
101
+ className: T.counter,
102
+ component: "span",
103
+ variant: "body",
104
+ children: se
105
+ }),
106
+ /* @__PURE__ */ y(m, {
107
+ "aria-label": "放大",
108
+ disabled: !ae,
109
+ icon: De,
110
+ onClick: () => {
111
+ h((e) => Math.min(D, e + He));
112
+ },
113
+ size: "minor",
114
+ variant: "base-secondary"
115
+ })
116
+ ]
117
+ }),
118
+ n ? /* @__PURE__ */ y(m, {
119
+ icon: Se,
120
+ iconType: "leading",
121
+ onClick: n,
122
+ size: "minor",
123
+ variant: "base-primary",
124
+ children: "下載"
125
+ }) : null
126
+ ]
127
+ }), /* @__PURE__ */ y("div", {
128
+ className: T.viewport,
129
+ ref: r,
130
+ children: /* @__PURE__ */ y(Le, {
131
+ error: /* @__PURE__ */ y(O, { message: "PDF 無法載入。" }),
132
+ file: t,
133
+ loading: /* @__PURE__ */ y(O, { message: "正在載入 PDF..." }),
134
+ noData: /* @__PURE__ */ y(O, { message: "沒有可預覽的 PDF。" }),
135
+ onLoadSuccess: ne,
136
+ children: /* @__PURE__ */ y(w, {
137
+ className: T.page,
138
+ loading: /* @__PURE__ */ y(O, { message: "正在載入頁面..." }),
139
+ pageNumber: o,
140
+ renderAnnotationLayer: !0,
141
+ renderTextLayer: !0,
142
+ width: te
143
+ })
144
+ })
145
+ })]
146
+ });
147
+ }
148
+ function O({ message: e }) {
149
+ return /* @__PURE__ */ y("div", {
150
+ className: T.state,
151
+ children: /* @__PURE__ */ y(v, {
152
+ color: "text-neutral",
153
+ variant: "body",
154
+ children: e
155
+ })
156
+ });
157
+ }
158
+ //#endregion
159
+ //#region src/views/instances/detail/InstanceDetailView.tsx
160
+ var k = {
161
+ display: "grid",
162
+ gap: 16
163
+ }, We = {
164
+ display: "flex",
165
+ flexWrap: "wrap",
166
+ gap: 8
167
+ }, A = 184, j = 96, Ge = {
168
+ display: "grid",
169
+ gap: 16
170
+ }, Ke = {
171
+ display: "grid",
172
+ gap: 12,
173
+ width: "100%"
174
+ }, qe = {
175
+ minWidth: "100%",
176
+ width: "100%"
177
+ }, Je = {
178
+ display: "grid",
179
+ gap: 12,
180
+ width: "100%"
181
+ }, Ye = {
182
+ background: "#f8fafc",
183
+ border: "1px solid #e2e8f0",
184
+ borderRadius: 8,
185
+ height: "min(64vh, 620px)",
186
+ minHeight: 440,
187
+ overflow: "hidden",
188
+ width: "min(80vw, 1040px)"
189
+ }, M = {
190
+ background: "#ffffff",
191
+ border: "1px solid #cbd5e1",
192
+ borderRadius: 8,
193
+ boxShadow: "0 8px 18px rgba(15, 23, 42, 0.08)",
194
+ display: "grid",
195
+ gap: 6,
196
+ minHeight: 82,
197
+ padding: 12,
198
+ width: 184
199
+ }, Xe = {
200
+ borderRadius: 999,
201
+ fontSize: 12,
202
+ fontWeight: 600,
203
+ justifySelf: "start",
204
+ lineHeight: "18px",
205
+ padding: "0 8px"
206
+ }, Ze = {
207
+ color: "#64748b",
208
+ fontSize: 12,
209
+ overflow: "hidden",
210
+ textOverflow: "ellipsis",
211
+ whiteSpace: "nowrap"
212
+ }, Qe = { opacity: 0 }, $e = {
213
+ display: "flex",
214
+ flexWrap: "wrap",
215
+ gap: 8
216
+ }, et = {
217
+ alignItems: "center",
218
+ background: "#ffffff",
219
+ border: "1px solid #cbd5e1",
220
+ borderRadius: 8,
221
+ color: "#334155",
222
+ display: "inline-flex",
223
+ fontSize: 12,
224
+ fontWeight: 600,
225
+ gap: 6,
226
+ lineHeight: "20px",
227
+ padding: "4px 8px"
228
+ }, tt = {
229
+ cursor: "help",
230
+ textDecoration: "underline dotted",
231
+ textUnderlineOffset: 3
232
+ }, N = { color: "var(--mzn-color-text-error)" };
233
+ function nt(e) {
234
+ e && (e.style.width = "100%");
235
+ }
236
+ var rt = { workflowRuntime: X };
237
+ function it({ instanceId: o }) {
238
+ let s = r(), { member: c } = e(), d = c?.memberId ?? null, [ae, ue] = f([]), [x, ye] = f(null), [be, De] = f([]), [Oe, Pe] = f([]), [S, Ie] = f([]), [C, Le] = f(null), [w, T] = f([]), [E, Re] = f([]), [ze, Be] = f([]), [Ve, D] = f(null), [He, O] = f(!0), [A, j] = f(!1), [M, Xe] = f(!1), [Ze, Qe] = f(""), [tt, N] = f(!1), [it, F] = f(""), [ct, I] = f(null), [pt, L] = f(!1), [R, z] = f(""), [ht, gt] = f(!1), [_t, B] = f(null), [vt, V] = f(""), [H, U] = f(null), [yt, bt] = f(!1), [xt, St] = f([]), [Ct, wt] = f(!1), [Tt, G] = f({}), [jt, Mt] = f({}), [K, Nt] = f(null), [q, Lt] = f(null), J = it.trim(), Y = Ze.trim(), Rt = R.trim(), zt = vt.trim();
239
+ l(() => {
240
+ un();
241
+ }, [d, o]), l(() => {
242
+ Mt(x?.formData ?? {});
243
+ }, [x]);
244
+ let X = u(() => w.find((e) => kt(e, d) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [d, w]), Z = u(() => X && x ? x.workflowSnapshot.nodes.find((e) => e.id === X.nodeId) ?? null : null, [X, x]), Q = u(() => Z && x ? Et(x.workflowSnapshot, Z) : [], [Z, x]), Ut = Z?.type === "userTask" && Z.data.returnBehavior.allowReturn, Wt = Q.find((e) => e.id === _t) ?? Q[0] ?? null, Gt = !!(x && x.initiatorMemberId === d && (x.state === "RUNNING" || x.state === "RETURNED")), qt = !!(x && x.initiatorMemberId === d && x.state === "RETURNED"), Jt = u(() => new Map(ze.map((e) => [e.memberId, e])), [ze]), Yt = u(() => w.map((e) => ({
245
+ ...e,
246
+ assigneeLabel: Ot(e, Jt),
247
+ key: e.id,
248
+ nodeLabel: W(e.nodeId, x?.workflowSnapshot ?? null),
249
+ statusLabel: Dt(e.status)
250
+ })), [
251
+ x,
252
+ Jt,
253
+ w
254
+ ]), Xt = u(() => dt(be), [be]), Zt = u(() => new Map(S.map((e) => [e.id, e])), [S]), Qt = u(() => ft(ae, w, E, x?.workflowSnapshot ?? null, x?.state ?? "RUNNING", Jt, Xt, Zt, C), [
255
+ ae,
256
+ x,
257
+ Jt,
258
+ C,
259
+ Zt,
260
+ Xt,
261
+ w,
262
+ E
263
+ ]), $t = u(() => mt(Qt), [Qt]), $ = u(() => x ? Vt(x.workflowSnapshot) : null, [x]), en = u(() => x && $ ? Bt($, w, E, x.state) : [], [
264
+ x,
265
+ $,
266
+ w,
267
+ E
268
+ ]), tn = u(() => $ ? Ht($) : [], [$]), nn = u(() => x ? Kt(x.workflowSnapshot) : [], [x]), rn = u(() => [
269
+ {
270
+ dataIndex: "nodeLabel",
271
+ key: "nodeLabel",
272
+ title: "節點",
273
+ width: 180
274
+ },
275
+ {
276
+ key: "assigneeMemberId",
277
+ title: "處理者",
278
+ render: (e) => /* @__PURE__ */ y(v, {
279
+ component: "span",
280
+ variant: "body",
281
+ children: e.assigneeLabel
282
+ }),
283
+ width: 180
284
+ },
285
+ {
286
+ dataIndex: "statusLabel",
287
+ key: "statusLabel",
288
+ title: "狀態",
289
+ width: 120
290
+ },
291
+ {
292
+ key: "createdAt",
293
+ render: (e) => /* @__PURE__ */ y(v, {
294
+ component: "span",
295
+ variant: "body",
296
+ children: t(e.createdAt)
297
+ }),
298
+ title: "建立時間",
299
+ width: 220
300
+ }
301
+ ], []), an = u(() => Oe.map((e) => ({
302
+ attachment: e,
303
+ createdAt: e.createdAt,
304
+ filename: e.filename,
305
+ id: e.id,
306
+ key: e.id,
307
+ mimeType: e.mimeType,
308
+ sizeLabel: at(Number(e.sizeBytes))
309
+ })), [Oe]), on = u(() => [
310
+ {
311
+ dataIndex: "filename",
312
+ key: "filename",
313
+ title: "檔名",
314
+ width: 260
315
+ },
316
+ {
317
+ dataIndex: "mimeType",
318
+ key: "mimeType",
319
+ title: "類型",
320
+ width: 180
321
+ },
322
+ {
323
+ dataIndex: "sizeLabel",
324
+ key: "sizeLabel",
325
+ title: "大小",
326
+ width: 120
327
+ },
328
+ {
329
+ key: "createdAt",
330
+ render: (e) => /* @__PURE__ */ y(v, {
331
+ component: "span",
332
+ variant: "body",
333
+ children: t(e.createdAt)
334
+ }),
335
+ title: "上傳時間",
336
+ width: 220
337
+ }
338
+ ], []), sn = u(() => ({
339
+ render: (e) => [...e.mimeType === "application/pdf" ? [{
340
+ icon: Ce,
341
+ iconType: "leading",
342
+ name: "預覽",
343
+ onClick: () => {
344
+ pn(e.attachment);
345
+ }
346
+ }] : [], {
347
+ icon: Se,
348
+ iconType: "leading",
349
+ name: "下載",
350
+ onClick: () => {
351
+ fn(e.attachment);
352
+ }
353
+ }],
354
+ variant: "base-secondary",
355
+ width: 160
356
+ }), []), cn = u(() => S.map((e) => ({
357
+ algorithm: e.algorithm,
358
+ hashLabel: ot(e.signedPayloadHash),
359
+ key: e.id,
360
+ keyVersion: e.keyVersion,
361
+ signedAtLabel: t(e.signedAt),
362
+ signerMemberId: e.signerMemberId
363
+ })), [S]), ln = u(() => [
364
+ {
365
+ dataIndex: "signerMemberId",
366
+ key: "signerMemberId",
367
+ title: "簽章者",
368
+ width: 160
369
+ },
370
+ {
371
+ dataIndex: "algorithm",
372
+ key: "algorithm",
373
+ title: "演算法",
374
+ width: 150
375
+ },
376
+ {
377
+ dataIndex: "keyVersion",
378
+ key: "keyVersion",
379
+ title: "Key 版本",
380
+ width: 100
381
+ },
382
+ {
383
+ dataIndex: "hashLabel",
384
+ key: "hashLabel",
385
+ title: "Payload Hash",
386
+ width: 180
387
+ },
388
+ {
389
+ dataIndex: "signedAtLabel",
390
+ key: "signedAtLabel",
391
+ title: "簽章時間",
392
+ width: 220
393
+ }
394
+ ], []);
395
+ async function un() {
396
+ O(!0), D(null);
397
+ try {
398
+ let e = await de(o);
399
+ ue(e.activityLogs), ye(e.instance), T(e.tasks), Re(e.workflowTokens);
400
+ let [t, n, r, i] = await Promise.all([
401
+ ut(e.tasks),
402
+ lt(e),
403
+ le(e.instance.id),
404
+ me(e.instance.id)
405
+ ]);
406
+ De(t), Be(n), Pe(r), Ie(i.signatures), Le(i.verification);
407
+ } catch (e) {
408
+ D(P(e));
409
+ } finally {
410
+ O(!1);
411
+ }
412
+ }
413
+ async function dn(e, t) {
414
+ if (!d) throw Error("尚未登入,無法上傳附件");
415
+ return { id: (await _e({
416
+ file: t,
417
+ formFieldPath: `form.${e.fieldKey}`
418
+ })).id };
419
+ }
420
+ async function fn(e) {
421
+ if (!d) return;
422
+ let t = await fe({ id: e.id });
423
+ window.open(t, "_blank", "noopener,noreferrer");
424
+ }
425
+ async function pn(e) {
426
+ if (!d) return;
427
+ let t = await pe({ id: e.id });
428
+ Nt(e), Lt(t);
429
+ }
430
+ async function mn({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: r = null }) {
431
+ if (!(!d || !X)) {
432
+ j(!0), D(null);
433
+ try {
434
+ await ce({
435
+ action: e,
436
+ comment: t,
437
+ decidedByMemberId: d,
438
+ returnToNodeId: n,
439
+ taskId: X.id,
440
+ transferToMemberId: r
441
+ }), L(!1), gt(!1), wt(!1), F(""), z(""), V(""), U(null), B(null), I(null), await un();
442
+ } catch (e) {
443
+ D(P(e));
444
+ } finally {
445
+ j(!1);
446
+ }
447
+ }
448
+ }
449
+ function hn() {
450
+ F(""), I(null), L(!0);
451
+ }
452
+ function gn() {
453
+ A || (L(!1), F(""), I(null));
454
+ }
455
+ function _n() {
456
+ z(""), B(Q[0]?.id ?? null), gt(!0);
457
+ }
458
+ function vn() {
459
+ A || (gt(!1), z(""), B(null));
460
+ }
461
+ function yn() {
462
+ V(""), U(null), wt(!0), xn("");
463
+ }
464
+ function bn() {
465
+ A || (wt(!1), V(""), U(null));
466
+ }
467
+ async function xn(e) {
468
+ bt(!0);
469
+ try {
470
+ St((await ge(e)).filter((e) => e.memberId !== d).map(Pt));
471
+ } catch (e) {
472
+ D(P(e));
473
+ } finally {
474
+ bt(!1);
475
+ }
476
+ }
477
+ async function Sn() {
478
+ if (!J) {
479
+ I("請輸入拒絕原因");
480
+ return;
481
+ }
482
+ await mn({
483
+ action: "REJECTED",
484
+ comment: J
485
+ });
486
+ }
487
+ async function Cn() {
488
+ if (!H) {
489
+ D("請選擇轉派對象");
490
+ return;
491
+ }
492
+ await mn({
493
+ action: "TRANSFERRED",
494
+ comment: zt || null,
495
+ transferToMemberId: H.id
496
+ });
497
+ }
498
+ async function wn() {
499
+ await mn({
500
+ action: "RETURNED",
501
+ comment: Rt || null,
502
+ returnToNodeId: Wt?.id ?? null
503
+ });
504
+ }
505
+ async function Tn() {
506
+ if (!(!d || !x || !Gt)) {
507
+ if (j(!0), D(null), G({}), x.formDefinitionSnapshot.schema && x.formDefinitionSnapshot.uiSchema) {
508
+ let e = je({
509
+ schema: x.formDefinitionSnapshot.schema,
510
+ uiSchema: x.formDefinitionSnapshot.uiSchema,
511
+ values: jt
512
+ });
513
+ if (!e.valid) {
514
+ G(e.errors), D("請先補齊必填欄位。"), e.firstInvalidFieldKey && Ae(e.firstInvalidFieldKey), j(!1);
515
+ return;
516
+ }
517
+ }
518
+ try {
519
+ await se({
520
+ cancelledByMemberId: d,
521
+ comment: Y || null,
522
+ instanceId: x.id
523
+ }), Qe(""), N(!1), await un();
524
+ } catch (e) {
525
+ D(P(e));
526
+ } finally {
527
+ j(!1);
528
+ }
529
+ }
530
+ }
531
+ async function En() {
532
+ if (!(!d || !x || !qt)) {
533
+ j(!0), D(null);
534
+ try {
535
+ await he({
536
+ formData: jt,
537
+ initiatorMemberId: d,
538
+ instanceId: x.id,
539
+ title: x.title
540
+ }), await un();
541
+ } catch (e) {
542
+ D(P(e));
543
+ } finally {
544
+ j(!1);
545
+ }
546
+ }
547
+ }
548
+ return /* @__PURE__ */ b(n, {
549
+ activeHref: s.inbox(),
550
+ children: [
551
+ /* @__PURE__ */ y(ee, { children: /* @__PURE__ */ b(ke, {
552
+ description: x ? `${At(x.state)} · ${t(x.startedAt)}` : "載入案件內容。",
553
+ title: x?.title ?? "簽核案件",
554
+ children: [
555
+ x ? /* @__PURE__ */ y(m, {
556
+ "aria-label": "查看流程圖",
557
+ icon: Te,
558
+ iconType: "icon-only",
559
+ onClick: () => Xe(!0),
560
+ title: "查看流程圖",
561
+ variant: "base-secondary",
562
+ children: "流程圖"
563
+ }) : null,
564
+ Gt ? /* @__PURE__ */ y(m, {
565
+ disabled: A,
566
+ icon: xe,
567
+ iconType: "leading",
568
+ onClick: () => N(!0),
569
+ variant: "destructive-secondary",
570
+ children: "取消案件"
571
+ }) : null,
572
+ X ? /* @__PURE__ */ b(oe, { children: [
573
+ Ut ? /* @__PURE__ */ y(m, {
574
+ disabled: A,
575
+ icon: we,
576
+ iconType: "leading",
577
+ onClick: _n,
578
+ variant: "base-secondary",
579
+ children: "退回"
580
+ }) : null,
581
+ /* @__PURE__ */ y(m, {
582
+ disabled: A,
583
+ icon: Ee,
584
+ iconType: "leading",
585
+ onClick: yn,
586
+ variant: "base-secondary",
587
+ children: "轉派"
588
+ }),
589
+ /* @__PURE__ */ y(m, {
590
+ disabled: A,
591
+ icon: xe,
592
+ iconType: "leading",
593
+ onClick: hn,
594
+ variant: "destructive-secondary",
595
+ children: "拒絕"
596
+ }),
597
+ /* @__PURE__ */ y(m, {
598
+ disabled: A,
599
+ icon: ve,
600
+ iconType: "leading",
601
+ onClick: () => void mn({
602
+ action: "APPROVED",
603
+ comment: null
604
+ }),
605
+ variant: "base-primary",
606
+ children: "同意"
607
+ })
608
+ ] }) : null
609
+ ]
610
+ }) }),
611
+ /* @__PURE__ */ b(te, { children: [
612
+ /* @__PURE__ */ y(g, { children: /* @__PURE__ */ b("div", {
613
+ style: k,
614
+ children: [
615
+ Ve ? /* @__PURE__ */ y(v, {
616
+ color: "text-error",
617
+ variant: "body",
618
+ children: Ve
619
+ }) : null,
620
+ He ? /* @__PURE__ */ y(v, {
621
+ color: "text-neutral",
622
+ variant: "body",
623
+ children: "載入中..."
624
+ }) : null,
625
+ x?.formDefinitionSnapshot.schema && x.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ b(oe, { children: [/* @__PURE__ */ y(a, {
626
+ errors: Tt,
627
+ onChange: (e) => {
628
+ Mt(e), G({});
629
+ },
630
+ onUploadAttachment: qt ? dn : void 0,
631
+ readonly: !qt,
632
+ schema: x.formDefinitionSnapshot.schema,
633
+ uiSchema: x.formDefinitionSnapshot.uiSchema,
634
+ value: qt ? jt : x.formData
635
+ }), qt ? /* @__PURE__ */ y("div", {
636
+ style: We,
637
+ children: /* @__PURE__ */ y(m, {
638
+ disabled: A,
639
+ icon: we,
640
+ iconType: "leading",
641
+ onClick: () => void En(),
642
+ variant: "base-primary",
643
+ children: "重新送出"
644
+ })
645
+ }) : null] }) : /* @__PURE__ */ y(v, {
646
+ color: "text-neutral",
647
+ variant: "body",
648
+ children: "此案件沒有可顯示的表單快照。"
649
+ })
650
+ ]
651
+ }) }),
652
+ /* @__PURE__ */ y(g, { children: /* @__PURE__ */ b("div", {
653
+ style: k,
654
+ children: [/* @__PURE__ */ y(v, {
655
+ component: "h2",
656
+ variant: "h3",
657
+ children: "附件"
658
+ }), an.length > 0 ? /* @__PURE__ */ y(ie, {
659
+ actions: sn,
660
+ columns: on,
661
+ dataSource: an,
662
+ fullWidth: !0
663
+ }) : /* @__PURE__ */ y(v, {
664
+ color: "text-neutral",
665
+ variant: "body",
666
+ children: "此案件沒有附件。"
667
+ })]
668
+ }) }),
669
+ /* @__PURE__ */ b(g, { children: [/* @__PURE__ */ y(v, {
670
+ component: "h2",
671
+ variant: "h3",
672
+ children: "任務"
673
+ }), /* @__PURE__ */ y(ie, {
674
+ columns: rn,
675
+ dataSource: Yt,
676
+ fullWidth: !0
677
+ })] }),
678
+ /* @__PURE__ */ y(g, { children: /* @__PURE__ */ b("div", {
679
+ style: k,
680
+ children: [
681
+ /* @__PURE__ */ y(v, {
682
+ component: "h2",
683
+ variant: "h3",
684
+ children: "簽章"
685
+ }),
686
+ /* @__PURE__ */ y(v, {
687
+ color: C?.valid ? "text-success" : "text-error",
688
+ variant: "body",
689
+ children: C ? C.valid ? `簽章鏈已驗證,共 ${C.checkedCount} 筆。` : `簽章鏈驗證失敗:${C.errors.join("、")}` : "尚無簽章紀錄。"
690
+ }),
691
+ cn.length > 0 ? /* @__PURE__ */ y(ie, {
692
+ columns: ln,
693
+ dataSource: cn,
694
+ fullWidth: !0
695
+ }) : null
696
+ ]
697
+ }) }),
698
+ /* @__PURE__ */ y(g, { children: /* @__PURE__ */ b("div", {
699
+ style: k,
700
+ children: [/* @__PURE__ */ y(v, {
701
+ component: "h2",
702
+ variant: "h3",
703
+ children: "歷程"
704
+ }), Qt.length > 0 ? /* @__PURE__ */ y(re, {
705
+ currentStep: $t,
706
+ orientation: "vertical",
707
+ type: "dot",
708
+ children: Qt.map((e) => /* @__PURE__ */ y(st, {
709
+ descriptionParts: e.descriptionParts,
710
+ error: e.error,
711
+ forcePending: e.forcePending,
712
+ title: e.title
713
+ }, e.id))
714
+ }) : /* @__PURE__ */ y(v, {
715
+ color: "text-neutral",
716
+ variant: "body",
717
+ children: "尚無歷程紀錄。"
718
+ })]
719
+ }) })
720
+ ] }),
721
+ x ? /* @__PURE__ */ y(h, {
722
+ modalType: "standard",
723
+ onClose: () => Xe(!1),
724
+ open: M,
725
+ showModalHeader: !0,
726
+ size: "wide",
727
+ supportingText: `${At(x.state)} · ${t(x.startedAt)}`,
728
+ title: "流程圖",
729
+ children: /* @__PURE__ */ b("div", {
730
+ style: Ge,
731
+ children: [/* @__PURE__ */ y("div", {
732
+ style: Ye,
733
+ children: /* @__PURE__ */ b(Fe, {
734
+ edges: tn,
735
+ fitView: !0,
736
+ fitViewOptions: { padding: .18 },
737
+ maxZoom: 1.2,
738
+ minZoom: .2,
739
+ nodes: en,
740
+ nodesDraggable: !1,
741
+ nodesFocusable: !1,
742
+ nodeTypes: rt,
743
+ panOnDrag: !0,
744
+ proOptions: { hideAttribution: !0 },
745
+ children: [/* @__PURE__ */ y(Me, {}), /* @__PURE__ */ y(Ne, { showInteractive: !1 })]
746
+ })
747
+ }), nn.length > 0 ? /* @__PURE__ */ y("div", {
748
+ style: $e,
749
+ children: nn.map((e) => /* @__PURE__ */ y("span", {
750
+ style: et,
751
+ children: e
752
+ }, e))
753
+ }) : null]
754
+ })
755
+ }) : null,
756
+ /* @__PURE__ */ y(h, {
757
+ modalType: "standard",
758
+ onClose: () => {
759
+ Nt(null), Lt(null);
760
+ },
761
+ open: !!(K && q),
762
+ showModalHeader: !0,
763
+ size: "wide",
764
+ supportingText: K?.filename ?? void 0,
765
+ title: "PDF 預覽",
766
+ children: q ? /* @__PURE__ */ y(Ue, {
767
+ filename: K?.filename ?? "PDF 預覽",
768
+ fileUrl: q,
769
+ onDownload: K ? () => void fn(K) : void 0
770
+ }) : null
771
+ }),
772
+ /* @__PURE__ */ y(h, {
773
+ cancelText: "保留案件",
774
+ confirmButtonProps: { variant: "destructive-primary" },
775
+ confirmText: "確認取消",
776
+ loading: A,
777
+ modalStatusType: "error",
778
+ modalType: "standard",
779
+ onCancel: () => N(!1),
780
+ onClose: () => N(!1),
781
+ onConfirm: () => void Tn(),
782
+ open: tt,
783
+ showModalFooter: !0,
784
+ showModalHeader: !0,
785
+ supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
786
+ title: "取消案件",
787
+ children: /* @__PURE__ */ b("div", {
788
+ style: k,
789
+ children: [/* @__PURE__ */ b(v, {
790
+ variant: "body",
791
+ children: [
792
+ "確定要取消「",
793
+ x?.title ?? "",
794
+ "」嗎?"
795
+ ]
796
+ }), /* @__PURE__ */ y(i, {
797
+ label: "取消原因",
798
+ name: "cancelComment",
799
+ children: /* @__PURE__ */ y(_, {
800
+ onChange: (e) => Qe(e.target.value),
801
+ placeholder: "可填寫取消原因",
802
+ resize: "vertical",
803
+ rows: 3,
804
+ value: Ze
805
+ })
806
+ })]
807
+ })
808
+ }),
809
+ /* @__PURE__ */ y(h, {
810
+ cancelText: "取消",
811
+ confirmButtonProps: {
812
+ disabled: !J,
813
+ variant: "destructive-primary"
814
+ },
815
+ confirmText: "送出拒絕",
816
+ loading: A,
817
+ modalStatusType: "error",
818
+ modalType: "standard",
819
+ onCancel: gn,
820
+ onClose: gn,
821
+ onConfirm: () => void Sn(),
822
+ open: pt,
823
+ showModalFooter: !0,
824
+ showModalHeader: !0,
825
+ size: "regular",
826
+ supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
827
+ title: "拒絕原因",
828
+ children: /* @__PURE__ */ b("div", {
829
+ style: Ke,
830
+ children: [/* @__PURE__ */ y(i, {
831
+ label: "拒絕原因",
832
+ name: "rejectReason",
833
+ required: !0,
834
+ children: /* @__PURE__ */ y(_, {
835
+ autoFocus: !0,
836
+ onChange: (e) => {
837
+ F(e.target.value), I(null);
838
+ },
839
+ placeholder: "請說明拒絕原因",
840
+ ref: nt,
841
+ resize: "vertical",
842
+ rows: 4,
843
+ style: qe,
844
+ type: ct ? "error" : "default",
845
+ value: it
846
+ })
847
+ }), ct ? /* @__PURE__ */ y(v, {
848
+ color: "text-error",
849
+ variant: "body",
850
+ children: ct
851
+ }) : null]
852
+ })
853
+ }),
854
+ /* @__PURE__ */ y(h, {
855
+ cancelText: "取消",
856
+ confirmButtonProps: { disabled: !H },
857
+ confirmText: "送出轉派",
858
+ loading: A,
859
+ modalType: "standard",
860
+ onCancel: bn,
861
+ onClose: bn,
862
+ onConfirm: () => void Cn(),
863
+ open: Ct,
864
+ showModalFooter: !0,
865
+ showModalHeader: !0,
866
+ size: "regular",
867
+ supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
868
+ title: "轉派簽核",
869
+ children: /* @__PURE__ */ b("div", {
870
+ style: Je,
871
+ children: [/* @__PURE__ */ y(i, {
872
+ label: "轉派對象",
873
+ name: "transferToMemberId",
874
+ required: !0,
875
+ children: /* @__PURE__ */ y(p, {
876
+ asyncData: !0,
877
+ disabledOptionsFilter: !0,
878
+ emptyText: "沒有符合的成員",
879
+ inputProps: {
880
+ autoCapitalize: "none",
881
+ autoCorrect: "off",
882
+ name: "transfer-member-search",
883
+ spellCheck: !1
884
+ },
885
+ loading: yt,
886
+ loadingText: "搜尋成員中...",
887
+ mode: "single",
888
+ onChange: (e) => U(Ft(e)),
889
+ onSearch: xn,
890
+ onSearchTextChange: (e) => U(It(e, xt)),
891
+ onVisibilityChange: (e) => {
892
+ e && xn("");
893
+ },
894
+ options: [...xt],
895
+ placeholder: "搜尋姓名或信箱",
896
+ searchDebounceTime: 300,
897
+ value: H
898
+ })
899
+ }), /* @__PURE__ */ y(i, {
900
+ label: "轉派說明",
901
+ name: "transferComment",
902
+ children: /* @__PURE__ */ y(_, {
903
+ onChange: (e) => V(e.target.value),
904
+ placeholder: "可補充轉派原因",
905
+ ref: nt,
906
+ resize: "vertical",
907
+ rows: 4,
908
+ style: qe,
909
+ value: vt
910
+ })
911
+ })]
912
+ })
913
+ }),
914
+ /* @__PURE__ */ y(h, {
915
+ cancelText: "取消",
916
+ confirmButtonProps: { disabled: !Wt },
917
+ confirmText: "送出退回",
918
+ loading: A,
919
+ modalType: "standard",
920
+ onCancel: vn,
921
+ onClose: vn,
922
+ onConfirm: () => void wn(),
923
+ open: ht,
924
+ showModalFooter: !0,
925
+ showModalHeader: !0,
926
+ size: "regular",
927
+ supportingText: "退回後,流程會回到指定節點並等待重新處理。",
928
+ title: "退回簽核",
929
+ children: /* @__PURE__ */ b("div", {
930
+ style: Je,
931
+ children: [/* @__PURE__ */ y(i, {
932
+ label: "退回節點",
933
+ name: "returnTargetNodeId",
934
+ required: !0,
935
+ children: /* @__PURE__ */ y(ne, {
936
+ clearable: !1,
937
+ fullWidth: !0,
938
+ onChange: (e) => B(e?.id ?? null),
939
+ options: [...Q],
940
+ placeholder: "選擇退回節點",
941
+ value: Wt
942
+ })
943
+ }), /* @__PURE__ */ y(i, {
944
+ label: "退回說明",
945
+ name: "returnComment",
946
+ children: /* @__PURE__ */ y(_, {
947
+ onChange: (e) => z(e.target.value),
948
+ placeholder: "可補充需要修改的內容",
949
+ ref: nt,
950
+ resize: "vertical",
951
+ rows: 4,
952
+ style: qe,
953
+ value: R
954
+ })
955
+ })]
956
+ })
957
+ })
958
+ ]
959
+ });
960
+ }
961
+ function P(e) {
962
+ return e instanceof Error ? e.message : "發生未知錯誤";
963
+ }
964
+ function at(e) {
965
+ return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
966
+ }
967
+ function ot(e) {
968
+ return e.length > 16 ? `${e.slice(0, 12)}...` : e;
969
+ }
970
+ function F(...e) {
971
+ return e.filter((e) => Y(e ?? null)).join(" ");
972
+ }
973
+ var st = s(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: a, status: s = "pending", title: c, type: l = "number", ...u }, d) {
974
+ let f = r ? "pending" : s;
975
+ return /* @__PURE__ */ b("div", {
976
+ ...u,
977
+ className: F(C.host, l === "dot" ? C.dot : null, n && f !== "processing" ? C.error : null, a === "horizontal" ? C.horizontal : null, l === "number" ? C.number : null, f === "pending" ? C.pending : null, f === "processing" ? C.processing : null, n && f === "processing" ? C.processingError : null, !n && f === "succeeded" ? C.succeeded : null, a === "vertical" ? C.vertical : null, e),
978
+ ref: d,
979
+ children: [l === "dot" ? /* @__PURE__ */ y("span", { className: F(C.statusIndicator, C.statusIndicatorDot) }) : /* @__PURE__ */ y("span", {
980
+ className: C.statusIndicator,
981
+ children: i + 1
982
+ }), /* @__PURE__ */ b("div", {
983
+ className: C.textContainer,
984
+ children: [/* @__PURE__ */ b(v, {
985
+ className: C.title,
986
+ variant: "label-primary-highlight",
987
+ children: [c, /* @__PURE__ */ y("span", { className: C.titleConnectLine })]
988
+ }), t.length > 0 ? /* @__PURE__ */ y(v, {
989
+ className: C.description,
990
+ variant: "caption",
991
+ children: t.map((e, t) => /* @__PURE__ */ b(o, { children: [t > 0 ? " · " : null, ct(e)] }, `${e.type}-${t}`))
992
+ }) : null]
993
+ })]
994
+ });
995
+ });
996
+ function ct(e) {
997
+ return e.type === "text" ? e.text : e.type === "dangerText" ? /* @__PURE__ */ y("span", {
998
+ style: N,
999
+ children: e.text
1000
+ }) : e.email ? /* @__PURE__ */ b(oe, { children: [
1001
+ e.prefix,
1002
+ ":",
1003
+ /* @__PURE__ */ y(ae, {
1004
+ title: e.email,
1005
+ children: ({ onMouseEnter: t, onMouseLeave: n, ref: r }) => /* @__PURE__ */ y("span", {
1006
+ "data-testid": e.memberId ? `member-tooltip-${e.memberId}` : void 0,
1007
+ onMouseEnter: t,
1008
+ onMouseLeave: n,
1009
+ ref: r,
1010
+ style: tt,
1011
+ children: e.label
1012
+ })
1013
+ })
1014
+ ] }) : `${e.prefix}:${e.label}`;
1015
+ }
1016
+ async function lt({ activityLogs: e, tasks: t }) {
1017
+ let n = [...new Set([
1018
+ ...e.map((e) => e.actorMemberId),
1019
+ ...t.map((e) => e.assigneeMemberId),
1020
+ ...t.map((e) => e.originalAssigneeMemberId),
1021
+ ...t.flatMap((e) => e.candidateMemberIds),
1022
+ ...t.flatMap((e) => q(e.delegationChainJson).flatMap((e) => [e.from, e.to]))
1023
+ ].filter(Y))];
1024
+ try {
1025
+ return await x(n);
1026
+ } catch {
1027
+ return [];
1028
+ }
1029
+ }
1030
+ async function ut(e) {
1031
+ return (await Promise.all(e.map((e) => ue(e.id)))).flat();
1032
+ }
1033
+ function dt(e) {
1034
+ return e.reduce((e, t) => {
1035
+ let n = e.get(t.taskId), r = !n || new Date(t.decidedAt).getTime() > new Date(n.decidedAt).getTime() ? t : n;
1036
+ return new Map(e).set(t.taskId, r);
1037
+ }, /* @__PURE__ */ new Map());
1038
+ }
1039
+ function ft(e, t, n, r, i, a, o, s, c) {
1040
+ let l = e.filter(ht).map((e) => {
1041
+ let t = bt(e), n = Tt(e.nodeId, r);
1042
+ return {
1043
+ descriptionParts: [
1044
+ I(n ? `節點:${n}` : "節點:全流程"),
1045
+ L("操作者", e.actorMemberId, a, "系統"),
1046
+ I(`時間:${Mt(e.createdAt)}`),
1047
+ ...wt(e, t, r, o, s, c, a)
1048
+ ].filter(z),
1049
+ error: jt(e, t),
1050
+ id: e.id,
1051
+ title: xt(e.eventType, t)
1052
+ };
1053
+ }), u = t.filter(zt).map((e) => ({
1054
+ descriptionParts: [
1055
+ I(`節點:${W(e.nodeId, r)}`),
1056
+ L("處理者", e.assigneeMemberId, a, "未指定"),
1057
+ I(`建立時間:${Mt(e.createdAt)}`)
1058
+ ].filter(z),
1059
+ error: !1,
1060
+ id: `pending-task-${e.id}`,
1061
+ title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
1062
+ })), d = new Set([...e.filter(ht).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(Y)), f = r ? _t(r, t, n, i, d).map((e) => ({
1063
+ descriptionParts: [I(`${Q(e.type)} · 尚未抵達`)].filter(z),
1064
+ error: !1,
1065
+ forcePending: !0,
1066
+ id: `future-node-${e.id}`,
1067
+ title: yt(e)
1068
+ })) : [];
1069
+ return [
1070
+ ...l,
1071
+ ...u,
1072
+ ...f
1073
+ ];
1074
+ }
1075
+ function I(e) {
1076
+ return Y(e) ? {
1077
+ text: e,
1078
+ type: "text"
1079
+ } : null;
1080
+ }
1081
+ function pt(e) {
1082
+ return Y(e) ? {
1083
+ text: e,
1084
+ type: "dangerText"
1085
+ } : null;
1086
+ }
1087
+ function L(e, t, n, r) {
1088
+ let i = t ? n.get(t) : null;
1089
+ return {
1090
+ email: i?.email ?? null,
1091
+ label: i?.name ?? r,
1092
+ memberId: t,
1093
+ prefix: e,
1094
+ type: "member"
1095
+ };
1096
+ }
1097
+ function R(e, t) {
1098
+ if (!e) return "-";
1099
+ let n = t.get(e);
1100
+ return n ? `${n.name}(${n.email})` : e;
1101
+ }
1102
+ function z(e) {
1103
+ return !!e;
1104
+ }
1105
+ function mt(e) {
1106
+ let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
1107
+ return t === -1 ? e.length : t;
1108
+ }
1109
+ function ht(e) {
1110
+ return e.eventType === "INSTANCE_STARTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED";
1111
+ }
1112
+ function gt(e, t, n, r, i) {
1113
+ if (e.type === "startEvent" || i.has(e.id)) return !1;
1114
+ if (r === "REJECTED") return !0;
1115
+ let a = Z(e, t, n, r);
1116
+ return a.tone === "neutral" || a.tone === "waiting";
1117
+ }
1118
+ function _t(e, t, n, r, i) {
1119
+ if (r !== "RUNNING" && r !== "REJECTED") return [];
1120
+ let a = e.nodes.filter((e) => gt(e, t, n, r, i)), o = B(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
1121
+ return a.filter((e) => o.has(e.id)).sort((e, t) => {
1122
+ let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
1123
+ 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;
1124
+ });
1125
+ }
1126
+ function B(e, t, n, r, i) {
1127
+ let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
1128
+ let n = [...e.get(t.source) ?? [], t.target];
1129
+ return new Map(e).set(t.source, n);
1130
+ }, /* @__PURE__ */ new Map());
1131
+ return vt(e, n, r, i).reduce((e, t) => U(e, V(t, o, a)), /* @__PURE__ */ new Map());
1132
+ }
1133
+ function vt(e, t, n, r) {
1134
+ let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(zt).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [...new Set([
1135
+ ...i,
1136
+ ...a,
1137
+ ...o
1138
+ ])], c = e.nodes.filter((e) => e.type === "startEvent").map((e) => e.id);
1139
+ return s.length > 0 ? s : c;
1140
+ }
1141
+ function V(e, t, n) {
1142
+ return H([{
1143
+ distance: 0,
1144
+ nodeId: e
1145
+ }], t, n);
1146
+ }
1147
+ function H(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
1148
+ let [a, ...o] = e;
1149
+ if (!a) return i;
1150
+ if (r.has(a.nodeId)) return H(o, t, n, r, i);
1151
+ 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;
1152
+ return H([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
1153
+ distance: a.distance + 1,
1154
+ nodeId: e
1155
+ }))], t, n, s, c);
1156
+ }
1157
+ function U(e, t) {
1158
+ return [...t.entries()].reduce((e, [t, n]) => new Map(e).set(t, Math.min(e.get(t) ?? n, n)), e);
1159
+ }
1160
+ function yt(e) {
1161
+ 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}`;
1162
+ }
1163
+ function bt(e) {
1164
+ try {
1165
+ let t = JSON.parse(e.payloadJson);
1166
+ return Rt(t) ? t : {};
1167
+ } catch {
1168
+ return {};
1169
+ }
1170
+ }
1171
+ function xt(e, t) {
1172
+ return e === "INSTANCE_STARTED" ? "案件已發起" : e === "TOKEN_CREATED" ? "流程路徑已建立" : e === "ENGINE_PROCESS_REQUESTED" ? "流程引擎已處理" : e === "TOKEN_ADVANCED" ? "流程已前進" : e === "TASK_CREATED" ? "待簽任務已建立" : e === "TASK_DECIDED" ? St(K(t, "action")) : e === "SLA_TRIGGERED" ? "時限提醒已觸發" : e;
1173
+ }
1174
+ function St(e) {
1175
+ return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
1176
+ }
1177
+ function Ct(e, t, n, r) {
1178
+ if (e.eventType === "TASK_CREATED") {
1179
+ let e = K(t, "assigneeMemberId"), n = K(t, "originalAssigneeMemberId");
1180
+ if (!e) {
1181
+ let e = Nt(t, "candidateMemberIds");
1182
+ return e.length ? `候選簽核人:${e.map((e) => R(e, r)).join("、")}` : null;
1183
+ }
1184
+ let i = R(e, r), a = R(n, r);
1185
+ return n && n !== e ? `待簽人:${i}(原簽核人:${a})` : `待簽人:${i}`;
1186
+ }
1187
+ if (e.eventType === "TASK_DECIDED") {
1188
+ let e = K(t, "action"), n = K(t, "comment"), i = e ? `決議:${G(e)}` : null, a = K(t, "transferToMemberId");
1189
+ return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(Y).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${R(a, r)}`].filter(Y).join(" · ") : i;
1190
+ }
1191
+ if (e.eventType === "TOKEN_ADVANCED") {
1192
+ let e = K(t, "action");
1193
+ if (e) return `流程結果:${G(e)}`;
1194
+ let r = J(t, "arrivedCount"), i = J(t, "requiredCount");
1195
+ if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
1196
+ let a = K(t, "fromNodeId"), o = K(t, "toNodeId");
1197
+ if (a && o) return `由 ${W(a, n)} 前進至 ${W(o, n)}`;
1198
+ }
1199
+ if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
1200
+ let e = K(t, "state");
1201
+ return e ? `案件狀態:${At(e)}` : null;
1202
+ }
1203
+ return null;
1204
+ }
1205
+ function wt(e, t, n, r, i, a, o) {
1206
+ if (e.eventType !== "TASK_DECIDED") return [I(Ct(e, t, n, o))].filter(z);
1207
+ let s = e.taskId ? r.get(e.taskId) : null, c = K(t, "action") ?? s?.action ?? null, l = K(t, "comment") ?? s?.comment ?? null, u = K(t, "transferToMemberId") ?? s?.transferToMemberId ?? null, d = K(t, "signatureId") ?? s?.signatureId ?? null, f = d ? i.get(d) : null;
1208
+ return [
1209
+ I(c ? `決議:${G(c)}` : null),
1210
+ c === "REJECTED" ? pt(`拒絕原因:${l ?? "-"}`) : null,
1211
+ c === "RETURNED" ? I(`退回說明:${l ?? "-"}`) : null,
1212
+ c === "TRANSFERRED" ? I(`轉派給:${R(u, o)}`) : null,
1213
+ c === "TRANSFERRED" ? I(`轉派說明:${l ?? "-"}`) : null,
1214
+ f ? I(a?.valid ? `簽章:已驗證(${ot(f.signedPayloadHash)})` : `簽章:待檢查(${ot(f.signedPayloadHash)})`) : null
1215
+ ].filter(z);
1216
+ }
1217
+ function Tt(e, t) {
1218
+ return e ? W(e, t) : null;
1219
+ }
1220
+ function W(e, t) {
1221
+ return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
1222
+ }
1223
+ function Et(e, t) {
1224
+ if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
1225
+ if (t.data.returnBehavior.allowedTargets === "ANY") return e.nodes.filter((e) => e.id !== t.id).map((e) => ({
1226
+ id: e.id,
1227
+ name: `${e.data.label}(${Q(e.type)})`
1228
+ }));
1229
+ 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);
1230
+ return r ? [{
1231
+ id: r.id,
1232
+ name: `${r.data.label}(${Q(r.type)})`
1233
+ }] : [];
1234
+ }
1235
+ function G(e) {
1236
+ return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
1237
+ }
1238
+ function Dt(e) {
1239
+ return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
1240
+ }
1241
+ function Ot(e, t = /* @__PURE__ */ new Map()) {
1242
+ let n = q(e.delegationChainJson);
1243
+ if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => R(e, t)).join("、")}` : "未指定";
1244
+ let r = R(e.assigneeMemberId, t), i = R(e.originalAssigneeMemberId, t);
1245
+ return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
1246
+ }
1247
+ function kt(e, t) {
1248
+ return t ? e.assigneeMemberId === t || e.candidateMemberIds.includes(t) : !1;
1249
+ }
1250
+ function At(e) {
1251
+ return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
1252
+ }
1253
+ function jt(e, t) {
1254
+ return e.eventType === "SLA_TRIGGERED" || K(t, "action") === "REJECTED" || K(t, "instanceState") === "REJECTED";
1255
+ }
1256
+ function Mt(e) {
1257
+ return t(e);
1258
+ }
1259
+ function K(e, t) {
1260
+ let n = e[t];
1261
+ return typeof n == "string" ? n : null;
1262
+ }
1263
+ function Nt(e, t) {
1264
+ let n = e[t];
1265
+ return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
1266
+ }
1267
+ function Pt(e) {
1268
+ return {
1269
+ email: e.email,
1270
+ id: e.memberId,
1271
+ name: `${e.name} · ${e.email}`
1272
+ };
1273
+ }
1274
+ function Ft(e) {
1275
+ if (!Rt(e)) return null;
1276
+ let t = e.email, n = e.id, r = e.name;
1277
+ return typeof n == "string" && typeof r == "string" ? {
1278
+ email: typeof t == "string" ? t : null,
1279
+ id: n,
1280
+ name: r
1281
+ } : null;
1282
+ }
1283
+ function It(e, t) {
1284
+ let n = e.trim().toLocaleLowerCase();
1285
+ if (!n) return null;
1286
+ let r = t.filter((e) => [
1287
+ e.id,
1288
+ e.name,
1289
+ e.email ?? ""
1290
+ ].some((e) => e.toLocaleLowerCase().includes(n)));
1291
+ return r.length === 1 ? r[0] ?? null : null;
1292
+ }
1293
+ function q(e) {
1294
+ try {
1295
+ let t = JSON.parse(e);
1296
+ return Array.isArray(t) ? t.map((e) => Rt(e) ? Lt(e) : null).filter((e) => e !== null) : [];
1297
+ } catch {
1298
+ return [];
1299
+ }
1300
+ }
1301
+ function Lt(e) {
1302
+ let t = K(e, "from"), n = K(e, "to"), r = K(e, "reason");
1303
+ return !t || !n || !r ? null : {
1304
+ from: t,
1305
+ reason: r,
1306
+ ruleId: K(e, "ruleId"),
1307
+ to: n
1308
+ };
1309
+ }
1310
+ function J(e, t) {
1311
+ let n = e[t];
1312
+ return typeof n == "number" ? n : null;
1313
+ }
1314
+ function Y(e) {
1315
+ return typeof e == "string" && e.trim().length > 0;
1316
+ }
1317
+ function Rt(e) {
1318
+ return typeof e == "object" && !!e;
1319
+ }
1320
+ function zt(e) {
1321
+ return e.status === "PENDING" || e.status === "IN_PROGRESS";
1322
+ }
1323
+ function X({ data: e }) {
1324
+ return /* @__PURE__ */ b("div", {
1325
+ style: Ut(e.tone),
1326
+ children: [
1327
+ /* @__PURE__ */ y(Pe, {
1328
+ isConnectable: !1,
1329
+ position: S.Left,
1330
+ style: Qe,
1331
+ type: "target"
1332
+ }),
1333
+ /* @__PURE__ */ y(v, {
1334
+ component: "span",
1335
+ ellipsis: !0,
1336
+ title: e.label,
1337
+ variant: "label-primary",
1338
+ children: e.label
1339
+ }),
1340
+ /* @__PURE__ */ y("span", {
1341
+ style: Wt(e.tone),
1342
+ children: e.statusLabel
1343
+ }),
1344
+ /* @__PURE__ */ y("span", {
1345
+ title: e.secondaryLabel,
1346
+ style: Ze,
1347
+ children: e.secondaryLabel || e.kindLabel
1348
+ }),
1349
+ /* @__PURE__ */ y(Pe, {
1350
+ isConnectable: !1,
1351
+ position: S.Right,
1352
+ style: Qe,
1353
+ type: "source"
1354
+ })
1355
+ ]
1356
+ });
1357
+ }
1358
+ function Bt(e, t, n, r) {
1359
+ return e.nodes.map((e) => {
1360
+ let i = Z(e, t, n, r);
1361
+ return {
1362
+ data: {
1363
+ kindLabel: Q(e.type),
1364
+ label: e.data.label,
1365
+ secondaryLabel: i.secondaryLabel,
1366
+ statusLabel: i.statusLabel,
1367
+ tone: i.tone
1368
+ },
1369
+ id: e.id,
1370
+ position: e.position,
1371
+ sourcePosition: S.Right,
1372
+ targetPosition: S.Left,
1373
+ type: "workflowRuntime"
1374
+ };
1375
+ });
1376
+ }
1377
+ function Vt(e) {
1378
+ let t = new Ie.graphlib.Graph();
1379
+ return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
1380
+ nodesep: 56,
1381
+ rankdir: "LR",
1382
+ ranksep: 120
1383
+ }), e.nodes.forEach((e) => {
1384
+ t.setNode(e.id, {
1385
+ height: j,
1386
+ width: A
1387
+ });
1388
+ }), e.edges.forEach((e) => {
1389
+ t.setEdge(e.source, e.target);
1390
+ }), Ie.layout(t), {
1391
+ ...e,
1392
+ nodes: e.nodes.map((e) => {
1393
+ let n = t.node(e.id);
1394
+ return n ? {
1395
+ ...e,
1396
+ position: {
1397
+ x: n.x - A / 2,
1398
+ y: n.y - j / 2
1399
+ }
1400
+ } : e;
1401
+ })
1402
+ };
1403
+ }
1404
+ function Ht(e) {
1405
+ return e.edges.map((e) => {
1406
+ let t = Gt(e);
1407
+ return {
1408
+ animated: !1,
1409
+ id: e.id,
1410
+ label: t,
1411
+ labelBgBorderRadius: 6,
1412
+ labelBgPadding: [8, 4],
1413
+ labelBgStyle: {
1414
+ fill: e.data.isDefault ? "#f8fafc" : "#eff6ff",
1415
+ stroke: e.data.isDefault ? "#64748b" : "#2563eb",
1416
+ strokeWidth: 1
1417
+ },
1418
+ labelShowBg: !!t,
1419
+ labelStyle: {
1420
+ fill: e.data.isDefault ? "#475569" : "#2563eb",
1421
+ fontSize: 12,
1422
+ fontWeight: 600
1423
+ },
1424
+ source: e.source,
1425
+ style: {
1426
+ stroke: "#475569",
1427
+ strokeWidth: 1.5
1428
+ },
1429
+ target: e.target,
1430
+ type: e.type ?? "smoothstep"
1431
+ };
1432
+ });
1433
+ }
1434
+ function Z(e, t, n, r) {
1435
+ 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");
1436
+ return a ? {
1437
+ secondaryLabel: `處理者 ${Ot(a)}`,
1438
+ statusLabel: "待處理",
1439
+ tone: "current"
1440
+ } : o ? {
1441
+ secondaryLabel: `已取消 ${Ot(o)}`,
1442
+ statusLabel: "已取消",
1443
+ tone: "cancelled"
1444
+ } : s ? {
1445
+ secondaryLabel: `已完成 ${Ot(s)}`,
1446
+ statusLabel: "已完成",
1447
+ tone: "completed"
1448
+ } : l ? {
1449
+ secondaryLabel: `token ${l.id}`,
1450
+ statusLabel: "執行中",
1451
+ tone: "current"
1452
+ } : u ? {
1453
+ secondaryLabel: `token ${u.id}`,
1454
+ statusLabel: "等待前置",
1455
+ tone: "waiting"
1456
+ } : e.type === "startEvent" ? {
1457
+ secondaryLabel: "流程已發起",
1458
+ statusLabel: "已發起",
1459
+ tone: "completed"
1460
+ } : e.type === "endEvent" && r !== "RUNNING" ? {
1461
+ secondaryLabel: r,
1462
+ statusLabel: r === "REJECTED" ? "已拒絕" : "已完成",
1463
+ tone: r === "REJECTED" ? "cancelled" : "completed"
1464
+ } : {
1465
+ secondaryLabel: Q(e.type),
1466
+ statusLabel: "未抵達",
1467
+ tone: "neutral"
1468
+ };
1469
+ }
1470
+ function Q(e) {
1471
+ return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
1472
+ }
1473
+ function Ut(e) {
1474
+ return e === "current" ? {
1475
+ ...M,
1476
+ border: "1px solid var(--mzn-color-primary, #0057ff)",
1477
+ boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
1478
+ } : e === "completed" ? {
1479
+ ...M,
1480
+ border: "1px solid #16a34a"
1481
+ } : e === "cancelled" ? {
1482
+ ...M,
1483
+ border: "1px solid #dc2626",
1484
+ opacity: .72
1485
+ } : e === "waiting" ? {
1486
+ ...M,
1487
+ border: "1px dashed #64748b"
1488
+ } : M;
1489
+ }
1490
+ function Wt(e) {
1491
+ let t = Xe;
1492
+ return e === "current" ? {
1493
+ ...t,
1494
+ background: "#eff6ff",
1495
+ color: "#2563eb"
1496
+ } : e === "completed" ? {
1497
+ ...t,
1498
+ background: "#f0fdf4",
1499
+ color: "#15803d"
1500
+ } : e === "cancelled" ? {
1501
+ ...t,
1502
+ background: "#fef2f2",
1503
+ color: "#dc2626"
1504
+ } : e === "waiting" ? {
1505
+ ...t,
1506
+ background: "#f8fafc",
1507
+ color: "#475569"
1508
+ } : {
1509
+ ...t,
1510
+ background: "#f1f5f9",
1511
+ color: "#64748b"
1512
+ };
1513
+ }
1514
+ function Gt(e) {
1515
+ return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
1516
+ }
1517
+ function Kt(e) {
1518
+ return e.edges.map(Gt).filter((e) => e.trim().length > 0);
1519
+ }
1520
+ //#endregion
1521
+ export { it as t };
1522
+
1523
+ //# sourceMappingURL=detail-BcGAqJ_R.js.map