fix: text field output up to 20 characters in the table

This commit is contained in:
chenos 2021-01-02 09:23:02 +08:00
parent 2689e070f1
commit 34895d3843

View File

@ -31,13 +31,20 @@ function getFieldComponent(type) {
}
export function StringField(props: any) {
const { value } = props;
const { value, viewType } = props;
if (!value) {
return null;
}
if (typeof value === 'object') {
return JSON.stringify(value);
}
if (viewType === 'table' && value.length > 20) {
return (
<Popover content={<div onClick={(e) => {
e.stopPropagation();
}} style={{maxWidth: 300}}>{value}</div>}>{value.substring(0, 15)}...</Popover>
);
}
return (
<>{value}</>
);