import { SortDirection } from '../typings/common';
import TinyEmitter from 'tiny-emitter';
import { getHighlightRegExp, searchStringToRegExp } from '../utils/regexp';
declare type Action = 'in';
declare type SortingParams = {
    fieldId: string;
    direction: SortDirection;
};
declare type ItemConverter = Function;
declare type Field = {
    id: string;
    type: string;
    isPrimaryKey: boolean;
    getter: Function;
    comparator: Function;
    textFilterHandler: Function;
    fieldFilterHandler: Function;
    field?: any;
    primaryKey?: any;
};
declare type Filter = {
    field: string;
    action: Action;
    value: any;
    inverted: boolean;
};
export declare type BackendResponse<V> = {
    data: V[];
    filteredCount: number;
    totalCount: number;
    lastPage?: any;
};
declare type LocalResponse<V> = V[];
declare type FieldsHashMap = {
    [key: string]: Field;
};
declare type DataMap<T> = {
    [key: string]: T;
};
export declare abstract class Store<V> extends TinyEmitter {
    primaryKey: string;
    storeType: string;
    data: V[];
    rawData: V[];
    totalCount: number;
    filteredCount: number;
    filteringFields: any[];
    params: {
        sorting: SortingParams;
        currentPage: number;
        pageSize: number;
        customFieldsFilter: any;
        filterByText: any;
    };
    stateName: string | null;
    fields: Field[];
    loaded: boolean;
    textFilterCallback: any;
    textFilterPattern: any;
    debouncedInternalLoad: any;
    textHighlightPattern: any;
    onStoreReset: any;
    pool: any;
    awaiting: any;
    lastPage: any;
    protected e: any;
    /**
     * Example configurations:
     * ```json
     * {
     *     "fields": [],
     *     "fields": {},
     *     "stateName": ""
     * }
     * ```
     *
     * @param {object} params
     */
    constructor(params: any);
    clone(): Store<V>;
    /**
     * Registers the store in Event Bus. This allows remote control over certain store types.
     * @param type
     */
    register(type: string): void;
    /**
     * Unwires store from EventBus and cancels all pending activities
     */
    destructor(): void;
    /**
     * Returns a field descriptor by ID
     * @param fieldId
     */
    getFieldById(fieldId: Field['id']): Field;
    /**
     * Resets page back to zero
     * TODO Should emit change event?
     */
    resetCurrentPage(): void;
    /**
     * @deprecated
     * @param filter
     */
    setInitialFieldsFilter(filter: Filter): void;
    /**
     * Use {@link data/Store.setTextFilter} instead
     * @deprecated
     * @param searchString
     */
    setInitialTextFilter(searchString: string): void;
    /**
     * TODO Should emit change event?
     * @param {string} searchString
     */
    setTextFilter(searchString: string): void;
    /**
     * @deprecated
     * @param {string} fieldId
     * @param {string} direction
     */
    setInitialSorting(fieldId: string, direction?: SortDirection): void;
    /**
     * @deprecated
     * @param currentPage
     * @param pageSize
     */
    setInitialPagination(currentPage: number, pageSize?: number | null): void;
    setItems(items: any[], skipConversion?: boolean): void;
    getItemsCollection(converter: ItemConverter): {
        [key: string]: any;
    };
    extendFormState(items: {
        [key: string]: any;
    }, converter: ItemConverter): {
        [key: string]: any;
    };
    /**
     * This method will be used if useBackend = true
     * @return {Promise.<Array>}
     */
    loadWithParams(): Promise<BackendResponse<V>>;
    /**
     * This method will be used if useBackend = false
     * @return {Promise.<Array>}
     */
    loadAll(): Promise<LocalResponse<V>>;
    load(): void;
    /**
     * TODO Add _ before name
     * Emits before load event
     * @protected
     */
    protected startLoading(): void;
    /**
     * TODO Add _ before name
     * Emits after load event
     * @protected
     */
    protected endLoading(): void;
    /**
     * TODO Add _ before name
     * Actual load function that calls backend/frontend loaders and manages calculations
     * @protected
     * @param forced
     */
    protected internalLoad(forced: boolean): void;
    reload(): void;
    convert(data: V[]): V[];
    setFilteringFields(fields: [] | string, ...restfields: string[]): void;
    static getDefaultComparator(type: any): ItemConverter;
    static compareStrings(a: string, b: string, direction: SortDirection): number;
    static compareNumbers(a: number, b: number, direction: SortDirection): number;
    static defaultFilter(value: any, callback: Function): void;
    static getDefaultTextFilterHandler(type: any): Function;
    static getDefaultFieldFilterHandler(type: any): Function;
    static getFilterByAction(action: Action, filterValue: any): Function;
    useBackend(): boolean;
    getClientDebounceValue(): number;
    getBackendDebounceValue(): number;
    setFields(fields: Field[] | FieldsHashMap): void;
    private setFieldsFromArray;
    convertField: (field: any) => Field;
    addField(field: any): void;
    private setFieldsFromObject;
    setCurrentPage(index: number): void;
    setPageSize(size: number): void;
    private writeState;
    private readState;
    sortBy(fieldId: Field['id'], direction?: SortDirection): void;
    filterByText(searchString: string): void;
    filterByFields(fields: Filter[]): void;
    filterByField(fieldName: string, ...filter: any[]): void;
    resetFieldFilter(fieldName: string): void;
    getCurrentFilter(excludedFieldName: string): Filter[];
    hasFilters(): boolean;
    getFiltered<D = any>(list: D[]): D[];
    getSorted<D = any>(list: D[]): D[];
    getSliced<D = any>(list: D[]): D[];
    validateCurrentPage<D = any>(list: D[]): void;
    calculate(data: any[]): void;
    notifyChanges(hasRawDataChanges?: boolean): void;
    onChange(handler: Function, context?: any): void;
    onDeleteItems(handler: Function, context: any): void;
    getTotalCount(): number;
    getIsLastPage(): boolean;
    getFilteredCount(): number;
    getData(): V[];
    getRawData(): any[];
    getPrimaryKeys(): any[];
    getCount(): number;
    getCurrentPage(): number;
    getPageSize(): number;
    getSorting(): SortingParams;
    getSortingFieldId(): SortingParams['fieldId'];
    getSortingDirection(): SortingParams['direction'];
    isAwaiting(): boolean;
    isLoaded(): boolean;
    private memoizedRawDataMapGetter;
    getRawDataMap(): DataMap<V>;
    getItem(key: string): V | void;
    static searchStringToRegExp: typeof searchStringToRegExp;
    static getHighlightRegExp: typeof getHighlightRegExp;
}
export default Store;
