fix: 处理table.column渲染mapping值是 tagSchema 不正常渲染的情况, 避免渲染tag时从 props.value 取值而无法渲染 label

This commit is contained in:
jinye 2023-06-01 15:52:34 +08:00
parent b901ea36fc
commit c75159b71c

View File

@ -266,22 +266,19 @@ 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('mapping-tag', label, {
// 避免渲染tag时从 props.value 取值而无法渲染 label
value: null
});
}
return render('tpl', label, {
data: createObject(data, {
value: realValue,
label: realValue
}),
...(label?.type === 'tag' ? {value: null} : {})
});
return render('tpl', label);
}
return render('mappingItemSchema', itemSchema, {
data: createObject(data, isObject(value) ? value : {item: value}),