@tddc/assign-modal 3.0.7 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,162 @@
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";
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';
25
160
  import { useEffect, useState, useCallback, useRef, useMemo } from 'react';
26
161
  import { cloneDeep, debounce } from 'lodash';
27
162
  import './index.less';
@@ -47,7 +182,23 @@ var AssignModal = function AssignModal(props) {
47
182
  userList = _props$userList === void 0 ? [] : _props$userList,
48
183
  showUser = props.showUser,
49
184
  customOrgDisabled = props.customOrgDisabled,
50
- customAppDisabled = props.customAppDisabled;
185
+ customAppDisabled = props.customAppDisabled,
186
+ locale = props.locale;
187
+
188
+ // 封装 getText,自动传入 locale
189
+ var t = function t(key) {
190
+ for (
191
+ var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1;
192
+ _key < _len;
193
+ _key++
194
+ ) {
195
+ params[_key - 1] = arguments[_key];
196
+ }
197
+ return getText.apply(
198
+ void 0,
199
+ [key, props === null || props === void 0 ? void 0 : props.lang, locale].concat(params),
200
+ );
201
+ };
51
202
  var _dataItem$appCodes = dataItem.appCodes,
52
203
  appCodes = _dataItem$appCodes === void 0 ? [] : _dataItem$appCodes,
53
204
  _dataItem$orgCodes = dataItem.orgCodes,
@@ -61,25 +212,39 @@ var AssignModal = function AssignModal(props) {
61
212
  var appMapRef = useRef({});
62
213
  var userMapRef = useRef({});
63
214
  var rootNode = orgList[0];
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]),
215
+ var _useMemo = useMemo(
216
+ function () {
217
+ var org = preorder(
218
+ rootNode,
219
+ function (key, node) {
220
+ orgMapRef.current[key] = node;
221
+ },
222
+ true,
223
+ );
224
+ var app = appList.map(function (item) {
225
+ appMapRef.current[item.value] = item;
226
+ return item.value;
227
+ });
228
+ var user =
229
+ (userList === null || userList === void 0
230
+ ? void 0
231
+ : userList.map(function (item) {
232
+ userMapRef.current[item.account] = item;
233
+ return item.account;
234
+ })) || [];
235
+ return [org, app, user];
236
+ },
237
+ [rootNode, appList, userList],
238
+ ),
78
239
  _useMemo2 = _slicedToArray(_useMemo, 3),
79
240
  allOrg = _useMemo2[0],
80
241
  allApp = _useMemo2[1],
81
242
  allUser = _useMemo2[2];
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))];
243
+ var titleOptions = [
244
+ ''.concat(orgTitle || t('availableOrgs')),
245
+ ''.concat(appTitle || t('availableApps')),
246
+ ''.concat(userTitle || t('availableUsers')),
247
+ ];
83
248
  if (!showUser) {
84
249
  titleOptions.pop();
85
250
  }
