fix: field linkage rules not working for subform (popup) in subtable (#6800)

This commit is contained in:
Katherine 2025-04-28 22:33:38 +08:00 committed by GitHub
parent 973038a2e9
commit bd077d5cc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View File

@ -29,6 +29,7 @@ import { useIsAssociationField } from '../../../../schema-component/antd/form-it
import { FormLinkageRules } from '../../../../schema-settings/LinkageRules';
import { SchemaSettingsLinkageRules } from '../../../../schema-settings/SchemaSettings';
import { SchemaSettingsItemType } from '../../../../application';
import { useColumnSchema } from '../../../../schema-component';
const enabledIndexColumn: SchemaSettingsItemType = {
name: 'enableIndexColumn',
@ -338,11 +339,12 @@ export const linkageRules = {
Component: SchemaSettingsLinkageRules,
useComponentProps() {
const field = useField();
const fieldSchema = useFieldSchema();
const schema = useFieldSchema();
const { fieldSchema: columnSchema } = useColumnSchema();
const fieldSchema = columnSchema || schema;
const cm = useCollectionManager();
const collectionField = cm.getCollectionField(fieldSchema['x-collection-field']);
const { rerenderDataBlock } = useRerenderDataBlock();
return {
collectionName: collectionField?.target,
Component: LinkageRulesComponent,

View File

@ -218,7 +218,6 @@ export const SubTable: any = observer(
},
};
};
console.log(props);
return (
<div className={subTableContainer}>
<FlagProvider isInSubTable>

View File

@ -104,6 +104,7 @@ function getLinkageRules(fieldSchema) {
if (!fieldSchema) {
return;
}
const result = fieldSchema['x-linkage-rules'] || fieldSchema?.parent?.['x-linkage-rules'] || [];
return fieldSchema['x-linkage-rules']?.filter((k) => !k.disabled);
return result?.filter((k) => !k.disabled);
}