@genspectrum/dashboard-components 0.17.0 → 0.17.1

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.
Files changed (23) hide show
  1. package/custom-elements.json +44 -13
  2. package/dist/components.d.ts +18 -14
  3. package/dist/components.js +557 -99
  4. package/dist/components.js.map +1 -1
  5. package/dist/style.css +318 -6
  6. package/dist/util.d.ts +12 -12
  7. package/package.json +2 -1
  8. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +133 -84
  9. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +46 -16
  10. package/src/preact/mutationsOverTime/mutations-over-time.tsx +3 -0
  11. package/src/preact/shared/tanstackTable/pagination.tsx +132 -0
  12. package/src/preact/shared/tanstackTable/tanstackTable.tsx +43 -0
  13. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +2 -1
  14. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +3 -5
  15. package/src/web-components/visualization/gs-mutations-over-time.spec-d.ts +39 -0
  16. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +4 -0
  17. package/src/web-components/visualization/gs-mutations-over-time.tsx +8 -31
  18. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.spec-d.ts +24 -0
  19. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.stories.ts +3 -3
  20. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +5 -36
  21. package/standalone-bundle/dashboard-components.js +17733 -15921
  22. package/standalone-bundle/dashboard-components.js.map +1 -1
  23. package/standalone-bundle/style.css +1 -1
