]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/autofocus.directive.ts
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / directives / autofocus.directive.ts
1 import { AfterViewInit, Directive, ElementRef } from '@angular/core';
2
3 import * as _ from 'lodash';
4
5 @Directive({
6 selector: '[autofocus]' // tslint:disable-line
7 })
8 export class AutofocusDirective implements AfterViewInit {
9 constructor(private elementRef: ElementRef) {}
10
11 ngAfterViewInit() {
12 const el: HTMLInputElement = this.elementRef.nativeElement;
13 if (_.isFunction(el.focus)) {
14 el.focus();
15 }
16 }
17 }