mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
add quotes around strings
This commit is contained in:
parent
b66a0316e6
commit
aadfc63bf0
1 changed files with 28 additions and 14 deletions
|
|
@ -70,6 +70,32 @@ export const DataTable: FC<TableProps> = ({
|
|||
}
|
||||
};
|
||||
|
||||
const formatTableCell = (row: any, col: any) => {
|
||||
if (typeof row[col.name] === 'object') {
|
||||
return (
|
||||
<pre className={css.preFormat}>
|
||||
{JSON.stringify(row[col.name], null, 2)}
|
||||
</pre> )
|
||||
} else if (row[col.name] !== undefined) {
|
||||
if (col.datatype === '[]string') {
|
||||
return (
|
||||
<span>
|
||||
{'"' + (row[col.name]) + '"'}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<span>
|
||||
{col.datatype === 'timestamp' && row[col.name]
|
||||
? moment
|
||||
.utc(row[col.name])
|
||||
.format('MM/DD/YYYY hh:mm:ss a')
|
||||
: row[col.name].toLocaleString()}
|
||||
</span> )
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<div ref={resultsRef} />
|
||||
|
|
@ -117,20 +143,8 @@ export const DataTable: FC<TableProps> = ({
|
|||
key={`table-cell-${rowIdx}-${colIdx}`}
|
||||
className={css.tableCell}
|
||||
>
|
||||
{typeof row[col.name] === 'object' ? (
|
||||
<pre className={css.preFormat}>
|
||||
{JSON.stringify(row[col.name], null, 2)}
|
||||
</pre>
|
||||
) : row[col.name] !== undefined ? (
|
||||
<span>
|
||||
{col.datatype === 'timestamp' && row[col.name]
|
||||
? moment
|
||||
.utc(row[col.name])
|
||||
.format('MM/DD/YYYY hh:mm:ss a')
|
||||
: row[col.name].toLocaleString()}
|
||||
</span>
|
||||
) : null}
|
||||
</TableCell>
|
||||
{formatTableCell(row, col)}
|
||||
</TableCell>
|
||||
))}
|
||||
{autoWidth ? <TableCell className={css.fillWidth} /> : null}
|
||||
</TableRow>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue