2020-06-03 00:26:06 +02:00
|
|
|
<script>
|
2020-11-18 20:18:18 +01:00
|
|
|
import { getContext, onMount } from "svelte"
|
2020-08-26 18:03:30 +02:00
|
|
|
import { isEmpty } from "lodash/fp"
|
2020-11-18 20:18:18 +01:00
|
|
|
import DataProvider from "./DataProvider.svelte"
|
|
|
|
|
|
|
|
const { API, styleable } = getContext("app")
|
2020-06-03 00:26:06 +02:00
|
|
|
|
2020-08-26 18:03:30 +02:00
|
|
|
export let datasource = []
|
2020-11-18 12:24:01 +01:00
|
|
|
export let styles
|
2020-06-03 00:26:06 +02:00
|
|
|
|
2020-11-18 12:24:01 +01:00
|
|
|
let rows = []
|
2020-06-03 00:26:06 +02:00
|
|
|
|
2020-08-26 18:03:30 +02:00
|
|
|
onMount(async () => {
|
|
|
|
if (!isEmpty(datasource)) {
|
2020-11-18 20:18:18 +01:00
|
|
|
rows = await API.fetchDatasource(datasource)
|
2020-06-03 00:26:06 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
2020-11-18 12:24:01 +01:00
|
|
|
<div use:styleable={styles}>
|
|
|
|
{#each rows as row}
|
|
|
|
<DataProvider {row}>
|
|
|
|
<slot />
|
|
|
|
</DataProvider>
|
|
|
|
{/each}
|
|
|
|
</div>
|