Compare commits
4 commits
a4eebb944f
...
c6abf633f8
Author | SHA1 | Date | |
---|---|---|---|
c6abf633f8 | |||
88a5040f9c | |||
cdb344609c | |||
4a3155c33a |
4 changed files with 33 additions and 34 deletions
|
@ -31,7 +31,3 @@ export const handle = sequence(
|
|||
authorization,
|
||||
createTRPCHandle({ router, createContext }),
|
||||
);
|
||||
|
||||
// Allow server application to exit
|
||||
process.on("SIGINT", () => process.exit()); // Ctrl+C
|
||||
process.on("SIGTERM", () => process.exit()); // docker stop
|
||||
|
|
|
@ -166,6 +166,14 @@
|
|||
if (opened) {
|
||||
onClose(kb);
|
||||
}
|
||||
// select remaining item if autoselect is enabled
|
||||
if (!selection) {
|
||||
if (!noAutoselect1 && filteredItems.length === 1) {
|
||||
selectListItem(filteredItems[0], true);
|
||||
} else {
|
||||
setInputValue("");
|
||||
}
|
||||
}
|
||||
opened = false;
|
||||
}
|
||||
|
||||
|
@ -185,43 +193,38 @@
|
|||
}
|
||||
|
||||
function onKeyDown(e: KeyboardEvent): void {
|
||||
let { key } = e;
|
||||
if (key === "Tab" && e.shiftKey) key = "ShiftTab";
|
||||
const fnmap: Record<string, () => void> = {
|
||||
Tab: () => close,
|
||||
ShiftTab: () => close,
|
||||
ArrowDown: () => {
|
||||
switch (e.key) {
|
||||
case "Tab":
|
||||
close();
|
||||
break;
|
||||
case "ArrowDown":
|
||||
open();
|
||||
if (highlightIndex < filteredItems.length - 1) {
|
||||
highlightIndex++;
|
||||
highlight();
|
||||
}
|
||||
},
|
||||
ArrowUp: () => {
|
||||
break;
|
||||
case "ArrowUp":
|
||||
open();
|
||||
if (highlightIndex > 0) {
|
||||
highlightIndex--;
|
||||
highlight();
|
||||
}
|
||||
},
|
||||
Escape: () => {
|
||||
break;
|
||||
case "Escape":
|
||||
e.stopPropagation();
|
||||
if (opened) {
|
||||
if (inputElm) inputElm.focus();
|
||||
close();
|
||||
}
|
||||
},
|
||||
Backspace: () => {
|
||||
break;
|
||||
case "Backspace":
|
||||
if (inputValue().length === 0) {
|
||||
onBackspace();
|
||||
} else if (selection) {
|
||||
clearSelection();
|
||||
}
|
||||
},
|
||||
};
|
||||
const fn = fnmap[key];
|
||||
if (typeof fn === "function") {
|
||||
fn();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,16 +237,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
function onBlur(): void {
|
||||
if (!selection) {
|
||||
if (!noAutoselect1 && filteredItems.length === 1) {
|
||||
selectListItem(filteredItems[0], true);
|
||||
} else {
|
||||
setInputValue("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function highlight(): void {
|
||||
if (browser && opened) {
|
||||
window.setTimeout(() => {
|
||||
|
@ -303,12 +296,11 @@
|
|||
on:focus={open}
|
||||
on:keydown={onKeyDown}
|
||||
on:keypress={onKeyPress}
|
||||
on:blur={onBlur}
|
||||
use:floatingRef
|
||||
/>
|
||||
|
||||
{#if opened && filteredItems.length > 0}
|
||||
<div bind:this={listElm} class="autocomplete-list" use:floatingContent>
|
||||
<div bind:this={listElm} class="autocomplete-list" tabindex="-1" use:floatingContent>
|
||||
{#each filteredItems as item, i}
|
||||
<div
|
||||
class="autocomplete-list-item"
|
||||
|
@ -344,7 +336,12 @@
|
|||
|
||||
{#if clearBtn && selection}
|
||||
<div class="absolute bottom-0 right-0 h-full flex items-center">
|
||||
<IconButton cls="" path={mdiClose} title="Löschen" on:click={clearSelection} />
|
||||
<IconButton
|
||||
cls=""
|
||||
path={mdiClose}
|
||||
tabindex={-1}
|
||||
title="Löschen"
|
||||
on:click={clearSelection} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { goto } from "$app/navigation";
|
||||
|
||||
import type { RouterOutput } from "$lib/shared/trpc";
|
||||
import { formatDate } from "$lib/shared/util";
|
||||
|
||||
|
@ -39,6 +41,7 @@
|
|||
class="transition-colors hover:bg-neutral-content/10"
|
||||
class:done={entry.execution?.done}
|
||||
class:priority={entry.current_version.priority}
|
||||
on:dblclick={() => { void goto("/entry/" + entry.id); }}
|
||||
>
|
||||
<td
|
||||
><a
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { goto } from "$app/navigation";
|
||||
|
||||
import { mdiFilter } from "@mdi/js";
|
||||
|
||||
import { URL_ENTRIES } from "$lib/shared/constants";
|
||||
|
@ -34,6 +36,7 @@
|
|||
<tr
|
||||
class="transition-colors hover:bg-neutral-content/10"
|
||||
class:p-hidden={patient.hidden}
|
||||
on:dblclick={() => { void goto("/patient/" + patient.id); }}
|
||||
>
|
||||
<td
|
||||
><a
|
||||
|
|
Loading…
Reference in a new issue