@genspectrum/dashboard-components 1.4.0 → 1.6.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.
Files changed (41) hide show
  1. package/custom-elements.json +134 -7
  2. package/dist/assets/{mutationOverTimeWorker-CQxrFo53.js.map → mutationOverTimeWorker-BmB6BvVM.js.map} +1 -1
  3. package/dist/components.d.ts +52 -11
  4. package/dist/components.js +189 -45
  5. package/dist/components.js.map +1 -1
  6. package/dist/util.d.ts +11 -11
  7. package/package.json +1 -1
  8. package/src/preact/lineageFilter/lineage-filter.stories.tsx +24 -0
  9. package/src/preact/lineageFilter/lineage-filter.tsx +13 -2
  10. package/src/preact/locationFilter/location-filter.stories.tsx +24 -0
  11. package/src/preact/locationFilter/location-filter.tsx +19 -3
  12. package/src/preact/mutationFilter/mutation-filter-info.tsx +2 -2
  13. package/src/preact/mutationFilter/mutation-filter.stories.tsx +71 -1
  14. package/src/preact/mutationFilter/mutation-filter.tsx +65 -24
  15. package/src/preact/mutationsOverTime/__mockData__/withGaps.ts +352 -0
  16. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +38 -0
  17. package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +10 -0
  18. package/src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts +2 -0
  19. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +35 -0
  20. package/src/preact/mutationsOverTime/mutations-over-time.tsx +28 -4
  21. package/src/preact/textFilter/text-filter.stories.tsx +29 -4
  22. package/src/preact/textFilter/text-filter.tsx +13 -2
  23. package/src/query/queryMutationsOverTime.ts +37 -4
  24. package/src/query/queryMutationsOverTimeNewEndpoint.spec.ts +122 -0
  25. package/src/utils/map2d.spec.ts +30 -0
  26. package/src/utils/map2d.ts +14 -1
  27. package/src/utils/mutations.spec.ts +13 -0
  28. package/src/utils/mutations.ts +3 -3
  29. package/src/web-components/input/gs-lineage-filter.stories.ts +7 -0
  30. package/src/web-components/input/gs-lineage-filter.tsx +8 -0
  31. package/src/web-components/input/gs-location-filter.stories.ts +7 -0
  32. package/src/web-components/input/gs-location-filter.tsx +9 -1
  33. package/src/web-components/input/gs-mutation-filter.stories.ts +29 -1
  34. package/src/web-components/input/gs-mutation-filter.tsx +29 -2
  35. package/src/web-components/input/gs-text-filter.stories.ts +7 -0
  36. package/src/web-components/input/gs-text-filter.tsx +8 -0
  37. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +14 -1
  38. package/src/web-components/visualization/gs-mutations-over-time.tsx +8 -0
  39. package/standalone-bundle/assets/{mutationOverTimeWorker-CDACUs6w.js.map → mutationOverTimeWorker-B_xP8pIC.js.map} +1 -1
  40. package/standalone-bundle/dashboard-components.js +3666 -3553
  41. package/standalone-bundle/dashboard-components.js.map +1 -1