@@ -133,87 +298,125 @@ var AssignModal = function AssignModal(props) {
133
298
  setFilterApp = _useState24[1];
134
299
  var gap = 335;
135
300
  var windowHeight = useWindowHeight(gap);
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;
301
+ useEffect(
302
+ function () {
303
+ var _Object$keys;
304
+ if (
305
+ dataItem &&
306
+ ((_Object$keys = Object.keys(dataItem)) === null || _Object$keys === void 0
307
+ ? void 0
308
+ : _Object$keys.length)
309
+ ) {
310
+ // path 和 allOrgList 赋值
311
+ path = findSameCodePath(rootNode, orgCode);
312
+ var initOrgs = [];
313
+ var initApps = [];
314
+ var initAccounts = [];
315
+ if (orgCodes.includes('all')) {
316
+ setAllOrgChecked(orgCodes.includes('all'));
317
+ initOrgs = allOrg;
160
318
  } else {
161
- initAccounts = Array.from(new Set([].concat(_toConsumableArray(accounts || []), [account])));
319
+ initOrgs = Array.from(
320
+ new Set([].concat(_toConsumableArray(orgCodes || []), _toConsumableArray(path))),
321
+ );
162
322
  }
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
323
+ if (appCodes.includes('all')) {
324
+ setAllAppChecked(appCodes.includes('all'));
325
+ initApps = allApp;
326
+ } else {
327
+ initApps = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
178
328
  }
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
- });
329
+ if (showUser) {
330
+ if (accounts.includes('all')) {
331
+ setAllUserChecked(true);
332
+ initAccounts = allUser;
333
+ } else {
334
+ initAccounts = Array.from(
335
+ new Set([].concat(_toConsumableArray(accounts || []), [account])),
336
+ );
196
337
  }
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)
338
+ }
339
+ setCheckedKeys(initOrgs);
340
+ setAppKeys(initApps || []);
341
+ setUserKeys(initAccounts || []);
342
+ onChange &&
343
+ onChange({
344
+ appKeys: appCodes.includes('all') ? ['all'] : initApps,
345
+ checkedKeys: orgCodes.includes('all') ? ['all'] : initOrgs,
346
+ userKeys: accounts.includes('all') ? ['all'] : initAccounts,
347
+ appCheckAll: appCodes.includes('all'),
348
+ orgCheckAll: orgCodes.includes('all'),
349
+ userCheckAll: accounts.includes('all'),
350
+ checkData: {
351
+ apps: initApps,
352
+ orgs: initOrgs,
353
+ accounts: initAccounts,
354
+ },
202
355
  });
203
- });
204
- };
205
- setTreeData(_loopTreeNodes(orgList, 0));
206
- }
207
- }, [orgList, allOrgChecked, allAppChecked, allUserChecked]);
356
+ }
357
+ },
358
+ [dataItem],
359
+ );
360
+ useEffect(
361
+ function () {
362
+ if (orgList) {
363
+ var _loopTreeNodes = function loopTreeNodes(nodes) {
364
+ var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
365
+ return nodes === null || nodes === void 0
366
+ ? void 0
367
+ : nodes.map(function (item) {
368
+ var orgDisabled = path.includes(item.code);
369
+ if (item.children && item.children.length > 0) {
370
+ return _objectSpread(
371
+ _objectSpread({}, item),
372
+ {},
373
+ {
374
+ key: item.code,
375
+ title: item.name,
376
+ value: item.code,
377
+ disabled:
378
+ orgDisabled ||
379
+ disabled ||
380
+ allOrgChecked ||
381
+ (customOrgDisabled && customOrgDisabled(item)),
382
+ children: _loopTreeNodes(item.children, level + 1),
383
+ },
384
+ );
385
+ }
386
+ return _objectSpread(
387
+ _objectSpread({}, item),
388
+ {},
389
+ {
390
+ key: item.code,
391
+ value: item.code,
392
+ title: item.name,
393
+ disabled:
394
+ orgDisabled ||
395
+ disabled ||
396
+ allOrgChecked ||
397
+ (customOrgDisabled && customOrgDisabled(item)),
398
+ },
399
+ );
400
+ });
401
+ };
402
+ setTreeData(_loopTreeNodes(orgList, 0));
403
+ }
404
+ },
405
+ [orgList, allOrgChecked, allAppChecked, allUserChecked],
406
+ );
208
407
  var onCheck = function onCheck() {
209
408
  var _node$childrenValues;
210
- for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {
211
- rest[_key] = arguments[_key];
409
+ for (var _len2 = arguments.length, rest = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
410
+ rest[_key2] = arguments[_key2];
212
411
  }
213
412
  var checked = rest[0],
214
413
  node = rest[1],
215
414
  isChecked = rest[2];
216
- var isLeaf = !(node === null || node === void 0 ? void 0 : (_node$childrenValues = node.childrenValues) === null || _node$childrenValues === void 0 ? void 0 : _node$childrenValues.length);
415
+ var isLeaf = !(node === null || node === void 0
416
+ ? void 0
417
+ : (_node$childrenValues = node.childrenValues) === null || _node$childrenValues === void 0
418
+ ? void 0
419
+ : _node$childrenValues.length);
217
420
  var curNode = orgMapRef.current[node.value] || {};
218
421
  var path = curNode.path;
219
422
  var newChecked = cloneDeep(checked);
@@ -242,8 +445,8 @@ var AssignModal = function AssignModal(props) {
242
445
  checkData: {
243
446
  apps: appKeys,
244
447
  orgs: newChecked,
245
- accounts: userKeys
246
- }
448
+ accounts: userKeys,
449
+ },
247
450
  });
248
451
  };
249
452
  var assignApp = function assignApp(e) {
@@ -272,8 +475,8 @@ var AssignModal = function AssignModal(props) {
272
475
  checkData: {
273
476
  apps: newAppKeys,
274
477
  orgs: checkedKeys,
275
- accounts: userKeys
276
- }
478
+ accounts: userKeys,
479
+ },
277
480
  });
278
481
  };
279
482
  var assignUser = function assignUser(e) {
@@ -302,8 +505,8 @@ var AssignModal = function AssignModal(props) {
302
505
  checkData: {
303
506
  apps: appKeys,
304
507
  orgs: checkedKeys,
305
- accounts: newUserKeys
306
- }
508
+ accounts: newUserKeys,
509
+ },
307
510
  });
308
511
  };
309
512
 
@@ -324,13 +527,15 @@ var AssignModal = function AssignModal(props) {
324
527
  checkData: {
325
528
  apps: appKeys,
326
529
  orgs: checkedKeys,
327
- accounts: accounts
328
- }
530
+ accounts: accounts,
531
+ },
329
532
  });
330
533
  } else {
331
534
  setAllOrgChecked(false);
332
535
  var arr = orgCodes.includes('all') ? allOrg : orgCodes;
333
- orgChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), _toConsumableArray(path))));
536
+ orgChecks = Array.from(
537
+ new Set([].concat(_toConsumableArray(arr || []), _toConsumableArray(path))),
538
+ );
334
539
  setCheckedKeys(orgChecks);
