@tddc/assign-modal 3.0.7 → 3.0.8

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,19 +1,92 @@
1
- import _Input from "tntd/es/input";
2
- import _Icon from "tntd/es/icon";
3
- import _Tooltip from "tntd/es/tooltip";
4
- import _Empty from "tntd/es/empty";
5
- import _Ellipsis from "tntd/es/ellipsis";
6
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
7
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
9
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
10
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
11
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
13
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
14
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
16
- import React from "react";
1
+ import _Input from 'tntd/es/input';
2
+ import _Icon from 'tntd/es/icon';
3
+ import _Tooltip from 'tntd/es/tooltip';
4
+ import _Empty from 'tntd/es/empty';
5
+ import _Ellipsis from 'tntd/es/ellipsis';
6
+ function _toConsumableArray(r) {
7
+ return (
8
+ _arrayWithoutHoles(r) ||
9
+ _iterableToArray(r) ||
10
+ _unsupportedIterableToArray(r) ||
11
+ _nonIterableSpread()
12
+ );
13
+ }
14
+ function _nonIterableSpread() {
15
+ throw new TypeError(
16
+ 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
17
+ );
18
+ }
19
+ function _iterableToArray(r) {
20
+ if (('undefined' != typeof Symbol && null != r[Symbol.iterator]) || null != r['@@iterator'])
21
+ return Array.from(r);
22
+ }
23
+ function _arrayWithoutHoles(r) {
24
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
25
+ }
26
+ function _slicedToArray(r, e) {
27
+ return (
28
+ _arrayWithHoles(r) ||
29
+ _iterableToArrayLimit(r, e) ||
30
+ _unsupportedIterableToArray(r, e) ||
31
+ _nonIterableRest()
32
+ );
33
+ }
34
+ function _nonIterableRest() {
35
+ throw new TypeError(
36
+ 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
37
+ );
38
+ }
39
+ function _unsupportedIterableToArray(r, a) {
40
+ if (r) {
41
+ if ('string' == typeof r) return _arrayLikeToArray(r, a);
42
+ var t = {}.toString.call(r).slice(8, -1);
43
+ return (
44
+ 'Object' === t && r.constructor && (t = r.constructor.name),
45
+ 'Map' === t || 'Set' === t
46
+ ? Array.from(r)
47
+ : 'Arguments' === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
48
+ ? _arrayLikeToArray(r, a)
49
+ : void 0
50
+ );
51
+ }
52
+ }
53
+ function _arrayLikeToArray(r, a) {
54
+ (null == a || a > r.length) && (a = r.length);
55
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
56
+ return n;
57
+ }
58
+ function _iterableToArrayLimit(r, l) {
59
+ var t =
60
+ null == r ? null : ('undefined' != typeof Symbol && r[Symbol.iterator]) || r['@@iterator'];
61
+ if (null != t) {
62
+ var e,
63
+ n,
64
+ i,
65
+ u,
66
+ a = [],
67
+ f = !0,
68
+ o = !1;
69
+ try {
70
+ if (((i = (t = t.call(r)).next), 0 === l)) {
71
+ if (Object(t) !== t) return;
72
+ f = !1;
73
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
74
+ } catch (r) {
75
+ (o = !0), (n = r);
76
+ } finally {
77
+ try {
78
+ if (!f && null != t.return && ((u = t.return()), Object(u) !== u)) return;
79
+ } finally {
80
+ if (o) throw n;
81
+ }
82
+ }
83
+ return a;
84
+ }
85
+ }
86
+ function _arrayWithHoles(r) {
87
+ if (Array.isArray(r)) return r;
88
+ }
89
+ import React from 'react';
17
90
  import { useEffect, useState, useCallback, useRef, useMemo } from 'react';
18
91
  import { debounce } from 'lodash';
19
92
  import './index.less';
@@ -45,20 +118,30 @@ var AssignModal = function AssignModal(props) {
45
118
  var appMapRef = useRef({});
46
119
  var userMapRef = useRef({});
47
120
  var rootNode = orgList[0];
48
- var _useMemo = useMemo(function () {
49
- var org = preorder(rootNode, function (key, obj) {
50
- orgMapRef.current[key] = obj;
51
- }, true);
52
- var app = appList.map(function (item) {
53
- appMapRef.current[item.value] = item;
54
- return item.value;
55
- });
56
- var user = (userList === null || userList === void 0 ? void 0 : userList.map(function (item) {
57
- userMapRef.current[item.account] = item;
58
- return item.account;
59
- })) || [];
60
- return [org, app, user];
61
- }, [rootNode, appList, userList]),
121
+ var _useMemo = useMemo(
122
+ function () {
123
+ var org = preorder(
124
+ rootNode,
125
+ function (key, obj) {
126
+ orgMapRef.current[key] = obj;
127
+ },
128
+ true,
129
+ );
130
+ var app = appList.map(function (item) {
131
+ appMapRef.current[item.value] = item;
132
+ return item.value;
133
+ });
134
+ var user =
135
+ (userList === null || userList === void 0
136
+ ? void 0
137
+ : userList.map(function (item) {
138
+ userMapRef.current[item.account] = item;
139
+ return item.account;
140
+ })) || [];
141
+ return [org, app, user];
142
+ },
143
+ [rootNode, appList, userList],
144
+ ),
62
145
  _useMemo2 = _slicedToArray(_useMemo, 3),
63
146
  allOrg = _useMemo2[0],
64
147
  allApp = _useMemo2[1],
@@ -80,238 +163,484 @@ var AssignModal = function AssignModal(props) {
80
163
  filterOrg = _useState8[0],
81
164
  setFilterOrg = _useState8[1];
82
165
  var _useState9 = useState(),
83
- _useState10 = _slicedToArray(_useState9, 2),
84
- filterUser = _useState10[0],
85
- setFilterUser = _useState10[1];
86
- var _useState11 = useState(),
87
- _useState12 = _slicedToArray(_useState11, 2),
88
- filterApp = _useState12[0],
89
- setFilterApp = _useState12[1];
90
- useEffect(function () {
91
- // path 和 allOrgList 赋值
92
- path = findSameCodePath(rootNode, orgCode);
93
- var initOrgs = [];
94
- var initApps = [];
95
- var initAccounts = [];
96
- if (orgCodes.includes('all')) {
97
- initOrgs = allOrg;
98
- } else {
99
- initOrgs = Array.from(new Set([].concat(_toConsumableArray(orgCodes || []), _toConsumableArray(path))));
100
- }
101
- if (appCodes.includes('all')) {
102
- initApps = allApp;
103
- } else {
104
- initApps = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
105
- }
106
- if (showUser) {
107
- if (accounts.includes('all')) {
108
- initAccounts = allUser;
166
+ _useState0 = _slicedToArray(_useState9, 2),
167
+ filterUser = _useState0[0],
168
+ setFilterUser = _useState0[1];
169
+ var _useState1 = useState(),
170
+ _useState10 = _slicedToArray(_useState1, 2),
171
+ filterApp = _useState10[0],
172
+ setFilterApp = _useState10[1];
173
+ useEffect(
174
+ function () {
175
+ // path allOrgList 赋值
176
+ path = findSameCodePath(rootNode, orgCode);
177
+ var initOrgs = [];
178
+ var initApps = [];
179
+ var initAccounts = [];
180
+ if (orgCodes.includes('all')) {
181
+ initOrgs = allOrg;
109
182
  } else {
110
- initAccounts = Array.from(new Set([].concat(_toConsumableArray(accounts || []), [account])));
183
+ initOrgs = Array.from(
184
+ new Set([].concat(_toConsumableArray(orgCodes || []), _toConsumableArray(path))),
185
+ );
111
186
  }
112
- }
113
- setCheckedKeys(initOrgs);
114
- setAppKeys(initApps || []);
115
- setUserKeys(initAccounts || []);
116
- }, [dataItem]);
117
- var debouncedOrgSearch = useCallback(debounce(function (nextValue) {
118
- setFilterOrg(nextValue);
119
- }, 200), []);
120
- var debouncedUserSearch = useCallback(debounce(function (nextValue) {
121
- setFilterUser(nextValue);
122
- }, 200), []);
123
- var debouncedAppSearch = useCallback(debounce(function (nextValue) {
124
- setFilterApp(nextValue);
125
- }, 200), []);
187
+ if (appCodes.includes('all')) {
188
+ initApps = allApp;
189
+ } else {
190
+ initApps = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
191
+ }
192
+ if (showUser) {
193
+ if (accounts.includes('all')) {
194
+ initAccounts = allUser;
195
+ } else {
196
+ initAccounts = Array.from(
197
+ new Set([].concat(_toConsumableArray(accounts || []), [account])),
198
+ );
199
+ }
200
+ }
201
+ setCheckedKeys(initOrgs);
202
+ setAppKeys(initApps || []);
203
+ setUserKeys(initAccounts || []);
204
+ },
205
+ [dataItem],
206
+ );
207
+ var debouncedOrgSearch = useCallback(
208
+ debounce(function (nextValue) {
209
+ setFilterOrg(nextValue);
210
+ }, 200),
211
+ [],
212
+ );
213
+ var debouncedUserSearch = useCallback(
214
+ debounce(function (nextValue) {
215
+ setFilterUser(nextValue);
216
+ }, 200),
217
+ [],
218
+ );
219
+ var debouncedAppSearch = useCallback(
220
+ debounce(function (nextValue) {
221
+ setFilterApp(nextValue);
222
+ }, 200),
223
+ [],
224
+ );
126
225
  // 获取机构路径的中文显示名并拼接
127
226
  var getOrgPathDisplayName = function getOrgPathDisplayName() {
128
227
  var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
129
228
  var displayName = '';
130
229
  if (path.length > 0) {
131
- displayName = path.map(function (item) {
132
- return orgMapRef.current[item].name;
133
- }).join(' / ');
230
+ displayName = path
231
+ .map(function (item) {
232
+ return orgMapRef.current[item].name;
233
+ })
234
+ .join(' / ');
134
235
  }
135
236
  return displayName;
136
237
  };
137
238
 
138
239
  // 渲染Org列表
139
- var orgListDomRender = useMemo(function () {
140
- var renderOrgItem = function renderOrgItem(item, lang) {
141
- console.log(item, 'item');
142
- var mapResult = {
143
- 1: {
144
- cn: '职能部门',
145
- en: 'Func. Dept.',
146
- icon: 'crowd'
147
- },
148
- 2: {
149
- icon: 'corporation'
150
- }
240
+ var orgListDomRender = useMemo(
241
+ function () {
242
+ var renderOrgItem = function renderOrgItem(item, lang) {
243
+ console.log(item, 'item');
244
+ var mapResult = {
245
+ 1: {
246
+ cn: '职能部门',
247
+ en: 'Func. Dept.',
248
+ icon: 'crowd',
249
+ },
250
+ 2: {
251
+ icon: 'corporation',
252
+ },
253
+ };
254
+ var result = mapResult[item === null || item === void 0 ? void 0 : item.orgAttribute] || {};
255
+ return /*#__PURE__*/ React.createElement(
256
+ 'div',
257
+ {
258
+ className: 'org-item-wrapper',
259
+ style: {
260
+ width: '100%',
261
+ },
262
+ },
263
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
264
+ title: item.name,
265
+ widthLimit: String(item.orgAttribute) === '1' ? 'calc(100% - 90px}' : '100%',
266
+ }),
267
+ String(item.orgAttribute) === '1' &&
268
+ /*#__PURE__*/ React.createElement(
269
+ 'span',
270
+ {
271
+ className: 'org-functional-departemt-marker',
272
+ },
273
+ result[lang] || '职能部门',
274
+ ),
275
+ );
151
276
  };
152
- var result = mapResult[item === null || item === void 0 ? void 0 : item.orgAttribute] || {};
153
- return /*#__PURE__*/React.createElement("div", {
154
- className: "org-item-wrapper",
155
- style: {
156
- width: '100%'
157
- }
158
- }, /*#__PURE__*/React.createElement(_Ellipsis, {
159
- title: item.name,
160
- widthLimit: String(item.orgAttribute) === '1' ? 'calc(100% - 90px}' : '100%'
161
- }), String(item.orgAttribute) === '1' && /*#__PURE__*/React.createElement("span", {
162
- className: "org-functional-departemt-marker"
163
- }, result[lang] || '职能部门'));
164
- };
165
- return checkedKeys.filter(function (i) {
166
- var node = orgMapRef.current[i] || {};
167
- var path = node.path,
168
- name = node.name;
169
- if (!path && !name) return false;
170
- var pathDisplayName = getOrgPathDisplayName(path);
171
- if (filterOrg) {
172
- return (pathDisplayName === null || pathDisplayName === void 0 ? void 0 : pathDisplayName.toLocaleLowerCase().includes(filterOrg === null || filterOrg === void 0 ? void 0 : filterOrg.toLocaleLowerCase())) || (name === null || name === void 0 ? void 0 : name.toLocaleLowerCase().includes(filterOrg === null || filterOrg === void 0 ? void 0 : filterOrg.toLocaleLowerCase()));
173
- }
174
- return i;
175
- }).map(function (item, index) {
176
- var node = orgMapRef.current[item] || {};
177
- var path = node.path,
178
- name = node.name;
179
- var pathDisplayName = getOrgPathDisplayName(path);
180
- if (!path && !name) return null;
181
- return /*#__PURE__*/React.createElement("li", {
182
- key: item.value + index,
183
- className: "select-menu-list-item"
184
- }, /*#__PURE__*/React.createElement("span", {
185
- className: "org-name"
186
- }, /*#__PURE__*/React.createElement(_Ellipsis, {
187
- title: renderOrgItem(node, props === null || props === void 0 ? void 0 : props.lang)
188
- })), /*#__PURE__*/React.createElement("span", {
189
- className: "path-name"
190
- }, /*#__PURE__*/React.createElement(_Ellipsis, {
191
- title: pathDisplayName
192
- })));
193
- }) || /*#__PURE__*/React.createElement(_Empty, null);
194
- }, [userList, checkedKeys, filterOrg]);
277
+ return (
278
+ checkedKeys
279
+ .filter(function (i) {
280
+ var node = orgMapRef.current[i] || {};
281
+ var path = node.path,
282
+ name = node.name;
283
+ if (!path && !name) return false;
284
+ var pathDisplayName = getOrgPathDisplayName(path);
285
+ if (filterOrg) {
286
+ return (
287
+ (pathDisplayName === null || pathDisplayName === void 0
288
+ ? void 0
289
+ : pathDisplayName
290
+ .toLocaleLowerCase()
291
+ .includes(
292
+ filterOrg === null || filterOrg === void 0
293
+ ? void 0
294
+ : filterOrg.toLocaleLowerCase(),
295
+ )) ||
296
+ (name === null || name === void 0
297
+ ? void 0
298
+ : name
299
+ .toLocaleLowerCase()
300
+ .includes(
301
+ filterOrg === null || filterOrg === void 0
302
+ ? void 0
303
+ : filterOrg.toLocaleLowerCase(),
304
+ ))
305
+ );
306
+ }
307
+ return i;
308
+ })
309
+ .map(function (item, index) {
310
+ var node = orgMapRef.current[item] || {};
311
+ var path = node.path,
312
+ name = node.name;
313
+ var pathDisplayName = getOrgPathDisplayName(path);
314
+ if (!path && !name) return null;
315
+ return /*#__PURE__*/ React.createElement(
316
+ 'li',
317
+ {
318
+ key: item.value + index,
319
+ className: 'select-menu-list-item',
320
+ },
321
+ /*#__PURE__*/ React.createElement(
322
+ 'span',
323
+ {
324
+ className: 'org-name',
325
+ },
326
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
327
+ title: renderOrgItem(
328
+ node,
329
+ props === null || props === void 0 ? void 0 : props.lang,
330
+ ),
331
+ }),
332
+ ),
333
+ /*#__PURE__*/ React.createElement(
334
+ 'span',
335
+ {
336
+ className: 'path-name',
337
+ },
338
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
339
+ title: pathDisplayName,
340
+ }),
341
+ ),
342
+ );
343
+ }) || /*#__PURE__*/ React.createElement(_Empty, null)
344
+ );
345
+ },
346
+ [userList, checkedKeys, filterOrg],
347
+ );
195
348
  // 渲染App列表
