@baishuyun/ui-business 5.1.6 → 5.2.0

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.
Files changed (28) hide show
  1. package/dist/DeptsMemberSelector/{Department-12ftZfXD.js → Department-H6zGUr4c.js} +5 -5
  2. package/dist/DeptsMemberSelector/{DeptsMemberSelector-BXWGwgUq.js → DeptsMemberSelector-DD3yoWYQ.js} +236 -236
  3. package/dist/DeptsMemberSelector/DeptsUser-41XeJOIY.js +981 -0
  4. package/dist/DeptsMemberSelector/Member-Bit-zWOE.js +517 -0
  5. package/dist/DeptsMemberSelector/MemberPanel-BhuVgJdO.js +510 -0
  6. package/dist/DeptsMemberSelector/OrganizationPanel-CT3v_KVr.js +374 -0
  7. package/dist/DeptsMemberSelector/{TabGroup-Ds7bTbKL.js → TabGroup-Dht9ylk4.js} +13 -13
  8. package/dist/DeptsMemberSelector/index.js +7 -7
  9. package/dist/DeptsMemberSelector/subcomponents/Entity/Department/index.js +3 -3
  10. package/dist/DeptsMemberSelector/subcomponents/Entity/DeptsUser/index.js +4 -4
  11. package/dist/DeptsMemberSelector/subcomponents/Entity/Member/index.js +3 -3
  12. package/dist/DeptsMemberSelector/utils/index.js +11 -2
  13. package/dist/components/ConfigProvider/ConfigProvider.type.d.ts +1 -1
  14. package/dist/components/DeptsMemberSelector/subcomponents/Panels/DeptUsersExtraContactPanel/DeptUsersExtraContactPanel.d.ts +2 -0
  15. package/dist/components/DeptsMemberSelector/subcomponents/Panels/DeptUsersExtraContactPanel/useDeptUsersExtraContactPanelData.d.ts +40 -0
  16. package/dist/components/DeptsMemberSelector/subcomponents/Panels/DeptUsersRolePanel/useDeptUsersRolePanelData.d.ts +1 -1
  17. package/dist/components/DeptsMemberSelector/utils/departmentStatus.d.ts +3 -0
  18. package/dist/index.css +1 -1
  19. package/dist/index.js +7 -7
  20. package/dist/lang/en-US.json.d.ts +2 -0
  21. package/dist/lang/zh-CN.json.d.ts +2 -0
  22. package/dist/lang/zh-TW.json.d.ts +71 -0
  23. package/dist/vendors/useLocale.js +75 -7
  24. package/package.json +3 -3
  25. package/dist/DeptsMemberSelector/DeptsUser-C8hYQ6z-.js +0 -790
  26. package/dist/DeptsMemberSelector/ExtraConcactPanel-BDNrz5rV.js +0 -647
  27. package/dist/DeptsMemberSelector/Member-B4tEHksu.js +0 -375
  28. package/dist/DeptsMemberSelector/OrganizationPanel-DoM4UNxv.js +0 -374
