Skip to content

Commit 8481ea7

Browse files
committed
refactor(sidenav): remove deprecated APIs for v11
Removes the APIs that were marked for removal in v11 from the `sidenav` module. BREAKING CHANGES: * `_container` parameter is now required in the `MatDrawer` constructor.
1 parent 0363236 commit 8481ea7

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

src/material/schematics/ng-update/data/constructor-checks.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export const constructorChecks: VersionChanges<ConstructorChecksUpgradeData> = {
2626
{
2727
pr: 'https://github.com/angular/components/pull/20545',
2828
changes: ['MatBottomSheet', 'MatBottomSheetRef']
29+
},
30+
{
31+
pr: 'https://github.com/angular/components/pull/20589',
32+
changes: ['MatDrawer']
2933
}
3034
],
3135
[TargetVersion.V10]: [

src/material/sidenav/drawer.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,8 @@ export class MatDrawer implements AfterContentInit, AfterContentChecked, OnDestr
262262
private _focusMonitor: FocusMonitor,
263263
private _platform: Platform,
264264
private _ngZone: NgZone,
265-
@Optional() @Inject(DOCUMENT) private _doc: any,
266-
/**
267-
* @deprecated `_container` parameter to be made required.
268-
* @breaking-change 10.0.0
269-
*/
270-
@Optional() @Inject(MAT_DRAWER_CONTAINER) public _container?: MatDrawerContainer) {
265+
@Inject(DOCUMENT) private _doc: any,
266+
@Inject(MAT_DRAWER_CONTAINER) public _container: MatDrawerContainer) {
271267

272268
this.openedChange.subscribe((opened: boolean) => {
273269
if (opened) {
@@ -626,8 +622,7 @@ export class MatDrawerContainer implements AfterContentInit, DoCheck, OnDestroy
626622
this._allDrawers.changes
627623
.pipe(startWith(this._allDrawers), takeUntil(this._destroyed))
628624
.subscribe((drawer: QueryList<MatDrawer>) => {
629-
// @breaking-change 10.0.0 Remove `_container` check once container parameter is required.
630-
this._drawers.reset(drawer.filter(item => !item._container || item._container === this));
625+
this._drawers.reset(drawer.filter(item => item._container === this));
631626
this._drawers.notifyOnChanges();
632627
});
633628

tools/public_api_guard/material/sidenav.d.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export declare class MatDrawer implements AfterContentInit, AfterContentChecked,
77
_animationStarted: Subject<AnimationEvent>;
88
_animationState: 'open-instant' | 'open' | 'void';
99
_closedStream: Observable<void>;
10-
_container?: MatDrawerContainer | undefined;
10+
_container: MatDrawerContainer;
1111
readonly _modeChanged: Subject<void>;
1212
_openedStream: Observable<void>;
1313
get autoFocus(): boolean;
@@ -24,8 +24,7 @@ export declare class MatDrawer implements AfterContentInit, AfterContentChecked,
2424
readonly openedStart: Observable<void>;
2525
get position(): 'start' | 'end';
2626
set position(value: 'start' | 'end');
27-
constructor(_elementRef: ElementRef<HTMLElement>, _focusTrapFactory: FocusTrapFactory, _focusMonitor: FocusMonitor, _platform: Platform, _ngZone: NgZone, _doc: any,
28-
_container?: MatDrawerContainer | undefined);
27+
constructor(_elementRef: ElementRef<HTMLElement>, _focusTrapFactory: FocusTrapFactory, _focusMonitor: FocusMonitor, _platform: Platform, _ngZone: NgZone, _doc: any, _container: MatDrawerContainer);
2928
_animationDoneListener(event: AnimationEvent): void;
3029
_animationStartListener(event: AnimationEvent): void;
3130
_closeViaBackdropClick(): Promise<MatDrawerToggleResult>;
@@ -40,7 +39,7 @@ export declare class MatDrawer implements AfterContentInit, AfterContentChecked,
4039
static ngAcceptInputType_disableClose: BooleanInput;
4140
static ngAcceptInputType_opened: BooleanInput;
4241
static ɵcmp: i0.ɵɵComponentDefWithMeta<MatDrawer, "mat-drawer", ["matDrawer"], { "position": "position"; "mode": "mode"; "disableClose": "disableClose"; "autoFocus": "autoFocus"; "opened": "opened"; }, { "openedChange": "openedChange"; "_openedStream": "opened"; "openedStart": "openedStart"; "_closedStream": "closed"; "closedStart": "closedStart"; "onPositionChanged": "positionChanged"; }, never, ["*"]>;
43-
static ɵfac: i0.ɵɵFactoryDef<MatDrawer, [null, null, null, null, null, { optional: true; }, { optional: true; }]>;
42+
static ɵfac: i0.ɵɵFactoryDef<MatDrawer, never>;
4443
}
4544

4645
export declare const matDrawerAnimations: {

0 commit comments

Comments
 (0)