176 lines
6.9 KiB
TypeScript
176 lines
6.9 KiB
TypeScript
import {
|
|
AfterContentChecked,
|
|
AfterViewInit,
|
|
ChangeDetectorRef,
|
|
Component,
|
|
OnDestroy,
|
|
OnInit,
|
|
ViewChild
|
|
} from "@angular/core";
|
|
import {Subscription} from "rxjs";
|
|
import {Meta, Title} from "@angular/platform-browser";
|
|
import {ActivatedRoute, Router} from "@angular/router";
|
|
import {OpenaireEntities} from "../../utils/properties/searchFields";
|
|
import {SEOService} from "../../sharedComponents/SEO/SEO.service";
|
|
import {properties} from "../../../../environments/environment";
|
|
import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
|
|
import {HelperService} from "../../utils/helper/helper.service";
|
|
|
|
|
|
declare var ResizeObserver;
|
|
|
|
@Component({
|
|
selector: 'terminology',
|
|
template: `
|
|
<div id="graph_element" #graph_element class="uk-blur-background" uk-sticky="bottom: true;" [attr.offset]="graph_offset">
|
|
<div class="uk-container uk-container-large uk-margin-small-top uk-margin-small-bottom">
|
|
<icon name="graph" customClass="text-graph"></icon>
|
|
<span class="uk-margin-small-left uk-text-meta">More information for </span>
|
|
<a href="https://graph.openaire.eu" class="text-graph">OpenAIRE Research Graph</a>
|
|
<span class="uk-text-meta">.</span>
|
|
</div>
|
|
</div>
|
|
<div class="uk-background-muted">
|
|
<div class="uk-container uk-container-large uk-section uk-section-small">
|
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
<breadcrumbs [breadcrumbs]="breadcrumbs"></breadcrumbs>
|
|
</div>
|
|
<div class="uk-text-center" uk-scrollspy-class>
|
|
<h1 class="uk-margin-medium-top uk-margin-medium-bottom">Terminology and <br> construction<span class="uk-text-primary">.</span></h1>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div *ngIf="divContents" class="uk-section" uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; delay: 250">
|
|
<div class="uk-section uk-container uk-container-large" uk-scrollspy-class>
|
|
<div id="parentContainer" class="uk-grid uk-grid-large" uk-grid>
|
|
<div class="uk-width-1-4@m uk-margin-top uk-visible@m">
|
|
<div class="uk-sticky" uk-sticky="bottom: !#parentContainer; offset: 100;">
|
|
<slider-tabs type="scrollable" position="left">
|
|
<slider-tab tabId="entities" tabTitle="1. Entities"></slider-tab>
|
|
<slider-tab tabId="inherited-and-inferred-attributes" tabTitle="2. Inherited and Inferred Attributes"></slider-tab>
|
|
<slider-tab tabId="constructed-attributes" tabTitle="3. Constructed Attributes"></slider-tab>
|
|
</slider-tabs>
|
|
</div>
|
|
</div>
|
|
<div class="uk-width-1-1 uk-margin-top uk-hidden@m">
|
|
<div class="uk-sticky uk-background-default" uk-sticky>
|
|
<slider-tabs type="scrollable" position="horizontal">
|
|
<slider-tab tabId="entities" tabTitle="1. Entities"></slider-tab>
|
|
<slider-tab tabId="inherited-and-inferred-attributes" tabTitle="2. Inherited and Inferred Attributes"></slider-tab>
|
|
<slider-tab tabId="constructed-attributes" tabTitle="3. Constructed Attributes"></slider-tab>
|
|
</slider-tabs>
|
|
</div>
|
|
</div>
|
|
<div class="uk-width-expand@m uk-margin-top">
|
|
<div id="entities" class="uk-margin-large-bottom">
|
|
<helper [texts]="divContents['entities']"></helper>
|
|
</div>
|
|
<div id="inherited-and-inferred-attributes" class="uk-margin-large-bottom">
|
|
<helper [texts]="divContents['inherited-and-inferred-attributes']"></helper>
|
|
</div>
|
|
<div id="constructed-attributes" class="uk-margin-large-bottom">
|
|
<helper [texts]="divContents['constructed-attributes']"></helper>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
})
|
|
export class TerminologyComponent implements OnInit, OnDestroy, AfterViewInit, AfterContentChecked {
|
|
public tab: 'entities' | 'attributes' = 'entities';
|
|
private subscriptions: any[] = [];
|
|
public openaireEntities = OpenaireEntities;
|
|
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Resources - Terminology and construction', keepFormat: true}];
|
|
public graph_offset: number = 0;
|
|
public graph_height: number = 0;
|
|
@ViewChild("graph_element") graph_element;
|
|
public contentSections: string[] = ['entities', 'inherited-and-inferred-attributes', 'constructed-attributes'];
|
|
public activeSection: string;
|
|
public properties = properties;
|
|
public divContents: any;
|
|
|
|
constructor(private seoService: SEOService,
|
|
private meta: Meta,
|
|
private router: Router,
|
|
private route: ActivatedRoute,
|
|
private title: Title,
|
|
private cdr: ChangeDetectorRef,
|
|
private helper: HelperService) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.subscriptions.push(this.route.params.subscribe(params => {
|
|
const description = "Monitor | Terminology and construction";
|
|
const title = "Monitor | Terminology and construction";
|
|
this.metaTags(title, description);
|
|
this.breadcrumbs[0].route = '/' + (params['stakeholder']?params['stakeholder']:'');
|
|
this.breadcrumbs[0].name = (params['stakeholder']?'dashboard':'home');
|
|
}));
|
|
this.subscriptions.push(this.route.fragment.subscribe(fragment => {
|
|
if(fragment) {
|
|
this.activeSection = fragment;
|
|
} else {
|
|
this.activeSection = 'entities';
|
|
}
|
|
}));
|
|
this.getDivContents();
|
|
}
|
|
|
|
ngAfterViewInit() {
|
|
if (typeof document !== 'undefined') {
|
|
if(this.graph_element) {
|
|
this.observeGraphElement();
|
|
}
|
|
}
|
|
}
|
|
|
|
ngAfterContentChecked() {
|
|
if(this.graph_element && typeof document !== 'undefined') {
|
|
this.graph_offset = this.calcGraphOffset(this.graph_element.nativeElement);
|
|
}
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.subscriptions.forEach(subscription => {
|
|
if (subscription instanceof Subscription) {
|
|
subscription.unsubscribe();
|
|
}
|
|
});
|
|
}
|
|
|
|
private getDivContents() {
|
|
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'monitor', this.router.url).subscribe(contents => {
|
|
this.divContents = contents;
|
|
}));
|
|
}
|
|
|
|
public observeGraphElement() {
|
|
let resizeObs = new ResizeObserver(entries => {
|
|
entries.forEach(entry => {
|
|
setTimeout(() => {
|
|
this.graph_offset = this.calcGraphOffset(entry.target);
|
|
this.cdr.detectChanges();
|
|
});
|
|
})
|
|
});
|
|
this.subscriptions.push(resizeObs);
|
|
resizeObs.observe(this.graph_element.nativeElement);
|
|
}
|
|
|
|
calcGraphOffset(element) {
|
|
this.graph_height = element.offsetHeight;
|
|
return window.innerHeight-this.graph_height;
|
|
}
|
|
|
|
metaTags(title, description) {
|
|
const url = properties.domain + properties.baseLink + this.router.url;
|
|
this.seoService.createLinkForCanonicalURL(url, false);
|
|
this.meta.updateTag({content: url}, "property='og:url'");
|
|
this.meta.updateTag({content: description}, "name='description'");
|
|
this.meta.updateTag({content: description}, "property='og:description'");
|
|
this.meta.updateTag({content: title}, "property='og:title'");
|
|
this.title.setTitle(title);
|
|
}
|
|
}
|