import { ChangeDetectorRef, Component, ElementRef, HostListener, Input, QueryList, ViewChild, ViewChildren } from '@angular/core'; import {properties} from "../../../../environments/environment"; @Component({ selector: 'showSubjects', template: ` 0"> Subjects by Vocabulary {{key}}: {{subject}} {{subject}} 0) || (otherSubjects && otherSubjects.size > 0)"> 0"> Subjects View all 0">{{subjects.join(', ')}} ` }) export class ShowSubjectsComponent { @Input() subjects: string[]; @Input() otherSubjects: Map; @Input() classifiedSubjects: Map; isLarge: boolean = false; properties = properties; specialSubjects = []; @ViewChildren("content", { read: ElementRef }) content: QueryList; @ViewChild('subjectsModal') subjectsModal; @HostListener('window:resize', ['$event']) onResize(event) { this.checkLarge(); } constructor(private cdr: ChangeDetectorRef) { if(properties.dashboard == "explore") { this.specialSubjects = [ // "Physics::Optics", // "Astrophysics::Cosmology and Extragalactic Astrophysics", // "Computer Science::Information Theory", // "Physics::Accelerator Physics", // "Condensed Matter::Superconductivity", "Physics::Atomic Physics", // "Computer Science::Robotics", // "Computer Science::Computer Science and Game Theory", // "Computer Science::Neural and Evolutionary Computation", "Mathematics::Combinatorics", // "Mathematics::Probability", // "Computer Science::Operating Systems", // "lcsh:Medicine", // "lcsh:Science", // "lcsh:Biology (General)", // "lcsh:Chemistry", // "lcsh:Engineering (General). Civil engineering (General)", // "lcsh:Technology" ]; } } ngOnInit() { } ngAfterViewInit() { this.checkLarge(); } checkLarge() { let overflow = 42; if(typeof document !== "undefined" && this.content) { let element = this.content.find(content => content.nativeElement.id === "content"); this.isLarge = (element && element.nativeElement.offsetHeight > overflow); this.cdr.detectChanges(); } } public getKeys(map) { return Array.from(map.keys()); } getSubjectParameter(param){ return {'f0':'resultsubject','fv0':'"' +(param)+'"', size:50}; } public openSubjectsModal() { this.subjectsModal.cancelButton = false; this.subjectsModal.okButton = false; this.subjectsModal.alertTitle = "Subjects"; this.subjectsModal.open(); } }
0">{{subjects.join(', ')}}