mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
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:
parent
9d82164105
commit
6874b06c7e
@ -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 {
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user