mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 10:59:42 +08:00
fix: Form中嵌套容器后,容器中组件disabled失效问题 (#5473)
This commit is contained in:
parent
512a313fb1
commit
b7f79c6102
@ -218,7 +218,33 @@ order: 1
|
||||
"label": "禁用",
|
||||
"name": "text2",
|
||||
"disabled": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "grid",
|
||||
"columns": [
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"type": "input-text",
|
||||
"label": "姓名",
|
||||
"name": "name",
|
||||
"value": "amis",
|
||||
"disabled": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"body": [
|
||||
{
|
||||
"type": "input-email",
|
||||
"label": "邮箱",
|
||||
"name": "email",
|
||||
"disabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
```
|
||||
|
@ -16,7 +16,7 @@ import {ScopedContext} from './Scoped';
|
||||
import {Schema, SchemaNode} from './types';
|
||||
import {DebugWrapper} from './utils/debug';
|
||||
import getExprProperties from './utils/filter-schema';
|
||||
import {anyChanged, chainEvents, autobind, createObject} from './utils/helper';
|
||||
import {anyChanged, chainEvents, autobind} from './utils/helper';
|
||||
import {SimpleMap} from './utils/SimpleMap';
|
||||
|
||||
import {bindEvent, dispatchEvent, RendererEvent} from './utils/renderer-event';
|
||||
|
@ -1522,7 +1522,14 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
formLabelAlign: labelAlign !== 'left' ? 'right' : labelAlign,
|
||||
formLabelWidth: labelWidth,
|
||||
controlWidth,
|
||||
disabled: disabled || (control as Schema).disabled || form.loading,
|
||||
/**
|
||||
* form.loading有为true时才下发disabled属性,否则不显性设置disbaled为false
|
||||
* Form中包含容器类组件时,这些组件会将此处的disbaled继续下发至子组件,导致SchemaRenderer中props.disabled覆盖schema.disabled
|
||||
*/
|
||||
disabled:
|
||||
disabled ||
|
||||
(control as Schema).disabled ||
|
||||
(form.loading ? true : undefined),
|
||||
btnDisabled: disabled || form.loading || form.validating,
|
||||
onAction: this.handleAction,
|
||||
onQuery: this.handleQuery,
|
||||
|
@ -1,13 +1,7 @@
|
||||
import React from 'react';
|
||||
import {FormHorizontal, Renderer, RendererProps} from 'amis-core';
|
||||
import {Schema} from 'amis-core';
|
||||
import pick from 'lodash/pick';
|
||||
import {
|
||||
BaseSchema,
|
||||
SchemaClassName,
|
||||
SchemaCollection,
|
||||
SchemaObject
|
||||
} from '../Schema';
|
||||
import {BaseSchema, SchemaClassName, SchemaCollection} from '../Schema';
|
||||
|
||||
import {ucFirst} from 'amis-core';
|
||||
import {Spinner} from 'amis-ui';
|
||||
|
Loading…
Reference in New Issue
Block a user