Fix issue with using blocks and conditional UI together due to new nested settings
This commit is contained in:
parent
e8429965c0
commit
f9cf221c84
|
@ -13,9 +13,10 @@
|
||||||
import { generate } from "shortid"
|
import { generate } from "shortid"
|
||||||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||||
import { OperatorOptions, getValidOperatorsForType } from "constants/lucene"
|
import { OperatorOptions, getValidOperatorsForType } from "constants/lucene"
|
||||||
import { selectedComponent, store } from "builderStore"
|
import { selectedComponent } from "builderStore"
|
||||||
import { getComponentForSettingType } from "./componentSettings"
|
import { getComponentForSettingType } from "./componentSettings"
|
||||||
import PropertyControl from "./PropertyControl.svelte"
|
import PropertyControl from "./PropertyControl.svelte"
|
||||||
|
import { getComponentSettings } from "builderStore/storeUtils"
|
||||||
|
|
||||||
export let conditions = []
|
export let conditions = []
|
||||||
export let bindings = []
|
export let bindings = []
|
||||||
|
@ -55,15 +56,11 @@
|
||||||
]
|
]
|
||||||
|
|
||||||
let dragDisabled = true
|
let dragDisabled = true
|
||||||
$: definition = store.actions.components.getDefinition(
|
$: settings = getComponentSettings($selectedComponent?._component)
|
||||||
$selectedComponent?._component
|
$: settingOptions = settings.map(setting => ({
|
||||||
)
|
|
||||||
$: settings = (definition?.settings ?? []).map(setting => {
|
|
||||||
return {
|
|
||||||
label: setting.label,
|
label: setting.label,
|
||||||
value: setting.key,
|
value: setting.key,
|
||||||
}
|
}))
|
||||||
})
|
|
||||||
$: conditions.forEach(link => {
|
$: conditions.forEach(link => {
|
||||||
if (!link.id) {
|
if (!link.id) {
|
||||||
link.id = generate()
|
link.id = generate()
|
||||||
|
@ -71,9 +68,7 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
const getSettingDefinition = key => {
|
const getSettingDefinition = key => {
|
||||||
return definition?.settings?.find(setting => {
|
return settings.find(setting => setting.key === key)
|
||||||
return setting.key === key
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getComponentForSetting = key => {
|
const getComponentForSetting = key => {
|
||||||
|
@ -175,7 +170,10 @@
|
||||||
bind:value={condition.action}
|
bind:value={condition.action}
|
||||||
/>
|
/>
|
||||||
{#if condition.action === "update"}
|
{#if condition.action === "update"}
|
||||||
<Select options={settings} bind:value={condition.setting} />
|
<Select
|
||||||
|
options={settingOptions}
|
||||||
|
bind:value={condition.setting}
|
||||||
|
/>
|
||||||
<div>TO</div>
|
<div>TO</div>
|
||||||
{#if getSettingDefinition(condition.setting)}
|
{#if getSettingDefinition(condition.setting)}
|
||||||
<PropertyControl
|
<PropertyControl
|
||||||
|
|
Loading…
Reference in New Issue