|
|
|
@ -7,6 +7,18 @@ export function customTableFilterFunction(data: any, filter: any) {
|
|
|
|
|
}
|
|
|
|
|
for (const filterElementName of Object.keys(filter.columnFilters)) {
|
|
|
|
|
const filterElement = filter.columnFilters[filterElementName];
|
|
|
|
|
// List Filter - ignore types if column is list
|
|
|
|
|
if (filterElement.list && filterElement.values.length > 0) {
|
|
|
|
|
let dataElement: Array<any> = data[filterElementName];
|
|
|
|
|
if (dataElement.length !== filterElement.values.length) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
for (const element of filterElement.values) {
|
|
|
|
|
if (!dataElement.includes(element)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// String Filter
|
|
|
|
|
if (filterElement.value) {
|
|
|
|
|
if (filterElement.type === 'String' || filterElement.type === 'Id') {
|
|
|
|
@ -148,14 +160,23 @@ export function customTableFilterFunction(data: any, filter: any) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Enum Filter
|
|
|
|
|
if (filterElement.type.startsWith('Enum') && filterElement.value != null && filterElement.value !== data[filterElementName]) {
|
|
|
|
|
if (
|
|
|
|
|
filterElement.type.startsWith('Enum') &&
|
|
|
|
|
filterElement.value != null &&
|
|
|
|
|
filterElement.value !== data[filterElementName]
|
|
|
|
|
) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Boolean Filter
|
|
|
|
|
if (filterElement.type === "Boolean" && ((filterElement.value === "Ja" && !data[filterElementName])||(filterElement.value === "Nein" && data[filterElementName]))) {
|
|
|
|
|
if (
|
|
|
|
|
filterElement.type === 'Boolean' &&
|
|
|
|
|
((filterElement.value === 'Ja' && !data[filterElementName]) ||
|
|
|
|
|
(filterElement.value === 'Nein' && data[filterElementName]))
|
|
|
|
|
) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*const b =
|
|
|
|
|
!filter.includesString ||
|
|
|
|
|
Object.keys(data).some(
|
|
|
|
|