196
- var appListDomRender = useMemo(function () {
197
- return appKeys.filter(function (i) {
198
- var node = appMapRef.current[i] || {};
199
- var label = node.label,
200
- value = node.value;
201
- if (!value && !label) return false;
202
- if (filterApp) {
203
- return (label === null || label === void 0 ? void 0 : label.toLocaleLowerCase().includes(filterApp === null || filterApp === void 0 ? void 0 : filterApp.toLocaleLowerCase())) || (value === null || value === void 0 ? void 0 : value.toLocaleLowerCase().includes(filterApp === null || filterApp === void 0 ? void 0 : filterApp.toLocaleLowerCase()));
204
- }
205
- return i;
206
- }).map(function (item, index) {
207
- var node = appMapRef.current[item] || {};
208
- var value = node.value,
209
- label = node.label;
210
- return /*#__PURE__*/React.createElement("li", {
211
- key: value + index,
212
- className: "select-menu-list-item"
213
- }, /*#__PURE__*/React.createElement(_Tooltip, {
214
- title: label,
215
- key: label + index
216
- }, /*#__PURE__*/React.createElement("span", {
217
- className: "app-name"
218
- }, label)));
219
- }) || /*#__PURE__*/React.createElement(_Empty, null);
220
- }, [appList, appKeys, filterApp]);
349
+ var appListDomRender = useMemo(
350
+ function () {
351
+ return (
352
+ appKeys
353
+ .filter(function (i) {
354
+ var node = appMapRef.current[i] || {};
355
+ var label = node.label,
356
+ value = node.value;
357
+ if (!value && !label) return false;
358
+ if (filterApp) {
359
+ return (
360
+ (label === null || label === void 0
361
+ ? void 0
362
+ : label
363
+ .toLocaleLowerCase()
364
+ .includes(
365
+ filterApp === null || filterApp === void 0
366
+ ? void 0
367
+ : filterApp.toLocaleLowerCase(),
368
+ )) ||
369
+ (value === null || value === void 0
370
+ ? void 0
371
+ : value
372
+ .toLocaleLowerCase()
373
+ .includes(
374
+ filterApp === null || filterApp === void 0
375
+ ? void 0
376
+ : filterApp.toLocaleLowerCase(),
377
+ ))
378
+ );
379
+ }
380
+ return i;
381
+ })
382
+ .map(function (item, index) {
383
+ var node = appMapRef.current[item] || {};
384
+ var value = node.value,
385
+ label = node.label;
386
+ return /*#__PURE__*/ React.createElement(
387
+ 'li',
388
+ {
389
+ key: value + index,
390
+ className: 'select-menu-list-item',
391
+ },
392
+ /*#__PURE__*/ React.createElement(
393
+ _Tooltip,
394
+ {
395
+ title: label,
396
+ key: label + index,
397
+ },
398
+ /*#__PURE__*/ React.createElement(
399
+ 'span',
400
+ {
401
+ className: 'app-name',
402
+ },
403
+ label,
404
+ ),
405
+ ),
406
+ );
407
+ }) || /*#__PURE__*/ React.createElement(_Empty, null)
408
+ );
409
+ },
410
+ [appList, appKeys, filterApp],
411
+ );
221
412
 
