diff --git a/frontend/src/lib/components/DisplayResult.svelte b/frontend/src/lib/components/DisplayResult.svelte index 2abb4fda30..9fd6e3fab9 100644 --- a/frontend/src/lib/components/DisplayResult.svelte +++ b/frontend/src/lib/components/DisplayResult.svelte @@ -14,6 +14,7 @@ export let disableExpand = false export let jobId: string | undefined = undefined export let workspaceId: string | undefined = undefined + export let disableDetails = false let resultKind: | 'json' @@ -132,15 +133,18 @@ > - {/if}{#if typeof result == 'object' && Object.keys(result).length > 0}
The result keys are: {truncate(Object.keys(result).join(', '), 50)} - {#if !disableExpand} -
- - -
- {/if} + {/if} + {#if typeof result == 'object' && Object.keys(result).length > 0} +
+ {#if !disableDetails} + The result keys are: {truncate(Object.keys(result).join(', '), 50)} + {/if} + {#if !disableExpand} +
+ + +
+ {/if}
{/if}{#if !forceJson && resultKind == 'table-col'}
@@ -296,6 +300,7 @@ {/if}
+ {#if !disableExpand} diff --git a/frontend/src/lib/components/apps/components/display/AppDisplayComponent.svelte b/frontend/src/lib/components/apps/components/display/AppDisplayComponent.svelte index f98779d77c..53a3acd306 100644 --- a/frontend/src/lib/components/apps/components/display/AppDisplayComponent.svelte +++ b/frontend/src/lib/components/apps/components/display/AppDisplayComponent.svelte @@ -2,27 +2,38 @@ import DisplayResult from '$lib/components/DisplayResult.svelte' import { getContext } from 'svelte' import { twMerge } from 'tailwind-merge' - import { initOutput } from '../../editor/appUtils' + import { initConfig, initOutput } from '../../editor/appUtils' import type { AppInput } from '../../inputType' import { IS_APP_PUBLIC_CONTEXT_KEY, type AppViewerContext, - type ComponentCustomCSS + type ComponentCustomCSS, + + type RichConfigurations + } from '../../types' import RunnableWrapper from '../helpers/RunnableWrapper.svelte' import { initCss } from '../../utils' import ResolveStyle from '../helpers/ResolveStyle.svelte' + import { components } from '../../editor/component' + import ResolveConfig from '../helpers/ResolveConfig.svelte' export let id: string export let componentInput: AppInput | undefined export let initializing: boolean | undefined = undefined export let customCss: ComponentCustomCSS<'displaycomponent'> | undefined = undefined export let render: boolean + export let configuration: RichConfigurations const requireHtmlApproval = getContext(IS_APP_PUBLIC_CONTEXT_KEY) const { app, worldStore, componentControl } = getContext('AppViewerContext') let result: any = undefined + const resolvedConfig = initConfig( + components['displaycomponent'].initialData.configuration, + configuration + ) + $componentControl[id] = { setValue(value: string) { result = value @@ -37,6 +48,15 @@ let css = initCss($app.css?.displaycomponent, customCss) +{#each Object.keys(components['displaycomponent'].initialData.configuration) as key (key)} + +{/each} + {#each Object.keys(css ?? {}) as key (key)} - Results + {resolvedConfig?.title ?? 'Result'}
- +
diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index c1318a3b61..a29bf32878 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -271,7 +271,6 @@ $: $cssEditorOpen && secondaryMenuLeft?.open(StylePanel, {}) function animateCssInput(cssEditorOpen: boolean) { - console.log(cssEditorOpen, cssToggled) if (cssEditorOpen && !cssToggled) { cssToggled = true diff --git a/frontend/src/lib/components/apps/editor/component/Component.svelte b/frontend/src/lib/components/apps/editor/component/Component.svelte index cfb8fda986..811d78e0c3 100644 --- a/frontend/src/lib/components/apps/editor/component/Component.svelte +++ b/frontend/src/lib/components/apps/editor/component/Component.svelte @@ -146,6 +146,7 @@ customCss={component.customCss} bind:initializing componentInput={component.componentInput} + configuration={component.configuration} {render} /> {:else if component.type === 'logcomponent'} diff --git a/frontend/src/lib/components/apps/editor/component/components.ts b/frontend/src/lib/components/apps/editor/component/components.ts index d5a93cee23..766925164e 100644 --- a/frontend/src/lib/components/apps/editor/component/components.ts +++ b/frontend/src/lib/components/apps/editor/component/components.ts @@ -476,7 +476,20 @@ export const components = { fieldType: 'object', value: { foo: 42 } }, - configuration: {} + configuration: { + title: { + type: 'static', + fieldType: 'text', + value: 'Result' + }, + hideDetails: { + type: 'static', + fieldType: 'boolean', + value: false, + tooltip: + 'Hide the details section: the object keys, the clipboard button and the maximise button' + } + } } }, jobidlogcomponent: { diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte index eca086ac0a..b94b631a8a 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte @@ -25,7 +25,7 @@ let tab: 'local' | 'global' = 'local' let overrideGlobalCSS: (() => void) | undefined = undefined let overrideLocalCSS: (() => void) | undefined = undefined - let type = component?.type + $: type = component?.type let migrationModal: CssMigrationModal | undefined = undefined $: customCssByComponentType =