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

Method _filterItems

packages/main/src/Input.ts:1341–1359  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

1339 }
1340
1341 _filterItems(value: string) {
1342 let matchingItems: Array<IInputSuggestionItem> = [];
1343 const groupItems = this._flattenItems.filter(item => this._isGroupItem(item));
1344
1345 this._resetItemVisibility();
1346
1347 if (groupItems.length) {
1348 matchingItems = this._filterGroups(this.filter, groupItems);
1349 } else {
1350 matchingItems = (Filters[this.filter])(value, this._selectableItems, "text");
1351 }
1352 this._selectableItems.forEach(item => {
1353 item.hidden = !matchingItems.includes(item);
1354 });
1355
1356 if (matchingItems.length === 0) {
1357 this.open = false;
1358 }
1359 }
1360
1361 _filterGroups(filterType: `${InputSuggestionsFilter}`, groupItems: IInputSuggestionItem[]) {
1362 const filteredGroupItems: IInputSuggestionItem[] = [];

Callers 1

onBeforeRenderingMethod · 0.95

Calls 3

_isGroupItemMethod · 0.95
_resetItemVisibilityMethod · 0.95
_filterGroupsMethod · 0.95

Tested by

no test coverage detected