Filter options
This commit is contained in:
parent
dd87dd6821
commit
17008f4475
@ -24,11 +24,11 @@ function copySettings(oldFilters: INestedFilter[], newFilters: INestedFilter[])
|
||||
|
||||
export function handleCheckedValue(filter: INestedFilter): void {
|
||||
if (filter.children && filter.children.length) {
|
||||
filter.checked = filter.children.reduce<boolean>((acc, next) => acc && !!next.checked, true);
|
||||
filter.checked = filter.children.reduce<boolean>((acc, next) => acc && next.checked, true);
|
||||
if (filter.checked) {
|
||||
filter.indeterminate = false;
|
||||
} else {
|
||||
filter.indeterminate = filter.children.reduce<boolean>((acc, next) => acc || !!next.checked, false);
|
||||
filter.indeterminate = filter.children.reduce<boolean>((acc, next) => acc || next.checked, false);
|
||||
}
|
||||
} else {
|
||||
filter.indeterminate = false;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
export interface IFilter {
|
||||
checked?: boolean;
|
||||
matches?: number;
|
||||
readonly skipTranslation?: boolean;
|
||||
readonly id: string;
|
||||
readonly label: string;
|
||||
readonly icon?: string;
|
||||
@ -9,4 +10,5 @@ export interface IFilter {
|
||||
readonly required?: boolean;
|
||||
readonly disabled?: boolean;
|
||||
readonly helpModeKey?: string;
|
||||
readonly color?: string;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { IListable } from '../../listing/models/listable';
|
||||
import { IListable } from '../../listing';
|
||||
import { Filter } from './filter';
|
||||
import { INestedFilter } from './nested-filter.model';
|
||||
|
||||
@ -8,6 +8,8 @@ export class NestedFilter extends Filter implements INestedFilter, IListable {
|
||||
disabled?: boolean;
|
||||
helpModeKey?: string;
|
||||
readonly children: Filter[];
|
||||
readonly skipTranslation?: boolean;
|
||||
readonly color?: string;
|
||||
|
||||
constructor(nestedFilter: INestedFilter) {
|
||||
super(nestedFilter);
|
||||
@ -16,5 +18,7 @@ export class NestedFilter extends Filter implements INestedFilter, IListable {
|
||||
this.disabled = !!nestedFilter.disabled;
|
||||
this.helpModeKey = nestedFilter.helpModeKey;
|
||||
this.children = nestedFilter.children ?? [];
|
||||
this.skipTranslation = nestedFilter.skipTranslation;
|
||||
this.color = nestedFilter.color;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user