Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(toolbar): get correct width inside tabs #10315

Merged
merged 5 commits into from
Oct 26, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import {
Inject,
Input,
OnDestroy,
OnInit,
Optional
} from '@angular/core';
import { first } from 'rxjs/operators';
import { Subscription } from 'rxjs';
import { IDisplayDensityOptions, DisplayDensityToken, DisplayDensityBase } from '../../core/displayDensity';
import { IgxIconService } from '../../icon/public_api';
Expand All @@ -30,7 +28,7 @@ import { GridType } from '../common/grid.interface';
selector: 'igx-grid-toolbar',
templateUrl: './grid-toolbar.component.html'
})
export class IgxGridToolbarComponent extends DisplayDensityBase implements OnInit, OnDestroy {
export class IgxGridToolbarComponent extends DisplayDensityBase implements OnDestroy {

/**
* When enabled, shows the indeterminate progress bar.
Expand Down Expand Up @@ -106,10 +104,6 @@ export class IgxGridToolbarComponent extends DisplayDensityBase implements OnIni
return this.displayDensity === 'compact';
}

/** @hidden @internal */
@HostBinding('style.max-width.px')
@HostBinding('style.flex-basis.px')
public width = null;

protected _grid: IgxGridBaseDirective;
protected sub: Subscription;
Expand All @@ -125,12 +119,6 @@ export class IgxGridToolbarComponent extends DisplayDensityBase implements OnIni
this.iconService.addSvgIconFromText(unpinLeft.name, unpinLeft.value, 'imx-icons');
}

/** @hidden @internal */
public ngOnInit() {
this.grid.rendered$.pipe(first()).subscribe(() => this.width = this.grid.outerWidth);
this.sub = this.grid.resizeNotify.subscribe(() => this.width = this.grid.outerWidth);
}

/** @hidden @internal */
public ngOnDestroy() {
this.sub?.unsubscribe();
Expand Down