interface FilterGroupDefinition { /** * The filters in this group. */ filters: FilterDefinition[]; /** * If set to true, only one filter can be active at a time. */ toggleMode?: boolean; /** * If set to true, it is allowed to have no filter active. */ noneActiveAllowed?: boolean; } interface FilterGroup { /** * The filters in this group. */ filters: Filter[]; /** * If set to true, only one filter can be active at a time. */ toggleMode?: boolean; /** * If set to true, it is allowed to have no filter active. */ noneActiveAllowed?: boolean; } /** * Definition of a filter. */ interface FilterDefinition { /** * The name of the filter. */ name: string; /** * The filter function. */ filter: (data: TData) => boolean; /** * The initial state of the filter. */ active?: boolean; } interface Filter extends FilterDefinition { active: boolean; } type SearchFunc = (item: TData, query: string) => boolean; interface SearchOptions { /** * The list of all items. */ items: TData[]; /** * The search query string. */ query: string; /** * The optional list of filters. */ filterGroups?: FilterGroupDefinition[]; /** * The function to filter one item of the list by the given query string. */ filterByQuery: SearchFunc; /** * If set to true, all items are shown if the query is empty and no filters are set. */ showAllItemsByDefault: boolean; } /** * Searches for matching items by a query and filters. * @param param0 The options object. * @returns The list of items matching the given search query and active filters. */ declare function search({ query, items, filterGroups, filterByQuery, showAllItemsByDefault }: SearchOptions): TData[]; export type { Filter, FilterDefinition, FilterGroup, FilterGroupDefinition, SearchFunc }; export { search };