2020-06-03 10:26:06 +12:00
|
|
|
<script>
|
2020-11-19 00:24:01 +13:00
|
|
|
import { onMount } from "svelte"
|
2020-11-18 01:08:24 +13:00
|
|
|
import {
|
|
|
|
fetchDatasource,
|
2020-11-19 00:24:01 +13:00
|
|
|
styleable,
|
|
|
|
DataProvider,
|
2020-11-18 01:08:24 +13:00
|
|
|
} from "@budibase/component-sdk"
|
2020-08-27 04:03:30 +12:00
|
|
|
import { isEmpty } from "lodash/fp"
|
2020-06-03 10:26:06 +12:00
|
|
|
|
2020-08-27 04:03:30 +12:00
|
|
|
export let datasource = []
|
2020-11-19 00:24:01 +13:00
|
|
|
export let styles
|
2020-06-03 10:26:06 +12:00
|
|
|
|
2020-11-19 00:24:01 +13:00
|
|
|
let rows = []
|
2020-06-03 10:26:06 +12:00
|
|
|
|
2020-08-27 04:03:30 +12:00
|
|
|
onMount(async () => {
|
|
|
|
if (!isEmpty(datasource)) {
|
2020-11-19 00:24:01 +13:00
|
|
|
rows = await fetchDatasource(datasource)
|
2020-06-03 10:26:06 +12:00
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
2020-11-19 00:24:01 +13:00
|
|
|
<div use:styleable={styles}>
|
|
|
|
{#each rows as row}
|
|
|
|
<DataProvider {row}>
|
|
|
|
<slot />
|
|
|
|
</DataProvider>
|
|
|
|
{/each}
|
|
|
|
</div>
|