]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/eg2/src/app/share/dialog/prompt.component.ts
LP 2061136 follow-up: ng lint --fix
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / share / dialog / prompt.component.ts
1 import {Component, Input, ViewChild, OnInit, TemplateRef} from '@angular/core';
2 import {DialogComponent} from '@eg/share/dialog/dialog.component';
3
4 @Component({
5     selector: 'eg-prompt-dialog',
6     templateUrl: './prompt.component.html'
7 })
8
9 /**
10  * Promptation dialog that requests user input.
11  */
12 export class PromptDialogComponent extends DialogComponent implements OnInit {
13     static domId = 0;
14
15     @Input() inputDomId = 'eg-prompt-dialog-' + PromptDialogComponent.domId++;
16
17     // What question are we asking?
18     @Input() public dialogBody: string;
19     // Value to return to the caller
20     @Input() public promptValue: string;
21     // 'password', etc.
22     @Input() promptType = 'text';
23
24     // May be used when promptType == 'number'
25     @Input() promptMin: number = null;
26     @Input() promptMax: number = null;
27
28     ngOnInit() {
29         this.onOpen$.subscribe(_ => {
30             const node = document.getElementById(this.inputDomId) as HTMLInputElement;
31             if (node) { node.focus(); node.select(); }
32         });
33     }
34 }
35
36