Merge branch 'bugfix/autocomplete' into dev
This commit is contained in:
@@ -116,6 +116,7 @@
|
||||
<Route path="/project/:project_id/add_task" component={AddTask} />
|
||||
<Route path="/project/:id/kanban" component={Kanban} />
|
||||
<Route path="/project/:id/view" component={ViewPrj} />
|
||||
<Route path="/project/:id" component={ViewPrj} />
|
||||
<Route path="/search" component={Search} />
|
||||
<Route path="/stock" component={Stock} />
|
||||
<Route path="/stock/location/:location_id" component={Stock} />
|
||||
|
||||
@@ -63,6 +63,11 @@
|
||||
selected = null;
|
||||
}
|
||||
|
||||
function onblur(ev){
|
||||
candidates = [];
|
||||
selected = null;
|
||||
}
|
||||
|
||||
async function onkeyup(ev){
|
||||
if (ignore.includes(ev.key)) return;
|
||||
if (ev.key == 'ArrowDown'){
|
||||
@@ -145,11 +150,11 @@
|
||||
</style>
|
||||
|
||||
<span class="autocomplete">
|
||||
<input type="text" bind:value={candidate.display} {onkeyup} autofocus={autofocus} {id} />
|
||||
<input type="text" bind:value={candidate.display} {onkeyup} autofocus={autofocus} {id} {onblur} />
|
||||
{#if candidates && candidates.length > 0}
|
||||
<ul bind:this={list_elem} class="suggestions">
|
||||
<ul bind:this={list_elem} class="suggestions" tabindex="-1">
|
||||
{#each candidates as candidate,i}
|
||||
<li class="option {selected==i?'highlight':''}" onclick={e => select(i)} ondblclick={e => select(i)}>{candidate.display}</li>
|
||||
<li class="option {selected==i?'highlight':''}" tabindex="-1" onclick={e => select(i)} ondblclick={e => select(i)}>{candidate.display}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user