@genspectrum/dashboard-components 1.10.3 → 1.11.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 +38 -3
- package/dist/components.d.ts +61 -53
- package/dist/components.js +83 -56
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +66 -53
- package/package.json +1 -1
- package/src/preact/mutationsOverTime/mutations-over-time-grid-tooltip.stories.tsx +15 -10
- package/src/preact/mutationsOverTime/mutations-over-time-grid-tooltip.tsx +49 -43
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +34 -6
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +27 -0
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +3 -1
- package/src/utilEntrypoint.ts +1 -0
- package/src/web-components/input/gs-lineage-filter.stories.ts +9 -1
- package/src/web-components/visualization/gs-mutations-over-time.spec-d.ts +3 -0
- package/src/web-components/visualization/gs-mutations-over-time.stories.ts +21 -0
- package/src/web-components/visualization/gs-mutations-over-time.tsx +8 -0
- package/standalone-bundle/dashboard-components.js +1225 -1204
- package/standalone-bundle/dashboard-components.js.map +1 -1
|
@@ -17,7 +17,7 @@ import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
|
17
17
|
const codeExample = String.raw`
|
|
18
18
|
<gs-lineage-filter
|
|
19
19
|
lapisField="pangoLineage"
|
|
20
|
-
lapisFilter='{"
|
|
20
|
+
lapisFilter='{"country": "Germany"}'
|
|
21
21
|
placeholderText="Enter lineage"
|
|
22
22
|
value="B.1.1.7"
|
|
23
23
|
width="50%">
|
|
@@ -163,6 +163,7 @@ export const LineageFilterStringValue: StoryObj<Required<LineageFilterProps>> =
|
|
|
163
163
|
lapisField="pangoLineage"
|
|
164
164
|
placeholderText="Enter a lineage"
|
|
165
165
|
value="B.1.1.7"
|
|
166
|
+
.lapisFilter=${args.lapisFilter}
|
|
166
167
|
.multiSelect=${args.multiSelect}
|
|
167
168
|
></gs-lineage-filter>
|
|
168
169
|
</div>
|
|
@@ -170,6 +171,9 @@ export const LineageFilterStringValue: StoryObj<Required<LineageFilterProps>> =
|
|
|
170
171
|
},
|
|
171
172
|
args: {
|
|
172
173
|
multiSelect: false,
|
|
174
|
+
lapisFilter: {
|
|
175
|
+
country: 'Germany',
|
|
176
|
+
},
|
|
173
177
|
},
|
|
174
178
|
play: async ({ canvasElement }) => {
|
|
175
179
|
const canvas = await withinShadowRoot(canvasElement, 'gs-lineage-filter');
|
|
@@ -187,6 +191,7 @@ export const LineageFilterArrayValue: StoryObj<Required<LineageFilterProps>> = {
|
|
|
187
191
|
lapisField="pangoLineage"
|
|
188
192
|
placeholderText="Enter a lineage"
|
|
189
193
|
value='["B.1.1.7", "B.1.1.10"]'
|
|
194
|
+
.lapisFilter=${args.lapisFilter}
|
|
190
195
|
.multiSelect=${args.multiSelect}
|
|
191
196
|
></gs-lineage-filter>
|
|
192
197
|
</div>
|
|
@@ -194,6 +199,9 @@ export const LineageFilterArrayValue: StoryObj<Required<LineageFilterProps>> = {
|
|
|
194
199
|
},
|
|
195
200
|
args: {
|
|
196
201
|
multiSelect: true,
|
|
202
|
+
lapisFilter: {
|
|
203
|
+
country: 'Germany',
|
|
204
|
+
},
|
|
197
205
|
},
|
|
198
206
|
play: async ({ canvasElement }) => {
|
|
199
207
|
const canvas = await withinShadowRoot(canvasElement, 'gs-lineage-filter');
|
|
@@ -38,5 +38,8 @@ describe('gs-mutations-over-time', () => {
|
|
|
38
38
|
expectTypeOf<typeof MutationsOverTimeComponent.prototype.pageSizes>().toEqualTypeOf<
|
|
39
39
|
MutationsOverTimeProps['pageSizes']
|
|
40
40
|
>();
|
|
41
|
+
expectTypeOf<typeof MutationsOverTimeComponent.prototype.customColumns>().toEqualTypeOf<
|
|
42
|
+
MutationsOverTimeProps['customColumns']
|
|
43
|
+
>();
|
|
41
44
|
});
|
|
42
45
|
});
|
|
@@ -45,6 +45,7 @@ const meta: Meta<Required<MutationsOverTimeProps>> = {
|
|
|
45
45
|
hideGaps: { control: 'boolean' },
|
|
46
46
|
useNewEndpoint: { control: 'boolean' },
|
|
47
47
|
pageSizes: { control: 'object' },
|
|
48
|
+
customColumns: { control: 'object' },
|
|
48
49
|
},
|
|
49
50
|
args: {
|
|
50
51
|
lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-07-10' },
|
|
@@ -116,6 +117,7 @@ const Template: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
|
116
117
|
.hideGaps=${args.hideGaps}
|
|
117
118
|
.pageSizes=${args.pageSizes}
|
|
118
119
|
.useNewEndpoint=${args.useNewEndpoint}
|
|
120
|
+
.customColumns=${args.customColumns}
|
|
119
121
|
></gs-mutations-over-time>
|
|
120
122
|
</gs-app>
|
|
121
123
|
`,
|
|
@@ -183,3 +185,22 @@ export const WithFixedHeight: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
|
183
185
|
height: '700px',
|
|
184
186
|
},
|
|
185
187
|
};
|
|
188
|
+
|
|
189
|
+
// This test uses mock data: withDisplayMutations.ts (through mutationOverTimeWorker.mock.ts)
|
|
190
|
+
export const WithCustomColumns: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
191
|
+
...Template,
|
|
192
|
+
args: {
|
|
193
|
+
...Template.args,
|
|
194
|
+
displayMutations: ['A19722G', 'G21641T', 'T21653-'],
|
|
195
|
+
customColumns: [
|
|
196
|
+
{
|
|
197
|
+
header: 'Jaccard Index',
|
|
198
|
+
values: {
|
|
199
|
+
A19722G: 0.75,
|
|
200
|
+
G21641T: 0.92,
|
|
201
|
+
'T21653-': 0.58,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
};
|
|
@@ -136,6 +136,13 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
|
|
|
136
136
|
@property({ type: Array })
|
|
137
137
|
pageSizes: number[] | number = [10, 20, 30, 40, 50];
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Custom columns to add to the grid.
|
|
141
|
+
* Each column has a header and a map of mutation codes to values.
|
|
142
|
+
*/
|
|
143
|
+
@property({ type: Array })
|
|
144
|
+
customColumns?: { header: string; values: Record<string, string | number> }[] = undefined;
|
|
145
|
+
|
|
139
146
|
/**
|
|
140
147
|
* @internal
|
|
141
148
|
*/
|
|
@@ -165,6 +172,7 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
|
|
|
165
172
|
hideGaps={this.hideGaps}
|
|
166
173
|
useNewEndpoint={this.useNewEndpoint}
|
|
167
174
|
pageSizes={this.pageSizes}
|
|
175
|
+
customColumns={this.customColumns}
|
|
168
176
|
/>
|
|
169
177
|
</MutationLinkTemplateContextProvider>
|
|
170
178
|
</MutationAnnotationsContextProvider>
|