@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.
@@ -0,0 +1,137 @@
1
+ import { createContext as h, useContext as g, useMemo as p, useCallback as v, useRef as E, useState as A, useEffect as D } from "react";
2
+ import { n as b } from "../vendors/lodash-es.js";
3
+ import { jsx as o, jsxs as G } from "react/jsx-runtime";
4
+ import { Icon as c } from "bsy-react-ui";
5
+ import { C as N } from "../ConfigProvider/configContext-lDqg07Z3.js";
6
+ import { c as S } from "../vendors/clsx.js";
7
+ const I = h({
8
+ type: "user",
9
+ setValue: b,
10
+ dispatch: b,
11
+ containerHeight: 0
12
+ }), tt = () => g(I), et = {
13
+ /**
14
+ * @description 表示单个成员
15
+ */
16
+ USER: "user",
17
+ /**
18
+ * @description 表示多个成员组
19
+ */
20
+ USER_GROUP: "usergroup",
21
+ /**
22
+ * @description 表示单个部门
23
+ */
24
+ DEPARMENT: "dept",
25
+ /**
26
+ * @description 表示多个部门组
27
+ */
28
+ DEPARMENT_GROUP: "deptgroup"
29
+ }, nt = 110, at = 68, rt = 30, ot = 8, lt = 90, ct = ({ type: n }) => {
30
+ switch (n) {
31
+ case "label":
32
+ return /* @__PURE__ */ o(c, { name: "Enterpriselabel", className: "text-[#0265ff] text-lg" });
33
+ case "dockcorp":
34
+ case "dockcorpdept":
35
+ return /* @__PURE__ */ o(c, { name: "company", className: "text-[#0265ff] text-lg" });
36
+ case "dockdept":
37
+ case "member":
38
+ return /* @__PURE__ */ o(c, { name: "dept-one", className: "text-[#0265ff] text-lg" });
39
+ case "group":
40
+ return /* @__PURE__ */ o(c, { name: "Outreach", className: "text-[#70c911] text-lg" });
41
+ default:
42
+ return /* @__PURE__ */ o(c, { name: "dept-one", className: "text-[#0265ff] text-lg" });
43
+ }
44
+ }, M = { loading: "加载中...", cancel: "取消", confirm: "确认", clearAll: "清空所选项", viewAll: "查看全部{count}个", selected: "已选 {selected}/{total}", collapseAll: "收起全部", noAvailable: "没有可选成员" }, y = { title: "部门", search: "搜索部门", noAvailable: "没有可选部门", contact: "对接部门", organizationalStructure: "组织架构", currentUserDepartment: "当前用户所处部门", internal: "内部组织", external: "外部组织", externalContactGroup: "对接人小组", externalContactDepartment: "对接部门" }, R = { title: "成员", search: "搜索成员", contact: "对接人", all: "全部成员", allContact: "全部对接人", internal: "内部成员", external: "外部成员", noAvailable: "没有可选成员" }, U = { title: "角色", internal: "内部角色", external: "互联角色" }, k = { title: "职位" }, T = { title: "当前用户" }, P = { title: "外部联系人", defaultGroup: "默认分组", customGroup: "自定义分组", group: "外部联系人分组", noAvailableGroup: "没有可选分组" }, $ = { searchMember: "搜索成员", searchDepartment: "搜索部门" }, d = {
45
+ common: M,
46
+ department: y,
47
+ member: R,
48
+ role: U,
49
+ position: k,
50
+ currentUser: T,
51
+ externalContact: P,
52
+ tabs: $
53
+ }, H = { loading: "Loading...", cancel: "Cancel", confirm: "Confirm", clearAll: "Clear All", viewAll: "View All {count}", selected: "Selected {selected}/{total}", collapseAll: "Collapse All", noAvailable: "No available members" }, L = { title: "Department", search: "Search Department", noAvailable: "No available departments", contact: "Contact Department", organizationalStructure: "Organizational Structure", currentUserDepartment: "Current User Department", internal: "Internal Organization", external: "External Organization", externalContactGroup: "External Contact Group", externalContactDepartment: "External Contact Department" }, O = { title: "Member", search: "Search Member", contact: "Contact Person", allContact: "All Contact Persons", all: "All Members", internal: "Internal Members", external: "External Members", noAvailable: "No available members" }, w = { title: "Role", internal: "Internal Role", external: "Interconnected Role" }, z = { title: "Position" }, B = { title: "Current User" }, W = { title: "External Contact", defaultGroup: "Default Group", customGroup: "Custom Group", group: "External Contact Group", noAvailableGroup: "No available groups" }, j = { searchMember: "Search Member", searchDepartment: "Search Department" }, V = {
54
+ common: H,
55
+ department: L,
56
+ member: O,
57
+ role: w,
58
+ position: z,
59
+ currentUser: B,
60
+ externalContact: W,
61
+ tabs: j
62
+ }, X = (n, a, t) => {
63
+ const s = a.split(".");
64
+ let e = n;
65
+ try {
66
+ for (const r of s)
67
+ e = e[r];
68
+ return typeof e == "string" ? t ? e.replace(/\{(\w+)\}/g, (r, i) => t[i] !== void 0 ? String(t[i]) : r) : e : a;
69
+ } catch {
70
+ return a;
71
+ }
72
+ }, st = () => {
73
+ const n = g(N), a = p(() => ({ "zh-CN": d, "en-US": V }), []), t = p(() => a[n.locale] || d, [n.locale, a]);
74
+ return {
75
+ t: v(
76
+ (e, r) => X(t, e, r),
77
+ [t]
78
+ )
79
+ };
80
+ }, q = "_active_nkgxh_15", u = {
81
+ "tabgroup-container": "_tabgroup-container_nkgxh_1",
82
+ "tabgroup-container__tab-item": "_tabgroup-container__tab-item_nkgxh_7",
83
+ active: q,
84
+ "tabgroup-container__indicator": "_tabgroup-container__indicator_nkgxh_18"
85
+ }, it = (n) => {
86
+ const { tabs: a, value: t, onChange: s } = n, e = E(null), [r, i] = A({
87
+ width: 0,
88
+ transform: "translateX(0)"
89
+ }), x = (l) => {
90
+ const m = e.current?.querySelector(`[data-key="${l}"]`);
91
+ if (m) {
92
+ const { width: f, left: C } = m.getBoundingClientRect(), _ = m.parentElement?.parentElement?.getBoundingClientRect().left || 0;
93
+ i({
94
+ width: f,
95
+ transform: `translateX(${C - _}px)`
96
+ });
97
+ }
98
+ };
99
+ return D(() => {
100
+ x(t);
101
+ }, [t]), /* @__PURE__ */ G("div", { className: u["tabgroup-container"], ref: e, children: [
102
+ /* @__PURE__ */ o(
103
+ "div",
104
+ {
105
+ className: u["tabgroup-container__indicator"],
106
+ style: {
107
+ width: `${r.width}px`,
108
+ transform: r.transform
109
+ }
110
+ }
111
+ ),
112
+ a.map((l) => /* @__PURE__ */ o(
113
+ "div",
114
+ {
115
+ className: S(u["tabgroup-container__tab-item"], {
116
+ [u.active]: t === l.value
117
+ }),
118
+ onClick: () => s(l.value),
119
+ children: /* @__PURE__ */ o("span", { "data-key": l.value, children: l.label })
120
+ },
121
+ l.value
122
+ ))
123
+ ] });
124
+ };
125
+ export {
126
+ I as D,
127
+ et as E,
128
+ ot as G,
129
+ rt as M,
130
+ lt as P,
131
+ at as T,
132
+ st as a,
133
+ nt as b,
134
+ ct as c,
135
+ it as d,
136
+ tt as u
137
+ };
@@ -1,5 +1,5 @@
1
- import { D as t } from "./DeptsMember-C54jKU8C.js";
2
- import { E as a } from "./TabGroup-B_2npRbC.js";
1
+ import { D as t } from "./DeptsMember-C4fZKTp3.js";
2
+ import { E as a } from "./TabGroup-C4h1Oi7h.js";
3
3
  export {
4
4
  a as Entity,
5
5
  t as default
@@ -4,7 +4,7 @@ import { useRequest as T } from "ahooks";
4
4
  import { Spin as A, Radio as R } from "antd";
5
5
  import { c as v } from "../../../../vendors/clsx.js";
6
6
  import { useState as D, useMemo as G, useCallback as M } from "react";
7
- import { u as N, a as k, E, d as L, c as H } from "../../../TabGroup-B_2npRbC.js";
7
+ import { u as N, a as k, E, d as L, c as H } from "../../../TabGroup-C4h1Oi7h.js";
8
8
  import { buildDeptTree as B, buildTree as U, findNodeInTree as q } from "../../../utils/index.js";
9
9
  import { S } from "../../../../vendors/simplebar-react.js";
10
10
  import { Tree as w, Icon as C, Checkbox as O } from "bsy-react-ui";
@@ -151,14 +151,6 @@ const Q = (t) => {
151
151
  ...h,
152
152
  checkable: h.type !== "dockcorpdept" && h.type !== "label",
153
153
  icon: /* @__PURE__ */ e(H, { type: h.type })
154
- // name: (
155
- // <div>
156
- // <span>{dept.name}</span>
157
- // {showBadge && (
158
- // <span className="text-xs text-[#4d609f]">({badgeText[dept.type]})</span>
159
- // )}
160
- // </div>
161
- // ),
162
154
  }));
