@tddc/assign-modal 3.0.7 → 3.0.9

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';
@@ -32,7 +105,23 @@ var AssignModal = function AssignModal(props) {
32
105
  userTitle = props.userTitle,
33
106
  _props$userList = props.userList,
34
107
  userList = _props$userList === void 0 ? [] : _props$userList,
35
- showUser = props.showUser;
108
+ showUser = props.showUser,
109
+ locale = props.locale;
110
+
111
+ // 封装 getText,自动传入 locale
112
+ var t = function t(key) {
113
+ for (
114
+ var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1;
115
+ _key < _len;
116
+ _key++
117
+ ) {
118
+ params[_key - 1] = arguments[_key];
119
+ }
120
+ return getText.apply(
121
+ void 0,
122
+ [key, props === null || props === void 0 ? void 0 : props.lang, locale].concat(params),
123
+ );
124
+ };
36
125
  var _dataItem$appCodes = dataItem.appCodes,
37
126
  appCodes = _dataItem$appCodes === void 0 ? [] : _dataItem$appCodes,
38
127
  _dataItem$orgCodes = dataItem.orgCodes,
@@ -45,20 +134,30 @@ var AssignModal = function AssignModal(props) {
45
134
  var appMapRef = useRef({});
46
135
  var userMapRef = useRef({});
47
136
  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]),
137
+ var _useMemo = useMemo(
138
+ function () {
139
+ var org = preorder(
140
+ rootNode,
141
+ function (key, obj) {
142
+ orgMapRef.current[key] = obj;
143
+ },
144
+ true,
145
+ );
146
+ var app = appList.map(function (item) {
147
+ appMapRef.current[item.value] = item;
148
+ return item.value;
149
+ });
150
+ var user =
151
+ (userList === null || userList === void 0
152
+ ? void 0
153
+ : userList.map(function (item) {
154
+ userMapRef.current[item.account] = item;
155
+ return item.account;
156
+ })) || [];
157
+ return [org, app, user];
158
+ },
159
+ [rootNode, appList, userList],
160
+ ),
62
161
  _useMemo2 = _slicedToArray(_useMemo, 3),
63
162
  allOrg = _useMemo2[0],
64
163
  allApp = _useMemo2[1],
@@ -87,231 +186,456 @@ var AssignModal = function AssignModal(props) {
87
186
  _useState12 = _slicedToArray(_useState11, 2),
88
187
  filterApp = _useState12[0],
89
188
  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;
189
+ useEffect(
190
+ function () {
191
+ // path allOrgList 赋值
192
+ path = findSameCodePath(rootNode, orgCode);
193
+ var initOrgs = [];
194
+ var initApps = [];
195
+ var initAccounts = [];
196
+ if (orgCodes.includes('all')) {
197
+ initOrgs = allOrg;
109
198
  } else {
110
- initAccounts = Array.from(new Set([].concat(_toConsumableArray(accounts || []), [account])));
199
+ initOrgs = Array.from(
200
+ new Set([].concat(_toConsumableArray(orgCodes || []), _toConsumableArray(path))),
201
+ );
111
202
  }
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), []);
203
+ if (appCodes.includes('all')) {
204
+ initApps = allApp;
205
+ } else {
206
+ initApps = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
207
+ }
208
+ if (showUser) {
209
+ if (accounts.includes('all')) {
210
+ initAccounts = allUser;
211
+ } else {
212
+ initAccounts = Array.from(
213
+ new Set([].concat(_toConsumableArray(accounts || []), [account])),
214
+ );
215
+ }
216
+ }
217
+ setCheckedKeys(initOrgs);
218
+ setAppKeys(initApps || []);
219
+ setUserKeys(initAccounts || []);
220
+ },
221
+ [dataItem],
222
+ );
223
+ var debouncedOrgSearch = useCallback(
224
+ debounce(function (nextValue) {
225
+ setFilterOrg(nextValue);
226
+ }, 200),
227
+ [],
228
+ );
229
+ var debouncedUserSearch = useCallback(
230
+ debounce(function (nextValue) {
231
+ setFilterUser(nextValue);
232
+ }, 200),
233
+ [],
234
+ );
235
+ var debouncedAppSearch = useCallback(
236
+ debounce(function (nextValue) {
237
+ setFilterApp(nextValue);
238
+ }, 200),
239
+ [],
240
+ );
126
241
  // 获取机构路径的中文显示名并拼接
