import type { DataSourceAPI, FieldData, FieldDef, FieldFormat, FilterRules, IListTableDataConfig, IPagination, MaybePromiseOrCallOrUndefined, MaybePromiseOrUndefined, SortState } from '../ts-types';
import { HierarchyState } from '../ts-types';
import { EventTarget } from '../event/EventTarget';
import type { BaseTableAPI } from '../ts-types/base-table';
import { type Aggregator } from '../ts-types/dataset/aggregation';
import type { ColumnsDefine } from '../ts-types/list-table/layout-map/api';
declare const EVENT_TYPE: {
    readonly SOURCE_LENGTH_UPDATE: "source_length_update";
    readonly CHANGE_ORDER: "change_order";
};
type PromiseBack = (value: MaybePromiseOrUndefined) => void;
export declare function getValue(value: MaybePromiseOrCallOrUndefined, promiseCallBack: PromiseBack): MaybePromiseOrUndefined;
export declare function getField(record: MaybePromiseOrUndefined, field: FieldDef | FieldFormat | number, col: number, row: number, table: BaseTableAPI, promiseCallBack: PromiseBack): FieldData;
export interface DataSourceParam {
    get?: (index: number) => any;
    length?: number;
    records?: any;
    added?: (index: number, count: number) => any;
    deleted?: (index: number[]) => any;
    canChangeOrder?: (sourceIndex: number, targetIndex: number) => boolean;
    changeOrder?: (sourceIndex: number, targetIndex: number) => void;
}
export interface ISortedMapItem {
    asc?: (number | number[])[];
    desc?: (number | number[])[];
    normal?: (number | number[])[];
}
export declare class DataSource extends EventTarget implements DataSourceAPI {
    dataConfig: IListTableDataConfig;
    dataSourceObj: DataSourceParam | DataSource;
    private _get;
    private _sourceLength;
    private _source;
    protected sortedIndexMap: Map<FieldDef, ISortedMapItem>;
    private lastSortStates;
    currentIndexedData: (number | number[])[] | null;
    protected userPagination: IPagination;
    protected pagination: IPagination;
    _currentPagerIndexedData: (number | number[])[];
    hierarchyExpandLevel: number;
    static get EVENT_TYPE(): typeof EVENT_TYPE;
    hasHierarchyStateExpand: boolean;
    beforeChangedRecordsMap: Map<string, any>;
    registedAggregators: {
        [key: string]: {
            new (config: {
                field: string | string[];
                formatFun?: any;
                isRecord?: boolean;
                aggregationFun?: Function;
            }): Aggregator;
        };
    };
    rowHierarchyType: 'grid' | 'tree' | 'grid-tree';
    fieldAggregators: Aggregator[];
    columns: ColumnsDefine;
    lastFilterRules: FilterRules;
    constructor(dataSourceObj?: DataSourceParam, dataConfig?: IListTableDataConfig, pagination?: IPagination, columns?: ColumnsDefine, rowHierarchyType?: 'grid' | 'tree', hierarchyExpandLevel?: number);
    initTreeHierarchyState(): void;
    supplementConfig(pagination?: IPagination, columns?: ColumnsDefine, rowHierarchyType?: 'grid' | 'tree' | 'grid-tree', hierarchyExpandLevel?: number): void;
    registerAggregator(type: string, aggregator: any): void;
    registerAggregators(): void;
    updateColumns(columns: ColumnsDefine): void;
    _generateFieldAggragations(): void;
    processRecords(records: any[]): any[];
    filteredChildren(records: any[]): any[];
    processRecord(record: any): void;
    initChildrenNodeHierarchy(indexKey: number | number[], hierarchyExpandLevel: number, currentLevel: number, nodeData: any): number;
    updatePagination(pagination?: IPagination): void;
    protected updatePagerData(): void;
    getRecordIndexPaths(bodyShowIndex: number): number | number[];
    get records(): any[];
    get source(): any[] | DataSourceParam | DataSource;
    get(index: number): MaybePromiseOrUndefined;
    getRaw(index: number): MaybePromiseOrUndefined;
    getIndexKey(index: number): number | number[];
    getTableIndex(colOrRow: number | number[]): number;
    getField(index: number, field: FieldDef | FieldFormat | number, col: number, row: number, table: BaseTableAPI): FieldData;
    getRawField(index: number, field: FieldDef | FieldFormat | number, col: number, row: number, table: BaseTableAPI): FieldData;
    hasField(index: number, field: FieldDef): boolean;
    getHierarchyState(index: number): HierarchyState;
    toggleHierarchyState(index: number, bodyStartIndex: number, bodyEndIndex: number): {
        add: number[];
        remove: number[];
    };
    pushChildrenNode(indexKey: number | number[], hierarchyState: HierarchyState, nodeData: any): number;
    changeFieldValue(value: FieldData, index: number, field: FieldDef, col?: number, row?: number, table?: BaseTableAPI): FieldData;
    cacheBeforeChangedRecord(dataIndex: number | number[], table?: BaseTableAPI): void;
    setRecord(record: any, index: number): void;
    addRecord(record: any, index: number): void;
    addRecords(recordArr: any, index: number): void;
    addRecordForSorted(record: any): void;
    addRecordsForSorted(recordArr: any): void;
    adjustBeforeChangedRecordsMap(insertIndex: number, insertCount: number, type?: 'add' | 'delete'): void;
    deleteRecords(recordIndexs: number[]): number[];
    deleteRecordsForSorted(recordIndexs: number[]): void;
    updateRecords(records: any[], recordIndexs: (number | number[])[]): (number | number[])[];
    updateRecordsForSorted(records: any[], recordIndexs: number[]): void;
    sort(states: Array<SortState>): void;
    setSortedIndexMap(field: FieldDef, filedMap: ISortedMapItem): void;
    private clearFilteredChildren;
    private filterRecord;
    updateFilterRulesForSorted(filterRules?: FilterRules): void;
    updateFilterRules(filterRules?: FilterRules): void;
    clearSortedIndexMap(): void;
    get sourceLength(): number;
    set sourceLength(sourceLen: number);
    get length(): number;
    get dataSource(): DataSource;
    get currentPagerIndexedData(): (number | number[])[];
    release(): void;
    clearSortedMap(): void;
    clearCurrentIndexedData(): void;
    protected getOriginalRecord(dataIndex: number | number[]): MaybePromiseOrUndefined;
    protected getRawRecord(dataIndex: number | number[]): MaybePromiseOrUndefined;
    protected getOriginalField(index: number | number[], field: FieldDef | FieldFormat | number, col?: number, row?: number, table?: BaseTableAPI): FieldData;
    protected getRawFieldData(index: number, field: FieldDef | FieldFormat | number, col?: number, row?: number, table?: BaseTableAPI): FieldData;
    protected hasOriginalField(index: number | number[], field: FieldDef): boolean;
    protected fieldPromiseCallBack(_index: number | number[], _field: FieldDef | FieldFormat | number, _value: MaybePromiseOrUndefined): void;
    protected recordPromiseCallBack(_index: number | number[], _record: MaybePromiseOrUndefined): void;
    static EMPTY: DataSource;
    canChangeOrder(sourceIndex: number, targetIndex: number): boolean;
    changeOrder(sourceIndex: number, targetIndex: number): void;
    restoreTreeHierarchyState(): void;
    restoreChildrenNodeHierarchy(indexKey: number | number[], nodeData: any): number;
    private _setNodeStateRecursive;
    expandAllNodes(): void;
    collapseAllNodes(): void;
}
export declare function getValueFromDeepArray(array: any, index: number[]): any;
export declare function sortRecordIndexs(recordIndexs: (number | number[])[], sort: -1 | 1): (number | number[])[];
export {};
