fix formatting of selectors

This commit is contained in:
Peter Clement 2023-10-26 11:27:34 +01:00
parent 8203139c69
commit 73a7b8eb50
3 changed files with 57 additions and 29 deletions

View File

@ -283,6 +283,14 @@
return !dependsOn || !!inputData[dependsOn]
}
function shouldRenderField(value) {
return (
value.customType !== "row" &&
value.customType !== "code" &&
value.customType !== "queryParams"
)
}
onMount(async () => {
try {
await environment.loadVariables()
@ -295,15 +303,15 @@
<div class="fields">
{#each schemaProperties as [key, value]}
{#if canShowField(key, value)}
<div class:block-field={value.customType !== "row"}>
{#if key !== "fields" && value.type !== "boolean" && value.customType !== "row"}
<div class:block-field={shouldRenderField(value)}>
{#if key !== "fields" && value.type !== "boolean" && shouldRenderField(value)}
<Label
tooltip={value.title === "Binding / Value"
? "If using the String input type, please use a comma or newline separated string"
: null}>{value.title || (key === "row" ? "Table" : key)}</Label
>
{/if}
<div class:field-width={value.customType !== "row"}>
<div class:field-width={shouldRenderField(value)}>
{#if value.type === "string" && value.enum && canShowField(key, value)}
<Select
on:change={e => onChange(e, key)}

View File

@ -23,7 +23,9 @@
</div>
</ModalContent>
</Modal>
<Button primary on:click={show}>Edit Code</Button>
<div class="center">
<Button primary on:click={show}>Edit Code</Button>
</div>
<style>
.container :global(section > header) {
@ -33,4 +35,9 @@
.container :global(textarea) {
min-height: 60px;
}
.center {
display: flex;
justify-content: center;
}
</style>

View File

@ -1,7 +1,7 @@
<script>
import { createEventDispatcher } from "svelte"
import { queries } from "stores/backend"
import { Select } from "@budibase/bbui"
import { Select, Label } from "@budibase/bbui"
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
@ -27,41 +27,54 @@
$: if (value?.queryId == null) value = { queryId: "" }
</script>
<div class="block-field">
<Select
label="Query"
on:change={onChangeQuery}
value={value.queryId}
options={$queries.list}
getOptionValue={query => query._id}
getOptionLabel={query => query.name}
/>
<div class="schema-fields">
<Label>Table</Label>
<div class="field-width">
<Select
on:change={onChangeQuery}
value={value.queryId}
options={$queries.list}
getOptionValue={query => query._id}
getOptionLabel={query => query.name}
/>
</div>
</div>
{#if parameters.length}
<div class="schema-fields">
{#each parameters as field}
<DrawerBindableInput
panel={AutomationBindingPanel}
extraThin
value={value[field.name]}
on:change={e => onChange(e, field)}
label={field.name}
type="string"
{bindings}
fillWidth={true}
updateOnChange={false}
/>
<Label>{field.name}</Label>
<div class="field-width">
<DrawerBindableInput
panel={AutomationBindingPanel}
extraThin
on:change={e => onChange(e, field)}
type="string"
{bindings}
fillWidth={true}
updateOnChange={false}
/>
</div>
{/each}
</div>
{/if}
<style>
.schema-fields {
display: grid;
grid-gap: var(--spacing-xl);
margin-top: var(--spacing-xl);
.field-width {
width: 320px;
}
.schema-fields {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row;
align-items: center;
gap: 10px;
flex: 1;
margin-bottom: 10px;
}
.schema-fields :global(label) {
text-transform: capitalize;
}