From f229f9f0f94d77a694347b2e5deb195c8dc8fe14 Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Tue, 31 Dec 2024 10:40:01 +0800 Subject: [PATCH] feat(m2m-array): supports using "Table selected records" variable in m2m array fields (#5974) --- .../client/src/schema-settings/SchemaSettingsDefaultValue.tsx | 1 + .../VariableInput/hooks/useContextAssociationFields.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-settings/SchemaSettingsDefaultValue.tsx b/packages/core/client/src/schema-settings/SchemaSettingsDefaultValue.tsx index 75e7fae168..1cbe557597 100644 --- a/packages/core/client/src/schema-settings/SchemaSettingsDefaultValue.tsx +++ b/packages/core/client/src/schema-settings/SchemaSettingsDefaultValue.tsx @@ -85,6 +85,7 @@ export const SchemaSettingsDefaultValue = function DefaultValueConfigure(props: const tableCtx = useTableBlockContext(); const isAllowContextVariable = collectionField?.interface === 'm2m' || + collectionField?.interface === 'mbm' || (parentCollectionField?.type === 'hasMany' && collectionField?.interface === 'm2o'); const returnScope = useCallback( diff --git a/packages/core/client/src/schema-settings/VariableInput/hooks/useContextAssociationFields.tsx b/packages/core/client/src/schema-settings/VariableInput/hooks/useContextAssociationFields.tsx index a1293a68e6..7ea69f241b 100644 --- a/packages/core/client/src/schema-settings/VariableInput/hooks/useContextAssociationFields.tsx +++ b/packages/core/client/src/schema-settings/VariableInput/hooks/useContextAssociationFields.tsx @@ -101,7 +101,9 @@ export const useContextAssociationFields = ({ const children = getChildren( getFilterOptions(collectionName).filter((v) => { - const isAssociationField = ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(v.type); + const isAssociationField = ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany', 'belongsToArray'].includes( + v.type, + ); return isAssociationField; }), {