@baishuyun/ui-business 2.0.0 → 2.0.1

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,15 +1,15 @@
1
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";
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
8
  import { createPortal as ve } from "react-dom";
9
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";
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
13
  import { n as _e, d as Ne } from "../vendors/lodash-es.js";
14
14
  import { useMemberTabItems as we } from "./subcomponents/Entity/Member/index.js";
15
15
  import { useDepartmentTabItems as Ee } from "./subcomponents/Entity/Department/index.js";
@@ -18,82 +18,82 @@ import { g as Re } from "../vendors/services/data/member_limit.service.js";
18
18
  import { g as Te } from "../vendors/services/data/member.service.js";
19
19
  import { produce as De } from "immer";
20
20
  const Ie = () => {
21
- const { value: t = [], setValue: r, type: n } = G(), { t: s } = L(), m = {
21
+ const { value: n = [], setValue: i, type: t } = G(), { t: s } = L(), u = {
22
22
  dockcorp: s("member.contact"),
23
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;
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
25
  U(() => {
26
- d && c(!0);
27
- }, [d]);
26
+ o && c(!0);
27
+ }, [o]);
28
28
  const l = () => {
29
- d || c(!1);
30
- }, [_, H] = T(!1);
29
+ o || c(!1);
30
+ }, [N, H] = T(!1);
31
31
  U(() => {
32
- if (!y.current || !R.current) return;
33
- const w = () => {
32
+ if (!v.current || !R.current) return;
33
+ const E = () => {
34
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);
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
39
  return;
40
40
  }
41
- if (h.length !== t.length) {
42
- console.warn("DOM not fully updated, retrying..."), requestAnimationFrame(() => w());
41
+ if (f.length !== n.length) {
42
+ console.warn("DOM not fully updated, retrying..."), requestAnimationFrame(() => E());
43
43
  return;
44
44
  }
45
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++;
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
50
  else {
51
- P = N;
51
+ P = w;
52
52
  break;
53
53
  }
54
54
  }
55
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;
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
61
  else {
62
62
  H(!0);
63
63
  break;
64
64
  }
65
65
  }
66
- a !== C && u(C);
66
+ a !== C && m(C);
67
67
  });
