PR feedback

This commit is contained in:
Dean 2024-01-22 09:44:57 +00:00
parent f0feed9cd9
commit 64951d6f29
2 changed files with 6 additions and 7 deletions

View File

@ -2,6 +2,7 @@
import { getContext } from "svelte" import { getContext } from "svelte"
import Placeholder from "./Placeholder.svelte" import Placeholder from "./Placeholder.svelte"
import Container from "./Container.svelte" import Container from "./Container.svelte"
import { ContextScopes } from "constants"
export let dataProvider export let dataProvider
export let noRowsMessage export let noRowsMessage
@ -9,9 +10,9 @@
export let hAlign export let hAlign
export let vAlign export let vAlign
export let gap export let gap
export let nested = false export let scope = ContextScopes.Local
const { Provider, ContextScopes } = getContext("sdk") const { Provider } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
$: rows = dataProvider?.rows ?? [] $: rows = dataProvider?.rows ?? []
@ -23,10 +24,7 @@
<Placeholder /> <Placeholder />
{:else if rows.length > 0} {:else if rows.length > 0}
{#each rows as row, index} {#each rows as row, index}
<Provider <Provider data={{ ...row, index }} {scope}>
data={{ ...row, index }}
scope={nested ? ContextScopes.Global : ContextScopes.Local}
>
<slot /> <slot />
</Provider> </Provider>
{/each} {/each}

View File

@ -10,6 +10,7 @@
export let noRowsMessage export let noRowsMessage
const component = getContext("component") const component = getContext("component")
const { ContextScopes } = getContext("sdk")
$: providerId = `${$component.id}-provider` $: providerId = `${$component.id}-provider`
$: dataProvider = `{{ literal ${safe(providerId)} }}` $: dataProvider = `{{ literal ${safe(providerId)} }}`
@ -55,7 +56,7 @@
noRowsMessage: noRowsMessage || "We couldn't find a row to display", noRowsMessage: noRowsMessage || "We couldn't find a row to display",
direction: "column", direction: "column",
hAlign: "center", hAlign: "center",
nested: true, scope: ContextScopes.Global,
}} }}
> >
<slot /> <slot />