Use setting default value in conditional UI drawer

This commit is contained in:
Andrew Kingston 2024-08-08 11:58:19 +01:00
parent 9c6b8cdd0e
commit fc21c80d64
No known key found for this signature in database
1 changed files with 10 additions and 1 deletions

View File

@ -147,6 +147,15 @@
onOperatorChange(condition, condition.operator)
}
}
const onSettingChange = (e, condition) => {
const setting = settings.find(x => x.key === e.detail)
if (setting?.defaultValue != null) {
condition.settingValue = setting?.defaultValue
} else {
delete condition.settingValue
}
}
</script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
@ -189,7 +198,7 @@
<Select
options={settingOptions}
bind:value={condition.setting}
on:change={() => delete condition.settingValue}
on:change={e => onSettingChange(e, condition)}
/>
<div>TO</div>
{#if definition}