68
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;
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
73
  return /* @__PURE__ */ e(
74
74
  "div",
75
75
  {
76
- className: E({
77
- "measure-list": w
76
+ className: k({
77
+ "measure-list": E
78
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";
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
82
  return /* @__PURE__ */ p(
83
83
  "li",
84
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
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
89
  )
90
90
  }),
91
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,
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
94
  {
95
95
  style: {
96
- backgroundColor: q(P),
96
+ backgroundColor: z(P),
97
97
  fontSize: "12px",
98
98
  lineHeight: "13px",
99
99
  width: "20px",
@@ -102,11 +102,11 @@ const Ie = () => {
102
102
  children: P?.charAt(0) || "?"
103
103
  }
104
104
  ) }),
105
- /* @__PURE__ */ p("div", { className: "entity-item__text", "data-type": h.type, children: [
105
+ /* @__PURE__ */ p("div", { className: "entity-item__text", "data-type": f.type, children: [
106
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: [
107
+ f.type === "dockcorpdept" || f.type === "dockcorp" ? /* @__PURE__ */ p("span", { className: "entity-item__badge", children: [
108
108
  "(",
109
- m[h.type],
109
+ u[f.type],
110
110
  ")"
111
111
  ] }) : null
112
112
  ] }),
@@ -115,8 +115,8 @@ const Ie = () => {
115
115
  {
116
116
  role: "button",
117
117
  className: "entity-item__close",
118
- onClick: w ? _e : () => S(h._id),
119
- children: /* @__PURE__ */ e(be, {})
118
+ onClick: E ? _e : () => S(f._id),
119
+ children: /* @__PURE__ */ e(xe, {})
120
120
  }
121
121
  )
122
122
  ]
@@ -124,14 +124,14 @@ const Ie = () => {
124
124
  C
125
125
  );
126
126
  }),
127
- ie && !w && /* @__PURE__ */ e("li", { ref: x, className: "entity-list__more", children: /* @__PURE__ */ p(
127
+ ie && !E && /* @__PURE__ */ e("li", { ref: y, className: "entity-list__more", children: /* @__PURE__ */ p(
128
128
  "div",
129
129
  {
130
130
  role: "button",
131
131
  className: "entity-list__more-button",
132
132
  onClick: () => {
133
- const h = document.querySelector('[data-teleport="DeptsMember"]');
134
- k(h), f();
133
+ const f = document.querySelector('[data-teleport="DeptsMember"]');
134
+ _(f), h();
135
135
  },
136
136
  children: [
137
137
  /* @__PURE__ */ e("span", { children: s("common.viewAll", { count: j }) }),
@@ -148,31 +148,31 @@ const Ie = () => {
148
148
  {
149
149
  className: "depts-member-selection-preview",
150
150
  style: {
151
- height: g ? `${ue}px` : "auto"
151
+ height: x ? `${he}px` : "auto"
152
152
  },
153
153
  children: /* @__PURE__ */ p(
154
154
  "div",
155
155
  {
156
- className: E("depts-member-selection-preview-container", {
157
- expand: d,
158
- "enable-animation": g
156
+ className: k("depts-member-selection-preview-container", {
157
+ expand: o,
158
+ "enable-animation": x
159
159
  }),
160
160
  children: [
161
161
  /* @__PURE__ */ p(
162
162
  "div",
163
163
  {
164
- className: E("preview-container__body", {
165
- expand: d
164
+ className: k("preview-container__body", {
165
+ expand: o
166
166
  }),
167
167
  ref: R,
168
168
  children: [
169
169
  K(!0),
170
- /* @__PURE__ */ e(z, { style: { maxHeight: "400px" }, children: /* @__PURE__ */ e("div", { ref: y, className: "preview-container__scroll-gutter", children: /* @__PURE__ */ e(
170
+ /* @__PURE__ */ e(q, { style: { maxHeight: "400px" }, children: /* @__PURE__ */ e("div", { ref: v, className: "preview-container__scroll-gutter", children: /* @__PURE__ */ e(
171
171
  "div",
172
172
  {
173
173
  className: "preview-container__scroll",
174
174
  style: {
175
- height: re + "px"
175
+ height: oe + "px"
176
176
  },
177
177
  children: K()
178
178
  }
@@ -181,7 +181,7 @@ const Ie = () => {
181
181
  }
182
182
  ),
183
183
  b && ve(
184
- /* @__PURE__ */ e(Y, { children: d && /* @__PURE__ */ e(
184
+ /* @__PURE__ */ e(Y, { children: o && /* @__PURE__ */ e(
185
185
  J.div,
186
186
  {
187
187
  className: "depts-member-preview-container__mask",
@@ -194,7 +194,7 @@ const Ie = () => {
194
194
  ) }),
195
195
  b
196
196
  ),
197
- /* @__PURE__ */ e(Y, { mode: "wait", children: d && /* @__PURE__ */ e(
197
+ /* @__PURE__ */ e(Y, { mode: "wait", children: o && /* @__PURE__ */ e(
198
198
  J.div,
199
199
  {
200
200
  className: "preview-container__button",
@@ -202,7 +202,7 @@ const Ie = () => {
202
202
  exit: { opacity: 0 },
203
203
  transition: { duration: 0.3 },
204
204
  onAnimationComplete: l,
205
- children: /* @__PURE__ */ p(B, { type: "link", onClick: () => f(), children: [
205
+ children: /* @__PURE__ */ p(W, { type: "link", onClick: () => h(), children: [
206
206
  s("common.collapseAll"),
207
207
  /* @__PURE__ */ e(I, { name: "arrow-up" })
208
208
  ] })
@@ -213,53 +213,53 @@ const Ie = () => {
213
213
  )
214
214
  }
215
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({
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
220
  width: 0,
221
221
  transform: "translateX(0)"
222
- }), f = M(Ne((c) => t.onSearch?.(c), 250)).current;
222
+ }), h = M(Ne((c) => n.onSearch?.(c), 250)).current;
223
223
  U(() => () => {
224
- f.cancel();
225
- }, [f]);
226
- const g = (c) => {
224
+ h.cancel();
225
+ }, [h]);
226
+ const x = (c) => {
227
227
  const b = a.current.get(c);
228
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)`
229
+ const { width: _, left: y } = b.getBoundingClientRect(), g = b.parentElement?.getBoundingClientRect().left || 0;
230
+ o({
231
+ width: _,
232
+ transform: `translateX(${y - g}px)`
233
233
  });
234
234
  }
235
235
  };
236
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: [
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
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
243
  /* @__PURE__ */ e(
244
244
  "div",
245
245
  {
246
246
  className: "absolute bottom-[-1px] h-[2px] bg-[#0265ff] transition-all duration-300 ease-in-out",
247
247
  style: {
248
- width: `${u.width}px`,
249
- transform: u.transform
248
+ width: `${m.width}px`,
249
+ transform: m.transform
250
250
  }
251
251
  }
252
252
  ),
253
- t.tabs.map((c) => /* @__PURE__ */ e(
253
+ n.tabs.map((c) => /* @__PURE__ */ e(
254
254
  "li",
255
255
  {
256
256
  ref: (b) => {
257
257
  b && a.current.set(c.value, b);
258
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
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
263
  }),
264
264
  children: c.label
265
265
  },
@@ -273,10 +273,10 @@ const Ie = () => {
273
273
  type: "text",
274
274
  value: s,
275
275
  onChange: (c) => {
276
- m(c.target.value), f(c.target.value);
276
+ u(c.target.value), h(c.target.value);
277
277
  },
278
- placeholder: t.searchPlaceholder,
279
- className: E(
278
+ placeholder: n.searchPlaceholder,
279
+ className: k(
280
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
281
  "hover:border-[#0265ff]"
282
282
  )
@@ -291,173 +291,173 @@ const Ie = () => {
291
291
  )
292
292
  ] }) })
293
293
  ] });
294
- }, Pe = (t) => {
295
- const { containerHeight: r } = G();
294
+ }, Pe = (n) => {
295
+ const { containerHeight: i } = G();
296
296
  return /* @__PURE__ */ e(
297
297
  "div",
298
298
  {
299
- className: E("tab-panel"),
299
+ className: k("tab-panel"),
300
300
  style: {
301
- height: r + "px"
301
+ height: i + "px"
302
302
  },
303
- children: t.children
303
+ children: n.children
304
304
  }
305
305
  );
306
306
  }, Me = {
307
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,
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
311
  {
312
312
  style: {
313
- backgroundColor: r,
313
+ backgroundColor: i,
314
314
  fontSize: "12px",
315
315
  lineHeight: "13px",
316
316
  width: "20px",
317
317
  height: "20px",
318
318
  flexShrink: 0
319
319
  },
320
- children: n.charAt(0)
320
+ children: t.charAt(0)
321
321
  }
322
322
  ),
323
- /* @__PURE__ */ e("span", { className: "text-sm select-none text-ellipsis whitespace-nowrap overflow-hidden", children: n }),
323
+ /* @__PURE__ */ e("span", { className: "text-sm select-none text-ellipsis whitespace-nowrap overflow-hidden", children: t }),
324
324
  s
325
- ] }), ee = (t) => {
326
- const { type: r, dispatch: n, value: s, containerHeight: m } = G(), { t: a } = L(), { data: u, loading: d } = F(
325
+ ] }), ee = (n) => {
326
+ const { type: i, dispatch: t, value: s, containerHeight: u } = G(), { t: a } = L(), { data: m, loading: o } = F(
327
327
  () => ke({
328
328
  groupLimit: [],
329
329
  memberLimit: [],
330
330
  limit: 100,
331
331
  skip: 0,
332
- key: t.wd
332
+ key: n.wd
333
333
  }),
334
334
  {
335
- refreshDeps: [t.wd]
335
+ refreshDeps: [n.wd]
336
336
  }
337
- ), { data: f, loading: g } = F(
337
+ ), { data: h, loading: x } = F(
338
338
  () => Re({
339
- key: t.wd,
339
+ key: n.wd,
340
340
  limit: 100,
341
341
  skip: 0,
342
342
  hasLimit: !1
343
343
  }),
344
344
  {
345
- refreshDeps: [t.wd]
345
+ refreshDeps: [n.wd]
346
346
  }
347
- ), c = u?.list || [], b = f?.dock_user_list || [], k = f?.users || [], x = [
347
+ ), c = m?.list || [], b = h?.dock_user_list || [], _ = h?.users || [], y = [
348
348
  {
349
349
  title: a("externalContact.title"),
350
350
  value: "waibulianxiren",
351
- children: c.map((i) => {
352
- const l = i.nickname || i.name, _ = q(l);
351
+ children: c.map((r) => {
352
+ const l = r.nickname || r.name, N = z(l);
353
353
  return {
354
- ...i,
354
+ ...r,
355
355
  title: /* @__PURE__ */ e(
356
356
  Z,
357
357
  {
358
- avatarurl: i.avatarurl,
359
- randomColor: _,
358
+ avatarurl: r.avatarurl,
359
+ randomColor: N,
360
360
  name: l,
361
361
  extra: /* @__PURE__ */ p("span", { className: "text-xs text-[#4d609f] shrink-0 truncate", children: [
362
362
  "(",
363
363
  a("externalContact.title"),
364
364
  ":",
365
- i.groupname,
365
+ r.groupname,
366
366
  ")"
367
367
  ] })
368
368
  }
369
369
  ),
370
- value: i._id
370
+ value: r._id
371
371
  };
372
372
  })
373
373
  },
374
374
  {
375
375
  title: a("member.title"),
376
376
  value: "chengyuan",
377
- children: [...k, ...b].map((i) => {
378
- const l = i.nickname || i.name, _ = q(l);
377
+ children: [..._, ...b].map((r) => {
378
+ const l = r.nickname || r.name, N = z(l);
379
379
  return {
380
- ...i,
380
+ ...r,
381
381
  title: /* @__PURE__ */ e(
382
382
  Z,
383
383
  {
384
- avatarurl: i.avatarurl,
385
- randomColor: _,
384
+ avatarurl: r.avatarurl,
385
+ randomColor: N,
386
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 })
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
388
  }
389
389
  ),
390
- value: i._id
390
+ value: r._id
391
391
  };
392
392
  })
393
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({
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
398
  type: "insertOnly",
399
399
  payload: {
400
400
  ...l
401
401
  }
402
402
  });
403
403
  }
404
- if (o.USER_GROUP === r) {
405
- const l = Q(i, x);
406
- n({
404
+ if (d.USER_GROUP === i) {
405
+ const l = Q(r, y);
406
+ t({
407
407
  type: "addOne",
408
408
  payload: {
409
409
  ...l
410
410
  }
411
411
  });
412
412
  }
413
- }, R = (i) => {
414
- o.USER !== r && n({
413
+ }, R = (r) => {
414
+ d.USER !== i && t({
415
415
  type: "deleteOne",
416
- payload: i
416
+ payload: r
417
417
  });
418
418
  };
419
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,
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
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(
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
428
  I,
429
429
  {
430
430
  name: "xiangxiazhankai-11",
431
- className: E(
431
+ className: k(
432
432
  "transition-transform duration-300 text-base ease-in-out text-[#666]",
433
433
  {
434
- "rotate-90": i
434
+ "rotate-90": r
435
435
  }
436
436
  )
437
437
  }
438
438
  ),
439
- onSelect: y,
439
+ onSelect: v,
440
440
  onDeSelect: R
441
441
  }
442
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") }) })
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
444
  ] });
445
- }, te = (t) => {
446
- const { type: r, value: n, dispatch: s, containerHeight: m } = G(), { t: a } = L(), { data: u, loading: d } = F(
445
+ }, te = (n) => {
446
+ const { type: i, value: t, dispatch: s, containerHeight: u } = G(), { t: a } = L(), { data: m, loading: o } = F(
447
447
  () => Te({
448
448
  departmentLimit: [],
449
- key: t.wd
449
+ key: n.wd
450
450
  }),
451
451
  {
452
- refreshDeps: [t.wd]
452
+ refreshDeps: [n.wd]
453
453
  }
454
- ), { data: f, loading: g } = F(
454
+ ), { data: h, loading: x } = F(
455
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 = [
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
457
  {
458
458
  title: a("externalContact.group"),
459
459
  _id: "waibulianxiren",
460
- children: c.filter((l) => l.status === 1 && l.name?.includes(t.wd)).map((l) => ({
460
+ children: c.filter((l) => l.status === 1 && l.name?.includes(n.wd)).map((l) => ({
461
461
  ...l,
462
462
  title: /* @__PURE__ */ p($, { children: [
463
463
  /* @__PURE__ */ e(ne, { type: "group" }),
@@ -468,7 +468,7 @@ const Ie = () => {
468
468
  {
469
469
  title: a("department.title"),
470
470
  _id: "bumen",
471
- children: x.map((l) => ({
471
+ children: y.map((l) => ({
472
472
  ...l,
473
473
  title: /* @__PURE__ */ p($, { children: [
474
474
  /* @__PURE__ */ e(I, { name: "dept-one", className: "text-[#0265ff] text-lg" }),
@@ -481,25 +481,25 @@ const Ie = () => {
481
481
  ] })
482
482
  }))
483
483
  }
484
- ].filter((l) => l.children.length), S = v.map((l) => l._id), y = (l, _) => {
485
- if (!_)
484
+ ].filter((l) => l.children.length), S = g.map((l) => l._id), v = (l, N) => {
485
+ if (!N)
486
486
  return;
487
- if (r === o.DEPARMENT) {
487
+ if (i === d.DEPARMENT) {
488
488
  s({
489
489
  type: "insertOnly",
490
490
  payload: {
491
- ..._,
492
- type: _.departmentId ? "dockdept" : "group"
491
+ ...N,
492
+ type: N.departmentId ? "dockdept" : "group"
493
493
  }
494
494
  });
495
495
  return;
496
496
  }
497
- const H = c.some((j) => j._id === _._id);
497
+ const H = c.some((j) => j._id === N._id);
498
498
  s({
499
499
  type: "addOne",
500
500
  payload: {
501
- ..._,
502
- _id: _._id,
501
+ ...N,
502
+ _id: N._id,
503
503
  type: H ? "group" : "dockdept"
504
504
  }
505
505
  });
@@ -508,14 +508,14 @@ const Ie = () => {
508
508
  type: "deleteOne",
509
509
  payload: l
510
510
  });
511
- }, i = d || g;
511
+ }, r = o || x;
512
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,
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
515
  {
516
- data: v,
517
- checkType: r === o.DEPARMENT ? "radio" : "checkbox",
518
- selectedKeys: n?.map((l) => l._id),
516
+ data: g,
517
+ checkType: i === d.DEPARMENT ? "radio" : "checkbox",
518
+ selectedKeys: t?.map((l) => l._id),
519
519
  fieldNames: {
520
520
  title: "title",
521
521
  children: "children",
@@ -526,7 +526,7 @@ const Ie = () => {
526
526
  I,
527
527
  {
528
528
  name: "xiangxiazhankai-11",
529
- className: E(
529
+ className: k(
530
530
  "transition-transform text-base duration-300 ease-in-out text-[#666]",
531
531
  {
532
532
  "rotate-90": l
@@ -534,148 +534,142 @@ const Ie = () => {
534
534
  )
535
535
  }
536
536
  ),
537
- onSelect: y,
537
+ onSelect: v,
538
538
  onDeSelect: R
539
539
  }
540
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") }) })
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
542
  ] });
543
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")
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
548
  },
549
- [o.USER_GROUP]: {
550
- raw: /* @__PURE__ */ e(ee, { wd: n }),
551
- placeholder: r("tabs.searchMember")
549
+ [d.USER_GROUP]: {
550
+ raw: /* @__PURE__ */ e(ee, { wd: t }),
551
+ placeholder: i("tabs.searchMember")
552
552
  },
553
- [o.DEPARMENT]: {
554
- raw: /* @__PURE__ */ e(te, { wd: n }),
555
- placeholder: r("tabs.searchDepartment")
553
+ [d.DEPARMENT]: {
554
+ raw: /* @__PURE__ */ e(te, { wd: t }),
555
+ placeholder: i("tabs.searchDepartment")
556
556
  },
557
- [o.DEPARMENT_GROUP]: {
558
- raw: /* @__PURE__ */ e(te, { wd: n }),
559
- placeholder: r("tabs.searchDepartment")
557
+ [d.DEPARMENT_GROUP]: {
558
+ raw: /* @__PURE__ */ e(te, { wd: t }),
559
+ placeholder: i("tabs.searchDepartment")
560
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) {
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
570
  s(void 0);
571
571
  return;
572
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: [
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
576
  /* @__PURE__ */ e(
577
577
  Ce,
578
578
  {
579
- value: g,
579
+ value: x,
580
580
  onChange: b,
581
- onSearch: x,
582
- tabs: f,
581
+ onSearch: y,
582
+ tabs: h,
583
583
  searchPlaceholder: S
584
584
  }
585
585
  ),
586
- /* @__PURE__ */ e(Pe, { children: v })
586
+ /* @__PURE__ */ e(Pe, { children: g })
587
587
  ] });
588
- }, Oe = (t, r) => De(t, (n) => {
589
- switch (r.type) {
588
+ }, Oe = (n, i) => De(n, (t) => {
589
+ switch (i.type) {
590
590
  case "addOne": {
591
- const s = r.payload;
592
- ~n.findIndex((a) => a._id === s._id) || n.push(s);
591
+ const s = i.payload;
592
+ ~t.findIndex((a) => a._id === s._id) || t.push(s);
593
593
  break;
594
594
  }
595
595
  case "addMany": {
596
- r.payload.forEach((s) => {
597
- ~n.findIndex((a) => a._id === s._id) || n.push(s);
596
+ i.payload.forEach((s) => {
597
+ ~t.findIndex((a) => a._id === s._id) || t.push(s);
598
598
  });
599
599
  break;
600
600
  }
601
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);
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
606
  });
607
607
  break;
608
608
  }
609
609
  case "removeAll": {
610
- n.splice(0, n.length);
610
+ t.splice(0, t.length);
611
611
  break;
612
612
  }
613
613
  case "insertOnly": {
614
- const s = r.payload;
615
- n.length && (n.length = 0), n.push(s);
614
+ const s = i.payload;
615
+ t.length && (t.length = 0), t.push(s);
616
616
  break;
617
617
  }
618
618
  case "deleteOne": {
619
- const s = r.payload, m = n.findIndex((a) => a._id === s);
620
- ~m && n.splice(m, 1);
619
+ const s = i.payload, u = t.findIndex((a) => a._id === s);
620
+ ~u && t.splice(u, 1);
621
621
  break;
622
622
  }
623
623
  // 插入新元素 & 删除旧元素
624
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);
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
629
  }), s.forEach((a) => {
630
- ~n.findIndex((d) => d._id === a._id) || n.push(a);
630
+ ~t.findIndex((o) => o._id === a._id) || t.push(a);
631
631
  });
632
632
  }
633
633
  }
634
634
  }), Ue = {
635
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);
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
643
  },
644
- [a, m]
645
- );
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]);
646
652
  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
- ) }) }),
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
+ ] }) }) }),
663
657
  /* @__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,
658
+ [d.DEPARMENT_GROUP, d.USER_GROUP].includes(a) && /* @__PURE__ */ e("div", { className: "flex-auto", children: /* @__PURE__ */ e(
659
+ W,
666
660
  {
667
661
  type: "text",
668
662
  className: "hover:bg-transparent hover:text-[#0265ff] pl-0",
669
663
  icon: /* @__PURE__ */ e(I, { name: "clearTree", className: "text-lg", style: { verticalAlign: "sub" } }),
670
664
  onClick: () => {
671
- a([]);
665
+ h([]);
672
666
  },
673
- children: s("common.clearAll")
667
+ children: m("common.clearAll")
674
668
  }
675
669
  ) }),
676
670
  /* @__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") })
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") })
679
673
  ] })
680
674
  ] })
681
675
  ] });