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