commit
63f0de886c
|
@ -161,7 +161,11 @@ export function makeDatasourceFormComponents(datasource) {
|
||||||
placeholder: field,
|
placeholder: field,
|
||||||
})
|
})
|
||||||
if (fieldType === "options") {
|
if (fieldType === "options") {
|
||||||
component.customProps({ placeholder: "Choose an option " })
|
component.customProps({
|
||||||
|
placeholder: "Choose an option",
|
||||||
|
optionsType: "select",
|
||||||
|
optionsSource: "schema",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if (fieldType === "link") {
|
if (fieldType === "link") {
|
||||||
let placeholder =
|
let placeholder =
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if settings && settings.length > 0}
|
{#if settings && settings.length > 0}
|
||||||
{#each settings as setting}
|
{#each settings as setting (setting.key)}
|
||||||
{#if canRenderControl(setting)}
|
{#if canRenderControl(setting)}
|
||||||
<PropertyControl
|
<PropertyControl
|
||||||
type={setting.type}
|
type={setting.type}
|
||||||
|
@ -83,8 +83,8 @@
|
||||||
{componentInstance}
|
{componentInstance}
|
||||||
onChange={val => updateProp(setting.key, val)}
|
onChange={val => updateProp(setting.key, val)}
|
||||||
props={{
|
props={{
|
||||||
options: setting.options,
|
options: setting.options || [],
|
||||||
placeholder: setting.placeholder,
|
placeholder: setting.placeholder || null,
|
||||||
}}
|
}}
|
||||||
{bindings}
|
{bindings}
|
||||||
{componentDefinition}
|
{componentDefinition}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { CoreSelect, RadioGroup } from "@budibase/bbui"
|
import { CoreSelect, CoreRadioGroup } from "@budibase/bbui"
|
||||||
import Field from "./Field.svelte"
|
import Field from "./Field.svelte"
|
||||||
|
|
||||||
export let field
|
export let field
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
bind:fieldSchema
|
bind:fieldSchema
|
||||||
>
|
>
|
||||||
{#if fieldState}
|
{#if fieldState}
|
||||||
{#if optionsType === "select"}
|
{#if !optionsType || optionsType === "select"}
|
||||||
<CoreSelect
|
<CoreSelect
|
||||||
value={$fieldState.value}
|
value={$fieldState.value}
|
||||||
id={$fieldState.fieldId}
|
id={$fieldState.fieldId}
|
||||||
|
@ -87,13 +87,15 @@
|
||||||
getOptionValue={flatOptions ? x => x : x => x.value}
|
getOptionValue={flatOptions ? x => x : x => x.value}
|
||||||
/>
|
/>
|
||||||
{:else if optionsType === "radio"}
|
{:else if optionsType === "radio"}
|
||||||
<RadioGroup
|
<CoreRadioGroup
|
||||||
value={$fieldState.value}
|
value={$fieldState.value}
|
||||||
id={$fieldState.fieldId}
|
id={$fieldState.fieldId}
|
||||||
disabled={$fieldState.disabled}
|
disabled={$fieldState.disabled}
|
||||||
error={$fieldState.error}
|
error={$fieldState.error}
|
||||||
options={fieldSchema?.constraints?.inclusion ?? []}
|
{options}
|
||||||
on:change={e => fieldApi.setValue(e.detail)}
|
on:change={e => fieldApi.setValue(e.detail)}
|
||||||
|
getOptionLabel={flatOptions ? x => x : x => x.label}
|
||||||
|
getOptionValue={flatOptions ? x => x : x => x.value}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Reference in New Issue