forked from tsai/budibase
6 changed files with 171 additions and 54 deletions
@ -0,0 +1,25 @@ |
|||||
|
<script> |
||||
|
import { automationStore } from "builderStore" |
||||
|
|
||||
|
import { ModalContent, Toggle } from "@budibase/bbui" |
||||
|
|
||||
|
$: rowControl = $automationStore.selectedAutomation.automation.rowFieldControl |
||||
|
async function toggleFieldControl(evt) { |
||||
|
await automationStore.actions.toggleFieldControl(evt.detail) |
||||
|
await automationStore.actions.save( |
||||
|
$automationStore.selectedAutomation?.automation |
||||
|
) |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<ModalContent |
||||
|
title="Automation Configuration" |
||||
|
confirmText="Test" |
||||
|
showConfirmButton={false} |
||||
|
> |
||||
|
<Toggle |
||||
|
bind:value={rowControl} |
||||
|
on:change={toggleFieldControl} |
||||
|
text="Fine Grained Row Control" |
||||
|
/> |
||||
|
</ModalContent> |
||||
@ -0,0 +1,64 @@ |
|||||
|
<script> |
||||
|
import { |
||||
|
Select, |
||||
|
Toggle, |
||||
|
DatePicker, |
||||
|
Multiselect, |
||||
|
TextArea, |
||||
|
} from "@budibase/bbui" |
||||
|
import LinkedRowSelector from "components/common/LinkedRowSelector.svelte" |
||||
|
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte" |
||||
|
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte" |
||||
|
|
||||
|
export let onChange |
||||
|
export let field |
||||
|
export let schema |
||||
|
export let value |
||||
|
export let bindings |
||||
|
|
||||
|
function schemaHasOptions(schema) { |
||||
|
return !!schema.constraints?.inclusion?.length |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
{#if schemaHasOptions(schema) && schema.type !== "array"} |
||||
|
<Select |
||||
|
on:change={e => onChange(e, field)} |
||||
|
label={field} |
||||
|
value={value[field]} |
||||
|
options={schema.constraints.inclusion} |
||||
|
/> |
||||
|
{:else if schema.type === "datetime"} |
||||
|
<DatePicker |
||||
|
label={field} |
||||
|
value={value[field]} |
||||
|
on:change={e => onChange(e, field)} |
||||
|
/> |
||||
|
{:else if schema.type === "boolean"} |
||||
|
<Toggle |
||||
|
text={field} |
||||
|
value={value[field]} |
||||
|
on:change={e => onChange(e, field)} |
||||
|
/> |
||||
|
{:else if schema.type === "array"} |
||||
|
<Multiselect |
||||
|
bind:value={value[field]} |
||||
|
label={field} |
||||
|
options={schema.constraints.inclusion} |
||||
|
/> |
||||
|
{:else if schema.type === "longform"} |
||||
|
<TextArea label={field} bind:value={value[field]} /> |
||||
|
{:else if schema.type === "link"} |
||||
|
<LinkedRowSelector bind:linkedRows={value[field]} {schema} /> |
||||
|
{:else if schema.type === "string" || schema.type === "number"} |
||||
|
<DrawerBindableInput |
||||
|
panel={AutomationBindingPanel} |
||||
|
value={value[field]} |
||||
|
on:change={e => onChange(e, field)} |
||||
|
label={field} |
||||
|
type="string" |
||||
|
{bindings} |
||||
|
fillWidth={true} |
||||
|
allowJS={false} |
||||
|
/> |
||||
|
{/if} |
||||
Loading…
Reference in new issue