From 8c62ea9833a416c3c1a5c5e2bcf4479d0d2e1451 Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 17 Oct 2022 12:03:13 +0100 Subject: [PATCH 01/46] Values or defaults passed to the picker are parsed to ensure only valid options are marked/added to the component. --- .../bbui/src/Form/Core/Multiselect.svelte | 22 ++++++++++++++++--- .../common/bindings/BindingPanel.svelte | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/bbui/src/Form/Core/Multiselect.svelte b/packages/bbui/src/Form/Core/Multiselect.svelte index eb39e39042..3fbbaf5d4a 100644 --- a/packages/bbui/src/Form/Core/Multiselect.svelte +++ b/packages/bbui/src/Form/Core/Multiselect.svelte @@ -15,12 +15,28 @@ export let sort = false export let autoWidth = false + $: streamed = Array.isArray(value) + ? value.reduce((acc, ele) => { + if (typeof ele === "string") { + let temp = ele.trim() + if (!temp) { + return acc + } + } + let processedOpt = ele.toString() + if (options.indexOf(processedOpt) > -1) { + acc.push(ele.toString()) + } + return acc + }, []) + : [] + const dispatch = createEventDispatcher() - $: selectedLookupMap = getSelectedLookupMap(value) + $: selectedLookupMap = getSelectedLookupMap(streamed) $: optionLookupMap = getOptionLookupMap(options) - $: fieldText = getFieldText(value, optionLookupMap, placeholder) + $: fieldText = getFieldText(streamed, optionLookupMap, placeholder) $: isOptionSelected = optionValue => selectedLookupMap[optionValue] === true - $: toggleOption = makeToggleOption(selectedLookupMap, value) + $: toggleOption = makeToggleOption(selectedLookupMap, streamed) const getFieldText = (value, map, placeholder) => { if (Array.isArray(value) && value.length > 0) { diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 1a1714967d..d105253e14 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -247,7 +247,7 @@ return } hoverTarget = { - title: binding.display?.name || binding.fieldSchema.name, + title: binding.display?.name || binding.fieldSchema?.name, description: binding.description, } popover.show() From 449ddf2a6bdb5783ac2351f27a395d8ba18a7fb3 Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 17 Oct 2022 12:08:37 +0100 Subject: [PATCH 02/46] Added the json field type to the Automation field block. Also added in the automation icon to identify the automation bindings --- .../automation/SetupPanel/RowSelector.svelte | 13 ++++++++++-- .../SetupPanel/RowSelectorTypes.svelte | 21 ++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte b/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte index c72acc252a..b3d50c1658 100644 --- a/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte @@ -14,6 +14,11 @@ export let block export let isTestModal + $: parsedBindings = bindings.map(binding => { + binding.icon = "ShareAndroid" + return binding + }) + let table let schemaFields @@ -79,6 +84,10 @@ return [value] } + if (type === "json") { + return value.value + } + return value } @@ -109,7 +118,7 @@ {isTestModal} {field} {schema} - {bindings} + bindings={parsedBindings} {value} {onChange} /> @@ -124,7 +133,7 @@ on:change={e => onChange(e, field, schema.type)} label={field} type="string" - {bindings} + bindings={parsedBindings} fillWidth={true} allowJS={true} updateOnChange={false} diff --git a/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte b/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte index f3abad6e25..30b888b5fb 100644 --- a/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte +++ b/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte @@ -5,11 +5,13 @@ DatePicker, Multiselect, TextArea, + Label, } from "@budibase/bbui" import LinkedRowSelector from "components/common/LinkedRowSelector.svelte" import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte" import ModalBindableInput from "../../common/bindings/ModalBindableInput.svelte" import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte" + import Editor from "components/integration/QueryEditor.svelte" export let onChange export let field @@ -18,6 +20,11 @@ export let bindings export let isTestModal + $: parsedBindings = bindings.map(binding => { + binding.icon = "ShareAndroid" + return binding + }) + function schemaHasOptions(schema) { return !!schema.constraints?.inclusion?.length } @@ -50,6 +57,18 @@ /> {:else if schema.type === "longform"}