Skip to content

Commit 4d64bb7

Browse files
committed
fix(material/core): delete deprecated APIs
Deletes the mixin APIs that have been deprecated for a while and aren't used anywhere. BREAKING CHANGES: * `mixinColor` and `CanColor` have been removed. Use a host binding instead. * `mixinDisableRipple` and `CanDisableRipple` have been removed. Use input transforms instead. * `mixinDisabled` and `CanDisable` have been removed. Use input transforms instead. * `mixinInitialized` and `HasInitialized` have been removed. Use a `Subject` that emits in `ngOnInit` instead. * `mixinTabIndex` and `HasTabIndex` have been removed. Use input transforms instead.
1 parent 3bf0e31 commit 4d64bb7

15 files changed

+13
-664
lines changed

src/material/core/common-behaviors/color.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {mixinColor} from './color';
1+
import {mixinColor} from './palette';
22
import {ElementRef} from '@angular/core';
33

44
describe('MixinColor', () => {

src/material/core/common-behaviors/color.ts

Lines changed: 0 additions & 77 deletions
This file was deleted.

src/material/core/common-behaviors/constructor.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/material/core/common-behaviors/disable-ripple.spec.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/material/core/common-behaviors/disable-ripple.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/material/core/common-behaviors/disabled.spec.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/material/core/common-behaviors/disabled.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/material/core/common-behaviors/error-state.ts

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,10 @@
99
import {AbstractControl, FormGroupDirective, NgControl, NgForm} from '@angular/forms';
1010
import {Subject} from 'rxjs';
1111
import {ErrorStateMatcher as _ErrorStateMatcher} from '../error/error-options';
12-
import {AbstractConstructor, Constructor} from './constructor';
1312

1413
// Declare ErrorStateMatcher as an interface to have compatibility with Closure Compiler.
1514
interface ErrorStateMatcher extends _ErrorStateMatcher {}
1615

17-
/**
18-
* @docs-private
19-
* @deprecated Will be removed together with `mixinErrorState`.
20-
* @breaking-change 19.0.0
21-
*/
22-
export interface CanUpdateErrorState {
23-
/** Updates the error state based on the provided error state matcher. */
24-
updateErrorState(): void;
25-
/** Whether the component is in an error state. */
26-
errorState: boolean;
27-
/** An object used to control the error state of the component. */
28-
errorStateMatcher: ErrorStateMatcher;
29-
}
30-
31-
type CanUpdateErrorStateCtor = Constructor<CanUpdateErrorState> &
32-
AbstractConstructor<CanUpdateErrorState>;
33-
34-
/** @docs-private */
35-
interface HasErrorState {
36-
_parentFormGroup: FormGroupDirective | null;
37-
_parentForm: NgForm | null;
38-
_defaultErrorStateMatcher: ErrorStateMatcher;
39-
40-
// These properties are defined as per the `MatFormFieldControl` interface. Since
41-
// this mixin is commonly used with custom form-field controls, we respect the
42-
// properties (also with the public name they need according to `MatFormFieldControl`).
43-
ngControl: NgControl | null;
44-
stateChanges: Subject<void>;
45-
}
46-
4716
/**
4817
* Class that tracks the error state of a component.
4918
* @docs-private
@@ -77,59 +46,3 @@ export class _ErrorStateTracker {
7746
}
7847
}
7948
}
80-
81-
/**
82-
* Mixin to augment a directive with updateErrorState method.
83-
* For component with `errorState` and need to update `errorState`.
84-
* @deprecated Implement the `updateErrorState` method directly.
85-
* @breaking-change 19.0.0
86-
*/
87-
export function mixinErrorState<T extends AbstractConstructor<HasErrorState>>(
88-
base: T,
89-
): CanUpdateErrorStateCtor & T;
90-
export function mixinErrorState<T extends Constructor<HasErrorState>>(
91-
base: T,
92-
): CanUpdateErrorStateCtor & T {
93-
return class extends base {
94-
private _tracker: _ErrorStateTracker | undefined;
95-
96-
/** Whether the component is in an error state. */
97-
get errorState() {
98-
return this._getTracker().errorState;
99-
}
100-
set errorState(value: boolean) {
101-
this._getTracker().errorState = value;
102-
}
103-
104-
/** An object used to control the error state of the component. */
105-
get errorStateMatcher() {
106-
return this._getTracker().matcher;
107-
}
108-
set errorStateMatcher(value: ErrorStateMatcher) {
109-
this._getTracker().matcher = value;
110-
}
111-
112-
/** Updates the error state based on the provided error state matcher. */
113-
updateErrorState() {
114-
this._getTracker().updateErrorState();
115-
}
116-
117-
private _getTracker() {
118-
if (!this._tracker) {
119-
this._tracker = new _ErrorStateTracker(
120-
this._defaultErrorStateMatcher,
121-
this.ngControl,
122-
this._parentFormGroup,
123-
this._parentForm,
124-
this.stateChanges,
125-
);
126-
}
127-
128-
return this._tracker;
129-
}
130-
131-
constructor(...args: any[]) {
132-
super(...args);
133-
}
134-
};
135-
}

src/material/core/common-behaviors/index.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,5 @@ export {
1313
GranularSanityChecks,
1414
} from './common-module';
1515

16-
// Note: These need to be exposed privately for cross-package type inference. e.g. if the
17-
// experimental package uses a mixin, TS will try to write an explicit type reference that
18-
// is equivalent to e.g. `CanColorCtor`. For this it needs these two helpers as otherwise it
19-
// would generate a deep cross-package import that breaks in the NPM package output.
20-
export {
21-
Constructor as _Constructor,
22-
AbstractConstructor as _AbstractConstructor,
23-
} from './constructor';
24-
25-
export {CanDisable, mixinDisabled} from './disabled';
26-
export {CanColor, mixinColor, ThemePalette} from './color';
27-
export {CanDisableRipple, mixinDisableRipple} from './disable-ripple';
28-
export {HasTabIndex, mixinTabIndex} from './tabindex';
29-
export {CanUpdateErrorState, mixinErrorState, _ErrorStateTracker} from './error-state';
30-
export {HasInitialized, mixinInitialized} from './initialized';
16+
export {ThemePalette} from './palette';
17+
export {_ErrorStateTracker} from './error-state';

0 commit comments

Comments
 (0)