feat: 合并代码后 系统设置 ui样式优化、bug修复、全局统一图标对齐等
This commit is contained in:
@@ -188,7 +188,11 @@ function labelProps(label) {
|
||||
typeof label === 'object' &&
|
||||
!React.isValidElement(label) &&
|
||||
'text' in label
|
||||
? { label: label.text, required: label.required, htmlFor: label.name }
|
||||
? {
|
||||
label: label.text,
|
||||
required: label.required,
|
||||
...(label.name ? { htmlFor: label.name } : {}),
|
||||
}
|
||||
: { label };
|
||||
}
|
||||
|
||||
@@ -273,16 +277,27 @@ export function withField(
|
||||
if (error) throw new Error(String(error));
|
||||
},
|
||||
});
|
||||
const fieldLabel = labelProps(label);
|
||||
const control =
|
||||
field === undefined && props.children && Component === Controls.Input ? (
|
||||
props.children
|
||||
) : (
|
||||
<Component {...props} ref={ref} style={style} />
|
||||
<Component
|
||||
{...props}
|
||||
id={props.id ?? fieldLabel.htmlFor}
|
||||
ref={ref}
|
||||
style={style}
|
||||
/>
|
||||
);
|
||||
// Unnamed slots remain controlled by the page; named fields use Ant Form's store.
|
||||
return (
|
||||
<AntForm.Item
|
||||
{...(noLabel ? {} : labelProps(label))}
|
||||
{...(noLabel
|
||||
? {}
|
||||
: {
|
||||
...fieldLabel,
|
||||
...(control?.props?.id ? { htmlFor: control.props.id } : {}),
|
||||
})}
|
||||
name={field === undefined ? undefined : fieldPath(field)}
|
||||
initialValue={initValue}
|
||||
rules={normalizedRules}
|
||||
|
||||
Reference in New Issue
Block a user