refactor(focus-monitor): make checkChildren parameter optional (#9384)

After we made the `renderer` param optional, `checkChildren` became required when using the two-param signature. These changes make it optional which is slightly more convenient on consumption.
This commit is contained in:
Kristiyan Kostadinov
2018-01-23 16:45:30 +01:00
committed by Jeremy Elbourn
parent b491f7afab
commit 9177fbf766
7 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ describe('FocusMonitor', () => {
focusMonitor = fm;
changeHandler = jasmine.createSpy('focus origin change handler');
focusMonitor.monitor(buttonElement, false).subscribe(changeHandler);
focusMonitor.monitor(buttonElement).subscribe(changeHandler);
patchElementFocus(buttonElement);
}));
+2 -2
View File
@@ -82,10 +82,10 @@ export class FocusMonitor {
* @returns An observable that emits when the focus state of the element changes.
* When the element is blurred, null will be emitted.
*/
monitor(element: HTMLElement, checkChildren: boolean): Observable<FocusOrigin>;
monitor(element: HTMLElement, checkChildren?: boolean): Observable<FocusOrigin>;
monitor(
element: HTMLElement,
renderer: Renderer2 | boolean,
renderer?: Renderer2 | boolean,
checkChildren?: boolean): Observable<FocusOrigin> {
// TODO(mmalerba): clean up after deprecated signature is removed.
if (!(renderer instanceof Renderer2)) {
+1 -1
View File
@@ -215,7 +215,7 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
ngAfterViewInit() {
this._focusMonitor
.monitor(this._inputElement.nativeElement, false)
.monitor(this._inputElement.nativeElement)
.subscribe(focusOrigin => this._onInputFocusChange(focusOrigin));
}
+1 -1
View File
@@ -80,7 +80,7 @@ export class MatExpansionPanelHeader implements OnDestroy {
)
.subscribe(() => this._changeDetectorRef.markForCheck());
_focusMonitor.monitor(_element.nativeElement, false);
_focusMonitor.monitor(_element.nativeElement);
}
/** Height of the header while the panel is expanded. */
+1 -1
View File
@@ -533,7 +533,7 @@ export class MatRadioButton extends _MatRadioButtonMixinBase
ngAfterViewInit() {
this._focusMonitor
.monitor(this._inputElement.nativeElement, false)
.monitor(this._inputElement.nativeElement)
.subscribe(focusOrigin => this._onInputFocusChange(focusOrigin));
}
+1 -1
View File
@@ -159,7 +159,7 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
this._slideRenderer = new SlideToggleRenderer(this._elementRef, this._platform);
this._focusMonitor
.monitor(this._inputElement.nativeElement, false)
.monitor(this._inputElement.nativeElement)
.subscribe(focusOrigin => this._onInputFocusChange(focusOrigin));
}
+1 -1
View File
@@ -217,7 +217,7 @@ export class MatTooltip implements OnDestroy {
element.style.webkitUserSelect = element.style.userSelect = '';
}
_focusMonitor.monitor(element, false).subscribe(origin => {
_focusMonitor.monitor(element).subscribe(origin => {
// Note that the focus monitor runs outside the Angular zone.
if (!origin) {
_ngZone.run(() => this.hide(0));