Skip to content

Commit ce8d75b

Browse files
committed
Merge remote-tracking branch 'origin/develop' into mh/scatterplot_new
2 parents 49096fc + 77e5a0a commit ce8d75b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+4625
-1889
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@
106106
"d3-force-boundary": "^0.0.3",
107107
"d3-hexbin": "^0.2.2",
108108
"d3v7": "npm:d3@^7.9.0",
109+
"echarts": "^5.5.1",
109110
"fit-curve": "^0.2.0",
110111
"html-to-image": "^1.11.11",
111112
"i18next": "^23.14.0",
112113
"jstat": "^1.9.6",
114+
"jszip": "^3.10.1",
113115
"lineupjs": "4.11.0",
114116
"lodash": "~4.17.21",
115117
"plotly.js-dist-min": "~2.12.0",
@@ -118,6 +120,7 @@
118120
"react-highlight-words": "^0.20.0",
119121
"react-plotly.js": "^2.6.0",
120122
"react-spring": "^9.7.4",
123+
"react-window": "^1.8.10",
121124
"use-deep-compare-effect": "^1.8.1",
122125
"visyn_scripts": "^11.1.0"
123126
},
@@ -135,6 +138,7 @@
135138
"@storybook/react": "^7.6.20",
136139
"@storybook/react-webpack5": "^7.6.20",
137140
"@storybook/testing-library": "0.2.2",
141+
"@types/react-window": "^1.8.8",
138142
"chromatic": "^11.7.1",
139143
"storybook": "^7.6.20",
140144
"storybook-addon-swc": "^1.2.0"

src/demo/MainApp.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function MainApp() {
3434
},
3535
],
3636
color: {
37-
description: null,
37+
description: '',
3838
id: 'cellularity',
3939
name: 'Cellularity',
4040
},
@@ -66,6 +66,11 @@ export function MainApp() {
6666
aboutAppModal: {
6767
content: <Text>This is the demo app for visyn core.</Text>,
6868
},
69+
center: (
70+
<Text c="white" size="sm">
71+
{breastCancerData.length} data points / {selection.length} points selected
72+
</Text>
73+
),
6974
}}
7075
/>
7176
}

src/utils/colors.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
// categorical color map
2+
/**
3+
* @deprecated Use `categoricalColors10` instead.
4+
*/
25
export const categoricalColors = ['#337AB7', '#ec6836', '#75c4c2', '#e9d36c', '#24b466', '#e891ae', '#db933c', '#b08aa6', '#8a6044'];
36

7+
/**
8+
* categorical color map with 10 colors
9+
*/
10+
export const categoricalColors10 = ['#337ab7', '#f75a1e', '#75c4c2', '#f0d034', '#15a154', '#e891ae', '#db933c', '#a380c4', '#a4c255', '#8c574b'];
11+
12+
/**
13+
* categorical color map with 20 colors
14+
*/
15+
export const categoricalColors20 = [
16+
'#337ab7',
17+
'#f75a1e',
18+
'#75c4c2',
19+
'#f0d034',
20+
'#15a154',
21+
'#e891ae',
22+
'#db933c',
23+
'#a380c4',
24+
'#a4c255',
25+
'#8c574b',
26+
'#73c1e9',
27+
'#ffa087',
28+
'#c1e8f6',
29+
'#c0ffd2',
30+
'#fabed4',
31+
'#facea2',
32+
'#dcbeff',
33+
'#b2c8a8',
34+
'#bf9890',
35+
'#fff3b8',
36+
];
37+
438
// sequential color map blue
539
export const sequentialBlueColors = ['#cff6ff', '#b0d6fe', '#93b9e8', '#779ecb', '#5c84af', '#406a94', '#23527a', '#023a60', '#002245'];
640

src/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './getCssValue';
33
export * from './initializeLibrary';
44
export * from './fromNow';
55
export * from './colors';
6+
export * from './sanitize-filename';

src/utils/sanitize-filename.test.ts

1.41 KB
Binary file not shown.

