MCPcopy Create free account
hub / github.com/UI5/webcomponents / _filterItems

Method _filterItems

packages/main/src/ComboBox.ts:1210–1240  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

1208 }
1209
1210 _filterItems(str: string) {
1211 let filteredItem:IComboBoxItem;
1212 let filteredGroupItems: Array<IComboBoxItem> = [];
1213 const filteredItems: Array<IComboBoxItem> = [];
1214 const filteredItemGroups: Array<IComboBoxItem> = [];
1215
1216 this._resetItemVisibility();
1217 this.items.forEach(item => {
1218 if (isInstanceOfComboBoxItemGroup(item)) {
1219 filteredGroupItems = (Filters[this.filter] || Filters.StartsWithPerTerm)(str, item.items, "text");
1220 filteredGroupItems.forEach(i => {
1221 i._isVisible = true;
1222 });
1223
1224 if (filteredGroupItems.length) {
1225 filteredItemGroups.push(item);
1226 }
1227
1228 return;
1229 }
1230
1231 [filteredItem] = (Filters[this.filter] || Filters.StartsWithPerTerm)(str, [item], "text");
1232
1233 if (filteredItem) {
1234 filteredItem._isVisible = true;
1235 filteredItems.push(filteredItem);
1236 }
1237 });
1238
1239 return [...filteredItemGroups, ...filteredItems];
1240 }
1241
1242 /**
1243 * Sets the markupText property of an item with highlighted first match.

Callers 3

onBeforeRenderingMethod · 0.95
_resetFilterMethod · 0.95
_inputMethod · 0.95

Calls 2

_resetItemVisibilityMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected