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

Method _onItemSelect

packages/main/src/TabContainer.ts:905–924  ·  view source on GitHub ↗
(selectedTabId: string, originalEvent?: Event)

Source from the content-addressed store, hash-verified

903 }
904
905 _onItemSelect(selectedTabId: string, originalEvent?: Event) {
906 const selectedTabIndex = this._itemsFlat.findIndex(item => item.__id === selectedTabId);
907 const selectedTab = this._itemsFlat[selectedTabIndex] as Tab;
908
909 const selectionSuccessful = this.selectTab(selectedTab, selectedTabIndex);
910 if (!selectionSuccessful) {
911 return;
912 }
913
914 if (originalEvent) {
915 selectedTab.fireDecoratorEvent("click", { originalEvent });
916 }
917
918 // update selected property on all items
919 this._itemsFlat.forEach(item => {
920 if (!item.isSeparator) {
921 (item as Tab).selected = item === selectedTab;
922 }
923 });
924 }
925
926 /**
927 * Fires the `tab-select` event and changes the internal reference for the currently selected tab.

Callers 2

_onHeaderItemSelectMethod · 0.95

Calls 1

selectTabMethod · 0.95

Tested by

no test coverage detected