From d8a36d1e5295134de9874c47a5f798b8ce8dde6c Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Thu, 25 Jul 2024 10:43:39 +0200 Subject: [PATCH] Implement links of type "text" --- .../logic/RecursiveEasyDBDetailView.svelte | 56 ++++++++++++------- src/components/splitter/Panel.svelte | 3 +- src/components/splitter/TabItem.svelte | 3 +- src/components/splitter/Tabs.svelte | 3 +- src/lib/easydbHelpers.js | 5 +- 5 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/components/logic/RecursiveEasyDBDetailView.svelte b/src/components/logic/RecursiveEasyDBDetailView.svelte index 9009910..5de4df1 100644 --- a/src/components/logic/RecursiveEasyDBDetailView.svelte +++ b/src/components/logic/RecursiveEasyDBDetailView.svelte @@ -1,5 +1,5 @@ {#if fields.length > 0} @@ -97,7 +103,7 @@ {#if firstField.output[output] } {/if} - + {:else if firstField.kind === "linked-table" } {#if firstField.output[output] && hasSubData(data, table, firstField)} {#if !condensed } @@ -109,56 +115,68 @@ {#each linkedSubData(data, table, firstField) as subdata}
  • - +
  • {/each}
    {/if} - + {:else if firstField.kind === "reverse-linked-table" } {#if firstField.output[output] && hasReverseSubData(data, table, firstField) } {#each reverseLinkedSubData(data, table, firstField) as subdata } - + {/each} {/if} - + {:else if firstField.kind === "splitter" } {#if firstField.type === "panel-begin" } - - + + - + {:else if firstField.type === "tabs-begin" } - + {#each findTabs() as tab} - - + + {/each} - + {:else if firstField.type === "split" } - + {:else if firstField.type === "custom-begin" } - + {:else}

    Splitter of type {firstField.type} not yet implemented.

    - + {/if} {:else if firstField.kind === "link" } {#if firstField.output[output] } - + {#if firstField.inline === "standard" } + + {:else if firstField.inline === "text" } + + {#await loadAdditionalUUID(firstField)} + Loading... + {:then additionalData} + + {/await} + + {:else} + + {/if} {/if} - + {:else} - + {/if} {/if} diff --git a/src/components/splitter/Panel.svelte b/src/components/splitter/Panel.svelte index f3e8d5a..46f55b6 100644 --- a/src/components/splitter/Panel.svelte +++ b/src/components/splitter/Panel.svelte @@ -7,11 +7,12 @@ export let data; export let fields; export let table; + export let output; const options = JSON.parse(fields[0].options); -{#if hasContent(data, table, fields)} +{#if hasContent(data, table, fields, output)} {splitterTitle(data, table, options, $appLanguageStore)} diff --git a/src/components/splitter/TabItem.svelte b/src/components/splitter/TabItem.svelte index 09a25d8..784e601 100644 --- a/src/components/splitter/TabItem.svelte +++ b/src/components/splitter/TabItem.svelte @@ -6,12 +6,13 @@ export let data; export let fields; export let table; + export let output; export let open; const options = JSON.parse(fields[0].options); -{#if hasContent(data, table, fields) } +{#if hasContent(data, table, fields, output) } diff --git a/src/components/splitter/Tabs.svelte b/src/components/splitter/Tabs.svelte index 03b4384..b03419a 100644 --- a/src/components/splitter/Tabs.svelte +++ b/src/components/splitter/Tabs.svelte @@ -5,9 +5,10 @@ export let data; export let table; export let fields; + export let output; -{#if hasContent(data, table, fields) } +{#if hasContent(data, table, fields, output) } diff --git a/src/lib/easydbHelpers.js b/src/lib/easydbHelpers.js index 43bc21e..176e8e9 100644 --- a/src/lib/easydbHelpers.js +++ b/src/lib/easydbHelpers.js @@ -69,8 +69,11 @@ export function splitterTitle(data, table, options, lang) { return bestLanguage(get(easydbInstanceDataStore).l10n[`mask.${get(easydbInstanceDataStore).schemas[table].table_id}.${maskObj(data).name}.splitter.${String(options.splitterIdx)}`], lang); } -export function hasContent(data, table, fields) { +export function hasContent(data, table, fields, output) { for (let field of fields) { + if (("output" in field) && (field.output[output] === false)) { + continue; + } if (((field.kind === 'field') || (field.kind === 'link')) && (hasField(data, table, field))) { return true; }