From 616e25ac27e5a410693d4f0fe29914174523108f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 15 Mar 2023 09:53:32 +0000 Subject: [PATCH] Add functional relationship cell --- .../components/sheet/KeyboardManager.svelte | 11 +- .../sheet/cells/AttachmentCell.svelte | 1 + .../sheet/cells/RelationshipCell.svelte | 240 ++++++++++++++++-- 3 files changed, 224 insertions(+), 28 deletions(-) diff --git a/packages/frontend-core/src/components/sheet/KeyboardManager.svelte b/packages/frontend-core/src/components/sheet/KeyboardManager.svelte index bbf7bfe9a9..3e85261155 100644 --- a/packages/frontend-core/src/components/sheet/KeyboardManager.svelte +++ b/packages/frontend-core/src/components/sheet/KeyboardManager.svelte @@ -31,9 +31,11 @@ // Pass the key event to the selected cell and let it decide whether to // capture it or not - const handled = api?.onKeyDown?.(e) - if (handled) { - return + if (!api?.isReadonly()) { + const handled = api?.onKeyDown?.(e) + if (handled) { + return + } } e.preventDefault() @@ -120,6 +122,9 @@ }, 100) const focusSelectedCell = () => { + if ($selectedCellAPI?.isReadonly()) { + return + } $selectedCellAPI?.focus?.() } diff --git a/packages/frontend-core/src/components/sheet/cells/AttachmentCell.svelte b/packages/frontend-core/src/components/sheet/cells/AttachmentCell.svelte index ed94423083..da42254b13 100644 --- a/packages/frontend-core/src/components/sheet/cells/AttachmentCell.svelte +++ b/packages/frontend-core/src/components/sheet/cells/AttachmentCell.svelte @@ -128,6 +128,7 @@ text-transform: uppercase; font-weight: 600; font-size: 10px; + user-select: none; } img { height: calc(var(--cell-height) - 12px); diff --git a/packages/frontend-core/src/components/sheet/cells/RelationshipCell.svelte b/packages/frontend-core/src/components/sheet/cells/RelationshipCell.svelte index 3898426c12..de850f0e0f 100644 --- a/packages/frontend-core/src/components/sheet/cells/RelationshipCell.svelte +++ b/packages/frontend-core/src/components/sheet/cells/RelationshipCell.svelte @@ -1,48 +1,150 @@