indicator-ui 0.0.80 → 0.0.81
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 +28 -27
- 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/config/index.d.ts +2 -1
- package/dist/types/src/ui/InputFields/SelectField/types/SelectFieldTypes.d.ts +5 -6
- package/dist/types/src/ui/InputFields/SelectField/ui/SelectField.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/src/ui/InputFields/SelectField/config/ScrollConfig.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -9370,22 +9370,6 @@ function RadioFieldItem({ option, onClick, active = false, disabled = false, cla
|
|
|
9370
9370
|
}
|
|
9371
9371
|
|
|
9372
9372
|
|
|
9373
|
-
/***/ }),
|
|
9374
|
-
|
|
9375
|
-
/***/ "./src/ui/InputFields/SelectField/config/ScrollConfig.ts":
|
|
9376
|
-
/*!***************************************************************!*\
|
|
9377
|
-
!*** ./src/ui/InputFields/SelectField/config/ScrollConfig.ts ***!
|
|
9378
|
-
\***************************************************************/
|
|
9379
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9380
|
-
|
|
9381
|
-
"use strict";
|
|
9382
|
-
__webpack_require__.r(__webpack_exports__);
|
|
9383
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9384
|
-
/* harmony export */ DELTA_SCROLL_END: () => (/* binding */ DELTA_SCROLL_END)
|
|
9385
|
-
/* harmony export */ });
|
|
9386
|
-
const DELTA_SCROLL_END = 1;
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
9373
|
/***/ }),
|
|
9390
9374
|
|
|
9391
9375
|
/***/ "./src/ui/InputFields/SelectField/config/index.ts":
|
|
@@ -9397,10 +9381,11 @@ const DELTA_SCROLL_END = 1;
|
|
|
9397
9381
|
"use strict";
|
|
9398
9382
|
__webpack_require__.r(__webpack_exports__);
|
|
9399
9383
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9400
|
-
/* harmony export */ DELTA_SCROLL_END: () => (/*
|
|
9384
|
+
/* harmony export */ DELTA_SCROLL_END: () => (/* binding */ DELTA_SCROLL_END),
|
|
9385
|
+
/* harmony export */ SEARCHING_DELAY_TIME: () => (/* binding */ SEARCHING_DELAY_TIME)
|
|
9401
9386
|
/* harmony export */ });
|
|
9402
|
-
|
|
9403
|
-
|
|
9387
|
+
const DELTA_SCROLL_END = 1;
|
|
9388
|
+
const SEARCHING_DELAY_TIME = 0.5 * 1000; // in ms
|
|
9404
9389
|
|
|
9405
9390
|
|
|
9406
9391
|
/***/ }),
|
|
@@ -9580,6 +9565,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9580
9565
|
/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../styles */ "./src/ui/InputFields/SelectField/styles/index.ts");
|
|
9581
9566
|
/* harmony import */ var _SelectModalWindow__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./SelectModalWindow */ "./src/ui/InputFields/SelectField/ui/SelectModalWindow.tsx");
|
|
9582
9567
|
/* harmony import */ var _ui__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/ui */ "./src/ui/index.ts");
|
|
9568
|
+
/* harmony import */ var _ui_InputFields_SelectField_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/ui/InputFields/SelectField/config */ "./src/ui/InputFields/SelectField/config/index.ts");
|
|
9583
9569
|
|
|
9584
9570
|
|
|
9585
9571
|
|
|
@@ -9587,7 +9573,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9587
9573
|
|
|
9588
9574
|
|
|
9589
9575
|
|
|
9590
|
-
|
|
9576
|
+
|
|
9577
|
+
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, ...props }) {
|
|
9591
9578
|
const [isFocus, setIsFocus] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
|
|
9592
9579
|
const [searchingString, setSearchingString] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('');
|
|
9593
9580
|
const [isShowModalWindow, setIsShowModalWindow] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
|
|
@@ -9596,6 +9583,15 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
|
|
|
9596
9583
|
const optionsCacheRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)([]);
|
|
9597
9584
|
const [optionsState, setOptionsState] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(options);
|
|
9598
9585
|
const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
9586
|
+
const searchingTimeoutRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
9587
|
+
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
|
|
9588
|
+
return () => {
|
|
9589
|
+
// Отчистка таймаута для searching
|
|
9590
|
+
if (searchingTimeoutRef.current != null) {
|
|
9591
|
+
clearTimeout(searchingTimeoutRef.current);
|
|
9592
|
+
}
|
|
9593
|
+
};
|
|
9594
|
+
}, []);
|
|
9599
9595
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
|
|
9600
9596
|
if (!offInitLoadMoreOptions) {
|
|
9601
9597
|
onScrollToBottom();
|
|
@@ -9620,22 +9616,27 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
|
|
|
9620
9616
|
else {
|
|
9621
9617
|
if (data.length > 1 && !multiple) {
|
|
9622
9618
|
onChange && onChange([data[data.length - 1]]);
|
|
9623
|
-
if (autoClose) {
|
|
9624
|
-
setIsShowModalWindow(false);
|
|
9625
|
-
onBlur && onBlur();
|
|
9626
|
-
}
|
|
9627
9619
|
}
|
|
9628
9620
|
else {
|
|
9629
9621
|
onChange && onChange(data);
|
|
9630
9622
|
}
|
|
9631
9623
|
}
|
|
9624
|
+
if (autoClose) {
|
|
9625
|
+
setIsShowModalWindow(false);
|
|
9626
|
+
onBlur && onBlur();
|
|
9627
|
+
}
|
|
9632
9628
|
};
|
|
9633
9629
|
const getViewField = () => {
|
|
9634
9630
|
if (searching !== undefined) {
|
|
9635
9631
|
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, optionsCacheRef.current), onChange: (searchString) => {
|
|
9636
9632
|
if (isFocus) {
|
|
9637
9633
|
setSearchingString(searchString);
|
|
9638
|
-
|
|
9634
|
+
if (searchingTimeoutRef.current != null) {
|
|
9635
|
+
clearTimeout(searchingTimeoutRef.current);
|
|
9636
|
+
}
|
|
9637
|
+
searchingTimeoutRef.current = setTimeout(() => {
|
|
9638
|
+
searching(searchString, optionsState).then((newOptions) => newOptions !== undefined && setOptionsState(newOptions));
|
|
9639
|
+
}, _ui_InputFields_SelectField_config__WEBPACK_IMPORTED_MODULE_7__.SEARCHING_DELAY_TIME);
|
|
9639
9640
|
}
|
|
9640
9641
|
}, disabled: disabled, onFocus: () => {
|
|
9641
9642
|
setIsShowModalWindow(true);
|
|
@@ -9644,9 +9645,9 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
|
|
|
9644
9645
|
}, onBlur: () => {
|
|
9645
9646
|
setIsFocus(false);
|
|
9646
9647
|
onBlur && onBlur();
|
|
9647
|
-
}, onDropdownClick: () => setIsShowModalWindow(prevState => !prevState), isError: isError, placeholder: placeholder, dropdown: true, dropdownState: isShowModalWindow, ref: inputRef });
|
|
9648
|
+
}, onDropdownClick: () => setIsShowModalWindow(prevState => !prevState), isError: isError, placeholder: placeholder, dropdown: true, dropdownState: isShowModalWindow, ref: inputRef, ...props });
|
|
9648
9649
|
}
|
|
9649
|
-
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(prevState => !prevState), dropdown: true, dropdownState: isShowModalWindow, ref: inputRef });
|
|
9650
|
+
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(prevState => !prevState), dropdown: true, dropdownState: isShowModalWindow, ref: inputRef, ...props });
|
|
9650
9651
|
};
|
|
9651
9652
|
const processLoadMoreOptions = async () => {
|
|
9652
9653
|
if (requestPromiseRef.current)
|