indicator-ui 0.0.61 → 0.0.63
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
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, className = _styles__WEBPACK_IMPORTED_MODULE_4__.SelectFieldStyle, }) {
|
|
9481
|
+
function SelectField({ value, onChange, options = [], placeholder, isError, searching, required = false, multiple = false, disabled = false, offOptionsSyncing = true, offInitLoadMoreOptions = false, autoClose = false, onBlur, selectModalWindowAfterElement, loadMoreOptions, moreOptions, 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);
|
|
@@ -9539,17 +9539,26 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
|
|
|
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
9541
|
const onScrollToBottom = async () => {
|
|
9542
|
-
if (loadMoreOptions) {
|
|
9542
|
+
if (loadMoreOptions || moreOptions) {
|
|
9543
9543
|
const requestPromise = requestPromiseRef.current;
|
|
9544
9544
|
if (requestPromise === undefined) {
|
|
9545
|
-
|
|
9545
|
+
if (loadMoreOptions) {
|
|
9546
|
+
requestPromiseRef.current = loadMoreOptions(optionsState?.length || 0, searchingString);
|
|
9547
|
+
}
|
|
9548
|
+
else {
|
|
9549
|
+
requestPromiseRef.current = moreOptions(optionsState || [], searchingString);
|
|
9550
|
+
}
|
|
9546
9551
|
}
|
|
9547
9552
|
const newOptions = await requestPromiseRef.current;
|
|
9548
|
-
|
|
9549
|
-
|
|
9553
|
+
requestPromiseRef.current = undefined;
|
|
9554
|
+
if (newOptions !== undefined) {
|
|
9555
|
+
setOptionsState(prevState => {
|
|
9556
|
+
if (loadMoreOptions)
|
|
9557
|
+
return [...prevState, ...newOptions];
|
|
9558
|
+
else
|
|
9559
|
+
return newOptions;
|
|
9560
|
+
});
|
|
9550
9561
|
}
|
|
9551
|
-
if (newOptions !== undefined)
|
|
9552
|
-
setOptionsState(prevState => [...prevState, ...newOptions]);
|
|
9553
9562
|
}
|
|
9554
9563
|
};
|
|
9555
9564
|
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 }) })] }));
|