Browse Source
Merge pull request #7344 from Budibase/fix/screen-load-bindings
Add bindings for screen on load setting
pull/7352/head
Andrew Kingston
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
6 additions and
9 deletions
-
packages/builder/src/builderStore/dataBinding.js
-
packages/builder/src/components/design/settings/controls/ButtonActionEditor/ButtonActionDrawer.svelte
|
|
|
@ -502,11 +502,11 @@ const getRoleBindings = () => { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Gets all bindable properties exposed in a button actions 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, |
|
|
|
@ -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, |
|
|
|
|
|
|
|
@ -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 |
|
|
|
$: { |
|
|
|
|