@genspectrum/dashboard-components 0.18.4 → 0.18.6
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/README.md +12 -0
- package/custom-elements.json +1 -1
- package/dist/components.d.ts +44 -44
- package/dist/components.js +826 -343
- package/dist/components.js.map +1 -1
- package/dist/style.css +2 -2
- package/dist/util.d.ts +44 -44
- package/package.json +2 -2
- package/src/preact/MutationAnnotationsContext.tsx +34 -27
- package/src/preact/components/dropdown.tsx +1 -1
- package/src/preact/components/info.tsx +1 -1
- package/src/preact/components/mutations-over-time-text-filter.stories.tsx +57 -0
- package/src/preact/components/mutations-over-time-text-filter.tsx +63 -0
- package/src/preact/components/segment-selector.stories.tsx +12 -5
- package/src/preact/components/segment-selector.tsx +11 -7
- package/src/preact/mutationComparison/mutation-comparison.tsx +5 -1
- package/src/preact/mutationFilter/mutation-filter.stories.tsx +169 -50
- package/src/preact/mutationFilter/mutation-filter.tsx +239 -234
- package/src/preact/mutationFilter/parseAndValidateMutation.ts +62 -10
- package/src/preact/mutationFilter/parseMutation.spec.ts +62 -47
- package/src/preact/mutations/mutations.tsx +5 -1
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +128 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +39 -2
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +9 -12
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +27 -0
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +31 -6
- package/src/preact/sequencesByLocation/__mockData__/worldAtlas.json +1 -1
- package/src/preact/shared/tanstackTable/pagination-context.tsx +30 -0
- package/src/preact/shared/tanstackTable/pagination.tsx +41 -21
- package/src/preact/shared/tanstackTable/tanstackTable.tsx +17 -3
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +22 -4
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +11 -2
- package/src/web-components/input/gs-mutation-filter.stories.ts +4 -4
- package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +1 -1
- package/standalone-bundle/dashboard-components.js +12896 -13334
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/standalone-bundle/style.css +1 -1
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { type Deletion, type Substitution } from '../../utils/mutations';
|
|
20
20
|
import { toTemporalClass } from '../../utils/temporalClass';
|
|
21
21
|
import { useLapisUrl } from '../LapisUrlContext';
|
|
22
|
+
import { useMutationAnnotationsProvider } from '../MutationAnnotationsContext';
|
|
22
23
|
import { type ColorScale } from '../components/color-scale-selector';
|
|
23
24
|
import { ColorScaleSelectorDropdown } from '../components/color-scale-selector-dropdown';
|
|
24
25
|
import { CsvDownloadButton } from '../components/csv-download-button';
|
|
@@ -27,6 +28,7 @@ import { Fullscreen } from '../components/fullscreen';
|
|
|
27
28
|
import Info, { InfoComponentCode, InfoHeadline1, InfoParagraph } from '../components/info';
|
|
28
29
|
import { LoadingDisplay } from '../components/loading-display';
|
|
29
30
|
import { type DisplayedMutationType, MutationTypeSelector } from '../components/mutation-type-selector';
|
|
31
|
+
import { MutationsOverTimeTextFilter } from '../components/mutations-over-time-text-filter';
|
|
30
32
|
import { NoDataDisplay } from '../components/no-data-display';
|
|
31
33
|
import type { ProportionInterval } from '../components/proportion-selector';
|
|
32
34
|
import { ProportionSelectorDropdown } from '../components/proportion-selector-dropdown';
|
|
@@ -34,6 +36,7 @@ import { ResizeContainer } from '../components/resize-container';
|
|
|
34
36
|
import { type DisplayedSegment, SegmentSelector, useDisplayedSegments } from '../components/segment-selector';
|
|
35
37
|
import Tabs from '../components/tabs';
|
|
36
38
|
import { pageSizesSchema } from '../shared/tanstackTable/pagination';
|
|
39
|
+
import { PageSizeContextProvider } from '../shared/tanstackTable/pagination-context';
|
|
37
40
|
import { useWebWorker } from '../webWorkers/useWebWorker';
|
|
38
41
|
|
|
39
42
|
const mutationsOverTimeViewSchema = z.literal(views.grid);
|
|
@@ -123,6 +126,9 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
123
126
|
originalComponentProps,
|
|
124
127
|
overallMutationData,
|
|
125
128
|
}) => {
|
|
129
|
+
const [mutationFilterValue, setMutationFilterValue] = useState('');
|
|
130
|
+
const annotationProvider = useMutationAnnotationsProvider();
|
|
131
|
+
|
|
126
132
|
const [proportionInterval, setProportionInterval] = useState(originalComponentProps.initialMeanProportionInterval);
|
|
127
133
|
const [colorScale, setColorScale] = useState<ColorScale>({ min: 0, max: 1, color: 'indigo' });
|
|
128
134
|
|
|
@@ -132,8 +138,6 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
132
138
|
{ label: 'Deletions', checked: true, type: 'deletion' },
|
|
133
139
|
]);
|
|
134
140
|
|
|
135
|
-
const displayMutations = originalComponentProps.displayMutations;
|
|
136
|
-
|
|
137
141
|
const filteredData = useMemo(() => {
|
|
138
142
|
return getFilteredMutationOverTimeData({
|
|
139
143
|
data: mutationOverTimeData,
|
|
@@ -141,7 +145,10 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
141
145
|
displayedSegments,
|
|
142
146
|
displayedMutationTypes,
|
|
143
147
|
proportionInterval,
|
|
144
|
-
displayMutations,
|
|
148
|
+
displayMutations: originalComponentProps.displayMutations,
|
|
149
|
+
mutationFilterValue,
|
|
150
|
+
sequenceType: originalComponentProps.sequenceType,
|
|
151
|
+
annotationProvider,
|
|
145
152
|
});
|
|
146
153
|
}, [
|
|
147
154
|
mutationOverTimeData,
|
|
@@ -149,7 +156,10 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
149
156
|
displayedSegments,
|
|
150
157
|
displayedMutationTypes,
|
|
151
158
|
proportionInterval,
|
|
152
|
-
displayMutations,
|
|
159
|
+
originalComponentProps.displayMutations,
|
|
160
|
+
originalComponentProps.sequenceType,
|
|
161
|
+
mutationFilterValue,
|
|
162
|
+
annotationProvider,
|
|
153
163
|
]);
|
|
154
164
|
|
|
155
165
|
const getTab = (view: MutationsOverTimeView) => {
|
|
@@ -190,10 +200,16 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
190
200
|
colorScale={colorScale}
|
|
191
201
|
setColorScale={setColorScale}
|
|
192
202
|
originalComponentProps={originalComponentProps}
|
|
203
|
+
setFilterValue={setMutationFilterValue}
|
|
204
|
+
mutationFilterValue={mutationFilterValue}
|
|
193
205
|
/>
|
|
194
206
|
);
|
|
195
207
|
|
|
196
|
-
return
|
|
208
|
+
return (
|
|
209
|
+
<PageSizeContextProvider pageSizes={originalComponentProps.pageSizes}>
|
|
210
|
+
<Tabs tabs={tabs} toolbar={toolbar} />
|
|
211
|
+
</PageSizeContextProvider>
|
|
212
|
+
);
|
|
197
213
|
};
|
|
198
214
|
|
|
199
215
|
type ToolbarProps = {
|
|
@@ -208,6 +224,8 @@ type ToolbarProps = {
|
|
|
208
224
|
colorScale: ColorScale;
|
|
209
225
|
setColorScale: Dispatch<StateUpdater<ColorScale>>;
|
|
210
226
|
originalComponentProps: MutationsOverTimeProps;
|
|
227
|
+
mutationFilterValue: string;
|
|
228
|
+
setFilterValue: (filterValue: string) => void;
|
|
211
229
|
};
|
|
212
230
|
|
|
213
231
|
const Toolbar: FunctionComponent<ToolbarProps> = ({
|
|
@@ -222,13 +240,20 @@ const Toolbar: FunctionComponent<ToolbarProps> = ({
|
|
|
222
240
|
colorScale,
|
|
223
241
|
setColorScale,
|
|
224
242
|
originalComponentProps,
|
|
243
|
+
setFilterValue,
|
|
244
|
+
mutationFilterValue,
|
|
225
245
|
}) => {
|
|
226
246
|
return (
|
|
227
247
|
<>
|
|
248
|
+
<MutationsOverTimeTextFilter setFilterValue={setFilterValue} value={mutationFilterValue} />
|
|
228
249
|
{activeTab === 'Grid' && (
|
|
229
250
|
<ColorScaleSelectorDropdown colorScale={colorScale} setColorScale={setColorScale} />
|
|
230
251
|
)}
|
|
231
|
-
<SegmentSelector
|
|
252
|
+
<SegmentSelector
|
|
253
|
+
displayedSegments={displayedSegments}
|
|
254
|
+
setDisplayedSegments={setDisplayedSegments}
|
|
255
|
+
sequenceType={originalComponentProps.sequenceType}
|
|
256
|
+
/>
|
|
232
257
|
<MutationTypeSelector
|
|
233
258
|
setDisplayedMutationTypes={setDisplayedMutationTypes}
|
|
234
259
|
displayedMutationTypes={displayedMutationTypes}
|