diff --git a/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx b/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx
index 2aad77835..3e781f987 100644
--- a/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx
+++ b/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx
@@ -353,73 +353,47 @@ FormItem.Designer = function Designer() {
type: 'object',
title: t('Set default value'),
properties: {
- default:
- // isInvariable(interfaceConfig)
- // ? {
- // ...(fieldSchemaWithoutRequired || {}),
- // 'x-decorator': 'FormItem',
- // 'x-component-props': {
- // ...fieldSchema['x-component-props'],
- // targetField,
- // component:
- // collectionField?.target && collectionField?.interface !== 'chinaRegion'
- // ? 'AssociationSelect'
- // : undefined,
- // service: {
- // resource: collectionField?.target,
- // },
- // style: {
- // width: '100%',
- // verticalAlign: 'top',
- // },
- // },
- // name: 'default',
- // title: t('Default value'),
- // default: getFieldDefaultValue(fieldSchema, collectionField),
- // 'x-read-pretty': false,
- // 'x-disabled': false,
- // }
- // :
- {
- ...(fieldSchemaWithoutRequired || {}),
- 'x-decorator': 'FormItem',
- 'x-component': 'VariableInput',
- 'x-component-props': {
- ...(fieldSchema?.['x-component-props'] || {}),
- collectionField,
- targetField,
- collectionName: collectionField?.collectionName,
- schema: collectionField?.uiSchema,
- className: defaultInputStyle,
- renderSchemaComponent: function Com(props) {
- const s = _.cloneDeep(fieldSchemaWithoutRequired) || ({} as Schema);
- s.title = '';
- s['x-read-pretty'] = false;
- s['x-disabled'] = false;
+ default: {
+ ...(fieldSchemaWithoutRequired || {}),
+ 'x-decorator': 'FormItem',
+ 'x-component': 'VariableInput',
+ 'x-component-props': {
+ ...(fieldSchema?.['x-component-props'] || {}),
+ collectionField,
+ targetField,
+ collectionName: collectionField?.collectionName,
+ schema: collectionField?.uiSchema,
+ className: defaultInputStyle,
+ renderSchemaComponent: function Com(props) {
+ const s = _.cloneDeep(fieldSchemaWithoutRequired) || ({} as Schema);
- return (
-
- );
- },
+ },
+ }}
+ />
+ );
},
- name: 'default',
- title: t('Default value'),
- default: getFieldDefaultValue(fieldSchema, collectionField),
},
+ name: 'default',
+ title: t('Default value'),
+ default: getFieldDefaultValue(fieldSchema, collectionField),
+ },
},
} as ISchema
}
diff --git a/packages/core/client/src/schema-component/antd/remote-select/RemoteSelect.tsx b/packages/core/client/src/schema-component/antd/remote-select/RemoteSelect.tsx
index b32e96506..84257c122 100644
--- a/packages/core/client/src/schema-component/antd/remote-select/RemoteSelect.tsx
+++ b/packages/core/client/src/schema-component/antd/remote-select/RemoteSelect.tsx
@@ -35,6 +35,7 @@ const InternalRemoteSelect = connect(
service = {},
wait = 300,
value,
+ defaultValue,
objectValue,
manual = true,
mapOptions,
@@ -249,12 +250,13 @@ const InternalRemoteSelect = connect(
};
const options = useMemo(() => {
+ const v = value || defaultValue;
if (!data?.data?.length) {
- return value != null ? (Array.isArray(value) ? value : [value]) : [];
+ return v != null ? (Array.isArray(v) ? v : [v]) : [];
}
- const valueOptions = (value != null && (Array.isArray(value) ? value : [value])) || [];
+ const valueOptions = (v != null && (Array.isArray(v) ? v : [v])) || [];
return uniqBy(data?.data?.concat(valueOptions) || [], fieldNames.value);
- }, [data?.data, value]);
+ }, [value, defaultValue, data?.data, fieldNames.value]);
const onDropdownVisibleChange = (visible) => {
setOpen(visible);
@@ -264,6 +266,7 @@ const InternalRemoteSelect = connect(
}
firstRun.current = true;
};
+
return (