Merge pull request 'Irish Monitor Release June 2024' (#46) from develop into master

Reviewed-on: #46
This commit is contained in:
Konstantinos Triantafyllou 2024-06-26 13:47:50 +02:00
commit df789fddff
6 changed files with 116 additions and 70 deletions

View File

@ -17,7 +17,6 @@ export class BrowseStakeholderBaseComponent<T> extends StakeholderBaseComponent
filteredStakeholders: T[] = []; filteredStakeholders: T[] = [];
showLoading: boolean = true; showLoading: boolean = true;
isMobile: boolean = false; isMobile: boolean = false;
gridView: boolean = true; gridView: boolean = true;
sortOptions: Option[] = [ sortOptions: Option[] = [
{value: 'alphAsc', label: 'Alphabetically Asc. (A-Z)'}, {value: 'alphAsc', label: 'Alphabetically Asc. (A-Z)'},
@ -31,6 +30,7 @@ export class BrowseStakeholderBaseComponent<T> extends StakeholderBaseComponent
keywordControl: FormControl; keywordControl: FormControl;
hasPublications: boolean = true; hasPublications: boolean = true;
hasOpenAccess: boolean = true; hasOpenAccess: boolean = true;
id = 'results';
/* Services */ /* Services */
protected layoutService: LayoutService; protected layoutService: LayoutService;
@ -101,7 +101,7 @@ export class BrowseStakeholderBaseComponent<T> extends StakeholderBaseComponent
updateCurrentPage($event) { updateCurrentPage($event) {
this.currentPage = $event.value; this.currentPage = $event.value;
HelperFunctions.scrollToId('target'); this._router.navigate([], {fragment: 'results', onSameUrlNavigation: 'reload'});
this.afterStakeholdersInitialized(); this.afterStakeholdersInitialized();
} }

View File

@ -264,7 +264,7 @@ export class IndicatorFilterUtils {
"indi_pub_downloads":"indi_pub_downloads.result.year", "indi_pub_downloads":"indi_pub_downloads.result.year",
"result_apc":"result_apc.result.year", "result_apc":"result_apc.result.year",
"result_apc_affiliations":"result_apc_affiliations.result.year", "result_apc_affiliations":"result_apc_affiliations.result.year",
"result_country":"result_country.result.year", "cross_country":"cross_country.year",
"indi_impact_measures": "indi_impact_measures.result.year", "indi_impact_measures": "indi_impact_measures.result.year",
"project": "project.start year" "project": "project.start year"
}, },
@ -286,7 +286,7 @@ export class IndicatorFilterUtils {
"indi_impact_measures":"indi_impact_measures.result.result_fos.lvl1", "indi_impact_measures":"indi_impact_measures.result.result_fos.lvl1",
"result_apc":"result_apc.result.result_fos.lvl1", "result_apc":"result_apc.result.result_fos.lvl1",
"result_apc_affiliations":"result_apc_affiliations.result.result_fos.lvl1", "result_apc_affiliations":"result_apc_affiliations.result.result_fos.lvl1",
"result_country":"result_country.result.result_fos.lvl1", "cross_country":"cross_country.lvl1",
"historical_snapshots_irish_fos":"historical_snapshots_irish_fos.lvl1" "historical_snapshots_irish_fos":"historical_snapshots_irish_fos.lvl1"
}, },
"foslvl2":{ "foslvl2":{
@ -297,7 +297,7 @@ export class IndicatorFilterUtils {
"indi_impact_measures":"indi_impact_measures.result.result_fos.lvl2", "indi_impact_measures":"indi_impact_measures.result.result_fos.lvl2",
"result_apc":"result_apc.result.result_fos.lvl2", "result_apc":"result_apc.result.result_fos.lvl2",
"result_apc_affiliations":"result_apc_affiliations.result.result_fos.lvl2", "result_apc_affiliations":"result_apc_affiliations.result.result_fos.lvl2",
"result_country":"result_country.result.result_fos.lvl2", "cross_country":"cross_country.lvl2",
"historical_snapshots_irish_fos":"historical_snapshots_irish_fos.lvl2" "historical_snapshots_irish_fos":"historical_snapshots_irish_fos.lvl2"
}, },
"publicly-funded":{ "publicly-funded":{
@ -307,7 +307,7 @@ export class IndicatorFilterUtils {
"indi_impact_measures":"indi_impact_measures.result.indi_pub_publicly_funded.publicly_funded", "indi_impact_measures":"indi_impact_measures.result.indi_pub_publicly_funded.publicly_funded",
"result_apc":"result_apc.result.indi_pub_publicly_funded.publicly_funded", "result_apc":"result_apc.result.indi_pub_publicly_funded.publicly_funded",
"result_apc_affiliations":"result_apc_affiliations.result.indi_pub_publicly_funded.publicly_funded", "result_apc_affiliations":"result_apc_affiliations.result.indi_pub_publicly_funded.publicly_funded",
"result_country":"result_country.result.indi_pub_publicly_funded.publicly_funded" "cross_country":"cross_country.publicly_funded"
} }
} }

View File

@ -49,7 +49,8 @@ export interface Option {
export interface Placeholder { export interface Placeholder {
label: string, label: string,
static?: boolean static?: boolean,
tooltip?: string
} }
export interface YearRange { export interface YearRange {
@ -80,50 +81,72 @@ declare var UIkit;
<div #inputBox class="input-box" [class.select]="selectable || type ==='date'" click-outside-or-esc <div #inputBox class="input-box" [class.select]="selectable || type ==='date'" click-outside-or-esc
[class.static]="placeholderInfo?.static" (clickOutside)="click($event)"> [class.static]="placeholderInfo?.static" (clickOutside)="click($event)">
<div *ngIf="!placeholderInfo?.static && placeholderInfo?.label" class="placeholder"> <div *ngIf="!placeholderInfo?.static && placeholderInfo?.label" class="placeholder">
<label>{{placeholderInfo.label}} <sup *ngIf="required">*</sup></label> <label>{{ placeholderInfo.label }} <sup *ngIf="required">*</sup></label>
</div> </div>
<div class="uk-flex" [class.uk-flex-middle]="type !== 'textarea'" <div class="uk-flex" [class.uk-flex-middle]="type !== 'textarea'"
[attr.uk-tooltip]="(tooltip && !focused && type !== 'chips' && type !== 'textarea' && (formControl.value || hint || placeholderInfo?.label))?('title: ' + (formControl.value ?getTooltip(formControl.value):(hint?hint:placeholderInfo?.label)) + '; delay: 500; pos: bottom-left'):null"> [attr.uk-tooltip]="placeholderInfo.tooltip?('title: ' + placeholderInfo.tooltip + '; delay: 500; pos: bottom-left'):
((tooltip && !focused && type !== 'chips' && type !== 'textarea' && (formControl.value || hint || placeholderInfo?.label))?
('title: ' + (formControl.value ?getTooltip(formControl.value):(hint?hint:placeholderInfo?.label)) + '; delay: 500; pos: bottom-left'):null)">
<ng-template [ngIf]="type === 'text' || type === 'URL' || type === 'logoURL'"> <ng-template [ngIf]="type === 'text' || type === 'URL' || type === 'logoURL'">
<input #input class="input" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint" <input #input class="input"
[attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
[type]="password?'password':'text'" [formControl]="formAsControl" [type]="password?'password':'text'" [formControl]="formAsControl"
[class.uk-text-truncate]="!focused"> [class.uk-text-truncate]="!focused">
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'textarea'"> <ng-template [ngIf]="type === 'textarea'">
<textarea #textArea class="input" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint" <textarea #textArea class="input"
[attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
[rows]="rows" [formControl]="formAsControl"></textarea> [rows]="rows" [formControl]="formAsControl"></textarea>
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'select'"> <ng-template [ngIf]="type === 'select'">
<ng-container *ngIf="placeholderInfo?.static"> <ng-container *ngIf="placeholderInfo?.static">
<div *ngIf="!getLabel(formControl.value)" <div *ngIf="!getLabel(formControl.value)"
class="input placeholder uk-width-expand uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{placeholderInfo.label}}</div> class="input placeholder uk-width-expand uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ placeholderInfo.label }}
</div>
<div *ngIf="getLabel(formControl.value)" <div *ngIf="getLabel(formControl.value)"
class="input uk-width-expand uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{getLabel(formControl.value)}}</div> class="input uk-width-expand uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ getLabel(formControl.value) }}
</div>
</ng-container> </ng-container>
<ng-container *ngIf="!placeholderInfo?.static"> <ng-container *ngIf="!placeholderInfo?.static">
<div *ngIf="!getLabel(formControl.value)" <div *ngIf="!getLabel(formControl.value)"
class="input uk-width-expand uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{noValueSelected}}</div> class="input uk-width-expand uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ noValueSelected }}
</div>
<div *ngIf="getLabel(formControl.value)" <div *ngIf="getLabel(formControl.value)"
class="input uk-width-expand uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{getLabel(formControl.value)}}</div> class="input uk-width-expand uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ getLabel(formControl.value) }}
</div>
</ng-container> </ng-container>
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'autocomplete'"> <ng-template [ngIf]="type === 'autocomplete'">
<input *ngIf="focused" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint" <input *ngIf="focused" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
#searchInput class="input" [formControl]="searchControl" [class.uk-text-truncate]="!focused"> #searchInput class="input" [formControl]="searchControl"
[class.uk-text-truncate]="!focused">
<ng-container *ngIf="!focused && !selectable"> <ng-container *ngIf="!focused && !selectable">
<div *ngIf="!getLabel(formControl.value)" <div *ngIf="!getLabel(formControl.value)"
class="input placeholder uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{placeholderInfo?.static ? placeholderInfo.label : getLabel(formAsControl.value)}}</div> class="input placeholder uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ placeholderInfo?.static ? placeholderInfo.label : getLabel(formAsControl.value) }}
</div>
<div *ngIf="getLabel(formControl.value)" <div *ngIf="getLabel(formControl.value)"
class="input uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{getLabel(formAsControl.value)}}</div> class="input uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ getLabel(formAsControl.value) }}
</div>
</ng-container> </ng-container>
<ng-container *ngIf="!focused && selectable"> <ng-container *ngIf="!focused && selectable">
<div *ngIf="!getLabel(formControl.value)" class="input uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{noValueSelected}}</div> <div *ngIf="!getLabel(formControl.value)" class="input uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ noValueSelected }}
</div>
<div *ngIf="getLabel(formControl.value)" <div *ngIf="getLabel(formControl.value)"
class="input uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{getLabel(formControl.value)}}</div> class="input uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ getLabel(formControl.value) }}
</div>
</ng-container> </ng-container>
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'autocomplete_soft'"> <ng-template [ngIf]="type === 'autocomplete_soft'">
<input #input class="input" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint" <input #input class="input"
[attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
[formControl]="formAsControl" [class.uk-text-truncate]="!focused"> [formControl]="formAsControl" [class.uk-text-truncate]="!focused">
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'chips'"> <ng-template [ngIf]="type === 'chips'">
@ -134,7 +157,7 @@ declare var UIkit;
class="chip"> class="chip">
<div class="uk-label uk-label-small uk-text-transform-none uk-flex uk-flex-middle" <div class="uk-label uk-label-small uk-text-transform-none uk-flex uk-flex-middle"
[attr.uk-tooltip]="(tooltip)?('title: ' + getLabel(chip.value) + '; delay: 500; pos: bottom-left'):null"> [attr.uk-tooltip]="(tooltip)?('title: ' + getLabel(chip.value) + '; delay: 500; pos: bottom-left'):null">
<span class="uk-text-truncate uk-width-expand">{{getLabel(chip.value)}}</span> <span class="uk-text-truncate uk-width-expand">{{ getLabel(chip.value) }}</span>
<icon *ngIf="focused" (click)="remove(i, $event)" <icon *ngIf="focused" (click)="remove(i, $event)"
class="uk-link-text uk-margin-small-left clickable" [flex]="true" class="uk-link-text uk-margin-small-left clickable" [flex]="true"
name="close" ratio="0.7"></icon> name="close" ratio="0.7"></icon>
@ -148,32 +171,42 @@ declare var UIkit;
</div> </div>
<div *ngIf="!focused && formAsArray.length > visibleChips" <div *ngIf="!focused && formAsArray.length > visibleChips"
class="uk-width-expand uk-flex uk-flex-column uk-flex-center more"> class="uk-width-expand uk-flex uk-flex-column uk-flex-center more">
+ {{(formAsArray.length - visibleChips)}} more + {{ (formAsArray.length - visibleChips) }} more
</div> </div>
</div> </div>
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'year-range' && yearRange && formAsGroup"> <ng-template [ngIf]="type === 'year-range' && yearRange && formAsGroup">
<div class="uk-width-2-5"> <div class="uk-width-2-5">
<input #input class="input uk-text-center uk-text-truncate" [attr.placeholder]="yearRange.from.placeholder" <input #input class="input uk-text-center uk-text-truncate"
maxlength="4" (click)="activeIndex = 0;$event.preventDefault()" [formControl]="getFormByName(yearRange.from.control)"> [attr.placeholder]="yearRange.from.placeholder"
maxlength="4" (click)="activeIndex = 0;$event.preventDefault()"
[formControl]="getFormByName(yearRange.from.control)">
</div> </div>
<div class="uk-width-1-5 uk-text-center">-</div> <div class="uk-width-1-5 uk-text-center">-</div>
<div class="uk-width-2-5"> <div class="uk-width-2-5">
<input #input class="input uk-text-center uk-text-truncate" [attr.placeholder]="yearRange.to.placeholder" <input #input class="input uk-text-center uk-text-truncate"
maxlength="4" (click)="activeIndex = 1;$event.preventDefault()" [formControl]="getFormByName(yearRange.to.control)"> [attr.placeholder]="yearRange.to.placeholder"
maxlength="4" (click)="activeIndex = 1;$event.preventDefault()"
[formControl]="getFormByName(yearRange.to.control)">
</div> </div>
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'date'"> <ng-template [ngIf]="type === 'date'">
<div *ngIf="!formAsControl.getRawValue()" class="input uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{selectADate}}</div> <div *ngIf="!formAsControl.getRawValue()" class="input uk-text-truncate"
<div *ngIf="formAsControl.getRawValue()" class="input uk-text-truncate" [class.uk-disabled]="formControl.disabled">{{formAsControl.getRawValue() | date: 'dd-MM-yyyy'}}</div> [class.uk-disabled]="formControl.disabled">{{ selectADate }}
</div>
<div *ngIf="formAsControl.getRawValue()" class="input uk-text-truncate"
[class.uk-disabled]="formControl.disabled">{{ formAsControl.getRawValue() | date: 'dd-MM-yyyy' }}
</div>
</ng-template> </ng-template>
<div *ngIf="(formControl.disabled && disabledIcon) || icon || (selectable && selectArrow) || type === 'autocomplete' || searchable || type === 'date'" <div *ngIf="(formControl.disabled && disabledIcon) || icon || (selectable && selectArrow) || type === 'autocomplete' || searchable || type === 'date'"
class="uk-margin-small-left icon"> class="uk-margin-small-left icon">
<icon *ngIf="formControl.disabled && disabledIcon" [name]="disabledIcon" [flex]="true"></icon> <icon *ngIf="formControl.disabled && disabledIcon" [name]="disabledIcon" [flex]="true"></icon>
<ng-template [ngIf]="formControl.enabled"> <ng-template [ngIf]="formControl.enabled">
<icon *ngIf="!searchControl?.value && icon" [name]="icon" [flex]="true"></icon> <icon *ngIf="!searchControl?.value && icon" [name]="icon" [flex]="true"></icon>
<icon *ngIf="!icon && selectable && selectArrow" [name]="selectArrow" [flex]="true"></icon> <icon *ngIf="!icon && selectable && selectArrow" [name]="selectArrow"
<button *ngIf="focused && type === 'autocomplete' && (!selectable || searchControl.value)" class="uk-close uk-icon" [flex]="true"></icon>
<button *ngIf="focused && type === 'autocomplete' && (!selectable || searchControl.value)"
class="uk-close uk-icon"
(click)="resetSearch($event)"> (click)="resetSearch($event)">
<icon [flex]="true" name="close"></icon> <icon [flex]="true" name="close"></icon>
</button> </button>
@ -193,28 +226,34 @@ declare var UIkit;
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="!mobile && type === 'date' && opened" class="uk-dropdown" #calendarBox <div *ngIf="!mobile && type === 'date' && opened" class="uk-dropdown" #calendarBox
uk-dropdown="pos: bottom-left; mode: none; flip: false ; shift: false" [attr.target]="'#' + id" [attr.boundary]="'#' + id" (click)="$event.stopPropagation()"> uk-dropdown="pos: bottom-left; mode: none; flip: false ; shift: false" [attr.target]="'#' + id"
<mat-calendar [selected]="selectedDate" [startAt]="selectedDate" (selectedChange)="dateChanged($event)"></mat-calendar> [attr.boundary]="'#' + id" (click)="$event.stopPropagation()">
<mat-calendar [selected]="selectedDate" [startAt]="selectedDate"
(selectedChange)="dateChanged($event)"></mat-calendar>
</div> </div>
<mobile-dropdown *ngIf="mobile && type === 'date' && opened" (onClose)="focus(false)" #mobileDropdown> <mobile-dropdown *ngIf="mobile && type === 'date' && opened" (onClose)="focus(false)" #mobileDropdown>
<mat-calendar [selected]="selectedDate" [startAt]="selectedDate" (selectedChange)="dateChanged($event)"></mat-calendar> <mat-calendar [selected]="selectedDate" [startAt]="selectedDate"
(selectedChange)="dateChanged($event)"></mat-calendar>
</mobile-dropdown> </mobile-dropdown>
<div *ngIf="!mobile && filteredOptions && filteredOptions.length > 0 && opened" class="options uk-dropdown" #optionBox <div *ngIf="!mobile && filteredOptions && filteredOptions.length > 0 && opened" class="options uk-dropdown"
#optionBox
uk-dropdown="mode: none; stretch: true; flip: false; shift: false" [attr.boundary]="'#' + id"> uk-dropdown="mode: none; stretch: true; flip: false; shift: false" [attr.boundary]="'#' + id">
<ul class="uk-nav uk-dropdown-nav"> <ul class="uk-nav uk-dropdown-nav">
<li *ngFor="let option of filteredOptions; let i=index" [class.uk-hidden]="option.hidden" <li *ngFor="let option of filteredOptions; let i=index" [class.uk-hidden]="option.hidden"
[class.uk-active]="(formControl.value === option.value) || selectedIndex === i"> [class.uk-active]="(formControl.value === option.value) || selectedIndex === i">
<a (click)="selectOption(option, $event)" <a (click)="selectOption(option, $event)"
[class]="option.disabled ? 'uk-disabled uk-text-muted' : ''"> [class]="option.disabled ? 'uk-disabled uk-text-muted' : ''">
<span [attr.uk-tooltip]="(tooltip)?('title: ' + (option.tooltip ? option.tooltip : option.label) + '; delay: 500; pos:bottom-left'):null">{{option.label}}</span> <span [attr.uk-tooltip]="(tooltip)?('title: ' + (option.tooltip ? option.tooltip : option.label) + '; delay: 500; pos:bottom-left'):null">{{ option.label }}</span>
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
<mobile-dropdown *ngIf="mobile && filteredOptions && filteredOptions.length > 0 && opened" (onClose)="focus(false)" #mobileDropdown> <mobile-dropdown *ngIf="mobile && filteredOptions && filteredOptions.length > 0 && opened"
<div *ngIf="placeholderInfo" class="uk-text-emphasis uk-text-bolder uk-text-center uk-padding-small uk-padding-remove-vertical uk-text-uppercase"> (onClose)="focus(false)" #mobileDropdown>
{{placeholderInfo.label}} <div *ngIf="placeholderInfo"
class="uk-text-emphasis uk-text-bolder uk-text-center uk-padding-small uk-padding-remove-vertical uk-text-uppercase">
{{ placeholderInfo.label }}
</div> </div>
<div class="uk-padding uk-padding-remove-horizontal"> <div class="uk-padding uk-padding-remove-horizontal">
<ul class="uk-nav uk-nav-default"> <ul class="uk-nav uk-nav-default">
@ -222,7 +261,7 @@ declare var UIkit;
[class.uk-active]="formControl.value === option.value"> [class.uk-active]="formControl.value === option.value">
<a (click)="selectOption(option, $event)" <a (click)="selectOption(option, $event)"
[class]="option.disabled ? 'uk-disabled uk-text-muted' : ''"> [class]="option.disabled ? 'uk-disabled uk-text-muted' : ''">
<span>{{option.label}}</span> <span>{{ option.label }}</span>
</a> </a>
</li> </li>
</ul> </ul>
@ -230,7 +269,7 @@ declare var UIkit;
</mobile-dropdown> </mobile-dropdown>
</div> </div>
<span *ngIf="formControl?.invalid && formControl?.touched" class="uk-text-small uk-text-danger"> <span *ngIf="formControl?.invalid && formControl?.touched" class="uk-text-small uk-text-danger">
<span *ngIf="errors?.error">{{errors?.error}}</span> <span *ngIf="errors?.error">{{ errors?.error }}</span>
<span *ngIf="type === 'URL' || type === 'logoURL'">Please provide a valid URL (e.g. https://example.com)</span> <span *ngIf="type === 'URL' || type === 'logoURL'">Please provide a valid URL (e.g. https://example.com)</span>
</span> </span>
<span class="uk-text-small uk-text-danger"> <span class="uk-text-small uk-text-danger">
@ -320,7 +359,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
@Input() @Input()
set placeholder(placeholder: string | Placeholder) { set placeholder(placeholder: string | Placeholder) {
if(this.type === 'year-range') { if (this.type === 'year-range') {
this.placeholderInfo = null; this.placeholderInfo = null;
} else if (typeof placeholder === 'string') { } else if (typeof placeholder === 'string') {
this.placeholderInfo = {label: placeholder, static: false}; this.placeholderInfo = {label: placeholder, static: false};
@ -336,7 +375,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
@Input() @Input()
set options(options: (Option | string | number) []) { set options(options: (Option | string | number) []) {
this.optionsArray = options.map(option => { this.optionsArray = options.map(option => {
if(option === null) { if (option === null) {
return { return {
label: this.noValueSelected, label: this.noValueSelected,
value: '' value: ''
@ -537,20 +576,20 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
} }
get yearRangeActive(): boolean { get yearRangeActive(): boolean {
if(this.yearRange) { if (this.yearRange) {
return this.formAsGroup && (this.getFormByName(this.yearRange.from.control)?.value || this.getFormByName(this.yearRange.to.control)?.value); return this.formAsGroup && (this.getFormByName(this.yearRange.from.control)?.value || this.getFormByName(this.yearRange.to.control)?.value);
} }
return false; return false;
} }
get errors(): any { get errors(): any {
if(this.formAsGroup) { if (this.formAsGroup) {
return (this.formAsGroup.errors return (this.formAsGroup.errors
?this.formAsGroup.errors:(this.getFormByName(this.yearRange.from.control).errors ? this.formAsGroup.errors : (this.getFormByName(this.yearRange.from.control).errors
?this.getFormByName(this.yearRange.from.control).errors:this.getFormByName(this.yearRange.to.control).errors)); ? this.getFormByName(this.yearRange.from.control).errors : this.getFormByName(this.yearRange.to.control).errors));
} else if(this.formAsControl) { } else if (this.formAsControl) {
return this.formAsControl.errors; return this.formAsControl.errors;
} else if(this.searchControl) { } else if (this.searchControl) {
return this.searchControl.errors; return this.searchControl.errors;
} else { } else {
return null; return null;
@ -578,7 +617,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
if (this.focused) { if (this.focused) {
this.open(true); this.open(true);
setTimeout(() => { setTimeout(() => {
if(this.searchInput) { if (this.searchInput) {
this.searchInput.nativeElement.focus(); this.searchInput.nativeElement.focus();
this.searchInput.nativeElement.value = value; this.searchInput.nativeElement.value = value;
} }
@ -590,12 +629,12 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
let validator = this.formControl.validator({} as AbstractControl); let validator = this.formControl.validator({} as AbstractControl);
this.required = (validator && validator.required); this.required = (validator && validator.required);
} }
if(this.type === 'date') { if (this.type === 'date') {
this.selectedDate = this.formAsControl.getRawValue()?new Date(this.formAsControl.getRawValue()):null; this.selectedDate = this.formAsControl.getRawValue() ? new Date(this.formAsControl.getRawValue()) : null;
} }
this.subscriptions.push(this.formControl.valueChanges.subscribe(value => { this.subscriptions.push(this.formControl.valueChanges.subscribe(value => {
if (this.formControl.enabled) { if (this.formControl.enabled) {
if(this.type !== 'year-range') { if (this.type !== 'year-range') {
value = (value === '') ? null : value; value = (value === '') ? null : value;
if (this.type === 'logoURL') { if (this.type === 'logoURL') {
this.secure = (!value || value.includes('https://')); this.secure = (!value || value.includes('https://'));
@ -613,7 +652,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
} }
} }
if (this.type === 'date') { if (this.type === 'date') {
this.selectedDate = value?new Date(value):null; this.selectedDate = value ? new Date(value) : null;
} }
} }
if ((this.value && value && this.value !== value) || (!this.value && value) || this.value && !value) { if ((this.value && value && this.value !== value) || (!this.value && value) || this.value && !value) {
@ -621,7 +660,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
} }
} }
})); }));
if(this.formAsGroup) { if (this.formAsGroup) {
let fromControl = this.formAsGroup.get(this.yearRange.from.control); let fromControl = this.formAsGroup.get(this.yearRange.from.control);
this.subscriptions.push(fromControl.valueChanges.subscribe(value => { this.subscriptions.push(fromControl.valueChanges.subscribe(value => {
let from = this.initValue[this.yearRange.from.control]; let from = this.initValue[this.yearRange.from.control];
@ -630,8 +669,8 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
} else { } else {
fromControl.markAsDirty(); fromControl.markAsDirty();
} }
if(fromControl.valid) { if (fromControl.valid) {
if(this.activeIndex === 0 && value) { if (this.activeIndex === 0 && value) {
this.activeIndex = 1; this.activeIndex = 1;
this.input.get(this.activeIndex).nativeElement.focus(); this.input.get(this.activeIndex).nativeElement.focus();
} }
@ -745,13 +784,13 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
} }
focus(value: boolean, event = null) { focus(value: boolean, event = null) {
if(!this.activeIndex) { if (!this.activeIndex) {
this.activeIndex = 0; this.activeIndex = 0;
} }
if (this.focused) { if (this.focused) {
this.formControl.markAsTouched(); this.formControl.markAsTouched();
} }
if(this.formControl.enabled) { if (this.formControl.enabled) {
this.focused = value; this.focused = value;
this.cdr.detectChanges(); this.cdr.detectChanges();
if (this.focused) { if (this.focused) {
@ -791,7 +830,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
open(value: boolean) { open(value: boolean) {
this.opened = value && this.formControl.enabled; this.opened = value && this.formControl.enabled;
this.cdr.detectChanges(); this.cdr.detectChanges();
if(this.optionBox) { if (this.optionBox) {
if (this.opened) { if (this.opened) {
this.selectedIndex = this.filteredOptions.findIndex(option => option.value === this.formControl.value); this.selectedIndex = this.filteredOptions.findIndex(option => option.value === this.formControl.value);
if (this.selectedIndex === -1 && this.type !== 'autocomplete_soft') { if (this.selectedIndex === -1 && this.type !== 'autocomplete_soft') {
@ -802,17 +841,17 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
UIkit.dropdown(this.optionBox.nativeElement).hide(); UIkit.dropdown(this.optionBox.nativeElement).hide();
this.focused = false; this.focused = false;
} }
} else if(this.calendarBox) { } else if (this.calendarBox) {
if (this.opened) { if (this.opened) {
UIkit.dropdown(this.calendarBox.nativeElement).show(); UIkit.dropdown(this.calendarBox.nativeElement).show();
} else { } else {
UIkit.dropdown(this.calendarBox.nativeElement).hide(); UIkit.dropdown(this.calendarBox.nativeElement).hide();
this.focused = false; this.focused = false;
} }
} else if(this.mobileDropdown) { } else if (this.mobileDropdown) {
if(this.opened) { if (this.opened) {
this.mobileDropdown.open(); this.mobileDropdown.open();
if(this.searchInput) { if (this.searchInput) {
this.searchInput.nativeElement.blur(); this.searchInput.nativeElement.blur();
} }
} else { } else {
@ -845,7 +884,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
this.searchControl.setValue(''); this.searchControl.setValue('');
} }
} }
if(this.mobileDropdown) { if (this.mobileDropdown) {
this.mobileDropdown.close(); this.mobileDropdown.close();
} }
} }

View File

@ -23,7 +23,7 @@ import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive";
<div class="uk-flex uk-flex-middle"> <div class="uk-flex uk-flex-middle">
<div class="uk-width-expand"> <div class="uk-width-expand">
<div #input [class.uk-hidden]="hidden" input [formInput]="searchControl" [inputClass]="'search'+(iconPosition === 'left'?' icon-left':'')" [disabledIcon]="null" <div #input [class.uk-hidden]="hidden" input [formInput]="searchControl" [inputClass]="'search'+(iconPosition === 'left'?' icon-left':'')" [disabledIcon]="null"
[placeholder]="{label: placeholder, static: true}" [value]="value" (valueChange)="valueChange.emit($event)" [placeholder]="{label: placeholder, static: true, tooltip: tooltip}" [value]="value" (valueChange)="valueChange.emit($event)"
[disabled]="disabled" [showOptionsOnEmpty]="false" [type]="(options.length > 0?'autocomplete_soft':'text')" [options]="options"></div> [disabled]="disabled" [showOptionsOnEmpty]="false" [type]="(options.length > 0?'autocomplete_soft':'text')" [options]="options"></div>
</div> </div>
<div [class.uk-hidden]="(!searchControl?.value && !value) || disabled" class="uk-width-auto"> <div [class.uk-hidden]="(!searchControl?.value && !value) || disabled" class="uk-width-auto">
@ -53,6 +53,7 @@ export class SearchInputComponent implements OnInit, AfterViewInit {
@Output() valueChange = new EventEmitter<string>(); @Output() valueChange = new EventEmitter<string>();
@Input() options: string[] = []; @Input() options: string[] = [];
@Input() placeholder: string; @Input() placeholder: string;
@Input() tooltip: string;
@Input() expandable: boolean = false; @Input() expandable: boolean = false;
@Output() searchEmitter: EventEmitter<void> = new EventEmitter<void>(); @Output() searchEmitter: EventEmitter<void> = new EventEmitter<void>();
@ViewChild('searchInput') searchInput: ElementRef; @ViewChild('searchInput') searchInput: ElementRef;

View File

@ -46,8 +46,11 @@ export class DataProviderInfo {
// aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string}; // aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string};
aggregationStatus: { "fulltexts": string }; aggregationStatus: { "fulltexts": string };
/** @deprecated*/
tabs: { "name": string, "content": string }[]; tabs: { "name": string, "content": string }[];
/** @deprecated*/
tabs2: string[] = []; tabs2: string[] = [];
/** @deprecated*/
tabsInTypes = { tabsInTypes = {
"publicationsTab": new Set<string>( "publicationsTab": new Set<string>(
["aggregator::datarepository", ["aggregator::datarepository",
@ -196,11 +199,14 @@ export class DataProviderInfo {
organizations: { "acronym": string, "name": string, "id": string }[] = []; organizations: { "acronym": string, "name": string, "id": string }[] = [];
//publications: any; //publications: any;
//datasets: any; //datasets: any;
/** @deprecated*/
statistics: any; statistics: any;
//projects: any; //projects: any;
/** @deprecated*/
datasources: any; datasources: any;
//relatedDatasources: Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>; //relatedDatasources: Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>;
// Search query
relatedDatasources: { "id": string, "name": string, "count": number }[] = []; relatedDatasources: { "id": string, "name": string, "count": number }[] = [];
belongsTo: boolean = true; belongsTo: boolean = true;

View File

@ -21,8 +21,8 @@ export class OrganizationInfo {
name: string; name: string;
country: string; country: string;
objIdentifier: string; objIdentifier: string;
/** @deprecated*/ //deprecated - search query
projects: Map<string, OrganizationProject[]>; projects: Map<string, OrganizationProject[]>;
//dataProviders: { name: string; url: string; type: string; websiteUrl: string; //dataProviders: { name: string; url: string; type: string; websiteUrl: string;
// organizations: {name: string; url: string}[]}[]; // organizations: {name: string; url: string}[]}[];