@rytass/bpm-core-react 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/README.md +13 -1
  3. package/dist/chunks/app-navigation-BSkMsEhy.js +268 -0
  4. package/dist/chunks/app-navigation-BSkMsEhy.js.map +1 -0
  5. package/dist/chunks/app-navigation-KnlJCUp1.cjs +2 -0
  6. package/dist/chunks/app-navigation-KnlJCUp1.cjs.map +1 -0
  7. package/dist/chunks/approval-instance-list-page-CVXgE2K3.cjs +2 -0
  8. package/dist/chunks/approval-instance-list-page-CVXgE2K3.cjs.map +1 -0
  9. package/dist/chunks/{approval-instance-list-page-BgE4vQw8.js → approval-instance-list-page-CqNdoZqx.js} +103 -99
  10. package/dist/chunks/approval-instance-list-page-CqNdoZqx.js.map +1 -0
  11. package/dist/chunks/builder-CMlJfQHE.cjs +3 -0
  12. package/dist/chunks/builder-CMlJfQHE.cjs.map +1 -0
  13. package/dist/chunks/{builder-Du_0apkh.js → builder-D950gct_.js} +436 -432
  14. package/dist/chunks/builder-D950gct_.js.map +1 -0
  15. package/dist/chunks/categories-5yEM3p3N.cjs +2 -0
  16. package/dist/chunks/categories-5yEM3p3N.cjs.map +1 -0
  17. package/dist/chunks/categories-BIpOG451.js +387 -0
  18. package/dist/chunks/categories-BIpOG451.js.map +1 -0
  19. package/dist/chunks/dashboard-page-1K_jQXQk.cjs +2 -0
  20. package/dist/chunks/dashboard-page-1K_jQXQk.cjs.map +1 -0
  21. package/dist/chunks/dashboard-page-R_T2OEiE.js +122 -0
  22. package/dist/chunks/dashboard-page-R_T2OEiE.js.map +1 -0
  23. package/dist/chunks/delegations-B2j-wNEO.js +646 -0
  24. package/dist/chunks/delegations-B2j-wNEO.js.map +1 -0
  25. package/dist/chunks/delegations-CsB9ozLu.cjs +2 -0
  26. package/dist/chunks/delegations-CsB9ozLu.cjs.map +1 -0
  27. package/dist/chunks/delegations-CvtwTXNP.cjs +2 -0
  28. package/dist/chunks/delegations-CvtwTXNP.cjs.map +1 -0
  29. package/dist/chunks/delegations-dKodb0WW.js +573 -0
  30. package/dist/chunks/delegations-dKodb0WW.js.map +1 -0
  31. package/dist/chunks/detail-BcGAqJ_R.js +1523 -0
  32. package/dist/chunks/detail-BcGAqJ_R.js.map +1 -0
  33. package/dist/chunks/detail-CqjqLd65.cjs +2 -0
  34. package/dist/chunks/detail-CqjqLd65.cjs.map +1 -0
  35. package/dist/chunks/{format-date-time-hKLVMxq4.cjs → format-date-time-26_pFvv4.cjs} +2 -2
  36. package/dist/chunks/{format-date-time-hKLVMxq4.cjs.map → format-date-time-26_pFvv4.cjs.map} +1 -1
  37. package/dist/chunks/notifications-2swRqDPF.js +198 -0
  38. package/dist/chunks/notifications-2swRqDPF.js.map +1 -0
  39. package/dist/chunks/notifications-BaYDebFt.cjs +2 -0
  40. package/dist/chunks/notifications-BaYDebFt.cjs.map +1 -0
  41. package/dist/chunks/{orgs-c29y74w2.js → orgs-CuHxxd_n.js} +665 -661
  42. package/dist/chunks/orgs-CuHxxd_n.js.map +1 -0
  43. package/dist/chunks/orgs-YMiVLNvL.cjs +2 -0
  44. package/dist/chunks/orgs-YMiVLNvL.cjs.map +1 -0
  45. package/dist/chunks/routes-config-2aKbWq2H.cjs +2 -0
  46. package/dist/chunks/routes-config-2aKbWq2H.cjs.map +1 -0
  47. package/dist/chunks/routes-config-dxahImVe.js +43 -0
  48. package/dist/chunks/routes-config-dxahImVe.js.map +1 -0
  49. package/dist/chunks/templates-DTkbSgFY.cjs +2 -0
  50. package/dist/chunks/templates-DTkbSgFY.cjs.map +1 -0
  51. package/dist/chunks/{templates-Dn9QHFSy.js → templates-DoDWM68t.js} +136 -132
  52. package/dist/chunks/templates-DoDWM68t.js.map +1 -0
  53. package/dist/chunks/users-3ySyUW4u.cjs +2 -0
  54. package/dist/chunks/users-3ySyUW4u.cjs.map +1 -0
  55. package/dist/chunks/users-sMfrSjRQ.js +219 -0
  56. package/dist/chunks/users-sMfrSjRQ.js.map +1 -0
  57. package/dist/components/app-navigation.d.ts +17 -10
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.ts +1 -0
  61. package/dist/index.js +101 -99
  62. package/dist/index.js.map +1 -1
  63. package/dist/lib/notification-drawer-provider.d.ts +1 -1
  64. package/dist/lib/notification-unread-provider.d.ts +1 -1
  65. package/dist/lib/providers.d.ts +1 -1
  66. package/dist/lib/routes-config.d.ts +96 -0
  67. package/dist/next/index.cjs +1 -1
  68. package/dist/next/index.cjs.map +1 -1
  69. package/dist/next/index.d.ts +1 -0
  70. package/dist/next/index.js +22 -21
  71. package/dist/next/index.js.map +1 -1
  72. package/dist/pages/admin/delegations/index.cjs +1 -1
  73. package/dist/pages/admin/delegations/index.js +1 -1
  74. package/dist/pages/admin/orgs/index.cjs +1 -1
  75. package/dist/pages/admin/orgs/index.js +1 -1
  76. package/dist/pages/admin/users/index.cjs +1 -1
  77. package/dist/pages/admin/users/index.js +1 -1
  78. package/dist/pages/delegations/index.cjs +1 -1
  79. package/dist/pages/delegations/index.js +1 -1
  80. package/dist/pages/forms/builder/index.cjs +1 -1
  81. package/dist/pages/forms/builder/index.js +1 -1
  82. package/dist/pages/instances/detail/index.cjs +1 -1
  83. package/dist/pages/instances/detail/index.js +1 -1
  84. package/dist/pages/settings/notifications/index.cjs +1 -1
  85. package/dist/pages/settings/notifications/index.js +1 -1
  86. package/dist/pages/templates/categories/index.cjs +1 -1
  87. package/dist/pages/templates/categories/index.js +1 -1
  88. package/dist/pages/templates/index.cjs +1 -1
  89. package/dist/pages/templates/index.js +1 -1
  90. package/dist/views/admin/delegations/index.cjs +1 -1
  91. package/dist/views/admin/delegations/index.js +1 -1
  92. package/dist/views/admin/index.cjs +1 -1
  93. package/dist/views/admin/index.js +3 -3
  94. package/dist/views/admin/orgs/index.cjs +1 -1
  95. package/dist/views/admin/orgs/index.js +1 -1
  96. package/dist/views/admin/users/index.cjs +1 -1
  97. package/dist/views/admin/users/index.js +1 -1
  98. package/dist/views/cc/index.cjs +1 -1
  99. package/dist/views/cc/index.js +1 -1
  100. package/dist/views/dashboard/index.cjs +1 -1
  101. package/dist/views/dashboard/index.js +1 -1
  102. package/dist/views/delegations/index.cjs +1 -1
  103. package/dist/views/delegations/index.js +1 -1
  104. package/dist/views/forms/builder/index.cjs +1 -1
  105. package/dist/views/forms/builder/index.js +1 -1
  106. package/dist/views/forms/index.cjs +1 -1
  107. package/dist/views/forms/index.cjs.map +1 -1
  108. package/dist/views/forms/index.js +84 -80
  109. package/dist/views/forms/index.js.map +1 -1
  110. package/dist/views/inbox/index.cjs +1 -1
  111. package/dist/views/inbox/index.cjs.map +1 -1
  112. package/dist/views/inbox/index.js +83 -79
  113. package/dist/views/inbox/index.js.map +1 -1
  114. package/dist/views/instances/detail/index.cjs +1 -1
  115. package/dist/views/instances/detail/index.js +1 -1
  116. package/dist/views/instances/new/index.cjs +1 -1
  117. package/dist/views/instances/new/index.cjs.map +1 -1
  118. package/dist/views/instances/new/index.js +107 -100
  119. package/dist/views/instances/new/index.js.map +1 -1
  120. package/dist/views/search/index.cjs +1 -1
  121. package/dist/views/search/index.js +1 -1
  122. package/dist/views/sent/index.cjs +1 -1
  123. package/dist/views/sent/index.js +1 -1
  124. package/dist/views/settings/index.cjs +1 -1
  125. package/dist/views/settings/index.js +1 -1
  126. package/dist/views/settings/notifications/index.cjs +1 -1
  127. package/dist/views/settings/notifications/index.js +1 -1
  128. package/dist/views/templates/categories/index.cjs +1 -1
  129. package/dist/views/templates/categories/index.js +1 -1
  130. package/dist/views/templates/designer/index.cjs +6 -6
  131. package/dist/views/templates/designer/index.cjs.map +1 -1
  132. package/dist/views/templates/designer/index.js +758 -754
  133. package/dist/views/templates/designer/index.js.map +1 -1
  134. package/dist/views/templates/index.cjs +1 -1
  135. package/dist/views/templates/index.js +2 -2
  136. package/dist/views/templates/versions/index.cjs +1 -1
  137. package/dist/views/templates/versions/index.cjs.map +1 -1
  138. package/dist/views/templates/versions/index.js +47 -43
  139. package/dist/views/templates/versions/index.js.map +1 -1
  140. package/package.json +3 -3
  141. package/dist/chunks/app-navigation-BRRFCkxZ.cjs +0 -2
  142. package/dist/chunks/app-navigation-BRRFCkxZ.cjs.map +0 -1
  143. package/dist/chunks/app-navigation-rxhpHCch.js +0 -262
  144. package/dist/chunks/app-navigation-rxhpHCch.js.map +0 -1
  145. package/dist/chunks/approval-instance-list-page-2vUWc5-c.cjs +0 -2
  146. package/dist/chunks/approval-instance-list-page-2vUWc5-c.cjs.map +0 -1
  147. package/dist/chunks/approval-instance-list-page-BgE4vQw8.js.map +0 -1
  148. package/dist/chunks/builder-B8X-m6C5.cjs +0 -3
  149. package/dist/chunks/builder-B8X-m6C5.cjs.map +0 -1
  150. package/dist/chunks/builder-Du_0apkh.js.map +0 -1
  151. package/dist/chunks/categories-DG4k7S8V.js +0 -383
  152. package/dist/chunks/categories-DG4k7S8V.js.map +0 -1
  153. package/dist/chunks/categories-DshBQG33.cjs +0 -2
  154. package/dist/chunks/categories-DshBQG33.cjs.map +0 -1
  155. package/dist/chunks/dashboard-page-CTBwpu_D.js +0 -114
  156. package/dist/chunks/dashboard-page-CTBwpu_D.js.map +0 -1
  157. package/dist/chunks/dashboard-page-DcDiWQp2.cjs +0 -2
  158. package/dist/chunks/dashboard-page-DcDiWQp2.cjs.map +0 -1
  159. package/dist/chunks/delegations-BAZQbElH.js +0 -642
  160. package/dist/chunks/delegations-BAZQbElH.js.map +0 -1
  161. package/dist/chunks/delegations-DzrckrPp.js +0 -569
  162. package/dist/chunks/delegations-DzrckrPp.js.map +0 -1
  163. package/dist/chunks/delegations-Z8hTajLj.cjs +0 -2
  164. package/dist/chunks/delegations-Z8hTajLj.cjs.map +0 -1
  165. package/dist/chunks/delegations-hb9JoVZe.cjs +0 -2
  166. package/dist/chunks/delegations-hb9JoVZe.cjs.map +0 -1
  167. package/dist/chunks/detail-DilI0PPe.js +0 -1519
  168. package/dist/chunks/detail-DilI0PPe.js.map +0 -1
  169. package/dist/chunks/detail-DuRg3Y7b.cjs +0 -2
  170. package/dist/chunks/detail-DuRg3Y7b.cjs.map +0 -1
  171. package/dist/chunks/notifications-B2Lk3grg.js +0 -194
  172. package/dist/chunks/notifications-B2Lk3grg.js.map +0 -1
  173. package/dist/chunks/notifications-C8ADhnxF.cjs +0 -2
  174. package/dist/chunks/notifications-C8ADhnxF.cjs.map +0 -1
  175. package/dist/chunks/orgs-CGv3VNDR.cjs +0 -2
  176. package/dist/chunks/orgs-CGv3VNDR.cjs.map +0 -1
  177. package/dist/chunks/orgs-c29y74w2.js.map +0 -1
  178. package/dist/chunks/templates-Cd0WFheA.cjs +0 -2
  179. package/dist/chunks/templates-Cd0WFheA.cjs.map +0 -1
  180. package/dist/chunks/templates-Dn9QHFSy.js.map +0 -1
  181. package/dist/chunks/users-B-trMu0E.cjs +0 -2
  182. package/dist/chunks/users-B-trMu0E.cjs.map +0 -1
  183. package/dist/chunks/users-itVXXRj7.js +0 -215
  184. package/dist/chunks/users-itVXXRj7.js.map +0 -1
@@ -1,33 +1,34 @@
1
1
  "use client";
2
2
  import { a as e } from "../../../chunks/auth-provider-Bnox5gsx.js";
