|
|
@ -1,11 +1,9 @@ |
|
|
<script> |
|
|
<script> |
|
|
import { Button, Icon, Drawer, Label } from "@budibase/bbui" |
|
|
import { Label } from "@budibase/bbui" |
|
|
import { |
|
|
import { |
|
|
readableToRuntimeBinding, |
|
|
readableToRuntimeBinding, |
|
|
runtimeToReadableBinding, |
|
|
runtimeToReadableBinding, |
|
|
} from "builderStore/dataBinding" |
|
|
} from "builderStore/dataBinding" |
|
|
import BindingPanel from "components/common/bindings/BindingPanel.svelte" |
|
|
|
|
|
import { capitalise } from "helpers" |
|
|
|
|
|
|
|
|
|
|
|
export let label = "" |
|
|
export let label = "" |
|
|
export let bindable = true |
|
|
export let bindable = true |
|
|
@ -20,10 +18,6 @@ |
|
|
export let componentBindings = [] |
|
|
export let componentBindings = [] |
|
|
export let nested = false |
|
|
export let nested = false |
|
|
|
|
|
|
|
|
let bindingDrawer |
|
|
|
|
|
let anchor |
|
|
|
|
|
let valid |
|
|
|
|
|
|
|
|
|
|
|
$: allBindings = getAllBindings(bindings, componentBindings, nested) |
|
|
$: allBindings = getAllBindings(bindings, componentBindings, nested) |
|
|
$: safeValue = getSafeValue(value, props.defaultValue, allBindings) |
|
|
$: safeValue = getSafeValue(value, props.defaultValue, allBindings) |
|
|
$: tempValue = safeValue |
|
|
$: tempValue = safeValue |
|
|
@ -36,11 +30,6 @@ |
|
|
return [...(bindings || []), ...(componentBindings || [])] |
|
|
return [...(bindings || []), ...(componentBindings || [])] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const handleClose = () => { |
|
|
|
|
|
handleChange(tempValue) |
|
|
|
|
|
bindingDrawer.hide() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Handle a value change of any type |
|
|
// Handle a value change of any type |
|
|
// String values have any bindings handled |
|
|
// String values have any bindings handled |
|
|
const handleChange = value => { |
|
|
const handleChange = value => { |
|
|
@ -74,7 +63,7 @@ |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<div class="property-control" bind:this={anchor} data-cy={`setting-${key}`}> |
|
|
<div class="property-control" data-cy={`setting-${key}`}> |
|
|
{#if type !== "boolean" && label} |
|
|
{#if type !== "boolean" && label} |
|
|
<div class="label"> |
|
|
<div class="label"> |
|
|
<Label>{label}</Label> |
|
|
<Label>{label}</Label> |
|
|
@ -94,31 +83,6 @@ |
|
|
{type} |
|
|
{type} |
|
|
{...props} |
|
|
{...props} |
|
|
/> |
|
|
/> |
|
|
{#if bindable && !key.startsWith("_") && type === "text"} |
|
|
|
|
|
<div |
|
|
|
|
|
class="icon" |
|
|
|
|
|
data-cy={`${key}-binding-button`} |
|
|
|
|
|
on:click={bindingDrawer.show} |
|
|
|
|
|
> |
|
|
|
|
|
<Icon size="S" name="FlashOn" /> |
|
|
|
|
|
</div> |
|
|
|
|
|
<Drawer bind:this={bindingDrawer} title={capitalise(key)}> |
|
|
|
|
|
<svelte:fragment slot="description"> |
|
|
|
|
|
Add the objects on the left to enrich your text. |
|
|
|
|
|
</svelte:fragment> |
|
|
|
|
|
<Button cta slot="buttons" disabled={!valid} on:click={handleClose}> |
|
|
|
|
|
Save |
|
|
|
|
|
</Button> |
|
|
|
|
|
<BindingPanel |
|
|
|
|
|
slot="body" |
|
|
|
|
|
bind:valid |
|
|
|
|
|
value={safeValue} |
|
|
|
|
|
on:change={e => (tempValue = e.detail)} |
|
|
|
|
|
bindableProperties={allBindings} |
|
|
|
|
|
allowJS |
|
|
|
|
|
/> |
|
|
|
|
|
</Drawer> |
|
|
|
|
|
{/if} |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
@ -130,40 +94,10 @@ |
|
|
justify-content: flex-start; |
|
|
justify-content: flex-start; |
|
|
align-items: stretch; |
|
|
align-items: stretch; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.label { |
|
|
.label { |
|
|
padding-bottom: var(--spectrum-global-dimension-size-65); |
|
|
padding-bottom: var(--spectrum-global-dimension-size-65); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.control { |
|
|
.control { |
|
|
position: relative; |
|
|
position: relative; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.icon { |
|
|
|
|
|
right: 1px; |
|
|
|
|
|
top: 1px; |
|
|
|
|
|
bottom: 1px; |
|
|
|
|
|
position: absolute; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
flex-direction: row; |
|
|
|
|
|
box-sizing: border-box; |
|
|
|
|
|
border-left: 1px solid var(--spectrum-alias-border-color); |
|
|
|
|
|
border-top-right-radius: var(--spectrum-alias-border-radius-regular); |
|
|
|
|
|
border-bottom-right-radius: var(--spectrum-alias-border-radius-regular); |
|
|
|
|
|
width: 31px; |
|
|
|
|
|
color: var(--spectrum-alias-text-color); |
|
|
|
|
|
background-color: var(--spectrum-global-color-gray-75); |
|
|
|
|
|
transition: background-color |
|
|
|
|
|
var(--spectrum-global-animation-duration-100, 130ms), |
|
|
|
|
|
box-shadow var(--spectrum-global-animation-duration-100, 130ms), |
|
|
|
|
|
border-color var(--spectrum-global-animation-duration-100, 130ms); |
|
|
|
|
|
} |
|
|
|
|
|
.icon:hover { |
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
color: var(--spectrum-alias-text-color-hover); |
|
|
|
|
|
background-color: var(--spectrum-global-color-gray-50); |
|
|
|
|
|
border-color: var(--spectrum-alias-border-color-hover); |
|
|
|
|
|
} |
|
|
|
|
|
</style> |
|
|
</style> |
|
|
|