Add missing initial form values to form context and prefix static values to avoid clashes with column names

This commit is contained in:
Andrew Kingston 2021-08-23 11:10:07 +01:00
parent de7caf90f4
commit be22834d47
2 changed files with 15 additions and 12 deletions

View File

@ -1739,15 +1739,15 @@
"values": [
{
"label": "Valid",
"key": "valid"
"key": "__valid"
},
{
"label": "Current Step",
"key": "currentStep"
"key": "__currentStep"
},
{
"label": "Current Step Valid",
"key": "currentStepValid"
"key": "__currentStepValid"
}
]
},

View File

@ -256,17 +256,20 @@
{ type: ActionTypes.ClearForm, callback: formApi.clear },
{ type: ActionTypes.ChangeFormStep, callback: formApi.changeStep },
]
// Create data context to provide
$: dataContext = {
...initialValues,
...$values,
// These static values are prefixed to avoid clashes with actual columns
__valid: valid,
__currentStep: $currentStep,
__currentStepValid: $currentStepValid,
}
</script>
<Provider
{actions}
data={{
...$values,
valid,
currentStep: $currentStep,
currentStepValid: $currentStepValid,
}}
>
<Provider {actions} data={dataContext}>
<div use:styleable={$component.styles}>
<slot />
</div>