335
540
  onChange({
336
541
  appKeys: allAppChecked ? ['all'] : appKeys,
@@ -342,8 +547,8 @@ var AssignModal = function AssignModal(props) {
342
547
  checkData: {
343
548
  apps: appKeys,
344
549
  orgs: orgChecks,
345
- accounts: accounts
346
- }
550
+ accounts: accounts,
551
+ },
347
552
  });
348
553
  }
349
554
  };
@@ -367,8 +572,8 @@ var AssignModal = function AssignModal(props) {
367
572
  checkData: {
368
573
  apps: appChecks,
369
574
  orgs: checkedKeys,
370
- accounts: accounts
371
- }
575
+ accounts: accounts,
576
+ },
372
577
  });
373
578
  } else {
374
579
  setAllAppChecked(false);
@@ -385,8 +590,8 @@ var AssignModal = function AssignModal(props) {
385
590
  checkData: {
386
591
  apps: appChecks,
387
592
  orgs: checkedKeys,
388
- accounts: accounts
389
- }
593
+ accounts: accounts,
594
+ },
390
595
  });
391
596
  }
392
597
  };
@@ -410,8 +615,8 @@ var AssignModal = function AssignModal(props) {
410
615
  checkData: {
411
616
  apps: appKeys,
412
617
  orgs: checkedKeys,
413
- accounts: userChecks
414
- }
618
+ accounts: userChecks,
619
+ },
415
620
  });
416
621
  } else {
417
622
  setAllUserChecked(false);
@@ -428,29 +633,40 @@ var AssignModal = function AssignModal(props) {
428
633
  checkData: {
429
634
  apps: appKeys,
430
635
  orgs: checkedKeys,
431
- accounts: userChecks
432
- }
636
+ accounts: userChecks,
637
+ },
433
638
  });
434
639
  }
435
640
  };
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), []);
641
+ var debouncedOrgSearch = useCallback(
642
+ debounce(function (nextValue) {
643
+ setFilterOrg(nextValue);
644
+ }, 200),
645
+ [],
646
+ );
647
+ var debouncedUserSearch = useCallback(
648
+ debounce(function (nextValue) {
649
+ setFilterUser(nextValue);
650
+ }, 200),
651
+ [],
652
+ );
653
+ var debouncedAppSearch = useCallback(
654
+ debounce(function (nextValue) {
655
+ setFilterApp(nextValue);
656
+ }, 200),
657
+ [],
658
+ );
445
659
 
446
660
  // 拼接机构路径显示名
447
661
  var getOrgPathDisplayName = function getOrgPathDisplayName() {
448
662
  var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
449
663
  var displayName = '';
450
664
  if (path.length > 0) {
451
- displayName = path.map(function (item) {
452
- return orgMapRef.current[item].name;
453
- }).join(' / ');
665
+ displayName = path
666
+ .map(function (item) {
667
+ return orgMapRef.current[item].name;
668
+ })
669
+ .join(' / ');
454
670
  }
455
671
  return displayName;
456
672
  };
@@ -473,8 +689,8 @@ var AssignModal = function AssignModal(props) {
473
689
  checkData: {
474
690
  apps: appKeys,
475
691
  orgs: checked,
476
- accounts: userKeys
477
- }
692
+ accounts: userKeys,
693
+ },
478
694
  });
479
695
  };
480
696
 
@@ -493,8 +709,8 @@ var AssignModal = function AssignModal(props) {
493
709
  checkData: {
494
710
  apps: appKeys,
495
711
  orgs: checked,
496
- accounts: userKeys
497
- }
712
+ accounts: userKeys,
713
+ },
498
714
  });
499
715
  };
500
716
 
@@ -518,8 +734,8 @@ var AssignModal = function AssignModal(props) {
518
734
  checkData: {
519
735
  apps: newAppKeys,
520
736
  orgs: checkedKeys,
521
- accounts: userKeys
522
- }
737
+ accounts: userKeys,
738
+ },
523
739
  });
524
740
  };
525
741
  // 移除全部应用
@@ -537,8 +753,8 @@ var AssignModal = function AssignModal(props) {
537
753
  checkData: {
538
754
  apps: newAppKeys,
539
755
  orgs: checkedKeys,
540
- accounts: userKeys
541
- }
756
+ accounts: userKeys,
757
+ },
542
758
  });
543
759
  };
544
760
 
@@ -557,8 +773,8 @@ var AssignModal = function AssignModal(props) {
557
773
  checkData: {
558
774
  apps: appKeys,
559
775
  orgs: checkedKeys,
560
- accounts: newUserKeys
561
- }
776
+ accounts: newUserKeys,
777
+ },
562
778
  });
563
779
  };
564
780
 
