修复 requiredOn 在 group 中的问题

This commit is contained in:
2betop 2020-03-02 14:18:59 +08:00
parent ae4ac50397
commit 5e15dee775

View File

@ -8,6 +8,7 @@ import {
} from '../../utils/helper'; } from '../../utils/helper';
import cx from 'classnames'; import cx from 'classnames';
import {FormItemWrap} from './Item'; import {FormItemWrap} from './Item';
import getExprProperties from '../../utils/filter-schema';
export interface InputGroupProps extends RendererProps { export interface InputGroupProps extends RendererProps {
formMode?: string; formMode?: string;
@ -27,7 +28,7 @@ export class ControlGroupRenderer extends React.Component<InputGroupProps> {
} }
renderControl(control: any, index: any, otherProps?: any) { renderControl(control: any, index: any, otherProps?: any) {
const {render, disabled} = this.props; const {render, disabled, data} = this.props;
if (!control) { if (!control) {
return null; return null;
@ -43,6 +44,12 @@ export class ControlGroupRenderer extends React.Component<InputGroupProps> {
if (subSchema.control) { if (subSchema.control) {
let control = subSchema.control as Schema; let control = subSchema.control as Schema;
control = subSchema.control = {
...control,
...getExprProperties(control, data)
};
control.hiddenOn && (subSchema.hiddenOn = control.hiddenOn); control.hiddenOn && (subSchema.hiddenOn = control.hiddenOn);
control.visibleOn && (subSchema.visibleOn = control.visibleOn); control.visibleOn && (subSchema.visibleOn = control.visibleOn);
} }