@baishuyun/ui-business 3.0.2 → 3.0.3

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 (39) hide show
  1. package/dist/DeptsMember/DeptsMember-CzJqr_LX.js +721 -0
  2. package/dist/DeptsMember/ExtraConcactPanel-BI9emYpp.js +674 -0
  3. package/dist/DeptsMember/OrganizationPanel-DcwvZ6X4.js +254 -0
  4. package/dist/DeptsMember/TabGroup-wNM86-Zq.js +141 -0
  5. package/dist/DeptsMember/index.js +2 -2
  6. package/dist/DeptsMember/subcomponents/Entity/Department/index.js +79 -316
  7. package/dist/DeptsMember/subcomponents/Entity/DeptsUser/index.d.ts +2 -0
  8. package/dist/DeptsMember/subcomponents/Entity/DeptsUser/index.js +38 -0
  9. package/dist/DeptsMember/subcomponents/Entity/Member/index.js +27 -690
  10. package/dist/components/DeptsMember/DeptsMember.type.d.ts +5 -1
  11. package/dist/components/DeptsMember/hooks/useDeptsMemberSelector.d.ts +1 -0
  12. package/dist/components/DeptsMember/subcomponents/Entity/Department/index.d.ts +1 -1
  13. package/dist/components/DeptsMember/subcomponents/Entity/DeptsUser/index.d.ts +6 -0
  14. package/dist/components/DeptsMember/subcomponents/Entity/Member/index.d.ts +1 -1
  15. package/dist/components/DeptsMember/subcomponents/SelectionTabs/SelectionTabList/SelectionTabList.d.ts +2 -2
  16. package/dist/components/DeptsMember/subcomponents/SelectionTabs/useSelectorType.d.ts +16 -0
  17. package/dist/components/DeptsMember/utils/constants.d.ts +8 -4
  18. package/dist/index.css +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/lang/en-US.json.d.ts +2 -1
  21. package/dist/lang/zh-CN.json.d.ts +2 -1
  22. package/package.json +1 -1
  23. package/dist/DeptsMember/DeptsMember-pFjdAocd.js +0 -702
  24. package/dist/DeptsMember/TabGroup-CznMwTOD.js +0 -137
  25. package/dist/vendors/services/team/team.services.js +0 -5
  26. /package/dist/components/DeptsMember/subcomponents/Entity/Member/{MemberEntity/MemerList → MemerList}/MemberList.d.ts +0 -0
  27. /package/dist/components/DeptsMember/subcomponents/{Entity/Department/CurrentDepartmentEntity/CurrentDepartmentEntity.d.ts → Panels/CurrentUserDeptsPanel/CurrentUserDeptsPanel.d.ts} +0 -0
  28. /package/dist/components/DeptsMember/subcomponents/{Entity/Member/CurrentEntity/CurrentEntity.d.ts → Panels/CurrentUserPanel/CurrentUserPanel.d.ts} +0 -0
  29. /package/dist/components/DeptsMember/subcomponents/{Entity/Department/ExternalContactEntity/ExternalContactEntity.d.ts → Panels/ExtraConcactPanel/ExtraConcactPanel.d.ts} +0 -0
  30. /package/dist/components/DeptsMember/subcomponents/{Entity/Member/ExternalContactEntity/ExternalContactEntity.d.ts → Panels/ExtraContactGroupPanel/ExtraContactGroupPanel.d.ts} +0 -0
  31. /package/dist/components/DeptsMember/subcomponents/{Entity/Member/MemberEntity → Panels/MemberPanel}/AllMemeberCheck/AllMemeberCheck.d.ts +0 -0
  32. /package/dist/components/DeptsMember/subcomponents/{Entity/Member/MemberEntity → Panels/MemberPanel}/ExternalMember/ExternalMember.d.ts +0 -0
  33. /package/dist/components/DeptsMember/subcomponents/{Entity/Member/MemberEntity → Panels/MemberPanel}/InternalMemeber/InternalMemeber.d.ts +0 -0
  34. /package/dist/components/DeptsMember/subcomponents/{Entity/Member/MemberEntity/MemberEntity.d.ts → Panels/MemberPanel/MemberPanel.d.ts} +0 -0
  35. /package/dist/components/DeptsMember/subcomponents/{Entity/Department/OrganizationalEntity → Panels/OrganizationPanel}/ExternalOrganization/ExternalOrganization.d.ts +0 -0
  36. /package/dist/components/DeptsMember/subcomponents/{Entity/Department/OrganizationalEntity → Panels/OrganizationPanel}/InternalOrganization/InternalOrganization.d.ts +0 -0
  37. /package/dist/components/DeptsMember/subcomponents/{Entity/Department/OrganizationalEntity/OrganizationalEntity.d.ts → Panels/OrganizationPanel/OrganizationPanel.d.ts} +0 -0
  38. /package/dist/components/DeptsMember/subcomponents/{Entity/Member/MajorEntity/MajorEntity.d.ts → Panels/PositionPanel/PositionPanel.d.ts} +0 -0
  39. /package/dist/components/DeptsMember/subcomponents/{Entity/Member/RoleEntity/RoleEntity.d.ts → Panels/RolePanel/RolePanel.d.ts} +0 -0
