Merge branch 'refactor/association-field' of github.com:nocobase/nocobase into refactor/association-field

This commit is contained in:
katherinehhh 2023-05-11 09:30:20 +08:00
commit 5369d337b2

View File

@ -30,9 +30,10 @@ const toArr = (v) => {
};
export const getLabelFormatValue = (labelUiSchema: ISchema, value: any, isTag = false): any => {
if (Array.isArray(labelUiSchema?.enum) && value) {
const options = labelUiSchema?.enum;
if (Array.isArray(options) && value) {
const values = toArr(value).map((val) => {
const opt: any = labelUiSchema.enum.find((option: any) => option.value === val);
const opt: any = options.find((option: any) => option.value === val);
if (isTag) {
return React.createElement(Tag, { color: opt?.color }, opt?.label);
}