Provide additional context from row explorer block
This commit is contained in:
parent
840f499b47
commit
53bb890d3d
|
@ -3,25 +3,35 @@
|
|||
import BlockComponent from "components/BlockComponent.svelte"
|
||||
import { makePropSafe as safe } from "@budibase/string-templates"
|
||||
import { generate } from "shortid"
|
||||
import { get } from "svelte/store"
|
||||
import { getContext } from "svelte"
|
||||
|
||||
export let dataSource
|
||||
export let height
|
||||
|
||||
export let cardTitle
|
||||
export let cardSubtitle
|
||||
export let cardDescription
|
||||
export let cardImageURL
|
||||
export let cardSearchField
|
||||
|
||||
export let detailFields
|
||||
export let detailTitle
|
||||
|
||||
export let noRowsMessage
|
||||
|
||||
const stateKey = generate()
|
||||
const context = getContext("context")
|
||||
const { generateGoldenSample } = getContext("sdk")
|
||||
|
||||
let listDataProviderId
|
||||
let listRepeaterId
|
||||
|
||||
// Provide additional data context for live binding eval
|
||||
export const getAdditionalDataContext = () => {
|
||||
const rows = get(context)[listDataProviderId]?.rows || []
|
||||
const goldenRow = generateGoldenSample(rows)
|
||||
return {
|
||||
[listRepeaterId]: goldenRow,
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Block>
|
||||
|
|
Loading…
Reference in New Issue