@genspectrum/dashboard-components 1.0.1 → 1.2.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 +2 -2
- package/dist/{NumberRangeFilterChangedEvent-B64OQZjX.js → NumberRangeFilterChangedEvent-CQ32Qy8D.js} +2 -2
- package/dist/NumberRangeFilterChangedEvent-CQ32Qy8D.js.map +1 -0
- package/dist/assets/mutationOverTimeWorker-DpW4YOGl.js.map +1 -0
- package/dist/components.d.ts +29 -29
- package/dist/components.js +186 -145
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +29 -29
- package/dist/util.js +1 -1
- package/package.json +7 -3
- package/src/lapisApi/lapisApi.ts +2 -2
- package/src/operator/DivisionOperator.ts +4 -2
- package/src/operator/FetchDetailsOperator.ts +1 -1
- package/src/operator/RenameFieldOperator.ts +3 -3
- package/src/preact/MutationAnnotationsContext.tsx +15 -7
- package/src/preact/aggregatedData/aggregate.tsx +0 -5
- package/src/preact/components/annotated-mutation.tsx +0 -1
- package/src/preact/components/clearable-select.stories.tsx +1 -1
- package/src/preact/components/confidence-interval-selector.tsx +1 -1
- package/src/preact/components/error-boundary.tsx +1 -5
- package/src/preact/components/error-display.tsx +1 -1
- package/src/preact/components/fullscreen.tsx +2 -5
- package/src/preact/components/info.stories.tsx +1 -1
- package/src/preact/components/min-max-range-slider.tsx +1 -1
- package/src/preact/components/mutations-over-time-mutations-filter.stories.tsx +109 -0
- package/src/preact/components/mutations-over-time-mutations-filter.tsx +139 -0
- package/src/preact/components/proportion-selector.tsx +4 -4
- package/src/preact/components/select.tsx +1 -1
- package/src/preact/components/table.tsx +1 -1
- package/src/preact/components/tabs.tsx +1 -1
- package/src/preact/components/tooltip.stories.tsx +1 -1
- package/src/preact/components/tooltip.tsx +1 -1
- package/src/preact/genomeViewer/CDSPlot.tsx +3 -3
- package/src/preact/genomeViewer/loadGff3.ts +5 -8
- package/src/preact/lineageFilter/lineage-filter.tsx +1 -1
- package/src/preact/locationFilter/location-filter.tsx +4 -4
- package/src/preact/mutationComparison/getMutationComparisonTableData.ts +1 -3
- package/src/preact/mutationComparison/mutation-comparison-venn.tsx +1 -1
- package/src/preact/mutationComparison/mutation-comparison.tsx +0 -5
- package/src/preact/mutationFilter/mutation-filter-info.tsx +2 -2
- package/src/preact/mutationFilter/mutation-filter.tsx +1 -1
- package/src/preact/mutations/getMutationsGridData.ts +2 -6
- package/src/preact/mutations/getMutationsTableData.ts +1 -1
- package/src/preact/mutations/mutations-grid.tsx +1 -1
- package/src/preact/mutations/mutations.tsx +0 -5
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +27 -16
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +45 -11
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +16 -15
- package/src/preact/numberRangeFilter/number-range-filter.tsx +4 -4
- package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.ts +1 -4
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +0 -5
- package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +1 -1
- package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +1 -1
- package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +1 -1
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +1 -1
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +5 -5
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +1 -4
- package/src/preact/sequencesByLocation/loadMapSource.tsx +5 -2
- package/src/preact/shared/aspectRatio/AspectRatio.tsx +1 -1
- package/src/preact/shared/floating-ui/hooks.ts +2 -2
- package/src/preact/shared/sort/sortMutationPositions.ts +2 -2
- package/src/preact/shared/tanstackTable/pagination.tsx +2 -2
- package/src/preact/shared/tanstackTable/tanstackTable.tsx +1 -1
- package/src/preact/statistic/statistics.tsx +0 -5
- package/src/preact/textFilter/fetchStringAutocompleteList.ts +1 -10
- package/src/preact/textFilter/text-filter.tsx +1 -6
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +14 -8
- package/src/preact/webWorkers/useWebWorker.ts +2 -1
- package/src/preact/webWorkers/workerFunction.ts +2 -2
- package/src/query/computeMapLocationData.ts +1 -1
- package/src/query/queryAggregatedDataOverTime.ts +3 -3
- package/src/query/queryMutationsOverTime.spec.ts +9 -9
- package/src/query/queryMutationsOverTime.ts +22 -16
- package/src/query/queryRelativeGrowthAdvantage.ts +5 -9
- package/src/query/queryWastewaterMutationsOverTime.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/mutations.ts +10 -10
- package/src/utils/type-utils.ts +1 -1
- package/src/utils/typeAssertions.spec.ts +1 -1
- package/src/web-components/gs-app.spec-d.ts +1 -1
- package/src/web-components/gs-app.stories.ts +1 -1
- package/src/web-components/input/gs-date-range-filter.tsx +2 -2
- package/src/web-components/input/gs-lineage-filter.tsx +2 -2
- package/src/web-components/input/gs-location-filter.tsx +3 -3
- package/src/web-components/input/gs-mutation-filter.tsx +2 -2
- package/src/web-components/input/gs-number-range-filter.spec.ts +1 -1
- package/src/web-components/input/gs-text-filter.tsx +2 -2
- package/src/web-components/visualization/gs-aggregate.tsx +2 -2
- package/src/web-components/visualization/gs-genome-data-viewer.spec-d.ts +1 -1
- package/src/web-components/visualization/gs-mutation-comparison.tsx +2 -2
- package/src/web-components/visualization/gs-mutations.tsx +2 -2
- package/src/web-components/visualization/gs-number-sequences-over-time.tsx +2 -2
- package/src/web-components/visualization/gs-prevalence-over-time.tsx +2 -2
- package/src/web-components/visualization/gs-relative-growth-advantage.tsx +2 -2
- package/src/web-components/visualization/gs-sequences-by-location.tsx +2 -2
- package/src/web-components/visualization/gs-statistics.tsx +2 -2
- package/standalone-bundle/assets/mutationOverTimeWorker-CZVvQBze.js.map +1 -0
- package/standalone-bundle/dashboard-components.js +3989 -3923
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/dist/NumberRangeFilterChangedEvent-B64OQZjX.js.map +0 -1
- package/dist/assets/mutationOverTimeWorker-DjH04AQB.js.map +0 -1
- package/src/preact/components/mutations-over-time-text-filter.stories.tsx +0 -57
- package/src/preact/components/mutations-over-time-text-filter.tsx +0 -63
- package/standalone-bundle/assets/mutationOverTimeWorker-B6bf3R3j.js.map +0 -1
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { type StoryObj } from '@storybook/preact';
|
|
2
|
-
import { expect, fn, userEvent, waitFor, within } from '@storybook/test';
|
|
3
|
-
import { type Meta } from '@storybook/web-components';
|
|
4
|
-
import { useState } from 'preact/hooks';
|
|
5
|
-
|
|
6
|
-
import { MutationsOverTimeTextFilter, type TextFilterProps } from './mutations-over-time-text-filter';
|
|
7
|
-
|
|
8
|
-
const meta: Meta = {
|
|
9
|
-
title: 'Component/Mutations over time text filter',
|
|
10
|
-
component: 'MutationsOverTimeTextFilter',
|
|
11
|
-
parameters: { fetchMock: {} },
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default meta;
|
|
15
|
-
|
|
16
|
-
const WrapperWithState = ({ setFilterValue, value }: { setFilterValue: (value: string) => void; value: string }) => {
|
|
17
|
-
const [state, setState] = useState(value);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<MutationsOverTimeTextFilter
|
|
21
|
-
setFilterValue={(value) => {
|
|
22
|
-
setFilterValue(value);
|
|
23
|
-
setState(value);
|
|
24
|
-
}}
|
|
25
|
-
value={state}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const MutationsOverTimeTextFilterStory: StoryObj<TextFilterProps> = {
|
|
31
|
-
render: (args) => {
|
|
32
|
-
return <WrapperWithState setFilterValue={args.setFilterValue} value={args.value} />;
|
|
33
|
-
},
|
|
34
|
-
args: {
|
|
35
|
-
setFilterValue: fn(),
|
|
36
|
-
value: 'Test',
|
|
37
|
-
},
|
|
38
|
-
play: async ({ canvasElement, step }) => {
|
|
39
|
-
const canvas = within(canvasElement);
|
|
40
|
-
|
|
41
|
-
await step('Expect initial value to show on the button', async () => {
|
|
42
|
-
const button = canvas.getByRole('button');
|
|
43
|
-
await expect(button).toHaveTextContent('Test');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
await step('Change filter and expect it to show on the button', async () => {
|
|
47
|
-
const button = canvas.getByRole('button');
|
|
48
|
-
await userEvent.click(button);
|
|
49
|
-
|
|
50
|
-
const inputField = canvas.getByRole('textbox');
|
|
51
|
-
await userEvent.clear(inputField);
|
|
52
|
-
await userEvent.type(inputField, 'OtherText');
|
|
53
|
-
|
|
54
|
-
await waitFor(() => expect(button).toHaveTextContent('OtherText'));
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { h } from 'preact';
|
|
2
|
-
import { useCallback, useEffect, useState } from 'preact/hooks';
|
|
3
|
-
|
|
4
|
-
import { Dropdown } from './dropdown';
|
|
5
|
-
import { DeleteIcon } from '../shared/icons/DeleteIcon';
|
|
6
|
-
|
|
7
|
-
export type TextFilterProps = { setFilterValue: (newValue: string) => void; value: string };
|
|
8
|
-
|
|
9
|
-
export function MutationsOverTimeTextFilter({ setFilterValue, value }: TextFilterProps) {
|
|
10
|
-
const onInput = (newValue: string) => {
|
|
11
|
-
setFilterValue(newValue);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const onDeleteClick = () => setFilterValue('');
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div className={'w-28 inline-flex'}>
|
|
18
|
-
<Dropdown buttonTitle={value === '' ? `Filter mutations` : value} placement={'bottom-start'}>
|
|
19
|
-
<div>
|
|
20
|
-
<label className='flex gap-1 input input-xs'>
|
|
21
|
-
<DebouncedInput placeholder={'Filter'} onInput={onInput} value={value} type='text' />
|
|
22
|
-
{value !== undefined && value !== '' && (
|
|
23
|
-
<button className={'cursor-pointer'} onClick={onDeleteClick}>
|
|
24
|
-
<DeleteIcon />
|
|
25
|
-
</button>
|
|
26
|
-
)}
|
|
27
|
-
</label>
|
|
28
|
-
</div>
|
|
29
|
-
</Dropdown>
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function DebouncedInput({
|
|
35
|
-
value: initialValue,
|
|
36
|
-
onInput,
|
|
37
|
-
debounce = 500,
|
|
38
|
-
...props
|
|
39
|
-
}: {
|
|
40
|
-
onInput: (value: string) => void;
|
|
41
|
-
debounce?: number;
|
|
42
|
-
value?: string;
|
|
43
|
-
} & Omit<h.JSX.IntrinsicElements['input'], 'onInput'>) {
|
|
44
|
-
const [value, setValue] = useState<string | undefined>(initialValue);
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
setValue(initialValue);
|
|
48
|
-
}, [initialValue]);
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
const timeout = setTimeout(() => {
|
|
52
|
-
onInput(value ?? '');
|
|
53
|
-
}, debounce);
|
|
54
|
-
|
|
55
|
-
return () => clearTimeout(timeout);
|
|
56
|
-
}, [value, debounce, onInput]);
|
|
57
|
-
|
|
58
|
-
const onChangeInput = useCallback((event: h.JSX.TargetedEvent<HTMLInputElement>) => {
|
|
59
|
-
setValue(event.currentTarget.value);
|
|
60
|
-
}, []);
|
|
61
|
-
|
|
62
|
-
return <input {...props} value={value} onInput={onChangeInput} />;
|
|
63
|
-
}
|