ComboForm 初始值考虑 flat 的情况

This commit is contained in:
liaoxuezhi 2019-10-31 14:51:38 +08:00
parent 43be1f5529
commit 4f2d758a3b

View File

@ -277,8 +277,14 @@ export default class ComboControl extends React.Component<ComboProps> {
store.forms.forEach(item => item.items.forEach(item => item.unique && item.syncOptions()));
}
handleSingleFormChange(values: object) {
this.props.onChange({
...values
});
}
handleFormInit(index: number, values: any) {
const {syncDefaultValue, disabled} = this.props;
const {syncDefaultValue, disabled, flat, joinValues, delimiter} = this.props;
if (syncDefaultValue === false || disabled) {
return;
@ -286,20 +292,14 @@ export default class ComboControl extends React.Component<ComboProps> {
let value = this.getValueAsArray();
value.splice(index, 1, {
...value[index],
...values
});
value[index] = flat ? values.flat : {...values};
if (flat && joinValues) {
value = value.join(delimiter || ',');
}
this.props.onChange(value);
}
handleSingleFormChange(values: object) {
this.props.onChange({
...values
});
}
handleSingleFormInit(values: any) {
this.props.syncDefaultValue !== false &&
this.props.setPrinstineValue &&