@@ -582,350 +798,701 @@ var AssignModal = function AssignModal(props) {
582
798
  checkData: {
583
799
  apps: appKeys,
584
800
  orgs: checkedKeys,
585
- accounts: newUserKeys
586
- }
801
+ accounts: newUserKeys,
802
+ },
587
803
  });
588
804
  };
589
805
 
590
806
  // 已选择的机构列表
591
- var areadySelectOrg = useMemo(function () {
592
- return checkedKeys.filter(function (i) {
593
- return allOrg.includes(i);
594
- }) || [];
595
- }, [checkedKeys, allOrg]);
807
+ var areadySelectOrg = useMemo(
808
+ function () {
809
+ return (
810
+ checkedKeys.filter(function (i) {
811
+ return allOrg.includes(i);
812
+ }) || []
813
+ );
814
+ },
815
+ [checkedKeys, allOrg],
816
+ );
596
817
  // 已选择的渠道列表
597
- var areadySelectApp = useMemo(function () {
598
- return appKeys.filter(function (i) {
599
- return allApp.includes(i);
600
- }) || [];
601
- }, [appKeys, allApp]);
818
+ var areadySelectApp = useMemo(
819
+ function () {
820
+ return (
821
+ appKeys.filter(function (i) {
822
+ return allApp.includes(i);
823
+ }) || []
824
+ );
825
+ },
826
+ [appKeys, allApp],
827
+ );
602
828
  // 已选择的用户列表
603
- var areadySelectUser = useMemo(function () {
604
- return userKeys.filter(function (i) {
605
- return allUser.includes(i);
606
- }) || [];
607
- }, [userKeys, allUser]);
829
+ var areadySelectUser = useMemo(
830
+ function () {
831
+ return (
832
+ userKeys.filter(function (i) {
833
+ return allUser.includes(i);
834
+ }) || []
835
+ );
836
+ },
837
+ [userKeys, allUser],
838
+ );
608
839
 
609
840
  // 渲染App列表
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]);
841
+ var appListDomRender = useMemo(
842
+ function () {
843
+ return appList
844
+ .filter(function (i) {
845
+ var label = i.label,
846
+ value = i.value;
847
+ if (filterApp) {
848
+ return (
849
+ (label === null || label === void 0
850
+ ? void 0
851
+ : label
852
+ .toLocaleLowerCase()
853
+ .includes(
854
+ filterApp === null || filterApp === void 0
855
+ ? void 0
856
+ : filterApp.toLocaleLowerCase(),
857
+ )) ||
858
+ (value === null || value === void 0
859
+ ? void 0
860
+ : value
861
+ .toLocaleLowerCase()
862
+ .includes(
863
+ filterApp === null || filterApp === void 0
864
+ ? void 0
865
+ : filterApp.toLocaleLowerCase(),
866
+ ))
867
+ );
868
+ }
869
+ return i;
870
+ })
871
+ .map(function (item, index) {
872
+ var isCheck =
873
+ appKeys === null || appKeys === void 0 ? void 0 : appKeys.includes(item.value);
874
+ var isOwnAppCode = appCode === item.value;
875
+ return /*#__PURE__*/ React.createElement(
876
+ _Checkbox,
877
+ {
878
+ checked: isCheck,
879
+ disabled:
880
+ disabled ||
881
+ isOwnAppCode ||
882
+ allAppChecked ||
883
+ (customAppDisabled && customAppDisabled(item)),
884
+ onChange: assignApp,
885
+ value: item.value,
886
+ key: index,
887
+ },
888
+ /*#__PURE__*/ React.createElement(
889
+ 'span',
890
+ {
891
+ style: {
892
+ display: 'inline-block',
893
+ },
894
+ },
895
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
896
+ title: item.label,
897
+ }),
898
+ ),
899
+ );
900
+ });
901
+ },
902
+ [appList, appKeys, filterApp],
903
+ );
636
904
 
