@tddc/assign-modal 3.1.5 → 3.1.6

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 (38) hide show
  1. package/es/index.js +67791 -3
  2. package/es/index.js.LICENSE.txt +45 -0
  3. package/lib/index.js +70897 -0
  4. package/lib/index.js.LICENSE.txt +45 -0
  5. package/package.json +44 -2
  6. package/src/.octopus/ar-EG/index.js +17 -3
  7. package/src/.octopus/en-US/index.js +6 -6
  8. package/src/.octopus/es-ES/index.js +17 -3
  9. package/src/.octopus/ko-KR/index.js +17 -3
  10. package/src/.octopus/th-TH/index.js +17 -3
  11. package/src/.octopus/zh-TW/index.js +19 -0
  12. package/src/I18N.js +3 -0
  13. package/src/locale/en-US.js +5 -0
  14. package/src/locale/es-ES.js +5 -0
  15. package/src/locale/ko-KR.js +5 -0
  16. package/src/locale/th-TH.js +5 -0
  17. package/src/locale/zh-CN.js +5 -0
  18. package/src/locale/zh-TW.js +5 -0
  19. package/es/AssignModal/AssignApp/Edit.js +0 -1504
  20. package/es/AssignModal/AssignApp/Edit_without_TntdVirtualTree.js +0 -1359
  21. package/es/AssignModal/AssignApp/View.js +0 -641
  22. package/es/AssignModal/AssignApp/index.js +0 -9
  23. package/es/AssignModal/AssignApp/index.less +0 -329
  24. package/es/AssignModal/AssignApp/utils.js +0 -241
  25. package/es/AssignModal/index.js +0 -202
  26. package/es/AssignModal/index.less +0 -12
  27. package/es/I18N.js +0 -102
  28. package/es/locale/ar-EG.js +0 -4
  29. package/es/locale/en-US.js +0 -0
  30. package/es/locale/es-ES.js +0 -0
  31. package/es/locale/ko-KR.js +0 -0
  32. package/es/locale/th-TH.js +0 -0
  33. package/es/locale/zh-CN.js +0 -0
  34. package/src/.octopus/ar-EG/test.js +0 -3
  35. package/src/.octopus/en-US/test.js +0 -3
  36. package/src/.octopus/es-ES/test.js +0 -3
  37. package/src/.octopus/ko-KR/test.js +0 -3
  38. package/src/.octopus/th-TH/test.js +0 -3
