Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
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:
@@ -0,0 +1,89 @@
|
||||
<section
|
||||
*ngIf="hasGroups"
|
||||
class="topic-legend"
|
||||
[class.topic-legend-compact]="variant === 'compact'"
|
||||
[class.topic-legend-expanded]="expanded"
|
||||
aria-label="Aktuell sichtbare Themenbereiche">
|
||||
<div *ngIf="hasHeader" class="topic-legend-header">
|
||||
<div *ngIf="showTitle" class="topic-legend-title">
|
||||
<span>{{ title }}</span>
|
||||
<mat-icon
|
||||
class="topic-legend-info"
|
||||
[matTooltip]="infoTooltip"
|
||||
matTooltipPosition="above"
|
||||
aria-label="Informationen zur Farblegende">
|
||||
info_outline
|
||||
</mat-icon>
|
||||
</div>
|
||||
|
||||
<button
|
||||
*ngIf="showVisibilityToggle"
|
||||
type="button"
|
||||
class="topic-legend-visibility-toggle"
|
||||
[attr.aria-expanded]="visible"
|
||||
(click)="toggleVisibility()">
|
||||
<span>{{ visible ? 'Legende ausblenden' : 'Legende einblenden' }}</span>
|
||||
<mat-icon aria-hidden="true">
|
||||
{{ visible ? 'expand_less' : 'expand_more' }}
|
||||
</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
*ngIf="visible"
|
||||
class="topic-legend-body"
|
||||
[class.topic-legend-body-inline-info]="!hasHeader">
|
||||
<mat-icon
|
||||
*ngIf="!hasHeader"
|
||||
class="topic-legend-info topic-legend-info-inline"
|
||||
[matTooltip]="infoTooltip"
|
||||
matTooltipPosition="above"
|
||||
aria-label="Informationen zur Farblegende">
|
||||
info_outline
|
||||
</mat-icon>
|
||||
|
||||
<div class="topic-legend-content">
|
||||
<div
|
||||
*ngFor="let group of visibleGroups; trackBy: trackByGroup"
|
||||
class="topic-legend-group">
|
||||
<span
|
||||
class="topic-legend-field"
|
||||
[matTooltip]="group.tooltip"
|
||||
[matTooltipDisabled]="!group.tooltip"
|
||||
matTooltipClass="topic-chip-tooltip"
|
||||
matTooltipPosition="above">
|
||||
<span
|
||||
class="topic-legend-dot"
|
||||
[style.background]="group.color"
|
||||
aria-hidden="true"></span>
|
||||
<span>{{ group.name }}</span>
|
||||
</span>
|
||||
|
||||
<span class="topic-legend-items">
|
||||
<span
|
||||
*ngFor="let item of group.items; trackBy: trackByItem"
|
||||
class="topic-legend-item"
|
||||
[matTooltip]="item.tooltip"
|
||||
[matTooltipDisabled]="!item.tooltip"
|
||||
matTooltipClass="topic-chip-tooltip"
|
||||
matTooltipPosition="above">
|
||||
{{ item.name }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<button
|
||||
*ngIf="showExpandedToggle"
|
||||
type="button"
|
||||
class="topic-legend-more-toggle"
|
||||
[attr.aria-expanded]="expanded"
|
||||
(click)="toggleExpanded()">
|
||||
{{
|
||||
expanded
|
||||
? 'Weniger anzeigen'
|
||||
: '+' + hiddenLegendItemCount + ' weitere'
|
||||
}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,201 @@
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.topic-legend {
|
||||
--topic-legend-accent: #0057ff;
|
||||
|
||||
width: min(760px, 100%);
|
||||
box-sizing: border-box;
|
||||
margin-top: 16px;
|
||||
padding: 13px 16px;
|
||||
border: 1px solid #dbe5f6;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.topic-legend-header,
|
||||
.topic-legend-title,
|
||||
.topic-legend-visibility-toggle,
|
||||
.topic-legend-body,
|
||||
.topic-legend-content,
|
||||
.topic-legend-group,
|
||||
.topic-legend-field,
|
||||
.topic-legend-items {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.topic-legend-header {
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.topic-legend-title {
|
||||
gap: 5px;
|
||||
color: #07163d;
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.topic-legend-info {
|
||||
flex: 0 0 auto;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
color: #7d8aa8;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
.topic-legend-visibility-toggle,
|
||||
.topic-legend-more-toggle {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--topic-legend-accent);
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
font-weight: 700;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--topic-legend-accent);
|
||||
outline-offset: 2px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-legend-visibility-toggle {
|
||||
flex: 0 0 auto;
|
||||
gap: 4px;
|
||||
padding: 0;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
|
||||
mat-icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-legend-body {
|
||||
align-items: flex-start;
|
||||
gap: 9px;
|
||||
margin-top: 17px;
|
||||
}
|
||||
|
||||
.topic-legend-body-inline-info {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.topic-legend-content {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.topic-legend-group {
|
||||
gap: 9px;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
min-height: 28px;
|
||||
padding: 5px 9px;
|
||||
border: 1px solid #dbe5f6;
|
||||
border-radius: 999px;
|
||||
background: #fbfdff;
|
||||
}
|
||||
|
||||
.topic-legend-field {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
gap: 5px;
|
||||
color: #07163d;
|
||||
font-size: 11px;
|
||||
font-weight: 800;
|
||||
line-height: 1.2;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.topic-legend-field span:last-child,
|
||||
.topic-legend-item {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.topic-legend-dot {
|
||||
flex: 0 0 auto;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.85);
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2);
|
||||
}
|
||||
|
||||
.topic-legend-items {
|
||||
flex: 0 1 auto;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px 11px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.topic-legend-item {
|
||||
color: #53617e;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.topic-legend-more-toggle {
|
||||
flex: 0 0 auto;
|
||||
padding: 0;
|
||||
font-size: 11px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.topic-legend-compact {
|
||||
width: fit-content;
|
||||
max-width: 100%;
|
||||
margin: 0 0 16px;
|
||||
padding: 8px 10px;
|
||||
|
||||
.topic-legend-body {
|
||||
gap: 9px;
|
||||
}
|
||||
|
||||
.topic-legend-content {
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
.topic-legend-group {
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
min-height: 24px;
|
||||
padding: 3px 7px;
|
||||
}
|
||||
|
||||
.topic-legend-field,
|
||||
.topic-legend-item {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.topic-legend-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.topic-legend-more-toggle {
|
||||
min-height: 24px;
|
||||
padding: 0 2px;
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { TopicLegendGroup, TopicLegendItem } from '../../utils/topic-legend';
|
||||
|
||||
export type TopicLegendVariant = 'default' | 'compact';
|
||||
|
||||
@Component({
|
||||
selector: 'app-topic-legend',
|
||||
standalone: true,
|
||||
imports: [CommonModule, MatIconModule, MatTooltipModule],
|
||||
templateUrl: './topic-legend.component.html',
|
||||
styleUrl: './topic-legend.component.scss',
|
||||
})
|
||||
export class TopicLegendComponent {
|
||||
@Input() groups: TopicLegendGroup[] = [];
|
||||
@Input() title = 'Farben nach Fachgebiet';
|
||||
@Input() infoTooltip =
|
||||
'Fachgebiete bestimmen die Farbe. Themenbereiche werden darunter gruppiert.';
|
||||
@Input() visible = true;
|
||||
@Input() expanded = false;
|
||||
@Input() showTitle = true;
|
||||
@Input() showVisibilityToggle = true;
|
||||
@Input() collapsedGroupLimit = 3;
|
||||
@Input() variant: TopicLegendVariant = 'default';
|
||||
|
||||
@Output() visibleChange = new EventEmitter<boolean>();
|
||||
@Output() expandedChange = new EventEmitter<boolean>();
|
||||
|
||||
get hasGroups(): boolean {
|
||||
return this.groups.length > 0;
|
||||
}
|
||||
|
||||
get hasHeader(): boolean {
|
||||
return this.showTitle || this.showVisibilityToggle;
|
||||
}
|
||||
|
||||
get visibleGroups(): TopicLegendGroup[] {
|
||||
if (this.expanded) {
|
||||
return this.groups;
|
||||
}
|
||||
|
||||
return this.groups.slice(0, this.collapsedGroupLimit);
|
||||
}
|
||||
|
||||
get hiddenLegendItemCount(): number {
|
||||
if (this.expanded) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.groups
|
||||
.slice(this.collapsedGroupLimit)
|
||||
.reduce((count, group) => count + group.items.length, 0);
|
||||
}
|
||||
|
||||
get showExpandedToggle(): boolean {
|
||||
return this.expanded || this.hiddenLegendItemCount > 0;
|
||||
}
|
||||
|
||||
toggleVisibility(): void {
|
||||
this.visibleChange.emit(!this.visible);
|
||||
}
|
||||
|
||||
toggleExpanded(): void {
|
||||
this.expandedChange.emit(!this.expanded);
|
||||
}
|
||||
|
||||
trackByGroup(_: number, group: TopicLegendGroup): string {
|
||||
return group.id;
|
||||
}
|
||||
|
||||
trackByItem(_: number, item: TopicLegendItem): string {
|
||||
return item.id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user