@rytass/bpm-core-react 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +54 -6
  3. package/dist/chunks/{FormBuilderView-CLg-JYmu.js → FormBuilderView-BYL42M0d.js} +13 -33
  4. package/dist/chunks/FormBuilderView-BYL42M0d.js.map +1 -0
  5. package/dist/chunks/FormBuilderView-aBcA-_tt.cjs +3 -0
  6. package/dist/chunks/FormBuilderView-aBcA-_tt.cjs.map +1 -0
  7. package/dist/chunks/FormRendererView-DRFi_IH7.cjs +4 -0
  8. package/dist/chunks/FormRendererView-DRFi_IH7.cjs.map +1 -0
  9. package/dist/chunks/{FormRendererView-DU9LLrOF.js → FormRendererView-cZGOOjU5.js} +319 -332
  10. package/dist/chunks/FormRendererView-cZGOOjU5.js.map +1 -0
  11. package/dist/chunks/{admin-pickers-DLlG_1du.js → admin-pickers-DxhzECkD.js} +52 -51
  12. package/dist/chunks/admin-pickers-DxhzECkD.js.map +1 -0
  13. package/dist/chunks/admin-pickers-qe3j--gX.cjs +2 -0
  14. package/dist/chunks/admin-pickers-qe3j--gX.cjs.map +1 -0
  15. package/dist/chunks/approval-instance-list-page-CPXMP3PL.js.map +1 -1
  16. package/dist/chunks/approval-instance-list-page-ax0pm8bt.cjs.map +1 -1
  17. package/dist/chunks/auth-provider-4BeCw7cI.cjs.map +1 -1
  18. package/dist/chunks/auth-provider-B5oPmvk2.js.map +1 -1
  19. package/dist/chunks/bpm-form-field-Bc6k4ZEO.cjs.map +1 -1
  20. package/dist/chunks/bpm-form-field-Cao0rMol.js.map +1 -1
  21. package/dist/chunks/{categories-DGlxuC6X.js → categories-1gKxeEqw.js} +4 -10
  22. package/dist/chunks/categories-1gKxeEqw.js.map +1 -0
  23. package/dist/chunks/{categories-Yid05WAX.cjs → categories-DjENouRm.cjs} +2 -2
  24. package/dist/chunks/categories-DjENouRm.cjs.map +1 -0
  25. package/dist/chunks/{compose-BtQPBd1Q.js → compose-Crklayzy.js} +4 -4
  26. package/dist/chunks/compose-Crklayzy.js.map +1 -0
  27. package/dist/chunks/{compose-DZhTQOt4.cjs → compose-DZ7RKvUp.cjs} +2 -2
  28. package/dist/chunks/compose-DZ7RKvUp.cjs.map +1 -0
  29. package/dist/chunks/dashboard-page-BWQBSGDq.cjs +2 -0
  30. package/dist/chunks/dashboard-page-BWQBSGDq.cjs.map +1 -0
  31. package/dist/chunks/{dashboard-page-CeCLV1tp.js → dashboard-page-DdBvV6YI.js} +15 -16
  32. package/dist/chunks/dashboard-page-DdBvV6YI.js.map +1 -0
  33. package/dist/chunks/delegations-Ckf03icM.cjs +2 -0
  34. package/dist/chunks/delegations-Ckf03icM.cjs.map +1 -0
  35. package/dist/chunks/{delegations-DRupxJ4_.js → delegations-MxF3uJGW.js} +205 -215
  36. package/dist/chunks/delegations-MxF3uJGW.js.map +1 -0
  37. package/dist/chunks/delegations-V9HIe3_P.cjs +2 -0
  38. package/dist/chunks/delegations-V9HIe3_P.cjs.map +1 -0
  39. package/dist/chunks/{delegations-B8gLSt0i.js → delegations-xUt1tj8d.js} +168 -173
  40. package/dist/chunks/delegations-xUt1tj8d.js.map +1 -0
  41. package/dist/chunks/{designer-CrbBRPUU.js → designer-D9eFma1W.js} +1180 -1134
  42. package/dist/chunks/designer-D9eFma1W.js.map +1 -0
  43. package/dist/chunks/designer-sJGTGYOf.cjs +65 -0
  44. package/dist/chunks/designer-sJGTGYOf.cjs.map +1 -0
  45. package/dist/chunks/detail-DRCTnuKm.cjs +2 -0
  46. package/dist/chunks/detail-DRCTnuKm.cjs.map +1 -0
  47. package/dist/chunks/{detail-_c21WQla.js → detail-DScLf42P.js} +849 -836
  48. package/dist/chunks/detail-DScLf42P.js.map +1 -0
  49. package/dist/chunks/format-date-time-CB-LxzqT.js.map +1 -1
  50. package/dist/chunks/format-date-time-D-cx5M8z.cjs.map +1 -1
  51. package/dist/chunks/format-member-label-DudVI55w.js +13 -0
  52. package/dist/chunks/format-member-label-DudVI55w.js.map +1 -0
  53. package/dist/chunks/format-member-label-t7ANTF62.cjs +2 -0
  54. package/dist/chunks/format-member-label-t7ANTF62.cjs.map +1 -0
  55. package/dist/chunks/login-AtVxZBsC.cjs.map +1 -1
  56. package/dist/chunks/login-C6qlTC6F.js.map +1 -1
  57. package/dist/chunks/notifications-Bc4mgSds.cjs.map +1 -1
  58. package/dist/chunks/notifications-DJ5wzCye.js.map +1 -1
  59. package/dist/chunks/{orgs-BpqVu5ka.js → orgs-CY0i1fie.js} +787 -766
  60. package/dist/chunks/orgs-CY0i1fie.js.map +1 -0
  61. package/dist/chunks/orgs-Dr0FFoZo.cjs +2 -0
  62. package/dist/chunks/orgs-Dr0FFoZo.cjs.map +1 -0
  63. package/dist/chunks/providers-DHtDZFNA.cjs.map +1 -1
  64. package/dist/chunks/providers-J5eyByQj.js.map +1 -1
  65. package/dist/chunks/router-adapter--gYs13E8.cjs.map +1 -1
  66. package/dist/chunks/router-adapter-DftlFTOd.js.map +1 -1
  67. package/dist/chunks/routes-config-C1j_vFKo.cjs.map +1 -1
  68. package/dist/chunks/routes-config-yZbESPlw.js.map +1 -1
  69. package/dist/chunks/task-node-label-BF6UllxP.cjs.map +1 -1
  70. package/dist/chunks/task-node-label-CWZgOBj0.js.map +1 -1
  71. package/dist/chunks/use-bpm-member-D57LKe_u.js.map +1 -1
  72. package/dist/chunks/use-bpm-member-DpNAQtNC.cjs.map +1 -1
  73. package/dist/chunks/users-BCyePbwB.js +422 -0
  74. package/dist/chunks/users-BCyePbwB.js.map +1 -0
  75. package/dist/chunks/users-DVBJluFR.cjs +2 -0
  76. package/dist/chunks/users-DVBJluFR.cjs.map +1 -0
  77. package/dist/index.cjs +1 -1
  78. package/dist/index.cjs.map +1 -1
  79. package/dist/index.js +2 -2
  80. package/dist/index.js.map +1 -1
  81. package/dist/lib/format-member-label.d.ts +12 -0
  82. package/dist/next/index.cjs.map +1 -1
  83. package/dist/next/index.js.map +1 -1
  84. package/dist/next/workflow-chat-route.cjs.map +1 -1
  85. package/dist/next/workflow-chat-route.js.map +1 -1
  86. package/dist/pages/admin/delegations/index.cjs +1 -1
  87. package/dist/pages/admin/delegations/index.cjs.map +1 -1
  88. package/dist/pages/admin/delegations/index.js +1 -1
  89. package/dist/pages/admin/delegations/index.js.map +1 -1
  90. package/dist/pages/admin/orgs/index.cjs +1 -1
  91. package/dist/pages/admin/orgs/index.cjs.map +1 -1
  92. package/dist/pages/admin/orgs/index.js +1 -1
  93. package/dist/pages/admin/orgs/index.js.map +1 -1
  94. package/dist/pages/admin/users/index.cjs +1 -1
  95. package/dist/pages/admin/users/index.cjs.map +1 -1
  96. package/dist/pages/admin/users/index.js +1 -1
  97. package/dist/pages/admin/users/index.js.map +1 -1
  98. package/dist/pages/admin/webhook-endpoints/index.cjs.map +1 -1
  99. package/dist/pages/admin/webhook-endpoints/index.js.map +1 -1
  100. package/dist/pages/cc/index.cjs.map +1 -1
  101. package/dist/pages/cc/index.js.map +1 -1
  102. package/dist/pages/dashboard/index.cjs.map +1 -1
  103. package/dist/pages/dashboard/index.js.map +1 -1
  104. package/dist/pages/delegations/index.cjs +1 -1
  105. package/dist/pages/delegations/index.cjs.map +1 -1
  106. package/dist/pages/delegations/index.js +1 -1
  107. package/dist/pages/delegations/index.js.map +1 -1
  108. package/dist/pages/inbox/index.cjs.map +1 -1
  109. package/dist/pages/inbox/index.js.map +1 -1
  110. package/dist/pages/instances/detail/index.cjs +1 -1
  111. package/dist/pages/instances/detail/index.cjs.map +1 -1
  112. package/dist/pages/instances/detail/index.js +1 -1
  113. package/dist/pages/instances/detail/index.js.map +1 -1
  114. package/dist/pages/instances/new/index.cjs.map +1 -1
  115. package/dist/pages/instances/new/index.js.map +1 -1
  116. package/dist/pages/login/index.cjs.map +1 -1
  117. package/dist/pages/login/index.js.map +1 -1
  118. package/dist/pages/root/index.cjs.map +1 -1
  119. package/dist/pages/root/index.js.map +1 -1
  120. package/dist/pages/search/index.cjs.map +1 -1
  121. package/dist/pages/search/index.js.map +1 -1
  122. package/dist/pages/sent/index.cjs.map +1 -1
  123. package/dist/pages/sent/index.js.map +1 -1
  124. package/dist/pages/settings/notifications/index.cjs.map +1 -1
  125. package/dist/pages/settings/notifications/index.js.map +1 -1
  126. package/dist/pages/templates/categories/index.cjs +1 -1
  127. package/dist/pages/templates/categories/index.cjs.map +1 -1
  128. package/dist/pages/templates/categories/index.js +1 -1
  129. package/dist/pages/templates/categories/index.js.map +1 -1
  130. package/dist/pages/templates/compose/index.cjs +1 -1
  131. package/dist/pages/templates/compose/index.cjs.map +1 -1
  132. package/dist/pages/templates/compose/index.js +1 -1
  133. package/dist/pages/templates/compose/index.js.map +1 -1
  134. package/dist/pages/templates/designer/index.cjs +1 -1
  135. package/dist/pages/templates/designer/index.cjs.map +1 -1
  136. package/dist/pages/templates/designer/index.js +1 -1
  137. package/dist/pages/templates/designer/index.js.map +1 -1
  138. package/dist/pages/templates/index.cjs.map +1 -1
  139. package/dist/pages/templates/index.js.map +1 -1
  140. package/dist/pages/templates/versions/index.cjs.map +1 -1
  141. package/dist/pages/templates/versions/index.js.map +1 -1
  142. package/dist/views/admin/delegations/index.cjs +1 -1
  143. package/dist/views/admin/delegations/index.js +1 -2
  144. package/dist/views/admin/index.cjs +1 -1
  145. package/dist/views/admin/index.js +3 -3
  146. package/dist/views/admin/orgs/index.cjs +1 -1
  147. package/dist/views/admin/orgs/index.js +1 -2
  148. package/dist/views/admin/users/MemberTaskReassignModal.d.ts +13 -0
  149. package/dist/views/admin/users/index.cjs +1 -1
  150. package/dist/views/admin/users/index.js +1 -2
  151. package/dist/views/admin/webhook-endpoints/index.cjs.map +1 -1
  152. package/dist/views/admin/webhook-endpoints/index.js.map +1 -1
  153. package/dist/views/cc/index.cjs.map +1 -1
  154. package/dist/views/cc/index.js.map +1 -1
  155. package/dist/views/dashboard/index.cjs +1 -1
  156. package/dist/views/dashboard/index.cjs.map +1 -1
  157. package/dist/views/dashboard/index.js +1 -1
  158. package/dist/views/dashboard/index.js.map +1 -1
  159. package/dist/views/delegations/index.cjs +1 -1
  160. package/dist/views/delegations/index.js +1 -2
  161. package/dist/views/forms/builder/index.cjs +1 -1
  162. package/dist/views/forms/builder/index.js +1 -2
  163. package/dist/views/forms/renderer/index.cjs +1 -1
  164. package/dist/views/forms/renderer/index.js +1 -2
  165. package/dist/views/inbox/index.cjs +1 -1
  166. package/dist/views/inbox/index.cjs.map +1 -1
  167. package/dist/views/inbox/index.js +1 -5
  168. package/dist/views/inbox/index.js.map +1 -1
  169. package/dist/views/instances/detail/index.cjs +1 -1
  170. package/dist/views/instances/detail/index.js +1 -2
  171. package/dist/views/instances/index.js +1 -2
  172. package/dist/views/instances/new/index.cjs +1 -1
  173. package/dist/views/instances/new/index.cjs.map +1 -1
  174. package/dist/views/instances/new/index.js +4 -11
  175. package/dist/views/instances/new/index.js.map +1 -1
  176. package/dist/views/login/index.js +1 -2
  177. package/dist/views/search/index.cjs.map +1 -1
  178. package/dist/views/search/index.js.map +1 -1
  179. package/dist/views/sent/index.cjs.map +1 -1
  180. package/dist/views/sent/index.js.map +1 -1
  181. package/dist/views/settings/index.js +1 -2
  182. package/dist/views/settings/notifications/index.js +1 -2
  183. package/dist/views/templates/categories/index.cjs +1 -1
  184. package/dist/views/templates/categories/index.js +1 -2
  185. package/dist/views/templates/compose/index.cjs +1 -1
  186. package/dist/views/templates/compose/index.js +1 -2
  187. package/dist/views/templates/designer/index.cjs +1 -1
  188. package/dist/views/templates/designer/index.js +1 -2
  189. package/dist/views/templates/index.cjs +1 -1
  190. package/dist/views/templates/index.cjs.map +1 -1
  191. package/dist/views/templates/index.js +1 -1
  192. package/dist/views/templates/index.js.map +1 -1
  193. package/dist/views/templates/versions/index.cjs.map +1 -1
  194. package/dist/views/templates/versions/index.js.map +1 -1
  195. package/package.json +5 -5
  196. package/dist/chunks/FormBuilderView-6bCbIkz6.cjs +0 -3
  197. package/dist/chunks/FormBuilderView-6bCbIkz6.cjs.map +0 -1
  198. package/dist/chunks/FormBuilderView-CLg-JYmu.js.map +0 -1
  199. package/dist/chunks/FormRendererView-DU9LLrOF.js.map +0 -1
  200. package/dist/chunks/FormRendererView-gctFIqwC.cjs +0 -4
  201. package/dist/chunks/FormRendererView-gctFIqwC.cjs.map +0 -1
  202. package/dist/chunks/admin-pickers-Btvij1at.cjs +0 -2
  203. package/dist/chunks/admin-pickers-Btvij1at.cjs.map +0 -1
  204. package/dist/chunks/admin-pickers-DLlG_1du.js.map +0 -1
  205. package/dist/chunks/categories-DGlxuC6X.js.map +0 -1
  206. package/dist/chunks/categories-Yid05WAX.cjs.map +0 -1
  207. package/dist/chunks/compose-BtQPBd1Q.js.map +0 -1
  208. package/dist/chunks/compose-DZhTQOt4.cjs.map +0 -1
  209. package/dist/chunks/dashboard-page-CeCLV1tp.js.map +0 -1
  210. package/dist/chunks/dashboard-page-DooFJsxM.cjs +0 -2
  211. package/dist/chunks/dashboard-page-DooFJsxM.cjs.map +0 -1
  212. package/dist/chunks/delegations-8LsxcQM4.cjs +0 -2
  213. package/dist/chunks/delegations-8LsxcQM4.cjs.map +0 -1
  214. package/dist/chunks/delegations-B8gLSt0i.js.map +0 -1
  215. package/dist/chunks/delegations-DRupxJ4_.js.map +0 -1
  216. package/dist/chunks/delegations-DlYwMiAW.cjs +0 -2
  217. package/dist/chunks/delegations-DlYwMiAW.cjs.map +0 -1
  218. package/dist/chunks/designer-CrbBRPUU.js.map +0 -1
  219. package/dist/chunks/designer-D3_lWmfa.cjs +0 -65
  220. package/dist/chunks/designer-D3_lWmfa.cjs.map +0 -1
  221. package/dist/chunks/detail-CVXb5Vy8.cjs +0 -2
  222. package/dist/chunks/detail-CVXb5Vy8.cjs.map +0 -1
  223. package/dist/chunks/detail-_c21WQla.js.map +0 -1
  224. package/dist/chunks/orgs-BpqVu5ka.js.map +0 -1
  225. package/dist/chunks/orgs-D0-5BaHT.cjs +0 -2
  226. package/dist/chunks/orgs-D0-5BaHT.cjs.map +0 -1
  227. package/dist/chunks/users-C9LA-Rd7.cjs +0 -2
  228. package/dist/chunks/users-C9LA-Rd7.cjs.map +0 -1
  229. package/dist/chunks/users-FWrb3ehW.js +0 -214
  230. package/dist/chunks/users-FWrb3ehW.js.map +0 -1
@@ -1,23 +1,24 @@
1
1
  "use client";
2
2
  import { t as e } from "./bpm-form-field-Cao0rMol.js";
3
- import { a as t, i as n, n as r, o as i, r as a, t as o } from "./admin-pickers-DLlG_1du.js";
3
+ import { t } from "./format-member-label-DudVI55w.js";
4
+ import { a as n, i as r, n as i, o as a, r as o, t as s } from "./admin-pickers-DxhzECkD.js";
4
5
  import '../style.css';import '../orgs.css';/* empty css */
