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