diff --git a/frontend/src/lib/components/apps/components/helpers/InputValue.svelte b/frontend/src/lib/components/apps/components/helpers/InputValue.svelte index beb5c45d28..c48ccfd5be 100644 --- a/frontend/src/lib/components/apps/components/helpers/InputValue.svelte +++ b/frontend/src/lib/components/apps/components/helpers/InputValue.svelte @@ -169,24 +169,30 @@ } else if (lastInput?.type == 'eval') { value = await evalExpr(lastInput as EvalAppInput) } else if (lastInput?.type == 'evalv2') { + const skey = `${id}-${key}-${rowContext ? $rowContext.index : 0}-${ + iterContext ? $iterContext.index : 0 + }` const input = lastInput as EvalV2AppInput for (const c of input.connections ?? []) { const previousValueKey = `${c.componentId}-${c.id}` $worldStore?.connect( c, onEvalChange(previousValueKey), - `${id}-${key}`, + skey, previousConnectedValues[previousValueKey] ) } } else if (lastInput?.type == 'templatev2') { const input = lastInput as TemplateV2Input + const skey = `${id}-${key}-${rowContext ? $rowContext.index : 0}-${ + iterContext ? $iterContext.index : 0 + }` for (const c of input.connections ?? []) { const previousValueKey = `${c.componentId}-${c.id}` $worldStore?.connect( c, onTemplateChange(previousValueKey), - `${id}-${key}`, + skey, previousConnectedValues[previousValueKey] ) } diff --git a/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte index 46c2e49c80..80b13881bc 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte @@ -2,7 +2,7 @@ import { getContext } from 'svelte' import RangeSlider from 'svelte-range-slider-pips' import { twMerge } from 'tailwind-merge' - import { initOutput } from '../../editor/appUtils' + import { initConfig, initOutput } from '../../editor/appUtils' import type { AppViewerContext, ComponentCustomCSS, @@ -12,8 +12,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 ResolveConfig from '../helpers/ResolveConfig.svelte' + import { components } from '../../editor/component' export let id: string export let configuration: RichConfigurations @@ -25,13 +26,21 @@ const iterContext = getContext('ListWrapperContext') const listInputs: ListInputs | undefined = getContext('ListInputs') - let min = 0 - let max = 42 - let step = 1 - let slider: HTMLElement + let resolvedConfig = initConfig( + components['rangecomponent'].initialData.configuration, + configuration + ) + + let values: [number, number] = [0, 1] + $: (resolvedConfig.defaultLow || resolvedConfig.defaultHigh) && handleMin() + + function handleMin() { + values = [resolvedConfig?.defaultLow ?? 0, resolvedConfig?.defaultHigh ?? 1] + } + let disabled = false - let values: [number, number] = [0, 0] + let slider: HTMLElement let outputs = initOutput($worldStore, id, { result: null as [number, number] | null @@ -62,12 +71,14 @@ } - - - - - - +{#each Object.keys(components['rangecomponent'].initialData.configuration) as key (key)} + +{/each} @@ -75,7 +86,7 @@
- {+min} + {+(resolvedConfig.min ?? 0)}
- {+max} + {+(resolvedConfig.max ?? 1)}