lu-lowcode-package-form 0.10.59 → 0.10.61
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 +76 -76
- package/dist/index.es.js +1776 -1775
- package/package.json +1 -1
- package/src/components/field/select/search-select.jsx +7 -2
package/package.json
CHANGED
@@ -12,7 +12,7 @@ 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
16
|
useEffect(() => {
|
17
17
|
// console.log("SearchSelect useEffect props", props)
|
18
18
|
if (value) {
|
@@ -79,6 +79,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
|
|
79
79
|
let item = null
|
80
80
|
const ruleParams = {}
|
81
81
|
currentPageRef.current = 1
|
82
|
+
isAllLoadedRef.current = false
|
82
83
|
if (request && typeof request === 'function') {
|
83
84
|
debounceFetchOptions(params, ruleParams)
|
84
85
|
}
|
@@ -192,12 +193,16 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
|
|
192
193
|
};
|
193
194
|
|
194
195
|
const loadMoreOptions = async () => {
|
196
|
+
if (isAllLoadedRef.current) return
|
195
197
|
const nextPageParams = { ...requestParams, page: currentPageRef.current + 1, pageSize: currentPageSize };
|
196
198
|
let newOptions = await fetchList(nextPageParams, null)
|
199
|
+
newOptions = await handleOptions(newOptions)
|
197
200
|
if (Array.isArray(newOptions) && newOptions.length > 0) {
|
198
201
|
setNOptions(prevOptions => [...prevOptions, ...newOptions]);
|
199
|
-
|
202
|
+
} else {
|
203
|
+
isAllLoadedRef.current = true
|
200
204
|
}
|
205
|
+
currentPageRef.current = currentPageRef.current + 1;
|
201
206
|
};
|
202
207
|
return addWrapper ? (
|
203
208
|
<BaseWrapper {...props}>
|