@tddc/assign-modal 1.2.4 → 2.0.0
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.
- package/{lib → es}/AssignModal/AssignApp/index.js +94 -185
- package/{lib → es}/AssignModal/AssignApp/utils.js +3 -12
- package/{lib → es}/AssignModal/index.js +34 -112
- package/es/index.js +1 -0
- package/{lib → es}/locale.js +7 -21
- package/package.json +19 -21
- package/lib/index.js +0 -15
- /package/{lib → es}/AssignModal/AssignApp/index.less +0 -0
- /package/{lib → es}/AssignModal/index.less +0 -0
|
@@ -1,80 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return (
|
|
6
|
-
(_typeof =
|
|
7
|
-
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
|
|
8
|
-
? function (obj) {
|
|
9
|
-
return typeof obj;
|
|
10
|
-
}
|
|
11
|
-
: function (obj) {
|
|
12
|
-
return obj &&
|
|
13
|
-
'function' == typeof Symbol &&
|
|
14
|
-
obj.constructor === Symbol &&
|
|
15
|
-
obj !== Symbol.prototype
|
|
16
|
-
? 'symbol'
|
|
17
|
-
: typeof obj;
|
|
18
|
-
}),
|
|
19
|
-
_typeof(obj)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
Object.defineProperty(exports, '__esModule', {
|
|
23
|
-
value: true,
|
|
24
|
-
});
|
|
25
|
-
exports.default = void 0;
|
|
26
|
-
require('antd/lib/checkbox/style');
|
|
27
|
-
var _checkbox = _interopRequireDefault(require('antd/lib/checkbox'));
|
|
28
|
-
require('antd/lib/input/style');
|
|
29
|
-
var _input = _interopRequireDefault(require('antd/lib/input'));
|
|
30
|
-
require('antd/lib/tree/style');
|
|
31
|
-
var _tree = _interopRequireDefault(require('antd/lib/tree'));
|
|
32
|
-
var _react = _interopRequireWildcard(require('react'));
|
|
33
|
-
var _tntd = require('tntd');
|
|
34
|
-
var _lodash = require('lodash');
|
|
35
|
-
require('./index.less');
|
|
36
|
-
var _utils = require('./utils');
|
|
37
|
-
var _locale = require('../../locale');
|
|
38
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
39
|
-
if (typeof WeakMap !== 'function') return null;
|
|
40
|
-
var cacheBabelInterop = new WeakMap();
|
|
41
|
-
var cacheNodeInterop = new WeakMap();
|
|
42
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
|
|
43
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
44
|
-
})(nodeInterop);
|
|
45
|
-
}
|
|
46
|
-
function _interopRequireWildcard(obj, nodeInterop) {
|
|
47
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
48
|
-
return obj;
|
|
49
|
-
}
|
|
50
|
-
if (obj === null || (_typeof(obj) !== 'object' && typeof obj !== 'function')) {
|
|
51
|
-
return { default: obj };
|
|
52
|
-
}
|
|
53
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
54
|
-
if (cache && cache.has(obj)) {
|
|
55
|
-
return cache.get(obj);
|
|
56
|
-
}
|
|
57
|
-
var newObj = {};
|
|
58
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
59
|
-
for (var key in obj) {
|
|
60
|
-
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
61
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
62
|
-
if (desc && (desc.get || desc.set)) {
|
|
63
|
-
Object.defineProperty(newObj, key, desc);
|
|
64
|
-
} else {
|
|
65
|
-
newObj[key] = obj[key];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
newObj.default = obj;
|
|
70
|
-
if (cache) {
|
|
71
|
-
cache.set(obj, newObj);
|
|
72
|
-
}
|
|
73
|
-
return newObj;
|
|
74
|
-
}
|
|
75
|
-
function _interopRequireDefault(obj) {
|
|
76
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
77
|
-
}
|
|
1
|
+
import _Ellipsis from 'tntd/es/ellipsis';
|
|
2
|
+
import _Checkbox from 'tntd/es/checkbox';
|
|
3
|
+
import _Input from 'tntd/es/input';
|
|
4
|
+
import _Tree from 'tntd/es/tree';
|
|
78
5
|
function _toConsumableArray(arr) {
|
|
79
6
|
return (
|
|
80
7
|
_arrayWithoutHoles(arr) ||
|
|
@@ -125,46 +52,45 @@ function _arrayLikeToArray(arr, len) {
|
|
|
125
52
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
126
53
|
return arr2;
|
|
127
54
|
}
|
|
128
|
-
function _iterableToArrayLimit(
|
|
129
|
-
var
|
|
130
|
-
null ==
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
_n = !0,
|
|
140
|
-
_d = !1;
|
|
55
|
+
function _iterableToArrayLimit(r, l) {
|
|
56
|
+
var t =
|
|
57
|
+
null == r ? null : ('undefined' != typeof Symbol && r[Symbol.iterator]) || r['@@iterator'];
|
|
58
|
+
if (null != t) {
|
|
59
|
+
var e,
|
|
60
|
+
n,
|
|
61
|
+
i,
|
|
62
|
+
u,
|
|
63
|
+
a = [],
|
|
64
|
+
f = !0,
|
|
65
|
+
o = !1;
|
|
141
66
|
try {
|
|
142
|
-
if (((
|
|
143
|
-
if (Object(
|
|
144
|
-
|
|
145
|
-
} else
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i);
|
|
149
|
-
_n = !0
|
|
150
|
-
);
|
|
151
|
-
} catch (err) {
|
|
152
|
-
(_d = !0), (_e = err);
|
|
67
|
+
if (((i = (t = t.call(r)).next), 0 === l)) {
|
|
68
|
+
if (Object(t) !== t) return;
|
|
69
|
+
f = !1;
|
|
70
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
71
|
+
} catch (r) {
|
|
72
|
+
(o = !0), (n = r);
|
|
153
73
|
} finally {
|
|
154
74
|
try {
|
|
155
|
-
if (!
|
|
75
|
+
if (!f && null != t.return && ((u = t.return()), Object(u) !== u)) return;
|
|
156
76
|
} finally {
|
|
157
|
-
if (
|
|
77
|
+
if (o) throw n;
|
|
158
78
|
}
|
|
159
79
|
}
|
|
160
|
-
return
|
|
80
|
+
return a;
|
|
161
81
|
}
|
|
162
82
|
}
|
|
163
83
|
function _arrayWithHoles(arr) {
|
|
164
84
|
if (Array.isArray(arr)) return arr;
|
|
165
85
|
}
|
|
166
|
-
|
|
167
|
-
|
|
86
|
+
import React from 'react';
|
|
87
|
+
import { useEffect, useState, useCallback } from 'react';
|
|
88
|
+
import { cloneDeep, debounce } from 'lodash';
|
|
89
|
+
import './index.less';
|
|
90
|
+
import { addPath, findSameCodePath, preorder } from './utils';
|
|
91
|
+
import { getText } from '../../locale';
|
|
92
|
+
var TreeNode = _Tree.TreeNode;
|
|
93
|
+
var Search = _Input.Search;
|
|
168
94
|
var path = []; // 上级机构到当前机构的路径
|
|
169
95
|
|
|
170
96
|
var AssignModal = function AssignModal(props) {
|
|
@@ -194,7 +120,7 @@ var AssignModal = function AssignModal(props) {
|
|
|
194
120
|
_dataItem$accounts = dataItem.accounts,
|
|
195
121
|
accounts = _dataItem$accounts === void 0 ? [] : _dataItem$accounts,
|
|
196
122
|
account = dataItem.account;
|
|
197
|
-
var allOrg =
|
|
123
|
+
var allOrg = preorder(orgList[0]);
|
|
198
124
|
var allApp = appList.map(function (item) {
|
|
199
125
|
return item.value;
|
|
200
126
|
});
|
|
@@ -204,42 +130,41 @@ var AssignModal = function AssignModal(props) {
|
|
|
204
130
|
: userList.map(function (item) {
|
|
205
131
|
return item.account;
|
|
206
132
|
})) || [];
|
|
207
|
-
var _useState =
|
|
133
|
+
var _useState = useState([]),
|
|
208
134
|
_useState2 = _slicedToArray(_useState, 2),
|
|
209
135
|
checkedKeys = _useState2[0],
|
|
210
136
|
setCheckedKeys = _useState2[1];
|
|
211
|
-
var _useState3 =
|
|
137
|
+
var _useState3 = useState(appCodes || []),
|
|
212
138
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
213
139
|
appKeys = _useState4[0],
|
|
214
140
|
setAppKeys = _useState4[1];
|
|
215
|
-
var _useState5 =
|
|
141
|
+
var _useState5 = useState(accounts || []),
|
|
216
142
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
217
143
|
userKeys = _useState6[0],
|
|
218
144
|
setUserKeys = _useState6[1];
|
|
219
|
-
var _useState7 =
|
|
145
|
+
var _useState7 = useState(false),
|
|
220
146
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
221
147
|
allOrgChecked = _useState8[0],
|
|
222
148
|
setAllOrgChecked = _useState8[1];
|
|
223
|
-
var _useState9 =
|
|
149
|
+
var _useState9 = useState(false),
|
|
224
150
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
225
151
|
allAppChecked = _useState10[0],
|
|
226
152
|
setAllAppChecked = _useState10[1];
|
|
227
|
-
var _useState11 =
|
|
153
|
+
var _useState11 = useState(false),
|
|
228
154
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
229
155
|
allUserChecked = _useState12[0],
|
|
230
156
|
setAllUserChecked = _useState12[1];
|
|
231
|
-
var _useState13 =
|
|
157
|
+
var _useState13 = useState(),
|
|
232
158
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
233
159
|
filterUser = _useState14[0],
|
|
234
160
|
setFilterUser = _useState14[1];
|
|
235
161
|
if (!((_orgList$ = orgList[0]) === null || _orgList$ === void 0 ? void 0 : _orgList$.path)) {
|
|
236
|
-
|
|
162
|
+
addPath(orgList[0], []); // 添加 上级机构到子机构的路径
|
|
237
163
|
}
|
|
238
|
-
|
|
239
|
-
(0, _react.useEffect)(
|
|
164
|
+
useEffect(
|
|
240
165
|
function () {
|
|
241
166
|
// path 和 allOrgList 赋值
|
|
242
|
-
path =
|
|
167
|
+
path = findSameCodePath(orgList[0], orgCode);
|
|
243
168
|
var initOrgs = [];
|
|
244
169
|
var initApps = [];
|
|
245
170
|
var initAccounts = [];
|
|
@@ -291,7 +216,7 @@ var AssignModal = function AssignModal(props) {
|
|
|
291
216
|
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
292
217
|
var NodeTitle = function NodeTitle(_ref) {
|
|
293
218
|
var node = _ref.node;
|
|
294
|
-
return /*#__PURE__*/
|
|
219
|
+
return /*#__PURE__*/ React.createElement(
|
|
295
220
|
'div',
|
|
296
221
|
{
|
|
297
222
|
className: 'node-title',
|
|
@@ -302,11 +227,11 @@ var AssignModal = function AssignModal(props) {
|
|
|
302
227
|
return data.map(function (item) {
|
|
303
228
|
var orgDisabled = path.includes(item.code);
|
|
304
229
|
if (item.children) {
|
|
305
|
-
return /*#__PURE__*/
|
|
230
|
+
return /*#__PURE__*/ React.createElement(
|
|
306
231
|
TreeNode,
|
|
307
232
|
{
|
|
308
233
|
key: item.code,
|
|
309
|
-
title: /*#__PURE__*/
|
|
234
|
+
title: /*#__PURE__*/ React.createElement(NodeTitle, {
|
|
310
235
|
node: item,
|
|
311
236
|
}),
|
|
312
237
|
item: item,
|
|
@@ -315,13 +240,13 @@ var AssignModal = function AssignModal(props) {
|
|
|
315
240
|
loopTreeNodes(item.children, level + 1),
|
|
316
241
|
);
|
|
317
242
|
}
|
|
318
|
-
return /*#__PURE__*/
|
|
243
|
+
return /*#__PURE__*/ React.createElement(TreeNode, {
|
|
319
244
|
style: {
|
|
320
245
|
paddingLeft: ''.concat((level + 1) * 14, 'px'),
|
|
321
246
|
marginLeft: '-'.concat(level * 14, 'px'),
|
|
322
247
|
},
|
|
323
248
|
key: item.code,
|
|
324
|
-
title: /*#__PURE__*/
|
|
249
|
+
title: /*#__PURE__*/ React.createElement(NodeTitle, {
|
|
325
250
|
node: item,
|
|
326
251
|
}),
|
|
327
252
|
item: item,
|
|
@@ -335,7 +260,7 @@ var AssignModal = function AssignModal(props) {
|
|
|
335
260
|
var path = item.path;
|
|
336
261
|
var checked = keys.checked;
|
|
337
262
|
if (!info.node.isLeaf() && !info.node.checked) {
|
|
338
|
-
var arr =
|
|
263
|
+
var arr = preorder(info.node.props.item);
|
|
339
264
|
arr.splice(0, 1);
|
|
340
265
|
arr.map(function (item) {
|
|
341
266
|
var i = checked.findIndex(function (i) {
|
|
@@ -372,7 +297,7 @@ var AssignModal = function AssignModal(props) {
|
|
|
372
297
|
newAppKeys = [].concat(_toConsumableArray(appKeys), [value]);
|
|
373
298
|
} else {
|
|
374
299
|
value = e.target.value;
|
|
375
|
-
newAppKeys =
|
|
300
|
+
newAppKeys = cloneDeep(appKeys);
|
|
376
301
|
newAppKeys.map(function (item, index) {
|
|
377
302
|
if (value === item) {
|
|
378
303
|
newAppKeys.splice(index, 1);
|
|
@@ -402,7 +327,7 @@ var AssignModal = function AssignModal(props) {
|
|
|
402
327
|
newUserKeys = [].concat(_toConsumableArray(userKeys), [value]);
|
|
403
328
|
} else {
|
|
404
329
|
value = e.target.value;
|
|
405
|
-
newUserKeys =
|
|
330
|
+
newUserKeys = cloneDeep(userKeys);
|
|
406
331
|
newUserKeys.map(function (item, index) {
|
|
407
332
|
if (value === item) {
|
|
408
333
|
newUserKeys.splice(index, 1);
|
|
@@ -415,7 +340,7 @@ var AssignModal = function AssignModal(props) {
|
|
|
415
340
|
checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
|
|
416
341
|
appCheckAll: allAppChecked,
|
|
417
342
|
orgCheckAll: allOrgChecked,
|
|
418
|
-
userKeys:
|
|
343
|
+
userKeys: newUserKeys,
|
|
419
344
|
userCheckAll: allUserChecked,
|
|
420
345
|
checkData: {
|
|
421
346
|
apps: appKeys,
|
|
@@ -430,7 +355,7 @@ var AssignModal = function AssignModal(props) {
|
|
|
430
355
|
var orgChecks = [];
|
|
431
356
|
if (e.target.checked) {
|
|
432
357
|
setAllOrgChecked(true);
|
|
433
|
-
orgChecks =
|
|
358
|
+
orgChecks = preorder(orgList[0]);
|
|
434
359
|
setCheckedKeys(orgChecks);
|
|
435
360
|
onChange({
|
|
436
361
|
appKeys: allAppChecked ? ['all'] : appKeys,
|
|
@@ -553,54 +478,48 @@ var AssignModal = function AssignModal(props) {
|
|
|
553
478
|
});
|
|
554
479
|
}
|
|
555
480
|
};
|
|
556
|
-
var debouncedSearch =
|
|
557
|
-
|
|
481
|
+
var debouncedSearch = useCallback(
|
|
482
|
+
debounce(function (nextValue) {
|
|
558
483
|
setFilterUser(nextValue);
|
|
559
484
|
}, 200),
|
|
560
485
|
[],
|
|
561
486
|
);
|
|
562
|
-
return /*#__PURE__*/
|
|
487
|
+
return /*#__PURE__*/ React.createElement(
|
|
563
488
|
'div',
|
|
564
489
|
{
|
|
565
490
|
className: 'assign-box-container',
|
|
566
491
|
},
|
|
567
|
-
/*#__PURE__*/
|
|
492
|
+
/*#__PURE__*/ React.createElement(
|
|
568
493
|
'div',
|
|
569
494
|
{
|
|
570
495
|
className: 'left',
|
|
571
496
|
},
|
|
572
|
-
/*#__PURE__*/
|
|
497
|
+
/*#__PURE__*/ React.createElement(
|
|
573
498
|
'div',
|
|
574
499
|
{
|
|
575
500
|
className: 'menu-header',
|
|
576
501
|
},
|
|
577
502
|
orgTitle ||
|
|
578
|
-
(
|
|
579
|
-
|
|
580
|
-
props === null || props === void 0 ? void 0 : props.lang,
|
|
581
|
-
),
|
|
582
|
-
/*#__PURE__*/ _react.default.createElement(
|
|
503
|
+
getText('authorizesOrgList', props === null || props === void 0 ? void 0 : props.lang),
|
|
504
|
+
/*#__PURE__*/ React.createElement(
|
|
583
505
|
'div',
|
|
584
506
|
{
|
|
585
507
|
className: 'menu-all-checked',
|
|
586
508
|
},
|
|
587
|
-
/*#__PURE__*/
|
|
588
|
-
|
|
509
|
+
/*#__PURE__*/ React.createElement(
|
|
510
|
+
_Checkbox,
|
|
589
511
|
{
|
|
590
512
|
onChange: checkAllOrg,
|
|
591
513
|
checked: allOrgChecked,
|
|
592
514
|
disabled: disabled,
|
|
593
515
|
},
|
|
594
516
|
orgCheckboxTitle ||
|
|
595
|
-
(
|
|
596
|
-
'allOrgAvailable',
|
|
597
|
-
props === null || props === void 0 ? void 0 : props.lang,
|
|
598
|
-
),
|
|
517
|
+
getText('allOrgAvailable', props === null || props === void 0 ? void 0 : props.lang),
|
|
599
518
|
),
|
|
600
519
|
),
|
|
601
520
|
),
|
|
602
|
-
/*#__PURE__*/
|
|
603
|
-
|
|
521
|
+
/*#__PURE__*/ React.createElement(
|
|
522
|
+
_Tree,
|
|
604
523
|
{
|
|
605
524
|
blockNode: true,
|
|
606
525
|
className: 'tree-list',
|
|
@@ -614,42 +533,36 @@ var AssignModal = function AssignModal(props) {
|
|
|
614
533
|
loopTreeNodes(orgList, 0),
|
|
615
534
|
),
|
|
616
535
|
),
|
|
617
|
-
/*#__PURE__*/
|
|
536
|
+
/*#__PURE__*/ React.createElement(
|
|
618
537
|
'div',
|
|
619
538
|
{
|
|
620
539
|
className: 'right',
|
|
621
540
|
},
|
|
622
|
-
/*#__PURE__*/
|
|
541
|
+
/*#__PURE__*/ React.createElement(
|
|
623
542
|
'div',
|
|
624
543
|
{
|
|
625
544
|
className: 'menu-header',
|
|
626
545
|
},
|
|
627
546
|
appTitle ||
|
|
628
|
-
(
|
|
629
|
-
|
|
630
|
-
props === null || props === void 0 ? void 0 : props.lang,
|
|
631
|
-
),
|
|
632
|
-
/*#__PURE__*/ _react.default.createElement(
|
|
547
|
+
getText('authorizesAppList', props === null || props === void 0 ? void 0 : props.lang),
|
|
548
|
+
/*#__PURE__*/ React.createElement(
|
|
633
549
|
'div',
|
|
634
550
|
{
|
|
635
551
|
className: 'menu-all-checked',
|
|
636
552
|
},
|
|
637
|
-
/*#__PURE__*/
|
|
638
|
-
|
|
553
|
+
/*#__PURE__*/ React.createElement(
|
|
554
|
+
_Checkbox,
|
|
639
555
|
{
|
|
640
556
|
onChange: checkedAllApp,
|
|
641
557
|
checked: allAppChecked,
|
|
642
558
|
disabled: disabled,
|
|
643
559
|
},
|
|
644
560
|
appCheckboxTitle ||
|
|
645
|
-
(
|
|
646
|
-
'allAppAvailable',
|
|
647
|
-
props === null || props === void 0 ? void 0 : props.lang,
|
|
648
|
-
),
|
|
561
|
+
getText('allAppAvailable', props === null || props === void 0 ? void 0 : props.lang),
|
|
649
562
|
),
|
|
650
563
|
),
|
|
651
564
|
),
|
|
652
|
-
/*#__PURE__*/
|
|
565
|
+
/*#__PURE__*/ React.createElement(
|
|
653
566
|
'div',
|
|
654
567
|
{
|
|
655
568
|
className: 'menu-body',
|
|
@@ -658,8 +571,8 @@ var AssignModal = function AssignModal(props) {
|
|
|
658
571
|
var isCheck =
|
|
659
572
|
appKeys === null || appKeys === void 0 ? void 0 : appKeys.includes(item.value);
|
|
660
573
|
var isOwnAppCode = appCode === item.value;
|
|
661
|
-
return /*#__PURE__*/
|
|
662
|
-
|
|
574
|
+
return /*#__PURE__*/ React.createElement(
|
|
575
|
+
_Checkbox,
|
|
663
576
|
{
|
|
664
577
|
checked: isCheck,
|
|
665
578
|
disabled: disabled || isOwnAppCode || allAppChecked,
|
|
@@ -667,14 +580,14 @@ var AssignModal = function AssignModal(props) {
|
|
|
667
580
|
value: item.value,
|
|
668
581
|
key: index,
|
|
669
582
|
},
|
|
670
|
-
/*#__PURE__*/
|
|
583
|
+
/*#__PURE__*/ React.createElement(
|
|
671
584
|
'span',
|
|
672
585
|
{
|
|
673
586
|
style: {
|
|
674
587
|
display: 'inline-block',
|
|
675
588
|
},
|
|
676
589
|
},
|
|
677
|
-
/*#__PURE__*/
|
|
590
|
+
/*#__PURE__*/ React.createElement(_Ellipsis, {
|
|
678
591
|
widthLimit: 100,
|
|
679
592
|
title: item.label,
|
|
680
593
|
}),
|
|
@@ -684,55 +597,52 @@ var AssignModal = function AssignModal(props) {
|
|
|
684
597
|
),
|
|
685
598
|
),
|
|
686
599
|
!!showUser &&
|
|
687
|
-
/*#__PURE__*/
|
|
600
|
+
/*#__PURE__*/ React.createElement(
|
|
688
601
|
'div',
|
|
689
602
|
{
|
|
690
603
|
className: 'user',
|
|
691
604
|
},
|
|
692
|
-
/*#__PURE__*/
|
|
605
|
+
/*#__PURE__*/ React.createElement(
|
|
693
606
|
'div',
|
|
694
607
|
{
|
|
695
608
|
className: 'menu-header',
|
|
696
609
|
},
|
|
697
610
|
userTitle ||
|
|
698
|
-
(
|
|
699
|
-
|
|
700
|
-
props === null || props === void 0 ? void 0 : props.lang,
|
|
701
|
-
),
|
|
702
|
-
/*#__PURE__*/ _react.default.createElement(
|
|
611
|
+
getText('authorizesUserList', props === null || props === void 0 ? void 0 : props.lang),
|
|
612
|
+
/*#__PURE__*/ React.createElement(
|
|
703
613
|
'div',
|
|
704
614
|
{
|
|
705
615
|
className: 'menu-all-checked',
|
|
706
616
|
},
|
|
707
|
-
/*#__PURE__*/
|
|
708
|
-
|
|
617
|
+
/*#__PURE__*/ React.createElement(
|
|
618
|
+
_Checkbox,
|
|
709
619
|
{
|
|
710
620
|
onChange: checkedAllUser,
|
|
711
621
|
checked: allUserChecked,
|
|
712
622
|
disabled: disabled,
|
|
713
623
|
},
|
|
714
624
|
userCheckboxTitle ||
|
|
715
|
-
|
|
625
|
+
getText(
|
|
716
626
|
'allUserAvailable',
|
|
717
627
|
props === null || props === void 0 ? void 0 : props.lang,
|
|
718
628
|
),
|
|
719
629
|
),
|
|
720
630
|
),
|
|
721
631
|
),
|
|
722
|
-
/*#__PURE__*/
|
|
632
|
+
/*#__PURE__*/ React.createElement(
|
|
723
633
|
'div',
|
|
724
634
|
{
|
|
725
635
|
className: 'menu-body',
|
|
726
636
|
},
|
|
727
|
-
/*#__PURE__*/
|
|
637
|
+
/*#__PURE__*/ React.createElement(
|
|
728
638
|
'div',
|
|
729
639
|
{
|
|
730
640
|
className: 'assign-search-wrap',
|
|
731
641
|
},
|
|
732
|
-
/*#__PURE__*/
|
|
642
|
+
/*#__PURE__*/ React.createElement(Search, {
|
|
733
643
|
size: 'small',
|
|
734
644
|
allowClear: true,
|
|
735
|
-
placeholder:
|
|
645
|
+
placeholder: getText(
|
|
736
646
|
'search',
|
|
737
647
|
props === null || props === void 0 ? void 0 : props.lang,
|
|
738
648
|
),
|
|
@@ -787,11 +697,11 @@ var AssignModal = function AssignModal(props) {
|
|
|
787
697
|
? void 0
|
|
788
698
|
: userKeys.includes(item.account);
|
|
789
699
|
var isOwnAccount = account === item.account;
|
|
790
|
-
return /*#__PURE__*/
|
|
700
|
+
return /*#__PURE__*/ React.createElement(
|
|
791
701
|
'div',
|
|
792
702
|
null,
|
|
793
|
-
/*#__PURE__*/
|
|
794
|
-
|
|
703
|
+
/*#__PURE__*/ React.createElement(
|
|
704
|
+
_Checkbox,
|
|
795
705
|
{
|
|
796
706
|
checked: isCheck,
|
|
797
707
|
disabled: disabled || isOwnAccount || allUserChecked,
|
|
@@ -799,14 +709,14 @@ var AssignModal = function AssignModal(props) {
|
|
|
799
709
|
value: item.account,
|
|
800
710
|
key: index,
|
|
801
711
|
},
|
|
802
|
-
/*#__PURE__*/
|
|
712
|
+
/*#__PURE__*/ React.createElement(
|
|
803
713
|
'span',
|
|
804
714
|
{
|
|
805
715
|
style: {
|
|
806
716
|
display: 'inline-block',
|
|
807
717
|
},
|
|
808
718
|
},
|
|
809
|
-
/*#__PURE__*/
|
|
719
|
+
/*#__PURE__*/ React.createElement(_Ellipsis, {
|
|
810
720
|
widthLimit: 240,
|
|
811
721
|
title: item.userName,
|
|
812
722
|
}),
|
|
@@ -818,5 +728,4 @@ var AssignModal = function AssignModal(props) {
|
|
|
818
728
|
),
|
|
819
729
|
);
|
|
820
730
|
};
|
|
821
|
-
|
|
822
|
-
exports.default = _default;
|
|
731
|
+
export default AssignModal;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true,
|
|
5
|
-
});
|
|
6
|
-
exports.preorder = exports.findSameCodePath = exports.addPath = void 0;
|
|
7
1
|
function _toConsumableArray(arr) {
|
|
8
2
|
return (
|
|
9
3
|
_arrayWithoutHoles(arr) ||
|
|
@@ -42,7 +36,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
42
36
|
return arr2;
|
|
43
37
|
}
|
|
44
38
|
// 遍历机构树 添加 path属性 (上级机构到子机构的路径)
|
|
45
|
-
var addPath = function addPath(root) {
|
|
39
|
+
export var addPath = function addPath(root) {
|
|
46
40
|
var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
47
41
|
if (!root) {
|
|
48
42
|
return;
|
|
@@ -55,8 +49,7 @@ var addPath = function addPath(root) {
|
|
|
55
49
|
};
|
|
56
50
|
|
|
57
51
|
// 遍历寻找 当前规则集所属机构
|
|
58
|
-
|
|
59
|
-
var findSameCodePath = function findSameCodePath(root, code) {
|
|
52
|
+
export var findSameCodePath = function findSameCodePath(root, code) {
|
|
60
53
|
var res = {};
|
|
61
54
|
var dfs = function dfs(root, code) {
|
|
62
55
|
if (!root) {
|
|
@@ -72,8 +65,7 @@ var findSameCodePath = function findSameCodePath(root, code) {
|
|
|
72
65
|
};
|
|
73
66
|
|
|
74
67
|
// 遍历输出 orgCode;
|
|
75
|
-
|
|
76
|
-
var preorder = function preorder(root) {
|
|
68
|
+
export var preorder = function preorder(root) {
|
|
77
69
|
var res = [];
|
|
78
70
|
var dfs = function dfs(root) {
|
|
79
71
|
var res = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -88,4 +80,3 @@ var preorder = function preorder(root) {
|
|
|
88
80
|
dfs(root, res);
|
|
89
81
|
return res;
|
|
90
82
|
};
|
|
91
|
-
exports.preorder = preorder;
|
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) {
|
|
4
|
-
'@babel/helpers - typeof';
|
|
5
|
-
return (
|
|
6
|
-
(_typeof =
|
|
7
|
-
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
|
|
8
|
-
? function (obj) {
|
|
9
|
-
return typeof obj;
|
|
10
|
-
}
|
|
11
|
-
: function (obj) {
|
|
12
|
-
return obj &&
|
|
13
|
-
'function' == typeof Symbol &&
|
|
14
|
-
obj.constructor === Symbol &&
|
|
15
|
-
obj !== Symbol.prototype
|
|
16
|
-
? 'symbol'
|
|
17
|
-
: typeof obj;
|
|
18
|
-
}),
|
|
19
|
-
_typeof(obj)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
Object.defineProperty(exports, '__esModule', {
|
|
23
|
-
value: true,
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, 'AssignApp', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function get() {
|
|
28
|
-
return _AssignApp.default;
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
exports.default = void 0;
|
|
32
|
-
require('antd/lib/modal/style');
|
|
33
|
-
var _modal = _interopRequireDefault(require('antd/lib/modal'));
|
|
34
|
-
var _react = _interopRequireWildcard(require('react'));
|
|
35
|
-
var _AssignApp = _interopRequireDefault(require('./AssignApp'));
|
|
36
|
-
require('./index.less');
|
|
37
|
-
var _universalCookie = _interopRequireDefault(require('universal-cookie'));
|
|
1
|
+
import _Modal from 'tntd/es/modal';
|
|
38
2
|
var _excluded = [
|
|
39
3
|
'visible',
|
|
40
4
|
'orgList',
|
|
@@ -47,46 +11,6 @@ var _excluded = [
|
|
|
47
11
|
'userList',
|
|
48
12
|
'showUser',
|
|
49
13
|
];
|
|
50
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
51
|
-
if (typeof WeakMap !== 'function') return null;
|
|
52
|
-
var cacheBabelInterop = new WeakMap();
|
|
53
|
-
var cacheNodeInterop = new WeakMap();
|
|
54
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
|
|
55
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
56
|
-
})(nodeInterop);
|
|
57
|
-
}
|
|
58
|
-
function _interopRequireWildcard(obj, nodeInterop) {
|
|
59
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
60
|
-
return obj;
|
|
61
|
-
}
|
|
62
|
-
if (obj === null || (_typeof(obj) !== 'object' && typeof obj !== 'function')) {
|
|
63
|
-
return { default: obj };
|
|
64
|
-
}
|
|
65
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
66
|
-
if (cache && cache.has(obj)) {
|
|
67
|
-
return cache.get(obj);
|
|
68
|
-
}
|
|
69
|
-
var newObj = {};
|
|
70
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
71
|
-
for (var key in obj) {
|
|
72
|
-
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
73
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
74
|
-
if (desc && (desc.get || desc.set)) {
|
|
75
|
-
Object.defineProperty(newObj, key, desc);
|
|
76
|
-
} else {
|
|
77
|
-
newObj[key] = obj[key];
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
newObj.default = obj;
|
|
82
|
-
if (cache) {
|
|
83
|
-
cache.set(obj, newObj);
|
|
84
|
-
}
|
|
85
|
-
return newObj;
|
|
86
|
-
}
|
|
87
|
-
function _interopRequireDefault(obj) {
|
|
88
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
89
|
-
}
|
|
90
14
|
function _extends() {
|
|
91
15
|
_extends = Object.assign
|
|
92
16
|
? Object.assign.bind()
|
|
@@ -130,39 +54,32 @@ function _arrayLikeToArray(arr, len) {
|
|
|
130
54
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
131
55
|
return arr2;
|
|
132
56
|
}
|
|
133
|
-
function _iterableToArrayLimit(
|
|
134
|
-
var
|
|
135
|
-
null ==
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
_n = !0,
|
|
145
|
-
_d = !1;
|
|
57
|
+
function _iterableToArrayLimit(r, l) {
|
|
58
|
+
var t =
|
|
59
|
+
null == r ? null : ('undefined' != typeof Symbol && r[Symbol.iterator]) || r['@@iterator'];
|
|
60
|
+
if (null != t) {
|
|
61
|
+
var e,
|
|
62
|
+
n,
|
|
63
|
+
i,
|
|
64
|
+
u,
|
|
65
|
+
a = [],
|
|
66
|
+
f = !0,
|
|
67
|
+
o = !1;
|
|
146
68
|
try {
|
|
147
|
-
if (((
|
|
148
|
-
if (Object(
|
|
149
|
-
|
|
150
|
-
} else
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i);
|
|
154
|
-
_n = !0
|
|
155
|
-
);
|
|
156
|
-
} catch (err) {
|
|
157
|
-
(_d = !0), (_e = err);
|
|
69
|
+
if (((i = (t = t.call(r)).next), 0 === l)) {
|
|
70
|
+
if (Object(t) !== t) return;
|
|
71
|
+
f = !1;
|
|
72
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
73
|
+
} catch (r) {
|
|
74
|
+
(o = !0), (n = r);
|
|
158
75
|
} finally {
|
|
159
76
|
try {
|
|
160
|
-
if (!
|
|
77
|
+
if (!f && null != t.return && ((u = t.return()), Object(u) !== u)) return;
|
|
161
78
|
} finally {
|
|
162
|
-
if (
|
|
79
|
+
if (o) throw n;
|
|
163
80
|
}
|
|
164
81
|
}
|
|
165
|
-
return
|
|
82
|
+
return a;
|
|
166
83
|
}
|
|
167
84
|
}
|
|
168
85
|
function _arrayWithHoles(arr) {
|
|
@@ -195,7 +112,12 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
195
112
|
}
|
|
196
113
|
return target;
|
|
197
114
|
}
|
|
198
|
-
|
|
115
|
+
import React from 'react';
|
|
116
|
+
import { useState } from 'react';
|
|
117
|
+
import AssignApp from './AssignApp';
|
|
118
|
+
import './index.less';
|
|
119
|
+
import Cookies from 'universal-cookie';
|
|
120
|
+
var cookies = new Cookies();
|
|
199
121
|
var AssignModal = function AssignModal(props) {
|
|
200
122
|
var visible = props.visible,
|
|
201
123
|
orgList = props.orgList,
|
|
@@ -210,7 +132,7 @@ var AssignModal = function AssignModal(props) {
|
|
|
210
132
|
userList = props.userList,
|
|
211
133
|
showUser = props.showUser,
|
|
212
134
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
213
|
-
var _useState =
|
|
135
|
+
var _useState = useState({}),
|
|
214
136
|
_useState2 = _slicedToArray(_useState, 2),
|
|
215
137
|
assignData = _useState2[0],
|
|
216
138
|
setAssignData = _useState2[1];
|
|
@@ -220,8 +142,8 @@ var AssignModal = function AssignModal(props) {
|
|
|
220
142
|
});
|
|
221
143
|
onSubmit(assignData);
|
|
222
144
|
};
|
|
223
|
-
return /*#__PURE__*/
|
|
224
|
-
|
|
145
|
+
return /*#__PURE__*/ React.createElement(
|
|
146
|
+
_Modal,
|
|
225
147
|
{
|
|
226
148
|
className: 'modelTool-assign',
|
|
227
149
|
title: title,
|
|
@@ -235,8 +157,8 @@ var AssignModal = function AssignModal(props) {
|
|
|
235
157
|
disabled: disabled,
|
|
236
158
|
},
|
|
237
159
|
},
|
|
238
|
-
/*#__PURE__*/
|
|
239
|
-
|
|
160
|
+
/*#__PURE__*/ React.createElement(
|
|
161
|
+
AssignApp,
|
|
240
162
|
_extends(
|
|
241
163
|
{
|
|
242
164
|
dataItem: dataItem,
|
|
@@ -258,5 +180,5 @@ var AssignModal = function AssignModal(props) {
|
|
|
258
180
|
),
|
|
259
181
|
);
|
|
260
182
|
};
|
|
261
|
-
|
|
262
|
-
|
|
183
|
+
export default AssignModal;
|
|
184
|
+
export { AssignApp };
|
package/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AssignModal';
|
package/{lib → es}/locale.js
RENAMED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true,
|
|
5
|
-
});
|
|
6
|
-
exports.zh_CN = exports.getText = exports.getLanguage = exports.en_US = exports.default = void 0;
|
|
7
|
-
var _universalCookie = _interopRequireDefault(require('universal-cookie'));
|
|
8
|
-
function _interopRequireDefault(obj) {
|
|
9
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
10
|
-
}
|
|
11
|
-
var cookies = new _universalCookie.default();
|
|
12
|
-
var zh_CN = {
|
|
1
|
+
import Cookies from 'universal-cookie';
|
|
2
|
+
var cookies = new Cookies();
|
|
3
|
+
export var zh_CN = {
|
|
13
4
|
authorizesOrgList: '机构列表',
|
|
14
5
|
allOrgAvailable: '全部机构',
|
|
15
6
|
authorizesAppList: '渠道列表',
|
|
@@ -18,8 +9,7 @@ var zh_CN = {
|
|
|
18
9
|
allUserAvailable: '全部用户',
|
|
19
10
|
search: '查询',
|
|
20
11
|
};
|
|
21
|
-
|
|
22
|
-
var en_US = {
|
|
12
|
+
export var en_US = {
|
|
23
13
|
authorizesOrgList: 'Organization List',
|
|
24
14
|
allOrgAvailable: 'All Organizations',
|
|
25
15
|
authorizesAppList: 'Channel List',
|
|
@@ -28,8 +18,7 @@ var en_US = {
|
|
|
28
18
|
allUserAvailable: 'All Accounts',
|
|
29
19
|
search: 'Search',
|
|
30
20
|
};
|
|
31
|
-
|
|
32
|
-
var getText = function getText(key, language) {
|
|
21
|
+
export var getText = function getText(key, language) {
|
|
33
22
|
var _ref;
|
|
34
23
|
var text =
|
|
35
24
|
(_ref =
|
|
@@ -53,17 +42,14 @@ var getText = function getText(key, language) {
|
|
|
53
42
|
}
|
|
54
43
|
return text;
|
|
55
44
|
};
|
|
56
|
-
|
|
57
|
-
var getLanguage = function getLanguage() {
|
|
45
|
+
export var getLanguage = function getLanguage() {
|
|
58
46
|
return (
|
|
59
47
|
cookies.get('lang', {
|
|
60
48
|
path: '/',
|
|
61
49
|
}) || 'cn'
|
|
62
50
|
);
|
|
63
51
|
};
|
|
64
|
-
|
|
65
|
-
var _default = {
|
|
52
|
+
export default {
|
|
66
53
|
en_US: en_US,
|
|
67
54
|
zh_CN: zh_CN,
|
|
68
55
|
};
|
|
69
|
-
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tddc/assign-modal",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"author": "zj <jun.zhang002383@tongdun.net>",
|
|
6
|
-
"license": "ISC",
|
|
7
|
-
"main": "
|
|
8
|
-
"files": [
|
|
9
|
-
"
|
|
10
|
-
],
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"gitHead": "597697f3b6df285679feeabf56b25943a4ec89d4"
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tddc/assign-modal",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "assign-modal",
|
|
5
|
+
"author": "zj <jun.zhang002383@tongdun.net>",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"main": "es/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"es"
|
|
10
|
+
],
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"universal-cookie": ">=2.2.0",
|
|
13
|
+
"react": ">=16.8.0"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"jsencrypt": "3.2.1"
|
|
17
|
+
},
|
|
18
|
+
"gitHead": "597697f3b6df285679feeabf56b25943a4ec89d4"
|
|
19
|
+
}
|
package/lib/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true,
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, 'default', {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _AssignModal.default;
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
var _AssignModal = _interopRequireDefault(require('./AssignModal'));
|
|
13
|
-
function _interopRequireDefault(obj) {
|
|
14
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
15
|
-
}
|
|
File without changes
|
|
File without changes
|