[new-search-extend-criteria | FIXED | DONE]: Fix criteria bug with static_autocomplete when type is soft.

This commit is contained in:
Konstantinos Triantafyllou 2025-11-14 18:43:53 +02:00
parent ed6f820885
commit 758673b54b
3 changed files with 11 additions and 2 deletions

@ -1 +1 @@
Subproject commit b973a1f16c824e304fa36d8677eeb87dd8d4ede0
Subproject commit ab83bfac2ee791bf9fcc451df87b1a3fc5f91a46

View File

@ -46,7 +46,7 @@
[fieldId]="criteriaUtils.criteriaFields[constraint.get('field').value].vocabularyId"
[selectedValue]="constraint.get('value').value" entityName="result" inputClass="flat"
[placeHolderMessage]="'Search for '+criteriaUtils.criteriaFields[constraint.get('field').value].label" [title]="criteriaUtils.criteriaFields[constraint.get('field').value].label"
(selectedValueChanged)="constraint.get('value').setValue($event.value)"
(selectedValueChanged)="autoCompleteValueChanged(constraint.get('value'), $event)"
[type]="criteriaUtils.criteriaFields[constraint.get('field').value].operator === 'string'?'autocomplete_soft':'autocomplete'"
[list]="vocabularyLists[criteriaUtils.criteriaFields[constraint.get('field').value].vocabularyId] "
(listUpdated)="vocabularyLists[criteriaUtils.criteriaFields[constraint.get('field').value].vocabularyId] = $event.value"

View File

@ -19,6 +19,7 @@ import {NotificationHandler} from "../../../openaireLibrary/utils/notification-h
import {OpenaireEntities} from "../../../openaireLibrary/utils/properties/searchFields";
import {ISVocabulariesService} from "../../../openaireLibrary/utils/staticAutoComplete/ISVocabularies.service";
import {Subscription} from "rxjs";
import {Option} from "../../../openaireLibrary/sharedComponents/input/input.component";
@Component({
selector: 'criteria',
@ -248,4 +249,12 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe
constraint.get('verb').setValue(operatorOptions[0].value);
constraint.get('verb_suffix').setValue(this.getSuffix(constraint.get('verb').value));
}
public autoCompleteValueChanged(control: AbstractControl, value: Option | string) {
if(typeof value === 'string') {
control.setValue(value);
} else {
control.setValue(value.value)
}
}
}