163
155
  return y.length > 0 ? U(I, {
164
156
  parentId: "parentId",
@@ -6,14 +6,14 @@ import { g as Z, a as $, b as Q, c as W } from "../../../../vendors/services/dat
6
6
  import { produce as O } from "immer";
7
7
  import { getColorByName as j, buildDeptTree as H, buildTree as X } from "../../../utils/index.js";
8
8
  import { Radio as G, Avatar as A, Spin as E } from "antd";
9
- import { a as S, u as I, E as T, d as Y, c as ee } from "../../../TabGroup-B_2npRbC.js";
9
+ import { a as S, u as I, E as T, d as Y, c as ee } from "../../../TabGroup-C4h1Oi7h.js";
10
10
  import { Checkbox as R, Tree as U, Icon as M } from "bsy-react-ui";
11
11
  import { S as w } from "../../../../vendors/simplebar-react.js";
12
12
  import { g as te, a as le } from "../../../../vendors/services/data/department.service.js";
13
13
  import { g as ne, a as se } from "../../../../vendors/services/corp/outsider.service.js";
14
14
  import { g as re } from "../../../../vendors/services/team/team.services.js";
15
15
  const D = (t) => {
16
- const { list: l, showCheckAll: b = !0 } = t, { t: d } = S(), { value: p, type: i, dispatch: o } = I(), m = i === T.USER, h = i === T.USER_GROUP, v = p?.[0]?._id, c = (s) => {
16
+ const { list: l, showCheckAll: b = !0 } = t, { t: d } = S(), { value: p, type: i, dispatch: o } = I(), m = i === T.USER, h = i === T.USER_GROUP, y = p?.[0]?._id, c = (s) => {
17
17
  const r = l?.find((f) => f._id === s.target.value);
18
18
  r && o({
19
19
  type: "insertOnly",
@@ -26,7 +26,7 @@ const D = (t) => {
26
26
  type: "deleteOne",
27
27
  payload: s
28
28
  });
29
- }, C = p?.map((s) => s._id) || [], n = l.filter((s) => C.includes(s._id)).length, y = (s) => {
29
+ }, C = p?.map((s) => s._id) || [], n = l.filter((s) => C.includes(s._id)).length, v = (s) => {
30
30
  const r = [], f = [];
31
31
  for (let k = 0; k < l.length; k++) {
32
32
  const g = l[k];
@@ -54,7 +54,7 @@ const D = (t) => {
54
54
  m && /* @__PURE__ */ e(
55
55
  G.Group,
56
56
  {
57
- value: v,
57
+ value: y,
58
58
  onChange: c,
59
59
  className: "w-full",
60
60
  prefixCls: "ant-radio",
@@ -119,7 +119,7 @@ const D = (t) => {
119
119
  )
120
120
  }
121
121
  ),
122
- /* @__PURE__ */ e(R.Group, { value: C, onChange: y, children: l.map((s) => {
122
+ /* @__PURE__ */ e(R.Group, { value: C, onChange: v, children: l.map((s) => {
123
123
  const r = s.nickname || s.name, f = j(r);
124
124
  return /* @__PURE__ */ e(
125
125
  "li",
@@ -185,7 +185,7 @@ const D = (t) => {
185
185
  )
186
186
  }
187
187
  ) }),
188
- /* @__PURE__ */ e("span", { children: l("member.all") })
188
+ /* @__PURE__ */ e("span", { children: t.title || l("member.all") })
189
189
  ]
190
190
  }
191
191
  );
@@ -214,27 +214,28 @@ const D = (t) => {
214
214
  children: n.children
215
215
  });
216
216
  else {
217
- const y = n.children ? m(n.children, u) : [];
217
+ const v = n.children ? m(n.children, u) : [];
218
218
  C.push({
219
219
  ...n,
220
- children: y.length > 0 ? y : void 0
220
+ children: v.length > 0 ? v : void 0
221
221
  });
222
222
  }
223
223
  else {
224
- const y = n.children ? m(n.children, u) : [];
225
- y.length > 0 && C.push({
224
+ const v = n.children ? m(n.children, u) : [];
225
+ v.length > 0 && C.push({
226
226
  ...n,
227
- children: y
227
+ children: v
228
228
  });
229
229
  }
230
230
  return C;
231
- }, h = m(t.data, i), v = h?.map((c) => c.departmentId);
231
+ }, h = m(t.data, i), y = h?.map((c) => c.departmentId);
232
232
  return /* @__PURE__ */ x("div", { className: K["bsy-external-member__container"], children: [
233
233
  /* @__PURE__ */ e(Y, { tabs: p, value: i, onChange: o }),
234
234
  /* @__PURE__ */ x(w, { style: { height: b - 34, padding: "4px" }, children: [
235
235
  /* @__PURE__ */ e(
236
236
  J,
237
237
  {
238
+ title: i === "dockcorp" ? d("member.allContact") : void 0,
238
239
  selected: t.selectLevel === t.unique_all,
239
240
  onSelect: () => t.onSelect(t.unique_all)
240
241
  }
@@ -251,7 +252,7 @@ const D = (t) => {
251
252
  selectedKeys: t.selectLevel ? [t.selectLevel] : [],
252
253
  onSelect: (c) => t.onSelect(c),
253
254
  parentCheckable: !0,
254
- defaultExpandedKeys: v.length === 1 ? v : [],
255
+ defaultExpandedKeys: y.length === 1 ? y : [],
255
256
  icon: () => /* @__PURE__ */ e(M, { name: "dept-one", className: K["bsy-external-member__icon"] }),
256
257
  switcherIcon: (c) => /* @__PURE__ */ e(
257
258
  M,
@@ -324,7 +325,7 @@ const D = (t) => {
324
325
  }
325
326
  }
326
327
  }
327
- ), v = B(() => {
328
+ ), y = B(() => {
328
329
  if (m) {
329
330
  if (i === "internal")
330
331
  return H(m.departments);
@@ -347,7 +348,7 @@ const D = (t) => {
347
348
  {
348
349
  refreshDeps: [i, c]
349
350
  }
350
- ), y = C ? C.users : [], a = C ? C.dock_user_list : [], s = (i === "external" ? a : y) || [];
351
+ ), v = C ? C.users : [], a = C ? C.dock_user_list : [], s = (i === "external" ? a : v) || [];
351
352
  return /* @__PURE__ */ x("div", { className: "member-entity flex line-height-normal h-full", children: [
352
353
  /* @__PURE__ */ e("aside", { className: "basis-[192px] p-1", children: /* @__PURE__ */ e("ul", { className: "flex flex-col", children: b.filter((r) => r.visible).map((r) => /* @__PURE__ */ e(
353
354
  "li",
@@ -370,7 +371,7 @@ const D = (t) => {
370
371
  unique_all: F,
371
372
  selectLevel: c,
372
373
  onSelect: u,
373
- data: v
374
+ data: y
374
375
  }
375
376
  ),
376
377
  i === "external" && /* @__PURE__ */ e(
@@ -379,7 +380,7 @@ const D = (t) => {
379
380
  unique_all: F,
380
381
  selectLevel: c,
381
382
  onSelect: u,
382
- data: v
383
+ data: y
383
384
  }
384
385
  )
385
386
  ] }) }),
@@ -423,7 +424,7 @@ const D = (t) => {
423
424
  const h = P({
424
425
  internal: [],
425
426
  external: []
426
- }), { loading: v } = L(
427
+ }), { loading: y } = L(
427
428
  () => Q({
428
429
  roleLimit: null
429
430
  }),
@@ -451,7 +452,7 @@ const D = (t) => {
451
452
  {
452
453
  refreshDeps: [o]
453
454
  }
454
- ), C = c?.users || [], n = c?.dock_user_list || [], y = p === "external" ? n : C;
455
+ ), C = c?.users || [], n = c?.dock_user_list || [], v = p === "external" ? n : C;
455
456
  return /* @__PURE__ */ x("div", { className: "member-entity flex line-height-normal h-full", children: [
456
457
  /* @__PURE__ */ e("aside", { className: "basis-[192px] p-1", children: /* @__PURE__ */ e("ul", { className: "flex flex-col", children: b.filter((a) => a.visible).map((a) => /* @__PURE__ */ e(
457
458
  "li",
@@ -465,7 +466,7 @@ const D = (t) => {
465
466
  },
466
467
  a.key
467
468
  )) }) }),
468
- /* @__PURE__ */ e("section", { className: "flex-1 border-l border-[#E0E0E0] overflow-hidden", children: /* @__PURE__ */ e(E, { spinning: v, tip: l("common.loading"), children: /* @__PURE__ */ e(w, { style: { height: t - 8, padding: "4px" }, children: /* @__PURE__ */ e(
469
+ /* @__PURE__ */ e("section", { className: "flex-1 border-l border-[#E0E0E0] overflow-hidden", children: /* @__PURE__ */ e(E, { spinning: y, tip: l("common.loading"), children: /* @__PURE__ */ e(w, { style: { height: t - 8, padding: "4px" }, children: /* @__PURE__ */ e(
469
470
  U,
470
471
  {
471
472
  showSwitcher: !1,
@@ -494,14 +495,14 @@ const D = (t) => {
494
495
  }
495
496
  ) }) }) }),
496
497
  /* @__PURE__ */ x("section", { className: "flex-1 border-l border-[#E0E0E0] relative", children: [
497
- /* @__PURE__ */ e(E, { spinning: u, tip: l("common.loading"), children: /* @__PURE__ */ e(w, { style: { height: t - 8, padding: "4px" }, children: y.length > 0 && /* @__PURE__ */ e(
498
+ /* @__PURE__ */ e(E, { spinning: u, tip: l("common.loading"), children: /* @__PURE__ */ e(w, { style: { height: t - 8, padding: "4px" }, children: v.length > 0 && /* @__PURE__ */ e(
498
499
  D,
499
500
  {
500
- list: y,
501
+ list: v,
501
502
  badge: (a) => /* @__PURE__ */ e("span", { className: "truncate flex-1 text-[#4d609f] text-sm", title: a.deptnames, children: a.deptnames })
502
503
  }
503
504
  ) }) }),
504
- y.length === 0 && !u && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: l("member.noAvailable") }) })
505
+ v.length === 0 && !u && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: l("member.noAvailable") }) })
505
506
  ] })
506
507
  ] });
507
508
  }, de = () => {
@@ -526,7 +527,7 @@ const D = (t) => {
526
527
  {
527
528
  refreshDeps: [b]
528
529
  }
529
- ), v = m?.list || [];
530
+ ), y = m?.list || [];
530
531
  return /* @__PURE__ */ x("div", { className: "h-full flex line-height-normal", children: [
531
532
  /* @__PURE__ */ e("div", { className: "basis-[200px]", children: /* @__PURE__ */ e(E, { spinning: i, tip: l("common.loading"), children: /* @__PURE__ */ e(w, { style: { height: t - 8 }, children: /* @__PURE__ */ e("ul", { className: "flex flex-col p-1 text-[#121211]", children: o.map((c, u) => /* @__PURE__ */ e(
532
533
  "li",
@@ -543,14 +544,14 @@ const D = (t) => {
543
544
  u
544
545
  )) }) }) }) }),
545
546
  /* @__PURE__ */ x("div", { className: "flex-1 p-1 border-l border-[#E0E0E0] relative", children: [
546
- /* @__PURE__ */ e(E, { spinning: h, tip: l("common.loading"), children: /* @__PURE__ */ e(w, { style: { height: t - 8 }, children: v.length > 0 && /* @__PURE__ */ e(
547
+ /* @__PURE__ */ e(E, { spinning: h, tip: l("common.loading"), children: /* @__PURE__ */ e(w, { style: { height: t - 8 }, children: y.length > 0 && /* @__PURE__ */ e(
547
548
  D,
548
549
  {
549
- list: v,
550
+ list: y,
550
551
  badge: (c) => /* @__PURE__ */ e("div", { className: "truncate flex-1 text-[#4d609f] text-sm", children: /* @__PURE__ */ e("span", { title: c.deptnames, children: c.deptnames }) })
551
552
  }
552
553
  ) }) }),
553
- v.length === 0 && !h && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: l("member.noAvailable") }) })
554
+ y.length === 0 && !h && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: l("member.noAvailable") }) })
554
555
  ] })
555
556
  ] });
556
557
  }, me = () => {
@@ -563,16 +564,16 @@ const D = (t) => {
563
564
  refreshDeps: [d],
564
565
  onSuccess: (n) => {
565
566
  if (n && d === "custom") {
566
- const y = n.list.filter((a) => a.type !== "1");
567
- o(y[0]?._id);
567
+ const v = n.list.filter((a) => a.type !== "1");
568
+ o(v[0]?._id);
568
569
  }
569
570
  if (n && d === "default") {
570
- const y = n.list.filter((a) => a.type === "1");
571
- o(y[0]._id);
571
+ const v = n.list.filter((a) => a.type === "1");
572
+ o(v[0]._id);
572
573
  }
573
574
  }
574
575
  }
575
- ), { data: v, loading: c } = L(
576
+ ), { data: y, loading: c } = L(
576
577
  () => i ? se({
577
578
  group_id: i,
578
579
  limit: 100
@@ -583,7 +584,7 @@ const D = (t) => {
583
584
  );
584
585
  let u = [];
585
586
  d === "custom" && (u = m?.list?.filter((n) => n.type !== "1") || []);
586
- const C = v?.list || [];
587
+ const C = y?.list || [];
587
588
  return /* @__PURE__ */ x("div", { className: "external-contact-entity flex line-height-normal h-full", children: [
588
589
  /* @__PURE__ */ e("aside", { className: "basis-[192px] p-1", children: /* @__PURE__ */ e("ul", { className: "flex flex-col", children: b.filter((n) => n.visible).map((n) => /* @__PURE__ */ e(
589
590
  "li",
@@ -1,77 +1,79 @@
1
- const i = ["#f5c547", "#528cff", "#50b0f4", "#61db8c", "#ff8383", "#444"], u = (t) => {
2
- const n = t.charCodeAt(0) % i.length;
3
- return i[n];
4
- }, h = (t, n) => {
1
+ import { i as u } from "../../vendors/lodash-es.js";
2
+ const a = ["#f5c547", "#528cff", "#50b0f4", "#61db8c", "#ff8383", "#444"], p = (n) => {
3
+ u(n) || (n = "?");
4
+ const r = n.charCodeAt(0) % a.length;
5
+ return a[r];
6
+ }, f = (n, r) => {
5
7
  const {
6
8
  value: o,
7
9
  children: e,
8
- parentId: a
10
+ parentId: i
9
11
  } = {
10
12
  value: "value",
11
13
  children: "children",
12
14
  parentId: "parentId",
13
- ...n
15
+ ...r
14
16
  };
15
- if (!Array.isArray(t))
17
+ if (!Array.isArray(n))
16
18
  return console.error("输入的数据不是一个数组。"), [];
17
19
  const c = /* @__PURE__ */ new Map();
18
- t.forEach((r) => {
19
- const d = r[o], s = {
20
- ...r,
20
+ n.forEach((t) => {
21
+ const d = t[o], s = {
22
+ ...t,
21
23
  [e]: []
22
24
  // 初始化 children 数组
23
25
  };
24
26
  c.set(d, s);
25
27
  });
26
28
  const l = [];
27
- return c.forEach((r) => {
28
- const d = r[a], s = c.get(d);
29
- s ? s[e].push(r) : l.push(r);
29
+ return c.forEach((t) => {
30
+ const d = t[i], s = c.get(d);
31
+ s ? s[e].push(t) : l.push(t);
30
32
  }), l;
31
- }, p = (t, n, o) => {
32
- const { value: e, children: a } = {
33
+ }, I = (n, r, o) => {
34
+ const { value: e, children: i } = {
33
35
  value: "value",
34
36
  children: "children",
35
37
  ...o
36
38
  };
37
- if (!Array.isArray(n))
39
+ if (!Array.isArray(r))
38
40
  return null;
39
- const c = [...n];
41
+ const c = [...r];
40
42
  for (; c.length > 0; ) {
41
43
  const l = c.pop();
42
44
  if (!l)
43
45
  continue;
44
- if (l[e] === t)
46
+ if (l[e] === n)
45
47
  return l;
46
- const r = l[a];
47
- if (r && r.length > 0)
48
- for (let d = r.length - 1; d >= 0; d--)
49
- c.push(r[d]);
48
+ const t = l[i];
49
+ if (t && t.length > 0)
50
+ for (let d = t.length - 1; d >= 0; d--)
51
+ c.push(t[d]);
50
52
  }
51
53
  return null;
52
54
  };
53
- function f(t) {
54
- const n = {}, o = [];
55
- return t.forEach((e) => {
56
- n[e.departmentId] = {
55
+ function v(n) {
56
+ const r = {}, o = [];
57
+ return n.forEach((e) => {
58
+ r[e.departmentId] = {
57
59
  ...e,
58
60
  title: e.name,
59
61
  key: e.departmentId,
60
62
  children: []
61
63
  };
62
- }), t.forEach((e) => {
64
+ }), n.forEach((e) => {
63
65
  if (e.parentId === 0)
64
- o.push(n[e.departmentId]);
66
+ o.push(r[e.departmentId]);
65
67
  else {
66
- const a = n[e.parentId];
67
- a && a.children.push(n[e.departmentId]);
68
+ const i = r[e.parentId];
69
+ i && i.children.push(r[e.departmentId]);
68
70
  }
69
71
  }), o;
70
72
  }
71
73
  export {
72
- i as ENTITY_COLORS,
73
- f as buildDeptTree,
74
- h as buildTree,
75
- p as findNodeInTree,
76
- u as getColorByName
74
+ a as ENTITY_COLORS,
75
+ v as buildDeptTree,
76
+ f as buildTree,
77
+ I as findNodeInTree,
78
+ p as getColorByName
77
79
  };
@@ -1,13 +1,18 @@
1
- import { Entity } from './utils/constants';
2
- export type EntitySelectorProps = {
1
+ type SelectorType = 'user' | 'usergroup' | 'dept' | 'deptgroup';
2
+ type EntitySelectorProps = {
3
3
  /**
4
4
  * 业务类型:部门单选 / 部门多选 / 成员 / 成员多选
5
+ * @default 'user'
5
6
  */
6
- type: Entity;
7
+ type?: SelectorType;
7
8
  /**
8
9
  * 选择器值
9
10
  */
10
11
  value?: any[];
12
+ /**
13
+ * 默认值
14
+ */
15
+ defaultValue?: any[];
11
16
  /**
12
17
  * 选择器值改变时的回调
13
18
  */
@@ -21,3 +26,4 @@ export type EntitySelectorProps = {
21
26
  */
22
27
  onConfirm?: (value: any[]) => void;
23
28
  };
29
+ export type { SelectorType, EntitySelectorProps };
@@ -1,5 +1,5 @@
1
1
  export declare const useDeptsMemberSelector: () => {
2
- type: import('..').Entity;
2
+ type: import('..').SelectorType;
3
3
  value?: any[];
4
4
  setValue: (v: import('react').SetStateAction<any[]>, ...args: any[]) => void;
5
5
  dispatch: (action: import('../context/DeptsMemberContext').Action) => void;
@@ -1,4 +1,4 @@
1
1
  import { default as DeptsMemberSelector } from './DeptsMember';
2
2
  export default DeptsMemberSelector;
3
- export type { EntitySelectorProps } from './DeptsMember.type';
3
+ export type * from './DeptsMember.type';
4
4
  export { Entity } from './utils/constants';
@@ -1,5 +1,6 @@
1
1
  declare const AllMemeberCheck: React.FC<{
2
2
  selected: boolean;
3
3
  onSelect: (selected: boolean) => void;
4
+ title?: string;
4
5
  }>;
5
6
  export default AllMemeberCheck;
@@ -1,21 +1,21 @@
1
- declare const enum Entity {
1
+ declare const Entity: {
2
2
  /**
3
3
  * @description 表示单个成员
4
4
  */
5
- USER = 0,
5
+ USER: string;
6
6
  /**
7
7
  * @description 表示多个成员组
8
8
  */
9
- USER_GROUP = 1,
9
+ USER_GROUP: string;
10
10
  /**
11
11
  * @description 表示单个部门
12
12
  */
13
- DEPARMENT = 2,
13
+ DEPARMENT: string;
14
14
  /**
15
15
  * @description 表示多个部门组
16
16
  */
17
- DEPARMENT_GROUP = 3
18
- }
17
+ DEPARMENT_GROUP: string;
18
+ };
19
19
  declare const ELLIPSIS_BUTTON_WIDTH = 110;
20
20
  declare const TWO_LINE_HEIGHT = 68;
21
21
  declare const MIN_LINE_HEIGHT = 30;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as r } from "./DeptsMember/DeptsMember-C54jKU8C.js";
1
+ import { D as r } from "./DeptsMember/DeptsMember-C4fZKTp3.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 {