@genspectrum/dashboard-components 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +23 -23
- package/dist/assets/{mutationOverTimeWorker-CvZg52rf.js.map → mutationOverTimeWorker-Di6yP1e6.js.map} +1 -1
- package/dist/components.d.ts +50 -48
- package/dist/components.js +151 -62
- package/dist/components.js.map +1 -1
- package/dist/{utilEntrypoint-g4DsyhU7.js → dateRangeOption-du8H7LWu.js} +33 -2
- package/dist/dateRangeOption-du8H7LWu.js.map +1 -0
- package/dist/util.d.ts +101 -59
- package/dist/util.js +3 -2
- package/package.json +1 -1
- package/src/preact/components/color-scale-selector.tsx +7 -3
- package/src/preact/components/error-boundary.tsx +39 -5
- package/src/preact/components/error-display.tsx +40 -5
- package/src/preact/dateRangeSelector/computeInitialValues.spec.ts +8 -2
- package/src/preact/dateRangeSelector/computeInitialValues.ts +6 -0
- package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +16 -2
- package/src/preact/dateRangeSelector/date-range-selector.tsx +20 -15
- package/src/preact/dateRangeSelector/dateRangeOption.ts +10 -5
- package/src/preact/lineageFilter/lineage-filter.stories.tsx +18 -4
- package/src/preact/lineageFilter/lineage-filter.tsx +15 -10
- package/src/preact/locationFilter/location-filter.stories.tsx +14 -0
- package/src/preact/locationFilter/location-filter.tsx +15 -10
- package/src/preact/mutationComparison/mutation-comparison-venn.tsx +17 -18
- package/src/preact/mutationComparison/mutation-comparison.tsx +18 -12
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +1326 -9341
- package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +615 -4920
- package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +2203 -17624
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +16 -8
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -3
- package/src/preact/shared/stories/expectInvalidAttributesErrorMessage.ts +13 -0
- package/src/preact/webWorkers/useWebWorker.ts +8 -4
- package/src/query/queryMutationsOverTime.spec.ts +12 -27
- package/src/query/queryMutationsOverTime.ts +2 -6
- package/src/types.ts +19 -6
- package/src/utilEntrypoint.ts +8 -0
- package/src/utils/map2d.spec.ts +10 -10
- package/src/utils/map2d.ts +10 -10
- package/src/web-components/input/gs-date-range-selector.stories.ts +2 -2
- package/src/web-components/input/gs-date-range-selector.tsx +3 -3
- package/src/web-components/input/gs-lineage-filter.tsx +1 -1
- package/src/web-components/input/gs-location-filter.tsx +2 -2
- package/src/web-components/visualization/gs-aggregate.tsx +2 -2
- package/standalone-bundle/assets/{mutationOverTimeWorker-CypX_PYM.js.map → mutationOverTimeWorker-cIyshfj_.js.map} +1 -1
- package/standalone-bundle/dashboard-components.js +6668 -6580
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/dist/utilEntrypoint-g4DsyhU7.js.map +0 -1
|
@@ -54,7 +54,7 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
|
|
|
54
54
|
<MutationCell mutation={mutation} />
|
|
55
55
|
</div>
|
|
56
56
|
{dates.map((date, columnIndex) => {
|
|
57
|
-
const value = data.get(mutation, date) ??
|
|
57
|
+
const value = data.get(mutation, date) ?? null;
|
|
58
58
|
const tooltipPosition = getTooltipPosition(
|
|
59
59
|
rowIndex,
|
|
60
60
|
shownMutations.length,
|
|
@@ -106,10 +106,16 @@ const ProportionCell: FunctionComponent<{
|
|
|
106
106
|
</p>
|
|
107
107
|
<p>({timeIntervalDisplay(dateClass)})</p>
|
|
108
108
|
<p>{mutation.code}</p>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
{value === null ? (
|
|
110
|
+
<p>No data</p>
|
|
111
|
+
) : (
|
|
112
|
+
<>
|
|
113
|
+
<p>Proportion: {formatProportion(value.proportion)}</p>
|
|
114
|
+
<p>
|
|
115
|
+
Count: {value.count} / {value.totalCount} total
|
|
116
|
+
</p>
|
|
117
|
+
</>
|
|
118
|
+
)}
|
|
113
119
|
</div>
|
|
114
120
|
);
|
|
115
121
|
|
|
@@ -118,12 +124,14 @@ const ProportionCell: FunctionComponent<{
|
|
|
118
124
|
<Tooltip content={tooltipContent} position={tooltipPosition}>
|
|
119
125
|
<div
|
|
120
126
|
style={{
|
|
121
|
-
backgroundColor: getColorWithingScale(value
|
|
122
|
-
color: getTextColorForScale(value
|
|
127
|
+
backgroundColor: getColorWithingScale(value?.proportion, colorScale),
|
|
128
|
+
color: getTextColorForScale(value?.proportion, colorScale),
|
|
123
129
|
}}
|
|
124
130
|
className={`w-full h-full text-center hover:font-bold text-xs group @container`}
|
|
125
131
|
>
|
|
126
|
-
<span className='invisible @[2rem]:visible'>
|
|
132
|
+
<span className='invisible @[2rem]:visible'>
|
|
133
|
+
{value === null ? '' : formatProportion(value.proportion, 0)}
|
|
134
|
+
</span>
|
|
127
135
|
</div>
|
|
128
136
|
</Tooltip>
|
|
129
137
|
</div>
|
|
@@ -72,11 +72,9 @@ export const MutationsOverTimeInner: FunctionComponent<MutationsOverTimeProps> =
|
|
|
72
72
|
};
|
|
73
73
|
}, [granularity, lapis, lapisDateField, lapisFilter, sequenceType]);
|
|
74
74
|
|
|
75
|
-
const worker = useMemo(() => new MutationOverTimeWorker(), []);
|
|
76
|
-
|
|
77
75
|
const { data, error, isLoading } = useWebWorker<MutationOverTimeQuery, MutationOverTimeWorkerResponse>(
|
|
78
76
|
messageToWorker,
|
|
79
|
-
|
|
77
|
+
MutationOverTimeWorker,
|
|
80
78
|
);
|
|
81
79
|
|
|
82
80
|
if (isLoading) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { expect, waitFor, within } from '@storybook/test';
|
|
2
|
+
|
|
3
|
+
export async function expectInvalidAttributesErrorMessage(canvasElement: HTMLElement, errorMessage: string) {
|
|
4
|
+
const canvas = within(canvasElement);
|
|
5
|
+
|
|
6
|
+
await waitFor(() =>
|
|
7
|
+
expect(canvas.getByText('Error - Invalid component attributes', { exact: false })).toBeInTheDocument(),
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
canvas.getByRole('button', { name: 'Show details.' }).click();
|
|
11
|
+
|
|
12
|
+
await waitFor(() => expect(canvas.getByText(errorMessage, { exact: false })).toBeVisible());
|
|
13
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from 'preact/hooks';
|
|
1
|
+
import { useEffect, useMemo, useState } from 'preact/hooks';
|
|
2
2
|
|
|
3
3
|
import { UserFacingError } from '../components/error-display';
|
|
4
4
|
|
|
@@ -23,12 +23,14 @@ export type ErrorWorkerStatus =
|
|
|
23
23
|
};
|
|
24
24
|
export type WorkerStatus<Response> = LoadingWorkerStatus | SuccessWorkerStatus<Response> | ErrorWorkerStatus;
|
|
25
25
|
|
|
26
|
-
export function useWebWorker<Request, Response>(messageToWorker: Request,
|
|
26
|
+
export function useWebWorker<Request, Response>(messageToWorker: Request, WorkerConstructor: new () => Worker) {
|
|
27
27
|
const [data, setData] = useState<Response | undefined>(undefined);
|
|
28
28
|
const [error, setError] = useState<Error | undefined>(undefined);
|
|
29
29
|
const [isLoading, setIsLoading] = useState(true);
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const worker = useMemo(() => {
|
|
32
|
+
const worker = new WorkerConstructor();
|
|
33
|
+
|
|
32
34
|
worker.onmessage = (event: MessageEvent<WorkerStatus<Response>>) => {
|
|
33
35
|
const eventData = event.data;
|
|
34
36
|
const status = eventData.status;
|
|
@@ -59,7 +61,9 @@ export function useWebWorker<Request, Response>(messageToWorker: Request, worker
|
|
|
59
61
|
setError(new Error(`Worker received a message that it cannot deserialize: ${event.data}`));
|
|
60
62
|
setIsLoading(false);
|
|
61
63
|
};
|
|
62
|
-
|
|
64
|
+
|
|
65
|
+
return worker;
|
|
66
|
+
}, [WorkerConstructor]);
|
|
63
67
|
|
|
64
68
|
useEffect(() => {
|
|
65
69
|
worker.postMessage(messageToWorker);
|
|
@@ -99,12 +99,8 @@ describe('queryMutationsOverTime', () => {
|
|
|
99
99
|
granularity: 'day',
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
expect(mutationOverTimeData.getAsArray(
|
|
103
|
-
[
|
|
104
|
-
{ proportion: 0.4, count: 4, totalCount: 11 },
|
|
105
|
-
{ proportion: 0, count: 0, totalCount: 0 },
|
|
106
|
-
{ proportion: 0, count: 0, totalCount: 0 },
|
|
107
|
-
],
|
|
102
|
+
expect(mutationOverTimeData.getAsArray()).to.deep.equal([
|
|
103
|
+
[{ proportion: 0.4, count: 4, totalCount: 11 }, null, null],
|
|
108
104
|
[
|
|
109
105
|
{ proportion: 0.1, count: 1, totalCount: 11 },
|
|
110
106
|
{ proportion: 0.2, count: 2, totalCount: 12 },
|
|
@@ -250,17 +246,9 @@ describe('queryMutationsOverTime', () => {
|
|
|
250
246
|
granularity: 'day',
|
|
251
247
|
});
|
|
252
248
|
|
|
253
|
-
expect(mutationOverTimeData.getAsArray(
|
|
254
|
-
[
|
|
255
|
-
|
|
256
|
-
{ proportion: 0, count: 0, totalCount: 0 },
|
|
257
|
-
{ proportion: 0, count: 0, totalCount: 0 },
|
|
258
|
-
],
|
|
259
|
-
[
|
|
260
|
-
{ proportion: 0.1, count: 1, totalCount: 11 },
|
|
261
|
-
{ proportion: 0, count: 0, totalCount: 0 },
|
|
262
|
-
{ proportion: 0.3, count: 3, totalCount: 13 },
|
|
263
|
-
],
|
|
249
|
+
expect(mutationOverTimeData.getAsArray()).to.deep.equal([
|
|
250
|
+
[{ proportion: 0.4, count: 4, totalCount: 11 }, null, null],
|
|
251
|
+
[{ proportion: 0.1, count: 1, totalCount: 11 }, null, { proportion: 0.3, count: 3, totalCount: 13 }],
|
|
264
252
|
]);
|
|
265
253
|
|
|
266
254
|
const sequences = mutationOverTimeData.getFirstAxisKeys();
|
|
@@ -368,7 +356,7 @@ describe('queryMutationsOverTime', () => {
|
|
|
368
356
|
granularity: 'day',
|
|
369
357
|
});
|
|
370
358
|
|
|
371
|
-
expect(mutationOverTimeData.getAsArray(
|
|
359
|
+
expect(mutationOverTimeData.getAsArray()).to.deep.equal([]);
|
|
372
360
|
expect(mutationOverTimeData.getFirstAxisKeys()).to.deep.equal([]);
|
|
373
361
|
expect(mutationOverTimeData.getSecondAxisKeys()).to.deep.equal([]);
|
|
374
362
|
});
|
|
@@ -450,7 +438,7 @@ describe('queryMutationsOverTime', () => {
|
|
|
450
438
|
granularity: 'day',
|
|
451
439
|
});
|
|
452
440
|
|
|
453
|
-
expect(mutationOverTimeData.getAsArray(
|
|
441
|
+
expect(mutationOverTimeData.getAsArray()).to.deep.equal([
|
|
454
442
|
[
|
|
455
443
|
{ proportion: 0.2, count: 2, totalCount: 11 },
|
|
456
444
|
{ proportion: 0.3, count: 3, totalCount: 12 },
|
|
@@ -542,7 +530,7 @@ describe('queryMutationsOverTime', () => {
|
|
|
542
530
|
granularity: 'day',
|
|
543
531
|
});
|
|
544
532
|
|
|
545
|
-
expect(mutationOverTimeData.getAsArray(
|
|
533
|
+
expect(mutationOverTimeData.getAsArray()).to.deep.equal([
|
|
546
534
|
[
|
|
547
535
|
{ proportion: 0.1, count: 1, totalCount: 11 },
|
|
548
536
|
{ proportion: 0.2, count: 2, totalCount: 12 },
|
|
@@ -605,7 +593,7 @@ describe('queryMutationsOverTime', () => {
|
|
|
605
593
|
granularity: 'day',
|
|
606
594
|
});
|
|
607
595
|
|
|
608
|
-
expect(mutationOverTimeData.getAsArray(
|
|
596
|
+
expect(mutationOverTimeData.getAsArray()).to.deep.equal([
|
|
609
597
|
[
|
|
610
598
|
{
|
|
611
599
|
proportion: 0.2,
|
|
@@ -699,11 +687,8 @@ describe('queryMutationsOverTime', () => {
|
|
|
699
687
|
granularity: 'month',
|
|
700
688
|
});
|
|
701
689
|
|
|
702
|
-
expect(mutationOverTimeData.getAsArray(
|
|
703
|
-
[
|
|
704
|
-
{ proportion: 0.4, count: 4, totalCount: 11 },
|
|
705
|
-
{ proportion: 0, count: 0, totalCount: 0 },
|
|
706
|
-
],
|
|
690
|
+
expect(mutationOverTimeData.getAsArray()).to.deep.equal([
|
|
691
|
+
[{ proportion: 0.4, count: 4, totalCount: 11 }, null],
|
|
707
692
|
[
|
|
708
693
|
{ proportion: 0.1, count: 1, totalCount: 11 },
|
|
709
694
|
{ proportion: 0.2, count: 2, totalCount: 12 },
|
|
@@ -740,7 +725,7 @@ describe('queryMutationsOverTime', () => {
|
|
|
740
725
|
granularity: 'month',
|
|
741
726
|
});
|
|
742
727
|
|
|
743
|
-
expect(mutationOverTimeData.getAsArray(
|
|
728
|
+
expect(mutationOverTimeData.getAsArray()).to.deep.equal([]);
|
|
744
729
|
|
|
745
730
|
const sequences = mutationOverTimeData.getFirstAxisKeys();
|
|
746
731
|
expect(sequences.length).toBe(0);
|
|
@@ -41,7 +41,7 @@ export type MutationOverTimeData = {
|
|
|
41
41
|
totalCount: number;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export type MutationOverTimeMutationValue = { proportion: number; count: number; totalCount: number };
|
|
44
|
+
export type MutationOverTimeMutationValue = { proportion: number; count: number; totalCount: number } | null;
|
|
45
45
|
export type MutationOverTimeDataGroupedByMutation = Map2d<
|
|
46
46
|
SubstitutionClass | DeletionClass,
|
|
47
47
|
TemporalClass,
|
|
@@ -239,11 +239,7 @@ export function groupByMutation(
|
|
|
239
239
|
|
|
240
240
|
sortedOverallMutationData.forEach((mutationData) => {
|
|
241
241
|
sortedDates.forEach((date) => {
|
|
242
|
-
dataArray.set(mutationData, date,
|
|
243
|
-
count: 0,
|
|
244
|
-
proportion: 0,
|
|
245
|
-
totalCount: 0,
|
|
246
|
-
});
|
|
242
|
+
dataArray.set(mutationData, date, null);
|
|
247
243
|
});
|
|
248
244
|
});
|
|
249
245
|
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
type Deletion,
|
|
3
5
|
type DeletionClass,
|
|
@@ -7,16 +9,19 @@ import {
|
|
|
7
9
|
type SubstitutionClass,
|
|
8
10
|
} from './utils/mutations';
|
|
9
11
|
|
|
10
|
-
export
|
|
12
|
+
export const lapisFilterSchema = z.record(z.union([z.string(), z.number(), z.null(), z.boolean()]));
|
|
13
|
+
export type LapisFilter = z.infer<typeof lapisFilterSchema>;
|
|
11
14
|
|
|
12
|
-
export
|
|
13
|
-
lapisFilter:
|
|
14
|
-
displayName: string
|
|
15
|
-
};
|
|
15
|
+
export const namedLapisFilterSchema = z.object({
|
|
16
|
+
lapisFilter: lapisFilterSchema,
|
|
17
|
+
displayName: z.string(),
|
|
18
|
+
});
|
|
19
|
+
export type NamedLapisFilter = z.infer<typeof namedLapisFilterSchema>;
|
|
16
20
|
|
|
17
21
|
export type TemporalGranularity = 'day' | 'week' | 'month' | 'year';
|
|
18
22
|
|
|
19
|
-
export
|
|
23
|
+
export const sequenceTypeSchema = z.union([z.literal('nucleotide'), z.literal('amino acid')]);
|
|
24
|
+
export type SequenceType = z.infer<typeof sequenceTypeSchema>;
|
|
20
25
|
|
|
21
26
|
export type SubstitutionOrDeletion = 'substitution' | 'deletion';
|
|
22
27
|
|
|
@@ -44,3 +49,11 @@ export type SubstitutionOrDeletionEntry<
|
|
|
44
49
|
> = SubstitutionEntry<S> | DeletionEntry<D>;
|
|
45
50
|
|
|
46
51
|
export type MutationEntry = SubstitutionEntry | DeletionEntry | InsertionEntry;
|
|
52
|
+
|
|
53
|
+
export const views = {
|
|
54
|
+
table: 'table',
|
|
55
|
+
venn: 'venn',
|
|
56
|
+
} as const;
|
|
57
|
+
|
|
58
|
+
export const mutationComparisonViewSchema = z.union([z.literal(views.table), z.literal(views.venn)]);
|
|
59
|
+
export type MutationComparisonView = z.infer<typeof mutationComparisonViewSchema>;
|
package/src/utilEntrypoint.ts
CHANGED
|
@@ -4,3 +4,11 @@ export {
|
|
|
4
4
|
dateRangeOptionPresets,
|
|
5
5
|
DateRangeOptionChangedEvent,
|
|
6
6
|
} from './preact/dateRangeSelector/dateRangeOption';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
type NamedLapisFilter,
|
|
10
|
+
type LapisFilter,
|
|
11
|
+
type SequenceType,
|
|
12
|
+
views,
|
|
13
|
+
type MutationComparisonView,
|
|
14
|
+
} from './types';
|
package/src/utils/map2d.spec.ts
CHANGED
|
@@ -32,7 +32,7 @@ describe('Map2dBase', () => {
|
|
|
32
32
|
map2d.set('c', 'b', 3);
|
|
33
33
|
map2d.set('c', 'd', 4);
|
|
34
34
|
|
|
35
|
-
expect(map2d.getAsArray(
|
|
35
|
+
expect(map2d.getAsArray()).toEqual([
|
|
36
36
|
[1, 2],
|
|
37
37
|
[3, 4],
|
|
38
38
|
]);
|
|
@@ -45,9 +45,9 @@ describe('Map2dBase', () => {
|
|
|
45
45
|
);
|
|
46
46
|
map2d.set('a', 'b', 2);
|
|
47
47
|
map2d.set('c', 'd', 4);
|
|
48
|
-
expect(map2d.getAsArray(
|
|
49
|
-
[2,
|
|
50
|
-
[
|
|
48
|
+
expect(map2d.getAsArray()).toEqual([
|
|
49
|
+
[2, undefined],
|
|
50
|
+
[undefined, 4],
|
|
51
51
|
]);
|
|
52
52
|
});
|
|
53
53
|
|
|
@@ -103,8 +103,8 @@ describe('Map2dBase', () => {
|
|
|
103
103
|
map2d.set('a', 'b', 2);
|
|
104
104
|
map2d.set('c', 'd', 4);
|
|
105
105
|
|
|
106
|
-
expect(map2d.getRow('a'
|
|
107
|
-
expect(map2d.getRow('c'
|
|
106
|
+
expect(map2d.getRow('a')).toEqual([2, undefined]);
|
|
107
|
+
expect(map2d.getRow('c')).toEqual([undefined, 4]);
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
it('should return an empty array when the row does not exist', () => {
|
|
@@ -114,7 +114,7 @@ describe('Map2dBase', () => {
|
|
|
114
114
|
);
|
|
115
115
|
map2d.set('a', 'b', 2);
|
|
116
116
|
|
|
117
|
-
expect(map2d.getRow('c'
|
|
117
|
+
expect(map2d.getRow('c')).toEqual([]);
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it('should return content as object', () => {
|
|
@@ -185,7 +185,7 @@ describe('Map2dView', () => {
|
|
|
185
185
|
const view = new Map2dView<string, string, number>(container);
|
|
186
186
|
view.deleteRow('c');
|
|
187
187
|
|
|
188
|
-
expect(view.getAsArray(
|
|
188
|
+
expect(view.getAsArray()).toEqual([[1, undefined]]);
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
it('should throw an error when trying to set a value', () => {
|
|
@@ -198,7 +198,7 @@ describe('Map2dView', () => {
|
|
|
198
198
|
const container = createBaseContainer();
|
|
199
199
|
const view = new Map2dView<string, string, number>(container);
|
|
200
200
|
|
|
201
|
-
expect(view.getRow('a'
|
|
201
|
+
expect(view.getRow('a')).toEqual([1, undefined]);
|
|
202
202
|
});
|
|
203
203
|
|
|
204
204
|
it('should return an empty array when the row does not exist', () => {
|
|
@@ -206,7 +206,7 @@ describe('Map2dView', () => {
|
|
|
206
206
|
const view = new Map2dView<string, string, number>(container);
|
|
207
207
|
view.deleteRow('c');
|
|
208
208
|
|
|
209
|
-
expect(view.getRow('c'
|
|
209
|
+
expect(view.getRow('c')).toEqual([]);
|
|
210
210
|
});
|
|
211
211
|
|
|
212
212
|
function createBaseContainer() {
|
package/src/utils/map2d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface Map2d<Key1, Key2, Value> {
|
|
|
3
3
|
|
|
4
4
|
set(keyFirstAxis: Key1, keySecondAxis: Key2, value: Value): void;
|
|
5
5
|
|
|
6
|
-
getRow(key: Key1
|
|
6
|
+
getRow(key: Key1): (Value | undefined)[];
|
|
7
7
|
|
|
8
8
|
deleteRow(key: Key1): void;
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ export interface Map2d<Key1, Key2, Value> {
|
|
|
11
11
|
|
|
12
12
|
getSecondAxisKeys(): Key2[];
|
|
13
13
|
|
|
14
|
-
getAsArray(
|
|
14
|
+
getAsArray(): (Value | undefined)[][];
|
|
15
15
|
|
|
16
16
|
serializeFirstAxis(key: Key1): string;
|
|
17
17
|
|
|
@@ -52,13 +52,13 @@ export class Map2dBase<Key1 extends object | string, Key2 extends object | strin
|
|
|
52
52
|
return this.data.get(serializedKeyFirstAxis)?.get(serializedKeySecondAxis);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
getRow(key: Key1
|
|
55
|
+
getRow(key: Key1) {
|
|
56
56
|
const serializedKeyFirstAxis = this.serializeFirstAxis(key);
|
|
57
57
|
const row = this.data.get(serializedKeyFirstAxis);
|
|
58
58
|
if (row === undefined) {
|
|
59
59
|
return [];
|
|
60
60
|
}
|
|
61
|
-
return Array.from(this.keysSecondAxis.keys()).map((key) => row.get(key)
|
|
61
|
+
return Array.from(this.keysSecondAxis.keys()).map((key) => row.get(key));
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
set(keyFirstAxis: Key1, keySecondAxis: Key2, value: Value) {
|
|
@@ -89,10 +89,10 @@ export class Map2dBase<Key1 extends object | string, Key2 extends object | strin
|
|
|
89
89
|
return Array.from(this.keysSecondAxis.values());
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
getAsArray(
|
|
92
|
+
getAsArray() {
|
|
93
93
|
return this.getFirstAxisKeys().map((firstAxisKey) => {
|
|
94
94
|
return this.getSecondAxisKeys().map((secondAxisKey) => {
|
|
95
|
-
return this.get(firstAxisKey, secondAxisKey)
|
|
95
|
+
return this.get(firstAxisKey, secondAxisKey);
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
}
|
|
@@ -159,20 +159,20 @@ export class Map2dView<Key1 extends object | string, Key2 extends object | strin
|
|
|
159
159
|
return Array.from(this.keysSecondAxis.values());
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
getAsArray(
|
|
162
|
+
getAsArray() {
|
|
163
163
|
return this.getFirstAxisKeys().map((firstAxisKey) => {
|
|
164
164
|
return this.getSecondAxisKeys().map((secondAxisKey) => {
|
|
165
|
-
return this.baseMap.get(firstAxisKey, secondAxisKey)
|
|
165
|
+
return this.baseMap.get(firstAxisKey, secondAxisKey);
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
getRow(key: Key1
|
|
170
|
+
getRow(key: Key1) {
|
|
171
171
|
const serializedKeyFirstAxis = this.serializeFirstAxis(key);
|
|
172
172
|
if (!this.keysFirstAxis.has(serializedKeyFirstAxis)) {
|
|
173
173
|
return [];
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
return this.baseMap.getRow(key
|
|
176
|
+
return this.baseMap.getRow(key);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
@@ -74,8 +74,8 @@ const meta: Meta<Required<DateRangeSelectorProps>> = {
|
|
|
74
74
|
initialValue: dateRangeOptionPresets.lastMonth.label,
|
|
75
75
|
dateColumn: 'aDateColumn',
|
|
76
76
|
width: '100%',
|
|
77
|
-
initialDateFrom:
|
|
78
|
-
initialDateTo:
|
|
77
|
+
initialDateFrom: undefined,
|
|
78
|
+
initialDateTo: undefined,
|
|
79
79
|
},
|
|
80
80
|
tags: ['autodocs'],
|
|
81
81
|
};
|
|
@@ -84,7 +84,7 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
|
|
|
84
84
|
* If `initialDateTo` is set, but this is unset, it will default to `earliestDate`.
|
|
85
85
|
*/
|
|
86
86
|
@property()
|
|
87
|
-
initialDateFrom: string =
|
|
87
|
+
initialDateFrom: string | undefined = undefined;
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* A date string in the format `YYYY-MM-DD`.
|
|
@@ -92,7 +92,7 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
|
|
|
92
92
|
* If `initialDateFrom` is set, but this is unset, it will default to the current date.
|
|
93
93
|
*/
|
|
94
94
|
@property()
|
|
95
|
-
initialDateTo: string =
|
|
95
|
+
initialDateTo: string | undefined = undefined;
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* The width of the component.
|
|
@@ -106,7 +106,7 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
|
|
|
106
106
|
* The name of the column in LAPIS that contains the date information.
|
|
107
107
|
*/
|
|
108
108
|
@property({ type: String })
|
|
109
|
-
dateColumn: string = '
|
|
109
|
+
dateColumn: string = '';
|
|
110
110
|
|
|
111
111
|
override render() {
|
|
112
112
|
return (
|
|
@@ -48,7 +48,7 @@ export class LineageFilterComponent extends PreactLitAdapter {
|
|
|
48
48
|
* The placeholder text to display in the input field.
|
|
49
49
|
*/
|
|
50
50
|
@property()
|
|
51
|
-
placeholderText: string =
|
|
51
|
+
placeholderText: string | undefined = undefined;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* The width of the component.
|
|
@@ -40,7 +40,7 @@ export class LocationFilterComponent extends PreactLitAdapter {
|
|
|
40
40
|
* Must be of the form `valueForField1 / valueForField2 / ... / valueForFieldN`.
|
|
41
41
|
*/
|
|
42
42
|
@property()
|
|
43
|
-
initialValue =
|
|
43
|
+
initialValue: string | undefined = undefined;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Required.
|
|
@@ -65,7 +65,7 @@ export class LocationFilterComponent extends PreactLitAdapter {
|
|
|
65
65
|
* The placeholder text to display in the input field, if it is empty.
|
|
66
66
|
*/
|
|
67
67
|
@property()
|
|
68
|
-
placeholderText: string =
|
|
68
|
+
placeholderText: string | undefined = undefined;
|
|
69
69
|
|
|
70
70
|
override render() {
|
|
71
71
|
return (
|
|
@@ -101,7 +101,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
101
101
|
|
|
102
102
|
declare global {
|
|
103
103
|
interface HTMLElementTagNameMap {
|
|
104
|
-
'gs-aggregate
|
|
104
|
+
'gs-aggregate': AggregateComponent;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -109,7 +109,7 @@ declare global {
|
|
|
109
109
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
110
110
|
namespace JSX {
|
|
111
111
|
interface IntrinsicElements {
|
|
112
|
-
'gs-aggregate
|
|
112
|
+
'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|