pro-components
pro-components copied to clipboard
🐛[BUG] Nested group's properties are saved as parent group's properties
Hello! sorry, I only speak english so I couldn't use bug template. Let me know if you need more info.
Example code:
Sandbox: https://codesandbox.io/s/schema-biao-dan-forked-l7b2hi?file=/App.tsx
import React from "react";
import type {
ProFormColumnsType
} from "@ant-design/pro-components";
import { BetaSchemaForm } from "@ant-design/pro-components";
const columns: ProFormColumnsType<any>[] = [
{
title: "Question",
dataIndex: "question",
},
{
title: "Answer Options",
dataIndex: "options",
valueType: "formList",
fieldProps: {
creatorButtonProps: {
creatorButtonText: "Add option"
}
},
columns: [
{
valueType: "group",
columns: [
{
title: "Type",
dataIndex: "type",
valueType: "select",
valueEnum: {
choice: { text: "Single choice" }
}
},
{
dataIndex: "properties",
valueType: "group",
columns: [
{
title: "Option text",
dataIndex: "label",
valueType: "text"
}
]
}
]
}
]
}
];
export default () => {
return (
<BetaSchemaForm<any>
layoutType="Form"
onFinish={async (values) => {
console.log(values);
}}
columns={columns as any}
/>
);
};
Expected data structure:
{
"question": "Is sun hot?",
"options": [
{
"type": "choice",
"properties": {
"label": "Yes"
}
},
{
"type": "choice",
"properties": {
"label": "No"
}
}
]
}
Actual data structure:
{
"question": "Is sun hot?",
"options": [
{
"type": "choice",
"label": "Yes"
},
{
"type": "choice",
"label": "No"
}
]
}
Dependencies:
