diff --git a/packages/main/src/ComboBoxFilters.js b/packages/main/src/ComboBoxFilters.js
index 10e640969fff..8a8e3679fe0b 100644
--- a/packages/main/src/ComboBoxFilters.js
+++ b/packages/main/src/ComboBoxFilters.js
@@ -30,4 +30,11 @@ const Contains = (value, items) => {
});
};
-export { StartsWithPerTerm, StartsWith, Contains };
+const None = (_, items) => items;
+
+export {
+ StartsWithPerTerm,
+ StartsWith,
+ Contains,
+ None,
+};
diff --git a/packages/main/src/MultiComboBox.js b/packages/main/src/MultiComboBox.js
index 149c8902f892..71f53c852437 100644
--- a/packages/main/src/MultiComboBox.js
+++ b/packages/main/src/MultiComboBox.js
@@ -24,7 +24,9 @@ import ResponsivePopover from "./ResponsivePopover.js";
import List from "./List.js";
import StandardListItem from "./StandardListItem.js";
import ToggleButton from "./ToggleButton.js";
+import * as Filters from "./ComboBoxFilters.js";
import Button from "./Button.js";
+
import {
VALUE_STATE_SUCCESS,
VALUE_STATE_ERROR,
@@ -201,6 +203,19 @@ const metadata = {
type: Boolean,
},
+ /**
+ * Defines the filter type of the ui5-multi-combobox
.
+ * Available options are: StartsWithPerTerm
, None
.
+ *
+ * @type {string}
+ * @defaultvalue "StartsWithPerTerm"
+ * @public
+ */
+ filter: {
+ type: String,
+ defaultValue: "StartsWithPerTerm",
+ },
+
/**
* Indicates whether the dropdown is open. True if the dropdown is open, false otherwise.
*
@@ -586,12 +601,8 @@ class MultiComboBox extends UI5Element {
}
}
- _filterItems(value) {
- return this.items.filter(item => {
- return item.text
- && item.text.toLowerCase().startsWith(value.toLowerCase())
- && (this.filterSelected ? item.selected : true);
- });
+ _filterItems(str) {
+ return (Filters[this.filter] || Filters.StartsWithPerTerm)(str, this.items);
}
_toggle() {