From ca4da850908f9ec045524982221745a11ada571d Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 19 Apr 2022 02:09:42 +0300 Subject: [PATCH] Add openAccess in quick selection and make it responsive. Remove enter behaviour for select inputs in advanced-search-input --- .../advancedSearchForm.component.html | 182 +++++++++--------- .../advancedSearchForm.component.ts | 9 +- .../searchUtils/newSearchPage.component.html | 2 +- .../searchUtils/quick-selections.component.ts | 30 ++- .../advanced-search-input.component.ts | 11 +- 5 files changed, 116 insertions(+), 118 deletions(-) diff --git a/searchPages/searchUtils/advancedSearchForm.component.html b/searchPages/searchUtils/advancedSearchForm.component.html index 4a009526..500a061f 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.html +++ b/searchPages/searchUtils/advancedSearchForm.component.html @@ -1,5 +1,5 @@ -
+
Advanced search in {{entities.getLabel(entityType)}} @@ -15,125 +15,121 @@
-
-
+
+
+ + + + + + + + + +
Field to searchTerm
+ {{fieldIdsMap[id].name}} + +
+ + +
- - - - - - - - - - - - - + + (listUpdated)="listUpdated($event,selectedField.id)"> + + + - - - + + - -
Field to searchTerm
- {{fieldIdsMap[id].name}} - -
- - -
- - -
- - - - - - - + + + + - - + + + + + + Yes
- + No
-
- {{op.id}} - -
- Add rule -
-
+ + {{op.id}} + +
+ Add rule +
+
-
+
-
-
-
-
- Please check your from date -
-
- Please check your to date -
-
- Please check your dates +
+
+
+
+ Please check your from date +
+
+ Please check your to date +
+
+ Please check your dates +
- -
- +
+ + +
diff --git a/searchPages/searchUtils/advancedSearchForm.component.ts b/searchPages/searchUtils/advancedSearchForm.component.ts index 88b78d7f..29031ba8 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.ts +++ b/searchPages/searchUtils/advancedSearchForm.component.ts @@ -1,7 +1,7 @@ -import {Component, EventEmitter, Input, Output} from '@angular/core'; +import {ChangeDetectorRef, Component, EventEmitter, Input, Output} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; -import {AdvancedField, Filter} from '../searchUtils/searchHelperClasses.class'; +import {AdvancedField, Filter} from './searchHelperClasses.class'; import {SearchFields} from '../../utils/properties/searchFields'; import {Dates} from '../../utils/string-utils.class'; import {EnvProperties} from '../../utils/properties/env-properties'; @@ -45,9 +45,7 @@ export class AdvancedSearchFormComponent { @Input() showSwitchSearchLink: boolean = true; sub; - constructor(private route: ActivatedRoute, private router: Router) { - - } + constructor(private route: ActivatedRoute, private router: Router, private cdr: ChangeDetectorRef) {} ngOnDestroy() { if (this.sub instanceof Subscriber) { @@ -109,6 +107,7 @@ export class AdvancedSearchFormComponent { disableSelectChange(value) { this.disableSelect = value; + this.cdr.detectChanges(); } addField() { diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index cde37c5e..7d540b70 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -152,7 +152,7 @@
-
+
diff --git a/searchPages/searchUtils/quick-selections.component.ts b/searchPages/searchUtils/quick-selections.component.ts index 9d1c5571..8feae1bf 100644 --- a/searchPages/searchUtils/quick-selections.component.ts +++ b/searchPages/searchUtils/quick-selections.component.ts @@ -6,18 +6,28 @@ import {ConfigurationService} from "../../utils/configuration/configuration.serv import {Subscription} from "rxjs"; import {ActivatedRoute, Router} from "@angular/router"; import {properties} from "../../../../environments/environment"; +import {OpenaireEntities} from "../../utils/properties/searchFields"; @Component({ selector: 'quick-selections', template: ` +
+ + {{quickFilter.value}} + +
-
Include:
- -
- - +
Include:
+
+
+ +
+ + +
+
- +
` }) @@ -123,16 +133,16 @@ export class QuickSelectionsComponent { this.resultTypes.countSelectedValues = selected.length; this.resultTypes.values = []; if(this.showPublications){ - this.resultTypes.values.push({name: "Publications" , id:"publications",selected:selected.indexOf("publications")!=-1, number:0}); + this.resultTypes.values.push({name: OpenaireEntities.PUBLICATIONS , id:"publications",selected:selected.indexOf("publications")!=-1, number:0}); } if(this.showDatasets){ - this.resultTypes.values.push({name: "Research data" , id:"datasets",selected:selected.indexOf("datasets")!=-1, number:0}); + this.resultTypes.values.push({name: OpenaireEntities.DATASETS , id:"datasets",selected:selected.indexOf("datasets")!=-1, number:0}); } if(this.showSoftware){ - this.resultTypes.values.push({name: "Software" , id:"software",selected:selected.indexOf("software")!=-1, number:0}); + this.resultTypes.values.push({name: OpenaireEntities.SOFTWARE , id:"software",selected:selected.indexOf("software")!=-1, number:0}); } if(this.showOrp){ - this.resultTypes.values.push({name: "Other research products" , id:"other",selected:selected.indexOf("other")!=-1, number:0}); + this.resultTypes.values.push({name: OpenaireEntities.OTHER , id:"other",selected:selected.indexOf("other")!=-1, number:0}); } } this.typeChange.emit("filters_update"); diff --git a/sharedComponents/advanced-search-input/advanced-search-input.component.ts b/sharedComponents/advanced-search-input/advanced-search-input.component.ts index 7a0da370..17562223 100644 --- a/sharedComponents/advanced-search-input/advanced-search-input.component.ts +++ b/sharedComponents/advanced-search-input/advanced-search-input.component.ts @@ -42,16 +42,9 @@ export class AdvancedSearchInputComponent implements AfterContentInit, OnDestroy @HostListener('window:keydown.enter', ['$event']) enter(event: KeyboardEvent) { - let input: InputComponent | EntitiesSelectionComponent = this.inputs.toArray().find(input => input.focused); - if (!input) { - input = this.entities.toArray().find(input => input.input.focused); - } + let input: InputComponent = this.inputs.toArray().find(input => input.focused && input.type !== 'select'); if (input) { - if (input instanceof EntitiesSelectionComponent) { - input.input.focus(false, event); - } else { - input.focus(false, event); - } + input.focus(false, event); event.preventDefault(); this.searchEmitter.emit(); }