@@ -59,6 +59,13 @@ export class TextFilterComponent extends PreactLitAdapter {
59
59
  @property()
60
60
  placeholderText: string | undefined = undefined;
61
61
 
62
+ /**
63
+ * Whether to hide counts behind options in the drop down selection.
64
+ * Defaults to false.
65
+ */
66
+ @property({ type: Boolean })
67
+ hideCounts: boolean | undefined = false;
68
+
62
69
  /**
63
70
  * The width of the component.
64
71
  *
@@ -73,6 +80,7 @@ export class TextFilterComponent extends PreactLitAdapter {
73
80
  lapisField={this.lapisField}
74
81
  lapisFilter={this.lapisFilter}
75
82
  placeholderText={this.placeholderText}
83
+ hideCounts={this.hideCounts}
76
84
  value={this.value}
77
85
  width={this.width}
78
86
  />
@@ -42,6 +42,7 @@ const meta: Meta<Required<MutationsOverTimeProps>> = {
42
42
  lapisDateField: { control: 'text' },
43
43
  displayMutations: { control: 'object' },
44
44
  initialMeanProportionInterval: { control: 'object' },
45
+ hideGaps: { control: 'boolean' },
45
46
  useNewEndpoint: { control: 'boolean' },
46
47
  pageSizes: { control: 'object' },
47
48
  },
@@ -53,6 +54,7 @@ const meta: Meta<Required<MutationsOverTimeProps>> = {
53
54
  granularity: 'month',
54
55
  lapisDateField: 'date',
55
56
  initialMeanProportionInterval: { min: 0.05, max: 0.9 },
57
+ hideGaps: false,
56
58
  useNewEndpoint: false,
57
59
  pageSizes: [10, 20, 30, 40, 50],
58
60
  },
@@ -100,6 +102,7 @@ const Template: StoryObj<Required<MutationsOverTimeProps>> = {
100
102
  .lapisDateField=${args.lapisDateField}
101
103
  .displayMutations=${args.displayMutations}
102
104
  .initialMeanProportionInterval=${args.initialMeanProportionInterval}
105
+ .hideGaps=${args.hideGaps}
103
106
  .pageSizes=${args.pageSizes}
104
107
  .useNewEndpoint=${args.useNewEndpoint}
105
108
  ></gs-mutations-over-time>
@@ -112,7 +115,7 @@ export const ByMonth: StoryObj<Required<MutationsOverTimeProps>> = {
112
115
  ...Template,
113
116
  };
114
117
 
115
- // This test uses mock data: defaultMockData.ts (through mutationOverTimeWorker.mock.ts)
118
+ // This test uses mock data: withDisplayMutations.ts (through mutationOverTimeWorker.mock.ts)
116
119
  export const ByMonthWithFilterOnDisplayedMutations: StoryObj<Required<MutationsOverTimeProps>> = {
117
120
  ...Template,
118
121
  args: {
@@ -121,6 +124,16 @@ export const ByMonthWithFilterOnDisplayedMutations: StoryObj<Required<MutationsO
121
124
  },
122
125
  };
123
126
 
127
+ // This test uses mock data: withGaps.ts (through mutationOverTimeWorker.mock.ts)
128
+ export const ByMonthWithFilterOnDisplayedMutationsAndGaps: StoryObj<Required<MutationsOverTimeProps>> = {
129
+ ...Template,
130
+ args: {
131
+ ...Template.args,
132
+ displayMutations: ['A19722G', 'G21641T', 'T21652-'],
133
+ hideGaps: true,
134
+ },
135
+ };
136
+
124
137
  // This test uses mock data: byWeek.ts (through mutationOverTimeWorker.mock.ts)
125
138
  export const ByWeek: StoryObj<Required<MutationsOverTimeProps>> = {
126
139
  ...Template,
@@ -113,6 +113,13 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
113
113
  @property({ type: Object })
114
114
  initialMeanProportionInterval: { min: number; max: number } = { min: 0.05, max: 0.9 };
115
115
 
116
+ /**
117
+ * If true, date ranges with no data will be hidden initially; if false, not.
118
+ * Can be switched with a button in the toolbar.
119
+ */
120
+ @property({ type: Boolean })
121
+ hideGaps: boolean = false;
122
+
116
123
  /**
117
124
  * Whether to use the mutationsOverTime endpoint from LAPIS.
118
125
  * If true, use the endpoint, if false, compute component data as before.
@@ -146,6 +153,7 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
146
153
  lapisDateField={this.lapisDateField}
147
154
  displayMutations={this.displayMutations}
148
155
  initialMeanProportionInterval={this.initialMeanProportionInterval}
156
+ hideGaps={this.hideGaps}
149
157
  useNewEndpoint={this.useNewEndpoint}
150
158
  pageSizes={this.pageSizes}
151
159
  />