@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.
@@ -1,735 +1,9 @@
1
- import _Ellipsis from 'tntd/es/ellipsis';
2
- import _Checkbox from 'tntd/es/checkbox';
3
- import _Input from 'tntd/es/input';
4
- import _Tree from 'tntd/es/tree';
5
- function _toConsumableArray(arr) {
6
- return (
7
- _arrayWithoutHoles(arr) ||
8
- _iterableToArray(arr) ||
9
- _unsupportedIterableToArray(arr) ||
10
- _nonIterableSpread()
11
- );
12
- }
13
- function _nonIterableSpread() {
14
- throw new TypeError(
15
- 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
16
- );
17
- }
18
- function _iterableToArray(iter) {
19
- if (
20
- (typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) ||
21
- iter['@@iterator'] != null
22
- )
23
- return Array.from(iter);
24
- }
25
- function _arrayWithoutHoles(arr) {
26
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
27
- }
28
- function _slicedToArray(arr, i) {
29
- return (
30
- _arrayWithHoles(arr) ||
31
- _iterableToArrayLimit(arr, i) ||
32
- _unsupportedIterableToArray(arr, i) ||
33
- _nonIterableRest()
34
- );
35
- }
36
- function _nonIterableRest() {
37
- throw new TypeError(
38
- 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
39
- );
40
- }
41
- function _unsupportedIterableToArray(o, minLen) {
42
- if (!o) return;
43
- if (typeof o === 'string') return _arrayLikeToArray(o, minLen);
44
- var n = Object.prototype.toString.call(o).slice(8, -1);
45
- if (n === 'Object' && o.constructor) n = o.constructor.name;
46
- if (n === 'Map' || n === 'Set') return Array.from(o);
47
- if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
48
- return _arrayLikeToArray(o, minLen);
49
- }
50
- function _arrayLikeToArray(arr, len) {
51
- if (len == null || len > arr.length) len = arr.length;
52
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
53
- arr2[i] = arr[i];
54
- }
55
- return arr2;
56
- }
57
- function _iterableToArrayLimit(arr, i) {
58
- var _i =
59
- arr == null
60
- ? null
61
- : (typeof Symbol !== 'undefined' && arr[Symbol.iterator]) || arr['@@iterator'];
62
- if (_i == null) return;
63
- var _arr = [];
64
- var _n = true;
65
- var _d = false;
66
- var _s, _e;
67
- try {
68
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
69
- _arr.push(_s.value);
70
- if (i && _arr.length === i) break;
71
- }
72
- } catch (err) {
73
- _d = true;
74
- _e = err;
75
- } finally {
76
- try {
77
- if (!_n && _i['return'] != null) _i['return']();
78
- } finally {
79
- if (_d) throw _e;
80
- }
81
- }
82
- return _arr;
83
- }
84
- function _arrayWithHoles(arr) {
85
- if (Array.isArray(arr)) return arr;
86
- }
87
1
  import React from 'react';
