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