publication overview: make Jahr/Typ/Sprache filters searchable
LocationBasedServices/smartguide/pipeline/head There was a failure building this commit
LocationBasedServices/smartguide/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -6,44 +6,98 @@
|
||||
<div class="publication-filter-stack">
|
||||
<form class="publication-filters" [formGroup]="filterForm">
|
||||
<mat-form-field>
|
||||
<mat-icon matPrefix class="filter-prefix-icon">calendar_today</mat-icon>
|
||||
<mat-select
|
||||
placeholder="Jahr"
|
||||
formControlName="publicationYears"
|
||||
multiple
|
||||
(selectionChange)="applyFilters()">
|
||||
@for (year of publicationYearOptions; track year) {
|
||||
[panelWidth]="null"
|
||||
(selectionChange)="applyFilters()"
|
||||
(opened)="focusSelectSearch(yearSearchInput)"
|
||||
(closed)="yearSearchControl.setValue('')">
|
||||
<mat-select-trigger>{{ yearSelectionSummary() }}</mat-select-trigger>
|
||||
<div class="select-search" (click)="$event.stopPropagation()">
|
||||
<mat-icon class="select-search__icon">search</mat-icon>
|
||||
<input
|
||||
#yearSearchInput
|
||||
type="text"
|
||||
class="select-search__input"
|
||||
[formControl]="yearSearchControl"
|
||||
placeholder="Jahr suchen…"
|
||||
(keydown)="$event.stopPropagation()" />
|
||||
</div>
|
||||
@for (year of filteredYearOptions(); track year) {
|
||||
<mat-option [value]="year">{{ year }}</mat-option>
|
||||
} @empty {
|
||||
<div class="select-search__empty">Keine Treffer</div>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-icon matPrefix class="filter-prefix-icon">category</mat-icon>
|
||||
<mat-select
|
||||
placeholder="Typ"
|
||||
formControlName="types"
|
||||
multiple
|
||||
(selectionChange)="applyFilters()">
|
||||
@for (type of typeOptions; track type.value) {
|
||||
[panelWidth]="null"
|
||||
(selectionChange)="applyFilters()"
|
||||
(opened)="focusSelectSearch(typeSearchInput)"
|
||||
(closed)="typeSearchControl.setValue('')">
|
||||
<mat-select-trigger>{{ typeSelectionSummary() }}</mat-select-trigger>
|
||||
<div class="select-search" (click)="$event.stopPropagation()">
|
||||
<mat-icon class="select-search__icon">search</mat-icon>
|
||||
<input
|
||||
#typeSearchInput
|
||||
type="text"
|
||||
class="select-search__input"
|
||||
[formControl]="typeSearchControl"
|
||||
placeholder="Typ suchen…"
|
||||
(keydown)="$event.stopPropagation()" />
|
||||
</div>
|
||||
@for (type of filteredTypeOptions(); track type.value) {
|
||||
<mat-option [value]="type.value">{{ type.label }}</mat-option>
|
||||
} @empty {
|
||||
<div class="select-search__empty">Keine Treffer</div>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-icon matPrefix class="filter-prefix-icon">translate</mat-icon>
|
||||
<mat-select
|
||||
placeholder="Sprache"
|
||||
formControlName="languages"
|
||||
multiple
|
||||
(selectionChange)="applyFilters()">
|
||||
@for (language of languageOptions; track language.value) {
|
||||
[panelWidth]="null"
|
||||
(selectionChange)="applyFilters()"
|
||||
(opened)="focusSelectSearch(languageSearchInput)"
|
||||
(closed)="languageSearchControl.setValue('')">
|
||||
<mat-select-trigger>{{
|
||||
languageSelectionSummary()
|
||||
}}</mat-select-trigger>
|
||||
<div class="select-search" (click)="$event.stopPropagation()">
|
||||
<mat-icon class="select-search__icon">search</mat-icon>
|
||||
<input
|
||||
#languageSearchInput
|
||||
type="text"
|
||||
class="select-search__input"
|
||||
[formControl]="languageSearchControl"
|
||||
placeholder="Sprache suchen…"
|
||||
(keydown)="$event.stopPropagation()" />
|
||||
</div>
|
||||
@for (language of filteredLanguageOptions(); track language.value) {
|
||||
<mat-option [value]="language.value">{{
|
||||
language.label
|
||||
}}</mat-option>
|
||||
} @empty {
|
||||
<div class="select-search__empty">Keine Treffer</div>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="institution-filter">
|
||||
<mat-icon matPrefix class="filter-prefix-icon">apartment</mat-icon>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
@@ -73,12 +127,13 @@
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="topic-filter">
|
||||
<mat-icon matPrefix class="filter-prefix-icon">search</mat-icon>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
[formControl]="topicSearchControl"
|
||||
[matAutocomplete]="topicAutocomplete"
|
||||
placeholder="Topic suchen" />
|
||||
placeholder="Thema suchen" />
|
||||
<mat-autocomplete
|
||||
#topicAutocomplete="matAutocomplete"
|
||||
[displayWith]="displayTopic"
|
||||
@@ -96,7 +151,7 @@
|
||||
topicOptions.length === 0 &&
|
||||
topicSearchControl.value
|
||||
) {
|
||||
<mat-option disabled>Kein Topic gefunden</mat-option>
|
||||
<mat-option disabled>Kein Thema gefunden</mat-option>
|
||||
}
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
@@ -112,10 +167,70 @@
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@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
|
||||
) {
|
||||
<div class="active-filters-row" aria-label="Aktive Filter">
|
||||
<span class="active-filters-label">Aktive Filter:</span>
|
||||
<div class="chips-container">
|
||||
@for (year of selectedYears; track year) {
|
||||
<span class="active-meta-filter">
|
||||
<span class="filter-meta-chip">
|
||||
<mat-icon class="filter-meta-chip__icon"
|
||||
>calendar_today</mat-icon
|
||||
>
|
||||
<span class="filter-meta-chip__label">{{ year }}</span>
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="remove-chip-btn"
|
||||
(click)="toggleYearFilter(year)"
|
||||
[attr.aria-label]="'Jahresfilter ' + year + ' entfernen'">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</span>
|
||||
}
|
||||
@for (type of selectedTypes; track type) {
|
||||
<span class="active-meta-filter">
|
||||
<span class="filter-meta-chip">
|
||||
<mat-icon class="filter-meta-chip__icon">category</mat-icon>
|
||||
<span class="filter-meta-chip__label">{{ type }}</span>
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="remove-chip-btn"
|
||||
(click)="toggleTypeFilter(type)"
|
||||
[attr.aria-label]="'Typfilter ' + type + ' entfernen'">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</span>
|
||||
}
|
||||
@for (language of selectedLanguages; track language) {
|
||||
<span class="active-meta-filter">
|
||||
<span class="filter-meta-chip">
|
||||
<mat-icon class="filter-meta-chip__icon">translate</mat-icon>
|
||||
<span class="filter-meta-chip__label">{{
|
||||
languageLabel(language)
|
||||
}}</span>
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="remove-chip-btn"
|
||||
(click)="toggleLanguageFilter(language)"
|
||||
[attr.aria-label]="
|
||||
'Sprachfilter ' + languageLabel(language) + ' entfernen'
|
||||
">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</span>
|
||||
}
|
||||
@for (topic of selectedTopics; track topic.id) {
|
||||
<span class="active-topic-filter">
|
||||
<span class="active-topic-filter__prefix">Thema:</span>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<number[]>([], { 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,
|
||||
|
||||
Reference in New Issue
Block a user