From e322bd239bd46f5a323fc4bcdc58ab5804b1d89c Mon Sep 17 00:00:00 2001 From: Tim Haasdyk Date: Thu, 16 Jan 2025 14:09:41 +0100 Subject: [PATCH] Hide reordering UI for Complex Forms --- .../src/lib/entry-editor/EntryOrSenseItemList.svelte | 7 ++++--- .../{OrderedItemList.svelte => ItemList.svelte} | 5 +++-- .../field-editors/ComplexFormComponents.svelte | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) rename frontend/viewer/src/lib/entry-editor/{OrderedItemList.svelte => ItemList.svelte} (97%) diff --git a/frontend/viewer/src/lib/entry-editor/EntryOrSenseItemList.svelte b/frontend/viewer/src/lib/entry-editor/EntryOrSenseItemList.svelte index d4a49b995..fb7bd2a8e 100644 --- a/frontend/viewer/src/lib/entry-editor/EntryOrSenseItemList.svelte +++ b/frontend/viewer/src/lib/entry-editor/EntryOrSenseItemList.svelte @@ -1,5 +1,5 @@ - `?entryId=${getEntryId(entry)}&search=${getHeadword(entry)?.replace(/\d?$/, '')}`}> @@ -25,4 +26,4 @@ - + diff --git a/frontend/viewer/src/lib/entry-editor/OrderedItemList.svelte b/frontend/viewer/src/lib/entry-editor/ItemList.svelte similarity index 97% rename from frontend/viewer/src/lib/entry-editor/OrderedItemList.svelte rename to frontend/viewer/src/lib/entry-editor/ItemList.svelte index 5f6be1d8d..acd4799f3 100644 --- a/frontend/viewer/src/lib/entry-editor/OrderedItemList.svelte +++ b/frontend/viewer/src/lib/entry-editor/ItemList.svelte @@ -13,6 +13,7 @@ export let value: T[]; export let readonly: boolean; + export let orderable = false; export let getDisplayName: (item: T) => string | undefined; export let getGotoLink: ((item: T) => string) | undefined = undefined; @@ -47,7 +48,7 @@ } -
+
{#each value as item, i} {@const gotoLink = getGotoLink?.(item)} {@const displayName = getDisplayName(item) || '–'} @@ -69,7 +70,7 @@ {@const first = i === 0} {@const last = i === count - 1} {@const only = count === 1} - {#if !only} + {#if orderable && !only} diff --git a/frontend/viewer/src/lib/entry-editor/field-editors/ComplexFormComponents.svelte b/frontend/viewer/src/lib/entry-editor/field-editors/ComplexFormComponents.svelte index b800ea0bc..cf09b9fac 100644 --- a/frontend/viewer/src/lib/entry-editor/field-editors/ComplexFormComponents.svelte +++ b/frontend/viewer/src/lib/entry-editor/field-editors/ComplexFormComponents.svelte @@ -58,7 +58,7 @@ >
- dispatch('change', { value })} getEntryId={(e) => e.componentEntryId} getHeadword={(e) => e.componentHeadword}> + dispatch('change', { value })} getEntryId={(e) => e.componentEntryId} getHeadword={(e) => e.componentHeadword}>