mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix: linkage rules compatibility with legacy data (#6686)
* fix: linkage rules compatibility with legacy data * fix: bug
This commit is contained in:
parent
78fefe197b
commit
38f8cf9d56
@ -20,6 +20,7 @@ import { SubFormProvider } from '../../schema-component/antd/association-field/h
|
|||||||
import { DynamicComponentProps } from '../../schema-component/antd/filter/DynamicComponent';
|
import { DynamicComponentProps } from '../../schema-component/antd/filter/DynamicComponent';
|
||||||
import { FilterContext } from '../../schema-component/antd/filter/context';
|
import { FilterContext } from '../../schema-component/antd/filter/context';
|
||||||
import { VariableInput, getShouldChange } from '../VariableInput/VariableInput';
|
import { VariableInput, getShouldChange } from '../VariableInput/VariableInput';
|
||||||
|
import { useCurrentFormContext } from '../VariableInput/hooks/useFormVariable';
|
||||||
import { LinkageRuleActionGroup } from './LinkageRuleActionGroup';
|
import { LinkageRuleActionGroup } from './LinkageRuleActionGroup';
|
||||||
import { EnableLinkage } from './components/EnableLinkage';
|
import { EnableLinkage } from './components/EnableLinkage';
|
||||||
import { ArrayCollapse } from './components/LinkageHeader';
|
import { ArrayCollapse } from './components/LinkageHeader';
|
||||||
@ -95,6 +96,7 @@ export const FormLinkageRules = withDynamicSchemaProps(
|
|||||||
const { name } = useCollection_deprecated();
|
const { name } = useCollection_deprecated();
|
||||||
const { getAllCollectionsInheritChain } = useCollectionManager_deprecated();
|
const { getAllCollectionsInheritChain } = useCollectionManager_deprecated();
|
||||||
const parentRecordData = useCollectionParentRecordData();
|
const parentRecordData = useCollectionParentRecordData();
|
||||||
|
const { shouldDisplayCurrentForm } = useCurrentFormContext();
|
||||||
const variableKey = getActiveContextName(localVariables);
|
const variableKey = getActiveContextName(localVariables);
|
||||||
const components = useMemo(() => ({ ArrayCollapse }), []);
|
const components = useMemo(() => ({ ArrayCollapse }), []);
|
||||||
const schema = useMemo(
|
const schema = useMemo(
|
||||||
@ -103,7 +105,7 @@ export const FormLinkageRules = withDynamicSchemaProps(
|
|||||||
properties: {
|
properties: {
|
||||||
rules: {
|
rules: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
default: transformDefaultValue(defaultValues, variableKey),
|
default: transformDefaultValue(defaultValues, shouldDisplayCurrentForm ? variableKey : '$nRecord'),
|
||||||
'x-component': 'ArrayCollapse',
|
'x-component': 'ArrayCollapse',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user