Allow using ephemeral action context for 'buttons' type settings

This commit is contained in:
Andrew Kingston 2023-11-07 13:21:13 +00:00
parent 57e3b1ad08
commit 9f285b32a7
3 changed files with 18 additions and 2 deletions

View File

@ -4,10 +4,13 @@
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { store } from "builderStore" import { store } from "builderStore"
import { Helpers } from "@budibase/bbui" import { Helpers } from "@budibase/bbui"
import { getEventContextBindings } from "builderStore/dataBinding"
export let componentInstance
export let componentBindings export let componentBindings
export let bindings export let bindings
export let value export let value
export let key
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
@ -15,9 +18,14 @@
$: buttonList = sanitizeValue(value) || [] $: buttonList = sanitizeValue(value) || []
$: buttonCount = buttonList.length $: buttonCount = buttonList.length
$: eventContextBindings = getEventContextBindings({
componentInstance,
settingKey: key,
})
$: allBindings = [...bindings, ...eventContextBindings]
$: itemProps = { $: itemProps = {
componentBindings: componentBindings || [], componentBindings: componentBindings || [],
bindings, bindings: allBindings,
removeButton, removeButton,
canRemove: true, canRemove: true,
} }

View File

@ -17,6 +17,7 @@
export let value export let value
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let sanitisedFields let sanitisedFields
let fieldList let fieldList
let schema let schema

View File

@ -6346,7 +6346,14 @@
"settings": [ "settings": [
{ {
"type": "buttonConfiguration", "type": "buttonConfiguration",
"key": "buttons" "key": "buttons",
"nested": true,
"context": [
{
"label": "Clicked row",
"key": "row"
}
]
} }
] ]
} }