@baishuyun/ui-business 2.0.1 → 2.0.4

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