mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 20:27:49 +08:00
fix: can't set default value when turn on the form field required (#1887)
* fix: can't set default value when turn on the form field required * fix: can't set default value when turn on the association select field required
This commit is contained in:
parent
110b00bc01
commit
db349ccb68
@ -160,6 +160,8 @@ AssociationSelect.Designer = function Designer() {
|
||||
readOnlyMode = 'read-pretty';
|
||||
}
|
||||
|
||||
const fieldSchemaWithoutRequired = _.omit(fieldSchema,'required')
|
||||
|
||||
return (
|
||||
<GeneralSchemaDesigner>
|
||||
<GeneralSchemaItems />
|
||||
@ -299,10 +301,10 @@ AssociationSelect.Designer = function Designer() {
|
||||
title: t('Set default value'),
|
||||
properties: {
|
||||
default: {
|
||||
...(fieldSchema || {}),
|
||||
...(fieldSchemaWithoutRequired || {}),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component-props': {
|
||||
...fieldSchema['x-component-props'],
|
||||
...fieldSchemaWithoutRequired['x-component-props'],
|
||||
component: collectionField?.target ? 'AssociationSelect' : undefined,
|
||||
service: {
|
||||
resource: collectionField?.target,
|
||||
@ -812,7 +814,7 @@ AssociationSelect.FilterDesigner = function FilterDesigner() {
|
||||
title: t('Set default value'),
|
||||
properties: {
|
||||
default: {
|
||||
...collectionField?.uiSchema,
|
||||
..._.omit(collectionField?.uiSchema, 'required'),
|
||||
name: 'default',
|
||||
title: t('Default value'),
|
||||
'x-decorator': 'FormItem',
|
||||
|
@ -172,6 +172,8 @@ FormItem.Designer = function Designer() {
|
||||
};
|
||||
});
|
||||
|
||||
const fieldSchemaWithoutRequired = _.omit(fieldSchema,'required')
|
||||
|
||||
return (
|
||||
<GeneralSchemaDesigner>
|
||||
<GeneralSchemaItems />
|
||||
@ -352,7 +354,7 @@ FormItem.Designer = function Designer() {
|
||||
properties: {
|
||||
default: isInvariable(interfaceConfig)
|
||||
? {
|
||||
...(fieldSchema || {}),
|
||||
...(fieldSchemaWithoutRequired || {}),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component-props': {
|
||||
...fieldSchema['x-component-props'],
|
||||
@ -375,7 +377,7 @@ FormItem.Designer = function Designer() {
|
||||
'x-disabled': false,
|
||||
}
|
||||
: {
|
||||
...(fieldSchema || {}),
|
||||
...(fieldSchemaWithoutRequired || {}),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'VariableInput',
|
||||
'x-component-props': {
|
||||
@ -384,7 +386,7 @@ FormItem.Designer = function Designer() {
|
||||
schema: collectionField?.uiSchema,
|
||||
className: defaultInputStyle,
|
||||
renderSchemaComponent: function Com(props) {
|
||||
const s = _.cloneDeep(fieldSchema) || ({} as Schema);
|
||||
const s = _.cloneDeep(fieldSchemaWithoutRequired) || ({} as Schema);
|
||||
s.title = '';
|
||||
s['x-read-pretty'] = false;
|
||||
s['x-disabled'] = false;
|
||||
|
Loading…
Reference in New Issue
Block a user