fix: ssue with configuring linkage rules in subform (popup) within subtable (#6803)

This commit is contained in:
Katherine 2025-04-30 09:35:26 +08:00 committed by GitHub
parent db88e8301f
commit fe005e091a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -28,6 +28,7 @@ import { isSubMode } from '../../../../schema-component/antd/association-field/u
import { useIsAssociationField } from '../../../../schema-component/antd/form-item';
import { FormLinkageRules } from '../../../../schema-settings/LinkageRules';
import { SchemaSettingsLinkageRules } from '../../../../schema-settings/SchemaSettings';
import { useColumnSchema } from '../../../../schema-component';
const fieldComponent: any = {
name: 'fieldComponent',
@ -312,7 +313,9 @@ 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();

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);
}