Merge branch 'contextual-workflows' of github.com:Budibase/budibase into contextual-workflows

This commit is contained in:
mike12345567 2020-09-21 23:19:56 +01:00
commit 0e932a1999
1 changed files with 9 additions and 7 deletions

View File

@ -12,6 +12,10 @@
// Ensure any nullish modelId values get set to empty string so // Ensure any nullish modelId values get set to empty string so
// that the select works // that the select works
$: if (value?.modelId == null) value = { modelId: "" } $: if (value?.modelId == null) value = { modelId: "" }
function schemaHasOptions(schema) {
return !!schema.constraints?.inclusion?.length
}
</script> </script>
<div class="block-field"> <div class="block-field">
@ -27,18 +31,15 @@
<div class="bb-margin-xl block-field"> <div class="bb-margin-xl block-field">
{#each schemaFields as [field, schema]} {#each schemaFields as [field, schema]}
<div class="bb-margin-xl capitalise"> <div class="bb-margin-xl capitalise">
{#if schema.constraints?.inclusion?.length} {#if schemaHasOptions(schema)}
<div class="field-label">{field}</div> <div class="field-label">{field}</div>
<Select <Select thin secondary bind:value={value[field]}>
thin
secondary
bind:value={value[field]}>
<option value="">Choose an option</option> <option value="">Choose an option</option>
{#each schema.constraints.inclusion as option} {#each schema.constraints.inclusion as option}
<option value={option}>{option}</option> <option value={option}>{option}</option>
{/each} {/each}
</Select> </Select>
{:else if schema.type === "string" || schema.type === "number"} {:else if schema.type === 'string' || schema.type === 'number'}
<BindableInput <BindableInput
thin thin
bind:value={value[field]} bind:value={value[field]}
@ -61,7 +62,8 @@
font-family: sans-serif; font-family: sans-serif;
} }
.capitalise :global(label), .field-label { .capitalise :global(label),
.field-label {
text-transform: capitalize; text-transform: capitalize;
} }
</style> </style>