indicator-ui 0.0.35 → 0.0.37
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
|
@@ -9422,13 +9422,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9422
9422
|
|
|
9423
9423
|
|
|
9424
9424
|
|
|
9425
|
-
function SelectField({ value, onChange, options = [], placeholder, isError, isSearching = false, required = false, multiple = false, disabled = false, offOptionsSyncing = true, autoClose = true, onBlur, selectModalWindowAfterElement, loadMoreOptions, className = _styles__WEBPACK_IMPORTED_MODULE_4__.SelectFieldStyle, }) {
|
|
9425
|
+
function SelectField({ value, onChange, options = [], placeholder, isError, isSearching = false, required = false, multiple = false, disabled = false, offOptionsSyncing = true, offInitLoadMoreOptions = false, autoClose = true, onBlur, selectModalWindowAfterElement, loadMoreOptions, className = _styles__WEBPACK_IMPORTED_MODULE_4__.SelectFieldStyle, }) {
|
|
9426
9426
|
const [isFocus, setIsFocus] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
|
|
9427
9427
|
const [searchingString, setSearchingString] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('');
|
|
9428
9428
|
const [isShowModalWindow, setIsShowModalWindow] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
|
|
9429
9429
|
const [optionsState, setOptionsState] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(options);
|
|
9430
9430
|
const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
9431
9431
|
const modalWindowRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
9432
|
+
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
|
|
9433
|
+
if (!offInitLoadMoreOptions) {
|
|
9434
|
+
onScrollToBottom();
|
|
9435
|
+
}
|
|
9436
|
+
}, []);
|
|
9432
9437
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
|
|
9433
9438
|
if (!offOptionsSyncing)
|
|
9434
9439
|
setOptionsState(options);
|
|
@@ -9489,8 +9494,9 @@ function SelectField({ value, onChange, options = [], placeholder, isError, isSe
|
|
|
9489
9494
|
};
|
|
9490
9495
|
const onScrollToBottom = async () => {
|
|
9491
9496
|
if (loadMoreOptions) {
|
|
9492
|
-
const newOptions = await loadMoreOptions(optionsState?.length);
|
|
9493
|
-
|
|
9497
|
+
const newOptions = await loadMoreOptions(optionsState?.length || 0);
|
|
9498
|
+
if (newOptions !== undefined)
|
|
9499
|
+
setOptionsState(prevState => [...prevState, ...newOptions]);
|
|
9494
9500
|
}
|
|
9495
9501
|
};
|
|
9496
9502
|
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { className: className?.selectField, children: [getViewField(), isShowModalWindow && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { ref: modalWindowRef, 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 }) }))] }));
|