127
242
  var getOrgPathDisplayName = function getOrgPathDisplayName() {
128
243
  var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
129
244
  var displayName = '';
130
245
  if (path.length > 0) {
131
- displayName = path.map(function (item) {
132
- return orgMapRef.current[item].name;
133
- }).join(' / ');
246
+ displayName = path
247
+ .map(function (item) {
248
+ return orgMapRef.current[item].name;
249
+ })
250
+ .join(' / ');
134
251
  }
135
252
  return displayName;
136
253
  };
137
254
 
138
255
  // 渲染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
- }
256
+ var orgListDomRender = useMemo(
257
+ function () {
258
+ var renderOrgItem = function renderOrgItem(item, lang) {
259
+ console.log(item, 'item');
260
+ var mapResult = {
261
+ 1: {
262
+ cn: '职能部门',
263
+ en: 'Func. Dept.',
264
+ icon: 'crowd',
265
+ },
266
+ 2: {
267
+ icon: 'corporation',
268
+ },
269
+ };
270
+ var result = mapResult[item === null || item === void 0 ? void 0 : item.orgAttribute] || {};
271
+ return /*#__PURE__*/ React.createElement(
272
+ 'div',
273
+ {
274
+ className: 'org-item-wrapper',
275
+ style: {
276
+ width: '100%',
277
+ },
278
+ },
279
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
280
+ title: item.name,
281
+ widthLimit: String(item.orgAttribute) === '1' ? 'calc(100% - 90px}' : '100%',
282
+ }),
283
+ String(item.orgAttribute) === '1' &&
284
+ /*#__PURE__*/ React.createElement(
285
+ 'span',
286
+ {
287
+ className: 'org-functional-departemt-marker',
288
+ },
289
+ result[lang] || '职能部门',
290
+ ),
291
+ );
151
292
  };
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]);
293
+ return (
294
+ checkedKeys
295
+ .filter(function (i) {
296
+ var node = orgMapRef.current[i] || {};
297
+ var path = node.path,
298
+ name = node.name;
299
+ if (!path && !name) return false;
300
+ var pathDisplayName = getOrgPathDisplayName(path);
301
+ if (filterOrg) {
302
+ return (
303
+ (pathDisplayName === null || pathDisplayName === void 0
304
+ ? void 0
305
+ : pathDisplayName
306
+ .toLocaleLowerCase()
307
+ .includes(
308
+ filterOrg === null || filterOrg === void 0
309
+ ? void 0
310
+ : filterOrg.toLocaleLowerCase(),
311
+ )) ||
312
+ (name === null || name === void 0
313
+ ? void 0
314
+ : name
315
+ .toLocaleLowerCase()
316
+ .includes(
317
+ filterOrg === null || filterOrg === void 0
318
+ ? void 0
319
+ : filterOrg.toLocaleLowerCase(),
320
+ ))
321
+ );
322
+ }
323
+ return i;
324
+ })
325
+ .map(function (item, index) {
326
+ var node = orgMapRef.current[item] || {};
327
+ var path = node.path,
328
+ name = node.name;
329
+ var pathDisplayName = getOrgPathDisplayName(path);
330
+ if (!path && !name) return null;
331
+ return /*#__PURE__*/ React.createElement(
332
+ 'li',
333
+ {
334
+ key: item.value + index,
335
+ className: 'select-menu-list-item',
336
+ },
337
+ /*#__PURE__*/ React.createElement(
338
+ 'span',
339
+ {
340
+ className: 'org-name',
341
+ },
342
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
343
+ title: renderOrgItem(
344
+ node,
345
+ props === null || props === void 0 ? void 0 : props.lang,
346
+ ),
347
+ }),
348
+ ),
349
+ /*#__PURE__*/ React.createElement(
350
+ 'span',
351
+ {
352
+ className: 'path-name',
353
+ },
354
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
355
+ title: pathDisplayName,
356
+ }),
357
+ ),
358
+ );
359
+ }) || /*#__PURE__*/ React.createElement(_Empty, null)
360
+ );
361
+ },
362
+ [userList, checkedKeys, filterOrg],
363
+ );
195
364
  // 渲染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]);