@@ -1,1504 +0,0 @@
1
- function _typeof(o) {
2
- '@babel/helpers - typeof';
3
- return (
4
- (_typeof =
5
- 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
6
- ? function (o) {
7
- return typeof o;
8
- }
9
- : function (o) {
10
- return o &&
11
- 'function' == typeof Symbol &&
12
- o.constructor === Symbol &&
13
- o !== Symbol.prototype
14
- ? 'symbol'
15
- : typeof o;
16
- }),
17
- _typeof(o)
18
- );
19
- }
20
- import _TntdVirtualTree from 'tntd/es/tntd-virtual-tree';
21
- import _Input from 'tntd/es/input';
22
- import _Icon from 'tntd/es/icon';
23
- import _Segmented from 'tntd/es/segmented';
24
- import _Empty from 'tntd/es/empty';
25
- import _Checkbox from 'tntd/es/checkbox';
26
- import _Ellipsis from 'tntd/es/ellipsis';
27
- function ownKeys(e, r) {
28
- var t = Object.keys(e);
29
- if (Object.getOwnPropertySymbols) {
30
- var o = Object.getOwnPropertySymbols(e);
31
- r &&
32
- (o = o.filter(function (r) {
33
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
34
- })),
35
- t.push.apply(t, o);
36
- }
37
- return t;
38
- }
39
- function _objectSpread(e) {
40
- for (var r = 1; r < arguments.length; r++) {
41
- var t = null != arguments[r] ? arguments[r] : {};
42
- r % 2
43
- ? ownKeys(Object(t), !0).forEach(function (r) {
44
- _defineProperty(e, r, t[r]);
45
- })
46
- : Object.getOwnPropertyDescriptors
47
- ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
48
- : ownKeys(Object(t)).forEach(function (r) {
49
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
50
- });
51
- }
52
- return e;
53
- }
54
- function _defineProperty(e, r, t) {
55
- return (
56
- (r = _toPropertyKey(r)) in e
57
- ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 })
58
- : (e[r] = t),
59
- e
60
- );
61
- }
62
- function _toPropertyKey(t) {
63
- var i = _toPrimitive(t, 'string');
64
- return 'symbol' == _typeof(i) ? i : i + '';
65
- }
66
- function _toPrimitive(t, r) {
67
- if ('object' != _typeof(t) || !t) return t;
68
- var e = t[Symbol.toPrimitive];
69
- if (void 0 !== e) {
70
- var i = e.call(t, r || 'default');
71
- if ('object' != _typeof(i)) return i;
72
- throw new TypeError('@@toPrimitive must return a primitive value.');
73
- }
74
- return ('string' === r ? String : Number)(t);
75
- }
76
- function _toConsumableArray(r) {
77
- return (
78
- _arrayWithoutHoles(r) ||
79
- _iterableToArray(r) ||
80
- _unsupportedIterableToArray(r) ||
81
- _nonIterableSpread()
82
- );
83
- }
84
- function _nonIterableSpread() {
85
- throw new TypeError(
86
- 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
87
- );
88
- }
89
- function _iterableToArray(r) {
90
- if (('undefined' != typeof Symbol && null != r[Symbol.iterator]) || null != r['@@iterator'])
91
- return Array.from(r);
92
- }
93
- function _arrayWithoutHoles(r) {
94
- if (Array.isArray(r)) return _arrayLikeToArray(r);
95
- }
96
- function _slicedToArray(r, e) {
97
- return (
98
- _arrayWithHoles(r) ||
99
- _iterableToArrayLimit(r, e) ||
100
- _unsupportedIterableToArray(r, e) ||
101
- _nonIterableRest()
102
- );
103
- }
104
- function _nonIterableRest() {
105
- throw new TypeError(
106
- 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
107
- );
108
- }
109
- function _unsupportedIterableToArray(r, a) {
110
- if (r) {
111
- if ('string' == typeof r) return _arrayLikeToArray(r, a);
112
- var t = {}.toString.call(r).slice(8, -1);
113
- return (
114
- 'Object' === t && r.constructor && (t = r.constructor.name),
115
- 'Map' === t || 'Set' === t
116
- ? Array.from(r)
117
- : 'Arguments' === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
118
- ? _arrayLikeToArray(r, a)
119
- : void 0
120
- );
121
- }
122
- }
123
- function _arrayLikeToArray(r, a) {
124
- (null == a || a > r.length) && (a = r.length);
125
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
126
- return n;
127
- }
128
- function _iterableToArrayLimit(r, l) {
129
- var t =
130
- null == r ? null : ('undefined' != typeof Symbol && r[Symbol.iterator]) || r['@@iterator'];
131
- if (null != t) {
132
- var e,
133
- n,
134
- i,
135
- u,
136
- a = [],
137
- f = !0,
138
- o = !1;
139
- try {
140
- if (((i = (t = t.call(r)).next), 0 === l)) {
141
- if (Object(t) !== t) return;
142
- f = !1;
143
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
144
- } catch (r) {
145
- (o = !0), (n = r);
146
- } finally {
147
- try {
148
- if (!f && null != t.return && ((u = t.return()), Object(u) !== u)) return;
149
- } finally {
150
- if (o) throw n;
151
- }
152
- }
153
- return a;
154
- }
155
- }
156
- function _arrayWithHoles(r) {
157
- if (Array.isArray(r)) return r;
158
- }
159
- import React from 'react';
160
- import { useEffect, useState, useCallback, useRef, useMemo } from 'react';
161
- import { cloneDeep, debounce } from 'lodash';
162
- import './index.less';
163
- import { findSameCodePath, preorder, mergeAndDeduplicate, useWindowHeight } from './utils';
164
- import { getText } from '../../I18N';
165
- var path = []; // 上级机构到当前机构的路径
166
-
167
- var AssignModal = function AssignModal(props) {
168
- var onChange = props.onChange,
169
- _props$orgList = props.orgList,
170
- orgList = _props$orgList === void 0 ? [] : _props$orgList,
171
- _props$dataItem = props.dataItem,
172
- dataItem = _props$dataItem === void 0 ? {} : _props$dataItem,
173
- disabled = props.disabled,
174
- appList = props.appList,
175
- orgTitle = props.orgTitle,
176
- appTitle = props.appTitle,
177
- userTitle = props.userTitle,
178
- orgCheckboxTitle = props.orgCheckboxTitle,
179
- appCheckboxTitle = props.appCheckboxTitle,
180
- userCheckboxTitle = props.userCheckboxTitle,
181
- _props$userList = props.userList,
182
- userList = _props$userList === void 0 ? [] : _props$userList,
183
- showUser = props.showUser,
184
- customOrgDisabled = props.customOrgDisabled,
185
- customAppDisabled = props.customAppDisabled,
186
- locale = props.locale;
187
-
188
- // 封装 getText,自动传入 locale
189
- var t = function t(key) {
190
- for (
191
- var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1;
192
- _key < _len;
193
- _key++
194
- ) {
195
- params[_key - 1] = arguments[_key];
196
- }
197
- return getText.apply(
198
- void 0,
199
- [key, props === null || props === void 0 ? void 0 : props.lang, locale].concat(params),
200
- );
201
- };
202
- var _dataItem$appCodes = dataItem.appCodes,
203
- appCodes = _dataItem$appCodes === void 0 ? [] : _dataItem$appCodes,
204
- _dataItem$orgCodes = dataItem.orgCodes,
205
- orgCodes = _dataItem$orgCodes === void 0 ? [] : _dataItem$orgCodes,
206
- orgCode = dataItem.orgCode,
207
- appCode = dataItem.appCode,
208
- _dataItem$accounts = dataItem.accounts,
209
- accounts = _dataItem$accounts === void 0 ? [] : _dataItem$accounts,
210
- account = dataItem.account;
211
- var orgMapRef = useRef({});
212
- var appMapRef = useRef({});
213
- var userMapRef = useRef({});
214
- var rootNode = orgList[0];
215
- var _useMemo = useMemo(
216
- function () {
217
- var org = preorder(
218
- rootNode,
219
- function (key, node) {
220
- orgMapRef.current[key] = node;
221
- },
222
- true,
223
- );
224
- var app = appList.map(function (item) {
225
- appMapRef.current[item.value] = item;
226
- return item.value;
227
- });
228
- var user =
229
- (userList === null || userList === void 0
230
- ? void 0
231
- : userList.map(function (item) {
232
- userMapRef.current[item.account] = item;
233
- return item.account;
234
- })) || [];
235
- return [org, app, user];
236
- },
237
- [rootNode, appList, userList],
238
- ),
239
- _useMemo2 = _slicedToArray(_useMemo, 3),
240
- allOrg = _useMemo2[0],
241
- allApp = _useMemo2[1],
242
- allUser = _useMemo2[2];
243
- var titleOptions = [
244
- ''.concat(orgTitle || t('availableOrgs')),
245
- ''.concat(appTitle || t('availableApps')),
246
- ''.concat(userTitle || t('availableUsers')),
247
- ];
248
- if (!showUser) {
249
- titleOptions.pop();
250
- }
251
- var _useState = useState(orgList[0]),
252
- _useState2 = _slicedToArray(_useState, 2),
253
- treeData = _useState2[0],
254
- setTreeData = _useState2[1];
255
- var _useState3 = useState(0),
256
- _useState4 = _slicedToArray(_useState3, 2),
257
- curIndex = _useState4[0],
258
- setCurIndex = _useState4[1];
259
- var _useState5 = useState(titleOptions[0]),
260
- _useState6 = _slicedToArray(_useState5, 2),
261
- curValue = _useState6[0],
262
- setCurValue = _useState6[1];
263
- var _useState7 = useState([]),
264
- _useState8 = _slicedToArray(_useState7, 2),
265
- checkedKeys = _useState8[0],
266
- setCheckedKeys = _useState8[1];
267
- var _useState9 = useState(appCodes || []),
268
- _useState0 = _slicedToArray(_useState9, 2),
269
- appKeys = _useState0[0],
270
- setAppKeys = _useState0[1];
271
- var _useState1 = useState(accounts || []),
272
- _useState10 = _slicedToArray(_useState1, 2),
273
- userKeys = _useState10[0],
274
- setUserKeys = _useState10[1];
275
- var _useState11 = useState(false),
276
- _useState12 = _slicedToArray(_useState11, 2),
277
- allOrgChecked = _useState12[0],
278
- setAllOrgChecked = _useState12[1];
279
- var _useState13 = useState(false),
280
- _useState14 = _slicedToArray(_useState13, 2),
281
- allAppChecked = _useState14[0],
282
- setAllAppChecked = _useState14[1];
283
- var _useState15 = useState(false),
284
- _useState16 = _slicedToArray(_useState15, 2),
285
- allUserChecked = _useState16[0],
286
- setAllUserChecked = _useState16[1];
287
- var _useState17 = useState(),
288
- _useState18 = _slicedToArray(_useState17, 2),
289
- filterOrg = _useState18[0],
290
- setFilterOrg = _useState18[1];
291
- var _useState19 = useState(),
292
- _useState20 = _slicedToArray(_useState19, 2),
293
- filterUser = _useState20[0],
294
- setFilterUser = _useState20[1];
295
- var _useState21 = useState(),
296
- _useState22 = _slicedToArray(_useState21, 2),
297
- filterApp = _useState22[0],
298
- setFilterApp = _useState22[1];
299
- var gap = 335;
300
- var windowHeight = useWindowHeight(gap);
301
- useEffect(
302
- function () {
303
- var _Object$keys;
304
- if (
305
- dataItem &&
306
- ((_Object$keys = Object.keys(dataItem)) === null || _Object$keys === void 0
307
- ? void 0
308
- : _Object$keys.length)
309
- ) {
310
- // path 和 allOrgList 赋值
311
- path = findSameCodePath(rootNode, orgCode);
312
- var initOrgs = [];
313
- var initApps = [];
314
- var initAccounts = [];
315
- if (orgCodes.includes('all')) {
316
- setAllOrgChecked(orgCodes.includes('all'));
317
- initOrgs = allOrg;
318
- } else {
319
- initOrgs = Array.from(
320
- new Set([].concat(_toConsumableArray(orgCodes || []), _toConsumableArray(path))),
321
- );
322
- }
323
- if (appCodes.includes('all')) {
324
- setAllAppChecked(appCodes.includes('all'));
325
- initApps = allApp;
326
- } else {
327
- initApps = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
328
- }
329
- if (showUser) {
330
- if (accounts.includes('all')) {
331
- setAllUserChecked(true);
332
- initAccounts = allUser;
333
- } else {
334
- initAccounts = Array.from(
335
- new Set([].concat(_toConsumableArray(accounts || []), [account])),
336
- );
337
- }
338
- }
339
- setCheckedKeys(initOrgs);
340
- setAppKeys(initApps || []);
341
- setUserKeys(initAccounts || []);
342
- onChange &&
343
- onChange({
344
- appKeys: appCodes.includes('all') ? ['all'] : initApps,
345
- checkedKeys: orgCodes.includes('all') ? ['all'] : initOrgs,
346
- userKeys: accounts.includes('all') ? ['all'] : initAccounts,
347
- appCheckAll: appCodes.includes('all'),
348
- orgCheckAll: orgCodes.includes('all'),
349
- userCheckAll: accounts.includes('all'),
350
- checkData: {
351
- apps: initApps,
352
- orgs: initOrgs,
353
- accounts: initAccounts,
354
- },
355
- });
356
- }
357
- },
358
- [dataItem],
359
- );
360
- useEffect(
361
- function () {
362
- if (orgList) {
363
- var _loopTreeNodes = function loopTreeNodes(nodes) {
364
- var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
365
- return nodes === null || nodes === void 0
366
- ? void 0
367
- : nodes.map(function (item) {
368
- var orgDisabled = path.includes(item.code);
369
- if (item.children && item.children.length > 0) {
370
- return _objectSpread(
371
- _objectSpread({}, item),
372
- {},
373
- {
374
- key: item.code,
375
- title: item.name,
376
- value: item.code,
377
- disabled:
378
- orgDisabled ||
379
- disabled ||
380
- allOrgChecked ||
381
- (customOrgDisabled && customOrgDisabled(item)),
382
- children: _loopTreeNodes(item.children, level + 1),
383
- },
384
- );
385
- }
386
- return _objectSpread(
387
- _objectSpread({}, item),
388
- {},
389
- {
390
- key: item.code,
391
- value: item.code,
392
- title: item.name,
393
- disabled:
394
- orgDisabled ||
395
- disabled ||
396
- allOrgChecked ||
397
- (customOrgDisabled && customOrgDisabled(item)),
398
- },
399
- );
400
- });
401
- };
402
- setTreeData(_loopTreeNodes(orgList, 0));
403
- }
404
- },
405
- [orgList, allOrgChecked, allAppChecked, allUserChecked],
406
- );
407
- var onCheck = function onCheck() {
408
- var _node$childrenValues;
409
- for (var _len2 = arguments.length, rest = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
410
- rest[_key2] = arguments[_key2];
411
- }
412
- var checked = rest[0],
413
- node = rest[1],
414
- isChecked = rest[2];
415
- var isLeaf = !(node === null || node === void 0
416
- ? void 0
417
- : (_node$childrenValues = node.childrenValues) === null || _node$childrenValues === void 0
418
- ? void 0
419
- : _node$childrenValues.length);
420
- var curNode = orgMapRef.current[node.value] || {};
421
- var path = curNode.path;
422
- var newChecked = cloneDeep(checked);
423
- if (!isLeaf && !isChecked) {
424
- var arr = preorder(node);
425
- arr.splice(0, 1);
426
- arr.map(function (item) {
427
- var i = newChecked.findIndex(function (i) {
428
- return i === item;
429
- });
430
- if (i !== -1) newChecked.splice(i, 1);
431
- });
432
- }
433
- if (isChecked) {
434
- newChecked.pop();
435
- newChecked = mergeAndDeduplicate(newChecked, path);
436
- }
437
- setCheckedKeys(newChecked);
438
- onChange({
439
- appKeys: allAppChecked ? ['all'] : appKeys,
440
- checkedKeys: newChecked,
441
- appCheckAll: allAppChecked,
442
- orgCheckAll: allOrgChecked,
443
- userKeys: allUserChecked ? ['all'] : userKeys,
444
- userCheckAll: allUserChecked,
445
- checkData: {
446
- apps: appKeys,
447
- orgs: newChecked,
448
- accounts: userKeys,
449
- },
450
- });
451
- };
452
- var assignApp = function assignApp(e) {
453
- var value = '';
454
- var newAppKeys = [];
455
- if (e.target.checked) {
456
- value = e.target.value;
457
- newAppKeys = [].concat(_toConsumableArray(appKeys), [value]);
458
- } else {
459
- value = e.target.value;
460
- newAppKeys = cloneDeep(appKeys);
461
- newAppKeys.map(function (item, index) {
462
- if (value === item) {
463
- newAppKeys.splice(index, 1);
464
- }
465
- });
466
- }
467
- setAppKeys(newAppKeys);
468
- onChange({
469
- appKeys: newAppKeys,
470
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
471
- appCheckAll: allAppChecked,
472
- orgCheckAll: allOrgChecked,
473
- userKeys: allUserChecked ? ['all'] : userKeys,
474
- userCheckAll: allUserChecked,
475
- checkData: {
476
- apps: newAppKeys,
477
- orgs: checkedKeys,
478
- accounts: userKeys,
479
- },
480
- });
481
- };
482
- var assignUser = function assignUser(e) {
483
- var value = '';
484
- var newUserKeys = [];
485
- if (e.target.checked) {
486
- value = e.target.value;
487
- newUserKeys = [].concat(_toConsumableArray(userKeys), [value]);
488
- } else {
489
- value = e.target.value;
490
- newUserKeys = cloneDeep(userKeys);
491
- newUserKeys.map(function (item, index) {
492
- if (value === item) {
493
- newUserKeys.splice(index, 1);
494
- }
495
- });
496
- }
497
- setUserKeys(newUserKeys);
498
- onChange({
499
- appKeys: appKeys,
500
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
501
- appCheckAll: allAppChecked,
502
- orgCheckAll: allOrgChecked,
503
- userKeys: newUserKeys,
504
- userCheckAll: allUserChecked,
505
- checkData: {
506
- apps: appKeys,
507
- orgs: checkedKeys,
508
- accounts: newUserKeys,
509
- },
510
- });
511
- };
512
-
513
- // org全局授权
514
- var checkAllOrg = function checkAllOrg(e) {
515
- var orgChecks = [];
516
- if (e.target.checked) {
517
- setAllOrgChecked(true);
518
- orgChecks = preorder(rootNode);
519
- setCheckedKeys(orgChecks);
520
- onChange({
521
- appKeys: allAppChecked ? ['all'] : appKeys,
522
- checkedKeys: ['all'],
523
- appCheckAll: allAppChecked,
524
- orgCheckAll: true,
525
- userKeys: allUserChecked ? ['all'] : userKeys,
526
- userCheckAll: allUserChecked,
527
- checkData: {
528
- apps: appKeys,
529
- orgs: checkedKeys,
530
- accounts: accounts,
531
- },
532
- });
533
- } else {
534
- setAllOrgChecked(false);
535
- var arr = orgCodes.includes('all') ? allOrg : orgCodes;
536
- orgChecks = Array.from(
537
- new Set([].concat(_toConsumableArray(arr || []), _toConsumableArray(path))),
538
- );
539
- setCheckedKeys(orgChecks);
540
- onChange({
541
- appKeys: allAppChecked ? ['all'] : appKeys,
542
- checkedKeys: orgChecks,
543
- appCheckAll: allAppChecked,
544
- orgCheckAll: false,
545
- userKeys: allUserChecked ? ['all'] : userKeys,
546
- userCheckAll: allUserChecked,
547
- checkData: {
548
- apps: appKeys,
549
- orgs: orgChecks,
550
- accounts: accounts,
551
- },
552
- });
553
- }
554
- };
555
-
556
- // app全局授权
557
- var checkedAllApp = function checkedAllApp(e) {
558
- var appChecks = [];
559
- if (e.target.checked) {
560
- setAllAppChecked(true);
561
- appChecks = appList.map(function (item) {
562
- return item.value;
563
- });
564
- setAppKeys(appChecks);
565
- onChange({
566
- appKeys: ['all'],
567
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
568
- appCheckAll: true,
569
- orgCheckAll: allOrgChecked,
570
- userKeys: allUserChecked ? ['all'] : userKeys,
571
- userCheckAll: allUserChecked,
572
- checkData: {
573
- apps: appChecks,
574
- orgs: checkedKeys,
575
- accounts: accounts,
576
- },
577
- });
578
- } else {
579
- setAllAppChecked(false);
580
- var arr = appCodes.includes('all') ? allApp : appCodes;
581
- appChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), [appCode])));
582
- setAppKeys(appChecks);
583
- onChange({
584
- appKeys: appChecks,
585
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
586
- appCheckAll: false,
587
- orgCheckAll: allOrgChecked,
588
- userKeys: allUserChecked ? ['all'] : userKeys,
589
- userCheckAll: allUserChecked,
590
- checkData: {
591
- apps: appChecks,
592
- orgs: checkedKeys,
593
- accounts: accounts,
594
- },
595
- });
596
- }
597
- };
598
-
599
- // account全局授权
600
- var checkedAllUser = function checkedAllUser(e) {
601
- var userChecks = [];
602
- if (e.target.checked) {
603
- setAllUserChecked(true);
604
- userChecks = userList.map(function (item) {
605
- return item.account;
606
- });
607
- setUserKeys(userChecks);
608
- onChange({
609
- appKeys: allAppChecked ? ['all'] : appKeys,
610
- appCheckAll: allAppChecked,
611
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
612
- orgCheckAll: allOrgChecked,
613
- userKeys: ['all'],
614
- userCheckAll: true,
615
- checkData: {
616
- apps: appKeys,
617
- orgs: checkedKeys,
618
- accounts: userChecks,
619
- },
620
- });
621
- } else {
622
- setAllUserChecked(false);
623
- var arr = accounts.includes('all') ? allUser : accounts;
624
- userChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), [account])));
625
- setUserKeys(userChecks);
626
- onChange({
627
- appKeys: allAppChecked ? ['all'] : appKeys,
628
- appCheckAll: allAppChecked,
629
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
630
- orgCheckAll: allOrgChecked,
631
- userKeys: userChecks,
632
- userCheckAll: false,
633
- checkData: {
634
- apps: appKeys,
635
- orgs: checkedKeys,
636
- accounts: userChecks,
637
- },
638
- });
639
- }
640
- };
641
- var debouncedOrgSearch = useCallback(
642
- debounce(function (nextValue) {
643
- setFilterOrg(nextValue);
644
- }, 200),
645
- [],
646
- );
647
- var debouncedUserSearch = useCallback(
648
- debounce(function (nextValue) {
649
- setFilterUser(nextValue);
650
- }, 200),
651
- [],
652
- );
653
- var debouncedAppSearch = useCallback(
654
- debounce(function (nextValue) {
655
- setFilterApp(nextValue);
656
- }, 200),
657
- [],
658
- );
659
-
660
- // 拼接机构路径显示名
661
- var getOrgPathDisplayName = function getOrgPathDisplayName() {
662
- var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
663
- var displayName = '';
664
- if (path.length > 0) {
665
- displayName = path
666
- .map(function (item) {
667
- return orgMapRef.current[item].name;
668
- })
669
- .join(' / ');
670
- }
671
- return displayName;
672
- };
673
-
674
- // 移除单个机构
675
- var onRemoveSingleOrg = function onRemoveSingleOrg(node) {
676
- var del_arr = preorder(node);
677
- var checked = checkedKeys.filter(function (item) {
678
- return !del_arr.includes(item);
679
- });
680
- setCheckedKeys(checked);
681
- setAllOrgChecked(false);
682
- onChange({
683
- appKeys: allAppChecked ? ['all'] : appKeys,
684
- checkedKeys: checked,
685
- appCheckAll: allAppChecked,
686
- orgCheckAll: false,
687
- userKeys: allUserChecked ? ['all'] : userKeys,
688
- userCheckAll: allUserChecked,
689
- checkData: {
690
- apps: appKeys,
691
- orgs: checked,
692
- accounts: userKeys,
693
- },
694
- });
695
- };
696
-
697
- // 移除全部机构
698
- var onRemoveAllOrg = function onRemoveAllOrg() {
699
- var checked = [rootNode.key];
700
- setCheckedKeys(checked);
701
- setAllOrgChecked(false);
702
- onChange({
703
- appKeys: allAppChecked ? ['all'] : appKeys,
704
- checkedKeys: checked,
705
- appCheckAll: allAppChecked,
706
- orgCheckAll: false,
707
- userKeys: allUserChecked ? ['all'] : userKeys,
708
- userCheckAll: allUserChecked,
709
- checkData: {
710
- apps: appKeys,
711
- orgs: checked,
712
- accounts: userKeys,
713
- },
714
- });
715
- };
716
-
717
- // 移除单个应用
718
- var onRemoveSingleApp = function onRemoveSingleApp(value) {
719
- var newAppKeys = cloneDeep(appKeys);
720
- newAppKeys.map(function (item, index) {
721
- if (value === item) {
722
- newAppKeys.splice(index, 1);
723
- }
724
- });
725
- setAppKeys(newAppKeys);
726
- setAllAppChecked(false);
727
- onChange({
728
- appKeys: newAppKeys,
729
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
730
- appCheckAll: false,
731
- orgCheckAll: allOrgChecked,
732
- userKeys: allUserChecked ? ['all'] : userKeys,
733
- userCheckAll: allUserChecked,
734
- checkData: {
735
- apps: newAppKeys,
736
- orgs: checkedKeys,
737
- accounts: userKeys,
738
- },
739
- });
740
- };
741
- // 移除全部应用
742
- var onRemoveAllApp = function onRemoveAllApp() {
743
- var newAppKeys = [appCode];
744
- setAppKeys(newAppKeys);
745
- setAllAppChecked(false);
746
- onChange({
747
- appKeys: newAppKeys,
748
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
749
- appCheckAll: false,
750
- orgCheckAll: allOrgChecked,
751
- userKeys: allUserChecked ? ['all'] : userKeys,
752
- userCheckAll: allUserChecked,
753
- checkData: {
754
- apps: newAppKeys,
755
- orgs: checkedKeys,
756
- accounts: userKeys,
757
- },
758
- });
759
- };
760
-
761
- // 移除全部用户
762
- var onRemoveAllUser = function onRemoveAllUser() {
763
- var newUserKeys = [account];
764
- setUserKeys(newUserKeys);
765
- setAllUserChecked(false);
766
- onChange({
767
- appKeys: allAppChecked ? ['all'] : appKeys,
768
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
769
- userKeys: newUserKeys,
770
- appCheckAll: allAppChecked,
771
- orgCheckAll: allOrgChecked,
772
- userCheckAll: false,
773
- checkData: {
774
- apps: appKeys,
775
- orgs: checkedKeys,
776
- accounts: newUserKeys,
777
- },
778
- });
779
- };
780
-
781
- // 移除单个用户
782
- var onRemoveSingleUser = function onRemoveSingleUser(value) {
783
- var newUserKeys = cloneDeep(userKeys);
784
- newUserKeys.map(function (item, index) {
785
- if (value === item) {
786
- newUserKeys.splice(index, 1);
787
- }
788
- });
789
- setUserKeys(newUserKeys);
790
- setAllUserChecked(false);
791
- onChange({
792
- appKeys: allAppChecked ? ['all'] : appKeys,
793
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
794
- userKeys: newUserKeys,
795
- appCheckAll: allAppChecked,
796
- orgCheckAll: allOrgChecked,
797
- userCheckAll: false,
798
- checkData: {
799
- apps: appKeys,
800
- orgs: checkedKeys,
801
- accounts: newUserKeys,
802
- },
803
- });
804
- };
805
-
806
- // 已选择的机构列表
807
- var areadySelectOrg = useMemo(
808
- function () {
809
- return (
810
- checkedKeys.filter(function (i) {
811
- return allOrg.includes(i);
812
- }) || []
813
- );
814
- },
815
- [checkedKeys, allOrg],
816
- );
817
- // 已选择的渠道列表
818
- var areadySelectApp = useMemo(
819
- function () {
820
- return (
821
- appKeys.filter(function (i) {
822
- return allApp.includes(i);
823
- }) || []
824
- );
825
- },
826
- [appKeys, allApp],
827
- );
828
- // 已选择的用户列表
829
- var areadySelectUser = useMemo(
830
- function () {
831
- return (
832
- userKeys.filter(function (i) {
833
- return allUser.includes(i);
834
- }) || []
835
- );
836
- },
837
- [userKeys, allUser],
838
- );
839
-
840
- // 渲染App列表
841
- var appListDomRender = useMemo(
842
- function () {
843
- return appList
844
- .filter(function (i) {
845
- var label = i.label,
846
- value = i.value;
847
- if (filterApp) {
848
- return (
849
- (label === null || label === void 0
850
- ? void 0
851
- : label
852
- .toLocaleLowerCase()
853
- .includes(
854
- filterApp === null || filterApp === void 0
855
- ? void 0
856
- : filterApp.toLocaleLowerCase(),
857
- )) ||
858
- (value === null || value === void 0
859
- ? void 0
860
- : value
861
- .toLocaleLowerCase()
862
- .includes(
863
- filterApp === null || filterApp === void 0
864
- ? void 0
865
- : filterApp.toLocaleLowerCase(),
866
- ))
867
- );
868
- }
869
- return i;
870
- })
871
- .map(function (item, index) {
872
- var isCheck =
873
- appKeys === null || appKeys === void 0 ? void 0 : appKeys.includes(item.value);
874
- var isOwnAppCode = appCode === item.value;
875
- return /*#__PURE__*/ React.createElement(
876
- _Checkbox,
877
- {
878
- checked: isCheck,
879
- disabled:
880
- disabled ||
881
- isOwnAppCode ||
882
- allAppChecked ||
883
- (customAppDisabled && customAppDisabled(item)),
884
- onChange: assignApp,
885
- value: item.value,
886
- key: index,
887
- },
888
- /*#__PURE__*/ React.createElement(
889
- 'span',
890
- {
891
- style: {
892
- display: 'inline-block',
893
- },
894
- },
895
- /*#__PURE__*/ React.createElement(_Ellipsis, {
896
- title: item.label,
897
- }),
898
- ),
899
- );
900
- });
901
- },
902
- [appList, appKeys, filterApp],
903
- );
904
-
905
- // 渲染User列表
906
- var userListDomRender = useMemo(
907
- function () {
908
- return (
909
- (userList === null || userList === void 0
910
- ? void 0
911
- : userList
912
- .filter(function (item) {
913
- if (filterUser) {
914
- var _item$account, _item$userName;
915
- return (
916
- (item === null || item === void 0
917
- ? void 0
918
- : (_item$account = item.account) === null || _item$account === void 0
919
- ? void 0
920
- : _item$account
921
- .toLocaleLowerCase()
922
- .includes(
923
- filterUser === null || filterUser === void 0
924
- ? void 0
925
- : filterUser.toLocaleLowerCase(),
926
- )) ||
927
- (item === null || item === void 0
928
- ? void 0
929
- : (_item$userName = item.userName) === null || _item$userName === void 0
930
- ? void 0
931
- : _item$userName
932
- .toLocaleLowerCase()
933
- .includes(
934
- filterUser === null || filterUser === void 0
935
- ? void 0
936
- : filterUser.toLocaleLowerCase(),
937
- ))
938
- );
939
- }
940
- return item;
941
- })
942
- .map(function (item, index) {
943
- var isCheck =
944
- userKeys === null || userKeys === void 0
945
- ? void 0
946
- : userKeys.includes(item.account);
947
- var isOwnAccount = account === item.account;
948
- return /*#__PURE__*/ React.createElement(
949
- _Checkbox,
950
- {
951
- key: item + index,
952
- checked: isCheck,
953
- disabled: disabled || isOwnAccount || allUserChecked,
954
- onChange: assignUser,
955
- value: item.account,
956
- },
957
- /*#__PURE__*/ React.createElement(
958
- 'span',
959
- {
960
- style: {
961
- display: 'inline-block',
962
- },
963
- },
964
- /*#__PURE__*/ React.createElement(_Ellipsis, {
965
- widthLimit: 240,
966
- title: item.userName,
967
- }),
968
- ),
969
- );
970
- })) || /*#__PURE__*/ React.createElement(_Empty, null)
971
- );
972
- },
973
- [userList, userKeys, filterUser],
974
- );
975
- var renderOrgItem = function renderOrgItem(item, lang) {
976
- var mapResult = {
977
- 1: {
978
- cn: '职能部门',
979
- en: 'Func. Dept.',
980
- icon: 'crowd',
981
- },
982
- 2: {
983
- icon: 'corporation',
984
- },
985
- };
986
- var result = mapResult[item === null || item === void 0 ? void 0 : item.orgAttribute] || {};
987
- return /*#__PURE__*/ React.createElement(
988
- 'div',
989
- {
990
- className: 'org-item-wrapper',
991
- style: {
992
- width: 'calc(100% - 32px)',
993
- },
994
- },
995
- /*#__PURE__*/ React.createElement(_Ellipsis, {
996
- title: item.title,
997
- widthLimit: String(item.orgAttribute) === '1' ? 'calc(100% - 90px}' : '100%',
998
- }),
999
- String(item.orgAttribute) === '1' &&
1000
- /*#__PURE__*/ React.createElement(
1001
- 'span',
1002
- {
1003
- className: 'org-functional-departemt-marker',
1004
- },
1005
- result[lang] || '职能部门',
1006
- ),
1007
- );
1008
- };
1009
- var defaultRenderItem = function defaultRenderItem(item) {
1010
- var isOrg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1011
- if (isOrg) {
1012
- return renderOrgItem(item, props === null || props === void 0 ? void 0 : props.lang);
1013
- }
1014
- return /*#__PURE__*/ React.createElement(_Ellipsis, {
1015
- title: item.title,
1016
- widthLimit: '100%',
1017
- });
1018
- };
1019
- var canNotRemoveOrg = useMemo(
1020
- function () {
1021
- var _orgMapRef$current, _orgMapRef$current$ch;
1022
- return (
1023
- (checkedKeys === null || checkedKeys === void 0 ? void 0 : checkedKeys.length) === 1 &&
1024
- ((_orgMapRef$current = orgMapRef.current) === null || _orgMapRef$current === void 0
1025
- ? void 0
1026
- : (_orgMapRef$current$ch = _orgMapRef$current[checkedKeys[0]]) === null ||
1027
- _orgMapRef$current$ch === void 0
1028
- ? void 0
1029
- : _orgMapRef$current$ch.key) ===
1030
- (rootNode === null || rootNode === void 0 ? void 0 : rootNode.key)
1031
- );
1032
- },
1033
- [checkedKeys],
1034
- );
1035
- var canNotRemoveApp = useMemo(
1036
- function () {
1037
- var _appMapRef$current, _appMapRef$current$ap;
1038
- return (
1039
- (appKeys === null || appKeys === void 0 ? void 0 : appKeys.length) === 1 &&
1040
- ((_appMapRef$current = appMapRef.current) === null || _appMapRef$current === void 0
1041
- ? void 0
1042
- : (_appMapRef$current$ap = _appMapRef$current[appKeys[0]]) === null ||
1043
- _appMapRef$current$ap === void 0
1044
- ? void 0
1045
- : _appMapRef$current$ap.name) === appCode
1046
- );
1047
- },
1048
- [appKeys],
1049
- );
1050
- console.log(canNotRemoveOrg, 'canNotRemove');
1051
-
1052
- // 计算面板数量和平移距离
1053
- var panelCount = showUser ? 3 : 2;
1054
- var translateX = curIndex === 0 ? 0 : ''.concat(-(100 / panelCount) * curIndex, '%');
1055
- return /*#__PURE__*/ React.createElement(
1056
- React.Fragment,
1057
- null,
1058
- /*#__PURE__*/ React.createElement(_Segmented, {
1059
- className: 'menu-title',
1060
- value: curValue,
1061
- options: titleOptions,
1062
- onChange: function onChange(index) {
1063
- setCurValue(index);
1064
- setCurIndex(
1065
- titleOptions.findIndex(function (i) {
1066
- return i === index;
1067
- }),
1068
- );
1069
- },
1070
- }),
1071
- /*#__PURE__*/ React.createElement(
1072
- 'div',
1073
- {
1074
- className: 'assign-box-container',
1075
- },
1076
- /*#__PURE__*/ React.createElement(
1077
- 'div',
1078
- {
1079
- className: 'slider',
1080
- style: {
1081
- width: showUser ? '300%' : '200%',
1082
- transform: 'translateX('.concat(translateX, ')'),
1083
- transition: 'transform 0.2s ease',
1084
- },
1085
- },
1086
- /*#__PURE__*/ React.createElement(
1087
- 'div',
1088
- {
1089
- className: 'org-panel panel',
1090
- },
1091
- /*#__PURE__*/ React.createElement(
1092
- 'div',
1093
- {
1094
- className: 'menu-header',
1095
- },
1096
- /*#__PURE__*/ React.createElement(
1097
- 'span',
1098
- {
1099
- className: 'title',
1100
- },
1101
- orgTitle || t('authorizesOrgList'),
1102
- ),
1103
- /*#__PURE__*/ React.createElement(
1104
- 'div',
1105
- {
1106
- className: 'menu-all-checked',
1107
- },
1108
- /*#__PURE__*/ React.createElement(
1109
- _Checkbox,
1110
- {
1111
- onChange: checkAllOrg,
1112
- checked: allOrgChecked,
1113
- disabled: disabled,
1114
- },
1115
- orgCheckboxTitle || t('allOrgAvailable'),
1116
- ),
1117
- ),
1118
- ),
1119
- /*#__PURE__*/ React.createElement(
1120
- 'div',
1121
- {
1122
- className: 'panel-menu-body',
1123
- },
1124
- /*#__PURE__*/ React.createElement(
1125
- 'div',
1126
- {
1127
- className: 'panel-left',
1128
- style: {
1129
- width: '60%',
1130
- },
1131
- },
1132
- /*#__PURE__*/ React.createElement(_Input, {
1133
- size: 'small',
1134
- placeholder: t('search'),
1135
- onChange: function onChange(e) {
1136
- debouncedOrgSearch(e.target.value);
1137
- },
1138
- suffix: /*#__PURE__*/ React.createElement(_Icon, {
1139
- type: 'zoom',
1140
- }),
1141
- style: {
1142
- marginBottom: 16,
1143
- width: 'calc(100% - 16px)',
1144
- },
1145
- }),
1146
- /*#__PURE__*/ React.createElement(_TntdVirtualTree, {
1147
- style: {
1148
- overflowX: 'auto',
1149
- },
1150
- isOrg: true,
1151
- treeData: treeData,
1152
- filterKey: filterOrg,
1153
- blockNode: true,
1154
- checkable: true,
1155
- checkStrictly: true,
1156
- checkedKeys: checkedKeys,
1157
- defaultExpandAll: true,
1158
- onCheck: onCheck,
1159
- height: windowHeight,
1160
- titleRender: defaultRenderItem,
1161
- }),
1162
- ),
1163
- /*#__PURE__*/ React.createElement(
1164
- 'div',
1165
- {
1166
- className: 'panel-right',
1167
- style: {
1168
- width: '40%',
1169
- },
1170
- },
1171
- /*#__PURE__*/ React.createElement(
1172
- 'div',
1173
- {
1174
- className: 'select-menu-header',
1175
- },
1176
- /*#__PURE__*/ React.createElement(
1177
- 'span',
1178
- null,
1179
- t('hasBeenSelected'),
1180
- ': ',
1181
- t('numOfOrg', areadySelectOrg.length || 0),
1182
- ),
1183
- /*#__PURE__*/ React.createElement(
1184
- 'a',
1185
- {
1186
- className: canNotRemoveOrg ? 'disabeld' : '',
1187
- onClick: function onClick() {
1188
- return onRemoveAllOrg();
1189
- },
1190
- },
1191
- t('clear'),
1192
- ),
1193
- ),
1194
- /*#__PURE__*/ React.createElement(
1195
- 'ul',
1196
- {
1197
- className: 'select-menu-list',
1198
- },
1199
- checkedKeys
1200
- .filter(function (i) {
1201
- return !!orgMapRef.current[i];
1202
- })
1203
- .map(function (item, index) {
1204
- var node = orgMapRef.current[item] || {};
1205
- var path = node.path,
1206
- name = node.name;
1207
- var pathDisplayName = getOrgPathDisplayName(path);
1208
- var disabled = rootNode.key === item;
1209
- return /*#__PURE__*/ React.createElement(
1210
- 'li',
1211
- {
1212
- key: item.value + index,
1213
- className: 'select-menu-list-item',
1214
- },
1215
- /*#__PURE__*/ React.createElement(
1216
- 'span',
1217
- {
1218
- className: 'org-name',
1219
- },
1220
- /*#__PURE__*/ React.createElement(_Ellipsis, {
1221
- title: name,
1222
- }),
1223
- ),
1224
- /*#__PURE__*/ React.createElement(
1225
- 'span',
1226
- {
1227
- className: 'path-name',
1228
- },
1229
- /*#__PURE__*/ React.createElement(_Ellipsis, {
1230
- title: pathDisplayName,
1231
- }),
1232
- ),
1233
- !disabled &&
1234
- /*#__PURE__*/ React.createElement(_Icon, {
1235
- type: 'close',
1236
- className: 'close-icon',
1237
- onClick: function onClick() {
1238
- return onRemoveSingleOrg(node);
1239
- },
1240
- }),
1241
- );
1242
- }) || /*#__PURE__*/ React.createElement(_Empty, null),
1243
- ),
1244
- ),
1245
- ),
1246
- ),
1247
- /*#__PURE__*/ React.createElement(
1248
- 'div',
1249
- {
1250
- className: 'app-panel panel',
1251
- },
1252
- /*#__PURE__*/ React.createElement(
1253
- 'div',
1254
- {
1255
- className: 'menu-header',
1256
- },
1257
- /*#__PURE__*/ React.createElement(
1258
- 'span',
1259
- {
1260
- className: 'title',
1261
- },
1262
- appTitle || t('authorizesAppList'),
1263
- ),
1264
- /*#__PURE__*/ React.createElement(
1265
- 'div',
1266
- {
1267
- className: 'menu-all-checked',
1268
- },
1269
- /*#__PURE__*/ React.createElement(
1270
- _Checkbox,
1271
- {
1272
- onChange: checkedAllApp,
1273
- checked: allAppChecked,
1274
- disabled: disabled,
1275
- },
1276
- appCheckboxTitle || t('allAppAvailable'),
1277
- ),
1278
- ),
1279
- ),
1280
- /*#__PURE__*/ React.createElement(
1281
- 'div',
1282
- {
1283
- className: 'panel-menu-body',
1284
- },
1285
- /*#__PURE__*/ React.createElement(
1286
- 'div',
1287
- {
1288
- className: 'panel-left',
1289
- },
1290
- /*#__PURE__*/ React.createElement(_Input, {
1291
- onChange: function onChange(e) {
1292
- debouncedAppSearch(e.target.value);
1293
- },
1294
- placeholder: t('enterAppName'),
1295
- size: 'small',
1296
- suffix: /*#__PURE__*/ React.createElement(_Icon, {
1297
- type: 'zoom',
1298
- }),
1299
- style: {
1300
- marginBottom: 16,
1301
- width: 'calc(100% - 16px)',
1302
- },
1303
- }),
1304
- appListDomRender,
1305
- ),
1306
- /*#__PURE__*/ React.createElement(
1307
- 'div',
1308
- {
1309
- className: 'panel-right',
1310
- },
1311
- /*#__PURE__*/ React.createElement(
1312
- 'div',
1313
- {
1314
- className: 'select-menu-header',
1315
- },
1316
- /*#__PURE__*/ React.createElement(
1317
- 'span',
1318
- null,
1319
- t('hasBeenSelected'),
1320
- ': ',
1321
- t('numOfApp', areadySelectApp.length || 0),
1322
- ),
1323
- /*#__PURE__*/ React.createElement(
1324
- 'a',
1325
- {
1326
- className: canNotRemoveApp ? 'disabeld' : '',
1327
- onClick: function onClick() {
1328
- return onRemoveAllApp();
1329
- },
1330
- },
1331
- t('clear'),
1332
- ),
1333
- ),
1334
- /*#__PURE__*/ React.createElement(
1335
- 'ul',
1336
- {
1337
- className: 'select-menu-list',
1338
- },
1339
- appKeys.map(function (item, index) {
1340
- var node = appMapRef.current[item] || {};
1341
- var value = node.value,
1342
- label = node.label;
1343
- var isOwnAppCode = appCode === value;
1344
- if (!value && !label) return null; // 不显示多余数据
1345
- return /*#__PURE__*/ React.createElement(
1346
- 'li',
1347
- {
1348
- key: value + index,
1349
- className: 'select-menu-list-item',
1350
- },
1351
- /*#__PURE__*/ React.createElement(
1352
- 'span',
1353
- {
1354
- className: 'app-name',
1355
- },
1356
- /*#__PURE__*/ React.createElement(_Ellipsis, {
1357
- title: label,
1358
- }),
1359
- ),
1360
- !isOwnAppCode &&
1361
- /*#__PURE__*/ React.createElement(_Icon, {
1362
- type: 'close',
1363
- className: 'close-icon',
1364
- onClick: function onClick() {
1365
- return onRemoveSingleApp(value);
1366
- },
1367
- }),
1368
- );
1369
- }) || /*#__PURE__*/ React.createElement(_Empty, null),
1370
- ),
1371
- ),
1372
- ),
1373
- ),
1374
- !!showUser &&
1375
- /*#__PURE__*/ React.createElement(
1376
- 'div',
1377
- {
1378
- className: 'user-panel panel',
1379
- },
1380
- /*#__PURE__*/ React.createElement(
1381
- 'div',
1382
- {
1383
- className: 'menu-header',
1384
- },
1385
- /*#__PURE__*/ React.createElement(
1386
- 'span',
1387
- {
1388
- className: 'title',
1389
- },
1390
- userTitle || t('authorizesUserList'),
1391
- ),
1392
- /*#__PURE__*/ React.createElement(
1393
- 'div',
1394
- {
1395
- className: 'menu-all-checked',
1396
- },
1397
- /*#__PURE__*/ React.createElement(
1398
- _Checkbox,
1399
- {
1400
- onChange: checkedAllUser,
1401
- checked: allUserChecked,
1402
- disabled: disabled,
1403
- },
1404
- userCheckboxTitle || t('allUserAvailable'),
1405
- ),
1406
- ),
1407
- ),
1408
- /*#__PURE__*/ React.createElement(
1409
- 'div',
1410
- {
1411
- className: 'panel-menu-body',
1412
- },
1413
- /*#__PURE__*/ React.createElement(
1414
- 'div',
1415
- {
1416
- className: 'panel-left',
1417
- },
1418
- /*#__PURE__*/ React.createElement(_Input, {
1419
- size: 'small',
1420
- placeholder: t('enterUserName'),
1421
- onChange: function onChange(e) {
1422
- debouncedUserSearch(e.target.value);
1423
- },
1424
- suffix: /*#__PURE__*/ React.createElement(_Icon, {
1425
- type: 'zoom',
1426
- }),
1427
- style: {
1428
- marginBottom: 16,
1429
- width: 'calc(100% - 16px)',
1430
- },
1431
- }),
1432
- userListDomRender,
1433
- ),
1434
- /*#__PURE__*/ React.createElement(
1435
- 'div',
1436
- {
1437
- className: 'panel-right',
1438
- },
1439
- /*#__PURE__*/ React.createElement(
1440
- 'div',
1441
- {
1442
- className: 'select-menu-header',
1443
- },
1444
- /*#__PURE__*/ React.createElement(
1445
- 'span',
1446
- null,
1447
- t('hasBeenSelected'),
1448
- ': ',
1449
- t('numOfUser', areadySelectUser.length || 0),
1450
- ),
1451
- /*#__PURE__*/ React.createElement(
1452
- 'a',
1453
- {
1454
- onClick: function onClick() {
1455
- return onRemoveAllUser();
1456
- },
1457
- },
1458
- t('clear'),
1459
- ),
1460
- ),
1461
- /*#__PURE__*/ React.createElement(
1462
- 'ul',
1463
- {
1464
- className: 'select-menu-list',
1465
- },
1466
- userKeys.map(function (item, index) {
1467
- var node = userMapRef.current[item] || {};
1468
- var userName = node.userName;
1469
- var isOwnUserCode = account === node.account;
1470
- if (!userName && !node.account) return null; // 不显示多余数据
1471
- return /*#__PURE__*/ React.createElement(
1472
- 'li',
1473
- {
1474
- key: userName + index,
1475
- className: 'select-menu-list-item',
1476
- },
1477
- /*#__PURE__*/ React.createElement(
1478
- 'span',
1479
- {
1480
- className: 'app-name',
1481
- },
1482
- /*#__PURE__*/ React.createElement(_Ellipsis, {
1483
- title: userName,
1484
- }),
1485
- ),
1486
- !isOwnUserCode &&
1487
- /*#__PURE__*/ React.createElement(_Icon, {
1488
- type: 'close',
1489
- className: 'close-icon',
1490
- onClick: function onClick() {
1491
- return onRemoveSingleUser(node.account);
1492
- },
1493
- }),
1494
- );
1495
- }) || /*#__PURE__*/ React.createElement(_Empty, null),
1496
- ),
1497
- ),
1498
- ),
1499
- ),
1500
- ),
1501
- ),
1502
- );
1503
- };
1504
- export default AssignModal;