From 69deb69f3fdbb34ca92c285f07bf7461c33dbe74 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 11 Sep 2020 15:58:57 +0200 Subject: [PATCH] refactor(bottom-sheet): remove deprecated APIs for v11 Removes the APIs that were marked as deprecated for v11. BREAKING CHANGES: * `_location` parameter has been removed from the `MatBottomSheet` constructor. * `_location` parameter has been removed from the `MatBottomSheetRef` constructor. --- src/material/bottom-sheet/bottom-sheet-ref.ts | 5 +---- src/material/bottom-sheet/bottom-sheet.ts | 4 +--- .../schematics/ng-update/data/constructor-checks.ts | 4 ++++ tools/public_api_guard/material/bottom-sheet.d.ts | 6 +++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/material/bottom-sheet/bottom-sheet-ref.ts b/src/material/bottom-sheet/bottom-sheet-ref.ts index b088c61e57fc..efe33d6ce647 100644 --- a/src/material/bottom-sheet/bottom-sheet-ref.ts +++ b/src/material/bottom-sheet/bottom-sheet-ref.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {Location} from '@angular/common'; import {ESCAPE, hasModifierKey} from '@angular/cdk/keycodes'; import {OverlayRef} from '@angular/cdk/overlay'; import {merge, Observable, Subject} from 'rxjs'; @@ -44,9 +43,7 @@ export class MatBottomSheetRef { constructor( containerInstance: MatBottomSheetContainer, - private _overlayRef: OverlayRef, - // @breaking-change 8.0.0 `_location` parameter to be removed. - _location?: Location) { + private _overlayRef: OverlayRef) { this.containerInstance = containerInstance; this.disableClose = containerInstance.bottomSheetConfig.disableClose; diff --git a/src/material/bottom-sheet/bottom-sheet.ts b/src/material/bottom-sheet/bottom-sheet.ts index beaae0d05dc4..fd32bf5866da 100644 --- a/src/material/bottom-sheet/bottom-sheet.ts +++ b/src/material/bottom-sheet/bottom-sheet.ts @@ -21,7 +21,6 @@ import { OnDestroy, StaticProvider, } from '@angular/core'; -import {Location} from '@angular/common'; import {of as observableOf} from 'rxjs'; import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetConfig} from './bottom-sheet-config'; import {MatBottomSheetContainer} from './bottom-sheet-container'; @@ -58,7 +57,6 @@ export class MatBottomSheet implements OnDestroy { private _overlay: Overlay, private _injector: Injector, @Optional() @SkipSelf() private _parentBottomSheet: MatBottomSheet, - @Optional() private _location?: Location, @Optional() @Inject(MAT_BOTTOM_SHEET_DEFAULT_OPTIONS) private _defaultOptions?: MatBottomSheetConfig) {} @@ -74,7 +72,7 @@ export class MatBottomSheet implements OnDestroy { _applyConfigDefaults(this._defaultOptions || new MatBottomSheetConfig(), config); const overlayRef = this._createOverlay(_config); const container = this._attachContainer(overlayRef, _config); - const ref = new MatBottomSheetRef(container, overlayRef, this._location); + const ref = new MatBottomSheetRef(container, overlayRef); if (componentOrTemplateRef instanceof TemplateRef) { container.attachTemplatePortal(new TemplatePortal(componentOrTemplateRef, null!, { diff --git a/src/material/schematics/ng-update/data/constructor-checks.ts b/src/material/schematics/ng-update/data/constructor-checks.ts index 8958fbea9ff2..f1e07426de94 100644 --- a/src/material/schematics/ng-update/data/constructor-checks.ts +++ b/src/material/schematics/ng-update/data/constructor-checks.ts @@ -22,6 +22,10 @@ export const constructorChecks: VersionChanges = { { pr: 'https://github.com/angular/components/pull/20449', changes: ['MatDatepickerContent'] + }, + { + pr: 'https://github.com/angular/components/pull/20545', + changes: ['MatBottomSheet', 'MatBottomSheetRef'] } ], [TargetVersion.V10]: [ diff --git a/tools/public_api_guard/material/bottom-sheet.d.ts b/tools/public_api_guard/material/bottom-sheet.d.ts index 2244d09fd3fc..17565ce6307c 100644 --- a/tools/public_api_guard/material/bottom-sheet.d.ts +++ b/tools/public_api_guard/material/bottom-sheet.d.ts @@ -5,12 +5,12 @@ export declare const MAT_BOTTOM_SHEET_DEFAULT_OPTIONS: InjectionToken | null; set _openedBottomSheetRef(value: MatBottomSheetRef | null); - constructor(_overlay: Overlay, _injector: Injector, _parentBottomSheet: MatBottomSheet, _location?: Location | undefined, _defaultOptions?: MatBottomSheetConfig | undefined); + constructor(_overlay: Overlay, _injector: Injector, _parentBottomSheet: MatBottomSheet, _defaultOptions?: MatBottomSheetConfig | undefined); dismiss(result?: R): void; ngOnDestroy(): void; open(component: ComponentType, config?: MatBottomSheetConfig): MatBottomSheetRef; open(template: TemplateRef, config?: MatBottomSheetConfig): MatBottomSheetRef; - static ɵfac: i0.ɵɵFactoryDef; + static ɵfac: i0.ɵɵFactoryDef; static ɵprov: i0.ɵɵInjectableDef; } @@ -61,7 +61,7 @@ export declare class MatBottomSheetRef { containerInstance: MatBottomSheetContainer; disableClose: boolean | undefined; instance: T; - constructor(containerInstance: MatBottomSheetContainer, _overlayRef: OverlayRef, _location?: Location); + constructor(containerInstance: MatBottomSheetContainer, _overlayRef: OverlayRef); afterDismissed(): Observable; afterOpened(): Observable; backdropClick(): Observable;