intelicoreact 1.1.20 → 1.1.21
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.
|
@@ -130,11 +130,11 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
130
130
|
return (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.length;
|
|
131
131
|
}).map(function (item) {
|
|
132
132
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
133
|
-
items: isSearchable ? item.items.filter(function (el) {
|
|
133
|
+
items: !isSearchable ? item === null || item === void 0 ? void 0 : item.items : item.items.filter(function (el) {
|
|
134
134
|
var _el$label;
|
|
135
135
|
|
|
136
|
-
return isSearchChanged
|
|
137
|
-
})
|
|
136
|
+
return !isSearchChanged || (el === null || el === void 0 ? void 0 : (_el$label = el.label) === null || _el$label === void 0 ? void 0 : _el$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || '')) || !(item !== null && item !== void 0 && item.value) || (item === null || item === void 0 ? void 0 : item.value) === '';
|
|
137
|
+
})
|
|
138
138
|
});
|
|
139
139
|
}).filter(function (item) {
|
|
140
140
|
var _item$items2;
|
|
@@ -155,6 +155,8 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
155
155
|
|
|
156
156
|
var onChangeHandler = function onChangeHandler(item) {
|
|
157
157
|
setIsOpen(false);
|
|
158
|
+
setSearchValue(null);
|
|
159
|
+
setIsSearchChanged(false);
|
|
158
160
|
onChange(item.value);
|
|
159
161
|
}; // decorator
|
|
160
162
|
|
|
@@ -415,17 +417,20 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
415
417
|
};
|
|
416
418
|
|
|
417
419
|
(0, _react.useEffect)(function () {
|
|
418
|
-
if (!searchValue &&
|
|
420
|
+
if (!searchValue && isSearchInputFocused) {
|
|
419
421
|
setSearchValue(selectedLabel);
|
|
420
422
|
setTimeout(function () {
|
|
421
423
|
return searchInputRef.current.select();
|
|
422
424
|
}, 1);
|
|
423
425
|
}
|
|
424
426
|
|
|
425
|
-
if (!isSearchInputFocused) {
|
|
427
|
+
if (!isSearchInputFocused && !isOpen) {
|
|
426
428
|
setSearchValue(null);
|
|
427
429
|
}
|
|
428
|
-
}, [
|
|
430
|
+
}, [isSearchInputFocused]);
|
|
431
|
+
(0, _react.useEffect)(function () {
|
|
432
|
+
if (isOpen && !isSearchInputFocused) searchInputRef.current.focus();
|
|
433
|
+
}, [isOpen]);
|
|
429
434
|
var postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(function (option) {
|
|
430
435
|
return option.value === value;
|
|
431
436
|
})) === null || _filteredOptions$find === void 0 ? void 0 : _filteredOptions$find.postfix) || null;
|