Add mobile-dropown in dropdown-filter. Fix input autocomplete in mobile. Fix icon alignment in fundedBy. Add scroll to top in fs-modal and on change tab in landing mobile bar.

This commit is contained in:
Konstantinos Triantafyllou 2023-07-26 11:49:50 +03:00
parent 0a79d2a17e
commit 056faac88f
11 changed files with 55 additions and 35 deletions

View File

@ -437,19 +437,19 @@
<div class="landing-action-bar-mobile uk-background-default">
<div class="uk-container uk-flex-middle uk-grid uk-text-xsmall uk-text-meta" [ngClass]="hasMetrics ? 'uk-child-width-1-3' : 'uk-child-width-1-2'">
<div>
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'info'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'info'; scroll()">
<icon name="note_add" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'info' ? 'uk-text-primary': ''"></icon>
<span>{{openaireEntities.DATASOURCE}}</span>
</a>
</div>
<div *ngIf="dataProviderInfo && hasMetrics">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'metrics'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'metrics'; scroll()">
<icon name="bar_chart" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'metrics' ? 'uk-text-primary': ''"></icon>
<span>Metrics</span>
</a>
</div>
<div>
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'actions'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'actions'; scroll()">
<icon name="pending" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'actions' ? 'uk-text-primary': ''"></icon>
<span>Actions</span>
</a>

View File

@ -34,8 +34,8 @@ import {RouterHelper} from "../../utils/routerHelper.class";
</div>
<div *ngIf="isMobile">
<div *ngFor="let item of fundedByProjects.slice(0, viewAll?fundedByProjects.length:threshold) let i=index"
class="uk-flex uk-flex-between uk-flex-middle uk-margin-small-bottom">
<span class="uk-text-emphasis">
class="uk-flex uk-flex-middle uk-margin-small-bottom">
<span class="uk-text-emphasis uk-width-expand">
<ng-container *ngTemplateOutlet="funder; context: {item: item}"></ng-container>
</span>
<a #toggle><icon name="info" visuallyHidden="info" [type]="'outlined'"></icon></a>

View File

