@rytass/bpm-core-react 0.7.7 → 0.9.0

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 (155) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/README.md +18 -2
  3. package/dist/chunks/FormBuilderView-BPLwAJGv.cjs +3 -0
  4. package/dist/chunks/FormBuilderView-BPLwAJGv.cjs.map +1 -0
  5. package/dist/chunks/FormBuilderView-Do9-MIAe.js +1477 -0
  6. package/dist/chunks/FormBuilderView-Do9-MIAe.js.map +1 -0
  7. package/dist/chunks/FormRendererView-C5POZbWz.js +492 -0
  8. package/dist/chunks/FormRendererView-C5POZbWz.js.map +1 -0
  9. package/dist/chunks/FormRendererView-DNtNodNl.cjs +2 -0
  10. package/dist/chunks/FormRendererView-DNtNodNl.cjs.map +1 -0
  11. package/dist/chunks/{approval-instance-list-page-YZcGGDD8.js → approval-instance-list-page-BjX2kaoF.js} +56 -54
  12. package/dist/chunks/approval-instance-list-page-BjX2kaoF.js.map +1 -0
  13. package/dist/chunks/approval-instance-list-page-C408vxE2.cjs +2 -0
  14. package/dist/chunks/approval-instance-list-page-C408vxE2.cjs.map +1 -0
  15. package/dist/chunks/{categories-DBPoSrsi.js → categories-DGlxuC6X.js} +5 -5
  16. package/dist/chunks/{categories-DBPoSrsi.js.map → categories-DGlxuC6X.js.map} +1 -1
  17. package/dist/chunks/{categories-B6QZKZRt.cjs → categories-DUfldZ_9.cjs} +2 -2
  18. package/dist/chunks/{categories-B6QZKZRt.cjs.map → categories-DUfldZ_9.cjs.map} +1 -1
  19. package/dist/chunks/compose-CULMDsLS.cjs +2 -0
  20. package/dist/chunks/compose-CULMDsLS.cjs.map +1 -0
  21. package/dist/chunks/{compose-B1quUa7y.js → compose-DJBlA5PD.js} +60 -58
  22. package/dist/chunks/compose-DJBlA5PD.js.map +1 -0
  23. package/dist/chunks/{delegations-DDEk-WI6.cjs → delegations-CGj-tZNO.cjs} +2 -2
  24. package/dist/chunks/{delegations-DDEk-WI6.cjs.map → delegations-CGj-tZNO.cjs.map} +1 -1
  25. package/dist/chunks/{delegations-iVnRi3QE.js → delegations-DLEEFBlH.js} +231 -231
  26. package/dist/chunks/{delegations-iVnRi3QE.js.map → delegations-DLEEFBlH.js.map} +1 -1
  27. package/dist/chunks/{delegations-ZNtodFaD.js → delegations-DqMpI_Nk.js} +168 -167
  28. package/dist/chunks/delegations-DqMpI_Nk.js.map +1 -0
  29. package/dist/chunks/delegations-kbMOSEif.cjs +2 -0
  30. package/dist/chunks/delegations-kbMOSEif.cjs.map +1 -0
  31. package/dist/chunks/designer-BszXJ5RO.js +3038 -0
  32. package/dist/chunks/designer-BszXJ5RO.js.map +1 -0
  33. package/dist/chunks/designer-CmqAU92b.cjs +65 -0
  34. package/dist/chunks/designer-CmqAU92b.cjs.map +1 -0
  35. package/dist/chunks/detail-CDexqBoU.cjs +2 -0
  36. package/dist/chunks/detail-CDexqBoU.cjs.map +1 -0
  37. package/dist/chunks/{detail-fg8MTwuH.js → detail-DAak2OXS.js} +737 -653
  38. package/dist/chunks/detail-DAak2OXS.js.map +1 -0
  39. package/dist/chunks/notifications--hwl-DR0.cjs +2 -0
  40. package/dist/chunks/{notifications-BKs4--96.cjs.map → notifications--hwl-DR0.cjs.map} +1 -1
  41. package/dist/chunks/{notifications-CSulztkU.js → notifications-DJ5wzCye.js} +7 -7
  42. package/dist/chunks/{notifications-CSulztkU.js.map → notifications-DJ5wzCye.js.map} +1 -1
  43. package/dist/chunks/{orgs-CrNxqlwp.js → orgs-DytLvZ_X.js} +243 -241
  44. package/dist/chunks/{orgs-CrNxqlwp.js.map → orgs-DytLvZ_X.js.map} +1 -1
  45. package/dist/chunks/orgs-Ni22buHs.cjs +2 -0
  46. package/dist/chunks/orgs-Ni22buHs.cjs.map +1 -0
  47. package/dist/chunks/providers-DEqcuXw9.js +506 -0
  48. package/dist/chunks/providers-DEqcuXw9.js.map +1 -0
  49. package/dist/chunks/providers-D_zTbkQH.cjs +2 -0
  50. package/dist/chunks/providers-D_zTbkQH.cjs.map +1 -0
  51. package/dist/chunks/{users-qghSMtLn.cjs → users-0HqlM_VQ.cjs} +2 -2
  52. package/dist/chunks/{users-qghSMtLn.cjs.map → users-0HqlM_VQ.cjs.map} +1 -1
  53. package/dist/chunks/{users-CUY139DF.js → users-FWrb3ehW.js} +5 -5
  54. package/dist/chunks/{users-CUY139DF.js.map → users-FWrb3ehW.js.map} +1 -1
  55. package/dist/components/notification-drawer.d.ts +4 -3
  56. package/dist/index.cjs +1 -1
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.js +21 -428
  59. package/dist/index.js.map +1 -1
  60. package/dist/next/index.cjs +1 -1
  61. package/dist/next/index.cjs.map +1 -1
  62. package/dist/next/index.js +16 -15
  63. package/dist/next/index.js.map +1 -1
  64. package/dist/pages/admin/delegations/index.cjs +1 -1
  65. package/dist/pages/admin/delegations/index.js +1 -1
  66. package/dist/pages/admin/orgs/index.cjs +1 -1
  67. package/dist/pages/admin/orgs/index.js +1 -1
  68. package/dist/pages/admin/users/index.cjs +1 -1
  69. package/dist/pages/admin/users/index.js +1 -1
  70. package/dist/pages/delegations/index.cjs +1 -1
  71. package/dist/pages/delegations/index.js +1 -1
  72. package/dist/pages/instances/detail/index.cjs +1 -1
  73. package/dist/pages/instances/detail/index.js +1 -1
  74. package/dist/pages/settings/notifications/index.cjs +1 -1
  75. package/dist/pages/settings/notifications/index.js +1 -1
  76. package/dist/pages/templates/categories/index.cjs +1 -1
  77. package/dist/pages/templates/categories/index.js +1 -1
  78. package/dist/pages/templates/compose/index.cjs +1 -1
  79. package/dist/pages/templates/compose/index.js +1 -1
  80. package/dist/pages/templates/designer/index.cjs +1 -1
  81. package/dist/pages/templates/designer/index.js +1 -1
  82. package/dist/views/admin/delegations/index.cjs +1 -1
  83. package/dist/views/admin/delegations/index.js +1 -1
  84. package/dist/views/admin/index.cjs +1 -1
  85. package/dist/views/admin/index.js +3 -3
  86. package/dist/views/admin/orgs/index.cjs +1 -1
  87. package/dist/views/admin/orgs/index.js +1 -1
  88. package/dist/views/admin/users/index.cjs +1 -1
  89. package/dist/views/admin/users/index.js +1 -1
  90. package/dist/views/cc/index.cjs +1 -1
  91. package/dist/views/cc/index.js +1 -1
  92. package/dist/views/delegations/index.cjs +1 -1
  93. package/dist/views/delegations/index.js +1 -1
  94. package/dist/views/forms/builder/index.cjs +1 -1
  95. package/dist/views/forms/builder/index.js +1 -1
  96. package/dist/views/forms/renderer/FormRendererView.d.ts +7 -2
  97. package/dist/views/forms/renderer/form-data-source-field.d.ts +34 -0
  98. package/dist/views/forms/renderer/index.cjs +1 -1
  99. package/dist/views/forms/renderer/index.d.ts +1 -0
  100. package/dist/views/forms/renderer/index.js +2 -2
  101. package/dist/views/instances/detail/index.cjs +1 -1
  102. package/dist/views/instances/detail/index.js +1 -1
  103. package/dist/views/instances/detail/sections/InstanceFormSection.d.ts +4 -1
  104. package/dist/views/instances/detail/sections/InstanceTasksSection.d.ts +5 -1
  105. package/dist/views/instances/new/index.cjs +1 -1
  106. package/dist/views/instances/new/index.cjs.map +1 -1
  107. package/dist/views/instances/new/index.js +105 -86
  108. package/dist/views/instances/new/index.js.map +1 -1
  109. package/dist/views/search/index.cjs +1 -1
  110. package/dist/views/search/index.js +1 -1
  111. package/dist/views/sent/index.cjs +1 -1
  112. package/dist/views/sent/index.js +1 -1
  113. package/dist/views/settings/index.cjs +1 -1
  114. package/dist/views/settings/index.js +1 -1
  115. package/dist/views/settings/notifications/index.cjs +1 -1
  116. package/dist/views/settings/notifications/index.js +1 -1
  117. package/dist/views/templates/categories/index.cjs +1 -1
  118. package/dist/views/templates/categories/index.js +1 -1
  119. package/dist/views/templates/compose/TemplateComposeWizardView.d.ts +3 -2
  120. package/dist/views/templates/compose/index.cjs +1 -1
  121. package/dist/views/templates/compose/index.js +1 -1
  122. package/dist/views/templates/designer/index.cjs +1 -1
  123. package/dist/views/templates/designer/index.js +1 -1
  124. package/dist/views/templates/index.cjs +1 -1
  125. package/dist/views/templates/index.cjs.map +1 -1
  126. package/dist/views/templates/index.js +153 -112
  127. package/dist/views/templates/index.js.map +1 -1
  128. package/package.json +41 -5
  129. package/dist/chunks/FormBuilderView-B_KGPjlp.cjs +0 -3
  130. package/dist/chunks/FormBuilderView-B_KGPjlp.cjs.map +0 -1
  131. package/dist/chunks/FormBuilderView-D8DrQOXD.js +0 -1090
  132. package/dist/chunks/FormBuilderView-D8DrQOXD.js.map +0 -1
  133. package/dist/chunks/FormRendererView-BwVsH2eX.cjs +0 -2
  134. package/dist/chunks/FormRendererView-BwVsH2eX.cjs.map +0 -1
  135. package/dist/chunks/FormRendererView-DrHsuSVo.js +0 -220
  136. package/dist/chunks/FormRendererView-DrHsuSVo.js.map +0 -1
  137. package/dist/chunks/approval-instance-list-page-BMUKxzcz.cjs +0 -2
  138. package/dist/chunks/approval-instance-list-page-BMUKxzcz.cjs.map +0 -1
  139. package/dist/chunks/approval-instance-list-page-YZcGGDD8.js.map +0 -1
  140. package/dist/chunks/compose-B1quUa7y.js.map +0 -1
  141. package/dist/chunks/compose-B6nevcwq.cjs +0 -2
  142. package/dist/chunks/compose-B6nevcwq.cjs.map +0 -1
  143. package/dist/chunks/delegations-C2wLWsDQ.cjs +0 -2
  144. package/dist/chunks/delegations-C2wLWsDQ.cjs.map +0 -1
  145. package/dist/chunks/delegations-ZNtodFaD.js.map +0 -1
  146. package/dist/chunks/designer-BLfz5Dk9.js +0 -2594
  147. package/dist/chunks/designer-BLfz5Dk9.js.map +0 -1
  148. package/dist/chunks/designer-DP002lt7.cjs +0 -65
  149. package/dist/chunks/designer-DP002lt7.cjs.map +0 -1
  150. package/dist/chunks/detail-KEmfpCtt.cjs +0 -2
  151. package/dist/chunks/detail-KEmfpCtt.cjs.map +0 -1
  152. package/dist/chunks/detail-fg8MTwuH.js.map +0 -1
  153. package/dist/chunks/notifications-BKs4--96.cjs +0 -2
  154. package/dist/chunks/orgs-iNJ0QEcK.cjs +0 -2
  155. package/dist/chunks/orgs-iNJ0QEcK.cjs.map +0 -1
@@ -2,20 +2,20 @@
2
2
  import { n as e } from "./auth-provider-B5oPmvk2.js";
3
3
  import { t } from "./format-date-time-CB-LxzqT.js";
4
4
  import { t as n } from "./bpm-form-field-Cao0rMol.js";
5
- import { t as r } from "./FormRendererView-DrHsuSVo.js";
5
+ import { n as r, t as i } from "./FormRendererView-C5POZbWz.js";
6
6
  import '../style.css';import '../detail.css';/* empty css */
7
- import { Fragment as i, forwardRef as a, useCallback as o, useEffect as s, useImperativeHandle as c, useMemo as l, useRef as u, useState as d } from "react";
8
- import { AutoComplete as f, Button as p, Input as m, Modal as h, PageHeader as g, Section as _, SectionGroup as ee, Select as v, Stepper as y, Table as te, Textarea as ne, Tooltip as b, Typography as x } from "@mezzanine-ui/react";
7
+ import { Fragment as a, forwardRef as o, useCallback as s, useEffect as c, useImperativeHandle as l, useMemo as u, useRef as d, useState as f } from "react";
8
+ import { AutoComplete as p, Button as m, Input as ee, Modal as h, PageHeader as te, Section as g, SectionGroup as _, Select as ne, Stepper as v, Table as re, Textarea as y, Tooltip as b, Typography as x } from "@mezzanine-ui/react";
9
9
  import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
10
- import { cancelAdhocDirective as re, cancelApprovalInstance as ie, configureAdhocCompletionNotification as ae, configureAdhocStageNotification as oe, decideTask as se, listAdhocDirectives as ce, listAttachments as le, listTaskDecisions as ue, readApprovalInstance as de, readAttachmentDownloadUrl as fe, readAttachmentPreviewUrl as pe, readInstanceSignatures as me, requestAdhocCountersign as he, requestAdhocPreApproval as ge, resolveMemberProfiles as _e, resubmitApprovalInstance as ve, searchMembers as ye, uploadAttachment as be } from "@rytass/bpm-core-client/workflow";
10
+ import { cancelAdhocDirective as T, cancelApprovalInstance as ie, configureAdhocCompletionNotification as ae, configureAdhocStageNotification as oe, decideTask as se, listAdhocDirectives as ce, listAttachments as le, listTaskDecisions as ue, readApprovalInstance as de, readAttachmentDownloadUrl as fe, readAttachmentPreviewUrl as pe, readInstanceSignatures as me, requestAdhocCountersign as he, requestAdhocPreApproval as ge, resolveMemberProfiles as _e, resubmitApprovalInstance as ve, searchMembers as ye, uploadAttachment as be } from "@rytass/bpm-core-client/workflow";
11
11
  import xe from "@mezzanine-ui/react/ContentHeader";
