@tddc/assign-modal 3.0.7 → 3.0.8

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