Provide additional context from repeater blocks
This commit is contained in:
parent
dc077da5ae
commit
5c4e797251
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue