Merge dev into fix-analyses-dashboard
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
</span>
|
||||
<span class="brand-text">
|
||||
<strong>AIIS</strong>
|
||||
<small>AI Innovation<br />Intelligence System</small>
|
||||
<small>AI-based<br />Innovation Scouting</small>
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@@ -56,6 +56,15 @@
|
||||
{{ auth.name }}
|
||||
</span>
|
||||
<div class="item-actions">
|
||||
<a
|
||||
[href]="getRedirectUrl(auth.id)"
|
||||
target="_blank"
|
||||
class="action-btn redirect-btn"
|
||||
[style.color]="getEntityColor()(auth.id)"
|
||||
(click)="$event.stopPropagation()"
|
||||
title="Zur Detailansicht des Autors wechseln">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
class="action-btn visibility-btn"
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface CompareItem {
|
||||
styleUrl: './author-selector.component.scss',
|
||||
})
|
||||
export class AuthorSelectorComponent {
|
||||
readonly activeTab = input<string>('publications');
|
||||
readonly comparisonAuthors = input<CompareItem[]>([]);
|
||||
readonly topSuggestions = input<any[]>([]);
|
||||
readonly isSuggestionsLoading = input<boolean>(false);
|
||||
@@ -31,6 +32,18 @@ export class AuthorSelectorComponent {
|
||||
readonly toggleVisibility = output<string>();
|
||||
readonly selectPie = output<{ id: string; name: string; type: 'author' }>();
|
||||
|
||||
getRedirectUrl(id: string): string {
|
||||
const cleanId = id.includes('/') ? id.split('/').pop() || id : id;
|
||||
const tab = this.activeTab();
|
||||
if (tab === 'projects') {
|
||||
return `/inse-webapp/person/${cleanId}/projects?page=0&size=10&sort_by=title&sort_direction=asc&search=`;
|
||||
}
|
||||
if (tab === 'patents') {
|
||||
return `/inse-webapp/person/${cleanId}/patents`;
|
||||
}
|
||||
return `/inse-webapp/person/${cleanId}/publications`;
|
||||
}
|
||||
|
||||
onSelectPie(id: string, name: string): void {
|
||||
this.selectPie.emit({ id, name, type: 'author' });
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
@if (additionalFiltersTmp()) {
|
||||
<ng-container [ngTemplateOutlet]="additionalFiltersTmp()"></ng-container>
|
||||
}
|
||||
@if (observers() && observers()!.length > 0) {
|
||||
<app-selected-filters [observers]="observers()!" />
|
||||
}
|
||||
|
||||
<mat-divider />
|
||||
@let pageValue = page();
|
||||
|
||||
@@ -8,6 +8,10 @@ import { MatDivider } from '@angular/material/divider';
|
||||
import { QueryParamPaginatorComponent } from '../query-param-paginator/query-param-paginator.component';
|
||||
import { NgTemplateOutlet } from '@angular/common';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../selected-filters/selected-filters.component';
|
||||
|
||||
export type Page = {
|
||||
page: number;
|
||||
@@ -25,6 +29,7 @@ export type Page = {
|
||||
QueryParamPaginatorComponent,
|
||||
NgTemplateOutlet,
|
||||
MatProgressSpinnerModule,
|
||||
SelectedFiltersComponent,
|
||||
],
|
||||
templateUrl: './card-search.component.html',
|
||||
styleUrl: './card-search.component.scss',
|
||||
@@ -33,6 +38,7 @@ export class CardSearchComponent {
|
||||
cardTmp = input.required<TemplateRef<any>>();
|
||||
additionalFiltersTmp = input<TemplateRef<any>>();
|
||||
noResultsTmp = input<TemplateRef<any>>();
|
||||
observers = input<FilterObserver[]>([]);
|
||||
|
||||
cardMinWidth = input<number>(300);
|
||||
loading = input<boolean>(false);
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
<app-data-table
|
||||
[columns]="columns"
|
||||
[data]="elements()"
|
||||
[queryParamSortKey]="queryParamKeys.sortBy"
|
||||
[queryParamSortDirectionKey]="queryParamKeys.sortDirection" />
|
||||
|
||||
<app-query-param-paginator
|
||||
[total]="total()"
|
||||
[queryParamPageKey]="queryParamKeys.page"
|
||||
[queryParamSizeKey]="queryParamKeys.size"
|
||||
[pageSizeOptions]="[10]" />
|
||||
|
||||
<ng-template #fundingEndTmp let-element>
|
||||
{{
|
||||
element.funding_end == '2999' || element.funding_end == null
|
||||
? 'laufend'
|
||||
: element.funding_end
|
||||
}}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #actionsTmp let-element>
|
||||
<a
|
||||
[routerLink]="['/projects/dfg', element.id]"
|
||||
target="_blank"
|
||||
mat-icon-button
|
||||
color="primary">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
</ng-template>
|
||||
<ng-template #detailRowTmp let-element>
|
||||
<div class="classification-container">
|
||||
@for (classification of element.subject_classifications; track $index) {
|
||||
<p>
|
||||
{{ classification.wissenschaftsbereich || '-' }}
|
||||
→ {{ classification.fachkollegium || '-' }} →
|
||||
{{ classification.fachgebiet || '-' }} →
|
||||
{{ classification.fach || '-' }}
|
||||
</p>
|
||||
} @empty {
|
||||
<span>-</span>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #authorsTmp let-project>
|
||||
@let projectAuthors = getProjectAuthors(project);
|
||||
@let isProjectAuthorsExpanded = isProjectPersonsExpanded(project);
|
||||
@let visibleAuthors =
|
||||
isProjectAuthorsExpanded ? projectAuthors : projectAuthors.slice(0, 3);
|
||||
<div class="author-tags" aria-label="Autoren" style="padding: 0.5rem 0">
|
||||
@for (author of visibleAuthors; track author.person_id) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
[class.active]="isAuthorActive(author.person_id!)"
|
||||
[matTooltip]="getAuthorTooltipText(author)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getAuthorTooltipText(author)"
|
||||
(click)="filterByAuthor(author.person_id!)">
|
||||
<mat-icon class="institution-icon">person</mat-icon>
|
||||
<span class="institution-name">{{ author.full_name }}</span>
|
||||
</button>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (projectAuthors.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
[attr.aria-expanded]="isProjectAuthorsExpanded"
|
||||
(click)="toggleProjectAuthorsExpansion(project)">
|
||||
{{
|
||||
isProjectAuthorsExpanded
|
||||
? 'weniger'
|
||||
: '+' + (projectAuthors.length - 3)
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #institutionsTmp let-project>
|
||||
@let institutions = getProjectInstitutions(project);
|
||||
|
||||
<div
|
||||
class="institution-tags"
|
||||
aria-label="Institutionen"
|
||||
style="padding: 0.5rem 0">
|
||||
@for (
|
||||
institution of isProjectInstitutionsExpanded(project)
|
||||
? institutions
|
||||
: institutions.slice(0, 3);
|
||||
track getProjectInstitutionId(institution)
|
||||
) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
[class.active]="isInstitutionActive(institution.id!)"
|
||||
[matTooltip]="getInstitutionTooltipText(institution)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getInstitutionTooltipText(institution)"
|
||||
(click)="filterByInstitution(institution)">
|
||||
<mat-icon class="institution-icon">apartment</mat-icon>
|
||||
<span class="institution-name">{{
|
||||
institution.institute_name_de || institution.institute_name_en
|
||||
}}</span>
|
||||
</button>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (institutions.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
(click)="toggleProjectInstitutionsExpansion(project)">
|
||||
@if (isProjectInstitutionsExpanded(project)) {
|
||||
Weniger anzeigen
|
||||
} @else {
|
||||
+{{ institutions.length - 3 }} weitere
|
||||
}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #topicsTmp let-project>
|
||||
@let projectTopics = project.topics ?? [];
|
||||
@let isTopicsExpanded = isProjectTopicsExpanded(project);
|
||||
@let visibleTopics =
|
||||
isTopicsExpanded ? projectTopics : projectTopics.slice(0, 3);
|
||||
<div class="topic-chips" aria-label="Themen" style="padding: 0.5rem 0">
|
||||
@for (topic of visibleTopics; track $index) {
|
||||
<app-topic-chip
|
||||
size="mini"
|
||||
[label]="topic.display_name || ''"
|
||||
[description]="topic.description"
|
||||
[subfieldName]="topic.subfield?.display_name"
|
||||
[fieldName]="topic.field?.display_name"
|
||||
[domainName]="topic.domain?.display_name"
|
||||
[color]="getWorkTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActive(topic)"
|
||||
(chipClick)="filterByTopic(topic)">
|
||||
</app-topic-chip>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (projectTopics.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
[attr.aria-expanded]="isTopicsExpanded"
|
||||
(click)="toggleProjectTopicsExpansion(project)">
|
||||
{{ isTopicsExpanded ? 'weniger' : '+' + (projectTopics.length - 3) }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
@@ -0,0 +1,220 @@
|
||||
.page {
|
||||
padding: 28px 32px 42px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Shared tags & chips
|
||||
// ------------------------
|
||||
|
||||
.publication-institution-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 6px;
|
||||
border: 1px solid var(--sg-primary-border, var(--sg-border));
|
||||
border-radius: 4px;
|
||||
background: var(--sg-primary-soft);
|
||||
color: var(--sg-primary);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
line-height: normal;
|
||||
max-width: 100%;
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: #fff;
|
||||
border-color: var(--sg-primary);
|
||||
outline: none;
|
||||
box-shadow:
|
||||
0 0 0 2px var(--sg-background),
|
||||
0 0 0 4px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--sg-primary);
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active:hover,
|
||||
&.active:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.institution-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.institution-name {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.flag-img {
|
||||
flex-shrink: 0;
|
||||
margin-left: 6px;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.country-code {
|
||||
flex-shrink: 0;
|
||||
margin-left: 2px;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.institution-open-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
&:hover .institution-open-icon {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.institution-open-icon:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-institution-more {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 24px;
|
||||
padding: 3px 8px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: #fff;
|
||||
color: var(--sg-text-muted);
|
||||
font-family: inherit;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: var(--sg-primary);
|
||||
color: var(--sg-primary);
|
||||
background: var(--sg-surface-soft);
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Containers for chips
|
||||
// ------------------------
|
||||
|
||||
.topic-chips,
|
||||
.institution-tags,
|
||||
.author-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.topic-chips {
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.institution-tags {
|
||||
align-items: flex-start;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
.author-tags {
|
||||
align-items: flex-start;
|
||||
max-width: 280px;
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Empty text
|
||||
// ------------------------
|
||||
|
||||
.empty-text {
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Classification container
|
||||
// ------------------------
|
||||
|
||||
.classification-container {
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Data table overrides (applied via ::ng-deep)
|
||||
// ------------------------
|
||||
|
||||
::ng-deep {
|
||||
.mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
.mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
.mat-column-type,
|
||||
.mat-column-year,
|
||||
.mat-column-language,
|
||||
.mat-column-citations,
|
||||
.mat-mdc-header-cell {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mat-mdc-cell:not(:last-child),
|
||||
.mat-mdc-header-cell:not(:last-child) {
|
||||
border-right: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
.mat-column-institutions,
|
||||
.mat-column-topics {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Responsive adjustments
|
||||
// ------------------------
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
input,
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
viewChild,
|
||||
inject,
|
||||
} from '@angular/core';
|
||||
import { DfgProjectPage, DfgProjectSummary, Topic } from '../../../api';
|
||||
import { TopicChipComponent } from '../topic-chip/topic-chip.component';
|
||||
import {
|
||||
DataTableComponent,
|
||||
GenericColumn,
|
||||
} from '../data-table/data-table.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { QueryParamPaginatorComponent } from '../query-param-paginator/query-param-paginator.component';
|
||||
import { projectQueryParamKeys } from '../../../resolvers/dfg-projects.resolver';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DfgPersonSummary } from '../../../api/model/dfgPersonSummary';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
@Component({
|
||||
selector: 'app-dfg-project-table',
|
||||
imports: [
|
||||
DataTableComponent,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
QueryParamPaginatorComponent,
|
||||
MatTooltip,
|
||||
TopicChipComponent,
|
||||
],
|
||||
templateUrl: './dfg-project-table.component.html',
|
||||
styleUrl: './dfg-project-table.component.scss',
|
||||
})
|
||||
export class DfgProjectTableComponent implements OnInit {
|
||||
private readonly activatedRoute = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
page = input.required<DfgProjectPage>();
|
||||
authorFilterEnabled = input<boolean>(false);
|
||||
institutionFilterEnabled = input<boolean>(false);
|
||||
topicFilterEnabled = input<boolean>(false);
|
||||
|
||||
elements = computed(() => this.page().elements ?? []);
|
||||
|
||||
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
|
||||
initialValue: this.activatedRoute.snapshot.queryParamMap,
|
||||
});
|
||||
|
||||
queryParamKeys = projectQueryParamKeys;
|
||||
total = computed(() => this.page().total ?? 0);
|
||||
|
||||
columns: GenericColumn<DfgProjectSummary>[] = [];
|
||||
titleTmp = viewChild.required<TemplateRef<any>>('titleTmp');
|
||||
authorsTmp = viewChild.required<TemplateRef<any>>('authorsTmp');
|
||||
institutionsTmp = viewChild.required<TemplateRef<any>>('institutionsTmp');
|
||||
fundingStartTmp = viewChild.required<TemplateRef<any>>('fundingStartTmp');
|
||||
fundingEndTmp = viewChild.required<TemplateRef<any>>('fundingEndTmp');
|
||||
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
|
||||
detailRowTmp = viewChild.required<TemplateRef<any>>('detailRowTmp');
|
||||
topicsTmp = viewChild.required<TemplateRef<any>>('topicsTmp');
|
||||
|
||||
expandedProjectAuthorsId: string[] = [];
|
||||
expandedProjectInstitutionsId: string[] = [];
|
||||
expandedProjectTopicsId: string[] = [];
|
||||
|
||||
selectedFundingStartYearsQueryParams = computed(() => {
|
||||
return this.queryParamMap()
|
||||
.getAll(this.queryParamKeys.funding_start)
|
||||
.map(Number);
|
||||
});
|
||||
|
||||
selectedFundingEndYearsQueryParams = computed(() => {
|
||||
return this.queryParamMap()
|
||||
.getAll(this.queryParamKeys.funding_end)
|
||||
.map(Number);
|
||||
});
|
||||
|
||||
selectedAuthorIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.authorId);
|
||||
});
|
||||
|
||||
selectedInstitutionIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.institutionId);
|
||||
});
|
||||
|
||||
selectedTopicIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.topicId);
|
||||
});
|
||||
|
||||
ngOnInit(): void {
|
||||
console.log('DFG PROJECTS', this.page());
|
||||
this.columns = [
|
||||
{ id: 'title', header: 'Titel', type: 'accessor', accessorKey: 'title' },
|
||||
{
|
||||
id: 'funding_start',
|
||||
header: 'Förderbeginn',
|
||||
type: 'accessor',
|
||||
accessorKey: 'funding_start',
|
||||
},
|
||||
{
|
||||
id: 'funding_end',
|
||||
header: 'Förderende',
|
||||
type: 'accessor',
|
||||
accessorKey: 'funding_end',
|
||||
cellTemplate: this.fundingEndTmp(),
|
||||
},
|
||||
{
|
||||
id: 'names',
|
||||
header: 'Autoren',
|
||||
type: 'accessor',
|
||||
accessorKey: 'names',
|
||||
cellTemplate: this.authorsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'institutions',
|
||||
header: 'Institutionen',
|
||||
type: 'display',
|
||||
cellTemplate: this.institutionsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'professional_classification',
|
||||
header: 'Fachliche Zuordnung',
|
||||
type: 'accessor',
|
||||
accessorKey: 'professional_classification',
|
||||
cellTemplate: this.detailRowTmp(),
|
||||
},
|
||||
|
||||
{
|
||||
id: 'topics',
|
||||
header: 'Themen',
|
||||
type: 'display',
|
||||
cellTemplate: this.topicsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: '',
|
||||
type: 'display',
|
||||
cellTemplate: this.actionsTmp(),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sortNames(names: string[] | undefined): string[] {
|
||||
return [...(names ?? [])].sort((a, b) => a.localeCompare(b));
|
||||
}
|
||||
isAuthorActive(authorId: number): boolean {
|
||||
return (
|
||||
!!authorId &&
|
||||
this.authorFilterEnabled() &&
|
||||
this.selectedAuthorIdsQueryParams().includes(String(authorId))
|
||||
);
|
||||
}
|
||||
getProjectAuthors(project: DfgProjectSummary): DfgPersonSummary[] {
|
||||
return project.persons?.filter((a): a is DfgPersonSummary => !!a) || [];
|
||||
}
|
||||
|
||||
toggleProjectAuthorsExpansion(project: DfgProjectSummary): void {
|
||||
if (!project.id) return;
|
||||
|
||||
if (this.expandedProjectAuthorsId.includes(project.id)) {
|
||||
this.expandedProjectAuthorsId = this.expandedProjectAuthorsId.filter(
|
||||
(id) => id !== project.id,
|
||||
);
|
||||
} else {
|
||||
this.expandedProjectAuthorsId.push(project.id);
|
||||
}
|
||||
}
|
||||
isProjectPersonsExpanded(project: DfgProjectSummary): boolean {
|
||||
if (!project.id) return false;
|
||||
|
||||
return this.expandedProjectAuthorsId.includes(project.id);
|
||||
}
|
||||
getAuthorTooltipText(author: DfgPersonSummary): string {
|
||||
if (this.authorFilterEnabled() && author.person_id) {
|
||||
return `Nach Autor filtern: ${author.full_name}`;
|
||||
}
|
||||
return `Autor: ${author.full_name}`;
|
||||
}
|
||||
filterByAuthor(authorId: number): void {
|
||||
if (!authorId || !this.authorFilterEnabled()) return;
|
||||
const selectedAuthorIds = this.selectedAuthorIdsQueryParams();
|
||||
if (selectedAuthorIds.includes(String(authorId))) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.authorId]: selectedAuthorIds.filter(
|
||||
(id) => id !== String(authorId),
|
||||
),
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.authorId]: [
|
||||
...selectedAuthorIds,
|
||||
String(authorId),
|
||||
],
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isProjectInstitutionsExpanded(project: DfgProjectSummary): boolean {
|
||||
if (!project.id) return false;
|
||||
|
||||
return this.expandedProjectInstitutionsId.includes(project.id);
|
||||
}
|
||||
|
||||
toggleProjectInstitutionsExpansion(project: DfgProjectSummary): void {
|
||||
if (!project.id) return;
|
||||
|
||||
if (this.expandedProjectInstitutionsId.includes(project.id)) {
|
||||
this.expandedProjectInstitutionsId =
|
||||
this.expandedProjectInstitutionsId.filter((id) => id !== project.id);
|
||||
} else {
|
||||
this.expandedProjectInstitutionsId.push(project.id);
|
||||
}
|
||||
}
|
||||
|
||||
getProjectInstitutions(project: DfgProjectSummary): any[] {
|
||||
const institutions = new Map<string, any>();
|
||||
|
||||
for (const institution of project.institutions ?? []) {
|
||||
const id = this.getProjectInstitutionId(institution);
|
||||
if (!id) continue;
|
||||
|
||||
institutions.set(id, institution);
|
||||
}
|
||||
|
||||
return Array.from(institutions.values()).sort((a, b) =>
|
||||
this.getProjectInstitutionName(a).localeCompare(
|
||||
this.getProjectInstitutionName(b),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getProjectInstitutionId(institution: any): string | null {
|
||||
const id = institution.id;
|
||||
|
||||
return id == null ? null : String(id);
|
||||
}
|
||||
|
||||
getProjectInstitutionName(institution: any): string {
|
||||
return institution.institute_name_de ?? institution.institute_name_en;
|
||||
}
|
||||
|
||||
isInstitutionActive(
|
||||
institutionId: string | number | null | undefined,
|
||||
): boolean {
|
||||
return (
|
||||
!!institutionId &&
|
||||
this.institutionFilterEnabled() &&
|
||||
this.selectedInstitutionIdsQueryParams().includes(String(institutionId))
|
||||
);
|
||||
}
|
||||
|
||||
filterByInstitution(institution: any): void {
|
||||
const institutionId = this.getProjectInstitutionId(institution);
|
||||
|
||||
if (!institutionId || !this.institutionFilterEnabled()) return;
|
||||
|
||||
const selectedInstitutionIds = this.selectedInstitutionIdsQueryParams();
|
||||
|
||||
if (selectedInstitutionIds.includes(institutionId)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.institutionId]: selectedInstitutionIds.filter(
|
||||
(id) => id !== institutionId,
|
||||
),
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.institutionId]: [
|
||||
...selectedInstitutionIds,
|
||||
institutionId,
|
||||
],
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getInstitutionTooltipText(institution: any): string {
|
||||
const name = this.getProjectInstitutionName(institution);
|
||||
|
||||
if (this.institutionFilterEnabled()) {
|
||||
return `Nach Institution filtern: ${name}`;
|
||||
}
|
||||
|
||||
return `Institution: ${name}`;
|
||||
}
|
||||
|
||||
getWorkTopicColor(topic: Topic): string {
|
||||
return topicHierarchyColor({
|
||||
id: topic.id,
|
||||
name: topic.display_name,
|
||||
field_id: topic.field?.id,
|
||||
field_name: topic.field?.display_name,
|
||||
domain_id: topic.domain?.id,
|
||||
domain_name: topic.domain?.display_name,
|
||||
});
|
||||
}
|
||||
|
||||
isTopicActive(topic: Topic): boolean {
|
||||
return (
|
||||
!!topic.id &&
|
||||
this.authorFilterEnabled() &&
|
||||
this.selectedTopicIdsQueryParams().includes(topic.id)
|
||||
);
|
||||
}
|
||||
|
||||
filterByTopic(topic: Topic): void {
|
||||
if (!topic.id || !this.topicFilterEnabled()) return;
|
||||
const selectedTopicIds = this.selectedTopicIdsQueryParams();
|
||||
if (selectedTopicIds.includes(topic.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.topicId]: selectedTopicIds.filter(
|
||||
(id) => id !== topic.id,
|
||||
),
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.topicId]: [...selectedTopicIds, topic.id],
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
toggleProjectTopicsExpansion(project: DfgProjectSummary): void {
|
||||
if (!project.id) return;
|
||||
|
||||
if (this.expandedProjectTopicsId.includes(project.id)) {
|
||||
this.expandedProjectTopicsId = this.expandedProjectTopicsId.filter(
|
||||
(id) => id !== project.id,
|
||||
);
|
||||
} else {
|
||||
this.expandedProjectTopicsId.push(project.id);
|
||||
}
|
||||
}
|
||||
isProjectTopicsExpanded(project: DfgProjectSummary): boolean {
|
||||
if (!project.id) return false;
|
||||
|
||||
return this.expandedProjectTopicsId.includes(project.id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<app-data-table
|
||||
[columns]="columns"
|
||||
[data]="elements()"
|
||||
[queryParamSortKey]="queryParamKeys.sortBy"
|
||||
[queryParamSortDirectionKey]="queryParamKeys.sortDirection" />
|
||||
|
||||
<app-query-param-paginator
|
||||
[total]="total()"
|
||||
[queryParamPageKey]="queryParamKeys.page"
|
||||
[queryParamSizeKey]="queryParamKeys.size"
|
||||
[pageSizeOptions]="[10]" />
|
||||
|
||||
<ng-template #fundingStartTmp let-element>
|
||||
{{ element.startDate | date: 'dd.MM.yyyy' }}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #fundingEndTmp let-element>
|
||||
{{ element.endDate | date: 'dd.MM.yyyy' }}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #fundingAmountTmp let-element>
|
||||
{{ element.ecMaxContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #actionsTmp let-element>
|
||||
<a
|
||||
[routerLink]="['/projects/eu', element.id]"
|
||||
target="_blank"
|
||||
mat-icon-button
|
||||
color="primary">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
</ng-template>
|
||||
@@ -0,0 +1,78 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
input,
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import { CordisEuProject, CordisEuProjectPage } from '../../../api';
|
||||
import {
|
||||
DataTableComponent,
|
||||
GenericColumn,
|
||||
} from '../data-table/data-table.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { CurrencyPipe, DatePipe } from '@angular/common';
|
||||
import { QueryParamPaginatorComponent } from '../query-param-paginator/query-param-paginator.component';
|
||||
import { projectQueryParamKeys } from '../../../resolvers/dfg-projects.resolver';
|
||||
|
||||
@Component({
|
||||
selector: 'app-eu-project-table',
|
||||
imports: [
|
||||
DataTableComponent,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
DatePipe,
|
||||
CurrencyPipe,
|
||||
QueryParamPaginatorComponent,
|
||||
],
|
||||
templateUrl: './eu-project-table.component.html',
|
||||
styleUrl: './eu-project-table.component.scss',
|
||||
})
|
||||
export class EuProjectTableComponent implements OnInit {
|
||||
page = input.required<CordisEuProjectPage>();
|
||||
queryParamKeys = projectQueryParamKeys;
|
||||
|
||||
elements = computed(() => this.page().elements ?? []);
|
||||
total = computed(() => this.page().total ?? 0);
|
||||
|
||||
columns: GenericColumn<CordisEuProject>[] = [];
|
||||
|
||||
fundingStartTmp = viewChild.required<TemplateRef<any>>('fundingStartTmp');
|
||||
fundingEndTmp = viewChild.required<TemplateRef<any>>('fundingEndTmp');
|
||||
fundingAmountTmp = viewChild.required<TemplateRef<any>>('fundingAmountTmp');
|
||||
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
|
||||
|
||||
ngOnInit(): void {
|
||||
this.columns = [
|
||||
{ id: 'title', header: 'Titel', type: 'accessor', accessorKey: 'title' },
|
||||
{
|
||||
id: 'startDate',
|
||||
header: 'Startdatum',
|
||||
type: 'display',
|
||||
cellTemplate: this.fundingStartTmp(),
|
||||
},
|
||||
{
|
||||
id: 'endDate',
|
||||
header: 'Enddatum',
|
||||
type: 'display',
|
||||
cellTemplate: this.fundingEndTmp(),
|
||||
},
|
||||
{
|
||||
id: 'ecMaxContribution',
|
||||
header: 'Förderbetrag (EU)',
|
||||
type: 'display',
|
||||
cellTemplate: this.fundingAmountTmp(),
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: '',
|
||||
type: 'display',
|
||||
cellTemplate: this.actionsTmp(),
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,8 @@
|
||||
<div
|
||||
class="primary-inst-badge clickable-pie-target"
|
||||
[class.active-pie]="selectedPieEntityId() === primaryInstitution()"
|
||||
(click)="
|
||||
onSelectPie(
|
||||
primaryInstitution() || '',
|
||||
primaryInstitutionName() || ''
|
||||
)
|
||||
"
|
||||
[title]="'Klicken, um die Themenverteilung im Kreisdiagramm anzuzeigen'">
|
||||
(click)="onSelectPrimaryBadge()"
|
||||
[title]="'Klicken, um die Einrichtung zur Vergleichsliste hinzuzufügen'">
|
||||
<span class="label">Zugewiesen:</span>
|
||||
<strong class="name">
|
||||
<mat-icon class="pie-icon-indicator">{{
|
||||
@@ -77,6 +72,15 @@
|
||||
{{ inst.name }}
|
||||
</span>
|
||||
<div class="item-actions">
|
||||
<a
|
||||
[href]="getRedirectUrl(inst.id)"
|
||||
target="_blank"
|
||||
class="action-btn redirect-btn"
|
||||
[style.color]="getEntityColor()(inst.id)"
|
||||
(click)="$event.stopPropagation()"
|
||||
title="Zur Detailansicht der Einrichtung wechseln">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
class="action-btn visibility-btn"
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface CompareItem {
|
||||
styleUrl: './institution-selector.component.scss',
|
||||
})
|
||||
export class InstitutionSelectorComponent {
|
||||
readonly activeTab = input<string>('publications');
|
||||
readonly comparisonInstitutions = input<CompareItem[]>([]);
|
||||
readonly primaryInstitution = input<string | null>(null);
|
||||
readonly primaryInstitutionName = input<string | null>(null);
|
||||
@@ -37,6 +38,27 @@ export class InstitutionSelectorComponent {
|
||||
type: 'institution';
|
||||
}>();
|
||||
|
||||
onSelectPrimaryBadge(): void {
|
||||
const id = this.primaryInstitution();
|
||||
const name = this.primaryInstitutionName();
|
||||
if (id && name) {
|
||||
this.addInstitution.emit({ id, name });
|
||||
this.onSelectPie(id, name);
|
||||
}
|
||||
}
|
||||
|
||||
getRedirectUrl(id: string): string {
|
||||
const cleanId = id.includes('/') ? id.split('/').pop() || id : id;
|
||||
const tab = this.activeTab();
|
||||
if (tab === 'projects') {
|
||||
return `/inse-webapp/institution/${cleanId}/projects?project_tab=bund&page=0&size=10&search=&sort_by=title&sort_direction=asc`;
|
||||
}
|
||||
if (tab === 'patents') {
|
||||
return `/inse-webapp/institution/${cleanId}/patents?filter=all&sortBy=date&matchType=all&page=1`;
|
||||
}
|
||||
return `/inse-webapp/institution/${cleanId}/publications`;
|
||||
}
|
||||
|
||||
onSelectPie(id: string, name: string): void {
|
||||
this.selectPie.emit({ id, name, type: 'institution' });
|
||||
}
|
||||
@@ -70,8 +92,20 @@ export class InstitutionSelectorComponent {
|
||||
|
||||
isAlreadyAdded(id: string | undefined): boolean {
|
||||
if (!id) return false;
|
||||
const isPrimary = this.primaryInstitution() === id;
|
||||
const isComp = this.comparisonInstitutions().some((i) => i.id === id);
|
||||
const cleanTarget = id.includes('/') ? id.split('/').pop() || id : id;
|
||||
const primaryId = this.primaryInstitution();
|
||||
const cleanPrimary = primaryId
|
||||
? primaryId.includes('/')
|
||||
? primaryId.split('/').pop() || primaryId
|
||||
: primaryId
|
||||
: null;
|
||||
const isPrimary = cleanPrimary?.toLowerCase() === cleanTarget.toLowerCase();
|
||||
const isComp = this.comparisonInstitutions().some((i) => {
|
||||
const cleanItem = i.id.includes('/')
|
||||
? i.id.split('/').pop() || i.id
|
||||
: i.id;
|
||||
return cleanItem.toLowerCase() === cleanTarget.toLowerCase();
|
||||
});
|
||||
return isPrimary || isComp;
|
||||
}
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<div>
|
||||
<div
|
||||
echarts
|
||||
[options]="chartOption()"
|
||||
style="height: 300px; width: 100%"></div>
|
||||
<div class="info-cards">
|
||||
@for (cardInput of this.cardInputs(); track $index) {
|
||||
<app-info-card
|
||||
[value]="cardInput.value"
|
||||
[description]="cardInput.description"
|
||||
[icon]="cardInput.icon" />
|
||||
}
|
||||
<app-info-card
|
||||
[value]="this.totalCount() + ''"
|
||||
description="Gesamtanzahl klassifizierter Publikationen"
|
||||
icon="article" />
|
||||
</div>
|
||||
</div>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
.info-cards {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import {
|
||||
PrimaryCategoryYearAggregation,
|
||||
PrimaryCategoryYearAggregationPage,
|
||||
WorkPrimaryCategory,
|
||||
} from '../../../api';
|
||||
import { transformWorkPrimaryCategory } from '../../pipes/work-primary-category.pipe';
|
||||
import { AppInfoCardComponent } from '../app-info-card/app-info-card.component';
|
||||
import { EChartsCoreOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
|
||||
type CardInput = {
|
||||
value: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-primary-category-year-aggregation-chart',
|
||||
imports: [AppInfoCardComponent, NgxEchartsDirective],
|
||||
templateUrl: './primary-category-year-aggregation-chart.component.html',
|
||||
styleUrl: './primary-category-year-aggregation-chart.component.scss',
|
||||
})
|
||||
export class PrimaryCategoryYearAggregationChartComponent {
|
||||
page = input.required<PrimaryCategoryYearAggregationPage>();
|
||||
|
||||
countPrimaryCategoryForAllYears(
|
||||
page: PrimaryCategoryYearAggregationPage,
|
||||
primaryCategory: WorkPrimaryCategory,
|
||||
): number {
|
||||
if (!page?.elements) {
|
||||
return 0;
|
||||
}
|
||||
return page.elements.reduce((acc, element) => {
|
||||
const count = element.categories?.[primaryCategory] || 0;
|
||||
return acc + count;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
basicResearchCount = computed(() => {
|
||||
return this.countPrimaryCategoryForAllYears(
|
||||
this.page(),
|
||||
WorkPrimaryCategory.BasicResearch,
|
||||
);
|
||||
});
|
||||
basicResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.BasicResearch,
|
||||
);
|
||||
|
||||
appliedResearchCount = computed(() => {
|
||||
return this.countPrimaryCategoryForAllYears(
|
||||
this.page(),
|
||||
WorkPrimaryCategory.AppliedResearch,
|
||||
);
|
||||
});
|
||||
appliedResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.AppliedResearch,
|
||||
);
|
||||
|
||||
nonResearchCount = computed(() => {
|
||||
return this.countPrimaryCategoryForAllYears(
|
||||
this.page(),
|
||||
WorkPrimaryCategory.NonResearch,
|
||||
);
|
||||
});
|
||||
nonResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.NonResearch,
|
||||
);
|
||||
|
||||
experimentalDevelopmentCount = computed(() => {
|
||||
return this.countPrimaryCategoryForAllYears(
|
||||
this.page(),
|
||||
WorkPrimaryCategory.ExperimentalDevelopment,
|
||||
);
|
||||
});
|
||||
experimentalDevelopmentLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.ExperimentalDevelopment,
|
||||
);
|
||||
|
||||
totalCount = computed(() => {
|
||||
return (
|
||||
this.basicResearchCount() +
|
||||
this.appliedResearchCount() +
|
||||
this.nonResearchCount() +
|
||||
this.experimentalDevelopmentCount()
|
||||
);
|
||||
});
|
||||
|
||||
cardInputs = computed<CardInput[]>(() => {
|
||||
return [
|
||||
{
|
||||
value: this.basicResearchCount().toString(),
|
||||
description: this.basicResearchLabel,
|
||||
icon: 'science',
|
||||
},
|
||||
{
|
||||
value: this.appliedResearchCount().toString(),
|
||||
description: this.appliedResearchLabel,
|
||||
icon: 'biotech',
|
||||
},
|
||||
{
|
||||
value: this.nonResearchCount().toString(),
|
||||
description: this.nonResearchLabel,
|
||||
icon: 'work_outline',
|
||||
},
|
||||
{
|
||||
value: this.experimentalDevelopmentCount().toString(),
|
||||
description: this.experimentalDevelopmentLabel,
|
||||
icon: 'build',
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
chartOption = computed(() => {
|
||||
return this.buildChartOptions(this.page().elements ?? []);
|
||||
});
|
||||
|
||||
buildChartOptions(data: PrimaryCategoryYearAggregation[]): EChartsCoreOption {
|
||||
return {
|
||||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||||
legend: {
|
||||
data: [
|
||||
this.basicResearchLabel,
|
||||
this.appliedResearchLabel,
|
||||
this.nonResearchLabel,
|
||||
this.experimentalDevelopmentLabel,
|
||||
],
|
||||
bottom: 0,
|
||||
itemGap: 40,
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '10%',
|
||||
top: '3%',
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: data.map((d) => d.publication_year.toString()),
|
||||
},
|
||||
yAxis: { type: 'value' },
|
||||
series: [
|
||||
{
|
||||
name: this.basicResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map(
|
||||
(d) => d.categories?.[WorkPrimaryCategory.BasicResearch] || 0,
|
||||
),
|
||||
},
|
||||
{
|
||||
name: this.appliedResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map(
|
||||
(d) => d.categories?.[WorkPrimaryCategory.AppliedResearch] || 0,
|
||||
),
|
||||
},
|
||||
{
|
||||
name: this.nonResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map(
|
||||
(d) => d.categories?.[WorkPrimaryCategory.NonResearch] || 0,
|
||||
),
|
||||
},
|
||||
{
|
||||
name: this.experimentalDevelopmentLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map(
|
||||
(d) =>
|
||||
d.categories?.[WorkPrimaryCategory.ExperimentalDevelopment] || 0,
|
||||
),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<div class="content">
|
||||
@if (showTitleFilter()) {
|
||||
<app-query-param-input
|
||||
[queryParamKey]="queryParamKeys.title"
|
||||
label="Suche nach Titel"
|
||||
placeholder="Suche"
|
||||
[debounceTime]="300" />
|
||||
}
|
||||
<div class="select-area">
|
||||
@if (showFundingStartFilter()) {
|
||||
<app-searchable-year-select
|
||||
[label]="fundingStartYearLabel()"
|
||||
[selectedYears]="selectedFundingStartYears()"
|
||||
(handleYearSelectChange)="handleFundingStartSelectChange($event)" />
|
||||
}
|
||||
@if (showFundingEndFilter()) {
|
||||
<app-searchable-year-select
|
||||
[label]="fundingEndYearLabel()"
|
||||
[selectedYears]="selectedFundingEndYears()"
|
||||
(handleYearSelectChange)="handleFundingEndSelectChange($event)" />
|
||||
}
|
||||
@if (showInstitutionFilter()) {
|
||||
<app-searchable-dfg-institution-select
|
||||
[label]="institutionLabel()"
|
||||
[selectedInstitutions]="selectedInstitutions()"
|
||||
(handleInstitutionSelectChange)="
|
||||
handleInstitutionSelectChange($event)
|
||||
" />
|
||||
}
|
||||
@if (showAuthorFilter()) {
|
||||
<app-searchable-dfg-author-select
|
||||
[label]="authorLabel()"
|
||||
[selectedAuthors]="selectedAuthors()"
|
||||
(handleAuthorSelectChange)="handleAuthorSelectChange($event)" />
|
||||
}
|
||||
@if (showTopicFilter()) {
|
||||
<app-searchable-topic-select
|
||||
[label]="topicLabel()"
|
||||
[selectedTopics]="selectedTopics()"
|
||||
(handleTopicSelectChange)="handleTopicSelectChange($event)" />
|
||||
}
|
||||
<button mat-stroked-button color="primary" (click)="resetFilters()">
|
||||
<mat-icon>filter_alt_off</mat-icon>
|
||||
Filter zurücksetzen
|
||||
</button>
|
||||
</div>
|
||||
<app-selected-filters [observers]="observers()" />
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.select-area {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { DfgInstitutionSummaryPage } from '../../../api/model/dfgInstitutionSummaryPage';
|
||||
import { DfgInstitutionSummary } from '../../../api/model/dfgInstitutionSummary';
|
||||
import {
|
||||
DfgPersonSummary,
|
||||
DfgPersonSummaryPage,
|
||||
Topic,
|
||||
TopicPageV2,
|
||||
} from '../../../api';
|
||||
import { QueryParamInputComponent } from '../query-param-input/query-param-input.component';
|
||||
import { SearchableDfgInstitutionSelectComponent } from '../searchable-dfg-institution-select/searchable-dfg-institution-select.component';
|
||||
|
||||
import { SearchableYearSelectComponent } from '../searchable-year-select/searchable-year-select.component';
|
||||
import { projectQueryParamKeys } from '../../../resolvers/dfg-projects.resolver';
|
||||
import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../selected-filters/selected-filters.component';
|
||||
import { map } from 'rxjs/internal/operators/map';
|
||||
import { SearchableDfgAuthorSelectComponent } from '../searchable-dfg-author-select/searchable-dfg-author-select.component';
|
||||
import { SearchableTopicSelectComponent } from '../searchable-topic-select/searchable-topic-select.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-filters',
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
QueryParamInputComponent,
|
||||
SearchableDfgInstitutionSelectComponent,
|
||||
SearchableDfgAuthorSelectComponent,
|
||||
SearchableYearSelectComponent,
|
||||
SelectedFiltersComponent,
|
||||
SearchableTopicSelectComponent,
|
||||
],
|
||||
templateUrl: './project-filters.component.html',
|
||||
styleUrl: './project-filters.component.scss',
|
||||
})
|
||||
export class ProjectFilterComponent {
|
||||
constructor(private readonly router: Router) {}
|
||||
|
||||
// Each tab (DFG / EU) passes its OWN key set so they never collide.
|
||||
queryParamKeys = projectQueryParamKeys;
|
||||
|
||||
// selectedAuthorsPage = input<AuthorPage>();
|
||||
// selectedAuthors = computed<Author[]>(
|
||||
// () => this.selectedAuthorsPage()?.elements || [],
|
||||
// );
|
||||
selectedAuthorsPage = input<DfgPersonSummaryPage>();
|
||||
selectedAuthors = computed<DfgPersonSummary[]>(
|
||||
() => this.selectedAuthorsPage()?.elements || [],
|
||||
);
|
||||
selectedInstitutionsPage = input<DfgInstitutionSummaryPage>();
|
||||
selectedInstitutions = computed<DfgInstitutionSummary[]>(
|
||||
() => this.selectedInstitutionsPage()?.elements || [],
|
||||
);
|
||||
selectedTopicsPage = input<TopicPageV2>();
|
||||
selectedTopics = computed<Topic[]>(
|
||||
() => this.selectedTopicsPage()?.elements || [],
|
||||
);
|
||||
|
||||
showTitleFilter = input<boolean>(true);
|
||||
showInstitutionFilter = input<boolean>(true);
|
||||
showAuthorFilter = input<boolean>(true);
|
||||
showFundingStartFilter = input<boolean>(true);
|
||||
showFundingEndFilter = input<boolean>(false);
|
||||
showTopicFilter = input<boolean>(true);
|
||||
queryParamMap = toSignal(this.router.routerState.root.queryParamMap, {
|
||||
initialValue: this.router.routerState.snapshot.root.queryParamMap,
|
||||
});
|
||||
|
||||
selectedInstitutionIds = computed(() =>
|
||||
this.queryParamMap().getAll(this.queryParamKeys.institutionId),
|
||||
);
|
||||
|
||||
selectedAuthorIds = computed(() =>
|
||||
this.queryParamMap().getAll(this.queryParamKeys.authorId),
|
||||
);
|
||||
|
||||
selectedFundingStartYears = computed(() =>
|
||||
this.queryParamMap().getAll(this.queryParamKeys.funding_start).map(Number),
|
||||
);
|
||||
selectedFundingEndYears = computed(() =>
|
||||
this.queryParamMap().getAll(this.queryParamKeys.funding_end).map(Number),
|
||||
);
|
||||
fundingStartYearLabel = computed(() => {
|
||||
const selectedYears = this.selectedFundingStartYears();
|
||||
if (selectedYears.length === 0) {
|
||||
return 'Förderbeginn';
|
||||
} else if (selectedYears.length === 1) {
|
||||
return selectedYears[0].toString();
|
||||
} else {
|
||||
return `${selectedYears.join(', ')} Jahre`;
|
||||
}
|
||||
});
|
||||
|
||||
fundingEndYearLabel = computed(() => {
|
||||
const selectedYears = this.selectedFundingEndYears();
|
||||
if (selectedYears.length === 0) {
|
||||
return 'Förderende';
|
||||
} else if (selectedYears.length === 1) {
|
||||
return selectedYears[0].toString();
|
||||
} else {
|
||||
return `${selectedYears.join(', ')} Jahre`;
|
||||
}
|
||||
});
|
||||
|
||||
institutionLabel = computed(() => {
|
||||
const selected = this.selectedInstitutions().filter((i) =>
|
||||
this.selectedInstitutionIds().includes(String(i.id!)),
|
||||
);
|
||||
if (selected.length === 0) return 'Institution';
|
||||
if (selected.length === 1)
|
||||
return selected[0].institute_name_de ?? 'Institution';
|
||||
return `${selected.length} Institutionen`;
|
||||
});
|
||||
|
||||
authorLabel = computed(() => {
|
||||
const selected = this.selectedAuthors().filter((a) =>
|
||||
this.selectedAuthorIds().includes(String(a.person_id!)),
|
||||
);
|
||||
if (selected.length === 0) return 'Autor';
|
||||
if (selected.length === 1) return selected[0].full_name ?? 'Autor';
|
||||
return `${selected.length} Autoren`;
|
||||
});
|
||||
|
||||
observers = computed<FilterObserver[]>(() => {
|
||||
const keys = this.queryParamKeys;
|
||||
return [
|
||||
{ id: 'search', queryParamKey: keys.title, icon: 'search' },
|
||||
{
|
||||
id: 'fundingStart',
|
||||
queryParamKey: projectQueryParamKeys.funding_start,
|
||||
icon: 'calendar_today',
|
||||
valueFormatter: (value: string) => `Förderbeginn ${value}`,
|
||||
},
|
||||
{
|
||||
id: 'fundingEnd',
|
||||
queryParamKey: projectQueryParamKeys.funding_end,
|
||||
icon: 'event_busy',
|
||||
valueFormatter: (value: string) => `Förderende ${value}`,
|
||||
},
|
||||
{
|
||||
id: 'institutions',
|
||||
queryParamKey: keys.institutionId,
|
||||
icon: 'apartment',
|
||||
valueFormatter: (value: string) =>
|
||||
this.selectedInstitutions().find((i) => String(i.id) === value)
|
||||
?.institute_name_de ?? value,
|
||||
},
|
||||
{
|
||||
id: 'authors',
|
||||
queryParamKey: keys.authorId,
|
||||
icon: 'person',
|
||||
valueFormatter: (value: string) =>
|
||||
this.selectedAuthors().find((a) => String(a.person_id) === value)
|
||||
?.full_name ?? value,
|
||||
},
|
||||
{
|
||||
id: 'topics',
|
||||
queryParamKey: keys.topicId,
|
||||
icon: 'topic',
|
||||
valueFormatter: (value: string) => {
|
||||
const topic = this.selectedTopics().find((t) => t.id === value);
|
||||
return topic ? topic.display_name : value;
|
||||
},
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
handleFundingStartSelectChange = (selectedYear: number): void => {
|
||||
if (this.selectedFundingStartYears().includes(selectedYear)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[projectQueryParamKeys.funding_start]:
|
||||
this.selectedFundingStartYears().filter(
|
||||
(year) => year !== selectedYear,
|
||||
),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[projectQueryParamKeys.funding_start]: [
|
||||
...this.selectedFundingStartYears(),
|
||||
selectedYear,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
handleFundingEndSelectChange = (selectedYear: number): void => {
|
||||
if (this.selectedFundingEndYears().includes(selectedYear)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[projectQueryParamKeys.funding_end]:
|
||||
this.selectedFundingEndYears().filter(
|
||||
(year) => year !== selectedYear,
|
||||
),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[projectQueryParamKeys.funding_end]: [
|
||||
...this.selectedFundingEndYears(),
|
||||
selectedYear,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
handleInstitutionSelectChange = (
|
||||
institution: DfgInstitutionSummary,
|
||||
): void => {
|
||||
if (!institution.id) return;
|
||||
const keys = this.queryParamKeys;
|
||||
const selectedIds = this.selectedInstitutionIds();
|
||||
const nextIds = selectedIds.includes(String(institution.id))
|
||||
? selectedIds.filter((id) => id !== String(institution.id))
|
||||
: [...selectedIds, String(institution.id)];
|
||||
|
||||
this.router.navigate([], {
|
||||
queryParams: { [keys.institutionId]: nextIds, [keys.page]: 0 },
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
};
|
||||
|
||||
handleAuthorSelectChange = (author: DfgPersonSummary): void => {
|
||||
if (!author.person_id) return;
|
||||
const keys = this.queryParamKeys;
|
||||
const selectedIds = this.selectedAuthorIds();
|
||||
const nextIds = selectedIds.includes(String(author.person_id))
|
||||
? selectedIds.filter((id) => id !== String(author.person_id))
|
||||
: [...selectedIds, String(author.person_id)];
|
||||
|
||||
this.router.navigate([], {
|
||||
queryParams: { [keys.authorId]: nextIds, [keys.page]: 0 },
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
};
|
||||
|
||||
topicLabel = computed(() => {
|
||||
const selectedTopicIds = this.selectedTopics().map((t) => t.id);
|
||||
if (selectedTopicIds.length === 0) {
|
||||
return 'Thema';
|
||||
} else if (selectedTopicIds.length === 1) {
|
||||
const topic = this.selectedTopics()[0];
|
||||
return topic.display_name || 'Thema';
|
||||
} else {
|
||||
return `${selectedTopicIds.length} Themen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleTopicSelectChange = (selectedTopic: Topic): void => {
|
||||
if (this.selectedTopics().some((t) => t.id === selectedTopic.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.topicId]: this.selectedTopics()
|
||||
.filter((t) => t.id !== selectedTopic.id)
|
||||
.map((t) => t.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.topicId]: [
|
||||
...this.selectedTopics().map((t) => t.id!),
|
||||
selectedTopic.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
resetFilters = (): void => {
|
||||
const keys = this.queryParamKeys;
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[keys.title]: null,
|
||||
[keys.institutionId]: null,
|
||||
[keys.authorId]: null,
|
||||
[keys.funding_start]: null,
|
||||
[keys.funding_end]: null,
|
||||
[keys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<div class="content">
|
||||
@if (showTitleFilter()) {
|
||||
<app-query-param-input
|
||||
[queryParamKey]="titleQueryParamKey()"
|
||||
label="Suchen nach Titel"
|
||||
placeholder="Suche"
|
||||
[debounceTime]="300" />
|
||||
}
|
||||
<div class="select-area">
|
||||
@if (showYearFilter()) {
|
||||
<app-searchable-year-select
|
||||
[label]="yearLabel()"
|
||||
[selectedYears]="selectedYears()"
|
||||
(handleYearSelectChange)="handleYearSelectChange($event)" />
|
||||
}
|
||||
@if (showWorkTypeFilter()) {
|
||||
<app-searchable-work-type-select
|
||||
[label]="workTypeLabel()"
|
||||
[selectedWorkTypes]="selectedWorkTypes()"
|
||||
(handleWorkTypeSelectChange)="handleWorkTypeSelectChange($event)" />
|
||||
}
|
||||
@if (showLanguageFilter()) {
|
||||
<app-searchable-language-select
|
||||
[label]="languageLabel()"
|
||||
[selectedLanguages]="selectedLanguages()"
|
||||
(handleLanguageSelectChange)="handleLanguageSelectChange($event)" />
|
||||
}
|
||||
@if (showAuthorFilter()) {
|
||||
<app-searchable-author-select
|
||||
[label]="authorLabel()"
|
||||
[selectedAuthors]="selectedAuthors()"
|
||||
(handleAuthorSelectChange)="handleAuthorSelectChange($event)" />
|
||||
}
|
||||
@if (showInstitutionFilter()) {
|
||||
<app-searchable-institution-select
|
||||
[label]="institutionLabel()"
|
||||
[selectedInstitutions]="selectedInstitutions()"
|
||||
(handleInstitutionSelectChange)="
|
||||
handleInstitutionSelectChange($event)
|
||||
" />
|
||||
}
|
||||
@if (showTopicFilter()) {
|
||||
<app-searchable-topic-select
|
||||
[label]="topicLabel()"
|
||||
[selectedTopics]="selectedTopics()"
|
||||
(handleTopicSelectChange)="handleTopicSelectChange($event)" />
|
||||
}
|
||||
<button mat-stroked-button color="primary" (click)="resetFilters()">
|
||||
<mat-icon>filter_alt_off</mat-icon>
|
||||
Filter zurücksetzen
|
||||
</button>
|
||||
</div>
|
||||
<app-selected-filters [observers]="observers" />
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.select-area {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,381 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { SearchableTopicSelectComponent } from '../searchable-topic-select/searchable-topic-select.component';
|
||||
import { SearchableYearSelectComponent } from '../searchable-year-select/searchable-year-select.component';
|
||||
import {
|
||||
Author,
|
||||
AuthorPage,
|
||||
Institution,
|
||||
InstitutionPageV2,
|
||||
Topic,
|
||||
TopicPageV2,
|
||||
} from '../../../api';
|
||||
import { Router } from '@angular/router';
|
||||
import { workQueryParamKeys } from '../../../resolvers/work-page.resolver';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { SearchableInstitutionSelectComponent } from '../searchable-institution-select/searchable-institution-select.component';
|
||||
import {
|
||||
findWorkTypeById,
|
||||
SearchableWorkTypeSelectComponent,
|
||||
WorkType,
|
||||
} from '../searchable-work-type-select/searchable-work-type-select.component';
|
||||
import {
|
||||
findLanguageById,
|
||||
Language,
|
||||
SearchableLanguageSelectComponent,
|
||||
} from '../searchable-language-select/searchable-language-select.component';
|
||||
import { SearchableAuthorSelectComponent } from '../searchable-author-select/searchable-author-select.component';
|
||||
import { QueryParamInputComponent } from '../query-param-input/query-param-input.component';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../selected-filters/selected-filters.component';
|
||||
import { translateWorkType } from '../../pipes/work-type.pipe';
|
||||
import { translateLanguageCode } from '../../pipes/language-code.pipe';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publication-filter',
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
SearchableTopicSelectComponent,
|
||||
SearchableYearSelectComponent,
|
||||
SearchableInstitutionSelectComponent,
|
||||
SearchableWorkTypeSelectComponent,
|
||||
SearchableLanguageSelectComponent,
|
||||
SearchableAuthorSelectComponent,
|
||||
QueryParamInputComponent,
|
||||
SelectedFiltersComponent,
|
||||
],
|
||||
templateUrl: './publication-filters.component.html',
|
||||
styleUrl: './publication-filters.component.scss',
|
||||
})
|
||||
export class PublicationFilterComponent {
|
||||
constructor(private readonly router: Router) {}
|
||||
|
||||
selectedAuthorsPage = input<AuthorPage>();
|
||||
selectedAuthors = computed<Author[]>(
|
||||
() => this.selectedAuthorsPage()?.elements || [],
|
||||
);
|
||||
selectedTopicsPage = input<TopicPageV2>();
|
||||
selectedTopics = computed<Topic[]>(
|
||||
() => this.selectedTopicsPage()?.elements || [],
|
||||
);
|
||||
selectedInstitutionsPage = input<InstitutionPageV2>();
|
||||
selectedInstitutions = computed<Institution[]>(
|
||||
() => this.selectedInstitutionsPage()?.elements || [],
|
||||
);
|
||||
|
||||
showTitleFilter = input<boolean>(true);
|
||||
showYearFilter = input<boolean>(true);
|
||||
showWorkTypeFilter = input<boolean>(true);
|
||||
showLanguageFilter = input<boolean>(true);
|
||||
showAuthorFilter = input<boolean>(true);
|
||||
showInstitutionFilter = input<boolean>(true);
|
||||
showTopicFilter = input<boolean>(true);
|
||||
|
||||
observers: FilterObserver[] = [
|
||||
{
|
||||
id: 'search',
|
||||
queryParamKey: workQueryParamKeys.title,
|
||||
icon: 'search',
|
||||
},
|
||||
{
|
||||
id: 'types',
|
||||
queryParamKey: workQueryParamKeys.types,
|
||||
icon: 'category',
|
||||
valueFormatter: (value: string) => {
|
||||
return translateWorkType(value) || value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'years',
|
||||
queryParamKey: workQueryParamKeys.years,
|
||||
icon: 'calendar_today',
|
||||
},
|
||||
{
|
||||
id: 'languages',
|
||||
queryParamKey: workQueryParamKeys.language,
|
||||
icon: 'translate',
|
||||
valueFormatter: (value: string) => {
|
||||
return translateLanguageCode(value) || value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'authors',
|
||||
queryParamKey: workQueryParamKeys.authorId,
|
||||
icon: 'person',
|
||||
valueFormatter: (value: string) => {
|
||||
const author = this.selectedAuthors().find((a) => a.id === value);
|
||||
console.log('Authors', this.selectedAuthors());
|
||||
return author ? author.display_name : value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'institutions',
|
||||
queryParamKey: workQueryParamKeys.institutionId,
|
||||
icon: 'business',
|
||||
valueFormatter: (value: string) => {
|
||||
const institution = this.selectedInstitutions().find(
|
||||
(i) => i.id === value,
|
||||
);
|
||||
return institution ? institution.display_name : value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'topics',
|
||||
queryParamKey: workQueryParamKeys.topicId,
|
||||
icon: 'label',
|
||||
valueFormatter: (value: string) => {
|
||||
const topic = this.selectedTopics().find((t) => t.id === value);
|
||||
return topic ? topic.display_name : value;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
queryParamMap = toSignal(this.router.routerState.root.queryParamMap, {
|
||||
initialValue: this.router.routerState.snapshot.root.queryParamMap,
|
||||
});
|
||||
|
||||
titleQueryParamKey = computed(() => workQueryParamKeys.title);
|
||||
|
||||
selectedYears = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.years).map(Number);
|
||||
});
|
||||
|
||||
yearLabel = computed(() => {
|
||||
const selectedYears = this.selectedYears();
|
||||
if (selectedYears.length === 0) {
|
||||
return 'Jahr';
|
||||
} else if (selectedYears.length === 1) {
|
||||
return selectedYears[0].toString();
|
||||
} else {
|
||||
return `${selectedYears.length} Jahre`;
|
||||
}
|
||||
});
|
||||
|
||||
handleYearSelectChange = (selectedYear: number): void => {
|
||||
if (this.selectedYears().includes(selectedYear)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: this.selectedYears().filter(
|
||||
(year) => year !== selectedYear,
|
||||
),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: [...this.selectedYears(), selectedYear],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
selectedWorkTypes = computed(() => {
|
||||
const workTypeIds = this.queryParamMap().getAll(workQueryParamKeys.types);
|
||||
return workTypeIds
|
||||
.map((id) => findWorkTypeById(id))
|
||||
.filter((type) => type !== undefined) as WorkType[];
|
||||
});
|
||||
|
||||
workTypeLabel = computed(() => {
|
||||
const selectedWorkTypes = this.selectedWorkTypes();
|
||||
if (selectedWorkTypes.length === 0) {
|
||||
return 'Typ';
|
||||
} else if (selectedWorkTypes.length === 1) {
|
||||
return selectedWorkTypes[0].name;
|
||||
} else {
|
||||
return `${selectedWorkTypes.length} Typen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleWorkTypeSelectChange = (selectedWorkType: WorkType): void => {
|
||||
if (this.selectedWorkTypes().some((t) => t.id === selectedWorkType.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: this.selectedWorkTypes()
|
||||
.filter((t) => t.id !== selectedWorkType.id)
|
||||
.map((t) => t.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: [
|
||||
...this.selectedWorkTypes().map((t) => t.id),
|
||||
selectedWorkType.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
selectedLanguages = computed(() => {
|
||||
const languageCodes = this.queryParamMap().getAll(
|
||||
workQueryParamKeys.language,
|
||||
);
|
||||
return languageCodes
|
||||
.map((code) => findLanguageById(code))
|
||||
.filter((lang) => lang !== undefined) as Language[];
|
||||
});
|
||||
|
||||
languageLabel = computed(() => {
|
||||
const selectedLanguages = this.selectedLanguages();
|
||||
if (selectedLanguages.length === 0) {
|
||||
return 'Sprache';
|
||||
} else if (selectedLanguages.length === 1) {
|
||||
return selectedLanguages[0].name;
|
||||
} else {
|
||||
return `${selectedLanguages.length} Sprachen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleLanguageSelectChange = (selectedLanguage: Language): void => {
|
||||
if (
|
||||
this.selectedLanguages().some((l) => l.code === selectedLanguage.code)
|
||||
) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: this.selectedLanguages()
|
||||
.filter((l) => l.code !== selectedLanguage.code)
|
||||
.map((l) => l.code),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: [
|
||||
...this.selectedLanguages().map((l) => l.code),
|
||||
selectedLanguage.code,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
authorLabel = computed(() => {
|
||||
const selectedAuthors = this.selectedAuthors();
|
||||
if (selectedAuthors.length === 0) {
|
||||
return 'Autor';
|
||||
} else if (selectedAuthors.length === 1) {
|
||||
return selectedAuthors[0].display_name ?? 'Autor';
|
||||
} else {
|
||||
return `${selectedAuthors.length} Autoren`;
|
||||
}
|
||||
});
|
||||
|
||||
handleAuthorSelectChange = (selectedAuthor: Author): void => {
|
||||
if (this.selectedAuthors().includes(selectedAuthor)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.authorId]: this.selectedAuthors()
|
||||
.filter((a) => a !== selectedAuthor)
|
||||
.map((a) => a.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.authorId]: [
|
||||
...this.selectedAuthors().map((a) => a.id),
|
||||
selectedAuthor.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
institutionLabel = computed(() => {
|
||||
const selectedInstitutions = this.selectedInstitutions();
|
||||
if (selectedInstitutions.length === 0) {
|
||||
return 'Institution';
|
||||
} else if (selectedInstitutions.length === 1) {
|
||||
return selectedInstitutions[0].display_name ?? 'Institution';
|
||||
} else {
|
||||
return `${selectedInstitutions.length} Institutionen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleInstitutionSelectChange = (selectedInstitution: Institution): void => {
|
||||
if (this.selectedInstitutions().includes(selectedInstitution)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: this.selectedInstitutions()
|
||||
.filter((inst) => inst !== selectedInstitution)
|
||||
.map((inst) => inst.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: [
|
||||
...this.selectedInstitutions().map((inst) => inst.id),
|
||||
selectedInstitution.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
topicLabel = computed(() => {
|
||||
const selectedTopicIds = this.selectedTopics().map((t) => t.id);
|
||||
if (selectedTopicIds.length === 0) {
|
||||
return 'Thema';
|
||||
} else if (selectedTopicIds.length === 1) {
|
||||
const topic = this.selectedTopics()[0];
|
||||
return topic.display_name || 'Thema';
|
||||
} else {
|
||||
return `${selectedTopicIds.length} Themen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleTopicSelectChange = (selectedTopic: Topic): void => {
|
||||
if (this.selectedTopics().some((t) => t.id === selectedTopic.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.topicId]: this.selectedTopics()
|
||||
.filter((t) => t.id !== selectedTopic.id)
|
||||
.map((t) => t.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.topicId]: [
|
||||
...this.selectedTopics().map((t) => t.id!),
|
||||
selectedTopic.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
resetFilters = (): void => {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.title]: null,
|
||||
[workQueryParamKeys.years]: null,
|
||||
[workQueryParamKeys.types]: null,
|
||||
[workQueryParamKeys.language]: null,
|
||||
[workQueryParamKeys.authorId]: null,
|
||||
[workQueryParamKeys.institutionId]: null,
|
||||
[workQueryParamKeys.topicId]: null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
<app-data-table
|
||||
[columns]="columns"
|
||||
[data]="elements()"
|
||||
queryParamSortKey="sort_by"
|
||||
queryParamSortDirectionKey="sort_direction" />
|
||||
|
||||
<ng-template #titleTmp let-work>
|
||||
<span>{{ work.title }}</span>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #typeTmp let-work>
|
||||
@if (work.type) {
|
||||
<button
|
||||
type="button"
|
||||
class="type-filter-btn"
|
||||
[class.active]="isTypeActive(work.type)"
|
||||
matTooltip="Nach Typ filtern"
|
||||
matTooltipPosition="above"
|
||||
(click)="toggleTypeFilter(work.type)">
|
||||
<app-chip [color]="typeColor(work.type)">
|
||||
{{ work.type | workType }}
|
||||
</app-chip>
|
||||
</button>
|
||||
} @else {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #yearTmp let-work>
|
||||
@if (work.publication_year) {
|
||||
<button
|
||||
type="button"
|
||||
class="cell-filter-pill"
|
||||
[class.active]="isYearActive(work.publication_year)"
|
||||
matTooltip="Nach Jahr filtern"
|
||||
matTooltipPosition="above"
|
||||
(click)="toggleYearFilter(work.publication_year)">
|
||||
{{ work.publication_year }}
|
||||
</button>
|
||||
} @else {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #languageTmp let-work>
|
||||
@if (work.language) {
|
||||
<button
|
||||
type="button"
|
||||
class="cell-filter-pill"
|
||||
[class.active]="isLanguageActive(work.language)"
|
||||
matTooltip="Nach Sprache filtern"
|
||||
matTooltipPosition="above"
|
||||
(click)="toggleLanguageFilter(work.language)">
|
||||
{{ work.language | languageCode }}
|
||||
</button>
|
||||
} @else {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #classificationTmp let-work>
|
||||
@let classification = getWorkClassification(work.id);
|
||||
@if (classification) {
|
||||
<button type="button" class="cell-filter-pill" matTooltipPosition="above">
|
||||
{{
|
||||
classification.classification?.primary_category | workPrimaryCategory
|
||||
}}
|
||||
</button>
|
||||
} @else {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #authorsTmp let-work>
|
||||
@let workAuthors = getWorkAuthors(work);
|
||||
@let workAuthorsExpanded = isWorkAuthorsExpanded(work);
|
||||
@let visibleAuthors =
|
||||
workAuthorsExpanded ? workAuthors : workAuthors.slice(0, 3);
|
||||
<div class="author-tags" aria-label="Autoren" style="padding: 0.5rem 0">
|
||||
@for (
|
||||
author of visibleAuthors;
|
||||
track author.id ?? 'name-' + author.display_name
|
||||
) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
[class.active]="isAuthorActive(author.id!)"
|
||||
[matTooltip]="getAuthorTooltipText(author)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getAuthorTooltipText(author)"
|
||||
(click)="filterByAuthor(author.id!)">
|
||||
<mat-icon class="institution-icon">person</mat-icon>
|
||||
<span class="institution-name">{{ author.display_name }}</span>
|
||||
</button>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (workAuthors.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
[attr.aria-expanded]="workAuthorsExpanded"
|
||||
(click)="toggleWorkAuthorsExpansion(work)">
|
||||
{{ workAuthorsExpanded ? 'weniger' : '+' + (workAuthors.length - 3) }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #institutionsTmp let-work>
|
||||
@let publicationInstitutions = getWorkInstitutions(work);
|
||||
@let institutionsExpanded = isWorkInstitutionsExpanded(work);
|
||||
@let visibleInstitutions =
|
||||
institutionsExpanded
|
||||
? publicationInstitutions
|
||||
: publicationInstitutions.slice(0, 3);
|
||||
<div
|
||||
class="institution-tags"
|
||||
aria-label="Institutionen"
|
||||
style="padding: 0.5rem 0">
|
||||
@for (institution of visibleInstitutions; track institution.id) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
[class.active]="isInstitutionActive(institution.id!)"
|
||||
[matTooltip]="getInstitutionTooltipText(institution)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getInstitutionTooltipText(institution)"
|
||||
(click)="filterByInstitution(institution)">
|
||||
<mat-icon class="institution-icon">apartment</mat-icon>
|
||||
<span class="institution-name">{{ institution.display_name }}</span>
|
||||
@if (institution.country_code) {
|
||||
<img
|
||||
alt=""
|
||||
class="flag-img"
|
||||
[src]="
|
||||
'https://flagcdn.io/' +
|
||||
institution.country_code.toLowerCase() +
|
||||
'.svg'
|
||||
"
|
||||
height="10" />
|
||||
<span class="country-code">{{
|
||||
institution.country_code.toUpperCase()
|
||||
}}</span>
|
||||
}
|
||||
</button>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (publicationInstitutions.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
[attr.aria-expanded]="institutionsExpanded"
|
||||
(click)="toggleWorkInstitutionsExpansion(work)">
|
||||
{{
|
||||
institutionsExpanded
|
||||
? 'weniger'
|
||||
: '+' + (publicationInstitutions.length - 3)
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #topicsTmp let-work>
|
||||
@let workTopics = work.topics ?? [];
|
||||
<div class="topic-chips" aria-label="Themen" style="padding: 0.5rem 0">
|
||||
@for (topic of workTopics; track topic.id) {
|
||||
<app-topic-chip
|
||||
size="mini"
|
||||
[label]="topic.display_name || ''"
|
||||
[description]="topic.description"
|
||||
[subfieldName]="topic.subfield?.display_name"
|
||||
[fieldName]="topic.field?.display_name"
|
||||
[domainName]="topic.domain?.display_name"
|
||||
[color]="getWorkTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActive(topic)"
|
||||
(chipClick)="filterByTopic(topic)">
|
||||
</app-topic-chip>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #citationsTmp let-work>
|
||||
{{ work.cited_by_count ?? 0 }}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #actionsTmp let-work>
|
||||
<a
|
||||
mat-icon-button
|
||||
color="primary"
|
||||
[routerLink]="['/publication', extractRawId(work.id)]"
|
||||
matTooltip="Details anzeigen">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
</ng-template>
|
||||
@@ -0,0 +1,594 @@
|
||||
.page {
|
||||
padding: 28px 32px 42px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.publication-filter-stack {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 25px;
|
||||
}
|
||||
|
||||
.publication-filters {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.publication-filters mat-form-field {
|
||||
width: 175px;
|
||||
}
|
||||
|
||||
.publication-filters .institution-filter,
|
||||
.publication-filters .topic-filter {
|
||||
flex: 1 1 200px;
|
||||
width: auto;
|
||||
min-width: 180px;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.publication-filters .sort-field {
|
||||
width: 235px;
|
||||
}
|
||||
|
||||
.publication-filters .reset-filter-btn {
|
||||
min-width: 132px;
|
||||
height: 42px;
|
||||
padding: 0 14px;
|
||||
border-color: #d9e2f0;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.publication-filters .reset-filter-btn mat-icon {
|
||||
margin-right: 6px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-subscript-wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-text-field-wrapper {
|
||||
height: 42px;
|
||||
background: var(--sg-surface-soft);
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
transition:
|
||||
border-color 0.15s,
|
||||
box-shadow 0.15s;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-focused .mat-mdc-text-field-wrapper {
|
||||
border-color: var(--sg-primary);
|
||||
box-shadow: 0 0 0 2px var(--sg-primary-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-flex {
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-infix {
|
||||
min-height: 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mdc-notched-outline__leading,
|
||||
::ng-deep .publication-filters .mdc-notched-outline__notch,
|
||||
::ng-deep .publication-filters .mdc-notched-outline__trailing {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.filter-prefix-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 18px;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-icon-prefix {
|
||||
padding: 0 4px 0 10px;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-select-value,
|
||||
::ng-deep .publication-filters input.mat-mdc-input-element {
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-select-placeholder,
|
||||
::ng-deep .publication-filters input.mat-mdc-input-element::placeholder {
|
||||
color: var(--sg-text-muted);
|
||||
opacity: 1;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-icon-suffix,
|
||||
::ng-deep .publication-filters .mat-mdc-select-arrow-wrapper {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.active-filters-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding: 8px 16px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.active-filters-label {
|
||||
font-weight: 600;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.chips-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.filter-meta-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--sg-border-strong);
|
||||
border-radius: 4px;
|
||||
background: var(--sg-surface-soft);
|
||||
color: var(--sg-text);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.filter-topic-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: min(320px, 46vw);
|
||||
padding: 3px 8px;
|
||||
border-radius: 7px;
|
||||
background: color-mix(in srgb, var(--topic-color) 22%, #ffffff);
|
||||
color: color-mix(in srgb, var(--topic-color) 45%, #07163d);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
box-shadow: inset 0 0 0 1px
|
||||
color-mix(in srgb, var(--topic-color) 45%, transparent);
|
||||
}
|
||||
|
||||
.filter-topic-chip__icon {
|
||||
flex: 0 0 auto;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.active-institution-filter,
|
||||
.active-meta-filter {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.filter-institution-chip,
|
||||
.publication-institution-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 6px;
|
||||
border: 1px solid var(--sg-primary-border, var(--sg-border));
|
||||
border-radius: 4px;
|
||||
background: var(--sg-primary-soft);
|
||||
color: var(--sg-primary);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.filter-institution-chip {
|
||||
max-width: 340px;
|
||||
}
|
||||
|
||||
.publication-institution-tag {
|
||||
max-width: 100%;
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: #fff;
|
||||
border-color: var(--sg-primary);
|
||||
outline: none;
|
||||
box-shadow:
|
||||
0 0 0 2px var(--sg-background),
|
||||
0 0 0 4px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--sg-primary);
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active:hover,
|
||||
&.active:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-icon,
|
||||
.publication-institution-tag .institution-icon,
|
||||
.filter-meta-chip__icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.filter-meta-chip__icon {
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-name,
|
||||
.publication-institution-tag .institution-name {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.filter-institution-chip .flag-img,
|
||||
.publication-institution-tag .flag-img {
|
||||
flex-shrink: 0;
|
||||
margin-left: 6px;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.filter-institution-chip .country-code,
|
||||
.publication-institution-tag .country-code {
|
||||
flex-shrink: 0;
|
||||
margin-left: 2px;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon,
|
||||
.publication-institution-tag .institution-open-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.filter-institution-chip:hover .institution-open-icon,
|
||||
.publication-institution-tag:hover .institution-open-icon {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon:hover,
|
||||
.publication-institution-tag .institution-open-icon:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.filter-meta-chip__label,
|
||||
.filter-topic-chip__label {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.active-institution-filter button,
|
||||
.active-meta-filter button {
|
||||
display: flex;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--sg-text-soft);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: var(--sg-text);
|
||||
}
|
||||
}
|
||||
|
||||
.active-institution-filter button mat-icon,
|
||||
.active-meta-filter button mat-icon {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
position: relative;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
min-width: 1120px;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0 10px;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: inline-block;
|
||||
max-width: 520px;
|
||||
line-height: 1.35;
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.title:hover {
|
||||
color: var(--sg-text);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.is-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.table-status {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
min-height: 240px;
|
||||
padding: 32px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
}
|
||||
|
||||
.cell-filter-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 3px 10px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
color: var(--sg-text);
|
||||
font-family: inherit;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: var(--sg-primary);
|
||||
background: var(--sg-surface-soft);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--sg-primary);
|
||||
color: var(--sg-primary);
|
||||
font-weight: 600;
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.type-filter-btn {
|
||||
display: inline-flex;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 7px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 1px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.topic-chips,
|
||||
.institution-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.topic-chips {
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.institution-tags {
|
||||
align-items: flex-start;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
.publication-institution-more,
|
||||
.publication-topic-more {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 24px;
|
||||
padding: 3px 8px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: #fff;
|
||||
color: var(--sg-text-muted);
|
||||
font-family: inherit;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: var(--sg-primary);
|
||||
color: var(--sg-primary);
|
||||
background: var(--sg-surface-soft);
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-topic-more {
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-wrap ::ng-deep {
|
||||
.mat-column-type,
|
||||
.mat-column-year,
|
||||
.mat-column-language,
|
||||
.mat-column-citations,
|
||||
.mat-mdc-header-cell {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mat-mdc-cell:not(:last-child),
|
||||
.mat-mdc-header-cell:not(:last-child) {
|
||||
border-right: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
.mat-column-institutions,
|
||||
.mat-column-topics {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
||||
mat-paginator {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.table-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 66px;
|
||||
padding: 0 22px 0 28px;
|
||||
border: 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.table-footer {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.publication-filter-stack {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.publication-filters {
|
||||
justify-content: stretch;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.publication-filters mat-form-field,
|
||||
.publication-filters button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.publication-filters .institution-filter,
|
||||
.publication-filters .topic-filter {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.active-filters-row {
|
||||
align-self: stretch;
|
||||
}
|
||||
}
|
||||
|
||||
mat-expansion-panel {
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-none);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
mat-expansion-panel-header {
|
||||
padding: 0 16px;
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
mat-panel-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
mat-panel-description {
|
||||
font-size: 14px;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
// ------------------------
|
||||
|
||||
.author-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
align-items: flex-start;
|
||||
max-width: 280px;
|
||||
}
|
||||
@@ -0,0 +1,474 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
OnInit,
|
||||
signal,
|
||||
TemplateRef,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
DataTableComponent,
|
||||
GenericColumn,
|
||||
} from '../data-table/data-table.component';
|
||||
import {
|
||||
DehydratedAuthor,
|
||||
WorkPageV2,
|
||||
Institution,
|
||||
Work,
|
||||
WorkClassification,
|
||||
WorksV2Service,
|
||||
WorkTopic,
|
||||
} from '../../../api';
|
||||
import { TopicChipComponent } from '../topic-chip/topic-chip.component';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
import { ChipComponent } from '../chip/chip.component';
|
||||
import { WorkTypePipe } from '../../pipes/work-type.pipe';
|
||||
import { LanguageCodePipe } from '../../pipes/language-code.pipe';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { workQueryParamKeys } from '../../../resolvers/work-page.resolver';
|
||||
import { WorkPrimaryCategoryPipe } from '../../pipes/work-primary-category.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publication-table',
|
||||
imports: [
|
||||
MatIconModule,
|
||||
MatTooltipModule,
|
||||
MatButtonModule,
|
||||
RouterModule,
|
||||
DataTableComponent,
|
||||
TopicChipComponent,
|
||||
ChipComponent,
|
||||
WorkTypePipe,
|
||||
LanguageCodePipe,
|
||||
WorkPrimaryCategoryPipe,
|
||||
],
|
||||
templateUrl: './publication-table.component.html',
|
||||
styleUrl: './publication-table.component.scss',
|
||||
})
|
||||
export class PublicationTableComponent implements OnInit {
|
||||
page = input.required<WorkPageV2>();
|
||||
authorFilterEnabled = input<boolean>(false);
|
||||
institutionFilterEnabled = input<boolean>(false);
|
||||
topicFilterEnabled = input<boolean>(false);
|
||||
|
||||
elements = computed(() => this.page().elements ?? []);
|
||||
|
||||
columns: GenericColumn<Work>[] = [];
|
||||
titleTmp = viewChild.required<TemplateRef<any>>('titleTmp');
|
||||
typeTmp = viewChild.required<TemplateRef<any>>('typeTmp');
|
||||
yearTmp = viewChild.required<TemplateRef<any>>('yearTmp');
|
||||
languageTmp = viewChild.required<TemplateRef<any>>('languageTmp');
|
||||
classificationTmp = viewChild.required<TemplateRef<any>>('classificationTmp');
|
||||
authorsTmp = viewChild.required<TemplateRef<any>>('authorsTmp');
|
||||
institutionsTmp = viewChild.required<TemplateRef<any>>('institutionsTmp');
|
||||
topicsTmp = viewChild.required<TemplateRef<any>>('topicsTmp');
|
||||
citationsTmp = viewChild.required<TemplateRef<any>>('citationsTmp');
|
||||
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
|
||||
|
||||
private readonly activatedRoute = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
|
||||
initialValue: this.activatedRoute.snapshot.queryParamMap,
|
||||
});
|
||||
|
||||
selectedYearsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.years).map(Number);
|
||||
});
|
||||
|
||||
selectedTypesQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.types);
|
||||
});
|
||||
|
||||
selectedLanguagesQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.language);
|
||||
});
|
||||
|
||||
selectedAuthorIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.authorId);
|
||||
});
|
||||
|
||||
selectedInstitutionIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.institutionId);
|
||||
});
|
||||
|
||||
selectedTopicIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.topicId);
|
||||
});
|
||||
|
||||
ngOnInit(): void {
|
||||
this.columns = [
|
||||
{
|
||||
id: 'title',
|
||||
header: 'Titel',
|
||||
type: 'accessor',
|
||||
accessorKey: 'title',
|
||||
cellTemplate: this.titleTmp(),
|
||||
},
|
||||
{
|
||||
id: 'type',
|
||||
header: 'Typ',
|
||||
type: 'accessor',
|
||||
accessorKey: 'type',
|
||||
cellTemplate: this.typeTmp(),
|
||||
},
|
||||
{
|
||||
id: 'publication_year',
|
||||
header: 'Jahr',
|
||||
type: 'accessor',
|
||||
accessorKey: 'publication_year',
|
||||
cellTemplate: this.yearTmp(),
|
||||
},
|
||||
{
|
||||
id: 'language',
|
||||
header: 'Sprache',
|
||||
type: 'accessor',
|
||||
accessorKey: 'language',
|
||||
cellTemplate: this.languageTmp(),
|
||||
},
|
||||
{
|
||||
id: 'classification',
|
||||
header: 'Klassifikation',
|
||||
type: 'display',
|
||||
cellTemplate: this.classificationTmp(),
|
||||
},
|
||||
{
|
||||
id: 'authors',
|
||||
header: 'Autoren',
|
||||
type: 'display',
|
||||
cellTemplate: this.authorsTmp(),
|
||||
},
|
||||
|
||||
{
|
||||
id: 'institutions',
|
||||
header: 'Institutionen',
|
||||
type: 'display',
|
||||
cellTemplate: this.institutionsTmp(),
|
||||
},
|
||||
|
||||
{
|
||||
id: 'topics',
|
||||
header: 'Themen',
|
||||
type: 'display',
|
||||
cellTemplate: this.topicsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'cited_by_count',
|
||||
header: 'Zitiert von',
|
||||
type: 'accessor',
|
||||
accessorKey: 'cited_by_count',
|
||||
cellTemplate: this.citationsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: 'Aktionen',
|
||||
type: 'display',
|
||||
cellTemplate: this.actionsTmp(),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
workIds = computed(
|
||||
() =>
|
||||
this.elements()
|
||||
.map((work) => work.id)
|
||||
.filter(Boolean) as string[],
|
||||
);
|
||||
|
||||
workClassifications = signal<WorkClassification[]>([]);
|
||||
|
||||
getWorkClassification(workId: string): WorkClassification | undefined {
|
||||
return this.workClassifications().find(
|
||||
(classification) => classification.work_id === workId,
|
||||
);
|
||||
}
|
||||
|
||||
constructor(private readonly worksV2Service: WorksV2Service) {
|
||||
effect(() => {
|
||||
const ids = this.workIds();
|
||||
if (ids.length > 0) {
|
||||
this.worksV2Service
|
||||
.getWorkClassificationsByWorkIds(ids)
|
||||
.subscribe((classificationPage) => {
|
||||
this.workClassifications.set(classificationPage.elements ?? []);
|
||||
});
|
||||
} else {
|
||||
this.workClassifications.set([]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isTypeActive(type: string): boolean {
|
||||
return this.selectedTypesQueryParams().includes(type);
|
||||
}
|
||||
|
||||
isAuthorActive(authorId: string): boolean {
|
||||
return (
|
||||
!!authorId &&
|
||||
this.authorFilterEnabled() &&
|
||||
this.selectedAuthorIdsQueryParams().includes(authorId)
|
||||
);
|
||||
}
|
||||
|
||||
toggleTypeFilter(type: string): void {
|
||||
const selectedTopics = this.selectedTypesQueryParams();
|
||||
if (selectedTopics.includes(type)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: selectedTopics.filter((t) => t !== type),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: [...selectedTopics, type],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
typeColor(type: string | null | undefined): string {
|
||||
const normalized = (type ?? '').toLowerCase();
|
||||
if (normalized.includes('conference')) return 'success';
|
||||
if (normalized.includes('book')) return 'help';
|
||||
return 'info';
|
||||
}
|
||||
|
||||
isYearActive(year: number): boolean {
|
||||
return this.selectedYearsQueryParams().includes(year);
|
||||
}
|
||||
|
||||
toggleYearFilter(year: number): void {
|
||||
const selectedYears = this.selectedYearsQueryParams();
|
||||
if (selectedYears.includes(year)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: selectedYears.filter((y) => y !== year),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: [...selectedYears, year],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isLanguageActive(language: string): boolean {
|
||||
return this.selectedLanguagesQueryParams().includes(language);
|
||||
}
|
||||
|
||||
toggleLanguageFilter(language: string): void {
|
||||
const selectedLanguages = this.selectedLanguagesQueryParams();
|
||||
if (selectedLanguages.includes(language)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: selectedLanguages.filter(
|
||||
(l) => l !== language,
|
||||
),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: [...selectedLanguages, language],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
expandedWorkInstitutionsId: string[] = [];
|
||||
expandedWorkAuthorsId: string[] = [];
|
||||
|
||||
isWorkInstitutionsExpanded(work: Work): boolean {
|
||||
if (!work.id) return false;
|
||||
|
||||
return this.expandedWorkInstitutionsId.includes(work.id);
|
||||
}
|
||||
|
||||
toggleWorkInstitutionsExpansion(work: Work): void {
|
||||
if (!work.id) return;
|
||||
|
||||
if (this.expandedWorkInstitutionsId.includes(work.id)) {
|
||||
this.expandedWorkInstitutionsId = this.expandedWorkInstitutionsId.filter(
|
||||
(id) => id !== work.id,
|
||||
);
|
||||
} else {
|
||||
this.expandedWorkInstitutionsId.push(work.id);
|
||||
}
|
||||
}
|
||||
|
||||
isWorkAuthorsExpanded(work: Work): boolean {
|
||||
if (!work.id) return false;
|
||||
|
||||
return this.expandedWorkAuthorsId.includes(work.id);
|
||||
}
|
||||
|
||||
toggleWorkAuthorsExpansion(work: Work): void {
|
||||
if (!work.id) return;
|
||||
|
||||
if (this.expandedWorkAuthorsId.includes(work.id)) {
|
||||
this.expandedWorkAuthorsId = this.expandedWorkAuthorsId.filter(
|
||||
(id) => id !== work.id,
|
||||
);
|
||||
} else {
|
||||
this.expandedWorkAuthorsId.push(work.id);
|
||||
}
|
||||
}
|
||||
|
||||
isInstitutionActive(id: string): boolean {
|
||||
return !!id && this.selectedInstitutionIdsQueryParams().includes(id);
|
||||
}
|
||||
|
||||
filterByInstitution(institution: Institution): void {
|
||||
if (!institution.id || !this.institutionFilterEnabled()) return;
|
||||
const selectedInstitutionIds = this.selectedInstitutionIdsQueryParams();
|
||||
if (selectedInstitutionIds.includes(institution.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: selectedInstitutionIds.filter(
|
||||
(id) => id !== institution.id,
|
||||
),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: [
|
||||
...selectedInstitutionIds,
|
||||
institution.id,
|
||||
],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
filterByAuthor(authorId: string): void {
|
||||
if (!authorId || !this.authorFilterEnabled()) return;
|
||||
const selectedAuthorIds = this.selectedAuthorIdsQueryParams();
|
||||
if (selectedAuthorIds.includes(authorId)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.authorId]: selectedAuthorIds.filter(
|
||||
(id) => id !== authorId,
|
||||
),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.authorId]: [...selectedAuthorIds, authorId],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getWorkTopicColor(topic: WorkTopic): string {
|
||||
return topicHierarchyColor({
|
||||
id: topic.id,
|
||||
name: topic.display_name,
|
||||
field_id: topic.field?.id,
|
||||
field_name: topic.field?.display_name,
|
||||
domain_id: topic.domain?.id,
|
||||
domain_name: topic.domain?.display_name,
|
||||
});
|
||||
}
|
||||
|
||||
isTopicActive(topic: WorkTopic): boolean {
|
||||
return !!topic.id && this.selectedTopicIdsQueryParams().includes(topic.id);
|
||||
}
|
||||
|
||||
filterByTopic(topic: WorkTopic): void {
|
||||
if (!topic.id || !this.topicFilterEnabled()) return;
|
||||
const selectedTopicIds = this.selectedTopicIdsQueryParams();
|
||||
if (selectedTopicIds.includes(topic.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.topicId]: selectedTopicIds.filter(
|
||||
(id) => id !== topic.id,
|
||||
),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.topicId]: [...selectedTopicIds, topic.id],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extractRawId(id: string | null | undefined): string | null {
|
||||
if (!id) return null;
|
||||
|
||||
return id.split('/').filter(Boolean).pop() ?? null;
|
||||
}
|
||||
|
||||
getWorkInstitutions(work: Work): Institution[] {
|
||||
const institutions = new Map<string, Institution>();
|
||||
|
||||
for (const authorship of work.authorships ?? []) {
|
||||
if (!authorship.institutions) continue;
|
||||
|
||||
for (const institution of authorship.institutions) {
|
||||
if (!institution.id) continue;
|
||||
institutions.set(institution.id, institution);
|
||||
}
|
||||
}
|
||||
return Array.from(institutions.values());
|
||||
}
|
||||
|
||||
getWorkAuthors(work: Work): DehydratedAuthor[] {
|
||||
return (
|
||||
work.authorships
|
||||
?.map((a) => a.author)
|
||||
.filter((a): a is DehydratedAuthor => !!a) || []
|
||||
);
|
||||
}
|
||||
|
||||
getAuthorTooltipText(author: DehydratedAuthor): string {
|
||||
if (this.authorFilterEnabled() && author.id) {
|
||||
return `Nach Autor filtern: ${author.display_name}`;
|
||||
}
|
||||
return `Autor: ${author.display_name}`;
|
||||
}
|
||||
|
||||
getInstitutionTooltipText(institution: Institution): string {
|
||||
if (this.institutionFilterEnabled()) {
|
||||
return `Nach Institution filtern: ${institution.display_name}`;
|
||||
}
|
||||
return `Institution: ${institution.display_name}`;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-form-field style="width: 100%" subscriptSizing="dynamic">
|
||||
<mat-label>{{ this.label() }}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Autoren suchen..."
|
||||
icon="person"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Autoren"
|
||||
fetchedLabel="Gefundene Autoren"
|
||||
[fetchElements]="fetchAuthors"
|
||||
[selectedElements]="selectedAuthors()"
|
||||
[getSelectLabel]="getAuthorLabel"
|
||||
[getSelectValue]="getAuthorValue"
|
||||
[getSelectDescription]="getAuthorDescription"
|
||||
(handleSelectChange)="handleAuthorSelectChange.emit($event)" />
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
import { Component, inject, input, output } from '@angular/core';
|
||||
import { Author, AuthorPage, AuthorsV2Service } from '../../../api';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-author-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-author-select.component.html',
|
||||
styleUrl: './searchable-author-select.component.scss',
|
||||
})
|
||||
export class SearchableAuthorSelectComponent {
|
||||
private readonly authorsV2Service = inject(AuthorsV2Service);
|
||||
|
||||
label = input<string>('Authoren');
|
||||
selectedAuthors = input.required<Author[]>();
|
||||
|
||||
handleAuthorSelectChange = output<Author>();
|
||||
|
||||
fetchAuthors = (searchTerm: string): Observable<AuthorPage> => {
|
||||
return this.authorsV2Service.autocompleteAuthorsForSelector(searchTerm);
|
||||
};
|
||||
|
||||
getAuthorLabel = (author: Author): string => {
|
||||
return author.display_name!;
|
||||
};
|
||||
|
||||
getAuthorValue = (author: Author): string => {
|
||||
return author.id!;
|
||||
};
|
||||
|
||||
getAuthorDescription = (author: Author): string => {
|
||||
const worksCount = author.works_count ?? 0;
|
||||
const worksCountText = worksCount === 1 ? 'Werk' : 'Werke';
|
||||
const lastKnownInstitution = author.last_known_institutions?.[0];
|
||||
const lastKnownInstitutionDisplayName =
|
||||
lastKnownInstitution?.display_name ?? 'Unbekannt';
|
||||
const lastKnownInstitutionCountryCode =
|
||||
lastKnownInstitution?.country_code ?? '??';
|
||||
return `${worksCount} ${worksCountText} - ${lastKnownInstitutionDisplayName} (${lastKnownInstitutionCountryCode})`;
|
||||
};
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Autoren suchen..."
|
||||
icon="person"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Autoren"
|
||||
fetchedLabel="Gefundene Autoren"
|
||||
[fetchElements]="fetchAuthors"
|
||||
[selectedElements]="selectedAuthors()"
|
||||
[getSelectLabel]="getAuthorLabel"
|
||||
[getSelectValue]="getAuthorValue"
|
||||
[getSelectDescription]="getAuthorDescription"
|
||||
(handleSelectChange)="handleAuthorSelectChange.emit($event)" />
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
import { Component, inject, input, output } from '@angular/core';
|
||||
import { DFGPersonsService } from '../../../api';
|
||||
import { DfgPersonSummaryPage } from '../../../api/model/dfgPersonSummaryPage';
|
||||
import { DfgPersonSummary } from '../../../api/model/dfgPersonSummary';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-dfg-author-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-dfg-author-select.component.html',
|
||||
styleUrl: './searchable-dfg-author-select.component.scss',
|
||||
})
|
||||
export class SearchableDfgAuthorSelectComponent {
|
||||
private readonly dfgPersonsService = inject(DFGPersonsService);
|
||||
|
||||
label = input<string>('Authoren');
|
||||
selectedAuthors = input.required<DfgPersonSummary[]>();
|
||||
|
||||
handleAuthorSelectChange = output<DfgPersonSummary>();
|
||||
|
||||
fetchAuthors = (searchTerm: string): Observable<DfgPersonSummaryPage> => {
|
||||
return this.dfgPersonsService.getDfgPersonAutocompleteForSelector(
|
||||
searchTerm,
|
||||
);
|
||||
};
|
||||
|
||||
getAuthorLabel = (author: DfgPersonSummary): string => {
|
||||
return author.full_name!;
|
||||
};
|
||||
|
||||
getAuthorValue = (author: DfgPersonSummary): string => {
|
||||
return String(author.person_id!);
|
||||
};
|
||||
|
||||
getAuthorDescription = (author: DfgPersonSummary): string => {
|
||||
const rootInstitution = author.institution?.root_name_de ?? 'Unbekannt';
|
||||
const institution = author.institution?.institute_name_de ?? 'Unbekannt';
|
||||
return `${rootInstitution} - ${institution}`;
|
||||
};
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Institution suchen..."
|
||||
icon="apartment"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Institutionen"
|
||||
fetchedLabel="Gefundene Institutionen"
|
||||
[fetchElements]="fetchInstitutions"
|
||||
[selectedElements]="selectedInstitutions()"
|
||||
[getSelectLabel]="getInstitutionLabel"
|
||||
[getSelectValue]="getInstitutionValue"
|
||||
[getSelectDescription]="getInstitutionDescription"
|
||||
(handleSelectChange)="handleInstitutionSelectChange.emit($event)" />
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import { Component, inject, input, output } from '@angular/core';
|
||||
import { DfgInstitutionSummaryPage } from '../../../api/model/dfgInstitutionSummaryPage';
|
||||
import { DfgInstitutionSummary } from '../../../api/model/dfgInstitutionSummary';
|
||||
import { DFGInstitutionsService } from '../../../api';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-dfg-institution-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-dfg-institution-select.component.html',
|
||||
styleUrl: './searchable-dfg-institution-select.component.scss',
|
||||
})
|
||||
export class SearchableDfgInstitutionSelectComponent {
|
||||
private readonly dfgInstitutionService = inject(DFGInstitutionsService);
|
||||
|
||||
label = input<string>('Institutionen');
|
||||
selectedInstitutions = input.required<DfgInstitutionSummary[]>();
|
||||
|
||||
handleInstitutionSelectChange = output<DfgInstitutionSummary>();
|
||||
|
||||
fetchInstitutions = (
|
||||
searchTerm: string,
|
||||
): Observable<DfgInstitutionSummaryPage> => {
|
||||
return this.dfgInstitutionService.getDfgInstitutionAutocompleteForSelector(
|
||||
searchTerm,
|
||||
);
|
||||
};
|
||||
|
||||
getInstitutionLabel = (institution: DfgInstitutionSummary): string => {
|
||||
return institution.institute_name_de! || institution.institute_name_en!;
|
||||
};
|
||||
|
||||
getInstitutionValue = (institution: DfgInstitutionSummary): string => {
|
||||
return Number(institution.id!).toString();
|
||||
};
|
||||
|
||||
getInstitutionDescription = (institution: DfgInstitutionSummary): string => {
|
||||
return (
|
||||
institution.root_name_de! + ' (' + institution.address_country_de! + ')'
|
||||
);
|
||||
};
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Institution suchen..."
|
||||
icon="apartment"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Institutionen"
|
||||
fetchedLabel="Gefundene Institutionen"
|
||||
[fetchElements]="fetchInstitutions"
|
||||
[selectedElements]="selectedInstitutions()"
|
||||
[getSelectLabel]="getInstitutionLabel"
|
||||
[getSelectValue]="getInstitutionValue"
|
||||
[getSelectDescription]="getInstitutionDescription"
|
||||
(handleSelectChange)="handleInstitutionSelectChange.emit($event)" />
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
import { Component, inject, input, output } from '@angular/core';
|
||||
import { Institution, InstitutionsV2Service, TopicPageV2 } from '../../../api';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-institution-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-institution-select.component.html',
|
||||
styleUrl: './searchable-institution-select.component.scss',
|
||||
})
|
||||
export class SearchableInstitutionSelectComponent {
|
||||
private readonly institutionsV2Service = inject(InstitutionsV2Service);
|
||||
|
||||
label = input<string>('Institutionen');
|
||||
selectedInstitutions = input.required<Institution[]>();
|
||||
|
||||
handleInstitutionSelectChange = output<Institution>();
|
||||
|
||||
fetchInstitutions = (searchTerm: string): Observable<TopicPageV2> => {
|
||||
return this.institutionsV2Service.getInstitutionAutocompleteForSelector(
|
||||
searchTerm,
|
||||
);
|
||||
};
|
||||
|
||||
getInstitutionLabel = (institution: Institution): string => {
|
||||
return institution.display_name!;
|
||||
};
|
||||
|
||||
getInstitutionValue = (institution: Institution): string => {
|
||||
return institution.id!;
|
||||
};
|
||||
|
||||
getInstitutionDescription = (institution: Institution): string => {
|
||||
return institution.country_code + ' - ' + institution.type;
|
||||
};
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Sprache suchen..."
|
||||
icon="translate"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Sprachen"
|
||||
fetchedLabel="Weitere Sprachen"
|
||||
[fetchElements]="fetchLanguages"
|
||||
[selectedElements]="selectedLanguages()"
|
||||
[getSelectLabel]="getLanguageLabel"
|
||||
[getSelectValue]="getLanguageValue"
|
||||
(handleSelectChange)="handleLanguageSelectChange.emit($event)" />
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface Language {
|
||||
code: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export const languages: Language[] = [
|
||||
{ code: 'en', name: 'Englisch' },
|
||||
{ code: 'de', name: 'Deutsch' },
|
||||
{ code: 'fr', name: 'Französisch' },
|
||||
{ code: 'es', name: 'Spanisch' },
|
||||
{ code: 'it', name: 'Italienisch' },
|
||||
{ code: 'pt', name: 'Portugiesisch' },
|
||||
{ code: 'ru', name: 'Russisch' },
|
||||
{ code: 'zh', name: 'Chinesisch' },
|
||||
{ code: 'ja', name: 'Japanisch' },
|
||||
{ code: 'ko', name: 'Koreanisch' },
|
||||
];
|
||||
|
||||
export const findLanguageById = (id: string): Language | undefined => {
|
||||
return languages.find((language) => language.code === id);
|
||||
};
|
||||
|
||||
type LanguagePage = {
|
||||
elements?: Language[];
|
||||
page?: number;
|
||||
size?: number;
|
||||
total?: number;
|
||||
};
|
||||
@Component({
|
||||
selector: 'app-searchable-language-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-language-select.component.html',
|
||||
styleUrl: './searchable-language-select.component.scss',
|
||||
})
|
||||
export class SearchableLanguageSelectComponent {
|
||||
label = input<string>('Typen');
|
||||
selectedLanguages = input.required<Language[]>();
|
||||
|
||||
handleLanguageSelectChange = output<Language>();
|
||||
|
||||
fetchLanguages = (searchTerm: string): Observable<LanguagePage> => {
|
||||
return new Observable<LanguagePage>((observer) => {
|
||||
observer.next({
|
||||
elements: languages.filter((language) =>
|
||||
language.name.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||
),
|
||||
});
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
|
||||
getLanguageLabel = (language: Language): string => {
|
||||
return language.name;
|
||||
};
|
||||
|
||||
getLanguageValue = (language: Language): string => {
|
||||
return language.code;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<mat-form-field style="width: 100%" subscriptSizing="dynamic">
|
||||
@if (icon()) {
|
||||
<mat-icon matPrefix [fontIcon]="icon()"></mat-icon>
|
||||
}
|
||||
<mat-select
|
||||
canSelectNullableOptions
|
||||
(selectionChange)="handleSelectChange.emit($event.value)"
|
||||
[placeholder]="label()">
|
||||
<mat-select-trigger>{{ label() }}</mat-select-trigger>
|
||||
<div
|
||||
class="search-panel-header"
|
||||
(click)="$event.stopPropagation()"
|
||||
(keydown)="$event.stopPropagation()">
|
||||
<mat-icon matPrefix>search</mat-icon>
|
||||
<input
|
||||
matInput
|
||||
[placeholder]="inputPlaceholder()"
|
||||
[(ngModel)]="searchValue"
|
||||
(ngModelChange)="_handleValueChange($event)"
|
||||
(click)="$event.stopPropagation()"
|
||||
(keydown)="$event.stopPropagation()" />
|
||||
|
||||
<button
|
||||
mat-icon-button
|
||||
aria-label="Clear"
|
||||
(click)="_clearSearchValue(); $event.stopPropagation()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (isLoading()) {
|
||||
<mat-option disabled>Laden…</mat-option>
|
||||
} @else {
|
||||
@if (selectedElements().length > 0) {
|
||||
<mat-optgroup [label]="selectedLabel()">
|
||||
@for (
|
||||
element of selectedElements();
|
||||
track getSelectValue()(element)
|
||||
) {
|
||||
<mat-option [value]="element" selected>
|
||||
<mat-icon>check</mat-icon>
|
||||
{{ getSelectLabel()(element) }}
|
||||
@if (getSelectDescription()) {
|
||||
<span class="option-description">{{
|
||||
getSelectDescription()!(element)
|
||||
}}</span>
|
||||
}
|
||||
</mat-option>
|
||||
} @empty {
|
||||
<mat-option disabled>Keine Ergebnisse</mat-option>
|
||||
}
|
||||
</mat-optgroup>
|
||||
}
|
||||
<mat-optgroup [label]="fetchedLabel()">
|
||||
@for (element of fetchedElements().elements; track getSelectValue()(element)) {
|
||||
<mat-option [value]="element">
|
||||
{{ getSelectLabel()(element) }}
|
||||
@if (getSelectDescription()) {
|
||||
<span class="option-description">{{
|
||||
getSelectDescription()!(element)
|
||||
}}</span>
|
||||
}
|
||||
</mat-option>
|
||||
} @empty {
|
||||
<mat-option disabled>Keine Ergebnisse</mat-option>
|
||||
}
|
||||
</mat-optgroup>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
@@ -0,0 +1,18 @@
|
||||
.search-panel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 12px;
|
||||
gap: 8px;
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.option-description {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
DestroyRef,
|
||||
inject,
|
||||
input,
|
||||
output,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {
|
||||
BehaviorSubject,
|
||||
catchError,
|
||||
debounceTime,
|
||||
distinctUntilChanged,
|
||||
Observable,
|
||||
of,
|
||||
switchMap,
|
||||
tap,
|
||||
} from 'rxjs';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
type Page<T> = {
|
||||
elements?: T[];
|
||||
page?: number;
|
||||
size?: number;
|
||||
total?: number;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-select',
|
||||
imports: [
|
||||
MatSelectModule,
|
||||
MatInputModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
FormsModule,
|
||||
],
|
||||
templateUrl: './searchable-select.component.html',
|
||||
styleUrl: './searchable-select.component.scss',
|
||||
})
|
||||
export class SearchableSelectComponent<T> {
|
||||
searchValue: string = '';
|
||||
handleSelectChange = output<T>();
|
||||
|
||||
_elements = computed<T[]>(() => {
|
||||
const predefined = this.selectedElements();
|
||||
const fetched = this.fetchedElements();
|
||||
return [...predefined, ...fetched.elements!];
|
||||
});
|
||||
isLoading = signal<boolean>(false);
|
||||
|
||||
icon = input<string>('');
|
||||
label = input.required<string>();
|
||||
selectedLabel = input<string>('Ausgewählt');
|
||||
fetchedLabel = input<string>('Verfügbar');
|
||||
fetchElements = input<(searchTerm: string) => Observable<Page<T>>>();
|
||||
fetchedElements = signal<Page<T>>({ elements: [] });
|
||||
selectedElements = input<T[]>([]);
|
||||
getSelectLabel = input.required<(element: T) => string>();
|
||||
getSelectValue = input.required<(element: T) => string>();
|
||||
getSelectDescription = input<(element: T) => string>();
|
||||
|
||||
inputPlaceholder = input<string>('Suche');
|
||||
|
||||
private readonly searchTerms = new BehaviorSubject<string>('');
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
constructor() {
|
||||
this.searchTerms
|
||||
.pipe(
|
||||
debounceTime(300),
|
||||
distinctUntilChanged(),
|
||||
tap(() => this.isLoading.set(true)),
|
||||
switchMap((term) => {
|
||||
const fetchFn = this.fetchElements();
|
||||
if (!fetchFn) {
|
||||
return of({ elements: [] } as Page<T>);
|
||||
}
|
||||
return fetchFn(term).pipe(catchError(() => of({ elements: [] } as Page<T>)));
|
||||
}),
|
||||
tap(() => this.isLoading.set(false)),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((results) => this.fetchedElements.set(results));
|
||||
}
|
||||
|
||||
_handleValueChange(newValue: string): void {
|
||||
this.searchValue = newValue;
|
||||
this.searchTerms.next(newValue);
|
||||
}
|
||||
|
||||
_clearSearchValue(): void {
|
||||
this.searchValue = '';
|
||||
this.fetchedElements.set({ elements: [] });
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Thema suchen..."
|
||||
icon="label"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Themen"
|
||||
fetchedLabel="Gefundene Themen"
|
||||
[fetchElements]="fetchTopics"
|
||||
[selectedElements]="selectedTopics()"
|
||||
[getSelectLabel]="getTopicLabel"
|
||||
[getSelectValue]="getTopicValue"
|
||||
[getSelectDescription]="getTopicDescription"
|
||||
(handleSelectChange)="handleTopicSelectChange.emit($event)" />
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Component, inject, input, output } from '@angular/core';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
import { Topic, TopicPageV2, TopicsV2Service } from '../../../api';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-topic-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-topic-select.component.html',
|
||||
styleUrl: './searchable-topic-select.component.scss',
|
||||
})
|
||||
export class SearchableTopicSelectComponent {
|
||||
private readonly topicsV2Service = inject(TopicsV2Service);
|
||||
|
||||
label = input<string>('Themen');
|
||||
selectedTopics = input.required<Topic[]>();
|
||||
|
||||
handleTopicSelectChange = output<Topic>();
|
||||
|
||||
fetchTopics = (searchTerm: string): Observable<TopicPageV2> => {
|
||||
return this.topicsV2Service.autocompleteTopicsForSelector(searchTerm);
|
||||
};
|
||||
|
||||
getTopicLabel = (topic: Topic): string => {
|
||||
return topic.display_name!;
|
||||
};
|
||||
|
||||
getTopicValue = (topic: Topic): string => {
|
||||
return topic.id!;
|
||||
};
|
||||
|
||||
getTopicDescription = (topic: Topic): string => {
|
||||
return (
|
||||
topic.subfield?.display_name +
|
||||
' - ' +
|
||||
topic.field?.display_name +
|
||||
' - ' +
|
||||
topic.domain?.display_name || ''
|
||||
);
|
||||
};
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Typ suchen..."
|
||||
icon="category"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Typen"
|
||||
fetchedLabel="Weitere Typen"
|
||||
[fetchElements]="fetchWorkTypes"
|
||||
[selectedElements]="selectedWorkTypes()"
|
||||
[getSelectLabel]="getWorkTypeLabel"
|
||||
[getSelectValue]="getWorkTypeValue"
|
||||
(handleSelectChange)="handleWorkTypeSelectChange.emit($event)" />
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface WorkType {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export const workTypes: WorkType[] = [
|
||||
{ id: 'article', name: 'Artikel' },
|
||||
{ id: 'book', name: 'Buch' },
|
||||
{ id: 'book-chapter', name: 'Buchkapitel' },
|
||||
{ id: 'dataset', name: 'Datensatz' },
|
||||
{ id: 'dissertation', name: 'Dissertation' },
|
||||
{ id: 'editorial', name: 'Editorial' },
|
||||
{ id: 'erratum', name: 'Erratum' },
|
||||
{ id: 'letter', name: 'Brief' },
|
||||
{ id: 'libguides', name: 'LibGuides' },
|
||||
{ id: 'other', name: 'Andere' },
|
||||
{ id: 'paratext', name: 'Paratext' },
|
||||
{ id: 'peer-review', name: 'Peer Review' },
|
||||
{ id: 'preprint', name: 'Preprint' },
|
||||
{ id: 'reference-entry', name: 'Referenzeintrag' },
|
||||
{ id: 'report', name: 'Bericht' },
|
||||
{ id: 'retraction', name: 'Retraktion' },
|
||||
{ id: 'review', name: 'Review' },
|
||||
{ id: 'standard', name: 'Standard' },
|
||||
{ id: 'supplementary-materials', name: 'Ergänzende Materialien' },
|
||||
];
|
||||
|
||||
export const findWorkTypeById = (id: string): WorkType | undefined => {
|
||||
return workTypes.find((workType) => workType.id === id);
|
||||
};
|
||||
|
||||
type WorkTypePage = {
|
||||
elements?: WorkType[];
|
||||
page?: number;
|
||||
size?: number;
|
||||
total?: number;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-work-type-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-work-type-select.component.html',
|
||||
styleUrl: './searchable-work-type-select.component.scss',
|
||||
})
|
||||
export class SearchableWorkTypeSelectComponent {
|
||||
label = input<string>('Typen');
|
||||
selectedWorkTypes = input.required<WorkType[]>();
|
||||
|
||||
handleWorkTypeSelectChange = output<WorkType>();
|
||||
|
||||
fetchWorkTypes = (searchTerm: string): Observable<WorkTypePage> => {
|
||||
return new Observable<WorkTypePage>((observer) => {
|
||||
observer.next({
|
||||
elements: workTypes.filter((workType) =>
|
||||
workType.name.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||
),
|
||||
});
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
|
||||
getWorkTypeLabel = (workType: WorkType): string => {
|
||||
return workType.name;
|
||||
};
|
||||
|
||||
getWorkTypeValue = (workType: WorkType): string => {
|
||||
return workType.id;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Jahr suchen..."
|
||||
icon="calendar_today"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Jahre"
|
||||
fetchedLabel="Weitere Jahre"
|
||||
[fetchElements]="fetchYears"
|
||||
[selectedElements]="selectedYears()"
|
||||
[getSelectLabel]="getYearLabel"
|
||||
[getSelectValue]="getYearValue"
|
||||
(handleSelectChange)="handleYearSelectChange.emit($event)" />
|
||||
@@ -0,0 +1,47 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
type YearPage = {
|
||||
elements?: number[];
|
||||
page?: number;
|
||||
size?: number;
|
||||
total?: number;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-year-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-year-select.component.html',
|
||||
styleUrl: './searchable-year-select.component.scss',
|
||||
})
|
||||
export class SearchableYearSelectComponent {
|
||||
label = input<string>('Jahr');
|
||||
selectedYears = input.required<number[]>();
|
||||
startYear = input<number>(1900);
|
||||
endYear = input<number>(new Date().getFullYear());
|
||||
|
||||
handleYearSelectChange = output<number>();
|
||||
|
||||
fetchYears = (searchTerm: string): Observable<YearPage> => {
|
||||
const years: number[] = [];
|
||||
for (let year = this.endYear(); year >= this.startYear(); year--) {
|
||||
years.push(year);
|
||||
}
|
||||
|
||||
return new Observable<YearPage>((observer) => {
|
||||
observer.next({
|
||||
elements: years.filter((year) => year.toString().includes(searchTerm)),
|
||||
});
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
|
||||
getYearLabel = (year: number): string => {
|
||||
return year.toString();
|
||||
};
|
||||
|
||||
getYearValue = (year: number): string => {
|
||||
return year.toString();
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
@if (hasActiveFilters()) {
|
||||
<div class="active-filters-row" aria-label="Aktive Filter">
|
||||
<span class="active-filters-label">Aktive Filter:</span>
|
||||
<div class="chips-container">
|
||||
@for (key of observedQueryParamValuesMap().keys(); track $index) {
|
||||
@let observer = observerMap().get(key)!;
|
||||
|
||||
@let tmp = observerMap().get(key)?.template;
|
||||
@for (value of observedQueryParamValuesMap().get(key); track $index) {
|
||||
<div class="active-meta-filter">
|
||||
@if (tmp) {
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
tmp;
|
||||
context: { $implicit: value }
|
||||
"></ng-container>
|
||||
} @else {
|
||||
<div class="filter-meta-chip">
|
||||
@if (observer.icon) {
|
||||
<mat-icon class="filter-meta-chip__icon">{{
|
||||
observer.icon
|
||||
}}</mat-icon>
|
||||
}
|
||||
<span class="filter-meta-chip__label">{{
|
||||
formatValue(observer, value)
|
||||
}}</span>
|
||||
</div>
|
||||
}
|
||||
<button
|
||||
type="button"
|
||||
class="remove-chip-btn"
|
||||
(click)="_handleRemove(observer, value)">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
.active-filters-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding: 8px 16px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.active-filters-row {
|
||||
align-self: stretch;
|
||||
}
|
||||
}
|
||||
|
||||
.active-filters-label {
|
||||
font-weight: 600;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.chips-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.active-meta-filter {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.active-meta-filter button {
|
||||
display: flex;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--sg-text-soft);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: var(--sg-text);
|
||||
}
|
||||
}
|
||||
|
||||
.filter-meta-chip__icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
.filter-meta-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--sg-border-strong);
|
||||
border-radius: 4px;
|
||||
background: var(--sg-surface-soft);
|
||||
color: var(--sg-text);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.filter-meta-chip__label {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
import { Component, computed, input, TemplateRef } from '@angular/core';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { NgTemplateOutlet } from '@angular/common';
|
||||
|
||||
export interface FilterObserver {
|
||||
id: string;
|
||||
queryParamKey: string;
|
||||
icon?: string;
|
||||
valueFormatter?: (value: string) => string | null | undefined;
|
||||
handleRemove?: (value: string) => void;
|
||||
template?: TemplateRef<any>;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-selected-filters',
|
||||
imports: [MatIconModule, MatButtonModule, NgTemplateOutlet],
|
||||
templateUrl: './selected-filters.component.html',
|
||||
styleUrl: './selected-filters.component.scss',
|
||||
})
|
||||
export class SelectedFiltersComponent {
|
||||
observers = input.required<FilterObserver[]>();
|
||||
|
||||
observedQueryParamKeys = computed(() =>
|
||||
this.observers().map((observer) => observer.queryParamKey),
|
||||
);
|
||||
|
||||
observerMap = computed(() => {
|
||||
const map = new Map<string, FilterObserver>();
|
||||
this.observers().forEach((observer) => {
|
||||
map.set(observer.queryParamKey, observer);
|
||||
});
|
||||
return map;
|
||||
});
|
||||
|
||||
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
|
||||
initialValue: this.activatedRoute.snapshot.queryParamMap,
|
||||
});
|
||||
|
||||
observedQueryParamValuesMap = computed(() => {
|
||||
const map = new Map<string, string[]>();
|
||||
this.observedQueryParamKeys().forEach((key) => {
|
||||
const values = this.queryParamMap().getAll(key);
|
||||
if (values.some((v) => v.trim() !== '')) {
|
||||
map.set(key, values);
|
||||
}
|
||||
});
|
||||
return map;
|
||||
});
|
||||
|
||||
hasActiveFilters = computed(
|
||||
() => this.observedQueryParamValuesMap().size > 0,
|
||||
);
|
||||
|
||||
constructor(
|
||||
private readonly activatedRoute: ActivatedRoute,
|
||||
private readonly router: Router,
|
||||
) {}
|
||||
|
||||
formatValue(
|
||||
observer: FilterObserver,
|
||||
value: string,
|
||||
): string | null | undefined {
|
||||
if (observer.valueFormatter) {
|
||||
return observer.valueFormatter(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
_handleRemove(observer: FilterObserver, value: string) {
|
||||
if (observer.handleRemove) {
|
||||
observer.handleRemove(value);
|
||||
} else {
|
||||
this.removeFilter(observer.queryParamKey, value);
|
||||
}
|
||||
}
|
||||
|
||||
removeFilter(queryParamKey: string, value: string) {
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.activatedRoute,
|
||||
queryParams: {
|
||||
[queryParamKey]: this.queryParamMap()
|
||||
.getAll(queryParamKey)
|
||||
.filter((v) => v !== value),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
of,
|
||||
switchMap,
|
||||
} from 'rxjs';
|
||||
import { Topic } from '../../../api';
|
||||
import { Topic } from '../../../api/model/topic';
|
||||
|
||||
@Component({
|
||||
selector: 'app-topic-autocomplete',
|
||||
|
||||
Reference in New Issue
Block a user