6
6
import * as dom from 'vs/base/browser/dom' ;
7
7
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
8
8
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent' ;
9
- import { IInputBoxStyles , InputBox , IRange , MessageType } from 'vs/base/browser/ui/inputbox/inputBox' ;
9
+ import { FindInput } from 'vs/base/browser/ui/findinput/findInput' ;
10
+ import { IInputBoxStyles , IRange , MessageType } from 'vs/base/browser/ui/inputbox/inputBox' ;
10
11
import { Disposable , IDisposable } from 'vs/base/common/lifecycle' ;
11
12
import Severity from 'vs/base/common/severity' ;
12
13
import 'vs/css!./media/quickInput' ;
@@ -16,113 +17,115 @@ const $ = dom.$;
16
17
export class QuickInputBox extends Disposable {
17
18
18
19
private container : HTMLElement ;
19
- private inputBox : InputBox ;
20
+ private findInput : FindInput ;
20
21
21
22
constructor (
22
23
private parent : HTMLElement
23
24
) {
24
25
super ( ) ;
25
26
this . container = dom . append ( this . parent , $ ( '.quick-input-box' ) ) ;
26
- this . inputBox = this . _register ( new InputBox ( this . container , undefined ) ) ;
27
+ this . findInput = this . _register ( new FindInput ( this . container , undefined , false , {
28
+ label : ''
29
+ } ) ) ;
27
30
}
28
31
29
32
onKeyDown = ( handler : ( event : StandardKeyboardEvent ) => void ) : IDisposable => {
30
- return dom . addDisposableListener ( this . inputBox . inputElement , dom . EventType . KEY_DOWN , ( e : KeyboardEvent ) => {
33
+ return dom . addDisposableListener ( this . findInput . inputBox . inputElement , dom . EventType . KEY_DOWN , ( e : KeyboardEvent ) => {
31
34
handler ( new StandardKeyboardEvent ( e ) ) ;
32
35
} ) ;
33
36
} ;
34
37
35
38
onMouseDown = ( handler : ( event : StandardMouseEvent ) => void ) : IDisposable => {
36
- return dom . addDisposableListener ( this . inputBox . inputElement , dom . EventType . MOUSE_DOWN , ( e : MouseEvent ) => {
39
+ return dom . addDisposableListener ( this . findInput . inputBox . inputElement , dom . EventType . MOUSE_DOWN , ( e : MouseEvent ) => {
37
40
handler ( new StandardMouseEvent ( e ) ) ;
38
41
} ) ;
39
42
} ;
40
43
41
44
onDidChange = ( handler : ( event : string ) => void ) : IDisposable => {
42
- return this . inputBox . onDidChange ( handler ) ;
45
+ return this . findInput . onDidChange ( handler ) ;
43
46
} ;
44
47
45
48
get value ( ) {
46
- return this . inputBox . value ;
49
+ return this . findInput . getValue ( ) ;
47
50
}
48
51
49
52
set value ( value : string ) {
50
- this . inputBox . value = value ;
53
+ this . findInput . setValue ( value ) ;
51
54
}
52
55
53
56
select ( range : IRange | null = null ) : void {
54
- this . inputBox . select ( range ) ;
57
+ this . findInput . inputBox . select ( range ) ;
55
58
}
56
59
57
60
isSelectionAtEnd ( ) : boolean {
58
- return this . inputBox . isSelectionAtEnd ( ) ;
61
+ return this . findInput . inputBox . isSelectionAtEnd ( ) ;
59
62
}
60
63
61
64
setPlaceholder ( placeholder : string ) : void {
62
- this . inputBox . setPlaceHolder ( placeholder ) ;
65
+ this . findInput . inputBox . setPlaceHolder ( placeholder ) ;
63
66
}
64
67
65
68
get placeholder ( ) {
66
- return this . inputBox . inputElement . getAttribute ( 'placeholder' ) || '' ;
69
+ return this . findInput . inputBox . inputElement . getAttribute ( 'placeholder' ) || '' ;
67
70
}
68
71
69
72
set placeholder ( placeholder : string ) {
70
- this . inputBox . setPlaceHolder ( placeholder ) ;
73
+ this . findInput . inputBox . setPlaceHolder ( placeholder ) ;
71
74
}
72
75
73
76
get ariaLabel ( ) {
74
- return this . inputBox . getAriaLabel ( ) ;
77
+ return this . findInput . inputBox . getAriaLabel ( ) ;
75
78
}
76
79
77
80
set ariaLabel ( ariaLabel : string ) {
78
- this . inputBox . setAriaLabel ( ariaLabel ) ;
81
+ this . findInput . inputBox . setAriaLabel ( ariaLabel ) ;
79
82
}
80
83
81
84
get password ( ) {
82
- return this . inputBox . inputElement . type === 'password' ;
85
+ return this . findInput . inputBox . inputElement . type === 'password' ;
83
86
}
84
87
85
88
set password ( password : boolean ) {
86
- this . inputBox . inputElement . type = password ? 'password' : 'text' ;
89
+ this . findInput . inputBox . inputElement . type = password ? 'password' : 'text' ;
87
90
}
88
91
89
92
set enabled ( enabled : boolean ) {
90
- this . inputBox . setEnabled ( enabled ) ;
93
+ this . findInput . setEnabled ( enabled ) ;
91
94
}
92
95
93
96
hasFocus ( ) : boolean {
94
- return this . inputBox . hasFocus ( ) ;
97
+ return this . findInput . inputBox . hasFocus ( ) ;
95
98
}
96
99
97
100
setAttribute ( name : string , value : string ) : void {
98
- this . inputBox . inputElement . setAttribute ( name , value ) ;
101
+ this . findInput . inputBox . inputElement . setAttribute ( name , value ) ;
99
102
}
100
103
101
104
removeAttribute ( name : string ) : void {
102
- this . inputBox . inputElement . removeAttribute ( name ) ;
105
+ this . findInput . inputBox . inputElement . removeAttribute ( name ) ;
103
106
}
104
107
105
108
showDecoration ( decoration : Severity ) : void {
106
109
if ( decoration === Severity . Ignore ) {
107
- this . inputBox . hideMessage ( ) ;
110
+ this . findInput . clearMessage ( ) ;
108
111
} else {
109
- this . inputBox . showMessage ( { type : decoration === Severity . Info ? MessageType . INFO : decoration === Severity . Warning ? MessageType . WARNING : MessageType . ERROR , content : '' } ) ;
112
+ this . findInput . showMessage ( { type : decoration === Severity . Info ? MessageType . INFO : decoration === Severity . Warning ? MessageType . WARNING : MessageType . ERROR , content : '' } ) ;
110
113
}
111
114
}
112
115
113
116
stylesForType ( decoration : Severity ) {
114
- return this . inputBox . stylesForType ( decoration === Severity . Info ? MessageType . INFO : decoration === Severity . Warning ? MessageType . WARNING : MessageType . ERROR ) ;
117
+ return this . findInput . inputBox . stylesForType ( decoration === Severity . Info ? MessageType . INFO : decoration === Severity . Warning ? MessageType . WARNING : MessageType . ERROR ) ;
115
118
}
116
119
117
120
setFocus ( ) : void {
118
- this . inputBox . focus ( ) ;
121
+ this . findInput . focus ( ) ;
119
122
}
120
123
121
124
layout ( ) : void {
122
- this . inputBox . layout ( ) ;
125
+ this . findInput . inputBox . layout ( ) ;
123
126
}
124
127
125
128
style ( styles : IInputBoxStyles ) : void {
126
- this . inputBox . style ( styles ) ;
129
+ this . findInput . style ( styles ) ;
127
130
}
128
131
}
0 commit comments