Merge pull request #12763 from Budibase/multistep-formblock-feedback

Multistep formblock feedback
This commit is contained in:
deanhannigan 2024-01-15 10:43:21 +00:00 committed by GitHub
commit 6db96a7af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 20 deletions

View File

@ -23,7 +23,7 @@
stepAction("addStep") stepAction("addStep")
}} }}
> >
Add Step Add step
</ActionButton> </ActionButton>
</div> </div>
{:else} {:else}

View File

@ -6093,15 +6093,44 @@
"key": "steps", "key": "steps",
"nested": true, "nested": true,
"labelHidden": true, "labelHidden": true,
"resetOn": [ "resetOn": ["dataSource", "actionType"],
"dataSource", "defaultValue": [{}]
"actionType"
],
"defaultValue": [
{}
]
} }
] ]
},
{
"tag": "style",
"type": "select",
"label": "Size",
"key": "size",
"options": [
{
"label": "Medium",
"value": "spectrum--medium"
},
{
"label": "Large",
"value": "spectrum--large"
}
],
"defaultValue": "spectrum--medium"
},
{
"tag": "style",
"type": "select",
"label": "Button position",
"key": "buttonPosition",
"options": [
{
"label": "Bottom",
"value": "bottom"
},
{
"label": "Top",
"value": "top"
}
],
"defaultValue": "bottom"
} }
], ],
"actions": [ "actions": [

View File

@ -11,6 +11,8 @@
export let noRowsMessage export let noRowsMessage
export let steps export let steps
export let dataSource export let dataSource
export let buttonPosition = "bottom"
export let size
const { fetchDatasourceSchema } = getContext("sdk") const { fetchDatasourceSchema } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
@ -127,6 +129,7 @@
type="form" type="form"
context="form" context="form"
props={{ props={{
size,
dataSource, dataSource,
actionType: actionType === "Create" ? "Create" : "Update", actionType: actionType === "Create" ? "Create" : "Update",
readonly: actionType === "View", readonly: actionType === "View",
@ -154,8 +157,33 @@
size: "shrink", size: "shrink",
}} }}
> >
<BlockComponent type="container" order={0}> <BlockComponent
<BlockComponent type="heading" props={{ text: step.title }} /> type="container"
props={{
direction: "column",
gap: "S",
}}
order={0}
>
<BlockComponent
type="container"
props={{
direction: "row",
hAlign: "stretch",
vAlign: "center",
gap: "M",
wrap: true,
}}
order={0}
>
<BlockComponent type="heading" props={{ text: step.title }} />
{#if buttonPosition === "top"}
<BlockComponent
type="buttongroup"
props={{ buttons: step.buttons }}
/>
{/if}
</BlockComponent>
</BlockComponent> </BlockComponent>
<BlockComponent type="text" props={{ text: step.desc }} order={1} /> <BlockComponent type="text" props={{ text: step.desc }} order={1} />
<BlockComponent type="container" order={2}> <BlockComponent type="container" order={2}>
@ -176,16 +204,13 @@
{/each} {/each}
</div> </div>
</BlockComponent> </BlockComponent>
<BlockComponent {#if buttonPosition === "bottom"}
type="buttongroup" <BlockComponent
props={{ buttons: step.buttons }} type="buttongroup"
styles={{ props={{ buttons: step.buttons }}
normal: { order={3}
"margin-top": "16px", />
}, {/if}
}}
order={3}
/>
</BlockComponent> </BlockComponent>
</BlockComponent> </BlockComponent>
{/each} {/each}