This commit is contained in:
katherinehhh 2025-06-26 15:38:00 +08:00
parent f9be668b49
commit ccc981b98e

View File

@ -17,7 +17,7 @@ import { TreeNode } from '../TreeLabel';
// 过滤掉系统字段
export const systemKeys = [
// 'id',
// 'sort',
'sort',
'createdById',
'createdBy',
'createdAt',
@ -61,7 +61,7 @@ export const useCollectionState = (currentCollectionName: string, displayType =
if (!field.interface) {
return;
}
if (['password', 'sequence'].includes(field.type)) {
if (depth === 0 && ['sort', 'password', 'sequence'].includes(field.type)) {
return;
}
if (filterFields && filterFields(field)) {
@ -97,7 +97,7 @@ export const useCollectionState = (currentCollectionName: string, displayType =
depth: depth + 1,
maxDepth,
prefix: option.key,
exclude: ['id', ...systemKeys],
exclude: ['id', ...systemKeys.filter((v) => v !== 'sort')],
});
}
return option;
@ -290,7 +290,7 @@ function loadChildren({ node, traverseAssociations, traverseFields, systemKeys,
});
} else if (['hasOne', 'hasMany'].includes(node.field.type) || node?.type === 'duplicate') {
children = traverseFields(node.field.target, {
exclude: ['id', ...systemKeys],
exclude: ['id', ...systemKeys.filter((v) => v !== 'sort')],
prefix: node.key,
maxDepth: 1,
});