added skeleton loading for projects data table

This commit is contained in:
2026-08-10 13:45:59 +02:00
parent f51b775fd9
commit 127f5ca287
11 changed files with 48 additions and 39 deletions
@@ -15,10 +15,6 @@ import { ResolverStateService } from '../../app/shared/services/resolver-state.s
standalone: true,
})
export class SkTextDirective implements OnChanges {
/**
* Optional manual loading state.
* The directive also reacts to global route/resolver loading.
*/
@Input() skText = false;
private readonly el = inject(ElementRef<HTMLElement>);
@@ -12,7 +12,7 @@ import { AppAuthorTooltipComponent } from '../app-author-tooltip/app-author-tool
import { MatIconModule } from '@angular/material/icon';
import { ComponentTooltipDirective } from '../../../directives/component-tooltip.directive';
import { MatChipsModule } from '@angular/material/chips';
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
@Component({
host: {
'[style.--border-width]': 'isSelected() ? "2px" : "1px"',
@@ -22,7 +22,12 @@ import { MatChipsModule } from '@angular/material/chips';
'[class.is-mini-size]': 'isMiniSize()',
},
selector: 'app-author-chip',
imports: [MatIconModule, MatChipsModule, ComponentTooltipDirective],
imports: [
MatIconModule,
MatChipsModule,
ComponentTooltipDirective,
SkTextDirective,
],
templateUrl: './app-author-chip.component.html',
styleUrl: './app-author-chip.component.scss',
})
@@ -13,7 +13,7 @@ import { ComponentTooltipDirective } from '../../../directives/component-tooltip
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
import { MatIconModule } from '@angular/material/icon';
import { AppTopicTooltipComponent } from '../app-topic-tooltip/app-topic-tooltip.component';
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
@Component({
host: {
'[style.--topic-color]': 'color()',
@@ -23,7 +23,12 @@ import { AppTopicTooltipComponent } from '../app-topic-tooltip/app-topic-tooltip
'[class.is-mini-size]': 'isMiniSize()',
},
selector: 'app-topic-chip-2',
imports: [MatChipsModule, ComponentTooltipDirective, MatIconModule],
imports: [
MatChipsModule,
ComponentTooltipDirective,
MatIconModule,
SkTextDirective,
],
templateUrl: './app-topic-chip.component.html',
styleUrl: './app-topic-chip.component.scss',
})
@@ -11,15 +11,23 @@
[pageSizeOptions]="[10, 25, 50]" />
<ng-template #fundingStartTmp let-element>
{{ getStartDate(element) | date: 'dd.MM.yyyy' }}
<span>
{{ getStartDate(element) | date: 'dd.MM.yyyy' }}
</span>
</ng-template>
<ng-template #fundingEndTmp let-element>
{{ getEndDate(element) | date: 'dd.MM.yyyy' }}
<span>
{{ getEndDate(element) | date: 'dd.MM.yyyy' }}
</span>
</ng-template>
<ng-template #fundingAmountTmp let-element>
{{ getFundingAmount(element) | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
<span>
{{
getFundingAmount(element) | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}
</span>
</ng-template>
<ng-template #actionsTmp let-element>
@@ -31,20 +39,6 @@
<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 #institutionsTmp let-project>
@let institutions = getProjectInstitutions(project);
@@ -79,7 +73,7 @@
matTooltipPosition="above"
(click)="toggleFundingTypeFilter(project.funding_type)">
<app-chip [color]="getFundingTypeColor(project.funding_type)">
{{ project.funding_type }}
<span>{{ project.funding_type }}</span>
</app-chip>
</button>
} @else {
@@ -25,6 +25,7 @@ import { ChipComponent } from '../chip/chip.component';
import { MatTooltip } from '@angular/material/tooltip';
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
import { bundProjectQueryParamKeys } from '../../../resolvers/bund-projects.resolver';
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
@Component({
selector: 'app-bund-project-table',
imports: [
@@ -38,6 +39,7 @@ import { bundProjectQueryParamKeys } from '../../../resolvers/bund-projects.reso
DatePipe,
ChipComponent,
AppTopicChipComponent,
SkTextDirective,
],
templateUrl: './bund-project-table.component.html',
styleUrl: './bund-project-table.component.scss',
@@ -30,7 +30,7 @@
context: { $implicit: row }
"></ng-container>
} @else if (col.type === 'accessor') {
{{ row[col.accessorKey] }}
<span>{{ row[col.accessorKey] }}</span>
}
</td>
</ng-container>
@@ -20,7 +20,7 @@ import {
} from '@angular/material/sort';
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
import { ActivatedRoute, Router } from '@angular/router';
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
export interface BaseColumn<T> {
id: string;
header: string;
@@ -43,7 +43,7 @@ export type GenericColumn<T> = AccessorColumn<T> | DisplayColumn<T>;
@Component({
selector: 'app-data-table',
standalone: true,
imports: [MatTableModule, NgTemplateOutlet, MatSortModule],
imports: [MatTableModule, NgTemplateOutlet, MatSortModule, SkTextDirective],
templateUrl: './data-table.component.html',
styleUrl: './data-table.component.scss',
})
@@ -11,11 +11,13 @@
[pageSizeOptions]="[10, 25, 50]" />
<ng-template #fundingEndTmp let-element>
{{
element.funding_end == '2999' || element.funding_end == null
? 'laufend'
: element.funding_end
}}
<span>
{{
element.funding_end == '2999' || element.funding_end == null
? 'laufend'
: element.funding_end
}}</span
>
</ng-template>
<ng-template #actionsTmp let-element>
@@ -23,6 +23,7 @@ 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';
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
@Component({
selector: 'app-dfg-project-table',
imports: [
@@ -33,6 +34,7 @@ import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
QueryParamPaginatorComponent,
MatTooltip,
AppTopicChipComponent,
SkTextDirective,
],
templateUrl: './dfg-project-table.component.html',
styleUrl: './dfg-project-table.component.scss',
@@ -20,7 +20,7 @@
matTooltipPosition="above"
(click)="toggleTypeFilter(project.project_type)">
<app-chip [color]="getProjectTypeColor(project.project_type)">
{{ getProjectTypeLabel(project) }}
<span>{{ getProjectTypeLabel(project) }}</span>
</app-chip>
</button>
} @else {
@@ -29,15 +29,17 @@
</ng-template>
<ng-template #fundingStartTmp let-element>
{{ getStartDate(element) | date: 'dd.MM.yyyy' }}
<span>{{ getStartDate(element) | date: 'dd.MM.yyyy' }}</span>
</ng-template>
<ng-template #fundingEndTmp let-element>
{{ getEndDate(element) | date: 'dd.MM.yyyy' }}
<span>{{ getEndDate(element) | date: 'dd.MM.yyyy' }}</span>
</ng-template>
<ng-template #fundingAmountTmp let-element>
{{ getFundingAmount(element) | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
<span>{{
getFundingAmount(element) | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}</span>
</ng-template>
<ng-template #authorsTmp let-project>
@@ -14,7 +14,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatTooltip } from '@angular/material/tooltip';
import { CurrencyPipe, DatePipe } from '@angular/common';
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
import {
DataTableComponent,
GenericColumn,
@@ -46,6 +46,7 @@ import { AppAuthorChipComponent } from '../app-author-chip/app-author-chip.compo
AppTopicChipComponent,
ChipComponent,
AppAuthorChipComponent,
SkTextDirective,
],
templateUrl: './eu-project-table.component.html',
styleUrl: './eu-project-table.component.scss',