Add collapsed button option to multistep form block
This commit is contained in:
parent
049e2767c3
commit
3b827c35a2
|
@ -28,7 +28,7 @@
|
||||||
>
|
>
|
||||||
{text || "Action"}
|
{text || "Action"}
|
||||||
</Button>
|
</Button>
|
||||||
<Popover bind:this={popover} {align} {anchor} {offset}>
|
<Popover bind:this={popover} {align} {anchor} {offset} resizable={false}>
|
||||||
<Menu>
|
<Menu>
|
||||||
{#each buttons as button}
|
{#each buttons as button}
|
||||||
<MenuItem on:click={() => handleClick(button)} disabled={button.disabled}>
|
<MenuItem on:click={() => handleClick(button)} disabled={button.disabled}>
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
_instanceName: `Step ${currentStep + 1}`,
|
_instanceName: `Step ${currentStep + 1}`,
|
||||||
title: savedInstance.title ?? defaults?.title,
|
title: savedInstance.title ?? defaults?.title,
|
||||||
buttons: savedInstance.buttons || defaults?.buttons,
|
buttons: savedInstance.buttons || defaults?.buttons,
|
||||||
|
buttonsCollapsed: savedInstance.buttonsCollapsed,
|
||||||
|
buttonsCollapsedText: savedInstance.buttonsCollapsedText,
|
||||||
fields: savedInstance.fields,
|
fields: savedInstance.fields,
|
||||||
desc: savedInstance.desc,
|
desc: savedInstance.desc,
|
||||||
|
|
||||||
|
|
|
@ -7076,6 +7076,18 @@
|
||||||
"key": "buttons",
|
"key": "buttons",
|
||||||
"wide": true,
|
"wide": true,
|
||||||
"nested": true
|
"nested": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"label": "Collapse",
|
||||||
|
"key": "buttonsCollapsed"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"label": "Collapsed text",
|
||||||
|
"key": "buttonsCollapsedText",
|
||||||
|
"dependsOn": "buttonsCollapsed",
|
||||||
|
"placeholder": "Action"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
const enrichSteps = (steps, schema, id) => {
|
const enrichSteps = (steps, schema, id) => {
|
||||||
const safeSteps = steps?.length ? steps : [{}]
|
const safeSteps = steps?.length ? steps : [{}]
|
||||||
return safeSteps.map((step, idx) => {
|
return safeSteps.map((step, idx) => {
|
||||||
const { title, desc, fields, buttons } = step
|
const { title, fields, buttons } = step
|
||||||
const defaultProps = Utils.buildMultiStepFormBlockDefaultProps({
|
const defaultProps = Utils.buildMultiStepFormBlockDefaultProps({
|
||||||
_id: id,
|
_id: id,
|
||||||
stepCount: safeSteps.length,
|
stepCount: safeSteps.length,
|
||||||
|
@ -86,10 +86,10 @@
|
||||||
dataSource,
|
dataSource,
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
|
...step,
|
||||||
_stepId: Helpers.uuid(),
|
_stepId: Helpers.uuid(),
|
||||||
fields: getDefaultFields(fields || [], schema),
|
fields: getDefaultFields(fields || [], schema),
|
||||||
title: title ?? defaultProps.title,
|
title: title ?? defaultProps.title,
|
||||||
desc,
|
|
||||||
buttons: buttons || defaultProps.buttons,
|
buttons: buttons || defaultProps.buttons,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -172,7 +172,11 @@
|
||||||
{#if buttonPosition === "bottom"}
|
{#if buttonPosition === "bottom"}
|
||||||
<BlockComponent
|
<BlockComponent
|
||||||
type="buttongroup"
|
type="buttongroup"
|
||||||
props={{ buttons: step.buttons }}
|
props={{
|
||||||
|
buttons: step.buttons,
|
||||||
|
collapsed: step.buttonsCollapsed,
|
||||||
|
collapsedText: step.buttonsCollapsedText,
|
||||||
|
}}
|
||||||
order={3}
|
order={3}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Reference in New Issue