Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 36 additions & 14 deletions src/form/components/Radio/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { RadioGroupProps, RadioProps } from 'antd';
import { Radio } from 'antd';
import React from 'react';
import FieldRadio from '../../../field/components/Radio';
import { ProConfigProvider } from '../../../provider';
import { runFunction } from '../../../utils';
import type {
ProFormFieldItemProps,
Expand Down Expand Up @@ -32,21 +34,41 @@ const RadioGroup: React.FC<ProFormRadioGroupProps> = React.forwardRef(
ref: any,
) => {
return (
<ProField
valueType={radioType === 'button' ? 'radioButton' : 'radio'}
ref={ref}
valueEnum={runFunction<[any]>(valueEnum, undefined)}
{...rest}
fieldProps={{
options,
layout,
...fieldProps,
<ProConfigProvider
valueTypeMap={{
radio: {
render: (text, props) => <FieldRadio {...props} text={text} />,
formItemRender: (text, props) => (
<FieldRadio {...props} text={text} />
),
},
radioButton: {
render: (text, props) => {
console.log(props);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

移除调试用的 console.log 语句。

生产代码中不应该包含调试用的 console.log 语句,这会在控制台产生不必要的输出。

-              console.log(props);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log(props);
🤖 Prompt for AI Agents
In src/form/components/Radio/index.tsx at line 47, remove the console.log(props)
statement as it is a debug log that should not be present in production code to
avoid unnecessary console output.

return <FieldRadio radioType={'button'} {...props} text={text} />;
},
formItemRender: (text, props) => (
<FieldRadio radioType={'button'} {...props} text={text} />
),
},
}}
proFieldProps={proFieldProps}
filedConfig={{
customLightMode: true,
}}
/>
>
<ProField
valueType={radioType === 'button' ? 'radioButton' : 'radio'}
ref={ref}
valueEnum={runFunction<[any]>(valueEnum, undefined)}
{...rest}
fieldProps={{
options,
layout,
...fieldProps,
}}
proFieldProps={proFieldProps}
filedConfig={{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

修复属性名称中的拼写错误。

filedConfig 应该是 fieldConfig,这是一个拼写错误。

-          filedConfig={{
+          fieldConfig={{
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
filedConfig={{
fieldConfig={{
🤖 Prompt for AI Agents
In src/form/components/Radio/index.tsx at line 67, there is a typo in the
property name 'filedConfig'. Rename it to 'fieldConfig' to correct the spelling
mistake.

customLightMode: true,
}}
/>
</ProConfigProvider>
);
},
);
Expand Down
Loading