@genspectrum/dashboard-components 0.4.4 → 0.4.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/custom-elements.json +107 -12
- package/dist/dashboard-components.js +186 -145
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +24 -0
- package/package.json +1 -1
- package/src/preact/aggregatedData/aggregate-table.tsx +3 -2
- package/src/preact/aggregatedData/aggregate.stories.tsx +2 -0
- package/src/preact/aggregatedData/aggregate.tsx +8 -3
- package/src/preact/components/table.stories.tsx +51 -1
- package/src/preact/components/table.tsx +4 -3
- package/src/preact/locationFilter/location-filter.stories.tsx +12 -1
- package/src/preact/locationFilter/location-filter.tsx +10 -3
- package/src/preact/mutationComparison/mutation-comparison-table.tsx +7 -2
- package/src/preact/mutationComparison/mutation-comparison.stories.tsx +3 -0
- package/src/preact/mutationComparison/mutation-comparison.tsx +25 -3
- package/src/preact/mutations/mutations-grid.tsx +8 -2
- package/src/preact/mutations/mutations-insertions-table.tsx +3 -2
- package/src/preact/mutations/mutations-table.tsx +3 -2
- package/src/preact/mutations/mutations.stories.tsx +3 -0
- package/src/preact/mutations/mutations.tsx +16 -6
- package/src/preact/prevalenceOverTime/prevalence-over-time-table.tsx +3 -2
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +4 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +8 -1
- package/src/web-components/input/gs-location-filter.stories.ts +11 -0
- package/src/web-components/input/gs-location-filter.tsx +14 -1
- package/src/web-components/visualization/gs-aggregate.stories.ts +4 -0
- package/src/web-components/visualization/gs-aggregate.tsx +8 -0
- package/src/web-components/visualization/gs-mutation-comparison.stories.ts +4 -0
- package/src/web-components/visualization/gs-mutation-comparison.tsx +8 -0
- package/src/web-components/visualization/gs-mutations.stories.ts +4 -0
- package/src/web-components/visualization/gs-mutations.tsx +8 -0
- package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +5 -0
- package/src/web-components/visualization/gs-prevalence-over-time.tsx +12 -4
|
@@ -32,6 +32,7 @@ export default {
|
|
|
32
32
|
width: { control: 'text' },
|
|
33
33
|
height: { control: 'text' },
|
|
34
34
|
headline: { control: 'text' },
|
|
35
|
+
pageSize: { control: 'object' },
|
|
35
36
|
},
|
|
36
37
|
};
|
|
37
38
|
|
|
@@ -49,6 +50,7 @@ const Template = {
|
|
|
49
50
|
height={args.height}
|
|
50
51
|
headline={args.headline}
|
|
51
52
|
lapisDateField={args.lapisDateField}
|
|
53
|
+
pageSize={args.pageSize}
|
|
52
54
|
/>
|
|
53
55
|
</LapisUrlContext.Provider>
|
|
54
56
|
),
|
|
@@ -70,6 +72,7 @@ export const TwoVariants = {
|
|
|
70
72
|
height: '700px',
|
|
71
73
|
headline: 'Prevalence over time',
|
|
72
74
|
lapisDateField: 'date',
|
|
75
|
+
pageSize: 10,
|
|
73
76
|
},
|
|
74
77
|
parameters: {
|
|
75
78
|
fetchMock: {
|
|
@@ -142,6 +145,7 @@ export const OneVariant = {
|
|
|
142
145
|
height: '700px',
|
|
143
146
|
headline: 'Prevalence over time',
|
|
144
147
|
lapisDateField: 'date',
|
|
148
|
+
pageSize: 10,
|
|
145
149
|
},
|
|
146
150
|
parameters: {
|
|
147
151
|
fetchMock: {
|
|
@@ -40,6 +40,7 @@ export interface PrevalenceOverTimeInnerProps {
|
|
|
40
40
|
views: View[];
|
|
41
41
|
confidenceIntervalMethods: ConfidenceIntervalMethod[];
|
|
42
42
|
lapisDateField: string;
|
|
43
|
+
pageSize: boolean | number;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export const PrevalenceOverTime: FunctionComponent<PrevalenceOverTimeProps> = ({
|
|
@@ -53,6 +54,7 @@ export const PrevalenceOverTime: FunctionComponent<PrevalenceOverTimeProps> = ({
|
|
|
53
54
|
height,
|
|
54
55
|
headline = 'Prevalence over time',
|
|
55
56
|
lapisDateField,
|
|
57
|
+
pageSize,
|
|
56
58
|
}) => {
|
|
57
59
|
const size = { height, width };
|
|
58
60
|
|
|
@@ -68,6 +70,7 @@ export const PrevalenceOverTime: FunctionComponent<PrevalenceOverTimeProps> = ({
|
|
|
68
70
|
views={views}
|
|
69
71
|
confidenceIntervalMethods={confidenceIntervalMethods}
|
|
70
72
|
lapisDateField={lapisDateField}
|
|
73
|
+
pageSize={pageSize}
|
|
71
74
|
/>
|
|
72
75
|
</Headline>
|
|
73
76
|
</ResizeContainer>
|
|
@@ -83,6 +86,7 @@ export const PrevalenceOverTimeInner: FunctionComponent<PrevalenceOverTimeInnerP
|
|
|
83
86
|
views,
|
|
84
87
|
confidenceIntervalMethods,
|
|
85
88
|
lapisDateField,
|
|
89
|
+
pageSize,
|
|
86
90
|
}) => {
|
|
87
91
|
const lapis = useContext(LapisUrlContext);
|
|
88
92
|
|
|
@@ -109,6 +113,7 @@ export const PrevalenceOverTimeInner: FunctionComponent<PrevalenceOverTimeInnerP
|
|
|
109
113
|
data={data}
|
|
110
114
|
granularity={granularity}
|
|
111
115
|
confidenceIntervalMethods={confidenceIntervalMethods}
|
|
116
|
+
pageSize={pageSize}
|
|
112
117
|
/>
|
|
113
118
|
);
|
|
114
119
|
};
|
|
@@ -118,6 +123,7 @@ type PrevalenceOverTimeTabsProps = {
|
|
|
118
123
|
data: PrevalenceOverTimeData;
|
|
119
124
|
granularity: TemporalGranularity;
|
|
120
125
|
confidenceIntervalMethods: ConfidenceIntervalMethod[];
|
|
126
|
+
pageSize: boolean | number;
|
|
121
127
|
};
|
|
122
128
|
|
|
123
129
|
const PrevalenceOverTimeTabs: FunctionComponent<PrevalenceOverTimeTabsProps> = ({
|
|
@@ -125,6 +131,7 @@ const PrevalenceOverTimeTabs: FunctionComponent<PrevalenceOverTimeTabsProps> = (
|
|
|
125
131
|
data,
|
|
126
132
|
granularity,
|
|
127
133
|
confidenceIntervalMethods,
|
|
134
|
+
pageSize,
|
|
128
135
|
}) => {
|
|
129
136
|
const [yAxisScaleType, setYAxisScaleType] = useState<ScaleType>('linear');
|
|
130
137
|
const [confidenceIntervalMethod, setConfidenceIntervalMethod] = useState<ConfidenceIntervalMethod>(
|
|
@@ -163,7 +170,7 @@ const PrevalenceOverTimeTabs: FunctionComponent<PrevalenceOverTimeTabsProps> = (
|
|
|
163
170
|
case 'table':
|
|
164
171
|
return {
|
|
165
172
|
title: 'Table',
|
|
166
|
-
content: <PrevalenceOverTimeTable data={data} granularity={granularity} />,
|
|
173
|
+
content: <PrevalenceOverTimeTable data={data} granularity={granularity} pageSize={pageSize} />,
|
|
167
174
|
};
|
|
168
175
|
}
|
|
169
176
|
};
|
|
@@ -17,6 +17,7 @@ const codeExample = String.raw`
|
|
|
17
17
|
fields='["region", "country"]'
|
|
18
18
|
initialValue='Europe / Switzerland'
|
|
19
19
|
width="100%"
|
|
20
|
+
placeholderText="Enter a location"
|
|
20
21
|
></gs-location-filter>`;
|
|
21
22
|
|
|
22
23
|
const meta: Meta = {
|
|
@@ -48,6 +49,11 @@ const meta: Meta = {
|
|
|
48
49
|
type: 'text',
|
|
49
50
|
},
|
|
50
51
|
},
|
|
52
|
+
placeholderText: {
|
|
53
|
+
control: {
|
|
54
|
+
type: 'text',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
51
57
|
},
|
|
52
58
|
decorators: [withActions],
|
|
53
59
|
tags: ['autodocs'],
|
|
@@ -63,6 +69,7 @@ const Template: StoryObj<LocationFilterProps> = {
|
|
|
63
69
|
.fields=${args.fields}
|
|
64
70
|
initialValue=${ifDefined(args.initialValue)}
|
|
65
71
|
.width=${args.width}
|
|
72
|
+
placeholderText=${ifDefined(args.placeholderText)}
|
|
66
73
|
></gs-location-filter>
|
|
67
74
|
</div>
|
|
68
75
|
</gs-app>`;
|
|
@@ -71,6 +78,7 @@ const Template: StoryObj<LocationFilterProps> = {
|
|
|
71
78
|
fields: ['region', 'country', 'division', 'location'],
|
|
72
79
|
initialValue: '',
|
|
73
80
|
width: '100%',
|
|
81
|
+
placeholderText: 'Enter a location',
|
|
74
82
|
},
|
|
75
83
|
};
|
|
76
84
|
|
|
@@ -102,6 +110,9 @@ export const LocationFilter: StoryObj<LocationFilterProps> = {
|
|
|
102
110
|
await waitFor(() => {
|
|
103
111
|
return expect(canvas.getByRole('combobox')).toBeEnabled();
|
|
104
112
|
});
|
|
113
|
+
await waitFor(() => {
|
|
114
|
+
return expect(canvas.getByPlaceholderText('Enter a location')).toBeInTheDocument();
|
|
115
|
+
});
|
|
105
116
|
},
|
|
106
117
|
};
|
|
107
118
|
|
|
@@ -59,8 +59,21 @@ export class LocationFilterComponent extends PreactLitAdapter {
|
|
|
59
59
|
@property({ type: String })
|
|
60
60
|
width: string = '100%';
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* The placeholder text to display in the input field, if it is empty.
|
|
64
|
+
*/
|
|
65
|
+
@property()
|
|
66
|
+
placeholderText: string = '';
|
|
67
|
+
|
|
62
68
|
override render() {
|
|
63
|
-
return
|
|
69
|
+
return (
|
|
70
|
+
<LocationFilter
|
|
71
|
+
initialValue={this.initialValue}
|
|
72
|
+
fields={this.fields}
|
|
73
|
+
width={this.width}
|
|
74
|
+
placeholderText={this.placeholderText}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
79
|
|
|
@@ -19,6 +19,7 @@ const codeExample = `
|
|
|
19
19
|
height='700px'
|
|
20
20
|
initialSortField="count"
|
|
21
21
|
initialSortDirection="descending"
|
|
22
|
+
pageSize="10"
|
|
22
23
|
></gs-aggregate>`;
|
|
23
24
|
|
|
24
25
|
const meta: Meta<Required<AggregateProps>> = {
|
|
@@ -33,6 +34,7 @@ const meta: Meta<Required<AggregateProps>> = {
|
|
|
33
34
|
width: { control: 'text' },
|
|
34
35
|
height: { control: 'text' },
|
|
35
36
|
headline: { control: 'text' },
|
|
37
|
+
pageSize: { control: 'object' },
|
|
36
38
|
initialSortField: { control: 'text' },
|
|
37
39
|
initialSortDirection: {
|
|
38
40
|
options: ['ascending', 'descending'],
|
|
@@ -81,6 +83,7 @@ export const Table: StoryObj<Required<AggregateProps>> = {
|
|
|
81
83
|
.headline=${args.headline}
|
|
82
84
|
.initialSortField=${args.initialSortField}
|
|
83
85
|
.initialSortDirection=${args.initialSortDirection}
|
|
86
|
+
.pageSize=${args.pageSize}
|
|
84
87
|
></gs-aggregate>
|
|
85
88
|
</gs-app>
|
|
86
89
|
`,
|
|
@@ -95,5 +98,6 @@ export const Table: StoryObj<Required<AggregateProps>> = {
|
|
|
95
98
|
headline: 'Aggregate',
|
|
96
99
|
initialSortField: 'count',
|
|
97
100
|
initialSortDirection: 'descending',
|
|
101
|
+
pageSize: 10,
|
|
98
102
|
},
|
|
99
103
|
};
|
|
@@ -80,6 +80,13 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
80
80
|
@property({ type: String })
|
|
81
81
|
initialSortDirection: 'ascending' | 'descending' = 'descending';
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The maximum number of rows to display in the table view.
|
|
85
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
86
|
+
*/
|
|
87
|
+
@property({ type: Object })
|
|
88
|
+
pageSize: boolean | number = false;
|
|
89
|
+
|
|
83
90
|
override render() {
|
|
84
91
|
return (
|
|
85
92
|
<Aggregate
|
|
@@ -91,6 +98,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
91
98
|
headline={this.headline}
|
|
92
99
|
initialSortField={this.initialSortField}
|
|
93
100
|
initialSortDirection={this.initialSortDirection}
|
|
101
|
+
pageSize={this.pageSize}
|
|
94
102
|
/>
|
|
95
103
|
);
|
|
96
104
|
}
|
|
@@ -19,6 +19,7 @@ const codeExample = String.raw`
|
|
|
19
19
|
headline="Mutation comparison"
|
|
20
20
|
width='100%'
|
|
21
21
|
height='700px'
|
|
22
|
+
pageSize="10"
|
|
22
23
|
></gs-mutation-comparison>`;
|
|
23
24
|
|
|
24
25
|
const meta: Meta<Required<MutationComparisonProps>> = {
|
|
@@ -37,6 +38,7 @@ const meta: Meta<Required<MutationComparisonProps>> = {
|
|
|
37
38
|
width: { control: 'text' },
|
|
38
39
|
height: { control: 'text' },
|
|
39
40
|
headline: { control: 'text' },
|
|
41
|
+
pageSize: { control: 'object' },
|
|
40
42
|
},
|
|
41
43
|
parameters: withComponentDocs({
|
|
42
44
|
componentDocs: {
|
|
@@ -60,6 +62,7 @@ const Template: StoryObj<Required<MutationComparisonProps>> = {
|
|
|
60
62
|
.width=${args.width}
|
|
61
63
|
.height=${args.height}
|
|
62
64
|
.headline=${args.headline}
|
|
65
|
+
.pageSize=${args.pageSize}
|
|
63
66
|
></gs-mutation-comparison>
|
|
64
67
|
</gs-app>
|
|
65
68
|
`,
|
|
@@ -91,6 +94,7 @@ export const Default: StoryObj<Required<MutationComparisonProps>> = {
|
|
|
91
94
|
width: '100%',
|
|
92
95
|
height: '700px',
|
|
93
96
|
headline: 'Mutation comparison',
|
|
97
|
+
pageSize: 10,
|
|
94
98
|
},
|
|
95
99
|
parameters: {
|
|
96
100
|
fetchMock: {
|
|
@@ -82,6 +82,13 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
82
82
|
@property({ type: String })
|
|
83
83
|
headline: string = 'Mutation comparison';
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* The maximum number of rows to display in the table view.
|
|
87
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
88
|
+
*/
|
|
89
|
+
@property({ type: Object })
|
|
90
|
+
pageSize: boolean | number = false;
|
|
91
|
+
|
|
85
92
|
override render() {
|
|
86
93
|
return (
|
|
87
94
|
<MutationComparison
|
|
@@ -91,6 +98,7 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
91
98
|
width={this.width}
|
|
92
99
|
height={this.height}
|
|
93
100
|
headline={this.headline}
|
|
101
|
+
pageSize={this.pageSize}
|
|
94
102
|
/>
|
|
95
103
|
);
|
|
96
104
|
}
|
|
@@ -19,6 +19,7 @@ const codeExample = String.raw`
|
|
|
19
19
|
headline="Mutations"
|
|
20
20
|
width='100%'
|
|
21
21
|
height='700px'
|
|
22
|
+
pageSize="10"
|
|
22
23
|
></gs-mutations>`;
|
|
23
24
|
|
|
24
25
|
const meta: Meta<Required<MutationsProps>> = {
|
|
@@ -37,6 +38,7 @@ const meta: Meta<Required<MutationsProps>> = {
|
|
|
37
38
|
width: { control: 'text' },
|
|
38
39
|
height: { control: 'text' },
|
|
39
40
|
headline: { control: 'text' },
|
|
41
|
+
pageSize: { control: 'object' },
|
|
40
42
|
},
|
|
41
43
|
args: {
|
|
42
44
|
variant: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },
|
|
@@ -45,6 +47,7 @@ const meta: Meta<Required<MutationsProps>> = {
|
|
|
45
47
|
width: '100%',
|
|
46
48
|
height: '700px',
|
|
47
49
|
headline: 'Mutations',
|
|
50
|
+
pageSize: 10,
|
|
48
51
|
},
|
|
49
52
|
parameters: withComponentDocs({
|
|
50
53
|
componentDocs: {
|
|
@@ -68,6 +71,7 @@ const Template: StoryObj<Required<MutationsProps>> = {
|
|
|
68
71
|
.width=${args.width}
|
|
69
72
|
.height=${args.height}
|
|
70
73
|
.headline=${args.headline}
|
|
74
|
+
.pageSize=${args.pageSize}
|
|
71
75
|
></gs-mutations>
|
|
72
76
|
</gs-app>
|
|
73
77
|
`,
|
|
@@ -77,6 +77,13 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
77
77
|
@property({ type: String })
|
|
78
78
|
headline: string = 'Mutations';
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* The maximum number of rows to display in the table view.
|
|
82
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
83
|
+
*/
|
|
84
|
+
@property({ type: Object })
|
|
85
|
+
pageSize: boolean | number = false;
|
|
86
|
+
|
|
80
87
|
override render() {
|
|
81
88
|
return (
|
|
82
89
|
<Mutations
|
|
@@ -86,6 +93,7 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
86
93
|
width={this.width}
|
|
87
94
|
height={this.height}
|
|
88
95
|
headline={this.headline}
|
|
96
|
+
pageSize={this.pageSize}
|
|
89
97
|
/>
|
|
90
98
|
);
|
|
91
99
|
}
|
|
@@ -26,6 +26,7 @@ const codeExample = String.raw`
|
|
|
26
26
|
width="100%"
|
|
27
27
|
height="700px"
|
|
28
28
|
lapisDateField="date"
|
|
29
|
+
pageSize="10"
|
|
29
30
|
></gs-prevalence-over-time>`;
|
|
30
31
|
|
|
31
32
|
const meta: Meta<Required<PrevalenceOverTimeProps>> = {
|
|
@@ -50,6 +51,7 @@ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
|
|
|
50
51
|
width: { control: 'text' },
|
|
51
52
|
height: { control: 'text' },
|
|
52
53
|
headline: { control: 'text' },
|
|
54
|
+
pageSize: { control: 'object' },
|
|
53
55
|
},
|
|
54
56
|
parameters: withComponentDocs({
|
|
55
57
|
componentDocs: {
|
|
@@ -77,6 +79,7 @@ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
77
79
|
.height=${args.height}
|
|
78
80
|
.headline=${args.headline}
|
|
79
81
|
.lapisDateField=${args.lapisDateField}
|
|
82
|
+
.pageSize=${args.pageSize}
|
|
80
83
|
></gs-prevalence-over-time>
|
|
81
84
|
</gs-app>
|
|
82
85
|
`,
|
|
@@ -98,6 +101,7 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
98
101
|
height: '700px',
|
|
99
102
|
headline: 'Prevalence over time',
|
|
100
103
|
lapisDateField: 'date',
|
|
104
|
+
pageSize: 10,
|
|
101
105
|
},
|
|
102
106
|
parameters: {
|
|
103
107
|
fetchMock: {
|
|
@@ -170,6 +174,7 @@ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
170
174
|
height: '700px',
|
|
171
175
|
headline: 'Prevalence over time',
|
|
172
176
|
lapisDateField: 'date',
|
|
177
|
+
pageSize: 10,
|
|
173
178
|
},
|
|
174
179
|
parameters: {
|
|
175
180
|
fetchMock: {
|
|
@@ -53,16 +53,16 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
53
53
|
* which will be used as the label for the variant in the views,
|
|
54
54
|
* or an array of such objects.
|
|
55
55
|
*/
|
|
56
|
-
@property({type: Object})
|
|
56
|
+
@property({ type: Object })
|
|
57
57
|
numerator:
|
|
58
58
|
{
|
|
59
59
|
lapisFilter: Record<string, string | number | null | boolean>;
|
|
60
60
|
displayName: string;
|
|
61
61
|
}
|
|
62
62
|
| {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
lapisFilter: Record<string, string | number | null | boolean>;
|
|
64
|
+
displayName: string;
|
|
65
|
+
}[] = { displayName: '', lapisFilter: {} };
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Required.
|
|
@@ -136,6 +136,13 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
136
136
|
@property({ type: String })
|
|
137
137
|
lapisDateField: string = 'date';
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* The maximum number of rows to display in the table view.
|
|
141
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
142
|
+
*/
|
|
143
|
+
@property({ type: Object })
|
|
144
|
+
pageSize: boolean | number = false;
|
|
145
|
+
|
|
139
146
|
override render() {
|
|
140
147
|
return (
|
|
141
148
|
<PrevalenceOverTime
|
|
@@ -149,6 +156,7 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
149
156
|
height={this.height}
|
|
150
157
|
headline={this.headline}
|
|
151
158
|
lapisDateField={this.lapisDateField}
|
|
159
|
+
pageSize={this.pageSize}
|
|
152
160
|
/>
|
|
153
161
|
);
|
|
154
162
|
}
|