fix: collectionField undefined (#2320)
This commit is contained in:
parent
07ff868133
commit
673ea808b0
packages/core/client/src
@ -69,7 +69,7 @@ export const FormItem: any = observer(
|
|||||||
} else if (
|
} else if (
|
||||||
isVariable(schema?.default) &&
|
isVariable(schema?.default) &&
|
||||||
schema?.default?.includes('$context') &&
|
schema?.default?.includes('$context') &&
|
||||||
collectionField.interface === 'm2m'
|
collectionField?.interface === 'm2m'
|
||||||
) {
|
) {
|
||||||
// 直接对多
|
// 直接对多
|
||||||
const contextData = parseVariables('{{$context}}', variablesCtx);
|
const contextData = parseVariables('{{$context}}', variablesCtx);
|
||||||
@ -212,7 +212,7 @@ FormItem.Designer = function Designer() {
|
|||||||
const isPickerMode = fieldSchema['x-component-props']?.mode === 'Picker';
|
const isPickerMode = fieldSchema['x-component-props']?.mode === 'Picker';
|
||||||
const showFieldMode = isAssociationField && fieldModeOptions && !isTableField;
|
const showFieldMode = isAssociationField && fieldModeOptions && !isTableField;
|
||||||
const showModeSelect = showFieldMode && isPickerMode;
|
const showModeSelect = showFieldMode && isPickerMode;
|
||||||
const isDateField = ['datetime', 'createdAt', 'updatedAt'].includes(collectionField.interface);
|
const isDateField = ['datetime', 'createdAt', 'updatedAt'].includes(collectionField?.interface);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GeneralSchemaDesigner>
|
<GeneralSchemaDesigner>
|
||||||
|
@ -1462,12 +1462,12 @@ SchemaSettings.DefaultValue = function DefaultvalueConfigure(props) {
|
|||||||
`${collectionField.target}.${fieldSchema['x-component-props']?.fieldNames?.label || 'id'}`,
|
`${collectionField.target}.${fieldSchema['x-component-props']?.fieldNames?.label || 'id'}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const parentFieldSchema = collectionField.interface === 'm2o' && findParentFieldSchema(fieldSchema);
|
const parentFieldSchema = collectionField?.interface === 'm2o' && findParentFieldSchema(fieldSchema);
|
||||||
const parentCollectionField = parentFieldSchema && getCollectionJoinField(parentFieldSchema?.['x-collection-field']);
|
const parentCollectionField = parentFieldSchema && getCollectionJoinField(parentFieldSchema?.['x-collection-field']);
|
||||||
const tableCtx = useTableBlockContext();
|
const tableCtx = useTableBlockContext();
|
||||||
const isAllowContexVariable =
|
const isAllowContexVariable =
|
||||||
collectionField.interface === 'm2m' ||
|
collectionField?.interface === 'm2m' ||
|
||||||
(parentCollectionField?.type === 'hasMany' && collectionField.interface === 'm2o');
|
(parentCollectionField?.type === 'hasMany' && collectionField?.interface === 'm2o');
|
||||||
return (
|
return (
|
||||||
<SchemaSettings.ModalItem
|
<SchemaSettings.ModalItem
|
||||||
title={t('Set default value')}
|
title={t('Set default value')}
|
||||||
|
Loading…
Reference in New Issue
Block a user