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