Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 71x 71x 71x 71x 71x 1x 1x 1x 1x | import { Component, EventEmitter, Input, Output } from '@angular/core';
import { catchError, Observable, of } from 'rxjs';
import { AutofocusDirective } from '../../../directive/autofocus.directive';
import { LoadingComponent } from '../../loading/loading.component';
import { ActionComponent } from '../action.component';
@Component({
selector: 'app-inline-password',
templateUrl: './inline-password.component.html',
styleUrls: ['./inline-password.component.scss'],
host: { 'class': 'action' },
imports: [AutofocusDirective, LoadingComponent]
})
export class InlinePasswordComponentI extends ActionComponent {
@Input()
action: (password: string) => Observable<any|never> = () => of(null);
@Output()
error = new EventEmitter<string>();
editing = false;
acting = false;
override reset() {
this.editing = false;
this.acting = false;
}
override active() {
return this.editing || this.acting;
}
save(field: HTMLInputElement) {
const password = (field.value || '').trim();
if (!password) {
this.editing = false;
return;
}
this.editing = false;
this.acting = true;
this.action(password).pipe(
catchError(() => of(null)),
).subscribe(() => this.acting = false);
}
}
|