fix: inherited fields not appear in field list and cannot override in… (#5800)

* fix: inherited fields not appear in field list and cannot override inherited field

* fix: bug
This commit is contained in:
Katherine 2024-12-06 18:24:44 +08:00 committed by GitHub
parent 9d82164105
commit 6874b06c7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View File

@ -104,11 +104,11 @@ export const OverridingCollectionField = (props) => {
return <OverridingFieldAction item={record} parentItem={parentRecordData} {...props} />;
};
const getIsOverriding = (currentFields, record) => {
const flag = currentFields.find((v) => {
const getIsOverriding = (currentCollection, currentFields, record) => {
const targetField = currentFields.find((v) => {
return v.name === record.name;
});
return flag;
return targetField.collectionName === currentCollection;
};
export const OverridingFieldAction = (props) => {
const { scope, getContainer, item: record, parentItem: parentRecord, children, currentCollection } = props;
@ -130,7 +130,8 @@ export const OverridingFieldAction = (props) => {
};
const [data, setData] = useState<any>({});
const currentFields = getCurrentCollectionFields(currentCollection);
const disabled = getIsOverriding(currentFields, record);
const disabled = getIsOverriding(currentCollection, currentFields, record);
const currentCollections = useMemo(() => {
return collections.map((v) => {
return {

View File

@ -155,11 +155,11 @@ export class InheritanceCollectionMixin extends Collection {
});
}
this.parentCollectionFields[parentCollectionName] = parentFields.filter((v) => {
return !filterFields.find((k) => {
const targetField = filterFields.find((k) => {
return k.name === v.name;
});
return targetField.collectionName !== this.name;
});
return this.parentCollectionFields[parentCollectionName];
}

View File

@ -121,6 +121,7 @@ export function useTableColumnInitializerFields() {
const isReadPretty = isSubTable ? form.readPretty : true;
return currentFields
.filter((v) => v.collectionName === name)
.filter((field) => field?.interface && field?.interface !== 'subTable' && !field?.treeChildren)
.map((field) => {
const interfaceConfig = getInterface(field.interface);