@genspectrum/dashboard-components 0.6.19 → 0.7.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.
- package/custom-elements.json +18 -18
- package/dist/assets/mutationOverTimeWorker-BOCXtKzd.js.map +1 -0
- package/dist/dashboard-components.js +296 -302
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +98 -48
- package/package.json +1 -3
- package/src/index.ts +1 -0
- package/src/preact/aggregatedData/aggregate.tsx +41 -33
- package/src/preact/dateRangeSelector/computeInitialValues.spec.ts +53 -38
- package/src/preact/dateRangeSelector/computeInitialValues.ts +17 -23
- package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +46 -32
- package/src/preact/dateRangeSelector/date-range-selector.tsx +24 -26
- package/src/preact/dateRangeSelector/dateRangeOption.ts +65 -0
- package/src/preact/dateRangeSelector/selectableOptions.ts +17 -66
- package/src/preact/mutationComparison/mutation-comparison.tsx +32 -34
- package/src/preact/mutations/mutations.tsx +63 -56
- package/src/preact/mutationsOverTime/MutationOverTimeData.ts +20 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +2 -3
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +2 -2
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +3 -3
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +40 -43
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +46 -64
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +29 -36
- package/src/query/queryMutationsOverTime.ts +3 -5
- package/src/utils/map2d.spec.ts +52 -13
- package/src/utils/map2d.ts +3 -4
- package/src/web-components/input/gs-date-range-selector.stories.ts +16 -28
- package/src/web-components/input/gs-date-range-selector.tsx +17 -32
- package/standalone-bundle/dashboard-components.js +14322 -15115
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/dist/assets/mutationOverTimeWorker-BdzqDqvO.js.map +0 -1
|
@@ -37,13 +37,14 @@ import { PreactLitAdapter } from '../PreactLitAdapter';
|
|
|
37
37
|
@customElement('gs-date-range-selector')
|
|
38
38
|
export class DateRangeSelectorComponent extends PreactLitAdapter {
|
|
39
39
|
/**
|
|
40
|
-
* An array of
|
|
41
|
-
* in addition to the predefined options.
|
|
40
|
+
* An array of date range options that the select field should provide.
|
|
42
41
|
* The `label` will be shown to the user, and it will be available as `initialValue`.
|
|
43
42
|
* The dates must be in the format `YYYY-MM-DD`.
|
|
43
|
+
*
|
|
44
|
+
* If dateFrom or dateTo is not set, the component will default to the `earliestDate` or the current date.
|
|
44
45
|
*/
|
|
45
46
|
@property({ type: Array })
|
|
46
|
-
|
|
47
|
+
dateRangeOptions: { label: string; dateFrom?: string; dateTo?: string }[] = [];
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* The `dateFrom` value to use in the `allTimes` preset in the format `YYYY-MM-DD`.
|
|
@@ -51,26 +52,18 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
|
|
|
51
52
|
@property({ type: String })
|
|
52
53
|
earliestDate: string = '1900-01-01';
|
|
53
54
|
|
|
54
|
-
// prettier-ignore
|
|
55
|
-
// The multiline union type must not start with `| 'custom'` - Storybook will list "" as the first type which is wrong
|
|
56
55
|
/**
|
|
57
56
|
* The initial value to use for this date range selector.
|
|
58
|
-
* Must be a valid label from the
|
|
57
|
+
* Must be a valid label from the `dateRangeOptions`.
|
|
59
58
|
*
|
|
60
|
-
* If the value is
|
|
59
|
+
* If the value is not set, the component will default to the range `earliestDate` until today.
|
|
61
60
|
*
|
|
62
61
|
* It will be overwritten if `initialDateFrom` or `initialDateTo` is set.
|
|
62
|
+
*
|
|
63
|
+
* We provide some options in `dateRangeOptionPresets` for convenience.
|
|
63
64
|
*/
|
|
64
65
|
@property()
|
|
65
|
-
initialValue:
|
|
66
|
-
'custom'
|
|
67
|
-
| 'allTimes'
|
|
68
|
-
| 'last2Weeks'
|
|
69
|
-
| 'lastMonth'
|
|
70
|
-
| 'last2Months'
|
|
71
|
-
| 'last3Months'
|
|
72
|
-
| 'last6Months'
|
|
73
|
-
| string = 'last6Months';
|
|
66
|
+
initialValue: string | undefined = undefined;
|
|
74
67
|
|
|
75
68
|
/**
|
|
76
69
|
* A date string in the format `YYYY-MM-DD`.
|
|
@@ -105,7 +98,7 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
|
|
|
105
98
|
override render() {
|
|
106
99
|
return (
|
|
107
100
|
<DateRangeSelector
|
|
108
|
-
|
|
101
|
+
dateRangeOptions={this.dateRangeOptions}
|
|
109
102
|
earliestDate={this.earliestDate}
|
|
110
103
|
initialValue={this.initialValue}
|
|
111
104
|
initialDateFrom={this.initialDateFrom}
|
|
@@ -138,30 +131,22 @@ declare global {
|
|
|
138
131
|
|
|
139
132
|
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
140
133
|
type CustomSelectOptionsMatches = Expect<
|
|
141
|
-
Equals<
|
|
142
|
-
typeof DateRangeSelectorComponent.prototype.customSelectOptions,
|
|
143
|
-
DateRangeSelectorProps<string>['customSelectOptions']
|
|
144
|
-
>
|
|
134
|
+
Equals<typeof DateRangeSelectorComponent.prototype.dateRangeOptions, DateRangeSelectorProps['dateRangeOptions']>
|
|
145
135
|
>;
|
|
146
136
|
type EarliestDateMatches = Expect<
|
|
147
|
-
Equals<typeof DateRangeSelectorComponent.prototype.earliestDate, DateRangeSelectorProps
|
|
137
|
+
Equals<typeof DateRangeSelectorComponent.prototype.earliestDate, DateRangeSelectorProps['earliestDate']>
|
|
148
138
|
>;
|
|
149
139
|
type InitialValueMatches = Expect<
|
|
150
|
-
Equals<typeof DateRangeSelectorComponent.prototype.initialValue, DateRangeSelectorProps
|
|
140
|
+
Equals<typeof DateRangeSelectorComponent.prototype.initialValue, DateRangeSelectorProps['initialValue']>
|
|
151
141
|
>;
|
|
152
142
|
type InitialDateFromMatches = Expect<
|
|
153
|
-
Equals<
|
|
154
|
-
typeof DateRangeSelectorComponent.prototype.initialDateFrom,
|
|
155
|
-
DateRangeSelectorProps<string>['initialDateFrom']
|
|
156
|
-
>
|
|
143
|
+
Equals<typeof DateRangeSelectorComponent.prototype.initialDateFrom, DateRangeSelectorProps['initialDateFrom']>
|
|
157
144
|
>;
|
|
158
145
|
type InitialDateToMatches = Expect<
|
|
159
|
-
Equals<typeof DateRangeSelectorComponent.prototype.initialDateTo, DateRangeSelectorProps
|
|
160
|
-
>;
|
|
161
|
-
type WidthMatches = Expect<
|
|
162
|
-
Equals<typeof DateRangeSelectorComponent.prototype.width, DateRangeSelectorProps<string>['width']>
|
|
146
|
+
Equals<typeof DateRangeSelectorComponent.prototype.initialDateTo, DateRangeSelectorProps['initialDateTo']>
|
|
163
147
|
>;
|
|
148
|
+
type WidthMatches = Expect<Equals<typeof DateRangeSelectorComponent.prototype.width, DateRangeSelectorProps['width']>>;
|
|
164
149
|
type DateColumnMatches = Expect<
|
|
165
|
-
Equals<typeof DateRangeSelectorComponent.prototype.dateColumn, DateRangeSelectorProps
|
|
150
|
+
Equals<typeof DateRangeSelectorComponent.prototype.dateColumn, DateRangeSelectorProps['dateColumn']>
|
|
166
151
|
>;
|
|
167
152
|
/* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
|