diff --git a/packages/bbui/src/Form/Combobox.svelte b/packages/bbui/src/Form/Combobox.svelte index b718921325..368e8bec4b 100644 --- a/packages/bbui/src/Form/Combobox.svelte +++ b/packages/bbui/src/Form/Combobox.svelte @@ -36,5 +36,7 @@ {getOptionLabel} {getOptionValue} on:change={onChange} + on:pick + on:type /> diff --git a/packages/bbui/src/Form/Core/Combobox.svelte b/packages/bbui/src/Form/Core/Combobox.svelte index 2f832ad91e..6a1390eeea 100644 --- a/packages/bbui/src/Form/Core/Combobox.svelte +++ b/packages/bbui/src/Form/Core/Combobox.svelte @@ -40,8 +40,15 @@ open = false } - const onChange = e => { - selectOption(e.target.value) + const onType = e => { + const value = e.target.value + dispatch("type", value) + selectOption(value) + } + + const onPick = value => { + dispatch("pick", value) + selectOption(value) } @@ -62,7 +69,7 @@ type="text" on:focus={() => (focus = true)} on:blur={() => (focus = false)} - on:change={onChange} + on:change={onType} value={value || ""} placeholder={placeholder || ""} {disabled} @@ -99,7 +106,7 @@ role="option" aria-selected="true" tabindex="0" - on:click={() => selectOption(getOptionValue(option))} + on:click={() => onPick(getOptionValue(option))} > {getOptionLabel(option)} { 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,12 +56,17 @@ {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} -
+
{/if} 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}`)}