@tddc/assign-modal 2.0.6 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1429 @@
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 '../../locale';
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
+ var _dataItem$appCodes = dataItem.appCodes,
187
+ appCodes = _dataItem$appCodes === void 0 ? [] : _dataItem$appCodes,
188
+ _dataItem$orgCodes = dataItem.orgCodes,
189
+ orgCodes = _dataItem$orgCodes === void 0 ? [] : _dataItem$orgCodes,
190
+ orgCode = dataItem.orgCode,
191
+ appCode = dataItem.appCode,
192
+ _dataItem$accounts = dataItem.accounts,
193
+ accounts = _dataItem$accounts === void 0 ? [] : _dataItem$accounts,
194
+ account = dataItem.account;
195
+ var orgMapRef = useRef({});
196
+ var appMapRef = useRef({});
197
+ var userMapRef = useRef({});
198
+ var rootNode = orgList[0];
199
+ var _useMemo = useMemo(
200
+ function () {
201
+ var org = preorder(
202
+ rootNode,
203
+ function (key, node) {
204
+ orgMapRef.current[key] = node;
205
+ },
206
+ true,
207
+ );
208
+ var app = appList.map(function (item) {
209
+ appMapRef.current[item.value] = item;
210
+ return item.value;
211
+ });
212
+ var user =
213
+ (userList === null || userList === void 0
214
+ ? void 0
215
+ : userList.map(function (item) {
216
+ userMapRef.current[item.account] = item;
217
+ return item.account;
218
+ })) || [];
219
+ return [org, app, user];
220
+ },
221
+ [rootNode, appList, userList],
222
+ ),
223
+ _useMemo2 = _slicedToArray(_useMemo, 3),
224
+ allOrg = _useMemo2[0],
225
+ allApp = _useMemo2[1],
226
+ allUser = _useMemo2[2];
227
+ var titleOptions = [
228
+ ''.concat(
229
+ orgTitle ||
230
+ getText('availableOrgs', props === null || props === void 0 ? void 0 : props.lang),
231
+ ),
232
+ ''.concat(
233
+ appTitle ||
234
+ getText('availableApps', props === null || props === void 0 ? void 0 : props.lang),
235
+ ),
236
+ ''.concat(
237
+ userTitle ||
238
+ getText('availableUsers', props === null || props === void 0 ? void 0 : props.lang),
239
+ ),
240
+ ];
241
+ if (!showUser) {
242
+ titleOptions.pop();
243
+ }
244
+ var _useState = useState(orgList[0]),
245
+ _useState2 = _slicedToArray(_useState, 2),
246
+ treeData = _useState2[0],
247
+ setTreeData = _useState2[1];
248
+ var _useState3 = useState(0),
249
+ _useState4 = _slicedToArray(_useState3, 2),
250
+ curIndex = _useState4[0],
251
+ setCurIndex = _useState4[1];
252
+ var _useState5 = useState(titleOptions[0]),
253
+ _useState6 = _slicedToArray(_useState5, 2),
254
+ curValue = _useState6[0],
255
+ setCurValue = _useState6[1];
256
+ var _useState7 = useState([]),
257
+ _useState8 = _slicedToArray(_useState7, 2),
258
+ checkedKeys = _useState8[0],
259
+ setCheckedKeys = _useState8[1];
260
+ var _useState9 = useState(appCodes || []),
261
+ _useState10 = _slicedToArray(_useState9, 2),
262
+ appKeys = _useState10[0],
263
+ setAppKeys = _useState10[1];
264
+ var _useState11 = useState(accounts || []),
265
+ _useState12 = _slicedToArray(_useState11, 2),
266
+ userKeys = _useState12[0],
267
+ setUserKeys = _useState12[1];
268
+ var _useState13 = useState(false),
269
+ _useState14 = _slicedToArray(_useState13, 2),
270
+ allOrgChecked = _useState14[0],
271
+ setAllOrgChecked = _useState14[1];
272
+ var _useState15 = useState(false),
273
+ _useState16 = _slicedToArray(_useState15, 2),
274
+ allAppChecked = _useState16[0],
275
+ setAllAppChecked = _useState16[1];
276
+ var _useState17 = useState(false),
277
+ _useState18 = _slicedToArray(_useState17, 2),
278
+ allUserChecked = _useState18[0],
279
+ setAllUserChecked = _useState18[1];
280
+ var _useState19 = useState(),
281
+ _useState20 = _slicedToArray(_useState19, 2),
282
+ filterOrg = _useState20[0],
283
+ setFilterOrg = _useState20[1];
284
+ var _useState21 = useState(),
285
+ _useState22 = _slicedToArray(_useState21, 2),
286
+ filterUser = _useState22[0],
287
+ setFilterUser = _useState22[1];
288
+ var _useState23 = useState(),
289
+ _useState24 = _slicedToArray(_useState23, 2),
290
+ filterApp = _useState24[0],
291
+ setFilterApp = _useState24[1];
292
+ var gap = 335;
293
+ var windowHeight = useWindowHeight(gap);
294
+ useEffect(
295
+ function () {
296
+ var _Object$keys;
297
+ if (
298
+ dataItem &&
299
+ ((_Object$keys = Object.keys(dataItem)) === null || _Object$keys === void 0
300
+ ? void 0
301
+ : _Object$keys.length)
302
+ ) {
303
+ // path 和 allOrgList 赋值
304
+ path = findSameCodePath(rootNode, orgCode);
305
+ var initOrgs = [];
306
+ var initApps = [];
307
+ var initAccounts = [];
308
+ if (orgCodes.includes('all')) {
309
+ setAllOrgChecked(orgCodes.includes('all'));
310
+ initOrgs = allOrg;
311
+ } else {
312
+ initOrgs = Array.from(
313
+ new Set([].concat(_toConsumableArray(orgCodes || []), _toConsumableArray(path))),
314
+ );
315
+ }
316
+ if (appCodes.includes('all')) {
317
+ setAllAppChecked(appCodes.includes('all'));
318
+ initApps = allApp;
319
+ } else {
320
+ initApps = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
321
+ }
322
+ if (showUser) {
323
+ if (accounts.includes('all')) {
324
+ setAllUserChecked(true);
325
+ initAccounts = allUser;
326
+ } else {
327
+ initAccounts = Array.from(
328
+ new Set([].concat(_toConsumableArray(accounts || []), [account])),
329
+ );
330
+ }
331
+ }
332
+ setCheckedKeys(initOrgs);
333
+ setAppKeys(initApps || []);
334
+ setUserKeys(initAccounts || []);
335
+ onChange &&
336
+ onChange({
337
+ appKeys: appCodes.includes('all') ? ['all'] : initApps,
338
+ checkedKeys: orgCodes.includes('all') ? ['all'] : initOrgs,
339
+ userKeys: accounts.includes('all') ? ['all'] : initAccounts,
340
+ appCheckAll: appCodes.includes('all'),
341
+ orgCheckAll: orgCodes.includes('all'),
342
+ userCheckAll: accounts.includes('all'),
343
+ checkData: {
344
+ apps: initApps,
345
+ orgs: initOrgs,
346
+ accounts: initAccounts,
347
+ },
348
+ });
349
+ }
350
+ },
351
+ [dataItem],
352
+ );
353
+ useEffect(
354
+ function () {
355
+ if (orgList) {
356
+ var _loopTreeNodes = function loopTreeNodes(nodes) {
357
+ var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
358
+ return nodes === null || nodes === void 0
359
+ ? void 0
360
+ : nodes.map(function (item) {
361
+ var orgDisabled = path.includes(item.code);
362
+ if (item.children && item.children.length > 0) {
363
+ return _objectSpread(
364
+ _objectSpread({}, item),
365
+ {},
366
+ {
367
+ key: item.code,
368
+ title: item.name,
369
+ value: item.code,
370
+ disabled:
371
+ orgDisabled ||
372
+ disabled ||
373
+ allOrgChecked ||
374
+ (customOrgDisabled && customOrgDisabled(item)),
375
+ children: _loopTreeNodes(item.children, level + 1),
376
+ },
377
+ );
378
+ }
379
+ return _objectSpread(
380
+ _objectSpread({}, item),
381
+ {},
382
+ {
383
+ key: item.code,
384
+ value: item.code,
385
+ title: item.name,
386
+ disabled:
387
+ orgDisabled ||
388
+ disabled ||
389
+ allOrgChecked ||
390
+ (customOrgDisabled && customOrgDisabled(item)),
391
+ },
392
+ );
393
+ });
394
+ };
395
+ setTreeData(_loopTreeNodes(orgList, 0));
396
+ }
397
+ },
398
+ [orgList, allOrgChecked, allAppChecked, allUserChecked],
399
+ );
400
+ var onCheck = function onCheck() {
401
+ var _node$childrenValues;
402
+ for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {
403
+ rest[_key] = arguments[_key];
404
+ }
405
+ var checked = rest[0],
406
+ node = rest[1],
407
+ isChecked = rest[2];
408
+ var isLeaf = !(node === null || node === void 0
409
+ ? void 0
410
+ : (_node$childrenValues = node.childrenValues) === null || _node$childrenValues === void 0
411
+ ? void 0
412
+ : _node$childrenValues.length);
413
+ var curNode = orgMapRef.current[node.value] || {};
414
+ var path = curNode.path;
415
+ var newChecked = cloneDeep(checked);
416
+ if (!isLeaf && !isChecked) {
417
+ var arr = preorder(node);
418
+ arr.splice(0, 1);
419
+ arr.map(function (item) {
420
+ var i = newChecked.findIndex(function (i) {
421
+ return i === item;
422
+ });
423
+ if (i !== -1) newChecked.splice(i, 1);
424
+ });
425
+ }
426
+ if (isChecked) {
427
+ newChecked.pop();
428
+ newChecked = mergeAndDeduplicate(newChecked, path);
429
+ }
430
+ setCheckedKeys(newChecked);
431
+ onChange({
432
+ appKeys: allAppChecked ? ['all'] : appKeys,
433
+ checkedKeys: newChecked,
434
+ appCheckAll: allAppChecked,
435
+ orgCheckAll: allOrgChecked,
436
+ userKeys: allUserChecked ? ['all'] : userKeys,
437
+ userCheckAll: allUserChecked,
438
+ checkData: {
439
+ apps: appKeys,
440
+ orgs: newChecked,
441
+ accounts: userKeys,
442
+ },
443
+ });
444
+ };
445
+ var assignApp = function assignApp(e) {
446
+ var value = '';
447
+ var newAppKeys = [];
448
+ if (e.target.checked) {
449
+ value = e.target.value;
450
+ newAppKeys = [].concat(_toConsumableArray(appKeys), [value]);
451
+ } else {
452
+ value = e.target.value;
453
+ newAppKeys = cloneDeep(appKeys);
454
+ newAppKeys.map(function (item, index) {
455
+ if (value === item) {
456
+ newAppKeys.splice(index, 1);
457
+ }
458
+ });
459
+ }
460
+ setAppKeys(newAppKeys);
461
+ onChange({
462
+ appKeys: newAppKeys,
463
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
464
+ appCheckAll: allAppChecked,
465
+ orgCheckAll: allOrgChecked,
466
+ userKeys: allUserChecked ? ['all'] : userKeys,
467
+ userCheckAll: allUserChecked,
468
+ checkData: {
469
+ apps: newAppKeys,
470
+ orgs: checkedKeys,
471
+ accounts: userKeys,
472
+ },
473
+ });
474
+ };
475
+ var assignUser = function assignUser(e) {
476
+ var value = '';
477
+ var newUserKeys = [];
478
+ if (e.target.checked) {
479
+ value = e.target.value;
480
+ newUserKeys = [].concat(_toConsumableArray(userKeys), [value]);
481
+ } else {
482
+ value = e.target.value;
483
+ newUserKeys = cloneDeep(userKeys);
484
+ newUserKeys.map(function (item, index) {
485
+ if (value === item) {
486
+ newUserKeys.splice(index, 1);
487
+ }
488
+ });
489
+ }
490
+ setUserKeys(newUserKeys);
491
+ onChange({
492
+ appKeys: appKeys,
493
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
494
+ appCheckAll: allAppChecked,
495
+ orgCheckAll: allOrgChecked,
496
+ userKeys: newUserKeys,
497
+ userCheckAll: allUserChecked,
498
+ checkData: {
499
+ apps: appKeys,
500
+ orgs: checkedKeys,
501
+ accounts: newUserKeys,
502
+ },
503
+ });
504
+ };
505
+
506
+ // org全局授权
507
+ var checkAllOrg = function checkAllOrg(e) {
508
+ var orgChecks = [];
509
+ if (e.target.checked) {
510
+ setAllOrgChecked(true);
511
+ orgChecks = preorder(rootNode);
512
+ setCheckedKeys(orgChecks);
513
+ onChange({
514
+ appKeys: allAppChecked ? ['all'] : appKeys,
515
+ checkedKeys: ['all'],
516
+ appCheckAll: allAppChecked,
517
+ orgCheckAll: true,
518
+ userKeys: allUserChecked ? ['all'] : userKeys,
519
+ userCheckAll: allUserChecked,
520
+ checkData: {
521
+ apps: appKeys,
522
+ orgs: checkedKeys,
523
+ accounts: accounts,
524
+ },
525
+ });
526
+ } else {
527
+ setAllOrgChecked(false);
528
+ var arr = orgCodes.includes('all') ? allOrg : orgCodes;
529
+ orgChecks = Array.from(
530
+ new Set([].concat(_toConsumableArray(arr || []), _toConsumableArray(path))),
531
+ );
532
+ setCheckedKeys(orgChecks);
533
+ onChange({
534
+ appKeys: allAppChecked ? ['all'] : appKeys,
535
+ checkedKeys: orgChecks,
536
+ appCheckAll: allAppChecked,
537
+ orgCheckAll: false,
538
+ userKeys: allUserChecked ? ['all'] : userKeys,
539
+ userCheckAll: allUserChecked,
540
+ checkData: {
541
+ apps: appKeys,
542
+ orgs: orgChecks,
543
+ accounts: accounts,
544
+ },
545
+ });
546
+ }
547
+ };
548
+
549
+ // app全局授权
550
+ var checkedAllApp = function checkedAllApp(e) {
551
+ var appChecks = [];
552
+ if (e.target.checked) {
553
+ setAllAppChecked(true);
554
+ appChecks = appList.map(function (item) {
555
+ return item.value;
556
+ });
557
+ setAppKeys(appChecks);
558
+ onChange({
559
+ appKeys: ['all'],
560
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
561
+ appCheckAll: true,
562
+ orgCheckAll: allOrgChecked,
563
+ userKeys: allUserChecked ? ['all'] : userKeys,
564
+ userCheckAll: allUserChecked,
565
+ checkData: {
566
+ apps: appChecks,
567
+ orgs: checkedKeys,
568
+ accounts: accounts,
569
+ },
570
+ });
571
+ } else {
572
+ setAllAppChecked(false);
573
+ var arr = appCodes.includes('all') ? allApp : appCodes;
574
+ appChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), [appCode])));
575
+ setAppKeys(appChecks);
576
+ onChange({
577
+ appKeys: appChecks,
578
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
579
+ appCheckAll: false,
580
+ orgCheckAll: allOrgChecked,
581
+ userKeys: allUserChecked ? ['all'] : userKeys,
582
+ userCheckAll: allUserChecked,
583
+ checkData: {
584
+ apps: appChecks,
585
+ orgs: checkedKeys,
586
+ accounts: accounts,
587
+ },
588
+ });
589
+ }
590
+ };
591
+
592
+ // account全局授权
593
+ var checkedAllUser = function checkedAllUser(e) {
594
+ var userChecks = [];
595
+ if (e.target.checked) {
596
+ setAllUserChecked(true);
597
+ userChecks = userList.map(function (item) {
598
+ return item.account;
599
+ });
600
+ setUserKeys(userChecks);
601
+ onChange({
602
+ appKeys: allAppChecked ? ['all'] : appKeys,
603
+ appCheckAll: allAppChecked,
604
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
605
+ orgCheckAll: allOrgChecked,
606
+ userKeys: ['all'],
607
+ userCheckAll: true,
608
+ checkData: {
609
+ apps: appKeys,
610
+ orgs: checkedKeys,
611
+ accounts: userChecks,
612
+ },
613
+ });
614
+ } else {
615
+ setAllUserChecked(false);
616
+ var arr = accounts.includes('all') ? allUser : accounts;
617
+ userChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), [account])));
618
+ setUserKeys(userChecks);
619
+ onChange({
620
+ appKeys: allAppChecked ? ['all'] : appKeys,
621
+ appCheckAll: allAppChecked,
622
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
623
+ orgCheckAll: allOrgChecked,
624
+ userKeys: userChecks,
625
+ userCheckAll: false,
626
+ checkData: {
627
+ apps: appKeys,
628
+ orgs: checkedKeys,
629
+ accounts: userChecks,
630
+ },
631
+ });
632
+ }
633
+ };
634
+ var debouncedOrgSearch = useCallback(
635
+ debounce(function (nextValue) {
636
+ setFilterOrg(nextValue);
637
+ }, 200),
638
+ [],
639
+ );
640
+ var debouncedUserSearch = useCallback(
641
+ debounce(function (nextValue) {
642
+ setFilterUser(nextValue);
643
+ }, 200),
644
+ [],
645
+ );
646
+ var debouncedAppSearch = useCallback(
647
+ debounce(function (nextValue) {
648
+ setFilterApp(nextValue);
649
+ }, 200),
650
+ [],
651
+ );
652
+
653
+ // 拼接机构路径显示名
654
+ var getOrgPathDisplayName = function getOrgPathDisplayName() {
655
+ var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
656
+ var displayName = '';
657
+ if (path.length > 0) {
658
+ displayName = path
659
+ .map(function (item) {
660
+ return orgMapRef.current[item].name;
661
+ })
662
+ .join(' / ');
663
+ }
664
+ return displayName;
665
+ };
666
+
667
+ // 移除单个机构
668
+ var onRemoveSingleOrg = function onRemoveSingleOrg(node) {
669
+ var del_arr = preorder(node);
670
+ var checked = checkedKeys.filter(function (item) {
671
+ return !del_arr.includes(item);
672
+ });
673
+ setCheckedKeys(checked);
674
+ setAllOrgChecked(false);
675
+ onChange({
676
+ appKeys: allAppChecked ? ['all'] : appKeys,
677
+ checkedKeys: checked,
678
+ appCheckAll: allAppChecked,
679
+ orgCheckAll: false,
680
+ userKeys: allUserChecked ? ['all'] : userKeys,
681
+ userCheckAll: allUserChecked,
682
+ checkData: {
683
+ apps: appKeys,
684
+ orgs: checked,
685
+ accounts: userKeys,
686
+ },
687
+ });
688
+ };
689
+
690
+ // 移除全部机构
691
+ var onRemoveAllOrg = function onRemoveAllOrg() {
692
+ var checked = [rootNode.key];
693
+ setCheckedKeys(checked);
694
+ setAllOrgChecked(false);
695
+ onChange({
696
+ appKeys: allAppChecked ? ['all'] : appKeys,
697
+ checkedKeys: checked,
698
+ appCheckAll: allAppChecked,
699
+ orgCheckAll: false,
700
+ userKeys: allUserChecked ? ['all'] : userKeys,
701
+ userCheckAll: allUserChecked,
702
+ checkData: {
703
+ apps: appKeys,
704
+ orgs: checked,
705
+ accounts: userKeys,
706
+ },
707
+ });
708
+ };
709
+
710
+ // 移除单个应用
711
+ var onRemoveSingleApp = function onRemoveSingleApp(value) {
712
+ var newAppKeys = cloneDeep(appKeys);
713
+ newAppKeys.map(function (item, index) {
714
+ if (value === item) {
715
+ newAppKeys.splice(index, 1);
716
+ }
717
+ });
718
+ setAppKeys(newAppKeys);
719
+ setAllAppChecked(false);
720
+ onChange({
721
+ appKeys: newAppKeys,
722
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
723
+ appCheckAll: false,
724
+ orgCheckAll: allOrgChecked,
725
+ userKeys: allUserChecked ? ['all'] : userKeys,
726
+ userCheckAll: allUserChecked,
727
+ checkData: {
728
+ apps: newAppKeys,
729
+ orgs: checkedKeys,
730
+ accounts: userKeys,
731
+ },
732
+ });
733
+ };
734
+ // 移除全部应用
735
+ var onRemoveAllApp = function onRemoveAllApp() {
736
+ var newAppKeys = [appCode];
737
+ setAppKeys(newAppKeys);
738
+ setAllAppChecked(false);
739
+ onChange({
740
+ appKeys: newAppKeys,
741
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
742
+ appCheckAll: false,
743
+ orgCheckAll: allOrgChecked,
744
+ userKeys: allUserChecked ? ['all'] : userKeys,
745
+ userCheckAll: allUserChecked,
746
+ checkData: {
747
+ apps: newAppKeys,
748
+ orgs: checkedKeys,
749
+ accounts: userKeys,
750
+ },
751
+ });
752
+ };
753
+
754
+ // 移除全部用户
755
+ var onRemoveAllUser = function onRemoveAllUser() {
756
+ var newUserKeys = [account];
757
+ setUserKeys(newUserKeys);
758
+ setAllUserChecked(false);
759
+ onChange({
760
+ appKeys: allAppChecked ? ['all'] : appKeys,
761
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
762
+ userKeys: newUserKeys,
763
+ appCheckAll: allAppChecked,
764
+ orgCheckAll: allOrgChecked,
765
+ userCheckAll: false,
766
+ checkData: {
767
+ apps: appKeys,
768
+ orgs: checkedKeys,
769
+ accounts: newUserKeys,
770
+ },
771
+ });
772
+ };
773
+
774
+ // 移除单个用户
775
+ var onRemoveSingleUser = function onRemoveSingleUser(value) {
776
+ var newUserKeys = cloneDeep(userKeys);
777
+ newUserKeys.map(function (item, index) {
778
+ if (value === item) {
779
+ newUserKeys.splice(index, 1);
780
+ }
781
+ });
782
+ setUserKeys(newUserKeys);
783
+ setAllUserChecked(false);
784
+ onChange({
785
+ appKeys: allAppChecked ? ['all'] : appKeys,
786
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
787
+ userKeys: newUserKeys,
788
+ appCheckAll: allAppChecked,
789
+ orgCheckAll: allOrgChecked,
790
+ userCheckAll: false,
791
+ checkData: {
792
+ apps: appKeys,
793
+ orgs: checkedKeys,
794
+ accounts: newUserKeys,
795
+ },
796
+ });
797
+ };
798
+
799
+ // 已选择的机构列表
800
+ var areadySelectOrg = useMemo(
801
+ function () {
802
+ return (
803
+ checkedKeys.filter(function (i) {
804
+ return allOrg.includes(i);
805
+ }) || []
806
+ );
807
+ },
808
+ [checkedKeys, allOrg],
809
+ );
810
+ // 已选择的渠道列表
811
+ var areadySelectApp = useMemo(
812
+ function () {
813
+ return (
814
+ appKeys.filter(function (i) {
815
+ return allApp.includes(i);
816
+ }) || []
817
+ );
818
+ },
819
+ [appKeys, allApp],
820
+ );
821
+ // 已选择的用户列表
822
+ var areadySelectUser = useMemo(
823
+ function () {
824
+ return (
825
+ userKeys.filter(function (i) {
826
+ return allUser.includes(i);
827
+ }) || []
828
+ );
829
+ },
830
+ [userKeys, allUser],
831
+ );
832
+
833
+ // 渲染App列表
834
+ var appListDomRender = useMemo(
835
+ function () {
836
+ return appList
837
+ .filter(function (i) {
838
+ var label = i.label,
839
+ value = i.value;
840
+ if (filterApp) {
841
+ return (
842
+ (label === null || label === void 0
843
+ ? void 0
844
+ : label
845
+ .toLocaleLowerCase()
846
+ .includes(
847
+ filterApp === null || filterApp === void 0
848
+ ? void 0
849
+ : filterApp.toLocaleLowerCase(),
850
+ )) ||
851
+ (value === null || value === void 0
852
+ ? void 0
853
+ : value
854
+ .toLocaleLowerCase()
855
+ .includes(
856
+ filterApp === null || filterApp === void 0
857
+ ? void 0
858
+ : filterApp.toLocaleLowerCase(),
859
+ ))
860
+ );
861
+ }
862
+ return i;
863
+ })
864
+ .map(function (item, index) {
865
+ var isCheck =
866
+ appKeys === null || appKeys === void 0 ? void 0 : appKeys.includes(item.value);
867
+ var isOwnAppCode = appCode === item.value;
868
+ return /*#__PURE__*/ React.createElement(
869
+ _Checkbox,
870
+ {
871
+ checked: isCheck,
872
+ disabled:
873
+ disabled ||
874
+ isOwnAppCode ||
875
+ allAppChecked ||
876
+ (customAppDisabled && customAppDisabled(item)),
877
+ onChange: assignApp,
878
+ value: item.value,
879
+ key: index,
880
+ },
881
+ /*#__PURE__*/ React.createElement(
882
+ 'span',
883
+ {
884
+ style: {
885
+ display: 'inline-block',
886
+ },
887
+ },
888
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
889
+ title: item.label,
890
+ }),
891
+ ),
892
+ );
893
+ });
894
+ },
895
+ [appList, appKeys, filterApp],
896
+ );
897
+
898
+ // 渲染User列表
899
+ var userListDomRender = useMemo(
900
+ function () {
901
+ return (
902
+ (userList === null || userList === void 0
903
+ ? void 0
904
+ : userList
905
+ .filter(function (item) {
906
+ if (filterUser) {
907
+ var _item$account, _item$userName;
908
+ return (
909
+ (item === null || item === void 0
910
+ ? void 0
911
+ : (_item$account = item.account) === null || _item$account === void 0
912
+ ? void 0
913
+ : _item$account
914
+ .toLocaleLowerCase()
915
+ .includes(
916
+ filterUser === null || filterUser === void 0
917
+ ? void 0
918
+ : filterUser.toLocaleLowerCase(),
919
+ )) ||
920
+ (item === null || item === void 0
921
+ ? void 0
922
+ : (_item$userName = item.userName) === null || _item$userName === void 0
923
+ ? void 0
924
+ : _item$userName
925
+ .toLocaleLowerCase()
926
+ .includes(
927
+ filterUser === null || filterUser === void 0
928
+ ? void 0
929
+ : filterUser.toLocaleLowerCase(),
930
+ ))
931
+ );
932
+ }
933
+ return item;
934
+ })
935
+ .map(function (item, index) {
936
+ var isCheck =
937
+ userKeys === null || userKeys === void 0
938
+ ? void 0
939
+ : userKeys.includes(item.account);
940
+ var isOwnAccount = account === item.account;
941
+ return /*#__PURE__*/ React.createElement(
942
+ _Checkbox,
943
+ {
944
+ key: item + index,
945
+ checked: isCheck,
946
+ disabled: disabled || isOwnAccount || allUserChecked,
947
+ onChange: assignUser,
948
+ value: item.account,
949
+ },
950
+ /*#__PURE__*/ React.createElement(
951
+ 'span',
952
+ {
953
+ style: {
954
+ display: 'inline-block',
955
+ },
956
+ },
957
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
958
+ widthLimit: 240,
959
+ title: item.userName,
960
+ }),
961
+ ),
962
+ );
963
+ })) || /*#__PURE__*/ React.createElement(_Empty, null)
964
+ );
965
+ },
966
+ [userList, userKeys, filterUser],
967
+ );
968
+ return /*#__PURE__*/ React.createElement(
969
+ React.Fragment,
970
+ null,
971
+ /*#__PURE__*/ React.createElement(_Segmented, {
972
+ className: 'menu-title',
973
+ value: curValue,
974
+ options: titleOptions,
975
+ onChange: function onChange(index) {
976
+ setCurValue(index);
977
+ setCurIndex(
978
+ titleOptions.findIndex(function (i) {
979
+ return i === index;
980
+ }),
981
+ );
982
+ },
983
+ }),
984
+ /*#__PURE__*/ React.createElement(
985
+ 'div',
986
+ {
987
+ className: 'assign-box-container',
988
+ },
989
+ /*#__PURE__*/ React.createElement(
990
+ 'div',
991
+ {
992
+ className: 'slider panel-'.concat(curIndex),
993
+ style: {
994
+ width: !!showUser ? '300%' : '200%',
995
+ },
996
+ },
997
+ /*#__PURE__*/ React.createElement(
998
+ 'div',
999
+ {
1000
+ className: 'org-panel panel',
1001
+ },
1002
+ /*#__PURE__*/ React.createElement(
1003
+ 'div',
1004
+ {
1005
+ className: 'menu-header',
1006
+ },
1007
+ /*#__PURE__*/ React.createElement(
1008
+ 'span',
1009
+ {
1010
+ className: 'title',
1011
+ },
1012
+ orgTitle ||
1013
+ getText(
1014
+ 'authorizesOrgList',
1015
+ props === null || props === void 0 ? void 0 : props.lang,
1016
+ ),
1017
+ ),
1018
+ /*#__PURE__*/ React.createElement(
1019
+ 'div',
1020
+ {
1021
+ className: 'menu-all-checked',
1022
+ },
1023
+ /*#__PURE__*/ React.createElement(
1024
+ _Checkbox,
1025
+ {
1026
+ onChange: checkAllOrg,
1027
+ checked: allOrgChecked,
1028
+ disabled: disabled,
1029
+ },
1030
+ orgCheckboxTitle ||
1031
+ getText(
1032
+ 'allOrgAvailable',
1033
+ props === null || props === void 0 ? void 0 : props.lang,
1034
+ ),
1035
+ ),
1036
+ ),
1037
+ ),
1038
+ /*#__PURE__*/ React.createElement(
1039
+ 'div',
1040
+ {
1041
+ className: 'panel-menu-body',
1042
+ },
1043
+ /*#__PURE__*/ React.createElement(
1044
+ 'div',
1045
+ {
1046
+ className: 'panel-left',
1047
+ },
1048
+ /*#__PURE__*/ React.createElement(_Input, {
1049
+ size: 'small',
1050
+ placeholder: getText(
1051
+ 'search',
1052
+ props === null || props === void 0 ? void 0 : props.lang,
1053
+ ),
1054
+ onChange: function onChange(e) {
1055
+ debouncedOrgSearch(e.target.value);
1056
+ },
1057
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
1058
+ type: 'zoom',
1059
+ }),
1060
+ style: {
1061
+ marginBottom: 16,
1062
+ width: 'calc(100% - 16px)',
1063
+ },
1064
+ }),
1065
+ /*#__PURE__*/ React.createElement(_TntdVirtualTree, {
1066
+ isOrg: true,
1067
+ treeData: treeData,
1068
+ filterKey: filterOrg,
1069
+ blockNode: true,
1070
+ checkable: true,
1071
+ checkStrictly: true,
1072
+ checkedKeys: checkedKeys,
1073
+ defaultExpandAll: true,
1074
+ onCheck: onCheck,
1075
+ height: windowHeight,
1076
+ }),
1077
+ ),
1078
+ /*#__PURE__*/ React.createElement(
1079
+ 'div',
1080
+ {
1081
+ className: 'panel-right',
1082
+ },
1083
+ /*#__PURE__*/ React.createElement(
1084
+ 'div',
1085
+ {
1086
+ className: 'select-menu-header',
1087
+ },
1088
+ /*#__PURE__*/ React.createElement(
1089
+ 'span',
1090
+ null,
1091
+ '\u5DF2\u9009: ',
1092
+ areadySelectOrg.length || 0,
1093
+ ' \u4E2A\u673A\u6784',
1094
+ ),
1095
+ /*#__PURE__*/ React.createElement(
1096
+ 'a',
1097
+ {
1098
+ onClick: function onClick() {
1099
+ return onRemoveAllOrg();
1100
+ },
1101
+ },
1102
+ '\u6E05\u7A7A',
1103
+ ),
1104
+ ),
1105
+ /*#__PURE__*/ React.createElement(
1106
+ 'ul',
1107
+ {
1108
+ className: 'select-menu-list',
1109
+ },
1110
+ checkedKeys.map(function (item, index) {
1111
+ var node = orgMapRef.current[item] || {};
1112
+ var path = node.path,
1113
+ name = node.name;
1114
+ var pathDisplayName = getOrgPathDisplayName(path);
1115
+ var disabled = rootNode.key === item;
1116
+ return /*#__PURE__*/ React.createElement(
1117
+ 'li',
1118
+ {
1119
+ key: item.value + index,
1120
+ className: 'select-menu-list-item',
1121
+ },
1122
+ /*#__PURE__*/ React.createElement(
1123
+ 'span',
1124
+ {
1125
+ className: 'org-name',
1126
+ },
1127
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1128
+ title: name,
1129
+ }),
1130
+ ),
1131
+ /*#__PURE__*/ React.createElement(
1132
+ 'span',
1133
+ {
1134
+ className: 'path-name',
1135
+ },
1136
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1137
+ title: pathDisplayName,
1138
+ }),
1139
+ ),
1140
+ !disabled &&
1141
+ /*#__PURE__*/ React.createElement(_Icon, {
1142
+ type: 'close',
1143
+ className: 'close-icon',
1144
+ onClick: function onClick() {
1145
+ return onRemoveSingleOrg(node);
1146
+ },
1147
+ }),
1148
+ );
1149
+ }) || /*#__PURE__*/ React.createElement(_Empty, null),
1150
+ ),
1151
+ ),
1152
+ ),
1153
+ ),
1154
+ /*#__PURE__*/ React.createElement(
1155
+ 'div',
1156
+ {
1157
+ className: 'app-panel panel',
1158
+ },
1159
+ /*#__PURE__*/ React.createElement(
1160
+ 'div',
1161
+ {
1162
+ className: 'menu-header',
1163
+ },
1164
+ /*#__PURE__*/ React.createElement(
1165
+ 'span',
1166
+ {
1167
+ className: 'title',
1168
+ },
1169
+ appTitle ||
1170
+ getText(
1171
+ 'authorizesAppList',
1172
+ props === null || props === void 0 ? void 0 : props.lang,
1173
+ ),
1174
+ ),
1175
+ /*#__PURE__*/ React.createElement(
1176
+ 'div',
1177
+ {
1178
+ className: 'menu-all-checked',
1179
+ },
1180
+ /*#__PURE__*/ React.createElement(
1181
+ _Checkbox,
1182
+ {
1183
+ onChange: checkedAllApp,
1184
+ checked: allAppChecked,
1185
+ disabled: disabled,
1186
+ },
1187
+ appCheckboxTitle ||
1188
+ getText(
1189
+ 'allAppAvailable',
1190
+ props === null || props === void 0 ? void 0 : props.lang,
1191
+ ),
1192
+ ),
1193
+ ),
1194
+ ),
1195
+ /*#__PURE__*/ React.createElement(
1196
+ 'div',
1197
+ {
1198
+ className: 'panel-menu-body',
1199
+ },
1200
+ /*#__PURE__*/ React.createElement(
1201
+ 'div',
1202
+ {
1203
+ className: 'panel-left',
1204
+ },
1205
+ /*#__PURE__*/ React.createElement(_Input, {
1206
+ onChange: function onChange(e) {
1207
+ debouncedAppSearch(e.target.value);
1208
+ },
1209
+ placehoalder: '\u8BF7\u8F93\u5165\u6E20\u9053\u540D\u79F0',
1210
+ size: 'small',
1211
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
1212
+ type: 'zoom',
1213
+ }),
1214
+ style: {
1215
+ marginBottom: 16,
1216
+ width: 'calc(100% - 16px)',
1217
+ },
1218
+ }),
1219
+ appListDomRender,
1220
+ ),
1221
+ /*#__PURE__*/ React.createElement(
1222
+ 'div',
1223
+ {
1224
+ className: 'panel-right',
1225
+ },
1226
+ /*#__PURE__*/ React.createElement(
1227
+ 'div',
1228
+ {
1229
+ className: 'select-menu-header',
1230
+ },
1231
+ /*#__PURE__*/ React.createElement(
1232
+ 'span',
1233
+ null,
1234
+ '\u5DF2\u9009: ',
1235
+ areadySelectApp.length || 0,
1236
+ ' \u4E2A\u6E20\u9053',
1237
+ ),
1238
+ /*#__PURE__*/ React.createElement(
1239
+ 'a',
1240
+ {
1241
+ onClick: function onClick() {
1242
+ return onRemoveAllApp();
1243
+ },
1244
+ },
1245
+ '\u6E05\u7A7A',
1246
+ ),
1247
+ ),
1248
+ /*#__PURE__*/ React.createElement(
1249
+ 'ul',
1250
+ {
1251
+ className: 'select-menu-list',
1252
+ },
1253
+ appKeys.map(function (item, index) {
1254
+ var node = appMapRef.current[item] || {};
1255
+ var value = node.value,
1256
+ label = node.label;
1257
+ var isOwnAppCode = appCode === value;
1258
+ if (!value && !label) return null; // 不显示多余数据
1259
+ return /*#__PURE__*/ React.createElement(
1260
+ 'li',
1261
+ {
1262
+ key: value + index,
1263
+ className: 'select-menu-list-item',
1264
+ },
1265
+ /*#__PURE__*/ React.createElement(
1266
+ 'span',
1267
+ {
1268
+ className: 'app-name',
1269
+ },
1270
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1271
+ title: label,
1272
+ }),
1273
+ ),
1274
+ !isOwnAppCode &&
1275
+ /*#__PURE__*/ React.createElement(_Icon, {
1276
+ type: 'close',
1277
+ className: 'close-icon',
1278
+ onClick: function onClick() {
1279
+ return onRemoveSingleApp(value);
1280
+ },
1281
+ }),
1282
+ );
1283
+ }) || /*#__PURE__*/ React.createElement(_Empty, null),
1284
+ ),
1285
+ ),
1286
+ ),
1287
+ ),
1288
+ !!showUser &&
1289
+ /*#__PURE__*/ React.createElement(
1290
+ 'div',
1291
+ {
1292
+ className: 'user-panel panel',
1293
+ },
1294
+ /*#__PURE__*/ React.createElement(
1295
+ 'div',
1296
+ {
1297
+ className: 'menu-header',
1298
+ },
1299
+ /*#__PURE__*/ React.createElement(
1300
+ 'span',
1301
+ {
1302
+ className: 'title',
1303
+ },
1304
+ userTitle ||
1305
+ getText(
1306
+ 'authorizesUserList',
1307
+ props === null || props === void 0 ? void 0 : props.lang,
1308
+ ),
1309
+ ),
1310
+ /*#__PURE__*/ React.createElement(
1311
+ 'div',
1312
+ {
1313
+ className: 'menu-all-checked',
1314
+ },
1315
+ /*#__PURE__*/ React.createElement(
1316
+ _Checkbox,
1317
+ {
1318
+ onChange: checkedAllUser,
1319
+ checked: allUserChecked,
1320
+ disabled: disabled,
1321
+ },
1322
+ userCheckboxTitle ||
1323
+ getText(
1324
+ 'allUserAvailable',
1325
+ props === null || props === void 0 ? void 0 : props.lang,
1326
+ ),
1327
+ ),
1328
+ ),
1329
+ ),
1330
+ /*#__PURE__*/ React.createElement(
1331
+ 'div',
1332
+ {
1333
+ className: 'panel-menu-body',
1334
+ },
1335
+ /*#__PURE__*/ React.createElement(
1336
+ 'div',
1337
+ {
1338
+ className: 'panel-left',
1339
+ },
1340
+ /*#__PURE__*/ React.createElement(_Input, {
1341
+ size: 'small',
1342
+ placeholder: getText(
1343
+ 'search',
1344
+ props === null || props === void 0 ? void 0 : props.lang,
1345
+ ),
1346
+ onChange: function onChange(e) {
1347
+ debouncedUserSearch(e.target.value);
1348
+ },
1349
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
1350
+ type: 'zoom',
1351
+ }),
1352
+ style: {
1353
+ marginBottom: 16,
1354
+ width: 'calc(100% - 16px)',
1355
+ },
1356
+ }),
1357
+ userListDomRender,
1358
+ ),
1359
+ /*#__PURE__*/ React.createElement(
1360
+ 'div',
1361
+ {
1362
+ className: 'panel-right',
1363
+ },
1364
+ /*#__PURE__*/ React.createElement(
1365
+ 'div',
1366
+ {
1367
+ className: 'select-menu-header',
1368
+ },
1369
+ /*#__PURE__*/ React.createElement(
1370
+ 'span',
1371
+ null,
1372
+ '\u5DF2\u9009: ',
1373
+ areadySelectUser.length || 0,
1374
+ ' \u4E2A\u7528\u6237',
1375
+ ),
1376
+ /*#__PURE__*/ React.createElement(
1377
+ 'a',
1378
+ {
1379
+ onClick: function onClick() {
1380
+ return onRemoveAllUser();
1381
+ },
1382
+ },
1383
+ '\u6E05\u7A7A',
1384
+ ),
1385
+ ),
1386
+ /*#__PURE__*/ React.createElement(
1387
+ 'ul',
1388
+ {
1389
+ className: 'select-menu-list',
1390
+ },
1391
+ userKeys.map(function (item, index) {
1392
+ var node = userMapRef.current[item] || {};
1393
+ var userName = node.userName;
1394
+ var isOwnAppCode = accounts === node.account;
1395
+ if (!userName && !node.account) return null; // 不显示多余数据
1396
+ return /*#__PURE__*/ React.createElement(
1397
+ 'li',
1398
+ {
1399
+ key: userName + index,
1400
+ className: 'select-menu-list-item',
1401
+ },
1402
+ /*#__PURE__*/ React.createElement(
1403
+ 'span',
1404
+ {
1405
+ className: 'app-name',
1406
+ },
1407
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1408
+ title: userName,
1409
+ }),
1410
+ ),
1411
+ !isOwnAppCode &&
1412
+ /*#__PURE__*/ React.createElement(_Icon, {
1413
+ type: 'close',
1414
+ className: 'close-icon',
1415
+ onClick: function onClick() {
1416
+ return onRemoveSingleUser(node.account);
1417
+ },
1418
+ }),
1419
+ );
1420
+ }) || /*#__PURE__*/ React.createElement(_Empty, null),
1421
+ ),
1422
+ ),
1423
+ ),
1424
+ ),
1425
+ ),
1426
+ ),
1427
+ );
1428
+ };
1429
+ export default AssignModal;