@rytass/bpm-core-react 0.8.0 → 0.9.1

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 (154) hide show
  1. package/CHANGELOG.md +93 -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-CQHDT7vh.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-CUbVXEtS.js → designer-BszXJ5RO.js} +1227 -990
  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-Cts5_gVp.js → detail-DAak2OXS.js} +704 -622
  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 +56 -11
  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-CQHDT7vh.js.map +0 -1
  141. package/dist/chunks/compose-Ds_cAefe.cjs +0 -2
  142. package/dist/chunks/compose-Ds_cAefe.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-CQ9hxSdD.cjs +0 -65
  147. package/dist/chunks/designer-CQ9hxSdD.cjs.map +0 -1
  148. package/dist/chunks/designer-CUbVXEtS.js.map +0 -1
  149. package/dist/chunks/detail-B-Q4W-iw.cjs +0 -2
  150. package/dist/chunks/detail-B-Q4W-iw.cjs.map +0 -1
  151. package/dist/chunks/detail-Cts5_gVp.js.map +0 -1
  152. package/dist/chunks/notifications-BKs4--96.cjs +0 -2
  153. package/dist/chunks/orgs-iNJ0QEcK.cjs +0 -2
  154. package/dist/chunks/orgs-iNJ0QEcK.cjs.map +0 -1
@@ -2,18 +2,18 @@
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 Ae, ZoomOutIcon as je } from "@mezzanine-ui/icons";
13
- import { focusFormRendererField as Me, validateFormRendererValues as Ne } from "@rytass/bpm-core-client/form";
14
- import { Background as Pe, Controls as Fe, Handle as Ie, Position as O, ReactFlow as k } from "@xyflow/react";
15
- import * as Le from "dagre";
16
- import { Document as Re, Page as ze } from "react-pdf";
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
17
  import { stepClasses as A } from "@mezzanine-ui/core/stepper";
