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