Skip to content

Commit 818a8c7

Browse files
crisbetommalerba
authored andcommitted
refactor(select): remove deprecated APIs for 9.0.0 (#17230)
BREAKING CHANGES: * `MatSelect.focused` is now a readonly property. * `_liveAnnouncer` constructor parameter is now required. * `transformPanel` constant has been removed. Use `matSelectAnimations.transformPanel`. * `matSelectAnimations.fadeInContent` has been removed.
1 parent c7c40fe commit 818a8c7

File tree

4 files changed

+10
-53
lines changed

4 files changed

+10
-53
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import {ConstructorChecksUpgradeData, TargetVersion, VersionChanges} from '@angu
1414
* automatically through type checking.
1515
*/
1616
export const constructorChecks: VersionChanges<ConstructorChecksUpgradeData> = {
17+
[TargetVersion.V9]: [
18+
{
19+
pr: 'https://github.com/angular/components/pull/17230',
20+
changes: ['MatSelect']
21+
}
22+
],
1723
[TargetVersion.V8]: [
1824
{
1925
pr: 'https://github.com/angular/components/pull/15647',

src/material/select/select-animations.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
export const matSelectAnimations: {
2828
readonly transformPanelWrap: AnimationTriggerMetadata;
2929
readonly transformPanel: AnimationTriggerMetadata;
30-
readonly fadeInContent: AnimationTriggerMetadata;
3130
} = {
3231
/**
3332
* This animation ensures the select's overlay panel animation (transformPanel) is called when
@@ -66,35 +65,5 @@ export const matSelectAnimations: {
6665
})),
6766
transition('void => *', animate('120ms cubic-bezier(0, 0, 0.2, 1)')),
6867
transition('* => void', animate('100ms 25ms linear', style({opacity: 0})))
69-
]),
70-
71-
/**
72-
* This animation fades in the background color and text content of the
73-
* select's options. It is time delayed to occur 100ms after the overlay
74-
* panel has transformed in.
75-
* @deprecated Not used anymore. To be removed.
76-
* @breaking-change 8.0.0
77-
*/
78-
fadeInContent: trigger('fadeInContent', [
79-
state('showing', style({opacity: 1})),
80-
transition('void => showing', [
81-
style({opacity: 0}),
82-
animate('150ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')
83-
])
8468
])
8569
};
86-
87-
88-
/**
89-
* @deprecated
90-
* @breaking-change 8.0.0
91-
* @docs-private
92-
*/
93-
export const transformPanel = matSelectAnimations.transformPanel;
94-
95-
/**
96-
* @deprecated
97-
* @breaking-change 8.0.0
98-
* @docs-private
99-
*/
100-
export const fadeInContent = matSelectAnimations.fadeInContent;

src/material/select/select.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,6 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
321321
get focused(): boolean {
322322
return this._focused || this._panelOpen;
323323
}
324-
/**
325-
* @deprecated Setter to be removed as this property is intended to be readonly.
326-
* @breaking-change 8.0.0
327-
*/
328-
set focused(value: boolean) {
329-
this._focused = value;
330-
}
331324
private _focused = false;
332325

333326
/** A name for this control that can be used by `mat-form-field`. */
@@ -495,11 +488,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
495488
@Self() @Optional() public ngControl: NgControl,
496489
@Attribute('tabindex') tabIndex: string,
497490
@Inject(MAT_SELECT_SCROLL_STRATEGY) scrollStrategyFactory: any,
498-
/**
499-
* @deprecated _liveAnnouncer to be turned into a required parameter.
500-
* @breaking-change 8.0.0
501-
*/
502-
private _liveAnnouncer?: LiveAnnouncer) {
491+
private _liveAnnouncer: LiveAnnouncer) {
503492
super(elementRef, _defaultErrorStateMatcher, _parentForm,
504493
_parentFormGroup, ngControl);
505494

@@ -739,8 +728,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
739728
const selectedOption = this.selected;
740729

741730
// Since the value has changed, we need to announce it ourselves.
742-
// @breaking-change 8.0.0 remove null check for _liveAnnouncer.
743-
if (this._liveAnnouncer && selectedOption && previouslySelectedOption !== selectedOption) {
731+
if (selectedOption && previouslySelectedOption !== selectedOption) {
744732
// We set a duration on the live announcement, because we want the live element to be
745733
// cleared after a while so that users can't navigate to it using the arrow keys.
746734
this._liveAnnouncer.announce((selectedOption as MatOption).viewValue, 10000);

tools/public_api_guard/material/select.d.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export declare const fadeInContent: AnimationTriggerMetadata;
2-
31
export declare const MAT_SELECT_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
42

53
export declare const MAT_SELECT_SCROLL_STRATEGY_PROVIDER: {
@@ -39,7 +37,7 @@ export declare class MatSelect extends _MatSelectMixinBase implements AfterConte
3937
disableOptionCentering: boolean;
4038
readonly empty: boolean;
4139
errorStateMatcher: ErrorStateMatcher;
42-
focused: boolean;
40+
readonly focused: boolean;
4341
id: string;
4442
multiple: boolean;
4543
ngControl: NgControl;
@@ -64,8 +62,7 @@ export declare class MatSelect extends _MatSelectMixinBase implements AfterConte
6462
typeaheadDebounceInterval: number;
6563
value: any;
6664
readonly valueChange: EventEmitter<any>;
67-
constructor(_viewportRuler: ViewportRuler, _changeDetectorRef: ChangeDetectorRef, _ngZone: NgZone, _defaultErrorStateMatcher: ErrorStateMatcher, elementRef: ElementRef, _dir: Directionality, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _parentFormField: MatFormField, ngControl: NgControl, tabIndex: string, scrollStrategyFactory: any,
68-
_liveAnnouncer?: LiveAnnouncer | undefined);
65+
constructor(_viewportRuler: ViewportRuler, _changeDetectorRef: ChangeDetectorRef, _ngZone: NgZone, _defaultErrorStateMatcher: ErrorStateMatcher, elementRef: ElementRef, _dir: Directionality, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _parentFormField: MatFormField, ngControl: NgControl, tabIndex: string, scrollStrategyFactory: any, _liveAnnouncer: LiveAnnouncer);
6966
_calculateOverlayScroll(selectedIndex: number, scrollBuffer: number, maxScroll: number): number;
7067
_getAriaActiveDescendant(): string | null;
7168
_getAriaLabel(): string | null;
@@ -96,7 +93,6 @@ export declare class MatSelect extends _MatSelectMixinBase implements AfterConte
9693
export declare const matSelectAnimations: {
9794
readonly transformPanelWrap: AnimationTriggerMetadata;
9895
readonly transformPanel: AnimationTriggerMetadata;
99-
readonly fadeInContent: AnimationTriggerMetadata;
10096
};
10197

10298
export declare class MatSelectChange {
@@ -124,5 +120,3 @@ export declare const SELECT_PANEL_MAX_HEIGHT = 256;
124120
export declare const SELECT_PANEL_PADDING_X = 16;
125121

126122
export declare const SELECT_PANEL_VIEWPORT_PADDING = 8;
127-
128-
export declare const transformPanel: AnimationTriggerMetadata;

0 commit comments

Comments
 (0)