@@ -0,0 +1,39 @@
1
+ import { describe, expectTypeOf, it } from 'vitest';
2
+
3
+ import { type MutationsOverTimeComponent } from './gs-mutations-over-time';
4
+ import { type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
5
+
6
+ describe('gs-mutations-over-time', () => {
7
+ it('types of preact and lit component should match', () => {
8
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.lapisFilter>().toEqualTypeOf<
9
+ MutationsOverTimeProps['lapisFilter']
10
+ >();
11
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.sequenceType>().toEqualTypeOf<
12
+ MutationsOverTimeProps['sequenceType']
13
+ >();
14
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.views>().toEqualTypeOf<
15
+ MutationsOverTimeProps['views']
16
+ >();
17
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.width>().toEqualTypeOf<
18
+ MutationsOverTimeProps['width']
19
+ >();
20
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.height>().toEqualTypeOf<
21
+ MutationsOverTimeProps['height']
22
+ >();
23
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.granularity>().toEqualTypeOf<
24
+ MutationsOverTimeProps['granularity']
25
+ >();
26
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.lapisDateField>().toEqualTypeOf<
27
+ MutationsOverTimeProps['lapisDateField']
28
+ >();
29
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.displayMutations>().toEqualTypeOf<
30
+ MutationsOverTimeProps['displayMutations']
31
+ >();
32
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.initialMeanProportionInterval>().toEqualTypeOf<
33
+ MutationsOverTimeProps['initialMeanProportionInterval']
34
+ >();
35
+ expectTypeOf<typeof MutationsOverTimeComponent.prototype.pageSizes>().toEqualTypeOf<
36
+ MutationsOverTimeProps['pageSizes']
37
+ >();
38
+ });
39
+ });
@@ -17,6 +17,7 @@ const codeExample = String.raw`
17
17
  granularity="month"
18
18
  lapisDateField="date"
19
19
  displayMutations='["A23403G","C241T"]'
20
+ pageSizes='[5,10]'
20
21
  ></gs-mutations-over-time>`;
21
22
 
22
23
  const meta: Meta<Required<MutationsOverTimeProps>> = {
@@ -41,6 +42,7 @@ const meta: Meta<Required<MutationsOverTimeProps>> = {
41
42
  lapisDateField: { control: 'text' },
42
43
  displayMutations: { control: 'object' },
43
44
  initialMeanProportionInterval: { control: 'object' },
45
+ pageSizes: { control: 'object' },
44
46
  },
45
47
  args: {
46
48
  lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-07-10' },
@@ -50,6 +52,7 @@ const meta: Meta<Required<MutationsOverTimeProps>> = {
50
52
  granularity: 'month',
51
53
  lapisDateField: 'date',
52
54
  initialMeanProportionInterval: { min: 0.05, max: 0.9 },
55
+ pageSizes: [10, 20, 30, 40, 50],
53
56
  },
54
57
  parameters: withComponentDocs({
55
58
  componentDocs: {
@@ -95,6 +98,7 @@ const Template: StoryObj<Required<MutationsOverTimeProps>> = {
95
98
  .lapisDateField=${args.lapisDateField}
96
99
  .displayMutations=${args.displayMutations}
97
100
  .initialMeanProportionInterval=${args.initialMeanProportionInterval}
101
+ .pageSizes=${args.pageSizes}
98
102
  ></gs-mutations-over-time>
99
103
  </gs-app>
100
104
  `,
@@ -3,8 +3,7 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import type { DetailedHTMLProps, HTMLAttributes } from 'react';
4
4
 
5
5
  import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
6
- import { MutationsOverTime, type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
7
- import type { Equals, Expect } from '../../utils/typeAssertions';
6
+ import { MutationsOverTime } from '../../preact/mutationsOverTime/mutations-over-time';
8
7
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
9
8
  import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
10
9
 
@@ -111,6 +110,12 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
111
110
  @property({ type: Object })
112
111
  initialMeanProportionInterval: { min: number; max: number } = { min: 0.05, max: 0.9 };
113
112
 
113
+ /**
114
+ * The number of rows per page, which can be selected by the user.
115
+ */
116
+ @property({ type: Array })
117
+ pageSizes: number[] | number = [10, 20, 30, 40, 50];
118
+
114
119
  /**
115
120
  * @internal
116
121
  */
@@ -130,6 +135,7 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
130
135
  lapisDateField={this.lapisDateField}
131
136
  displayMutations={this.displayMutations}
132
137
  initialMeanProportionInterval={this.initialMeanProportionInterval}
138
+ pageSizes={this.pageSizes}
133
139
  />
134
140
  </MutationAnnotationsContextProvider>
135
141
  );
@@ -150,32 +156,3 @@ declare global {
150
156
  }
151
157
  }
152
158
  }
153
-
154
- /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
155
- type LapisFilterMatches = Expect<
156
- Equals<typeof MutationsOverTimeComponent.prototype.lapisFilter, MutationsOverTimeProps['lapisFilter']>
157
- >;
158
- type SequenceTypeMatches = Expect<
159
- Equals<typeof MutationsOverTimeComponent.prototype.sequenceType, MutationsOverTimeProps['sequenceType']>
160
- >;
161
- type ViewsMatches = Expect<Equals<typeof MutationsOverTimeComponent.prototype.views, MutationsOverTimeProps['views']>>;
162
- type WidthMatches = Expect<Equals<typeof MutationsOverTimeComponent.prototype.width, MutationsOverTimeProps['width']>>;
163
- type HeightMatches = Expect<
164
- Equals<typeof MutationsOverTimeComponent.prototype.height, MutationsOverTimeProps['height']>
165
- >;
166
- type GranularityMatches = Expect<
167
- Equals<typeof MutationsOverTimeComponent.prototype.granularity, MutationsOverTimeProps['granularity']>
168
- >;
169
- type LapisDateFieldMatches = Expect<
170
- Equals<typeof MutationsOverTimeComponent.prototype.lapisDateField, MutationsOverTimeProps['lapisDateField']>
171
- >;
172
- type DisplayMutationsMatches = Expect<
173
- Equals<typeof MutationsOverTimeComponent.prototype.displayMutations, MutationsOverTimeProps['displayMutations']>
174
- >;
175
- type InitialMeanProportionIntervalMatches = Expect<
176
- Equals<
177
- typeof MutationsOverTimeComponent.prototype.initialMeanProportionInterval,
178
- MutationsOverTimeProps['initialMeanProportionInterval']
179
- >
180
- >;
181
- /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -0,0 +1,24 @@
1
+ import { describe, expectTypeOf, it } from 'vitest';
2
+
3
+ import { type WastewaterMutationsOverTimeComponent } from './gs-wastewater-mutations-over-time';
4
+ import { type WastewaterMutationsOverTimeProps } from '../../preact/wastewater/mutationsOverTime/wastewater-mutations-over-time';
5
+
6
+ describe('gs-wastewater-mutations-over-time', () => {
7
+ it('types of preact and lit component should match', () => {
8
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.lapisFilter>().toEqualTypeOf<
9
+ WastewaterMutationsOverTimeProps['lapisFilter']
10
+ >();
11
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.sequenceType>().toEqualTypeOf<
12
+ WastewaterMutationsOverTimeProps['sequenceType']
13
+ >();
14
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.width>().toEqualTypeOf<
15
+ WastewaterMutationsOverTimeProps['width']
16
+ >();
17
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.height>().toEqualTypeOf<
18
+ WastewaterMutationsOverTimeProps['height']
19
+ >();
20
+ expectTypeOf<typeof WastewaterMutationsOverTimeComponent.prototype.pageSizes>().toEqualTypeOf<
21
+ WastewaterMutationsOverTimeProps['pageSizes']
22
+ >();
23
+ });
24
+ });
@@ -14,7 +14,7 @@ const codeExample = String.raw`
14
14
  sequenceType='nucleotide'
15
15
  width='100%'
16
16
  height='700px'
17
- maxNumberOfGridRows='100'
17
+ pageSizes='[5,10]'
18
18
  >
19
19
  <span slot="infoText">Some info text</span>
20
20
  </gs-wastewater-mutations-over-time>`;
@@ -37,7 +37,7 @@ const meta: Meta<WastewaterMutationsOverTimeProps & { infoText: string }> = {
37
37
  width: '100%',
38
38
  height: undefined,
39
39
  infoText: 'Some info text',
40
- maxNumberOfGridRows: 100,
40
+ pageSizes: [10, 20, 30, 40, 50],
41
41
  },
42
42
  parameters: withComponentDocs({
43
43
  componentDocs: {
@@ -70,7 +70,7 @@ export const WastewaterMutationsOverTime: StoryObj<WastewaterMutationsOverTimePr
70
70
  .sequenceType=${args.sequenceType}
71
71
  .width=${args.width}
72
72
  .height=${args.height}
73
- .maxNumberOfGridRows=${args.maxNumberOfGridRows}
73
+ .pageSizes=${args.pageSizes}
74
74
  >
75
75
  <span slot="infoText">${args.infoText}</span>
76
76
  </gs-wastewater-mutations-over-time>
@@ -3,11 +3,7 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
4
4
 
5
5
  import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
6
- import {
7
- WastewaterMutationsOverTime,
8
- type WastewaterMutationsOverTimeProps,
9
- } from '../../preact/wastewater/mutationsOverTime/wastewater-mutations-over-time';
10
- import { type Equals, type Expect } from '../../utils/typeAssertions';
6
+ import { WastewaterMutationsOverTime } from '../../preact/wastewater/mutationsOverTime/wastewater-mutations-over-time';
11
7
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
12
8
  import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
13
9
 
@@ -69,10 +65,10 @@ export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGr
69
65
  height: string | undefined = undefined;
70
66
 
71
67
  /**
72
- * The maximum number of grid rows to display.
68
+ * The number of rows per page, which can be selected by the user.
73
69
  */
74
- @property({ type: Number })
75
- maxNumberOfGridRows: number = 100;
70
+ @property({ type: Array })
71
+ pageSizes: number[] | number = [10, 20, 30, 40, 50];
76
72
 
77
73
  /**
78
74
  * @internal
@@ -88,7 +84,7 @@ export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGr
88
84
  sequenceType={this.sequenceType}
89
85
  width={this.width}
90
86
  height={this.height}
91
- maxNumberOfGridRows={this.maxNumberOfGridRows}
87
+ pageSizes={this.pageSizes}
92
88
  />
93
89
  </MutationAnnotationsContextProvider>
94
90
  );
@@ -109,30 +105,3 @@ declare global {
109
105
  }
110
106
  }
111
107
  }
112
-
113
- /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
114
- type LapisFilterMatches = Expect<
115
- Equals<
116
- typeof WastewaterMutationsOverTimeComponent.prototype.lapisFilter,
117
- WastewaterMutationsOverTimeProps['lapisFilter']
118
- >
119
- >;
120
- type SequenceTypeMatches = Expect<
121
- Equals<
122
- typeof WastewaterMutationsOverTimeComponent.prototype.sequenceType,
123
- WastewaterMutationsOverTimeProps['sequenceType']
124
- >
125
- >;
126
- type WidthMatches = Expect<
127
- Equals<typeof WastewaterMutationsOverTimeComponent.prototype.width, WastewaterMutationsOverTimeProps['width']>
128
- >;
129
- type HeightMatches = Expect<
130
- Equals<typeof WastewaterMutationsOverTimeComponent.prototype.height, WastewaterMutationsOverTimeProps['height']>
131
- >;
132
- type MaxNumberOfGridRowsMatches = Expect<
133
- Equals<
134
- typeof WastewaterMutationsOverTimeComponent.prototype.maxNumberOfGridRows,
135
- WastewaterMutationsOverTimeProps['maxNumberOfGridRows']
136
- >
137
- >;
138
- /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */