Skip to content

Commit

Permalink
Merge pull request #1993 from HealthCatalyst/dev
Browse files Browse the repository at this point in the history
Cashmere 13.5.2
  • Loading branch information
andrew-frueh authored Nov 9, 2022
2 parents b539e1d + 450308d commit d59f7a4
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions projects/cashmere/src/lib/tabs/tab-set/tab-set.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
AfterContentInit,
AfterViewInit,
ChangeDetectorRef,
Component,
ContentChildren,
ElementRef,
Expand Down Expand Up @@ -59,7 +59,7 @@ export function invalidDefaultTab(tabVal: string | number): void {
styleUrls: ['./tab-set.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class TabSetComponent implements AfterContentInit, AfterViewInit {
export class TabSetComponent implements AfterContentInit {
_routerEnabled = false;
_routerDeselected = false;
_tabArrowsEnabled = [true, true];
Expand Down Expand Up @@ -167,23 +167,20 @@ export class TabSetComponent implements AfterContentInit, AfterViewInit {
}
private _overflowStyle = 'more';

constructor(private router: Router, private route: ActivatedRoute) {}
constructor(private router: Router, private route: ActivatedRoute, public changeDetector: ChangeDetectorRef) {}

ngAfterViewInit(): void {
ngAfterContentInit(): void {
this.setUpTabs();

/** Backup call to calculate tab widths in case the tabs are presented after page load */
setTimeout(() => {
this.refreshTabWidths();
}, 10);
setTimeout(() => this.refreshTabWidths(), 10);

// If links are added dynamically, recheck the navbar link sizing
this._tabs.changes.pipe(takeUntil(this.unsubscribe)).subscribe(() => this.refreshTabWidths());
}

ngAfterContentInit(): void {
this.setUpTabs();
this._tabs.changes.subscribe(() => this.setUpTabs());
this._tabs.changes.pipe(takeUntil(this.unsubscribe)).subscribe(() => {
this.setUpTabs();
this.refreshTabWidths();
this.changeDetector.detectChanges();
});
}

/** Runs the initial calculation of tab widths after the page has fully rendered */
Expand Down

0 comments on commit d59f7a4

Please sign in to comment.