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