5
- import { forwardRef as s, useCallback as c, useEffect as l, useImperativeHandle as u, useMemo as d, useRef as f, useState as p } from "react";
6
- import { AutoComplete as m, Button as h, DatePicker as g, Filter as _, FilterArea as v, FilterLine as y, FormField as b, Input as x, Modal as S, PageHeader as C, Section as w, SectionGroup as T, Select as E, Tab as D, TabItem as O, Table as k, Typography as A } from "@mezzanine-ui/react";
7
- import { resolveMembers as j } from "@rytass/bpm-core-client";
8
- import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
9
- import { FormFieldLayout as F } from "@mezzanine-ui/core/form";
10
- import I from "@mezzanine-ui/react/ContentHeader";
11
- import { CloseIcon as L, EditIcon as R, PlusIcon as z, SaveIcon as B } from "@mezzanine-ui/icons";
12
- import { commitOrgUnitTreeDraft as ee, createManagerResolution as V, createMembership as te, createOrgUnit as ne, createPosition as re, deleteManagerResolution as ie, deleteMembership as ae, deleteOrgUnit as oe, deletePosition as se, readOrganizationDashboard as ce, updateManagerResolution as le, updateMembership as ue, updateOrgUnit as de, updatePosition as fe } from "@rytass/bpm-core-client/organization";
13
- import { Background as pe, ConnectionMode as me, Controls as he, Handle as ge, MiniMap as _e, Panel as ve, Position as H, ReactFlow as ye, applyNodeChanges as be } from "@xyflow/react";
14
- import * as xe from "dagre";
6
+ import { forwardRef as c, useCallback as l, useEffect as u, useImperativeHandle as d, useMemo as f, useRef as p, useState as m } from "react";
7
+ import { AutoComplete as h, Button as g, DatePicker as _, Filter as v, FilterArea as y, FilterLine as b, FormField as x, Input as S, Modal as C, PageHeader as w, Section as T, SectionGroup as E, Select as D, Tab as O, TabItem as k, Table as A, Typography as j } from "@mezzanine-ui/react";
8
+ import { resolveMembers as M } from "@rytass/bpm-core-client";
9
+ import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
10
+ import { FormFieldLayout as I } from "@mezzanine-ui/core/form";
11
+ import L from "@mezzanine-ui/react/ContentHeader";
12
+ import { CloseIcon as R, EditIcon as ee, PlusIcon as z, SaveIcon as te } from "@mezzanine-ui/icons";
13
+ import { commitOrgUnitTreeDraft as ne, createManagerResolution as re, createMembership as ie, createOrgUnit as ae, createPosition as oe, deleteManagerResolution as se, deleteMembership as ce, deleteOrgUnit as le, deletePosition as ue, readOrgUnitRetirementImpact as de, readOrganizationDashboard as fe, updateManagerResolution as pe, updateMembership as me, updateOrgUnit as he, updatePosition as ge } from "@rytass/bpm-core-client/organization";
14
+ import { Background as _e, ConnectionMode as ve, Controls as ye, Handle as be, MiniMap as xe, Panel as Se, Position as B, ReactFlow as Ce, applyNodeChanges as we } from "@xyflow/react";
15
+ import * as Te from "dagre";
15
16
  //#region src/lib/org-tree-draft.ts
