Merge pull request #7058 from CheshireJCat/fix-table-column-mapping-render-tag-bug

fix: 处理table.column渲染mapping值是 tagSchema 不正常渲染的情况, 避免渲染tag时从 props.va…
This commit is contained in:
hsm-lv 2023-06-01 16:44:05 +08:00 committed by GitHub
commit b477a6d122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,23 +266,20 @@ export const MappingField = withStore(props =>
label = value[labelField || 'label'];
}
}
let realValue = value;
// 处理 table column 渲染 mapping 的值是 tagSchema 不正常渲染的情况
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
}),
...(label?.type === 'tag' ? {value: null} : {})
return render('mapping-tag', label, {
// 避免渲染tag时从 props.value 取值而无法渲染 label
value: null
});
}
return render('tpl', label);
}
return render('mappingItemSchema', itemSchema, {
data: createObject(data, isObject(value) ? value : {item: value}),
...((itemSchema as any)?.type === 'tag' ? {value: null} : {})