tablor-core
Version:
Core features for data tables, grids, and advanced search, pagination, and sorting in Angular.
34 lines (33 loc) • 1.76 kB
TypeScript
import { ImmutableAugmentedItem, Item } from '../../stores/items-store/interfaces';
import { ProcessedField } from '../../stores/fields-store/interfaces';
import { DraftStringQueryOptions, ProcessedStringQueryOptions } from './interfaces';
/**
* String query searcher.
*/
export declare class StringQuerySearcher<T extends Item<T>> {
protected readonly getFields: () => ProcessedField<T, keyof T>[];
protected readonly hasField: (key: keyof T) => boolean;
constructor(getFields: () => ProcessedField<T, keyof T>[], hasField: (key: keyof T) => boolean);
/**
* Processes string query options.
*/
processOptions(options: DraftStringQueryOptions<T>): ProcessedStringQueryOptions<T>;
/**
* Checks if the given options are valid.
*/
checkKeys(options: ProcessedStringQueryOptions<T>): boolean;
/**
* Search items by string query.
*/
search(items: ImmutableAugmentedItem<T>[], options: ProcessedStringQueryOptions<T>): ImmutableAugmentedItem<T>[];
/**
* Search items by string query.
*/
protected _search(items: ImmutableAugmentedItem<T>[], options: ProcessedStringQueryOptions<T>): ImmutableAugmentedItem<T>[];
/**
* Generates field value extractor function.
*/
protected genQuerySplitterIntoWords(wordSeparators: ProcessedStringQueryOptions<T>['wordSeparators'], ignoreWhitespace: boolean, isCaseSensitive: boolean): (query: string) => (string)[];
protected genWordsMatcherFn(options: ProcessedStringQueryOptions<T>): (subWord: string, word: string) => boolean;
protected genPhrasesMatcherFn(wordsMatcherFn: (subWord: string, word: string) => boolean, options: ProcessedStringQueryOptions<T>): (searchWords: string[], itemWords: string[][]) => boolean;
}