Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprint 27 Release #115

Merged
merged 6 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/component/misc/DataGridExpandRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Box from '@mui/material/Box';
import { Paper, Popper, Typography } from '@mui/material';
import { GridRenderCellParams } from '@mui/x-data-grid';
import { useEffect } from 'react';
import { RenderString } from '../../report/ReportRecordProcessing';

interface GridCellExpandProps {
value: string;
Expand Down Expand Up @@ -106,14 +107,7 @@ const GridCellExpand = React.memo((props: GridCellExpandProps) => {

export function renderCellExpand(params: GridRenderCellParams<any, string>, lineBreakAfterListEntry: boolean) {
let value = params.value?.low ? params.value.low : params.value;
const displayLink = typeof value === 'string' || value instanceof String ? RenderString(value) : '';
return <GridCellExpand value={displayLink} width={params.colDef.computedWidth} />;

const stringifiedObj = value
? JSON.stringify(value)
.replaceAll(',', lineBreakAfterListEntry ? ',\r\n' : ', ') // TODO: Consolidate to a regex
.replaceAll(']', '')
.replaceAll('[', '')
.replaceAll('"', '')
: '';

return <GridCellExpand value={stringifiedObj || ''} width={params.colDef.computedWidth} />;
}
2 changes: 1 addition & 1 deletion src/report/ReportRecordProcessing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function RenderArray(value) {
return mapped;
}

function RenderString(value) {
export function RenderString(value) {
const str = value?.toString() || '';
if (str.startsWith('http') || str.startsWith('https')) {
return (
Expand Down
Loading