88
- import { useEffect, useState, useCallback } from 'react';
89
- import { cloneDeep, debounce } from 'lodash';
90
- import './index.less';
91
- import { addPath, findSameCodePath, preorder } from './utils';
92
- import { getText } from '../../locale';
93
- var TreeNode = _Tree.TreeNode;
94
- var Search = _Input.Search;
95
- var path = []; // 上级机构到当前机构的路径
96
-
2
+ import View from './View';
3
+ import Edit from './Edit';
97
4
  var AssignModal = function AssignModal(props) {
98
- var _orgList$;
99
- var _props$orgList = props.orgList,
100
- orgList = _props$orgList === void 0 ? [] : _props$orgList,
101
- _props$dataItem = props.dataItem,
102
- dataItem = _props$dataItem === void 0 ? {} : _props$dataItem,
103
- disabled = props.disabled,
104
- appList = props.appList,
105
- onChange = props.onChange,
106
- orgTitle = props.orgTitle,
107
- appTitle = props.appTitle,
108
- userTitle = props.userTitle,
109
- orgCheckboxTitle = props.orgCheckboxTitle,
110
- appCheckboxTitle = props.appCheckboxTitle,
111
- userCheckboxTitle = props.userCheckboxTitle,
112
- _props$userList = props.userList,
113
- userList = _props$userList === void 0 ? [] : _props$userList,
114
- showUser = props.showUser;
115
- var _dataItem$appCodes = dataItem.appCodes,
116
- appCodes = _dataItem$appCodes === void 0 ? [] : _dataItem$appCodes,
117
- _dataItem$orgCodes = dataItem.orgCodes,
118
- orgCodes = _dataItem$orgCodes === void 0 ? [] : _dataItem$orgCodes,
119
- orgCode = dataItem.orgCode,
120
- appCode = dataItem.appCode,
121
- _dataItem$accounts = dataItem.accounts,
122
- accounts = _dataItem$accounts === void 0 ? [] : _dataItem$accounts,
123
- account = dataItem.account;
124
- var allOrg = preorder(orgList[0]);
125
- var allApp = appList.map(function (item) {
126
- return item.value;
127
- });
128
- var allUser =
129
- (userList === null || userList === void 0
130
- ? void 0
131
- : userList.map(function (item) {
132
- return item.account;
133
- })) || [];
134
- var _useState = useState([]),
135
- _useState2 = _slicedToArray(_useState, 2),
136
- checkedKeys = _useState2[0],
137
- setCheckedKeys = _useState2[1];
138
- var _useState3 = useState(appCodes || []),
139
- _useState4 = _slicedToArray(_useState3, 2),
140
- appKeys = _useState4[0],
141
- setAppKeys = _useState4[1];
142
- var _useState5 = useState(accounts || []),
143
- _useState6 = _slicedToArray(_useState5, 2),
144
- userKeys = _useState6[0],
145
- setUserKeys = _useState6[1];
146
- var _useState7 = useState(false),
147
- _useState8 = _slicedToArray(_useState7, 2),
148
- allOrgChecked = _useState8[0],
149
- setAllOrgChecked = _useState8[1];
150
- var _useState9 = useState(false),
151
- _useState10 = _slicedToArray(_useState9, 2),
152
- allAppChecked = _useState10[0],
153
- setAllAppChecked = _useState10[1];
154
- var _useState11 = useState(false),
155
- _useState12 = _slicedToArray(_useState11, 2),
156
- allUserChecked = _useState12[0],
157
- setAllUserChecked = _useState12[1];
158
- var _useState13 = useState(),
159
- _useState14 = _slicedToArray(_useState13, 2),
160
- filterUser = _useState14[0],
161
- setFilterUser = _useState14[1];
162
- if (!((_orgList$ = orgList[0]) === null || _orgList$ === void 0 ? void 0 : _orgList$.path)) {
163
- for (var i = 0; i < orgList.length; i++) {
164
- addPath(orgList[i], []); // 添加 上级机构到子机构的路径
165
- }
166
- }
167
-
168
- useEffect(
169
- function () {
170
- // path 和 allOrgList 赋值
171
- path = findSameCodePath(orgList, orgCode);
172
- var initOrgs = [];
173
- var initApps = [];
174
- var initAccounts = [];
175
- if (orgCodes.includes('all')) {
176
- setAllOrgChecked(orgCodes.includes('all'));
177
- initOrgs = allOrg;
178
- } else {
179
- initOrgs = Array.from(
180
- new Set([].concat(_toConsumableArray(orgCodes || []), _toConsumableArray(path))),
181
- );
182
- }
183
- if (appCodes.includes('all')) {
184
- setAllAppChecked(appCodes.includes('all'));
185
- initApps = allApp;
186
- } else {
187
- initApps = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
188
- }
189
- if (showUser) {
190
- if (accounts.includes('all')) {
191
- setAllUserChecked(true);
192
- initAccounts = allUser;
193
- } else {
194
- initAccounts = Array.from(
195
- new Set([].concat(_toConsumableArray(accounts || []), [account])),
196
- );
197
- }
198
- }
199
- setCheckedKeys(initOrgs);
200
- setAppKeys(initApps || []);
201
- setUserKeys(initAccounts || []);
202
- onChange &&
203
- onChange({
204
- appKeys: appCodes.includes('all') ? ['all'] : initApps,
205
- checkedKeys: orgCodes.includes('all') ? ['all'] : initOrgs,
206
- userKeys: accounts.includes('all') ? ['all'] : initAccounts,
207
- appCheckAll: appCodes.includes('all'),
208
- orgCheckAll: orgCodes.includes('all'),
209
- userCheckAll: accounts.includes('all'),
210
- checkData: {
211
- apps: initApps,
212
- orgs: initOrgs,
213
- accounts: initAccounts,
214
- },
215
- });
216
- },
217
- [dataItem],
218
- );
219
- var loopTreeNodes = function loopTreeNodes(data) {
220
- var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
221
- var NodeTitle = function NodeTitle(_ref) {
222
- var node = _ref.node;
223
- return /*#__PURE__*/ React.createElement(
224
- 'div',
225
- {
226
- className: 'node-title',
227
- },
228
- node.title,
229
- );
230
- };
231
- return data.map(function (item) {
232
- var orgDisabled = path.includes(item.code);
233
- if (item.children) {
234
- return /*#__PURE__*/ React.createElement(
235
- TreeNode,
236
- {
237
- key: item.code,
238
- title: /*#__PURE__*/ React.createElement(NodeTitle, {
239
- node: item,
240
- }),
241
- item: item,
242
- disabled: orgDisabled || disabled || allOrgChecked,
243
- },
244
- loopTreeNodes(item.children, level + 1),
245
- );
246
- }
247
- return /*#__PURE__*/ React.createElement(TreeNode, {
248
- style: {
249
- paddingLeft: ''.concat((level + 1) * 14, 'px'),
250
- marginLeft: '-'.concat(level * 14, 'px'),
251
- },
252
- key: item.code,
253
- title: /*#__PURE__*/ React.createElement(NodeTitle, {
254
- node: item,
255
- }),
256
- item: item,
257
- disabled: orgDisabled || disabled,
258
- });
259
- });
260
- };
261
- var onCheck = function onCheck(keys, info) {
262
- var props = info.node.props;
263
- var item = props.item;
264
- var path = item.path;
265
- var checked = keys.checked;
266
- if (!info.node.isLeaf() && !info.node.checked) {
267
- var arr = preorder(info.node.props.item);
268
- arr.splice(0, 1);
269
- arr.map(function (item) {
270
- var i = checked.findIndex(function (i) {
271
- return i === item;
272
- });
273
- if (i !== -1) checked.splice(i, 1);
274
- });
275
- }
276
- if (info.checked) {
277
- checked = Array.from(
278
- new Set([].concat(_toConsumableArray(checked), _toConsumableArray(path))),
279
- );
280
- }
281
- setCheckedKeys(checked);
282
- onChange({
283
- appKeys: allAppChecked ? ['all'] : appKeys,
284
- checkedKeys: checked,
285
- appCheckAll: allAppChecked,
286
- orgCheckAll: allOrgChecked,
287
- userKeys: allUserChecked ? ['all'] : userKeys,
288
- userCheckAll: allUserChecked,
289
- checkData: {
290
- apps: appKeys,
291
- orgs: checked,
292
- accounts: userKeys,
293
- },
294
- });
295
- };
296
- var assignApp = function assignApp(e) {
297
- var value = '';
298
- var newAppKeys = [];
299
- if (e.target.checked) {
300
- value = e.target.value;
301
- newAppKeys = [].concat(_toConsumableArray(appKeys), [value]);
302
- } else {
303
- value = e.target.value;
304
- newAppKeys = cloneDeep(appKeys);
305
- newAppKeys.map(function (item, index) {
306
- if (value === item) {
307
- newAppKeys.splice(index, 1);
308
- }
309
- });
310
- }
311
- setAppKeys(newAppKeys);
312
- onChange({
313
- appKeys: newAppKeys,
314
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
315
- appCheckAll: allAppChecked,
316
- orgCheckAll: allOrgChecked,
317
- userKeys: allUserChecked ? ['all'] : userKeys,
318
- userCheckAll: allUserChecked,
319
- checkData: {
320
- apps: newAppKeys,
321
- orgs: checkedKeys,
322
- accounts: userKeys,
323
- },
324
- });
325
- };
326
- var assignUser = function assignUser(e) {
327
- var value = '';
328
- var newUserKeys = [];
329
- if (e.target.checked) {
330
- value = e.target.value;
331
- newUserKeys = [].concat(_toConsumableArray(userKeys), [value]);
332
- } else {
333
- value = e.target.value;
334
- newUserKeys = cloneDeep(userKeys);
335
- newUserKeys.map(function (item, index) {
336
- if (value === item) {
337
- newUserKeys.splice(index, 1);
338
- }
339
- });
340
- }
341
- setUserKeys(newUserKeys);
342
- onChange({
343
- appKeys: appKeys,
344
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
345
- appCheckAll: allAppChecked,
346
- orgCheckAll: allOrgChecked,
347
- userKeys: newUserKeys,
348
- userCheckAll: allUserChecked,
349
- checkData: {
350
- apps: appKeys,
351
- orgs: checkedKeys,
352
- accounts: newUserKeys,
353
- },
354
- });
355
- };
356
-
357
- // org全局授权
358
- var checkAllOrg = function checkAllOrg(e) {
359
- var orgChecks = [];
360
- if (e.target.checked) {
361
- setAllOrgChecked(true);
362
- orgChecks = preorder(orgList[0]);
363
- setCheckedKeys(orgChecks);
364
- onChange({
365
- appKeys: allAppChecked ? ['all'] : appKeys,
366
- checkedKeys: ['all'],
367
- appCheckAll: allAppChecked,
368
- orgCheckAll: true,
369
- userKeys: allUserChecked ? ['all'] : userKeys,
370
- userCheckAll: allUserChecked,
371
- checkData: {
372
- apps: appKeys,
373
- orgs: checkedKeys,
374
- accounts: accounts,
375
- },
376
- });
377
- } else {
378
- setAllOrgChecked(false);
379
- var arr = orgCodes.includes('all') ? allOrg : orgCodes;
380
- orgChecks = Array.from(
381
- new Set([].concat(_toConsumableArray(arr || []), _toConsumableArray(path))),
382
- );
383
- setCheckedKeys(orgChecks);
384
- onChange({
385
- appKeys: allAppChecked ? ['all'] : appKeys,
386
- checkedKeys: orgChecks,
387
- appCheckAll: allAppChecked,
388
- orgCheckAll: false,
389
- userKeys: allUserChecked ? ['all'] : userKeys,
390
- userCheckAll: allUserChecked,
391
- checkData: {
392
- apps: appKeys,
393
- orgs: orgChecks,
394
- accounts: accounts,
395
- },
396
- });
397
- }
398
- };
399
-
400
- // app全局授权
401
- var checkedAllApp = function checkedAllApp(e) {
402
- var appChecks = [];
403
- if (e.target.checked) {
404
- setAllAppChecked(true);
405
- appChecks = appList.map(function (item) {
406
- return item.value;
407
- });
408
- setAppKeys(appChecks);
409
- onChange({
410
- appKeys: ['all'],
411
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
412
- appCheckAll: true,
413
- orgCheckAll: allOrgChecked,
414
- userKeys: allUserChecked ? ['all'] : userKeys,
415
- userCheckAll: allUserChecked,
416
- checkData: {
417
- apps: appChecks,
418
- orgs: checkedKeys,
419
- accounts: accounts,
420
- },
421
- });
422
- } else {
423
- setAllAppChecked(false);
424
- var arr = appCodes.includes('all') ? allApp : appCodes;
425
- appChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), [appCode])));
426
- setAppKeys(appChecks);
427
- onChange({
428
- appKeys: appChecks,
429
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
430
- appCheckAll: false,
431
- orgCheckAll: allOrgChecked,
432
- userKeys: allUserChecked ? ['all'] : userKeys,
433
- userCheckAll: allUserChecked,
434
- checkData: {
435
- apps: appChecks,
436
- orgs: checkedKeys,
437
- accounts: accounts,
438
- },
439
- });
440
- }
441
- };
442
-
443
- // account全局授权
444
- var checkedAllUser = function checkedAllUser(e) {
445
- var userChecks = [];
446
- if (e.target.checked) {
447
- setAllUserChecked(true);
448
- userChecks = userList.map(function (item) {
449
- return item.account;
450
- });
451
- setUserKeys(userChecks);
452
- onChange({
453
- appKeys: allAppChecked ? ['all'] : appKeys,
454
- appCheckAll: allAppChecked,
455
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
456
- orgCheckAll: allOrgChecked,
457
- userKeys: ['all'],
458
- userCheckAll: true,
459
- checkData: {
460
- apps: appKeys,
461
- orgs: checkedKeys,
462
- accounts: userChecks,
463
- },
464
- });
465
- } else {
466
- setAllUserChecked(false);
467
- var arr = accounts.includes('all') ? allUser : accounts;
468
- userChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), [account])));
469
- setUserKeys(userChecks);
470
- onChange({
471
- appKeys: allAppChecked ? ['all'] : appKeys,
472
- appCheckAll: allAppChecked,
473
- checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
474
- orgCheckAll: allOrgChecked,
475
- userKeys: userChecks,
476
- userCheckAll: false,
477
- checkData: {
478
- apps: appKeys,
479
- orgs: checkedKeys,
480
- accounts: userChecks,
481
- },
482
- });
483
- }
484
- };
485
- var debouncedSearch = useCallback(
486
- debounce(function (nextValue) {
487
- setFilterUser(nextValue);
488
- }, 200),
489
- [],
490
- );
491
- return /*#__PURE__*/ React.createElement(
492
- 'div',
493
- {
494
- className: 'assign-box-container',
495
- },
496
- /*#__PURE__*/ React.createElement(
497
- 'div',
498
- {
499
- className: 'left',
500
- },
501
- /*#__PURE__*/ React.createElement(
502
- 'div',
503
- {
504
- className: 'menu-header',
505
- },
506
- orgTitle ||
507
- getText('authorizesOrgList', props === null || props === void 0 ? void 0 : props.lang),
508
- /*#__PURE__*/ React.createElement(
509
- 'div',
510
- {
511
- className: 'menu-all-checked',
512
- },
513
- /*#__PURE__*/ React.createElement(
514
- _Checkbox,
515
- {
516
- onChange: checkAllOrg,
517
- checked: allOrgChecked,
518
- disabled: disabled,
519
- },
520
- orgCheckboxTitle ||
521
- getText('allOrgAvailable', props === null || props === void 0 ? void 0 : props.lang),
522
- ),
523
- ),
524
- ),
525
- /*#__PURE__*/ React.createElement(
526
- _Tree,
527
- {
528
- blockNode: true,
529
- className: 'tree-list',
530
- checkable: true,
531
- checkStrictly: true,
532
- checkedKeys: checkedKeys,
533
- defaultExpandAll: true,
534
- onCheck: onCheck,
535
- disabled: true,
536
- },
537
- loopTreeNodes(orgList, 0),
538
- ),
539
- ),
540
- /*#__PURE__*/ React.createElement(
541
- 'div',
542
- {
543
- className: 'right',
544
- },
545
- /*#__PURE__*/ React.createElement(
546
- 'div',
547
- {
548
- className: 'menu-header',
549
- },
550
- appTitle ||
551
- getText('authorizesAppList', props === null || props === void 0 ? void 0 : props.lang),
552
- /*#__PURE__*/ React.createElement(
553
- 'div',
554
- {
555
- className: 'menu-all-checked',
556
- },
557
- /*#__PURE__*/ React.createElement(
558
- _Checkbox,
559
- {
560
- onChange: checkedAllApp,
561
- checked: allAppChecked,
562
- disabled: disabled,
563
- },
564
- appCheckboxTitle ||
565
- getText('allAppAvailable', props === null || props === void 0 ? void 0 : props.lang),
566
- ),
567
- ),
568
- ),
569
- /*#__PURE__*/ React.createElement(
570
- 'div',
571
- {
572
- className: 'menu-body',
573
- },
574
- appList.map(function (item, index) {
575
- var isCheck =
576
- appKeys === null || appKeys === void 0 ? void 0 : appKeys.includes(item.value);
577
- var isOwnAppCode = appCode === item.value;
578
- return /*#__PURE__*/ React.createElement(
579
- _Checkbox,
580
- {
581
- checked: isCheck,
582
- disabled: disabled || isOwnAppCode || allAppChecked,
583
- onChange: assignApp,
584
- value: item.value,
585
- key: index,
586
- },
587
- /*#__PURE__*/ React.createElement(
588
- 'span',
589
- {
590
- style: {
591
- display: 'inline-block',
592
- },
593
- },
594
- /*#__PURE__*/ React.createElement(_Ellipsis, {
595
- widthLimit: 100,
596
- title: item.label,
597
- }),
598
- ),
599
- );
600
- }),
601
- ),
602
- ),
603
- !!showUser &&
604
- /*#__PURE__*/ React.createElement(
605
- 'div',
606
- {
607
- className: 'user',
608
- },
609
- /*#__PURE__*/ React.createElement(
610
- 'div',
611
- {
612
- className: 'menu-header',
613
- },
614
- userTitle ||
615
- getText('authorizesUserList', props === null || props === void 0 ? void 0 : props.lang),
616
- /*#__PURE__*/ React.createElement(
617
- 'div',
618
- {
619
- className: 'menu-all-checked',
620
- },
621
- /*#__PURE__*/ React.createElement(
622
- _Checkbox,
623
- {
624
- onChange: checkedAllUser,
625
- checked: allUserChecked,
626
- disabled: disabled,
627
- },
628
- userCheckboxTitle ||
629
- getText(
630
- 'allUserAvailable',
631
- props === null || props === void 0 ? void 0 : props.lang,
632
- ),
633
- ),
634
- ),
635
- ),
636
- /*#__PURE__*/ React.createElement(
637
- 'div',
638
- {
639
- className: 'menu-body',
640
- },
641
- /*#__PURE__*/ React.createElement(
642
- 'div',
643
- {
644
- className: 'assign-search-wrap',
645
- },
646
- /*#__PURE__*/ React.createElement(Search, {
647
- size: 'small',
648
- allowClear: true,
649
- placeholder: getText(
650
- 'search',
651
- props === null || props === void 0 ? void 0 : props.lang,
652
- ),
653
- onChange: function onChange(e) {
654
- debouncedSearch(e.target.value);
655
- },
656
- onSearch: function onSearch(v) {
657
- setFilterUser(v);
658
- },
659
- style: {
660
- width: '90%',
661
- },
662
- }),
663
- ),
664
- userList === null || userList === void 0
665
- ? void 0
666
- : userList
667
- .filter(function (item) {
668
- if (filterUser) {
669
- var _item$account, _item$userName;
670
- return (
671
- (item === null || item === void 0
672
- ? void 0
673
- : (_item$account = item.account) === null || _item$account === void 0
674
- ? void 0
675
- : _item$account
676
- .toLocaleLowerCase()
677
- .includes(
678
- filterUser === null || filterUser === void 0
679
- ? void 0
680
- : filterUser.toLocaleLowerCase(),
681
- )) ||
682
- (item === null || item === void 0
683
- ? void 0
684
- : (_item$userName = item.userName) === null || _item$userName === void 0
685
- ? void 0
686
- : _item$userName
687
- .toLocaleLowerCase()
688
- .includes(
689
- filterUser === null || filterUser === void 0
690
- ? void 0
691
- : filterUser.toLocaleLowerCase(),
692
- ))
693
- );
694
- } else {
695
- return item;
696
- }
697
- })
698
- .map(function (item, index) {
699
- var isCheck =
700
- userKeys === null || userKeys === void 0
701
- ? void 0
702
- : userKeys.includes(item.account);
703
- var isOwnAccount = account === item.account;
704
- return /*#__PURE__*/ React.createElement(
705
- 'div',
706
- null,
707
- /*#__PURE__*/ React.createElement(
708
- _Checkbox,
709
- {
710
- checked: isCheck,
711
- disabled: disabled || isOwnAccount || allUserChecked,
712
- onChange: assignUser,
713
- value: item.account,
714
- key: index,
715
- },
716
- /*#__PURE__*/ React.createElement(
717
- 'span',
718
- {
719
- style: {
720
- display: 'inline-block',
721
- },
722
- },
723
- /*#__PURE__*/ React.createElement(_Ellipsis, {
724
- widthLimit: 240,
725
- title: item.userName,
726
- }),
727
- ),
728
- ),
729
- );
730
- }),
731
- ),
732
- ),
733
- );
5
+ return props.disabled
6
+ ? /*#__PURE__*/ React.createElement(View, props)
7
+ : /*#__PURE__*/ React.createElement(Edit, props);
734
8
  };
735
9
  export default AssignModal;