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