Skip to content

refactor(sidenav): constructor breaking changes for 8.0 #15773

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

Merged
merged 1 commit into from
Apr 23, 2019
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
4 changes: 4 additions & 0 deletions src/lib/schematics/ng-update/data/constructor-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export const constructorChecks: VersionChanges<ConstructorChecksUpgradeData> = {
{
pr: 'https://github.com/angular/material2/pull/15806',
changes: ['MatSlideToggle']
},
{
pr: 'https://github.com/angular/material2/pull/15773',
changes: ['MatDrawerContainer']
}
],

Expand Down
16 changes: 5 additions & 11 deletions src/lib/sidenav/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,9 @@ export class MatDrawerContainer implements AfterContentInit, DoCheck, OnDestroy
private _element: ElementRef<HTMLElement>,
private _ngZone: NgZone,
private _changeDetectorRef: ChangeDetectorRef,
viewportRuler: ViewportRuler,
@Inject(MAT_DRAWER_DEFAULT_AUTOSIZE) defaultAutosize = false,
@Optional() @Inject(ANIMATION_MODULE_TYPE) private _animationMode?: string,
/**
* @deprecated viewportRuler to become a required parameter.
* @breaking-change 8.0.0
*/
@Optional() viewportRuler?: ViewportRuler) {
@Optional() @Inject(ANIMATION_MODULE_TYPE) private _animationMode?: string) {

// If a `Dir` directive exists up the tree, listen direction changes
// and update the left/right properties to point to the proper start/end.
Expand All @@ -546,11 +542,9 @@ export class MatDrawerContainer implements AfterContentInit, DoCheck, OnDestroy

// Since the minimum width of the sidenav depends on the viewport width,
// we need to recompute the margins if the viewport changes.
if (viewportRuler) {
viewportRuler.change()
.pipe(takeUntil(this._destroyed))
.subscribe(() => this._updateContentMargins());
}
viewportRuler.change()
.pipe(takeUntil(this._destroyed))
.subscribe(() => this._updateContentMargins());

this._autosize = defaultAutosize;
}
Expand Down
3 changes: 1 addition & 2 deletions tools/public_api_guard/lib/sidenav.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export declare class MatDrawerContainer implements AfterContentInit, DoCheck, On
hasBackdrop: any;
readonly scrollable: CdkScrollable;
readonly start: MatDrawer | null;
constructor(_dir: Directionality, _element: ElementRef<HTMLElement>, _ngZone: NgZone, _changeDetectorRef: ChangeDetectorRef, defaultAutosize?: boolean, _animationMode?: string | undefined,
viewportRuler?: ViewportRuler);
constructor(_dir: Directionality, _element: ElementRef<HTMLElement>, _ngZone: NgZone, _changeDetectorRef: ChangeDetectorRef, viewportRuler: ViewportRuler, defaultAutosize?: boolean, _animationMode?: string | undefined);
_closeModalDrawer(): void;
_isShowingBackdrop(): boolean;
_onBackdropClicked(): void;
Expand Down