lu-lowcode-package-form 0.10.60 → 0.10.62
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/dist/index.cjs.js +95 -95
- package/dist/index.es.js +2321 -2312
- package/package.json +1 -1
- package/src/components/field/select/search-select.jsx +23 -7
package/package.json
CHANGED
@@ -12,7 +12,9 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
|
|
12
12
|
|
13
13
|
const currentPageRef = useRef(1);
|
14
14
|
const currentPageSize = 10
|
15
|
-
const
|
15
|
+
const isAllLoadedRef = useRef(false)
|
16
|
+
const isLoadingRef = useRef(false);
|
17
|
+
|
16
18
|
useEffect(() => {
|
17
19
|
// console.log("SearchSelect useEffect props", props)
|
18
20
|
if (value) {
|
@@ -79,6 +81,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
|
|
79
81
|
let item = null
|
80
82
|
const ruleParams = {}
|
81
83
|
currentPageRef.current = 1
|
84
|
+
isAllLoadedRef.current = false
|
82
85
|
if (request && typeof request === 'function') {
|
83
86
|
debounceFetchOptions(params, ruleParams)
|
84
87
|
}
|
@@ -191,13 +194,26 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
|
|
191
194
|
}
|
192
195
|
};
|
193
196
|
|
197
|
+
|
194
198
|
const loadMoreOptions = async () => {
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
199
|
+
if (isAllLoadedRef.current || isLoadingRef.current) return; // 检查是否已加载完毕或正在加载
|
200
|
+
|
201
|
+
isLoadingRef.current = true; // 设置加载状态为 true
|
202
|
+
|
203
|
+
try {
|
204
|
+
const nextPageParams = { ...requestParams, page: currentPageRef.current + 1, pageSize: currentPageSize };
|
205
|
+
let newOptions = await fetchList(nextPageParams, null);
|
206
|
+
newOptions = await handleOptions(newOptions);
|
207
|
+
if (Array.isArray(newOptions) && newOptions.length > 0) {
|
208
|
+
setNOptions(prevOptions => [...prevOptions, ...newOptions]);
|
209
|
+
} else {
|
210
|
+
isAllLoadedRef.current = true;
|
211
|
+
}
|
212
|
+
currentPageRef.current += 1;
|
213
|
+
} catch (error) {
|
214
|
+
console.error("加载更多选项时出错", error);
|
215
|
+
} finally {
|
216
|
+
isLoadingRef.current = false; // 重置加载状态
|
201
217
|
}
|
202
218
|
};
|
203
219
|
return addWrapper ? (
|