2020-06-03 00:26:06 +02:00
|
|
|
<script>
|
|
|
|
import { onMount } from "svelte"
|
2020-11-13 16:42:32 +01:00
|
|
|
import { fetchDatasource } from "@budibase/component-sdk"
|
2020-08-26 18:03:30 +02:00
|
|
|
import { isEmpty } from "lodash/fp"
|
2020-06-03 00:26:06 +02:00
|
|
|
|
|
|
|
export let _bb
|
2020-08-26 18:03:30 +02:00
|
|
|
export let datasource = []
|
2020-06-03 00:26:06 +02:00
|
|
|
|
|
|
|
let target
|
2020-10-12 15:21:15 +02:00
|
|
|
let store = _bb.store
|
2020-06-03 00:26:06 +02:00
|
|
|
|
2020-08-26 18:03:30 +02:00
|
|
|
onMount(async () => {
|
|
|
|
if (!isEmpty(datasource)) {
|
2020-11-12 13:24:45 +01:00
|
|
|
const data = await fetchDatasource(datasource)
|
2020-06-03 00:26:06 +02:00
|
|
|
_bb.attachChildren(target, {
|
|
|
|
hydrate: false,
|
2020-08-26 18:03:30 +02:00
|
|
|
context: data,
|
2020-06-03 00:26:06 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
2020-07-07 22:29:20 +02:00
|
|
|
<section bind:this={target} />
|