18
18
  var j = {
19
19
  root: "bpm_root_ehm7w",
@@ -24,26 +24,26 @@ var j = {
24
24
  viewport: "bpm_viewport_DQXms",
25
25
  page: "bpm_page_Cv5Rg",
26
26
  state: "bpm_state_bpgp3"
27
- }, M = 760, Be = 920, Ve = 320, He = 32, N = .75, Ue = 1.75, We = .25;
28
- function P({ 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(M);
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(Ve, g - He);
43
- return Math.round(Math.min(Be, 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 > N, b = m < Ue, 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
49
  className: j.root,
@@ -54,12 +54,12 @@ function P({ filename: e, fileUrl: t, onDownload: n }) {
54
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"
@@ -68,14 +68,14 @@ function P({ filename: e, fileUrl: t, onDownload: n }) {
68
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"
@@ -86,12 +86,12 @@ function P({ filename: e, fileUrl: t, onDownload: n }) {
86
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: je,
91
+ disabled: !re,
92
+ icon: Me,
93
93
  onClick: () => {
94
- h((e) => Math.max(N, e - We));
94
+ ee((e) => Math.max(F, e - I));
95
95
  },
96
96
  size: "minor",
97
97
  variant: "base-secondary"
@@ -100,22 +100,22 @@ function P({ filename: e, fileUrl: t, onDownload: n }) {
100
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: Ae,
107
+ disabled: !y,
108
+ icon: je,
109
109
  onClick: () => {
110
- h((e) => Math.min(Ue, e + We));
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",
@@ -126,25 +126,25 @@ function P({ filename: e, fileUrl: t, onDownload: n }) {
126
126
  }), /* @__PURE__ */ C("div", {
127
127
  className: j.viewport,
128
128
  ref: r,
129
- children: /* @__PURE__ */ C(Re, {
130
- error: /* @__PURE__ */ C(F, { message: "PDF 無法載入。" }),
129
+ children: /* @__PURE__ */ C(k, {
130
+ error: /* @__PURE__ */ C(L, { message: "PDF 無法載入。" }),
131
131
  file: t,
132
- loading: /* @__PURE__ */ C(F, { message: "正在載入 PDF..." }),
133
- noData: /* @__PURE__ */ C(F, { message: "沒有可預覽的 PDF。" }),
134
- onLoadSuccess: v,
135
- children: /* @__PURE__ */ C(ze, {
132
+ loading: /* @__PURE__ */ C(L, { message: "正在載入 PDF..." }),
133
+ noData: /* @__PURE__ */ C(L, { message: "沒有可預覽的 PDF。" }),
134
+ onLoadSuccess: _,
135
+ children: /* @__PURE__ */ C(Ve, {
136
136
  className: j.page,
137
- loading: /* @__PURE__ */ C(F, { message: "正在載入頁面..." }),
138
- pageNumber: c,
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 F({ message: e }) {
147
+ function L({ message: e }) {
148
148
  return /* @__PURE__ */ C("div", {
149
149
  className: j.state,
150
150
  children: /* @__PURE__ */ C(x, {
@@ -156,77 +156,77 @@ function F({ message: e }) {
156
156
  }
157
157
  //#endregion
158
158
  //#region src/views/instances/detail/sections/shared.ts
159
- function I(e) {
160
- let t = R(e, "from"), n = R(e, "to"), r = R(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: R(e, "ruleId"),
164
+ ruleId: B(e, "ruleId"),
165
165
  to: n
166
166
  };
167
167
  }
168
- function L(e) {
168
+ function z(e) {
169
169
  try {
170
170
  let t = JSON.parse(e);
171
- return Array.isArray(t) ? t.map((e) => Ke(e) ? I(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 R(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 Ge(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 z(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 B(e) {
188
+ function U(e) {
189
189
  return typeof e == "string" && e.trim().length > 0;
190
190
  }
191
- function Ke(e) {
191
+ function W(e) {
192
192
  return typeof e == "object" && !!e;
193
193
  }
194
- function qe(e) {
194
+ function Ge(e) {
195
195
  return e.status === "PENDING" || e.status === "IN_PROGRESS";
196
196
  }
197
- function V(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 H(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 U(e) {
203
+ function qe(e) {
204
204
  return e.length > 16 ? `${e.slice(0, 12)}...` : e;
205
205
  }
206
- function W(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 Je(e) {
209
+ function K(e) {
210
210
  return e === "PENDING" ? "待處理" : e === "IN_PROGRESS" ? "處理中" : e === "COMPLETED" ? "已完成" : e === "CANCELLED" ? "已取消" : e === "TRANSFERRED" ? "已轉派" : e;
211
211
  }
212
212
  function Ye(e) {
213
213
  return e === "APPROVED" ? "同意" : e === "REJECTED" ? "拒絕" : e === "RETURNED" ? "退回" : e === "TRANSFERRED" ? "轉派" : e;
214
214
  }
215
- function G(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 = L(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}(${G(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}(${G(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 (!Ke(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 B(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 B(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,153 +295,154 @@ 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(R(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 Ke(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" || R(t, "action") === "REJECTED" || R(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 = R(t, "assigneeMemberId"), n = R(t, "originalAssigneeMemberId");
327
+ let e = B(t, "assigneeMemberId"), n = B(t, "originalAssigneeMemberId");
328
328
  if (!e) {
329
- let e = Ge(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 = R(t, "action"), n = R(t, "comment"), i = e ? `決議:${Ye(e)}` : null, a = R(t, "transferToMemberId");
337
- return e === "REJECTED" && n ? [i, `拒絕原因:${n}`].filter(B).join(" · ") : e === "TRANSFERRED" ? [i, `轉派給:${q(a, r)}`].filter(B).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 = R(t, "action");
340
+ let e = B(t, "action");
341
341
  if (e) return `流程結果:${Ye(e)}`;
342
- let r = z(t, "arrivedCount"), i = z(t, "requiredCount");
342
+ let r = H(t, "arrivedCount"), i = H(t, "requiredCount");
343
343
  if (r !== null && i !== null) return `等待匯合:${r}/${i}`;
344
- let a = R(t, "fromNodeId"), o = R(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 = R(t, "state");
349
- return e ? `案件狀態:${W(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 = R(t, "action") ?? s?.action ?? null, l = R(t, "comment") ?? s?.comment ?? null, u = R(t, "transferToMemberId") ?? s?.transferToMemberId ?? null, d = R(t, "signatureId") ?? s?.signatureId ?? null, f = d ? i.get(d) : null;
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 ? `決議:${Ye(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 ? `簽章:已驗證(${U(f.signedPayloadHash)})` : `簽章:待檢查(${U(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 ut(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 $(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) => ut(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
- let i = n.filter((e) => e.status === "ACTIVE" || e.status === "WAITING").map((e) => e.currentNodeId), a = t.filter(qe).map((e) => e.nodeId), o = e.nodes.filter((e) => r.has(e.id)).map((e) => e.id), s = [...new Set([
387
+ function ht(e, t, n, r) {
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,
390
391
  ...o
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
- }), u = t.filter(qe).map((e) => ({
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(B)), f = r ? $(r, t, n, i, d).map((e) => ({
440
- descriptionParts: [Y(`${G(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: G(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) => L(e.delegationChainJson).flatMap((e) => [e.from, e.to])),
497
- ...t.flatMap((e) => [e.createdByMemberId, ...bt(e.targetValueJson)])
498
- ].filter(B))];
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: H(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(""), [Ae, je] = d(null), [Me, Ne] = d(!1), [Pe, Fe] = d([]), [Ie, O] = d(!1), [k, Le] = d("COUNTERSIGN"), [Re, ze] = d("REJECT_INSTANCE"), [A, j] = d(!1), [M, Be] = d("MEMBER"), [Ve, He] = d(""), N = b.trim(), Ue = fe.trim(), We = xe.trim(), P = l(() => s.find((e) => Ze(e, r) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [r, s]), F = l(() => P && i ? i.workflowSnapshot.nodes.find((e) => e.id === P.nodeId) ?? null : null, [P, i]), I = l(() => F && i ? Qe(i.workflowSnapshot, F) : [], [F, i]), L = F?.type === "userTask" && F.data.returnBehavior.allowReturn, R = F?.type === "userTask" && F.data.returnBehavior.requireComment === !0, Ge = F?.type === "userTask" && F.data.allowAddSigner, z = l(() => e.filter((e) => e.status === "PENDING"), [e]), B = I.find((e) => e.id === ve) ?? I[0] ?? null, Ke = 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: Je(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
- ]), qe = 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
- ], []), H = l(() => z.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, z]), U = 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: A,
784
- onClick: () => void ut(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
- ], [A, r]);
793
- async function W({ action: e, comment: t, returnToNodeId: n = null, transferToMemberId: i = null }) {
794
- if (!(!r || !P)) {
795
- _(!0), y(null);
796
- try {
797
- await se({
798
- action: e,
799
- comment: t,
800
- decidedByMemberId: r,
801
- returnToNodeId: n,
802
- taskId: P.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(V(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;
810
816
  }
817
+ try {
818
+ await o();
819
+ } catch (e) {
820
+ _(G(e));
821
+ } finally {
822
+ te(!1);
823
+ }
824
+ return !0;
825
+ }
826
+ function rt() {
827
+ !r || !R || (_(null), b(""), ce(!0));
828
+ }
829
+ function Z() {
830
+ d || (ce(!1), b(""));
811
831
  }
812
- function Ye() {
813
- ie(""), le(null), de(!0);
832
+ async function it() {
833
+ d || await nt({
834
+ action: "APPROVED",
835
+ comment: v.trim() || null
836
+ }) && (ce(!1), b(""));
814
837
  }
815
- function G() {
816
- g || (de(!1), ie(""), le(null));
838
+ function at() {
839
+ H && (ue(""), fe(null), me(!0));
817
840
  }
818
- function Y() {
819
- pe(""), be(I[0]?.id ?? null), _e(!0);
841
+ function ot() {
842
+ d || (me(!1), ue(""), fe(null));
820
843
  }
821
- function tt() {
822
- g || (_e(!1), pe(""), be(null));
844
+ function st() {
845
+ ve(""), Ce(B[0]?.id ?? null), xe(!0);
823
846
  }
824
- function X() {
825
- Se(""), E(null), De(!0), nt("");
847
+ function ct() {
848
+ d || (xe(!1), ve(""), Ce(null));
826
849
  }
827
- function Z() {
828
- g || (De(!1), Se(""), E(null));
850
+ function lt() {
851
+ U && (we(""), D(null), je(!0), dt(""));
829
852
  }
830
- async function nt(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(V(e));
861
+ _(G(e));
836
862
  } finally {
837
- D(!1);
863
+ De(!1);
838
864
  }
839
865
  }
840
- async function rt() {
841
- if (!N) {
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 W({
846
- action: "REJECTED",
847
- comment: N
848
- });
849
877
  }
850
- async function it() {
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 W({
856
- action: "TRANSFERRED",
857
- comment: We || null,
858
- transferToMemberId: T.id
859
- });
860
890
  }
861
- async function at() {
862
- await W({
891
+ async function Q() {
892
+ await nt({
863
893
  action: "RETURNED",
864
- comment: Ue || null,
865
- returnToNodeId: B?.id ?? null
894
+ comment: We || null,
895
+ returnToNodeId: qe?.id ?? null
866
896
  });
867
897
  }
868
- function ot() {
869
- ke(""), je(null), ze("REJECT_INSTANCE"), Be("MEMBER"), He("");
898
+ function mt() {
899
+ Ne(""), Fe(null), j("REJECT_INSTANCE"), He("MEMBER"), Ue("");
870
900
  }
871
- function Q(e) {
872
- Le(e), ot(), O(!0), ct("");
901
+ function ht(e) {
902
+ Ve(e), mt(), Be(!0), _t("");
873
903
  }
874
- function st() {
875
- A || (O(!1), ot());
904
+ function gt() {
905
+ M || (Be(!1), mt());
876
906
  }
877
- async function ct(e) {
878
- Ne(!0);
907
+ async function _t(e) {
908
+ Le(!0);
879
909
  try {
880
- Fe((await ye(e)).map($e));
910
+ O((await ye(e)).map($e));
881
911
  } catch (e) {
882
- y(V(e));
912
+ _(G(e));
883
913
  } finally {
884
- Ne(!1);
914
+ Le(!1);
885
915
  }
886
916
  }
887
- async function lt() {
888
- if (!P) return;
889
- let e = (k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY") && M === "WEBHOOK", t = Ve.trim(), n = Ae;
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
- j(!0), y(null);
934
+ }, i = Me.trim() || null;
935
+ N(!0), _(null);
906
936
  try {
907
937
  k === "COUNTERSIGN" ? await he({
908
938
  comment: i,
909
939
  target: r,
910
- taskId: P.id
940
+ taskId: R.id
911
941
  }) : k === "PRE_APPROVAL" ? await ge({
912
942
  comment: i,
913
- onReject: Re,
943
+ onReject: A,
914
944
  target: r,
915
- taskId: P.id
945
+ taskId: R.id
916
946
  }) : k === "STAGE_NOTIFY" ? await oe({
917
947
  target: r,
918
- taskId: P.id
948
+ taskId: R.id
919
949
  }) : await ae({
920
950
  target: r,
921
- taskId: P.id
922
- }), O(!1), ot(), await o();
951
+ taskId: R.id
952
+ }), Be(!1), mt(), await o();
923
953
  } catch (e) {
924
- y(V(e));
954
+ _(G(e));
925
955
  } finally {
926
- j(!1);
956
+ N(!1);
927
957
  }
928
958
  }
929
- async function ut(e) {
930
- j(!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(V(e));
964
+ _(G(e));
935
965
  } finally {
936
- j(!1);
966
+ N(!1);
937
967
  }
938
968
  }
939
- c(u, () => ({
969
+ l(c, () => ({
940
970
  canAddSignerCurrentTask: Ge,
941
- canReturnCurrentTask: L,
942
- deciding: g,
943
- handleApprove: () => {
944
- W({
945
- action: "APPROVED",
946
- comment: null
947
- });
948
- },
949
- hasCurrentTask: P !== null,
950
- openAdhocModal: Q,
951
- openRejectModal: Ye,
952
- openReturnModal: Y,
953
- openTransferModal: X
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
982
  Ge,
956
- L,
957
- P,
958
- g
983
+ H,
984
+ V,
985
+ U,
986
+ r,
987
+ R,
988
+ d
959
989
  ]);
960
- let $ = k === "STAGE_NOTIFY" || k === "COMPLETION_NOTIFY", dt = $ && M === "WEBHOOK" ? !Ve.trim() : !Ae, ft = It.find((e) => e.id === Re) ?? It[0], pt = Lt.find((e) => e.id === M) ?? 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: qe,
976
- dataSource: Ke,
1003
+ style: Nt,
1004
+ children: /* @__PURE__ */ C(re, {
1005
+ columns: Ye,
1006
+ dataSource: Je,
977
1007
  fullWidth: !0
978
1008
  })
979
1009
  }),
980
- z.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: U,
989
- dataSource: H,
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: !N,
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: G,
1004
- onClose: G,
1005
- onConfirm: () => void rt(),
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: Z,
1045
- onClose: Z,
1046
- onConfirm: () => void it(),
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,117 +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: nt,
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 && nt("");
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: !B || R && !Ue },
1167
+ confirmButtonProps: { disabled: !qe || W && !We },
1101
1168
  confirmText: "送出退回",
1102
- loading: g,
1169
+ loading: d,
1103
1170
  modalType: "standard",
1104
- onCancel: tt,
1105
- onClose: tt,
1106
- onConfirm: () => void at(),
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: [...I],
1189
+ onChange: (e) => Ce(e?.id ?? null),
1190
+ options: [...B],
1124
1191
  placeholder: "選擇退回節點",
1125
- value: B
1192
+ value: qe
1126
1193
  })
1127
1194
  }), /* @__PURE__ */ C(n, {
1128
- hintText: R ? "此關卡設定退回時必須填寫意見。" : void 0,
1195
+ hintText: W ? "此關卡設定退回時必須填寫意見。" : void 0,
1129
1196
  label: "退回說明",
1130
1197
  name: "returnComment",
1131
- required: R,
1132
- children: /* @__PURE__ */ C(ne, {
1133
- onChange: (e) => pe(e.target.value),
1134
- placeholder: R ? "請說明退回原因" : "可補充需要修改的內容",
1135
- ref: Nt,
1198
+ required: W,
1199
+ children: /* @__PURE__ */ C(y, {
1200
+ onChange: (e) => ve(e.target.value),
1201
+ placeholder: W ? "請說明退回原因" : "可補充需要修改的內容",
1202
+ ref: Ft,
1136
1203
  resize: "vertical",
1137
1204
  rows: 4,
1138
- style: kt,
1139
- value: fe
1205
+ style: jt,
1206
+ value: _e
1140
1207
  })
1141
1208
  })]
1142
1209
  })
1143
1210
  }),
1144
1211
  /* @__PURE__ */ C(h, {
1145
1212
  cancelText: "取消",
1146
- confirmButtonProps: { disabled: dt },
1213
+ confirmButtonProps: { disabled: bt },
1147
1214
  confirmText: "送出",
1148
- loading: A,
1215
+ loading: M,
1149
1216
  modalType: "standard",
1150
- onCancel: st,
1151
- onClose: st,
1152
- onConfirm: () => void lt(),
1153
- open: Ie,
1217
+ onCancel: gt,
1218
+ onClose: gt,
1219
+ onConfirm: () => void vt(),
1220
+ open: ze,
1154
1221
  showModalFooter: !0,
1155
1222
  showModalHeader: !0,
1156
1223
  size: "regular",
1157
- supportingText: Ft[k],
1158
- title: Pt[k],
1224
+ supportingText: Lt[k],
1225
+ title: It[k],
1159
1226
  children: /* @__PURE__ */ w("div", {
1160
- style: At,
1227
+ style: Mt,
1161
1228
  children: [
1162
1229
  $ ? /* @__PURE__ */ C(n, {
1163
1230
  label: "通知時機",
1164
1231
  name: "adhocNotifyMode",
1165
1232
  required: !0,
1166
- children: /* @__PURE__ */ C(v, {
1233
+ children: /* @__PURE__ */ C(ne, {
1167
1234
  clearable: !1,
1168
1235
  fullWidth: !0,
1169
- onChange: (e) => Le(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1236
+ onChange: (e) => Ve(e?.id === "COMPLETION_NOTIFY" ? "COMPLETION_NOTIFY" : "STAGE_NOTIFY"),
1170
1237
  options: [{
1171
1238
  id: "STAGE_NOTIFY",
1172
- name: Pt.STAGE_NOTIFY
1239
+ name: It.STAGE_NOTIFY
1173
1240
  }, {
1174
1241
  id: "COMPLETION_NOTIFY",
1175
- name: Pt.COMPLETION_NOTIFY
1242
+ name: It.COMPLETION_NOTIFY
1176
1243
  }],
1177
1244
  value: {
1178
1245
  id: k,
1179
- name: Pt[k]
1246
+ name: It[k]
1180
1247
  }
1181
1248
  })
1182
1249
  }) : null,
@@ -1184,29 +1251,29 @@ var Pt = {
1184
1251
  label: "通知對象類型",
1185
1252
  name: "adhocTargetKind",
1186
1253
  required: !0,
1187
- children: /* @__PURE__ */ C(v, {
1254
+ children: /* @__PURE__ */ C(ne, {
1188
1255
  clearable: !1,
1189
1256
  fullWidth: !0,
1190
- onChange: (e) => Be(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1191
- options: [...Lt],
1192
- value: pt
1257
+ onChange: (e) => He(e?.id === "WEBHOOK" ? "WEBHOOK" : "MEMBER"),
1258
+ options: [...zt],
1259
+ value: St
1193
1260
  })
1194
1261
  }) : null,
1195
- $ && M === "WEBHOOK" ? /* @__PURE__ */ C(n, {
1262
+ $ && P === "WEBHOOK" ? /* @__PURE__ */ C(n, {
1196
1263
  label: "Webhook URL",
1197
1264
  name: "adhocWebhookUrl",
1198
1265
  required: !0,
1199
- children: /* @__PURE__ */ C(m, {
1266
+ children: /* @__PURE__ */ C(ee, {
1200
1267
  fullWidth: !0,
1201
- onChange: (e) => He(e.target.value),
1268
+ onChange: (e) => Ue(e.target.value),
1202
1269
  placeholder: "https://example.com/webhook",
1203
- value: Ve
1270
+ value: F
1204
1271
  })
1205
1272
  }) : /* @__PURE__ */ C(n, {
1206
1273
  label: $ ? "通知對象" : "簽核對象",
1207
1274
  name: "adhocMemberId",
1208
1275
  required: !0,
1209
- children: /* @__PURE__ */ C(f, {
1276
+ children: /* @__PURE__ */ C(p, {
1210
1277
  asyncData: !0,
1211
1278
  disabledOptionsFilter: !0,
1212
1279
  emptyText: "沒有符合的成員",
@@ -1216,44 +1283,44 @@ var Pt = {
1216
1283
  name: "adhoc-member-search",
1217
1284
  spellCheck: !1
1218
1285
  },
1219
- loading: Me,
1286
+ loading: Ie,
1220
1287
  loadingText: "搜尋成員中...",
1221
1288
  mode: "single",
1222
- onChange: (e) => je(J(e)),
1223
- onSearch: ct,
1224
- onSearchTextChange: (e) => je(et(e, Pe)),
1289
+ onChange: (e) => Fe(et(e)),
1290
+ onSearch: _t,
1291
+ onSearchTextChange: (e) => Fe(tt(e, Re)),
1225
1292
  onVisibilityChange: (e) => {
1226
- e && ct("");
1293
+ e && _t("");
1227
1294
  },
1228
- options: [...Pe],
1295
+ options: [...Re],
1229
1296
  placeholder: "搜尋姓名或信箱",
1230
1297
  searchDebounceTime: 300,
1231
- value: Ae
1298
+ value: Pe
1232
1299
  })
1233
1300
  }),
1234
1301
  k === "PRE_APPROVAL" ? /* @__PURE__ */ C(n, {
1235
1302
  label: "拒簽處理方式",
1236
1303
  name: "adhocOnReject",
1237
1304
  required: !0,
1238
- children: /* @__PURE__ */ C(v, {
1305
+ children: /* @__PURE__ */ C(ne, {
1239
1306
  clearable: !1,
1240
1307
  fullWidth: !0,
1241
- onChange: (e) => ze(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1242
- options: [...It],
1243
- value: ft
1308
+ onChange: (e) => j(e?.id === "RETURN_TO_ORIGIN" ? "RETURN_TO_ORIGIN" : "REJECT_INSTANCE"),
1309
+ options: [...Rt],
1310
+ value: xt
1244
1311
  })
1245
1312
  }) : null,
1246
1313
  $ ? null : /* @__PURE__ */ C(n, {
1247
1314
  label: "說明",
1248
1315
  name: "adhocComment",
1249
- children: /* @__PURE__ */ C(ne, {
1250
- onChange: (e) => ke(e.target.value),
1316
+ children: /* @__PURE__ */ C(y, {
1317
+ onChange: (e) => Ne(e.target.value),
1251
1318
  placeholder: "可補充原因",
1252
- ref: Nt,
1319
+ ref: Ft,
1253
1320
  resize: "vertical",
1254
1321
  rows: 3,
1255
- style: kt,
1256
- value: Oe
1322
+ style: jt,
1323
+ value: Me
1257
1324
  })
1258
1325
  })
1259
1326
  ]
@@ -1261,10 +1328,10 @@ var Pt = {
1261
1328
  })
1262
1329
  ] });
1263
1330
  });
1264
- function zt(e, t) {
1331
+ function Vt(e, t) {
1265
1332
  try {
1266
1333
  let n = JSON.parse(e.targetValueJson);
1267
- 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("、");
1268
1335
  if (n.webhookUrl) return n.webhookUrl;
1269
1336
  if (n.positionId) return `職位 ${n.positionId}`;
1270
1337
  if (n.orgUnitId) return `部門 ${n.orgUnitId}`;
@@ -1273,19 +1340,19 @@ function zt(e, t) {
1273
1340
  }
1274
1341
  //#endregion
1275
1342
  //#region src/views/instances/detail/sections/InstanceSignaturesSection.tsx
1276
- var Bt = {
1343
+ var Ht = {
1277
1344
  display: "grid",
1278
1345
  gap: 16
1279
1346
  };
1280
- function Vt({ signatureVerification: e, signatures: n }) {
1281
- let r = l(() => n.map((e) => ({
1347
+ function Ut({ signatureVerification: e, signatures: n }) {
1348
+ let r = u(() => n.map((e) => ({
1282
1349
  algorithm: e.algorithm,
1283
- hashLabel: U(e.signedPayloadHash),
1350
+ hashLabel: qe(e.signedPayloadHash),
1284
1351
  key: e.id,
1285
1352
  keyVersion: e.keyVersion,
1286
1353
  signedAtLabel: t(e.signedAt),
1287
1354
  signerMemberId: e.signerMemberId
1288
- })), [n]), i = l(() => [
1355
+ })), [n]), i = u(() => [
1289
1356
  {
1290
1357
  dataIndex: "signerMemberId",
1291
1358
  key: "signerMemberId",
@@ -1318,7 +1385,7 @@ function Vt({ signatureVerification: e, signatures: n }) {
1318
1385
  }
1319
1386
  ], []);
1320
1387
  return /* @__PURE__ */ w("div", {
1321
- style: Bt,
1388
+ style: Ht,
1322
1389
  children: [
1323
1390
  /* @__PURE__ */ C(x, {
1324
1391
  component: "h2",
@@ -1330,7 +1397,7 @@ function Vt({ signatureVerification: e, signatures: n }) {
1330
1397
  variant: "body",
1331
1398
  children: e ? e.valid ? `簽章鏈已驗證,共 ${e.checkedCount} 筆。` : `簽章鏈驗證失敗:${e.errors.join("、")}` : "尚無簽章紀錄。"
1332
1399
  }),
1333
- r.length > 0 ? /* @__PURE__ */ C(te, {
1400
+ r.length > 0 ? /* @__PURE__ */ C(re, {
1334
1401
  columns: i,
1335
1402
  dataSource: r,
1336
1403
  fullWidth: !0
@@ -1340,26 +1407,26 @@ function Vt({ signatureVerification: e, signatures: n }) {
1340
1407
  }
1341
1408
  //#endregion
1342
1409
  //#region src/views/instances/detail/sections/InstanceHistorySection.tsx
1343
- var Ht = {
1410
+ var Wt = {
1344
1411
  display: "grid",
1345
1412
  gap: 16
1346
- }, Ut = {
1413
+ }, Gt = {
1347
1414
  cursor: "help",
1348
1415
  textDecoration: "underline dotted",
1349
1416
  textUnderlineOffset: 3
1350
- }, Wt = { color: "var(--mzn-color-text-error)" };
1351
- function Gt(...e) {
1352
- return e.filter((e) => B(e ?? null)).join(" ");
1417
+ }, Kt = { color: "var(--mzn-color-text-error)" };
1418
+ function qt(...e) {
1419
+ return e.filter((e) => U(e ?? null)).join(" ");
1353
1420
  }
1354
- 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) {
1355
1422
  let f = r ? "pending" : s;
1356
1423
  return /* @__PURE__ */ w("div", {
1357
1424
  ...u,
1358
- className: Gt(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),
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),
1359
1426
  ref: d,
1360
- children: [l === "dot" ? /* @__PURE__ */ C("span", { className: Gt(A.statusIndicator, A.statusIndicatorDot) }) : /* @__PURE__ */ C("span", {
1427
+ children: [l === "dot" ? /* @__PURE__ */ C("span", { className: qt(A.statusIndicator, A.statusIndicatorDot) }) : /* @__PURE__ */ C("span", {
1361
1428
  className: A.statusIndicator,
1362
- children: a + 1
1429
+ children: i + 1
1363
1430
  }), /* @__PURE__ */ w("div", {
1364
1431
  className: A.textContainer,
1365
1432
  children: [/* @__PURE__ */ w(x, {
@@ -1369,14 +1436,14 @@ var Kt = a(function({ className: e, descriptionParts: t, error: n, forcePending:
1369
1436
  }), t.length > 0 ? /* @__PURE__ */ C(x, {
1370
1437
  className: A.description,
1371
1438
  variant: "caption",
1372
- 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}`))
1373
1440
  }) : null]
1374
1441
  })]
1375
1442
  });
1376
1443
  });
1377
- function qt(e) {
1444
+ function Yt(e) {
1378
1445
  return e.type === "text" ? e.text : e.type === "dangerText" ? /* @__PURE__ */ C("span", {
1379
- style: Wt,
1446
+ style: Kt,
1380
1447
  children: e.text
1381
1448
  }) : e.email ? /* @__PURE__ */ w(S, { children: [
1382
1449
  e.prefix,
@@ -1388,28 +1455,28 @@ function qt(e) {
1388
1455
  onMouseEnter: t,
1389
1456
  onMouseLeave: n,
1390
1457
  ref: r,
1391
- style: Ut,
1458
+ style: Gt,
1392
1459
  children: e.label
1393
1460
  })
1394
1461
  })
1395
1462
  ] }) : `${e.prefix}:${e.label}`;
1396
1463
  }
1397
- function Jt({ activityLogs: e, instanceState: t, memberProfilesById: n, signatureVerification: r, signaturesById: i, taskDecisionsByTaskId: a, tasks: o, workflowSnapshot: s, workflowTokens: c }) {
1398
- 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) => ({
1399
1466
  ...e,
1400
1467
  descriptionParts: e.descriptionParts.filter(Z)
1401
1468
  }));
1402
1469
  return /* @__PURE__ */ w("div", {
1403
- style: Ht,
1470
+ style: Wt,
1404
1471
  children: [/* @__PURE__ */ C(x, {
1405
1472
  component: "h2",
1406
1473
  variant: "h3",
1407
1474
  children: "歷程"
1408
- }), d.length > 0 ? /* @__PURE__ */ C(y, {
1475
+ }), d.length > 0 ? /* @__PURE__ */ C(v, {
1409
1476
  currentStep: u,
1410
1477
  orientation: "vertical",
1411
1478
  type: "dot",
1412
- children: d.map((e) => /* @__PURE__ */ C(Kt, {
1479
+ children: d.map((e) => /* @__PURE__ */ C(Jt, {
1413
1480
  descriptionParts: e.descriptionParts,
1414
1481
  error: e.error,
1415
1482
  forcePending: e.forcePending,
@@ -1424,10 +1491,10 @@ function Jt({ activityLogs: e, instanceState: t, memberProfilesById: n, signatur
1424
1491
  }
1425
1492
  //#endregion
1426
1493
  //#region src/views/instances/detail/InstanceDetailView.tsx
1427
- var Yt = 184, Xt = 96, Zt = {
1494
+ var Zt = 184, Qt = 96, $t = {
1428
1495
  display: "grid",
1429
1496
  gap: 16
1430
- }, Qt = {
1497
+ }, en = {
1431
1498
  background: "#f8fafc",
1432
1499
  border: "1px solid #e2e8f0",
1433
1500
  borderRadius: 8,
@@ -1435,7 +1502,7 @@ var Yt = 184, Xt = 96, Zt = {
1435
1502
  minHeight: 440,
1436
1503
  overflow: "hidden",
1437
1504
  width: "min(80vw, 1040px)"
1438
- }, $t = {
1505
+ }, tn = {
1439
1506
  background: "#ffffff",
1440
1507
  border: "1px solid #cbd5e1",
1441
1508
  borderRadius: 8,
@@ -1445,24 +1512,24 @@ var Yt = 184, Xt = 96, Zt = {
1445
1512
  minHeight: 82,
1446
1513
  padding: 12,
1447
1514
  width: 184
1448
- }, en = {
1515
+ }, nn = {
1449
1516
  borderRadius: 999,
1450
1517
  fontSize: 12,
1451
1518
  fontWeight: 600,
1452
1519
  justifySelf: "start",
1453
1520
  lineHeight: "18px",
1454
1521
  padding: "0 8px"
1455
- }, tn = {
1522
+ }, rn = {
1456
1523
  color: "#64748b",
1457
1524
  fontSize: 12,
1458
1525
  overflow: "hidden",
1459
1526
  textOverflow: "ellipsis",
1460
1527
  whiteSpace: "nowrap"
1461
- }, nn = { opacity: 0 }, rn = {
1528
+ }, an = { opacity: 0 }, on = {
1462
1529
  display: "flex",
1463
1530
  flexWrap: "wrap",
1464
1531
  gap: 8
1465
- }, an = {
1532
+ }, sn = {
1466
1533
  alignItems: "center",
1467
1534
  background: "#ffffff",
1468
1535
  border: "1px solid #cbd5e1",
@@ -1474,71 +1541,82 @@ var Yt = 184, Xt = 96, Zt = {
1474
1541
  gap: 6,
1475
1542
  lineHeight: "20px",
1476
1543
  padding: "4px 8px"
1477
- }, on = {
1544
+ }, cn = {
1478
1545
  display: "grid",
1479
1546
  gap: 16
1480
- }, sn = { workflowRuntime: _n };
1481
- function cn({ instanceId: r, showAttachments: i = !0, showForm: a = !0, showHistory: o = !0, showSignatures: c = !0, showTasks: f = !0 }) {
1482
- 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([]), [Ae, je] = d([]), [Ie, O] = d(null), [Le, Re] = d(!0), [ze, A] = d(!1), [j, M] = d(!1), [Be, Ve] = d(""), [He, N] = d(!1), [Ue, We] = d({}), [F, I] = d({}), [L, R] = d(null), [Ge, z] = d(null), [B, Ke] = d([]), qe = Be.trim(), H = u(null);
1483
- s(() => {
1484
- X();
1485
- }, [v, r]), s(() => {
1486
- I(b?.formData ?? {});
1487
- }, [b]);
1488
- let U = l(() => T.find((e) => Ze(e, v) && (e.status === "PENDING" || e.status === "IN_PROGRESS")) ?? null, [v, T]), Je = l(() => U && b ? b.workflowSnapshot.nodes.find((e) => e.id === U.nodeId) ?? null : null, [U, b]), Ye = Je?.type === "userTask" && Je.data.returnBehavior.allowReturn, G = Je?.type === "userTask" && Je.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(Ae.map((e) => [e.memberId, e])), [Ae]), 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) : [], [
1489
- b,
1490
- 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) : [], [
1491
1567
  T,
1568
+ Z,
1569
+ E,
1492
1570
  D
1493
- ]), Y = l(() => J ? mn(J) : [], [J]), tt = l(() => b ? un(b.workflowSnapshot) : [], [b]);
1494
- async function X() {
1495
- Re(!0), O(null);
1571
+ ]), at = u(() => Z ? gn(Z) : [], [Z]), ot = u(() => T ? fn(T.workflowSnapshot) : [], [T]);
1572
+ async function st() {
1573
+ k(!0), O(null);
1496
1574
  try {
1497
- let e = await de(r);
1498
- te(e.activityLogs), re(e.instance), E(e.tasks), we(e.workflowTokens);
1499
- let t = await ce(e.instance.id), [n, i, a, o] = await Promise.all([
1500
- xt(e.tasks),
1501
- 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({
1502
1580
  ...e,
1503
1581
  adhocDirectives: t
1504
1582
  }),
1505
1583
  le(e.instance.id),
1506
1584
  me(e.instance.id)
1507
1585
  ]);
1508
- oe(n), je(i), ue(a), ge(o.signatures), ye(o.verification), Ke(t);
1586
+ se(n), Pe(r), he(a), _e(o.signatures), Ce(o.verification), Ke(t);
1509
1587
  } catch (e) {
1510
- O(V(e));
1588
+ O(G(e));
1511
1589
  } finally {
1512
- Re(!1);
1590
+ k(!1);
1513
1591
  }
1514
1592
  }
1515
- async function Z(e, t) {
1593
+ async function ct(e, t) {
1516
1594
  if (!v) throw Error("尚未登入,無法上傳附件");
1517
1595
  return { id: (await be({
1518
1596
  file: t,
1519
1597
  formFieldPath: `form.${e.fieldKey}`
1520
1598
  })).id };
1521
1599
  }
1522
- async function nt(e) {
1600
+ async function lt(e) {
1523
1601
  if (!v) return;
1524
1602
  let t = await fe({ id: e.id });
1525
1603
  window.open(t, "_blank", "noopener,noreferrer");
1526
1604
  }
1527
- async function rt(e) {
1605
+ async function ut(e) {
1528
1606
  if (!v) return;
1529
1607
  let t = await pe({ id: e.id });
1530
- R(e), z(t);
1608
+ H(e), W(t);
1531
1609
  }
1532
- async function it() {
1533
- if (!(!v || !b || !K)) {
1534
- if (A(!0), O(null), We({}), b.formDefinitionSnapshot.schema && b.formDefinitionSnapshot.uiSchema) {
1535
- let e = Ne({
1536
- schema: b.formDefinitionSnapshot.schema,
1537
- uiSchema: b.formDefinitionSnapshot.uiSchema,
1538
- values: F
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
1539
1617
  });
1540
1618
  if (!e.valid) {
1541
- We(e.errors), O("請先補齊必填欄位。"), e.firstInvalidFieldKey && Me(e.firstInvalidFieldKey), A(!1);
1619
+ I(e.errors), O("請先補齊必填欄位。"), e.firstInvalidFieldKey && Ne(e.firstInvalidFieldKey), A(!1);
1542
1620
  return;
1543
1621
  }
1544
1622
  }
@@ -1546,193 +1624,197 @@ function cn({ instanceId: r, showAttachments: i = !0, showForm: a = !0, showHist
1546
1624
  await ie({
1547
1625
  cancelledByMemberId: v,
1548
1626
  comment: qe || null,
1549
- instanceId: b.id
1550
- }), Ve(""), N(!1), await X();
1627
+ instanceId: T.id
1628
+ }), P(""), F(!1), await st();
1551
1629
  } catch (e) {
1552
- O(V(e));
1630
+ O(G(e));
1553
1631
  } finally {
1554
1632
  A(!1);
1555
1633
  }
1556
1634
  }
1557
1635
  }
1558
- async function at() {
1559
- if (!(!v || !b || !q)) {
1560
- A(!0), O(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
+ }
1561
1642
  try {
1562
1643
  await ve({
1563
- formData: F,
1644
+ formData: L,
1564
1645
  initiatorMemberId: v,
1565
- instanceId: b.id,
1566
- title: b.title
1567
- }), await X();
1646
+ instanceId: T.id,
1647
+ title: T.title
1648
+ }), await st();
1568
1649
  } catch (e) {
1569
- O(V(e));
1650
+ O(G(e));
1570
1651
  } finally {
1571
1652
  A(!1);
1572
1653
  }
1573
1654
  }
1574
1655
  }
1575
- let ot = H.current?.deciding ?? !1, Q = ze || ot;
1656
+ let pt = K.current?.deciding ?? !1, Q = Ve || pt;
1576
1657
  return /* @__PURE__ */ w(S, { children: [
1577
- /* @__PURE__ */ C(g, { children: /* @__PURE__ */ w(xe, {
1578
- description: b ? `${W(b.state)} · ${t(b.startedAt)}` : "載入案件內容。",
1579
- title: b?.title ?? "簽核案件",
1658
+ /* @__PURE__ */ C(te, { children: /* @__PURE__ */ w(xe, {
1659
+ description: T ? `${Je(T.state)} · ${t(T.startedAt)}` : "載入案件內容。",
1660
+ title: T?.title ?? "簽核案件",
1580
1661
  children: [
1581
- b ? /* @__PURE__ */ C(p, {
1662
+ T ? /* @__PURE__ */ C(m, {
1582
1663
  "aria-label": "查看流程圖",
1583
- icon: Oe,
1664
+ icon: ke,
1584
1665
  iconType: "icon-only",
1585
1666
  onClick: () => M(!0),
1586
1667
  title: "查看流程圖",
1587
1668
  variant: "base-secondary",
1588
1669
  children: "流程圖"
1589
1670
  }) : null,
1590
- K ? /* @__PURE__ */ C(p, {
1671
+ et ? /* @__PURE__ */ C(m, {
1591
1672
  disabled: Q,
1592
- icon: Ce,
1673
+ icon: we,
1593
1674
  iconType: "leading",
1594
- onClick: () => N(!0),
1675
+ onClick: () => F(!0),
1595
1676
  variant: "destructive-secondary",
1596
1677
  children: "取消案件"
1597
1678
  }) : null,
1598
- U ? /* @__PURE__ */ w(S, { children: [
1599
- G ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(p, {
1679
+ q ? /* @__PURE__ */ w(S, { children: [
1680
+ $e ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(m, {
1600
1681
  disabled: Q,
1601
- icon: Ee,
1682
+ icon: De,
1602
1683
  iconType: "leading",
1603
- onClick: () => H.current?.openAdhocModal("COUNTERSIGN"),
1684
+ onClick: () => K.current?.openAdhocModal("COUNTERSIGN"),
1604
1685
  variant: "base-secondary",
1605
1686
  children: "會簽"
1606
- }, "adhoc-countersign"), /* @__PURE__ */ C(p, {
1687
+ }, "adhoc-countersign"), /* @__PURE__ */ C(m, {
1607
1688
  disabled: Q,
1608
- icon: Ee,
1689
+ icon: De,
1609
1690
  iconType: "leading",
1610
- onClick: () => H.current?.openAdhocModal("PRE_APPROVAL"),
1691
+ onClick: () => K.current?.openAdhocModal("PRE_APPROVAL"),
1611
1692
  variant: "base-secondary",
1612
1693
  children: "加簽"
1613
1694
  }, "adhoc-pre-approval")] }) : null,
1614
- /* @__PURE__ */ C(p, {
1695
+ /* @__PURE__ */ C(m, {
1615
1696
  disabled: Q,
1616
- icon: Te,
1697
+ icon: Ee,
1617
1698
  iconType: "leading",
1618
- onClick: () => H.current?.openAdhocModal("STAGE_NOTIFY"),
1699
+ onClick: () => K.current?.openAdhocModal("STAGE_NOTIFY"),
1619
1700
  variant: "base-secondary",
1620
1701
  children: "通知設定"
1621
1702
  }, "adhoc-notify"),
1622
- Ye ? /* @__PURE__ */ C(p, {
1703
+ Y ? /* @__PURE__ */ C(m, {
1623
1704
  disabled: Q,
1624
- icon: De,
1705
+ icon: Oe,
1625
1706
  iconType: "leading",
1626
- onClick: () => H.current?.openReturnModal(),
1707
+ onClick: () => K.current?.openReturnModal(),
1627
1708
  variant: "base-secondary",
1628
1709
  children: "退回"
1629
1710
  }, "task-return") : null,
1630
- /* @__PURE__ */ C(p, {
1711
+ Qe ? /* @__PURE__ */ C(m, {
1631
1712
  disabled: Q,
1632
- icon: ke,
1713
+ icon: Ae,
1633
1714
  iconType: "leading",
1634
- onClick: () => H.current?.openTransferModal(),
1715
+ onClick: () => K.current?.openTransferModal(),
1635
1716
  variant: "base-secondary",
1636
1717
  children: "轉派"
1637
- }, "task-transfer"),
1638
- /* @__PURE__ */ C(p, {
1718
+ }, "task-transfer") : null,
1719
+ Xe ? /* @__PURE__ */ C(m, {
1639
1720
  disabled: Q,
1640
- icon: Ce,
1721
+ icon: we,
1641
1722
  iconType: "leading",
1642
- onClick: () => H.current?.openRejectModal(),
1723
+ onClick: () => K.current?.openRejectModal(),
1643
1724
  variant: "destructive-secondary",
1644
1725
  children: "拒絕"
1645
- }, "task-reject"),
1646
- /* @__PURE__ */ C(p, {
1726
+ }, "task-reject") : null,
1727
+ /* @__PURE__ */ C(m, {
1647
1728
  disabled: Q,
1648
1729
  icon: Se,
1649
1730
  iconType: "leading",
1650
- onClick: () => H.current?.handleApprove(),
1731
+ onClick: () => K.current?.handleApprove(),
1651
1732
  variant: "base-primary",
1652
1733
  children: "同意"
1653
1734
  }, "task-approve")
1654
1735
  ] }) : null
1655
1736
  ]
1656
1737
  }) }),
1657
- /* @__PURE__ */ w(ee, { children: [
1658
- a ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Tt, {
1659
- canResubmitInstance: q,
1660
- deciding: ze,
1661
- error: Ie,
1662
- instance: b,
1663
- loading: Le,
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,
1664
1746
  onResubmitFormChange: (e) => {
1665
- I(e), We({});
1747
+ R(e), I({});
1666
1748
  },
1667
- onResubmitInstance: () => void at(),
1668
- onUploadAttachment: Z,
1669
- resubmitFormData: F,
1749
+ onResubmitInstance: () => void ft(),
1750
+ onUploadAttachment: ct,
1751
+ resubmitFormData: L,
1670
1752
  resubmitFormErrors: Ue
1671
1753
  }) }) : null,
1672
- i ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Dt, {
1673
- attachments: se,
1754
+ a ? /* @__PURE__ */ C(g, { children: /* @__PURE__ */ C(kt, {
1755
+ attachments: ue,
1674
1756
  onDownload: (e) => {
1675
- nt(e);
1757
+ lt(e);
1676
1758
  },
1677
1759
  onPreview: (e) => {
1678
- rt(e);
1760
+ ut(e);
1679
1761
  }
1680
1762
  }) }) : null,
1681
- f ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Rt, {
1682
- adhocDirectives: B,
1763
+ ee ? /* @__PURE__ */ C(g, { children: /* @__PURE__ */ C(Bt, {
1764
+ adhocDirectives: Ge,
1683
1765
  currentMemberId: v,
1684
- instance: b,
1685
- memberProfilesById: Xe,
1686
- onChanged: X,
1687
- ref: H,
1688
- tasks: T
1766
+ instance: T,
1767
+ memberProfilesById: X,
1768
+ onChanged: st,
1769
+ ref: K,
1770
+ tasks: E
1689
1771
  }) }) : null,
1690
- c ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Vt, {
1691
- signatureVerification: _e,
1692
- signatures: he
1772
+ p ? /* @__PURE__ */ C(g, { children: /* @__PURE__ */ C(Ut, {
1773
+ signatureVerification: ye,
1774
+ signatures: ge
1693
1775
  }) }) : null,
1694
- o ? /* @__PURE__ */ C(_, { children: /* @__PURE__ */ C(Jt, {
1695
- activityLogs: y,
1696
- instanceState: b?.state ?? "RUNNING",
1697
- memberProfilesById: Xe,
1698
- signatureVerification: _e,
1699
- signaturesById: $e,
1700
- taskDecisionsByTaskId: Qe,
1701
- tasks: T,
1702
- 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,
1703
1785
  workflowTokens: D
1704
1786
  }) }) : null
1705
1787
  ] }),
1706
- b ? /* @__PURE__ */ C(h, {
1788
+ T ? /* @__PURE__ */ C(h, {
1707
1789
  modalType: "standard",
1708
1790
  onClose: () => M(!1),
1709
1791
  open: j,
1710
1792
  showModalHeader: !0,
1711
1793
  size: "wide",
1712
- supportingText: `${W(b.state)} · ${t(b.startedAt)}`,
1794
+ supportingText: `${Je(T.state)} · ${t(T.startedAt)}`,
1713
1795
  title: "流程圖",
1714
1796
  children: /* @__PURE__ */ w("div", {
1715
- style: Zt,
1797
+ style: $t,
1716
1798
  children: [/* @__PURE__ */ C("div", {
1717
- style: Qt,
1718
- children: /* @__PURE__ */ w(k, {
1719
- edges: Y,
1799
+ style: en,
1800
+ children: /* @__PURE__ */ w(ze, {
1801
+ edges: at,
1720
1802
  fitView: !0,
1721
1803
  fitViewOptions: { padding: .18 },
1722
1804
  maxZoom: 1.2,
1723
1805
  minZoom: .2,
1724
- nodes: et,
1806
+ nodes: it,
1725
1807
  nodesDraggable: !1,
1726
1808
  nodesFocusable: !1,
1727
- nodeTypes: sn,
1809
+ nodeTypes: ln,
1728
1810
  panOnDrag: !0,
1729
1811
  proOptions: { hideAttribution: !0 },
1730
- children: [/* @__PURE__ */ C(Pe, {}), /* @__PURE__ */ C(Fe, { showInteractive: !1 })]
1812
+ children: [/* @__PURE__ */ C(Ie, {}), /* @__PURE__ */ C(Le, { showInteractive: !1 })]
1731
1813
  })
1732
- }), tt.length > 0 ? /* @__PURE__ */ C("div", {
1733
- style: rn,
1734
- children: tt.map((e) => /* @__PURE__ */ C("span", {
1735
- style: an,
1814
+ }), ot.length > 0 ? /* @__PURE__ */ C("div", {
1815
+ style: on,
1816
+ children: ot.map((e) => /* @__PURE__ */ C("span", {
1817
+ style: sn,
1736
1818
  children: e
1737
1819
  }, e))
1738
1820
  }) : null]
@@ -1741,73 +1823,73 @@ function cn({ instanceId: r, showAttachments: i = !0, showForm: a = !0, showHist
1741
1823
  /* @__PURE__ */ C(h, {
1742
1824
  modalType: "standard",
1743
1825
  onClose: () => {
1744
- R(null), z(null);
1826
+ H(null), W(null);
1745
1827
  },
1746
- open: !!(L && Ge),
1828
+ open: !!(V && U),
1747
1829
  showModalHeader: !0,
1748
1830
  size: "wide",
1749
- supportingText: L?.filename ?? void 0,
1831
+ supportingText: V?.filename ?? void 0,
1750
1832
  title: "PDF 預覽",
1751
- children: Ge ? /* @__PURE__ */ C(P, {
1752
- filename: L?.filename ?? "PDF 預覽",
1753
- fileUrl: Ge,
1754
- onDownload: L ? () => void nt(L) : void 0
1833
+ children: U ? /* @__PURE__ */ C(We, {
1834
+ filename: V?.filename ?? "PDF 預覽",
1835
+ fileUrl: U,
1836
+ onDownload: V ? () => void lt(V) : void 0
1755
1837
  }) : null
1756
1838
  }),
1757
1839
  /* @__PURE__ */ C(h, {
1758
1840
  cancelText: "保留案件",
1759
1841
  confirmButtonProps: { variant: "destructive-primary" },
1760
1842
  confirmText: "確認取消",
1761
- loading: ze,
1843
+ loading: Ve,
1762
1844
  modalStatusType: "error",
1763
1845
  modalType: "standard",
1764
- onCancel: () => N(!1),
1765
- onClose: () => N(!1),
1766
- onConfirm: () => void it(),
1846
+ onCancel: () => F(!1),
1847
+ onClose: () => F(!1),
1848
+ onConfirm: () => void dt(),
1767
1849
  open: He,
1768
1850
  showModalFooter: !0,
1769
1851
  showModalHeader: !0,
1770
1852
  supportingText: "取消後會關閉目前待簽任務與候選簽核人。",
1771
1853
  title: "取消案件",
1772
1854
  children: /* @__PURE__ */ w("div", {
1773
- style: on,
1855
+ style: cn,
1774
1856
  children: [/* @__PURE__ */ w(x, {
1775
1857
  variant: "body",
1776
1858
  children: [
1777
1859
  "確定要取消「",
1778
- b?.title ?? "",
1860
+ T?.title ?? "",
1779
1861
  "」嗎?"
1780
1862
  ]
1781
1863
  }), /* @__PURE__ */ C(n, {
1782
1864
  label: "取消原因",
1783
1865
  name: "cancelComment",
1784
- children: /* @__PURE__ */ C(ne, {
1785
- onChange: (e) => Ve(e.target.value),
1866
+ children: /* @__PURE__ */ C(y, {
1867
+ onChange: (e) => P(e.target.value),
1786
1868
  placeholder: "可填寫取消原因",
1787
1869
  resize: "vertical",
1788
1870
  rows: 3,
1789
- value: Be
1871
+ value: N
1790
1872
  })
1791
1873
  })]
1792
1874
  })
1793
1875
  })
1794
1876
  ] });
1795
1877
  }
1796
- function ln(e) {
1878
+ function dn(e) {
1797
1879
  return e.data.label ? e.data.label : e.data.isDefault ? "其他情況" : e.data.condition ?? "";
1798
1880
  }
1799
- function un(e) {
1800
- 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);
1801
1883
  }
1802
- function dn(e) {
1884
+ function pn(e) {
1803
1885
  return e === "startEvent" ? "開始" : e === "endEvent" ? "完成" : e === "userTask" ? "簽核節點" : e === "serviceTask" ? "知會節點" : e === "exclusiveGateway" ? "條件分流" : "平行處理";
1804
1886
  }
1805
- function fn(e, t, n, r) {
1887
+ function mn(e, t, n, r) {
1806
1888
  return e.nodes.map((e) => {
1807
- let i = vt(e, t, n, r);
1889
+ let i = bt(e, t, n, r);
1808
1890
  return {
1809
1891
  data: {
1810
- kindLabel: dn(e.type),
1892
+ kindLabel: pn(e.type),
1811
1893
  label: e.data.label,
1812
1894
  secondaryLabel: i.secondaryLabel,
1813
1895
  statusLabel: i.statusLabel,
@@ -1821,36 +1903,36 @@ function fn(e, t, n, r) {
1821
1903
  };
1822
1904
  });
1823
1905
  }
1824
- function pn(e) {
1825
- let t = new Le.graphlib.Graph();
1906
+ function hn(e) {
1907
+ let t = new Be.graphlib.Graph();
1826
1908
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
1827
1909
  nodesep: 56,
1828
1910
  rankdir: "LR",
1829
1911
  ranksep: 120
1830
1912
  }), e.nodes.forEach((e) => {
1831
1913
  t.setNode(e.id, {
1832
- height: Xt,
1833
- width: Yt
1914
+ height: Qt,
1915
+ width: Zt
1834
1916
  });
1835
1917
  }), e.edges.forEach((e) => {
1836
1918
  t.setEdge(e.source, e.target);
1837
- }), Le.layout(t), {
1919
+ }), Be.layout(t), {
1838
1920
  ...e,
1839
1921
  nodes: e.nodes.map((e) => {
1840
1922
  let n = t.node(e.id);
1841
1923
  return n ? {
1842
1924
  ...e,
1843
1925
  position: {
1844
- x: n.x - Yt / 2,
1845
- y: n.y - Xt / 2
1926
+ x: n.x - Zt / 2,
1927
+ y: n.y - Qt / 2
1846
1928
  }
1847
1929
  } : e;
1848
1930
  })
1849
1931
  };
1850
1932
  }
1851
- function mn(e) {
1933
+ function gn(e) {
1852
1934
  return e.edges.map((e) => {
1853
- let t = ln(e);
1935
+ let t = dn(e);
1854
1936
  return {
1855
1937
  animated: !1,
1856
1938
  id: e.id,
@@ -1878,25 +1960,25 @@ function mn(e) {
1878
1960
  };
1879
1961
  });
1880
1962
  }
1881
- function hn(e) {
1963
+ function _n(e) {
1882
1964
  return e === "current" ? {
1883
- ...$t,
1965
+ ...tn,
1884
1966
  border: "1px solid var(--mzn-color-primary, #0057ff)",
1885
1967
  boxShadow: "0 0 0 3px rgba(0, 87, 255, 0.14)"
1886
1968
  } : e === "completed" ? {
1887
- ...$t,
1969
+ ...tn,
1888
1970
  border: "1px solid #16a34a"
1889
1971
  } : e === "cancelled" ? {
1890
- ...$t,
1972
+ ...tn,
1891
1973
  border: "1px solid #dc2626",
1892
1974
  opacity: .72
1893
1975
  } : e === "waiting" ? {
1894
- ...$t,
1976
+ ...tn,
1895
1977
  border: "1px dashed #64748b"
1896
- } : $t;
1978
+ } : tn;
1897
1979
  }
1898
- function gn(e) {
1899
- let t = en;
1980
+ function vn(e) {
1981
+ let t = nn;
1900
1982
  return e === "current" ? {
1901
1983
  ...t,
1902
1984
  background: "#eff6ff",
@@ -1919,14 +2001,14 @@ function gn(e) {
1919
2001
  color: "#64748b"
1920
2002
  };
1921
2003
  }
1922
- function _n({ data: e }) {
2004
+ function yn({ data: e }) {
1923
2005
  return /* @__PURE__ */ w("div", {
1924
- style: hn(e.tone),
2006
+ style: _n(e.tone),
1925
2007
  children: [
1926
- /* @__PURE__ */ C(Ie, {
2008
+ /* @__PURE__ */ C(Re, {
1927
2009
  isConnectable: !1,
1928
2010
  position: O.Left,
1929
- style: nn,
2011
+ style: an,
1930
2012
  type: "target"
1931
2013
  }),
1932
2014
  /* @__PURE__ */ C(x, {
@@ -1937,24 +2019,24 @@ function _n({ data: e }) {
1937
2019
  children: e.label
1938
2020
  }),
1939
2021
  /* @__PURE__ */ C("span", {
1940
- style: gn(e.tone),
2022
+ style: vn(e.tone),
1941
2023
  children: e.statusLabel
1942
2024
  }),
1943
2025
  /* @__PURE__ */ C("span", {
1944
2026
  title: e.secondaryLabel,
1945
- style: tn,
2027
+ style: rn,
1946
2028
  children: e.secondaryLabel || e.kindLabel
1947
2029
  }),
1948
- /* @__PURE__ */ C(Ie, {
2030
+ /* @__PURE__ */ C(Re, {
1949
2031
  isConnectable: !1,
1950
2032
  position: O.Right,
1951
- style: nn,
2033
+ style: an,
1952
2034
  type: "source"
1953
2035
  })
1954
2036
  ]
1955
2037
  });
1956
2038
  }
1957
2039
  //#endregion
1958
- 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 };
1959
2041
 
1960
- //# sourceMappingURL=detail-Cts5_gVp.js.map
2042
+ //# sourceMappingURL=detail-DAak2OXS.js.map