Added description field to the formblock

This commit is contained in:
Dean 2023-10-18 11:14:16 +01:00
parent bbda776c49
commit a064512224
3 changed files with 67 additions and 42 deletions

View File

@ -5305,6 +5305,12 @@
"key": "title", "key": "title",
"nested": true "nested": true
}, },
{
"type": "text",
"label": "Description",
"key": "description",
"nested": true
},
{ {
"section": true, "section": true,
"dependsOn": { "dependsOn": {

View File

@ -12,6 +12,7 @@
export let fields export let fields
export let labelPosition export let labelPosition
export let title export let title
export let description
export let showDeleteButton export let showDeleteButton
export let showSaveButton export let showSaveButton
export let saveButtonLabel export let saveButtonLabel
@ -98,6 +99,7 @@
fields: fieldsOrDefault, fields: fieldsOrDefault,
labelPosition, labelPosition,
title, title,
description,
saveButtonLabel: saveLabel, saveButtonLabel: saveLabel,
deleteButtonLabel: deleteLabel, deleteButtonLabel: deleteLabel,
schema, schema,

View File

@ -11,6 +11,7 @@
export let fields export let fields
export let labelPosition export let labelPosition
export let title export let title
export let description
export let saveButtonLabel export let saveButtonLabel
export let deleteButtonLabel export let deleteButtonLabel
export let schema export let schema
@ -160,55 +161,71 @@
<BlockComponent <BlockComponent
type="container" type="container"
props={{ props={{
direction: "row", direction: "column",
hAlign: "stretch", gap: "S",
vAlign: "center",
gap: "M",
wrap: true,
}} }}
order={0} order={0}
> >
<BlockComponent <BlockComponent
type="heading" type="container"
props={{ text: title || "" }} props={{
direction: "row",
hAlign: "stretch",
vAlign: "center",
gap: "M",
wrap: true,
}}
order={0} order={0}
/> >
{#if renderButtons}
<BlockComponent <BlockComponent
type="container" type="heading"
props={{ props={{ text: title || "" }}
direction: "row", order={0}
hAlign: "stretch", />
vAlign: "center", {#if renderButtons}
gap: "M", <BlockComponent
wrap: true, type="container"
}} props={{
direction: "row",
hAlign: "stretch",
vAlign: "center",
gap: "M",
wrap: true,
}}
order={1}
>
{#if renderDeleteButton}
<BlockComponent
type="button"
props={{
text: deleteButtonLabel,
onClick: onDelete,
quiet: true,
type: "secondary",
}}
order={0}
/>
{/if}
{#if renderSaveButton}
<BlockComponent
type="button"
props={{
text: saveButtonLabel,
onClick: onSave,
type: "cta",
}}
order={1}
/>
{/if}
</BlockComponent>
{/if}
</BlockComponent>
{#if description}
<BlockComponent
type="text"
props={{ text: description }}
order={1} order={1}
> />
{#if renderDeleteButton}
<BlockComponent
type="button"
props={{
text: deleteButtonLabel,
onClick: onDelete,
quiet: true,
type: "secondary",
}}
order={0}
/>
{/if}
{#if renderSaveButton}
<BlockComponent
type="button"
props={{
text: saveButtonLabel,
onClick: onSave,
type: "cta",
}}
order={1}
/>
{/if}
</BlockComponent>
{/if} {/if}
</BlockComponent> </BlockComponent>
{/if} {/if}