Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7b6255e54 | ||
|
|
0f9991b618 | ||
|
|
ac97c9f496 | ||
|
|
8261de4a02 | ||
|
|
f69b3cf871 | ||
|
|
4338b1cc0e | ||
|
|
d5164f9863 | ||
|
|
86fc87f507 | ||
|
|
156e31643c | ||
|
|
a21030309e | ||
|
|
a8db8194cf | ||
|
|
ce218cbfa1 | ||
|
|
ae80f0f812 | ||
|
|
fed1e56c81 |
@@ -781,6 +781,7 @@ async def _build_eu_cordis_search_query(
|
||||
topic_project_ids_by_type = await get_eu_project_ids_by_openalex_topic_ids(
|
||||
project_types=project_types,
|
||||
topic_ids=topic_ids,
|
||||
match_all=False
|
||||
)
|
||||
|
||||
topic_filter = _eu_project_type_index_filter(topic_project_ids_by_type)
|
||||
@@ -829,13 +830,14 @@ async def _build_eu_cordis_search_query(
|
||||
)
|
||||
|
||||
if keyword_clauses:
|
||||
must_clauses.append({"bool": {"must": keyword_clauses}})
|
||||
must_clauses.append({"bool": {"should": keyword_clauses, "minimum_should_match": 1}})
|
||||
|
||||
# === Independent OpenAlex topic filters ===
|
||||
if filter_topic_ids:
|
||||
filter_topic_project_ids_by_type = await get_eu_project_ids_by_openalex_topic_ids(
|
||||
project_types=project_types,
|
||||
topic_ids=filter_topic_ids,
|
||||
match_all=True
|
||||
)
|
||||
|
||||
topic_filter = _eu_project_type_index_filter(filter_topic_project_ids_by_type)
|
||||
|
||||
@@ -115,17 +115,23 @@ async def get_person_ids_by_institution_ids(
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
async def get_bund_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
||||
async def get_bund_project_ids_by_topic_ids(
|
||||
topic_ids: list[str],
|
||||
match_all: bool = True,
|
||||
) -> list[str]:
|
||||
"""
|
||||
Query the `projects_bund_openalex_topics` index to find BUND project IDs
|
||||
that match any of the given OpenAlex topic IDs.
|
||||
that match:
|
||||
|
||||
- ALL of the given OpenAlex topic IDs if match_all=True
|
||||
- ANY of the given OpenAlex topic IDs if match_all=False
|
||||
|
||||
Topics may be distributed across multiple documents for the same project.
|
||||
"""
|
||||
if not topic_ids:
|
||||
return []
|
||||
|
||||
required_topics = set(topic_ids)
|
||||
|
||||
project_topics: dict[str, set[str]] = defaultdict(set)
|
||||
|
||||
body = {
|
||||
@@ -143,8 +149,8 @@ async def get_bund_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
||||
cluster=ESCluster.INSE,
|
||||
body=body,
|
||||
)
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
for hit in hits:
|
||||
source = hit["_source"]
|
||||
@@ -163,26 +169,35 @@ async def get_bund_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
||||
if topic_id in required_topics:
|
||||
project_topics[project_id].add(topic_id)
|
||||
|
||||
if match_all:
|
||||
return [
|
||||
project_id
|
||||
for project_id, found_topics in project_topics.items()
|
||||
if required_topics.issubset(found_topics)
|
||||
]
|
||||
|
||||
# OR match: project has at least one requested topic
|
||||
return list(project_topics.keys())
|
||||
|
||||
|
||||
return [
|
||||
project_id
|
||||
for project_id, found_topics in project_topics.items()
|
||||
if required_topics.issubset(found_topics)
|
||||
]
|
||||
async def get_dfg_project_ids_by_topic_ids(
|
||||
topic_ids: list[str],
|
||||
match_all: bool = True,
|
||||
) -> list[str]:
|
||||
"""
|
||||
Fetches project IDs whose topic_matches contain:
|
||||
|
||||
async def get_dfg_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
||||
"""Fetches project IDs whose topic_matches contain EVERY given topic ID,
|
||||
even if the topics are distributed across multiple documents for the same project.
|
||||
- ALL given topic IDs if match_all=True
|
||||
- ANY given topic ID if match_all=False
|
||||
|
||||
Topics may be distributed across multiple documents for the same project.
|
||||
"""
|
||||
if not topic_ids:
|
||||
return []
|
||||
|
||||
required_topics = set(topic_ids)
|
||||
|
||||
project_topics: dict[str, set[str]] = defaultdict(set)
|
||||
|
||||
|
||||
body = {
|
||||
"size": 10000,
|
||||
"_source": ["project_id", "topic_matches"],
|
||||
@@ -192,7 +207,7 @@ async def get_dfg_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
||||
}
|
||||
},
|
||||
}
|
||||
print("BODY", body)
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_DFG_TOPICS,
|
||||
cluster=ESCluster.INSE,
|
||||
@@ -201,7 +216,6 @@ async def get_dfg_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
|
||||
for hit in hits:
|
||||
source = hit["_source"]
|
||||
|
||||
@@ -219,12 +233,15 @@ async def get_dfg_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
||||
if topic_id in required_topics:
|
||||
project_topics[project_id].add(topic_id)
|
||||
|
||||
if match_all:
|
||||
return [
|
||||
project_id
|
||||
for project_id, found_topics in project_topics.items()
|
||||
if required_topics.issubset(found_topics)
|
||||
]
|
||||
|
||||
return [
|
||||
project_id
|
||||
for project_id, found_topics in project_topics.items()
|
||||
if required_topics.issubset(found_topics)
|
||||
]
|
||||
# OR match: project has at least one requested topic
|
||||
return list(project_topics.keys())
|
||||
|
||||
|
||||
async def get_openalex_topics_for_bund_projects(project_ids: list[str]) -> dict[str, list[dict]]:
|
||||
@@ -428,14 +445,18 @@ async def get_dfg_institutes_by_ids(
|
||||
#EU Cordis Projects
|
||||
|
||||
|
||||
|
||||
async def get_eu_project_ids_by_openalex_topic_ids(
|
||||
project_types: list[EuCordisProjectType],
|
||||
topic_ids: list[str],
|
||||
match_all: bool = True,
|
||||
) -> dict[EuCordisProjectType, list[str]]:
|
||||
"""
|
||||
Returns EU CORDIS project IDs whose mapped OpenAlex topic_matches contain
|
||||
EVERY given topic ID. Same semantics as DFG topic filtering.
|
||||
Returns EU CORDIS project IDs whose mapped OpenAlex topic_matches contain:
|
||||
|
||||
- ALL given topic IDs if match_all=True
|
||||
- ANY given topic ID if match_all=False
|
||||
|
||||
Topics may be distributed across multiple documents for the same project.
|
||||
"""
|
||||
if not topic_ids:
|
||||
return {project_type: [] for project_type in project_types}
|
||||
@@ -474,15 +495,18 @@ async def get_eu_project_ids_by_openalex_topic_ids(
|
||||
for hit in hits:
|
||||
source = hit.get("_source", {})
|
||||
project_id = source.get("project_id")
|
||||
|
||||
if not project_id:
|
||||
continue
|
||||
|
||||
topic_matches = source.get("topic_matches") or []
|
||||
|
||||
if isinstance(topic_matches, dict):
|
||||
topic_matches = [topic_matches]
|
||||
|
||||
for match in topic_matches:
|
||||
topic_id = match.get("topic_id")
|
||||
|
||||
if topic_id in required_topics:
|
||||
project_topics[project_id].add(topic_id)
|
||||
|
||||
@@ -491,11 +515,15 @@ async def get_eu_project_ids_by_openalex_topic_ids(
|
||||
|
||||
from_ += page_size
|
||||
|
||||
result[project_type] = [
|
||||
project_id
|
||||
for project_id, found_topics in project_topics.items()
|
||||
if required_topics.issubset(found_topics)
|
||||
]
|
||||
if match_all:
|
||||
result[project_type] = [
|
||||
project_id
|
||||
for project_id, found_topics in project_topics.items()
|
||||
if required_topics.issubset(found_topics)
|
||||
]
|
||||
else:
|
||||
# OR match: project has at least one requested topic
|
||||
result[project_type] = list(project_topics.keys())
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -426,9 +426,8 @@ async def search_dfg_projects(
|
||||
# === Primary search clause: mutually exclusive fuzzy(topic_ids) vs keyword phrase search ===
|
||||
if fuzzy and topic_ids:
|
||||
matching_project_ids = await get_dfg_project_ids_by_topic_ids(
|
||||
topic_ids=topic_ids
|
||||
topic_ids=topic_ids, match_all = False
|
||||
)
|
||||
|
||||
if not matching_project_ids:
|
||||
return DfgProjectPage(elements=[], total=0, page=page, size=size)
|
||||
|
||||
@@ -493,12 +492,12 @@ async def search_dfg_projects(
|
||||
}
|
||||
)
|
||||
if keyword_clauses:
|
||||
must_clauses.append({"bool": {"must": keyword_clauses}})
|
||||
must_clauses.append({"bool": {"should": keyword_clauses, "minimum_should_match": 1}})
|
||||
|
||||
# === Additional independent filters (applied regardless of fuzzy/keyword mode) ===
|
||||
if filter_topic_ids:
|
||||
matching_filter_project_ids = await get_dfg_project_ids_by_topic_ids(
|
||||
topic_ids=filter_topic_ids
|
||||
topic_ids=filter_topic_ids, match_all=True
|
||||
)
|
||||
|
||||
if not matching_filter_project_ids:
|
||||
@@ -558,7 +557,7 @@ async def search_dfg_projects(
|
||||
)
|
||||
|
||||
if name_must_clauses:
|
||||
must_clauses.append({"bool": {"must": name_must_clauses}})
|
||||
must_clauses.append({"bool": {"should": name_must_clauses, "minimum_should_match": 1}})
|
||||
|
||||
if institution_aliases:
|
||||
matching_institution_ids = await get_institution_ids_by_institution_aliases(
|
||||
@@ -987,7 +986,7 @@ async def search_bund_projects_with_filters(
|
||||
)
|
||||
# === Primary search clause: fuzzy(topic_ids) vs keyword phrase search ===
|
||||
if fuzzy and topic_ids:
|
||||
matching_project_ids = await get_bund_project_ids_by_topic_ids(topic_ids=topic_ids)
|
||||
matching_project_ids = await get_bund_project_ids_by_topic_ids(topic_ids=topic_ids, match_all=False)
|
||||
if not matching_project_ids:
|
||||
return BundProjectPage(elements=[], total=0, page=page, size=size)
|
||||
must_clauses.append({"terms": {"_id": matching_project_ids}})
|
||||
@@ -1010,7 +1009,7 @@ async def search_bund_projects_with_filters(
|
||||
|
||||
# === Additional independent filters (applied regardless of fuzzy/keyword mode) ===
|
||||
if filter_topic_ids:
|
||||
matching_filter_ids = await get_bund_project_ids_by_topic_ids(topic_ids=filter_topic_ids)
|
||||
matching_filter_ids = await get_bund_project_ids_by_topic_ids(topic_ids=filter_topic_ids, match_all=True)
|
||||
if not matching_filter_ids:
|
||||
return BundProjectPage(elements=[], total=0, page=page, size=size)
|
||||
must_clauses.append({"terms": {"_id": matching_filter_ids}})
|
||||
|
||||
@@ -18,6 +18,12 @@ import {
|
||||
} from '@angular/cdk/overlay';
|
||||
import { ComponentPortal, ComponentType } from '@angular/cdk/portal';
|
||||
|
||||
const STICKY_TOOLBAR_HEIGHT_PX = 76;
|
||||
const EDGE_MARGIN_PX = 8;
|
||||
const TOP_MARGIN_PX = STICKY_TOOLBAR_HEIGHT_PX + EDGE_MARGIN_PX;
|
||||
const MIN_PANEL_WIDTH_PX = 240;
|
||||
const MIN_PANEL_HEIGHT_PX = 150;
|
||||
|
||||
type UnwrapInputSignals<T> = {
|
||||
[K in keyof T]: T[K] extends InputSignal<infer V> ? V : T[K];
|
||||
};
|
||||
@@ -27,6 +33,10 @@ type UnwrapInputSignals<T> = {
|
||||
standalone: true,
|
||||
})
|
||||
export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
private static readonly openInstances = new Set<
|
||||
ComponentTooltipDirective<any>
|
||||
>();
|
||||
|
||||
readonly component = input.required<ComponentType<T>>({
|
||||
alias: 'appComponentTooltip',
|
||||
});
|
||||
@@ -43,8 +53,10 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
|
||||
private overlayRef: OverlayRef | null = null;
|
||||
private componentRef: ComponentRef<T> | null = null;
|
||||
private computedMaxWidthPx = MIN_PANEL_WIDTH_PX;
|
||||
private showTimeout?: ReturnType<typeof setTimeout>;
|
||||
private hideTimeout?: ReturnType<typeof setTimeout>;
|
||||
private dismissTimeout?: ReturnType<typeof setTimeout>;
|
||||
|
||||
private isOverHost = false;
|
||||
private isOverOverlay = false;
|
||||
@@ -84,60 +96,188 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
this.scheduleHide();
|
||||
}
|
||||
|
||||
@HostListener('click')
|
||||
onHostClick(): void {
|
||||
this.scheduleDismiss();
|
||||
}
|
||||
|
||||
private scheduleDismiss(): void {
|
||||
clearTimeout(this.dismissTimeout);
|
||||
this.dismissTimeout = setTimeout(() => this.dismiss());
|
||||
}
|
||||
|
||||
private dismiss(): void {
|
||||
clearTimeout(this.showTimeout);
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.isOverHost = false;
|
||||
this.isOverOverlay = false;
|
||||
this.hide();
|
||||
}
|
||||
|
||||
private scheduleHide(): void {
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.hideTimeout = setTimeout(() => {
|
||||
if (!this.isOverHost && !this.isOverOverlay) {
|
||||
this.hide();
|
||||
if (this.isOverHost || this.isOverOverlay) {
|
||||
return;
|
||||
}
|
||||
if (this.hasOpenDescendantTooltip()) {
|
||||
this.scheduleHide();
|
||||
return;
|
||||
}
|
||||
this.hide();
|
||||
}, this.tooltipHideDelay());
|
||||
}
|
||||
|
||||
private hasOpenDescendantTooltip(): boolean {
|
||||
const paneElement = this.overlayRef?.overlayElement;
|
||||
if (!paneElement) return false;
|
||||
|
||||
for (const other of ComponentTooltipDirective.openInstances) {
|
||||
if (other === this) continue;
|
||||
if (paneElement.contains(other.elementRef.nativeElement)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private clampedOffsetX(
|
||||
alignToStart: boolean,
|
||||
triggerRect: DOMRect,
|
||||
actualWidthPx: number,
|
||||
viewportWidth: number,
|
||||
): number {
|
||||
const desiredLeft = alignToStart
|
||||
? triggerRect.left
|
||||
: triggerRect.right - actualWidthPx;
|
||||
const minLeft = EDGE_MARGIN_PX;
|
||||
const maxLeft = Math.max(
|
||||
EDGE_MARGIN_PX,
|
||||
viewportWidth - actualWidthPx - EDGE_MARGIN_PX,
|
||||
);
|
||||
const clampedLeft = Math.min(Math.max(desiredLeft, minLeft), maxLeft);
|
||||
const anchor = alignToStart ? triggerRect.left : triggerRect.right;
|
||||
return clampedLeft - anchor + (alignToStart ? 0 : actualWidthPx);
|
||||
}
|
||||
|
||||
private computePositioning(): {
|
||||
positions: ConnectedPosition[];
|
||||
maxWidthPx: number;
|
||||
maxHeightPx: number;
|
||||
} {
|
||||
const triggerRect = this.elementRef.nativeElement.getBoundingClientRect();
|
||||
const viewportWidth = window.innerWidth;
|
||||
const viewportHeight = window.innerHeight;
|
||||
|
||||
const spaceAbove = triggerRect.top - TOP_MARGIN_PX;
|
||||
const spaceBelow = viewportHeight - triggerRect.bottom - EDGE_MARGIN_PX;
|
||||
const spaceLeft = triggerRect.left - EDGE_MARGIN_PX;
|
||||
const spaceRight = viewportWidth - triggerRect.right - EDGE_MARGIN_PX;
|
||||
|
||||
const preferBelow = spaceBelow >= spaceAbove;
|
||||
const preferStartAligned = spaceRight >= spaceLeft;
|
||||
|
||||
const bestVerticalSpace = Math.max(spaceAbove, spaceBelow);
|
||||
const bestHorizontalSpace = Math.max(spaceLeft, spaceRight);
|
||||
|
||||
const maxHeightPx = Math.max(bestVerticalSpace, MIN_PANEL_HEIGHT_PX);
|
||||
const maxWidthPx = Math.max(bestHorizontalSpace, MIN_PANEL_WIDTH_PX);
|
||||
const actualWidthPx = Math.min(
|
||||
maxWidthPx,
|
||||
this.resolveConfiguredWidthPx(this.tooltipMaxWidth()) ?? maxWidthPx,
|
||||
);
|
||||
|
||||
const primaryOffsetX = this.clampedOffsetX(
|
||||
preferStartAligned,
|
||||
triggerRect,
|
||||
actualWidthPx,
|
||||
viewportWidth,
|
||||
);
|
||||
const secondaryOffsetX = this.clampedOffsetX(
|
||||
!preferStartAligned,
|
||||
triggerRect,
|
||||
actualWidthPx,
|
||||
viewportWidth,
|
||||
);
|
||||
|
||||
const verticalPrimary: ConnectedPosition = preferBelow
|
||||
? {
|
||||
originX: preferStartAligned ? 'start' : 'end',
|
||||
originY: 'bottom',
|
||||
overlayX: preferStartAligned ? 'start' : 'end',
|
||||
overlayY: 'top',
|
||||
offsetX: primaryOffsetX,
|
||||
offsetY: EDGE_MARGIN_PX,
|
||||
}
|
||||
: {
|
||||
originX: preferStartAligned ? 'start' : 'end',
|
||||
originY: 'top',
|
||||
overlayX: preferStartAligned ? 'start' : 'end',
|
||||
overlayY: 'bottom',
|
||||
offsetX: primaryOffsetX,
|
||||
offsetY: -EDGE_MARGIN_PX,
|
||||
};
|
||||
const verticalSecondary: ConnectedPosition = preferBelow
|
||||
? {
|
||||
originX: preferStartAligned ? 'end' : 'start',
|
||||
originY: 'top',
|
||||
overlayX: preferStartAligned ? 'end' : 'start',
|
||||
overlayY: 'bottom',
|
||||
offsetX: secondaryOffsetX,
|
||||
offsetY: -EDGE_MARGIN_PX,
|
||||
}
|
||||
: {
|
||||
originX: preferStartAligned ? 'end' : 'start',
|
||||
originY: 'bottom',
|
||||
overlayX: preferStartAligned ? 'end' : 'start',
|
||||
overlayY: 'top',
|
||||
offsetX: secondaryOffsetX,
|
||||
offsetY: EDGE_MARGIN_PX,
|
||||
};
|
||||
const sidePrimary: ConnectedPosition = preferStartAligned
|
||||
? {
|
||||
originX: 'end',
|
||||
originY: 'center',
|
||||
overlayX: 'start',
|
||||
overlayY: 'center',
|
||||
offsetX: EDGE_MARGIN_PX,
|
||||
}
|
||||
: {
|
||||
originX: 'start',
|
||||
originY: 'center',
|
||||
overlayX: 'end',
|
||||
overlayY: 'center',
|
||||
offsetX: -EDGE_MARGIN_PX,
|
||||
};
|
||||
|
||||
const positions: ConnectedPosition[] = [
|
||||
verticalPrimary,
|
||||
verticalSecondary,
|
||||
sidePrimary,
|
||||
];
|
||||
|
||||
return { positions, maxWidthPx, maxHeightPx };
|
||||
}
|
||||
|
||||
private show(): void {
|
||||
if (this.overlayRef?.hasAttached()) return;
|
||||
|
||||
const positions: ConnectedPosition[] = [
|
||||
{
|
||||
originX: 'center',
|
||||
originY: 'top',
|
||||
overlayX: 'center',
|
||||
overlayY: 'bottom',
|
||||
offsetY: -8,
|
||||
},
|
||||
{
|
||||
originX: 'center',
|
||||
originY: 'bottom',
|
||||
overlayX: 'center',
|
||||
overlayY: 'top',
|
||||
offsetY: 8,
|
||||
},
|
||||
{
|
||||
originX: 'end',
|
||||
originY: 'center',
|
||||
overlayX: 'start',
|
||||
overlayY: 'center',
|
||||
offsetX: 8,
|
||||
},
|
||||
{
|
||||
originX: 'start',
|
||||
originY: 'center',
|
||||
overlayX: 'end',
|
||||
overlayY: 'center',
|
||||
offsetX: -8,
|
||||
},
|
||||
];
|
||||
const { positions, maxWidthPx, maxHeightPx } = this.computePositioning();
|
||||
this.computedMaxWidthPx = maxWidthPx;
|
||||
|
||||
const positionStrategy = this.overlayPositionBuilder
|
||||
.flexibleConnectedTo(this.elementRef)
|
||||
.withPositions(positions)
|
||||
.withFlexibleDimensions(false)
|
||||
.withViewportMargin(12)
|
||||
.withViewportMargin(EDGE_MARGIN_PX)
|
||||
.withPush(true);
|
||||
|
||||
this.overlayRef = this.overlay.create({
|
||||
positionStrategy,
|
||||
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
||||
panelClass: 'app-tooltip-panel',
|
||||
maxWidth: this.tooltipMaxWidth() ?? 'calc(100vw - 24px)',
|
||||
maxWidth: this.resolveMaxWidth(this.tooltipMaxWidth()),
|
||||
maxHeight: `${maxHeightPx}px`,
|
||||
});
|
||||
|
||||
const portal = new ComponentPortal(this.component(), null, this.injector);
|
||||
@@ -155,18 +295,35 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
|
||||
overlayElement.addEventListener('mouseenter', this.onOverlayEnter);
|
||||
overlayElement.addEventListener('mouseleave', this.onOverlayLeave);
|
||||
overlayElement.addEventListener('click', this.onOverlayClick, true);
|
||||
|
||||
ComponentTooltipDirective.openInstances.add(this);
|
||||
}
|
||||
|
||||
private applyMaxWidth(
|
||||
element: HTMLElement,
|
||||
maxWidth: string | number | null,
|
||||
): void {
|
||||
if (maxWidth === null) {
|
||||
element.style.maxWidth = '';
|
||||
return;
|
||||
element.style.maxWidth = this.resolveMaxWidth(maxWidth);
|
||||
}
|
||||
|
||||
private resolveMaxWidth(maxWidth: string | number | null): string {
|
||||
const configuredPx = this.resolveConfiguredWidthPx(maxWidth);
|
||||
if (configuredPx === null) {
|
||||
return typeof maxWidth === 'number'
|
||||
? `${maxWidth}px`
|
||||
: (maxWidth ?? `${this.computedMaxWidthPx}px`);
|
||||
}
|
||||
element.style.maxWidth =
|
||||
typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth;
|
||||
return `${Math.min(configuredPx, this.computedMaxWidthPx)}px`;
|
||||
}
|
||||
|
||||
private resolveConfiguredWidthPx(
|
||||
maxWidth: string | number | null,
|
||||
): number | null {
|
||||
if (maxWidth === null) return null;
|
||||
if (typeof maxWidth === 'number') return maxWidth;
|
||||
const trimmed = maxWidth.trim();
|
||||
return trimmed.endsWith('px') ? parseFloat(trimmed) : null;
|
||||
}
|
||||
|
||||
private readonly onOverlayEnter = (): void => {
|
||||
@@ -179,19 +336,27 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
this.scheduleHide();
|
||||
};
|
||||
|
||||
private readonly onOverlayClick = (): void => {
|
||||
this.scheduleDismiss();
|
||||
};
|
||||
|
||||
private hide(): void {
|
||||
if (this.overlayRef) {
|
||||
const overlayElement = this.overlayRef.overlayElement;
|
||||
overlayElement.removeEventListener('mouseenter', this.onOverlayEnter);
|
||||
overlayElement.removeEventListener('mouseleave', this.onOverlayLeave);
|
||||
overlayElement.removeEventListener('click', this.onOverlayClick, true);
|
||||
this.overlayRef.detach();
|
||||
}
|
||||
this.componentRef = null;
|
||||
ComponentTooltipDirective.openInstances.delete(this);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
clearTimeout(this.showTimeout);
|
||||
clearTimeout(this.hideTimeout);
|
||||
clearTimeout(this.dismissTimeout);
|
||||
ComponentTooltipDirective.openInstances.delete(this);
|
||||
this.overlayRef?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,6 +455,7 @@
|
||||
[queryParams]="authorQueryParams(dataset, entry)"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ authorId: entry.id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
[title]="authorDisplayName(dataset, entry)">
|
||||
{{ authorDisplayName(dataset, entry) }}
|
||||
</a>
|
||||
|
||||
@@ -141,7 +141,8 @@
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
authorId: author.openalex_author_id,
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
{{ author.author_name }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
[color]="tag.color"
|
||||
[disabled]="!tag.id"
|
||||
[active]="isTagActive(tag)"
|
||||
[secondaryActionLabel]="tagAction(tag)?.label ?? null"
|
||||
[secondaryActionLink]="tagAction(tag)?.link ?? null"
|
||||
[secondaryActionQueryParams]="tagAction(tag)?.queryParams ?? null"
|
||||
countIcon="article"
|
||||
descriptionTooltipTarget="button"
|
||||
(chipClick)="onTagClick(tag)">
|
||||
|
||||
@@ -14,6 +14,7 @@ import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { TopicCount } from '../../api';
|
||||
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { TopicLegendComponent } from '../../shared/ui/topic-legend/topic-legend.component';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
@@ -45,6 +46,12 @@ interface InterestTag {
|
||||
domainDescription: string;
|
||||
}
|
||||
|
||||
interface InterestTagAction {
|
||||
label: string;
|
||||
link: unknown[];
|
||||
queryParams: Record<string, string | number>;
|
||||
}
|
||||
|
||||
const MAX_TAGS = 5;
|
||||
|
||||
@Component({
|
||||
@@ -69,6 +76,10 @@ export class PersonInterestingComponent implements OnInit {
|
||||
|
||||
readonly topics = input<TopicCount[] | null>(null);
|
||||
readonly loading = input<boolean>(false);
|
||||
|
||||
readonly personPublicationsLink = input<unknown[] | null>(null);
|
||||
readonly personName = input<string>('');
|
||||
|
||||
readonly legendExpanded = signal(false);
|
||||
readonly activeLegendFieldIds = signal<ReadonlySet<string>>(new Set());
|
||||
readonly activeLegendSubfieldIds = signal<ReadonlySet<string>>(new Set());
|
||||
@@ -142,6 +153,36 @@ export class PersonInterestingComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private readonly tagActions = computed(() => {
|
||||
const actions = new Map<string, InterestTagAction>();
|
||||
const link = this.personPublicationsLink();
|
||||
|
||||
if (!link) {
|
||||
return actions;
|
||||
}
|
||||
|
||||
const person = this.personName() || 'dieser Person';
|
||||
|
||||
for (const tag of this.tags()) {
|
||||
if (!tag.id) continue;
|
||||
|
||||
actions.set(tag.id, {
|
||||
label: `Publikationen von ${person}`,
|
||||
link,
|
||||
queryParams: {
|
||||
[workQueryParamKeys.page]: 0,
|
||||
[workQueryParamKeys.topicId]: tag.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return actions;
|
||||
});
|
||||
|
||||
tagAction(tag: InterestTag): InterestTagAction | null {
|
||||
return this.tagActions().get(tag.id) ?? null;
|
||||
}
|
||||
|
||||
onTagClick(tag: InterestTag): void {
|
||||
if (!tag.id) return;
|
||||
this.tagClick.emit({
|
||||
|
||||
@@ -131,7 +131,8 @@
|
||||
[appComponentTooltip]="AppPublicationTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
workId: this.stripOpenAlexIdPrefix(work.id),
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
<li>{{ work.display_name }}</li>
|
||||
</a>
|
||||
}
|
||||
@@ -150,7 +151,8 @@
|
||||
[appComponentTooltip]="AppInstitutionTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
institutionId: this.stripOpenAlexIdPrefix(institution.id),
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
<li>{{ institution.display_name }}</li>
|
||||
</a>
|
||||
}
|
||||
@@ -188,7 +190,8 @@
|
||||
[appComponentTooltip]="AppAuthorTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
authorId: this.stripOpenAlexIdPrefix(collaborator.id),
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
{{ collaborator.display_name }}
|
||||
</a>
|
||||
</li>
|
||||
@@ -227,7 +230,8 @@
|
||||
[appComponentTooltip]="AppAuthorTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
authorId: this.stripOpenAlexIdPrefix(collaborator.id),
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
{{ collaborator.display_name }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
+50
-2
@@ -171,8 +171,15 @@
|
||||
type="button"
|
||||
class="main-topic-button"
|
||||
[disabled]="!getMainTopicItem(item)?.id"
|
||||
[attr.aria-label]="
|
||||
getTopicAriaLabel(getMainTopicItem(item), [item.year])
|
||||
"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="{ topicId: getMainTopicItem(item)?.id }"
|
||||
[tooltipInputs]="
|
||||
getTopicTooltipInputs(getMainTopicItem(item), [
|
||||
item.year,
|
||||
])
|
||||
"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="
|
||||
selectTopic(getMainTopicItem(item), [item.year])
|
||||
@@ -217,6 +224,16 @@
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActiveByLegend(topic)"
|
||||
[secondaryActionLabel]="
|
||||
getTopicAction(topic, [item.year])?.label ?? null
|
||||
"
|
||||
[secondaryActionLink]="
|
||||
getTopicAction(topic, [item.year])?.link ?? null
|
||||
"
|
||||
[secondaryActionQueryParams]="
|
||||
getTopicAction(topic, [item.year])?.queryParams ??
|
||||
null
|
||||
"
|
||||
(chipClick)="selectTopic(topic, [item.year])">
|
||||
</app-topic-chip>
|
||||
</ng-container>
|
||||
@@ -288,8 +305,19 @@
|
||||
type="button"
|
||||
class="main-topic-button"
|
||||
[disabled]="!phase.primaryTopic.id"
|
||||
[attr.aria-label]="
|
||||
getTopicAriaLabel(
|
||||
phase.primaryTopic,
|
||||
getPhaseYears(phase)
|
||||
)
|
||||
"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="{ topicId: phase.primaryTopic.id }"
|
||||
[tooltipInputs]="
|
||||
getTopicTooltipInputs(
|
||||
phase.primaryTopic,
|
||||
getPhaseYears(phase)
|
||||
)
|
||||
"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="
|
||||
selectTopic(phase.primaryTopic, getPhaseYears(phase))
|
||||
@@ -317,6 +345,16 @@
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActiveByLegend(topic)"
|
||||
[secondaryActionLabel]="
|
||||
getTopicAction(topic, getPhaseYears(phase))?.label ?? null
|
||||
"
|
||||
[secondaryActionLink]="
|
||||
getTopicAction(topic, getPhaseYears(phase))?.link ?? null
|
||||
"
|
||||
[secondaryActionQueryParams]="
|
||||
getTopicAction(topic, getPhaseYears(phase))
|
||||
?.queryParams ?? null
|
||||
"
|
||||
(chipClick)="selectTopic(topic, getPhaseYears(phase))">
|
||||
</app-topic-chip>
|
||||
</ng-container>
|
||||
@@ -396,6 +434,16 @@
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActiveByLegend(topic)"
|
||||
[secondaryActionLabel]="
|
||||
getTopicAction(topic, [year.year])?.label ?? null
|
||||
"
|
||||
[secondaryActionLink]="
|
||||
getTopicAction(topic, [year.year])?.link ?? null
|
||||
"
|
||||
[secondaryActionQueryParams]="
|
||||
getTopicAction(topic, [year.year])?.queryParams ??
|
||||
null
|
||||
"
|
||||
(chipClick)="selectTopic(topic, [year.year])">
|
||||
</app-topic-chip>
|
||||
</ng-container>
|
||||
|
||||
+105
@@ -30,6 +30,7 @@ import {
|
||||
toggleTopicLegendSubfieldSelection,
|
||||
} from '../../../../resolvers/utils/topic-legend';
|
||||
import { buildTopicHierarchyTooltip } from '../../../../resolvers/utils/topic-tooltip';
|
||||
import { workQueryParamKeys } from '../../../../resolvers/work-page.resolver';
|
||||
|
||||
export interface TopicTimelineTopic {
|
||||
id?: string;
|
||||
@@ -92,6 +93,19 @@ interface TimelineScrollAnchor {
|
||||
scrollLeft: number;
|
||||
}
|
||||
|
||||
interface TimelineTopicAction {
|
||||
label: string;
|
||||
link: unknown[];
|
||||
queryParams: Record<string, string | number | number[]>;
|
||||
}
|
||||
|
||||
interface TimelineTopicTooltipInputs {
|
||||
topicId: string | undefined;
|
||||
secondaryActionLabel: string | null;
|
||||
secondaryActionLink: unknown[] | null;
|
||||
secondaryActionQueryParams: Record<string, string | number | number[]> | null;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-research-timeline',
|
||||
standalone: true,
|
||||
@@ -123,6 +137,8 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
@Input() subfieldLegendVisible = true;
|
||||
@Input() subfieldLegendExpanded = false;
|
||||
@Input() wordCloudLegendTopics: TopicLegendTopic[] = [];
|
||||
@Input() personPublicationsLink: unknown[] | null = null;
|
||||
@Input() personName = '';
|
||||
|
||||
@Output() viewModeChange = new EventEmitter<TimelineViewMode>();
|
||||
@Output() yearRangeChange = new EventEmitter<TimelineYearRange>();
|
||||
@@ -146,6 +162,11 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
private readonly displayedPhaseTopicLimit = 4;
|
||||
private readonly scrollRestoreThreshold = 24;
|
||||
private readonly expandedPhaseIds = new Set<string>();
|
||||
private readonly topicActionCache = new Map<string, TimelineTopicAction>();
|
||||
private readonly tooltipInputsCache = new Map<
|
||||
string,
|
||||
TimelineTopicTooltipInputs
|
||||
>();
|
||||
activeLegendFieldIds: ReadonlySet<string> = new Set();
|
||||
activeLegendSubfieldIds: ReadonlySet<string> = new Set();
|
||||
|
||||
@@ -169,6 +190,11 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
if (changes['elements'] || changes['startYear'] || changes['endYear']) {
|
||||
this.applyInputYearRange();
|
||||
}
|
||||
|
||||
if (changes['personName'] || changes['personPublicationsLink']) {
|
||||
this.topicActionCache.clear();
|
||||
this.tooltipInputsCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewChecked(): void {
|
||||
@@ -330,6 +356,85 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
return phase.years.map((year) => year.year);
|
||||
}
|
||||
|
||||
getTopicAction(
|
||||
topic: TopicTimelineTopic | undefined,
|
||||
years: number[],
|
||||
): TimelineTopicAction | null {
|
||||
if (!this.personPublicationsLink || !topic?.id || years.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const selectedYears = this.normalizeSelectedYears(years);
|
||||
const cacheKey = `${topic.id}|${selectedYears.join(',')}`;
|
||||
const cached = this.topicActionCache.get(cacheKey);
|
||||
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
const person = this.personName || 'dieser Person';
|
||||
const action: TimelineTopicAction = {
|
||||
label: `Publikationen von ${person} ${this.formatYearRange(selectedYears)}`,
|
||||
link: this.personPublicationsLink,
|
||||
queryParams: {
|
||||
[workQueryParamKeys.page]: 0,
|
||||
[workQueryParamKeys.years]: selectedYears,
|
||||
[workQueryParamKeys.topicId]: topic.id,
|
||||
},
|
||||
};
|
||||
|
||||
this.topicActionCache.set(cacheKey, action);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
getTopicTooltipInputs(
|
||||
topic: TopicTimelineTopic | undefined,
|
||||
years: number[],
|
||||
): TimelineTopicTooltipInputs {
|
||||
const action = this.getTopicAction(topic, years);
|
||||
const cacheKey = `${topic?.id ?? ''}|${years.join(',')}`;
|
||||
const cached = this.tooltipInputsCache.get(cacheKey);
|
||||
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
const inputs: TimelineTopicTooltipInputs = {
|
||||
topicId: topic?.id,
|
||||
secondaryActionLabel: action?.label ?? null,
|
||||
secondaryActionLink: action?.link ?? null,
|
||||
secondaryActionQueryParams: action?.queryParams ?? null,
|
||||
};
|
||||
|
||||
this.tooltipInputsCache.set(cacheKey, inputs);
|
||||
|
||||
return inputs;
|
||||
}
|
||||
|
||||
getTopicAriaLabel(
|
||||
topic: TopicTimelineTopic | undefined,
|
||||
years: number[],
|
||||
): string | null {
|
||||
if (!topic?.id || years.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const person = this.personName || 'dieser Person';
|
||||
const selectedYears = this.normalizeSelectedYears(years);
|
||||
|
||||
return `Publikationen von ${person} zum Thema ${topic.name} ${this.formatYearRange(selectedYears)}`;
|
||||
}
|
||||
|
||||
private formatYearRange(years: number[]): string {
|
||||
const firstYear = years[0];
|
||||
const lastYear = years[years.length - 1];
|
||||
|
||||
return firstYear === lastYear
|
||||
? `(${firstYear})`
|
||||
: `(${firstYear}–${lastYear})`;
|
||||
}
|
||||
|
||||
getYearPublicationTooltip(item: TopicTimelineElement): string {
|
||||
return this.getPublicationTooltip(
|
||||
item.publication_count,
|
||||
|
||||
+2
-1
@@ -15,8 +15,9 @@
|
||||
[style.fontSize.px]="word.fontSize"
|
||||
[style.fontWeight]="word.fontWeight"
|
||||
[disabled]="!word.topicId"
|
||||
[attr.aria-label]="wordAriaLabel(word)"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="{ topicId: word.rawTopicId }"
|
||||
[tooltipInputs]="tooltipInputsFor(word)"
|
||||
[tooltipDisabled]="!word.rawTopicId"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="selectWord(word)">
|
||||
|
||||
+65
-1
@@ -8,6 +8,14 @@ import {
|
||||
getTopicLegendSubfieldId,
|
||||
TopicLegendTopic,
|
||||
} from '../../../../resolvers/utils/topic-legend';
|
||||
import { workQueryParamKeys } from '../../../../resolvers/work-page.resolver';
|
||||
|
||||
interface WordTooltipInputs {
|
||||
topicId: string;
|
||||
secondaryActionLabel: string | null;
|
||||
secondaryActionLink: unknown[] | null;
|
||||
secondaryActionQueryParams: Record<string, string | number>;
|
||||
}
|
||||
|
||||
export interface WordCloudTopicOccurrence {
|
||||
name: string;
|
||||
@@ -158,7 +166,24 @@ function stripOpenAlexId(id: string | null | undefined): string {
|
||||
export class ResearchWordcloudComponent {
|
||||
readonly AppTopicTooltipComponent = AppTopicTooltipComponent;
|
||||
|
||||
@Input() words: WordCloudWord[] = [];
|
||||
@Input() set words(value: WordCloudWord[]) {
|
||||
this._words = value;
|
||||
this.rebuildTooltipInputs();
|
||||
}
|
||||
get words(): WordCloudWord[] {
|
||||
return this._words;
|
||||
}
|
||||
|
||||
@Input() set personPublicationsLink(value: unknown[] | null) {
|
||||
this._personPublicationsLink = value;
|
||||
this.rebuildTooltipInputs();
|
||||
}
|
||||
|
||||
@Input() set personName(value: string) {
|
||||
this._personName = value;
|
||||
this.rebuildTooltipInputs();
|
||||
}
|
||||
|
||||
@Input() loading = false;
|
||||
@Input() loadFailed = false;
|
||||
@Input() activeFieldIds: ReadonlySet<string> = new Set();
|
||||
@@ -166,6 +191,11 @@ export class ResearchWordcloudComponent {
|
||||
|
||||
@Output() wordSelect = new EventEmitter<WordCloudWord>();
|
||||
|
||||
private _words: WordCloudWord[] = [];
|
||||
private _personPublicationsLink: unknown[] | null = null;
|
||||
private _personName = '';
|
||||
private tooltipInputsByTopic = new Map<string, WordTooltipInputs>();
|
||||
|
||||
selectWord(word: WordCloudWord): void {
|
||||
if (!word.topicId) {
|
||||
return;
|
||||
@@ -181,4 +211,38 @@ export class ResearchWordcloudComponent {
|
||||
this.activeSubfieldIds.has(word.subfieldLegendId))
|
||||
);
|
||||
}
|
||||
|
||||
tooltipInputsFor(word: WordCloudWord): WordTooltipInputs | null {
|
||||
return this.tooltipInputsByTopic.get(word.topicId) ?? null;
|
||||
}
|
||||
|
||||
wordAriaLabel(word: WordCloudWord): string {
|
||||
return this._personName
|
||||
? `Publikationen von ${this._personName} zum Thema ${word.name}`
|
||||
: `Publikationen dieser Person zum Thema ${word.name}`;
|
||||
}
|
||||
|
||||
private rebuildTooltipInputs(): void {
|
||||
const label = this._personName
|
||||
? `Publikationen von ${this._personName}`
|
||||
: 'Publikationen dieser Person';
|
||||
const link = this._personPublicationsLink;
|
||||
|
||||
this.tooltipInputsByTopic = new Map(
|
||||
this._words
|
||||
.filter((word) => word.topicId)
|
||||
.map((word) => [
|
||||
word.topicId,
|
||||
{
|
||||
topicId: word.rawTopicId,
|
||||
secondaryActionLabel: link ? label : null,
|
||||
secondaryActionLink: link,
|
||||
secondaryActionQueryParams: {
|
||||
[workQueryParamKeys.page]: 0,
|
||||
[workQueryParamKeys.topicId]: word.topicId,
|
||||
},
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
[subfieldLegendVisible]="timelineLegendVisible"
|
||||
[subfieldLegendExpanded]="timelineLegendExpanded"
|
||||
[wordCloudLegendTopics]="wordCloudLegendTopics"
|
||||
[personName]="personName"
|
||||
[personPublicationsLink]="personPublicationsLink"
|
||||
(viewModeChange)="onTimelineViewModeChange($event)"
|
||||
(yearRangeChange)="onTimelineYearRangeChange($event)"
|
||||
(subfieldLegendVisibleChange)="onTimelineLegendVisibleChange($event)"
|
||||
@@ -27,6 +29,8 @@
|
||||
[loadFailed]="wordCloudLoadFailed"
|
||||
[activeFieldIds]="activeLegendFieldIds"
|
||||
[activeSubfieldIds]="activeLegendSubfieldIds"
|
||||
[personName]="personName"
|
||||
[personPublicationsLink]="personPublicationsLink"
|
||||
(wordSelect)="onWordClick($event)" />
|
||||
</app-research-timeline>
|
||||
</section>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||
import { combineLatest, distinctUntilChanged, map } from 'rxjs';
|
||||
import { combineLatest, distinctUntilChanged, map, of, switchMap } from 'rxjs';
|
||||
|
||||
import { TopicCount, TopicsByYear, WorksService } from '../../api';
|
||||
import {
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
TopicLegendSelectionState,
|
||||
TopicLegendTopic,
|
||||
} from '../../resolvers/utils/topic-legend';
|
||||
import { PersonDataResolved } from '../../resolvers/person.resolver';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-overview',
|
||||
@@ -69,6 +70,8 @@ export class PersonOverviewComponent implements OnInit {
|
||||
wordCloudLoadFailed = false;
|
||||
activeLegendFieldIds: ReadonlySet<string> = new Set();
|
||||
activeLegendSubfieldIds: ReadonlySet<string> = new Set();
|
||||
personName = '';
|
||||
personPublicationsLink: unknown[] | null = null;
|
||||
|
||||
private rawTopicOccurrences: WordCloudTopicOccurrence[] = [];
|
||||
|
||||
@@ -80,10 +83,16 @@ export class PersonOverviewComponent implements OnInit {
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((authorId) => {
|
||||
this.personPublicationsLink =
|
||||
authorId && authorId !== '0'
|
||||
? ['/person', authorId, 'publications']
|
||||
: null;
|
||||
this.loadTopicTimeline(authorId);
|
||||
this.loadWordCloud(authorId);
|
||||
});
|
||||
|
||||
this.loadPersonName();
|
||||
|
||||
this.route.queryParamMap
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((queryParams) => {
|
||||
@@ -337,6 +346,25 @@ export class PersonOverviewComponent implements OnInit {
|
||||
this.timelineEarlierYearsLoadFailed = false;
|
||||
}
|
||||
|
||||
private loadPersonName(): void {
|
||||
combineLatest(this.route.pathFromRoot.map((route) => route.data))
|
||||
.pipe(
|
||||
map((dataEntries) =>
|
||||
dataEntries
|
||||
.map((data) => data['personData'] as PersonDataResolved | undefined)
|
||||
.find((resolved): resolved is PersonDataResolved =>
|
||||
Boolean(resolved),
|
||||
),
|
||||
),
|
||||
distinctUntilChanged(),
|
||||
switchMap((resolved) => resolved?.personData$ ?? of(null)),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((response) => {
|
||||
this.personName = response?.results?.[0]?.display_name ?? '';
|
||||
});
|
||||
}
|
||||
|
||||
private loadWordCloud(authorId: string): void {
|
||||
if (!authorId || authorId === '0') {
|
||||
this.wordCloudWords = [];
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
<app-person-interesting
|
||||
[topics]="primaryTopicCounts()"
|
||||
[loading]="isTopicsLoading()"
|
||||
[personName]="personName()"
|
||||
[personPublicationsLink]="personPublicationsLink()"
|
||||
(tagClick)="onInterestingTagClick($event)"></app-person-interesting>
|
||||
</section>
|
||||
@if (this.links()) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
inject,
|
||||
signal,
|
||||
DestroyRef,
|
||||
ElementRef,
|
||||
input,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
@@ -18,11 +19,20 @@ import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import {
|
||||
ActivatedRoute,
|
||||
NavigationEnd,
|
||||
Router,
|
||||
RouterModule,
|
||||
RouterOutlet,
|
||||
} from '@angular/router';
|
||||
import { of, switchMap, finalize, map, catchError, combineLatest } from 'rxjs';
|
||||
import {
|
||||
of,
|
||||
switchMap,
|
||||
finalize,
|
||||
map,
|
||||
catchError,
|
||||
combineLatest,
|
||||
filter,
|
||||
} from 'rxjs';
|
||||
|
||||
import { PersonInterestingComponent } from '../person-interesting/person-interesting.component';
|
||||
import { CountryFlagComponent } from '../../shared/ui/country-flag/country-flag.component';
|
||||
@@ -82,11 +92,28 @@ export class PersonComponent {
|
||||
() => this.navBar()?.activeLink() ?? null,
|
||||
);
|
||||
|
||||
private readonly tabPanelElement = viewChild('tabPanel', {
|
||||
read: ElementRef,
|
||||
});
|
||||
|
||||
private publicationFilterKey: string | null = null;
|
||||
|
||||
constructor() {
|
||||
this.bookmarkService
|
||||
.load()
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe();
|
||||
|
||||
this.router.events
|
||||
.pipe(
|
||||
filter(
|
||||
(event): event is NavigationEnd => event instanceof NavigationEnd,
|
||||
),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((event) =>
|
||||
this.scrollToPanelOnFilterChange(event.urlAfterRedirects),
|
||||
);
|
||||
}
|
||||
|
||||
readonly params = toSignal(this.activatedRoute.paramMap);
|
||||
@@ -169,6 +196,13 @@ export class PersonComponent {
|
||||
readonly displayName = computed(
|
||||
() => this.person()?.display_name ?? 'Unbekannte Person',
|
||||
);
|
||||
|
||||
readonly personName = computed(() => this.person()?.display_name ?? '');
|
||||
|
||||
readonly personPublicationsLink = computed<unknown[] | null>(() => {
|
||||
const authorId = this.authorId();
|
||||
return authorId ? ['/person', authorId, 'publications'] : null;
|
||||
});
|
||||
readonly initials = computed(() => this.buildInitials(this.displayName()));
|
||||
readonly primaryAffiliation = computed(
|
||||
() => this.person()?.affiliations?.[0] ?? null,
|
||||
@@ -368,6 +402,46 @@ export class PersonComponent {
|
||||
});
|
||||
}
|
||||
|
||||
private scrollToPanelOnFilterChange(url: string): void {
|
||||
const { queryParams } = this.router.parseUrl(url);
|
||||
const filterKey = [workQueryParamKeys.topicId, workQueryParamKeys.years]
|
||||
.map((key) => {
|
||||
const value = queryParams[key];
|
||||
return Array.isArray(value) ? value.join(',') : (value ?? '');
|
||||
})
|
||||
.join('|');
|
||||
|
||||
const previousFilterKey = this.publicationFilterKey;
|
||||
this.publicationFilterKey = filterKey;
|
||||
|
||||
const hasFilter = filterKey !== '|';
|
||||
const isFirstNavigation = previousFilterKey === null;
|
||||
|
||||
if (isFirstNavigation || !hasFilter || filterKey === previousFilterKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.scrollPanelIntoView();
|
||||
}
|
||||
|
||||
private scrollPanelIntoView(): void {
|
||||
const scrollToPanel = (): void => {
|
||||
this.tabPanelElement()?.nativeElement.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'start',
|
||||
});
|
||||
};
|
||||
|
||||
requestAnimationFrame(scrollToPanel);
|
||||
|
||||
setTimeout(() => {
|
||||
const panel = this.tabPanelElement();
|
||||
if (panel && panel.nativeElement.getBoundingClientRect().top > 8) {
|
||||
scrollToPanel();
|
||||
}
|
||||
}, 400);
|
||||
}
|
||||
|
||||
private getId(key: string): string | null {
|
||||
const ids = this.person()?.ids as Record<string, string> | undefined;
|
||||
if (!ids) {
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
class="author-chip"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ author: _author(), authorId: rawOaAuthorId() }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(keydown)="_onChipClick($event)"
|
||||
(click)="_onChipClick($event)">
|
||||
<span class="chip-content">
|
||||
@if (showIcon()) {
|
||||
<mat-icon class="author-icon">{{ icon() }}</mat-icon>
|
||||
}
|
||||
{{ _author()?.display_name }}
|
||||
<span class="chip-label">{{ _author()?.display_name }}</span>
|
||||
</span>
|
||||
</mat-chip>
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
:host {
|
||||
display: inline-flex;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.author-chip {
|
||||
font-weight: 500;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background-color: var(--sg-surface-soft);
|
||||
border: var(--border-width) solid var(--border-color);
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:host ::ng-deep .author-chip .mat-mdc-chip-action,
|
||||
@@ -29,6 +37,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
color: var(--sg-text);
|
||||
|
||||
mat-icon {
|
||||
@@ -36,6 +45,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.chip-label {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:host.is-mini-size {
|
||||
::ng-deep .mat-mdc-chip {
|
||||
height: 1.5rem;
|
||||
|
||||
@@ -8,10 +8,17 @@
|
||||
">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{ displayName() }}</mat-card-title>
|
||||
<mat-card-subtitle class="city-country"
|
||||
>{{ institution().geo?.city }},
|
||||
{{ institution().geo?.country }}</mat-card-subtitle
|
||||
>
|
||||
<mat-card-subtitle class="city-country">
|
||||
{{ institution().geo?.city }},
|
||||
{{ institution().geo?.country }}
|
||||
@if (institution().geo?.country_code) {
|
||||
<app-country-flag
|
||||
[countryCode]="institution().geo?.country_code"
|
||||
[height]="10"
|
||||
[bordered]="false"
|
||||
style="margin-left: 6px" />
|
||||
}
|
||||
</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-divider />
|
||||
|
||||
@@ -15,6 +15,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { CredentialService } from '../../services/credential.service';
|
||||
import { CountryFlagComponent } from '../country-flag/country-flag.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institution-card',
|
||||
@@ -25,6 +26,7 @@ import { CredentialService } from '../../services/credential.service';
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
DecimalPipe,
|
||||
CountryFlagComponent,
|
||||
],
|
||||
templateUrl: './app-institution-card.component.html',
|
||||
styleUrl: './app-institution-card.component.scss',
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
institution: _institution(),
|
||||
institutionId: rawOaInstitutionId(),
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(keydown)="_onChipClick($event)"
|
||||
(click)="_onChipClick($event)">
|
||||
<span class="chip-content">
|
||||
|
||||
@@ -67,8 +67,7 @@
|
||||
class="nav-icon-button"
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
[queryParams]="item.queryParams || null"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="navLinkActiveOptions"
|
||||
[class.active]="isItemActive(item)"
|
||||
[class.disabled]="item.disabled"
|
||||
[matTooltip]="item.label"
|
||||
matTooltipPosition="right"
|
||||
@@ -80,8 +79,7 @@
|
||||
mat-list-item
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
[queryParams]="item.queryParams || null"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="navLinkActiveOptions"
|
||||
[class.active]="isItemActive(item)"
|
||||
[class.disabled]="item.disabled">
|
||||
<mat-icon matListItemIcon>{{ item.icon }}</mat-icon>
|
||||
<span matListItemTitle>{{ item.label }}</span>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Component, computed, inject, input, output } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { IsActiveMatchOptions, Router, RouterModule } from '@angular/router';
|
||||
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { filter, map } from 'rxjs';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
@@ -42,6 +44,7 @@ type NavItem = {
|
||||
adminOnly?: boolean;
|
||||
superAdminOnly?: boolean;
|
||||
managerOrAdminOnly?: boolean;
|
||||
detailRoutePrefixes?: string[];
|
||||
};
|
||||
|
||||
type NavItemGroup = {
|
||||
@@ -75,12 +78,26 @@ export class AppMenuComponent {
|
||||
collapsed = input(false);
|
||||
canCollapse = input(false);
|
||||
toggleCollapsed = output<void>();
|
||||
readonly navLinkActiveOptions: IsActiveMatchOptions = {
|
||||
paths: 'subset',
|
||||
queryParams: 'ignored',
|
||||
matrixParams: 'ignored',
|
||||
fragment: 'ignored',
|
||||
};
|
||||
|
||||
private readonly router = inject(Router);
|
||||
|
||||
private readonly currentPath = toSignal(
|
||||
this.router.events.pipe(
|
||||
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
||||
map((event) => event.urlAfterRedirects.split('?')[0]),
|
||||
),
|
||||
{ initialValue: this.router.url.split('?')[0] },
|
||||
);
|
||||
|
||||
isItemActive(item: NavItem): boolean {
|
||||
const path = this.currentPath();
|
||||
if (path === item.route || path.startsWith(`${item.route}/`)) {
|
||||
return true;
|
||||
}
|
||||
return (item.detailRoutePrefixes ?? []).some((prefix) =>
|
||||
path.startsWith(prefix),
|
||||
);
|
||||
}
|
||||
|
||||
readonly navItems = computed<NavItem[]>(() => {
|
||||
const items: NavItem[] = [
|
||||
@@ -99,6 +116,7 @@ export class AppMenuComponent {
|
||||
this.credentialService.organizationName(),
|
||||
),
|
||||
disabled: false,
|
||||
detailRoutePrefixes: ['/person/'],
|
||||
},
|
||||
{
|
||||
label: 'Bookmarks',
|
||||
@@ -124,6 +142,7 @@ export class AppMenuComponent {
|
||||
sort_by: 'works_count',
|
||||
sorting_order: SortDirection.Desc,
|
||||
},
|
||||
detailRoutePrefixes: ['/institution/'],
|
||||
},
|
||||
{
|
||||
label: 'Publikationen',
|
||||
@@ -137,6 +156,7 @@ export class AppMenuComponent {
|
||||
[workQueryParamKeys.sortBy]: WorkSortBy.CitedByCount,
|
||||
[workQueryParamKeys.sortDirection]: SortDirection.Desc,
|
||||
},
|
||||
detailRoutePrefixes: ['/publication/'],
|
||||
},
|
||||
{
|
||||
label: 'Themen',
|
||||
@@ -150,6 +170,7 @@ export class AppMenuComponent {
|
||||
[topicQueryParamKeys.sortBy]: TopicSortBy.CitedByCount,
|
||||
[topicQueryParamKeys.sortDirection]: SortDirection.Desc,
|
||||
},
|
||||
detailRoutePrefixes: ['/topic/'],
|
||||
},
|
||||
{
|
||||
label: 'Projekte',
|
||||
@@ -170,6 +191,7 @@ export class AppMenuComponent {
|
||||
icon: PATENT_ICON,
|
||||
route: '/patents',
|
||||
disabled: false,
|
||||
detailRoutePrefixes: ['/patent/'],
|
||||
},
|
||||
{
|
||||
label: 'Keywords',
|
||||
@@ -230,10 +252,7 @@ export class AppMenuComponent {
|
||||
];
|
||||
});
|
||||
|
||||
constructor(
|
||||
public credentialService: CredentialService,
|
||||
private readonly router: Router,
|
||||
) {}
|
||||
constructor(public credentialService: CredentialService) {}
|
||||
|
||||
isNavigating = computed(() => !!this.router.currentNavigation());
|
||||
readonly themeService = inject(ThemeService);
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
<mat-icon>label</mat-icon>
|
||||
<span>Themen</span>
|
||||
</div>
|
||||
<div class="chips chips-column">
|
||||
<div
|
||||
class="chips chips-column"
|
||||
[class.chips-column--size-to-content]="sizeTopicsToContent()">
|
||||
@for (topic of visibleTopics(); track topic.id) {
|
||||
<app-topic-chip-2
|
||||
[topic]="topic"
|
||||
|
||||
@@ -93,6 +93,10 @@ mat-card-title {
|
||||
min-height: calc(3 * 32px + 2 * 0.5rem);
|
||||
}
|
||||
|
||||
.chips-column--size-to-content {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.chips-authors {
|
||||
flex-wrap: nowrap;
|
||||
align-content: flex-start;
|
||||
|
||||
@@ -33,6 +33,7 @@ const MAX_VISIBLE_AUTHORS = 3;
|
||||
})
|
||||
export class AppPublicationCardComponent {
|
||||
work = input.required<Work>();
|
||||
sizeTopicsToContent = input(false);
|
||||
|
||||
topicChipClick = output<Topic>();
|
||||
authorChipClick = output<Author>();
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
@let work = this._work();
|
||||
|
||||
@if (work) {
|
||||
<app-publication-card [work]="work" />
|
||||
<app-publication-card [work]="work" [sizeTopicsToContent]="true" />
|
||||
}
|
||||
|
||||
@@ -40,13 +40,24 @@
|
||||
|
||||
<mat-card-footer>
|
||||
<mat-card-actions class="card-actions">
|
||||
@if (hasSecondaryAction()) {
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="secondaryActionLink()"
|
||||
[queryParams]="secondaryActionQueryParams()"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>{{ secondaryActionIcon() }}</mat-icon>
|
||||
{{ secondaryActionLabel() }}
|
||||
</a>
|
||||
}
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="['/topic', stripOpenAlexId(topic.id), 'publications']"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>menu_book</mat-icon>
|
||||
Publikationen
|
||||
{{ publicationsActionLabel() }}
|
||||
</a>
|
||||
</mat-card-actions>
|
||||
</mat-card-footer>
|
||||
|
||||
@@ -96,6 +96,7 @@ mat-card-content {
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Topic } from '../../../api';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { Params, RouterModule } from '@angular/router';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
@@ -27,6 +27,31 @@ import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
export class AppTopicCardComponent {
|
||||
topic = input.required<Topic>();
|
||||
|
||||
/**
|
||||
* Optional extra footer action, e.g. "Publikationen von <Person>". Only
|
||||
* rendered when both label and link are given.
|
||||
*/
|
||||
secondaryActionLabel = input<string | null>(null);
|
||||
secondaryActionIcon = input<string>('person_search');
|
||||
secondaryActionLink = input<unknown[] | string | null>(null);
|
||||
secondaryActionQueryParams = input<Params | null>(null);
|
||||
|
||||
hasSecondaryAction = computed(
|
||||
() =>
|
||||
Boolean(this.secondaryActionLabel()) &&
|
||||
Boolean(this.secondaryActionLink()),
|
||||
);
|
||||
|
||||
/**
|
||||
* Without a secondary action "Publikationen" is unambiguous. Next to a
|
||||
* person-scoped action it is not, so the scope becomes explicit.
|
||||
*/
|
||||
publicationsActionLabel = computed(() =>
|
||||
this.hasSecondaryAction()
|
||||
? 'Alle Publikationen zum Thema'
|
||||
: 'Publikationen',
|
||||
);
|
||||
|
||||
stripOpenAlexId(id: string | null | undefined): string | undefined {
|
||||
if (!id) {
|
||||
return undefined;
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
@if (showIcon()) {
|
||||
<mat-icon>{{ icon() }}</mat-icon>
|
||||
}
|
||||
{{ topic().display_name }}
|
||||
<span class="chip-label">{{ topic().display_name }}</span>
|
||||
</span>
|
||||
</mat-chip>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
:host {
|
||||
display: inline-flex;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.topic-chip {
|
||||
--topic-background: color-mix(
|
||||
in srgb,
|
||||
@@ -20,6 +26,8 @@
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: var(--sg-text);
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:host ::ng-deep .topic-chip .mat-mdc-chip-action,
|
||||
@@ -54,6 +62,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
color: var(--sg-text);
|
||||
|
||||
mat-icon {
|
||||
@@ -61,6 +70,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.chip-label {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:host.is-mini-size {
|
||||
::ng-deep .mat-mdc-chip {
|
||||
height: 1.5rem;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
@let topic = this._topic();
|
||||
|
||||
@if (topic) {
|
||||
<app-topic-card [topic]="topic" />
|
||||
<app-topic-card
|
||||
[topic]="topic"
|
||||
[secondaryActionLabel]="secondaryActionLabel()"
|
||||
[secondaryActionIcon]="secondaryActionIcon()"
|
||||
[secondaryActionLink]="secondaryActionLink()"
|
||||
[secondaryActionQueryParams]="secondaryActionQueryParams()" />
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, effect, inject, input, signal } from '@angular/core';
|
||||
import { Params } from '@angular/router';
|
||||
import { Topic, TopicsV2Service } from '../../../api';
|
||||
import { AppTopicCardComponent } from '../app-topic-card/app-topic-card.component';
|
||||
|
||||
@@ -14,6 +15,11 @@ export class AppTopicTooltipComponent {
|
||||
topicId = input<string | null | undefined>(undefined);
|
||||
topic = input<Topic | null | undefined>(undefined);
|
||||
|
||||
secondaryActionLabel = input<string | null>(null);
|
||||
secondaryActionIcon = input<string>('person_search');
|
||||
secondaryActionLink = input<unknown[] | string | null>(null);
|
||||
secondaryActionQueryParams = input<Params | null>(null);
|
||||
|
||||
_topic = signal<Topic | undefined>(undefined);
|
||||
_isLoading = signal<boolean>(false);
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ export class BundProjectTableComponent implements OnInit {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.topicId);
|
||||
});
|
||||
selectedTopicMatchesQueryParams = computed(() => {
|
||||
return this.queryParamMap().get('topics')?.split(',') || [];
|
||||
return this.queryParamMap().getAll('topics');
|
||||
});
|
||||
selectedFundingTypesQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.funding_type);
|
||||
|
||||
@@ -112,7 +112,7 @@ export class DfgProjectTableComponent implements OnInit {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.topicId);
|
||||
});
|
||||
selectedTopicMatchesQueryParams = computed(() => {
|
||||
return this.queryParamMap().get('topics')?.split(',') || [];
|
||||
return this.queryParamMap().getAll('topics');
|
||||
});
|
||||
keywordTopicMap = computed(() => {
|
||||
return (
|
||||
|
||||
@@ -103,7 +103,7 @@ export class EuProjectTableComponent {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.topicId);
|
||||
});
|
||||
selectedTopicMatchesQueryParams = computed(() => {
|
||||
return this.queryParamMap().get('topics')?.split(',') || [];
|
||||
return this.queryParamMap().getAll('topics');
|
||||
});
|
||||
selectedTypesQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.projectType);
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
[routerLink]="['/person', author.openalex_author_id]"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ authorId: author.openalex_author_id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="$event.stopPropagation()">
|
||||
{{ author.author_name }}
|
||||
</a>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, computed, input, output } from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { Params } from '@angular/router';
|
||||
import { Topic } from '../../../api';
|
||||
import { ComponentTooltipDirective } from '../../../directives/component-tooltip.directive';
|
||||
import { AppTopicTooltipComponent } from '../app-topic-tooltip/app-topic-tooltip.component';
|
||||
@@ -102,6 +103,10 @@ export class TopicChipComponent {
|
||||
descriptionTooltipTarget = input<TopicChipTooltipTarget>('label');
|
||||
topicId = input<string | null | undefined>(undefined);
|
||||
topic = input<Topic | null | undefined>(undefined);
|
||||
secondaryActionLabel = input<string | null>(null);
|
||||
secondaryActionIcon = input<string>('person_search');
|
||||
secondaryActionLink = input<unknown[] | string | null>(null);
|
||||
secondaryActionQueryParams = input<Params | null>(null);
|
||||
|
||||
chipClick = output<void>();
|
||||
|
||||
@@ -188,6 +193,10 @@ export class TopicChipComponent {
|
||||
return {
|
||||
topic: this.topicObject(),
|
||||
topicId: this.topicId() ?? this.topic()?.id ?? undefined,
|
||||
secondaryActionLabel: this.secondaryActionLabel(),
|
||||
secondaryActionIcon: this.secondaryActionIcon(),
|
||||
secondaryActionLink: this.secondaryActionLink(),
|
||||
secondaryActionQueryParams: this.secondaryActionQueryParams(),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -582,6 +582,11 @@ html.dark-theme {
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.cdk-overlay-pane.app-tooltip-panel {
|
||||
max-height: 70vh;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.cdk-overlay-pane .mat-mdc-option {
|
||||
padding: 0 18px;
|
||||
font-size: 13px;
|
||||
|
||||
Reference in New Issue
Block a user