[Library | Trunk]: Fix pids bug with content id
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60858 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
b227f1d9f6
commit
bd76f273da
|
@ -1,4 +1,14 @@
|
|||
import {AfterViewInit, Component, ElementRef, HostListener, Input, OnInit, ViewChild} from '@angular/core';
|
||||
import {
|
||||
AfterViewInit,
|
||||
Component,
|
||||
Directive,
|
||||
ElementRef,
|
||||
HostListener,
|
||||
Input,
|
||||
OnInit, QueryList,
|
||||
ViewChild,
|
||||
ViewChildren, ViewContainerRef
|
||||
} from '@angular/core';
|
||||
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||
import {EnvProperties} from "../../utils/properties/env-properties";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
|
@ -11,7 +21,7 @@ import {properties} from "../../../../environments/environment";
|
|||
<ng-container *ngFor="let key of keys let i=index">
|
||||
<div [class.multi-line-ellipsis]="large.get(key) && !showAll" [class.lines-2]="keys.length === 1" [class.line-1]="keys.length > 1">
|
||||
<p class="custom-break uk-margin-remove">
|
||||
<span [id]="key">
|
||||
<span #content [id]="key">
|
||||
<span class="uk-text-bold uk-text-uppercase">{{key}}: </span>
|
||||
<ng-container *ngFor="let item of identifiers.get(key) let j=index">
|
||||
<a *ngIf="key=='doi'" [href]="properties.doiURL + item" target="_blank" class="uk-display-inline">
|
||||
|
@ -27,7 +37,7 @@ import {properties} from "../../../../environments/environment";
|
|||
{{item}} <span class="custom-external custom-icon space"></span>
|
||||
</a>
|
||||
<ng-container *ngIf="(j !== (identifiers.get(key).length - 1))">, </ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -38,23 +48,19 @@ import {properties} from "../../../../environments/environment";
|
|||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class ShowIdentifiersComponent implements OnInit, AfterViewInit {
|
||||
export class ShowIdentifiersComponent implements AfterViewInit {
|
||||
@Input() identifiers: Map<string, string[]>;
|
||||
@Input() showViewAll: boolean = false;
|
||||
large: Map<string, boolean> = new Map<string, boolean>();
|
||||
showAll: boolean = false;
|
||||
properties: EnvProperties = properties;
|
||||
@ViewChildren("content", { read: ElementRef }) types: QueryList<ElementRef>;
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
onResize(event) {
|
||||
this.checkLarge();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.checkLarge();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.checkLarge();
|
||||
}
|
||||
|
@ -63,7 +69,8 @@ export class ShowIdentifiersComponent implements OnInit, AfterViewInit {
|
|||
let overflow = (this.keys.length === 1?42:21);
|
||||
if(typeof document !== "undefined") {
|
||||
this.keys.forEach(key => {
|
||||
this.large.set(key, document.getElementById(key) && document.getElementById(key).offsetHeight > overflow)
|
||||
let type = this.types.find(type => type.nativeElement.id === key);
|
||||
this.large.set(key, type && type.nativeElement.offsetHeight > overflow)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue