Make the field setting on fields optional, and use the component name as a fallback
This commit is contained in:
parent
26956f4f2e
commit
b4c2061ba9
|
@ -1141,10 +1141,11 @@ export const buildFormSchema = (component, asset) => {
|
||||||
const fieldSetting = settings.find(
|
const fieldSetting = settings.find(
|
||||||
setting => setting.key === "field" && setting.type.startsWith("field/")
|
setting => setting.key === "field" && setting.type.startsWith("field/")
|
||||||
)
|
)
|
||||||
if (fieldSetting && component.field) {
|
if (fieldSetting) {
|
||||||
const type = fieldSetting.type.split("field/")[1]
|
const type = fieldSetting.type.split("field/")[1]
|
||||||
if (type) {
|
const key = component.field || component._instanceName
|
||||||
schema[component.field] = { type }
|
if (type && key) {
|
||||||
|
schema[key] = { type }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
component._children?.forEach(child => {
|
component._children?.forEach(child => {
|
||||||
|
|
|
@ -3105,8 +3105,7 @@
|
||||||
{
|
{
|
||||||
"type": "field/string",
|
"type": "field/string",
|
||||||
"label": "Field",
|
"label": "Field",
|
||||||
"key": "field",
|
"key": "field"
|
||||||
"required": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -3524,8 +3523,7 @@
|
||||||
{
|
{
|
||||||
"type": "field/options",
|
"type": "field/options",
|
||||||
"label": "Field",
|
"label": "Field",
|
||||||
"key": "field",
|
"key": "field"
|
||||||
"required": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
$: formStep = formStepContext ? $formStepContext || 1 : 1
|
$: formStep = formStepContext ? $formStepContext || 1 : 1
|
||||||
$: formField = formApi?.registerField(
|
$: formField = formApi?.registerField(
|
||||||
field,
|
field || $component.name,
|
||||||
type,
|
type,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
disabled,
|
disabled,
|
||||||
|
|
Loading…
Reference in New Issue