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(
|
||||
setting => setting.key === "field" && setting.type.startsWith("field/")
|
||||
)
|
||||
if (fieldSetting && component.field) {
|
||||
if (fieldSetting) {
|
||||
const type = fieldSetting.type.split("field/")[1]
|
||||
if (type) {
|
||||
schema[component.field] = { type }
|
||||
const key = component.field || component._instanceName
|
||||
if (type && key) {
|
||||
schema[key] = { type }
|
||||
}
|
||||
}
|
||||
component._children?.forEach(child => {
|
||||
|
|
|
@ -3105,8 +3105,7 @@
|
|||
{
|
||||
"type": "field/string",
|
||||
"label": "Field",
|
||||
"key": "field",
|
||||
"required": true
|
||||
"key": "field"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
|
@ -3524,8 +3523,7 @@
|
|||
{
|
||||
"type": "field/options",
|
||||
"label": "Field",
|
||||
"key": "field",
|
||||
"required": true
|
||||
"key": "field"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
$: formStep = formStepContext ? $formStepContext || 1 : 1
|
||||
$: formField = formApi?.registerField(
|
||||
field,
|
||||
field || $component.name,
|
||||
type,
|
||||
defaultValue,
|
||||
disabled,
|
||||
|
|
Loading…
Reference in New Issue