implemented mouse action on dropdown
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -42,6 +42,16 @@
|
|||||||
console.warn(`${candidate.display} selected, but onSelect not overridden!`)
|
console.warn(`${candidate.display} selected, but onSelect not overridden!`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function ondblclick(evt){
|
||||||
|
const select = evt.target;
|
||||||
|
const idx = select.value;
|
||||||
|
candidate = candidates[idx];
|
||||||
|
candidates = [];
|
||||||
|
selected = [];
|
||||||
|
console.log(candidate);
|
||||||
|
onSelect(candidate);
|
||||||
|
}
|
||||||
|
|
||||||
async function onkeyup(ev){
|
async function onkeyup(ev){
|
||||||
if (ignore.includes(ev.key)) return;
|
if (ignore.includes(ev.key)) return;
|
||||||
if (ev.key == 'ArrowDown'){
|
if (ev.key == 'ArrowDown'){
|
||||||
@@ -96,7 +106,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<input type="text" bind:value={candidate.display} {onkeyup} />
|
<input type="text" bind:value={candidate.display} {onkeyup} />
|
||||||
{#if candidates && candidates.length > 0}
|
{#if candidates && candidates.length > 0}
|
||||||
<select bind:value={selected} multiple tabindex="-1">
|
<select bind:value={selected} {ondblclick} multiple tabindex="-1">
|
||||||
{#each candidates as candidate,i}
|
{#each candidates as candidate,i}
|
||||||
<option value={i}>{candidate.display}</option>
|
<option value={i}>{candidate.display}</option>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
Reference in New Issue
Block a user