indicator-ui 0.0.36 → 0.0.38
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,
|
|
9425
|
+
function SelectField({ value, onChange, options = [], placeholder, isError, searching, 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);
|
|
@@ -9475,8 +9480,11 @@ function SelectField({ value, onChange, options = [], placeholder, isError, isSe
|
|
|
9475
9480
|
}
|
|
9476
9481
|
};
|
|
9477
9482
|
const getViewField = () => {
|
|
9478
|
-
if (
|
|
9479
|
-
return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_2__.FlexField, { value: isFocus ? searchingString : (0,_lib__WEBPACK_IMPORTED_MODULE_3__.getStringValue)(value, optionsState), onChange:
|
|
9483
|
+
if (searching !== undefined) {
|
|
9484
|
+
return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_2__.FlexField, { value: isFocus ? searchingString : (0,_lib__WEBPACK_IMPORTED_MODULE_3__.getStringValue)(value, optionsState), onChange: (searchString) => {
|
|
9485
|
+
setSearchingString(searchString);
|
|
9486
|
+
searching(searchString, optionsState).then((newOptions) => newOptions !== undefined && setOptionsState(newOptions));
|
|
9487
|
+
}, disabled: disabled, onFocus: () => {
|
|
9480
9488
|
setIsFocus(true);
|
|
9481
9489
|
setIsShowModalWindow(true);
|
|
9482
9490
|
}, onBlur: () => {
|
|
@@ -9489,7 +9497,7 @@ function SelectField({ value, onChange, options = [], placeholder, isError, isSe
|
|
|
9489
9497
|
};
|
|
9490
9498
|
const onScrollToBottom = async () => {
|
|
9491
9499
|
if (loadMoreOptions) {
|
|
9492
|
-
const newOptions = await loadMoreOptions(optionsState?.length);
|
|
9500
|
+
const newOptions = await loadMoreOptions(optionsState?.length || 0, searchingString);
|
|
9493
9501
|
if (newOptions !== undefined)
|
|
9494
9502
|
setOptionsState(prevState => [...prevState, ...newOptions]);
|
|
9495
9503
|
}
|