import { Operator } from './operators'; import { Interval } from 'dataStructures/interval'; /** * FilterConfig :: * Describes the JSON representation of the filter configuration used as a base to create filtering functions * Example: * [ // FilterConfig * [ // GroupOfFilters * { id: 'priceMin', field: 'price', operator: 'lt', operand: 200 }, // Filter * ], * [ * { id: 'priceMax', field: 'price', operator: 'gt', operand: 500} * ] * [ * { id: 'solo' field: 'people', operator: 'equals', operand: 1 } * { id: 'forCouple' field: 'people', operator: 'equals', operand: 2 } * ] * ] */ export declare type GroupId = string; export declare type FilterId = string; export declare type FilterOperand = number | string | number[] | string[] | Interval; export interface Filter { id: TFilterId; field: keyof T; operator: Operator; operand: FilterOperand; } export declare type GroupOfFilters = Filter[]; export declare type FilterConfig = GroupOfFilters[]; export declare type FiltersApplied = TFilterId[]; export declare type GroupDictionary = Record>; export declare type FilterIdToGroupId = Map; export interface FilterConfigData { getFilterDictionary: () => Record>; getFiltersApplied: () => Filter[]; getFiltersNotApplied: () => Filter[]; getAllFilterIds: () => TFilterId[]; getFilterIdsApplied: () => Partial[]; getFilterIdsNotApplied: () => Partial[]; getGroupDictionary: () => GroupDictionary; getAllFilterGroupIds: () => GroupId[]; getGroupIdsApplied: () => GroupId[]; getGroupIdForFilter: (filterId: FilterId) => GroupId; } export declare const buildFilterConfigData: (filterConfig: FilterConfig) => (filterIdsApplied: TFilterId[]) => FilterConfigData;