637
905
  // 渲染User列表
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]);
906
+ var userListDomRender = useMemo(
907
+ function () {
908
+ return (
909
+ (userList === null || userList === void 0
910
+ ? void 0
911
+ : userList
912
+ .filter(function (item) {
913
+ if (filterUser) {
914
+ var _item$account, _item$userName;
915
+ return (
916
+ (item === null || item === void 0
917
+ ? void 0
918
+ : (_item$account = item.account) === null || _item$account === void 0
919
+ ? void 0
920
+ : _item$account
921
+ .toLocaleLowerCase()
922
+ .includes(
923
+ filterUser === null || filterUser === void 0
924
+ ? void 0
925
+ : filterUser.toLocaleLowerCase(),
926
+ )) ||
927
+ (item === null || item === void 0
928
+ ? void 0
929
+ : (_item$userName = item.userName) === null || _item$userName === void 0
930
+ ? void 0
931
+ : _item$userName
932
+ .toLocaleLowerCase()
933
+ .includes(
934
+ filterUser === null || filterUser === void 0
935
+ ? void 0
936
+ : filterUser.toLocaleLowerCase(),
937
+ ))
938
+ );
939
+ }
940
+ return item;
941
+ })
942
+ .map(function (item, index) {
943
+ var isCheck =
944
+ userKeys === null || userKeys === void 0
945
+ ? void 0
946
+ : userKeys.includes(item.account);
947
+ var isOwnAccount = account === item.account;
948
+ return /*#__PURE__*/ React.createElement(
949
+ _Checkbox,
950
+ {
951
+ key: item + index,
952
+ checked: isCheck,
953
+ disabled: disabled || isOwnAccount || allUserChecked,
954
+ onChange: assignUser,
955
+ value: item.account,
956
+ },
957
+ /*#__PURE__*/ React.createElement(
958
+ 'span',
959
+ {
960
+ style: {
961
+ display: 'inline-block',
962
+ },
963
+ },
964
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
965
+ widthLimit: 240,
966
+ title: item.userName,
967
+ }),
968
+ ),
969
+ );
970
+ })) || /*#__PURE__*/ React.createElement(_Empty, null)
971
+ );
972
+ },
973
+ [userList, userKeys, filterUser],
974
+ );
664
975
  var renderOrgItem = function renderOrgItem(item, lang) {
665
976
  var mapResult = {
666
977
  1: {
667
978
  cn: '职能部门',
668
979
  en: 'Func. Dept.',
669
- icon: 'crowd'
980
+ icon: 'crowd',
670
981
  },
671
982
  2: {
672
- icon: 'corporation'
673
- }
983
+ icon: 'corporation',
984
+ },
674
985
  };
675
986
  var result = mapResult[item === null || item === void 0 ? void 0 : item.orgAttribute] || {};
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] || '职能部门'));
987
+ return /*#__PURE__*/ React.createElement(
988
+ 'div',
989
+ {
990
+ className: 'org-item-wrapper',
991
+ style: {
992
+ width: 'calc(100% - 32px)',
993
+ },
994
+ },
995
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
996
+ title: item.title,
997
+ widthLimit: String(item.orgAttribute) === '1' ? 'calc(100% - 90px}' : '100%',
998
+ }),
999
+ String(item.orgAttribute) === '1' &&
1000
+ /*#__PURE__*/ React.createElement(
1001
+ 'span',
1002
+ {
1003
+ className: 'org-functional-departemt-marker',
1004
+ },
1005
+ result[lang] || '职能部门',
1006
+ ),
1007
+ );
687
1008
  };
