forked from tsai/budibase
5 changed files with 51 additions and 44 deletions
@ -0,0 +1,30 @@ |
|||||
|
<script> |
||||
|
import { DropdownMenu, TextButton as Button, Icon } from "@budibase/bbui" |
||||
|
// import CreateEditRecord from "../modals/CreateEditRecord.svelte" |
||||
|
|
||||
|
let anchor |
||||
|
let dropdown |
||||
|
</script> |
||||
|
|
||||
|
<div bind:this={anchor}> |
||||
|
<Button text small on:click={dropdown.show}> |
||||
|
<Icon name="addrow" /> |
||||
|
Create New Row |
||||
|
</Button> |
||||
|
</div> |
||||
|
<DropdownMenu bind:this={dropdown} {anchor} align="left"> |
||||
|
<h5>Add New Row</h5> |
||||
|
popup goes here! |
||||
|
<!-- <CreateEditRecord onClosed={dropdown.hide} /> --> |
||||
|
</DropdownMenu> |
||||
|
|
||||
|
<style> |
||||
|
div { |
||||
|
display: grid; |
||||
|
} |
||||
|
h5 { |
||||
|
padding: var(--spacing-xl) 0 0 var(--spacing-xl); |
||||
|
margin: 0; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
</style> |
||||
@ -1,22 +0,0 @@ |
|||||
<script> |
|
||||
import Form from "@svelteschool/svelte-forms" |
|
||||
import { Input } from "@budibase/bbui" |
|
||||
import { createEventDispatcher } from "svelte" |
|
||||
const dispatch = createEventDispatcher() |
|
||||
let values |
|
||||
export let fields |
|
||||
|
|
||||
const handleSubmit = () => { |
|
||||
dispatch("submit", values) |
|
||||
values = {} |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
<Form bind:values> |
|
||||
{#each fields as { field, hide }} |
|
||||
{#if !hide} |
|
||||
<Input thin placeholder="Enter {field}" name={field} /> |
|
||||
{/if} |
|
||||
{/each} |
|
||||
<button on:click|preventDefault={handleSubmit}>Add row</button> |
|
||||
</Form> |
|
||||
Loading…
Reference in new issue