Skip to content

Commit

Permalink
fix(antd): use Select fieldNames (#3275)
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyunwan authored Jul 15, 2022
1 parent 88df0da commit edf7a9f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/antd/src/preview-text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ const Select: React.FC<React.PropsWithChildren<SelectProps<any>>> = observer(
}

const getLabel = (target: any) => {
const labelKey = props.fieldNames?.label || 'label'
return (
dataSource?.find((item) => item.value == target?.value)?.label ||
dataSource?.find((item) => {
const valueKey = props.fieldNames?.value || 'value'
return item[valueKey] == target?.value
})?.[labelKey] ||
target.label ||
placeholder
)
Expand Down

0 comments on commit edf7a9f

Please sign in to comment.