Filter indeterminate behaviour
This commit is contained in:
parent
517d351faa
commit
c4ba84432a
@ -47,7 +47,7 @@ import { LogoComponent } from './logo/logo.component';
|
||||
import { CompositeRouteGuard } from './utils/composite-route.guard';
|
||||
import { AppStateGuard } from './state/app-state.guard';
|
||||
import { SimpleDoughnutChartComponent } from './components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MAT_CHECKBOX_CLICK_ACTION, MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { AnnotationIconComponent } from './components/annotation-icon/annotation-icon.component';
|
||||
import { AuthGuard } from './auth/auth.guard';
|
||||
@ -253,7 +253,8 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
|
||||
multi: true,
|
||||
useFactory: languageInitializer,
|
||||
deps: [LanguageService]
|
||||
}
|
||||
},
|
||||
{ provide: MAT_CHECKBOX_CLICK_ACTION, useValue: 'noop' }
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
|
||||
@ -25,8 +25,7 @@
|
||||
<mat-checkbox
|
||||
[checked]="filter.checked"
|
||||
[indeterminate]="filter.indeterminate"
|
||||
(click)="$event.stopPropagation()"
|
||||
(change)="filterCheckboxClicked($event, filter)"
|
||||
(click)="filterCheckboxClicked($event, filter); $event.stopPropagation()"
|
||||
class="filter-menu-checkbox"
|
||||
color="primary"
|
||||
>
|
||||
@ -37,8 +36,7 @@
|
||||
<div *ngFor="let subFilter of filter.filters" class="padding-left mat-menu-item" (click)="$event.stopPropagation()">
|
||||
<mat-checkbox
|
||||
[checked]="subFilter.checked"
|
||||
(click)="$event.stopPropagation()"
|
||||
(change)="filterCheckboxClicked($event, subFilter, filter)"
|
||||
(click)="filterCheckboxClicked($event, subFilter, filter); $event.stopPropagation()"
|
||||
color="primary"
|
||||
>
|
||||
<ng-template *ngTemplateOutlet="filterTemplate ? filterTemplate : defaultFilterTemplate; context: { filter: subFilter }">
|
||||
|
||||
@ -29,6 +29,9 @@ export class FilterComponent {
|
||||
if (parent) {
|
||||
handleCheckedValue(parent);
|
||||
} else {
|
||||
if (filter.indeterminate) {
|
||||
filter.checked = false;
|
||||
}
|
||||
filter.indeterminate = false;
|
||||
filter.filters?.forEach((f) => (f.checked = filter.checked));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user