Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/material/tabs/tab-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const _MatTabGroupMixinBase = mixinColor(mixinDisableRipple(class {
}), 'primary');

interface MatTabGroupBaseHeader {
_alignInkBarToSelectedTab: () => void;
_alignInkBarToSelectedTab(): void;
updatePagination(): void;
focusIndex: number;
}

Expand Down Expand Up @@ -306,6 +307,19 @@ export abstract class _MatTabGroupBase extends _MatTabGroupMixinBase implements
}
}

/**
* Recalculates the tab group's pagination dimensions.
*
* WARNING: Calling this method can be very costly in terms of performance. It should be called
* as infrequently as possible from outside of the Tabs component as it causes a reflow of the
* page.
*/
updatePagination() {
if (this._tabHeader) {
this._tabHeader.updatePagination();
}
}

/**
* Sets focus to a particular tab.
* @param index Index of the tab to be focused.
Expand Down
1 change: 1 addition & 0 deletions tools/public_api_guard/material/tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export abstract class _MatTabGroupBase extends _MatTabGroupMixinBase implements
// (undocumented)
abstract _tabHeader: MatTabGroupBaseHeader;
_tabs: QueryList<MatTab>;
updatePagination(): void;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<_MatTabGroupBase, never, never, { "dynamicHeight": "dynamicHeight"; "selectedIndex": "selectedIndex"; "headerPosition": "headerPosition"; "animationDuration": "animationDuration"; "contentTabIndex": "contentTabIndex"; "disablePagination": "disablePagination"; "backgroundColor": "backgroundColor"; }, { "selectedIndexChange": "selectedIndexChange"; "focusChange": "focusChange"; "animationDone": "animationDone"; "selectedTabChange": "selectedTabChange"; }, never>;
// (undocumented)
Expand Down