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