remove Spacer component

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-28 15:23:47 +02:00
parent 039797c7bb
commit 6158a547ea
1 changed files with 16 additions and 13 deletions

View File

@ -1,5 +1,5 @@
<script>
import { Label, ActionButton, Button, Spacer, Select, Input } from "@budibase/bbui"
import { Label, ActionButton, Button, Select, Input } from "@budibase/bbui"
import { store, currentAsset } from "builderStore"
import { getBindableProperties } from "builderStore/dataBinding"
import { createEventDispatcher } from "svelte"
@ -20,11 +20,11 @@
)
const addField = () => {
fields = [...fields.filter(field => field[0]), ["", ""]]
fields = [...fields.filter((field) => field[0]), ["", ""]]
}
const removeField = name => {
fields = fields.filter(field => field[0] !== name)
const removeField = (name) => {
fields = fields.filter((field) => field[0] !== name)
}
const updateFieldValue = (idx, value) => {
@ -37,10 +37,10 @@
fields = fields
}
const onChange = fields => {
const onChange = (fields) => {
const newParamFields = {}
fields
.filter(field => field[0])
.filter((field) => field[0])
.forEach(([field, value]) => {
newParamFields[field] = value
})
@ -54,32 +54,35 @@
{#if schemaFields}
<Select
value={field[0]}
on:change={event => updateFieldName(idx, event.detail)}
options={schemaFields.map(field => field.name)} />
on:change={(event) => updateFieldName(idx, event.detail)}
options={schemaFields.map((field) => field.name)}
/>
{:else}
<Input
thin
secondary
value={field[0]}
on:change={event => updateFieldName(idx, event.detail)} />
on:change={(event) => updateFieldName(idx, event.detail)}
/>
{/if}
<Label small>{valueLabel}</Label>
<DrawerBindableInput
title={`Value for "${field[0]}"`}
value={field[1]}
bindings={bindableProperties}
on:change={event => updateFieldValue(idx, event.detail)} />
on:change={(event) => updateFieldValue(idx, event.detail)}
/>
<ActionButton
size="S"
quiet
icon="Delete"
on:click={() => removeField(field[0])} />
on:click={() => removeField(field[0])}
/>
{/each}
<div>
<Spacer small />
<Button icon="AddCircle" size="S" cta on:click={addField}>
Add
{fieldLabel}
</Button>
</div>
{/if}
{/if}