1
0
Fork 0
mirror of synced 2024-06-02 18:44:54 +12:00

Fix table setting type

This commit is contained in:
Andrew Kingston 2022-09-30 15:43:47 +01:00
parent 937235fba0
commit 1b9f3cf0af

View file

@ -1,26 +1,28 @@
<script>
import { Select } from "@budibase/bbui"
import { tables } from "stores/backend"
import { createEventDispatcher } from "svelte"
import { tables as tablesStore } from "stores/backend"
export let value
const dispatch = createEventDispatcher()
$: tables = $tablesStore.list.map(m => ({
label: m.name,
tableId: m._id,
type: "table",
}))
const onChange = e => {
const dataSource = tables?.find(x => x.tableId === e.detail)
dispatch("change", dataSource)
}
</script>
<div>
<Select extraThin secondary wide on:change {value}>
<option value="">Choose a table</option>
{#each $tables.list as table}
<option value={table._id}>{table.name}</option>
{/each}
</Select>
</div>
<style>
div {
flex: 1 1 auto;
display: flex;
flex-direction: row;
}
div :global(> *) {
flex: 1 1 auto;
}
</style>
<Select
on:change={onChange}
value={value?.tableId}
options={tables}
getOptionValue={x => x.tableId}
getOptionLabel={x => x.label}
/>