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

Method _filterItems

packages/main/src/MultiComboBox.ts:1546–1563  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

1544 }
1545
1546 _filterItems(str: string) {
1547 const itemsToFilter = this._getItems().filter(item => !item.isGroupItem);
1548 const filteredItems = (Filters[this.filter] || Filters.StartsWithPerTerm)(str, itemsToFilter, "text");
1549
1550 this._getItems().forEach(item => {
1551 if (isInstanceOfMultiComboBoxItem(item)) {
1552 item._isVisible = filteredItems.includes(item);
1553 }
1554 });
1555
1556 return this.items.filter(item => {
1557 if (item.isGroupItem) {
1558 return (item as MultiComboBoxItemGroup).items.some(listItem => listItem._isVisible) ? item : false;
1559 }
1560
1561 return item._isVisible;
1562 });
1563 }
1564
1565 /**
1566 * Returns true if the group header should be shown (if there is a filtered suggestion item for this group item)

Callers 3

_handleMobileInputMethod · 0.95
_inputLiveChangeMethod · 0.95
onBeforeRenderingMethod · 0.95

Calls 1

_getItemsMethod · 0.95

Tested by

no test coverage detected