src/utils/sanitize-filename.ts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// NOTE: @dv-usama-ansari: Referenced from https://github.com/parshap/truncate-utf8-bytes/blob/master/lib/truncate.js
2+
import { Buffer } from 'buffer';
3+
4+
function isHighSurrogate(codePoint: number) {
5+
return codePoint >= 0xd800 && codePoint <= 0xdbff;
6+
}
7+
8+
function isLowSurrogate(codePoint: number) {
9+
return codePoint >= 0xdc00 && codePoint <= 0xdfff;
10+
}
11+
12+
// Truncate string by size in bytes
13+
function truncate(getLength: (str: string) => number, input: string, byteLength: number) {
14+
let curByteLength = 0;
15+
let codePoint = 0;
16+
let segment = '';
17+
18+
for (let i = 0; i < input.length; i += 1) {
19+
codePoint = input.charCodeAt(i);
20+
segment = input[i] as string;
21+
22+
if (isHighSurrogate(codePoint) && isLowSurrogate(input.charCodeAt(i + 1))) {
23+
i += 1;
24+
segment += input[i];
25+
}
26+
27+
curByteLength += getLength(segment);
28+
29+
if (curByteLength === byteLength) {
30+
return input.slice(0, i + 1);
31+
}
32+
if (curByteLength > byteLength) {
33+
return input.slice(0, i - segment.length + 1);
34+
}
35+
}
36+
37+
return input;
38+
}
39+
40+
// NOTE: @dv-usama-ansari: Referenced from https://github.com/parshap/truncate-utf8-bytes/blob/master/index.js
41+
const getLength = Buffer.byteLength.bind(Buffer);
42+
const boundTruncate = truncate.bind(null, getLength);
43+
44+
// NOTE: @dv-usama-ansari: Referenced from https://github.com/parshap/node-sanitize-filename/blob/master/index.js
45+
const illegalRe = /[/?<>\\:*|"]/g;
46+
// eslint-disable-next-line no-control-regex
47+
const controlRe = /[\x00-\x1f\x80-\x9f]/g;
48+
const reservedRe = /^\.+$/;
49+
const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
50+
const windowsTrailingRe = /[. ]+$/;
51+
52+
function sanitizeHelper(input: string, replacement: string) {
53+
const sanitized = input
54+
.replace(illegalRe, replacement)
55+
.replace(controlRe, replacement)
56+
.replace(reservedRe, replacement)
57+
.replace(windowsReservedRe, replacement)
58+
.replace(windowsTrailingRe, replacement);
59+
return boundTruncate(sanitized, 255);
60+
}
61+
62+
export function sanitize(input: string, options?: { replacement?: '' }) {
63+
const replacement = options?.replacement ?? '';
64+
const output = sanitizeHelper(input, replacement);
65+
if (replacement === '') {
66+
return output;
67+
}
68+
return sanitizeHelper(output, '');
69+
}

src/vis/EagerVis.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ import {
2323

2424
import { VisSidebar } from './VisSidebar';
2525
import { VisSidebarOpenButton } from './VisSidebarOpenButton';
26-
import { BarVis } from './bar/BarVis';
27-
import { BarVisSidebar } from './bar/BarVisSidebar';
28-
import { EBarDirection, EBarDisplayType, EBarGroupingType, IBarConfig } from './bar/interfaces';
29-
import { barMergeDefaultConfig } from './bar/utils';
26+
import { BarVis, BarVisSidebar, EBarDirection, EBarDisplayType, EBarGroupingType, IBarConfig, barMergeDefaultConfig } from './bar';
3027
import { correlationMergeDefaultConfig } from './correlation';
3128
import { CorrelationVis } from './correlation/CorrelationVis';
3229
import { CorrelationVisSidebar } from './correlation/CorrelationVisSidebar';
@@ -256,7 +253,7 @@ export function EagerVis({
256253
if (isSelectedVisTypeRegistered && (!visConfig?.merged || prevVisConfig?.type !== visConfig?.type)) {
257254
// TODO: I would prefer this to be not in a useEffect, as then we wouldn't have the render-flicker: https://react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes
258255
setPrevVisConfig(visConfig);
259-
_setVisConfig?.(getVisByType(visConfig.type)?.mergeConfig(columns, { ...visConfig, merged: true }));
256+
_setVisConfig?.(getVisByType(visConfig.type)?.mergeConfig(columns, { ...visConfig, merged: true }) as BaseVisConfig);
260257
}
261258
}, [_setVisConfig, columns, getVisByType, isSelectedVisTypeRegistered, prevVisConfig?.type, visConfig]);
262259

0 commit comments

Comments
 (0)