修复 combo 单选模式syncFields 无效问题

This commit is contained in:
2betop 2020-03-17 17:21:10 +08:00
parent e712e79e36
commit 3718800a86

View File

@ -569,7 +569,7 @@ export default class ComboControl extends React.Component<ComboProps> {
Array.isArray(syncFields) ? JSON.stringify([value, index, data, pickVars(data, syncFields)]): strictMode ? JSON.stringify([value, index]) : JSON.stringify([value, index, data])
);
formatValue(value: any, index: number) {
formatValue(value: any, index: number = -1) {
const {flat, data, strictMode, syncFields} = this.props;
if (flat) {
@ -1065,7 +1065,7 @@ export default class ComboControl extends React.Component<ComboProps> {
} = this.props;
let controls = this.props.controls;
const data = isObject(value) ? value : this.defaultValue;
const data = isObject(value) ? this.formatValue(value) : this.defaultValue;
let condition: Condition | null = null;
if (Array.isArray(conditions) && conditions.length) {
@ -1112,7 +1112,7 @@ export default class ComboControl extends React.Component<ComboProps> {
},
{
disabled: disabled,
data: isObject(value) ? value : this.defaultValue,
data: data,
onChange: this.handleSingleFormChange,
ref: this.makeFormRef(0),
onInit: this.handleSingleFormInit,