@qmlight/web-platform-components 1.0.6 → 1.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.
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/index.tsx +54 -44
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/searchModal.tsx +1 -0
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/searchTabs.tsx +4 -2
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/transfer/index.tsx +1 -1
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/treeData/index.tsx +4 -12
- package/package.json +1 -1
|
@@ -47,12 +47,13 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
47
47
|
const fetchRef = useRef(0);
|
|
48
48
|
const [visible, setVisible] = useState<boolean>(false);
|
|
49
49
|
const dataValue = useRef<any>(mode ? [] : {});
|
|
50
|
-
const
|
|
50
|
+
const status = useRef(false);
|
|
51
51
|
const pages = useRef<any>(0);
|
|
52
52
|
const currentPage = useRef<number>(1);
|
|
53
53
|
const [loading, setLoading] = useState(false);
|
|
54
54
|
const [searchValue, setSearchValue] = useState('');
|
|
55
55
|
const searchData = useRef([]);
|
|
56
|
+
const SelectRef = useRef<any>();
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
setValue(data);
|
|
58
59
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -137,38 +138,39 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
137
138
|
<div className="search-select-page">
|
|
138
139
|
<Select
|
|
139
140
|
// mode="tags"
|
|
141
|
+
ref={SelectRef}
|
|
140
142
|
mode={mode}
|
|
141
143
|
size="middle"
|
|
142
|
-
showSearch
|
|
144
|
+
// showSearch
|
|
143
145
|
showArrow
|
|
144
146
|
getPopupContainer={(trigger) => trigger}
|
|
145
|
-
searchValue={searchValue}
|
|
147
|
+
// searchValue={searchValue}
|
|
146
148
|
disabled={option?.readOnly || option?.disabled || $$form?.props?.formType === 'onlyShow'}
|
|
147
|
-
onPopupScroll={(event: any) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}}
|
|
164
|
-
dropdownRender={(menu) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}}
|
|
149
|
+
// onPopupScroll={(event: any) => {
|
|
150
|
+
// if (type !== 'org') {
|
|
151
|
+
// return;
|
|
152
|
+
// }
|
|
153
|
+
// const nodeClient = event.target?.firstChild?.clientHeight || 0;
|
|
154
|
+
// const scrollHeight = event.target.scrollTop;
|
|
155
|
+
// if (
|
|
156
|
+
// nodeClient - scrollHeight - 256 < 10 &&
|
|
157
|
+
// currentPage.current * 20 <= pages.current &&
|
|
158
|
+
// !loading
|
|
159
|
+
// ) {
|
|
160
|
+
// setLoading(true);
|
|
161
|
+
// currentPage.current++;
|
|
162
|
+
// debounceFetcher({ name: searchValue });
|
|
163
|
+
// }
|
|
164
|
+
// // console.log(event.target.scrollTop);
|
|
165
|
+
// }}
|
|
166
|
+
// dropdownRender={(menu) => {
|
|
167
|
+
// return (
|
|
168
|
+
// <>
|
|
169
|
+
// {menu}
|
|
170
|
+
// {loading ? <Spin tip="加载中..." /> : <></>}
|
|
171
|
+
// </>
|
|
172
|
+
// );
|
|
173
|
+
// }}
|
|
172
174
|
suffixIcon={
|
|
173
175
|
<>
|
|
174
176
|
{/* {!isEmpty(value) && (
|
|
@@ -208,7 +210,7 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
208
210
|
// console.log(dataValue.current);
|
|
209
211
|
// setStatus(!isEmpty(values));
|
|
210
212
|
// }}
|
|
211
|
-
|
|
213
|
+
options={options}
|
|
212
214
|
value={isEmpty(value) ? (mode ? [] : undefined) : value}
|
|
213
215
|
loading={fetching}
|
|
214
216
|
onSelect={(value: any) => {
|
|
@@ -236,24 +238,30 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
236
238
|
onDataChange && onDataChange(dataValue.current);
|
|
237
239
|
setValue(dataValue.current);
|
|
238
240
|
}}
|
|
239
|
-
onFocus={() => {
|
|
240
|
-
|
|
241
|
+
onFocus={(e) => {
|
|
242
|
+
e.stopPropagation();
|
|
243
|
+
SelectRef.current.blur();
|
|
244
|
+
|
|
245
|
+
if (option?.readOnly || option?.disabled || $$form?.props?.formType === 'onlyShow') {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
setVisible(true);
|
|
249
|
+
status.current = true;
|
|
241
250
|
}}
|
|
242
251
|
onBlur={() => {
|
|
243
|
-
|
|
252
|
+
SelectRef.current.blur();
|
|
244
253
|
}}
|
|
245
254
|
notFoundContent={fetching ? <Spin size="small" /> : null}
|
|
246
|
-
onSearch={(value) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}}
|
|
255
|
+
// onSearch={(value) => {
|
|
256
|
+
// // if (type === 'doc' || type === 'customNode') {
|
|
257
|
+
// // return;
|
|
258
|
+
// // }
|
|
259
|
+
// // if (type === 'org') {
|
|
260
|
+
// // currentPage.current = 1;
|
|
261
|
+
// // }
|
|
262
|
+
// // setSearchValue(value);
|
|
263
|
+
// // debounceFetcher({ name: value });
|
|
264
|
+
// }}
|
|
257
265
|
>
|
|
258
266
|
{options.map((item) => {
|
|
259
267
|
return (
|
|
@@ -286,7 +294,9 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
286
294
|
items={items}
|
|
287
295
|
type={type}
|
|
288
296
|
onChange={onModalDataChange}
|
|
289
|
-
onClose={() =>
|
|
297
|
+
onClose={() => {
|
|
298
|
+
setVisible(false);
|
|
299
|
+
}}
|
|
290
300
|
visible={visible}
|
|
291
301
|
title={title || '人力资源'}
|
|
292
302
|
customData={customData}
|
|
@@ -50,8 +50,10 @@ const SearchTabs = (props) => {
|
|
|
50
50
|
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
if (items?.length) {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const { key, type } = items[0] || {};
|
|
54
|
+
setActiveKey(key);
|
|
55
|
+
prevActiveKey.current = key;
|
|
56
|
+
setType(type);
|
|
55
57
|
setItemsList(items);
|
|
56
58
|
}
|
|
57
59
|
}, [items]);
|
|
@@ -65,7 +65,7 @@ const TransferIndex = ({
|
|
|
65
65
|
console.log(list);
|
|
66
66
|
console.log(transferDataSource);
|
|
67
67
|
const dataList: any[] = [];
|
|
68
|
-
if (lists.length) {
|
|
68
|
+
if (lists.length && type !== 'org') {
|
|
69
69
|
const newList = list.filter((item) => !lists.includes(item));
|
|
70
70
|
const perList = transferDataSource.filter((item) => newList.includes(item.id));
|
|
71
71
|
const newData = unionBy(data.concat(perList), 'id');
|
|
@@ -69,25 +69,17 @@ const TreeData = (props) => {
|
|
|
69
69
|
};
|
|
70
70
|
const getCheckAble = (item) => {
|
|
71
71
|
if (type === 'default' || type === 'org') {
|
|
72
|
-
return !
|
|
72
|
+
return !targetKeys.includes(item.id);
|
|
73
73
|
}
|
|
74
74
|
if (type === 'customOrg') {
|
|
75
|
-
return (
|
|
76
|
-
!item.orgtype &&
|
|
77
|
-
item.orgtype !== 0 &&
|
|
78
|
-
!(targetKeys.includes(item.id) || targetKeys.includes(item.parentId))
|
|
79
|
-
);
|
|
75
|
+
return !item.orgtype && item.orgtype !== 0 && !targetKeys.includes(item.id);
|
|
80
76
|
}
|
|
81
77
|
if (type === 'doc') {
|
|
82
|
-
return !
|
|
78
|
+
return !targetKeys.includes(item.id);
|
|
83
79
|
}
|
|
84
80
|
return (
|
|
85
81
|
item.orgtype === 2 &&
|
|
86
|
-
!(
|
|
87
|
-
targetKeys.includes(item.id) ||
|
|
88
|
-
targetKeys.includes(item.parentId) ||
|
|
89
|
-
targetKeys.includes(`${item.parentId}_${item.id}`)
|
|
90
|
-
)
|
|
82
|
+
!(targetKeys.includes(item.id) || targetKeys.includes(`${item.parentId}_${item.id}`))
|
|
91
83
|
);
|
|
92
84
|
};
|
|
93
85
|
|