Set inputs to readonly when displaying the javascript function helper label to prevent accidentally setting explicit text

This commit is contained in:
Andrew Kingston 2021-11-23 16:41:09 +00:00
parent 24a700f391
commit 19d74d3fb6
3 changed files with 7 additions and 1 deletions

View File

@ -55,6 +55,7 @@
<Combobox
{label}
{disabled}
readonly={isJS}
value={isJS ? "(JavaScript function)" : readableValue}
on:type={e => onChange(e.detail, false)}
on:pick={e => onChange(e.detail, true)}

View File

@ -40,6 +40,7 @@
<Input
{label}
{disabled}
readonly={isJS}
value={isJS ? "(JavaScript function)" : readableValue}
on:change={event => onChange(event.detail)}
{placeholder}

View File

@ -6,6 +6,7 @@
} from "builderStore/dataBinding"
import ServerBindingPanel from "components/common/bindings/ServerBindingPanel.svelte"
import { createEventDispatcher } from "svelte"
import { isJSBinding } from "@budibase/string-templates"
export let panel = ServerBindingPanel
export let value = ""
@ -18,8 +19,10 @@
const dispatch = createEventDispatcher()
let bindingModal
let valid = true
$: readableValue = runtimeToReadableBinding(bindings, value)
$: tempValue = readableValue
$: isJS = isJSBinding(value)
const saveBinding = () => {
onChange(tempValue)
@ -34,7 +37,8 @@
<div class="control">
<Input
{label}
value={readableValue}
readonly={isJS}
value={isJS ? "(JavaScript function)" : readableValue}
on:change={event => onChange(event.detail)}
{placeholder}
/>