From 9475090f8f887f3c9397b79c63569150dbfdf869 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 18 Aug 2022 11:16:59 +0100 Subject: [PATCH 1/2] Add bindings for screen on load setting --- packages/builder/src/builderStore/dataBinding.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index bebd06c6d7..62b61eee7c 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -502,7 +502,7 @@ const getRoleBindings = () => { } /** - * Gets all bindable properties exposed in a button actions flow up until + * Gets all bindable properties exposed in a button action flow up until * the specified action ID, as well as context provided for the action * setting as a whole by the component. */ @@ -520,10 +520,7 @@ export const getButtonContextBindings = ( const component = findComponent(asset.props, componentId) const settings = getComponentSettings(component?._component) const eventSetting = settings.find(setting => setting.key === settingKey) - if (!eventSetting) { - return bindings - } - if (eventSetting.context?.length) { + if (eventSetting?.context?.length) { eventSetting.context.forEach(contextEntry => { bindings.push({ readableBinding: contextEntry.label, From 42367638d8a68751ea3e39cbaea2abb17b88c338 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 18 Aug 2022 13:43:32 +0100 Subject: [PATCH 2/2] Rename some usages of button actions to events --- packages/builder/src/builderStore/dataBinding.js | 4 ++-- .../controls/ButtonActionEditor/ButtonActionDrawer.svelte | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index 62b61eee7c..13b749e19f 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -502,11 +502,11 @@ const getRoleBindings = () => { } /** - * Gets all bindable properties exposed in a button action flow up until + * Gets all bindable properties exposed in an event action flow up until * the specified action ID, as well as context provided for the action * setting as a whole by the component. */ -export const getButtonContextBindings = ( +export const getEventContextBindings = ( asset, componentId, settingKey, diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/ButtonActionDrawer.svelte b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/ButtonActionDrawer.svelte index 31962077fc..69d5fe60b4 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/ButtonActionDrawer.svelte +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/ButtonActionDrawer.svelte @@ -11,7 +11,7 @@ } from "@budibase/bbui" import { getAvailableActions } from "./index" import { generate } from "shortid" - import { getButtonContextBindings } from "builderStore/dataBinding" + import { getEventContextBindings } from "builderStore/dataBinding" import { currentAsset, store } from "builderStore" const flipDurationMs = 150 @@ -41,14 +41,14 @@ }, {}) // These are ephemeral bindings which only exist while executing actions - $: buttonContextBindings = getButtonContextBindings( + $: eventContexBindings = getEventContextBindings( $currentAsset, $store.selectedComponentId, key, actions, selectedAction?.id ) - $: allBindings = buttonContextBindings.concat(bindings) + $: allBindings = eventContexBindings.concat(bindings) // Assign a unique ID to each action $: {