修复 用法, visibleOn 不符合预期

This commit is contained in:
liaoxuezhi 2019-07-11 16:21:06 +08:00
parent 8633e1a973
commit 7816d3682f
2 changed files with 9 additions and 9 deletions

View File

@ -420,14 +420,6 @@ class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
delete schema.$ref;
path = path.replace(/(?!.*\/).*/, schema.type);
}
// value 会提前从 control 中获取到所有需要把control中的属性也补充完整
if (schema.control && schema.control.$ref) {
schema.control = {
...props.resolveDefinitions(schema.control.$ref),
...schema.control
}
delete schema.control.$ref;
}
this.renderer = rendererResolver(path, schema, props);
return schema;
}

View File

@ -778,7 +778,8 @@ export default class Form extends React.Component<FormProps, object> {
horizontal,
store,
disabled,
controlWidth
controlWidth,
resolveDefinitions
} = props;
const subProps = {
@ -806,6 +807,13 @@ export default class Form extends React.Component<FormProps, object> {
if (subSchema.control) {
let control = subSchema.control as Schema;
if (control.$ref) {
control = {
...resolveDefinitions(control.$ref),
...control
}
delete control.$ref;
}
control.hiddenOn && (subSchema.hiddenOn = control.hiddenOn);
control.visibleOn && (subSchema.visibleOn = control.visibleOn);
}