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) {
 | 
			
		||||
  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}</>
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user