@tddc/assign-modal 3.0.5 → 3.0.7

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