3
- import { t } from "../../../chunks/app-navigation-rxhpHCch.js";
4
- import { a as n, n as r, o as i, r as a } from "../../../chunks/admin-pickers-DLlG_1du.js";
5
- import { t as o } from "../../../chunks/bpm-form-field-Cao0rMol.js";
6
- import { useCallback as s, useEffect as c, useMemo as l, useRef as ee, useState as u } from "react";
7
- import { AutoComplete as te, Button as d, Icon as ne, Input as re, Layout as ie, Modal as ae, PageHeader as oe, Section as se, SectionGroup as ce, Select as f, Textarea as le, Toggle as ue, Typography as p } from "@mezzanine-ui/react";
8
- import { Fragment as de, jsx as m, jsxs as h } from "react/jsx-runtime";
9
- import { CheckedIcon as fe, DotGridIcon as pe, EyeIcon as me, FilterIcon as he, MailIcon as ge, SaveIcon as _e, TrashIcon as ve, UserIcon as ye } from "@mezzanine-ui/icons";
10
- import be from "@mezzanine-ui/react/ContentHeader";
11
- import { readOrganizationDashboard as xe } from "@rytass/bpm-core-client/organization";
12
- import { Background as Se, ConnectionMode as Ce, ControlButton as we, Controls as Te, Handle as g, MiniMap as Ee, Panel as _, Position as v, ReactFlow as De, applyNodeChanges as Oe, getViewportForBounds as ke } from "@xyflow/react";
13
- import * as Ae from "dagre";
14
- import { dryRunApprovalWorkflow as je, forkApprovalTemplate as Me, publishApprovalTemplateVersion as Ne, readTemplateDesigner as Pe, resolveMemberOptions as Fe, searchMemberOptions as Ie, searchPublishedFormVersionOptions as Le, updateApprovalTemplateDraft as Re } from "@rytass/bpm-core-client/template";
3
+ import { t } from "../../../chunks/app-navigation-BSkMsEhy.js";
4
+ import { r as n } from "../../../chunks/routes-config-dxahImVe.js";
5
+ import { a as r, n as i, o as a, r as o } from "../../../chunks/admin-pickers-DLlG_1du.js";
6
+ import { t as s } from "../../../chunks/bpm-form-field-Cao0rMol.js";
7
+ import { useCallback as ee, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
8
+ import { AutoComplete as te, Button as f, Icon as ne, Input as re, Modal as ie, PageHeader as ae, Section as oe, SectionGroup as se, Select as p, Textarea as ce, Toggle as le, Typography as m } from "@mezzanine-ui/react";
9
+ import { Fragment as ue, jsx as h, jsxs as g } from "react/jsx-runtime";
10
+ import { CheckedIcon as de, DotGridIcon as fe, EyeIcon as pe, FilterIcon as me, MailIcon as he, SaveIcon as ge, TrashIcon as _e, UserIcon as ve } from "@mezzanine-ui/icons";
11
+ import ye from "@mezzanine-ui/react/ContentHeader";
12
+ import { readOrganizationDashboard as be } from "@rytass/bpm-core-client/organization";
13
+ import { Background as xe, ConnectionMode as Se, ControlButton as Ce, Controls as we, Handle as Te, MiniMap as Ee, Panel as De, Position as _, ReactFlow as Oe, applyNodeChanges as ke, getViewportForBounds as v } from "@xyflow/react";
14
+ import * as y from "dagre";
15
+ import { dryRunApprovalWorkflow as Ae, forkApprovalTemplate as je, publishApprovalTemplateVersion as Me, readTemplateDesigner as Ne, resolveMemberOptions as Pe, searchMemberOptions as Fe, searchPublishedFormVersionOptions as Ie, updateApprovalTemplateDraft as Le } from "@rytass/bpm-core-client/template";
15
16
  //#region src/views/templates/designer/TemplateDesignerView.tsx
16
- var ze = {
17
+ var Re = {
17
18
  display: "grid",
18
19
  gap: 16
19
- }, Be = {
20
+ }, ze = {
20
21
  alignItems: "start",
21
22
  display: "grid",
22
23
  gap: 16,
23
24
  gridTemplateColumns: "minmax(0, 1fr) 420px"
24
- }, Ve = {
25
+ }, Be = {
25
26
  border: "1px solid var(--mzn-color-border-neutral)",
26
27
  borderRadius: 6,
27
28
  height: 620,
28
29
  minWidth: 0,
29
30
  overflow: "hidden"
30
- }, He = {
31
+ }, Ve = {
31
32
  alignItems: "center",
32
33
  boxSizing: "border-box",
33
34
  color: "var(--mzn-color-text-error)",
@@ -37,21 +38,21 @@ var ze = {
37
38
  lineHeight: 0,
38
39
  padding: 0,
39
40
  width: 26
40
- }, Ue = {
41
+ }, He = {
41
42
  alignItems: "center",
42
43
  display: "flex",
43
44
  height: "100%",
44
45
  justifyContent: "center",
45
46
  width: "100%"
46
- }, We = "workflow-designer-side-panel", y = 96, Ge = `
47
- .${We} .mzn-form-field--stretch .mzn-form-field__label-area,
48
- .${We} .mzn-form-field--horizontal .mzn-form-field__label-area {
49
- flex: 0 0 ${y}px;
50
- width: ${y}px;
47
+ }, Ue = "workflow-designer-side-panel", We = 96, Ge = `
48
+ .${Ue} .mzn-form-field--stretch .mzn-form-field__label-area,
49
+ .${Ue} .mzn-form-field--horizontal .mzn-form-field__label-area {
50
+ flex: 0 0 ${We}px;
51
+ width: ${We}px;
51
52
  }
52
53
 
53
- .${We} .mzn-form-field--stretch .mzn-form-field__data-entry,
54
- .${We} .mzn-form-field--horizontal .mzn-form-field__data-entry {
54
+ .${Ue} .mzn-form-field--stretch .mzn-form-field__data-entry,
55
+ .${Ue} .mzn-form-field--horizontal .mzn-form-field__data-entry {
55
56
  min-width: 0;
56
57
  }
57
58
  `, Ke = "#2563eb", b = "#64748b", qe = "var(--mzn-color-text-error, #dc2626)", Je = "drop-shadow(0 0 3px rgba(0, 87, 255, 0.85)) drop-shadow(0 0 9px rgba(0, 87, 255, 0.36))", Ye = `
@@ -133,31 +134,31 @@ var ze = {
133
134
  padding: "10px 12px",
134
135
  textAlign: "center",
135
136
  width: "100%"
136
- }, tt = "0 8px 20px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--mzn-color-primary, #0057ff), 0 0 10px rgba(0, 87, 255, 0.3)", nt = 64, C = 160, w = 20, T = 64, E = 180, D = {
137
+ }, tt = "0 8px 20px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--mzn-color-primary, #0057ff), 0 0 10px rgba(0, 87, 255, 0.3)", nt = 64, C = 160, rt = 20, it = 64, w = 180, T = {
137
138
  ...S,
138
139
  display: "grid",
139
140
  gap: 8,
140
141
  padding: "10px 12px"
141
- }, rt = {
142
- ...D,
142
+ }, E = {
143
+ ...T,
143
144
  background: "#eff6ff",
144
145
  border: "1px solid #2563eb"
145
- }, O = {
146
- ...D,
146
+ }, D = {
147
+ ...T,
147
148
  background: "#f0fdfa",
148
149
  border: "1px solid #0f766e"
149
- }, it = {
150
+ }, at = {
150
151
  ...S,
151
152
  background: "#ffffff"
152
- }, k = {
153
+ }, O = {
153
154
  ...S,
154
155
  background: "#ecfdf3",
155
156
  border: "1px solid #2f855a"
156
- }, at = {
157
+ }, ot = {
157
158
  ...S,
158
159
  background: "#fff4ed",
159
160
  border: "1px solid #c2410c"
160
- }, ot = {
161
+ }, k = {
161
162
  display: "block",
162
163
  maxWidth: "100%",
163
164
  minWidth: 0
@@ -173,15 +174,15 @@ var ze = {
173
174
  startEvent: "開始",
174
175
  userTask: "簽核"
175
176
  }, lt = [{
176
- icon: ye,
177
+ icon: ve,
177
178
  label: "簽核節點",
178
179
  type: "userTask"
179
180
  }, {
180
- icon: ge,
181
+ icon: he,
181
182
  label: "知會節點",
182
183
  type: "serviceTask"
183
184
  }], ut = [{
184
- icon: he,
185
+ icon: me,
185
186
  label: "條件分流",
186
187
  type: "exclusiveGateway"
187
188
  }], dt = [{
@@ -243,7 +244,7 @@ var ze = {
243
244
  }, {
244
245
  id: "DIRECT",
245
246
  name: "固定改派"
246
- }], ht = [
247
+ }], N = [
247
248
  {
248
249
  id: "EQUALS",
249
250
  name: "等於"
@@ -276,14 +277,14 @@ var ze = {
276
277
  id: "IS_EMPTY",
277
278
  name: "未填寫"
278
279
  }
279
- ], gt = [
280
+ ], ht = [
280
281
  "EQUALS",
281
282
  "GREATER_THAN",
282
283
  "GREATER_THAN_OR_EQUALS",
283
284
  "LESS_THAN",
284
285
  "LESS_THAN_OR_EQUALS",
285
286
  "NOT_EQUALS"
286
- ], _t = [
287
+ ], gt = [
287
288
  {
288
289
  id: "NONE",
289
290
  name: "未設定"
@@ -300,183 +301,183 @@ var ze = {
300
301
  id: "ORG_UNIT_POSITION",
301
302
  name: "指定組織職位"
302
303
  }
303
- ], vt = {
304
+ ], _t = {
304
305
  id: "CUSTOM",
305
306
  name: "既有自訂規則"
306
- }, yt = "member-001", bt = {
307
- endEvent: N,
308
- exclusiveGateway: N,
309
- parallelGateway: N,
310
- serviceTask: N,
311
- startEvent: N,
312
- userTask: N
307
+ }, vt = "member-001", yt = {
308
+ endEvent: P,
309
+ exclusiveGateway: P,
310
+ parallelGateway: P,
311
+ serviceTask: P,
312
+ startEvent: P,
313
+ userTask: P
313
314
  };
314
- function xt({ templateId: n, activeHref: i = "/templates" }) {
315
- let pe = e(), [he, ge] = u(null), [ye, g] = u(null), [_, v] = u(Bt()), [ke, Ae] = u(""), [y, Ke] = u(null), [b, Je] = u(null), [S, tt] = u(null), [nt, C] = u(null), [w, T] = u("start"), [E, D] = u([]), [rt, O] = u(null), [it, k] = u(null), [at, ot] = u(!0), [st, A] = u(!1), [j, ht] = u(!1), [gt, xt] = u([]), N = l(() => JSON.stringify({
316
- formDefinitionVersionId: y,
317
- initiatorPolicyCel: b,
318
- workflowDefinition: _
315
+ function bt({ templateId: r, activeHref: a }) {
316
+ let fe = e(), me = n(), he = a ?? me.templates(), [ve, Te] = d(null), [De, _] = d(null), [v, y] = d(zt()), [We, Ke] = d(""), [b, Je] = d(null), [S, tt] = d(null), [nt, C] = d(null), [rt, it] = d(null), [w, T] = d("start"), [E, D] = d([]), [at, O] = d(null), [ot, k] = d(null), [st, A] = d(!0), [j, N] = d(!1), [ht, bt] = d(!1), [P, St] = d([]), Ct = l(() => JSON.stringify({
317
+ formDefinitionVersionId: b,
318
+ initiatorPolicyCel: S,
319
+ workflowDefinition: v
319
320
  }), [
320
- y,
321
321
  b,
322
- _
323
- ]), Ct = !!ke && N !== ke, [wt, Tt] = u(!1), [P, F] = u([]), [I, Dt] = u([]), [L, Mt] = u([]), [Nt, Lt] = u([]), [Rt, zt] = u(!1), [Qt, tn] = u(!1), [rn, B] = u("{}"), [V, ln] = u(null), [pn, hn] = u(null), [H, U] = u(void 0), En = ee(null);
322
+ S,
323
+ v
324
+ ]), wt = !!We && Ct !== We, [Tt, F] = d(!1), [I, Dt] = d([]), [L, Mt] = d([]), [R, It] = d([]), [Lt, Rt] = d([]), [Zt, en] = d(!1), [nn, V] = d(!1), [H, cn] = d("{}"), [U, pn] = d(null), [W, G] = d(null), [wn, Tn] = d(void 0), En = u(null);
324
325
  c(() => {
325
- $n();
326
- }, [n]), c(() => {
326
+ er();
327
+ }, [r]), c(() => {
327
328
  function e(e) {
328
- Ct && (e.preventDefault(), e.returnValue = "");
329
+ wt && (e.preventDefault(), e.returnValue = "");
329
330
  }
330
331
  return window.addEventListener("beforeunload", e), () => {
331
332
  window.removeEventListener("beforeunload", e);
332
333
  };
333
- }, [Ct]), c(() => {
334
- rr(_);
335
- }, [_, P]), c(() => {
336
- v((e) => jt(e));
337
- }, [_.edges, _.nodes]);
334
+ }, [wt]), c(() => {
335
+ ar(v);
336
+ }, [v, I]), c(() => {
337
+ y((e) => jt(e));
338
+ }, [v.edges, v.nodes]);
338
339
  function Dn() {
339
- Ct && !window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?") || pe.push("/templates");
340
+ wt && !window.confirm("目前有尚未儲存的流程草稿,確定要離開嗎?") || fe.push(me.templates());
340
341
  }
341
- let W = l(() => _.nodes.find((e) => e.id === w) ?? null, [w, _.nodes]), On = W ? cn(W) : !1, An = E.length > 0 || On, Nn = s(() => {
342
- let e = W && cn(W) ? W.id : null;
343
- v((t) => ({
342
+ let K = l(() => v.nodes.find((e) => e.id === w) ?? null, [w, v.nodes]), jn = K ? sn(K) : !1, Mn = E.length > 0 || jn, Nn = ee(() => {
343
+ let e = K && sn(K) ? K.id : null;
344
+ y((t) => ({
344
345
  ...t,
345
346
  edges: t.edges.filter((t) => !E.includes(t.id) && t.source !== e && t.target !== e),
346
347
  nodes: e ? t.nodes.filter((t) => t.id !== e) : t.nodes
347
348
  })), D([]), O(null), e && T("start");
348
- }, [E, W]);
349
+ }, [E, K]);
349
350
  c(() => {
350
- if (!An) return;
351
+ if (!Mn) return;
351
352
  function e(e) {
352
- e.key !== "Delete" && e.key !== "Backspace" || un(e.target) || (e.preventDefault(), Nn());
353
+ e.key !== "Delete" && e.key !== "Backspace" || ln(e.target) || (e.preventDefault(), Nn());
353
354
  }
354
355
  return window.addEventListener("keydown", e), () => {
355
356
  window.removeEventListener("keydown", e);
356
357
  };
357
- }, [An, Nn]);
358
- let Pn = l(() => _.edges.find((e) => e.id === rt) ?? null, [rt, _.edges]), Fn = l(() => E.length === 1 ? _.edges.find((e) => e.id === E[0]) ?? null : null, [E, _.edges]), In = l(() => E.map((e) => _.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [E, _.edges]), G = l(() => nt ?? $t(b, S), [
359
- b,
360
- nt,
361
- S
362
- ]), zn = l(() => _.nodes.map((e) => Et(e, P, I, L, e.id === w, G)), [
363
- G,
364
- P,
358
+ }, [Mn, Nn]);
359
+ let Pn = l(() => v.edges.find((e) => e.id === at) ?? null, [at, v.edges]), Fn = l(() => E.length === 1 ? v.edges.find((e) => e.id === E[0]) ?? null : null, [E, v.edges]), q = l(() => E.map((e) => v.edges.find((t) => t.id === e) ?? null).filter((e) => !!e), [E, v.edges]), J = l(() => rt ?? Qt(S, nt), [
360
+ S,
361
+ rt,
362
+ nt
363
+ ]), Jn = l(() => v.nodes.map((e) => Et(e, I, L, R, e.id === w, J)), [
364
+ J,
365
365
  I,
366
366
  L,
367
+ R,
367
368
  w,
368
- _.nodes
369
- ]), Gn = l(() => _.edges.map((e) => Ot(e, _.nodes, E.includes(e.id))), [
369
+ v.nodes
370
+ ]), Yn = l(() => v.edges.map((e) => Ot(e, v.nodes, E.includes(e.id))), [
370
371
  E,
371
- _.edges,
372
- _.nodes
373
- ]), K = l(() => z(gt, y) ?? z(dn(he?.formVersions ?? []), y), [
374
- y,
375
- gt,
376
- he?.formVersions
377
- ]), Zn = l(() => vn(gt, K), [gt, K]), q = l(() => Rn(_), [_]), J = l(() => Bn(_), [_]), Y = l(() => en(G), [G]);
378
- async function $n() {
379
- ot(!0), k(null);
372
+ v.edges,
373
+ v.nodes
374
+ ]), Y = l(() => B(P, b) ?? B(un(ve?.formVersions ?? []), b), [
375
+ b,
376
+ P,
377
+ ve?.formVersions
378
+ ]), Zn = l(() => gn(P, Y), [P, Y]), X = l(() => Ln(v), [v]), Z = l(() => Rn(v), [v]), $n = l(() => $t(J), [J]);
379
+ async function er() {
380
+ A(!0), k(null);
380
381
  try {
381
- let [e, t] = await Promise.all([Pe(n), xe()]), r = e.versions.find((e) => e.status === "DRAFT") ?? null, i = r ?? e.versions[0] ?? null;
382
- ge(e), g(r), Dt(t.orgUnits), Mt(t.positions), Lt(t.memberships), xt(dn(e.formVersions));
383
- let a = i?.workflowDefinition ?? Bt(), o = i?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, s = i?.initiatorPolicyCel ?? null;
384
- v(a), Ke(o), Je(s), Ae(JSON.stringify({
382
+ let [e, t] = await Promise.all([Ne(r), be()]), n = e.versions.find((e) => e.status === "DRAFT") ?? null, i = n ?? e.versions[0] ?? null;
383
+ Te(e), _(n), Mt(t.orgUnits), It(t.positions), Rt(t.memberships), St(un(e.formVersions));
384
+ let a = i?.workflowDefinition ?? zt(), o = i?.formDefinitionVersionId ?? e.formVersions[0]?.id ?? null, s = i?.initiatorPolicyCel ?? null;
385
+ y(a), Je(o), tt(s), Ke(JSON.stringify({
385
386
  formDefinitionVersionId: o,
386
387
  initiatorPolicyCel: s,
387
388
  workflowDefinition: a
388
- })), tt(i && !e.template.currentVersionId && !i.initiatorPolicyCel && Vt(i.workflowDefinition) ? "NONE" : null), C(null), T(i?.workflowDefinition.nodes[0]?.id ?? "start"), D([]), O(null);
389
+ })), C(i && !e.template.currentVersionId && !i.initiatorPolicyCel && Bt(i.workflowDefinition) ? "NONE" : null), it(null), T(i?.workflowDefinition.nodes[0]?.id ?? "start"), D([]), O(null);
389
390
  } catch (e) {
390
- k(Q(e));
391
+ k(nr(e));
391
392
  } finally {
392
- ot(!1);
393
+ A(!1);
393
394
  }
394
395
  }
395
- async function tr(e) {
396
- ht(!0), k(null);
396
+ async function rr(e) {
397
+ bt(!0), k(null);
397
398
  try {
398
- xt(vn(dn(await Le(e)), K));
399
+ St(gn(un(await Ie(e)), Y));
399
400
  } catch (e) {
400
- k(Q(e));
401
+ k(nr(e));
401
402
  } finally {
402
- ht(!1);
403
+ bt(!1);
403
404
  }
404
405
  }
405
- async function Z(e) {
406
- Tt(!0), k(null);
406
+ async function ir(e) {
407
+ F(!0), k(null);
407
408
  try {
408
- let t = await Ie(e);
409
- F((e) => jn(e, yn(t)));
409
+ let t = await Fe(e);
410
+ Dt((e) => kn(e, _n(t)));
410
411
  } catch (e) {
411
- k(Q(e));
412
+ k(nr(e));
412
413
  } finally {
413
- Tt(!1);
414
+ F(!1);
414
415
  }
415
416
  }
416
- async function rr(e) {
417
- let t = Mn(e).filter((e) => !P.some((t) => t.memberId === e));
417
+ async function ar(e) {
418
+ let t = An(e).filter((e) => !I.some((t) => t.memberId === e));
418
419
  if (t.length !== 0) try {
419
- let e = await Fe(t);
420
- F((t) => jn(t, yn(e)));
420
+ let e = await Pe(t);
421
+ Dt((t) => kn(t, _n(e)));
421
422
  } catch {
422
- F((e) => jn(e, t.map(bn)));
423
+ Dt((e) => kn(e, t.map(vn)));
423
424
  }
424
425
  }
425
- async function ir() {
426
- A(!0), k(null);
426
+ async function or() {
427
+ N(!0), k(null);
427
428
  try {
428
- let e = Rn(_), t = en(G);
429
+ let e = Ln(v), t = $t(J);
429
430
  if (e || t) {
430
431
  let n = e ?? t ?? "流程設定未完成";
431
432
  throw k(n), Error(n);
432
433
  }
433
- let r = await Re({
434
- formDefinitionVersionId: y,
435
- initiatorPolicyCel: b,
436
- versionId: (ye ?? await Me(n)).id,
437
- workflowDefinition: _
434
+ let n = await Le({
435
+ formDefinitionVersionId: b,
436
+ initiatorPolicyCel: S,
437
+ versionId: (De ?? await je(r)).id,
438
+ workflowDefinition: v
438
439
  });
439
- return g(r), await $n(), r;
440
+ return _(n), await er(), n;
440
441
  } catch (e) {
441
- throw k(Q(e)), e;
442
+ throw k(nr(e)), e;
442
443
  } finally {
443
- A(!1);
444
+ N(!1);
444
445
  }
445
446
  }
446
- async function ar() {
447
- A(!0), k(null);
447
+ async function sr() {
448
+ N(!0), k(null);
448
449
  try {
449
- await Ne((await ir()).id), await $n();
450
+ await Me((await or()).id), await er();
450
451
  } catch (e) {
451
- k(Q(e));
452
+ k(nr(e));
452
453
  } finally {
453
- A(!1);
454
+ N(!1);
454
455
  }
455
456
  }
456
- function or() {
457
- B(JSON.stringify(fn(K), null, 2)), ln(null), hn(null), zt(!0);
457
+ function cr() {
458
+ cn(JSON.stringify(dn(Y), null, 2)), pn(null), G(null), en(!0);
458
459
  }
459
- function sr() {
460
- Qt || zt(!1);
460
+ function lr() {
461
+ nn || en(!1);
461
462
  }
462
- async function cr() {
463
- tn(!0), hn(null), ln(null);
463
+ async function ur() {
464
+ V(!0), G(null), pn(null);
464
465
  try {
465
- ln(await je({
466
- formData: mn(rn),
467
- initiatorMemberId: yt,
468
- initiatorMetadataSnapshot: Tn(yt, Nt),
469
- workflowDefinition: _
466
+ pn(await Ae({
467
+ formData: fn(H),
468
+ initiatorMemberId: vt,
469
+ initiatorMetadataSnapshot: Cn(vt, Lt),
470
+ workflowDefinition: v
470
471
  }));
471
472
  } catch (e) {
472
- hn(Q(e));
473
+ G(nr(e));
473
474
  } finally {
474
- tn(!1);
475
+ V(!1);
475
476
  }
476
477
  }
477
- function lr(e) {
478
- let t = Oe(e, zn);
479
- v((e) => ({
478
+ function dr(e) {
479
+ let t = ke(e, Jn);
480
+ y((e) => ({
480
481
  ...e,
481
482
  nodes: e.nodes.map((e) => {
482
483
  let n = t.find((t) => t.id === e.id);
@@ -487,34 +488,34 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
487
488
  })
488
489
  }));
489
490
  }
490
- function ur(e) {
491
- if (!on(e, _.nodes)) return;
492
- let t = _.nodes.some((t) => t.id === e.source && t.type === "exclusiveGateway"), n = R(e.source, e.target, {});
493
- v((e) => ({
491
+ function fr(e) {
492
+ if (!an(e, v.nodes)) return;
493
+ let t = v.nodes.some((t) => t.id === e.source && t.type === "exclusiveGateway"), n = z(e.source, e.target, {});
494
+ y((e) => ({
494
495
  ...e,
495
496
  edges: [...e.edges, n]
496
497
  })), T(null), D([n.id]), O(t ? n.id : null);
497
498
  }
498
- function dr(e, t) {
499
- e.stopPropagation(), D((n) => e.shiftKey || e.metaKey || e.ctrlKey ? sn(n, t.id) : [t.id]), T(null);
499
+ function pr(e, t) {
500
+ e.stopPropagation(), D((n) => e.shiftKey || e.metaKey || e.ctrlKey ? on(n, t.id) : [t.id]), T(null);
500
501
  }
501
- function fr() {
502
+ function mr() {
502
503
  O(null);
503
504
  }
504
- function pr(e) {
505
- let t = It({
506
- definition: _,
507
- node: Pt(e, Ft(_.nodes, e)),
505
+ function hr(e) {
506
+ let t = Ft({
507
+ definition: v,
508
+ node: Nt(e, Pt(v.nodes, e)),
508
509
  selectedEdgeId: E.length === 1 ? E[0] : null,
509
510
  selectedNodeId: w
510
- }), n = Ht(t.definition), r = Ln(n, En.current);
511
- v(n), T(t.selectedNodeId), D(t.selectedEdgeIds), O(t.editingEdgeId), r && U(r);
511
+ }), n = Vt(t.definition), r = In(n, En.current);
512
+ y(n), T(t.selectedNodeId), D(t.selectedEdgeIds), O(t.editingEdgeId), r && Tn(r);
512
513
  }
513
- function mr(e) {
514
- W && yr(W.id, (t) => kt(t, e));
514
+ function gr(e) {
515
+ K && xr(K.id, (t) => kt(t, e));
515
516
  }
516
517
  function $(e) {
517
- !W || W.type !== "userTask" || yr(W.id, (t) => t.type === "userTask" ? {
518
+ !K || K.type !== "userTask" || xr(K.id, (t) => t.type === "userTask" ? {
518
519
  ...t,
519
520
  data: {
520
521
  ...t.data,
@@ -523,8 +524,8 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
523
524
  }
524
525
  } : t);
525
526
  }
526
- function hr(e) {
527
- !W || W.type !== "userTask" || yr(W.id, (t) => t.type === "userTask" ? {
527
+ function _r(e) {
528
+ !K || K.type !== "userTask" || xr(K.id, (t) => t.type === "userTask" ? {
528
529
  ...t,
529
530
  data: {
530
531
  ...t.data,
@@ -535,8 +536,8 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
535
536
  }
536
537
  } : t);
537
538
  }
538
- function gr(e) {
539
- !W || W.type !== "serviceTask" || yr(W.id, (t) => t.type === "serviceTask" ? {
539
+ function vr(e) {
540
+ !K || K.type !== "serviceTask" || xr(K.id, (t) => t.type === "serviceTask" ? {
540
541
  ...t,
541
542
  data: {
542
543
  ...t.data,
@@ -544,30 +545,30 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
544
545
  }
545
546
  } : t);
546
547
  }
547
- function _r(e) {
548
- C(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), tt(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), Je(nn(e, I));
548
+ function yr(e) {
549
+ it(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e), C(e.mode === "ALL" || e.mode === "CUSTOM" ? null : e.mode), tt(tn(e, L));
549
550
  }
550
- function vr(e) {
551
- !W || W.type === "startEvent" || yr(W.id, (t) => At(t, e));
551
+ function br(e) {
552
+ !K || K.type === "startEvent" || xr(K.id, (t) => At(t, e));
552
553
  }
553
- function yr(e, t) {
554
- v((n) => ({
554
+ function xr(e, t) {
555
+ y((n) => ({
555
556
  ...n,
556
557
  nodes: n.nodes.map((n) => n.id === e ? t(n) : n)
557
558
  }));
558
559
  }
559
- function br(e, t) {
560
- v((n) => ({
560
+ function Sr(e, t) {
561
+ y((n) => ({
561
562
  ...n,
562
563
  edges: n.edges.map((n) => n.id === e ? t(n) : n)
563
564
  }));
564
565
  }
565
- function xr(e, t) {
566
- v((n) => {
566
+ function Cr(e, t) {
567
+ y((n) => {
567
568
  let r = n.edges.find((t) => t.id === e);
568
569
  return r ? {
569
570
  ...n,
570
- edges: n.edges.map((e) => t && e.source === r.source && e.id !== r.id && X(e, n.nodes) ? {
571
+ edges: n.edges.map((e) => t && e.source === r.source && e.id !== r.id && Q(e, n.nodes) ? {
571
572
  ...e,
572
573
  data: {
573
574
  ...e.data,
@@ -583,293 +584,296 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
583
584
  } : n;
584
585
  });
585
586
  }
586
- function Sr({ edgeId: e, fieldKey: t, operator: n, value: r }) {
587
- let i = K?.schema ?? null;
588
- br(e, (e) => {
589
- let a = Hn(i, t ?? e.data.conditionFieldKey ?? null), o = qn(a, n ?? e.data.conditionOperator ?? null), s = Jn(a, o, r ?? e.data.conditionValue ?? null), c = Xn(a, o, s);
587
+ function wr({ edgeId: e, fieldKey: t, operator: n, value: r }) {
588
+ let i = Y?.schema ?? null;
589
+ Sr(e, (e) => {
590
+ let a = Bn(i, t ?? e.data.conditionFieldKey ?? null), o = Wn(a, n ?? e.data.conditionOperator ?? null), s = Gn(a, o, r ?? e.data.conditionValue ?? null), ee = qn(a, o, s);
590
591
  return {
591
592
  ...e,
592
593
  data: {
593
594
  ...e.data,
594
- condition: Qn(a, o, s),
595
+ condition: Xn(a, o, s),
595
596
  conditionFieldKey: a?.fieldKey,
596
597
  conditionOperator: o,
597
598
  conditionValue: s,
598
599
  isDefault: !1,
599
- label: c
600
+ label: ee
600
601
  }
601
602
  };
602
603
  });
603
604
  }
604
- function Cr() {
605
- let e = Ht(_), t = Ln(e, En.current);
606
- v(e), t && U(t);
605
+ function Tr() {
606
+ let e = Vt(v), t = In(e, En.current);
607
+ y(e), t && Tn(t);
607
608
  }
608
- return /* @__PURE__ */ h(ie, { children: [/* @__PURE__ */ m(t, { activeHref: i }), /* @__PURE__ */ h(ie.Main, { children: [
609
- /* @__PURE__ */ m("style", { children: Ge }),
610
- /* @__PURE__ */ m(oe, { children: /* @__PURE__ */ h(be, {
611
- description: `${ye ? `草稿 v${ye.version}` : "尚未建立草稿"} ·${he?.template.currentVersionId ? " 已發布版本" : " 尚未發布"}`,
612
- onBackClick: Dn,
613
- title: he?.template.name ?? "流程設計器",
614
- children: [
615
- /* @__PURE__ */ m(d, {
616
- "aria-label": "儲存草稿",
617
- disabled: st || !!q || !!Y,
618
- icon: _e,
619
- iconType: "icon-only",
620
- onClick: () => void ir(),
621
- variant: "base-secondary",
622
- children: "儲存草稿"
623
- }),
624
- /* @__PURE__ */ m(d, {
625
- disabled: at || !!q || !!Y,
626
- icon: me,
627
- iconType: "leading",
628
- onClick: or,
629
- variant: "base-secondary",
630
- children: "試跑流程"
631
- }),
632
- /* @__PURE__ */ m(d, {
633
- disabled: st || !ye || !!q || !!Y,
634
- icon: fe,
635
- iconType: "leading",
636
- onClick: () => void ar(),
637
- variant: "base-primary",
638
- children: "發布版本"
639
- })
640
- ]
641
- }) }),
642
- /* @__PURE__ */ m(ce, { children: /* @__PURE__ */ m(se, { children: /* @__PURE__ */ h("div", {
643
- style: ze,
644
- children: [
645
- it ? /* @__PURE__ */ m(p, {
646
- color: "text-error",
647
- variant: "body",
648
- children: it
649
- }) : null,
650
- q ? /* @__PURE__ */ m(p, {
651
- color: "text-error",
652
- variant: "body",
653
- children: q
654
- }) : null,
655
- Y ? /* @__PURE__ */ m(p, {
656
- color: "text-error",
657
- variant: "body",
658
- children: Y
659
- }) : null,
660
- /* @__PURE__ */ m("div", {
661
- style: x,
662
- children: /* @__PURE__ */ m(o, {
663
- hintText: J ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
664
- label: "綁定表單版本",
665
- name: "formDefinitionVersionId",
666
- required: !0,
667
- children: /* @__PURE__ */ m(te, {
668
- asyncData: !0,
669
- disabled: at || J,
670
- disabledOptionsFilter: !0,
671
- emptyText: "沒有符合的已發布表單版本",
672
- isForceClearable: !!y && !J,
673
- loading: j,
674
- loadingText: "搜尋表單版本中...",
675
- mode: "single",
676
- onChange: (e) => {
677
- J || Ke(e?.id ?? null);
678
- },
679
- onClear: () => {
680
- J || Ke(null);
681
- },
682
- onSearch: tr,
683
- onVisibilityChange: (e) => {
684
- e && !J && tr("");
685
- },
686
- options: [...Zn],
687
- placeholder: "選擇已發布表單版本",
688
- searchDebounceTime: 300,
689
- value: K
690
- })
609
+ return /* @__PURE__ */ g(t, {
610
+ activeHref: he,
611
+ children: [
612
+ /* @__PURE__ */ h("style", { children: Ge }),
613
+ /* @__PURE__ */ h(ae, { children: /* @__PURE__ */ g(ye, {
614
+ description: `${De ? `草稿 v${De.version}` : "尚未建立草稿"} ·${ve?.template.currentVersionId ? " 已發布版本" : " 尚未發布"}`,
615
+ onBackClick: Dn,
616
+ title: ve?.template.name ?? "流程設計器",
617
+ children: [
618
+ /* @__PURE__ */ h(f, {
619
+ "aria-label": "儲存草稿",
620
+ disabled: j || !!X || !!$n,
621
+ icon: ge,
622
+ iconType: "icon-only",
623
+ onClick: () => void or(),
624
+ variant: "base-secondary",
625
+ children: "儲存草稿"
626
+ }),
627
+ /* @__PURE__ */ h(f, {
628
+ disabled: st || !!X || !!$n,
629
+ icon: pe,
630
+ iconType: "leading",
631
+ onClick: cr,
632
+ variant: "base-secondary",
633
+ children: "試跑流程"
634
+ }),
635
+ /* @__PURE__ */ h(f, {
636
+ disabled: j || !De || !!X || !!$n,
637
+ icon: de,
638
+ iconType: "leading",
639
+ onClick: () => void sr(),
640
+ variant: "base-primary",
641
+ children: "發布版本"
691
642
  })
692
- }),
693
- /* @__PURE__ */ h("div", {
694
- style: Be,
695
- children: [/* @__PURE__ */ m("div", {
696
- ref: En,
697
- style: Ve,
698
- children: /* @__PURE__ */ h(De, {
699
- connectionMode: Ce.Strict,
700
- edges: Gn,
701
- fitView: !0,
702
- isValidConnection: (e) => on(e, _.nodes),
703
- nodeTypes: bt,
704
- nodes: zn,
705
- deleteKeyCode: null,
706
- multiSelectionKeyCode: [
707
- "Shift",
708
- "Meta",
709
- "Control"
710
- ],
711
- onConnect: ur,
712
- onEdgeClick: dr,
713
- onNodeClick: (e, t) => {
714
- T(t.id), D([]);
715
- },
716
- onNodesChange: lr,
717
- onPaneClick: () => {
718
- T(null), D([]);
719
- },
720
- onViewportChange: U,
721
- viewport: H,
722
- children: [
723
- /* @__PURE__ */ m(Se, {}),
724
- /* @__PURE__ */ m("style", { children: Ye }),
725
- /* @__PURE__ */ m(Te, { children: An ? /* @__PURE__ */ m(we, {
726
- "aria-label": "刪除選取項目",
727
- className: "workflow-selection-delete-control",
728
- onClick: Nn,
729
- style: He,
730
- title: "刪除選取項目",
731
- children: /* @__PURE__ */ m("span", {
732
- style: Ue,
733
- children: /* @__PURE__ */ m(ne, {
734
- color: "error",
735
- icon: ve,
736
- size: 16
643
+ ]
644
+ }) }),
645
+ /* @__PURE__ */ h(se, { children: /* @__PURE__ */ h(oe, { children: /* @__PURE__ */ g("div", {
646
+ style: Re,
647
+ children: [
648
+ ot ? /* @__PURE__ */ h(m, {
649
+ color: "text-error",
650
+ variant: "body",
651
+ children: ot
652
+ }) : null,
653
+ X ? /* @__PURE__ */ h(m, {
654
+ color: "text-error",
655
+ variant: "body",
656
+ children: X
657
+ }) : null,
658
+ $n ? /* @__PURE__ */ h(m, {
659
+ color: "text-error",
660
+ variant: "body",
661
+ children: $n
662
+ }) : null,
663
+ /* @__PURE__ */ h("div", {
664
+ style: x,
665
+ children: /* @__PURE__ */ h(s, {
666
+ hintText: Z ? "已設定條件分流條件。請先移除所有條件,才能更換綁定表單版本。" : void 0,
667
+ label: "綁定表單版本",
668
+ name: "formDefinitionVersionId",
669
+ required: !0,
670
+ children: /* @__PURE__ */ h(te, {
671
+ asyncData: !0,
672
+ disabled: st || Z,
673
+ disabledOptionsFilter: !0,
674
+ emptyText: "沒有符合的已發布表單版本",
675
+ isForceClearable: !!b && !Z,
676
+ loading: ht,
677
+ loadingText: "搜尋表單版本中...",
678
+ mode: "single",
679
+ onChange: (e) => {
680
+ Z || Je(e?.id ?? null);
681
+ },
682
+ onClear: () => {
683
+ Z || Je(null);
684
+ },
685
+ onSearch: rr,
686
+ onVisibilityChange: (e) => {
687
+ e && !Z && rr("");
688
+ },
689
+ options: [...Zn],
690
+ placeholder: "選擇已發布表單版本",
691
+ searchDebounceTime: 300,
692
+ value: Y
693
+ })
694
+ })
695
+ }),
696
+ /* @__PURE__ */ g("div", {
697
+ style: ze,
698
+ children: [/* @__PURE__ */ h("div", {
699
+ ref: En,
700
+ style: Be,
701
+ children: /* @__PURE__ */ g(Oe, {
702
+ connectionMode: Se.Strict,
703
+ edges: Yn,
704
+ fitView: !0,
705
+ isValidConnection: (e) => an(e, v.nodes),
706
+ nodeTypes: yt,
707
+ nodes: Jn,
708
+ deleteKeyCode: null,
709
+ multiSelectionKeyCode: [
710
+ "Shift",
711
+ "Meta",
712
+ "Control"
713
+ ],
714
+ onConnect: fr,
715
+ onEdgeClick: pr,
716
+ onNodeClick: (e, t) => {
717
+ T(t.id), D([]);
718
+ },
719
+ onNodesChange: dr,
720
+ onPaneClick: () => {
721
+ T(null), D([]);
722
+ },
723
+ onViewportChange: Tn,
724
+ viewport: wn,
725
+ children: [
726
+ /* @__PURE__ */ h(xe, {}),
727
+ /* @__PURE__ */ h("style", { children: Ye }),
728
+ /* @__PURE__ */ h(we, { children: Mn ? /* @__PURE__ */ h(Ce, {
729
+ "aria-label": "刪除選取項目",
730
+ className: "workflow-selection-delete-control",
731
+ onClick: Nn,
732
+ style: Ve,
733
+ title: "刪除選取項目",
734
+ children: /* @__PURE__ */ h("span", {
735
+ style: He,
736
+ children: /* @__PURE__ */ h(ne, {
737
+ color: "error",
738
+ icon: _e,
739
+ size: 16
740
+ })
737
741
  })
738
- })
739
- }) : null }),
740
- /* @__PURE__ */ m(St, { onApplyAutoLayout: Cr }),
741
- /* @__PURE__ */ m(Ee, {})
742
+ }) : null }),
743
+ /* @__PURE__ */ h(xt, { onApplyAutoLayout: Tr }),
744
+ /* @__PURE__ */ h(Ee, {})
745
+ ]
746
+ })
747
+ }), /* @__PURE__ */ g("div", {
748
+ className: Ue,
749
+ style: Xe,
750
+ children: [
751
+ /* @__PURE__ */ h(m, {
752
+ component: "h2",
753
+ variant: "h3",
754
+ children: "流程工具"
755
+ }),
756
+ /* @__PURE__ */ g("div", {
757
+ style: et,
758
+ children: [/* @__PURE__ */ h(m, {
759
+ color: "text-neutral",
760
+ variant: "caption",
761
+ children: "動作節點"
762
+ }), /* @__PURE__ */ h("div", {
763
+ style: $e,
764
+ children: lt.map((e) => /* @__PURE__ */ h(f, {
765
+ icon: e.icon,
766
+ iconType: "leading",
767
+ onClick: () => hr(e.type),
768
+ size: "sub",
769
+ variant: "base-secondary",
770
+ children: e.label
771
+ }, e.type))
772
+ })]
773
+ }),
774
+ /* @__PURE__ */ g("div", {
775
+ style: et,
776
+ children: [/* @__PURE__ */ h(m, {
777
+ color: "text-neutral",
778
+ variant: "caption",
779
+ children: "流程控制"
780
+ }), /* @__PURE__ */ h("div", {
781
+ style: $e,
782
+ children: ut.map((e) => /* @__PURE__ */ h(f, {
783
+ icon: e.icon,
784
+ iconType: "leading",
785
+ onClick: () => hr(e.type),
786
+ size: "sub",
787
+ variant: "base-secondary",
788
+ children: e.label
789
+ }, e.type))
790
+ })]
791
+ }),
792
+ q.length > 1 ? Mr(q) : null,
793
+ q.length === 1 && Fn ? Nr(Fn) : null,
794
+ q.length === 0 && K ? Dr(K) : null
742
795
  ]
743
- })
744
- }), /* @__PURE__ */ h("div", {
745
- className: We,
746
- style: Xe,
747
- children: [
748
- /* @__PURE__ */ m(p, {
749
- component: "h2",
750
- variant: "h3",
751
- children: "流程工具"
752
- }),
753
- /* @__PURE__ */ h("div", {
754
- style: et,
755
- children: [/* @__PURE__ */ m(p, {
756
- color: "text-neutral",
757
- variant: "caption",
758
- children: "動作節點"
759
- }), /* @__PURE__ */ m("div", {
760
- style: $e,
761
- children: lt.map((e) => /* @__PURE__ */ m(d, {
762
- icon: e.icon,
763
- iconType: "leading",
764
- onClick: () => pr(e.type),
765
- size: "sub",
766
- variant: "base-secondary",
767
- children: e.label
768
- }, e.type))
769
- })]
770
- }),
771
- /* @__PURE__ */ h("div", {
772
- style: et,
773
- children: [/* @__PURE__ */ m(p, {
774
- color: "text-neutral",
775
- variant: "caption",
776
- children: "流程控制"
777
- }), /* @__PURE__ */ m("div", {
778
- style: $e,
779
- children: ut.map((e) => /* @__PURE__ */ m(d, {
780
- icon: e.icon,
781
- iconType: "leading",
782
- onClick: () => pr(e.type),
783
- size: "sub",
784
- variant: "base-secondary",
785
- children: e.label
786
- }, e.type))
787
- })]
788
- }),
789
- In.length > 1 ? Ar(In) : null,
790
- In.length === 1 && Fn ? jr(Fn) : null,
791
- In.length === 0 && W ? Tr(W) : null
792
- ]
793
- })]
794
- })
795
- ]
796
- }) }) }),
797
- Mr(Pn),
798
- wr()
799
- ] })] });
800
- function wr() {
801
- return /* @__PURE__ */ m(ae, {
796
+ })]
797
+ })
798
+ ]
799
+ }) }) }),
800
+ Pr(Pn),
801
+ Er()
802
+ ]
803
+ });
804
+ function Er() {
805
+ return /* @__PURE__ */ h(ie, {
802
806
  cancelText: "關閉",
803
807
  confirmText: "執行試跑",
804
- loading: Qt,
808
+ loading: nn,
805
809
  modalType: "standard",
806
- onCancel: sr,
807
- onClose: sr,
808
- onConfirm: () => void cr(),
809
- open: Rt,
810
+ onCancel: lr,
811
+ onClose: lr,
812
+ onConfirm: () => void ur(),
813
+ open: Zt,
810
814
  showModalFooter: !0,
811
815
  showModalHeader: !0,
812
816
  size: "wide",
813
- supportingText: `使用 ${yt} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
817
+ supportingText: `使用 ${vt} 與範例表單資料模擬目前畫布流程,不會建立案件。`,
814
818
  title: "試跑流程",
815
- children: /* @__PURE__ */ h("div", {
819
+ children: /* @__PURE__ */ g("div", {
816
820
  style: x,
817
821
  children: [
818
- /* @__PURE__ */ m(o, {
822
+ /* @__PURE__ */ h(s, {
819
823
  label: "表單資料 JSON",
820
824
  name: "dryRunFormDataJson",
821
825
  required: !0,
822
- children: /* @__PURE__ */ m(le, {
823
- onChange: (e) => B(e.target.value),
826
+ children: /* @__PURE__ */ h(ce, {
827
+ onChange: (e) => cn(e.target.value),
824
828
  resize: "vertical",
825
829
  rows: 8,
826
- value: rn
830
+ value: H
827
831
  })
828
832
  }),
829
- pn ? /* @__PURE__ */ m(p, {
833
+ W ? /* @__PURE__ */ h(m, {
830
834
  color: "text-error",
831
835
  variant: "body",
832
- children: pn
836
+ children: W
833
837
  }) : null,
834
- V ? /* @__PURE__ */ h("div", {
838
+ U ? /* @__PURE__ */ g("div", {
835
839
  style: Ze,
836
840
  children: [
837
- /* @__PURE__ */ m(p, {
838
- color: V.valid ? "text-success" : "text-error",
841
+ /* @__PURE__ */ h(m, {
842
+ color: U.valid ? "text-success" : "text-error",
839
843
  variant: "label-primary-highlight",
840
- children: V.valid ? "試跑通過" : "試跑失敗"
844
+ children: U.valid ? "試跑通過" : "試跑失敗"
841
845
  }),
842
- V.errors.map((e) => /* @__PURE__ */ m(p, {
846
+ U.errors.map((e) => /* @__PURE__ */ h(m, {
843
847
  color: "text-error",
844
848
  variant: "body",
845
849
  children: e
846
850
  }, e)),
847
- V.steps.map((e) => /* @__PURE__ */ h("div", {
851
+ U.steps.map((e) => /* @__PURE__ */ g("div", {
848
852
  style: Qe,
849
853
  children: [
850
- /* @__PURE__ */ h(p, {
854
+ /* @__PURE__ */ g(m, {
851
855
  variant: "label-primary-highlight",
852
856
  children: [
853
857
  e.nodeLabel,
854
858
  " · ",
855
- gn(e.status)
859
+ mn(e.status)
856
860
  ]
857
861
  }),
858
- /* @__PURE__ */ h(p, {
862
+ /* @__PURE__ */ g(m, {
859
863
  color: "text-neutral",
860
864
  variant: "caption",
861
865
  children: [
862
- _n(e.nodeType),
866
+ hn(e.nodeType),
863
867
  e.assigneeMemberId ? ` · 處理者:${e.assigneeMemberId}` : "",
864
868
  e.edgeLabel ? ` · 來源線段:${e.edgeLabel}` : ""
865
869
  ]
866
870
  }),
867
- e.edgeReason ? /* @__PURE__ */ m(p, {
871
+ e.edgeReason ? /* @__PURE__ */ h(m, {
868
872
  color: "text-neutral",
869
873
  variant: "caption",
870
874
  children: e.edgeReason
871
875
  }) : null,
872
- e.entryCondition ? /* @__PURE__ */ h(p, {
876
+ e.entryCondition ? /* @__PURE__ */ g(m, {
873
877
  color: "text-neutral",
874
878
  variant: "caption",
875
879
  children: [
@@ -880,7 +884,7 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
880
884
  e.entryCondition
881
885
  ]
882
886
  }) : null,
883
- /* @__PURE__ */ m(p, {
887
+ /* @__PURE__ */ h(m, {
884
888
  color: "text-neutral",
885
889
  variant: "body",
886
890
  children: e.message
@@ -893,16 +897,16 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
893
897
  })
894
898
  });
895
899
  }
896
- function Tr(e) {
897
- return /* @__PURE__ */ h("div", {
900
+ function Dr(e) {
901
+ return /* @__PURE__ */ g("div", {
898
902
  style: x,
899
903
  children: [
900
- /* @__PURE__ */ m(p, {
904
+ /* @__PURE__ */ h(m, {
901
905
  component: "h2",
902
906
  variant: "h3",
903
907
  children: "節點屬性"
904
908
  }),
905
- /* @__PURE__ */ h(p, {
909
+ /* @__PURE__ */ g(m, {
906
910
  color: "text-neutral",
907
911
  variant: "body",
908
912
  children: [
@@ -911,140 +915,140 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
911
915
  e.id
912
916
  ]
913
917
  }),
914
- /* @__PURE__ */ m(o, {
918
+ /* @__PURE__ */ h(s, {
915
919
  label: "顯示名稱",
916
920
  name: "nodeLabel",
917
921
  required: !0,
918
- children: /* @__PURE__ */ m(re, {
919
- onChange: (e) => mr(e.target.value),
922
+ children: /* @__PURE__ */ h(re, {
923
+ onChange: (e) => gr(e.target.value),
920
924
  value: e.data.label,
921
925
  variant: "base"
922
926
  })
923
927
  }),
924
- e.type === "startEvent" ? Er() : null,
925
- e.type === "startEvent" ? null : Dr(e),
926
- e.type === "userTask" ? Or(e) : null,
927
- e.type === "serviceTask" ? kr(e) : null
928
+ e.type === "startEvent" ? Or() : null,
929
+ e.type === "startEvent" ? null : kr(e),
930
+ e.type === "userTask" ? Ar(e) : null,
931
+ e.type === "serviceTask" ? jr(e) : null
928
932
  ]
929
933
  });
930
934
  }
931
- function Er() {
932
- let e = G.mode === "CUSTOM" ? [..._t, vt] : [..._t], t = G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? Cn(I, G.orgUnitId ?? "") : null, n = G.mode === "ORG_UNIT_POSITION" ? wn(L, G.positionId ?? "") : null, i = G.mode === "ORG_UNIT_POSITION" ? kn({
933
- includeDescendants: !!G.includeDescendants,
934
- memberships: Nt,
935
- orgUnitId: G.orgUnitId ?? "",
936
- orgUnits: I,
937
- positions: L
935
+ function Or() {
936
+ let e = J.mode === "CUSTOM" ? [...gt, _t] : [...gt], t = J.mode === "ORG_UNIT" || J.mode === "ORG_UNIT_POSITION" ? xn(L, J.orgUnitId ?? "") : null, n = J.mode === "ORG_UNIT_POSITION" ? Sn(R, J.positionId ?? "") : null, r = J.mode === "ORG_UNIT_POSITION" ? On({
937
+ includeDescendants: !!J.includeDescendants,
938
+ memberships: Lt,
939
+ orgUnitId: J.orgUnitId ?? "",
940
+ orgUnits: L,
941
+ positions: R
938
942
  }) : [];
939
- return /* @__PURE__ */ h(de, { children: [
940
- /* @__PURE__ */ m(o, {
941
- hintText: G.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
943
+ return /* @__PURE__ */ g(ue, { children: [
944
+ /* @__PURE__ */ h(s, {
945
+ hintText: J.mode === "CUSTOM" ? "這是舊版表達式規則;切換成標準選項後會改由 UI 管理。" : void 0,
942
946
  label: "發起權限",
943
947
  name: "initiatorPolicyMode",
944
948
  required: !0,
945
- children: /* @__PURE__ */ m(f, {
949
+ children: /* @__PURE__ */ h(p, {
946
950
  clearable: !1,
947
951
  onChange: (e) => {
948
952
  if (e?.id === "CUSTOM") {
949
- tt(null), C(null);
953
+ C(null), it(null);
950
954
  return;
951
955
  }
952
- let t = Zt(e?.id ?? null), n = an(t);
953
- tt(t === "ALL" ? null : t), C(t === "ALL" ? null : n), Je(nn(n, I));
956
+ let t = Xt(e?.id ?? null), n = rn(t);
957
+ C(t === "ALL" ? null : t), it(t === "ALL" ? null : n), tt(tn(n, L));
954
958
  },
955
959
  options: e,
956
960
  placeholder: "選擇誰可以發起",
957
- value: z(e, G.mode)
961
+ value: B(e, J.mode)
958
962
  })
959
963
  }),
960
- G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
964
+ J.mode === "ORG_UNIT" || J.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ h(s, {
961
965
  label: "組織",
962
966
  name: "initiatorOrgUnitId",
963
967
  required: !0,
964
- children: /* @__PURE__ */ m(r, {
968
+ children: /* @__PURE__ */ h(i, {
965
969
  name: "initiatorOrgUnitId",
966
- onChange: (e) => _r({
967
- ...G,
970
+ onChange: (e) => yr({
971
+ ...J,
968
972
  orgUnitId: e?.id ?? "",
969
973
  positionId: "",
970
974
  value: e?.id ?? ""
971
975
  }),
972
- orgUnits: I,
976
+ orgUnits: L,
973
977
  placeholder: "選擇組織",
974
978
  value: t
975
979
  })
976
980
  }) : null,
977
- G.mode === "ORG_UNIT" || G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
981
+ J.mode === "ORG_UNIT" || J.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ h(s, {
978
982
  label: "包含下層",
979
983
  name: "initiatorIncludeDescendants",
980
- children: /* @__PURE__ */ m(ue, {
981
- checked: !!G.includeDescendants,
982
- onChange: (e) => _r({
983
- ...G,
984
+ children: /* @__PURE__ */ h(le, {
985
+ checked: !!J.includeDescendants,
986
+ onChange: (e) => yr({
987
+ ...J,
984
988
  includeDescendants: e.target.checked,
985
- ...G.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
989
+ ...J.mode === "ORG_UNIT_POSITION" ? { positionId: "" } : {}
986
990
  })
987
991
  })
988
992
  }) : null,
989
- G.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
993
+ J.mode === "ORG_UNIT_POSITION" ? /* @__PURE__ */ h(s, {
990
994
  label: "職位",
991
995
  name: "initiatorPositionId",
992
996
  required: !0,
993
- children: /* @__PURE__ */ m(a, {
994
- disabled: !G.orgUnitId?.trim(),
997
+ children: /* @__PURE__ */ h(o, {
998
+ disabled: !J.orgUnitId?.trim(),
995
999
  name: "initiatorPositionId",
996
- onChange: (e) => _r({
997
- ...G,
1000
+ onChange: (e) => yr({
1001
+ ...J,
998
1002
  positionId: e?.id ?? ""
999
1003
  }),
1000
- placeholder: G.orgUnitId?.trim() ? "選擇職位" : "請先選擇組織",
1001
- positions: i,
1004
+ placeholder: J.orgUnitId?.trim() ? "選擇職位" : "請先選擇組織",
1005
+ positions: r,
1002
1006
  value: n
1003
1007
  })
1004
1008
  }) : null
1005
1009
  ] });
1006
1010
  }
1007
- function Dr(e) {
1008
- let t = _.edges.filter((t) => t.target === e.id).length, n = t < 2, r = n ? "AND" : e.data.triggerMode ?? "AND";
1009
- return /* @__PURE__ */ m(o, {
1011
+ function kr(e) {
1012
+ let t = v.edges.filter((t) => t.target === e.id).length, n = t < 2, r = n ? "AND" : e.data.triggerMode ?? "AND";
1013
+ return /* @__PURE__ */ h(s, {
1010
1014
  hintText: n ? "需要至少兩條前置連線,才可切換為任一前置完成。" : t > 1 ? `${t} 條前置連線會依此規則觸發。` : "只有一條前置連線時,兩種設定效果相同。",
1011
1015
  label: "前置條件",
1012
1016
  name: "triggerMode",
1013
1017
  required: !0,
1014
- children: /* @__PURE__ */ m(f, {
1018
+ children: /* @__PURE__ */ h(p, {
1015
1019
  clearable: !1,
1016
- onChange: (e) => n ? void 0 : vr(Ut(e?.id ?? null)),
1020
+ onChange: (e) => n ? void 0 : br(Ht(e?.id ?? null)),
1017
1021
  options: [...dt],
1018
1022
  readOnly: n,
1019
- value: z(dt, r)
1023
+ value: B(dt, r)
1020
1024
  })
1021
1025
  });
1022
1026
  }
1023
- function Or(e) {
1024
- let t = e.data.approverResolver, n = Gt(t.type), i = t.type === "DIRECT" ? Sn(t.memberIds, P) : null, s = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? Cn(I, t.orgUnitId) : null, c = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? wn(L, t.positionId) : null, l = t.type === "ORG_UNIT_POSITION" ? kn({
1027
+ function Ar(e) {
1028
+ let t = e.data.approverResolver, n = Wt(t.type), r = t.type === "DIRECT" ? bn(t.memberIds, I) : null, a = t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? xn(L, t.orgUnitId) : null, ee = t.type === "POSITION" || t.type === "ORG_UNIT_POSITION" ? Sn(R, t.positionId) : null, c = t.type === "ORG_UNIT_POSITION" ? On({
1025
1029
  includeDescendants: !!t.includeDescendants,
1026
- memberships: Nt,
1030
+ memberships: Lt,
1027
1031
  orgUnitId: t.orgUnitId,
1028
- orgUnits: I,
1029
- positions: L
1030
- }) : [], ee = t.type === "ORG_MANAGER" ? Yt(t.levelsUp) : M[0], u = t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, d = u.type === "DIRECT" ? xn(P, u.memberId) : null, ne = e.data.returnBehavior.resubmitStrategy ?? "RESTART";
1031
- return /* @__PURE__ */ h(de, { children: [
1032
- /* @__PURE__ */ m(o, {
1032
+ orgUnits: L,
1033
+ positions: R
1034
+ }) : [], l = t.type === "ORG_MANAGER" ? Jt(t.levelsUp) : M[0], u = t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? t.fallback ?? { type: "NONE" } : { type: "NONE" }, d = u.type === "DIRECT" ? yn(I, u.memberId) : null, f = e.data.returnBehavior.resubmitStrategy ?? "RESTART";
1035
+ return /* @__PURE__ */ g(ue, { children: [
1036
+ /* @__PURE__ */ h(s, {
1033
1037
  label: "簽核來源",
1034
1038
  name: "approverResolverType",
1035
1039
  required: !0,
1036
- children: /* @__PURE__ */ m(f, {
1040
+ children: /* @__PURE__ */ h(p, {
1037
1041
  clearable: !1,
1038
- onChange: (e) => $(Kt(e?.id ?? null)),
1042
+ onChange: (e) => $(Gt(e?.id ?? null)),
1039
1043
  options: [...pt],
1040
- value: z(pt, n)
1044
+ value: B(pt, n)
1041
1045
  })
1042
1046
  }),
1043
- t.type === "DIRECT" ? /* @__PURE__ */ m(o, {
1047
+ t.type === "DIRECT" ? /* @__PURE__ */ h(s, {
1044
1048
  label: "簽核者",
1045
1049
  name: "memberId",
1046
1050
  required: !0,
1047
- children: /* @__PURE__ */ m(te, {
1051
+ children: /* @__PURE__ */ h(te, {
1048
1052
  asyncData: !0,
1049
1053
  disabledOptionsFilter: !0,
1050
1054
  emptyText: "沒有符合的成員",
@@ -1054,45 +1058,45 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1054
1058
  name: "workflow-approver-search",
1055
1059
  spellCheck: !1
1056
1060
  },
1057
- loading: wt,
1061
+ loading: Tt,
1058
1062
  loadingText: "搜尋成員中...",
1059
1063
  mode: "single",
1060
1064
  onChange: (e) => $({
1061
1065
  memberIds: e?.id ? [e.id] : [],
1062
1066
  type: "DIRECT"
1063
1067
  }),
1064
- onSearch: Z,
1068
+ onSearch: ir,
1065
1069
  onVisibilityChange: (e) => {
1066
- e && Z("");
1070
+ e && ir("");
1067
1071
  },
1068
- options: [...P],
1072
+ options: [...I],
1069
1073
  placeholder: "搜尋姓名或信箱",
1070
1074
  searchDebounceTime: 300,
1071
- value: i
1075
+ value: r
1072
1076
  })
1073
1077
  }) : null,
1074
- t.type === "ORG_MANAGER" ? /* @__PURE__ */ m(o, {
1078
+ t.type === "ORG_MANAGER" ? /* @__PURE__ */ h(s, {
1075
1079
  hintText: "依發起人的有效會員歸屬與主管解析規則決定簽核人。",
1076
1080
  label: "主管層級",
1077
1081
  name: "managerLevelsUp",
1078
1082
  required: !0,
1079
- children: /* @__PURE__ */ m(f, {
1083
+ children: /* @__PURE__ */ h(p, {
1080
1084
  clearable: !1,
1081
1085
  onChange: (e) => $({
1082
1086
  baseFromInitiator: !0,
1083
- levelsUp: Xt(e?.id ?? null).value,
1087
+ levelsUp: Yt(e?.id ?? null).value,
1084
1088
  type: "ORG_MANAGER"
1085
1089
  }),
1086
1090
  options: [...M],
1087
- value: ee
1091
+ value: l
1088
1092
  })
1089
1093
  }) : null,
1090
- t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
1094
+ t.type === "ORG_UNIT_MANAGER" || t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ h(s, {
1091
1095
  hintText: t.type === "ORG_UNIT_MANAGER" ? "依指定組織或其上層的主管解析規則決定簽核人。" : "依指定組織目前有效會員歸屬建立候選簽核人。",
1092
1096
  label: "組織",
1093
1097
  name: "orgUnitId",
1094
1098
  required: !0,
1095
- children: /* @__PURE__ */ m(r, {
1099
+ children: /* @__PURE__ */ h(i, {
1096
1100
  name: "orgUnitId",
1097
1101
  onChange: (e) => $(t.type === "ORG_UNIT_MEMBER" ? {
1098
1102
  includeDescendants: t.includeDescendants,
@@ -1108,30 +1112,30 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1108
1112
  orgUnitId: e?.id ?? "",
1109
1113
  type: "ORG_UNIT_MANAGER"
1110
1114
  }),
1111
- orgUnits: I,
1115
+ orgUnits: L,
1112
1116
  placeholder: "選擇組織",
1113
- value: s
1117
+ value: a
1114
1118
  })
1115
1119
  }) : null,
1116
- t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ h(de, { children: [/* @__PURE__ */ m(o, {
1120
+ t.type === "ORG_MANAGER" || t.type === "ORG_UNIT_MANAGER" ? /* @__PURE__ */ g(ue, { children: [/* @__PURE__ */ h(s, {
1117
1121
  hintText: "預設會停止流程並提示;若設定固定人,找不到主管時會改派給該會員。",
1118
1122
  label: "無主管時",
1119
1123
  name: "approverFallbackMode",
1120
1124
  required: !0,
1121
- children: /* @__PURE__ */ m(f, {
1125
+ children: /* @__PURE__ */ h(p, {
1122
1126
  clearable: !1,
1123
- onChange: (e) => $(Jt(t, qt(e?.id ?? null) === "DIRECT" ? {
1127
+ onChange: (e) => $(qt(t, Kt(e?.id ?? null) === "DIRECT" ? {
1124
1128
  memberId: "",
1125
1129
  type: "DIRECT"
1126
1130
  } : { type: "NONE" })),
1127
1131
  options: [...mt],
1128
- value: z(mt, u.type)
1132
+ value: B(mt, u.type)
1129
1133
  })
1130
- }), u.type === "DIRECT" ? /* @__PURE__ */ h(de, { children: [/* @__PURE__ */ m(o, {
1134
+ }), u.type === "DIRECT" ? /* @__PURE__ */ g(ue, { children: [/* @__PURE__ */ h(s, {
1131
1135
  label: "改派人員",
1132
1136
  name: "approverFallbackMemberId",
1133
1137
  required: !0,
1134
- children: /* @__PURE__ */ m(te, {
1138
+ children: /* @__PURE__ */ h(te, {
1135
1139
  asyncData: !0,
1136
1140
  disabledOptionsFilter: !0,
1137
1141
  emptyText: "沒有符合的成員",
@@ -1141,40 +1145,40 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1141
1145
  name: "workflow-approver-fallback-search",
1142
1146
  spellCheck: !1
1143
1147
  },
1144
- loading: wt,
1148
+ loading: Tt,
1145
1149
  loadingText: "搜尋成員中...",
1146
1150
  mode: "single",
1147
- onChange: (e) => $(Jt(t, {
1151
+ onChange: (e) => $(qt(t, {
1148
1152
  allowInitiatorSelfApproval: u.allowInitiatorSelfApproval,
1149
1153
  memberId: e?.id ?? "",
1150
1154
  type: "DIRECT"
1151
1155
  })),
1152
- onSearch: Z,
1156
+ onSearch: ir,
1153
1157
  onVisibilityChange: (e) => {
1154
- e && Z("");
1158
+ e && ir("");
1155
1159
  },
1156
- options: [...P],
1160
+ options: [...I],
1157
1161
  placeholder: "搜尋姓名或信箱",
1158
1162
  searchDebounceTime: 300,
1159
1163
  value: d
1160
1164
  })
1161
- }), /* @__PURE__ */ m(o, {
1165
+ }), /* @__PURE__ */ h(s, {
1162
1166
  hintText: "預設禁止申請人簽自己的案件;只有此流程允許自簽時才開啟。",
1163
1167
  label: "允許自簽",
1164
1168
  name: "allowInitiatorSelfApproval",
1165
- children: /* @__PURE__ */ m(ue, {
1169
+ children: /* @__PURE__ */ h(le, {
1166
1170
  checked: !!u.allowInitiatorSelfApproval,
1167
- onChange: (e) => $(Jt(t, {
1171
+ onChange: (e) => $(qt(t, {
1168
1172
  allowInitiatorSelfApproval: e.target.checked,
1169
1173
  memberId: u.memberId,
1170
1174
  type: "DIRECT"
1171
1175
  }))
1172
1176
  })
1173
1177
  })] }) : null] }) : null,
1174
- t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
1178
+ t.type === "ORG_UNIT_MEMBER" || t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ h(s, {
1175
1179
  label: "包含下層",
1176
1180
  name: "includeDescendants",
1177
- children: /* @__PURE__ */ m(ue, {
1181
+ children: /* @__PURE__ */ h(le, {
1178
1182
  checked: !!t.includeDescendants,
1179
1183
  onChange: (e) => $({
1180
1184
  ...t,
@@ -1183,28 +1187,28 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1183
1187
  })
1184
1188
  })
1185
1189
  }) : null,
1186
- t.type === "POSITION" ? /* @__PURE__ */ m(o, {
1190
+ t.type === "POSITION" ? /* @__PURE__ */ h(s, {
1187
1191
  hintText: "指派給目前有效歸屬中擁有此職位的會員;主要歸屬優先。",
1188
1192
  label: "職位",
1189
1193
  name: "positionId",
1190
1194
  required: !0,
1191
- children: /* @__PURE__ */ m(a, {
1195
+ children: /* @__PURE__ */ h(o, {
1192
1196
  name: "positionId",
1193
1197
  onChange: (e) => $({
1194
1198
  positionId: e?.id ?? "",
1195
1199
  type: "POSITION"
1196
1200
  }),
1197
1201
  placeholder: "選擇職位",
1198
- positions: L,
1199
- value: c
1202
+ positions: R,
1203
+ value: ee
1200
1204
  })
1201
1205
  }) : null,
1202
- t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ m(o, {
1206
+ t.type === "ORG_UNIT_POSITION" ? /* @__PURE__ */ h(s, {
1203
1207
  hintText: "只納入指定組織範圍內擁有此職位的有效會員。",
1204
1208
  label: "職位",
1205
1209
  name: "orgUnitPositionId",
1206
1210
  required: !0,
1207
- children: /* @__PURE__ */ m(a, {
1211
+ children: /* @__PURE__ */ h(o, {
1208
1212
  disabled: !t.orgUnitId.trim(),
1209
1213
  name: "orgUnitPositionId",
1210
1214
  onChange: (e) => $({
@@ -1214,38 +1218,38 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1214
1218
  type: "ORG_UNIT_POSITION"
1215
1219
  }),
1216
1220
  placeholder: t.orgUnitId.trim() ? "選擇職位" : "請先選擇組織",
1217
- positions: l,
1218
- value: c
1221
+ positions: c,
1222
+ value: ee
1219
1223
  })
1220
1224
  }) : null,
1221
- e.data.returnBehavior.allowReturn ? /* @__PURE__ */ m(o, {
1225
+ e.data.returnBehavior.allowReturn ? /* @__PURE__ */ h(s, {
1222
1226
  hintText: "退回發起人後,重新送出時要從流程開始重跑,或直接回到退回的簽核節點。",
1223
1227
  label: "重送策略",
1224
1228
  name: "returnResubmitStrategy",
1225
1229
  required: !0,
1226
- children: /* @__PURE__ */ m(f, {
1230
+ children: /* @__PURE__ */ h(p, {
1227
1231
  clearable: !1,
1228
- onChange: (e) => hr(Wt(e?.id ?? null)),
1232
+ onChange: (e) => _r(Ut(e?.id ?? null)),
1229
1233
  options: [...ft],
1230
- value: z(ft, ne)
1234
+ value: B(ft, f)
1231
1235
  })
1232
1236
  }) : null
1233
1237
  ] });
1234
1238
  }
1235
- function kr(e) {
1236
- let t = nr(e.data.action).map((e) => xn(P, e));
1237
- return /* @__PURE__ */ m(o, {
1239
+ function jr(e) {
1240
+ let t = tr(e.data.action).map((e) => yn(I, e));
1241
+ return /* @__PURE__ */ h(s, {
1238
1242
  label: "知會對象",
1239
1243
  name: "notifyMemberIds",
1240
1244
  required: !0,
1241
- children: /* @__PURE__ */ m(te, {
1245
+ children: /* @__PURE__ */ h(te, {
1242
1246
  asyncData: !0,
1243
1247
  disabledOptionsFilter: !0,
1244
1248
  emptyText: "沒有符合的成員",
1245
- loading: wt,
1249
+ loading: Tt,
1246
1250
  loadingText: "搜尋成員中...",
1247
1251
  mode: "multiple",
1248
- onChange: (e) => gr({
1252
+ onChange: (e) => vr({
1249
1253
  channels: ["IN_APP"],
1250
1254
  recipients: {
1251
1255
  memberIds: e.map((e) => e.id),
@@ -1253,11 +1257,11 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1253
1257
  },
1254
1258
  type: "NOTIFY"
1255
1259
  }),
1256
- onSearch: Z,
1260
+ onSearch: ir,
1257
1261
  onVisibilityChange: (e) => {
1258
- e && Z("");
1262
+ e && ir("");
1259
1263
  },
1260
- options: [...P],
1264
+ options: [...I],
1261
1265
  overflowStrategy: "wrap",
1262
1266
  placeholder: "搜尋姓名或信箱",
1263
1267
  searchDebounceTime: 300,
@@ -1265,14 +1269,14 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1265
1269
  })
1266
1270
  });
1267
1271
  }
1268
- function Ar(e) {
1269
- return /* @__PURE__ */ h("div", {
1272
+ function Mr(e) {
1273
+ return /* @__PURE__ */ g("div", {
1270
1274
  style: x,
1271
- children: [/* @__PURE__ */ m(p, {
1275
+ children: [/* @__PURE__ */ h(m, {
1272
1276
  component: "h2",
1273
1277
  variant: "h3",
1274
1278
  children: "已選取線段"
1275
- }), /* @__PURE__ */ h(p, {
1279
+ }), /* @__PURE__ */ g(m, {
1276
1280
  color: "text-neutral",
1277
1281
  variant: "body",
1278
1282
  children: [
@@ -1283,17 +1287,17 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1283
1287
  })]
1284
1288
  });
1285
1289
  }
1286
- function jr(e) {
1287
- let t = X(e, _.nodes);
1288
- return /* @__PURE__ */ h("div", {
1290
+ function Nr(e) {
1291
+ let t = Q(e, v.nodes);
1292
+ return /* @__PURE__ */ g("div", {
1289
1293
  style: x,
1290
1294
  children: [
1291
- /* @__PURE__ */ m(p, {
1295
+ /* @__PURE__ */ h(m, {
1292
1296
  component: "h2",
1293
1297
  variant: "h3",
1294
1298
  children: t ? "條件設定" : "線段屬性"
1295
1299
  }),
1296
- /* @__PURE__ */ h(p, {
1300
+ /* @__PURE__ */ g(m, {
1297
1301
  color: "text-neutral",
1298
1302
  variant: "body",
1299
1303
  children: [
@@ -1302,7 +1306,7 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1302
1306
  e.target
1303
1307
  ]
1304
1308
  }),
1305
- t ? Nr(e) : /* @__PURE__ */ m(p, {
1309
+ t ? Fr(e) : /* @__PURE__ */ h(m, {
1306
1310
  color: "text-neutral",
1307
1311
  variant: "body",
1308
1312
  children: "這條線會直接把流程送到下一個節點。"
@@ -1310,63 +1314,63 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1310
1314
  ]
1311
1315
  });
1312
1316
  }
1313
- function Mr(e) {
1314
- return !e || !X(e, _.nodes) ? null : /* @__PURE__ */ m(ae, {
1317
+ function Pr(e) {
1318
+ return !e || !Q(e, v.nodes) ? null : /* @__PURE__ */ h(ie, {
1315
1319
  cancelText: "取消",
1316
1320
  confirmButtonProps: { disabled: !e.data.isDefault && !e.data.condition },
1317
1321
  confirmText: "完成",
1318
1322
  modalType: "standard",
1319
- onCancel: fr,
1320
- onClose: fr,
1321
- onConfirm: fr,
1322
- open: !!rt,
1323
+ onCancel: mr,
1324
+ onClose: mr,
1325
+ onConfirm: mr,
1326
+ open: !!at,
1323
1327
  showModalFooter: !0,
1324
1328
  showModalHeader: !0,
1325
1329
  size: "regular",
1326
1330
  supportingText: "條件分流的輸出連線需要指定條件,條件會直接顯示在線上。",
1327
1331
  title: "條件設定",
1328
- children: Nr(e)
1332
+ children: Fr(e)
1329
1333
  });
1330
1334
  }
1331
- function Nr(e) {
1332
- let t = er(e, _.nodes), n = Vn(K?.schema ?? null), r = Hn(K?.schema ?? null, e.data.conditionFieldKey ?? null), i = Un(r), a = Kn(r), s = z(i, e.data.conditionOperator ?? null);
1333
- return /* @__PURE__ */ h("div", {
1335
+ function Fr(e) {
1336
+ let t = Qn(e, v.nodes), n = zn(Y?.schema ?? null), r = Bn(Y?.schema ?? null, e.data.conditionFieldKey ?? null), i = Vn(r), a = Un(r), o = B(i, e.data.conditionOperator ?? null);
1337
+ return /* @__PURE__ */ g("div", {
1334
1338
  style: x,
1335
1339
  children: [
1336
- /* @__PURE__ */ h(p, {
1340
+ /* @__PURE__ */ g(m, {
1337
1341
  color: "text-neutral",
1338
1342
  variant: "body",
1339
1343
  children: [
1340
1344
  "畫布上的這條線目前會顯示「",
1341
- /* @__PURE__ */ m("span", {
1345
+ /* @__PURE__ */ h("span", {
1342
1346
  style: { color: !e.data.isDefault && !e.data.condition ? qe : void 0 },
1343
1347
  children: t ?? "請設定條件"
1344
1348
  }),
1345
1349
  "」。"
1346
1350
  ]
1347
1351
  }),
1348
- /* @__PURE__ */ m(ue, {
1352
+ /* @__PURE__ */ h(le, {
1349
1353
  checked: !!e.data.isDefault,
1350
1354
  label: "其他情況走這條",
1351
- onChange: (t) => xr(e.id, t.target.checked)
1355
+ onChange: (t) => Cr(e.id, t.target.checked)
1352
1356
  }),
1353
- e.data.isDefault ? /* @__PURE__ */ m(p, {
1357
+ e.data.isDefault ? /* @__PURE__ */ h(m, {
1354
1358
  color: "text-neutral",
1355
1359
  variant: "body",
1356
1360
  children: "其他條件都不符合時,流程會走這條線。"
1357
- }) : /* @__PURE__ */ h(de, { children: [
1358
- K ? null : /* @__PURE__ */ m(p, {
1361
+ }) : /* @__PURE__ */ g(ue, { children: [
1362
+ Y ? null : /* @__PURE__ */ h(m, {
1359
1363
  color: "text-neutral",
1360
1364
  variant: "body",
1361
1365
  children: "請先綁定表單版本,才能選擇條件欄位。"
1362
1366
  }),
1363
- /* @__PURE__ */ m(o, {
1367
+ /* @__PURE__ */ h(s, {
1364
1368
  label: "條件欄位",
1365
1369
  name: "edgeConditionField",
1366
1370
  required: !0,
1367
- children: /* @__PURE__ */ m(f, {
1371
+ children: /* @__PURE__ */ h(p, {
1368
1372
  clearable: !1,
1369
- onChange: (t) => Sr({
1373
+ onChange: (t) => wr({
1370
1374
  edgeId: e.id,
1371
1375
  fieldKey: t?.id ?? null,
1372
1376
  operator: null,
@@ -1374,40 +1378,40 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1374
1378
  }),
1375
1379
  options: [...n],
1376
1380
  placeholder: "選擇條件欄位",
1377
- value: z(n, e.data.conditionFieldKey ?? null)
1381
+ value: B(n, e.data.conditionFieldKey ?? null)
1378
1382
  })
1379
1383
  }),
1380
- /* @__PURE__ */ m(o, {
1384
+ /* @__PURE__ */ h(s, {
1381
1385
  label: "條件判斷",
1382
1386
  name: "edgeConditionOperator",
1383
1387
  required: !0,
1384
- children: /* @__PURE__ */ m(f, {
1388
+ children: /* @__PURE__ */ h(p, {
1385
1389
  clearable: !1,
1386
- onChange: (t) => Sr({
1390
+ onChange: (t) => wr({
1387
1391
  edgeId: e.id,
1388
- operator: Wn(t?.id ?? null),
1392
+ operator: Hn(t?.id ?? null),
1389
1393
  value: null
1390
1394
  }),
1391
1395
  options: [...i],
1392
1396
  placeholder: "選擇判斷方式",
1393
- value: s
1397
+ value: o
1394
1398
  })
1395
1399
  }),
1396
- s && Yn(s.id) ? /* @__PURE__ */ m(o, {
1400
+ o && Kn(o.id) ? /* @__PURE__ */ h(s, {
1397
1401
  label: "條件值",
1398
1402
  name: "edgeConditionValue",
1399
1403
  required: !0,
1400
- children: a.length > 0 ? /* @__PURE__ */ m(f, {
1404
+ children: a.length > 0 ? /* @__PURE__ */ h(p, {
1401
1405
  clearable: !1,
1402
- onChange: (t) => Sr({
1406
+ onChange: (t) => wr({
1403
1407
  edgeId: e.id,
1404
1408
  value: t?.id ?? null
1405
1409
  }),
1406
1410
  options: [...a],
1407
1411
  placeholder: "選擇條件值",
1408
- value: z(a, e.data.conditionValue ?? null)
1409
- }) : /* @__PURE__ */ m(re, {
1410
- onChange: (t) => Sr({
1412
+ value: B(a, e.data.conditionValue ?? null)
1413
+ }) : /* @__PURE__ */ h(re, {
1414
+ onChange: (t) => wr({
1411
1415
  edgeId: e.id,
1412
1416
  value: t.target.value
1413
1417
  }),
@@ -1421,14 +1425,14 @@ function xt({ templateId: n, activeHref: i = "/templates" }) {
1421
1425
  });
1422
1426
  }
1423
1427
  }
1424
- function St({ onApplyAutoLayout: e }) {
1428
+ function xt({ onApplyAutoLayout: e }) {
1425
1429
  function t() {
1426
1430
  e();
1427
1431
  }
1428
- return /* @__PURE__ */ m(_, {
1432
+ return /* @__PURE__ */ h(De, {
1429
1433
  position: "top-right",
1430
- children: /* @__PURE__ */ m(d, {
1431
- icon: pe,
1434
+ children: /* @__PURE__ */ h(f, {
1435
+ icon: fe,
1432
1436
  iconType: "leading",
1433
1437
  onClick: t,
1434
1438
  size: "sub",
@@ -1437,28 +1441,28 @@ function St({ onApplyAutoLayout: e }) {
1437
1441
  })
1438
1442
  });
1439
1443
  }
1440
- function N({ data: e, selected: t, type: n }) {
1441
- let r = e.approverLines ?? [e.approverSummary ?? e.label], i = Ct(e);
1442
- return /* @__PURE__ */ h("div", {
1443
- style: wt(n, t),
1444
+ function P({ data: e, selected: t, type: n }) {
1445
+ let r = e.approverLines ?? [e.approverSummary ?? e.label], i = St(e);
1446
+ return /* @__PURE__ */ g("div", {
1447
+ style: Ct(n, t),
1444
1448
  children: [
1445
- P(e),
1446
- /* @__PURE__ */ m("div", {
1449
+ Tt(e),
1450
+ /* @__PURE__ */ h("div", {
1447
1451
  style: st,
1448
- children: r.map((e, t) => /* @__PURE__ */ m(p, {
1452
+ children: r.map((e, t) => /* @__PURE__ */ h(m, {
1449
1453
  component: "span",
1450
1454
  ellipsis: !0,
1451
- style: ot,
1455
+ style: k,
1452
1456
  title: e,
1453
1457
  variant: "label-primary",
1454
1458
  children: e
1455
1459
  }, `${e}_${t}`))
1456
1460
  }),
1457
- /* @__PURE__ */ m(p, {
1461
+ /* @__PURE__ */ h(m, {
1458
1462
  color: "text-neutral",
1459
1463
  component: "span",
1460
1464
  ellipsis: !0,
1461
- style: ot,
1465
+ style: k,
1462
1466
  title: i,
1463
1467
  variant: "caption",
1464
1468
  children: i
@@ -1466,36 +1470,36 @@ function N({ data: e, selected: t, type: n }) {
1466
1470
  ]
1467
1471
  });
1468
1472
  }
1469
- function Ct(e) {
1473
+ function St(e) {
1470
1474
  return e.nodeKind === "startEvent" ? e.initiatorPolicySummary ?? "所有人" : e.approverSummary || e.approverLines ? e.label : e.nodeKind === "exclusiveGateway" ? "條件在線上" : e.nodeKind === "parallelGateway" ? "多條路徑同時進行" : ct[e.nodeKind];
1471
1475
  }
1472
- function wt(e, t) {
1473
- let n = Tt(e);
1476
+ function Ct(e, t) {
1477
+ let n = wt(e);
1474
1478
  return t ? {
1475
1479
  ...n,
1476
1480
  border: "1px solid var(--mzn-color-primary, #0057ff)",
1477
1481
  boxShadow: tt
1478
1482
  } : n;
1479
1483
  }
1480
- function Tt(e) {
1481
- return e === "exclusiveGateway" ? rt : e === "parallelGateway" ? O : e === "startEvent" ? k : e === "endEvent" ? at : e === "userTask" ? it : S;
1484
+ function wt(e) {
1485
+ return e === "exclusiveGateway" ? E : e === "parallelGateway" ? D : e === "startEvent" ? O : e === "endEvent" ? ot : e === "userTask" ? at : S;
1482
1486
  }
1483
- function P(e) {
1484
- return !e.hasInput && e.hasOutput ? /* @__PURE__ */ m(g, {
1487
+ function Tt(e) {
1488
+ return !e.hasInput && e.hasOutput ? /* @__PURE__ */ h(Te, {
1485
1489
  id: j,
1486
- position: v.Right,
1490
+ position: _.Right,
1487
1491
  type: "source"
1488
- }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ m(g, {
1492
+ }) : e.hasInput && !e.hasOutput ? /* @__PURE__ */ h(Te, {
1489
1493
  id: A,
1490
- position: v.Left,
1494
+ position: _.Left,
1491
1495
  type: "target"
1492
- }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ m(g, {
1496
+ }) : !e.hasInput && !e.hasOutput ? null : [/* @__PURE__ */ h(Te, {
1493
1497
  id: A,
1494
- position: v.Left,
1498
+ position: _.Left,
1495
1499
  type: "target"
1496
- }, "target"), /* @__PURE__ */ m(g, {
1500
+ }, "target"), /* @__PURE__ */ h(Te, {
1497
1501
  id: j,
1498
- position: v.Right,
1502
+ position: _.Right,
1499
1503
  type: "source"
1500
1504
  }, "source")];
1501
1505
  }
@@ -1503,11 +1507,11 @@ function Et(e, t, n, r, i, a) {
1503
1507
  let o = F(e);
1504
1508
  return {
1505
1509
  data: {
1506
- approverLines: Fn(e, t),
1507
- approverSummary: Nn(e, t, n, r),
1508
- hasInput: B(e),
1509
- hasOutput: V(e),
1510
- initiatorPolicySummary: e.type === "startEvent" ? rn(a, n, r) : null,
1510
+ approverLines: Nn(e, t),
1511
+ approverSummary: jn(e, t, n, r),
1512
+ hasInput: V(e),
1513
+ hasOutput: H(e),
1514
+ initiatorPolicySummary: e.type === "startEvent" ? nn(a, n, r) : null,
1511
1515
  label: e.data.label,
1512
1516
  nodeKind: e.type
1513
1517
  },
@@ -1518,18 +1522,18 @@ function Et(e, t, n, r, i, a) {
1518
1522
  initialWidth: o.width,
1519
1523
  position: e.position,
1520
1524
  selected: i,
1521
- sourcePosition: v.Right,
1522
- targetPosition: v.Left,
1525
+ sourcePosition: _.Right,
1526
+ targetPosition: _.Left,
1523
1527
  type: e.type,
1524
1528
  width: o.width
1525
1529
  };
1526
1530
  }
1527
1531
  function F(e) {
1528
1532
  return e.type === "exclusiveGateway" || e.type === "parallelGateway" ? {
1529
- height: T,
1530
- width: E
1533
+ height: it,
1534
+ width: w
1531
1535
  } : e.type === "serviceTask" ? {
1532
- height: nt + (Math.max(1, nr(e.data.action).length) - 1) * w,
1536
+ height: nt + (Math.max(1, tr(e.data.action).length) - 1) * rt,
1533
1537
  width: C
1534
1538
  } : {
1535
1539
  height: nt,
@@ -1538,14 +1542,14 @@ function F(e) {
1538
1542
  }
1539
1543
  function I(e) {
1540
1544
  let t = F(e);
1541
- return [...B(e) ? [Dt(t)] : [], ...V(e) ? [L(t)] : []];
1545
+ return [...V(e) ? [Dt(t)] : [], ...H(e) ? [L(t)] : []];
1542
1546
  }
1543
1547
  function Dt({ height: e }) {
1544
1548
  let t = e / 2 - 9 / 2;
1545
1549
  return {
1546
1550
  height: 9,
1547
1551
  id: A,
1548
- position: v.Left,
1552
+ position: _.Left,
1549
1553
  type: "target",
1550
1554
  width: 9,
1551
1555
  x: -9 / 2,
@@ -1557,7 +1561,7 @@ function L({ height: e, width: t }) {
1557
1561
  return {
1558
1562
  height: 9,
1559
1563
  id: j,
1560
- position: v.Right,
1564
+ position: _.Right,
1561
1565
  type: "source",
1562
1566
  width: 9,
1563
1567
  x: t - 9 / 2,
@@ -1565,7 +1569,7 @@ function L({ height: e, width: t }) {
1565
1569
  };
1566
1570
  }
1567
1571
  function Ot(e, t, n) {
1568
- let r = er(e, t), i = X(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? qe : i ? Ke : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", c = a ? qe : i ? Ke : b;
1572
+ let r = Qn(e, t), i = Q(e, t), a = i && !e.data.isDefault && !e.data.condition, o = a ? qe : i ? Ke : "#475569", s = a ? "#fef2f2" : i ? "#eff6ff" : "#ffffff", ee = a ? qe : i ? Ke : b;
1569
1573
  return {
1570
1574
  className: n ? "workflow-edge--selected" : void 0,
1571
1575
  data: e.data,
@@ -1575,7 +1579,7 @@ function Ot(e, t, n) {
1575
1579
  labelBgPadding: [8, 4],
1576
1580
  labelBgStyle: {
1577
1581
  fill: s,
1578
- stroke: c,
1582
+ stroke: ee,
1579
1583
  strokeWidth: 1
1580
1584
  },
1581
1585
  labelShowBg: !!r,
@@ -1618,16 +1622,16 @@ function At(e, t) {
1618
1622
  });
1619
1623
  }
1620
1624
  function jt(e) {
1621
- return Nt(Mt(e));
1625
+ return R(Mt(e));
1622
1626
  }
1623
1627
  function Mt(e) {
1624
- let t = new Set(e.nodes.filter((e) => ln(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
1628
+ let t = new Set(e.nodes.filter((e) => cn(e)).map((e) => e.id)), n = e.edges.filter((e) => !t.has(e.source));
1625
1629
  return n.length === e.edges.length ? e : {
1626
1630
  ...e,
1627
1631
  edges: n
1628
1632
  };
1629
1633
  }
1630
- function Nt(e) {
1634
+ function R(e) {
1631
1635
  let t = e.edges.reduce((e, t) => ({
1632
1636
  ...e,
1633
1637
  [t.target]: (e[t.target] ?? 0) + 1
@@ -1637,7 +1641,7 @@ function Nt(e) {
1637
1641
  nodes: n
1638
1642
  } : e;
1639
1643
  }
1640
- function Pt(e, t) {
1644
+ function Nt(e, t) {
1641
1645
  let n = {
1642
1646
  id: `${e}_${t}`,
1643
1647
  position: {
@@ -1690,13 +1694,13 @@ function Pt(e, t) {
1690
1694
  type: e
1691
1695
  };
1692
1696
  }
1693
- function Ft(e, t) {
1697
+ function Pt(e, t) {
1694
1698
  let n = new Set(e.filter((e) => e.type === t).map((e) => Number(e.id.replace(`${t}_`, ""))).filter((e) => Number.isInteger(e) && e > 0));
1695
1699
  return Array.from({ length: e.length + 1 }, (e, t) => t + 1).find((e) => !n.has(e)) ?? e.length + 1;
1696
1700
  }
1697
- function It({ definition: e, node: t, selectedEdgeId: n, selectedNodeId: r }) {
1701
+ function Ft({ definition: e, node: t, selectedEdgeId: n, selectedNodeId: r }) {
1698
1702
  let i = n ? e.edges.find((e) => e.id === n) ?? null : null, a = r ? e.nodes.find((e) => e.id === r) ?? null : null;
1699
- return i ? Lt(e, t, i) : a ? Rt(e, t, a) : {
1703
+ return i ? It(e, t, i) : a ? Lt(e, t, a) : {
1700
1704
  definition: {
1701
1705
  ...e,
1702
1706
  nodes: [...e.nodes, t]
@@ -1706,15 +1710,15 @@ function It({ definition: e, node: t, selectedEdgeId: n, selectedNodeId: r }) {
1706
1710
  selectedNodeId: t.id
1707
1711
  };
1708
1712
  }
1709
- function Lt(e, t, n) {
1710
- if (!B(t)) return {
1713
+ function It(e, t, n) {
1714
+ if (!V(t)) return {
1711
1715
  definition: e,
1712
1716
  editingEdgeId: null,
1713
1717
  selectedEdgeIds: [n.id],
1714
1718
  selectedNodeId: null
1715
1719
  };
1716
- if (!V(t)) {
1717
- let r = R(n.source, t.id, {});
1720
+ if (!H(t)) {
1721
+ let r = z(n.source, t.id, {});
1718
1722
  return {
1719
1723
  definition: {
1720
1724
  ...e,
@@ -1726,7 +1730,7 @@ function Lt(e, t, n) {
1726
1730
  selectedNodeId: t.id
1727
1731
  };
1728
1732
  }
1729
- let r = R(n.source, t.id, n.data), i = R(t.id, n.target, zt(t, n)), a = X(i, [...e.nodes, t]);
1733
+ let r = z(n.source, t.id, n.data), i = z(t.id, n.target, Rt(t, n)), a = Q(i, [...e.nodes, t]);
1730
1734
  return {
1731
1735
  definition: {
1732
1736
  ...e,
@@ -1738,8 +1742,8 @@ function Lt(e, t, n) {
1738
1742
  selectedNodeId: a ? null : t.id
1739
1743
  };
1740
1744
  }
1741
- function Rt(e, t, n) {
1742
- if (!V(n)) return {
1745
+ function Lt(e, t, n) {
1746
+ if (!H(n)) return {
1743
1747
  definition: {
1744
1748
  ...e,
1745
1749
  nodes: [...e.nodes, t]
@@ -1749,10 +1753,10 @@ function Rt(e, t, n) {
1749
1753
  selectedNodeId: t.id
1750
1754
  };
1751
1755
  let r = e.edges.find((e) => e.source === n.id) ?? null;
1752
- if (r && V(t)) return Lt(e, t, r);
1756
+ if (r && H(t)) return It(e, t, r);
1753
1757
  let i = e.nodes.find((e) => e.type === "endEvent");
1754
- if (i && n.id !== i.id && V(t)) {
1755
- let r = R(n.id, t.id, {}), a = R(t.id, i.id, zt(t, r)), o = X(a, [...e.nodes, t]);
1758
+ if (i && n.id !== i.id && H(t)) {
1759
+ let r = z(n.id, t.id, {}), a = z(t.id, i.id, Rt(t, r)), o = Q(a, [...e.nodes, t]);
1756
1760
  return {
1757
1761
  definition: {
1758
1762
  ...e,
@@ -1768,7 +1772,7 @@ function Rt(e, t, n) {
1768
1772
  selectedNodeId: o ? null : t.id
1769
1773
  };
1770
1774
  }
1771
- let a = R(n.id, t.id, {});
1775
+ let a = z(n.id, t.id, {});
1772
1776
  return {
1773
1777
  definition: {
1774
1778
  ...e,
@@ -1780,7 +1784,7 @@ function Rt(e, t, n) {
1780
1784
  selectedNodeId: t.id
1781
1785
  };
1782
1786
  }
1783
- function R(e, t, n) {
1787
+ function z(e, t, n) {
1784
1788
  return {
1785
1789
  data: n,
1786
1790
  id: `edge_${e}_${t}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
@@ -1791,13 +1795,13 @@ function R(e, t, n) {
1791
1795
  type: "smoothstep"
1792
1796
  };
1793
1797
  }
1794
- function zt(e, t) {
1798
+ function Rt(e, t) {
1795
1799
  return e.type === "exclusiveGateway" ? {
1796
1800
  isDefault: !0,
1797
1801
  label: "其他情況"
1798
1802
  } : {};
1799
1803
  }
1800
- function Bt() {
1804
+ function zt() {
1801
1805
  return {
1802
1806
  edges: [],
1803
1807
  meta: { schemaVersion: 1 },
@@ -1824,11 +1828,11 @@ function Bt() {
1824
1828
  }]
1825
1829
  };
1826
1830
  }
1827
- function Vt(e) {
1831
+ function Bt(e) {
1828
1832
  return e.edges.length === 0 && e.nodes.length === 2 && e.nodes.some((e) => e.type === "startEvent") && e.nodes.some((e) => e.type === "endEvent");
1829
1833
  }
1830
- function Ht(e) {
1831
- let t = new Ae.graphlib.Graph();
1834
+ function Vt(e) {
1835
+ let t = new y.graphlib.Graph();
1832
1836
  return t.setDefaultEdgeLabel(() => ({})), t.setGraph({
1833
1837
  rankdir: "LR",
1834
1838
  ranksep: 120
@@ -1836,7 +1840,7 @@ function Ht(e) {
1836
1840
  t.setNode(e.id, F(e));
1837
1841
  }), e.edges.forEach((e) => {
1838
1842
  t.setEdge(e.source, e.target);
1839
- }), Ae.layout(t), {
1843
+ }), y.layout(t), {
1840
1844
  ...e,
1841
1845
  nodes: e.nodes.map((e) => {
1842
1846
  let n = t.node(e.id);
@@ -1850,20 +1854,20 @@ function Ht(e) {
1850
1854
  })
1851
1855
  };
1852
1856
  }
1853
- function z(e, t) {
1857
+ function B(e, t) {
1854
1858
  return t ? e.find((e) => e.id === t) ?? null : null;
1855
1859
  }
1856
- function Ut(e) {
1860
+ function Ht(e) {
1857
1861
  return e === "OR" ? "OR" : "AND";
1858
1862
  }
1859
- function Wt(e) {
1863
+ function Ut(e) {
1860
1864
  return e === "FROM_RETURN_POINT" ? "FROM_RETURN_POINT" : "RESTART";
1861
1865
  }
1862
- function Gt(e) {
1866
+ function Wt(e) {
1863
1867
  return e === "ORG_MANAGER" || e === "ORG_UNIT_MANAGER" || e === "ORG_UNIT_MEMBER" || e === "ORG_UNIT_POSITION" || e === "POSITION" ? e : "DIRECT";
1864
1868
  }
1865
- function Kt(e) {
1866
- let t = Gt(e ?? "DIRECT");
1869
+ function Gt(e) {
1870
+ let t = Wt(e ?? "DIRECT");
1867
1871
  return t === "ORG_MANAGER" ? {
1868
1872
  baseFromInitiator: !0,
1869
1873
  levelsUp: 1,
@@ -1888,31 +1892,31 @@ function Kt(e) {
1888
1892
  type: "DIRECT"
1889
1893
  };
1890
1894
  }
1891
- function qt(e) {
1895
+ function Kt(e) {
1892
1896
  return e === "DIRECT" ? "DIRECT" : "NONE";
1893
1897
  }
1894
- function Jt(e, t) {
1898
+ function qt(e, t) {
1895
1899
  return e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER" ? {
1896
1900
  ...e,
1897
1901
  fallback: t
1898
1902
  } : e;
1899
1903
  }
1900
- function Yt(e) {
1904
+ function Jt(e) {
1901
1905
  return M.find((t) => t.value === e) ?? M[0];
1902
1906
  }
1903
- function Xt(e) {
1907
+ function Yt(e) {
1904
1908
  return M.find((t) => t.id === e) ?? M[0];
1905
1909
  }
1906
- function Zt(e) {
1910
+ function Xt(e) {
1907
1911
  return e === "ORG_UNIT" || e === "ORG_UNIT_POSITION" || e === "NONE" ? e : "ALL";
1908
1912
  }
1909
- function Qt(e) {
1913
+ function Zt(e) {
1910
1914
  let t = e?.trim();
1911
1915
  if (!t) return {
1912
1916
  mode: "ALL",
1913
1917
  value: ""
1914
1918
  };
1915
- let n = tn(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = tn(t, /"([^"]+)" in subject\.positionIds/gu);
1919
+ let n = en(t, /"([^"]+)" in subject\.orgUnitIds/gu), r = en(t, /"([^"]+)" in subject\.positionIds/gu);
1916
1920
  return n.length > 0 && r.length > 0 ? {
1917
1921
  includeDescendants: n.length > 1,
1918
1922
  mode: "ORG_UNIT_POSITION",
@@ -1929,32 +1933,32 @@ function Qt(e) {
1929
1933
  value: t
1930
1934
  };
1931
1935
  }
1932
- function $t(e, t) {
1933
- let n = Qt(e);
1936
+ function Qt(e, t) {
1937
+ let n = Zt(e);
1934
1938
  return !t || t === "ALL" || t === "NONE" ? t === "ALL" || t === "NONE" ? {
1935
1939
  mode: t,
1936
1940
  value: ""
1937
- } : n : n.mode === t ? n : an(t);
1941
+ } : n : n.mode === t ? n : rn(t);
1938
1942
  }
1939
- function en(e) {
1943
+ function $t(e) {
1940
1944
  return e.mode === "NONE" ? "發起權限需要選擇誰可以發起。" : (e.mode === "ORG_UNIT" || e.mode === "ORG_UNIT_POSITION") && !e.orgUnitId?.trim() ? "指定組織發起時,需要選擇組織。" : e.mode === "ORG_UNIT_POSITION" && !e.positionId?.trim() ? "指定組織職位發起時,需要選擇職位。" : null;
1941
1945
  }
1942
- function tn(e, t) {
1946
+ function en(e, t) {
1943
1947
  return [...e.matchAll(t)].map((e) => e[1]).filter((e) => !!e);
1944
1948
  }
1945
- function nn(e, t) {
1949
+ function tn(e, t) {
1946
1950
  if (e.mode === "ALL" || e.mode === "NONE") return null;
1947
1951
  let n = e.orgUnitId?.trim() ?? "";
1948
1952
  if (!n) return null;
1949
- let r = An(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
1953
+ let r = K(t, n, !!e.includeDescendants).map((e) => `${JSON.stringify(e)} in subject.orgUnitIds`).join(" || ");
1950
1954
  if (e.mode === "ORG_UNIT") return r ? `(${r})` : null;
1951
1955
  let i = e.positionId?.trim() ?? "";
1952
1956
  return i && r ? `(${r}) && ${JSON.stringify(i)} in subject.positionIds` : null;
1953
1957
  }
1954
- function rn(e, t, n) {
1955
- return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${H(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${H(t, e.orgUnitId)} / ${U(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
1958
+ function nn(e, t, n) {
1959
+ return e.mode === "NONE" ? "未設定" : e.mode === "ORG_UNIT" ? e.orgUnitId ? `組織:${W(t, e.orgUnitId)}` : "指定組織" : e.mode === "ORG_UNIT_POSITION" ? e.orgUnitId && e.positionId ? `組織職位:${W(t, e.orgUnitId)} / ${G(n, e.positionId)}` : "指定組織職位" : e.mode === "CUSTOM" ? "既有自訂規則" : "所有人";
1956
1960
  }
1957
- function an(e) {
1961
+ function rn(e) {
1958
1962
  return {
1959
1963
  includeDescendants: !0,
1960
1964
  mode: e,
@@ -1963,71 +1967,71 @@ function an(e) {
1963
1967
  value: ""
1964
1968
  };
1965
1969
  }
1966
- function on(e, t) {
1970
+ function an(e, t) {
1967
1971
  let n = e.source ? t.find((t) => t.id === e.source) ?? null : null, r = e.target ? t.find((t) => t.id === e.target) ?? null : null;
1968
- return !!n && !!r && e.source !== e.target && e.sourceHandle === j && e.targetHandle === A && !!(n && V(n)) && !!(r && B(r));
1972
+ return !!n && !!r && e.source !== e.target && e.sourceHandle === j && e.targetHandle === A && !!(n && H(n)) && !!(r && V(r));
1969
1973
  }
1970
- function sn(e, t) {
1974
+ function on(e, t) {
1971
1975
  return e.includes(t) ? e.filter((e) => e !== t) : [...e, t];
1972
1976
  }
1973
- function cn(e) {
1977
+ function sn(e) {
1974
1978
  return e.type !== "startEvent" && e.type !== "endEvent";
1975
1979
  }
1976
- function B(e) {
1980
+ function V(e) {
1977
1981
  return e.type !== "startEvent";
1978
1982
  }
1979
- function V(e) {
1980
- return e.type !== "endEvent" && !ln(e);
1983
+ function H(e) {
1984
+ return e.type !== "endEvent" && !cn(e);
1981
1985
  }
1982
- function ln(e) {
1986
+ function cn(e) {
1983
1987
  return e.type === "serviceTask" && e.data.action.type === "NOTIFY";
1984
1988
  }
1985
- function un(e) {
1989
+ function ln(e) {
1986
1990
  return e instanceof HTMLElement ? e.isContentEditable || e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" || !!e.closest("[contenteditable=\"true\"]") : !1;
1987
1991
  }
1988
- function dn(e) {
1992
+ function un(e) {
1989
1993
  return e.map((e) => ({
1990
1994
  id: e.id,
1991
1995
  name: `${e.formName} | v${e.version}`,
1992
1996
  schema: e.schema
1993
1997
  }));
1994
1998
  }
1995
- function fn(e) {
1999
+ function dn(e) {
1996
2000
  return (e?.schema.fields ?? []).reduce((e, t) => ({
1997
2001
  ...e,
1998
- [t.fieldKey]: pn(t)
2002
+ [t.fieldKey]: U(t)
1999
2003
  }), {});
2000
2004
  }
2001
- function pn(e) {
2005
+ function U(e) {
2002
2006
  return e.type === "number" ? 1e3 : e.type === "boolean" ? !0 : e.type === "select" ? e.options[0]?.value ?? "" : e.type === "checkbox" ? e.options[0] ? [e.options[0].value] : [] : e.type === "date" ? "2026-05-08" : e.type === "datetime" ? "2026-05-08T09:00:00+08:00" : e.placeholder ?? e.label;
2003
2007
  }
2004
- function mn(e) {
2008
+ function fn(e) {
2005
2009
  let t = JSON.parse(e);
2006
- if (!hn(t)) throw Error("表單資料 JSON 必須是物件。");
2010
+ if (!pn(t)) throw Error("表單資料 JSON 必須是物件。");
2007
2011
  return t;
2008
2012
  }
2009
- function hn(e) {
2013
+ function pn(e) {
2010
2014
  return typeof e == "object" && !!e && !Array.isArray(e);
2011
2015
  }
2012
- function gn(e) {
2016
+ function mn(e) {
2013
2017
  return e === "COMPLETED" ? "完成" : e === "PASSED" ? "通過" : e === "SKIPPED" ? "略過" : e === "STOPPED" ? "已停止" : e === "WAITING" ? "將等待簽核" : e;
2014
2018
  }
2015
- function _n(e) {
2019
+ function hn(e) {
2016
2020
  return e in ct ? ct[e] : e;
2017
2021
  }
2018
- function vn(e, t) {
2022
+ function gn(e, t) {
2019
2023
  return t && !e.some((e) => e.id === t.id) ? [t, ...e] : e;
2020
2024
  }
2021
- function yn(e) {
2025
+ function _n(e) {
2022
2026
  return e.map((e) => ({
2023
2027
  displayName: e.name,
2024
2028
  email: e.email,
2025
2029
  id: e.memberId,
2026
2030
  memberId: e.memberId,
2027
- name: G(e.name, e.email)
2031
+ name: Fn(e.name, e.email)
2028
2032
  }));
2029
2033
  }
2030
- function bn(e) {
2034
+ function vn(e) {
2031
2035
  return {
2032
2036
  displayName: "未知會員",
2033
2037
  email: "",
@@ -2036,87 +2040,87 @@ function bn(e) {
2036
2040
  name: "未知會員"
2037
2041
  };
2038
2042
  }
2039
- function xn(e, t) {
2040
- return e.find((e) => e.memberId === t) ?? bn(t);
2043
+ function yn(e, t) {
2044
+ return e.find((e) => e.memberId === t) ?? vn(t);
2041
2045
  }
2042
- function Sn(e, t) {
2046
+ function bn(e, t) {
2043
2047
  let n = e[0];
2044
- return n ? xn(t, n) : null;
2048
+ return n ? yn(t, n) : null;
2045
2049
  }
2046
- function Cn(e, t) {
2047
- let r = e.find((e) => e.id === t);
2048
- return r ? n(r) : null;
2050
+ function xn(e, t) {
2051
+ let n = e.find((e) => e.id === t);
2052
+ return n ? r(n) : null;
2049
2053
  }
2050
- function wn(e, t) {
2054
+ function Sn(e, t) {
2051
2055
  let n = e.find((e) => e.id === t);
2052
- return n ? i(n) : null;
2056
+ return n ? a(n) : null;
2053
2057
  }
2054
- function H(e, t) {
2055
- return Cn(e, t)?.name ?? "未指定組織";
2058
+ function W(e, t) {
2059
+ return xn(e, t)?.name ?? "未指定組織";
2056
2060
  }
2057
- function U(e, t) {
2058
- return wn(e, t)?.name ?? "未指定職位";
2061
+ function G(e, t) {
2062
+ return Sn(e, t)?.name ?? "未指定職位";
2059
2063
  }
2060
- function Tn(e, t) {
2061
- let n = En(), r = t.filter((t) => t.memberId === e && Dn(t, n)), i = r.reduce((e, t) => e && W(e, t) <= 0 ? e : t, null);
2064
+ function Cn(e, t) {
2065
+ let n = wn(), r = t.filter((t) => t.memberId === e && Tn(t, n)), i = r.reduce((e, t) => e && En(e, t) <= 0 ? e : t, null);
2062
2066
  return {
2063
2067
  customFields: {},
2064
2068
  managerMemberId: "member-002",
2065
2069
  memberId: e,
2066
2070
  orgCode: "HQ",
2067
- orgUnitIds: On(r.map((e) => e.orgUnitId)),
2071
+ orgUnitIds: Dn(r.map((e) => e.orgUnitId)),
2068
2072
  positionId: i?.positionId ?? null,
2069
- positionIds: On(r.map((e) => e.positionId)),
2073
+ positionIds: Dn(r.map((e) => e.positionId)),
2070
2074
  primaryOrgUnitId: i?.orgUnitId ?? null,
2071
2075
  roles: ["manager"]
2072
2076
  };
2073
2077
  }
2074
- function En() {
2078
+ function wn() {
2075
2079
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
2076
2080
  }
2077
- function Dn(e, t) {
2081
+ function Tn(e, t) {
2078
2082
  return e.effectiveFrom <= t && (!e.effectiveTo || e.effectiveTo >= t);
2079
2083
  }
2080
- function W(e, t) {
2084
+ function En(e, t) {
2081
2085
  return e.isPrimary === t.isPrimary ? t.effectiveFrom.localeCompare(e.effectiveFrom) : e.isPrimary ? -1 : 1;
2082
2086
  }
2083
- function On(e) {
2087
+ function Dn(e) {
2084
2088
  return e.reduce((e, t) => t && !e.includes(t) ? [...e, t] : e, []);
2085
2089
  }
2086
- function kn({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
2087
- let a = new Set(An(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
2090
+ function On({ includeDescendants: e, memberships: t, orgUnitId: n, orgUnits: r, positions: i }) {
2091
+ let a = new Set(K(r, n, e)), o = new Set(t.filter((e) => a.has(e.orgUnitId)).map((e) => e.positionId).filter((e) => !!e));
2088
2092
  return i.filter((e) => o.has(e.id));
2089
2093
  }
2090
- function An(e, t, n) {
2094
+ function K(e, t, n) {
2091
2095
  let r = e.find((e) => e.id === t);
2092
2096
  return r ? n ? e.filter((e) => e.id === r.id || e.path.startsWith(`${r.path}.`)).map((e) => e.id) : [r.id] : t.trim() ? [t] : [];
2093
2097
  }
2094
- function jn(e, t) {
2098
+ function kn(e, t) {
2095
2099
  let n = new Set(e.map((e) => e.memberId)), r = t.filter((e) => !n.has(e.memberId));
2096
2100
  return [...e, ...r];
2097
2101
  }
2098
- function Mn(e) {
2099
- return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? e.data.approverResolver.type === "DIRECT" ? e.data.approverResolver.memberIds : [] : e.type === "serviceTask" ? nr(e.data.action) : []))];
2102
+ function An(e) {
2103
+ return [...new Set(e.nodes.flatMap((e) => e.type === "userTask" ? e.data.approverResolver.type === "DIRECT" ? e.data.approverResolver.memberIds : [] : e.type === "serviceTask" ? tr(e.data.action) : []))];
2100
2104
  }
2101
- function Nn(e, t, n, r) {
2102
- return e.type === "userTask" ? Pn(e.data.approverResolver, t, n, r) : null;
2105
+ function jn(e, t, n, r) {
2106
+ return e.type === "userTask" ? Mn(e.data.approverResolver, t, n, r) : null;
2103
2107
  }
2104
- function Pn(e, t, n, r) {
2105
- return e.type === "DIRECT" ? In(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? Yt(e.levelsUp).name : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${H(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${H(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${H(n, e.orgUnitId)} / ${U(r, e.positionId)}` : e.type === "POSITION" ? `職位:${U(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? `表單欄位:${e.formPath || "未設定"}` : "自訂表達式";
2108
+ function Mn(e, t, n, r) {
2109
+ return e.type === "DIRECT" ? Pn(e.memberIds, t, "未指定簽核者") : e.type === "ORG_MANAGER" ? Jt(e.levelsUp).name : e.type === "ORG_UNIT_MANAGER" ? `組織主管:${W(n, e.orgUnitId)}` : e.type === "ORG_UNIT_MEMBER" ? `組織任一人:${W(n, e.orgUnitId)}` : e.type === "ORG_UNIT_POSITION" ? `組織職位:${W(n, e.orgUnitId)} / ${G(r, e.positionId)}` : e.type === "POSITION" ? `職位:${G(r, e.positionId)}` : e.type === "DYNAMIC_FORM" ? `表單欄位:${e.formPath || "未設定"}` : "自訂表達式";
2106
2110
  }
2107
- function Fn(e, t) {
2111
+ function Nn(e, t) {
2108
2112
  if (e.type !== "serviceTask") return null;
2109
- let n = nr(e.data.action);
2110
- return n.length === 0 ? ["未指定知會對象"] : n.map((e) => xn(t, e).name);
2113
+ let n = tr(e.data.action);
2114
+ return n.length === 0 ? ["未指定知會對象"] : n.map((e) => yn(t, e).name);
2111
2115
  }
2112
- function In(e, t, n) {
2113
- let r = e.map((e) => xn(t, e).name);
2116
+ function Pn(e, t, n) {
2117
+ let r = e.map((e) => yn(t, e).name);
2114
2118
  return r.length === 0 ? n : r.length <= 2 ? r.join("、") : `${r.slice(0, 2).join("、")} 等 ${r.length} 人`;
2115
2119
  }
2116
- function G(e, t) {
2120
+ function Fn(e, t) {
2117
2121
  return `${e} (${t})`;
2118
2122
  }
2119
- function Ln(e, t) {
2123
+ function In(e, t) {
2120
2124
  let n = t?.getBoundingClientRect();
2121
2125
  if (!n || e.nodes.length === 0) return null;
2122
2126
  let r = e.nodes.reduce((e, t) => {
@@ -2133,42 +2137,42 @@ function Ln(e, t) {
2133
2137
  minX: Infinity,
2134
2138
  minY: Infinity
2135
2139
  });
2136
- return ke({
2140
+ return v({
2137
2141
  height: r.maxY - r.minY,
2138
2142
  width: r.maxX - r.minX,
2139
2143
  x: r.minX,
2140
2144
  y: r.minY
2141
2145
  }, n.width, n.height, .1, 1, .2);
2142
2146
  }
2143
- function Rn(e) {
2144
- let t = e.nodes.find((e) => e.type === "userTask" && !!zn(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "serviceTask" && e.data.action.type === "NOTIFY" && nr(e.data.action).length === 0), r = e.edges.find((t) => X(t, e.nodes) && !t.data.isDefault && !t.data.condition);
2145
- return t && t.type === "userTask" ? zn(t.data.approverResolver) : n ? "知會節點需要至少一位知會對象。" : r ? "條件分流的每條輸出連線都需要先設定條件。" : null;
2147
+ function Ln(e) {
2148
+ let t = e.nodes.find((e) => e.type === "userTask" && !!q(e.data.approverResolver)), n = e.nodes.find((e) => e.type === "serviceTask" && e.data.action.type === "NOTIFY" && tr(e.data.action).length === 0), r = e.edges.find((t) => Q(t, e.nodes) && !t.data.isDefault && !t.data.condition);
2149
+ return t && t.type === "userTask" ? q(t.data.approverResolver) : n ? "知會節點需要至少一位知會對象。" : r ? "條件分流的每條輸出連線都需要先設定條件。" : null;
2146
2150
  }
2147
- function zn(e) {
2151
+ function q(e) {
2148
2152
  return e.type === "DIRECT" && e.memberIds.length === 0 ? "簽核節點需要指定簽核會員。" : e.type === "ORG_MANAGER" && e.levelsUp < 1 ? "簽核節點需要指定有效的主管層級。" : e.type === "ORG_UNIT_MANAGER" && !e.orgUnitId.trim() || e.type === "ORG_UNIT_MEMBER" && !e.orgUnitId.trim() ? "簽核節點需要指定組織。" : e.type === "ORG_UNIT_POSITION" && (!e.orgUnitId.trim() || !e.positionId.trim()) ? "簽核節點需要指定組織與職位。" : (e.type === "ORG_MANAGER" || e.type === "ORG_UNIT_MANAGER") && e.fallback?.type === "DIRECT" && !e.fallback.memberId.trim() ? "簽核節點需要指定改派固定人。" : e.type === "POSITION" && !e.positionId.trim() ? "簽核節點需要指定職位。" : null;
2149
2153
  }
2150
- function Bn(e) {
2151
- return e.edges.some((t) => X(t, e.nodes) && !!(t.data.condition || t.data.conditionFieldKey || t.data.conditionOperator || t.data.conditionValue));
2154
+ function Rn(e) {
2155
+ return e.edges.some((t) => Q(t, e.nodes) && !!(t.data.condition || t.data.conditionFieldKey || t.data.conditionOperator || t.data.conditionValue));
2152
2156
  }
2153
- function Vn(e) {
2157
+ function zn(e) {
2154
2158
  return e?.fields.map((e) => ({
2155
2159
  fieldType: e.type,
2156
2160
  id: e.fieldKey,
2157
2161
  name: `${e.label} (${e.fieldKey})`
2158
2162
  })) ?? [];
2159
2163
  }
2160
- function Hn(e, t) {
2164
+ function Bn(e, t) {
2161
2165
  return t ? e?.fields.find((e) => e.fieldKey === t) ?? null : null;
2162
2166
  }
2163
- function Un(e) {
2167
+ function Vn(e) {
2164
2168
  if (!e) return [];
2165
- let t = Gn(e);
2166
- return ht.filter((e) => t.includes(e.id));
2169
+ let t = J(e);
2170
+ return N.filter((e) => t.includes(e.id));
2167
2171
  }
2168
- function Wn(e) {
2169
- return ht.some((t) => t.id === e) ? e : null;
2172
+ function Hn(e) {
2173
+ return N.some((t) => t.id === e) ? e : null;
2170
2174
  }
2171
- function Gn(e) {
2175
+ function J(e) {
2172
2176
  return e.type === "file_upload" ? ["IS_FILLED", "IS_EMPTY"] : e.type === "boolean" ? [
2173
2177
  "EQUALS",
2174
2178
  "NOT_EQUALS",
@@ -2190,7 +2194,7 @@ function Gn(e) {
2190
2194
  "IS_EMPTY"
2191
2195
  ];
2192
2196
  }
2193
- function Kn(e) {
2197
+ function Un(e) {
2194
2198
  return e ? e.type === "boolean" ? [{
2195
2199
  id: "true",
2196
2200
  name: "是"
@@ -2202,71 +2206,71 @@ function Kn(e) {
2202
2206
  name: e.label
2203
2207
  })) : [] : [];
2204
2208
  }
2205
- function qn(e, t) {
2209
+ function Wn(e, t) {
2206
2210
  if (!e) return;
2207
- let n = Gn(e);
2211
+ let n = J(e);
2208
2212
  return t && n.includes(t) ? t : n[0];
2209
2213
  }
2210
- function Jn(e, t, n) {
2211
- if (!e || !t || !Yn(t)) return;
2212
- let r = Kn(e);
2214
+ function Gn(e, t, n) {
2215
+ if (!e || !t || !Kn(t)) return;
2216
+ let r = Un(e);
2213
2217
  return r.length === 0 || r.some((e) => e.id === n) ? n ?? void 0 : r[0]?.id;
2214
2218
  }
2215
- function Yn(e) {
2216
- return gt.includes(e);
2219
+ function Kn(e) {
2220
+ return ht.includes(e);
2217
2221
  }
2218
- function Xn(e, t, n) {
2222
+ function qn(e, t, n) {
2219
2223
  if (!e || !t) return;
2220
- let r = K(t);
2221
- if (!Yn(t)) return `${e.label} ${r}`;
2222
- if (n) return `${e.label} ${r} ${Zn(e, n)}`;
2224
+ let r = Jn(t);
2225
+ if (!Kn(t)) return `${e.label} ${r}`;
2226
+ if (n) return `${e.label} ${r} ${Yn(e, n)}`;
2223
2227
  }
2224
- function K(e) {
2225
- return ht.find((t) => t.id === e)?.name ?? e;
2228
+ function Jn(e) {
2229
+ return N.find((t) => t.id === e)?.name ?? e;
2226
2230
  }
2227
- function Zn(e, t) {
2228
- return e.type === "boolean" ? t === "true" ? "是" : "否" : e.type === "checkbox" || e.type === "radio" || e.type === "select" ? q(e.options, t)?.label ?? t : t;
2231
+ function Yn(e, t) {
2232
+ return e.type === "boolean" ? t === "true" ? "是" : "否" : e.type === "checkbox" || e.type === "radio" || e.type === "select" ? Y(e.options, t)?.label ?? t : t;
2229
2233
  }
2230
- function q(e, t) {
2234
+ function Y(e, t) {
2231
2235
  return e.find((e) => e.value === t) ?? null;
2232
2236
  }
2233
- function Qn(e, t, n) {
2237
+ function Xn(e, t, n) {
2234
2238
  if (!e || !t) return;
2235
- let r = J(e.fieldKey);
2239
+ let r = Zn(e.fieldKey);
2236
2240
  if (t === "IS_FILLED") return `${r} != null && ${r} != ""`;
2237
2241
  if (t === "IS_EMPTY") return `${r} == null || ${r} == ""`;
2238
- if (n) return `${r} ${Y(t)} ${$n(e, n)}`;
2242
+ if (n) return `${r} ${X(t)} ${Z(e, n)}`;
2239
2243
  }
2240
- function J(e) {
2244
+ function Zn(e) {
2241
2245
  return /^[A-Za-z_][A-Za-z0-9_]*$/u.test(e) ? `form.${e}` : `form[${JSON.stringify(e)}]`;
2242
2246
  }
2243
- function Y(e) {
2247
+ function X(e) {
2244
2248
  return e === "EQUALS" ? "==" : e === "NOT_EQUALS" ? "!=" : e === "GREATER_THAN" ? ">" : e === "GREATER_THAN_OR_EQUALS" ? ">=" : e === "LESS_THAN" ? "<" : "<=";
2245
2249
  }
2246
- function $n(e, t) {
2250
+ function Z(e, t) {
2247
2251
  return e.type === "boolean" ? t === "true" ? "true" : "false" : (e.type === "money" || e.type === "number") && Number.isFinite(Number(t)) ? t : JSON.stringify(t);
2248
2252
  }
2249
- function er(e, t) {
2253
+ function Qn(e, t) {
2250
2254
  if (e.data.label) return e.data.label;
2251
- if (X(e, t)) return tr(e);
2252
- if (Z(e, t)) return "同時進行";
2255
+ if (Q(e, t)) return $n(e);
2256
+ if (er(e, t)) return "同時進行";
2253
2257
  }
2254
- function tr(e) {
2258
+ function $n(e) {
2255
2259
  return e.data.isDefault ? "其他情況" : "請設定條件";
2256
2260
  }
2257
- function X(e, t) {
2261
+ function Q(e, t) {
2258
2262
  return t.some((t) => t.id === e.source && t.type === "exclusiveGateway");
2259
2263
  }
2260
- function Z(e, t) {
2264
+ function er(e, t) {
2261
2265
  return t.some((t) => t.id === e.source && t.type === "parallelGateway");
2262
2266
  }
2263
- function nr(e) {
2267
+ function tr(e) {
2264
2268
  return e.type === "NOTIFY" && e.recipients.type === "DIRECT" ? e.recipients.memberIds : [];
2265
2269
  }
2266
- function Q(e) {
2270
+ function nr(e) {
2267
2271
  return e instanceof Error ? e.message : "發生未知錯誤";
2268
2272
  }
2269
2273
  //#endregion
2270
- export { xt as TemplateDesignerView };
2274
+ export { bt as TemplateDesignerView };
2271
2275
 
2272
2276
  //# sourceMappingURL=index.js.map