ab-ui-library 1.40.0 → 1.41.1
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.
|
@@ -171,7 +171,7 @@ var MultiSelect = function MultiSelect(props) {
|
|
|
171
171
|
}, [initialSelected, selectedValues]);
|
|
172
172
|
useEffect(function () {
|
|
173
173
|
if (autoApplyOnChooseItem) {
|
|
174
|
-
submitSelectedValue(selectedValues, false);
|
|
174
|
+
submitSelectedValue(selectedValues, false, false);
|
|
175
175
|
}
|
|
176
176
|
}, [selectedValues, autoApplyOnChooseItem]);
|
|
177
177
|
useEffect(function () {
|
|
@@ -196,13 +196,16 @@ var MultiSelect = function MultiSelect(props) {
|
|
|
196
196
|
};
|
|
197
197
|
useOnOutsideClick(containerRef.current, autoApplyOnClose ? closeDropdown : cancelSelectedItems, isOpen, useId());
|
|
198
198
|
var submitSelectedValue = function submitSelectedValue(selections, isChecked) {
|
|
199
|
+
var closeDropdownOnApply = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
199
200
|
if (setSelectedItems) {
|
|
200
201
|
setSelectedItems(selections, isChecked);
|
|
201
202
|
}
|
|
202
203
|
if (name && setFieldValue) {
|
|
203
204
|
setFieldValue(name, selections);
|
|
204
205
|
}
|
|
205
|
-
|
|
206
|
+
if (closeDropdownOnApply) {
|
|
207
|
+
closeDropdown();
|
|
208
|
+
}
|
|
206
209
|
};
|
|
207
210
|
var applySelectedItems = function applySelectedItems(isChecked) {
|
|
208
211
|
submitSelectedValue(selectedValues, isChecked);
|
|
@@ -94,6 +94,8 @@ var Select = function Select(props) {
|
|
|
94
94
|
isSearchable = _props$isSearchable === void 0 ? false : _props$isSearchable,
|
|
95
95
|
_props$isDynamicSearc = props.isDynamicSearchable,
|
|
96
96
|
isDynamicSearchable = _props$isDynamicSearc === void 0 ? false : _props$isDynamicSearc,
|
|
97
|
+
_props$trimSearchValu = props.trimSearchValue,
|
|
98
|
+
trimSearchValue = _props$trimSearchValu === void 0 ? false : _props$trimSearchValu,
|
|
97
99
|
disabled = props.disabled,
|
|
98
100
|
_props$dataId = props.dataId,
|
|
99
101
|
dataId = _props$dataId === void 0 ? '' : _props$dataId,
|
|
@@ -212,8 +214,9 @@ var Select = function Select(props) {
|
|
|
212
214
|
if (!searchValue) {
|
|
213
215
|
return options;
|
|
214
216
|
}
|
|
217
|
+
var processedSearchValue = trimSearchValue ? searchValue.trim().toLowerCase() : searchValue.toLowerCase();
|
|
215
218
|
return options.filter(function (dataItem) {
|
|
216
|
-
return typeof dataItem.label === 'string' && dataItem.label.toLowerCase().includes(
|
|
219
|
+
return typeof dataItem.label === 'string' && dataItem.label.toLowerCase().includes(processedSearchValue);
|
|
217
220
|
});
|
|
218
221
|
}, [searchValue, options]);
|
|
219
222
|
var onItemSelect = function onItemSelect(value) {
|
|
@@ -127,6 +127,7 @@ export interface TSingleSelectPropTypes extends IFormCompProps, TSelectBaseProps
|
|
|
127
127
|
onInputFormatting?: (value: string) => string;
|
|
128
128
|
isSearchable?: boolean;
|
|
129
129
|
isDynamicSearchable?: boolean;
|
|
130
|
+
trimSearchValue?: boolean;
|
|
130
131
|
outerHelperText?: string;
|
|
131
132
|
innerHelperText?: string;
|
|
132
133
|
labelAddons?: JSX.Element;
|