Fix for datasource reset on formblock. Added 'resetOn' to the manifest to trigger a clear when the configured field is cleared
This commit is contained in:
parent
cf33680b1e
commit
c6bd81ba21
|
@ -1246,6 +1246,16 @@ export const getFrontendStore = () => {
|
|||
const settings = getComponentSettings(component._component)
|
||||
const updatedSetting = settings.find(setting => setting.key === name)
|
||||
|
||||
const resetFields = settings.filter(
|
||||
setting => name === setting.resetOn
|
||||
)
|
||||
resetFields?.forEach(setting => {
|
||||
console.log(setting.key, component)
|
||||
if (component[setting.key]) {
|
||||
component[setting.key] = null
|
||||
}
|
||||
})
|
||||
|
||||
if (
|
||||
updatedSetting?.type === "dataSource" ||
|
||||
updatedSetting?.type === "table"
|
||||
|
|
|
@ -34,9 +34,10 @@
|
|||
}
|
||||
|
||||
$: datasource = getDatasourceForProvider($currentAsset, componentInstance)
|
||||
$: resourceId = datasource.resourceId || datasource.tableId
|
||||
|
||||
$: if (!isEqual(value, cachedValue)) {
|
||||
cachedValue = value
|
||||
$: if (!isEqual(value, cachedValue) || resourceId) {
|
||||
cachedValue = cloneDeep(value)
|
||||
schema = getSchema($currentAsset, datasource)
|
||||
}
|
||||
|
||||
|
|
|
@ -4745,7 +4745,8 @@
|
|||
"dependsOn": {
|
||||
"setting": "clickBehaviour",
|
||||
"value": "details"
|
||||
}
|
||||
},
|
||||
"resetOn": "dataSource"
|
||||
},
|
||||
{
|
||||
"label": "Save button",
|
||||
|
@ -5397,6 +5398,7 @@
|
|||
"type": "fieldConfiguration",
|
||||
"key": "fields",
|
||||
"nested": true,
|
||||
"resetOn": "dataSource",
|
||||
"selectAllFields": true
|
||||
},
|
||||
{
|
||||
|
|
|
@ -211,17 +211,19 @@
|
|||
{/if}
|
||||
</BlockComponent>
|
||||
{/if}
|
||||
<BlockComponent type="fieldgroup" props={{ labelPosition }} order={1}>
|
||||
{#each fields as field, idx}
|
||||
{#if getComponentForField(field) && field.active}
|
||||
<BlockComponent
|
||||
type={getComponentForField(field)}
|
||||
props={getPropsForField(field)}
|
||||
order={idx}
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
</BlockComponent>
|
||||
{#key fields}
|
||||
<BlockComponent type="fieldgroup" props={{ labelPosition }} order={1}>
|
||||
{#each fields as field, idx}
|
||||
{#if getComponentForField(field) && field.active}
|
||||
<BlockComponent
|
||||
type={getComponentForField(field)}
|
||||
props={getPropsForField(field)}
|
||||
order={idx}
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
</BlockComponent>
|
||||
{/key}
|
||||
</BlockComponent>
|
||||
</BlockComponent>
|
||||
{:else}
|
||||
|
|
Loading…
Reference in New Issue