diff --git a/jslib b/jslib index bb8cf89788..f673bd62d7 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit bb8cf8978860b68d9f8011b0da0cb8588e729b37 +Subproject commit f673bd62d7abb773fa5a6abfb5307b7c3feca59b diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8328e22c06..28394a5409 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -29,7 +29,7 @@ import { TwoFactorComponent } from './accounts/two-factor.component'; import { ApiActionDirective } from 'jslib/angular/directives/api-action.directive'; import { AutofocusDirective } from 'jslib/angular/directives/autofocus.directive'; import { BlurClickDirective } from 'jslib/angular/directives/blur-click.directive'; -import { BoxRowDirective } from './directives/box-row.directive'; +import { BoxRowDirective } from 'jslib/angular/directives/box-row.directive'; import { FallbackSrcDirective } from 'jslib/angular/directives/fallback-src.directive'; import { StopClickDirective } from 'jslib/angular/directives/stop-click.directive'; import { StopPropDirective } from 'jslib/angular/directives/stop-prop.directive'; diff --git a/src/app/directives/box-row.directive.ts b/src/app/directives/box-row.directive.ts deleted file mode 100644 index 241a5b3f82..0000000000 --- a/src/app/directives/box-row.directive.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - Directive, - ElementRef, - HostListener, - OnInit, -} from '@angular/core'; - -@Directive({ - selector: '[appBoxRow]', -}) -export class BoxRowDirective implements OnInit { - el: HTMLElement = null; - formEls: NodeListOf; - - constructor(private elRef: ElementRef) { - this.el = elRef.nativeElement; - } - - ngOnInit(): void { - this.formEls = this.el.querySelectorAll('input:not([type="hidden"]), select, textarea'); - this.formEls.forEach((formEl) => { - formEl.addEventListener('focus', (event: Event) => { - this.el.classList.add('active'); - }, false); - - formEl.addEventListener('blur', (event: Event) => { - this.el.classList.remove('active'); - }, false); - }); - } - - @HostListener('click', ['$event']) onClick(event: Event) { - if (event.target !== this.el) { - return; - } - - if (this.formEls.length > 0) { - const formEl = (this.formEls[0] as HTMLElement); - if (formEl.tagName.toLowerCase() === 'input') { - const inputEl = (formEl as HTMLInputElement); - if (inputEl.type != null && inputEl.type.toLowerCase() === 'checkbox') { - inputEl.click(); - return; - } - } - formEl.focus(); - } - } -}