Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
This commit is contained in:
@@ -32,7 +32,6 @@ export class CardSearchComponent {
|
||||
additionalFiltersTmp = input<TemplateRef<any>>();
|
||||
noResultsTmp = input<TemplateRef<any>>();
|
||||
|
||||
|
||||
cardMinWidth = input<number>(300);
|
||||
|
||||
page = input.required<Page>();
|
||||
|
||||
@@ -61,12 +61,38 @@
|
||||
|
||||
:host(.topic-chip--active.topic-chip--normal) .topic-chip__button {
|
||||
border-color: var(--topic-color);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--topic-color) 26%, transparent);
|
||||
background: color-mix(in srgb, var(--topic-color) 27%, #ffffff);
|
||||
color: color-mix(in srgb, var(--topic-color) 40%, #07163d);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px var(--topic-color),
|
||||
0 0 0 2px #ffffff,
|
||||
0 0 0 4px color-mix(in srgb, var(--topic-color) 48%, transparent),
|
||||
0 5px 12px rgba(15, 23, 42, 0.16);
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
box-shadow:
|
||||
inset 0 0 0 1px var(--topic-color),
|
||||
0 0 0 2px #ffffff,
|
||||
0 0 0 4px color-mix(in srgb, var(--topic-color) 56%, transparent),
|
||||
0 7px 14px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
}
|
||||
|
||||
:host(.topic-chip--active.topic-chip--mini) .topic-chip__button {
|
||||
background: color-mix(in srgb, var(--topic-color) 24%, #ffffff);
|
||||
color: var(--topic-text);
|
||||
background: color-mix(in srgb, var(--topic-color) 32%, #ffffff);
|
||||
color: color-mix(in srgb, var(--topic-color) 42%, #07163d);
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px color-mix(in srgb, var(--topic-color) 72%, transparent);
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
:host(.topic-chip--active.topic-chip--normal) .topic-chip__count {
|
||||
background: #ffffff;
|
||||
color: color-mix(in srgb, var(--topic-color) 46%, #07163d);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px color-mix(in srgb, var(--topic-color) 72%, transparent),
|
||||
0 1px 4px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
|
||||
.topic-chip__label {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class="topic-legend"
|
||||
[class.topic-legend-compact]="variant === 'compact'"
|
||||
[class.topic-legend-expanded]="expanded"
|
||||
[class.topic-legend-selectable]="selectable"
|
||||
aria-label="Aktuell sichtbare Themenbereiche">
|
||||
<div *ngIf="hasHeader" class="topic-legend-header">
|
||||
<div *ngIf="showTitle" class="topic-legend-title">
|
||||
@@ -45,30 +46,40 @@
|
||||
<div class="topic-legend-content">
|
||||
<div
|
||||
*ngFor="let group of visibleGroups; trackBy: trackByGroup"
|
||||
class="topic-legend-group">
|
||||
<span
|
||||
class="topic-legend-group"
|
||||
[class.topic-legend-group-active]="isFieldActive(group)"
|
||||
[style.--legend-color]="group.color">
|
||||
<button
|
||||
type="button"
|
||||
class="topic-legend-field"
|
||||
[class.topic-legend-entry-active]="isFieldActive(group)"
|
||||
[attr.aria-pressed]="selectable ? isFieldActive(group) : null"
|
||||
[matTooltip]="group.tooltip"
|
||||
[matTooltipDisabled]="!group.tooltip"
|
||||
matTooltipClass="topic-chip-tooltip"
|
||||
matTooltipPosition="above">
|
||||
matTooltipPosition="above"
|
||||
(click)="toggleField(group)">
|
||||
<span
|
||||
class="topic-legend-dot"
|
||||
[style.background]="group.color"
|
||||
aria-hidden="true"></span>
|
||||
<span>{{ group.name }}</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<span class="topic-legend-items">
|
||||
<span
|
||||
<button
|
||||
*ngFor="let item of group.items; trackBy: trackByItem"
|
||||
type="button"
|
||||
class="topic-legend-item"
|
||||
[class.topic-legend-entry-active]="isSubfieldActive(item)"
|
||||
[attr.aria-pressed]="selectable ? isSubfieldActive(item) : null"
|
||||
[matTooltip]="item.tooltip"
|
||||
[matTooltipDisabled]="!item.tooltip"
|
||||
matTooltipClass="topic-chip-tooltip"
|
||||
matTooltipPosition="above">
|
||||
matTooltipPosition="above"
|
||||
(click)="toggleSubfield(group, item)">
|
||||
{{ item.name }}
|
||||
</span>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -110,11 +110,39 @@
|
||||
background: #fbfdff;
|
||||
}
|
||||
|
||||
.topic-legend-group-active {
|
||||
border-color: var(--legend-color, var(--topic-legend-accent));
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 10%,
|
||||
#fbfdff
|
||||
);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px
|
||||
color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 55%,
|
||||
transparent
|
||||
),
|
||||
0 0 0 2px
|
||||
color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 22%,
|
||||
transparent
|
||||
);
|
||||
}
|
||||
|
||||
.topic-legend-field {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
gap: 5px;
|
||||
padding: 2px 4px;
|
||||
appearance: none;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: #07163d;
|
||||
font-family: inherit;
|
||||
font-size: 11px;
|
||||
font-weight: 800;
|
||||
line-height: 1.2;
|
||||
@@ -143,13 +171,87 @@
|
||||
}
|
||||
|
||||
.topic-legend-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 4px;
|
||||
appearance: none;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: #53617e;
|
||||
font-family: inherit;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.topic-legend-selectable {
|
||||
.topic-legend-field,
|
||||
.topic-legend-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.topic-legend-field:hover,
|
||||
.topic-legend-item:hover {
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 8%,
|
||||
#ffffff
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
.topic-legend-field:focus-visible,
|
||||
.topic-legend-item:focus-visible {
|
||||
outline: 2px solid var(--topic-legend-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.topic-legend-entry-active {
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 24%,
|
||||
#ffffff
|
||||
);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px
|
||||
color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 75%,
|
||||
transparent
|
||||
),
|
||||
0 1px 3px rgba(15, 23, 42, 0.12);
|
||||
}
|
||||
|
||||
.topic-legend-field.topic-legend-entry-active {
|
||||
color: color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 34%,
|
||||
#07163d
|
||||
);
|
||||
}
|
||||
|
||||
.topic-legend-field.topic-legend-entry-active .topic-legend-dot {
|
||||
box-shadow:
|
||||
0 0 0 2px #ffffff,
|
||||
0 0 0 4px
|
||||
color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 82%,
|
||||
transparent
|
||||
);
|
||||
}
|
||||
|
||||
.topic-legend-item.topic-legend-entry-active {
|
||||
color: color-mix(
|
||||
in srgb,
|
||||
var(--legend-color, var(--topic-legend-accent)) 34%,
|
||||
#07163d
|
||||
);
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.topic-legend-more-toggle {
|
||||
flex: 0 0 auto;
|
||||
padding: 0;
|
||||
|
||||
@@ -2,7 +2,11 @@ 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 '../../../resolvers/utils/topic-legend';
|
||||
import {
|
||||
TopicLegendGroup,
|
||||
TopicLegendItem,
|
||||
TopicLegendSubfieldSelection,
|
||||
} from '../../../resolvers/utils/topic-legend';
|
||||
|
||||
export type TopicLegendVariant = 'default' | 'compact';
|
||||
|
||||
@@ -17,16 +21,21 @@ export class TopicLegendComponent {
|
||||
@Input() groups: TopicLegendGroup[] = [];
|
||||
@Input() title = 'Farben nach Fachgebiet';
|
||||
@Input() infoTooltip =
|
||||
'Fachgebiete bestimmen die Farbe. Themenbereiche werden darunter gruppiert.';
|
||||
'Fachgebiete bestimmen die Farbe. Themenbereiche werden darunter gruppiert. Fachgebiete oder Themenbereiche können angeklickt werden, um die passenden Themen zu markieren.';
|
||||
@Input() visible = true;
|
||||
@Input() expanded = false;
|
||||
@Input() showTitle = true;
|
||||
@Input() showVisibilityToggle = true;
|
||||
@Input() collapsedGroupLimit = 3;
|
||||
@Input() variant: TopicLegendVariant = 'default';
|
||||
@Input() selectable = false;
|
||||
@Input() activeFieldIds: ReadonlySet<string> | readonly string[] = [];
|
||||
@Input() activeSubfieldIds: ReadonlySet<string> | readonly string[] = [];
|
||||
|
||||
@Output() visibleChange = new EventEmitter<boolean>();
|
||||
@Output() expandedChange = new EventEmitter<boolean>();
|
||||
@Output() fieldToggle = new EventEmitter<TopicLegendGroup>();
|
||||
@Output() subfieldToggle = new EventEmitter<TopicLegendSubfieldSelection>();
|
||||
|
||||
get hasGroups(): boolean {
|
||||
return this.groups.length > 0;
|
||||
@@ -66,6 +75,30 @@ export class TopicLegendComponent {
|
||||
this.expandedChange.emit(!this.expanded);
|
||||
}
|
||||
|
||||
toggleField(group: TopicLegendGroup): void {
|
||||
if (!this.selectable) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.fieldToggle.emit(group);
|
||||
}
|
||||
|
||||
toggleSubfield(group: TopicLegendGroup, item: TopicLegendItem): void {
|
||||
if (!this.selectable) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.subfieldToggle.emit({ group, item });
|
||||
}
|
||||
|
||||
isFieldActive(group: TopicLegendGroup): boolean {
|
||||
return this.isActiveLegendId(this.activeFieldIds, group.id);
|
||||
}
|
||||
|
||||
isSubfieldActive(item: TopicLegendItem): boolean {
|
||||
return this.isActiveLegendId(this.activeSubfieldIds, item.id);
|
||||
}
|
||||
|
||||
trackByGroup(_: number, group: TopicLegendGroup): string {
|
||||
return group.id;
|
||||
}
|
||||
@@ -73,4 +106,15 @@ export class TopicLegendComponent {
|
||||
trackByItem(_: number, item: TopicLegendItem): string {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
private isActiveLegendId(
|
||||
activeIds: ReadonlySet<string> | readonly string[],
|
||||
id: string,
|
||||
): boolean {
|
||||
if ('has' in activeIds) {
|
||||
return activeIds.has(id);
|
||||
}
|
||||
|
||||
return activeIds.includes(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user