pro-components
pro-components copied to clipboard
👑 [需求] schemaform 中组件 group 中的gutter 属性是写死的,不能只定义
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
🔩 所属模块或组件
BetaSchemaForm -> group (packages/form/src/components/Group/index.tsx)
🥰 需求描述
// packages/form/src/components/Group/index.tsx:98
const [childrenDoms, hiddenDoms] = useMemo(() => {
const hiddenChildren: React.ReactNode[] = [];
const childrenList = React.Children.toArray(children).map(
(element, index) => {
if (React.isValidElement(element) && element?.props?.hidden) {
hiddenChildren.push(element);
return null;
}
if (index === 0 && React.isValidElement(element) && autoFocus) {
return React.cloneElement(element, {
...(element.props as any),
autoFocus,
});
}
return element;
},
);
return [
<RowWrapper key="children" Wrapper={Wrapper}>
{childrenList}
</RowWrapper>,
hiddenChildren.length > 0 ? (
<div
style={{
display: 'none',
}}
>
{hiddenChildren}
</div>
) : null,
];
}, [children, RowWrapper, Wrapper, autoFocus]);
<RowWrapper key="children" Wrapper={Wrapper}>
这里没有提供自定义 props 传入,导致不能修改row相关属性