From be1d987b4151b4300a8054a11df5a7658bb90d89 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 20 Mar 2023 16:04:50 +0100 Subject: [PATCH] fix table action input fields --- .../apps/components/buttons/AppButton.svelte | 14 ++++++++++++-- .../components/display/table/AppTable.svelte | 19 ++++++++++++++++--- .../helpers/RunnableComponent.svelte | 10 ++++++++-- .../components/helpers/RunnableWrapper.svelte | 2 ++ .../lib/components/apps/editor/appUtils.ts | 11 ++++++++++- .../triggerLists/ComponentTriggerList.svelte | 2 +- 6 files changed, 49 insertions(+), 9 deletions(-) diff --git a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte index e013680e1a..dcf4fe0e7d 100644 --- a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte +++ b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte @@ -26,11 +26,13 @@ export let customCss: ComponentCustomCSS<'buttoncomponent'> | undefined = undefined export let render: boolean export let initializing: boolean | undefined = true + export let extraKey: string | undefined = undefined export let controls: { left: () => boolean; right: () => boolean | string } | undefined = undefined - const { worldStore, app, componentControl } = getContext('AppViewerContext') + const { worldStore, app, componentControl, selectedComponent } = + getContext('AppViewerContext') let outputs = initOutput($worldStore, id, { result: undefined, @@ -94,6 +96,8 @@ event?.stopPropagation() event?.preventDefault() + $selectedComponent = id + if (preclickAction) { await preclickAction() } @@ -115,7 +119,12 @@ {#each configurationKeys['buttoncomponent'] as key (key)} - + {/each} {#if errorsMessage} diff --git a/frontend/src/lib/components/apps/components/display/table/AppTable.svelte b/frontend/src/lib/components/apps/components/display/table/AppTable.svelte index 5273062c64..b2f8c7abb5 100644 --- a/frontend/src/lib/components/apps/components/display/table/AppTable.svelte +++ b/frontend/src/lib/components/apps/components/display/table/AppTable.svelte @@ -52,7 +52,7 @@ let table = createSvelteTable(options) - const { app, worldStore, componentControl, selectedComponent } = + const { app, worldStore, componentControl, selectedComponent, hoverStore } = getContext('AppViewerContext') let selectedRowIndex = -1 @@ -262,11 +262,22 @@
{#each actionButtons as actionButton, actionIndex (actionIndex)}
{ + if (actionButton.id !== $hoverStore) { + $hoverStore = actionButton.id + } + }} + on:mouseout|stopPropagation={() => { + if ($hoverStore !== undefined) { + $hoverStore = undefined + } + }} + class={actionButton.id === $selectedComponent || + $hoverStore === actionButton.id ? 'outline outline-indigo-500 outline-1 outline-offset-1 relative ' : ''} > - {#if actionButton.id === $selectedComponent} + {#if actionButton.id === $selectedComponent || $hoverStore === actionButton.id} {:else} ; loading: Output } + export let extraKey = '' const { worldStore, @@ -282,13 +283,18 @@ {#each Object.entries(fields ?? {}) as [key, v] (key)} {#if v.type != 'static' && v.type != 'user'} - + {/if} {/each} {#if runnable?.type == 'runnableByName' && runnable.inlineScript?.language == 'frontend'} {#each runnable.inlineScript.refreshOn ?? [] as { id: tid, key } (`${tid}-${key}`)} - {@const fkey = `${tid}-${key}`} + {@const fkey = `${tid}-${key}${extraKey}`} ; loading: Output } + export let extraKey: string | undefined = undefined const { staticExporter, noBackend } = getContext('AppViewerContext') @@ -46,6 +47,7 @@ {:else if componentInput.type === 'runnable' && isRunnableDefined(componentInput)} x.id)) + } + } + return subIds } return getAllSubgridsAndComponentIds(app, item?.data)[1] } @@ -199,6 +205,9 @@ export function getAllSubgridsAndComponentIds( ): [string[], string[]] { const subgrids: string[] = [] let components: string[] = [component.id] + if (component.type === 'tablecomponent') { + components.push(...component.actionButtons?.map((x) => x.id)) + } if (app.subgrids && component.numberOfSubgrids) { for (let i = 0; i < component.numberOfSubgrids; i++) { const key = `${component.id}-${i}` diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte index 8419d77a41..1a0256911f 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/triggerLists/ComponentTriggerList.svelte @@ -30,7 +30,7 @@