@genspectrum/dashboard-components 0.11.7 → 0.12.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.
@@ -1,6 +1,7 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
2
  import type { DetailedHTMLProps, HTMLAttributes } from 'react';
3
3
 
4
+ import { type LocationChangedEvent } from '../../preact/locationFilter/LocationChangedEvent';
4
5
  import { LocationFilter, type LocationFilterProps } from '../../preact/locationFilter/location-filter';
5
6
  import type { Equals, Expect } from '../../utils/typeAssertions';
6
7
  import { PreactLitAdapter } from '../PreactLitAdapter';
@@ -14,11 +15,6 @@ import { PreactLitAdapter } from '../PreactLitAdapter';
14
15
  * The component retrieves a list of all possible values for these fields from the Lapis instance.
15
16
  * This list is then utilized to display autocomplete suggestions and to validate the input.
16
17
  *
17
- * Given `fields` are `['field1', 'field2', ..., 'fieldN']`,
18
- * then valid values for the location filter must be in the form `valueForField1 / valueForField2 / ... / valueForFieldK`,
19
- * where `1 <= K <= N`.
20
- * Values for the fields `i > K` are considered `undefined`.
21
- *
22
18
  * @fires {CustomEvent<Record<string, string>>} gs-location-changed
23
19
  * Fired when a value from the datalist is selected or when a valid value is typed into the field.
24
20
  * The `details` of this event contain an object with all `fields` as keys
@@ -37,10 +33,9 @@ import { PreactLitAdapter } from '../PreactLitAdapter';
37
33
  export class LocationFilterComponent extends PreactLitAdapter {
38
34
  /**
39
35
  * The initial value to use for this location filter.
40
- * Must be of the form `valueForField1 / valueForField2 / ... / valueForFieldN`.
41
36
  */
42
- @property()
43
- initialValue: string | undefined = undefined;
37
+ @property({ type: Object })
38
+ value: Record<string, string | null | undefined> | undefined = undefined;
44
39
 
45
40
  /**
46
41
  * Required.
@@ -70,7 +65,7 @@ export class LocationFilterComponent extends PreactLitAdapter {
70
65
  override render() {
71
66
  return (
72
67
  <LocationFilter
73
- initialValue={this.initialValue}
68
+ value={this.value}
74
69
  fields={this.fields}
75
70
  width={this.width}
76
71
  placeholderText={this.placeholderText}
@@ -85,7 +80,7 @@ declare global {
85
80
  }
86
81
 
87
82
  interface HTMLElementEventMap {
88
- 'gs-location-changed': CustomEvent<Record<string, string>>;
83
+ 'gs-location-changed': LocationChangedEvent;
89
84
  }
90
85
  }
91
86
 
@@ -99,9 +94,7 @@ declare global {
99
94
  }
100
95
 
101
96
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
102
- type InitialValueMatches = Expect<
103
- Equals<typeof LocationFilterComponent.prototype.initialValue, LocationFilterProps['initialValue']>
104
- >;
97
+ type InitialValueMatches = Expect<Equals<typeof LocationFilterComponent.prototype.value, LocationFilterProps['value']>>;
105
98
  type FieldsMatches = Expect<Equals<typeof LocationFilterComponent.prototype.fields, LocationFilterProps['fields']>>;
106
99
  type PlaceholderTextMatches = Expect<
107
100
  Equals<typeof LocationFilterComponent.prototype.placeholderText, LocationFilterProps['placeholderText']>