Fixed a bug where filter IsEmpty wasn't hiding the value input.

This commit is contained in:
Joseph Milazzo 2025-04-11 09:20:18 -05:00
parent e535e216df
commit efe27ccab5
2 changed files with 13 additions and 3 deletions

View file

@ -18,7 +18,7 @@
</div>
<div class="col-md-4 col-10 mb-2">
@if (formGroup.get('comparison')?.value !== FilterComparison.IsEmpty) {
@if (IsEmptySelected) {
@if (predicateType$ | async; as predicateType) {
@switch (predicateType) {
@case (PredicateType.Text) {

View file

@ -170,6 +170,10 @@ export class MetadataFilterRowComponent implements OnInit {
private readonly mangaFormatPipe = new MangaFormatPipe(this.translocoService);
private readonly ageRatingPipe = new AgeRatingPipe();
get IsEmptySelected() {
return parseInt(this.formGroup.get('comparison')?.value + '', 10) !== FilterComparison.IsEmpty;
}
get UiLabel(): FilterRowUi | null {
const field = parseInt(this.formGroup.get('input')!.value, 10) as FilterField;
@ -348,6 +352,7 @@ export class MetadataFilterRowComponent implements OnInit {
this.formGroup.get('filterValue')?.patchValue('');
this.formGroup.get('comparison')?.patchValue(StringComparisons[0]);
}
this.cdRef.markForCheck();
return;
}
@ -363,10 +368,13 @@ export class MetadataFilterRowComponent implements OnInit {
this.validComparisons$.next([...new Set(comps)]);
this.predicateType$.next(PredicateType.Number);
if (this.loaded) {
this.formGroup.get('filterValue')?.patchValue(0);
this.formGroup.get('comparison')?.patchValue(NumberComparisons[0]);
}
this.cdRef.markForCheck();
return;
}
@ -383,6 +391,7 @@ export class MetadataFilterRowComponent implements OnInit {
this.formGroup.get('filterValue')?.patchValue(false);
this.formGroup.get('comparison')?.patchValue(DateComparisons[0]);
}
this.cdRef.markForCheck();
return;
}
@ -400,6 +409,7 @@ export class MetadataFilterRowComponent implements OnInit {
this.formGroup.get('filterValue')?.patchValue(false);
this.formGroup.get('comparison')?.patchValue(BooleanComparisons[0]);
}
this.cdRef.markForCheck();
return;
}
@ -421,15 +431,15 @@ export class MetadataFilterRowComponent implements OnInit {
this.formGroup.get('filterValue')?.patchValue(0);
this.formGroup.get('comparison')?.patchValue(comps[0]);
}
this.cdRef.markForCheck();
return;
}
}
onDateSelect(_: NgbDate) {
this.propagateFilterUpdate();
}
updateIfDateFilled() {
this.propagateFilterUpdate();
}