12
- import { CheckedIcon as Se, ChevronLeftIcon as T, ChevronRightIcon as E, DangerousOutlineIcon as Ce, DownloadIcon as D, FileSearchIcon as we, NotificationUnreadIcon as Te, PlusIcon as Ee, RefreshCcwIcon as De, ShareIcon as Oe, UserIcon as ke, ZoomInIcon as O, ZoomOutIcon as Ae } from "@mezzanine-ui/icons";
13
- import { focusFormRendererField as je, validateFormRendererValues as Me } from "@rytass/bpm-core-client/form";
14
- import { Background as Ne, Controls as Pe, Handle as Fe, Position as k, ReactFlow as A } from "@xyflow/react";
15
- import * as Ie from "dagre";
16
- import { Document as Le, Page as Re } from "react-pdf";
17
- import { stepClasses as j } from "@mezzanine-ui/core/stepper";
18
- var M = {
12
+ import { CheckedIcon as Se, ChevronLeftIcon as Ce, ChevronRightIcon as E, DangerousOutlineIcon as we, DownloadIcon as Te, FileSearchIcon as D, NotificationUnreadIcon as Ee, PlusIcon as De, RefreshCcwIcon as Oe, ShareIcon as ke, UserIcon as Ae, ZoomInIcon as je, ZoomOutIcon as Me } from "@mezzanine-ui/icons";
13
+ import { focusFormRendererField as Ne, readFormDataSourceErrorMessage as Pe, validateFormRendererValues as Fe } from "@rytass/bpm-core-client/form";
14
+ import { Background as Ie, Controls as Le, Handle as Re, Position as O, ReactFlow as ze } from "@xyflow/react";
15
+ import * as Be from "dagre";
16
+ import { Document as k, Page as Ve } from "react-pdf";
17
+ import { stepClasses as A } from "@mezzanine-ui/core/stepper";
18
+ var j = {
19
19
  root: "bpm_root_ehm7w",
20
20
  toolbar: "bpm_toolbar_R-tis",
21
21
  pageControls: "bpm_pageControls_jM-rC",
@@ -24,58 +24,58 @@ var M = {
24
24
  viewport: "bpm_viewport_DQXms",
25
25
  page: "bpm_page_Cv5Rg",
26
26
  state: "bpm_state_bpgp3"
27
- }, N = 760, ze = 920, Be = 320, Ve = 32, P = .75, He = 1.75, Ue = .25;
28
- function F({ filename: e, fileUrl: t, onDownload: n }) {
29
- let r = u(null), [i, a] = d(null), [c, f] = d(1), [m, h] = d(1), [g, _] = d(N);
30
- s(() => {
27
+ }, M = 760, N = 920, P = 320, He = 32, F = .75, Ue = 1.75, I = .25;
28
+ function We({ filename: e, fileUrl: t, onDownload: n }) {
29
+ let r = d(null), [i, a] = f(null), [o, l] = f(1), [p, ee] = f(1), [h, te] = f(M);
30
+ c(() => {
31
31
  let e = r.current;
32
32
  if (!e || typeof ResizeObserver > "u") return;
33
33
  let t = new ResizeObserver((e) => {
34
34
  let t = e[0]?.contentRect.width;
35
- t && _(t);
35
+ t && te(t);
36
36
  });
37
37
  return t.observe(e), () => t.disconnect();
38
- }, []), s(() => {
39
- a(null), f(1), h(1);
38
+ }, []), c(() => {
39
+ a(null), l(1), ee(1);
40
40
  }, [t]);
41
- let ee = l(() => {
42
- let e = Math.max(Be, g - Ve);
43
- return Math.round(Math.min(ze, e) * m);
44
- }, [m, g]), v = o((e) => {
45
- a(e.numPages), f(1);
46
- }, []), y = c > 1, te = i !== null && c < i, ne = m > P, b = m < He, S = i === null ? `第 ${c} 頁` : `第 ${c} / ${i} 頁`, re = `${Math.round(m * 100)}%`;
41
+ let g = u(() => {
42
+ let e = Math.max(P, h - He);
43
+ return Math.round(Math.min(N, e) * p);
44
+ }, [p, h]), _ = s((e) => {
45
+ a(e.numPages), l(1);
46
+ }, []), ne = o > 1, v = i !== null && o < i, re = p > F, y = p < Ue, b = i === null ? `第 ${o} 頁` : `第 ${o} / ${i} 頁`, S = `${Math.round(p * 100)}%`;
47
47
  return /* @__PURE__ */ w("section", {
48
48
  "aria-label": `${e} PDF 預覽`,
49
- className: M.root,
49
+ className: j.root,
50
50
  children: [/* @__PURE__ */ w("div", {
51
- className: M.toolbar,
51
+ className: j.toolbar,
52
52
  children: [
53
53
  /* @__PURE__ */ w("div", {
54
- className: M.pageControls,
54
+ className: j.pageControls,
55
55
  "aria-label": "頁面切換",
56
56
  children: [
57
- /* @__PURE__ */ C(p, {
57
+ /* @__PURE__ */ C(m, {
58
58
  "aria-label": "上一頁",
59
- disabled: !y,
60
- icon: T,
59
+ disabled: !ne,
60
+ icon: Ce,
61
61
  onClick: () => {
62
- f((e) => Math.max(1, e - 1));
62
+ l((e) => Math.max(1, e - 1));
63
63
  },
64
64
  size: "minor",
65
65
  variant: "base-secondary"
66
66
  }),
67
67
  /* @__PURE__ */ C(x, {
68
- className: M.counter,
68
+ className: j.counter,
69
69
  component: "span",
70
70
  variant: "body",
71
- children: S
71
+ children: b
72
72
  }),
73
- /* @__PURE__ */ C(p, {
73
+ /* @__PURE__ */ C(m, {
74
74
  "aria-label": "下一頁",
75
- disabled: !te,
75
+ disabled: !v,
76
76
  icon: E,
77
77
  onClick: () => {
78
- f((e) => i === null ? e : Math.min(i, e + 1));
78
+ l((e) => i === null ? e : Math.min(i, e + 1));
79
79
  },
80
80
  size: "minor",
81
81
  variant: "base-secondary"
@@ -83,39 +83,39 @@ function F({ filename: e, fileUrl: t, onDownload: n }) {
83
83
  ]
84
84
  }),
85
85
  /* @__PURE__ */ w("div", {
86
- className: M.zoomControls,
86
+ className: j.zoomControls,
87
87
  "aria-label": "縮放",
88
88
  children: [
89
- /* @__PURE__ */ C(p, {
89
+ /* @__PURE__ */ C(m, {
90
90
  "aria-label": "縮小",
91
- disabled: !ne,
92
- icon: Ae,
91
+ disabled: !re,
92
+ icon: Me,
93
93
  onClick: () => {
94
- h((e) => Math.max(P, e - Ue));
94
+ ee((e) => Math.max(F, e - I));
95
95
  },
96
96
  size: "minor",
97
97
  variant: "base-secondary"
98
98
  }),
99
99
  /* @__PURE__ */ C(x, {
100
- className: M.counter,
100
+ className: j.counter,
101
101
  component: "span",
102
102
  variant: "body",
103
- children: re
103
+ children: S
104
104
  }),
105
- /* @__PURE__ */ C(p, {
105
+ /* @__PURE__ */ C(m, {
106
106
  "aria-label": "放大",
107
- disabled: !b,
108
- icon: O,
107
+ disabled: !y,
108
+ icon: je,
109
109
  onClick: () => {
110
- h((e) => Math.min(He, e + Ue));
110
+ ee((e) => Math.min(Ue, e + I));
111
111
  },
112
112
  size: "minor",
113
113
  variant: "base-secondary"
114
114
  })
115
115
  ]
116
116
  }),
117
- n ? /* @__PURE__ */ C(p, {
118
- icon: D,
117
+ n ? /* @__PURE__ */ C(m, {
118
+ icon: Te,
119
119
  iconType: "leading",
120
120
  onClick: n,
121
121
  size: "minor",
@@ -124,29 +124,29 @@ function F({ filename: e, fileUrl: t, onDownload: n }) {
124
124
  }) : null
125
125
  ]
126
126
  }), /* @__PURE__ */ C("div", {
127
- className: M.viewport,
127
+ className: j.viewport,
128
128
  ref: r,
129
- children: /* @__PURE__ */ C(Le, {
130
- error: /* @__PURE__ */ C(I, { message: "PDF 無法載入。" }),
129
+ children: /* @__PURE__ */ C(k, {
130
+ error: /* @__PURE__ */ C(L, { message: "PDF 無法載入。" }),
131
131
  file: t,
132
- loading: /* @__PURE__ */ C(I, { message: "正在載入 PDF..." }),
133
- noData: /* @__PURE__ */ C(I, { message: "沒有可預覽的 PDF。" }),
134
- onLoadSuccess: v,
135
- children: /* @__PURE__ */ C(Re, {
136
- className: M.page,
137
- loading: /* @__PURE__ */ C(I, { message: "正在載入頁面..." }),
138
- pageNumber: c,
132
+ loading: /* @__PURE__ */ C(L, { message: "正在載入 PDF..." }),
133
+ noData: /* @__PURE__ */ C(L, { message: "沒有可預覽的 PDF。" }),
134
+ onLoadSuccess: _,
135
+ children: /* @__PURE__ */ C(Ve, {
136
+ className: j.page,
137
+ loading: /* @__PURE__ */ C(L, { message: "正在載入頁面..." }),
138
+ pageNumber: o,
139
139
  renderAnnotationLayer: !0,
140
140
  renderTextLayer: !0,
141
- width: ee
141
+ width: g
142
142
  })
143
143
  })
144
144
  })]
145
145
  });
146
146
  }
147
- function I({ message: e }) {
147
+ function L({ message: e }) {
148
148
  return /* @__PURE__ */ C("div", {
149
- className: M.state,
149
+ className: j.state,
150
150
  children: /* @__PURE__ */ C(x, {
151
151
  color: "text-neutral",
152
152
  variant: "body",
@@ -156,77 +156,77 @@ function I({ message: e }) {
156
156
  }
157
157
  //#endregion
158
158
  //#region src/views/instances/detail/sections/shared.ts
159
- function L(e) {
160
- let t = z(e, "from"), n = z(e, "to"), r = z(e, "reason");
159
+ function R(e) {
160
+ let t = B(e, "from"), n = B(e, "to"), r = B(e, "reason");
161
161
  return !t || !n || !r ? null : {
162
162
  from: t,
163
163
  reason: r,
164
- ruleId: z(e, "ruleId"),
164
+ ruleId: B(e, "ruleId"),
165
165
  to: n
166
166
  };
167
167
  }
168
- function R(e) {
168
+ function z(e) {
169
169
  try {
170
170
  let t = JSON.parse(e);
171
- return Array.isArray(t) ? t.map((e) => We(e) ? L(e) : null).filter((e) => e !== null) : [];
171
+ return Array.isArray(t) ? t.map((e) => W(e) ? R(e) : null).filter((e) => e !== null) : [];
172
172
  } catch {
173
173
  return [];
174
174
  }
175
175
  }
176
- function z(e, t) {
176
+ function B(e, t) {
177
177
  let n = e[t];
178
178
  return typeof n == "string" ? n : null;
179
179
  }
180
- function B(e, t) {
180
+ function V(e, t) {
181
181
  let n = e[t];
182
182
  return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
183
183
  }
184
- function V(e, t) {
184
+ function H(e, t) {
185
185
  let n = e[t];
186
186
  return typeof n == "number" ? n : null;
187
187
  }
188
- function H(e) {
188
+ function U(e) {
189
189
  return typeof e == "string" && e.trim().length > 0;
190
190
  }
191
- function We(e) {
191
+ function W(e) {
192
192
  return typeof e == "object" && !!e;
193
193
  }
194
194
  function Ge(e) {
195
195
  return e.status === "PENDING" || e.status === "IN_PROGRESS";
196
196
  }
197
- function U(e) {
198
- return e instanceof Error ? e.message : "發生未知錯誤";
197
+ function G(e) {
198
+ return Pe(e) || (e instanceof Error ? e.message : "發生未知錯誤");
199
199
  }
200
- function W(e) {
200
+ function Ke(e) {
201
201
  return !Number.isFinite(e) || e <= 0 ? "-" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
202
202
  }
203
- function G(e) {
203
+ function qe(e) {
204
204
  return e.length > 16 ? `${e.slice(0, 12)}...` : e;
205
205
  }
206
- function Ke(e) {
206
+ function Je(e) {
207
207
  return e === "APPROVED" ? "已同意" : e === "CANCELLED" ? "已取消" : e === "DRAFT" ? "草稿" : e === "EXPIRED" ? "已逾期" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "RUNNING" ? "進行中" : e;
208
208
  }
209
- function qe(e) {
209
+ function K(e) {
210
210
  return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
211
211
  }
212
- function Je(e) {
212
+ function Ye(e) {
213
213
  return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
214
214
  }
215
- function Ye(e) {
215
+ function q(e) {
216
216
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
217
217
  }
218
- function K(e, t) {
218
+ function J(e, t) {
219
219
  return t?.nodes.find((t) => t.id === e)?.data.label ?? e;
220
220
  }
221
- function q(e, t) {
221
+ function Y(e, t) {
222
222
  if (!e) return "-";
223
223
  let n = t.get(e);
224
224
  return n ? `${n.name}(${n.email})` : e;
225
225
  }
226
226
  function Xe(e, t = /* @__PURE__ */ new Map()) {
227
- let n = R(e.delegationChainJson);
228
- if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => q(e, t)).join("、")}` : "未指定";
229
- let r = q(e.assigneeMemberId, t), i = q(e.originalAssigneeMemberId, t);
227
+ let n = z(e.delegationChainJson);
228
+ if (!e.assigneeMemberId) return e.candidateMemberIds.length ? `候選 ${e.candidateMemberIds.map((e) => Y(e, t)).join("、")}` : "未指定";
229
+ let r = Y(e.assigneeMemberId, t), i = Y(e.originalAssigneeMemberId, t);
230
230
  return n.length === 0 || e.originalAssigneeMemberId === e.assigneeMemberId ? r : `${r}(原:${i})`;
231
231
  }
232
232
  function Ze(e, t) {
@@ -236,12 +236,12 @@ function Qe(e, t) {
236
236
  if (t.type !== "userTask" || !t.data.returnBehavior.allowReturn) return [];
237
237
  if (t.data.returnBehavior.allowedTargets === "ANY") return e.nodes.filter((e) => e.id !== t.id).map((e) => ({
238
238
  id: e.id,
239
- name: `${e.data.label}(${Ye(e.type)})`
239
+ name: `${e.data.label}(${q(e.type)})`
240
240
  }));
241
241
  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);
242
242
  return r ? [{
243
243
  id: r.id,
244
- name: `${r.data.label}(${Ye(r.type)})`
244
+ name: `${r.data.label}(${q(r.type)})`
245
245
  }] : [];
246
246
  }
247
247
  function $e(e) {
@@ -251,8 +251,8 @@ function $e(e) {
251
251
  name: `${e.name} · ${e.email}`
252
252
  };
253
253
  }
254
- function J(e) {
255
- if (!We(e)) return null;
254
+ function et(e) {
255
+ if (!W(e)) return null;
256
256
  let t = e.email, n = e.id, r = e.name;
257
257
  return typeof n == "string" && typeof r == "string" ? {
258
258
  email: typeof t == "string" ? t : null,
@@ -260,7 +260,7 @@ function J(e) {
260
260
  name: r
261
261
  } : null;
262
262
  }
263
- function et(e, t) {
263
+ function tt(e, t) {
264
264
  let n = e.trim().toLocaleLowerCase();
265
265
  if (!n) return null;
266
266
  let r = t.filter((e) => [
@@ -270,19 +270,19 @@ function et(e, t) {
270
270
  ].some((e) => e.toLocaleLowerCase().includes(n)));
271
271
  return r.length === 1 ? r[0] ?? null : null;
272
272
  }
273
- function Y(e) {
274
- return H(e) ? {
273
+ function X(e) {
274
+ return U(e) ? {
275
275
  text: e,
276
276
  type: "text"
277
277
  } : null;
278
278
  }
279
- function tt(e) {
280
- return H(e) ? {
279
+ function nt(e) {
280
+ return U(e) ? {
281
281
  text: e,
282
282
  type: "dangerText"
283
283
  } : null;
284
284
  }
285
- function X(e, t, n, r) {
285
+ function rt(e, t, n, r) {
286
286
  let i = t ? n.get(t) : null;
287
287
  return {
288
288
  email: i?.email ?? null,
@@ -295,95 +295,96 @@ function X(e, t, n, r) {
295
295
  function Z(e) {
296
296
  return !!e;
297
297
  }
298
- function nt(e) {
298
+ function it(e) {
299
299
  let t = e.findIndex((e) => e.id.startsWith("pending-task-") || e.id.startsWith("future-node-"));
300
300
  return t === -1 ? e.length : t;
301
301
  }
302
- function rt(e) {
302
+ function at(e) {
303
303
  return e.eventType === "INSTANCE_STARTED" || e.eventType === "TASK_DECIDED" || e.eventType === "SLA_TRIGGERED";
304
304
  }
305
- function it(e) {
305
+ function ot(e) {
306
306
  return e === "APPROVED" ? "已同意" : e === "REJECTED" ? "已拒絕" : e === "RETURNED" ? "已退回" : e === "TRANSFERRED" ? "已轉派" : "簽核已決議";
307
307
  }
308
- function at(e, t) {
309
- return e === "INSTANCE_STARTED" ? "案件已發起" : e === "TOKEN_CREATED" ? "流程路徑已建立" : e === "ENGINE_PROCESS_REQUESTED" ? "流程引擎已處理" : e === "TOKEN_ADVANCED" ? "流程已前進" : e === "TASK_CREATED" ? "待簽任務已建立" : e === "TASK_DECIDED" ? it(z(t, "action")) : e === "SLA_TRIGGERED" ? "時限提醒已觸發" : e;
308
+ function st(e, t) {
309
+ return e === "INSTANCE_STARTED" ? "案件已發起" : e === "TOKEN_CREATED" ? "流程路徑已建立" : e === "ENGINE_PROCESS_REQUESTED" ? "流程引擎已處理" : e === "TOKEN_ADVANCED" ? "流程已前進" : e === "TASK_CREATED" ? "待簽任務已建立" : e === "TASK_DECIDED" ? ot(B(t, "action")) : e === "SLA_TRIGGERED" ? "時限提醒已觸發" : e;
310
310
  }
311
- function ot(e) {
311
+ function ct(e) {
312
312
  try {
313
313
  let t = JSON.parse(e.payloadJson);
314
- return We(t) ? t : {};
314
+ return W(t) ? t : {};
315
315
  } catch {
316
316
  return {};
317
317
  }
318
318
  }
319
- function Q(e, t) {
320
- return e.eventType === "SLA_TRIGGERED" || z(t, "action") === "REJECTED" || z(t, "instanceState") === "REJECTED";
319
+ function lt(e, t) {
320
+ return e.eventType === "SLA_TRIGGERED" || B(t, "action") === "REJECTED" || B(t, "instanceState") === "REJECTED";
321
321
  }
322
- function st(e) {
322
+ function ut(e) {
323
323
  return t(e);
324
324
  }
325
- function ct(e, t, n, r) {
325
+ function dt(e, t, n, r) {
326
326
  if (e.eventType === "TASK_CREATED") {
327
- let e = z(t, "assigneeMemberId"), n = z(t, "originalAssigneeMemberId");
327
+ let e = B(t, "assigneeMemberId"), n = B(t, "originalAssigneeMemberId");
328
328
  if (!e) {
329
- let e = B(t, "candidateMemberIds");
330
- return e.length ? `候選簽核人:${e.map((e) => q(e, r)).join("、")}` : null;
329
+ let e = V(t, "candidateMemberIds");
330
+ return e.length ? `候選簽核人:${e.map((e) => Y(e, r)).join("、")}` : null;
331
331
  }
332
- let i = q(e, r), a = q(n, r);
332
+ let i = Y(e, r), a = Y(n, r);
333
333
  return n && n !== e ? `待簽人:${i}(原簽核人:${a})` : `待簽人:${i}`;
334
334
  }
335
335
  if (e.eventType === "TASK_DECIDED") {
336
- let e = z(t, "action"), n = z(t, "comment"), i = e ? `決議:${Je(e)}` : null, a = z(t, "transferToMemberId");
337
- return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(H).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${q(a, r)}`].filter(H).join(" · ") : i;
336
+ let e = B(t, "action"), n = B(t, "comment"), i = e ? `決議:${Ye(e)}` : null, a = B(t, "transferToMemberId");
337
+ return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(U).join(" · ") : e === "APPROVED" && n ? [i, `同意說明:${n}`].filter(U).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${Y(a, r)}`].filter(U).join(" · ") : i;
338
338
  }
339
339
  if (e.eventType === "TOKEN_ADVANCED") {
340
- let e = z(t, "action");
341
- if (e) return `流程結果:${Je(e)}`;
342
- let r = V(t, "arrivedCount"), i = V(t, "requiredCount");
340
+ let e = B(t, "action");
341
+ if (e) return `流程結果:${Ye(e)}`;
342
+ let r = H(t, "arrivedCount"), i = H(t, "requiredCount");
343
343
  if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
344
- let a = z(t, "fromNodeId"), o = z(t, "toNodeId");
345
- if (a && o) return `由 ${K(a, n)} 前進至 ${K(o, n)}`;
344
+ let a = B(t, "fromNodeId"), o = B(t, "toNodeId");
345
+ if (a && o) return `由 ${J(a, n)} 前進至 ${J(o, n)}`;
346
346
  }
347
347
  if (e.eventType === "ENGINE_PROCESS_REQUESTED") {
348
- let e = z(t, "state");
349
- return e ? `案件狀態:${Ke(e)}` : null;
348
+ let e = B(t, "state");
349
+ return e ? `案件狀態:${Je(e)}` : null;
350
350
  }
351
351
  return null;
352
352
  }
353
- function lt(e, t, n, r, i, a, o) {
354
- if (e.eventType !== "TASK_DECIDED") return [Y(ct(e, t, n, o))].filter(Z);
355
- let s = e.taskId ? r.get(e.taskId) : null, c = z(t, "action") ?? s?.action ?? null, l = z(t, "comment") ?? s?.comment ?? null, u = z(t, "transferToMemberId") ?? s?.transferToMemberId ?? null, d = z(t, "signatureId") ?? s?.signatureId ?? null, f = d ? i.get(d) : null;
353
+ function ft(e, t, n, r, i, a, o) {
354
+ if (e.eventType !== "TASK_DECIDED") return [X(dt(e, t, n, o))].filter(Z);
355
+ let s = e.taskId ? r.get(e.taskId) : null, c = B(t, "action") ?? s?.action ?? null, l = B(t, "comment") ?? s?.comment ?? null, u = B(t, "transferToMemberId") ?? s?.transferToMemberId ?? null, d = B(t, "signatureId") ?? s?.signatureId ?? null, f = d ? i.get(d) : null;
356
356
  return [
357
- Y(c ? `決議:${Je(c)}` : null),
358
- c === "REJECTED" ? tt(`拒絕原因:${l ?? "-"}`) : null,
359
- c === "RETURNED" ? Y(`退回說明:${l ?? "-"}`) : null,
360
- c === "TRANSFERRED" ? Y(`轉派給:${q(u, o)}`) : null,
361
- c === "TRANSFERRED" ? Y(`轉派說明:${l ?? "-"}`) : null,
362
- f ? Y(a?.valid ? `簽章:已驗證(${G(f.signedPayloadHash)})` : `簽章:待檢查(${G(f.signedPayloadHash)})`) : null
357
+ X(c ? `決議:${Ye(c)}` : null),
358
+ c === "REJECTED" ? nt(`拒絕原因:${l ?? "-"}`) : null,
359
+ c === "APPROVED" && l ? X(`同意說明:${l}`) : null,
360
+ c === "RETURNED" ? X(`退回說明:${l ?? "-"}`) : null,
361
+ c === "TRANSFERRED" ? X(`轉派給:${Y(u, o)}`) : null,
362
+ c === "TRANSFERRED" ? X(`轉派說明:${l ?? "-"}`) : null,
363
+ f ? X(a?.valid ? `簽章:已驗證(${qe(f.signedPayloadHash)})` : `簽章:待檢查(${qe(f.signedPayloadHash)})`) : null
363
364
  ].filter(Z);
364
365
  }
365
- function $(e, t, n, r, i) {
366
+ function pt(e, t, n, r, i) {
366
367
  if (e.type === "startEvent" || i.has(e.id)) return !1;
367
368
  if (r === "REJECTED") return !0;
368
- let a = vt(e, t, n, r);
369
+ let a = bt(e, t, n, r);
369
370
  return a.tone === "neutral" || a.tone === "waiting";
370
371
  }
371
- function ut(e, t, n, r, i) {
372
+ function Q(e, t, n, r, i) {
372
373
  if (r !== "RUNNING" && r !== "REJECTED") return [];
373
- let a = e.nodes.filter((e) => $(e, t, n, r, i)), o = dt(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
374
+ let a = e.nodes.filter((e) => pt(e, t, n, r, i)), o = mt(e, a, t, n, i), s = new Map(e.nodes.map((e, t) => [e.id, t]));
374
375
  return a.filter((e) => o.has(e.id)).sort((e, t) => {
375
376
  let n = o.get(e.id) ?? 0, r = o.get(t.id) ?? 0;
376
377
  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;
377
378
  });
378
379
  }
379
- function dt(e, t, n, r, i) {
380
+ function mt(e, t, n, r, i) {
380
381
  let a = new Set(t.map((e) => e.id)), o = e.edges.reduce((e, t) => {
381
382
  let n = [...e.get(t.source) ?? [], t.target];
382
383
  return new Map(e).set(t.source, n);
383
384
  }, /* @__PURE__ */ new Map());
384
- return ft(e, n, r, i).reduce((e, t) => ht(e, pt(t, o, a)), /* @__PURE__ */ new Map());
385
+ return ht(e, n, r, i).reduce((e, t) => vt(e, gt(t, o, a)), /* @__PURE__ */ new Map());
385
386
  }
386
- function ft(e, t, n, r) {
387
+ function ht(e, t, n, r) {
387
388
  let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(Ge).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [...new Set([
388
389
  ...i,
389
390
  ...a,
@@ -391,57 +392,57 @@ function ft(e, t, n, r) {
391
392
  ])], c = e.nodes.filter((e) => e.type === "startEvent").map((e) => e.id);
392
393
  return s.length > 0 ? s : c;
393
394
  }
394
- function pt(e, t, n) {
395
- return mt([{
395
+ function gt(e, t, n) {
396
+ return _t([{
396
397
  distance: 0,
397
398
  nodeId: e
398
399
  }], t, n);
399
400
  }
400
- function mt(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
401
+ function _t(e, t, n, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map()) {
401
402
  let [a, ...o] = e;
402
403
  if (!a) return i;
403
- if (r.has(a.nodeId)) return mt(o, t, n, r, i);
404
+ if (r.has(a.nodeId)) return _t(o, t, n, r, i);
404
405
  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;
405
- return mt([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
406
+ return _t([...o, ...(t.get(a.nodeId) ?? []).map((e) => ({
406
407
  distance: a.distance + 1,
407
408
  nodeId: e
408
409
  }))], t, n, s, c);
409
410
  }
410
- function ht(e, t) {
411
+ function vt(e, t) {
411
412
  return [...t.entries()].reduce((e, [t, n]) => new Map(e).set(t, Math.min(e.get(t) ?? n, n)), e);
412
413
  }
413
- function gt(e) {
414
+ function yt(e) {
414
415
  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}`;
415
416
  }
416
- function _t(e, t, n, r, i, a, o, s, c) {
417
- let l = e.filter(rt).map((e) => {
418
- let t = ot(e), n = e.nodeId ? K(e.nodeId, r) : null;
417
+ function $(e, t, n, r, i, a, o, s, c) {
418
+ let l = e.filter(at).map((e) => {
419
+ let t = ct(e), n = e.nodeId ? J(e.nodeId, r) : null;
419
420
  return {
420
421
  descriptionParts: [
421
- Y(n ? `節點:${n}` : "節點:全流程"),
422
- X("操作者", e.actorMemberId, a, "系統"),
423
- Y(`時間:${st(e.createdAt)}`),
424
- ...lt(e, t, r, o, s, c, a)
422
+ X(n ? `節點:${n}` : "節點:全流程"),
423
+ rt("操作者", e.actorMemberId, a, "系統"),
424
+ X(`時間:${ut(e.createdAt)}`),
425
+ ...ft(e, t, r, o, s, c, a)
425
426
  ].filter(Z),
426
- error: Q(e, t),
427
+ error: lt(e, t),
427
428
  id: e.id,
428
- title: at(e.eventType, t)
429
+ title: st(e.eventType, t)
429
430
  };
430
431
  }), u = t.filter(Ge).map((e) => ({
431
432
  descriptionParts: [
432
- Y(`節點:${K(e.nodeId, r)}`),
433
- X("處理者", e.assigneeMemberId, a, "未指定"),
434
- Y(`建立時間:${st(e.createdAt)}`)
433
+ X(`節點:${J(e.nodeId, r)}`),
434
+ rt("處理者", e.assigneeMemberId, a, "未指定"),
435
+ X(`建立時間:${ut(e.createdAt)}`)
435
436
  ].filter(Z),
436
437
  error: !1,
437
438
  id: `pending-task-${e.id}`,
438
439
  title: e.status === "IN_PROGRESS" ? "簽核處理中" : "等待簽核處理"
439
- })), d = new Set([...e.filter(rt).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(H)), f = r ? ut(r, t, n, i, d).map((e) => ({
440
- descriptionParts: [Y(`${Ye(e.type)} · 尚未抵達`)].filter(Z),
440
+ })), d = new Set([...e.filter(at).map((e) => e.nodeId), ...t.map((e) => e.nodeId)].filter(U)), f = r ? Q(r, t, n, i, d).map((e) => ({
441
+ descriptionParts: [X(`${q(e.type)} · 尚未抵達`)].filter(Z),
441
442
  error: !1,
442
443
  forcePending: !0,
443
444
  id: `future-node-${e.id}`,
444
- title: gt(e)
445
+ title: yt(e)
445
446
  })) : [];
446
447
  return [
447
448
  ...l,
@@ -449,7 +450,7 @@ function _t(e, t, n, r, i, a, o, s, c) {
449
450
  ...f
450
451
  ];
451
452
  }
452
- function vt(e, t, n, r) {
453
+ function bt(e, t, n, r) {
453
454
  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");
454
455
  return a ? {
455
456
  secondaryLabel: `處理者 ${Xe(a)}`,
@@ -480,39 +481,39 @@ function vt(e, t, n, r) {
480
481
  statusLabel: r === "REJECTED" ? "已拒絕" : "已完成",
481
482
  tone: r === "REJECTED" ? "cancelled" : "completed"
482
483
  } : {
483
- secondaryLabel: Ye(e.type),
484
+ secondaryLabel: q(e.type),
484
485
  statusLabel: "未抵達",
485
486
  tone: "neutral"
486
487
  };
487
488
  }
488
489
  //#endregion
489
490
  //#region src/views/instances/detail/sections/container-helpers.ts
490
- async function yt({ activityLogs: e, adhocDirectives: t = [], tasks: n }) {
491
+ async function xt({ activityLogs: e, adhocDirectives: t = [], tasks: n }) {
491
492
  let r = [...new Set([
492
493
  ...e.map((e) => e.actorMemberId),
493
494
  ...n.map((e) => e.assigneeMemberId),
494
495
  ...n.map((e) => e.originalAssigneeMemberId),
495
496
  ...n.flatMap((e) => e.candidateMemberIds),
496
- ...n.flatMap((e) => R(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
497
- ...t.flatMap((e) => [e.createdByMemberId, ...bt(e.targetValueJson)])
498
- ].filter(H))];
497
+ ...n.flatMap((e) => z(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
498
+ ...t.flatMap((e) => [e.createdByMemberId, ...St(e.targetValueJson)])
499
+ ].filter(U))];
499
500
  try {
500
501
  return await _e(r);
501
502
  } catch {
502
503
  return [];
503
504
  }
504
505
  }
505
- function bt(e) {
506
+ function St(e) {
506
507
  try {
507
508
  return (JSON.parse(e).memberIds ?? []).filter((e) => typeof e == "string");
508
509
  } catch {
509
510
  return [];
510
511
  }
511
512
  }
512
- async function xt(e) {
513
+ async function Ct(e) {
513
514
  return (await Promise.all(e.map((e) => ue(e.id)))).flat();
514
515
  }
515
- function St(e) {
516
+ function wt(e) {
516
517
  return e.reduce((e, t) => {
517
518
  let n = e.get(t.taskId), r = !n || new Date(t.decidedAt).getTime() > new Date(n.decidedAt).getTime() ? t : n;
518
519
  return new Map(e).set(t.taskId, r);
@@ -520,17 +521,17 @@ function St(e) {
520
521
  }
521
522
  //#endregion
522
523
  //#region src/views/instances/detail/sections/InstanceFormSection.tsx
523
- var Ct = {
524
+ var Tt = {
524
525
  display: "grid",
525
526
  gap: 16
526
- }, wt = {
527
+ }, Et = {
527
528
  display: "flex",
528
529
  flexWrap: "wrap",
529
530
  gap: 8
530
531
  };
531
- function Tt({ canResubmitInstance: e, deciding: t, error: n, instance: i, loading: a, onResubmitFormChange: o, onResubmitInstance: s, onUploadAttachment: c, resubmitFormData: l, resubmitFormErrors: u }) {
532
+ function Dt({ canResubmitInstance: e, deciding: t, error: n, instance: r, loading: a, onDataSourceStateChange: o, onResubmitFormChange: s, onResubmitInstance: c, onUploadAttachment: l, resubmitFormData: u, resubmitFormErrors: d }) {
532
533
  return /* @__PURE__ */ w("div", {
533
- style: Ct,
534
+ style: Tt,
534
535
  children: [
535
536
  n ? /* @__PURE__ */ C(x, {
536
537
  color: "text-error",
@@ -542,23 +543,31 @@ function Tt({ canResubmitInstance: e, deciding: t, error: n, instance: i, loadin
542
543
  variant: "body",
543
544
  children: "載入中..."
544
545
  }) : null,
545
- i?.formDefinitionSnapshot.schema && i.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(r, {
546
- errors: u,
546
+ r?.formDefinitionSnapshot.schema && r.formDefinitionSnapshot.uiSchema ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(i, {
547
+ dataSourceContext: e ? {
548
+ instanceId: r.id,
549
+ kind: "runtime",
550
+ templateId: r.templateId
551
+ } : void 0,
552
+ dataSourceInitialValues: r.formData,
553
+ errors: d,
547
554
  onChange: (e) => {
548
- o(e);
555
+ s(e);
549
556
  },
550
- onUploadAttachment: e ? c : void 0,
557
+ onDataSourceStateChange: o,
558
+ onUploadAttachment: e ? l : void 0,
559
+ optionSnapshots: r.formDataOptionSnapshot,
551
560
  readonly: !e,
552
- schema: i.formDefinitionSnapshot.schema,
553
- uiSchema: i.formDefinitionSnapshot.uiSchema,
554
- value: e ? l : i.formData
561
+ schema: r.formDefinitionSnapshot.schema,
562
+ uiSchema: r.formDefinitionSnapshot.uiSchema,
563
+ value: e ? u : r.formData
555
564
  }), e ? /* @__PURE__ */ C("div", {
556
- style: wt,
557
- children: /* @__PURE__ */ C(p, {
565
+ style: Et,
566
+ children: /* @__PURE__ */ C(m, {
558
567
  disabled: t,
559
- icon: De,
568
+ icon: Oe,
560
569
  iconType: "leading",
561
- onClick: s,
570
+ onClick: c,
562
571
  variant: "base-primary",
563
572
  children: "重新送出"
564
573
  })
@@ -572,20 +581,20 @@ function Tt({ canResubmitInstance: e, deciding: t, error: n, instance: i, loadin
572
581
  }
573
582
  //#endregion
574
583
  //#region src/views/instances/detail/sections/InstanceAttachmentsSection.tsx
575
- var Et = {
584
+ var Ot = {
576
585
  display: "grid",
577
586
  gap: 16
578
587
  };
579
- function Dt({ attachments: e, onDownload: n, onPreview: r }) {
580
- let i = l(() => e.map((e) => ({
588
+ function kt({ attachments: e, onDownload: n, onPreview: r }) {
589
+ let i = u(() => e.map((e) => ({
581
590
  attachment: e,
582
591
  createdAt: e.createdAt,
583
592
  filename: e.filename,
584
593
  id: e.id,
585
594
  key: e.id,
586
595
  mimeType: e.mimeType,
587
- sizeLabel: W(Number(e.sizeBytes))
588
- })), [e]), a = l(() => [
596
+ sizeLabel: Ke(Number(e.sizeBytes))
597
+ })), [e]), a = u(() => [
589
598
  {
590
599
  dataIndex: "filename",
591
600
  key: "filename",
@@ -614,16 +623,16 @@ function Dt({ attachments: e, onDownload: n, onPreview: r }) {
614
623
  title: "上傳時間",
615
624
  width: 220
616
625
  }
617
- ], []), o = l(() => ({
626
+ ], []), o = u(() => ({
618
627
  render: (e) => [...e.mimeType === "application/pdf" ? [{
619
- icon: we,
628
+ icon: D,
620
629
  iconType: "leading",
621
630
  name: "預覽",
622
631
  onClick: () => {
623
632
  r(e.attachment);
624
633
  }
625
634
  }] : [], {
626
- icon: D,
635
+ icon: Te,
627
636
  iconType: "leading",
628
637
  name: "下載",
629
638
  onClick: () => {
@@ -634,12 +643,12 @@ function Dt({ attachments: e, onDownload: n, onPreview: r }) {
634
643
  width: 160
635
644
  }), [n, r]);
636
645
  return /* @__PURE__ */ w("div", {
637
- style: Et,
646
+ style: Ot,
638
647
  children: [/* @__PURE__ */ C(x, {
639
648
  component: "h2",
640
649
  variant: "h3",
641
650
  children: "附件"
642
- }), i.length > 0 ? /* @__PURE__ */ C(te, {
651
+ }), i.length > 0 ? /* @__PURE__ */ C(re, {
643
652
  actions: o,
644
653
  columns: a,
645
654
  dataSource: i,
@@ -653,55 +662,55 @@ function Dt({ attachments: e, onDownload: n, onPreview: r }) {
653
662
  }
654
663
  //#endregion
655
664
  //#region src/views/instances/detail/sections/InstanceTasksSection.tsx
656
- var Ot = {
665
+ var At = {
657
666
  display: "grid",
658
667
  gap: 12,
659
668
  width: "100%"
660
- }, kt = {
669
+ }, jt = {
661
670
  minWidth: "100%",
662
671
  width: "100%"
663
- }, At = {
672
+ }, Mt = {
664
673
  display: "grid",
665
674
  gap: 12,
666
675
  width: "100%"
667
- }, jt = { marginTop: 12 }, Mt = { marginTop: 24 };
668
- function Nt(e) {
676
+ }, Nt = { marginTop: 12 }, Pt = { marginTop: 24 };
677
+ function Ft(e) {
669
678
  e && (e.style.width = "100%");
670
679
  }
671
- var Pt = {
680
+ var It = {
672
681
  COMPLETION_NOTIFY: "結案通知",
673
682
  COUNTERSIGN: "臨時會簽",
674
683
  PRE_APPROVAL: "臨時加簽",
675
684
  STAGE_NOTIFY: "階段完成通知"
676
- }, Ft = {
685
+ }, Lt = {
677
686
  COMPLETION_NOTIFY: "本張單到達結案狀態(核准 / 拒絕 / 取消)後,通知指定對象。",
678
687
  COUNTERSIGN: "指定對象會併入下一層簽核,下一層需所有人都完成才會繼續。",
679
688
  PRE_APPROVAL: "指定對象需先完成加簽,本階段才會往下一層繼續。",
680
689
  STAGE_NOTIFY: "本階段完成後(不論通過與否)通知指定對象。"
681
- }, It = [{
690
+ }, Rt = [{
682
691
  id: "REJECT_INSTANCE",
683
692
  name: "加簽拒絕時整單駁回"
684
693
  }, {
685
694
  id: "RETURN_TO_ORIGIN",
686
695
  name: "加簽拒絕時退回給我重新處理"
687
- }], Lt = [{
696
+ }], zt = [{
688
697
  id: "MEMBER",
689
698
  name: "指定成員"
690
699
  }, {
691
700
  id: "WEBHOOK",
692
701
  name: "Webhook"
693
- }], Rt = a(function({ adhocDirectives: e, currentMemberId: r, instance: i, memberProfilesById: a, onChanged: o, tasks: s }, u) {
694
- let [g, _] = d(!1), [ee, y] = d(null), [b, ie] = d(""), [ce, le] = d(null), [ue, de] = d(!1), [fe, pe] = d(""), [me, _e] = d(!1), [ve, be] = d(null), [xe, Se] = d(""), [T, E] = d(null), [Ce, D] = d(!1), [we, Te] = d([]), [Ee, De] = d(!1), [Oe, ke] = d(""), [O, Ae] = d(null), [je, Me] = d(!1), [Ne, Pe] = d([]), [Fe, k] = d(!1), [A, Ie] = d("COUNTERSIGN"), [Le, Re] = d("REJECT_INSTANCE"), [j, M] = d(!1), [N, ze] = d("MEMBER"), [Be, Ve] = d(""), P = b.trim(), He = fe.trim(), Ue = xe.trim(), F = l(() => s.find((e) => Ze(e, r) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [r, s]), I = l(() => F && i ? i.workflowSnapshot.nodes.find((e) => e.id === F.nodeId) ?? null : null, [F, i]), L = l(() => I && i ? Qe(i.workflowSnapshot, I) : [], [I, i]), R = I?.type === "userTask" && I.data.returnBehavior.allowReturn, z = I?.type === "userTask" && I.data.allowAddSigner, B = l(() => e.filter((e) => e.status === "PENDING"), [e]), V = L.find((e) => e.id === ve) ?? L[0] ?? null, H = l(() => s.map((e) => ({
702
+ }], Bt = o(function({ adhocDirectives: e, currentMemberId: r, instance: i, memberProfilesById: a, onChanged: o, tasks: s }, c) {
703
+ let [d, te] = f(!1), [g, _] = f(null), [v, b] = f(""), [ie, ce] = f(!1), [le, ue] = f(""), [de, fe] = f(null), [pe, me] = f(!1), [_e, ve] = f(""), [be, xe] = f(!1), [Se, Ce] = f(null), [E, we] = f(""), [Te, D] = f(null), [Ee, De] = f(!1), [Oe, ke] = f([]), [Ae, je] = f(!1), [Me, Ne] = f(""), [Pe, Fe] = f(null), [Ie, Le] = f(!1), [Re, O] = f([]), [ze, Be] = f(!1), [k, Ve] = f("COUNTERSIGN"), [A, j] = f("REJECT_INSTANCE"), [M, N] = f(!1), [P, He] = f("MEMBER"), [F, Ue] = f(""), I = le.trim(), We = _e.trim(), L = E.trim(), R = u(() => s.find((e) => Ze(e, r) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [r, s]), z = u(() => R && i ? i.workflowSnapshot.nodes.find((e) => e.id === R.nodeId) ?? null : null, [R, i]), B = u(() => z && i ? Qe(i.workflowSnapshot, z) : [], [z, i]), V = z?.type === "userTask" && z.data.returnBehavior.allowReturn, H = z?.type === "userTask" && z.data.allowReject !== !1, U = z?.type === "userTask" && z.data.allowTransfer !== !1, W = z?.type === "userTask" && z.data.returnBehavior.requireComment === !0, Ge = z?.type === "userTask" && z.data.allowAddSigner, Ke = u(() => e.filter((e) => e.status === "PENDING"), [e]), qe = B.find((e) => e.id === Se) ?? B[0] ?? null, Je = u(() => s.map((e) => ({
695
704
  ...e,
696
705
  assigneeLabel: Xe(e, a),
697
706
  key: e.id,
698
- nodeLabel: `${K(e.nodeId, i?.workflowSnapshot ?? null)}${e.isAdhoc ? e.adhocType === "COUNTERSIGN" ? "(臨時會簽)" : "(臨時加簽)" : ""}`,
699
- statusLabel: qe(e.status)
707
+ nodeLabel: `${J(e.nodeId, i?.workflowSnapshot ?? null)}${e.isAdhoc ? e.adhocType === "COUNTERSIGN" ? "(臨時會簽)" : "(臨時加簽)" : ""}`,
708
+ statusLabel: K(e.status)
700
709
  })), [
701
710
  i,
702
711
  a,
703
712
  s
704
- ]), We = l(() => [
713
+ ]), Ye = u(() => [
705
714
  {
706
715
  dataIndex: "nodeLabel",
707
716
  key: "nodeLabel",
@@ -734,13 +743,13 @@ var Pt = {
734
743
  title: "建立時間",
735
744
  width: 220
736
745
  }
737
- ], []), Ge = l(() => B.map((e) => ({
746
+ ], []), q = u(() => Ke.map((e) => ({
738
747
  ...e,
739
- createdByLabel: q(e.createdByMemberId, a),
748
+ createdByLabel: Y(e.createdByMemberId, a),
740
749
  key: e.id,
741
- targetLabel: zt(e, a),
742
- typeLabel: Pt[e.type]
743
- })), [a, B]), W = l(() => [
750
+ targetLabel: Vt(e, a),
751
+ typeLabel: It[e.type]
752
+ })), [a, Ke]), X = u(() => [
744
753
  {
745
754
  dataIndex: "typeLabel",
746
755
  key: "typeLabel",
@@ -779,9 +788,9 @@ var Pt = {
779
788
  },
780
789
  {
781
790
  key: "actions",
782
- render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ C(p, {
783
- disabled: j,
784
- onClick: () => void lt(e.id),
791
+ render: (e) => e.createdByMemberId === r ? /* @__PURE__ */ C(m, {
792
+ disabled: M,
793
+ onClick: () => void yt(e.id),
785
794
  size: "minor",
786
795
  variant: "destructive-secondary",
787
796
  children: "撤回"
@@ -789,110 +798,131 @@ var Pt = {
789
798
  title: "操作",
790
799
  width: 100
791
800
  }
792
- ], [j, r]);
793
- async function G({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: i = null }) {
794
- if (!(!r || !F)) {
795
- _(!0), y(null);
796
- try {
797
- await se({
798
- action: e,
799
- comment: t,
800
- decidedByMemberId: r,
801
- returnToNodeId: n,
802
- taskId: F.id,
803
- transferToMemberId: i
804
- }), de(!1), _e(!1), De(!1), ie(""), pe(""), Se(""), E(null), be(null), le(null), await o();
805
- } catch (e) {
806
- y(U(e));
807
- } finally {
808
- _(!1);
809
- }
801
+ ], [M, r]);
802
+ async function nt({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: i = null }) {
803
+ if (!r || !R || e === "REJECTED" && !H || e === "TRANSFERRED" && !U) return !1;
804
+ te(!0), _(null);
805
+ try {
806
+ await se({
807
+ action: e,
808
+ comment: t,
809
+ decidedByMemberId: r,
810
+ returnToNodeId: n,
811
+ taskId: R.id,
812
+ transferToMemberId: i
813
+ }), me(!1), xe(!1), je(!1), ue(""), ve(""), we(""), D(null), Ce(null), fe(null);
814
+ } catch (e) {
815
+ return _(G(e)), te(!1), !1;
816
+ }
817
+ try {
818
+ await o();
819
+ } catch (e) {
820
+ _(G(e));
821
+ } finally {
822
+ te(!1);
810
823
  }
824
+ return !0;
811
825
  }
812
- function Ke() {
813
- ie(""), le(null), de(!0);
826
+ function rt() {
827
+ !r || !R || (_(null), b(""), ce(!0));
814
828
  }
815
- function Je() {
816
- g || (de(!1), ie(""), le(null));
829
+ function Z() {
830
+ d || (ce(!1), b(""));
817
831
  }
818
- function Ye() {
819
- pe(""), be(L[0]?.id ?? null), _e(!0);
832
+ async function it() {
833
+ d || await nt({
834
+ action: "APPROVED",
835
+ comment: v.trim() || null
836
+ }) && (ce(!1), b(""));
837
+ }
838
+ function at() {
839
+ H && (ue(""), fe(null), me(!0));
840
+ }
841
+ function ot() {
842
+ d || (me(!1), ue(""), fe(null));
820
843
  }
821
- function Y() {
822
- g || (_e(!1), pe(""), be(null));
844
+ function st() {
845
+ ve(""), Ce(B[0]?.id ?? null), xe(!0);
823
846
  }
824
- function tt() {
825
- Se(""), E(null), De(!0), Z("");
847
+ function ct() {
848
+ d || (xe(!1), ve(""), Ce(null));
826
849
  }
827
- function X() {
828
- g || (De(!1), Se(""), E(null));
850
+ function lt() {
851
+ U && (we(""), D(null), je(!0), dt(""));
829
852
  }
830
- async function Z(e) {
831
- D(!0);
853
+ function ut() {
854
+ d || (je(!1), we(""), D(null));
855
+ }
856
+ async function dt(e) {
857
+ De(!0);
832
858
  try {
833
- Te((await ye(e)).filter((e) => e.memberId !== r).map($e));
859
+ ke((await ye(e)).filter((e) => e.memberId !== r).map($e));
834
860
  } catch (e) {
835
- y(U(e));
861
+ _(G(e));
836
862
  } finally {
837
- D(!1);
863
+ De(!1);
838
864
  }
839
865
  }
840
- async function nt() {
841
- if (!P) {
842
- le("請輸入拒絕原因");
843
- return;
866
+ async function ft() {
867
+ if (H) {
868
+ if (!I) {
869
+ fe("請輸入拒絕原因");
870
+ return;
871
+ }
872
+ await nt({
873
+ action: "REJECTED",
874
+ comment: I
875
+ });
844
876
  }
845
- await G({
846
- action: "REJECTED",
847
- comment: P
848
- });
849
877
  }
850
- async function rt() {
851
- if (!T) {
852
- y("請選擇轉派對象");
853
- return;
878
+ async function pt() {
879
+ if (U) {
880
+ if (!Te) {
881
+ _("請選擇轉派對象");
882
+ return;
883
+ }
884
+ await nt({
885
+ action: "TRANSFERRED",
886
+ comment: L || null,
887
+ transferToMemberId: Te.id
888
+ });
854
889
  }
855
- await G({
856
- action: "TRANSFERRED",
857
- comment: Ue || null,
858
- transferToMemberId: T.id
859
- });
860
890
  }
861
- async function it() {
862
- await G({
891
+ async function Q() {
892
+ await nt({
863
893
  action: "RETURNED",
864
- comment: He || null,
865
- returnToNodeId: V?.id ?? null
894
+ comment: We || null,
895
+ returnToNodeId: qe?.id ?? null
866
896
  });
867
897
  }
868
- function at() {
869
- ke(""), Ae(null), Re("REJECT_INSTANCE"), ze("MEMBER"), Ve("");
898
+ function mt() {
899
+ Ne(""), Fe(null), j("REJECT_INSTANCE"), He("MEMBER"), Ue("");
870
900
  }
871
- function ot(e) {
872
- Ie(e), at(), k(!0), st("");
901
+ function ht(e) {
902
+ Ve(e), mt(), Be(!0), _t("");
873
903
  }
874
- function Q() {
875
- j || (k(!1), at());
904
+ function gt() {
905
+ M || (Be(!1), mt());
876
906
  }
877
- async function st(e) {
878
- Me(!0);
907
+ async function _t(e) {
908
+ Le(!0);
879
909
  try {
880
- Pe((await ye(e)).map($e));
910
+ O((await ye(e)).map($e));
881
911
  } catch (e) {
882
- y(U(e));
912
+ _(G(e));
883
913
  } finally {
884
- Me(!1);
914
+ Le(!1);
885
915
  }
886
916
  }
887
- async function ct() {
888
- if (!F) return;
889
- let e = (A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY") && N === "WEBHOOK", t = Be.trim(), n = O;
917
+ async function vt() {
918
+ if (!R) return;
919
+ let e = (k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY") && P === "WEBHOOK", t = F.trim(), n = Pe;
890
920
  if (e && !t) {
891
- y("請輸入 Webhook URL");
921
+ _("請輸入 Webhook URL");
892
922
  return;
893
923
  }
894
924
  if (!e && !n) {
895
- y("請選擇對象成員");
925
+ _("請選擇對象成員");
896
926
  return;
897
927
  }
898
928
  let r = e || !n ? {
@@ -901,162 +931,199 @@ var Pt = {
901
931
  } : {
902
932
  kind: "MEMBER",
903
933
  memberIds: [n.id]
904
- }, i = Oe.trim() || null;
905
- M(!0), y(null);
934
+ }, i = Me.trim() || null;
935
+ N(!0), _(null);
906
936
  try {
907
- A === "COUNTERSIGN" ? await he({
937
+ k === "COUNTERSIGN" ? await he({
908
938
  comment: i,
909
939
  target: r,
910
- taskId: F.id
911
- }) : A === "PRE_APPROVAL" ? await ge({
940
+ taskId: R.id
941
+ }) : k === "PRE_APPROVAL" ? await ge({
912
942
  comment: i,
913
- onReject: Le,
943
+ onReject: A,
914
944
  target: r,
915
- taskId: F.id
916
- }) : A === "STAGE_NOTIFY" ? await oe({
945
+ taskId: R.id
946
+ }) : k === "STAGE_NOTIFY" ? await oe({
917
947
  target: r,
918
- taskId: F.id
948
+ taskId: R.id
919
949
  }) : await ae({
920
950
  target: r,
921
- taskId: F.id
922
- }), k(!1), at(), await o();
951
+ taskId: R.id
952
+ }), Be(!1), mt(), await o();
923
953
  } catch (e) {
924
- y(U(e));
954
+ _(G(e));
925
955
  } finally {
926
- M(!1);
956
+ N(!1);
927
957
  }
928
958
  }
929
- async function lt(e) {
930
- M(!0), y(null);
959
+ async function yt(e) {
960
+ N(!0), _(null);
931
961
  try {
932
- await re(e), await o();
962
+ await T(e), await o();
933
963
  } catch (e) {
934
- y(U(e));
964
+ _(G(e));
935
965
  } finally {
936
- M(!1);
966
+ N(!1);
937
967
  }
938
968
  }
939
- c(u, () => ({
940
- canAddSignerCurrentTask: z,
941
- canReturnCurrentTask: R,
942
- deciding: g,
943
- handleApprove: () => {
944
- G({
945
- action: "APPROVED",
946
- comment: null
947
- });
948
- },
949
- hasCurrentTask: F !== null,
950
- openAdhocModal: ot,
951
- openRejectModal: Ke,
952
- openReturnModal: Ye,
953
- openTransferModal: tt
969
+ l(c, () => ({
970
+ canAddSignerCurrentTask: Ge,
971
+ canRejectCurrentTask: H,
972
+ canReturnCurrentTask: V,
973
+ canTransferCurrentTask: U,
974
+ deciding: d,
975
+ handleApprove: rt,
976
+ hasCurrentTask: R !== null,
977
+ openAdhocModal: ht,
978
+ openRejectModal: at,
979
+ openReturnModal: st,
980
+ openTransferModal: lt
954
981
  }), [
955
- z,
982
+ Ge,
983
+ H,
984
+ V,
985
+ U,
986
+ r,
956
987
  R,
957
- F,
958
- g
988
+ d
959
989
  ]);
960
- let $ = A === "STAGE_NOTIFY" || A === "COMPLETION_NOTIFY", ut = $ && N === "WEBHOOK" ? !Be.trim() : !O, dt = It.find((e) => e.id === Le) ?? It[0], ft = Lt.find((e) => e.id === N) ?? Lt[0];
990
+ let $ = k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY", bt = $ && P === "WEBHOOK" ? !F.trim() : !Pe, xt = Rt.find((e) => e.id === A) ?? Rt[0], St = zt.find((e) => e.id === P) ?? zt[0];
961
991
  return /* @__PURE__ */ w(S, { children: [
962
992
  /* @__PURE__ */ C(x, {
963
993
  component: "h2",
964
994
  variant: "h3",
965
995
  children: "任務"
966
996
  }),
967
- ee ? /* @__PURE__ */ C(x, {
997
+ g ? /* @__PURE__ */ C(x, {
968
998
  color: "text-error",
969
999
  variant: "body",
970
- children: ee
1000
+ children: g
971
1001
  }) : null,
972
1002
  /* @__PURE__ */ C("div", {
973
- style: jt,
974
- children: /* @__PURE__ */ C(te, {
975
- columns: We,
976
- dataSource: H,
1003
+ style: Nt,
1004
+ children: /* @__PURE__ */ C(re, {
1005
+ columns: Ye,
1006
+ dataSource: Je,
977
1007
  fullWidth: !0
978
1008
  })
979
1009
  }),
980
- B.length > 0 ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(x, {
1010
+ Ke.length > 0 ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(x, {
981
1011
  component: "h3",
982
- style: Mt,
1012
+ style: Pt,
983
1013
  variant: "h3",
984
1014
  children: "待生效的臨時設定"
985
1015
  }), /* @__PURE__ */ C("div", {
986
- style: jt,
987
- children: /* @__PURE__ */ C(te, {
988
- columns: W,
989
- dataSource: Ge,
1016
+ style: Nt,
1017
+ children: /* @__PURE__ */ C(re, {
1018
+ columns: X,
1019
+ dataSource: q,
990
1020
  fullWidth: !0
991
1021
  })
992
1022
  })] }) : null,
1023
+ /* @__PURE__ */ w(h, {
1024
+ cancelText: "取消",
1025
+ confirmText: "送出同意",
1026
+ loading: d,
1027
+ modalType: "standard",
1028
+ onCancel: Z,
1029
+ onClose: Z,
1030
+ onConfirm: () => void it(),
1031
+ open: ie,
1032
+ showModalFooter: !0,
1033
+ showModalHeader: !0,
1034
+ size: "regular",
1035
+ supportingText: "可以留下同意的說明,內容會記錄在簽核歷程;不填也可以直接送出。",
1036
+ title: "簽核意見",
1037
+ children: [g ? /* @__PURE__ */ C(x, {
1038
+ color: "text-error",
1039
+ role: "alert",
1040
+ variant: "body",
1041
+ children: g
1042
+ }) : null, /* @__PURE__ */ C("div", {
1043
+ style: At,
1044
+ children: /* @__PURE__ */ C(n, {
1045
+ label: "簽核意見",
1046
+ name: "approveComment",
1047
+ children: /* @__PURE__ */ C(y, {
1048
+ autoFocus: !0,
1049
+ onChange: (e) => b(e.target.value),
1050
+ placeholder: "選填,例如補充核准的條件或提醒事項",
1051
+ ref: Ft,
1052
+ resize: "vertical",
1053
+ rows: 4,
1054
+ style: jt,
1055
+ value: v
1056
+ })
1057
+ })
1058
+ })]
1059
+ }),
993
1060
  /* @__PURE__ */ C(h, {
994
1061
  cancelText: "取消",
995
1062
  confirmButtonProps: {
996
- disabled: !P,
1063
+ disabled: !I,
997
1064
  variant: "destructive-primary"
998
1065
  },
999
1066
  confirmText: "送出拒絕",
1000
- loading: g,
1067
+ loading: d,
1001
1068
  modalStatusType: "error",
1002
1069
  modalType: "standard",
1003
- onCancel: Je,
1004
- onClose: Je,
1005
- onConfirm: () => void nt(),
1006
- open: ue,
1070
+ onCancel: ot,
1071
+ onClose: ot,
1072
+ onConfirm: () => void ft(),
1073
+ open: pe,
1007
1074
  showModalFooter: !0,
1008
1075
  showModalHeader: !0,
1009
1076
  size: "regular",
1010
1077
  supportingText: "拒絕案件時必須留下原因,供發起人與後續追蹤查看。",
1011
1078
  title: "拒絕原因",
1012
1079
  children: /* @__PURE__ */ w("div", {
1013
- style: Ot,
1080
+ style: At,
1014
1081
  children: [/* @__PURE__ */ C(n, {
1015
1082
  label: "拒絕原因",
1016
1083
  name: "rejectReason",
1017
1084
  required: !0,
1018
- children: /* @__PURE__ */ C(ne, {
1085
+ children: /* @__PURE__ */ C(y, {
1019
1086
  autoFocus: !0,
1020
1087
  onChange: (e) => {
1021
- ie(e.target.value), le(null);
1088
+ ue(e.target.value), fe(null);
1022
1089
  },
1023
1090
  placeholder: "請說明拒絕原因",
1024
- ref: Nt,
1091
+ ref: Ft,
1025
1092
  resize: "vertical",
1026
1093
  rows: 4,
1027
- style: kt,
1028
- type: ce ? "error" : "default",
1029
- value: b
1094
+ style: jt,
1095
+ type: de ? "error" : "default",
1096
+ value: le
1030
1097
  })
1031
- }), ce ? /* @__PURE__ */ C(x, {
1098
+ }), de ? /* @__PURE__ */ C(x, {
1032
1099
  color: "text-error",
1033
1100
  variant: "body",
1034
- children: ce
1101
+ children: de
1035
1102
  }) : null]
1036
1103
  })
1037
1104
  }),
1038
1105
  /* @__PURE__ */ C(h, {
1039
1106
  cancelText: "取消",
1040
- confirmButtonProps: { disabled: !T },
1107
+ confirmButtonProps: { disabled: !Te },
1041
1108
  confirmText: "送出轉派",
1042
- loading: g,
1109
+ loading: d,
1043
1110
  modalType: "standard",
1044
- onCancel: X,
1045
- onClose: X,
1046
- onConfirm: () => void rt(),
1047
- open: Ee,
1111
+ onCancel: ut,
1112
+ onClose: ut,
1113
+ onConfirm: () => void pt(),
1114
+ open: Ae,
1048
1115
  showModalFooter: !0,
1049
1116
  showModalHeader: !0,
1050
1117
  size: "regular",
1051
1118
  supportingText: "轉派後,原任務會保留轉派紀錄,新的待簽任務會指派給指定成員。",
1052
1119
  title: "轉派簽核",
1053
1120
  children: /* @__PURE__ */ w("div", {
1054
- style: At,
1121
+ style: Mt,
1055
1122
  children: [/* @__PURE__ */ C(n, {
1056
1123
  label: "轉派對象",
1057
1124
  name: "transferToMemberId",
1058
1125
  required: !0,
1059
- children: /* @__PURE__ */ C(f, {
1126
+ children: /* @__PURE__ */ C(p, {
1060
1127
  asyncData: !0,
1061
1128
  disabledOptionsFilter: !0,
1062
1129
  emptyText: "沒有符合的成員",
@@ -1066,115 +1133,117 @@ var Pt = {
1066
1133
  name: "transfer-member-search",
1067
1134
  spellCheck: !1
1068
1135
  },
1069
- loading: Ce,
1136
+ loading: Ee,
1070
1137
  loadingText: "搜尋成員中...",
1071
1138
  mode: "single",
1072
- onChange: (e) => E(J(e)),
1073
- onSearch: Z,
1074
- onSearchTextChange: (e) => E(et(e, we)),
1139
+ onChange: (e) => D(et(e)),
1140
+ onSearch: dt,
1141
+ onSearchTextChange: (e) => D(tt(e, Oe)),
1075
1142
  onVisibilityChange: (e) => {
1076
- e && Z("");
1143
+ e && dt("");
1077
1144
  },
1078
- options: [...we],
1145
+ options: [...Oe],
1079
1146
  placeholder: "搜尋姓名或信箱",
1080
1147
  searchDebounceTime: 300,
1081
- value: T
1148
+ value: Te
1082
1149
  })
1083
1150
  }), /* @__PURE__ */ C(n, {
1084
1151
  label: "轉派說明",
1085
1152
  name: "transferComment",
1086
- children: /* @__PURE__ */ C(ne, {
1087
- onChange: (e) => Se(e.target.value),
1153
+ children: /* @__PURE__ */ C(y, {
1154
+ onChange: (e) => we(e.target.value),
1088
1155
  placeholder: "可補充轉派原因",
1089
- ref: Nt,
1156
+ ref: Ft,
1090
1157
  resize: "vertical",
1091
1158
  rows: 4,
1092
- style: kt,
1093
- value: xe
1159
+ style: jt,
1160
+ value: E
1094
1161
  })
1095
1162
  })]
1096
1163
  })
1097
1164
  }),
1098
1165
  /* @__PURE__ */ C(h, {
1099
1166
  cancelText: "取消",
1100
- confirmButtonProps: { disabled: !V },
1167
+ confirmButtonProps: { disabled: !qe || W && !We },
1101
1168
  confirmText: "送出退回",
1102
- loading: g,
1169
+ loading: d,
1103
1170
  modalType: "standard",
1104
- onCancel: Y,
1105
- onClose: Y,
1106
- onConfirm: () => void it(),
1107
- open: me,
1171
+ onCancel: ct,
1172
+ onClose: ct,
1173
+ onConfirm: () => void Q(),
1174
+ open: be,
1108
1175
  showModalFooter: !0,
1109
1176
  showModalHeader: !0,
1110
1177
  size: "regular",
1111
1178
  supportingText: "退回後,流程會回到指定節點並等待重新處理。",
1112
1179
  title: "退回簽核",
1113
1180
  children: /* @__PURE__ */ w("div", {
1114
- style: At,
1181
+ style: Mt,
1115
1182
  children: [/* @__PURE__ */ C(n, {
1116
1183
  label: "退回節點",
1117
1184
  name: "returnTargetNodeId",
1118
1185
  required: !0,
1119
- children: /* @__PURE__ */ C(v, {
1186
+ children: /* @__PURE__ */ C(ne, {
1120
1187
  clearable: !1,
1121
1188
  fullWidth: !0,
1122
- onChange: (e) => be(e?.id ?? null),
1123
- options: [...L],
1189
+ onChange: (e) => Ce(e?.id ?? null),
1190
+ options: [...B],
1124
1191
  placeholder: "選擇退回節點",
1125
- value: V
1192
+ value: qe
1126
1193
  })
1127
1194
  }), /* @__PURE__ */ C(n, {
1195
+ hintText: W ? "此關卡設定退回時必須填寫意見。" : void 0,
1128
1196
  label: "退回說明",
1129
1197
  name: "returnComment",
1130
- children: /* @__PURE__ */ C(ne, {
1131
- onChange: (e) => pe(e.target.value),
1132
- placeholder: "可補充需要修改的內容",
1133
- ref: Nt,
1198
+ required: W,
1199
+ children: /* @__PURE__ */ C(y, {
1200
+ onChange: (e) => ve(e.target.value),
1201
+ placeholder: W ? "請說明退回原因" : "可補充需要修改的內容",
1202
+ ref: Ft,
1134
1203
  resize: "vertical",
1135
1204
  rows: 4,
1136
- style: kt,
1137
- value: fe
1205
+ style: jt,
1206
+ value: _e
1138
1207
  })
1139
1208
  })]
1140
1209
  })
1141
1210
  }),
1142
1211
  /* @__PURE__ */ C(h, {
1143
1212
  cancelText: "取消",
1144
- confirmButtonProps: { disabled: ut },
1213
+ confirmButtonProps: { disabled: bt },
1145
1214
  confirmText: "送出",
1146
- loading: j,
1215
+ loading: M,
1147
1216
  modalType: "standard",
1148
- onCancel: Q,
1149
- onClose: Q,
1150
- onConfirm: () => void ct(),
1151
- open: Fe,
1217
+ onCancel: gt,
1218
+ onClose: gt,
1219
+ onConfirm: () => void vt(),
1220
+ open: ze,
1152
1221
  showModalFooter: !0,
1153
1222
  showModalHeader: !0,
1154
1223
  size: "regular",
1155
- supportingText: Ft[A],
1156
- title: Pt[A],
1224
+ supportingText: Lt[k],
1225
+ title: It[k],
1157
1226
  children: /* @__PURE__ */ w("div", {
1158
- style: At,
1227
+ style: Mt,
1159
1228
  children: [
1160
1229
  $ ? /* @__PURE__ */ C(n, {
1161
1230
  label: "通知時機",
1162
1231
  name: "adhocNotifyMode",
1163
1232
  required: !0,
1164
- children: /* @__PURE__ */ C(v, {
1233
+ children: /* @__PURE__ */ C(ne, {
1165
1234
  clearable: !1,
1166
1235
  fullWidth: !0,
1167
- onChange: (e) => Ie(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1236
+ onChange: (e) => Ve(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1168
1237
  options: [{
1169
1238
  id: "STAGE_NOTIFY",
1170
- name: Pt.STAGE_NOTIFY
1239
+ name: It.STAGE_NOTIFY
1171
1240
  }, {
1172
1241
  id: "COMPLETION_NOTIFY",
1173
- name: Pt.COMPLETION_NOTIFY
1242
+ name: It.COMPLETION_NOTIFY
1174
1243
  }],
1175
1244
  value: {
1176
- id: A,
1177
- name: Pt[A]
1245
+ id: k,
1246
+ name: It[k]
1178
1247
  }
1179
1248
  })
1180
1249
  }) : null,
@@ -1182,29 +1251,29 @@ var Pt = {
1182
1251
  label: "通知對象類型",
1183
1252
  name: "adhocTargetKind",
1184
1253
  required: !0,
1185
- children: /* @__PURE__ */ C(v, {
1254
+ children: /* @__PURE__ */ C(ne, {
1186
1255
  clearable: !1,
1187
1256
  fullWidth: !0,
1188
- onChange: (e) => ze(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1189
- options: [...Lt],
1190
- value: ft
1257
+ onChange: (e) => He(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1258
+ options: [...zt],
1259
+ value: St
1191
1260
  })
1192
1261
  }) : null,
1193
- $ && N === "WEBHOOK" ? /* @__PURE__ */ C(n, {
1262
+ $ && P === "WEBHOOK" ? /* @__PURE__ */ C(n, {
1194
1263
  label: "Webhook URL",
1195
1264
  name: "adhocWebhookUrl",
1196
1265
  required: !0,
1197
- children: /* @__PURE__ */ C(m, {
1266
+ children: /* @__PURE__ */ C(ee, {
1198
1267
  fullWidth: !0,
1199
- onChange: (e) => Ve(e.target.value),
1268
+ onChange: (e) => Ue(e.target.value),
1200
1269
  placeholder: "https://example.com/webhook",
1201
- value: Be
1270
+ value: F
1202
1271
  })
1203
1272
  }) : /* @__PURE__ */ C(n, {
1204
1273
  label: $ ? "通知對象" : "簽核對象",
1205
1274
  name: "adhocMemberId",
1206
1275
  required: !0,
1207
- children: /* @__PURE__ */ C(f, {
1276
+ children: /* @__PURE__ */ C(p, {
1208
1277
  asyncData: !0,
1209
1278
  disabledOptionsFilter: !0,
1210
1279
  emptyText: "沒有符合的成員",
@@ -1214,44 +1283,44 @@ var Pt = {
1214
1283
  name: "adhoc-member-search",
1215
1284
  spellCheck: !1
1216
1285
  },
1217
- loading: je,
1286
+ loading: Ie,
1218
1287
  loadingText: "搜尋成員中...",
1219
1288
  mode: "single",
1220
- onChange: (e) => Ae(J(e)),
1221
- onSearch: st,
1222
- onSearchTextChange: (e) => Ae(et(e, Ne)),
1289
+ onChange: (e) => Fe(et(e)),
1290
+ onSearch: _t,
1291
+ onSearchTextChange: (e) => Fe(tt(e, Re)),
1223
1292
  onVisibilityChange: (e) => {
1224
- e && st("");
1293
+ e && _t("");
1225
1294
  },
1226
- options: [...Ne],
1295
+ options: [...Re],
1227
1296
  placeholder: "搜尋姓名或信箱",
1228
1297
  searchDebounceTime: 300,
1229
- value: O
1298
+ value: Pe
1230
1299
  })
1231
1300
  }),
1232
- A === "PRE_APPROVAL" ? /* @__PURE__ */ C(n, {
1301
+ k === "PRE_APPROVAL" ? /* @__PURE__ */ C(n, {
1233
1302
  label: "拒簽處理方式",
1234
1303
  name: "adhocOnReject",
1235
1304
  required: !0,
1236
- children: /* @__PURE__ */ C(v, {
1305
+ children: /* @__PURE__ */ C(ne, {
1237
1306
  clearable: !1,
1238
1307
  fullWidth: !0,
1239
- onChange: (e) => Re(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1240
- options: [...It],
1241
- value: dt
1308
+ onChange: (e) => j(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1309
+ options: [...Rt],
1310
+ value: xt
1242
1311
  })
1243
1312
  }) : null,
1244
1313
  $ ? null : /* @__PURE__ */ C(n, {
1245
1314
  label: "說明",
1246
1315
  name: "adhocComment",
1247
- children: /* @__PURE__ */ C(ne, {
1248
- onChange: (e) => ke(e.target.value),
1316
+ children: /* @__PURE__ */ C(y, {
1317
+ onChange: (e) => Ne(e.target.value),
1249
1318
  placeholder: "可補充原因",
1250
- ref: Nt,
1319
+ ref: Ft,
1251
1320
  resize: "vertical",
1252
1321
  rows: 3,
1253
- style: kt,
1254
- value: Oe
1322
+ style: jt,
1323
+ value: Me
1255
1324
  })
1256
1325
  })
1257
1326
  ]
@@ -1259,10 +1328,10 @@ var Pt = {
1259
1328
  })
1260
1329
  ] });
1261
1330
  });
1262
- function zt(e, t) {
1331
+ function Vt(e, t) {
1263
1332
  try {
1264
1333
  let n = JSON.parse(e.targetValueJson);
1265
- if (n.memberIds?.length) return n.memberIds.map((e) => q(e, t)).join("、");
1334
+ if (n.memberIds?.length) return n.memberIds.map((e) => Y(e, t)).join("、");
1266
1335
  if (n.webhookUrl) return n.webhookUrl;
1267
1336
  if (n.positionId) return `職位 ${n.positionId}`;
1268
1337
  if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
@@ -1271,19 +1340,19 @@ function zt(e, t) {
1271
1340
  }
1272
1341
  //#endregion
1273
1342
  //#region src/views/instances/detail/sections/InstanceSignaturesSection.tsx
1274
- var Bt = {
1343
+ var Ht = {
1275
1344
  display: "grid",
1276
1345
  gap: 16
1277
1346
  };
1278
- function Vt({ signatureVerification: e, signatures: n }) {
1279
- let r = l(() => n.map((e) => ({
1347
+ function Ut({ signatureVerification: e, signatures: n }) {
1348
+ let r = u(() => n.map((e) => ({
1280
1349
  algorithm: e.algorithm,
1281
- hashLabel: G(e.signedPayloadHash),
1350
+ hashLabel: qe(e.signedPayloadHash),
1282
1351
  key: e.id,
1283
1352
  keyVersion: e.keyVersion,
1284
1353
  signedAtLabel: t(e.signedAt),
1285
1354
  signerMemberId: e.signerMemberId
1286
- })), [n]), i = l(() => [
1355
+ })), [n]), i = u(() => [
1287
1356
  {
1288
1357
  dataIndex: "signerMemberId",
1289
1358
  key: "signerMemberId",
@@ -1316,7 +1385,7 @@ function Vt({ signatureVerification: e, signatures: n }) {
1316
1385
  }
1317
1386
  ], []);
1318
1387
  return /* @__PURE__ */ w("div", {
1319
- style: Bt,
1388
+ style: Ht,
1320
1389
  children: [
1321
1390
  /* @__PURE__ */ C(x, {
1322
1391
  component: "h2",
@@ -1328,7 +1397,7 @@ function Vt({ signatureVerification: e, signatures: n }) {
1328
1397
  variant: "body",
1329
1398
  children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
1330
1399
  }),
1331
- r.length > 0 ? /* @__PURE__ */ C(te, {
1400
+ r.length > 0 ? /* @__PURE__ */ C(re, {
1332
1401
  columns: i,
1333
1402
  dataSource: r,
1334
1403
  fullWidth: !0
@@ -1338,43 +1407,43 @@ function Vt({ signatureVerification: e, signatures: n }) {
1338
1407
  }
1339
1408
  //#endregion
1340
1409
  //#region src/views/instances/detail/sections/InstanceHistorySection.tsx
1341
- var Ht = {
1410
+ var Wt = {
1342
1411
  display: "grid",
1343
1412
  gap: 16
1344
- }, Ut = {
1413
+ }, Gt = {
1345
1414
  cursor: "help",
1346
1415
  textDecoration: "underline dotted",
1347
1416
  textUnderlineOffset: 3
1348
- }, Wt = { color: "var(--mzn-color-text-error)" };
1349
- function Gt(...e) {
1350
- return e.filter((e) => H(e ?? null)).join(" ");
1417
+ }, Kt = { color: "var(--mzn-color-text-error)" };
1418
+ function qt(...e) {
1419
+ return e.filter((e) => U(e ?? null)).join(" ");
1351
1420
  }
1352
- var Kt = a(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: a = 0, orientation: o, status: s = "pending", title: c, type: l = "number", ...u }, d) {
1421
+ var Jt = o(function({ className: e, descriptionParts: t, error: n, forcePending: r = !1, index: i = 0, orientation: o, status: s = "pending", title: c, type: l = "number", ...u }, d) {
1353
1422
  let f = r ? "pending" : s;
1354
1423
  return /* @__PURE__ */ w("div", {
1355
1424
  ...u,
1356
- className: Gt(j.host, l === "dot" ? j.dot : null, n && f !== "processing" ? j.error : null, o === "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, o === "vertical" ? j.vertical : null, e),
1425
+ className: qt(A.host, l === "dot" ? A.dot : null, n && f !== "processing" ? A.error : null, o === "horizontal" ? A.horizontal : null, l === "number" ? A.number : null, f === "pending" ? A.pending : null, f === "processing" ? A.processing : null, n && f === "processing" ? A.processingError : null, !n && f === "succeeded" ? A.succeeded : null, o === "vertical" ? A.vertical : null, e),
1357
1426
  ref: d,
1358
- children: [l === "dot" ? /* @__PURE__ */ C("span", { className: Gt(j.statusIndicator, j.statusIndicatorDot) }) : /* @__PURE__ */ C("span", {
1359
- className: j.statusIndicator,
1360
- children: a + 1
1427
+ children: [l === "dot" ? /* @__PURE__ */ C("span", { className: qt(A.statusIndicator, A.statusIndicatorDot) }) : /* @__PURE__ */ C("span", {
1428
+ className: A.statusIndicator,
1429
+ children: i + 1
1361
1430
  }), /* @__PURE__ */ w("div", {
1362
- className: j.textContainer,
1431
+ className: A.textContainer,
1363
1432
  children: [/* @__PURE__ */ w(x, {
1364
- className: j.title,
1433
+ className: A.title,
1365
1434
  variant: "label-primary-highlight",
1366
- children: [c, /* @__PURE__ */ C("span", { className: j.titleConnectLine })]
1435
+ children: [c, /* @__PURE__ */ C("span", { className: A.titleConnectLine })]
1367
1436
  }), t.length > 0 ? /* @__PURE__ */ C(x, {
1368
- className: j.description,
1437
+ className: A.description,
1369
1438
  variant: "caption",
1370
- children: t.map((e, t) => /* @__PURE__ */ w(i, { children: [t > 0 ? " · " : null, qt(e)] }, `${e.type}-${t}`))
1439
+ children: t.map((e, t) => /* @__PURE__ */ w(a, { children: [t > 0 ? " · " : null, Yt(e)] }, `${e.type}-${t}`))
1371
1440
  }) : null]
1372
1441
  })]
1373
1442
  });
1374
1443
  });
1375
- function qt(e) {
1444
+ function Yt(e) {
1376
1445
  return e.type === "text" ? e.text : e.type === "dangerText" ? /* @__PURE__ */ C("span", {
1377
- style: Wt,
1446
+ style: Kt,
1378
1447
  children: e.text
1379
1448
  }) : e.email ? /* @__PURE__ */ w(S, { children: [
1380
1449
  e.prefix,
@@ -1386,28 +1455,28 @@ function qt(e) {
1386
1455
  onMouseEnter: t,
1387
1456
  onMouseLeave: n,
1388
1457
  ref: r,
1389
- style: Ut,
1458
+ style: Gt,
1390
1459
  children: e.label
1391
1460
  })
1392
1461
  })
1393
1462
  ] }) : `${e.prefix}:${e.label}`;
1394
1463
  }
1395
- function Jt({ activityLogs: e, instanceState: t, memberProfilesById: n, signatureVerification: r, signaturesById: i, taskDecisionsByTaskId: a, tasks: o, workflowSnapshot: s, workflowTokens: c }) {
1396
- let l = _t(e, o, c, s, t, n, a, i, r), u = nt(l), d = l.map((e) => ({
1464
+ function Xt({ activityLogs: e, instanceState: t, memberProfilesById: n, signatureVerification: r, signaturesById: i, taskDecisionsByTaskId: a, tasks: o, workflowSnapshot: s, workflowTokens: c }) {
1465
+ let l = $(e, o, c, s, t, n, a, i, r), u = it(l), d = l.map((e) => ({
1397
1466
  ...e,
1398
1467
  descriptionParts: e.descriptionParts.filter(Z)
1399
1468
  }));
1400
1469
  return /* @__PURE__ */ w("div", {
1401
- style: Ht,
1470
+ style: Wt,
1402
1471
  children: [/* @__PURE__ */ C(x, {
1403
1472
  component: "h2",
1404
1473
  variant: "h3",
1405
1474
  children: "歷程"
1406
- }), d.length > 0 ? /* @__PURE__ */ C(y, {
1475
+ }), d.length > 0 ? /* @__PURE__ */ C(v, {
1407
1476
  currentStep: u,
1408
1477
  orientation: "vertical",
1409
1478
  type: "dot",
1410
- children: d.map((e) => /* @__PURE__ */ C(Kt, {
1479
+ children: d.map((e) => /* @__PURE__ */ C(Jt, {
1411
1480
  descriptionParts: e.descriptionParts,
1412
1481
  error: e.error,
1413
1482
  forcePending: e.forcePending,
@@ -1422,10 +1491,10 @@ function Jt({ activityLogs: e, instanceState: t, memberProfilesById: n, signatur
1422
1491
  }
1423
1492
  //#endregion
1424
1493
  //#region src/views/instances/detail/InstanceDetailView.tsx
1425
- var Yt = 184, Xt = 96, Zt = {
1494
+ var Zt = 184, Qt = 96, $t = {
1426
1495
  display: "grid",
1427
1496
  gap: 16
1428
- }, Qt = {
1497
+ }, en = {
1429
1498
  background: "#f8fafc",
1430
1499
  border: "1px solid #e2e8f0",
1431
1500
  borderRadius: 8,
@@ -1433,7 +1502,7 @@ var Yt = 184, Xt = 96, Zt = {
1433
1502
  minHeight: 440,
1434
1503
  overflow: "hidden",
1435
1504
  width: "min(80vw, 1040px)"
1436
- }, $t = {
1505
+ }, tn = {
1437
1506
  background: "#ffffff",
1438
1507
  border: "1px solid #cbd5e1",
1439
1508
  borderRadius: 8,
@@ -1443,24 +1512,24 @@ var Yt = 184, Xt = 96, Zt = {
1443
1512
  minHeight: 82,
1444
1513
  padding: 12,
1445
1514
  width: 184
1446
- }, en = {
1515
+ }, nn = {
1447
1516
  borderRadius: 999,
1448
1517
  fontSize: 12,
1449
1518
  fontWeight: 600,
1450
1519
  justifySelf: "start",
1451
1520
  lineHeight: "18px",
1452
1521
  padding: "0 8px"
1453
- }, tn = {
1522
+ }, rn = {
1454
1523
  color: "#64748b",
1455
1524
  fontSize: 12,
1456
1525
  overflow: "hidden",
1457
1526
  textOverflow: "ellipsis",
1458
1527
  whiteSpace: "nowrap"
1459
- }, nn = { opacity: 0 }, rn = {
1528
+ }, an = { opacity: 0 }, on = {
1460
1529
  display: "flex",
1461
1530
  flexWrap: "wrap",
1462
1531
  gap: 8
1463
- }, an = {
1532
+ }, sn = {
1464
1533
  alignItems: "center",
1465
1534
  background: "#ffffff",
1466
1535
  border: "1px solid #cbd5e1",
@@ -1472,265 +1541,280 @@ var Yt = 184, Xt = 96, Zt = {
1472
1541
  gap: 6,
1473
1542
  lineHeight: "20px",
1474
1543
  padding: "4px 8px"
1475
- }, on = {
1544
+ }, cn = {
1476
1545
  display: "grid",
1477
1546
  gap: 16
1478
- }, sn = { workflowRuntime: _n };
1479
- function cn({ instanceId: r, showAttachments: i = !0, showForm: a = !0, showHistory: o = !0, showSignatures: c = !0, showTasks: f = !0 }) {
1480
- let { member: m } = e(), v = m?.memberId ?? null, [y, te] = d([]), [b, re] = d(null), [ae, oe] = d([]), [se, ue] = d([]), [he, ge] = d([]), [_e, ye] = d(null), [T, E] = d([]), [D, we] = d([]), [O, Ae] = d([]), [Fe, k] = d(null), [Ie, Le] = d(!0), [Re, j] = d(!1), [M, N] = d(!1), [ze, Be] = d(""), [Ve, P] = d(!1), [He, Ue] = d({}), [I, L] = d({}), [R, z] = d(null), [B, V] = d(null), [H, We] = d([]), Ge = ze.trim(), W = u(null);
1481
- s(() => {
1482
- X();
1483
- }, [v, r]), s(() => {
1484
- L(b?.formData ?? {});
1485
- }, [b]);
1486
- let G = l(() => T.find((e) => Ze(e, v) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [v, T]), qe = l(() => G && b ? b.workflowSnapshot.nodes.find((e) => e.id === G.nodeId) ?? null : null, [G, b]), Je = qe?.type === "userTask" && qe.data.returnBehavior.allowReturn, Ye = qe?.type === "userTask" && qe.data.allowAddSigner, K = !!(b && b.initiatorMemberId === v && (b.state === "RUNNING" || b.state === "RETURNED")), q = !!(b && b.initiatorMemberId === v && b.state === "RETURNED"), Xe = l(() => new Map(O.map((e) => [e.memberId, e])), [O]), Qe = l(() => St(ae), [ae]), $e = l(() => new Map(he.map((e) => [e.id, e])), [he]), J = l(() => b ? pn(b.workflowSnapshot) : null, [b]), et = l(() => b && J ? fn(J, T, D, b.state) : [], [
1487
- b,
1488
- J,
1547
+ }, ln = { workflowRuntime: yn };
1548
+ function un({ instanceId: i, showAttachments: a = !0, showForm: o = !0, showHistory: l = !0, showSignatures: p = !0, showTasks: ee = !0 }) {
1549
+ let { member: ne } = e(), v = ne?.memberId ?? null, [re, b] = f([]), [T, ae] = f(null), [oe, se] = f([]), [ue, he] = f([]), [ge, _e] = f([]), [ye, Ce] = f(null), [E, Te] = f([]), [D, je] = f([]), [Me, Pe] = f([]), [Re, O] = f(null), [Be, k] = f(!0), [Ve, A] = f(!1), [j, M] = f(!1), [N, P] = f(""), [He, F] = f(!1), [Ue, I] = f({}), [L, R] = f({}), [z, B] = f({}), [V, H] = f(null), [U, W] = f(null), [Ge, Ke] = f([]), qe = N.trim(), K = d(null);
1550
+ c(() => {
1551
+ st();
1552
+ }, [v, i]), c(() => {
1553
+ R(T?.formData ?? {}), B({});
1554
+ }, [T]);
1555
+ let Ye = s((e, t) => {
1556
+ B((n) => {
1557
+ let r = n[e];
1558
+ return r?.hasValue === t.hasValue && r.status === t.status ? n : {
1559
+ ...n,
1560
+ [e]: {
1561
+ hasValue: t.hasValue,
1562
+ status: t.status
1563
+ }
1564
+ };
1565
+ });
1566
+ }, []), q = u(() => E.find((e) => Ze(e, v) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [v, E]), J = u(() => q && T ? T.workflowSnapshot.nodes.find((e) => e.id === q.nodeId) ?? null : null, [q, T]), Y = J?.type === "userTask" && J.data.returnBehavior.allowReturn, Xe = J?.type === "userTask" && J.data.allowReject !== !1, Qe = J?.type === "userTask" && J.data.allowTransfer !== !1, $e = J?.type === "userTask" && J.data.allowAddSigner, et = !!(T && T.initiatorMemberId === v && (T.state === "RUNNING" || T.state === "RETURNED")), tt = !!(T && T.initiatorMemberId === v && T.state === "RETURNED"), X = u(() => new Map(Me.map((e) => [e.memberId, e])), [Me]), nt = u(() => wt(oe), [oe]), rt = u(() => new Map(ge.map((e) => [e.id, e])), [ge]), Z = u(() => T ? hn(T.workflowSnapshot) : null, [T]), it = u(() => T && Z ? mn(Z, E, D, T.state) : [], [
1489
1567
  T,
1568
+ Z,
1569
+ E,
1490
1570
  D
1491
- ]), Y = l(() => J ? mn(J) : [], [J]), tt = l(() => b ? un(b.workflowSnapshot) : [], [b]);
1492
- async function X() {
1493
- Le(!0), k(null);
1571
+ ]), at = u(() => Z ? gn(Z) : [], [Z]), ot = u(() => T ? fn(T.workflowSnapshot) : [], [T]);
1572
+ async function st() {
1573
+ k(!0), O(null);
1494
1574
  try {
1495
- let e = await de(r);
1496
- te(e.activityLogs), re(e.instance), E(e.tasks), we(e.workflowTokens);
1497
- let t = await ce(e.instance.id), [n, i, a, o] = await Promise.all([
1498
- xt(e.tasks),
1499
- yt({
1575
+ let e = await de(i);
1576
+ b(e.activityLogs), ae(e.instance), Te(e.tasks), je(e.workflowTokens);
1577
+ let t = await ce(e.instance.id), [n, r, a, o] = await Promise.all([
1578
+ Ct(e.tasks),
1579
+ xt({
1500
1580
  ...e,
1501
1581
  adhocDirectives: t
1502
1582
  }),
1503
1583
  le(e.instance.id),
1504
1584
  me(e.instance.id)
1505
1585
  ]);
1506
- oe(n), Ae(i), ue(a), ge(o.signatures), ye(o.verification), We(t);
1586
+ se(n), Pe(r), he(a), _e(o.signatures), Ce(o.verification), Ke(t);
1507
1587
  } catch (e) {
1508
- k(U(e));
1588
+ O(G(e));
1509
1589
  } finally {
1510
- Le(!1);
1590
+ k(!1);
1511
1591
  }
1512
1592
  }
1513
- async function Z(e, t) {
1593
+ async function ct(e, t) {
1514
1594
  if (!v) throw Error("尚未登入,無法上傳附件");
1515
1595
  return { id: (await be({
1516
1596
  file: t,
1517
1597
  formFieldPath: `form.${e.fieldKey}`
1518
1598
  })).id };
1519
1599
  }
1520
- async function nt(e) {
1600
+ async function lt(e) {
1521
1601
  if (!v) return;
1522
1602
  let t = await fe({ id: e.id });
1523
1603
  window.open(t, "_blank", "noopener,noreferrer");
1524
1604
  }
1525
- async function rt(e) {
1605
+ async function ut(e) {
1526
1606
  if (!v) return;
1527
1607
  let t = await pe({ id: e.id });
1528
- z(e), V(t);
1608
+ H(e), W(t);
1529
1609
  }
1530
- async function it() {
1531
- if (!(!v || !b || !K)) {
1532
- if (j(!0), k(null), Ue({}), b.formDefinitionSnapshot.schema && b.formDefinitionSnapshot.uiSchema) {
1533
- let e = Me({
1534
- schema: b.formDefinitionSnapshot.schema,
1535
- uiSchema: b.formDefinitionSnapshot.uiSchema,
1536
- values: I
1610
+ async function dt() {
1611
+ if (!(!v || !T || !et)) {
1612
+ if (A(!0), O(null), I({}), T.formDefinitionSnapshot.schema && T.formDefinitionSnapshot.uiSchema) {
1613
+ let e = Fe({
1614
+ schema: T.formDefinitionSnapshot.schema,
1615
+ uiSchema: T.formDefinitionSnapshot.uiSchema,
1616
+ values: L
1537
1617
  });
1538
1618
  if (!e.valid) {
1539
- Ue(e.errors), k("請先補齊必填欄位。"), e.firstInvalidFieldKey && je(e.firstInvalidFieldKey), j(!1);
1619
+ I(e.errors), O("請先補齊必填欄位。"), e.firstInvalidFieldKey && Ne(e.firstInvalidFieldKey), A(!1);
1540
1620
  return;
1541
1621
  }
1542
1622
  }
1543
1623
  try {
1544
1624
  await ie({
1545
1625
  cancelledByMemberId: v,
1546
- comment: Ge || null,
1547
- instanceId: b.id
1548
- }), Be(""), P(!1), await X();
1626
+ comment: qe || null,
1627
+ instanceId: T.id
1628
+ }), P(""), F(!1), await st();
1549
1629
  } catch (e) {
1550
- k(U(e));
1630
+ O(G(e));
1551
1631
  } finally {
1552
- j(!1);
1632
+ A(!1);
1553
1633
  }
1554
1634
  }
1555
1635
  }
1556
- async function at() {
1557
- if (!(!v || !b || !q)) {
1558
- j(!0), k(null);
1636
+ async function ft() {
1637
+ if (!(!v || !T || !tt)) {
1638
+ if (A(!0), O(null), Object.values(z).some(r)) {
1639
+ O("請先完成動態選項驗證。"), A(!1);
1640
+ return;
1641
+ }
1559
1642
  try {
1560
1643
  await ve({
1561
- formData: I,
1644
+ formData: L,
1562
1645
  initiatorMemberId: v,
1563
- instanceId: b.id,
1564
- title: b.title
1565
- }), await X();
1646
+ instanceId: T.id,
1647
+ title: T.title
1648
+ }), await st();
1566
1649
  } catch (e) {
1567
- k(U(e));
1650
+ O(G(e));
1568
1651
  } finally {
1569
- j(!1);
1652
+ A(!1);
1570
1653
  }
1571
1654
  }
1572
1655
  }
1573
- let ot = W.current?.deciding ?? !1, Q = Re || ot;
1656
+ let pt = K.current?.deciding ?? !1, Q = Ve || pt;
1574
1657
  return /* @__PURE__ */ w(S, { children: [
1575
- /* @__PURE__ */ C(g, { children: /* @__PURE__ */ w(xe, {
1576
- description: b ? `${Ke(b.state)} · ${t(b.startedAt)}` : "載入案件內容。",
1577
- title: b?.title ?? "簽核案件",
1658
+ /* @__PURE__ */ C(te, { children: /* @__PURE__ */ w(xe, {
1659
+ description: T ? `${Je(T.state)} · ${t(T.startedAt)}` : "載入案件內容。",
1660
+ title: T?.title ?? "簽核案件",
1578
1661
  children: [
1579
- b ? /* @__PURE__ */ C(p, {
1662
+ T ? /* @__PURE__ */ C(m, {
1580
1663
  "aria-label": "查看流程圖",
1581
- icon: Oe,
1664
+ icon: ke,
1582
1665
  iconType: "icon-only",
1583
- onClick: () => N(!0),
1666
+ onClick: () => M(!0),
1584
1667
  title: "查看流程圖",
1585
1668
  variant: "base-secondary",
1586
1669
  children: "流程圖"
1587
1670
  }) : null,
1588
- K ? /* @__PURE__ */ C(p, {
1671
+ et ? /* @__PURE__ */ C(m, {
1589
1672
  disabled: Q,
1590
- icon: Ce,
1673
+ icon: we,
1591
1674
  iconType: "leading",
1592
- onClick: () => P(!0),
1675
+ onClick: () => F(!0),
1593
1676
  variant: "destructive-secondary",
1594
1677
  children: "取消案件"
1595
1678
  }) : null,
1596
- G ? /* @__PURE__ */ w(S, { children: [
1597
- Ye ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(p, {
1679
+ q ? /* @__PURE__ */ w(S, { children: [
1680
+ $e ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(m, {
1598
1681
  disabled: Q,
1599
- icon: Ee,
1682
+ icon: De,
1600
1683
  iconType: "leading",
1601
- onClick: () => W.current?.openAdhocModal("COUNTERSIGN"),
1684
+ onClick: () => K.current?.openAdhocModal("COUNTERSIGN"),
1602
1685
  variant: "base-secondary",
1603
1686
  children: "會簽"
1604
- }, "adhoc-countersign"), /* @__PURE__ */ C(p, {
1687
+ }, "adhoc-countersign"), /* @__PURE__ */ C(m, {
1605
1688
  disabled: Q,
1606
- icon: Ee,
1689
+ icon: De,
1607
1690
  iconType: "leading",
1608
- onClick: () => W.current?.openAdhocModal("PRE_APPROVAL"),
1691
+ onClick: () => K.current?.openAdhocModal("PRE_APPROVAL"),
1609
1692
  variant: "base-secondary",
1610
1693
  children: "加簽"
1611
1694
  }, "adhoc-pre-approval")] }) : null,
1612
- /* @__PURE__ */ C(p, {
1695
+ /* @__PURE__ */ C(m, {
1613
1696
  disabled: Q,
1614
- icon: Te,
1697
+ icon: Ee,
1615
1698
  iconType: "leading",
1616
- onClick: () => W.current?.openAdhocModal("STAGE_NOTIFY"),
1699
+ onClick: () => K.current?.openAdhocModal("STAGE_NOTIFY"),
1617
1700
  variant: "base-secondary",
1618
1701
  children: "通知設定"
1619
1702
  }, "adhoc-notify"),
1620
- Je ? /* @__PURE__ */ C(p, {
1703
+ Y ? /* @__PURE__ */ C(m, {
1621
1704
  disabled: Q,
1622
- icon: De,
1705
+ icon: Oe,
1623
1706
  iconType: "leading",
1624
- onClick: () => W.current?.openReturnModal(),
1707
+ onClick: () => K.current?.openReturnModal(),
1625
1708
  variant: "base-secondary",
1626
1709
  children: "退回"
1627
1710
  }, "task-return") : null,
1628
- /* @__PURE__ */ C(p, {
1711
+ Qe ? /* @__PURE__ */ C(m, {
1629
1712
  disabled: Q,
1630
- icon: ke,
1713
+ icon: Ae,
1631
1714
  iconType: "leading",
1632
- onClick: () => W.current?.openTransferModal(),
1715
+ onClick: () => K.current?.openTransferModal(),
1633
1716
  variant: "base-secondary",
1634
1717
  children: "轉派"
1635
- }, "task-transfer"),
1636
- /* @__PURE__ */ C(p, {
1718
+ }, "task-transfer") : null,
1719
+ Xe ? /* @__PURE__ */ C(m, {
1637
1720
  disabled: Q,
1638
- icon: Ce,
1721
+ icon: we,
1639
1722
  iconType: "leading",
1640
- onClick: () => W.current?.openRejectModal(),
1723
+ onClick: () => K.current?.openRejectModal(),
1641
1724
  variant: "destructive-secondary",
1642
1725
  children: "拒絕"
1643
- }, "task-reject"),
1644
- /* @__PURE__ */ C(p, {
1726
+ }, "task-reject") : null,
1727
+ /* @__PURE__ */ C(m, {
1645
1728
  disabled: Q,
1646
1729
  icon: Se,
1647
1730
  iconType: "leading",
1648
- onClick: () => W.current?.handleApprove(),
1731
+ onClick: () => K.current?.handleApprove(),
1649
1732
  variant: "base-primary",
1650
1733
  children: "同意"
1651
1734
  }, "task-approve")
1652
1735
  ] }) : null
1653
1736
  ]
1654
1737
  }) }),
1655
- /* @__PURE__ */ w(ee, { children: [
1656
- a ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Tt, {
1657
- canResubmitInstance: q,
1658
- deciding: Re,
1659
- error: Fe,
1660
- instance: b,
1661
- loading: Ie,
1738
+ /* @__PURE__ */ w(_, { children: [
1739
+ o ? /* @__PURE__ */ C(g, { children: /* @__PURE__ */ C(Dt, {
1740
+ canResubmitInstance: tt,
1741
+ deciding: Ve,
1742
+ error: Re,
1743
+ instance: T,
1744
+ loading: Be,
1745
+ onDataSourceStateChange: Ye,
1662
1746
  onResubmitFormChange: (e) => {
1663
- L(e), Ue({});
1747
+ R(e), I({});
1664
1748
  },
1665
- onResubmitInstance: () => void at(),
1666
- onUploadAttachment: Z,
1667
- resubmitFormData: I,
1668
- resubmitFormErrors: He
1749
+ onResubmitInstance: () => void ft(),
1750
+ onUploadAttachment: ct,
1751
+ resubmitFormData: L,
1752
+ resubmitFormErrors: Ue
1669
1753
  }) }) : null,
1670
- i ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Dt, {
1671
- attachments: se,
1754
+ a ? /* @__PURE__ */ C(g, { children: /* @__PURE__ */ C(kt, {
1755
+ attachments: ue,
1672
1756
  onDownload: (e) => {
1673
- nt(e);
1757
+ lt(e);
1674
1758
  },
1675
1759
  onPreview: (e) => {
1676
- rt(e);
1760
+ ut(e);
1677
1761
  }
1678
1762
  }) }) : null,
1679
- f ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Rt, {
1680
- adhocDirectives: H,
1763
+ ee ? /* @__PURE__ */ C(g, { children: /* @__PURE__ */ C(Bt, {
1764
+ adhocDirectives: Ge,
1681
1765
  currentMemberId: v,
1682
- instance: b,
1683
- memberProfilesById: Xe,
1684
- onChanged: X,
1685
- ref: W,
1686
- tasks: T
1766
+ instance: T,
1767
+ memberProfilesById: X,
1768
+ onChanged: st,
1769
+ ref: K,
1770
+ tasks: E
1687
1771
  }) }) : null,
1688
- c ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Vt, {
1689
- signatureVerification: _e,
1690
- signatures: he
1772
+ p ? /* @__PURE__ */ C(g, { children: /* @__PURE__ */ C(Ut, {
1773
+ signatureVerification: ye,
1774
+ signatures: ge
1691
1775
  }) }) : null,
1692
- o ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Jt, {
1693
- activityLogs: y,
1694
- instanceState: b?.state ?? "RUNNING",
1695
- memberProfilesById: Xe,
1696
- signatureVerification: _e,
1697
- signaturesById: $e,
1698
- taskDecisionsByTaskId: Qe,
1699
- tasks: T,
1700
- workflowSnapshot: b?.workflowSnapshot ?? null,
1776
+ l ? /* @__PURE__ */ C(g, { children: /* @__PURE__ */ C(Xt, {
1777
+ activityLogs: re,
1778
+ instanceState: T?.state ?? "RUNNING",
1779
+ memberProfilesById: X,
1780
+ signatureVerification: ye,
1781
+ signaturesById: rt,
1782
+ taskDecisionsByTaskId: nt,
1783
+ tasks: E,
1784
+ workflowSnapshot: T?.workflowSnapshot ?? null,
1701
1785
  workflowTokens: D
1702
1786
  }) }) : null
1703
1787
  ] }),
1704
- b ? /* @__PURE__ */ C(h, {
1788
+ T ? /* @__PURE__ */ C(h, {
1705
1789
  modalType: "standard",
1706
- onClose: () => N(!1),
1707
- open: M,
1790
+ onClose: () => M(!1),
1791
+ open: j,
1708
1792
  showModalHeader: !0,
1709
1793
  size: "wide",
1710
- supportingText: `${Ke(b.state)} · ${t(b.startedAt)}`,
1794
+ supportingText: `${Je(T.state)} · ${t(T.startedAt)}`,
1711
1795
  title: "流程圖",
1712
1796
  children: /* @__PURE__ */ w("div", {
1713
- style: Zt,
1797
+ style: $t,
1714
1798
  children: [/* @__PURE__ */ C("div", {
1715
- style: Qt,
1716
- children: /* @__PURE__ */ w(A, {
1717
- edges: Y,
1799
+ style: en,
1800
+ children: /* @__PURE__ */ w(ze, {
1801
+ edges: at,
1718
1802
  fitView: !0,
1719
1803
  fitViewOptions: { padding: .18 },
1720
1804
  maxZoom: 1.2,
1721
1805
  minZoom: .2,
1722
- nodes: et,
1806
+ nodes: it,
1723
1807
  nodesDraggable: !1,
1724
1808
  nodesFocusable: !1,
1725
- nodeTypes: sn,
1809
+ nodeTypes: ln,
1726
1810
  panOnDrag: !0,
1727
1811
  proOptions: { hideAttribution: !0 },
1728
- children: [/* @__PURE__ */ C(Ne, {}), /* @__PURE__ */ C(Pe, { showInteractive: !1 })]
1812
+ children: [/* @__PURE__ */ C(Ie, {}), /* @__PURE__ */ C(Le, { showInteractive: !1 })]
1729
1813
  })
1730
- }), tt.length > 0 ? /* @__PURE__ */ C("div", {
1731
- style: rn,
1732
- children: tt.map((e) => /* @__PURE__ */ C("span", {
1733
- style: an,
1814
+ }), ot.length > 0 ? /* @__PURE__ */ C("div", {
1815
+ style: on,
1816
+ children: ot.map((e) => /* @__PURE__ */ C("span", {
1817
+ style: sn,
1734
1818
  children: e
1735
1819
  }, e))
1736
1820
  }) : null]
@@ -1739,73 +1823,73 @@ function cn({ instanceId: r, showAttachments: i = !0, showForm: a = !0, showHist
1739
1823
  /* @__PURE__ */ C(h, {
1740
1824
  modalType: "standard",
1741
1825
  onClose: () => {
1742
- z(null), V(null);
1826
+ H(null), W(null);
1743
1827
  },
1744
- open: !!(R && B),
1828
+ open: !!(V && U),
1745
1829
  showModalHeader: !0,
1746
1830
  size: "wide",
1747
- supportingText: R?.filename ?? void 0,
1831
+ supportingText: V?.filename ?? void 0,
1748
1832
  title: "PDF 預覽",
1749
- children: B ? /* @__PURE__ */ C(F, {
1750
- filename: R?.filename ?? "PDF 預覽",
1751
- fileUrl: B,
1752
- onDownload: R ? () => void nt(R) : void 0
1833
+ children: U ? /* @__PURE__ */ C(We, {
1834
+ filename: V?.filename ?? "PDF 預覽",
1835
+ fileUrl: U,
1836
+ onDownload: V ? () => void lt(V) : void 0
1753
1837
  }) : null
1754
1838
  }),
1755
1839
  /* @__PURE__ */ C(h, {
1756
1840
  cancelText: "保留案件",
1757
1841
  confirmButtonProps: { variant: "destructive-primary" },
1758
1842
  confirmText: "確認取消",
1759
- loading: Re,
1843
+ loading: Ve,
1760
1844
  modalStatusType: "error",
1761
1845
  modalType: "standard",
1762
- onCancel: () => P(!1),
1763
- onClose: () => P(!1),
1764
- onConfirm: () => void it(),
1765
- open: Ve,
1846
+ onCancel: () => F(!1),
1847
+ onClose: () => F(!1),
1848
+ onConfirm: () => void dt(),
1849
+ open: He,
1766
1850
  showModalFooter: !0,
1767
1851
  showModalHeader: !0,
1768
1852
  supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
1769
1853
  title: "取消案件",
1770
1854
  children: /* @__PURE__ */ w("div", {
1771
- style: on,
1855
+ style: cn,
1772
1856
  children: [/* @__PURE__ */ w(x, {
1773
1857
  variant: "body",
1774
1858
  children: [
1775
1859
  "確定要取消「",
1776
- b?.title ?? "",
1860
+ T?.title ?? "",
1777
1861
  "」嗎?"
1778
1862
  ]
1779
1863
  }), /* @__PURE__ */ C(n, {
1780
1864
  label: "取消原因",
1781
1865
  name: "cancelComment",
1782
- children: /* @__PURE__ */ C(ne, {
1783
- onChange: (e) => Be(e.target.value),
1866
+ children: /* @__PURE__ */ C(y, {
1867
+ onChange: (e) => P(e.target.value),
1784
1868
  placeholder: "可填寫取消原因",
1785
1869
  resize: "vertical",
1786
1870
  rows: 3,
1787
- value: ze
1871
+ value: N
1788
1872
  })
1789
1873
  })]
1790
1874
  })
1791
1875
  })
1792
1876
  ] });
1793
1877
  }
1794
- function ln(e) {
1878
+ function dn(e) {
1795
1879
  return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
1796
1880
  }
1797
- function un(e) {
1798
- return e.edges.map(ln).filter((e) => e.trim().length > 0);
1881
+ function fn(e) {
1882
+ return e.edges.map(dn).filter((e) => e.trim().length > 0);
1799
1883
  }
1800
- function dn(e) {
1884
+ function pn(e) {
1801
1885
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
1802
1886
  }
1803
- function fn(e, t, n, r) {
1887
+ function mn(e, t, n, r) {
1804
1888
  return e.nodes.map((e) => {
1805
- let i = vt(e, t, n, r);
1889
+ let i = bt(e, t, n, r);
1806
1890
  return {
1807
1891
  data: {
1808
- kindLabel: dn(e.type),
1892
+ kindLabel: pn(e.type),
1809
1893
  label: e.data.label,
1810
1894
  secondaryLabel: i.secondaryLabel,
1811
1895
  statusLabel: i.statusLabel,
@@ -1813,42 +1897,42 @@ function fn(e, t, n, r) {
1813
1897
  },
1814
1898
  id: e.id,
1815
1899
  position: e.position,
1816
- sourcePosition: k.Right,
1817
- targetPosition: k.Left,
1900
+ sourcePosition: O.Right,
1901
+ targetPosition: O.Left,
1818
1902
  type: "workflowRuntime"
1819
1903
  };
1820
1904
  });
1821
1905
  }
1822
- function pn(e) {
1823
- let t = new Ie.graphlib.Graph();
1906
+ function hn(e) {
1907
+ let t = new Be.graphlib.Graph();
1824
1908
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
1825
1909
  nodesep: 56,
1826
1910
  rankdir: "LR",
1827
1911
  ranksep: 120
1828
1912
  }), e.nodes.forEach((e) => {
1829
1913
  t.setNode(e.id, {
1830
- height: Xt,
1831
- width: Yt
1914
+ height: Qt,
1915
+ width: Zt
1832
1916
  });
1833
1917
  }), e.edges.forEach((e) => {
1834
1918
  t.setEdge(e.source, e.target);
1835
- }), Ie.layout(t), {
1919
+ }), Be.layout(t), {
1836
1920
  ...e,
1837
1921
  nodes: e.nodes.map((e) => {
1838
1922
  let n = t.node(e.id);
1839
1923
  return n ? {
1840
1924
  ...e,
1841
1925
  position: {
1842
- x: n.x - Yt / 2,
1843
- y: n.y - Xt / 2
1926
+ x: n.x - Zt / 2,
1927
+ y: n.y - Qt / 2
1844
1928
  }
1845
1929
  } : e;
1846
1930
  })
1847
1931
  };
1848
1932
  }
1849
- function mn(e) {
1933
+ function gn(e) {
1850
1934
  return e.edges.map((e) => {
1851
- let t = ln(e);
1935
+ let t = dn(e);
1852
1936
  return {
1853
1937
  animated: !1,
1854
1938
  id: e.id,
@@ -1876,25 +1960,25 @@ function mn(e) {
1876
1960
  };
1877
1961
  });
1878
1962
  }
1879
- function hn(e) {
1963
+ function _n(e) {
1880
1964
  return e === "current" ? {
1881
- ...$t,
1965
+ ...tn,
1882
1966
  border: "1px solid var(--mzn-color-primary, #0057ff)",
1883
1967
  boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
1884
1968
  } : e === "completed" ? {
1885
- ...$t,
1969
+ ...tn,
1886
1970
  border: "1px solid #16a34a"
1887
1971
  } : e === "cancelled" ? {
1888
- ...$t,
1972
+ ...tn,
1889
1973
  border: "1px solid #dc2626",
1890
1974
  opacity: .72
1891
1975
  } : e === "waiting" ? {
1892
- ...$t,
1976
+ ...tn,
1893
1977
  border: "1px dashed #64748b"
1894
- } : $t;
1978
+ } : tn;
1895
1979
  }
1896
- function gn(e) {
1897
- let t = en;
1980
+ function vn(e) {
1981
+ let t = nn;
1898
1982
  return e === "current" ? {
1899
1983
  ...t,
1900
1984
  background: "#eff6ff",
@@ -1917,14 +2001,14 @@ function gn(e) {
1917
2001
  color: "#64748b"
1918
2002
  };
1919
2003
  }
1920
- function _n({ data: e }) {
2004
+ function yn({ data: e }) {
1921
2005
  return /* @__PURE__ */ w("div", {
1922
- style: hn(e.tone),
2006
+ style: _n(e.tone),
1923
2007
  children: [
1924
- /* @__PURE__ */ C(Fe, {
2008
+ /* @__PURE__ */ C(Re, {
1925
2009
  isConnectable: !1,
1926
- position: k.Left,
1927
- style: nn,
2010
+ position: O.Left,
2011
+ style: an,
1928
2012
  type: "target"
1929
2013
  }),
1930
2014
  /* @__PURE__ */ C(x, {
@@ -1935,24 +2019,24 @@ function _n({ data: e }) {
1935
2019
  children: e.label
1936
2020
  }),
1937
2021
  /* @__PURE__ */ C("span", {
1938
- style: gn(e.tone),
2022
+ style: vn(e.tone),
1939
2023
  children: e.statusLabel
1940
2024
  }),
1941
2025
  /* @__PURE__ */ C("span", {
1942
2026
  title: e.secondaryLabel,
1943
- style: tn,
2027
+ style: rn,
1944
2028
  children: e.secondaryLabel || e.kindLabel
1945
2029
  }),
1946
- /* @__PURE__ */ C(Fe, {
2030
+ /* @__PURE__ */ C(Re, {
1947
2031
  isConnectable: !1,
1948
- position: k.Right,
1949
- style: nn,
2032
+ position: O.Right,
2033
+ style: an,
1950
2034
  type: "source"
1951
2035
  })
1952
2036
  ]
1953
2037
  });
1954
2038
  }
1955
2039
  //#endregion
1956
- export { Dt as a, Rt as i, Jt as n, Tt as o, Vt as r, cn as t };
2040
+ export { kt as a, Bt as i, Xt as n, Dt as o, Ut as r, un as t };
1957
2041
 
1958
- //# sourceMappingURL=detail-fg8MTwuH.js.map
2042
+ //# sourceMappingURL=detail-DAak2OXS.js.map