refactor: target key (#6000)

This commit is contained in:
Katherine 2025-01-06 21:11:09 +08:00 committed by GitHub
parent 91a998fff8
commit 648e282d48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 12 deletions

View File

@ -171,10 +171,10 @@ export const TargetKey = observer(
setOptions( setOptions(
getCollection(target) getCollection(target)
.fields?.filter((v) => { .fields?.filter((v) => {
if (type !== 'hasMany') { if (v.primaryKey || v.unique) {
return v.primaryKey || v.unique; return true;
} }
return supportTypes.includes(v.type); return type === 'hasMany' && supportTypes.includes(v.type);
}) })
.map((k) => { .map((k) => {
return { return {
@ -196,10 +196,10 @@ export const TargetKey = observer(
setOptions( setOptions(
getCollection(target) getCollection(target)
.fields?.filter((v) => { .fields?.filter((v) => {
if (type !== 'hasMany') { if (v.primaryKey || v.unique) {
return v.primaryKey || v.unique; return true;
} }
return supportTypes.includes(v.type); return type === 'hasMany' && supportTypes.includes(v.type);
}) })
.map((k) => { .map((k) => {
return { return {

View File

@ -161,10 +161,10 @@ export const TargetKey = observer(
setOptions( setOptions(
getCollection(target, dataSourceKey) getCollection(target, dataSourceKey)
.fields?.filter((v) => { .fields?.filter((v) => {
if (type !== 'hasMany') { if (v.primaryKey || v.unique) {
return v.primaryKey || v.unique; return true;
} }
return supportTypes.includes(v.type); return type === 'hasMany' && supportTypes.includes(v.type);
}) })
.map((k) => { .map((k) => {
return { return {
@ -196,10 +196,10 @@ export const TargetKey = observer(
setOptions( setOptions(
data.data data.data
?.filter((v) => { ?.filter((v) => {
if (type !== 'hasMany') { if (v.primaryKey || v.unique) {
return v.primaryKey || v.unique; return true;
} }
return supportTypes.includes(v.type); return type === 'hasMany' && supportTypes.includes(v.type);
}) })
.map((k) => { .map((k) => {
return { return {