Provide additional context from repeater blocks

This commit is contained in:
Andrew Kingston 2024-02-16 14:23:17 +00:00
parent dc077da5ae
commit 5c4e797251
1 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,7 @@
import Placeholder from "components/app/Placeholder.svelte"
import { getContext } from "svelte"
import { makePropSafe as safe } from "@budibase/string-templates"
import { get } from "svelte/store"
export let dataSource
export let filter
@ -18,8 +19,20 @@
export let gap
const component = getContext("component")
const context = getContext("context")
const { generateGoldenSample } = getContext("sdk")
let providerId
// Provide additional data context for live binding eval
export const getAdditionalDataContext = () => {
const rows = get(context)[providerId]?.rows || []
const goldenRow = generateGoldenSample(rows)
const id = get(component).id
return {
[`${id}-repeater`]: goldenRow,
}
}
</script>
<Block>