From d43c4068205219fbcfa71a97753a18183244a971 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Fri, 3 Jul 2026 14:53:30 +0200 Subject: [PATCH] publication overview: make Jahr/Typ/Sprache filters searchable --- .../person-publications.component.html | 133 +++++++++++++++-- .../person-publications.component.scss | 136 ++++++++++++++++-- .../person-publications.component.ts | 65 +++++++++ 3 files changed, 314 insertions(+), 20 deletions(-) diff --git a/webapp/src/app/modules/person-publications/person-publications.component.html b/webapp/src/app/modules/person-publications/person-publications.component.html index 39dcdeeb..ed59676a 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.html +++ b/webapp/src/app/modules/person-publications/person-publications.component.html @@ -6,44 +6,98 @@
+ calendar_today - @for (year of publicationYearOptions; track year) { + [panelWidth]="null" + (selectionChange)="applyFilters()" + (opened)="focusSelectSearch(yearSearchInput)" + (closed)="yearSearchControl.setValue('')"> + {{ yearSelectionSummary() }} + + @for (year of filteredYearOptions(); track year) { {{ year }} + } @empty { +
Keine Treffer
}
+ category - @for (type of typeOptions; track type.value) { + [panelWidth]="null" + (selectionChange)="applyFilters()" + (opened)="focusSelectSearch(typeSearchInput)" + (closed)="typeSearchControl.setValue('')"> + {{ typeSelectionSummary() }} + + @for (type of filteredTypeOptions(); track type.value) { {{ type.label }} + } @empty { +
Keine Treffer
}
+ translate - @for (language of languageOptions; track language.value) { + [panelWidth]="null" + (selectionChange)="applyFilters()" + (opened)="focusSelectSearch(languageSearchInput)" + (closed)="languageSearchControl.setValue('')"> + {{ + languageSelectionSummary() + }} + + @for (language of filteredLanguageOptions(); track language.value) { {{ language.label }} + } @empty { +
Keine Treffer
}
+ apartment + search + placeholder="Thema suchen" /> Kein Topic gefunden + Kein Thema gefunden } @@ -112,10 +167,70 @@ - @if (selectedInstitutions.length || selectedTopics.length) { + @let selectedYears = filterForm.controls.publicationYears.value; + @let selectedTypes = filterForm.controls.types.value; + @let selectedLanguages = filterForm.controls.languages.value; + @if ( + selectedInstitutions.length || + selectedTopics.length || + selectedYears.length || + selectedTypes.length || + selectedLanguages.length + ) {
Aktive Filter:
+ @for (year of selectedYears; track year) { + + + calendar_today + {{ year }} + + + + } + @for (type of selectedTypes; track type) { + + + category + {{ type }} + + + + } + @for (language of selectedLanguages; track language) { + + + translate + {{ + languageLabel(language) + }} + + + + } @for (topic of selectedTopics; track topic.id) { Thema: diff --git a/webapp/src/app/modules/person-publications/person-publications.component.scss b/webapp/src/app/modules/person-publications/person-publications.component.scss index 1f30a182..bf67b546 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.scss +++ b/webapp/src/app/modules/person-publications/person-publications.component.scss @@ -43,7 +43,7 @@ h2 { } .publication-filters mat-form-field { - width: 150px; + width: 175px; } .publication-filters .institution-filter, @@ -77,8 +77,17 @@ h2 { ::ng-deep .publication-filters .mat-mdc-text-field-wrapper { height: 42px; - background: #fff; + 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-infix { @@ -90,7 +99,19 @@ h2 { ::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-color: #d9e2f0; + 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, @@ -118,6 +139,44 @@ h2 { line-height: 1.2; } +::ng-deep .select-search { + position: sticky; + top: 0; + z-index: 1; + display: flex; + align-items: center; + gap: 6px; + min-width: 200px; + padding: 8px 12px; + background: var(--sg-surface, #fff); + border-bottom: 1px solid var(--sg-border); +} + +::ng-deep .select-search__icon { + flex-shrink: 0; + width: 16px; + height: 16px; + font-size: 16px; + color: var(--sg-text-soft); +} + +::ng-deep .select-search__input { + flex: 1; + min-width: 0; + border: none; + outline: none; + background: transparent; + color: var(--sg-text); + font-family: inherit; + font-size: 13px; +} + +::ng-deep .select-search__empty { + padding: 10px 14px; + color: var(--sg-text-muted); + font-size: 13px; +} + .active-filters-row { display: flex; align-items: center; @@ -185,7 +244,7 @@ h2 { .filter-institution-chip { display: inline-flex; align-items: center; - max-width: 220px; + max-width: 340px; padding: 2px 6px; border: 1px solid var(--sg-primary-border, var(--sg-border)); border-radius: 4px; @@ -204,10 +263,13 @@ h2 { } .institution-name { + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; min-width: 0; + white-space: normal; + overflow-wrap: anywhere; } .flag-img { @@ -223,6 +285,41 @@ h2 { } } +.active-meta-filter { + display: inline-flex; + align-items: center; + gap: 4px; + max-width: 100%; +} + +.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__icon { + flex-shrink: 0; + width: 12px; + height: 12px; + margin-right: 4px; + font-size: 12px; + color: var(--sg-text-soft); +} + +.filter-meta-chip__label { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + min-width: 0; +} + app-topic-chip.active-filter-topic-chip { max-width: min(320px, 48vw); } @@ -240,7 +337,8 @@ app-topic-chip.active-filter-topic-chip { .filter-chip button, .active-topic-filter button, -.active-institution-filter button { +.active-institution-filter button, +.active-meta-filter button { display: flex; padding: 0; border: 0; @@ -255,7 +353,8 @@ app-topic-chip.active-filter-topic-chip { .filter-chip button mat-icon, .active-topic-filter button mat-icon, -.active-institution-filter button mat-icon { +.active-institution-filter button mat-icon, +.active-meta-filter button mat-icon { width: 12px; height: 12px; font-size: 12px; @@ -397,6 +496,7 @@ table.is-hidden { .institution-tags { display: flex; flex-wrap: wrap; + align-items: flex-start; gap: 6px; max-width: 280px; } @@ -404,7 +504,7 @@ table.is-hidden { .publication-institution-tag { display: inline-flex; align-items: center; - max-width: 200px; + max-width: 100%; margin: 0; padding: 2px 6px; border: 1px solid var(--sg-primary-border, var(--sg-border)); @@ -452,10 +552,13 @@ table.is-hidden { } .publication-institution-tag .institution-name { + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; min-width: 0; + white-space: normal; + overflow-wrap: anywhere; } .publication-institution-tag .flag-img { @@ -521,6 +624,17 @@ table.is-hidden { .mat-column-citations { text-align: center; } + + .mat-mdc-header-cell.mat-column-title, + .mat-mdc-header-cell.mat-column-institutions, + .mat-mdc-header-cell.mat-column-topics { + text-align: center; + } + + .mat-mdc-cell:not(:last-child), + .mat-mdc-header-cell:not(:last-child) { + border-right: 1px solid var(--sg-border); + } } mat-paginator { diff --git a/webapp/src/app/modules/person-publications/person-publications.component.ts b/webapp/src/app/modules/person-publications/person-publications.component.ts index d689e672..e0efcbf2 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.ts +++ b/webapp/src/app/modules/person-publications/person-publications.component.ts @@ -139,6 +139,9 @@ export class PersonPublicationsComponent implements OnInit { >('', { nonNullable: true, }); + readonly yearSearchControl = new FormControl('', { nonNullable: true }); + readonly typeSearchControl = new FormControl('', { nonNullable: true }); + readonly languageSearchControl = new FormControl('', { nonNullable: true }); readonly filterForm = new FormGroup({ publicationYears: new FormControl([], { nonNullable: true }), @@ -547,6 +550,68 @@ export class PersonPublicationsComponent implements OnInit { return Array.from(institutionsById.values()); } + yearSelectionSummary(): string { + return this.summarizeSelection( + this.filterForm.controls.publicationYears.value.map((year) => + String(year), + ), + ); + } + + typeSelectionSummary(): string { + return this.summarizeSelection(this.filterForm.controls.types.value); + } + + languageSelectionSummary(): string { + const labels = this.filterForm.controls.languages.value.map( + (value) => + this.languageOptions.find((option) => option.value === value)?.label ?? + value, + ); + return this.summarizeSelection(labels); + } + + private summarizeSelection(labels: string[]): string { + if (labels.length === 0) return ''; + if (labels.length === 1) return labels[0]; + return `+${labels.length}`; + } + + languageLabel(value: string): string { + return ( + this.languageOptions.find((option) => option.value === value)?.label ?? + value + ); + } + + filteredYearOptions(): number[] { + const term = this.yearSearchControl.value.trim(); + if (!term) return this.publicationYearOptions; + return this.publicationYearOptions.filter((year) => + String(year).includes(term), + ); + } + + filteredTypeOptions(): { value: string; label: string }[] { + const term = this.typeSearchControl.value.trim().toLowerCase(); + if (!term) return this.typeOptions; + return this.typeOptions.filter((type) => + type.label.toLowerCase().includes(term), + ); + } + + filteredLanguageOptions(): { value: string; label: string }[] { + const term = this.languageSearchControl.value.trim().toLowerCase(); + if (!term) return this.languageOptions; + return this.languageOptions.filter((language) => + language.label.toLowerCase().includes(term), + ); + } + + focusSelectSearch(input: HTMLInputElement): void { + setTimeout(() => input.focus()); + } + private filters() { return { publicationYears: this.filterForm.controls.publicationYears.value,