Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!this._indexIsInRange(previousActiveIndex)) {
previousActiveIndex = this.activeTabIndex;
}
return this.tabs.toArray()[previousActiveIndex].computeIndicatorClientRect();
},
getTabDimensionsAtIndex: (index: number) => this.tabs.toArray()[index].computeDimensions(),
getPreviousActiveTabIndex: () => this.tabs.toArray().findIndex((_) => _.active),
getFocusedTabIndex: () =>
this._platform.isBrowser ? this.tabs.toArray().findIndex(tab =>
tab.elementRef.nativeElement === document.activeElement!) : -1,
getIndexOfTabById: (id: string) => this.tabs.toArray().findIndex(tab => id === tab.id),
getTabListLength: () => this.tabs.length,
notifyTabActivated: (index: number) =>
this.activated.emit({ source: this, index: index, tab: this.tabs.toArray()[index] })
};
return new MDCTabBarFoundation(adapter);
}
getDefaultFoundation() {
return new MDCTabBarFoundation(
/** @type {!MDCTabBarAdapter} */ {
scrollTo: (scrollX: number) => {
this.tabScroller && this.tabScroller.scrollTo(scrollX);
},
incrementScroll: (scrollXIncrement: number) =>
this.tabScroller &&
this.tabScroller.incrementScroll(scrollXIncrement),
getScrollPosition: () =>
this.tabScroller ? this.tabScroller.getScrollPosition() : 0,
getScrollContentWidth: () =>
this.tabScroller ? this.tabScroller.getScrollContentWidth() : 0,
getOffsetWidth: () => (this.root.ref ? this.root.ref.offsetWidth : 0),
isRTL: () =>
!!this.root.ref &&
window