diff --git a/frontend/src/lib/components/apps/components/display/AppBarChart.svelte b/frontend/src/lib/components/apps/components/display/AppBarChart.svelte index 661ab89bc1..be145a812b 100644 --- a/frontend/src/lib/components/apps/components/display/AppBarChart.svelte +++ b/frontend/src/lib/components/apps/components/display/AppBarChart.svelte @@ -13,12 +13,13 @@ } from 'chart.js' import { getContext } from 'svelte' import { Bar, Line } from 'svelte-chartjs' - import { initOutput } from '../../editor/appUtils' + import { initConfig, initOutput } from '../../editor/appUtils' import type { AppInput } from '../../inputType' import type { AppViewerContext, ComponentCustomCSS, RichConfigurations } from '../../types' import { concatCustomCss } from '../../utils' - import InputValue from '../helpers/InputValue.svelte' import RunnableWrapper from '../helpers/RunnableWrapper.svelte' + import { components } from '../../editor/component' + import ResolveConfig from '../helpers/ResolveConfig.svelte' export let id: string export let componentInput: AppInput | undefined export let configuration: RichConfigurations @@ -28,6 +29,11 @@ const { app, worldStore } = getContext('AppViewerContext') + let resolvedConfig = initConfig( + components['barchartcomponent'].initialData.configuration, + configuration + ) + let outputs = initOutput($worldStore, id, { result: undefined, loading: false @@ -45,8 +51,6 @@ ) let result: { data: number[]; labels?: string[] } | undefined = undefined - let theme: string = 'theme1' - let lineChart = false $: backgroundColor = { theme1: ['#FF6384', '#4BC0C0', '#FFCE56', '#E7E9ED', '#36A2EB'], @@ -54,7 +58,7 @@ theme2: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', '#e74a3b'], // red theme theme3: ['#e74a3b', '#4e73df', '#1cc88a', '#36b9cc', '#f6c23e'] - }[theme] + }[resolvedConfig.theme ?? 'theme1'] const lineOptions: ChartOptions<'line'> = { responsive: true, @@ -104,13 +108,19 @@ $: css = concatCustomCss($app.css?.barchartcomponent, customCss) - - +{#each Object.keys(components['barchartcomponent'].initialData.configuration) as key (key)} + +{/each}
{#if result} - {#if lineChart} + {#if resolvedConfig.line} {:else} diff --git a/frontend/src/lib/components/apps/components/display/AppIcon.svelte b/frontend/src/lib/components/apps/components/display/AppIcon.svelte index fca0b3ec54..c83e9b46d1 100644 --- a/frontend/src/lib/components/apps/components/display/AppIcon.svelte +++ b/frontend/src/lib/components/apps/components/display/AppIcon.svelte @@ -1,11 +1,13 @@ - - - - - +{#each Object.keys(components['iconcomponent'].initialData.configuration) as key (key)} + +{/each} - {#if icon && iconComponent} + {#if resolvedConfig.icon && iconComponent} diff --git a/frontend/src/lib/components/apps/components/display/AppMap.svelte b/frontend/src/lib/components/apps/components/display/AppMap.svelte index ce00480f77..9605166c2a 100644 --- a/frontend/src/lib/components/apps/components/display/AppMap.svelte +++ b/frontend/src/lib/components/apps/components/display/AppMap.svelte @@ -196,10 +196,10 @@ } - - - - + + + + diff --git a/frontend/src/lib/components/apps/components/display/AppPdf.svelte b/frontend/src/lib/components/apps/components/display/AppPdf.svelte index 35afea1804..d47fd6fbb5 100644 --- a/frontend/src/lib/components/apps/components/display/AppPdf.svelte +++ b/frontend/src/lib/components/apps/components/display/AppPdf.svelte @@ -190,8 +190,8 @@ $: css = concatCustomCss($app.css?.pdfcomponent, customCss) - - + + diff --git a/frontend/src/lib/components/apps/components/display/AppPieChart.svelte b/frontend/src/lib/components/apps/components/display/AppPieChart.svelte index 54beb30307..1136eab759 100644 --- a/frontend/src/lib/components/apps/components/display/AppPieChart.svelte +++ b/frontend/src/lib/components/apps/components/display/AppPieChart.svelte @@ -75,8 +75,8 @@ $: css = concatCustomCss($app.css?.piechartcomponent, customCss) - - + +
diff --git a/frontend/src/lib/components/apps/components/display/AppScatterChart.svelte b/frontend/src/lib/components/apps/components/display/AppScatterChart.svelte index 6f9638816e..a5b1650759 100644 --- a/frontend/src/lib/components/apps/components/display/AppScatterChart.svelte +++ b/frontend/src/lib/components/apps/components/display/AppScatterChart.svelte @@ -81,8 +81,8 @@ $: css = concatCustomCss($app.css?.scatterchartcomponent, customCss) - - + +
diff --git a/frontend/src/lib/components/apps/components/display/AppTimeseries.svelte b/frontend/src/lib/components/apps/components/display/AppTimeseries.svelte index d33288870c..9f10c04449 100644 --- a/frontend/src/lib/components/apps/components/display/AppTimeseries.svelte +++ b/frontend/src/lib/components/apps/components/display/AppTimeseries.svelte @@ -95,9 +95,14 @@ $: css = concatCustomCss($app.css?.timeseriescomponent, customCss) - - - + + +
diff --git a/frontend/src/lib/components/apps/components/display/VegaLiteHtml.svelte b/frontend/src/lib/components/apps/components/display/VegaLiteHtml.svelte index 7957beeeda..dbb5210ba0 100644 --- a/frontend/src/lib/components/apps/components/display/VegaLiteHtml.svelte +++ b/frontend/src/lib/components/apps/components/display/VegaLiteHtml.svelte @@ -57,7 +57,7 @@ ) - +
diff --git a/frontend/src/lib/components/apps/components/helpers/NonRunnableComponent.svelte b/frontend/src/lib/components/apps/components/helpers/NonRunnableComponent.svelte index 200e3e203f..6401043308 100644 --- a/frontend/src/lib/components/apps/components/helpers/NonRunnableComponent.svelte +++ b/frontend/src/lib/components/apps/components/helpers/NonRunnableComponent.svelte @@ -29,7 +29,7 @@ {#if componentInput.type !== 'runnable'} - + {/if} {#if render} diff --git a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte index 37ab7697e5..6a01d872bd 100644 --- a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte +++ b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte @@ -462,7 +462,7 @@ {#if v.type != 'static' && v.type != 'user'} import Toggle from '$lib/components/Toggle.svelte' import { getContext } from 'svelte' - import { initOutput } from '../../editor/appUtils' + import { initConfig, initOutput } from '../../editor/appUtils' import type { AppViewerContext, ComponentCustomCSS, @@ -12,7 +12,8 @@ import { concatCustomCss } from '../../utils' import AlignWrapper from '../helpers/AlignWrapper.svelte' import InitializeComponent from '../helpers/InitializeComponent.svelte' - import { InputValue } from '../helpers' + import { components } from '../../editor/component' + import ResolveConfig from '../helpers/ResolveConfig.svelte' export let id: string export let configuration: RichConfigurations @@ -34,11 +35,12 @@ const rowContext = getContext('RowWrapperContext') const rowInputs: ListInputs | undefined = getContext('RowInputs') - let value: boolean = false + let resolvedConfig = initConfig( + components['checkboxcomponent'].initialData.configuration, + configuration + ) - let defaultValue: boolean | undefined = undefined - let label: string = '' - let disabled: boolean = false + let value: boolean = resolvedConfig.defaultValue ?? false $componentControl[id] = { setValue(nvalue: boolean) { @@ -71,33 +73,39 @@ } function handleDefault() { - value = defaultValue ?? false + value = resolvedConfig.defaultValue ?? false handleInput() } $: value != undefined && handleInput() - $: defaultValue != undefined && handleDefault() + $: resolvedConfig.defaultValue != undefined && handleDefault() $: css = concatCustomCss($app.css?.checkboxcomponent, customCss) - - - +{#each Object.keys(components['checkboxcomponent'].initialData.configuration) as key (key)} + +{/each} { preclickAction?.() value = e.detail }} - {disabled} + disabled={resolvedConfig.disabled} /> diff --git a/frontend/src/lib/components/apps/components/inputs/AppDateInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppDateInput.svelte index 3aa9dcc3e7..b50b51d1bd 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppDateInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppDateInput.svelte @@ -1,13 +1,14 @@ - - - - - +{#each Object.keys(components['dateinputcomponent'].initialData.configuration) as key (key)} + +{/each} @@ -74,8 +78,8 @@ on:pointerdown|stopPropagation type="date" bind:value - min={minValue} - max={maxValue} + min={resolvedConfig.minDate} + max={resolvedConfig.maxDate} placeholder="Type..." class={twMerge(css?.input?.class ?? '')} style={css?.input?.style ?? ''} diff --git a/frontend/src/lib/components/apps/components/inputs/AppFileInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppFileInput.svelte index 3781ce01c5..01123364c0 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppFileInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppFileInput.svelte @@ -39,10 +39,15 @@ $: css = concatCustomCss($app.css?.fileinputcomponent, customCss) - - - - + + + + diff --git a/frontend/src/lib/components/apps/components/inputs/AppNumberInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppNumberInput.svelte index 7140f2825b..f8fd8e81b0 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppNumberInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppNumberInput.svelte @@ -1,7 +1,7 @@ - - - - - +{#each Object.keys(components['numberinputcomponent'].initialData.configuration) as key (key)} + +{/each} @@ -77,12 +80,12 @@ )} style={css?.input?.style ?? ''} bind:value - {min} - {max} - {step} + min={resolvedConfig.min} + max={resolvedConfig.max} + step={resolvedConfig.step} type="number" inputmode="numeric" pattern="\d*" - {placeholder} + placeholder={resolvedConfig.placeholder} /> diff --git a/frontend/src/lib/components/apps/components/inputs/AppQuillEditor.svelte b/frontend/src/lib/components/apps/components/inputs/AppQuillEditor.svelte index 8bcf44ff97..7e10dbb1d0 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppQuillEditor.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppQuillEditor.svelte @@ -83,8 +83,8 @@ } - - + + {#if render} diff --git a/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte index 80b13881bc..2ecffee67c 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte @@ -32,9 +32,11 @@ ) let values: [number, number] = [0, 1] - $: (resolvedConfig.defaultLow || resolvedConfig.defaultHigh) && handleMin() - function handleMin() { + $: (resolvedConfig.defaultLow != undefined || resolvedConfig.defaultHigh != undefined) && + handleDefault() + + function handleDefault() { values = [resolvedConfig?.defaultLow ?? 0, resolvedConfig?.defaultHigh ?? 1] } diff --git a/frontend/src/lib/components/apps/components/inputs/AppSliderInputs.svelte b/frontend/src/lib/components/apps/components/inputs/AppSliderInputs.svelte index 96f60ccd50..f55244fbf1 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppSliderInputs.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppSliderInputs.svelte @@ -9,11 +9,12 @@ RichConfigurations } from '../../types' import AlignWrapper from '../helpers/AlignWrapper.svelte' - import InputValue from '../helpers/InputValue.svelte' import { twMerge } from 'tailwind-merge' import { concatCustomCss } from '../../utils' - import { initOutput } from '../../editor/appUtils' + import { initConfig, initOutput } from '../../editor/appUtils' import InitializeComponent from '../helpers/InitializeComponent.svelte' + import { components } from '../../editor/component' + import ResolveConfig from '../helpers/ResolveConfig.svelte' export let id: string export let configuration: RichConfigurations @@ -26,9 +27,19 @@ const { app, worldStore, selectedComponent, componentControl } = getContext('AppViewerContext') - let min = 0 - let max = 42 - let step = 1 + + let resolvedConfig = initConfig( + components['slidercomponent'].initialData.configuration, + configuration + ) + + let values: [number] = [resolvedConfig.defaultValue ?? 0] + + $: resolvedConfig.defaultValue != undefined && handleDefault() + + function handleDefault() { + values = [resolvedConfig?.defaultValue ?? 0] + } let slider: HTMLElement @@ -36,11 +47,9 @@ result: (0 as number) || null }) - let values: [number] = [outputs?.result.peak() ?? 0] - $componentControl[id] = { setValue(nvalue: number) { - values[0] = nvalue + values = [nvalue] } } @@ -74,7 +83,7 @@ const spanClass = 'text-center text-sm font-medium bg-blue-100 text-blue-800 rounded px-2.5 py-0.5' function computeWidth() { - let maxValue = max + step + let maxValue = resolvedConfig.max ?? 0 + (resolvedConfig.step ?? 0) if (typeof document !== 'undefined') { const span = document.createElement('span') @@ -89,24 +98,28 @@ } } - $: if (max && step && render) { + $: if (resolvedConfig.max != undefined && resolvedConfig.step && render) { computeWidth() } let vertical = false - - - - - +{#each Object.keys(components['slidercomponent'].initialData.configuration) as key (key)} + +{/each} +
- {vertical ? +max : +min} + {vertical ? +(resolvedConfig?.max ?? 0) : +(resolvedConfig?.min ?? 0)}
($selectedComponent = [id])} > - +
- {vertical ? +min : +max} + {vertical ? +(resolvedConfig?.min ?? 0) : +(resolvedConfig?.max ?? 1)} import { getContext } from 'svelte' import { twMerge } from 'tailwind-merge' - import { initOutput, selectId } from '../../editor/appUtils' + import { initConfig, initOutput, selectId } from '../../editor/appUtils' import type { AppViewerContext, ComponentCustomCSS, @@ -11,8 +11,9 @@ } from '../../types' import { concatCustomCss } from '../../utils' import AlignWrapper from '../helpers/AlignWrapper.svelte' - import InputValue from '../helpers/InputValue.svelte' import InitializeComponent from '../helpers/InitializeComponent.svelte' + import { components } from '../../editor/component' + import ResolveConfig from '../helpers/ResolveConfig.svelte' export let id: string export let configuration: RichConfigurations @@ -29,12 +30,15 @@ const { app, worldStore, selectedComponent, connectingInput, componentControl } = getContext('AppViewerContext') + let resolvedConfig = initConfig( + components['textinputcomponent'].initialData.configuration, + configuration + ) + const iterContext = getContext('ListWrapperContext') const listInputs: ListInputs | undefined = getContext('ListInputs') - let placeholder: string | undefined = undefined - let defaultValue: string | undefined = undefined - let value: string | undefined = undefined + let value: string | undefined = resolvedConfig.defaultValue let outputs = initOutput($worldStore, id, { result: '' @@ -46,7 +50,7 @@ } } - $: handleDefault(defaultValue) + $: handleDefault(resolvedConfig.defaultValue) $: { let val = value ?? '' @@ -63,9 +67,14 @@ $: css = concatCustomCss($app.css?.[appCssKey], customCss) - - - +{#each Object.keys(components['textinputcomponent'].initialData.configuration) as key (key)} + +{/each} {#if render} {#if inputType === 'textarea'} @@ -79,7 +88,7 @@ !$connectingInput.opened && selectId(e, id, selectedComponent, $app)} on:keydown|stopPropagation bind:value - {placeholder} + placeholder={resolvedConfig.placeholder} /> {:else} @@ -95,7 +104,7 @@ on:keydown|stopPropagation type="password" bind:value - {placeholder} + placeholder={resolvedConfig.placeholder} /> {:else if inputType === 'text'} {:else if inputType === 'email'} {/if} diff --git a/frontend/src/lib/components/apps/components/inputs/currency/AppCurrencyInput.svelte b/frontend/src/lib/components/apps/components/inputs/currency/AppCurrencyInput.svelte index 886d3c4bde..e0f57958a2 100644 --- a/frontend/src/lib/components/apps/components/inputs/currency/AppCurrencyInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/currency/AppCurrencyInput.svelte @@ -1,5 +1,5 @@ - - - - +{#each Object.keys(components['currencycomponent'].initialData.configuration) as key (key)} + +{/each} - {#key isNegativeAllowed} - {#key locale} - {#key currency} + {#key resolvedConfig.isNegativeAllowed} + {#key resolvedConfig.locale} + {#key resolvedConfig.currency}
($selectedComponent = [id])}>
{/key} diff --git a/frontend/src/lib/components/apps/components/layout/AppConditionalWrapper.svelte b/frontend/src/lib/components/apps/components/layout/AppConditionalWrapper.svelte index 0fd383897c..dda643280a 100644 --- a/frontend/src/lib/components/apps/components/layout/AppConditionalWrapper.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppConditionalWrapper.svelte @@ -66,7 +66,7 @@ {#each conditions ?? [] as condition, index} - + {/each} diff --git a/frontend/src/lib/components/apps/components/layout/AppDivider.svelte b/frontend/src/lib/components/apps/components/layout/AppDivider.svelte index 820f6863d4..b81a8e5589 100644 --- a/frontend/src/lib/components/apps/components/layout/AppDivider.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppDivider.svelte @@ -46,8 +46,8 @@ } - - + + - + {#each disabledTabs ?? [] as disableTab, index} - + {/each}
diff --git a/frontend/src/lib/components/apps/editor/component/components.ts b/frontend/src/lib/components/apps/editor/component/components.ts index 0c6ada3692..1edf84630f 100644 --- a/frontend/src/lib/components/apps/editor/component/components.ts +++ b/frontend/src/lib/components/apps/editor/component/components.ts @@ -335,7 +335,7 @@ const onSuccessClick = { fieldType: 'text', type: 'static', value: '', - placeholder: 'Hello there', + placeholder: 'Hello there' } }, openModal: { @@ -343,7 +343,7 @@ const onSuccessClick = { tooltip: 'The id of the modal to open', fieldType: 'text', type: 'static', - value: '', + value: '' } }, closeModal: { @@ -351,7 +351,7 @@ const onSuccessClick = { tooltip: 'The id of the modal to close', fieldType: 'text', type: 'static', - value: '', + value: '' } } } @@ -1896,7 +1896,9 @@ This is a paragraph. outputFormat: { type: 'static', value: undefined, - fieldType: 'text' + fieldType: 'text', + tooltip: 'See date-fns format for more information', + documentationLink: 'https://date-fns.org/v1.29.0/docs/format' } } } diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/TableActionLabel.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/TableActionLabel.svelte deleted file mode 100644 index 60383651ce..0000000000 --- a/frontend/src/lib/components/apps/editor/settingsPanel/TableActionLabel.svelte +++ /dev/null @@ -1,13 +0,0 @@ - - -{#if componentInput !== undefined} - -{/if} - -{label}