mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:36:44 +00:00
fix: fix default value of optional field (#2053)
* fix: fix default value of optional field * fix: fix can not save default value
This commit is contained in:
parent
c89d7f980f
commit
74b8687071
@ -112,6 +112,10 @@ FormItem.Designer = function Designer() {
|
||||
const IsShowMultipleSwitch = useIsShowMultipleSwitch();
|
||||
|
||||
const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
|
||||
const targetField = getCollectionJoinField(
|
||||
`${collectionField?.target}.${fieldSchema['x-component-props'].fieldNames?.label}`,
|
||||
);
|
||||
|
||||
const targetCollection = getCollection(collectionField?.target);
|
||||
const interfaceConfig = getInterface(collectionField?.interface);
|
||||
const validateSchema = interfaceConfig?.['validateSchema']?.(fieldSchema);
|
||||
@ -353,6 +357,7 @@ FormItem.Designer = function Designer() {
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component-props': {
|
||||
...fieldSchema['x-component-props'],
|
||||
targetField,
|
||||
component:
|
||||
collectionField?.target && collectionField?.interface !== 'chinaRegion'
|
||||
? 'AssociationSelect'
|
||||
@ -377,6 +382,7 @@ FormItem.Designer = function Designer() {
|
||||
'x-component': 'VariableInput',
|
||||
'x-component-props': {
|
||||
...(fieldSchema?.['x-component-props'] || {}),
|
||||
targetField,
|
||||
collectionName: collectionField?.collectionName,
|
||||
schema: collectionField?.uiSchema,
|
||||
className: defaultInputStyle,
|
||||
|
Loading…
Reference in New Issue
Block a user