Commit e5235bf 1 parent 76f0122 commit e5235bf Copy full SHA for e5235bf
File tree 2 files changed +7
-12
lines changed
src/lib/holocene/combobox
2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change 14
14
15
15
export let id = ' ' ;
16
16
17
- function keypress (stuff ) {
17
+ function input (stuff : CustomEvent ) {
18
18
loading = true ;
19
- value = stuff .target . value ;
20
-
19
+ value = stuff .detail ;
20
+ console . log ( value );
21
21
options = syncOptions ;
22
22
23
23
// This makes sure the worst case always happens the newest value comes first
41
41
// console.log("it's old!", { value });
42
42
}
43
43
},
44
- 2000 + i * 100 ,
44
+ 2000 + i * 25 ,
45
45
value ,
46
46
);
47
47
}
50
50
<Combobox
51
51
bind:value
52
52
{options }
53
- { keypress }
53
+ on:input ={ input }
54
54
on:change ={(newVal ) => {
55
55
console .log (' change' , newVal );
56
56
}}
Original file line number Diff line number Diff line change 24
24
change: { value: string | T };
25
25
filter: string ;
26
26
close: { selectedOption: string | T };
27
+ input: string ;
27
28
}>();
28
29
29
30
type ExtendedInputEvent = Event & {
48
49
actionTooltip? : string ;
49
50
href? : string ;
50
51
hrefDisabled? : boolean ;
51
- /**
52
- * Use Keypress to receive the event after the combobox has done it's updating for async operations
53
- * @param event
54
- */
55
- keypress? : (event : KeyboardEvent ) => void ;
56
52
loading? : boolean ;
57
53
loadingText? : string ;
58
54
}
99
95
export let label: string ;
100
96
export let multiselect = false ;
101
97
export let value: string | string [] = multiselect ? [] : undefined ;
102
- export let keypress: BaseProps [' keypress' ] = () => {};
103
98
export let noResultsText: string ;
104
99
export let disabled = false ;
105
100
export let labelHidden = false ;
331
326
// Reactive statement at top makes this work, not my favorite tho
332
327
displayValue = event .currentTarget .value ;
333
328
filterValue = displayValue ;
329
+ dispatch (' input' , displayValue );
334
330
};
335
331
336
332
function filterOptions(value : string , options : (T | string )[]) {
418
414
on:focus |stopPropagation ={openList }
419
415
on:input |stopPropagation ={handleInput }
420
416
on:keydown |stopPropagation ={handleInputKeydown }
421
- on:keyup ={keypress }
422
417
on:click |stopPropagation ={handleInputClick }
423
418
data-testid ={$$props [' data-testid' ] ?? id }
424
419
bind:this ={inputElement }
You can’t perform that action at this time.
0 commit comments