365
+ var appListDomRender = useMemo(
366
+ function () {
367
+ return (
368
+ appKeys
369
+ .filter(function (i) {
370
+ var node = appMapRef.current[i] || {};
371
+ var label = node.label,
372
+ value = node.value;
373
+ if (!value && !label) return false;
374
+ if (filterApp) {
375
+ return (
376
+ (label === null || label === void 0
377
+ ? void 0
378
+ : label
379
+ .toLocaleLowerCase()
380
+ .includes(
381
+ filterApp === null || filterApp === void 0
382
+ ? void 0
383
+ : filterApp.toLocaleLowerCase(),
384
+ )) ||
385
+ (value === null || value === void 0
386
+ ? void 0
387
+ : value
388
+ .toLocaleLowerCase()
389
+ .includes(
390
+ filterApp === null || filterApp === void 0
391
+ ? void 0
392
+ : filterApp.toLocaleLowerCase(),
393
+ ))
394
+ );
395
+ }
396
+ return i;
397
+ })
398
+ .map(function (item, index) {
399
+ var node = appMapRef.current[item] || {};
400
+ var value = node.value,
401
+ label = node.label;
402
+ return /*#__PURE__*/ React.createElement(
403
+ 'li',
404
+ {
405
+ key: value + index,
406
+ className: 'select-menu-list-item',
407
+ },
408
+ /*#__PURE__*/ React.createElement(
409
+ _Tooltip,
410
+ {
411
+ title: label,
412
+ key: label + index,
413
+ },
414
+ /*#__PURE__*/ React.createElement(
415
+ 'span',
416
+ {
417
+ className: 'app-name',
418
+ },
419
+ label,
420
+ ),
421
+ ),
422
+ );
423
+ }) || /*#__PURE__*/ React.createElement(_Empty, null)
424
+ );
425
+ },
426
+ [appList, appKeys, filterApp],
427
+ );
221
428
 
222
429
  // 渲染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);
