@genspectrum/dashboard-components 1.4.0 → 1.5.0
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 +97 -5
- package/dist/assets/{mutationOverTimeWorker-CQxrFo53.js.map → mutationOverTimeWorker-BJ_P2T8Y.js.map} +1 -1
- package/dist/components.d.ts +45 -25
- package/dist/components.js +117 -20
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +25 -25
- package/package.json +1 -1
- package/src/preact/lineageFilter/lineage-filter.stories.tsx +24 -0
- package/src/preact/lineageFilter/lineage-filter.tsx +13 -2
- package/src/preact/locationFilter/location-filter.stories.tsx +24 -0
- package/src/preact/locationFilter/location-filter.tsx +19 -3
- package/src/preact/mutationsOverTime/__mockData__/withGaps.ts +352 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +38 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +10 -0
- package/src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts +2 -0
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +35 -0
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +28 -4
- package/src/preact/textFilter/text-filter.stories.tsx +29 -4
- package/src/preact/textFilter/text-filter.tsx +13 -2
- package/src/query/queryMutationsOverTime.ts +37 -4
- package/src/query/queryMutationsOverTimeNewEndpoint.spec.ts +122 -0
- package/src/utils/map2d.spec.ts +30 -0
- package/src/utils/map2d.ts +14 -1
- package/src/web-components/input/gs-lineage-filter.stories.ts +7 -0
- package/src/web-components/input/gs-lineage-filter.tsx +8 -0
- package/src/web-components/input/gs-location-filter.stories.ts +7 -0
- package/src/web-components/input/gs-location-filter.tsx +9 -1
- package/src/web-components/input/gs-text-filter.stories.ts +7 -0
- package/src/web-components/input/gs-text-filter.tsx +8 -0
- package/src/web-components/visualization/gs-mutations-over-time.stories.ts +14 -1
- package/src/web-components/visualization/gs-mutations-over-time.tsx +8 -0
- package/standalone-bundle/assets/{mutationOverTimeWorker-CDACUs6w.js.map → mutationOverTimeWorker-CkeGpKWp.js.map} +1 -1
- package/standalone-bundle/dashboard-components.js +1412 -1329
- package/standalone-bundle/dashboard-components.js.map +1 -1
package/dist/util.d.ts
CHANGED
|
@@ -917,7 +917,7 @@ declare global {
|
|
|
917
917
|
|
|
918
918
|
declare global {
|
|
919
919
|
interface HTMLElementTagNameMap {
|
|
920
|
-
'gs-
|
|
920
|
+
'gs-genome-data-viewer': GenomeDataViewerComponent;
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
923
|
|
|
@@ -925,7 +925,7 @@ declare global {
|
|
|
925
925
|
declare global {
|
|
926
926
|
namespace JSX {
|
|
927
927
|
interface IntrinsicElements {
|
|
928
|
-
'gs-
|
|
928
|
+
'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
}
|
|
@@ -933,7 +933,7 @@ declare global {
|
|
|
933
933
|
|
|
934
934
|
declare global {
|
|
935
935
|
interface HTMLElementTagNameMap {
|
|
936
|
-
'gs-
|
|
936
|
+
'gs-mutation-comparison-component': MutationComparisonComponent;
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
|
|
@@ -941,7 +941,7 @@ declare global {
|
|
|
941
941
|
declare global {
|
|
942
942
|
namespace JSX {
|
|
943
943
|
interface IntrinsicElements {
|
|
944
|
-
'gs-
|
|
944
|
+
'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
947
|
}
|
|
@@ -949,7 +949,7 @@ declare global {
|
|
|
949
949
|
|
|
950
950
|
declare global {
|
|
951
951
|
interface HTMLElementTagNameMap {
|
|
952
|
-
'gs-
|
|
952
|
+
'gs-mutations': MutationsComponent;
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
955
|
|
|
@@ -957,7 +957,7 @@ declare global {
|
|
|
957
957
|
declare global {
|
|
958
958
|
namespace JSX {
|
|
959
959
|
interface IntrinsicElements {
|
|
960
|
-
'gs-
|
|
960
|
+
'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
963
|
}
|
|
@@ -965,7 +965,7 @@ declare global {
|
|
|
965
965
|
|
|
966
966
|
declare global {
|
|
967
967
|
interface HTMLElementTagNameMap {
|
|
968
|
-
'gs-
|
|
968
|
+
'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
971
|
|
|
@@ -973,7 +973,7 @@ declare global {
|
|
|
973
973
|
declare global {
|
|
974
974
|
namespace JSX {
|
|
975
975
|
interface IntrinsicElements {
|
|
976
|
-
'gs-
|
|
976
|
+
'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
979
|
}
|
|
@@ -997,7 +997,7 @@ declare global {
|
|
|
997
997
|
|
|
998
998
|
declare global {
|
|
999
999
|
interface HTMLElementTagNameMap {
|
|
1000
|
-
'gs-
|
|
1000
|
+
'gs-aggregate': AggregateComponent;
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
@@ -1005,7 +1005,7 @@ declare global {
|
|
|
1005
1005
|
declare global {
|
|
1006
1006
|
namespace JSX {
|
|
1007
1007
|
interface IntrinsicElements {
|
|
1008
|
-
'gs-
|
|
1008
|
+
'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
@@ -1013,7 +1013,7 @@ declare global {
|
|
|
1013
1013
|
|
|
1014
1014
|
declare global {
|
|
1015
1015
|
interface HTMLElementTagNameMap {
|
|
1016
|
-
'gs-
|
|
1016
|
+
'gs-mutations-over-time': MutationsOverTimeComponent;
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
@@ -1021,7 +1021,7 @@ declare global {
|
|
|
1021
1021
|
declare global {
|
|
1022
1022
|
namespace JSX {
|
|
1023
1023
|
interface IntrinsicElements {
|
|
1024
|
-
'gs-
|
|
1024
|
+
'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
@@ -1029,7 +1029,7 @@ declare global {
|
|
|
1029
1029
|
|
|
1030
1030
|
declare global {
|
|
1031
1031
|
interface HTMLElementTagNameMap {
|
|
1032
|
-
'gs-
|
|
1032
|
+
'gs-sequences-by-location': SequencesByLocationComponent;
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
@@ -1037,7 +1037,7 @@ declare global {
|
|
|
1037
1037
|
declare global {
|
|
1038
1038
|
namespace JSX {
|
|
1039
1039
|
interface IntrinsicElements {
|
|
1040
|
-
'gs-
|
|
1040
|
+
'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1041
1041
|
}
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
@@ -1045,7 +1045,7 @@ declare global {
|
|
|
1045
1045
|
|
|
1046
1046
|
declare global {
|
|
1047
1047
|
interface HTMLElementTagNameMap {
|
|
1048
|
-
'gs-
|
|
1048
|
+
'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
|
|
@@ -1053,7 +1053,7 @@ declare global {
|
|
|
1053
1053
|
declare global {
|
|
1054
1054
|
namespace JSX {
|
|
1055
1055
|
interface IntrinsicElements {
|
|
1056
|
-
'gs-
|
|
1056
|
+
'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
@@ -1061,7 +1061,7 @@ declare global {
|
|
|
1061
1061
|
|
|
1062
1062
|
declare global {
|
|
1063
1063
|
interface HTMLElementTagNameMap {
|
|
1064
|
-
'gs-
|
|
1064
|
+
'gs-statistics': StatisticsComponent;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
@@ -1069,7 +1069,7 @@ declare global {
|
|
|
1069
1069
|
declare global {
|
|
1070
1070
|
namespace JSX {
|
|
1071
1071
|
interface IntrinsicElements {
|
|
1072
|
-
'gs-
|
|
1072
|
+
'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
@@ -1077,7 +1077,10 @@ declare global {
|
|
|
1077
1077
|
|
|
1078
1078
|
declare global {
|
|
1079
1079
|
interface HTMLElementTagNameMap {
|
|
1080
|
-
'gs-
|
|
1080
|
+
'gs-location-filter': LocationFilterComponent;
|
|
1081
|
+
}
|
|
1082
|
+
interface HTMLElementEventMap {
|
|
1083
|
+
[gsEventNames.locationChanged]: LocationChangedEvent;
|
|
1081
1084
|
}
|
|
1082
1085
|
}
|
|
1083
1086
|
|
|
@@ -1085,7 +1088,7 @@ declare global {
|
|
|
1085
1088
|
declare global {
|
|
1086
1089
|
namespace JSX {
|
|
1087
1090
|
interface IntrinsicElements {
|
|
1088
|
-
'gs-
|
|
1091
|
+
'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1089
1092
|
}
|
|
1090
1093
|
}
|
|
1091
1094
|
}
|
|
@@ -1093,10 +1096,7 @@ declare global {
|
|
|
1093
1096
|
|
|
1094
1097
|
declare global {
|
|
1095
1098
|
interface HTMLElementTagNameMap {
|
|
1096
|
-
'gs-
|
|
1097
|
-
}
|
|
1098
|
-
interface HTMLElementEventMap {
|
|
1099
|
-
[gsEventNames.locationChanged]: LocationChangedEvent;
|
|
1099
|
+
'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
@@ -1104,7 +1104,7 @@ declare global {
|
|
|
1104
1104
|
declare global {
|
|
1105
1105
|
namespace JSX {
|
|
1106
1106
|
interface IntrinsicElements {
|
|
1107
|
-
'gs-
|
|
1107
|
+
'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
package/package.json
CHANGED
|
@@ -74,6 +74,11 @@ const meta: Meta = {
|
|
|
74
74
|
type: 'object',
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
|
+
hideCounts: {
|
|
78
|
+
control: {
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
77
82
|
},
|
|
78
83
|
|
|
79
84
|
args: {
|
|
@@ -84,6 +89,7 @@ const meta: Meta = {
|
|
|
84
89
|
placeholderText: 'Enter a lineage',
|
|
85
90
|
value: 'A.1',
|
|
86
91
|
width: '100%',
|
|
92
|
+
hideCounts: false,
|
|
87
93
|
},
|
|
88
94
|
};
|
|
89
95
|
|
|
@@ -163,6 +169,24 @@ export const WithNoLapisField: StoryObj<LineageFilterProps> = {
|
|
|
163
169
|
},
|
|
164
170
|
};
|
|
165
171
|
|
|
172
|
+
export const WithHideCountsTrue: StoryObj<LineageFilterProps> = {
|
|
173
|
+
...Default,
|
|
174
|
+
args: {
|
|
175
|
+
...Default.args,
|
|
176
|
+
hideCounts: true,
|
|
177
|
+
},
|
|
178
|
+
play: async ({ canvasElement, step }) => {
|
|
179
|
+
const { canvas } = await prepare(canvasElement, step);
|
|
180
|
+
|
|
181
|
+
await step('visible without counts', async () => {
|
|
182
|
+
const input = await inputField(canvas);
|
|
183
|
+
await userEvent.clear(input);
|
|
184
|
+
await userEvent.type(input, 'B.1');
|
|
185
|
+
await expect(canvas.getByRole('option', { name: 'B.1' })).toBeVisible();
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
166
190
|
async function prepare(canvasElement: HTMLElement, step: StepFunction<PreactRenderer, unknown>) {
|
|
167
191
|
const canvas = within(canvasElement);
|
|
168
192
|
|
|
@@ -16,6 +16,7 @@ const lineageSelectorPropsSchema = z.object({
|
|
|
16
16
|
lapisField: z.string().min(1),
|
|
17
17
|
placeholderText: z.string().optional(),
|
|
18
18
|
value: z.string(),
|
|
19
|
+
hideCounts: z.boolean().optional(),
|
|
19
20
|
});
|
|
20
21
|
const lineageFilterInnerPropsSchema = lineageSelectorPropsSchema.extend({
|
|
21
22
|
lapisFilter: lapisFilterSchema,
|
|
@@ -46,6 +47,7 @@ const LineageFilterInner: FunctionComponent<LineageFilterInnerProps> = ({
|
|
|
46
47
|
placeholderText,
|
|
47
48
|
value,
|
|
48
49
|
lapisFilter,
|
|
50
|
+
hideCounts,
|
|
49
51
|
}) => {
|
|
50
52
|
const lapisUrl = useLapisUrl();
|
|
51
53
|
|
|
@@ -62,7 +64,15 @@ const LineageFilterInner: FunctionComponent<LineageFilterInnerProps> = ({
|
|
|
62
64
|
throw error;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
return
|
|
67
|
+
return (
|
|
68
|
+
<LineageSelector
|
|
69
|
+
lapisField={lapisField}
|
|
70
|
+
value={value}
|
|
71
|
+
placeholderText={placeholderText}
|
|
72
|
+
data={data}
|
|
73
|
+
hideCounts={hideCounts}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
66
76
|
};
|
|
67
77
|
|
|
68
78
|
const LineageSelector = ({
|
|
@@ -70,6 +80,7 @@ const LineageSelector = ({
|
|
|
70
80
|
value,
|
|
71
81
|
placeholderText,
|
|
72
82
|
data,
|
|
83
|
+
hideCounts = false,
|
|
73
84
|
}: LineageSelectorProps & {
|
|
74
85
|
data: LineageItem[];
|
|
75
86
|
}) => {
|
|
@@ -88,7 +99,7 @@ const LineageSelector = ({
|
|
|
88
99
|
formatItemInList={(item: LineageItem) => (
|
|
89
100
|
<p>
|
|
90
101
|
<span>{item.lineage}</span>
|
|
91
|
-
<span className='ml-2 text-gray-500'>({item.count})</span>
|
|
102
|
+
{!hideCounts && <span className='ml-2 text-gray-500'>({item.count})</span>}
|
|
92
103
|
</p>
|
|
93
104
|
)}
|
|
94
105
|
/>
|
|
@@ -44,6 +44,7 @@ const meta: Meta<LocationFilterProps> = {
|
|
|
44
44
|
lapisFilter: {
|
|
45
45
|
age: 18,
|
|
46
46
|
},
|
|
47
|
+
hideCounts: false,
|
|
47
48
|
},
|
|
48
49
|
argTypes: {
|
|
49
50
|
fields: {
|
|
@@ -66,6 +67,11 @@ const meta: Meta<LocationFilterProps> = {
|
|
|
66
67
|
type: 'text',
|
|
67
68
|
},
|
|
68
69
|
},
|
|
70
|
+
hideCounts: {
|
|
71
|
+
control: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
69
75
|
lapisFilter: {
|
|
70
76
|
control: {
|
|
71
77
|
type: 'object',
|
|
@@ -146,6 +152,24 @@ export const OnBlurInput: StoryObj<LocationFilterProps> = {
|
|
|
146
152
|
},
|
|
147
153
|
};
|
|
148
154
|
|
|
155
|
+
export const WithHideCountsTrue: StoryObj<LocationFilterProps> = {
|
|
156
|
+
...Primary,
|
|
157
|
+
args: {
|
|
158
|
+
...Primary.args,
|
|
159
|
+
hideCounts: true,
|
|
160
|
+
},
|
|
161
|
+
play: async ({ canvasElement, step }) => {
|
|
162
|
+
const { canvas } = await prepare(canvasElement, step);
|
|
163
|
+
|
|
164
|
+
await step('visible without counts', async () => {
|
|
165
|
+
const input = await inputField(canvas);
|
|
166
|
+
await userEvent.clear(input);
|
|
167
|
+
await userEvent.type(input, 'Adajan');
|
|
168
|
+
await expect(canvas.getByRole('option', { name: 'Adajan Asia / India / Gujarat / Adajan' })).toBeVisible();
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
149
173
|
const inputField = (canvas: ReturnType<typeof within>) => canvas.findByPlaceholderText('Enter a location');
|
|
150
174
|
|
|
151
175
|
async function prepare(canvasElement: HTMLElement, step: StepFunction<PreactRenderer, unknown>) {
|
|
@@ -16,6 +16,7 @@ const locationSelectorPropsSchema = z.object({
|
|
|
16
16
|
value: lapisLocationFilterSchema.optional(),
|
|
17
17
|
placeholderText: z.string().optional(),
|
|
18
18
|
fields: z.array(z.string()).min(1),
|
|
19
|
+
hideCounts: z.boolean().optional(),
|
|
19
20
|
});
|
|
20
21
|
const locationFilterInnerPropsSchema = locationSelectorPropsSchema.extend({ lapisFilter: lapisFilterSchema });
|
|
21
22
|
const locationFilterPropsSchema = locationFilterInnerPropsSchema.extend({
|
|
@@ -39,7 +40,13 @@ export const LocationFilter: FunctionComponent<LocationFilterProps> = (props) =>
|
|
|
39
40
|
);
|
|
40
41
|
};
|
|
41
42
|
|
|
42
|
-
export const LocationFilterInner = ({
|
|
43
|
+
export const LocationFilterInner = ({
|
|
44
|
+
value,
|
|
45
|
+
fields,
|
|
46
|
+
placeholderText,
|
|
47
|
+
lapisFilter,
|
|
48
|
+
hideCounts,
|
|
49
|
+
}: LocationFilterInnerProps) => {
|
|
43
50
|
const lapis = useLapisUrl();
|
|
44
51
|
|
|
45
52
|
const { data, error, isLoading } = useQuery(
|
|
@@ -54,7 +61,15 @@ export const LocationFilterInner = ({ value, fields, placeholderText, lapisFilte
|
|
|
54
61
|
throw error;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
|
-
return
|
|
64
|
+
return (
|
|
65
|
+
<LocationSelector
|
|
66
|
+
fields={fields}
|
|
67
|
+
value={value}
|
|
68
|
+
placeholderText={placeholderText}
|
|
69
|
+
locationData={data}
|
|
70
|
+
hideCounts={hideCounts}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
58
73
|
};
|
|
59
74
|
|
|
60
75
|
type SelectItem = {
|
|
@@ -69,6 +84,7 @@ const LocationSelector = ({
|
|
|
69
84
|
value,
|
|
70
85
|
placeholderText,
|
|
71
86
|
locationData,
|
|
87
|
+
hideCounts = false,
|
|
72
88
|
}: LocationSelectorProps & {
|
|
73
89
|
locationData: LocationEntry[];
|
|
74
90
|
}) => {
|
|
@@ -96,7 +112,7 @@ const LocationSelector = ({
|
|
|
96
112
|
<>
|
|
97
113
|
<p>
|
|
98
114
|
<span>{item.label}</span>
|
|
99
|
-
<span className='ml-2 text-gray-500'>({item.count})</span>
|
|
115
|
+
{!hideCounts && <span className='ml-2 text-gray-500'>({item.count})</span>}
|
|
100
116
|
</p>
|
|
101
117
|
<span className='text-sm text-gray-500'>{item.description}</span>
|
|
102
118
|
</>
|