1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-18 01:03:26 +00:00

Run prettier in feature branch

This commit is contained in:
Thomas Rittson
2021-12-17 06:09:55 +10:00
parent 44b0d51336
commit 1acfa54f00
593 changed files with 47237 additions and 42401 deletions

View File

@@ -1,33 +1,28 @@
import {
Directive,
ElementRef,
Input,
NgZone,
} from '@angular/core';
import { Directive, ElementRef, Input, NgZone } from "@angular/core";
import { take } from 'rxjs/operators';
import { take } from "rxjs/operators";
import { Utils } from 'jslib-common/misc/utils';
import { Utils } from "jslib-common/misc/utils";
@Directive({
selector: '[appAutofocus]',
selector: "[appAutofocus]",
})
export class AutofocusDirective {
@Input() set appAutofocus(condition: boolean | string) {
this.autofocus = condition === '' || condition === true;
}
private autofocus: boolean;
constructor(private el: ElementRef, private ngZone: NgZone) { }
ngOnInit() {
if (!Utils.isMobileBrowser && this.autofocus) {
if (this.ngZone.isStable) {
this.el.nativeElement.focus();
} else {
this.ngZone.onStable.pipe(take(1)).subscribe(() => this.el.nativeElement.focus());
}
}
@Input() set appAutofocus(condition: boolean | string) {
this.autofocus = condition === "" || condition === true;
}
private autofocus: boolean;
constructor(private el: ElementRef, private ngZone: NgZone) {}
ngOnInit() {
if (!Utils.isMobileBrowser && this.autofocus) {
if (this.ngZone.isStable) {
this.el.nativeElement.focus();
} else {
this.ngZone.onStable.pipe(take(1)).subscribe(() => this.el.nativeElement.focus());
}
}
}
}