2020-10-08 10:30:51 +13:00
|
|
|
<script>
|
|
|
|
import { onMount } from "svelte"
|
2020-11-13 01:24:45 +13:00
|
|
|
import { fetchTableDefinition } from "../../component-sdk"
|
2020-10-08 10:30:51 +13:00
|
|
|
|
|
|
|
export let _bb
|
2020-10-13 01:34:32 +13:00
|
|
|
export let table
|
2020-10-08 10:30:51 +13:00
|
|
|
|
2020-10-13 01:34:32 +13:00
|
|
|
let row = {}
|
2020-10-08 10:30:51 +13:00
|
|
|
|
|
|
|
$: {
|
2020-10-13 01:34:32 +13:00
|
|
|
row.tableId = table
|
2020-10-08 10:30:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
let target
|
|
|
|
|
|
|
|
onMount(async () => {
|
2020-10-14 21:39:49 +13:00
|
|
|
if (table && typeof table === "string") {
|
2020-11-13 01:24:45 +13:00
|
|
|
const tableObj = await fetchTableDefinition(table)
|
2020-10-13 01:34:32 +13:00
|
|
|
row.tableId = table
|
|
|
|
row._table = tableObj
|
2020-10-08 10:30:51 +13:00
|
|
|
_bb.attachChildren(target, {
|
2020-10-13 01:34:32 +13:00
|
|
|
context: row,
|
2020-10-08 10:30:51 +13:00
|
|
|
})
|
2020-10-12 22:51:20 +13:00
|
|
|
} else {
|
|
|
|
_bb.attachChildren(target, {
|
|
|
|
context: {},
|
|
|
|
})
|
2020-10-08 10:30:51 +13:00
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<section bind:this={target} />
|