Skip to content

Commit b6e7cd6

Browse files
Merge pull request #186 from mercedes-benz/develop
Sprint 56
2 parents 300ad22 + c59590b commit b6e7cd6

File tree

4 files changed

+62
-16
lines changed

4 files changed

+62
-16
lines changed

public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,22 @@
3535
<noscript>Please enable JavaScript to view this site.</noscript>
3636
<script src="bundle.js"></script>
3737
</body>
38+
<script>
39+
document.addEventListener('keydown', function(e) {
40+
if (
41+
e.key === 'F12' ||
42+
(e.ctrlKey && e.shiftKey && ['I','J','C'].includes(e.key)) ||
43+
(e.metaKey && e.altKey && ['I','J'].includes(e.key)) ||
44+
(e.metaKey && e.shiftKey && e.key === 'C') ||
45+
(e.metaKey && e.altKey) ||
46+
(e.metaKey && e.shiftKey) ||
47+
(e.ctrlKey && e.shiftKey)
48+
) {
49+
e.preventDefault();
50+
e.stopImmediatePropagation();
51+
}
52+
}, true);
53+
document.addEventListener('contextmenu', e => e.preventDefault(), true);
54+
</script>
3855

3956
</html>

src/application/Application.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,14 @@ const Application = ({
119119
}
120120
}, [themeMode]);
121121

122+
const disableContextMenu = (e) => {
123+
e.preventDefault();
124+
};
125+
122126
// Only render the dashboard component if we have an active Neo4j connection.
123127
return (
124128
<div
129+
onContextMenu={disableContextMenu}
125130
ref={ref}
126131
className={`n-bg-palette-neutral-bg-default n-h-screen n-w-screen n-flex n-flex-col n-overflow-hidden`}
127132
>

src/chart/graph/GraphChartVisualization2D.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,12 @@ export const NeoGraphChartVisualization2D = (props: GraphChartVisualizationProps
3333
generateRelCanvasObject(link, ctx, props.style.relLabelFontSize, props.style.relLabelColor),
3434
};
3535
const props2d = { ...props, config: config2d };
36-
return <NeoGraphChartVisualizationBase {...props2d} />;
36+
const handleContextMenu = (e) => {
37+
e.stopPropagation();
38+
};
39+
return (
40+
<div onContextMenu={handleContextMenu}>
41+
<NeoGraphChartVisualizationBase {...props2d} />
42+
</div>
43+
);
3744
};

src/component/misc/DataGridExpandRenderer.tsx

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import { valueIsArray } from '../../chart/ChartUtils';
88
interface GridCellExpandProps {
99
value: string;
1010
width: number;
11+
lineBreakAfterListEntry?: boolean;
1112
}
1213

1314
function isOverflown(element: Element): boolean {
1415
return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
1516
}
1617

1718
const GridCellExpand = React.memo((props: GridCellExpandProps) => {
18-
const { width, value } = props;
19+
const { width, value, lineBreakAfterListEntry } = props;
1920
const wrapper = React.useRef<HTMLDivElement | null>(null);
2021
const cellDiv = React.useRef(null);
2122
const cellValue = React.useRef(null);
@@ -95,7 +96,14 @@ const GridCellExpand = React.memo((props: GridCellExpandProps) => {
9596
{showPopper && (
9697
<Popper open={showFullCell && anchorEl !== null} anchorEl={anchorEl} style={{ width, marginLeft: -17 }}>
9798
<Paper elevation={1} style={{ minHeight: wrapper.current!.offsetHeight - 3 }}>
98-
<Typography variant='body2' style={{ padding: 8, whiteSpace: 'normal', wordBreak: 'break-word' }}>
99+
<Typography
100+
variant='body2'
101+
style={{
102+
padding: 8,
103+
whiteSpace: lineBreakAfterListEntry ? 'pre-line' : 'normal',
104+
wordBreak: 'break-word',
105+
}}
106+
>
99107
{value}
100108
</Typography>
101109
</Paper>
@@ -106,19 +114,28 @@ const GridCellExpand = React.memo((props: GridCellExpandProps) => {
106114
});
107115

108116
export function renderCellExpand(params: GridRenderCellParams<any, string>, lineBreakAfterListEntry: boolean) {
109-
110117
let value = params.value?.low ? params.value.low : params.value;
111-
112-
if(!value){
113-
value=""
114-
}
115-
return (typeof value==="string" || value instanceof String)
116-
? <GridCellExpand value={RenderString(value)} width={params.colDef.computedWidth} />
117-
: (valueIsArray(value)) ? <GridCellExpand value={RenderArray(Array.from(value), false, lineBreakAfterListEntry)} width={params.colDef.computedWidth} />
118-
: <GridCellExpand value={JSON.stringify(value)
119-
.replaceAll(',', lineBreakAfterListEntry ? ',\r\n' : ', ')
120-
.replaceAll(']', '')
121-
.replaceAll('[', '')
122-
.replaceAll('"', '')} width={params.colDef.computedWidth} />;
123118

119+
if (!value) {
120+
value = '';
121+
}
122+
return typeof value === 'string' || value instanceof String ? (
123+
<GridCellExpand value={RenderString(value)} width={params.colDef.computedWidth} lineBreakAfterListEntry />
124+
) : valueIsArray(value) ? (
125+
<GridCellExpand
126+
value={RenderArray(Array.from(value), false, lineBreakAfterListEntry)}
127+
width={params.colDef.computedWidth}
128+
lineBreakAfterListEntry
129+
/>
130+
) : (
131+
<GridCellExpand
132+
value={JSON.stringify(value)
133+
.replaceAll(',', lineBreakAfterListEntry ? ',\r\n' : ', ')
134+
.replaceAll(']', '')
135+
.replaceAll('[', '')
136+
.replaceAll('"', '')}
137+
width={params.colDef.computedWidth}
138+
lineBreakAfterListEntry
139+
/>
140+
);
124141
}

0 commit comments

Comments
 (0)