16
- function Se(e) {
17
+ function Ee(e) {
17
18
  return new Map(e.map((e) => [e.id, e.parentId]));
18
19
  }
19
- function Ce({ orgUnitId: e, parentDraft: t, parentId: n }) {
20
- let r = n === e ? e : n, i = Te({
20
+ function De({ orgUnitId: e, parentDraft: t, parentId: n }) {
21
+ let r = n === e ? e : n, i = ke({
21
22
  orgUnitId: e,
22
23
  parentDraft: t,
23
24
  parentId: r
@@ -39,7 +40,7 @@ function Ce({ orgUnitId: e, parentDraft: t, parentId: n }) {
39
40
  status: "UPDATED"
40
41
  };
41
42
  }
42
- function we({ orgUnits: e, parentDraft: t }) {
43
+ function Oe({ orgUnits: e, parentDraft: t }) {
43
44
  return e.map((e) => {
44
45
  let n = t.get(e.id) ?? null;
45
46
  return n === e.parentId ? null : {
@@ -49,14 +50,14 @@ function we({ orgUnits: e, parentDraft: t }) {
49
50
  };
50
51
  }).filter((e) => !!e);
51
52
  }
52
- function Te({ orgUnitId: e, parentDraft: t, parentId: n }) {
53
- return t.has(e) ? n ? t.has(n) ? n === e ? "組織不可成為自己的上層。" : U({
53
+ function ke({ orgUnitId: e, parentDraft: t, parentId: n }) {
54
+ return t.has(e) ? n ? t.has(n) ? n === e ? "組織不可成為自己的上層。" : Ae({
54
55
  orgUnitId: e,
55
56
  parentDraft: t,
56
57
  parentId: n
57
58
  }) ? "不可搬移到自己的下層組織。" : null : "找不到新的上層組織。" : null : "找不到要搬移的組織節點。";
58
59
  }
59
- function U({ orgUnitId: e, parentDraft: t, parentId: n }) {
60
+ function Ae({ orgUnitId: e, parentDraft: t, parentId: n }) {
60
61
  let r = /* @__PURE__ */ new Set(), i = n;
61
62
  for (; i;) {
62
63
  if (i === e || r.has(i)) return !0;
@@ -64,7 +65,7 @@ function U({ orgUnitId: e, parentDraft: t, parentId: n }) {
64
65
  }
65
66
  return !1;
66
67
  }
67
- var W = {
68
+ var V = {
68
69
  orgTreeEditor: "bpm_orgTreeEditor_TMOtD",
69
70
  orgTreeSummary: "bpm_orgTreeSummary_vpcV8",
70
71
  orgTreeChangeList: "bpm_orgTreeChangeList_EzmOv",
@@ -78,28 +79,28 @@ var W = {
78
79
  orgTreeNodeHeader: "bpm_orgTreeNodeHeader_LEXl-",
79
80
  orgTreeNodeBadge: "bpm_orgTreeNodeBadge_zLc7t",
80
81
  orgTreeNodeActions: "bpm_orgTreeNodeActions_cMldI"
81
- }, G = "__org-tree-root__", K = 232, Ee = 118, De = 232, Oe = 86, ke = 320, Ae = 1.4, je = .25, Me = .005, Ne = 250, Pe = 80, q = .85, Fe = .7, Ie = 1200, Le = 600, Re = 96, ze = {
82
+ }, H = "__org-tree-root__", U = 232, je = 118, Me = 232, Ne = 86, Pe = 320, Fe = 1.4, Ie = .25, Le = .005, Re = 250, ze = 80, Be = .85, W = .7, Ve = 1200, He = 600, Ue = 96, We = {
82
83
  COMPANY: "公司",
83
84
  DEPARTMENT: "部門",
84
85
  DIVISION: "事業群",
85
86
  TEAM: "小組"
86
- }, Be = { orgUnit: He }, Ve = s(function({ onCreateChild: e, onCreateRoot: t, onEditOrgUnit: n, onSaveDraft: r, onStateChange: i, orgUnits: a }, o) {
87
- let [s, m] = p(!1), [g, _] = p(null), [v, y] = p(null), [b, x] = p(() => Se(a)), [S, C] = p(() => /* @__PURE__ */ new Set()), [w, T] = p(() => /* @__PURE__ */ new Map()), [E, D] = p([]), O = f(null), k = f(null), j = c((e) => {
87
+ }, Ge = { orgUnit: qe }, Ke = c(function({ onCreateChild: e, onCreateRoot: t, onEditOrgUnit: n, onSaveDraft: r, onStateChange: i, orgUnits: a }, o) {
88
+ let [s, c] = m(!1), [h, _] = m(null), [v, y] = m(null), [b, x] = m(() => Ee(a)), [S, C] = m(() => /* @__PURE__ */ new Set()), [w, T] = m(() => /* @__PURE__ */ new Map()), [E, D] = m([]), O = p(null), k = p(null), A = l((e) => {
88
89
  k.current = e, C((t) => {
89
90
  let n = new Set(t);
90
91
  return n.has(e) ? n.delete(e) : n.add(e), n;
91
92
  });
92
- }, []), M = c(() => {
93
- k.current = G, C(/* @__PURE__ */ new Set());
94
- }, []), F = c(() => {
95
- k.current = G, C(() => {
96
- let e = Ue(a, b);
97
- return new Set([...e.keys()].filter((e) => e !== G));
93
+ }, []), M = l(() => {
94
+ k.current = H, C(/* @__PURE__ */ new Set());
95
+ }, []), N = l(() => {
96
+ k.current = H, C(() => {
97
+ let e = Je(a, b);
98
+ return new Set([...e.keys()].filter((e) => e !== H));
98
99
  });
99
- }, [a, b]), I = d(() => new Map(a.map((e) => [e.id, e])), [a]), L = d(() => we({
100
+ }, [a, b]), I = f(() => new Map(a.map((e) => [e.id, e])), [a]), L = f(() => Oe({
100
101
  orgUnits: a,
101
102
  parentDraft: b
102
- }), [a, b]), R = d(() => Ge({
103
+ }), [a, b]), R = f(() => Xe({
103
104
  collapsedIds: S,
104
105
  isEditing: s,
105
106
  measuredHeights: w,
@@ -110,14 +111,14 @@ var W = {
110
111
  let t = I.get(e);
111
112
  t && n(t);
112
113
  },
113
- onToggleCollapse: j,
114
+ onToggleCollapse: A,
114
115
  orgUnits: a,
115
116
  orgUnitsById: I,
116
117
  parentDraft: b,
117
118
  selectedOrgUnitId: v
118
119
  }), [
119
120
  S,
120
- j,
121
+ A,
121
122
  s,
122
123
  w,
123
124
  e,
@@ -127,79 +128,75 @@ var W = {
127
128
  I,
128
129
  b,
129
130
  v
130
- ]), z = f(R);
131
- z.current = R;
132
- let B = L.length > 0, ee = d(() => {
131
+ ]), ee = p(R);
132
+ ee.current = R;
133
+ let z = L.length > 0, te = f(() => {
133
134
  let e = Math.max(R.bounds.width, R.bounds.height);
134
- return e <= 0 ? je : Math.min(je, Math.max(Me, Ne / e));
135
- }, [R.bounds.height, R.bounds.width]), V = a.length <= Pe, te = c(() => {
135
+ return e <= 0 ? Ie : Math.min(Ie, Math.max(Le, Re / e));
136
+ }, [R.bounds.height, R.bounds.width]), ne = a.length <= ze, re = l(() => {
136
137
  let e = O.current;
137
138
  if (!e) return;
138
- let { bounds: t, rootCenter: n } = z.current, r = t.width > 0 ? Ie / t.width : Infinity, i = t.height > 0 ? Le / t.height : Infinity, a = Math.min(r, i);
139
- if (!Number.isFinite(a) || a >= Fe) {
139
+ let { bounds: t, rootCenter: n } = ee.current, r = t.width > 0 ? Ve / t.width : Infinity, i = t.height > 0 ? He / t.height : Infinity, a = Math.min(r, i);
140
+ if (!Number.isFinite(a) || a >= W) {
140
141
  e.fitView({ padding: .18 });
141
142
  return;
142
143
  }
143
- let o = Le / (2 * q);
144
+ let o = He / (2 * Be);
144
145
  e.setCenter(n.x, Math.min(t.height / 2, o), {
145
146
  duration: 0,
146
- zoom: q
147
+ zoom: Be
147
148
  });
148
- }, []), ne = c((e) => {
149
- O.current = e, te();
150
- }, [te]);
151
- u(o, () => ({
152
- cancelEditing: ce,
153
- saveDraft: le,
154
- startEditing: se
155
- })), l(() => {
149
+ }, []), ie = l((e) => {
150
+ O.current = e, re();
151
+ }, [re]);
152
+ d(o, () => ({
153
+ cancelEditing: ue,
154
+ saveDraft: de,
155
+ startEditing: le
156
+ })), u(() => {
156
157
  i({
157
- hasDraftChanges: B,
158
+ hasDraftChanges: z,
158
159
  isEditing: s
159
160
  });
160
161
  }, [
161
- B,
162
+ z,
162
163
  s,
163
164
  i
164
- ]), l(() => {
165
- let e = Se(a);
166
- x(e), C(/* @__PURE__ */ new Set()), T(/* @__PURE__ */ new Map()), y(null), _(null), m(!1);
167
- }, [a]), l(() => {
165
+ ]), u(() => {
166
+ let e = Ee(a);
167
+ x(e), C(/* @__PURE__ */ new Set()), T(/* @__PURE__ */ new Map()), y(null), _(null), c(!1);
168
+ }, [a]), u(() => {
168
169
  D(R.nodes);
169
- }, [R.nodes]), l(() => {
170
+ }, [R.nodes]), u(() => {
170
171
  if (typeof window > "u") return () => void 0;
171
172
  let e = window.requestAnimationFrame(() => {
172
- te();
173
+ re();
173
174
  });
174
175
  return () => window.cancelAnimationFrame(e);
175
- }, [te, a]), l(() => {
176
+ }, [re, a]), u(() => {
176
177
  let e = k.current;
177
178
  if (!e) return;
178
179
  k.current = null;
179
180
  let t = O.current, n = R.nodes.find((t) => t.id === e);
180
- t && n && t.setCenter(n.position.x + (n.width ?? K) / 2, n.position.y + (n.initialHeight ?? Ee) / 2, {
181
+ t && n && t.setCenter(n.position.x + (n.width ?? U) / 2, n.position.y + (n.initialHeight ?? je) / 2, {
181
182
  duration: 200,
182
183
  zoom: t.getZoom()
183
184
  });
184
185
  }, [R.nodes]);
185
- let re = c((e, t) => {
186
+ let ae = l((e, t) => {
186
187
  x((n) => {
187
- let r = Ce({
188
+ let r = De({
188
189
  orgUnitId: e,
189
190
  parentDraft: n,
190
191
  parentId: t
191
192
  });
192
193
  return _(r.message), r.parentDraft;
193
194
  });
194
- }, []), ie = c((e) => {
195
+ }, []), oe = l((e) => {
195
196
  if (!s || !e.target || !e.source) return;
196
- let t = e.source === G ? null : e.source;
197
- if (e.target === G) {
198
- _("根節點不能搬移到其他節點下。");
199
- return;
200
- }
201
- re(e.target, t);
202
- }, [re, s]), ae = c((e) => {
197
+ let t = e.source === H ? null : e.source;
198
+ e.target === H ? _("根節點不能搬移到其他節點下。") : ae(e.target, t);
199
+ }, [ae, s]), se = l((e) => {
203
200
  let t = e.filter((e) => e.type === "dimensions" && e.dimensions);
204
201
  t.length > 0 && T((e) => {
205
202
  let n = new Map(e);
@@ -208,101 +205,93 @@ var W = {
208
205
  let r = Math.ceil(t.dimensions.height);
209
206
  return Math.abs((n.get(t.id) ?? 0) - r) <= 1 ? e : (n.set(t.id, r), !0);
210
207
  }, !1) ? n : e;
211
- }), s && D((t) => be(e, [...t]));
212
- }, [s]), oe = c((e, t, n) => {
213
- if (!s || t.id === G) return;
214
- let r = Je(e, t.id) ?? qe(t, n);
215
- if (r === void 0) {
216
- _("拖曳到目標父節點附近,或從父節點拉線到子節點。");
217
- return;
218
- }
219
- re(t.id, r === G ? null : r);
220
- }, [re, s]);
221
- function se() {
222
- m(!0), x(Se(a)), _("已進入編輯模式,拖曳節點或拉線只會更新前端草稿。");
208
+ }), s && D((t) => we(e, [...t]));
209
+ }, [s]), ce = l((e, t, n) => {
210
+ if (!s || t.id === H) return;
211
+ let r = $e(e, t.id) ?? Qe(t, n);
212
+ r === void 0 ? _("拖曳到目標父節點附近,或從父節點拉線到子節點。") : ae(t.id, r === H ? null : r);
213
+ }, [ae, s]);
214
+ function le() {
215
+ c(!0), x(Ee(a)), _("已進入編輯模式,拖曳節點或拉線只會更新前端草稿。");
223
216
  }
224
- function ce() {
225
- m(!1), x(Se(a)), _("已取消草稿變更。");
217
+ function ue() {
218
+ c(!1), x(Ee(a)), _("已取消草稿變更。");
226
219
  }
227
- async function le() {
228
- if (!r) {
229
- _("批次儲存 API 尚未接上,草稿仍保留在前端。");
230
- return;
231
- }
232
- await r(L), m(!1), _("組織樹草稿已儲存。");
220
+ async function de() {
221
+ r ? (await r(L), c(!1), _("組織樹草稿已儲存。")) : _("批次儲存 API 尚未接上,草稿仍保留在前端。");
233
222
  }
234
- return /* @__PURE__ */ P("div", {
235
- className: W.orgTreeEditor,
236
- children: [/* @__PURE__ */ P("div", {
237
- className: W.orgTreeSummary,
238
- children: [/* @__PURE__ */ N(A, {
223
+ return /* @__PURE__ */ F("div", {
224
+ className: V.orgTreeEditor,
225
+ children: [/* @__PURE__ */ F("div", {
226
+ className: V.orgTreeSummary,
227
+ children: [/* @__PURE__ */ P(j, {
239
228
  color: "text-neutral",
240
229
  variant: "caption",
241
- children: g ?? (B ? `目前有 ${L.length} 筆父子關係草稿變更。` : "目前沒有草稿變更。")
242
- }), B ? /* @__PURE__ */ N("ul", {
243
- className: W.orgTreeChangeList,
244
- children: L.map((e) => /* @__PURE__ */ P("li", { children: [
245
- et(e.orgUnitId, I),
230
+ children: h ?? (z ? `目前有 ${L.length} 筆父子關係草稿變更。` : "目前沒有草稿變更。")
231
+ }), z ? /* @__PURE__ */ P("ul", {
232
+ className: V.orgTreeChangeList,
233
+ children: L.map((e) => /* @__PURE__ */ F("li", { children: [
234
+ at(e.orgUnitId, I),
246
235
  ":",
247
- et(e.previousParentId, I),
236
+ at(e.previousParentId, I),
248
237
  " -> ",
249
- et(e.parentId, I)
238
+ at(e.parentId, I)
250
239
  ] }, e.orgUnitId))
251
240
  }) : null]
252
- }), /* @__PURE__ */ N("div", {
253
- className: W.orgTreeCanvas,
254
- children: /* @__PURE__ */ P(ye, {
255
- connectionMode: me.Strict,
241
+ }), /* @__PURE__ */ P("div", {
242
+ className: V.orgTreeCanvas,
243
+ children: /* @__PURE__ */ F(Ce, {
244
+ connectionMode: ve.Strict,
256
245
  edges: [...R.edges],
257
246
  fitViewOptions: {
258
- minZoom: ee,
247
+ minZoom: te,
259
248
  padding: .18
260
249
  },
261
- isValidConnection: (e) => $e({
250
+ isValidConnection: (e) => it({
262
251
  source: e.source,
263
252
  target: e.target
264
253
  }, b),
265
- maxZoom: Ae,
266
- minZoom: ee,
267
- nodeTypes: Be,
254
+ maxZoom: Fe,
255
+ minZoom: te,
256
+ nodeTypes: Ge,
268
257
  nodes: [...E],
269
258
  nodesConnectable: s,
270
259
  nodesDraggable: s,
271
- onConnect: ie,
272
- onInit: ne,
260
+ onConnect: oe,
261
+ onInit: ie,
273
262
  onNodeClick: (e, t) => {
274
- y(t.id === G ? null : t.id);
263
+ y(t.id === H ? null : t.id);
275
264
  },
276
265
  onNodeDoubleClick: (e, t) => {
277
- if (t.id !== G) {
266
+ if (t.id !== H) {
278
267
  let e = I.get(t.id);
279
268
  e && n(e);
280
269
  }
281
270
  },
282
- onNodeDragStop: oe,
283
- onNodesChange: ae,
271
+ onNodeDragStop: ce,
272
+ onNodesChange: se,
284
273
  onPaneClick: () => y(null),
285
274
  panOnDrag: !0,
286
275
  proOptions: { hideAttribution: !0 },
287
276
  children: [
288
- /* @__PURE__ */ N(pe, {}),
289
- /* @__PURE__ */ N(he, {}),
290
- /* @__PURE__ */ P(ve, {
291
- className: `${W.orgTreePanel} nopan nodrag`,
277
+ /* @__PURE__ */ P(_e, {}),
278
+ /* @__PURE__ */ P(ye, {}),
279
+ /* @__PURE__ */ F(Se, {
280
+ className: `${V.orgTreePanel} nopan nodrag`,
292
281
  position: "top-right",
293
- children: [/* @__PURE__ */ N(h, {
282
+ children: [/* @__PURE__ */ P(g, {
294
283
  onClick: M,
295
284
  size: "sub",
296
285
  variant: "base-secondary",
297
286
  children: "全部展開"
298
- }), /* @__PURE__ */ N(h, {
299
- onClick: F,
287
+ }), /* @__PURE__ */ P(g, {
288
+ onClick: N,
300
289
  size: "sub",
301
290
  variant: "base-secondary",
302
291
  children: "全部收合"
303
292
  })]
304
293
  }),
305
- V ? /* @__PURE__ */ N(_e, {
294
+ ne ? /* @__PURE__ */ P(xe, {
306
295
  pannable: !0,
307
296
  zoomable: !0
308
297
  }) : null
@@ -311,42 +300,42 @@ var W = {
311
300
  })]
312
301
  });
313
302
  });
314
- function He({ data: e, selected: t }) {
315
- return /* @__PURE__ */ P("div", {
303
+ function qe({ data: e, selected: t }) {
304
+ return /* @__PURE__ */ F("div", {
316
305
  className: [
317
- W.orgTreeNode,
318
- e.isSyntheticRoot ? W.orgTreeNodeRoot : "",
319
- e.changed ? W.orgTreeNodeChanged : "",
320
- e.deleted ? W.orgTreeNodeDeleted : "",
321
- t ? W.orgTreeNodeSelected : ""
306
+ V.orgTreeNode,
307
+ e.isSyntheticRoot ? V.orgTreeNodeRoot : "",
308
+ e.changed ? V.orgTreeNodeChanged : "",
309
+ e.deleted ? V.orgTreeNodeDeleted : "",
310
+ t ? V.orgTreeNodeSelected : ""
322
311
  ].filter(Boolean).join(" "),
323
312
  children: [
324
- e.isSyntheticRoot ? null : /* @__PURE__ */ N(ge, {
313
+ e.isSyntheticRoot ? null : /* @__PURE__ */ P(be, {
325
314
  id: "target",
326
315
  isConnectable: e.isEditing,
327
- position: H.Top,
316
+ position: B.Top,
328
317
  type: "target"
329
318
  }),
330
- /* @__PURE__ */ N(ge, {
319
+ /* @__PURE__ */ P(be, {
331
320
  id: "source",
332
321
  isConnectable: e.isEditing,
333
- position: H.Bottom,
322
+ position: B.Bottom,
334
323
  type: "source"
335
324
  }),
336
- /* @__PURE__ */ P("div", {
337
- className: W.orgTreeNodeHeader,
338
- children: [/* @__PURE__ */ N(A, {
325
+ /* @__PURE__ */ F("div", {
326
+ className: V.orgTreeNodeHeader,
327
+ children: [/* @__PURE__ */ P(j, {
339
328
  component: "span",
340
329
  ellipsis: !0,
341
330
  title: e.name,
342
331
  variant: "label-primary",
343
332
  children: e.name
344
- }), e.changed ? /* @__PURE__ */ N("span", {
345
- className: W.orgTreeNodeBadge,
333
+ }), e.changed ? /* @__PURE__ */ P("span", {
334
+ className: V.orgTreeNodeBadge,
346
335
  children: "草稿"
347
336
  }) : null]
348
337
  }),
349
- /* @__PURE__ */ N(A, {
338
+ /* @__PURE__ */ P(j, {
350
339
  color: "text-neutral",
351
340
  component: "span",
352
341
  ellipsis: !0,
@@ -354,7 +343,7 @@ function He({ data: e, selected: t }) {
354
343
  variant: "caption",
355
344
  children: e.isSyntheticRoot ? "根節點容器" : `${e.typeLabel} · ${e.code}`
356
345
  }),
357
- e.isSyntheticRoot ? null : /* @__PURE__ */ P(A, {
346
+ e.isSyntheticRoot ? null : /* @__PURE__ */ F(j, {
358
347
  color: "text-neutral",
359
348
  component: "span",
360
349
  ellipsis: !0,
@@ -362,24 +351,24 @@ function He({ data: e, selected: t }) {
362
351
  variant: "caption",
363
352
  children: ["上層:", e.parentLabel]
364
353
  }),
365
- /* @__PURE__ */ P("div", {
366
- className: `${W.orgTreeNodeActions} nodrag nopan`,
367
- children: [e.childCount > 0 ? /* @__PURE__ */ N(h, {
354
+ /* @__PURE__ */ F("div", {
355
+ className: `${V.orgTreeNodeActions} nodrag nopan`,
356
+ children: [e.childCount > 0 ? /* @__PURE__ */ P(g, {
368
357
  onClick: (t) => {
369
- t.stopPropagation(), e.onToggleCollapse(e.orgUnitId ?? G);
358
+ t.stopPropagation(), e.onToggleCollapse(e.orgUnitId ?? H);
370
359
  },
371
360
  size: "sub",
372
361
  variant: "base-secondary",
373
362
  children: e.collapsed ? `展開 (${e.childCount})` : `收合 (${e.childCount})`
374
- }) : null, e.isSyntheticRoot ? /* @__PURE__ */ N(h, {
363
+ }) : null, e.isSyntheticRoot ? /* @__PURE__ */ P(g, {
375
364
  icon: z,
376
365
  iconType: "leading",
377
366
  onClick: () => e.onCreateChild(null),
378
367
  size: "sub",
379
368
  variant: "base-secondary",
380
369
  children: "新增根節點"
381
- }) : /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(h, {
382
- icon: R,
370
+ }) : /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(g, {
371
+ icon: ee,
383
372
  iconType: "leading",
384
373
  onClick: () => {
385
374
  e.orgUnitId && e.onEdit(e.orgUnitId);
@@ -387,7 +376,7 @@ function He({ data: e, selected: t }) {
387
376
  size: "sub",
388
377
  variant: "base-secondary",
389
378
  children: "編輯"
390
- }), /* @__PURE__ */ N(h, {
379
+ }), /* @__PURE__ */ P(g, {
391
380
  icon: z,
392
381
  iconType: "leading",
393
382
  onClick: () => e.onCreateChild(e.orgUnitId),
@@ -399,57 +388,57 @@ function He({ data: e, selected: t }) {
399
388
  ]
400
389
  });
401
390
  }
402
- function Ue(e, t) {
391
+ function Je(e, t) {
403
392
  let n = /* @__PURE__ */ new Map();
404
393
  return e.forEach((e) => {
405
- let r = t.get(e.id) ?? G;
394
+ let r = t.get(e.id) ?? H;
406
395
  n.set(r, [...n.get(r) ?? [], e.id]);
407
396
  }), n;
408
397
  }
409
- function We({ childrenMap: e, collapsedIds: t }) {
398
+ function Ye({ childrenMap: e, collapsedIds: t }) {
410
399
  let n = /* @__PURE__ */ new Set(), r = (i) => {
411
400
  t.has(i) || (e.get(i) ?? []).forEach((e) => {
412
401
  n.add(e), r(e);
413
402
  });
414
403
  };
415
- return r(G), n;
404
+ return r(H), n;
416
405
  }
417
- function Ge({ collapsedIds: e, isEditing: t, measuredHeights: n, onCreateChild: r, onEditOrgUnit: i, onToggleCollapse: a, orgUnits: o, orgUnitsById: s, parentDraft: c, selectedOrgUnitId: l }) {
418
- let u = Ue(o, c), d = We({
406
+ function Xe({ collapsedIds: e, isEditing: t, measuredHeights: n, onCreateChild: r, onEditOrgUnit: i, onToggleCollapse: a, orgUnits: o, orgUnitsById: s, parentDraft: c, selectedOrgUnitId: l }) {
407
+ let u = Je(o, c), d = Ye({
419
408
  childrenMap: u,
420
409
  collapsedIds: e
421
- }), f = o.filter((e) => d.has(e.id)), p = (e) => u.get(e)?.length ?? 0, m = (e, t) => Math.max(t, n.get(e) ?? 0), h = new xe.graphlib.Graph();
410
+ }), f = o.filter((e) => d.has(e.id)), p = (e) => u.get(e)?.length ?? 0, m = (e, t) => Math.max(t, n.get(e) ?? 0), h = new Te.graphlib.Graph();
422
411
  h.setDefaultEdgeLabel(() => ({})), h.setGraph({
423
412
  marginx: 36,
424
413
  marginy: 36,
425
414
  nodesep: 44,
426
415
  rankdir: "TB",
427
- ranksep: Re
428
- }), h.setNode(G, {
429
- height: m(G, Oe),
430
- width: De
416
+ ranksep: Ue
417
+ }), h.setNode(H, {
418
+ height: m(H, Ne),
419
+ width: Me
431
420
  }), f.forEach((e) => {
432
421
  h.setNode(e.id, {
433
- height: m(e.id, Ee),
434
- width: K
422
+ height: m(e.id, je),
423
+ width: U
435
424
  });
436
425
  }), f.forEach((e) => {
437
426
  let t = c.get(e.id) ?? null;
438
- h.setEdge(t ?? G, e.id);
439
- }), xe.layout(h);
427
+ h.setEdge(t ?? H, e.id);
428
+ }), Te.layout(h);
440
429
  let g = h.graph(), _ = {
441
430
  height: g.height ?? 0,
442
431
  width: g.width ?? 0
443
- }, v = h.node(G), y = {
432
+ }, v = h.node(H), y = {
444
433
  x: _.width > 0 ? _.width / 2 : v?.x ?? 0,
445
434
  y: v?.y ?? 0
446
435
  }, b = {
447
- ...Ke({
436
+ ...Ze({
448
437
  data: {
449
438
  changed: !1,
450
- childCount: p(G),
451
- code: G,
452
- collapsed: e.has(G),
439
+ childCount: p(H),
440
+ code: H,
441
+ collapsed: e.has(H),
453
442
  deleted: !1,
454
443
  isEditing: t,
455
444
  isSyntheticRoot: !0,
@@ -463,18 +452,18 @@ function Ge({ collapsedIds: e, isEditing: t, measuredHeights: n, onCreateChild:
463
452
  typeLabel: ""
464
453
  },
465
454
  graph: h,
466
- height: m(G, Oe),
467
- id: G,
455
+ height: m(H, Ne),
456
+ id: H,
468
457
  selected: l === null,
469
- width: De
458
+ width: Me
470
459
  }),
471
460
  position: {
472
- x: y.x - De / 2,
473
- y: y.y - m(G, Oe) / 2
461
+ x: y.x - Me / 2,
462
+ y: y.y - m(H, Ne) / 2
474
463
  }
475
464
  }, x = f.map((n) => {
476
- let o = c.get(n.id) ?? null, u = et(o, s);
477
- return Ke({
465
+ let o = c.get(n.id) ?? null, u = at(o, s);
466
+ return Ze({
478
467
  data: {
479
468
  changed: o !== n.parentId,
480
469
  childCount: p(n.id),
@@ -490,13 +479,13 @@ function Ge({ collapsedIds: e, isEditing: t, measuredHeights: n, onCreateChild:
490
479
  orgUnitId: n.id,
491
480
  parentLabel: u,
492
481
  path: n.path,
493
- typeLabel: tt(n.type)
482
+ typeLabel: ot(n.type)
494
483
  },
495
484
  graph: h,
496
- height: m(n.id, Ee),
485
+ height: m(n.id, je),
497
486
  id: n.id,
498
487
  selected: l === n.id,
499
- width: K
488
+ width: U
500
489
  });
501
490
  });
502
491
  return {
@@ -507,7 +496,7 @@ function Ge({ collapsedIds: e, isEditing: t, measuredHeights: n, onCreateChild:
507
496
  animated: t && r,
508
497
  data: {},
509
498
  id: `org-tree-edge-${n ?? "root"}-${e.id}`,
510
- source: n ?? G,
499
+ source: n ?? H,
511
500
  sourceHandle: "source",
512
501
  style: r ? {
513
502
  stroke: "var(--mzn-color-primary, #0057ff)",
@@ -522,7 +511,7 @@ function Ge({ collapsedIds: e, isEditing: t, measuredHeights: n, onCreateChild:
522
511
  rootCenter: y
523
512
  };
524
513
  }
525
- function Ke({ data: e, graph: t, height: n, id: r, selected: i, width: a }) {
514
+ function Ze({ data: e, graph: t, height: n, id: r, selected: i, width: a }) {
526
515
  let o = t.node(r);
527
516
  return {
528
517
  data: e,
@@ -537,21 +526,21 @@ function Ke({ data: e, graph: t, height: n, id: r, selected: i, width: a }) {
537
526
  y: 0
538
527
  },
539
528
  selected: i,
540
- sourcePosition: H.Bottom,
541
- targetPosition: H.Top,
529
+ sourcePosition: B.Bottom,
530
+ targetPosition: B.Top,
542
531
  type: "orgUnit",
543
532
  width: a
544
533
  };
545
534
  }
546
- function qe(e, t) {
547
- let n = Ze(e);
535
+ function Qe(e, t) {
536
+ let n = nt(e);
548
537
  return t.filter((t) => t.id !== e.id).map((e) => ({
549
- distance: Qe(n, Ze(e)),
538
+ distance: rt(n, nt(e)),
550
539
  id: e.id
551
- })).filter((e) => e.distance <= ke).sort((e, t) => e.distance - t.distance)[0]?.id;
540
+ })).filter((e) => e.distance <= Pe).sort((e, t) => e.distance - t.distance)[0]?.id;
552
541
  }
553
- function Je(e, t) {
554
- let n = Ye(e);
542
+ function $e(e, t) {
543
+ let n = et(e);
555
544
  if (n) return Array.from(document.querySelectorAll(".react-flow__node[data-id]")).map((e) => {
556
545
  let r = e.dataset.id;
557
546
  if (!r || r === t) return null;
@@ -560,45 +549,45 @@ function Je(e, t) {
560
549
  y: i.top + i.height / 2
561
550
  };
562
551
  return {
563
- distance: Qe(n, a),
552
+ distance: rt(n, a),
564
553
  id: r
565
554
  };
566
- }).filter((e) => !!e).filter((e) => e.distance <= ke).sort((e, t) => e.distance - t.distance)[0]?.id;
555
+ }).filter((e) => !!e).filter((e) => e.distance <= Pe).sort((e, t) => e.distance - t.distance)[0]?.id;
567
556
  }
568
- function Ye(e) {
569
- return Xe(e) ? {
557
+ function et(e) {
558
+ return tt(e) ? {
570
559
  x: e.clientX,
571
560
  y: e.clientY
572
561
  } : null;
573
562
  }
574
- function Xe(e) {
563
+ function tt(e) {
575
564
  return typeof e == "object" && !!e && "clientX" in e && "clientY" in e && typeof e.clientX == "number" && typeof e.clientY == "number";
576
565
  }
577
- function Ze(e) {
566
+ function nt(e) {
578
567
  return {
579
- x: e.position.x + (e.width ?? K) / 2,
580
- y: e.position.y + (e.measured?.height ?? e.initialHeight ?? Ee) / 2
568
+ x: e.position.x + (e.width ?? U) / 2,
569
+ y: e.position.y + (e.measured?.height ?? e.initialHeight ?? je) / 2
581
570
  };
582
571
  }
583
- function Qe(e, t) {
572
+ function rt(e, t) {
584
573
  return Math.hypot(e.x - t.x, e.y - t.y);
585
574
  }
586
- function $e(e, t) {
587
- return !e.source || !e.target || e.target === G ? !1 : Te({
575
+ function it(e, t) {
576
+ return !e.source || !e.target || e.target === H ? !1 : ke({
588
577
  orgUnitId: e.target,
589
578
  parentDraft: t,
590
- parentId: e.source === G ? null : e.source
579
+ parentId: e.source === H ? null : e.source
591
580
  }) === null;
592
581
  }
593
- function et(e, t) {
582
+ function at(e, t) {
594
583
  if (!e) return "根節點";
595
584
  let n = t.get(e);
596
585
  return n ? `${n.name} · ${n.code}` : "未知組織";
597
586
  }
598
- function tt(e) {
599
- return ze[e.toUpperCase()] ?? "未知類型";
587
+ function ot(e) {
588
+ return We[e.toUpperCase()] ?? "未知類型";
600
589
  }
601
- var J = {
590
+ var G = {
602
591
  tableIntroActions: "bpm_tableIntroActions_WO4XU",
603
592
  modalFields: "bpm_modalFields_juyv6",
604
593
  tableIntro: "bpm_tableIntro_u3hcm",
@@ -606,10 +595,10 @@ var J = {
606
595
  orgFilterArea: "bpm_orgFilterArea_Xjbbp",
607
596
  membershipFilterArea: "bpm_membershipFilterArea_zob-Y",
608
597
  scopeLabel: "bpm_scopeLabel_TLHMC"
609
- }, nt = {
598
+ }, K = {
610
599
  hasDraftChanges: !1,
611
600
  isEditing: !1
612
- }, rt = 100, Y = [
601
+ }, st = 100, q = [
613
602
  {
614
603
  id: "COMPANY",
615
604
  name: "公司"
@@ -626,10 +615,10 @@ var J = {
626
615
  id: "TEAM",
627
616
  name: "小組"
628
617
  }
629
- ], it = {
618
+ ], ct = {
630
619
  id: "ALL",
631
620
  name: "全部類型"
632
- }, at = [it, ...Y], X = [
621
+ }, J = [ct, ...q], Y = [
633
622
  {
634
623
  id: "MEMBER",
635
624
  name: "指定會員"
@@ -642,18 +631,18 @@ var J = {
642
631
  id: "POSITION",
643
632
  name: "指定職位"
644
633
  }
645
- ], ot = {
634
+ ], lt = {
646
635
  id: "ALL",
647
636
  name: "全部範圍"
648
- }, st = [ot, ...X], ct = {
637
+ }, ut = [lt, ...Y], dt = {
649
638
  activeOnly: !1,
650
639
  id: "ALL",
651
640
  name: "全部狀態"
652
- }, Z = [ct, {
641
+ }, ft = [dt, {
653
642
  activeOnly: !0,
654
643
  id: "ACTIVE",
655
644
  name: "目前有效"
656
- }], Q = [{
645
+ }], X = [{
657
646
  id: "true",
658
647
  name: "主要歸屬",
659
648
  value: !0
@@ -661,107 +650,116 @@ var J = {
661
650
  id: "false",
662
651
  name: "一般歸屬",
663
652
  value: !1
664
- }], lt = [
653
+ }], pt = [
665
654
  10,
666
655
  20,
667
656
  50
668
- ], ut = 1368, dt = 948, ft = 1292, pt = 1124;
669
- function mt() {
670
- let [e, t] = p("ORG_UNITS"), [n, r] = p(null), [i, a] = p(null), [o, s] = p(null), [u, f] = p(!0), [m, h] = p(null), [g, _] = p(ct), [v, y] = p(1), [b, x] = p(10), [E, k] = p(ot), [F, L] = p(0), [R, z] = p([]), [B, pe] = p(null), [me, he] = p(null), [ge, _e] = p(null), [ve, H] = p(1), [ye, be] = p(10), [xe, Se] = p(null), [Ce, we] = p(0), [Te, U] = p(null), [W, G] = p(1), [K, Ee] = p(10), [De, Oe] = p(""), [ke, Ae] = p(0), [je, Me] = p(it), [Ne, Pe] = p("TABLE"), [q, Fe] = p([]), [Ie, Le] = p([]), [Re, ze] = p([]), [Be, Ve] = p(null), [He, Ue] = p(1), [We, Ge] = p(10), [Ke, qe] = p(""), [Je, Ye] = p(0), [Xe, Ze] = p([]), [Qe, $e] = p([]), [et, tt] = p([]), [J, nt] = p(!1);
671
- l(() => {
672
- n && a(n);
673
- }, [n]);
674
- let Y = n ?? i, at = c(async () => {
675
- f(!0), s(null);
657
+ ], mt = 1368, ht = 948, gt = 1292, Z = 1124;
658
+ function _t() {
659
+ let [t, n] = m("ORG_UNITS"), [r, a] = m(null), [o, s] = m(null), [c, d] = m(null), [p, h] = m(!0), [g, _] = m(null), [v, y] = m(dt), [b, x] = m(1), [S, D] = m(10), [A, I] = m(lt), [R, ee] = m(0), [z, te] = m([]), [_e, ve] = m(null), [ye, be] = m(null), [xe, Se] = m(null), [B, Ce] = m(1), [we, Te] = m(10), [Ee, De] = m(null), [Oe, ke] = m(0), [Ae, V] = m(null), [H, U] = m(1), [je, Me] = m(10), [Ne, Pe] = m(""), [Fe, Ie] = m(0), [Le, Re] = m(ct), [ze, Be] = m("TABLE"), [W, Ve] = m([]), [He, Ue] = m([]), [We, Ge] = m([]), [Ke, qe] = m(null), [Je, Ye] = m(1), [Xe, Ze] = m(10), [Qe, $e] = m(""), [et, tt] = m(0), [nt, rt] = m([]), [it, at] = m([]), [ot, G] = m([]), [K, q] = m(!1), [J, Y] = m(null), [ut, ft] = m(null);
660
+ u(() => {
661
+ r && s(r);
662
+ }, [r]), u(() => {
663
+ let e = !1;
664
+ return Y(null), ft(null), r?.type === "ORG_UNIT" && de(r.id).then((t) => {
665
+ e || Y(t);
666
+ }).catch((t) => {
667
+ e || d(en(t));
668
+ }), () => {
669
+ e = !0;
670
+ };
671
+ }, [r]);
672
+ let X = r?.type === "ORG_UNIT", pt = X && J !== null && (J.openMembershipCount > 0 || J.openManagerResolutionCount > 0), mt = X && (J === null || J.childUnitCount > 0 || pt && !ut), ht = r ?? o, gt = l(async () => {
673
+ h(!0), d(null);
676
674
  try {
677
- let e = await ce({
678
- managerActiveOnly: g.activeOnly,
679
- managerPage: v,
680
- managerPageSize: b,
681
- managerScopeType: E.id === "ALL" ? null : E.id,
682
- membershipActiveOnly: B?.activeOnly ?? !1,
683
- membershipOrgUnitId: ge?.id ?? null,
684
- membershipPage: ve,
685
- membershipPageSize: ye,
686
- membershipPositionId: xe?.id ?? null,
687
- orgUnitPage: W,
688
- orgUnitPageSize: K,
689
- orgUnitSearchText: De,
690
- orgUnitType: je.id === "ALL" ? null : je.id,
691
- positionPage: He,
692
- positionPageSize: We,
693
- positionSearchText: Ke
694
- }), t = kt(e.memberships, e.managerResolutions), n = await j(t);
695
- z(n), Fe(e.orgUnits), Ae(e.orgUnitCount), Le(e.filteredOrgUnits), Ze(e.positions), Ye(e.positionCount), ze(e.filteredPositions), we(e.membershipCount), tt(e.filteredMemberships), L(e.managerResolutionCount), $e(e.filteredManagerResolutions);
675
+ let e = await fe({
676
+ managerActiveOnly: v.activeOnly,
677
+ managerPage: b,
678
+ managerPageSize: S,
679
+ managerScopeType: A.id === "ALL" ? null : A.id,
680
+ membershipActiveOnly: _e?.activeOnly ?? !1,
681
+ membershipOrgUnitId: xe?.id ?? null,
682
+ membershipPage: B,
683
+ membershipPageSize: we,
684
+ membershipPositionId: Ee?.id ?? null,
685
+ orgUnitPage: H,
686
+ orgUnitPageSize: je,
687
+ orgUnitSearchText: Ne,
688
+ orgUnitType: Le.id === "ALL" ? null : Le.id,
689
+ positionPage: Je,
690
+ positionPageSize: Xe,
691
+ positionSearchText: Qe
692
+ }), t = Mt(e.memberships, e.managerResolutions), n = await M(t);
693
+ te(n), Ve(e.orgUnits), Ie(e.orgUnitCount), Ue(e.filteredOrgUnits), rt(e.positions), tt(e.positionCount), Ge(e.filteredPositions), ke(e.membershipCount), G(e.filteredMemberships), ee(e.managerResolutionCount), at(e.filteredManagerResolutions);
696
694
  } catch (e) {
697
- s(Qt(e));
695
+ d(en(e));
698
696
  } finally {
699
- f(!1);
697
+ h(!1);
700
698
  }
701
699
  }, [
702
- g,
703
700
  v,
704
701
  b,
705
- E,
706
- B,
707
- ge,
708
- ve,
709
- ye,
702
+ S,
703
+ A,
704
+ _e,
710
705
  xe,
711
- W,
712
- K,
713
- De,
706
+ B,
707
+ we,
708
+ Ee,
709
+ H,
714
710
  je,
715
- He,
716
- We,
717
- Ke
711
+ Ne,
712
+ Le,
713
+ Je,
714
+ Xe,
715
+ Qe
718
716
  ]);
719
- l(() => {
720
- at();
721
- }, [at]);
722
- let X = d(() => new Map(q.map((e) => [e.id, e])), [q]), st = d(() => new Map(Xe.map((e) => [e.id, e])), [Xe]), Z = d(() => new Map(R.map((e) => [e.memberId, e])), [R]), Q = d(() => Ie.map((e) => ({
717
+ u(() => {
718
+ gt();
719
+ }, [gt]);
720
+ let Z = f(() => new Map(W.map((e) => [e.id, e])), [W]), _t = f(() => new Map(nt.map((e) => [e.id, e])), [nt]), Q = f(() => new Map(z.map((e) => [e.memberId, e])), [z]), St = f(() => He.map((e) => ({
723
721
  ...e,
724
722
  key: e.id,
725
- parentName: e.parentId ? Mt(X.get(e.parentId)) : "根節點",
726
- typeLabel: Nt(e.type)
727
- })), [Ie, X]), lt = d(() => Re.map((e) => ({
723
+ parentName: e.parentId ? Ft(Z.get(e.parentId)) : "根節點",
724
+ typeLabel: It(e.type)
725
+ })), [He, Z]), Ct = f(() => We.map((e) => ({
728
726
  ...e,
729
727
  key: e.id
730
- })), [Re]), ut = d(() => et.map((e) => ({
728
+ })), [We]), wt = f(() => ot.map((e) => ({
731
729
  ...e,
732
730
  key: e.id,
733
- memberName: jt(Z.get(e.memberId)),
734
- orgUnitName: Mt(X.get(e.orgUnitId)),
735
- positionName: e.positionId ? Pt(st.get(e.positionId)) : "未指定"
731
+ memberName: Pt(Q.get(e.memberId)),
732
+ orgUnitName: Ft(Z.get(e.orgUnitId)),
733
+ positionName: e.positionId ? Lt(_t.get(e.positionId)) : "未指定"
736
734
  })), [
735
+ Q,
736
+ ot,
737
737
  Z,
738
- et,
739
- X,
740
- st
741
- ]), dt = d(() => Qe.map((e) => ({
738
+ _t
739
+ ]), Tt = f(() => it.map((e) => ({
742
740
  ...e,
743
741
  key: e.id,
744
- managerName: jt(Z.get(e.managerMemberId)),
745
- scopeLabel: At(e, {
746
- membersById: Z,
747
- orgUnitsById: X,
748
- positionsById: st
742
+ managerName: Pt(Q.get(e.managerMemberId)),
743
+ scopeLabel: Nt(e, {
744
+ membersById: Q,
745
+ orgUnitsById: Z,
746
+ positionsById: _t
749
747
  })
750
748
  })), [
751
- Qe,
749
+ it,
750
+ Q,
752
751
  Z,
753
- X,
754
- st
755
- ]), ft = d(() => ({
752
+ _t
753
+ ]), At = f(() => ({
756
754
  render: (e) => [{
757
755
  name: "編輯",
758
- onClick: () => U({
756
+ onClick: () => V({
759
757
  record: e,
760
758
  type: "EDIT"
761
759
  })
762
760
  }, {
763
761
  name: "停用",
764
- onClick: () => r({
762
+ onClick: () => a({
765
763
  confirmText: "停用組織",
766
764
  description: `停用「${e.name}」後,這個組織節點將不再出現在可用組織清單中。`,
767
765
  id: e.id,
@@ -772,16 +770,16 @@ function mt() {
772
770
  }],
773
771
  variant: "base-secondary",
774
772
  width: 128
775
- }), []), pt = d(() => ({
773
+ }), []), jt = f(() => ({
776
774
  render: (e) => [{
777
775
  name: "編輯",
778
- onClick: () => Ve({
776
+ onClick: () => qe({
779
777
  record: e,
780
778
  type: "EDIT"
781
779
  })
782
780
  }, {
783
781
  name: "刪除",
784
- onClick: () => r({
782
+ onClick: () => a({
785
783
  confirmText: "刪除職位",
786
784
  description: `刪除職位「${e.name}」。若仍有會員歸屬、主管解析規則、簽核範本或進行中單據的加簽對象引用它,系統會拒絕刪除並說明原因。`,
787
785
  id: e.id,
@@ -792,16 +790,16 @@ function mt() {
792
790
  }],
793
791
  variant: "base-secondary",
794
792
  width: 128
795
- }), []), mt = d(() => ({
793
+ }), []), zt = f(() => ({
796
794
  render: (e) => [{
797
795
  name: "編輯",
798
- onClick: () => he({
796
+ onClick: () => be({
799
797
  record: e,
800
798
  type: "EDIT"
801
799
  })
802
800
  }, {
803
801
  name: "刪除",
804
- onClick: () => r({
802
+ onClick: () => a({
805
803
  confirmText: "刪除歸屬",
806
804
  description: `刪除「${e.memberName}」在「${e.orgUnitName}」的會員歸屬。`,
807
805
  id: e.id,
@@ -812,16 +810,16 @@ function mt() {
812
810
  }],
813
811
  variant: "base-secondary",
814
812
  width: 128
815
- }), []), yt = d(() => ({
813
+ }), []), Bt = f(() => ({
816
814
  render: (e) => [{
817
815
  name: "編輯",
818
- onClick: () => h({
816
+ onClick: () => _({
819
817
  record: e,
820
818
  type: "EDIT"
821
819
  })
822
820
  }, {
823
821
  name: "刪除",
824
- onClick: () => r({
822
+ onClick: () => a({
825
823
  confirmText: "刪除主管規則",
826
824
  description: `刪除「${e.scopeLabel}」指派給「${e.managerName}」的主管解析規則。`,
827
825
  id: e.id,
@@ -833,303 +831,334 @@ function mt() {
833
831
  variant: "base-secondary",
834
832
  width: 128
835
833
  }), []);
836
- function bt(e) {
837
- G(1), Oe(e);
834
+ function Vt(e) {
835
+ U(1), Pe(e);
838
836
  }
839
- function xt(e) {
840
- G(1), Me(e);
837
+ function Ht(e) {
838
+ U(1), Re(e);
841
839
  }
842
- function St(e) {
843
- Ue(1), qe(e);
840
+ function Ut(e) {
841
+ Ye(1), $e(e);
844
842
  }
845
- function Ct(e) {
846
- H(1), pe(e);
843
+ function Wt(e) {
844
+ Ce(1), ve(e);
847
845
  }
848
- function $(e) {
849
- H(1), _e(e);
846
+ function Gt(e) {
847
+ Ce(1), Se(e);
850
848
  }
851
- function Ot(e) {
852
- H(1), Se(e);
849
+ function Kt(e) {
850
+ Ce(1), De(e);
853
851
  }
854
- function It(e) {
855
- y(1), _(e);
852
+ function qt(e) {
853
+ x(1), y(e);
856
854
  }
857
- function Lt(e) {
858
- y(1), k(e);
855
+ function Jt(e) {
856
+ x(1), I(e);
859
857
  }
860
- function Rt() {
861
- J || r(null);
858
+ function $() {
859
+ K || a(null);
862
860
  }
863
- async function zt() {
864
- n && await Vt(async () => {
865
- n.type === "ORG_UNIT" && await oe(n.id), n.type === "POSITION" && await se(n.id), n.type === "MEMBERSHIP" && await ae(n.id), n.type === "MANAGER_RESOLUTION" && await ie(n.id), r(null);
861
+ async function Yt() {
862
+ r && await Qt(async () => {
863
+ r.type === "ORG_UNIT" && await le(r.id, { transferToOrgUnitId: pt ? ut?.id ?? null : null }), r.type === "POSITION" && await ue(r.id), r.type === "MEMBERSHIP" && await ce(r.id), r.type === "MANAGER_RESOLUTION" && await se(r.id), a(null);
866
864
  });
867
865
  }
868
- async function Bt(e) {
869
- nt(!0), s(null);
866
+ async function Zt(e) {
867
+ q(!0), d(null);
870
868
  try {
871
- await ee({ moves: e.map((e) => ({
872
- baseUpdatedAt: X.get(e.orgUnitId)?.updatedAt ?? "",
869
+ await ne({ moves: e.map((e) => ({
870
+ baseUpdatedAt: Z.get(e.orgUnitId)?.updatedAt ?? "",
873
871
  id: e.orgUnitId,
874
872
  parentId: e.parentId
875
- })) }), await at();
873
+ })) }), await gt();
876
874
  } catch (e) {
877
- throw s(Qt(e)), e;
875
+ throw d(en(e)), e;
878
876
  } finally {
879
- nt(!1);
877
+ q(!1);
880
878
  }
881
879
  }
882
- async function Vt(e) {
883
- nt(!0), s(null);
880
+ async function Qt(e) {
881
+ q(!0), d(null);
884
882
  try {
885
- await e(), await at();
883
+ await e(), await gt();
886
884
  } catch (e) {
887
- s(Qt(e));
885
+ d(en(e));
888
886
  } finally {
889
- nt(!1);
887
+ q(!1);
890
888
  }
891
889
  }
892
- return /* @__PURE__ */ P(M, { children: [
893
- /* @__PURE__ */ N(C, { children: /* @__PURE__ */ N(I, {
890
+ return /* @__PURE__ */ F(N, { children: [
891
+ /* @__PURE__ */ P(w, { children: /* @__PURE__ */ P(L, {
894
892
  description: "維護組織樹、職位、會員歸屬與簽核主管解析規則。",
895
893
  title: "組織管理"
896
894
  }) }),
897
- /* @__PURE__ */ N(T, { children: /* @__PURE__ */ P(w, {
898
- tab: /* @__PURE__ */ P(D, {
899
- activeKey: e,
900
- onChange: (e) => t(Ft(e)),
895
+ /* @__PURE__ */ P(E, { children: /* @__PURE__ */ F(T, {
896
+ tab: /* @__PURE__ */ F(O, {
897
+ activeKey: t,
898
+ onChange: (e) => n(Rt(e)),
901
899
  children: [
902
- /* @__PURE__ */ N(O, { children: "組織樹" }, "ORG_UNITS"),
903
- /* @__PURE__ */ N(O, { children: "職位" }, "POSITIONS"),
904
- /* @__PURE__ */ N(O, { children: "會員歸屬" }, "MEMBERSHIPS"),
905
- /* @__PURE__ */ N(O, { children: "簽核主管" }, "MANAGERS")
900
+ /* @__PURE__ */ P(k, { children: "組織樹" }, "ORG_UNITS"),
901
+ /* @__PURE__ */ P(k, { children: "職位" }, "POSITIONS"),
902
+ /* @__PURE__ */ P(k, { children: "會員歸屬" }, "MEMBERSHIPS"),
903
+ /* @__PURE__ */ P(k, { children: "簽核主管" }, "MANAGERS")
906
904
  ]
907
905
  }),
908
906
  children: [
909
- o ? /* @__PURE__ */ N(A, {
907
+ c ? /* @__PURE__ */ P(j, {
910
908
  color: "text-error",
911
909
  variant: "body",
912
- children: o
910
+ children: c
913
911
  }) : null,
914
- e === "ORG_UNITS" ? /* @__PURE__ */ N(ht, {
915
- actions: ft,
916
- loading: u,
917
- onCreate: () => U({
912
+ t === "ORG_UNITS" ? /* @__PURE__ */ P(vt, {
913
+ actions: At,
914
+ loading: p,
915
+ onCreate: () => V({
918
916
  parentId: null,
919
917
  record: null,
920
918
  type: "CREATE"
921
919
  }),
922
- onCreateChild: (e) => U({
920
+ onCreateChild: (e) => V({
923
921
  parentId: e,
924
922
  record: null,
925
923
  type: "CREATE"
926
924
  }),
927
- onEditOrgUnit: (e) => U({
925
+ onEditOrgUnit: (e) => V({
928
926
  record: e,
929
927
  type: "EDIT"
930
928
  }),
931
- onPageChange: G,
932
- onSaveDraft: Bt,
929
+ onPageChange: U,
930
+ onSaveDraft: Zt,
933
931
  onPageSizeChange: (e) => {
934
- G(1), Ee(e);
932
+ U(1), Me(e);
935
933
  },
936
- onSearchTextChange: bt,
937
- onTypeFilterChange: xt,
938
- orgUnits: q,
939
- page: W,
940
- pageSize: K,
941
- rows: Q,
942
- searchText: De,
943
- saving: J,
944
- total: ke,
945
- typeFilter: je,
946
- viewMode: Ne,
947
- onViewModeChange: Pe
934
+ onSearchTextChange: Vt,
935
+ onTypeFilterChange: Ht,
936
+ orgUnits: W,
937
+ page: H,
938
+ pageSize: je,
939
+ rows: St,
940
+ searchText: Ne,
941
+ saving: K,
942
+ total: Fe,
943
+ typeFilter: Le,
944
+ viewMode: ze,
945
+ onViewModeChange: Be
948
946
  }) : null,
949
- e === "POSITIONS" ? /* @__PURE__ */ N(gt, {
950
- actions: pt,
951
- loading: u,
952
- onCreate: () => Ve({
947
+ t === "POSITIONS" ? /* @__PURE__ */ P(yt, {
948
+ actions: jt,
949
+ loading: p,
950
+ onCreate: () => qe({
953
951
  record: null,
954
952
  type: "CREATE"
955
953
  }),
956
- onPageChange: Ue,
954
+ onPageChange: Ye,
957
955
  onPageSizeChange: (e) => {
958
- Ue(1), Ge(e);
956
+ Ye(1), Ze(e);
959
957
  },
960
- onSearchTextChange: St,
961
- page: He,
962
- pageSize: We,
963
- rows: lt,
964
- searchText: Ke,
965
- total: Je
958
+ onSearchTextChange: Ut,
959
+ page: Je,
960
+ pageSize: Xe,
961
+ rows: Ct,
962
+ searchText: Qe,
963
+ total: et
966
964
  }) : null,
967
- e === "MEMBERSHIPS" ? /* @__PURE__ */ N(_t, {
968
- actions: mt,
969
- loading: u,
970
- onCreate: () => he({
965
+ t === "MEMBERSHIPS" ? /* @__PURE__ */ P(bt, {
966
+ actions: zt,
967
+ loading: p,
968
+ onCreate: () => be({
971
969
  record: null,
972
970
  type: "CREATE"
973
971
  }),
974
- onActiveFilterChange: Ct,
975
- onOrgUnitFilterChange: $,
976
- onPageChange: H,
972
+ onActiveFilterChange: Wt,
973
+ onOrgUnitFilterChange: Gt,
974
+ onPageChange: Ce,
977
975
  onPageSizeChange: (e) => {
978
- H(1), be(e);
976
+ Ce(1), Te(e);
979
977
  },
980
- onPositionFilterChange: Ot,
981
- orgUnitFilter: ge,
982
- orgUnits: q,
983
- page: ve,
984
- pageSize: ye,
985
- positionFilter: xe,
986
- positions: Xe,
987
- rows: ut,
988
- statusFilter: B,
989
- total: Ce
978
+ onPositionFilterChange: Kt,
979
+ orgUnitFilter: xe,
980
+ orgUnits: W,
981
+ page: B,
982
+ pageSize: we,
983
+ positionFilter: Ee,
984
+ positions: nt,
985
+ rows: wt,
986
+ statusFilter: _e,
987
+ total: Oe
990
988
  }) : null,
991
- e === "MANAGERS" ? /* @__PURE__ */ N(vt, {
992
- actions: yt,
993
- loading: u,
994
- onCreate: () => h({
989
+ t === "MANAGERS" ? /* @__PURE__ */ P(xt, {
990
+ actions: Bt,
991
+ loading: p,
992
+ onCreate: () => _({
995
993
  record: null,
996
994
  type: "CREATE"
997
995
  }),
998
- onActiveFilterChange: It,
999
- onPageChange: y,
996
+ onActiveFilterChange: qt,
997
+ onPageChange: x,
1000
998
  onPageSizeChange: (e) => {
1001
- y(1), x(e);
999
+ x(1), D(e);
1002
1000
  },
1003
- onScopeTypeFilterChange: Lt,
1004
- page: v,
1005
- pageSize: b,
1006
- rows: dt,
1007
- scopeTypeFilter: E,
1008
- statusFilter: g,
1009
- total: F
1001
+ onScopeTypeFilterChange: Jt,
1002
+ page: b,
1003
+ pageSize: S,
1004
+ rows: Tt,
1005
+ scopeTypeFilter: A,
1006
+ statusFilter: v,
1007
+ total: R
1010
1008
  }) : null
1011
1009
  ]
1012
1010
  }) }),
1013
- /* @__PURE__ */ N(wt, {
1014
- modal: Te,
1015
- onClose: () => U(null),
1016
- onSubmit: (e) => Vt(async () => {
1017
- Te?.type === "EDIT" && Te.record ? await de({
1011
+ /* @__PURE__ */ P(Et, {
1012
+ modal: Ae,
1013
+ onClose: () => V(null),
1014
+ onSubmit: (e) => Qt(async () => {
1015
+ Ae?.type === "EDIT" && Ae.record ? await he({
1018
1016
  ...e,
1019
- id: Te.record.id,
1017
+ id: Ae.record.id,
1020
1018
  metadataJson: null
1021
- }) : await ne({
1019
+ }) : await ae({
1022
1020
  code: e.code ?? "",
1023
1021
  metadataJson: "{}",
1024
1022
  name: e.name ?? "",
1025
1023
  parentId: e.parentId,
1026
1024
  type: e.type ?? "DEPARTMENT"
1027
- }), U(null);
1025
+ }), V(null);
1028
1026
  }),
1029
- orgUnits: q,
1030
- saving: J
1027
+ orgUnits: W,
1028
+ saving: K
1031
1029
  }),
1032
- /* @__PURE__ */ N(Tt, {
1033
- modal: Be,
1034
- onClose: () => Ve(null),
1035
- onSubmit: (e) => Vt(async () => {
1036
- Be?.type === "EDIT" && Be.record ? await fe({
1030
+ /* @__PURE__ */ P(Dt, {
1031
+ modal: Ke,
1032
+ onClose: () => qe(null),
1033
+ onSubmit: (e) => Qt(async () => {
1034
+ Ke?.type === "EDIT" && Ke.record ? await ge({
1037
1035
  ...e,
1038
- id: Be.record.id,
1036
+ id: Ke.record.id,
1039
1037
  metadataJson: null
1040
- }) : await re({
1038
+ }) : await oe({
1041
1039
  code: e.code ?? "",
1042
1040
  level: e.level ?? 0,
1043
1041
  metadataJson: "{}",
1044
1042
  name: e.name ?? ""
1045
- }), Ve(null);
1043
+ }), qe(null);
1046
1044
  }),
1047
- saving: J
1045
+ saving: K
1048
1046
  }),
1049
- /* @__PURE__ */ N(Et, {
1050
- membersById: Z,
1051
- modal: me,
1052
- onClose: () => he(null),
1053
- onSubmit: (e) => Vt(async () => {
1054
- me?.type === "EDIT" && me.record ? await ue({
1047
+ /* @__PURE__ */ P(Ot, {
1048
+ membersById: Q,
1049
+ modal: ye,
1050
+ onClose: () => be(null),
1051
+ onSubmit: (e) => Qt(async () => {
1052
+ ye?.type === "EDIT" && ye.record ? await me({
1055
1053
  ...e,
1056
- id: me.record.id
1057
- }) : await te({
1058
- effectiveFrom: e.effectiveFrom ?? Jt(),
1054
+ id: ye.record.id
1055
+ }) : await ie({
1056
+ effectiveFrom: e.effectiveFrom ?? Xt(),
1059
1057
  effectiveTo: e.effectiveTo,
1060
1058
  isPrimary: e.isPrimary ?? !1,
1061
1059
  memberId: e.memberId ?? "",
1062
1060
  orgUnitId: e.orgUnitId ?? "",
1063
1061
  positionId: e.positionId
1064
- }), he(null);
1062
+ }), be(null);
1065
1063
  }),
1066
- orgUnits: q,
1067
- positions: Xe,
1068
- saving: J
1064
+ orgUnits: W,
1065
+ positions: nt,
1066
+ saving: K
1069
1067
  }),
1070
- /* @__PURE__ */ N(Dt, {
1071
- membersById: Z,
1072
- modal: m,
1073
- onClose: () => h(null),
1074
- onSubmit: (e) => Vt(async () => {
1075
- m?.type === "EDIT" && m.record ? await le({
1068
+ /* @__PURE__ */ P(kt, {
1069
+ membersById: Q,
1070
+ modal: g,
1071
+ onClose: () => _(null),
1072
+ onSubmit: (e) => Qt(async () => {
1073
+ g?.type === "EDIT" && g.record ? await pe({
1076
1074
  ...e,
1077
- id: m.record.id
1078
- }) : await V({
1079
- effectiveFrom: e.effectiveFrom ?? Jt(),
1075
+ id: g.record.id
1076
+ }) : await re({
1077
+ effectiveFrom: e.effectiveFrom ?? Xt(),
1080
1078
  effectiveTo: e.effectiveTo,
1081
1079
  managerMemberId: e.managerMemberId ?? "",
1082
- priority: e.priority ?? rt,
1080
+ priority: e.priority ?? st,
1083
1081
  scopeId: e.scopeId ?? "",
1084
1082
  scopeType: e.scopeType ?? "MEMBER"
1085
- }), h(null);
1083
+ }), _(null);
1086
1084
  }),
1087
- orgUnits: q,
1088
- positions: Xe,
1089
- saving: J
1085
+ orgUnits: W,
1086
+ positions: nt,
1087
+ saving: K
1090
1088
  }),
1091
- /* @__PURE__ */ P(S, {
1089
+ /* @__PURE__ */ F(C, {
1092
1090
  cancelText: "取消",
1093
- confirmButtonProps: { variant: "destructive-primary" },
1094
- confirmText: Y?.confirmText ?? "",
1095
- loading: J,
1091
+ confirmButtonProps: {
1092
+ disabled: mt,
1093
+ variant: "destructive-primary"
1094
+ },
1095
+ confirmText: pt ? "轉移並停用" : ht?.confirmText ?? "",
1096
+ loading: K,
1096
1097
  modalStatusType: "error",
1097
1098
  modalType: "standard",
1098
- onCancel: Rt,
1099
- onClose: Rt,
1100
- onConfirm: () => void zt(),
1101
- open: !!n,
1099
+ onCancel: $,
1100
+ onClose: $,
1101
+ onConfirm: () => void Yt(),
1102
+ open: !!r,
1102
1103
  showModalFooter: !0,
1103
1104
  showModalHeader: !0,
1104
1105
  size: "regular",
1105
1106
  supportingText: "此操作會立即套用,請確認後再繼續。",
1106
- title: Y?.title ?? "",
1107
- children: [/* @__PURE__ */ N(A, {
1108
- color: "text-neutral",
1109
- variant: "body",
1110
- children: Y?.description ?? ""
1111
- }), o ? /* @__PURE__ */ N(A, {
1112
- color: "text-error",
1113
- variant: "body",
1114
- children: o
1115
- }) : null]
1107
+ title: ht?.title ?? "",
1108
+ children: [
1109
+ /* @__PURE__ */ P(j, {
1110
+ color: "text-neutral",
1111
+ variant: "body",
1112
+ children: ht?.description ?? ""
1113
+ }),
1114
+ X && J === null && !c ? /* @__PURE__ */ P(j, {
1115
+ color: "text-neutral",
1116
+ variant: "body",
1117
+ children: "正在確認這個組織目前的歸屬與主管規則…"
1118
+ }) : null,
1119
+ X && J && J.childUnitCount > 0 ? /* @__PURE__ */ P(j, {
1120
+ color: "text-error",
1121
+ variant: "body",
1122
+ children: `這個組織底下還有 ${J.childUnitCount} 個子組織,請先移動或停用子組織。`
1123
+ }) : null,
1124
+ pt && J ? /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(j, {
1125
+ color: "text-neutral",
1126
+ variant: "body",
1127
+ children: `這個組織還有 ${J.openMembershipCount} 筆尚未結束的會員歸屬(含未來才生效的)、${J.openManagerResolutionCount} 筆簽核主管規則。請選擇承接組織:已生效的歸屬會在昨天結束,並自今天起改掛到承接組織,保留歷史;尚未生效的歸屬直接改掛;這個組織的簽核主管規則會一併結束。`
1128
+ }), /* @__PURE__ */ P(e, {
1129
+ label: "承接組織",
1130
+ name: "successorOrgUnitId",
1131
+ children: /* @__PURE__ */ P(i, {
1132
+ name: "successorOrgUnitId",
1133
+ onChange: ft,
1134
+ orgUnits: W.filter((e) => e.id !== r?.id),
1135
+ placeholder: "選擇承接組織",
1136
+ value: ut
1137
+ })
1138
+ })] }) : null,
1139
+ c ? /* @__PURE__ */ P(j, {
1140
+ color: "text-error",
1141
+ variant: "body",
1142
+ children: c
1143
+ }) : null
1144
+ ]
1116
1145
  })
1117
1146
  ] });
1118
1147
  }
1119
- function ht({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUnit: i, onPageChange: a, onSaveDraft: o, onPageSizeChange: s, onSearchTextChange: c, onTypeFilterChange: u, onViewModeChange: m, orgUnits: g, page: S, pageSize: C, rows: w, searchText: T, saving: D, total: O, typeFilter: A, viewMode: j }) {
1120
- let I = f(null), [R, z] = p(nt), B = j === "TABLE" ? "FLOW" : "TABLE", ee = j === "TABLE" ? "切換樹狀圖" : "切換表格", V = j === "FLOW", te = bt({
1121
- isTreeMode: V,
1122
- isTreeEditing: R.isEditing
1123
- }), ne = xt({
1124
- isTreeMode: V,
1125
- isTreeEditing: R.isEditing
1126
- }), re = St({
1127
- hasDraftChanges: R.hasDraftChanges,
1128
- isTreeEditing: R.isEditing,
1129
- isTreeMode: V,
1148
+ function vt({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUnit: i, onPageChange: a, onSaveDraft: o, onPageSizeChange: s, onSearchTextChange: c, onTypeFilterChange: l, onViewModeChange: d, orgUnits: h, page: _, pageSize: C, rows: w, searchText: T, saving: E, total: O, typeFilter: k, viewMode: j }) {
1149
+ let M = p(null), [L, ee] = m(K), z = j === "TABLE" ? "FLOW" : "TABLE", te = j === "TABLE" ? "切換樹狀圖" : "切換表格", ne = j === "FLOW", re = St({
1150
+ isTreeMode: ne,
1151
+ isTreeEditing: L.isEditing
1152
+ }), ie = Ct({
1153
+ isTreeMode: ne,
1154
+ isTreeEditing: L.isEditing
1155
+ }), ae = wt({
1156
+ hasDraftChanges: L.hasDraftChanges,
1157
+ isTreeEditing: L.isEditing,
1158
+ isTreeMode: ne,
1130
1159
  loading: t,
1131
- saving: D
1132
- }), ie = d(() => [
1160
+ saving: E
1161
+ }), oe = f(() => [
1133
1162
  {
1134
1163
  dataIndex: "code",
1135
1164
  key: "code",
@@ -1161,47 +1190,39 @@ function ht({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUn
1161
1190
  width: 420
1162
1191
  }
1163
1192
  ], []);
1164
- return l(() => {
1165
- j === "TABLE" && z(nt);
1166
- }, [j]), /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Ct, {
1167
- actionDisabled: re,
1168
- actionIcon: ne,
1169
- actionLabel: te,
1170
- actions: /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(h, {
1171
- onClick: () => m(B),
1193
+ return u(() => {
1194
+ j === "TABLE" && ee(K);
1195
+ }, [j]), /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(Tt, {
1196
+ actionDisabled: ae,
1197
+ actionIcon: ie,
1198
+ actionLabel: re,
1199
+ actions: /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(g, {
1200
+ onClick: () => d(z),
1172
1201
  variant: "base-secondary",
1173
- children: ee
1174
- }), V && R.isEditing ? /* @__PURE__ */ N(h, {
1175
- disabled: D,
1176
- icon: L,
1202
+ children: te
1203
+ }), ne && L.isEditing ? /* @__PURE__ */ P(g, {
1204
+ disabled: E,
1205
+ icon: R,
1177
1206
  iconType: "leading",
1178
- onClick: () => I.current?.cancelEditing(),
1207
+ onClick: () => M.current?.cancelEditing(),
1179
1208
  variant: "base-secondary",
1180
1209
  children: "取消"
1181
1210
  }) : null] }),
1182
1211
  description: "組織節點使用 ltree path 維護階層,搬移節點會同步更新子節點 path。",
1183
1212
  onCreate: () => {
1184
- if (!V) {
1185
- n();
1186
- return;
1187
- }
1188
- if (R.isEditing) {
1189
- I.current?.saveDraft();
1190
- return;
1191
- }
1192
- I.current?.startEditing();
1213
+ ne ? L.isEditing ? M.current?.saveDraft() : M.current?.startEditing() : n();
1193
1214
  },
1194
1215
  title: "組織樹"
1195
- }), j === "TABLE" ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(v, {
1196
- className: J.orgFilterArea,
1216
+ }), j === "TABLE" ? /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(y, {
1217
+ className: G.orgFilterArea,
1197
1218
  size: "sub",
1198
- children: /* @__PURE__ */ P(y, { children: [/* @__PURE__ */ N(_, {
1219
+ children: /* @__PURE__ */ F(b, { children: [/* @__PURE__ */ P(v, {
1199
1220
  span: 3,
1200
- children: /* @__PURE__ */ N(b, {
1221
+ children: /* @__PURE__ */ P(x, {
1201
1222
  fullWidth: !0,
1202
- layout: F.VERTICAL,
1223
+ layout: I.VERTICAL,
1203
1224
  name: "orgUnitSearchText",
1204
- children: /* @__PURE__ */ N(x, {
1225
+ children: /* @__PURE__ */ P(S, {
1205
1226
  fullWidth: !0,
1206
1227
  onChange: (e) => c(e.target.value),
1207
1228
  placeholder: "搜尋組織名稱或代碼",
@@ -1210,53 +1231,53 @@ function ht({ actions: e, loading: t, onCreate: n, onCreateChild: r, onEditOrgUn
1210
1231
  variant: "base"
1211
1232
  })
1212
1233
  })
1213
- }), /* @__PURE__ */ N(_, {
1234
+ }), /* @__PURE__ */ P(v, {
1214
1235
  span: 2,
1215
- children: /* @__PURE__ */ N(b, {
1236
+ children: /* @__PURE__ */ P(x, {
1216
1237
  fullWidth: !0,
1217
- layout: F.VERTICAL,
1238
+ layout: I.VERTICAL,
1218
1239
  name: "orgUnitTypeFilter",
1219
- children: /* @__PURE__ */ N(E, {
1240
+ children: /* @__PURE__ */ P(D, {
1220
1241
  clearable: !1,
1221
1242
  fullWidth: !0,
1222
- onChange: (e) => u(Lt(e)),
1223
- options: [...at],
1243
+ onChange: (e) => l(Bt(e)),
1244
+ options: [...J],
1224
1245
  placeholder: "類型",
1225
1246
  size: "sub",
1226
- value: A
1247
+ value: k
1227
1248
  })
1228
1249
  })
1229
1250
  })] })
1230
- }), /* @__PURE__ */ N("div", {
1231
- className: J.tableFrame,
1232
- children: /* @__PURE__ */ N(k, {
1251
+ }), /* @__PURE__ */ P("div", {
1252
+ className: G.tableFrame,
1253
+ children: /* @__PURE__ */ P(A, {
1233
1254
  actions: e,
1234
- columns: ie,
1255
+ columns: oe,
1235
1256
  dataSource: [...w],
1236
1257
  fullWidth: !0,
1237
1258
  loading: t,
1238
- pagination: yt({
1259
+ pagination: Q({
1239
1260
  onPageChange: a,
1240
1261
  onPageSizeChange: s,
1241
- page: S,
1262
+ page: _,
1242
1263
  pageSize: C,
1243
1264
  total: O
1244
1265
  }),
1245
- style: { minWidth: ut }
1266
+ style: { minWidth: mt }
1246
1267
  })
1247
- })] }) : /* @__PURE__ */ N(Ve, {
1248
- ref: I,
1268
+ })] }) : /* @__PURE__ */ P(Ke, {
1269
+ ref: M,
1249
1270
  onCreateChild: r,
1250
1271
  onCreateRoot: n,
1251
1272
  onEditOrgUnit: i,
1252
1273
  onSaveDraft: o,
1253
- onStateChange: z,
1254
- orgUnits: g,
1255
- saving: D
1274
+ onStateChange: ee,
1275
+ orgUnits: h,
1276
+ saving: E
1256
1277
  })] });
1257
1278
  }
1258
- function gt({ actions: e, loading: t, onCreate: n, onPageChange: r, onPageSizeChange: i, onSearchTextChange: a, page: o, pageSize: s, rows: c, searchText: l, total: u }) {
1259
- let f = d(() => [
1279
+ function yt({ actions: e, loading: t, onCreate: n, onPageChange: r, onPageSizeChange: i, onSearchTextChange: a, page: o, pageSize: s, rows: c, searchText: l, total: u }) {
1280
+ let d = f(() => [
1260
1281
  {
1261
1282
  dataIndex: "code",
1262
1283
  key: "code",
@@ -1282,23 +1303,23 @@ function gt({ actions: e, loading: t, onCreate: n, onPageChange: r, onPageSizeCh
1282
1303
  width: 220
1283
1304
  }
1284
1305
  ], []);
1285
- return /* @__PURE__ */ P(M, { children: [
1286
- /* @__PURE__ */ N(Ct, {
1306
+ return /* @__PURE__ */ F(N, { children: [
1307
+ /* @__PURE__ */ P(Tt, {
1287
1308
  actionLabel: "新增職位",
1288
1309
  description: "職位提供會員歸屬與主管解析規則使用。",
1289
1310
  onCreate: n,
1290
1311
  title: "職位"
1291
1312
  }),
1292
- /* @__PURE__ */ N(v, {
1293
- className: J.orgFilterArea,
1313
+ /* @__PURE__ */ P(y, {
1314
+ className: G.orgFilterArea,
1294
1315
  size: "sub",
1295
- children: /* @__PURE__ */ N(y, { children: /* @__PURE__ */ N(_, {
1316
+ children: /* @__PURE__ */ P(b, { children: /* @__PURE__ */ P(v, {
1296
1317
  span: 3,
1297
- children: /* @__PURE__ */ N(b, {
1318
+ children: /* @__PURE__ */ P(x, {
1298
1319
  fullWidth: !0,
1299
- layout: F.VERTICAL,
1320
+ layout: I.VERTICAL,
1300
1321
  name: "positionSearchText",
1301
- children: /* @__PURE__ */ N(x, {
1322
+ children: /* @__PURE__ */ P(S, {
1302
1323
  fullWidth: !0,
1303
1324
  onChange: (e) => a(e.target.value),
1304
1325
  placeholder: "搜尋職位名稱或代碼",
@@ -1309,28 +1330,28 @@ function gt({ actions: e, loading: t, onCreate: n, onPageChange: r, onPageSizeCh
1309
1330
  })
1310
1331
  }) })
1311
1332
  }),
1312
- /* @__PURE__ */ N("div", {
1313
- className: J.tableFrame,
1314
- children: /* @__PURE__ */ N(k, {
1333
+ /* @__PURE__ */ P("div", {
1334
+ className: G.tableFrame,
1335
+ children: /* @__PURE__ */ P(A, {
1315
1336
  actions: e,
1316
- columns: f,
1337
+ columns: d,
1317
1338
  dataSource: [...c],
1318
1339
  fullWidth: !0,
1319
1340
  loading: t,
1320
- pagination: yt({
1341
+ pagination: Q({
1321
1342
  onPageChange: r,
1322
1343
  onPageSizeChange: i,
1323
1344
  page: o,
1324
1345
  pageSize: s,
1325
1346
  total: u
1326
1347
  }),
1327
- style: { minWidth: dt }
1348
+ style: { minWidth: ht }
1328
1349
  })
1329
1350
  })
1330
1351
  ] });
1331
1352
  }
1332
- function _t({ actions: e, loading: n, onCreate: r, onActiveFilterChange: a, onOrgUnitFilterChange: o, onPageChange: s, onPageSizeChange: c, onPositionFilterChange: l, orgUnitFilter: u, orgUnits: f, page: p, pageSize: h, positionFilter: g, positions: x, rows: S, statusFilter: C, total: w }) {
1333
- let T = d(() => [
1353
+ function bt({ actions: e, loading: t, onCreate: r, onActiveFilterChange: i, onOrgUnitFilterChange: o, onPageChange: s, onPageSizeChange: c, onPositionFilterChange: l, orgUnitFilter: u, orgUnits: d, page: p, pageSize: m, positionFilter: g, positions: _, rows: S, statusFilter: C, total: w }) {
1354
+ let T = f(() => [
1334
1355
  {
1335
1356
  dataIndex: "memberName",
1336
1357
  key: "memberName",
@@ -1367,25 +1388,25 @@ function _t({ actions: e, loading: n, onCreate: r, onActiveFilterChange: a, onOr
1367
1388
  title: "結束日",
1368
1389
  width: 140
1369
1390
  }
1370
- ], []), E = d(() => f.map(t), [f]), D = d(() => x.map(i), [x]);
1371
- return /* @__PURE__ */ P(M, { children: [
1372
- /* @__PURE__ */ N(Ct, {
1391
+ ], []), E = f(() => d.map(n), [d]), D = f(() => _.map(a), [_]);
1392
+ return /* @__PURE__ */ F(N, { children: [
1393
+ /* @__PURE__ */ P(Tt, {
1373
1394
  actionLabel: "新增歸屬",
1374
1395
  description: "會員歸屬是 BPM 內部組織權限、主管解析與條件判斷的來源。",
1375
1396
  onCreate: r,
1376
1397
  title: "會員歸屬"
1377
1398
  }),
1378
- /* @__PURE__ */ N(v, {
1379
- className: [J.orgFilterArea, J.membershipFilterArea].join(" "),
1399
+ /* @__PURE__ */ P(y, {
1400
+ className: [G.orgFilterArea, G.membershipFilterArea].join(" "),
1380
1401
  size: "sub",
1381
- children: /* @__PURE__ */ P(y, { children: [
1382
- /* @__PURE__ */ N(_, {
1402
+ children: /* @__PURE__ */ F(b, { children: [
1403
+ /* @__PURE__ */ P(v, {
1383
1404
  span: 2,
1384
- children: /* @__PURE__ */ N(b, {
1405
+ children: /* @__PURE__ */ P(x, {
1385
1406
  fullWidth: !0,
1386
- layout: F.VERTICAL,
1407
+ layout: I.VERTICAL,
1387
1408
  name: "membershipOrgUnitFilter",
1388
- children: /* @__PURE__ */ N(m, {
1409
+ children: /* @__PURE__ */ P(h, {
1389
1410
  disabledOptionsFilter: !0,
1390
1411
  emptyText: "沒有符合的組織",
1391
1412
  inputProps: {
@@ -1396,7 +1417,7 @@ function _t({ actions: e, loading: n, onCreate: r, onActiveFilterChange: a, onOr
1396
1417
  },
1397
1418
  mode: "single",
1398
1419
  name: "membershipOrgUnitFilter",
1399
- onChange: (e) => o(Ht(e)),
1420
+ onChange: (e) => o(Gt(e)),
1400
1421
  options: [...E],
1401
1422
  placeholder: "全部組織",
1402
1423
  size: "sub",
@@ -1404,13 +1425,13 @@ function _t({ actions: e, loading: n, onCreate: r, onActiveFilterChange: a, onOr
1404
1425
  })
1405
1426
  })
1406
1427
  }),
1407
- /* @__PURE__ */ N(_, {
1428
+ /* @__PURE__ */ P(v, {
1408
1429
  span: 2,
1409
- children: /* @__PURE__ */ N(b, {
1430
+ children: /* @__PURE__ */ P(x, {
1410
1431
  fullWidth: !0,
1411
- layout: F.VERTICAL,
1432
+ layout: I.VERTICAL,
1412
1433
  name: "membershipPositionFilter",
1413
- children: /* @__PURE__ */ N(m, {
1434
+ children: /* @__PURE__ */ P(h, {
1414
1435
  disabledOptionsFilter: !0,
1415
1436
  emptyText: "沒有符合的職位",
1416
1437
  inputProps: {
@@ -1421,7 +1442,7 @@ function _t({ actions: e, loading: n, onCreate: r, onActiveFilterChange: a, onOr
1421
1442
  },
1422
1443
  mode: "single",
1423
1444
  name: "membershipPositionFilter",
1424
- onChange: (e) => l(Ut(e)),
1445
+ onChange: (e) => l(Kt(e)),
1425
1446
  options: [...D],
1426
1447
  placeholder: "全部職位",
1427
1448
  size: "sub",
@@ -1429,13 +1450,13 @@ function _t({ actions: e, loading: n, onCreate: r, onActiveFilterChange: a, onOr
1429
1450
  })
1430
1451
  })
1431
1452
  }),
1432
- /* @__PURE__ */ N(_, {
1453
+ /* @__PURE__ */ P(v, {
1433
1454
  span: 2,
1434
- children: /* @__PURE__ */ N(b, {
1455
+ children: /* @__PURE__ */ P(x, {
1435
1456
  fullWidth: !0,
1436
- layout: F.VERTICAL,
1457
+ layout: I.VERTICAL,
1437
1458
  name: "membershipStatusFilter",
1438
- children: /* @__PURE__ */ N(m, {
1459
+ children: /* @__PURE__ */ P(h, {
1439
1460
  disabledOptionsFilter: !0,
1440
1461
  emptyText: "沒有符合的狀態",
1441
1462
  inputProps: {
@@ -1446,8 +1467,8 @@ function _t({ actions: e, loading: n, onCreate: r, onActiveFilterChange: a, onOr
1446
1467
  },
1447
1468
  mode: "single",
1448
1469
  name: "membershipStatusFilter",
1449
- onChange: (e) => a(Vt(e)),
1450
- options: [...Z],
1470
+ onChange: (e) => i(Wt(e)),
1471
+ options: [...ft],
1451
1472
  placeholder: "全部狀態",
1452
1473
  size: "sub",
1453
1474
  value: C
@@ -1456,28 +1477,28 @@ function _t({ actions: e, loading: n, onCreate: r, onActiveFilterChange: a, onOr
1456
1477
  })
1457
1478
  ] })
1458
1479
  }),
1459
- /* @__PURE__ */ N("div", {
1460
- className: J.tableFrame,
1461
- children: /* @__PURE__ */ N(k, {
1480
+ /* @__PURE__ */ P("div", {
1481
+ className: G.tableFrame,
1482
+ children: /* @__PURE__ */ P(A, {
1462
1483
  actions: e,
1463
1484
  columns: T,
1464
1485
  dataSource: [...S],
1465
1486
  fullWidth: !0,
1466
- loading: n,
1467
- pagination: yt({
1487
+ loading: t,
1488
+ pagination: Q({
1468
1489
  onPageChange: s,
1469
1490
  onPageSizeChange: c,
1470
1491
  page: p,
1471
- pageSize: h,
1492
+ pageSize: m,
1472
1493
  total: w
1473
1494
  }),
1474
- style: { minWidth: ft }
1495
+ style: { minWidth: gt }
1475
1496
  })
1476
1497
  })
1477
1498
  ] });
1478
1499
  }
1479
- function vt({ actions: e, loading: t, onCreate: n, onActiveFilterChange: r, onPageChange: i, onPageSizeChange: a, onScopeTypeFilterChange: o, page: s, pageSize: c, rows: l, scopeTypeFilter: u, statusFilter: f, total: p }) {
1480
- let m = d(() => [
1500
+ function xt({ actions: e, loading: t, onCreate: n, onActiveFilterChange: r, onPageChange: i, onPageSizeChange: a, onScopeTypeFilterChange: o, page: s, pageSize: c, rows: l, scopeTypeFilter: u, statusFilter: d, total: p }) {
1501
+ let m = f(() => [
1481
1502
  {
1482
1503
  dataIndex: "scopeLabel",
1483
1504
  key: "scopeLabel",
@@ -1509,106 +1530,106 @@ function vt({ actions: e, loading: t, onCreate: n, onActiveFilterChange: r, onPa
1509
1530
  width: 140
1510
1531
  }
1511
1532
  ], []);
1512
- return /* @__PURE__ */ P(M, { children: [
1513
- /* @__PURE__ */ N(Ct, {
1533
+ return /* @__PURE__ */ F(N, { children: [
1534
+ /* @__PURE__ */ P(Tt, {
1514
1535
  actionLabel: "新增主管規則",
1515
1536
  description: "簽核主管規則獨立於組織樹 parent,解析優先序為會員、組織、職位。",
1516
1537
  onCreate: n,
1517
1538
  title: "簽核主管"
1518
1539
  }),
1519
- /* @__PURE__ */ N(v, {
1520
- className: J.orgFilterArea,
1540
+ /* @__PURE__ */ P(y, {
1541
+ className: G.orgFilterArea,
1521
1542
  size: "sub",
1522
- children: /* @__PURE__ */ P(y, { children: [/* @__PURE__ */ N(_, {
1543
+ children: /* @__PURE__ */ F(b, { children: [/* @__PURE__ */ P(v, {
1523
1544
  span: 3,
1524
- children: /* @__PURE__ */ N(b, {
1545
+ children: /* @__PURE__ */ P(x, {
1525
1546
  fullWidth: !0,
1526
- layout: F.VERTICAL,
1547
+ layout: I.VERTICAL,
1527
1548
  name: "managerScopeTypeFilter",
1528
- children: /* @__PURE__ */ N(E, {
1549
+ children: /* @__PURE__ */ P(D, {
1529
1550
  clearable: !1,
1530
1551
  fullWidth: !0,
1531
- onChange: (e) => o(zt(e)),
1532
- options: [...st],
1552
+ onChange: (e) => o(Ht(e)),
1553
+ options: [...ut],
1533
1554
  placeholder: "套用範圍",
1534
1555
  size: "sub",
1535
1556
  value: u
1536
1557
  })
1537
1558
  })
1538
- }), /* @__PURE__ */ N(_, {
1559
+ }), /* @__PURE__ */ P(v, {
1539
1560
  span: 2,
1540
- children: /* @__PURE__ */ N(b, {
1561
+ children: /* @__PURE__ */ P(x, {
1541
1562
  fullWidth: !0,
1542
- layout: F.VERTICAL,
1563
+ layout: I.VERTICAL,
1543
1564
  name: "managerStatusFilter",
1544
- children: /* @__PURE__ */ N(E, {
1565
+ children: /* @__PURE__ */ P(D, {
1545
1566
  clearable: !1,
1546
1567
  fullWidth: !0,
1547
- onChange: (e) => r(Bt(e)),
1548
- options: [...Z],
1568
+ onChange: (e) => r(Ut(e)),
1569
+ options: [...ft],
1549
1570
  placeholder: "狀態",
1550
1571
  size: "sub",
1551
- value: f
1572
+ value: d
1552
1573
  })
1553
1574
  })
1554
1575
  })] })
1555
1576
  }),
1556
- /* @__PURE__ */ N("div", {
1557
- className: J.tableFrame,
1558
- children: /* @__PURE__ */ N(k, {
1577
+ /* @__PURE__ */ P("div", {
1578
+ className: G.tableFrame,
1579
+ children: /* @__PURE__ */ P(A, {
1559
1580
  actions: e,
1560
1581
  columns: m,
1561
1582
  dataSource: [...l],
1562
1583
  fullWidth: !0,
1563
1584
  loading: t,
1564
- pagination: yt({
1585
+ pagination: Q({
1565
1586
  onPageChange: i,
1566
1587
  onPageSizeChange: a,
1567
1588
  page: s,
1568
1589
  pageSize: c,
1569
1590
  total: p
1570
1591
  }),
1571
- style: { minWidth: pt }
1592
+ style: { minWidth: Z }
1572
1593
  })
1573
1594
  })
1574
1595
  ] });
1575
1596
  }
1576
- function yt({ onPageChange: e, onPageSizeChange: t, page: n, pageSize: r, total: i }) {
1597
+ function Q({ onPageChange: e, onPageSizeChange: t, page: n, pageSize: r, total: i }) {
1577
1598
  return {
1578
1599
  current: n,
1579
1600
  onChange: e,
1580
1601
  onChangePageSize: t,
1581
1602
  pageSize: r,
1582
1603
  pageSizeLabel: "每頁筆數",
1583
- pageSizeOptions: [...lt],
1604
+ pageSizeOptions: [...pt],
1584
1605
  renderResultSummary: (e, t, n) => `顯示 ${e}-${t} 筆,共 ${n} 筆`,
1585
1606
  showPageSizeOptions: !0,
1586
1607
  total: i
1587
1608
  };
1588
1609
  }
1589
- function bt({ isTreeEditing: e, isTreeMode: t }) {
1610
+ function St({ isTreeEditing: e, isTreeMode: t }) {
1590
1611
  return t ? e ? "儲存" : "開始編輯" : "新增組織";
1591
1612
  }
1592
- function xt({ isTreeEditing: e, isTreeMode: t }) {
1593
- return t ? e ? B : R : z;
1613
+ function Ct({ isTreeEditing: e, isTreeMode: t }) {
1614
+ return t ? e ? te : ee : z;
1594
1615
  }
1595
- function St({ hasDraftChanges: e, isTreeEditing: t, isTreeMode: n, loading: r, saving: i }) {
1616
+ function wt({ hasDraftChanges: e, isTreeEditing: t, isTreeMode: n, loading: r, saving: i }) {
1596
1617
  return n ? t ? !e || i : r : !1;
1597
1618
  }
1598
- function Ct({ actionDisabled: e = !1, actionIcon: t = z, actionLabel: n, actions: r, description: i, onCreate: a, title: o }) {
1599
- return /* @__PURE__ */ P("div", {
1600
- className: J.tableIntro,
1601
- children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N(A, {
1619
+ function Tt({ actionDisabled: e = !1, actionIcon: t = z, actionLabel: n, actions: r, description: i, onCreate: a, title: o }) {
1620
+ return /* @__PURE__ */ F("div", {
1621
+ className: G.tableIntro,
1622
+ children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(j, {
1602
1623
  component: "h2",
1603
1624
  variant: "h3",
1604
1625
  children: o
1605
- }), /* @__PURE__ */ N(A, {
1626
+ }), /* @__PURE__ */ P(j, {
1606
1627
  color: "text-neutral",
1607
1628
  variant: "body",
1608
1629
  children: i
1609
- })] }), /* @__PURE__ */ P("div", {
1610
- className: J.tableIntroActions,
1611
- children: [r, /* @__PURE__ */ N(h, {
1630
+ })] }), /* @__PURE__ */ F("div", {
1631
+ className: G.tableIntroActions,
1632
+ children: [r, /* @__PURE__ */ P(g, {
1612
1633
  disabled: e,
1613
1634
  icon: t,
1614
1635
  iconType: "leading",
@@ -1618,80 +1639,80 @@ function Ct({ actionDisabled: e = !1, actionIcon: t = z, actionLabel: n, actions
1618
1639
  })]
1619
1640
  });
1620
1641
  }
1621
- function wt({ modal: n, onClose: i, onSubmit: a, orgUnits: o, saving: s }) {
1622
- let [c, u] = p(""), [d, f] = p(""), [m, h] = p(null), [g, _] = p(Y[2]);
1623
- return l(() => {
1624
- if (!n) return;
1625
- let e = n.record, r = e?.parentId ?? n.parentId ?? null, i = r ? o.find((e) => e.id === r) ?? null : null;
1626
- u(e?.code ?? ""), f(e?.name ?? ""), h(i ? t(i) : null), _(Y.find((t) => t.id === e?.type) ?? Y[2]);
1627
- }, [n, o]), /* @__PURE__ */ N(S, {
1642
+ function Et({ modal: t, onClose: r, onSubmit: a, orgUnits: o, saving: s }) {
1643
+ let [c, l] = m(""), [d, f] = m(""), [p, h] = m(null), [g, _] = m(q[2]);
1644
+ return u(() => {
1645
+ if (!t) return;
1646
+ let e = t.record, r = e?.parentId ?? t.parentId ?? null, i = r ? o.find((e) => e.id === r) ?? null : null;
1647
+ l(e?.code ?? ""), f(e?.name ?? ""), h(i ? n(i) : null), _(q.find((t) => t.id === e?.type) ?? q[2]);
1648
+ }, [t, o]), /* @__PURE__ */ P(C, {
1628
1649
  cancelText: "取消",
1629
1650
  confirmButtonProps: { disabled: !c || !d },
1630
- confirmText: n?.type === "EDIT" ? "儲存" : "建立",
1651
+ confirmText: t?.type === "EDIT" ? "儲存" : "建立",
1631
1652
  loading: s,
1632
1653
  modalType: "standard",
1633
- onCancel: i,
1634
- onClose: i,
1654
+ onCancel: r,
1655
+ onClose: r,
1635
1656
  onConfirm: () => void a({
1636
1657
  code: c,
1637
1658
  name: d,
1638
- parentId: m?.id ?? null,
1659
+ parentId: p?.id ?? null,
1639
1660
  type: g.id
1640
1661
  }),
1641
- open: !!n,
1662
+ open: !!t,
1642
1663
  showModalFooter: !0,
1643
1664
  showModalHeader: !0,
1644
1665
  size: "regular",
1645
- title: n?.type === "EDIT" ? "編輯組織" : "新增組織",
1646
- children: /* @__PURE__ */ P("div", {
1647
- className: J.modalFields,
1666
+ title: t?.type === "EDIT" ? "編輯組織" : "新增組織",
1667
+ children: /* @__PURE__ */ F("div", {
1668
+ className: G.modalFields,
1648
1669
  children: [
1649
- /* @__PURE__ */ N($, {
1670
+ /* @__PURE__ */ P(At, {
1650
1671
  label: "代碼",
1651
1672
  name: "orgCode",
1652
- onChange: u,
1673
+ onChange: l,
1653
1674
  placeholder: "例如 FIN-TW",
1654
1675
  value: c
1655
1676
  }),
1656
- /* @__PURE__ */ N($, {
1677
+ /* @__PURE__ */ P(At, {
1657
1678
  label: "名稱",
1658
1679
  name: "orgName",
1659
1680
  onChange: f,
1660
1681
  placeholder: "例如 財務部",
1661
1682
  value: d
1662
1683
  }),
1663
- /* @__PURE__ */ N(e, {
1684
+ /* @__PURE__ */ P(e, {
1664
1685
  label: "類型",
1665
1686
  name: "orgType",
1666
- children: /* @__PURE__ */ N(E, {
1687
+ children: /* @__PURE__ */ P(D, {
1667
1688
  clearable: !1,
1668
1689
  fullWidth: !0,
1669
- onChange: (e) => _(It(e)),
1670
- options: [...Y],
1690
+ onChange: (e) => _(zt(e)),
1691
+ options: [...q],
1671
1692
  placeholder: "選擇組織類型",
1672
1693
  value: g
1673
1694
  })
1674
1695
  }),
1675
- /* @__PURE__ */ N(e, {
1696
+ /* @__PURE__ */ P(e, {
1676
1697
  label: "上層組織",
1677
1698
  name: "parentId",
1678
- children: /* @__PURE__ */ N(r, {
1699
+ children: /* @__PURE__ */ P(i, {
1679
1700
  name: "parentId",
1680
1701
  onChange: h,
1681
- orgUnits: o.filter((e) => e.id !== n?.record?.id),
1702
+ orgUnits: o.filter((e) => e.id !== t?.record?.id),
1682
1703
  placeholder: "選擇上層組織",
1683
- value: m
1704
+ value: p
1684
1705
  })
1685
1706
  })
1686
1707
  ]
1687
1708
  })
1688
1709
  });
1689
1710
  }
1690
- function Tt({ modal: e, onClose: t, onSubmit: n, saving: r }) {
1691
- let [i, a] = p(""), [o, s] = p("0"), [c, u] = p("");
1692
- return l(() => {
1693
- e && (a(e.record?.code ?? ""), s(String(e.record?.level ?? 0)), u(e.record?.name ?? ""));
1694
- }, [e]), /* @__PURE__ */ N(S, {
1711
+ function Dt({ modal: e, onClose: t, onSubmit: n, saving: r }) {
1712
+ let [i, a] = m(""), [o, s] = m("0"), [c, l] = m("");
1713
+ return u(() => {
1714
+ e && (a(e.record?.code ?? ""), s(String(e.record?.level ?? 0)), l(e.record?.name ?? ""));
1715
+ }, [e]), /* @__PURE__ */ P(C, {
1695
1716
  cancelText: "取消",
1696
1717
  confirmButtonProps: { disabled: !i || !c },
1697
1718
  confirmText: e?.type === "EDIT" ? "儲存" : "建立",
@@ -1709,24 +1730,24 @@ function Tt({ modal: e, onClose: t, onSubmit: n, saving: r }) {
1709
1730
  showModalHeader: !0,
1710
1731
  size: "regular",
1711
1732
  title: e?.type === "EDIT" ? "編輯職位" : "新增職位",
1712
- children: /* @__PURE__ */ P("div", {
1713
- className: J.modalFields,
1733
+ children: /* @__PURE__ */ F("div", {
1734
+ className: G.modalFields,
1714
1735
  children: [
1715
- /* @__PURE__ */ N($, {
1736
+ /* @__PURE__ */ P(At, {
1716
1737
  label: "代碼",
1717
1738
  name: "positionCode",
1718
1739
  onChange: a,
1719
1740
  placeholder: "例如 FIN-MGR",
1720
1741
  value: i
1721
1742
  }),
1722
- /* @__PURE__ */ N($, {
1743
+ /* @__PURE__ */ P(At, {
1723
1744
  label: "名稱",
1724
1745
  name: "positionName",
1725
- onChange: u,
1746
+ onChange: l,
1726
1747
  placeholder: "例如 財務主管",
1727
1748
  value: c
1728
1749
  }),
1729
- /* @__PURE__ */ N($, {
1750
+ /* @__PURE__ */ P(At, {
1730
1751
  label: "職等",
1731
1752
  name: "positionLevel",
1732
1753
  onChange: s,
@@ -1737,30 +1758,30 @@ function Tt({ modal: e, onClose: t, onSubmit: n, saving: r }) {
1737
1758
  })
1738
1759
  });
1739
1760
  }
1740
- function Et({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, positions: m, saving: h }) {
1741
- let [g, _] = p(Jt()), [v, y] = p(""), [b, x] = p(Q[1]), [C, w] = p(null), [T, D] = p(null), [O, k] = p(null);
1742
- return l(() => {
1761
+ function Ot({ membersById: t, modal: c, onClose: l, onSubmit: d, orgUnits: f, positions: p, saving: h }) {
1762
+ let [g, _] = m(Xt()), [v, y] = m(""), [b, x] = m(X[1]), [S, w] = m(null), [T, E] = m(null), [O, k] = m(null);
1763
+ return u(() => {
1743
1764
  if (!c) return;
1744
- let e = c.record, r = e ? s.get(e.memberId) : null;
1745
- _(e?.effectiveFrom ?? Jt()), y(e?.effectiveTo ?? ""), x(Q.find((t) => t.value === e?.isPrimary) ?? Q[1]), w(r ? n(r) : null), D(qt(f.find((t) => t.id === e?.orgUnitId), t)), k(qt(m.find((t) => t.id === e?.positionId), i));
1765
+ let e = c.record, i = e ? t.get(e.memberId) : null;
1766
+ _(e?.effectiveFrom ?? Xt()), y(e?.effectiveTo ?? ""), x(X.find((t) => t.value === e?.isPrimary) ?? X[1]), w(i ? r(i) : null), E(Yt(f.find((t) => t.id === e?.orgUnitId), n)), k(Yt(p.find((t) => t.id === e?.positionId), a));
1746
1767
  }, [
1747
- s,
1768
+ t,
1748
1769
  c,
1749
1770
  f,
1750
- m
1751
- ]), /* @__PURE__ */ N(S, {
1771
+ p
1772
+ ]), /* @__PURE__ */ P(C, {
1752
1773
  cancelText: "取消",
1753
- confirmButtonProps: { disabled: !C || !T },
1774
+ confirmButtonProps: { disabled: !S || !T },
1754
1775
  confirmText: c?.type === "EDIT" ? "儲存" : "建立",
1755
1776
  loading: h,
1756
1777
  modalType: "standard",
1757
- onCancel: u,
1758
- onClose: u,
1778
+ onCancel: l,
1779
+ onClose: l,
1759
1780
  onConfirm: () => void d({
1760
1781
  effectiveFrom: g,
1761
1782
  effectiveTo: v || null,
1762
1783
  isPrimary: b.value,
1763
- memberId: C?.id ?? null,
1784
+ memberId: S?.id ?? null,
1764
1785
  orgUnitId: T?.id ?? null,
1765
1786
  positionId: O?.id ?? null
1766
1787
  }),
@@ -1769,61 +1790,61 @@ function Et({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
1769
1790
  showModalHeader: !0,
1770
1791
  size: "regular",
1771
1792
  title: c?.type === "EDIT" ? "編輯會員歸屬" : "新增會員歸屬",
1772
- children: /* @__PURE__ */ P("div", {
1773
- className: J.modalFields,
1793
+ children: /* @__PURE__ */ F("div", {
1794
+ className: G.modalFields,
1774
1795
  children: [
1775
- /* @__PURE__ */ N(e, {
1796
+ /* @__PURE__ */ P(e, {
1776
1797
  label: "會員",
1777
1798
  name: "memberId",
1778
- children: /* @__PURE__ */ N(o, {
1799
+ children: /* @__PURE__ */ P(s, {
1779
1800
  name: "memberId",
1780
1801
  onChange: w,
1781
1802
  placeholder: "搜尋會員姓名或信箱",
1782
- value: C
1803
+ value: S
1783
1804
  })
1784
1805
  }),
1785
- /* @__PURE__ */ N(e, {
1806
+ /* @__PURE__ */ P(e, {
1786
1807
  label: "組織",
1787
1808
  name: "orgUnitId",
1788
- children: /* @__PURE__ */ N(r, {
1809
+ children: /* @__PURE__ */ P(i, {
1789
1810
  name: "orgUnitId",
1790
- onChange: D,
1811
+ onChange: E,
1791
1812
  orgUnits: f,
1792
1813
  placeholder: "選擇歸屬組織",
1793
1814
  value: T
1794
1815
  })
1795
1816
  }),
1796
- /* @__PURE__ */ N(e, {
1817
+ /* @__PURE__ */ P(e, {
1797
1818
  label: "職位",
1798
1819
  name: "positionId",
1799
- children: /* @__PURE__ */ N(a, {
1820
+ children: /* @__PURE__ */ P(o, {
1800
1821
  name: "positionId",
1801
1822
  onChange: k,
1802
1823
  placeholder: "選擇職位",
1803
- positions: m,
1824
+ positions: p,
1804
1825
  value: O
1805
1826
  })
1806
1827
  }),
1807
- /* @__PURE__ */ N(e, {
1828
+ /* @__PURE__ */ P(e, {
1808
1829
  label: "歸屬類型",
1809
1830
  name: "isPrimary",
1810
- children: /* @__PURE__ */ N(E, {
1831
+ children: /* @__PURE__ */ P(D, {
1811
1832
  clearable: !1,
1812
1833
  fullWidth: !0,
1813
- onChange: (e) => x(Wt(e)),
1814
- options: [...Q],
1834
+ onChange: (e) => x(qt(e)),
1835
+ options: [...X],
1815
1836
  placeholder: "選擇歸屬類型",
1816
1837
  value: b
1817
1838
  })
1818
1839
  }),
1819
- /* @__PURE__ */ N(Ot, {
1840
+ /* @__PURE__ */ P(jt, {
1820
1841
  label: "生效日",
1821
1842
  name: "membershipEffectiveFrom",
1822
1843
  onChange: _,
1823
1844
  placeholder: "YYYY-MM-DD",
1824
1845
  value: g
1825
1846
  }),
1826
- /* @__PURE__ */ N(Ot, {
1847
+ /* @__PURE__ */ P(jt, {
1827
1848
  label: "結束日",
1828
1849
  name: "membershipEffectiveTo",
1829
1850
  onChange: y,
@@ -1834,69 +1855,69 @@ function Et({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
1834
1855
  })
1835
1856
  });
1836
1857
  }
1837
- function Dt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, positions: m, saving: h }) {
1838
- let [g, _] = p(Jt()), [v, y] = p(""), [b, x] = p(null), [C, w] = p(String(rt)), [T, D] = p(null), [O, k] = p(null), [j, M] = p(null), [F, I] = p(X[0]);
1839
- l(() => {
1858
+ function kt({ membersById: t, modal: c, onClose: l, onSubmit: d, orgUnits: f, positions: p, saving: h }) {
1859
+ let [g, _] = m(Xt()), [v, y] = m(""), [b, x] = m(null), [S, w] = m(String(st)), [T, E] = m(null), [O, k] = m(null), [A, M] = m(null), [N, I] = m(Y[0]);
1860
+ u(() => {
1840
1861
  if (!c) return;
1841
- let e = c.record, r = X.find((t) => t.id === e?.scopeType) ?? X[0];
1842
- _(e?.effectiveFrom ?? Jt()), y(e?.effectiveTo ?? ""), x(qt(e ? s.get(e.managerMemberId) : null, n)), w(String(e?.priority ?? rt)), D(r.id === "MEMBER" ? qt(e ? s.get(e.scopeId) : null, n) : null), k(r.id === "ORG_UNIT" ? qt(f.find((t) => t.id === e?.scopeId), t) : null), M(r.id === "POSITION" ? qt(m.find((t) => t.id === e?.scopeId), i) : null), I(r);
1862
+ let e = c.record, i = Y.find((t) => t.id === e?.scopeType) ?? Y[0];
1863
+ _(e?.effectiveFrom ?? Xt()), y(e?.effectiveTo ?? ""), x(Yt(e ? t.get(e.managerMemberId) : null, r)), w(String(e?.priority ?? st)), E(i.id === "MEMBER" ? Yt(e ? t.get(e.scopeId) : null, r) : null), k(i.id === "ORG_UNIT" ? Yt(f.find((t) => t.id === e?.scopeId), n) : null), M(i.id === "POSITION" ? Yt(p.find((t) => t.id === e?.scopeId), a) : null), I(i);
1843
1864
  }, [
1844
- s,
1865
+ t,
1845
1866
  c,
1846
1867
  f,
1847
- m
1868
+ p
1848
1869
  ]);
1849
- let L = F.id === "MEMBER" ? T?.id : F.id === "ORG_UNIT" ? O?.id : j?.id, R = !!(F.id === "MEMBER" && T?.id && b?.id && T.id === b.id);
1850
- return /* @__PURE__ */ N(S, {
1870
+ let L = N.id === "MEMBER" ? T?.id : N.id === "ORG_UNIT" ? O?.id : A?.id, R = !!(N.id === "MEMBER" && T?.id && b?.id && T.id === b.id);
1871
+ return /* @__PURE__ */ P(C, {
1851
1872
  cancelText: "取消",
1852
1873
  confirmButtonProps: { disabled: !b || !L || R },
1853
1874
  confirmText: c?.type === "EDIT" ? "儲存" : "建立",
1854
1875
  loading: h,
1855
1876
  modalType: "standard",
1856
- onCancel: u,
1857
- onClose: u,
1877
+ onCancel: l,
1878
+ onClose: l,
1858
1879
  onConfirm: () => void d({
1859
1880
  effectiveFrom: g,
1860
1881
  effectiveTo: v || null,
1861
1882
  managerMemberId: b?.id ?? null,
1862
- priority: Number(C),
1883
+ priority: Number(S),
1863
1884
  scopeId: L ?? null,
1864
- scopeType: F.id
1885
+ scopeType: N.id
1865
1886
  }),
1866
1887
  open: !!c,
1867
1888
  showModalFooter: !0,
1868
1889
  showModalHeader: !0,
1869
1890
  size: "regular",
1870
1891
  title: c?.type === "EDIT" ? "編輯主管規則" : "新增主管規則",
1871
- children: /* @__PURE__ */ P("div", {
1872
- className: J.modalFields,
1892
+ children: /* @__PURE__ */ F("div", {
1893
+ className: G.modalFields,
1873
1894
  children: [
1874
- /* @__PURE__ */ N(e, {
1895
+ /* @__PURE__ */ P(e, {
1875
1896
  label: "套用範圍",
1876
1897
  name: "scopeType",
1877
- children: /* @__PURE__ */ N(E, {
1898
+ children: /* @__PURE__ */ P(D, {
1878
1899
  clearable: !1,
1879
1900
  fullWidth: !0,
1880
- onChange: (e) => I(Rt(e)),
1881
- options: [...X],
1901
+ onChange: (e) => I(Vt(e)),
1902
+ options: [...Y],
1882
1903
  placeholder: "選擇套用範圍",
1883
- value: F
1904
+ value: N
1884
1905
  })
1885
1906
  }),
1886
- F.id === "MEMBER" ? /* @__PURE__ */ N(e, {
1907
+ N.id === "MEMBER" ? /* @__PURE__ */ P(e, {
1887
1908
  label: "會員",
1888
1909
  name: "scopeMemberId",
1889
- children: /* @__PURE__ */ N(o, {
1910
+ children: /* @__PURE__ */ P(s, {
1890
1911
  name: "scopeMemberId",
1891
- onChange: D,
1912
+ onChange: E,
1892
1913
  placeholder: "搜尋套用會員",
1893
1914
  value: T
1894
1915
  })
1895
1916
  }) : null,
1896
- F.id === "ORG_UNIT" ? /* @__PURE__ */ N(e, {
1917
+ N.id === "ORG_UNIT" ? /* @__PURE__ */ P(e, {
1897
1918
  label: "組織",
1898
1919
  name: "scopeOrgUnitId",
1899
- children: /* @__PURE__ */ N(r, {
1920
+ children: /* @__PURE__ */ P(i, {
1900
1921
  name: "scopeOrgUnitId",
1901
1922
  onChange: k,
1902
1923
  orgUnits: f,
@@ -1904,48 +1925,48 @@ function Dt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
1904
1925
  value: O
1905
1926
  })
1906
1927
  }) : null,
1907
- F.id === "POSITION" ? /* @__PURE__ */ N(e, {
1928
+ N.id === "POSITION" ? /* @__PURE__ */ P(e, {
1908
1929
  label: "職位",
1909
1930
  name: "scopePositionId",
1910
- children: /* @__PURE__ */ N(a, {
1931
+ children: /* @__PURE__ */ P(o, {
1911
1932
  name: "scopePositionId",
1912
1933
  onChange: M,
1913
1934
  placeholder: "選擇套用職位",
1914
- positions: m,
1915
- value: j
1935
+ positions: p,
1936
+ value: A
1916
1937
  })
1917
1938
  }) : null,
1918
- /* @__PURE__ */ N(e, {
1939
+ /* @__PURE__ */ P(e, {
1919
1940
  label: "簽核主管",
1920
1941
  name: "managerMemberId",
1921
- children: /* @__PURE__ */ N(o, {
1942
+ children: /* @__PURE__ */ P(s, {
1922
1943
  name: "managerMemberId",
1923
1944
  onChange: x,
1924
1945
  placeholder: "搜尋簽核主管",
1925
1946
  value: b
1926
1947
  })
1927
1948
  }),
1928
- R ? /* @__PURE__ */ N(A, {
1949
+ R ? /* @__PURE__ */ P(j, {
1929
1950
  color: "text-error",
1930
1951
  variant: "caption",
1931
1952
  children: "簽核主管不可設定為套用會員本人。"
1932
1953
  }) : null,
1933
- /* @__PURE__ */ N($, {
1954
+ /* @__PURE__ */ P(At, {
1934
1955
  hintText: "數字越大越優先,同一位成員命中多條規則時只會採用最高的那一層。建議:指定到人 200、部門主管 100、全公司通用的墊底規則 10。",
1935
1956
  label: "優先序",
1936
1957
  name: "managerPriority",
1937
1958
  onChange: w,
1938
1959
  placeholder: "例如 100",
1939
- value: C
1960
+ value: S
1940
1961
  }),
1941
- /* @__PURE__ */ N(Ot, {
1962
+ /* @__PURE__ */ P(jt, {
1942
1963
  label: "生效日",
1943
1964
  name: "managerEffectiveFrom",
1944
1965
  onChange: _,
1945
1966
  placeholder: "YYYY-MM-DD",
1946
1967
  value: g
1947
1968
  }),
1948
- /* @__PURE__ */ N(Ot, {
1969
+ /* @__PURE__ */ P(jt, {
1949
1970
  label: "結束日",
1950
1971
  name: "managerEffectiveTo",
1951
1972
  onChange: y,
@@ -1956,12 +1977,12 @@ function Dt({ membersById: s, modal: c, onClose: u, onSubmit: d, orgUnits: f, po
1956
1977
  })
1957
1978
  });
1958
1979
  }
1959
- function $({ hintText: t, label: n, name: r, onChange: i, placeholder: a, value: o }) {
1960
- return /* @__PURE__ */ N(e, {
1980
+ function At({ hintText: t, label: n, name: r, onChange: i, placeholder: a, value: o }) {
1981
+ return /* @__PURE__ */ P(e, {
1961
1982
  hintText: t,
1962
1983
  label: n,
1963
1984
  name: r,
1964
- children: /* @__PURE__ */ N(x, {
1985
+ children: /* @__PURE__ */ P(S, {
1965
1986
  fullWidth: !0,
1966
1987
  name: r,
1967
1988
  onChange: (e) => i(e.target.value),
@@ -1970,118 +1991,118 @@ function $({ hintText: t, label: n, name: r, onChange: i, placeholder: a, value:
1970
1991
  })
1971
1992
  });
1972
1993
  }
1973
- function Ot({ label: t, name: n, onChange: r, placeholder: i, value: a }) {
1974
- return /* @__PURE__ */ N(e, {
1994
+ function jt({ label: t, name: n, onChange: r, placeholder: i, value: a }) {
1995
+ return /* @__PURE__ */ P(e, {
1975
1996
  label: t,
1976
1997
  name: n,
1977
- children: /* @__PURE__ */ N(g, {
1998
+ children: /* @__PURE__ */ P(_, {
1978
1999
  format: "YYYY-MM-DD",
1979
2000
  fullWidth: !0,
1980
2001
  inputProps: { name: n },
1981
- onChange: (e) => r(Yt(e)),
2002
+ onChange: (e) => r(Zt(e)),
1982
2003
  placeholder: i,
1983
2004
  value: a.trim() ? a : void 0
1984
2005
  })
1985
2006
  });
1986
2007
  }
1987
- function kt(e, t) {
2008
+ function Mt(e, t) {
1988
2009
  return [.../* @__PURE__ */ new Set([
1989
2010
  ...e.map((e) => e.memberId),
1990
2011
  ...t.map((e) => e.managerMemberId),
1991
2012
  ...t.filter((e) => e.scopeType === "MEMBER").map((e) => e.scopeId)
1992
2013
  ])];
1993
2014
  }
1994
- function At(e, t) {
1995
- return e.scopeType === "MEMBER" ? `會員:${jt(t.membersById.get(e.scopeId))}` : e.scopeType === "ORG_UNIT" ? `組織:${Mt(t.orgUnitsById.get(e.scopeId))}` : `職位:${Pt(t.positionsById.get(e.scopeId))}`;
2015
+ function Nt(e, t) {
2016
+ return e.scopeType === "MEMBER" ? `會員:${Pt(t.membersById.get(e.scopeId))}` : e.scopeType === "ORG_UNIT" ? `組織:${Ft(t.orgUnitsById.get(e.scopeId))}` : `職位:${Lt(t.positionsById.get(e.scopeId))}`;
1996
2017
  }
1997
- function jt(e) {
1998
- return e ? `${e.name} · ${e.email}` : "未知會員";
2018
+ function Pt(e) {
2019
+ return e ? t(e.name, e.email, "dot") : "未知會員";
1999
2020
  }
2000
- function Mt(e) {
2021
+ function Ft(e) {
2001
2022
  return e ? `${e.name} · ${e.code}` : "未知組織";
2002
2023
  }
2003
- function Nt(e) {
2004
- return Y.find((t) => t.id.toLowerCase() === e.toLowerCase())?.name ?? "未知類型";
2024
+ function It(e) {
2025
+ return q.find((t) => t.id.toLowerCase() === e.toLowerCase())?.name ?? "未知類型";
2005
2026
  }
2006
- function Pt(e) {
2027
+ function Lt(e) {
2007
2028
  return e ? `${e.name} · ${e.code}` : "未指定";
2008
2029
  }
2009
- function Ft(e) {
2030
+ function Rt(e) {
2010
2031
  return e === "MANAGERS" || e === "MEMBERSHIPS" || e === "POSITIONS" ? e : "ORG_UNITS";
2011
2032
  }
2012
- function It(e) {
2013
- let t = Kt(e) ? e : null;
2033
+ function zt(e) {
2034
+ let t = $(e) ? e : null;
2014
2035
  if (typeof t?.id == "string") {
2015
2036
  let e = t.id;
2016
- return Y.find((t) => t.id.toLowerCase() === e.toLowerCase()) ?? Y[2];
2037
+ return q.find((t) => t.id.toLowerCase() === e.toLowerCase()) ?? q[2];
2017
2038
  }
2018
- return Y[2];
2039
+ return q[2];
2019
2040
  }
2020
- function Lt(e) {
2021
- let t = Kt(e) ? e : null;
2041
+ function Bt(e) {
2042
+ let t = $(e) ? e : null;
2022
2043
  if (typeof t?.id == "string") {
2023
2044
  let e = t.id;
2024
- return at.find((t) => t.id.toLowerCase() === e.toLowerCase()) ?? it;
2045
+ return J.find((t) => t.id.toLowerCase() === e.toLowerCase()) ?? ct;
2025
2046
  }
2026
- return it;
2047
+ return ct;
2027
2048
  }
2028
- function Rt(e) {
2029
- return Gt(e, X, X[0]);
2049
+ function Vt(e) {
2050
+ return Jt(e, Y, Y[0]);
2030
2051
  }
2031
- function zt(e) {
2032
- return Gt(e, st, ot);
2052
+ function Ht(e) {
2053
+ return Jt(e, ut, lt);
2033
2054
  }
2034
- function Bt(e) {
2035
- return Gt(e, Z, ct);
2055
+ function Ut(e) {
2056
+ return Jt(e, ft, dt);
2036
2057
  }
2037
- function Vt(e) {
2038
- let t = Kt(e) ? e : null, n = typeof t?.id == "string" ? t.id : null;
2039
- return Z.find((e) => e.id === n) ?? null;
2058
+ function Wt(e) {
2059
+ let t = $(e) ? e : null, n = typeof t?.id == "string" ? t.id : null;
2060
+ return ft.find((e) => e.id === n) ?? null;
2040
2061
  }
2041
- function Ht(e) {
2042
- let t = Kt(e) ? e : null, n = typeof t?.id == "string" ? t.id : null, r = typeof t?.name == "string" ? t.name : null;
2062
+ function Gt(e) {
2063
+ let t = $(e) ? e : null, n = typeof t?.id == "string" ? t.id : null, r = typeof t?.name == "string" ? t.name : null;
2043
2064
  return n && r ? {
2044
2065
  id: n,
2045
2066
  name: r
2046
2067
  } : null;
2047
2068
  }
2048
- function Ut(e) {
2049
- let t = Kt(e) ? e : null, n = typeof t?.id == "string" ? t.id : null, r = typeof t?.name == "string" ? t.name : null;
2069
+ function Kt(e) {
2070
+ let t = $(e) ? e : null, n = typeof t?.id == "string" ? t.id : null, r = typeof t?.name == "string" ? t.name : null;
2050
2071
  return n && r ? {
2051
2072
  id: n,
2052
2073
  name: r
2053
2074
  } : null;
2054
2075
  }
2055
- function Wt(e) {
2056
- return Gt(e, Q, Q[1]);
2076
+ function qt(e) {
2077
+ return Jt(e, X, X[1]);
2057
2078
  }
2058
- function Gt(e, t, n) {
2059
- let r = Kt(e) ? e : null, i = typeof r?.id == "string" ? r.id : null;
2079
+ function Jt(e, t, n) {
2080
+ let r = $(e) ? e : null, i = typeof r?.id == "string" ? r.id : null;
2060
2081
  return t.find((e) => e.id === i) ?? n;
2061
2082
  }
2062
- function Kt(e) {
2083
+ function $(e) {
2063
2084
  return typeof e == "object" && !!e && !Array.isArray(e);
2064
2085
  }
2065
- function qt(e, t) {
2086
+ function Yt(e, t) {
2066
2087
  return e ? t(e) : null;
2067
2088
  }
2068
- function Jt() {
2069
- return Xt(/* @__PURE__ */ new Date());
2089
+ function Xt() {
2090
+ return Qt(/* @__PURE__ */ new Date());
2070
2091
  }
2071
- function Yt(e) {
2092
+ function Zt(e) {
2072
2093
  let t = e ? new Date(e) : null;
2073
- return t && !Number.isNaN(t.getTime()) ? Xt(t) : "";
2094
+ return t && !Number.isNaN(t.getTime()) ? Qt(t) : "";
2074
2095
  }
2075
- function Xt(e) {
2076
- return `${e.getFullYear()}-${Zt(e.getMonth() + 1)}-${Zt(e.getDate())}`;
2096
+ function Qt(e) {
2097
+ return `${e.getFullYear()}-${$t(e.getMonth() + 1)}-${$t(e.getDate())}`;
2077
2098
  }
2078
- function Zt(e) {
2099
+ function $t(e) {
2079
2100
  return String(e).padStart(2, "0");
2080
2101
  }
2081
- function Qt(e) {
2102
+ function en(e) {
2082
2103
  return e instanceof Error ? e.message : "讀取組織資料失敗。";
2083
2104
  }
2084
2105
  //#endregion
2085
- export { mt as t };
2106
+ export { _t as t };
2086
2107
 
2087
- //# sourceMappingURL=orgs-BpqVu5ka.js.map
2108
+ //# sourceMappingURL=orgs-CY0i1fie.js.map