Compare commits

..

No commits in common. "c6abf633f8ae5e9b562dda36f9f7ab4d6adcb4e1" and "a4eebb944f55da8e87cc899eebada0bd3fd37aa8" have entirely different histories.

4 changed files with 34 additions and 33 deletions

View file

@ -31,3 +31,7 @@ export const handle = sequence(
authorization, authorization,
createTRPCHandle({ router, createContext }), createTRPCHandle({ router, createContext }),
); );
// Allow server application to exit
process.on("SIGINT", () => process.exit()); // Ctrl+C
process.on("SIGTERM", () => process.exit()); // docker stop

View file

@ -166,14 +166,6 @@
if (opened) { if (opened) {
onClose(kb); onClose(kb);
} }
// select remaining item if autoselect is enabled
if (!selection) {
if (!noAutoselect1 && filteredItems.length === 1) {
selectListItem(filteredItems[0], true);
} else {
setInputValue("");
}
}
opened = false; opened = false;
} }
@ -193,38 +185,43 @@
} }
function onKeyDown(e: KeyboardEvent): void { function onKeyDown(e: KeyboardEvent): void {
switch (e.key) { let { key } = e;
case "Tab": if (key === "Tab" && e.shiftKey) key = "ShiftTab";
close(); const fnmap: Record<string, () => void> = {
break; Tab: () => close,
case "ArrowDown": ShiftTab: () => close,
ArrowDown: () => {
open(); open();
if (highlightIndex < filteredItems.length - 1) { if (highlightIndex < filteredItems.length - 1) {
highlightIndex++; highlightIndex++;
highlight(); highlight();
} }
break; },
case "ArrowUp": ArrowUp: () => {
open(); open();
if (highlightIndex > 0) { if (highlightIndex > 0) {
highlightIndex--; highlightIndex--;
highlight(); highlight();
} }
break; },
case "Escape": Escape: () => {
e.stopPropagation(); e.stopPropagation();
if (opened) { if (opened) {
if (inputElm) inputElm.focus(); if (inputElm) inputElm.focus();
close(); close();
} }
break; },
case "Backspace": Backspace: () => {
if (inputValue().length === 0) { if (inputValue().length === 0) {
onBackspace(); onBackspace();
} else if (selection) { } else if (selection) {
clearSelection(); clearSelection();
} }
break; },
};
const fn = fnmap[key];
if (typeof fn === "function") {
fn();
} }
} }
@ -237,6 +234,16 @@
} }
} }
function onBlur(): void {
if (!selection) {
if (!noAutoselect1 && filteredItems.length === 1) {
selectListItem(filteredItems[0], true);
} else {
setInputValue("");
}
}
}
function highlight(): void { function highlight(): void {
if (browser && opened) { if (browser && opened) {
window.setTimeout(() => { window.setTimeout(() => {
@ -296,11 +303,12 @@
on:focus={open} on:focus={open}
on:keydown={onKeyDown} on:keydown={onKeyDown}
on:keypress={onKeyPress} on:keypress={onKeyPress}
on:blur={onBlur}
use:floatingRef use:floatingRef
/> />
{#if opened && filteredItems.length > 0} {#if opened && filteredItems.length > 0}
<div bind:this={listElm} class="autocomplete-list" tabindex="-1" use:floatingContent> <div bind:this={listElm} class="autocomplete-list" use:floatingContent>
{#each filteredItems as item, i} {#each filteredItems as item, i}
<div <div
class="autocomplete-list-item" class="autocomplete-list-item"
@ -336,12 +344,7 @@
{#if clearBtn && selection} {#if clearBtn && selection}
<div class="absolute bottom-0 right-0 h-full flex items-center"> <div class="absolute bottom-0 right-0 h-full flex items-center">
<IconButton <IconButton cls="" path={mdiClose} title="Löschen" on:click={clearSelection} />
cls=""
path={mdiClose}
tabindex={-1}
title="Löschen"
on:click={clearSelection} />
</div> </div>
{/if} {/if}
</div> </div>

View file

@ -1,6 +1,4 @@
<script lang="ts"> <script lang="ts">
import { goto } from "$app/navigation";
import type { RouterOutput } from "$lib/shared/trpc"; import type { RouterOutput } from "$lib/shared/trpc";
import { formatDate } from "$lib/shared/util"; import { formatDate } from "$lib/shared/util";
@ -41,7 +39,6 @@
class="transition-colors hover:bg-neutral-content/10" class="transition-colors hover:bg-neutral-content/10"
class:done={entry.execution?.done} class:done={entry.execution?.done}
class:priority={entry.current_version.priority} class:priority={entry.current_version.priority}
on:dblclick={() => { void goto("/entry/" + entry.id); }}
> >
<td <td
><a ><a

View file

@ -1,6 +1,4 @@
<script lang="ts"> <script lang="ts">
import { goto } from "$app/navigation";
import { mdiFilter } from "@mdi/js"; import { mdiFilter } from "@mdi/js";
import { URL_ENTRIES } from "$lib/shared/constants"; import { URL_ENTRIES } from "$lib/shared/constants";
@ -36,7 +34,6 @@
<tr <tr
class="transition-colors hover:bg-neutral-content/10" class="transition-colors hover:bg-neutral-content/10"
class:p-hidden={patient.hidden} class:p-hidden={patient.hidden}
on:dblclick={() => { void goto("/patient/" + patient.id); }}
> >
<td <td
><a ><a