From 985b8aa3ff8d1a81b8b75830781a8f5e6c126fe8 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 12 Jul 2018 17:53:47 -0400 Subject: [PATCH] LP#1779158 Export form focus improvements Signed-off-by: Bill Erickson --- .../src/app/staff/cat/vandelay/export.component.html | 8 +++++--- .../eg2/src/app/staff/cat/vandelay/export.component.ts | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.html b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.html index 71f960f877..020e09748b 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.html @@ -13,7 +13,7 @@
-
@@ -36,7 +36,8 @@
- +
@@ -48,7 +49,8 @@
- +
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.ts index 577da79bfd..d7e4d0784f 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; +import {Component, AfterViewInit, ViewChild, Renderer2} from '@angular/core'; import {NgbPanelChangeEvent} from '@ng-bootstrap/ng-bootstrap'; import {HttpClient, HttpRequest, HttpEventType} from '@angular/common/http'; import {HttpResponse, HttpErrorResponse} from '@angular/common/http'; @@ -12,7 +12,7 @@ import {VandelayService, VANDELAY_EXPORT_PATH} from './vandelay.service'; @Component({ templateUrl: 'export.component.html' }) -export class ExportComponent implements OnInit { +export class ExportComponent implements AfterViewInit { recordSource: string; fieldNumber: number; @@ -30,8 +30,9 @@ export class ExportComponent implements OnInit { private exportProgress: ProgressInlineComponent; constructor( - private http: HttpClient, - private toast: ToastService, + private renderer: Renderer2, + private http: HttpClient, + private toast: ToastService, private auth: AuthService ) { this.recordType = 'biblio'; @@ -40,11 +41,18 @@ export class ExportComponent implements OnInit { this.includeHoldings = false; } - ngOnInit() { + ngAfterViewInit() { + this.renderer.selectRootElement('#csv-input').focus(); } sourceChange($event: NgbPanelChangeEvent) { this.recordSource = $event.panelId; + + // Give the tab a chance to change before focusing. + setTimeout(() => + this.renderer.selectRootElement( + '#' + this.recordSource + '-input').focus() + ) } fileSelected($event) { -- 2.11.0