@genspectrum/dashboard-components 0.18.3 → 0.18.5
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/dist/components.d.ts +279 -0
- package/dist/components.js +63 -30
- package/dist/components.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/util.d.ts +279 -0
- package/package.json +2 -2
- 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/mutations/mutations.tsx +5 -1
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +1 -1
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +5 -1
- package/src/preact/sequencesByLocation/__mockData__/worldAtlas.json +1 -1
- package/src/preact/shared/tanstackTable/pagination.tsx +24 -17
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +3 -3
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +5 -1
- package/standalone-bundle/dashboard-components.js +1999 -1967
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/standalone-bundle/style.css +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Table } from '@tanstack/table-core';
|
|
2
|
-
import z from 'zod';
|
|
2
|
+
import z from 'zod'; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
5
|
type PaginationProps = { table: Table<any> };
|
|
@@ -13,11 +13,15 @@ export function Pagination({
|
|
|
13
13
|
pageSizes: PageSizes;
|
|
14
14
|
}) {
|
|
15
15
|
return (
|
|
16
|
-
<div className='
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
<div className='@container'>
|
|
17
|
+
<div className='flex items-center gap-x-6 gap-y-2 flex-wrap @xl:justify-end justify-center'>
|
|
18
|
+
<PageSizeSelector table={table} pageSizes={pageSizes} />
|
|
19
|
+
<PageIndicator table={table} />
|
|
20
|
+
<div className='@xl:block hidden'>
|
|
21
|
+
<GotoPageSelector table={table} />
|
|
22
|
+
</div>
|
|
23
|
+
<SelectPageButtons table={table} />
|
|
24
|
+
</div>
|
|
21
25
|
</div>
|
|
22
26
|
);
|
|
23
27
|
}
|
|
@@ -27,16 +31,19 @@ function PageIndicator({ table }: PaginationProps) {
|
|
|
27
31
|
return null;
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
const minRow = table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1;
|
|
35
|
+
const maxRow = minRow + table.getRowModel().rows.length - 1;
|
|
36
|
+
const numRows = table.getCoreRowModel().rows.length;
|
|
37
|
+
|
|
30
38
|
return (
|
|
31
|
-
<span className='
|
|
32
|
-
|
|
33
|
-
<strong>
|
|
34
|
-
{table.getState().pagination.pageIndex + 1} of {table.getPageCount().toLocaleString()}
|
|
35
|
-
</strong>
|
|
39
|
+
<span className='text-sm'>
|
|
40
|
+
{minRow} - {maxRow} of {numRows}
|
|
36
41
|
</span>
|
|
37
42
|
);
|
|
38
43
|
}
|
|
39
44
|
|
|
45
|
+
const heightForSmallerLines = 'h-[calc(var(--size)*0.7)]';
|
|
46
|
+
|
|
40
47
|
function PageSizeSelector({
|
|
41
48
|
table,
|
|
42
49
|
pageSizes,
|
|
@@ -48,10 +55,10 @@ function PageSizeSelector({
|
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
return (
|
|
51
|
-
<label className='flex items-center
|
|
52
|
-
<div className={'text-nowrap'}>Rows per page:</div>
|
|
58
|
+
<label className='flex items-center'>
|
|
59
|
+
<div className={'text-nowrap text-sm'}>Rows per page:</div>
|
|
53
60
|
<select
|
|
54
|
-
className={
|
|
61
|
+
className={`select select-ghost select-sm ${heightForSmallerLines}`}
|
|
55
62
|
value={table.getState().pagination.pageSize}
|
|
56
63
|
onChange={(e) => {
|
|
57
64
|
table.setPageSize(Number(e.currentTarget?.value));
|
|
@@ -74,8 +81,8 @@ function GotoPageSelector({ table }: PaginationProps) {
|
|
|
74
81
|
}
|
|
75
82
|
|
|
76
83
|
return (
|
|
77
|
-
<label className='
|
|
78
|
-
Go to page
|
|
84
|
+
<label className='items-center flex'>
|
|
85
|
+
<span className='text-nowrap text-sm'>Go to page:</span>
|
|
79
86
|
<input
|
|
80
87
|
type='number'
|
|
81
88
|
min='1'
|
|
@@ -85,7 +92,7 @@ function GotoPageSelector({ table }: PaginationProps) {
|
|
|
85
92
|
const page = e.currentTarget.value ? Number(e.currentTarget.value) - 1 : 0;
|
|
86
93
|
table.setPageIndex(page);
|
|
87
94
|
}}
|
|
88
|
-
className=
|
|
95
|
+
className={`input input-ghost input-sm ${heightForSmallerLines}`}
|
|
89
96
|
aria-label='Enter page number to go to'
|
|
90
97
|
/>
|
|
91
98
|
</label>
|
|
@@ -75,11 +75,11 @@ export const AminoAcids: StoryObj<WastewaterMutationsOverTimeProps> = {
|
|
|
75
75
|
},
|
|
76
76
|
play: async ({ canvas, step }) => {
|
|
77
77
|
await step('Wait for component to render', async () => {
|
|
78
|
-
await canvas.findByText('All
|
|
78
|
+
await canvas.findByText('All genes');
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
await step("Click 'All
|
|
82
|
-
canvas.getByRole('button', { name: 'All
|
|
81
|
+
await step("Click 'All genes' button", async () => {
|
|
82
|
+
canvas.getByRole('button', { name: 'All genes' }).click();
|
|
83
83
|
await expect(canvas.getByText('Select none')).toBeInTheDocument();
|
|
84
84
|
canvas.getByRole('button', { name: 'Select none' }).click();
|
|
85
85
|
await canvas.findAllByText('No data available for your filters.');
|
|
@@ -183,7 +183,11 @@ const Toolbar: FunctionComponent<ToolbarProps> = ({
|
|
|
183
183
|
return (
|
|
184
184
|
<>
|
|
185
185
|
<ColorScaleSelectorDropdown colorScale={colorScale} setColorScale={setColorScale} />
|
|
186
|
-
<SegmentSelector
|
|
186
|
+
<SegmentSelector
|
|
187
|
+
displayedSegments={displayedSegments}
|
|
188
|
+
setDisplayedSegments={setDisplayedSegments}
|
|
189
|
+
sequenceType={originalComponentProps.sequenceType}
|
|
190
|
+
/>
|
|
187
191
|
<WastewaterMutationsOverTimeInfo originalComponentProps={originalComponentProps} />
|
|
188
192
|
<Fullscreen />
|
|
189
193
|
</>
|