You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gristlabs_grist-core/app/common/RowFilterFunc.ts

17 lines
504 B

import { CellValue } from "app/common/DocActions";
import { ColumnFilterFunc } from "app/common/ColumnFilterFunc";
export type RowFilterFunc<T> = (row: T) => boolean;
// Builds RowFilter for a single column
export function buildRowFilter<T>(
getter: RowValueFunc<T> | null,
filterFunc: ColumnFilterFunc | null): RowFilterFunc<T> {
if (!getter || !filterFunc) {
return () => true;
}
return (rowId: T) => filterFunc(getter(rowId));
}
export type RowValueFunc<T> = (rowId: T) => CellValue;