diff --git a/packages/bbui/src/Form/Combobox.svelte b/packages/bbui/src/Form/Combobox.svelte index 368e8bec4b..83927b05db 100644 --- a/packages/bbui/src/Form/Combobox.svelte +++ b/packages/bbui/src/Form/Combobox.svelte @@ -6,6 +6,7 @@ export let value = null export let label = undefined export let disabled = false + export let readonly = false export let labelPosition = "above" export let error = null export let placeholder = "Choose an option or type" @@ -33,6 +34,7 @@ {value} {options} {placeholder} + {readonly} {getOptionLabel} {getOptionValue} on:change={onChange} diff --git a/packages/bbui/src/Form/Core/Combobox.svelte b/packages/bbui/src/Form/Core/Combobox.svelte index 6a1390eeea..6a6423cccf 100644 --- a/packages/bbui/src/Form/Core/Combobox.svelte +++ b/packages/bbui/src/Form/Core/Combobox.svelte @@ -9,6 +9,7 @@ export let id = null export let placeholder = "Choose an option or type" export let disabled = false + export let readonly = false export let error = null export let options = [] export let getOptionLabel = option => option @@ -73,6 +74,7 @@ value={value || ""} placeholder={placeholder || ""} {disabled} + {readonly} class="spectrum-Textfield-input spectrum-InputGroup-input" /> diff --git a/packages/bbui/src/Form/Core/TextField.svelte b/packages/bbui/src/Form/Core/TextField.svelte index 85c71338f7..d2064ddde0 100644 --- a/packages/bbui/src/Form/Core/TextField.svelte +++ b/packages/bbui/src/Form/Core/TextField.svelte @@ -16,15 +16,15 @@ const dispatch = createEventDispatcher() let focus = false - const updateValue = value => { + const updateValue = newValue => { if (readonly) { return } if (type === "number") { - const float = parseFloat(value) - value = isNaN(float) ? null : float + const float = parseFloat(newValue) + newValue = isNaN(float) ? null : float } - dispatch("change", value) + dispatch("change", newValue) } const onFocus = () => { diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 841e781cf2..7902212b7e 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -389,7 +389,7 @@ value={field.formula} on:change={e => (field.formula = e.detail)} bindings={getBindings({ table })} - serverSide="true" + allowJS /> {:else if field.type === AUTO_TYPE} onChange(event.detail)} {placeholder} @@ -63,7 +64,7 @@ bind:valid value={readableValue} on:change={event => (tempValue = event.detail)} - bindableProperties={bindings} + {bindings} {allowJS} /> diff --git a/packages/builder/src/components/common/bindings/ModalBindableInput.svelte b/packages/builder/src/components/common/bindings/ModalBindableInput.svelte index 2a72d7a315..3776f1dc84 100644 --- a/packages/builder/src/components/common/bindings/ModalBindableInput.svelte +++ b/packages/builder/src/components/common/bindings/ModalBindableInput.svelte @@ -6,20 +6,23 @@ } 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 = "" export let bindings = [] - export let thin = true export let title = "Bindings" export let placeholder export let label + export let allowJS = false const dispatch = createEventDispatcher() let bindingModal let valid = true + $: readableValue = runtimeToReadableBinding(bindings, value) $: tempValue = readableValue + $: isJS = isJSBinding(value) const saveBinding = () => { onChange(tempValue) @@ -34,8 +37,8 @@
onChange(event.detail)} {placeholder} /> @@ -55,7 +58,8 @@ value={readableValue} bind:valid on:change={e => (tempValue = e.detail)} - bindableProperties={bindings} + {bindings} + {allowJS} />
diff --git a/packages/builder/src/components/common/bindings/ServerBindingPanel.svelte b/packages/builder/src/components/common/bindings/ServerBindingPanel.svelte index 66b567f343..5440ba0b18 100644 --- a/packages/builder/src/components/common/bindings/ServerBindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/ServerBindingPanel.svelte @@ -1,209 +1,27 @@ - - -
-
-
Search
- -
- {#each filteredCategories as [categoryName, bindings]} - {#if bindings.length} -
-
{categoryName}
-
    - {#each bindings as binding} -
  • { - value = addHBSBinding(value, getCaretPosition(), binding) - }} - > - {binding.label} - {binding.type} - {#if binding.description} -
    -
    - {binding.description || ""} -
    - {/if} -
  • - {/each} -
-
- {/if} - {/each} - {#if filteredHelpers?.length} -
-
Helpers
-
    - {#each filteredHelpers as helper} -
  • { - value = addHBSBinding(value, getCaretPosition(), helper.text) - }} - > -
    -
    {helper.displayText}
    -
    - {@html helper.description} -
    -
    {helper.example || ''}
    -
    -
  • - {/each} -
-
- {/if} -
-
-
-