@tddc/assign-modal 1.2.3 → 1.2.4
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/AssignModal/AssignApp/index.js +101 -25
- package/lib/AssignModal/AssignApp/index.less +3 -0
- package/lib/locale.js +14 -12
- package/package.json +1 -1
|
@@ -25,6 +25,8 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
25
25
|
exports.default = void 0;
|
|
26
26
|
require('antd/lib/checkbox/style');
|
|
27
27
|
var _checkbox = _interopRequireDefault(require('antd/lib/checkbox'));
|
|
28
|
+
require('antd/lib/input/style');
|
|
29
|
+
var _input = _interopRequireDefault(require('antd/lib/input'));
|
|
28
30
|
require('antd/lib/tree/style');
|
|
29
31
|
var _tree = _interopRequireDefault(require('antd/lib/tree'));
|
|
30
32
|
var _react = _interopRequireWildcard(require('react'));
|
|
@@ -162,6 +164,7 @@ function _arrayWithHoles(arr) {
|
|
|
162
164
|
if (Array.isArray(arr)) return arr;
|
|
163
165
|
}
|
|
164
166
|
var TreeNode = _tree.default.TreeNode;
|
|
167
|
+
var Search = _input.default.Search;
|
|
165
168
|
var path = []; // 上级机构到当前机构的路径
|
|
166
169
|
|
|
167
170
|
var AssignModal = function AssignModal(props) {
|
|
@@ -225,6 +228,10 @@ var AssignModal = function AssignModal(props) {
|
|
|
225
228
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
226
229
|
allUserChecked = _useState12[0],
|
|
227
230
|
setAllUserChecked = _useState12[1];
|
|
231
|
+
var _useState13 = (0, _react.useState)(),
|
|
232
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
233
|
+
filterUser = _useState14[0],
|
|
234
|
+
setFilterUser = _useState14[1];
|
|
228
235
|
if (!((_orgList$ = orgList[0]) === null || _orgList$ === void 0 ? void 0 : _orgList$.path)) {
|
|
229
236
|
(0, _utils.addPath)(orgList[0], []); // 添加 上级机构到子机构的路径
|
|
230
237
|
}
|
|
@@ -546,6 +553,12 @@ var AssignModal = function AssignModal(props) {
|
|
|
546
553
|
});
|
|
547
554
|
}
|
|
548
555
|
};
|
|
556
|
+
var debouncedSearch = (0, _react.useCallback)(
|
|
557
|
+
(0, _lodash.debounce)(function (nextValue) {
|
|
558
|
+
setFilterUser(nextValue);
|
|
559
|
+
}, 200),
|
|
560
|
+
[],
|
|
561
|
+
);
|
|
549
562
|
return /*#__PURE__*/ _react.default.createElement(
|
|
550
563
|
'div',
|
|
551
564
|
{
|
|
@@ -711,33 +724,96 @@ var AssignModal = function AssignModal(props) {
|
|
|
711
724
|
{
|
|
712
725
|
className: 'menu-body',
|
|
713
726
|
},
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
727
|
+
/*#__PURE__*/ _react.default.createElement(
|
|
728
|
+
'div',
|
|
729
|
+
{
|
|
730
|
+
className: 'assign-search-wrap',
|
|
731
|
+
},
|
|
732
|
+
/*#__PURE__*/ _react.default.createElement(Search, {
|
|
733
|
+
size: 'small',
|
|
734
|
+
allowClear: true,
|
|
735
|
+
placeholder: (0, _locale.getText)(
|
|
736
|
+
'search',
|
|
737
|
+
props === null || props === void 0 ? void 0 : props.lang,
|
|
738
|
+
),
|
|
739
|
+
onChange: function onChange(e) {
|
|
740
|
+
debouncedSearch(e.target.value);
|
|
726
741
|
},
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
742
|
+
onSearch: function onSearch(v) {
|
|
743
|
+
setFilterUser(v);
|
|
744
|
+
},
|
|
745
|
+
style: {
|
|
746
|
+
width: '90%',
|
|
747
|
+
},
|
|
748
|
+
}),
|
|
749
|
+
),
|
|
750
|
+
userList === null || userList === void 0
|
|
751
|
+
? void 0
|
|
752
|
+
: userList
|
|
753
|
+
.filter(function (item) {
|
|
754
|
+
if (filterUser) {
|
|
755
|
+
var _item$account, _item$userName;
|
|
756
|
+
return (
|
|
757
|
+
(item === null || item === void 0
|
|
758
|
+
? void 0
|
|
759
|
+
: (_item$account = item.account) === null || _item$account === void 0
|
|
760
|
+
? void 0
|
|
761
|
+
: _item$account
|
|
762
|
+
.toLocaleLowerCase()
|
|
763
|
+
.includes(
|
|
764
|
+
filterUser === null || filterUser === void 0
|
|
765
|
+
? void 0
|
|
766
|
+
: filterUser.toLocaleLowerCase(),
|
|
767
|
+
)) ||
|
|
768
|
+
(item === null || item === void 0
|
|
769
|
+
? void 0
|
|
770
|
+
: (_item$userName = item.userName) === null || _item$userName === void 0
|
|
771
|
+
? void 0
|
|
772
|
+
: _item$userName
|
|
773
|
+
.toLocaleLowerCase()
|
|
774
|
+
.includes(
|
|
775
|
+
filterUser === null || filterUser === void 0
|
|
776
|
+
? void 0
|
|
777
|
+
: filterUser.toLocaleLowerCase(),
|
|
778
|
+
))
|
|
779
|
+
);
|
|
780
|
+
} else {
|
|
781
|
+
return item;
|
|
782
|
+
}
|
|
783
|
+
})
|
|
784
|
+
.map(function (item, index) {
|
|
785
|
+
var isCheck =
|
|
786
|
+
userKeys === null || userKeys === void 0
|
|
787
|
+
? void 0
|
|
788
|
+
: userKeys.includes(item.account);
|
|
789
|
+
var isOwnAccount = account === item.account;
|
|
790
|
+
return /*#__PURE__*/ _react.default.createElement(
|
|
791
|
+
'div',
|
|
792
|
+
null,
|
|
793
|
+
/*#__PURE__*/ _react.default.createElement(
|
|
794
|
+
_checkbox.default,
|
|
795
|
+
{
|
|
796
|
+
checked: isCheck,
|
|
797
|
+
disabled: disabled || isOwnAccount || allUserChecked,
|
|
798
|
+
onChange: assignUser,
|
|
799
|
+
value: item.account,
|
|
800
|
+
key: index,
|
|
801
|
+
},
|
|
802
|
+
/*#__PURE__*/ _react.default.createElement(
|
|
803
|
+
'span',
|
|
804
|
+
{
|
|
805
|
+
style: {
|
|
806
|
+
display: 'inline-block',
|
|
807
|
+
},
|
|
808
|
+
},
|
|
809
|
+
/*#__PURE__*/ _react.default.createElement(_tntd.Ellipsis, {
|
|
810
|
+
widthLimit: 240,
|
|
811
|
+
title: item.userName,
|
|
812
|
+
}),
|
|
813
|
+
),
|
|
814
|
+
),
|
|
815
|
+
);
|
|
737
816
|
}),
|
|
738
|
-
),
|
|
739
|
-
);
|
|
740
|
-
}),
|
|
741
817
|
),
|
|
742
818
|
),
|
|
743
819
|
);
|
package/lib/locale.js
CHANGED
|
@@ -10,21 +10,23 @@ function _interopRequireDefault(obj) {
|
|
|
10
10
|
}
|
|
11
11
|
var cookies = new _universalCookie.default();
|
|
12
12
|
var zh_CN = {
|
|
13
|
-
authorizesOrgList: '
|
|
14
|
-
allOrgAvailable: '
|
|
15
|
-
authorizesAppList: '
|
|
16
|
-
allAppAvailable: '
|
|
17
|
-
authorizesUserList: '
|
|
18
|
-
allUserAvailable: '
|
|
13
|
+
authorizesOrgList: '机构列表',
|
|
14
|
+
allOrgAvailable: '全部机构',
|
|
15
|
+
authorizesAppList: '渠道列表',
|
|
16
|
+
allAppAvailable: '全部渠道',
|
|
17
|
+
authorizesUserList: '用户列表',
|
|
18
|
+
allUserAvailable: '全部用户',
|
|
19
|
+
search: '查询',
|
|
19
20
|
};
|
|
20
21
|
exports.zh_CN = zh_CN;
|
|
21
22
|
var en_US = {
|
|
22
|
-
authorizesOrgList: '
|
|
23
|
-
allOrgAvailable: 'All
|
|
24
|
-
authorizesAppList: '
|
|
25
|
-
allAppAvailable: 'All
|
|
26
|
-
authorizesUserList: '
|
|
27
|
-
allUserAvailable: 'All
|
|
23
|
+
authorizesOrgList: 'Organization List',
|
|
24
|
+
allOrgAvailable: 'All Organizations',
|
|
25
|
+
authorizesAppList: 'Channel List',
|
|
26
|
+
allAppAvailable: 'All Channels',
|
|
27
|
+
authorizesUserList: 'Account List',
|
|
28
|
+
allUserAvailable: 'All Accounts',
|
|
29
|
+
search: 'Search',
|
|
28
30
|
};
|
|
29
31
|
exports.en_US = en_US;
|
|
30
32
|
var getText = function getText(key, language) {
|