diff --git a/packages/builder/src/components/common/bindings/DrawerBindableCombobox.svelte b/packages/builder/src/components/common/bindings/DrawerBindableCombobox.svelte index 655093e684..ba5a869e72 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableCombobox.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableCombobox.svelte @@ -17,6 +17,7 @@ export let disabled = false export let options export let allowJS = true + export let appendBindingsAsOptions = true const dispatch = createEventDispatcher() let bindingDrawer @@ -24,15 +25,30 @@ $: readableValue = runtimeToReadableBinding(bindings, value) $: tempValue = readableValue $: isJS = isJSBinding(value) + $: allOptions = buildOptions(options, bindings, appendBindingsAsOptions) const handleClose = () => { onChange(tempValue) bindingDrawer.hide() } - const onChange = value => { + const onChange = (value, optionPicked) => { + // Add HBS braces if picking binding + if (optionPicked && !options?.includes(value)) { + value = `{{ ${value} }}` + } + dispatch("change", readableToRuntimeBinding(bindings, value)) } + + const buildOptions = (options, bindings, appendBindingsAsOptions) => { + if (!appendBindingsAsOptions) { + return options + } + return [] + .concat(options || []) + .concat(bindings?.map(binding => binding.readableBinding) || []) + }
@@ -40,9 +56,10 @@ {label} {disabled} value={isJS ? "(JavaScript function)" : readableValue} - on:change={event => onChange(event.detail)} + on:type={e => onChange(e.detail, false)} + on:pick={e => onChange(e.detail, true)} {placeholder} - {options} + options={allOptions} /> {#if !disabled}
diff --git a/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte b/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte index 356e86b20a..34d86c9a08 100644 --- a/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte @@ -78,7 +78,6 @@ {#if idx === 0 && !componentInstance._component.endsWith("/layout")} - import { Input } from "@budibase/bbui" - import { isJSBinding } from "@budibase/string-templates" - - export let value - - $: isJS = isJSBinding(value) - - - diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/PropertyControl.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/PropertyControl.svelte index 73385b73f5..a6086bbbc6 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/PropertyControl.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/PropertyControl.svelte @@ -1,11 +1,9 @@ -
+
{#if type !== "boolean" && label}
@@ -94,31 +83,6 @@ {type} {...props} /> - {#if bindable && !key.startsWith("_") && type === "text"} -
- -
- - - Add the objects on the left to enrich your text. - - - (tempValue = e.detail)} - bindableProperties={allBindings} - allowJS - /> - - {/if}
@@ -130,40 +94,10 @@ justify-content: flex-start; align-items: stretch; } - .label { padding-bottom: var(--spectrum-global-dimension-size-65); } - .control { position: relative; } - - .icon { - right: 1px; - top: 1px; - bottom: 1px; - position: absolute; - justify-content: center; - align-items: center; - display: flex; - flex-direction: row; - box-sizing: border-box; - border-left: 1px solid var(--spectrum-alias-border-color); - border-top-right-radius: var(--spectrum-alias-border-radius-regular); - border-bottom-right-radius: var(--spectrum-alias-border-radius-regular); - width: 31px; - color: var(--spectrum-alias-text-color); - background-color: var(--spectrum-global-color-gray-75); - transition: background-color - var(--spectrum-global-animation-duration-100, 130ms), - box-shadow var(--spectrum-global-animation-duration-100, 130ms), - border-color var(--spectrum-global-animation-duration-100, 130ms); - } - .icon:hover { - cursor: pointer; - color: var(--spectrum-alias-text-color-hover); - background-color: var(--spectrum-global-color-gray-50); - border-color: var(--spectrum-alias-border-color-hover); - } diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/URLSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/URLSelect.svelte index fb8b48b9ed..dc2fa7ad89 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/URLSelect.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/URLSelect.svelte @@ -10,4 +10,10 @@ .filter(x => x != null) - + diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/componentSettings.js b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/componentSettings.js index 69bb3f8b47..b9b227bef0 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/componentSettings.js +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/componentSettings.js @@ -15,10 +15,10 @@ import URLSelect from "./URLSelect.svelte" import OptionsEditor from "./OptionsEditor/OptionsEditor.svelte" import FormFieldSelect from "./FormFieldSelect.svelte" import ValidationEditor from "./ValidationEditor/ValidationEditor.svelte" -import Input from "./Input.svelte" +import DrawerBindableCombobox from "components/common/bindings/DrawerBindableCombobox.svelte" const componentMap = { - text: Input, + text: DrawerBindableCombobox, select: Select, dataSource: DataSourceSelect, dataProvider: DataProviderSelect, diff --git a/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte b/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte index efe51ebdac..4a7c77746e 100644 --- a/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte @@ -54,7 +54,6 @@ {#each screenSettings as def (`${componentInstance._id}-${def.key}`)}