|
1 | | -import {Component, Directive, Provider, Input, ViewChild, HostBinding, ElementRef, HostListener, forwardRef} from 'angular2/core'; |
| 1 | +import {Component, Directive, Provider, ViewChild, HostBinding, ElementRef, HostListener, forwardRef} from 'angular2/core'; |
2 | 2 | import {ControlValueAccessor, NG_VALUE_ACCESSOR} from 'angular2/common'; |
3 | 3 | import {Search, SearchValueAccessor} from '../search'; |
4 | 4 | import {DropdownMenu} from '../dropdown'; |
@@ -128,6 +128,10 @@ export class Select extends Search { |
128 | 128 | this.selectedOptions.splice(index, 1); |
129 | 129 | this.selectedOptionsHTML.splice(index, 1); |
130 | 130 | this.selectedOptionChange.emit(this.selectedOptions); |
| 131 | + |
| 132 | + if (this.isSearchable) { |
| 133 | + this.focusFirstItem(); |
| 134 | + } |
131 | 135 | } |
132 | 136 |
|
133 | 137 | //noinspection JSMethodCanBeStatic |
@@ -181,31 +185,12 @@ export class Select extends Search { |
181 | 185 | var lastSelectedOption = selectedOptions[selectedOptions.length - 1]; |
182 | 186 | if (lastSelectedOption) { |
183 | 187 | this.deselectOption(lastSelectedOption); |
| 188 | + |
184 | 189 | } |
185 | 190 | } |
186 | 191 | } |
187 | 192 | } |
188 | 193 |
|
189 | | -@Component({ |
190 | | - selector: 'sui-select-option', |
191 | | - template: `<ng-content></ng-content>` |
192 | | -}) |
193 | | -export class SelectOption { |
194 | | - @HostBinding('class.item') itemClass = true; |
195 | | - |
196 | | - @Input() |
197 | | - public value:any; |
198 | | - |
199 | | - constructor(private host:Select, private el:ElementRef) { } |
200 | | - |
201 | | - @HostListener('click', ['$event']) |
202 | | - public click(event):boolean { |
203 | | - event.stopPropagation(); |
204 | | - this.host.selectOption(this.value, this.el.nativeElement.innerHTML); |
205 | | - return false; |
206 | | - } |
207 | | -} |
208 | | - |
209 | 194 | const CUSTOM_VALUE_ACCESSOR = new Provider(NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => SelectValueAccessor), multi: true}); |
210 | 195 |
|
211 | 196 | @Directive({ |
|
0 commit comments