222
413
  // 渲染User列表
223
- var userListDomRender = useMemo(function () {
224
- return (userKeys === null || userKeys === void 0 ? void 0 : userKeys.filter(function (item) {
225
- var node = userMapRef.current[item] || {};
226
- var account = node.account,
227
- userName = node.userName;
228
- if (!userName && !node.account) return false;
229
- if (filterUser) {
230
- return (account === null || account === void 0 ? void 0 : account.toLocaleLowerCase().includes(filterUser === null || filterUser === void 0 ? void 0 : filterUser.toLocaleLowerCase())) || (userName === null || userName === void 0 ? void 0 : userName.toLocaleLowerCase().includes(filterUser === null || filterUser === void 0 ? void 0 : filterUser.toLocaleLowerCase()));
231
- }
232
- return item;
233
- }).map(function (item, index) {
234
- var node = userMapRef.current[item] || {};
235
- var userName = node.userName;
236
- return /*#__PURE__*/React.createElement("li", {
237
- key: userName + index,
238
- className: "select-menu-list-item"
239
- }, /*#__PURE__*/React.createElement(_Tooltip, {
240
- title: userName,
241
- key: userName + index
242
- }, /*#__PURE__*/React.createElement("span", {
243
- className: "user-name"
244
- }, userName)));
245
- })) || /*#__PURE__*/React.createElement(_Empty, null);
246
- }, [userList, userKeys, filterUser]);
247
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
248
- className: "assign-box-container view-mode"
249
- }, /*#__PURE__*/React.createElement("div", {
250
- className: "org-panel panel"
251
- }, /*#__PURE__*/React.createElement("div", {
252
- className: "menu-header"
253
- }, /*#__PURE__*/React.createElement("span", {
254
- className: "title"
255
- }, orgTitle || getText('authorizesOrgList', props === null || props === void 0 ? void 0 : props.lang))), /*#__PURE__*/React.createElement("div", {
256
- className: "panel-menu-body"
257
- }, /*#__PURE__*/React.createElement("ul", {
258
- className: "select-menu-list"
259
- }, /*#__PURE__*/React.createElement(_Input, {
260
- size: "small",
261
- placeholder: getText('search', props === null || props === void 0 ? void 0 : props.lang),
262
- onChange: function onChange(e) {
263
- debouncedOrgSearch(e.target.value);
264
- },
265
- suffix: /*#__PURE__*/React.createElement(_Icon, {
266
- type: "zoom"
267
- }),
268
- style: {
269
- marginBottom: 16
270
- }
271
- }), orgListDomRender))), /*#__PURE__*/React.createElement("div", {
272
- className: "app-panel panel"
273
- }, /*#__PURE__*/React.createElement("div", {
274
- className: "menu-header"
275
- }, /*#__PURE__*/React.createElement("span", {
276
- className: "title"
277
- }, appTitle || getText('authorizesAppList', props === null || props === void 0 ? void 0 : props.lang))), /*#__PURE__*/React.createElement("div", {
278
- className: "panel-menu-body"
279
- }, /*#__PURE__*/React.createElement(_Input, {
280
- onChange: function onChange(e) {
281
- debouncedAppSearch(e.target.value);
282
- },
283
- placeholder: getText('enterAppName', props === null || props === void 0 ? void 0 : props.lang),
284
- size: "small",
285
- suffix: /*#__PURE__*/React.createElement(_Icon, {
286
- type: "zoom"
287
- }),
288
- style: {
289
- marginBottom: 16
290
- }
291
- }), /*#__PURE__*/React.createElement("ul", {
292
- className: "select-menu-list"
293
- }, appListDomRender))), !!showUser && /*#__PURE__*/React.createElement("div", {
294
- className: "user-panel panel"
295
- }, /*#__PURE__*/React.createElement("div", {
296
- className: "menu-header"
297
- }, /*#__PURE__*/React.createElement("span", {
298
- className: "title"
299
- }, userTitle || getText('authorizesUserList', props === null || props === void 0 ? void 0 : props.lang))), /*#__PURE__*/React.createElement("div", {
300
- className: "panel-menu-body"
301
- }, /*#__PURE__*/React.createElement(_Input, {
302
- size: "small",
303
- placeholder: getText('enterUserName', props === null || props === void 0 ? void 0 : props.lang),
304
- onChange: function onChange(e) {
305
- debouncedUserSearch(e.target.value);
414
+ var userListDomRender = useMemo(
415
+ function () {
416
+ return (
417
+ (userKeys === null || userKeys === void 0
418
+ ? void 0
419
+ : userKeys
420
+ .filter(function (item) {
421
+ var node = userMapRef.current[item] || {};
422
+ var account = node.account,
423
+ userName = node.userName;
424
+ if (!userName && !node.account) return false;
425
+ if (filterUser) {
426
+ return (
427
+ (account === null || account === void 0
428
+ ? void 0
429
+ : account
430
+ .toLocaleLowerCase()
431
+ .includes(
432
+ filterUser === null || filterUser === void 0
433
+ ? void 0
434
+ : filterUser.toLocaleLowerCase(),
435
+ )) ||
436
+ (userName === null || userName === void 0
437
+ ? void 0
438
+ : userName
439
+ .toLocaleLowerCase()
440
+ .includes(
441
+ filterUser === null || filterUser === void 0
442
+ ? void 0
443
+ : filterUser.toLocaleLowerCase(),
444
+ ))
445
+ );
446
+ }
447
+ return item;
448
+ })
449
+ .map(function (item, index) {
450
+ var node = userMapRef.current[item] || {};
451
+ var userName = node.userName;
452
+ return /*#__PURE__*/ React.createElement(
453
+ 'li',
454
+ {
455
+ key: userName + index,
456
+ className: 'select-menu-list-item',
457
+ },
458
+ /*#__PURE__*/ React.createElement(
459
+ _Tooltip,
460
+ {
461
+ title: userName,
462
+ key: userName + index,
463
+ },
464
+ /*#__PURE__*/ React.createElement(
465
+ 'span',
466
+ {
467
+ className: 'user-name',
468
+ },
469
+ userName,
470
+ ),
471
+ ),
472
+ );
473
+ })) || /*#__PURE__*/ React.createElement(_Empty, null)
474
+ );
306
475
  },
307
- suffix: /*#__PURE__*/React.createElement(_Icon, {
308
- type: "zoom"
309
- }),
310
- style: {
311
- marginBottom: 16
312
- }
313
- }), /*#__PURE__*/React.createElement("ul", {
314
- className: "select-menu-list"
315
- }, userListDomRender)))));
476
+ [userList, userKeys, filterUser],
477
+ );
478
+ return /*#__PURE__*/ React.createElement(
479
+ React.Fragment,
480
+ null,
481
+ /*#__PURE__*/ React.createElement(
482
+ 'div',
483
+ {
484
+ className: 'assign-box-container view-mode',
485
+ },
486
+ /*#__PURE__*/ React.createElement(
487
+ 'div',
488
+ {
489
+ className: 'org-panel panel',
490
+ },
491
+ /*#__PURE__*/ React.createElement(
492
+ 'div',
493
+ {
494
+ className: 'menu-header',
495
+ },
496
+ /*#__PURE__*/ React.createElement(
497
+ 'span',
498
+ {
499
+ className: 'title',
500
+ },
501
+ orgTitle ||
502
+ getText(
503
+ 'authorizesOrgList',
504
+ props === null || props === void 0 ? void 0 : props.lang,
505
+ ),
506
+ ),
507
+ ),
508
+ /*#__PURE__*/ React.createElement(
509
+ 'div',
510
+ {
511
+ className: 'panel-menu-body',
512
+ },
513
+ /*#__PURE__*/ React.createElement(
514
+ 'ul',
515
+ {
516
+ className: 'select-menu-list',
517
+ },
518
+ /*#__PURE__*/ React.createElement(_Input, {
519
+ size: 'small',
520
+ placeholder: getText(
521
+ 'search',
522
+ props === null || props === void 0 ? void 0 : props.lang,
523
+ ),
524
+ onChange: function onChange(e) {
525
+ debouncedOrgSearch(e.target.value);
526
+ },
527
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
528
+ type: 'zoom',
529
+ }),
530
+ style: {
531
+ marginBottom: 16,
532
+ },
533
+ }),
534
+ orgListDomRender,
535
+ ),
536
+ ),
537
+ ),
538
+ /*#__PURE__*/ React.createElement(
539
+ 'div',
540
+ {
541
+ className: 'app-panel panel',
542
+ },
543
+ /*#__PURE__*/ React.createElement(
544
+ 'div',
545
+ {
546
+ className: 'menu-header',
547
+ },
548
+ /*#__PURE__*/ React.createElement(
549
+ 'span',
550
+ {
551
+ className: 'title',
552
+ },
553
+ appTitle ||
554
+ getText(
555
+ 'authorizesAppList',
556
+ props === null || props === void 0 ? void 0 : props.lang,
557
+ ),
558
+ ),
559
+ ),
560
+ /*#__PURE__*/ React.createElement(
561
+ 'div',
562
+ {
563
+ className: 'panel-menu-body',
564
+ },
565
+ /*#__PURE__*/ React.createElement(_Input, {
566
+ onChange: function onChange(e) {
567
+ debouncedAppSearch(e.target.value);
568
+ },
569
+ placeholder: getText(
570
+ 'enterAppName',
571
+ props === null || props === void 0 ? void 0 : props.lang,
572
+ ),
573
+ size: 'small',
574
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
575
+ type: 'zoom',
576
+ }),
577
+ style: {
578
+ marginBottom: 16,
579
+ },
580
+ }),
581
+ /*#__PURE__*/ React.createElement(
582
+ 'ul',
583
+ {
584
+ className: 'select-menu-list',
585
+ },
586
+ appListDomRender,
587
+ ),
588
+ ),
589
+ ),
590
+ !!showUser &&
591
+ /*#__PURE__*/ React.createElement(
592
+ 'div',
593
+ {
594
+ className: 'user-panel panel',
595
+ },
596
+ /*#__PURE__*/ React.createElement(
597
+ 'div',
598
+ {
599
+ className: 'menu-header',
600
+ },
601
+ /*#__PURE__*/ React.createElement(
602
+ 'span',
603
+ {
604
+ className: 'title',
605
+ },
606
+ userTitle ||
607
+ getText(
608
+ 'authorizesUserList',
609
+ props === null || props === void 0 ? void 0 : props.lang,
610
+ ),
611
+ ),
612
+ ),
613
+ /*#__PURE__*/ React.createElement(
614
+ 'div',
615
+ {
616
+ className: 'panel-menu-body',
617
+ },
618
+ /*#__PURE__*/ React.createElement(_Input, {
619
+ size: 'small',
620
+ placeholder: getText(
621
+ 'enterUserName',
622
+ props === null || props === void 0 ? void 0 : props.lang,
623
+ ),
624
+ onChange: function onChange(e) {
625
+ debouncedUserSearch(e.target.value);
626
+ },
627
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
628
+ type: 'zoom',
629
+ }),
630
+ style: {
631
+ marginBottom: 16,
632
+ },
633
+ }),
634
+ /*#__PURE__*/ React.createElement(
635
+ 'ul',
636
+ {
637
+ className: 'select-menu-list',
638
+ },
639
+ userListDomRender,
640
+ ),
641
+ ),
642
+ ),
643
+ ),
644
+ );
316
645
  };
317
- export default AssignModal;
646
+ export default AssignModal;