Merge branch 'main' into next

This commit is contained in:
Zeke Zhang 2025-01-09 19:15:38 +08:00
commit 2ddaeb62a6
2 changed files with 15 additions and 3 deletions

View File

@ -51,7 +51,7 @@ export const FormItem: any = withDynamicSchemaProps(
const field = useField<Field>(); const field = useField<Field>();
const schema = useFieldSchema(); const schema = useFieldSchema();
const { addActiveFieldName } = useFormActiveFields() || {}; const { addActiveFieldName } = useFormActiveFields() || {};
const { wrapperStyle } = useDataFormItemProps(); const { wrapperStyle }: { wrapperStyle: any } = useDataFormItemProps();
useParseDefaultValue(); useParseDefaultValue();
useLazyLoadDisplayAssociationFieldsOfForm(); useLazyLoadDisplayAssociationFieldsOfForm();
@ -95,7 +95,15 @@ export const FormItem: any = withDynamicSchemaProps(
)} )}
> >
<ACLCollectionFieldProvider> <ACLCollectionFieldProvider>
<Item className={className} {...props} extra={extra} wrapperStyle={wrapperStyle} /> <Item
className={className}
{...props}
extra={extra}
wrapperStyle={{
...(wrapperStyle.backgroundColor ? { paddingLeft: '5px', paddingRight: '5px' } : {}),
...wrapperStyle,
}}
/>
</ACLCollectionFieldProvider> </ACLCollectionFieldProvider>
</BlockItem> </BlockItem>
</CollectionFieldProvider> </CollectionFieldProvider>

View File

@ -602,12 +602,16 @@ const InternalBodyCellComponent = React.memo<BodyCellComponentProps>((props) =>
const { record, schema, rowIndex, isSubTable, ...others } = props; const { record, schema, rowIndex, isSubTable, ...others } = props;
const styleRules = schema?.[LinkageRuleDataKeyMap['style']]; const styleRules = schema?.[LinkageRuleDataKeyMap['style']];
const [dynamicStyle, setDynamicStyle] = useState({}); const [dynamicStyle, setDynamicStyle] = useState({});
const isReadyPrettyMode =
!!schema?.properties && Object.values(schema.properties).some((item) => item['x-read-pretty'] === true);
const style = useMemo(() => ({ ...props.style, ...dynamicStyle }), [props.style, dynamicStyle]); const style = useMemo(() => ({ ...props.style, ...dynamicStyle }), [props.style, dynamicStyle]);
return ( return (
<> <>
{/* To improve rendering performance, do not render GetStyleRules component when no style rules are set */} {/* To improve rendering performance, do not render GetStyleRules component when no style rules are set */}
{!_.isEmpty(styleRules) && <GetStyleRules record={record} schema={schema} onStyleChange={setDynamicStyle} />} {!_.isEmpty(styleRules) && (
<GetStyleRules record={record} schema={schema} onStyleChange={isReadyPrettyMode ? setDynamicStyle : _.noop} />
)}
<td {...others} className={classNames(props.className, cellClass)} style={style}> <td {...others} className={classNames(props.className, cellClass)} style={style}>
{props.children} {props.children}
</td> </td>