@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.
@@ -0,0 +1,137 @@
1
+ import { createContext as v, useContext as f, useMemo as p, useCallback as E, useRef as h, useState as A, useEffect as D } from "react";
2
+ import { n as d } from "../vendors/lodash-es.js";
3
+ import { C as G } from "../ConfigProvider/configContext-lDqg07Z3.js";
4
+ import { jsx as o, jsxs as N } from "react/jsx-runtime";
5
+ import { Icon as c } from "bsy-react-ui";
6
+ import { c as S } from "../vendors/clsx.js";
7
+ const I = v({
8
+ type: "user",
9
+ setValue: d,
10
+ dispatch: d,
11
+ containerHeight: 0
12
+ }), tt = () => f(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, 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: "互联角色" }, T = { title: "职位" }, P = { title: "当前用户" }, $ = { title: "外部联系人", defaultGroup: "默认分组", customGroup: "自定义分组", group: "外部联系人分组", noAvailableGroup: "没有可选分组" }, H = { searchMember: "搜索成员", searchDepartment: "搜索部门" }, b = {
30
+ common: M,
31
+ department: y,
32
+ member: R,
33
+ role: U,
34
+ position: T,
35
+ currentUser: P,
36
+ externalContact: $,
37
+ tabs: H
38
+ }, L = { loading: "Loading...", cancel: "Cancel", confirm: "Confirm", clearAll: "Clear All", viewAll: "View All {count}", selected: "Selected {selected}/{total}", collapseAll: "Collapse All", noAvailable: "No available members" }, O = { 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" }, w = { 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" }, k = { 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 = {
39
+ common: L,
40
+ department: O,
41
+ member: w,
42
+ role: k,
43
+ position: z,
44
+ currentUser: B,
45
+ externalContact: W,
46
+ tabs: j
47
+ }, X = (n, a, t) => {
48
+ const s = a.split(".");
49
+ let e = n;
50
+ try {
51
+ for (const r of s)
52
+ e = e[r];
53
+ return typeof e == "string" ? t ? e.replace(/\{(\w+)\}/g, (r, i) => t[i] !== void 0 ? String(t[i]) : r) : e : a;
54
+ } catch {
55
+ return a;
56
+ }
57
+ }, ct = () => {
58
+ const n = f(G), a = p(() => ({ "zh-CN": b, "en-US": V }), []), t = p(() => a[n.locale] || b, [n.locale, a]);
59
+ return {
60
+ t: E(
61
+ (e, r) => X(t, e, r),
62
+ [t]
63
+ )
64
+ };
65
+ }, st = ({ type: n }) => {
66
+ switch (n) {
67
+ case "label":
68
+ return /* @__PURE__ */ o(c, { name: "Enterpriselabel", className: "text-[#0265ff] text-lg" });
69
+ case "dockcorp":
70
+ case "dockcorpdept":
71
+ return /* @__PURE__ */ o(c, { name: "company", className: "text-[#0265ff] text-lg" });
72
+ case "dockdept":
73
+ case "member":
74
+ return /* @__PURE__ */ o(c, { name: "dept-one", className: "text-[#0265ff] text-lg" });
75
+ case "group":
76
+ return /* @__PURE__ */ o(c, { name: "Outreach", className: "text-[#70c911] text-lg" });
77
+ default:
78
+ return /* @__PURE__ */ o(c, { name: "dept-one", className: "text-[#0265ff] text-lg" });
79
+ }
80
+ }, q = "_active_1vd3c_15", u = {
81
+ "tabgroup-container": "_tabgroup-container_1vd3c_1",
82
+ "tabgroup-container__tab-item": "_tabgroup-container__tab-item_1vd3c_7",
83
+ active: q,
84
+ "tabgroup-container__indicator": "_tabgroup-container__indicator_1vd3c_18"
85
+ }, it = (n) => {
86
+ const { tabs: a, value: t, onChange: s } = n, e = h(null), [r, i] = A({
87
+ width: 0,
88
+ transform: "translateX(0)"
89
+ }), g = (l) => {
90
+ const m = e.current?.querySelector(`[data-key="${l}"]`);
91
+ if (m) {
92
+ const { width: x, left: C } = m.getBoundingClientRect(), _ = m.parentElement?.parentElement?.getBoundingClientRect().left || 0;
93
+ i({
94
+ width: x,
95
+ transform: `translateX(${C - _}px)`
96
+ });
97
+ }
98
+ };
99
+ return D(() => {
100
+ g(t);
101
+ }, [t]), /* @__PURE__ */ N("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
+ tt as a,
133
+ st as b,
134
+ nt as c,
135
+ it as d,
136
+ ct 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-BSh1OsSC.js";
2
+ import { E as a } from "./TabGroup-LsBzSRvu.js";
3
3
  export {
4
4
  a as Entity,
5
5
  t as default
@@ -1,17 +1,17 @@
1
- import { jsxs as b, jsx as e, Fragment as j } from "react/jsx-runtime";
2
- import { g as z, d as P } from "../../../../vendors/services/data/member.service.js";
1
+ import { jsxs as g, jsx as e, Fragment as K } from "react/jsx-runtime";
2
+ import { g as j, d as P } from "../../../../vendors/services/data/member.service.js";
3
3
  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 { a as N, u as k, E, d as L, b as H } from "../../../TabGroup-LsBzSRvu.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";
11
11
  import { g as J } from "../../../../vendors/services/corp/outsider.service.js";
12
12
  const Q = (t) => {
13
13
  const { type: r, containerHeight: p, value: o } = N(), { t: a } = k(), f = o?.map((d) => d._id) || [], i = t.data?.map((d) => d._id);
14
- return /* @__PURE__ */ b(
14
+ return /* @__PURE__ */ g(
15
15
  S,
16
16
  {
17
17
  style: { height: p - 8, padding: "4px" },
@@ -52,7 +52,7 @@ const Q = (t) => {
52
52
  const { type: r, containerHeight: p, value: o } = N(), { t: a } = k(), [f, i] = D(
53
53
  "dockcorp"
54
54
  /* DOCK_PERSON_GROUP */
55
- ), d = o?.map((n) => n._id) || [], g = [
55
+ ), d = o?.map((n) => n._id) || [], b = [
56
56
  {
57
57
  label: a("department.externalContactGroup"),
58
58
  value: "dockcorp"
@@ -88,9 +88,9 @@ const Q = (t) => {
88
88
  }
89
89
  return m;
90
90
  }, x = s(t.data, f), _ = x?.map((n) => n._id);
91
- return /* @__PURE__ */ b("div", { className: "external-container", children: [
92
- /* @__PURE__ */ e(L, { tabs: g, value: f, onChange: i }),
93
- /* @__PURE__ */ e("div", { className: "external-container__content", children: /* @__PURE__ */ b(S, { style: { height: p - 42, padding: "4px" }, children: [
91
+ return /* @__PURE__ */ g("div", { className: "external-container", children: [
92
+ /* @__PURE__ */ e(L, { tabs: b, value: f, onChange: i }),
93
+ /* @__PURE__ */ e("div", { className: "external-container__content", children: /* @__PURE__ */ g(S, { style: { height: p - 42, padding: "4px" }, children: [
94
94
  x.length > 0 && /* @__PURE__ */ e(
95
95
  w,
96
96
  {
@@ -106,7 +106,7 @@ const Q = (t) => {
106
106
  onSelect: t.onSelect,
107
107
  onDeSelect: t.onDeselect,
108
108
  defaultExpandedKeys: _,
109
- icon: () => /* @__PURE__ */ e(C, { name: "dept-one", className: "text-[#0265ff] text-lg" }),
109
+ icon: () => /* @__PURE__ */ e(C, { name: "dept-one", className: "text-[#0265ff]", size: 16 }),
110
110
  switcherIcon: (n) => /* @__PURE__ */ e(
111
111
  C,
112
112
  {
@@ -132,7 +132,7 @@ const Q = (t) => {
132
132
  0
133
133
  /* INTERNAL */
134
134
  ), { data: i, loading: d } = T(
135
- () => z({
135
+ () => j({
136
136
  departmentLimit: [],
137
137
  hasDeptDock: a === 1
138
138
  /* EXTERNAL */
@@ -140,25 +140,17 @@ const Q = (t) => {
140
140
  {
141
141
  refreshDeps: [a]
142
142
  }
143
- ), g = G(() => {
143
+ ), b = G(() => {
144
144
  const l = i?.departments || [];
145
145
  return l.length > 0 ? B(l) : [];
146
146
  }, [i]), s = G(() => {
147
147
  const l = i?.label_corp_list || [];
148
148
  if (!l.length)
149
149
  return [];
150
- const y = l.filter((h) => h.type === "dockcorp" || h.type === "dockdept" ? !0 : h.parentId === 0 ? !1 : l.some((K) => K.parentId === h.departmentId)), I = y.map((h) => ({
150
+ const y = l.filter((h) => h.type === "dockcorp" || h.type === "dockdept" ? !0 : h.parentId === 0 ? !1 : l.some((z) => z.parentId === h.departmentId)), I = y.map((h) => ({
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",
@@ -167,7 +159,7 @@ const Q = (t) => {
167
159
  title: "name"
168
160
  }) : [];
169
161
  }, [i]), x = {
170
- 0: g,
162
+ 0: b,
171
163
  1: s
172
164
  }, _ = M(
173
165
  (l) => {
@@ -203,7 +195,7 @@ const Q = (t) => {
203
195
  payload: y._id
204
196
  });
205
197
  }, m = E.DEPARMENT === t ? _ : n, c = i?.label_corp_count || 0;
206
- return /* @__PURE__ */ b("div", { className: "flex line-height-normal h-full", children: [
198
+ return /* @__PURE__ */ g("div", { className: "flex line-height-normal h-full", children: [
207
199
  c > 0 && /* @__PURE__ */ e("aside", { className: "basis-[200px] p-1 shrink-0", children: /* @__PURE__ */ e("ul", { className: "flex flex-col", children: o.filter((l) => l.visible).map((l) => /* @__PURE__ */ e(
208
200
  "li",
209
201
  {
@@ -222,7 +214,7 @@ const Q = (t) => {
222
214
  className: v("flex-1 border-[#E0E0E0] overflow-hidden", {
223
215
  "border-l": c > 0
224
216
  }),
225
- children: /* @__PURE__ */ b(A, { spinning: d, children: [
217
+ children: /* @__PURE__ */ g(A, { spinning: d, children: [
226
218
  a === 0 && /* @__PURE__ */ e(
227
219
  Q,
228
220
  {
@@ -246,7 +238,7 @@ const Q = (t) => {
246
238
  )
247
239
  ] });
248
240
  }, F = (t) => {
249
- const { list: r } = t, { value: p, type: o, dispatch: a } = N(), f = o === E.DEPARMENT, i = o === E.DEPARMENT_GROUP, d = p?.[0]?._id, g = (n) => {
241
+ const { list: r } = t, { value: p, type: o, dispatch: a } = N(), f = o === E.DEPARMENT, i = o === E.DEPARMENT_GROUP, d = p?.[0]?._id, b = (n) => {
250
242
  const u = r?.find((m) => m._id === n.target.value);
251
243
  u && a({
252
244
  type: "insertOnly",
@@ -271,8 +263,8 @@ const Q = (t) => {
271
263
  }
272
264
  });
273
265
  };
274
- return /* @__PURE__ */ e("div", { className: "entity-group-list", children: /* @__PURE__ */ b("ul", { className: "font-0", children: [
275
- f && /* @__PURE__ */ e(R.Group, { value: d, onChange: g, className: "w-full", children: r.map((n) => /* @__PURE__ */ e(
266
+ return /* @__PURE__ */ e("div", { className: "entity-group-list", children: /* @__PURE__ */ g("ul", { className: "font-0", children: [
267
+ f && /* @__PURE__ */ e(R.Group, { value: d, onChange: b, className: "w-full", children: r.map((n) => /* @__PURE__ */ e(
276
268
  "li",
277
269
  {
278
270
  className: v("rounded-[4px] cursor-pointer font-0", {
@@ -292,7 +284,7 @@ const Q = (t) => {
292
284
  },
293
285
  n._id
294
286
  )) }),
295
- i && /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(O.Group, { value: x, onChange: _, children: r.map((n) => /* @__PURE__ */ e(
287
+ i && /* @__PURE__ */ e(K, { children: /* @__PURE__ */ e(O.Group, { value: x, onChange: _, children: r.map((n) => /* @__PURE__ */ e(
296
288
  "li",
297
289
  {
298
290
  className: v("rounded-[4px] cursor-pointer font-0 px-[10px]", {
@@ -309,7 +301,7 @@ const Q = (t) => {
309
301
  departmentLimit: []
310
302
  })
311
303
  ), a = p?.departmentList || [];
312
- return /* @__PURE__ */ e("div", { className: "p-1 external-contact-entit relative", children: /* @__PURE__ */ e(A, { spinning: o, tip: r("common.loading"), children: /* @__PURE__ */ b(S, { style: { height: t - 8 }, children: [
304
+ return /* @__PURE__ */ e("div", { className: "p-1 external-contact-entit relative", children: /* @__PURE__ */ e(A, { spinning: o, tip: r("common.loading"), children: /* @__PURE__ */ g(S, { style: { height: t - 8 }, children: [
313
305
  /* @__PURE__ */ e(F, { list: a }),
314
306
  a.length === 0 && !o && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: r("department.noAvailable") }) })
315
307
  ] }) }) });
@@ -317,8 +309,8 @@ const Q = (t) => {
317
309
  const { containerHeight: t } = N(), { t: r } = k(), [p] = D([
318
310
  { key: "default", label: r("externalContact.defaultGroup") },
319
311
  { key: "custom", label: r("externalContact.customGroup") }
320
- ]), [o, a] = D("default"), { data: f, loading: i } = T(() => J()), d = f?.list || [], g = o === "default" ? d.filter((s) => s.type === "1") : d.filter((s) => s.type !== "1");
321
- return /* @__PURE__ */ b("div", { className: "external-contact-entity relative flex", children: [
312
+ ]), [o, a] = D("default"), { data: f, loading: i } = T(() => J()), d = f?.list || [], b = o === "default" ? d.filter((s) => s.type === "1") : d.filter((s) => s.type !== "1");
313
+ return /* @__PURE__ */ g("div", { className: "external-contact-entity relative flex", children: [
322
314
  /* @__PURE__ */ e("aside", { className: "basis-[192px] p-1", children: /* @__PURE__ */ e("ul", { className: "flex flex-col", children: p.map((s) => /* @__PURE__ */ e(
323
315
  "li",
324
316
  {
@@ -333,9 +325,9 @@ const Q = (t) => {
333
325
  },
334
326
  s.key
335
327
  )) }) }),
336
- /* @__PURE__ */ e("div", { className: "flex-1 border-l border-[#E0E0E0]", children: /* @__PURE__ */ e(A, { spinning: i, tip: r("common.loading"), children: /* @__PURE__ */ b(S, { style: { height: t - 8, padding: "4px" }, children: [
337
- g.length > 0 && /* @__PURE__ */ e(F, { list: g, type: "group" }),
338
- g.length === 0 && !i && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: r("externalContact.noAvailableGroup") }) })
328
+ /* @__PURE__ */ e("div", { className: "flex-1 border-l border-[#E0E0E0]", children: /* @__PURE__ */ e(A, { spinning: i, tip: r("common.loading"), children: /* @__PURE__ */ g(S, { style: { height: t - 8, padding: "4px" }, children: [
329
+ b.length > 0 && /* @__PURE__ */ e(F, { list: b, type: "group" }),
330
+ b.length === 0 && !i && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "text-[#999]", children: r("externalContact.noAvailableGroup") }) })
339
331
  ] }) }) })
340
332
  ] });
341
333
  }, oe = () => {