Updating key value in queries to be a bit more clear.
This commit is contained in:
parent
4a0ce14f04
commit
bfd8007dfa
|
@ -1,6 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { Icon, ActionButton, Input } from "@budibase/bbui"
|
import { Icon, ActionButton, Input } from "@budibase/bbui"
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
|
import { lowercase } from "helpers"
|
||||||
|
|
||||||
let dispatch = createEventDispatcher()
|
let dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -8,6 +9,7 @@
|
||||||
export let object = defaults || {}
|
export let object = defaults || {}
|
||||||
export let readOnly
|
export let readOnly
|
||||||
export let noAddButton
|
export let noAddButton
|
||||||
|
export let name
|
||||||
|
|
||||||
let fields = Object.entries(object).map(([name, value]) => ({ name, value }))
|
let fields = Object.entries(object).map(([name, value]) => ({ name, value }))
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@
|
||||||
{#if !readOnly && !noAddButton}
|
{#if !readOnly && !noAddButton}
|
||||||
<div>
|
<div>
|
||||||
<ActionButton icon="Add" secondary thin outline on:click={addEntry}
|
<ActionButton icon="Add" secondary thin outline on:click={addEntry}
|
||||||
>Add</ActionButton
|
>Add{name ? ` ${lowercase(name)}` : ""}</ActionButton
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -30,7 +30,11 @@
|
||||||
{#each schemaKeys as field}
|
{#each schemaKeys as field}
|
||||||
{#if schema.fields[field]?.type === "object"}
|
{#if schema.fields[field]?.type === "object"}
|
||||||
<Label small>{getDisplayName(field)}</Label>
|
<Label small>{getDisplayName(field)}</Label>
|
||||||
<KeyValueBuilder readOnly={!editable} bind:object={fields[field]} />
|
<KeyValueBuilder
|
||||||
|
name={getDisplayName(field)}
|
||||||
|
readOnly={!editable}
|
||||||
|
bind:object={fields[field]}
|
||||||
|
/>
|
||||||
{:else if schema.fields[field]?.type === "json"}
|
{:else if schema.fields[field]?.type === "json"}
|
||||||
<div>
|
<div>
|
||||||
<Label extraSmall grey>{getDisplayName(field)}</Label>
|
<Label extraSmall grey>{getDisplayName(field)}</Label>
|
||||||
|
|
|
@ -19,6 +19,8 @@ export const pipe = (arg, funcs) => flow(funcs)(arg)
|
||||||
|
|
||||||
export const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1)
|
export const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1)
|
||||||
|
|
||||||
|
export const lowercase = s => s.substring(0, 1).toLowerCase() + s.substring(1)
|
||||||
|
|
||||||
export const get_name = s => (!s ? "" : last(s.split("/")))
|
export const get_name = s => (!s ? "" : last(s.split("/")))
|
||||||
|
|
||||||
export const get_capitalised_name = name => pipe(name, [get_name, capitalise])
|
export const get_capitalised_name = name => pipe(name, [get_name, capitalise])
|
||||||
|
|
|
@ -6,4 +6,5 @@ export {
|
||||||
capitalise,
|
capitalise,
|
||||||
get_name,
|
get_name,
|
||||||
get_capitalised_name,
|
get_capitalised_name,
|
||||||
|
lowercase,
|
||||||
} from "./helpers"
|
} from "./helpers"
|
||||||
|
|
Loading…
Reference in New Issue