1
0
Fork 0
mirror of synced 2024-10-01 09:38:55 +13:00

Allow form fields to have custom names

This commit is contained in:
Andrew Kingston 2021-02-05 10:26:24 +00:00
parent 580837f949
commit 10536a8c7d

View file

@ -1,5 +1,5 @@
<script>
import OptionSelect from "./OptionSelect.svelte"
import { DataList } from "@budibase/bbui"
import {
getDatasourceForProvider,
getSchemaForDatasource,
@ -18,7 +18,7 @@
component => component._component === "@budibase/standard-components/form"
)
$: datasource = getDatasourceForProvider(form)
$: schema = getSchemaForDatasource(datasource).schema
$: schema = getSchemaForDatasource(datasource, true).schema
$: options = getOptions(schema, type)
const getOptions = (schema, fieldType) => {
@ -28,6 +28,32 @@
}
return entries.map(entry => entry[0])
}
const handleBlur = () => onChange(value)
</script>
<OptionSelect {value} {onChange} {options} />
<div>
<DataList
editable
secondary
extraThin
on:blur={handleBlur}
on:change
bind:value>
<option value="" />
{#each options as option}
<option value={option}>{option}</option>
{/each}
</DataList>
</div>
<style>
div {
flex: 1 1 auto;
display: flex;
flex-direction: row;
}
div :global(> div) {
flex: 1 1 auto;
}
</style>