430
+ var userListDomRender = useMemo(
431
+ function () {
432
+ return (
433
+ (userKeys === null || userKeys === void 0
434
+ ? void 0
435
+ : userKeys
436
+ .filter(function (item) {
437
+ var node = userMapRef.current[item] || {};
438
+ var account = node.account,
439
+ userName = node.userName;
440
+ if (!userName && !node.account) return false;
441
+ if (filterUser) {
442
+ return (
443
+ (account === null || account === void 0
444
+ ? void 0
445
+ : account
446
+ .toLocaleLowerCase()
447
+ .includes(
448
+ filterUser === null || filterUser === void 0
449
+ ? void 0
450
+ : filterUser.toLocaleLowerCase(),
451
+ )) ||
452
+ (userName === null || userName === void 0
453
+ ? void 0
454
+ : userName
455
+ .toLocaleLowerCase()
456
+ .includes(
457
+ filterUser === null || filterUser === void 0
458
+ ? void 0
459
+ : filterUser.toLocaleLowerCase(),
460
+ ))
461
+ );
462
+ }
463
+ return item;
464
+ })
465
+ .map(function (item, index) {
466
+ var node = userMapRef.current[item] || {};
467
+ var userName = node.userName;
468
+ return /*#__PURE__*/ React.createElement(
469
+ 'li',
470
+ {
471
+ key: userName + index,
472
+ className: 'select-menu-list-item',
473
+ },
474
+ /*#__PURE__*/ React.createElement(
475
+ _Tooltip,
476
+ {
477
+ title: userName,
478
+ key: userName + index,
479
+ },
480
+ /*#__PURE__*/ React.createElement(
481
+ 'span',
482
+ {
483
+ className: 'user-name',
484
+ },
485
+ userName,
486
+ ),
487
+ ),
488
+ );
489
+ })) || /*#__PURE__*/ React.createElement(_Empty, null)
490
+ );
264
491
  },
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);
306
- },
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)))));
492
+ [userList, userKeys, filterUser],
493
+ );
494
+ return /*#__PURE__*/ React.createElement(
495
+ React.Fragment,
496
+ null,
497
+ /*#__PURE__*/ React.createElement(
498
+ 'div',
499
+ {
500
+ className: 'assign-box-container view-mode',
501
+ },
502
+ /*#__PURE__*/ React.createElement(
503
+ 'div',
504
+ {
505
+ className: 'org-panel panel',
506
+ },
507
+ /*#__PURE__*/ React.createElement(
508
+ 'div',
509
+ {
510
+ className: 'menu-header',
511
+ },
512
+ /*#__PURE__*/ React.createElement(
513
+ 'span',
514
+ {
515
+ className: 'title',
516
+ },
517
+ orgTitle || t('authorizesOrgList'),
518
+ ),
519
+ ),
520
+ /*#__PURE__*/ React.createElement(
521
+ 'div',
522
+ {
523
+ className: 'panel-menu-body',
524
+ },
525
+ /*#__PURE__*/ React.createElement(
526
+ 'ul',
527
+ {
528
+ className: 'select-menu-list',
529
+ },
530
+ /*#__PURE__*/ React.createElement(_Input, {
531
+ size: 'small',
532
+ placeholder: t('search'),
533
+ onChange: function onChange(e) {
534
+ debouncedOrgSearch(e.target.value);
535
+ },
536
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
537
+ type: 'zoom',
538
+ }),
539
+ style: {
540
+ marginBottom: 16,
541
+ },
542
+ }),
543
+ orgListDomRender,
544
+ ),
545
+ ),
546
+ ),
547
+ /*#__PURE__*/ React.createElement(
548
+ 'div',
549
+ {
550
+ className: 'app-panel panel',
551
+ },
552
+ /*#__PURE__*/ React.createElement(
553
+ 'div',
554
+ {
555
+ className: 'menu-header',
556
+ },
557
+ /*#__PURE__*/ React.createElement(
558
+ 'span',
559
+ {
560
+ className: 'title',
561
+ },
562
+ appTitle || t('authorizesAppList'),
563
+ ),
564
+ ),
565
+ /*#__PURE__*/ React.createElement(
566
+ 'div',
567
+ {
568
+ className: 'panel-menu-body',
569
+ },
570
+ /*#__PURE__*/ React.createElement(_Input, {
571
+ onChange: function onChange(e) {
572
+ debouncedAppSearch(e.target.value);
573
+ },
574
+ placeholder: t('enterAppName'),
575
+ size: 'small',
576
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
577
+ type: 'zoom',
578
+ }),
579
+ style: {
580
+ marginBottom: 16,
581
+ },
582
+ }),
583
+ /*#__PURE__*/ React.createElement(
584
+ 'ul',
585
+ {
586
+ className: 'select-menu-list',
587
+ },
588
+ appListDomRender,
589
+ ),
590
+ ),
591
+ ),
592
+ !!showUser &&
593
+ /*#__PURE__*/ React.createElement(
594
+ 'div',
595
+ {
596
+ className: 'user-panel panel',
597
+ },
598
+ /*#__PURE__*/ React.createElement(
599
+ 'div',
600
+ {
601
+ className: 'menu-header',
602
+ },
603
+ /*#__PURE__*/ React.createElement(
604
+ 'span',
605
+ {
606
+ className: 'title',
607
+ },
608
+ userTitle || t('authorizesUserList'),
609
+ ),
610
+ ),
611
+ /*#__PURE__*/ React.createElement(
612
+ 'div',
613
+ {
614
+ className: 'panel-menu-body',
615
+ },
616
+ /*#__PURE__*/ React.createElement(_Input, {
617
+ size: 'small',
618
+ placeholder: t('enterUserName'),
619
+ onChange: function onChange(e) {
620
+ debouncedUserSearch(e.target.value);
621
+ },
622
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
623
+ type: 'zoom',
624
+ }),
625
+ style: {
626
+ marginBottom: 16,
627
+ },
628
+ }),
629
+ /*#__PURE__*/ React.createElement(
630
+ 'ul',
631
+ {
632
+ className: 'select-menu-list',
633
+ },
634
+ userListDomRender,
635
+ ),
636
+ ),
637
+ ),
638
+ ),
639
+ );
316
640
  };
317
- export default AssignModal;
641
+ export default AssignModal;