mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 10:17:00 +00:00
fix: text field output up to 20 characters in the table
This commit is contained in:
parent
2689e070f1
commit
34895d3843
@ -31,13 +31,20 @@ function getFieldComponent(type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function StringField(props: any) {
|
export function StringField(props: any) {
|
||||||
const { value } = props;
|
const { value, viewType } = props;
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (typeof value === 'object') {
|
if (typeof value === 'object') {
|
||||||
return JSON.stringify(value);
|
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 (
|
return (
|
||||||
<>{value}</>
|
<>{value}</>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user