RED-2543: Doughnut chart - fixed visually disabling selection
This commit is contained in:
parent
a62cdf6eaa
commit
14811688f9
@ -28,7 +28,7 @@
|
||||
(click)="val.key && selectValue(val.key)"
|
||||
*ngFor="let val of config"
|
||||
[class.active]="filterChecked$(val.key) | async"
|
||||
[class.filter-disabled]="!val.key || (statusFilters$ | async)?.length === 0"
|
||||
[class.filter-disabled]="!val.key || !filtersEnabled"
|
||||
>
|
||||
<iqser-status-bar
|
||||
[configs]="[
|
||||
|
||||
@ -12,6 +12,8 @@ export interface DoughnutChartConfig {
|
||||
active?: boolean;
|
||||
}
|
||||
|
||||
const FILTER_KEY = 'statusFilters';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-simple-doughnut-chart',
|
||||
templateUrl: './simple-doughnut-chart.component.html',
|
||||
@ -25,6 +27,7 @@ export class SimpleDoughnutChartComponent implements OnChanges {
|
||||
@Input() direction: 'row' | 'column' = 'column';
|
||||
@Input() totalType: 'sum' | 'count' = 'sum';
|
||||
@Input() counterText: string;
|
||||
readonly filtersEnabled: boolean;
|
||||
|
||||
chartData: any[] = [];
|
||||
perimeter: number;
|
||||
@ -32,9 +35,11 @@ export class SimpleDoughnutChartComponent implements OnChanges {
|
||||
cy = 0;
|
||||
size = 0;
|
||||
|
||||
readonly statusFilters$ = this.filterService.getFilterModels$('statusFilters') ?? of([]);
|
||||
readonly statusFilters$ = this.filterService.getFilterModels$(FILTER_KEY) ?? of([]);
|
||||
|
||||
constructor(readonly filterService: FilterService) {}
|
||||
constructor(readonly filterService: FilterService) {
|
||||
this.filtersEnabled = !!this.filterService.filterGroups.find(g => g.slug === FILTER_KEY);
|
||||
}
|
||||
|
||||
get circumference(): number {
|
||||
return 2 * Math.PI * this.radius;
|
||||
@ -90,6 +95,8 @@ export class SimpleDoughnutChartComponent implements OnChanges {
|
||||
}
|
||||
|
||||
selectValue(key: string): void {
|
||||
this.filterService.toggleFilter('statusFilters', key);
|
||||
if (this.filtersEnabled) {
|
||||
this.filterService.toggleFilter(FILTER_KEY, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user