migrate angular 21 finalize
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Component, Input, inject} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup} from '@angular/forms';
|
||||
import {SongService} from '../../services/song.service';
|
||||
@@ -21,6 +21,8 @@ import {SongTypePipe} from '../../../../widget-modules/pipes/song-type-translate
|
||||
imports: [ReactiveFormsModule, MatFormField, MatLabel, MatInput, MatSelect, MatOption, LegalTypePipe, KeyPipe, SongTypePipe],
|
||||
})
|
||||
export class FilterComponent {
|
||||
private router = inject(Router);
|
||||
|
||||
public filterFormGroup: UntypedFormGroup;
|
||||
@Input() public route = '/';
|
||||
@Input() public songs: Song[] = [];
|
||||
@@ -28,11 +30,10 @@ export class FilterComponent {
|
||||
public legalType = SongService.LEGAL_TYPE;
|
||||
public keys = KEYS;
|
||||
|
||||
public constructor(
|
||||
private router: Router,
|
||||
activatedRoute: ActivatedRoute,
|
||||
fb: UntypedFormBuilder
|
||||
) {
|
||||
public constructor() {
|
||||
const activatedRoute = inject(ActivatedRoute);
|
||||
const fb = inject(UntypedFormBuilder);
|
||||
|
||||
this.filterFormGroup = fb.group({
|
||||
q: '',
|
||||
type: '',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ChangeDetectionStrategy, Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, OnDestroy, OnInit, inject} from '@angular/core';
|
||||
import {SongService} from '../services/song.service';
|
||||
import {Song} from '../services/song';
|
||||
import {map} from 'rxjs/operators';
|
||||
@@ -25,6 +25,10 @@ import {FaIconComponent} from '@fortawesome/angular-fontawesome';
|
||||
imports: [ListHeaderComponent, FilterComponent, CardComponent, RouterLink, RoleDirective, FaIconComponent, AsyncPipe],
|
||||
})
|
||||
export class SongListComponent implements OnInit, OnDestroy {
|
||||
private songService = inject(SongService);
|
||||
private activatedRoute = inject(ActivatedRoute);
|
||||
private scrollService = inject(ScrollService);
|
||||
|
||||
public anyFilterActive = false;
|
||||
public songs$: Observable<Song[]> = combineLatest([
|
||||
this.activatedRoute.queryParams.pipe(map(_ => _ as FilterValues)),
|
||||
@@ -39,12 +43,6 @@ export class SongListComponent implements OnInit, OnDestroy {
|
||||
public faDraft = faPencilRuler;
|
||||
public faFinal = faCheck;
|
||||
|
||||
public constructor(
|
||||
private songService: SongService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private scrollService: ScrollService
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
setTimeout(() => this.scrollService.restoreScrollPositionFor('songlist'), 100);
|
||||
setTimeout(() => this.scrollService.restoreScrollPositionFor('songlist'), 300);
|
||||
|
||||
Reference in New Issue
Block a user