indicator-ui 0.0.63 → 0.0.64
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.js +18 -21
- package/dist/index.js.map +1 -1
- package/dist/types/src/ui/FormBuilder/lib/formBuilder.d.ts +1 -1
- package/dist/types/src/ui/InputFields/SelectField/types/SelectFieldTypes.d.ts +1 -13
- package/dist/types/src/ui/InputFields/SelectField/ui/SelectField.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9478,7 +9478,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9478
9478
|
|
|
9479
9479
|
|
|
9480
9480
|
|
|
9481
|
-
function SelectField({ value, onChange, options = [], placeholder, isError, searching, required = false, multiple = false, disabled = false, offOptionsSyncing = true, offInitLoadMoreOptions = false, autoClose = false, onBlur, selectModalWindowAfterElement, loadMoreOptions,
|
|
9481
|
+
function SelectField({ value, onChange, options = [], placeholder, isError, searching, required = false, multiple = false, disabled = false, offOptionsSyncing = true, offInitLoadMoreOptions = false, autoClose = false, onBlur, selectModalWindowAfterElement, loadMoreOptions, onBottomScroll, className = _styles__WEBPACK_IMPORTED_MODULE_4__.SelectFieldStyle, }) {
|
|
9482
9482
|
const [isFocus, setIsFocus] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
|
|
9483
9483
|
const [searchingString, setSearchingString] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('');
|
|
9484
9484
|
const [isShowModalWindow, setIsShowModalWindow] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
|
|
@@ -9538,27 +9538,24 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
|
|
|
9538
9538
|
}
|
|
9539
9539
|
return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_2__.FlexField, { value: (0,_lib__WEBPACK_IMPORTED_MODULE_3__.getStringValue)(value, optionsCacheRef.current), isError: isError, disabled: disabled, placeholder: placeholder, notInput: true, onClick: () => setIsShowModalWindow(true), dropdown: true, dropdownState: isShowModalWindow, ref: inputRef });
|
|
9540
9540
|
};
|
|
9541
|
+
const processLoadMoreOptions = async () => {
|
|
9542
|
+
let requestPromise = requestPromiseRef.current;
|
|
9543
|
+
if (requestPromise !== undefined)
|
|
9544
|
+
return;
|
|
9545
|
+
requestPromise = loadMoreOptions && loadMoreOptions(optionsState?.length || 0, searchingString);
|
|
9546
|
+
requestPromiseRef.current = requestPromise;
|
|
9547
|
+
const newOptions = await requestPromise;
|
|
9548
|
+
if (newOptions !== undefined) {
|
|
9549
|
+
setOptionsState(prevState => {
|
|
9550
|
+
requestPromiseRef.current = undefined;
|
|
9551
|
+
return [...prevState, ...newOptions];
|
|
9552
|
+
});
|
|
9553
|
+
}
|
|
9554
|
+
};
|
|
9541
9555
|
const onScrollToBottom = async () => {
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
if (loadMoreOptions) {
|
|
9546
|
-
requestPromiseRef.current = loadMoreOptions(optionsState?.length || 0, searchingString);
|
|
9547
|
-
}
|
|
9548
|
-
else {
|
|
9549
|
-
requestPromiseRef.current = moreOptions(optionsState || [], searchingString);
|
|
9550
|
-
}
|
|
9551
|
-
}
|
|
9552
|
-
const newOptions = await requestPromiseRef.current;
|
|
9553
|
-
requestPromiseRef.current = undefined;
|
|
9554
|
-
if (newOptions !== undefined) {
|
|
9555
|
-
setOptionsState(prevState => {
|
|
9556
|
-
if (loadMoreOptions)
|
|
9557
|
-
return [...prevState, ...newOptions];
|
|
9558
|
-
else
|
|
9559
|
-
return newOptions;
|
|
9560
|
-
});
|
|
9561
|
-
}
|
|
9556
|
+
onBottomScroll && onBottomScroll();
|
|
9557
|
+
if (loadMoreOptions) {
|
|
9558
|
+
processLoadMoreOptions();
|
|
9562
9559
|
}
|
|
9563
9560
|
};
|
|
9564
9561
|
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { className: className?.selectField, children: [getViewField(), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_6__.ModalWindowWrapper, { isShow: isShowModalWindow, setIsShow: setIsShowModalWindow, additionElements: [inputRef.current], className: className?.modalWindow, children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_SelectModalWindow__WEBPACK_IMPORTED_MODULE_5__["default"], { value: value, options: optionsState, onChange: handleChange, afterElement: selectModalWindowAfterElement, onScrollToBottom: onScrollToBottom, className: className }) })] }));
|