@@ -0,0 +1,721 @@
1
+ import { jsx as e, jsxs as u, Fragment as F } from "react/jsx-runtime";
2
+ import { c as N } from "../vendors/clsx.js";
3
+ import { u as C, a as D, b as te, E as g, M as de, T as me, P as pe, G as K, c as ue, D as he } from "./TabGroup-wNM86-Zq.js";
4
+ import { Avatar as H, Button as V, Spin as ne } from "antd";
5
+ import { forwardRef as fe, useRef as T, useImperativeHandle as be, useState as S, useEffect as A, useMemo as ae, useCallback as ye } from "react";
6
+ import { Icon as E, Tree as se } from "bsy-react-ui";
7
+ import { createPortal as xe } from "react-dom";
8
+ import { AnimatePresence as $, motion as X } from "motion/react";
9
+ import { useToggle as ge, useControllableValue as re, useRequest as L } from "ahooks";
10
+ import { S as z } from "../vendors/simplebar-react.js";
11
+ import { CloseOutlined as ve } from "@ant-design/icons";
12
+ import { getColorByName as W, findNodeInTree as J } from "./utils/index.js";
13
+ import { n as _e, d as Ne } from "../vendors/lodash-es.js";
14
+ import { useDeptUserTabItems as we } from "./subcomponents/Entity/DeptsUser/index.js";
15
+ import { useMemberTabItems as ke } from "./subcomponents/Entity/Member/index.js";
16
+ import { useDepartmentTabItems as Se } from "./subcomponents/Entity/Department/index.js";
17
+ import { g as Ee, a as Ie } from "../vendors/services/data/outsider.service.js";
18
+ import { g as Te } from "../vendors/services/data/member_limit.service.js";
19
+ import { g as Ce } from "../vendors/services/data/member.service.js";
20
+ import { produce as De } from "immer";
21
+ const Q = fe(
22
+ (a, s) => {
23
+ const {
24
+ isMeasure: n = !1,
25
+ showEllipsisButton: i = !1,
26
+ onToggle: d,
27
+ hiddenCount: t = 0,
28
+ previewCount: c = 0
29
+ } = a, { t: m } = C(), { value: h = [], setValue: x, type: o } = D(), f = [g.DEPARMENT_GROUP, g.DEPARMENT].includes(o), p = T(null), y = T(null), _ = {
30
+ dockcorp: m("department.externalContactGroup"),
31
+ dockcorpdept: m("department.contact")
32
+ }, w = (b) => x?.(h.filter((k) => k._id !== b));
33
+ return be(s, () => ({
34
+ measureRef: p.current,
35
+ ellipsisButtonRef: y.current
36
+ })), /* @__PURE__ */ e(
37
+ "div",
38
+ {
39
+ className: N({
40
+ "measure-list": n
41
+ }),
42
+ children: /* @__PURE__ */ u("ul", { className: "entity-list", ref: n ? p : void 0, "data-role": "measure-list", children: [
43
+ h.slice(0, c)?.map((b, k) => {
44
+ const l = b.name || b.nickname, r = b.type ? b.type : Object.prototype.hasOwnProperty.call(b, "departmentId") ? null : "group";
45
+ return /* @__PURE__ */ u(
46
+ "li",
47
+ {
48
+ className: N("entity-item", {
49
+ "entity-item--user": [g.USER, g.USER_GROUP].includes(o),
50
+ "entity-item--department": [g.DEPARMENT, g.DEPARMENT_GROUP].includes(
51
+ o
52
+ )
53
+ }),
54
+ children: [
55
+ /* @__PURE__ */ e("div", { className: "entity-item__content", children: f ? /* @__PURE__ */ e(te, { type: r }) : b.avatarurl ? /* @__PURE__ */ e(H, { src: b.avatarurl, size: 20 }) : /* @__PURE__ */ e(
56
+ H,
57
+ {
58
+ style: {
59
+ backgroundColor: W(l),
60
+ fontSize: "12px",
61
+ lineHeight: "13px",
62
+ width: "20px",
63
+ height: "20px"
64
+ },
65
+ children: l?.charAt(0) || "?"
66
+ }
67
+ ) }),
68
+ /* @__PURE__ */ u("div", { className: "entity-item__text", "data-type": b.type, children: [
69
+ /* @__PURE__ */ e("span", { className: "entity-item__name", children: l }),
70
+ b.type === "dockcorpdept" || b.type === "dockcorp" ? /* @__PURE__ */ u("span", { className: "entity-item__badge", children: [
71
+ "(",
72
+ _[b.type],
73
+ ")"
74
+ ] }) : null
75
+ ] }),
76
+ /* @__PURE__ */ e(
77
+ "div",
78
+ {
79
+ role: "button",
80
+ className: "entity-item__close",
81
+ onClick: n ? _e : () => w(b._id),
82
+ children: /* @__PURE__ */ e(ve, {})
83
+ }
84
+ )
85
+ ]
86
+ },
87
+ k
88
+ );
89
+ }),
90
+ i && !n && /* @__PURE__ */ e("li", { ref: y, className: "entity-list__more", "data-button": "ellipsis-button", children: /* @__PURE__ */ u(
91
+ "div",
92
+ {
93
+ role: "button",
94
+ className: "entity-list__more-button",
95
+ onClick: () => {
96
+ d?.();
97
+ },
98
+ children: [
99
+ /* @__PURE__ */ e("span", { children: m("common.viewAll", { count: t }) }),
100
+ /* @__PURE__ */ e(E, { name: "arrow-down" })
101
+ ]
102
+ }
103
+ ) })
104
+ ] })
105
+ }
106
+ );
107
+ }
108
+ ), Re = () => {
109
+ const { value: a = [], type: s } = D(), { t: n } = C(), [i, d] = S(0), [t, { toggle: c }] = ge(!1), [m, h] = S(!1), [x, o] = S(null), f = T(null), p = T(null), y = [g.DEPARMENT, g.USER].includes(s) ? de : me;
110
+ A(() => {
111
+ t && h(!0);
112
+ }, [t]);
113
+ const _ = () => {
114
+ t || h(!1);
115
+ }, [w, b] = S(!1);
116
+ A(() => {
117
+ if (!f.current || !p.current) return;
118
+ const v = () => {
119
+ requestAnimationFrame(() => {
120
+ if (b(!1), !f.current || !p.current) return;
121
+ const O = f.current.clientWidth, I = p.current.querySelectorAll(".measure-list li"), le = p.current.querySelector(
122
+ '[data-button="ellipsis-button"]'
123
+ );
124
+ if (I.length === 0) {
125
+ d(a.length);
126
+ return;
127
+ }
128
+ if (I.length !== a.length) {
129
+ console.warn("DOM not fully updated, retrying..."), requestAnimationFrame(() => v());
130
+ return;
131
+ }
132
+ let U = 0, j = 0, R = 0, M = 0;
133
+ for (; M < I.length; ) {
134
+ const B = I[M].clientWidth + K;
135
+ if (R + B <= O)
136
+ R += B, U = M + 1, M++;
137
+ else
138
+ break;
139
+ }
140
+ j = M, R = 0;
141
+ const oe = le?.offsetWidth || ue;
142
+ for (let P = j; P < I.length; P++) {
143
+ const q = I[P].clientWidth + K, ce = oe;
144
+ if (R + q + ce < O)
145
+ R += q, U = P + 1;
146
+ else {
147
+ b(!0);
148
+ break;
149
+ }
150
+ }
151
+ i !== U && d(U);
152
+ });
153
+ };
154
+ v();
155
+ }, [a]);
156
+ const k = a.length - i, l = w && !t, r = ae(() => t && p?.current?.querySelector('[data-role="measure-list"]')?.clientHeight || y, [y, t]);
157
+ return /* @__PURE__ */ e(
158
+ "div",
159
+ {
160
+ className: "depts-member-selection-preview",
161
+ style: {
162
+ height: m ? `${pe}px` : "auto"
163
+ },
164
+ children: /* @__PURE__ */ u(
165
+ "div",
166
+ {
167
+ className: N("depts-member-selection-preview-container", {
168
+ expand: t,
169
+ "enable-animation": m
170
+ }),
171
+ children: [
172
+ /* @__PURE__ */ u(
173
+ "div",
174
+ {
175
+ className: N("preview-container__body", {
176
+ expand: t
177
+ }),
178
+ ref: p,
179
+ children: [
180
+ /* @__PURE__ */ e(Q, { isMeasure: !0, previewCount: a.length }),
181
+ /* @__PURE__ */ e(z, { style: { maxHeight: "400px" }, children: /* @__PURE__ */ e("div", { className: "preview-container__scroll-gutter", children: /* @__PURE__ */ e(
182
+ "div",
183
+ {
184
+ className: "preview-container__scroll",
185
+ ref: f,
186
+ style: {
187
+ height: r + "px"
188
+ },
189
+ children: /* @__PURE__ */ e(
190
+ Q,
191
+ {
192
+ previewCount: t ? a.length : i,
193
+ showEllipsisButton: l,
194
+ hiddenCount: k,
195
+ onToggle: () => {
196
+ const v = document.querySelector('[data-teleport="DeptsMember"]');
197
+ o(v), c();
198
+ }
199
+ }
200
+ )
201
+ }
202
+ ) }) })
203
+ ]
204
+ }
205
+ ),
206
+ x && xe(
207
+ /* @__PURE__ */ e($, { children: t && /* @__PURE__ */ e(
208
+ X.div,
209
+ {
210
+ className: "depts-member-preview-container__mask",
211
+ initial: { opacity: 0, backdropFilter: "blur(0px)" },
212
+ animate: { opacity: 1, backdropFilter: "blur(.5px)" },
213
+ exit: { opacity: 0, backdropFilter: "blur(0px)" },
214
+ transition: { duration: 0.3, ease: "easeIn" },
215
+ onAnimationComplete: _
216
+ }
217
+ ) }),
218
+ x
219
+ ),
220
+ /* @__PURE__ */ e($, { mode: "wait", children: t && /* @__PURE__ */ e(
221
+ X.div,
222
+ {
223
+ className: "preview-container__button",
224
+ initial: { opacity: 1 },
225
+ exit: { opacity: 0 },
226
+ transition: { duration: 0.3 },
227
+ onAnimationComplete: _,
228
+ children: /* @__PURE__ */ u(V, { type: "link", onClick: () => c(), children: [
229
+ n("common.collapseAll"),
230
+ /* @__PURE__ */ e(E, { name: "arrow-up" })
231
+ ] })
232
+ }
233
+ ) })
234
+ ]
235
+ }
236
+ )
237
+ }
238
+ );
239
+ }, Me = (a) => {
240
+ const [s, n] = re(a, {
241
+ defaultValue: a.tabs.length ? a.tabs[0].key : void 0
242
+ }), [i, d] = S(""), t = T(/* @__PURE__ */ new Map()), [c, m] = S({
243
+ width: 0,
244
+ transform: "translateX(0)"
245
+ }), h = T(Ne((o) => a.onSearch?.(o), 250)).current;
246
+ A(() => () => {
247
+ h.cancel();
248
+ }, [h]);
249
+ const x = (o) => {
250
+ const f = t.current.get(o);
251
+ if (f) {
252
+ const { width: p, left: y } = f.getBoundingClientRect(), _ = f.parentElement?.getBoundingClientRect().left || 0;
253
+ m({
254
+ width: p,
255
+ transform: `translateX(${y - _}px)`
256
+ });
257
+ }
258
+ };
259
+ return A(() => {
260
+ s && x(s);
261
+ }, [s]), A(() => {
262
+ const o = a.tabs.length ? a.tabs[0].key : void 0;
263
+ o && x(o);
264
+ }, [a.tabs]), /* @__PURE__ */ u("div", { className: "tab-bar flex justify-between px-[10px] border-b border-[#e0e0e0] relative", children: [
265
+ /* @__PURE__ */ e("div", { className: "tab-bar__list", children: /* @__PURE__ */ u("ul", { className: "tab-bar__list-container flex gap-10 relative py-[5px]", children: [
266
+ /* @__PURE__ */ e(
267
+ "div",
268
+ {
269
+ className: "absolute bottom-[-1px] h-[2px] bg-[#0265ff] transition-all duration-300 ease-in-out",
270
+ style: {
271
+ width: `${c.width}px`,
272
+ transform: c.transform
273
+ }
274
+ }
275
+ ),
276
+ a.tabs.map((o) => /* @__PURE__ */ e(
277
+ "li",
278
+ {
279
+ ref: (f) => {
280
+ f && t.current.set(o.key, f);
281
+ },
282
+ onClick: () => n(o.key),
283
+ className: N("tab-bar__list-item cursor-pointer relative py-1", {
284
+ "text-[#0265ff]": s === o.key,
285
+ "hover:text-[#0265ff]": s !== o.key
286
+ }),
287
+ children: o.label
288
+ },
289
+ o.key
290
+ ))
291
+ ] }) }),
292
+ /* @__PURE__ */ e("div", { className: "tab-bar__search flex items-center", children: /* @__PURE__ */ u("div", { className: "relative", children: [
293
+ /* @__PURE__ */ e(
294
+ "input",
295
+ {
296
+ type: "text",
297
+ value: i,
298
+ onChange: (o) => {
299
+ d(o.target.value), h(o.target.value);
300
+ },
301
+ placeholder: a.searchPlaceholder,
302
+ className: N(
303
+ "w-[280px] h-[30px] pl-8 pr-3 rounded-[100px] bg-white border border-[#E0E0E0] outline-none text-sm placeholder:text-[#999] transition-all duration-300 ease-in-out",
304
+ "hover:border-[#0265ff]"
305
+ )
306
+ }
307
+ ),
308
+ /* @__PURE__ */ e(
309
+ E,
310
+ {
311
+ name: "search",
312
+ className: "absolute left-2.5 top-1/2 -translate-y-1/2 w-5 h-5 text-[#666]"
313
+ }
314
+ )
315
+ ] }) })
316
+ ] });
317
+ }, Pe = (a) => {
318
+ const { containerHeight: s } = D();
319
+ return /* @__PURE__ */ e(
320
+ "div",
321
+ {
322
+ className: N("tab-panel"),
323
+ style: {
324
+ height: s + "px"
325
+ },
326
+ children: a.children
327
+ }
328
+ );
329
+ }, Ae = {
330
+ "selection-tabs": "_selection-tabs_88491_1"
331
+ }, Y = ({ avatarurl: a, randomColor: s, name: n, extra: i }) => /* @__PURE__ */ u("div", { className: "flex flex-1 gap-[6px] items-center overflow-hidden ml-[-16px]", children: [
332
+ a ? /* @__PURE__ */ e(H, { src: a, size: 20, style: { flexShrink: 0 } }) : /* @__PURE__ */ e(
333
+ H,
334
+ {
335
+ style: {
336
+ backgroundColor: s,
337
+ fontSize: "12px",
338
+ lineHeight: "13px",
339
+ width: "20px",
340
+ height: "20px",
341
+ flexShrink: 0
342
+ },
343
+ children: n.charAt(0)
344
+ }
345
+ ),
346
+ /* @__PURE__ */ e("span", { className: "text-sm select-none text-ellipsis whitespace-nowrap overflow-hidden", children: n }),
347
+ i
348
+ ] }), Oe = (a) => {
349
+ const { type: s, dispatch: n, value: i, containerHeight: d } = D(), { t } = C(), { data: c, loading: m } = L(
350
+ () => Ee({
351
+ groupLimit: [],
352
+ memberLimit: [],
353
+ limit: 100,
354
+ skip: 0,
355
+ key: a.wd
356
+ }),
357
+ {
358
+ refreshDeps: [a.wd]
359
+ }
360
+ ), { data: h, loading: x } = L(
361
+ () => Te({
362
+ key: a.wd,
363
+ limit: 100,
364
+ skip: 0,
365
+ hasLimit: !1
366
+ }),
367
+ {
368
+ refreshDeps: [a.wd]
369
+ }
370
+ ), o = c?.list || [], f = h?.dock_user_list || [], p = h?.users || [], y = [
371
+ {
372
+ title: t("externalContact.title"),
373
+ value: "waibulianxiren",
374
+ children: o.map((l) => {
375
+ const r = l.nickname || l.name, v = W(r);
376
+ return {
377
+ ...l,
378
+ title: /* @__PURE__ */ e(
379
+ Y,
380
+ {
381
+ avatarurl: l.avatarurl,
382
+ randomColor: v,
383
+ name: r,
384
+ extra: /* @__PURE__ */ u("span", { className: "text-xs text-[#4d609f] shrink-0 truncate", children: [
385
+ "(",
386
+ t("externalContact.title"),
387
+ ":",
388
+ l.groupname,
389
+ ")"
390
+ ] })
391
+ }
392
+ ),
393
+ value: l._id
394
+ };
395
+ })
396
+ },
397
+ {
398
+ title: t("member.title"),
399
+ value: "chengyuan",
400
+ children: [...p, ...f].map((l) => {
401
+ const r = l.nickname || l.name, v = W(r);
402
+ return {
403
+ ...l,
404
+ title: /* @__PURE__ */ e(
405
+ Y,
406
+ {
407
+ avatarurl: l.avatarurl,
408
+ randomColor: v,
409
+ name: r,
410
+ extra: /* @__PURE__ */ e("span", { className: "text-xs text-[#4d609f] shrink-0 truncate", children: l.user_type === "dock_user" ? `(${t("department.external")}:${l.dock_corpname})` : l.deptnames })
411
+ }
412
+ ),
413
+ value: l._id
414
+ };
415
+ })
416
+ }
417
+ ].filter((l) => l.children.length), _ = y.map((l) => l.value), w = x || m, b = (l) => {
418
+ if (g.USER === s) {
419
+ const r = J(l, y);
420
+ r && n({
421
+ type: "insertOnly",
422
+ payload: {
423
+ ...r
424
+ }
425
+ });
426
+ }
427
+ if (g.USER_GROUP === s) {
428
+ const r = J(l, y);
429
+ n({
430
+ type: "addOne",
431
+ payload: {
432
+ ...r
433
+ }
434
+ });
435
+ }
436
+ }, k = (l) => {
437
+ g.USER !== s && n({
438
+ type: "deleteOne",
439
+ payload: l
440
+ });
441
+ };
442
+ return /* @__PURE__ */ u("div", { className: "h-full relative overflow-hidden", children: [
443
+ /* @__PURE__ */ e(ne, { spinning: w, children: /* @__PURE__ */ e(z, { style: { height: d - 8, padding: "4px" }, children: y.length && !w ? /* @__PURE__ */ e("div", { className: "p-1", children: /* @__PURE__ */ e(
444
+ se,
445
+ {
446
+ data: y,
447
+ checkType: s === g.USER ? "radio" : "checkbox",
448
+ defaultSelectedKeys: i?.map((l) => l._id),
449
+ defaultExpandedKeys: _,
450
+ switcherIcon: (l) => /* @__PURE__ */ e(
451
+ E,
452
+ {
453
+ name: "xiangxiazhankai-11",
454
+ className: N(
455
+ "transition-transform duration-300 text-base ease-in-out text-[#666]",
456
+ {
457
+ "rotate-90": l
458
+ }
459
+ )
460
+ }
461
+ ),
462
+ onSelect: b,
463
+ onDeSelect: k
464
+ }
465
+ ) }) : null }) }),
466
+ !y.length && !w && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: t("member.noAvailable") }) })
467
+ ] });
468
+ }, ie = (a) => {
469
+ const { type: s, value: n, dispatch: i, containerHeight: d } = D(), { t } = C(), { data: c, loading: m } = L(
470
+ () => Ce({
471
+ departmentLimit: [],
472
+ key: a.wd
473
+ }),
474
+ {
475
+ refreshDeps: [a.wd]
476
+ }
477
+ ), { data: h, loading: x } = L(
478
+ () => Ie()
479
+ ), o = h?.list || [], f = c?.departments || [], p = (c?.label_corp_list || []).filter((r) => r.type !== "dockcorpdept"), y = [...f, ...p].filter((r) => r.type !== "label"), _ = [
480
+ {
481
+ title: t("externalContact.group"),
482
+ _id: "waibulianxiren",
483
+ children: o.filter((r) => r.status === 1 && r.name?.includes(a.wd)).map((r) => ({
484
+ ...r,
485
+ title: /* @__PURE__ */ u(F, { children: [
486
+ /* @__PURE__ */ e(te, { type: "group", size: 16 }),
487
+ /* @__PURE__ */ e("span", { className: "text-sm select-none text-ellipsis whitespace-nowrap overflow-hidden", children: r.name })
488
+ ] })
489
+ }))
490
+ },
491
+ {
492
+ title: t("department.title"),
493
+ _id: "bumen",
494
+ children: y.map((r) => ({
495
+ ...r,
496
+ title: /* @__PURE__ */ u(F, { children: [
497
+ /* @__PURE__ */ e(E, { name: "dept-one", className: "text-[#0265ff]", size: 16 }),
498
+ /* @__PURE__ */ e("span", { className: "text-sm select-none text-ellipsis whitespace-nowrap overflow-hidden", children: r.name }),
499
+ ["dockdept", "dockcorp", "dockcorpdept"].includes(r.type) && /* @__PURE__ */ u("span", { className: "text-xs text-[#4d609f] shrink-0 truncate", children: [
500
+ "(",
501
+ t("department.external"),
502
+ ")"
503
+ ] })
504
+ ] })
505
+ }))
506
+ }
507
+ ].filter((r) => r.children.length), w = _.map((r) => r._id), b = (r, v) => {
508
+ if (!v)
509
+ return;
510
+ if (s === g.DEPARMENT) {
511
+ i({
512
+ type: "insertOnly",
513
+ payload: {
514
+ ...v,
515
+ type: v.departmentId ? "dockdept" : "group"
516
+ }
517
+ });
518
+ return;
519
+ }
520
+ const G = o.some((O) => O._id === v._id);
521
+ i({
522
+ type: "addOne",
523
+ payload: {
524
+ ...v,
525
+ _id: v._id,
526
+ type: G ? "group" : "dockdept"
527
+ }
528
+ });
529
+ }, k = (r) => {
530
+ i({
531
+ type: "deleteOne",
532
+ payload: r
533
+ });
534
+ }, l = m || x;
535
+ return /* @__PURE__ */ u("div", { className: "relative overflow-hidden", children: [
536
+ /* @__PURE__ */ e(ne, { spinning: l, children: /* @__PURE__ */ e(z, { style: { height: d - 8 }, children: _.length && !l ? /* @__PURE__ */ e("div", { className: "p-1", children: /* @__PURE__ */ e(
537
+ se,
538
+ {
539
+ data: _,
540
+ checkType: s === g.DEPARMENT ? "radio" : "checkbox",
541
+ selectedKeys: n?.map((r) => r._id),
542
+ fieldNames: {
543
+ title: "title",
544
+ children: "children",
545
+ value: "_id"
546
+ },
547
+ defaultExpandedKeys: w,
548
+ switcherIcon: (r) => /* @__PURE__ */ e(
549
+ E,
550
+ {
551
+ name: "xiangxiazhankai-11",
552
+ className: N(
553
+ "transition-transform text-base duration-300 ease-in-out text-[#666]",
554
+ {
555
+ "rotate-90": r
556
+ }
557
+ )
558
+ }
559
+ ),
560
+ onSelect: b,
561
+ onDeSelect: k
562
+ }
563
+ ) }) : null }) }),
564
+ !_.length && !l && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: t("department.noAvailable") }) })
565
+ ] });
566
+ }, Z = ({ wd: a, t: s, memberTabItems: n }) => ({
567
+ raw: /* @__PURE__ */ e(Oe, { wd: a }),
568
+ placeholder: s("tabs.searchMember"),
569
+ tabItems: n
570
+ }), ee = ({
571
+ wd: a,
572
+ t: s,
573
+ departmentTabItems: n
574
+ }) => ({
575
+ raw: /* @__PURE__ */ e(ie, { wd: a }),
576
+ placeholder: s("tabs.searchDepartment"),
577
+ tabItems: n
578
+ }), Ue = ({
579
+ wd: a,
580
+ t: s,
581
+ deptUserTabItems: n
582
+ }) => ({
583
+ raw: /* @__PURE__ */ e(ie, { wd: a }),
584
+ placeholder: s("common.searchPlaceholder"),
585
+ tabItems: n
586
+ }), He = {
587
+ user: Z,
588
+ usergroup: Z,
589
+ dept: ee,
590
+ deptgroup: ee,
591
+ deptusers: Ue
592
+ }, Le = (a, s) => {
593
+ const n = ke(), i = Se(), d = we(), { t } = C(), c = He[a];
594
+ if (!c)
595
+ throw new Error(`No search strategy found for type: ${a}`);
596
+ return {
597
+ config: c({
598
+ wd: s,
599
+ t,
600
+ memberTabItems: n,
601
+ departmentTabItems: i,
602
+ deptUserTabItems: d
603
+ })
604
+ };
605
+ }, Ge = () => {
606
+ const { type: a } = D(), [s, n] = S(), { config: i } = Le(a, s), { tabItems: d } = i, [t, c] = S(d[0].key), m = (p) => {
607
+ c(p), n(void 0);
608
+ }, h = d.find((p) => p.key === t)?.view, x = (p) => {
609
+ if (!p.trim().length) {
610
+ n(void 0);
611
+ return;
612
+ }
613
+ n(p);
614
+ }, o = s ? i.raw : h, f = i.placeholder;
615
+ return /* @__PURE__ */ u("div", { className: N(Ae["selection-tabs"]), children: [
616
+ /* @__PURE__ */ e(
617
+ Me,
618
+ {
619
+ value: t,
620
+ onChange: m,
621
+ onSearch: x,
622
+ tabs: d,
623
+ searchPlaceholder: f
624
+ }
625
+ ),
626
+ /* @__PURE__ */ e(Pe, { children: o })
627
+ ] });
628
+ }, Be = (a, s) => De(a, (n) => {
629
+ switch (s.type) {
630
+ case "addOne": {
631
+ const i = s.payload;
632
+ ~n.findIndex((t) => t._id === i._id) || n.push(i);
633
+ break;
634
+ }
635
+ case "addMany": {
636
+ s.payload.forEach((i) => {
637
+ ~n.findIndex((t) => t._id === i._id) || n.push(i);
638
+ });
639
+ break;
640
+ }
641
+ case "removeMany": {
642
+ const i = s.payload;
643
+ n.filter((t) => i.includes(t._id)).forEach((t) => {
644
+ const c = n.findIndex((m) => m._id === t._id);
645
+ ~c && n.splice(c, 1);
646
+ });
647
+ break;
648
+ }
649
+ case "removeAll": {
650
+ n.splice(0, n.length);
651
+ break;
652
+ }
653
+ case "insertOnly": {
654
+ const i = s.payload;
655
+ n.length && (n.length = 0), n.push(i);
656
+ break;
657
+ }
658
+ case "deleteOne": {
659
+ const i = s.payload, d = n.findIndex((t) => t._id === i);
660
+ ~d && n.splice(d, 1);
661
+ break;
662
+ }
663
+ // 插入新元素 & 删除旧元素
664
+ case "deleteAndInsert": {
665
+ const { newItems: i, oldIds: d } = s.payload;
666
+ d.forEach((t) => {
667
+ const c = n.findIndex((m) => m._id === t);
668
+ ~c && n.splice(c, 1);
669
+ }), i.forEach((t) => {
670
+ ~n.findIndex((m) => m._id === t._id) || n.push(t);
671
+ });
672
+ }
673
+ }
674
+ }), Ve = {
675
+ "depts-member-selector": "_depts-member-selector_d4xq4_1"
676
+ }, ot = (a) => {
677
+ const { onCancel: s, onConfirm: n, onChange: i, defaultValue: d, type: t = "user", currentUser: c } = a, { t: m } = C(), [h, x] = re(a, {
678
+ defaultValue: d || []
679
+ }), o = ye(
680
+ (p) => {
681
+ const y = Be(h, p);
682
+ x(y), i?.(y);
683
+ },
684
+ [x, h, i]
685
+ ), f = ae(() => ({
686
+ type: t,
687
+ value: h,
688
+ setValue: x,
689
+ dispatch: o,
690
+ currentUser: c,
691
+ containerHeight: [g.USER_GROUP, g.DEPARMENT_GROUP].includes(t) ? 355 : 395
692
+ }), [t, h, x, o, c]);
693
+ return /* @__PURE__ */ u("div", { className: "depts-member-selector", children: [
694
+ /* @__PURE__ */ e("div", { className: "px-5 pt-5", children: /* @__PURE__ */ e("div", { className: Ve["depts-member-selector"], "data-teleport": "DeptsMember", children: /* @__PURE__ */ u(he.Provider, { value: f, children: [
695
+ /* @__PURE__ */ e(Re, {}),
696
+ /* @__PURE__ */ e(Ge, {})
697
+ ] }) }) }),
698
+ /* @__PURE__ */ u("div", { className: "flex py-[14px] px-5", children: [
699
+ [g.DEPARMENT_GROUP, g.USER_GROUP].includes(t) && /* @__PURE__ */ e("div", { className: "flex-auto", children: /* @__PURE__ */ u(
700
+ "div",
701
+ {
702
+ className: "inline-flex hover:text-[#0265ff] gap-[10px] cursor-pointer items-center h-full",
703
+ onClick: () => {
704
+ x([]);
705
+ },
706
+ children: [
707
+ /* @__PURE__ */ e(E, { name: "clearTree", size: 20, style: { verticalAlign: "sub" } }),
708
+ /* @__PURE__ */ e("span", { children: m("common.clearAll") })
709
+ ]
710
+ }
711
+ ) }),
712
+ /* @__PURE__ */ u("div", { className: "flex-1 flex justify-end", children: [
713
+ /* @__PURE__ */ e(V, { onClick: s, className: "btn-cancel", children: m("common.cancel") }),
714
+ /* @__PURE__ */ e(V, { type: "primary", className: "ml-3", onClick: () => n?.(h), children: m("common.confirm") })
715
+ ] })
716
+ ] })
717
+ ] });
718
+ };
719
+ export {
720
+ ot as D
721
+ };