ab-ui-library 1.49.6 → 1.49.8
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.
|
@@ -193,7 +193,7 @@ var Select = function Select(props) {
|
|
|
193
193
|
};
|
|
194
194
|
var handleOutsideClick = function handleOutsideClick() {
|
|
195
195
|
var selected = getSelectedOption();
|
|
196
|
-
if (!searchValue && selected) {
|
|
196
|
+
if (!searchValue && selected && !isCreateOnOutsideClick) {
|
|
197
197
|
setCurrentSelectedLabel();
|
|
198
198
|
} else if (isCreateOnOutsideClick) {
|
|
199
199
|
setSelectedOption({
|
|
@@ -229,6 +229,11 @@ var Select = function Select(props) {
|
|
|
229
229
|
}
|
|
230
230
|
closeDropdown();
|
|
231
231
|
};
|
|
232
|
+
var isInOptions = function isInOptions(value) {
|
|
233
|
+
return options.some(function (item) {
|
|
234
|
+
return "".concat(item.value) === value;
|
|
235
|
+
});
|
|
236
|
+
};
|
|
232
237
|
var onItemDeselect = function onItemDeselect() {
|
|
233
238
|
return onItemSelect(null);
|
|
234
239
|
};
|
|
@@ -294,7 +299,7 @@ var Select = function Select(props) {
|
|
|
294
299
|
}, selectRightIconProps);
|
|
295
300
|
}, [selectRightIconProps]);
|
|
296
301
|
useEffect(function () {
|
|
297
|
-
if (defaultValue && isCreateOnOutsideClick) {
|
|
302
|
+
if (defaultValue && isCreateOnOutsideClick && !isInOptions(defaultValue)) {
|
|
298
303
|
setSelectedOption({
|
|
299
304
|
label: defaultValue,
|
|
300
305
|
value: defaultValue
|