combo 数据格式调整

This commit is contained in:
liaoxuezhi 2019-08-12 15:34:49 +08:00
parent 5d2d5094ce
commit e8ee62152a
2 changed files with 8 additions and 4 deletions

View File

@ -15,7 +15,8 @@ import {
guid,
anyChanged,
isObject,
createObject} from '../../utils/helper';
createObject,
extendObject} from '../../utils/helper';
import Sortable = require('sortablejs');
import { evalExpression, filter } from '../../utils/tpl';
import find = require('lodash/find');
@ -423,7 +424,7 @@ export default class ComboControl extends React.Component<ComboProps> {
}
value = value || this.defaultValue;
return createObject(createObject(data, {index, __index: index}), value);
return createObject(extendObject(data, {index, __index: index, ...data}), value);
}
pickCondition(value:any):Condition {
@ -713,7 +714,8 @@ export default class ComboControl extends React.Component<ComboProps> {
@FormItem({
type: 'combo',
storeType: ComboStore.name
storeType: ComboStore.name,
extendsData: false
})
export class ComboControlRenderer extends ComboControl {};

View File

@ -42,6 +42,7 @@ export interface FormItemBasicConfig extends Partial<RendererConfig> {
storeExtendsData?: boolean;
sizeMutable?: boolean;
weight?: number;
extendsData?: boolean;
// 兼容老用法,新用法直接在 Component 里面定义 validate 方法即可。
validate?: (values: any, value: any) => string | boolean;
@ -528,7 +529,8 @@ export function registerFormItem(config: FormItemConfig): RendererConfig {
if (config.storeType) {
Control = HocStoreFactory({
storeType: config.storeType
storeType: config.storeType,
extendsData: config.extendsData
})(Control);
delete config.storeType;
}