fix: 修改table中的mapping使用tag的时候展示不符合预期的bug (#6395)

Co-authored-by: jinye <jinye@baidu.com>
This commit is contained in:
lmaomaoz 2023-03-28 15:52:08 +08:00 committed by GitHub
parent e07c5562c0
commit dfb6587b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,11 +262,27 @@ export const MappingField = withStore(props =>
label = value[labelField || 'label'];
}
}
return render('tpl', label);
let realValue = value;
if (
isObject(label)
&& label.type === 'tag'
&& !isObject(label.label)
&& label.label != null
) {
realValue = label.label;
}
return render('tpl', label, {
data: createObject(data, {
value: realValue,
label: realValue
}),
value: null
});
}
return render('mappingItemSchema', itemSchema, {
data: createObject(data, isObject(value) ? value : {item: value})
data: createObject(data, isObject(value) ? value : {item: value}),
// 阻止 itemSchema 从props.value 取值,否则渲染不正确
value: null
});
}