Add missing initial form values to form context and prefix static values to avoid clashes with column names
This commit is contained in:
parent
27be64a6fd
commit
88354073aa
|
@ -1739,15 +1739,15 @@
|
||||||
"values": [
|
"values": [
|
||||||
{
|
{
|
||||||
"label": "Valid",
|
"label": "Valid",
|
||||||
"key": "valid"
|
"key": "__valid"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Current Step",
|
"label": "Current Step",
|
||||||
"key": "currentStep"
|
"key": "__currentStep"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Current Step Valid",
|
"label": "Current Step Valid",
|
||||||
"key": "currentStepValid"
|
"key": "__currentStepValid"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -256,17 +256,20 @@
|
||||||
{ type: ActionTypes.ClearForm, callback: formApi.clear },
|
{ type: ActionTypes.ClearForm, callback: formApi.clear },
|
||||||
{ type: ActionTypes.ChangeFormStep, callback: formApi.changeStep },
|
{ 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>
|
</script>
|
||||||
|
|
||||||
<Provider
|
<Provider {actions} data={dataContext}>
|
||||||
{actions}
|
|
||||||
data={{
|
|
||||||
...$values,
|
|
||||||
valid,
|
|
||||||
currentStep: $currentStep,
|
|
||||||
currentStepValid: $currentStepValid,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div use:styleable={$component.styles}>
|
<div use:styleable={$component.styles}>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue