Skip to content

Commit

Permalink
fix(search-filter): cast types due to gn-ui typing issues
Browse files Browse the repository at this point in the history
this commit should be reverted and the any typings removed once the issues are fixed upstream
  • Loading branch information
tkohr committed Feb 21, 2024
1 parent 9ac27e6 commit 6ca164b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import {
ChangeDetectionStrategy,
Component,
EventEmitter,
Input,
Output,
} from '@angular/core'
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
import { Choice, DropdownMultiselectComponent } from 'geonetwork-ui'
import { FieldValue } from 'geonetwork-ui/libs/feature/search/src/lib/utils/service/fields'

@Component({
selector: 'mel-datahub-dropdown-select',
Expand All @@ -14,9 +9,10 @@ import { Choice, DropdownMultiselectComponent } from 'geonetwork-ui'
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DropdownSelectComponent extends DropdownMultiselectComponent {
//FIXME: overrides and casting via method due to typing issues with gn-ui
@Input() override selected: any
@Output() override selectValues = new EventEmitter<any>()
//FIXME: castings due to typing issues with gn-ui
@Input() set selectedValue(value: FieldValue | FieldValue[]) {
this.selected = value as unknown[]
}

selectFromEvent(choice: Choice, event: Event) {
this.select(choice, (event.target as HTMLInputElement).checked)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[title]="title"
[maxRows]="6"
[choices]="choices$ | async"
[selected]="selected$ | async"
[selectedValue]="selected$ | async"
[allowSearch]="true"
(selectValues)="onSelectedValues($event)"
(selectValues)="onSelectedValuesWithCast($event)"
[attr.data-cy-field]="fieldName"
>
</mel-datahub-dropdown-select>
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ import { FilterDropdownComponent } from 'geonetwork-ui'
styles: ``,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SearchFilterDropdownComponent extends FilterDropdownComponent {}
export class SearchFilterDropdownComponent extends FilterDropdownComponent {
//FIXME: castings due to typing issues with gn-ui
onSelectedValuesWithCast(values: unknown[]) {
this.onSelectedValues(values as (string | number)[])
}
}

0 comments on commit 6ca164b

Please sign in to comment.