@@ -3,7 +3,7 @@ import { Dropdown, DropdownOptions } from "./dropdown";
3
3
import { Component , BaseOptions , InitElements , MElement } from "./component" ;
4
4
5
5
export interface AutocompleteData {
6
- /**
6
+ /**
7
7
* A primitive value that can be converted to string.
8
8
* If "text" is not provided, it will also be used as "option text" as well
9
9
*/
@@ -66,7 +66,7 @@ export interface AutocompleteOptions extends BaseOptions {
66
66
* @default {}
67
67
*/
68
68
dropdownOptions : Partial < DropdownOptions > ;
69
- } ;
69
+ }
70
70
71
71
const _defaults : AutocompleteOptions = {
72
72
data : [ ] , // Autocomplete data set
@@ -82,7 +82,7 @@ const _defaults: AutocompleteOptions = {
82
82
onSearch : ( text : string , autocomplete : Autocomplete ) => {
83
83
const normSearch = text . toLocaleLowerCase ( ) ;
84
84
autocomplete . setMenuItems (
85
- autocomplete . options . data . filter ( ( option ) =>
85
+ autocomplete . options . data . filter ( ( option ) =>
86
86
option . id . toString ( ) . toLocaleLowerCase ( ) . includes ( normSearch )
87
87
|| option . text ?. toLocaleLowerCase ( ) . includes ( normSearch )
88
88
)
@@ -118,7 +118,7 @@ export class Autocomplete extends Component<AutocompleteOptions> {
118
118
...Autocomplete . defaults ,
119
119
...options
120
120
} ;
121
-
121
+
122
122
this . isOpen = false ;
123
123
this . count = 0 ;
124
124
this . activeIndex = - 1 ;
@@ -230,6 +230,7 @@ export class Autocomplete extends Component<AutocompleteOptions> {
230
230
...Autocomplete . defaults . dropdownOptions ,
231
231
...this . options . dropdownOptions
232
232
} ;
233
+ // @todo shouldn't we conditionally check if dropdownOptions.onItemClick is set in first place?
233
234
const userOnItemClick = dropdownOptions . onItemClick ;
234
235
// Ensuring the select Option call when user passes custom onItemClick function to dropdown
235
236
dropdownOptions . onItemClick = ( li ) => {
@@ -270,6 +271,7 @@ export class Autocomplete extends Component<AutocompleteOptions> {
270
271
}
271
272
}
272
273
274
+ // @todo FocusEvent not having e.key parameter, should we split up this method for Keyup/Focus?
273
275
_handleInputKeyupAndFocus = ( e : KeyboardEvent ) => {
274
276
if ( e . type === 'keyup' ) Autocomplete . _keydown = false ;
275
277
this . count = 0 ;
0 commit comments