@ -1,8 +1,6 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {StringUtils} from '../../utils/string-utils.class';
@ -18,7 +16,7 @@ import {OpenaireEntities} from '../../utils/properties/searchFields';
<ng-container *ngFor="let filter of fetchProjects.filters">
<div class="uk-inline">
<dropdown-filter #dropdownFilter dropdownClass="uk-width-large uk-padding-small uk-margin-medium-bottom"
[name]="filter.title" [count]="filter.countSelectedValues">
[name]="filter.title" [count]="filter.countSelectedValues" [isMobile]="isMobile">
<div class="uk-padding-small uk-overflow-auto uk-height-max-large uk-height-min-medium">
<search-filter [filter]="filter"
[showResultCount]=true filterValuesNum="0"
@ -57,6 +55,7 @@ export class ProjectsInModalComponent {
@Input() organizationId: string = "";
@Input() properties: EnvProperties;
@Input() modal: AlertModal;
@Input() isMobile: boolean = false;
public page: number = 1;
public size: number = 5;
@ -66,12 +65,7 @@ export class ProjectsInModalComponent {
private filterQuery: string = "";
public openaireEntities = OpenaireEntities;
constructor(private route: ActivatedRoute,
private _searchProjectsService: SearchProjectsService) {
}
ngOnInit() {
if (this.organizationId) {
if (this.fetchProjects.searchUtils.totalResults > 0) {

View File

@ -208,7 +208,7 @@
<!-- Tabs content section -->
<div id="landing-sections" class="uk-text-small">
<div id="projects" class="landing-section landing-section-height-auto">
<projectsInModal [fetchProjects]="fetchProjects"
<projectsInModal [fetchProjects]="fetchProjects" [isMobile]="isMobile"
[organizationId]="organizationId" [properties]=properties [prevPath]="prevPath">
</projectsInModal>
</div>
@ -366,13 +366,13 @@
<div class="landing-action-bar-mobile uk-background-default">
<div class="uk-container uk-grid uk-flex-middle uk-child-width-1-2 uk-text-xsmall uk-text-meta">
<div>
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'info'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'info'; scroll()">
<icon name="corporate_fare" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'info' ? 'uk-text-primary': ''"></icon>
<span>{{openaireEntities.ORGANIZATION}}</span>
</a>
</div>
<div>
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'actions'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'actions'; scroll()">
<icon name="pending" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'actions' ? 'uk-text-primary': ''"></icon>
<span>Actions</span>
</a>
@ -533,7 +533,7 @@
<fs-modal *ngIf="isMobile" #fsModal classTitle="uk-tile-default uk-border-bottom">
<div *ngIf="activeTab == 'projects'" class="landing-section landing-section-height-auto">
<projectsInModal [fetchProjects]="fetchProjects"
<projectsInModal [fetchProjects]="fetchProjects" [isMobile]="isMobile"
[organizationId]="organizationId" [properties]=properties [prevPath]="prevPath">
</projectsInModal>
</div>

View File

@ -561,19 +561,19 @@
<div class="landing-action-bar-mobile uk-background-default">
<div class="uk-container uk-flex-middle uk-grid uk-text-xsmall uk-text-meta" [ngClass]="hasMetrics ? 'uk-child-width-1-3' : 'uk-child-width-1-2'">
<div>
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'info'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'info'; scroll()">
<icon name="assignment_turned_in" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'info' ? 'uk-text-primary': ''"></icon>
<span>{{openaireEntities.PROJECT}}</span>
</a>
</div>
<div *ngIf="projectInfo && hasMetrics">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'metrics'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'metrics'; scroll()">
<icon name="bar_chart" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'metrics' ? 'uk-text-primary': ''"></icon>
<span>Metrics</span>
</a>
</div>
<div>
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'actions'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'actions'; scroll()">
<icon name="pending" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'actions' ? 'uk-text-primary': ''"></icon>
<span>Actions</span>
</a>

View File

@ -672,7 +672,7 @@
<div class="landing-action-bar-mobile uk-background-default">
<div class="uk-container uk-flex-middle uk-grid uk-text-xsmall uk-text-meta" [ngClass]="(resultLandingInfo.measure || hasAltMetrics) ? 'uk-child-width-1-3' : 'uk-child-width-1-2'">
<div>
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'info'; egiTransferModalOpen = false;">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'info'; egiTransferModalOpen = false; scroll();">
<span [ngClass]="mobileContent == 'info' ? 'uk-text-primary': ''">
<icon *ngIf="getTypeName().toLowerCase() == 'publication'" name="description" type="outlined" [flex]="true" [ratio]="2"></icon>
<icon *ngIf="getTypeName().toLowerCase() == 'research data'" name="database" type="outlined" [flex]="true" [ratio]="2"></icon>
@ -686,13 +686,13 @@
</a>
</div>
<div *ngIf="resultLandingInfo && (resultLandingInfo.measure || hasAltMetrics)">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'metrics'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'metrics'; scroll()">
<icon name="bar_chart" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'metrics' ? 'uk-text-primary': ''"></icon>
<span>Metrics</span>
</a>
</div>
<div>
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'actions'">
<a class="uk-flex uk-flex-column uk-flex-middle uk-flex-center uk-link-reset" (click)="mobileContent = 'actions'; scroll()">
<icon name="pending" type="outlined" [flex]="true" [ratio]="2" [ngClass]="mobileContent == 'actions' ? 'uk-text-primary': ''"></icon>
<span>Actions</span>
</a>

View File

@ -211,7 +211,7 @@ declare var UIkit;
</li>
</ul>
</div>
<mobile-dropdown *ngIf="mobile && filteredOptions && filteredOptions.length > 0 && opened" #mobileDropdown>
<mobile-dropdown *ngIf="mobile && filteredOptions && filteredOptions.length > 0 && opened" (onClose)="focus(false)" #mobileDropdown>
<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>
@ -839,6 +839,9 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
this.searchControl.setValue('');
}
}
if(this.mobileDropdown) {
this.mobileDropdown.close();
}
}
dateChanged(event: Date) {

View File

@ -1,23 +1,32 @@
import {Component, ElementRef, Input, ViewChild} from "@angular/core";
import {MobileDropdownComponent} from "../mobile-dropdown/mobile-dropdown.component";
declare var UIkit;
@Component({
selector: 'dropdown-filter',
template: `
<button class="uk-button uk-button-default uk-flex uk-flex-middle"
<button #toggle class="uk-button uk-button-default uk-flex uk-flex-middle"
[class.uk-disabled]="disabled" [disabled]="disabled">
<span>{{name}}<span *ngIf="count > 0">({{count}})</span></span>
<icon [flex]="true" class="uk-margin-xsmall-left" [name]="'expand_' + (isOpen?'less':'more')"></icon>
</button>
<div #dropdownElement class="uk-dropdown"
<div *ngIf="!isMobile" #dropdownElement class="uk-dropdown"
[class.uk-height-max-large]="overflow" [class.uk-overflow-auto]="overflow"
[ngStyle]="dropdownMinWidth?{'min-width.px': dropdownMinWidth}:''"
[ngClass]="dropdownClass" uk-dropdown="mode: click; delay-hide: 0;">
<div>
<ng-content></ng-content>
<ng-container *ngTemplateOutlet="content"></ng-container>
</div>
</div>
<mobile-dropdown #mobileDropdown [toggle]="toggle">
<div [ngClass]="dropdownClass">
<ng-container *ngTemplateOutlet="content"></ng-container>
</div>
</mobile-dropdown>
<ng-template #content>
<ng-content></ng-content>
</ng-template>
`
})
export class DropdownFilterComponent {
@ -33,13 +42,24 @@ export class DropdownFilterComponent {
public overflow: boolean = true;
@Input()
public disabled = false;
@Input()
public isMobile: boolean = false;
@ViewChild("dropdownElement") dropdownElement: ElementRef;
@ViewChild("mobileDropdown") mobileDropdown: MobileDropdownComponent;
get isOpen() {
return (typeof document !== 'undefined') && this.dropdownElement && UIkit.dropdown(this.dropdownElement.nativeElement).isActive();
if(this.isMobile) {
return this.mobileDropdown?.opened;
} else {
return (typeof document !== 'undefined') && this.dropdownElement && UIkit.dropdown(this.dropdownElement.nativeElement).isActive();
}
}
closeDropdown() {
UIkit.dropdown(this.dropdownElement.nativeElement).hide();
if(this.isMobile) {
this.mobileDropdown.close();
} else {
UIkit.dropdown(this.dropdownElement.nativeElement).hide();
}
}
}

View File

@ -2,9 +2,10 @@ import {NgModule} from "@angular/core";
import {CommonModule} from "@angular/common";
import {DropdownFilterComponent} from "./dropdown-filter.component";
import {IconsModule} from "../icons/icons.module";
import {MobileDropdownModule} from "../mobile-dropdown/mobile-dropdown.module";
@NgModule({
imports: [CommonModule, IconsModule],
imports: [CommonModule, IconsModule, MobileDropdownModule],
declarations: [DropdownFilterComponent],
exports: [DropdownFilterComponent]
})

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, Input, OnInit} from "@angular/core";
import {Component, ElementRef, EventEmitter, Input, OnInit, Output} from "@angular/core";
@Component({
selector: 'mobile-dropdown',
@ -15,7 +15,8 @@ import {Component, ElementRef, Input, OnInit} from "@angular/core";
</div>`
})
export class MobileDropdownComponent implements OnInit{
@Input() toggle: HTMLAnchorElement;
@Input() toggle: HTMLAnchorElement | HTMLButtonElement;
@Output() onClose: EventEmitter<void> = new EventEmitter;
public opened: boolean = false;
private static MOBILE_DROPDOWN_CONTAINER = 'mobile-dropdown-container';
@ -56,6 +57,7 @@ export class MobileDropdownComponent implements OnInit{
close() {
if(this.opened) {
this.opened = false;
this.onClose.emit();
document.getElementsByTagName('body')[0].setAttribute('style', '');
}
}

View File

@ -142,7 +142,7 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy {
open() {
UIkit.modal(this.modal.nativeElement).show();
HelperFunctions.scroll();
this.body.nativeElement.scrollTo(0, 0);
}
cancel() {