@@ -1,374 +0,0 @@
1
- import { t as e } from "../vendors/simplebar-react.js";
2
- import { t } from "../vendors/clsx.js";
3
- import { r as n, t as r } from "../vendors/lodash-es.js";
4
- import { i, t as a } from "./useDeptsMemberSelector-t7b8yu-A.js";
5
- import { n as o, p as s } from "./services/contact/selector.service-CY5vQea8.js";
6
- import { n as c, r as l, t as u } from "./TabGroup-Ds7bTbKL.js";
7
- import { t as d } from "../vendors/useLocale.js";
8
- import { buildDeptTree as f, buildTree as p, findNodeInTree as m } from "./utils/index.js";
9
- import { useCallback as h, useEffect as g, useMemo as _, useState as v } from "react";
10
- import { Spin as y } from "antd";
11
- import { Icon as b, Tree as x } from "@baishuyun/ui-base";
12
- import { useRequest as S } from "ahooks";
13
- import { jsx as C, jsxs as w } from "react/jsx-runtime";
14
- //#region src/components/DeptsMemberSelector/subcomponents/Panels/OrganizationPanel/utils/departmentExpandState.ts
15
- var T = {
16
- INTERNAL: "internal",
17
- EXTERNAL_DOCK_CORP: "external:dockcorp",
18
- EXTERNAL_DOCK_DEPARTMENT: "external:dockcorpdept"
19
- }, E = {
20
- DOCK_PERSON_GROUP: "dockcorp",
21
- DOCK_DEPARTMENT: "dockcorpdept"
22
- }, D = {
23
- [T.EXTERNAL_DOCK_CORP]: E.DOCK_PERSON_GROUP,
24
- [T.EXTERNAL_DOCK_DEPARTMENT]: E.DOCK_DEPARTMENT
25
- }, O = {
26
- dockcorp: T.EXTERNAL_DOCK_CORP,
27
- dockdept: T.EXTERNAL_DOCK_DEPARTMENT,
28
- dockcorpdept: T.EXTERNAL_DOCK_DEPARTMENT
29
- }, k = (e) => e ? D[e] : void 0, A = (e, t, n = []) => {
30
- for (let r of e) {
31
- let e = [...n, r._id];
32
- if (r._id === t) return e;
33
- if (r.children?.length) {
34
- let n = A(r.children, t, e);
35
- if (n) return n;
36
- }
37
- }
38
- return null;
39
- }, j = (e) => [O[e.type] ?? T.INTERNAL], M = (e) => r(e.flatMap((e) => e?._id ? j(e) : [])), N = (e) => {
40
- let t = M(e);
41
- return t.length === 1 ? t[0] : void 0;
42
- }, P = ({ selectedDepartments: e, treesByView: t }) => {
43
- let n = {}, i = /* @__PURE__ */ new Set(), a = M(e);
44
- Object.keys(t).forEach((e) => {
45
- n[e] = [];
46
- }), e.forEach((e) => {
47
- if (!e?._id) return;
48
- let a = j(e);
49
- for (let o of a) {
50
- let a = t[o];
51
- if (!a?.length) continue;
52
- let s = A(a, e._id);
53
- if (s) {
54
- i.add(o), n[o] = r([...n[o], ...s.slice(0, -1)]);
55
- break;
56
- }
57
- }
58
- });
59
- let o = [...i];
60
- return {
61
- preferredViewKey: a.length > 1 ? void 0 : o.length === 1 ? o[0] : void 0,
62
- matchedViewKeys: o,
63
- expandedKeysByView: n
64
- };
65
- }, F = ({ internalTreeData: e, externalDockCorpTreeData: t, externalDockDeptTreeData: n, selectedDepartments: r }) => _(() => {
66
- let i = N(r), a = P({
67
- selectedDepartments: r,
68
- treesByView: {
69
- [T.INTERNAL]: e,
70
- [T.EXTERNAL_DOCK_CORP]: t,
71
- [T.EXTERNAL_DOCK_DEPARTMENT]: n
72
- }
73
- });
74
- return {
75
- ...a,
76
- preferredViewKeyFromSelection: i,
77
- preferredExternalTab: k(a.preferredViewKey || i)
78
- };
79
- }, [
80
- t,
81
- n,
82
- e,
83
- r
84
- ]), I = (e, t) => {
85
- let n = [];
86
- for (let r of e) {
87
- if (r.type === t) {
88
- n.push({
89
- ...r,
90
- children: t === "dockcorpdept" ? r.children : r.children?.length ? I(r.children, t) : void 0
91
- });
92
- continue;
93
- }
94
- let e = r.children?.length ? I(r.children, t) : [];
95
- e.length > 0 && n.push({
96
- ...r,
97
- children: e
98
- });
99
- }
100
- return n;
101
- }, L = {
102
- INTERNAL: 0,
103
- EXTERNAL: 1
104
- }, R = {
105
- preferredViewKey: void 0,
106
- preferredExternalTab: void 0,
107
- matchedViewKeys: [],
108
- expandedKeysByView: {
109
- [T.INTERNAL]: [],
110
- [T.EXTERNAL_DOCK_CORP]: [],
111
- [T.EXTERNAL_DOCK_DEPARTMENT]: []
112
- }
113
- }, z = () => {
114
- let { type: e, value: t = [], dispatch: r, requestContext: u, limits: g, departmentSelectableRange: y, departmentPanelRequestGuard: b } = a(), { t: x } = d(), w = [l.DEPARMENT, l.DEPARMENT_GROUP].includes(e), T = _(() => [{
115
- key: L.INTERNAL,
116
- label: x("department.internal"),
117
- visible: !0
118
- }, {
119
- key: L.EXTERNAL,
120
- label: x("department.external"),
121
- visible: !0
122
- }], [x]), [D, O] = v(L.INTERNAL), k = D === L.EXTERNAL, { data: A, loading: j } = S(() => i(b, () => e === l.DEPT_USERS ? o({
123
- requestContext: u,
124
- hasDeptDock: k
125
- }) : s({
126
- requestContext: u,
127
- limits: g,
128
- departmentSelectableRange: y,
129
- hasDeptDock: k
130
- })), { refreshDeps: [
131
- k,
132
- e,
133
- u,
134
- g,
135
- y,
136
- b
137
- ] }), M = _(() => {
138
- let e = A?.departments || [];
139
- return n(e) ? [] : f(e);
140
- }, [A]), N = _(() => {
141
- let e = A?.label_corp_list || [];
142
- if (n(e)) return [];
143
- let t = e.filter((t) => t.type === "dockcorp" || t.type === "dockdept" ? !0 : t.parentId === 0 ? !1 : e.some((e) => e.parentId === t.departmentId)).map((e) => ({
144
- ...e,
145
- checkable: e.type !== "dockcorpdept" && e.type !== "label",
146
- icon: /* @__PURE__ */ C(c, {
147
- type: e.type,
148
- size: 16
149
- })
150
- }));
151
- return t.length > 0 ? p(t, {
152
- parentId: "parentId",
153
- children: "children",
154
- value: "departmentId",
155
- title: "name"
156
- }) : [];
157
- }, [A]), P = _(() => I(N, E.DOCK_PERSON_GROUP), [N]), z = _(() => I(N, E.DOCK_DEPARTMENT), [N]), B = _(() => ({
158
- internal: M,
159
- external: N
160
- }), [N, M]), V = F({
161
- internalTreeData: M,
162
- externalDockCorpTreeData: P,
163
- externalDockDeptTreeData: z,
164
- selectedDepartments: w ? t : []
165
- }), H = h((t, n) => {
166
- if (l.DEPARMENT === e) {
167
- let e = k ? A?.label_corp_list : A?.departments;
168
- if (!e) return;
169
- let n = e.find((e) => e._id === t);
170
- n && r({
171
- type: "insertOnly",
172
- payload: { ...n }
173
- });
174
- return;
175
- }
176
- r({
177
- type: "addOne",
178
- payload: { ...n }
179
- });
180
- }, [
181
- A,
182
- r,
183
- k,
184
- e
185
- ]), U = h((e) => {
186
- let t = m(e, D === L.INTERNAL ? B.internal : B.external, {
187
- children: "children",
188
- value: "_id"
189
- });
190
- t && r({
191
- type: "deleteOne",
192
- payload: t._id
193
- });
194
- }, [
195
- D,
196
- r,
197
- B
198
- ]);
199
- return {
200
- activeKey: D,
201
- setActiveKey: O,
202
- menuItems: T,
203
- treeData: B,
204
- currentTreeData: k ? B.external : B.internal,
205
- loading: j,
206
- showMenu: (A?.label_corp_count || 0) > 0,
207
- handleSelect: H,
208
- handleDeselect: U,
209
- isBorderless: (A?.label_corp_count || 0) === 0,
210
- menuType: L,
211
- expandState: w ? V : R,
212
- preferredExternalTab: w ? V.preferredExternalTab : void 0
213
- };
214
- }, B = (n) => {
215
- let { type: r, containerHeight: i, value: o } = a(), { t: s } = d(), c = o?.map((e) => e._id) || [], u = _(() => n.data?.map((e) => e._id), [n.data]), [f, p] = v(n.autoExpandKeys ?? u);
216
- return g(() => {
217
- p(n.autoExpandKeys ?? u);
218
- }, [
219
- u,
220
- _(() => (n.autoExpandKeys ?? u).join("|"), [u, n.autoExpandKeys]),
221
- n.autoExpandKeys
222
- ]), /* @__PURE__ */ w(e, {
223
- style: {
224
- height: i - 8,
225
- padding: "4px"
226
- },
227
- className: "internal-container",
228
- classNames: { contentEl: "internal-container-content-el" },
229
- children: [n.data.length > 0 && /* @__PURE__ */ C(x, {
230
- parentCheckable: !0,
231
- checkType: r === l.DEPARMENT ? "radio" : "checkbox",
232
- data: n.data,
233
- fieldNames: {
234
- title: "name",
235
- value: "_id",
236
- children: "children"
237
- },
238
- selectedKeys: c,
239
- onSelect: n.onSelect,
240
- onDeSelect: n.onDeselect,
241
- expandedKeys: f,
242
- onExpand: p,
243
- icon: () => /* @__PURE__ */ C(b, {
244
- name: "dept-one",
245
- className: "internal-container__icon"
246
- }),
247
- switcherIcon: (e) => /* @__PURE__ */ C(b, {
248
- name: "xiangxiazhankai-11",
249
- className: t("internal-container__arrow-icon", { "rotate-90": e })
250
- })
251
- }), n.data.length === 0 && !n.loading && /* @__PURE__ */ C("div", {
252
- className: "internal-container__empty",
253
- children: /* @__PURE__ */ C("span", { children: s("department.noAvailable") })
254
- })]
255
- });
256
- }, V = {
257
- "external-organization": "_external-organization_kf3pt_1",
258
- "external-organization__content": "_external-organization__content_kf3pt_5",
259
- "external-organization__scroll-content": "_external-organization__scroll-content_kf3pt_8",
260
- "external-organization__tree-icon": "_external-organization__tree-icon_kf3pt_12",
261
- "external-organization__switcher-icon": "_external-organization__switcher-icon_kf3pt_15",
262
- "external-organization__switcher-icon--expanded": "_external-organization__switcher-icon--expanded_kf3pt_20",
263
- "external-organization__empty": "_external-organization__empty_kf3pt_23"
264
- }, H = (n) => {
265
- let { type: r, containerHeight: i, value: o } = a(), { t: s } = d(), [c, f] = v(n.preferredTab || E.DOCK_PERSON_GROUP), p = o?.map((e) => e._id) || [], m = [{
266
- label: s("department.externalContactGroup"),
267
- value: E.DOCK_PERSON_GROUP
268
- }, {
269
- label: s("department.externalContactDepartment"),
270
- value: E.DOCK_DEPARTMENT
271
- }];
272
- g(() => {
273
- n.preferredTab && f(n.preferredTab);
274
- }, [n.preferredTab]);
275
- let h = _(() => I(n.data, c), [c, n.data]), y = _(() => h?.map((e) => e._id), [h]), S = n.autoExpandKeysByTab?.[c], [T, D] = v(S ?? y);
276
- return g(() => {
277
- D(S ?? y);
278
- }, [
279
- y,
280
- _(() => (S ?? y).join("|"), [y, S]),
281
- S
282
- ]), /* @__PURE__ */ w("div", {
283
- className: V["external-organization"],
284
- children: [/* @__PURE__ */ C(u, {
285
- tabs: m,
286
- value: c,
287
- onChange: f
288
- }), /* @__PURE__ */ C("div", {
289
- className: V["external-organization__content"],
290
- children: /* @__PURE__ */ w(e, {
291
- style: {
292
- height: i - 42,
293
- padding: "4px"
294
- },
295
- classNames: { contentEl: V["external-organization__scroll-content"] },
296
- children: [h.length > 0 && /* @__PURE__ */ C(x, {
297
- parentCheckable: !0,
298
- checkType: r === l.DEPARMENT ? "radio" : "checkbox",
299
- data: h,
300
- fieldNames: {
301
- title: "name",
302
- value: "_id",
303
- children: "children"
304
- },
305
- selectedKeys: p,
306
- onSelect: n.onSelect,
307
- onDeSelect: n.onDeselect,
308
- expandedKeys: T,
309
- onExpand: D,
310
- icon: () => /* @__PURE__ */ C(b, {
311
- name: "dept-one",
312
- className: V["external-organization__tree-icon"],
313
- size: 16
314
- }),
315
- switcherIcon: (e) => /* @__PURE__ */ C(b, {
316
- name: "xiangxiazhankai-11",
317
- className: t(V["external-organization__switcher-icon"], { [V["external-organization__switcher-icon--expanded"]]: e })
318
- })
319
- }), h.length === 0 && !n.loading && /* @__PURE__ */ C("div", {
320
- className: V["external-organization__empty"],
321
- children: /* @__PURE__ */ C("span", { children: s("department.noAvailable") })
322
- })]
323
- })
324
- })]
325
- });
326
- }, U = {
327
- "organization-panel": "_organization-panel_1dfed_1",
328
- "organization-panel__menu": "_organization-panel__menu_1dfed_6",
329
- "organization-panel__menu-list": "_organization-panel__menu-list_1dfed_10",
330
- "organization-panel__menu-item": "_organization-panel__menu-item_1dfed_14",
331
- "organization-panel__menu-item--active": "_organization-panel__menu-item--active_1dfed_25",
332
- "organization-panel__content": "_organization-panel__content_1dfed_32",
333
- "organization-panel__content--borderless": "_organization-panel__content--borderless_1dfed_37"
334
- }, W = () => {
335
- let e = z();
336
- return /* @__PURE__ */ w("div", {
337
- className: U["organization-panel"],
338
- children: [e.showMenu && /* @__PURE__ */ C("aside", {
339
- className: U["organization-panel__menu"],
340
- children: /* @__PURE__ */ C("ul", {
341
- className: U["organization-panel__menu-list"],
342
- children: e.menuItems.filter((e) => e.visible).map((n) => /* @__PURE__ */ C("li", {
343
- onClick: () => e.setActiveKey(n.key),
344
- className: t(U["organization-panel__menu-item"], { [U["organization-panel__menu-item--active"]]: e.activeKey === n.key }),
345
- children: n.label
346
- }, n.key))
347
- })
348
- }), /* @__PURE__ */ C("section", {
349
- className: t(U["organization-panel__content"], { [U["organization-panel__content--borderless"]]: e.isBorderless }),
350
- children: /* @__PURE__ */ w(y, {
351
- spinning: e.loading,
352
- children: [e.menuType.INTERNAL === e.activeKey && /* @__PURE__ */ C(B, {
353
- onSelect: e.handleSelect,
354
- onDeselect: e.handleDeselect,
355
- loading: e.loading,
356
- data: e.currentTreeData,
357
- autoExpandKeys: e.expandState.matchedViewKeys.includes("internal") ? e.expandState.expandedKeysByView.internal : void 0
358
- }), e.menuType.EXTERNAL === e.activeKey && /* @__PURE__ */ C(H, {
359
- data: e.currentTreeData,
360
- onSelect: e.handleSelect,
361
- onDeselect: e.handleDeselect,
362
- loading: e.loading,
363
- preferredTab: e.preferredExternalTab,
364
- autoExpandKeysByTab: {
365
- dockcorp: e.expandState.matchedViewKeys.includes("external:dockcorp") ? e.expandState.expandedKeysByView["external:dockcorp"] : void 0,
366
- dockcorpdept: e.expandState.matchedViewKeys.includes("external:dockcorpdept") ? e.expandState.expandedKeysByView["external:dockcorpdept"] : void 0
367
- }
368
- })]
369
- })
370
- })]
371
- });
372
- };
373
- //#endregion
374
- export { W as t };