688
1009
  var defaultRenderItem = function defaultRenderItem(item) {
689
1010
  var isOrg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
690
1011
  if (isOrg) {
691
1012
  return renderOrgItem(item, props === null || props === void 0 ? void 0 : props.lang);
692
1013
  }
693
- return /*#__PURE__*/React.createElement(_Ellipsis, {
1014
+ return /*#__PURE__*/ React.createElement(_Ellipsis, {
694
1015
  title: item.title,
695
- widthLimit: '100%'
1016
+ widthLimit: '100%',
696
1017
  });
697
1018
  };
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);
748
- },
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'
759
- },
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);
1019
+ var canNotRemoveOrg = useMemo(
1020
+ function () {
1021
+ var _orgMapRef$current, _orgMapRef$current$ch;
1022
+ return (
1023
+ (checkedKeys === null || checkedKeys === void 0 ? void 0 : checkedKeys.length) === 1 &&
1024
+ ((_orgMapRef$current = orgMapRef.current) === null || _orgMapRef$current === void 0
1025
+ ? void 0
1026
+ : (_orgMapRef$current$ch = _orgMapRef$current[checkedKeys[0]]) === null ||
1027
+ _orgMapRef$current$ch === void 0
1028
+ ? void 0
1029
+ : _orgMapRef$current$ch.key) ===
1030
+ (rootNode === null || rootNode === void 0 ? void 0 : rootNode.key)
1031
+ );
830
1032
  },
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"
835
- }),
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);
1033
+ [checkedKeys],
1034
+ );
1035
+ var canNotRemoveApp = useMemo(
1036
+ function () {
1037
+ var _appMapRef$current, _appMapRef$current$ap;
1038
+ return (
1039
+ (appKeys === null || appKeys === void 0 ? void 0 : appKeys.length) === 1 &&
1040
+ ((_appMapRef$current = appMapRef.current) === null || _appMapRef$current === void 0
1041
+ ? void 0
1042
+ : (_appMapRef$current$ap = _appMapRef$current[appKeys[0]]) === null ||
1043
+ _appMapRef$current$ap === void 0
1044
+ ? void 0
1045
+ : _appMapRef$current$ap.name) === appCode
1046
+ );
892
1047
  },
893
- suffix: /*#__PURE__*/React.createElement(_Icon, {
894
- type: "zoom"
1048
+ [appKeys],
1049
+ );
1050
+ console.log(canNotRemoveOrg, 'canNotRemove');
1051
+ return /*#__PURE__*/ React.createElement(
1052
+ React.Fragment,
1053
+ null,
1054
+ /*#__PURE__*/ React.createElement(_Segmented, {
1055
+ className: 'menu-title',
1056
+ value: curValue,
1057
+ options: titleOptions,
1058
+ onChange: function onChange(index) {
1059
+ setCurValue(index);
1060
+ setCurIndex(
1061
+ titleOptions.findIndex(function (i) {
1062
+ return i === index;
1063
+ }),
1064
+ );
1065
+ },
895
1066
  }),
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))))))));
1067
+ /*#__PURE__*/ React.createElement(
1068
+ 'div',
1069
+ {
1070
+ className: 'assign-box-container',
1071
+ },
1072
+ /*#__PURE__*/ React.createElement(
1073
+ 'div',
1074
+ {
1075
+ className: 'slider panel-'.concat(curIndex),
1076
+ style: {
1077
+ width: !!showUser ? '300%' : '200%',
1078
+ },
1079
+ },
1080
+ /*#__PURE__*/ React.createElement(
1081
+ 'div',
1082
+ {
1083
+ className: 'org-panel panel',
1084
+ },
1085
+ /*#__PURE__*/ React.createElement(
1086
+ 'div',
1087
+ {
1088
+ className: 'menu-header',
1089
+ },
1090
+ /*#__PURE__*/ React.createElement(
1091
+ 'span',
1092
+ {
1093
+ className: 'title',
1094
+ },
1095
+ orgTitle || t('authorizesOrgList'),
1096
+ ),
1097
+ /*#__PURE__*/ React.createElement(
1098
+ 'div',
1099
+ {
1100
+ className: 'menu-all-checked',
1101
+ },
1102
+ /*#__PURE__*/ React.createElement(
1103
+ _Checkbox,
1104
+ {
1105
+ onChange: checkAllOrg,
1106
+ checked: allOrgChecked,
1107
+ disabled: disabled,
1108
+ },
1109
+ orgCheckboxTitle || t('allOrgAvailable'),
1110
+ ),
1111
+ ),
1112
+ ),
1113
+ /*#__PURE__*/ React.createElement(
1114
+ 'div',
1115
+ {
1116
+ className: 'panel-menu-body',
1117
+ },
1118
+ /*#__PURE__*/ React.createElement(
1119
+ 'div',
1120
+ {
1121
+ className: 'panel-left',
1122
+ style: {
1123
+ width: '60%',
1124
+ },
1125
+ },
1126
+ /*#__PURE__*/ React.createElement(_Input, {
1127
+ size: 'small',
1128
+ placeholder: t('search'),
1129
+ onChange: function onChange(e) {
1130
+ debouncedOrgSearch(e.target.value);
1131
+ },
1132
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
1133
+ type: 'zoom',
1134
+ }),
1135
+ style: {
1136
+ marginBottom: 16,
1137
+ width: 'calc(100% - 16px)',
1138
+ },
1139
+ }),
1140
+ /*#__PURE__*/ React.createElement(_TntdVirtualTree, {
1141
+ style: {
1142
+ overflowX: 'auto',
1143
+ },
1144
+ isOrg: true,
1145
+ treeData: treeData,
1146
+ filterKey: filterOrg,
1147
+ blockNode: true,
1148
+ checkable: true,
1149
+ checkStrictly: true,
1150
+ checkedKeys: checkedKeys,
1151
+ defaultExpandAll: true,
1152
+ onCheck: onCheck,
1153
+ height: windowHeight,
1154
+ titleRender: defaultRenderItem,
1155
+ }),
1156
+ ),
1157
+ /*#__PURE__*/ React.createElement(
1158
+ 'div',
1159
+ {
1160
+ className: 'panel-right',
1161
+ style: {
1162
+ width: '40%',
1163
+ },
1164
+ },
1165
+ /*#__PURE__*/ React.createElement(
1166
+ 'div',
1167
+ {
1168
+ className: 'select-menu-header',
1169
+ },
1170
+ /*#__PURE__*/ React.createElement(
1171
+ 'span',
1172
+ null,
1173
+ t('hasBeenSelected'),
1174
+ ': ',
1175
+ t('numOfOrg', areadySelectOrg.length || 0),
1176
+ ),
1177
+ /*#__PURE__*/ React.createElement(
1178
+ 'a',
1179
+ {
1180
+ className: canNotRemoveOrg ? 'disabeld' : '',
1181
+ onClick: function onClick() {
1182
+ return onRemoveAllOrg();
1183
+ },
1184
+ },
1185
+ t('clear'),
1186
+ ),
1187
+ ),
1188
+ /*#__PURE__*/ React.createElement(
1189
+ 'ul',
1190
+ {
1191
+ className: 'select-menu-list',
1192
+ },
1193
+ checkedKeys
1194
+ .filter(function (i) {
1195
+ return !!orgMapRef.current[i];
1196
+ })
1197
+ .map(function (item, index) {
1198
+ var node = orgMapRef.current[item] || {};
1199
+ var path = node.path,
1200
+ name = node.name;
1201
+ var pathDisplayName = getOrgPathDisplayName(path);
1202
+ var disabled = rootNode.key === item;
1203
+ return /*#__PURE__*/ React.createElement(
1204
+ 'li',
1205
+ {
1206
+ key: item.value + index,
1207
+ className: 'select-menu-list-item',
1208
+ },
1209
+ /*#__PURE__*/ React.createElement(
1210
+ 'span',
1211
+ {
1212
+ className: 'org-name',
1213
+ },
1214
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1215
+ title: name,
1216
+ }),
1217
+ ),
1218
+ /*#__PURE__*/ React.createElement(
1219
+ 'span',
1220
+ {
1221
+ className: 'path-name',
1222
+ },
1223
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1224
+ title: pathDisplayName,
1225
+ }),
1226
+ ),
1227
+ !disabled &&
1228
+ /*#__PURE__*/ React.createElement(_Icon, {
1229
+ type: 'close',
1230
+ className: 'close-icon',
1231
+ onClick: function onClick() {
1232
+ return onRemoveSingleOrg(node);
1233
+ },
1234
+ }),
1235
+ );
1236
+ }) || /*#__PURE__*/ React.createElement(_Empty, null),
1237
+ ),
1238
+ ),
1239
+ ),
1240
+ ),
1241
+ /*#__PURE__*/ React.createElement(
1242
+ 'div',
1243
+ {
1244
+ className: 'app-panel panel',
1245
+ },
1246
+ /*#__PURE__*/ React.createElement(
1247
+ 'div',
1248
+ {
1249
+ className: 'menu-header',
1250
+ },
1251
+ /*#__PURE__*/ React.createElement(
1252
+ 'span',
1253
+ {
1254
+ className: 'title',
1255
+ },
1256
+ appTitle || t('authorizesAppList'),
1257
+ ),
1258
+ /*#__PURE__*/ React.createElement(
1259
+ 'div',
1260
+ {
1261
+ className: 'menu-all-checked',
1262
+ },
1263
+ /*#__PURE__*/ React.createElement(
1264
+ _Checkbox,
1265
+ {
1266
+ onChange: checkedAllApp,
1267
+ checked: allAppChecked,
1268
+ disabled: disabled,
1269
+ },
1270
+ appCheckboxTitle || t('allAppAvailable'),
1271
+ ),
1272
+ ),
1273
+ ),
1274
+ /*#__PURE__*/ React.createElement(
1275
+ 'div',
1276
+ {
1277
+ className: 'panel-menu-body',
1278
+ },
1279
+ /*#__PURE__*/ React.createElement(
1280
+ 'div',
1281
+ {
1282
+ className: 'panel-left',
1283
+ },
1284
+ /*#__PURE__*/ React.createElement(_Input, {
1285
+ onChange: function onChange(e) {
1286
+ debouncedAppSearch(e.target.value);
1287
+ },
1288
+ placeholder: t('enterAppName'),
1289
+ size: 'small',
1290
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
1291
+ type: 'zoom',
1292
+ }),
1293
+ style: {
1294
+ marginBottom: 16,
1295
+ width: 'calc(100% - 16px)',
1296
+ },
1297
+ }),
1298
+ appListDomRender,
1299
+ ),
1300
+ /*#__PURE__*/ React.createElement(
1301
+ 'div',
1302
+ {
1303
+ className: 'panel-right',
1304
+ },
1305
+ /*#__PURE__*/ React.createElement(
1306
+ 'div',
1307
+ {
1308
+ className: 'select-menu-header',
1309
+ },
1310
+ /*#__PURE__*/ React.createElement(
1311
+ 'span',
1312
+ null,
1313
+ t('hasBeenSelected'),
1314
+ ': ',
1315
+ t('numOfApp', areadySelectApp.length || 0),
1316
+ ),
1317
+ /*#__PURE__*/ React.createElement(
1318
+ 'a',
1319
+ {
1320
+ className: canNotRemoveApp ? 'disabeld' : '',
1321
+ onClick: function onClick() {
1322
+ return onRemoveAllApp();
1323
+ },
1324
+ },
1325
+ t('clear'),
1326
+ ),
1327
+ ),
1328
+ /*#__PURE__*/ React.createElement(
1329
+ 'ul',
1330
+ {
1331
+ className: 'select-menu-list',
1332
+ },
1333
+ appKeys.map(function (item, index) {
1334
+ var node = appMapRef.current[item] || {};
1335
+ var value = node.value,
1336
+ label = node.label;
1337
+ var isOwnAppCode = appCode === value;
1338
+ if (!value && !label) return null; // 不显示多余数据
1339
+ return /*#__PURE__*/ React.createElement(
1340
+ 'li',
1341
+ {
1342
+ key: value + index,
1343
+ className: 'select-menu-list-item',
1344
+ },
1345
+ /*#__PURE__*/ React.createElement(
1346
+ 'span',
1347
+ {
1348
+ className: 'app-name',
1349
+ },
1350
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1351
+ title: label,
1352
+ }),
1353
+ ),
1354
+ !isOwnAppCode &&
1355
+ /*#__PURE__*/ React.createElement(_Icon, {
1356
+ type: 'close',
1357
+ className: 'close-icon',
1358
+ onClick: function onClick() {
1359
+ return onRemoveSingleApp(value);
1360
+ },
1361
+ }),
1362
+ );
1363
+ }) || /*#__PURE__*/ React.createElement(_Empty, null),
1364
+ ),
1365
+ ),
1366
+ ),
1367
+ ),
1368
+ !!showUser &&
1369
+ /*#__PURE__*/ React.createElement(
1370
+ 'div',
1371
+ {
1372
+ className: 'user-panel panel',
1373
+ },
1374
+ /*#__PURE__*/ React.createElement(
1375
+ 'div',
1376
+ {
1377
+ className: 'menu-header',
1378
+ },
1379
+ /*#__PURE__*/ React.createElement(
1380
+ 'span',
1381
+ {
1382
+ className: 'title',
1383
+ },
1384
+ userTitle || t('authorizesUserList'),
1385
+ ),
1386
+ /*#__PURE__*/ React.createElement(
1387
+ 'div',
1388
+ {
1389
+ className: 'menu-all-checked',
1390
+ },
1391
+ /*#__PURE__*/ React.createElement(
1392
+ _Checkbox,
1393
+ {
1394
+ onChange: checkedAllUser,
1395
+ checked: allUserChecked,
1396
+ disabled: disabled,
1397
+ },
1398
+ userCheckboxTitle || t('allUserAvailable'),
1399
+ ),
1400
+ ),
1401
+ ),
1402
+ /*#__PURE__*/ React.createElement(
1403
+ 'div',
1404
+ {
1405
+ className: 'panel-menu-body',
1406
+ },
1407
+ /*#__PURE__*/ React.createElement(
1408
+ 'div',
1409
+ {
1410
+ className: 'panel-left',
1411
+ },
1412
+ /*#__PURE__*/ React.createElement(_Input, {
1413
+ size: 'small',
1414
+ placeholder: t('enterUserName'),
1415
+ onChange: function onChange(e) {
1416
+ debouncedUserSearch(e.target.value);
1417
+ },
1418
+ suffix: /*#__PURE__*/ React.createElement(_Icon, {
1419
+ type: 'zoom',
1420
+ }),
1421
+ style: {
1422
+ marginBottom: 16,
1423
+ width: 'calc(100% - 16px)',
1424
+ },
1425
+ }),
1426
+ userListDomRender,
1427
+ ),
1428
+ /*#__PURE__*/ React.createElement(
1429
+ 'div',
1430
+ {
1431
+ className: 'panel-right',
1432
+ },
1433
+ /*#__PURE__*/ React.createElement(
1434
+ 'div',
1435
+ {
1436
+ className: 'select-menu-header',
1437
+ },
1438
+ /*#__PURE__*/ React.createElement(
1439
+ 'span',
1440
+ null,
1441
+ t('hasBeenSelected'),
1442
+ ': ',
1443
+ t('numOfUser', areadySelectUser.length || 0),
1444
+ ),
1445
+ /*#__PURE__*/ React.createElement(
1446
+ 'a',
1447
+ {
1448
+ onClick: function onClick() {
1449
+ return onRemoveAllOrg();
1450
+ },
1451
+ },
1452
+ t('clear'),
1453
+ ),
1454
+ ),
1455
+ /*#__PURE__*/ React.createElement(
1456
+ 'ul',
1457
+ {
1458
+ className: 'select-menu-list',
1459
+ },
1460
+ userKeys.map(function (item, index) {
1461
+ var node = userMapRef.current[item] || {};
1462
+ var userName = node.userName;
1463
+ var isOwnAppCode = accounts === node.account;
1464
+ if (!userName && !node.account) return null; // 不显示多余数据
1465
+ return /*#__PURE__*/ React.createElement(
1466
+ 'li',
1467
+ {
1468
+ key: userName + index,
1469
+ className: 'select-menu-list-item',
1470
+ },
1471
+ /*#__PURE__*/ React.createElement(
1472
+ 'span',
1473
+ {
1474
+ className: 'app-name',
1475
+ },
1476
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1477
+ title: userName,
1478
+ }),
1479
+ ),
1480
+ !isOwnAppCode &&
1481
+ /*#__PURE__*/ React.createElement(_Icon, {
1482
+ type: 'close',
1483
+ className: 'close-icon',
1484
+ onClick: function onClick() {
1485
+ return onRemoveSingleUser(node.account);
1486
+ },
1487
+ }),
1488
+ );
1489
+ }) || /*#__PURE__*/ React.createElement(_Empty, null),
1490
+ ),
1491
+ ),
1492
+ ),
1493
+ ),
1494
+ ),
1495
+ ),
1496
+ );
930
1497
  };
931
- export default AssignModal;
1498
+ export default AssignModal;