Allow form fields to have custom names

This commit is contained in:
Andrew Kingston 2021-02-05 10:26:24 +00:00
parent 5244ce1a62
commit 2c465bb922
1 changed files with 29 additions and 3 deletions

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>