import { ActiveRecord, ActiveRecords, Pagination, RuntimeModel, RuntimeRelationField } from '@oinone/kunlun-engine';
import { ExpressionRunParam } from '@oinone/kunlun-expression';
import { CallChaining, ReturnPromise } from '@oinone/kunlun-shared';
import { SelectMode, WidgetTrigger } from '@oinone/kunlun-vue-ui-antd';
import { OioTreeNode, TreeSelectProperties } from '@oinone/kunlun-vue-ui-common';
import { DebouncedFunc } from 'lodash-es';
import { BaseFieldProps, FormFieldWidget } from '../../basic';
import { TreeNodeResponseBody } from '../../service';
import { TreeData, TreeNodeMetadata } from '../../typing';
interface ResponseBody {
    label?: string;
    metadata: TreeNodeMetadata;
    value: ActiveRecord;
    isLeaf: boolean;
}
export interface BackfillDataParameters<V extends TreeData = TreeData> {
    selectedNodes: OioTreeNode<V>[];
    expandedKeys: string[];
    nodes: OioTreeNode<V>[];
}
export declare abstract class AbstractTreeFieldWidget<V extends TreeData = TreeData, Value = ActiveRecords, Field extends RuntimeRelationField = RuntimeRelationField, Props extends BaseFieldProps<Field> = BaseFieldProps<Field>> extends FormFieldWidget<Value, Field, Props> {
    static readonly METADATA_PK_SEPARATOR = ":";
    static readonly PK_SEPARATOR = "-";
    protected defaultPagination: Pagination;
    protected mountedCallChaining: CallChaining | undefined;
    protected refreshCallChaining: CallChaining<boolean> | undefined;
    protected treeDefinition: TreeNodeMetadata | undefined;
    protected treeLevel: number;
    protected rootNode: OioTreeNode<V> | undefined;
    protected searchRootNode: OioTreeNode<V> | undefined;
    protected checkedKeys: string[] | undefined;
    protected halfCheckedKeys: string[] | undefined;
    protected expandedKeys: string[] | undefined;
    protected get mappingProperties(): TreeSelectProperties;
    protected get referencesModel(): RuntimeModel | undefined;
    protected get selectMode(): SelectMode;
    protected get selectable(): boolean;
    protected get checkable(): boolean;
    /**
     * 最多显示多少个 tag
     */
    get maxTagCount(): number | undefined;
    protected defaultConstructDataTrigger(): WidgetTrigger[];
    protected defaultClearFieldsTrigger(): WidgetTrigger[];
    initialize(props: any): this;
    protected generatorRootNode(metadata: TreeNodeMetadata): OioTreeNode<V>;
    protected getTreeMetadataList(): TreeNodeMetadata[];
    protected generatorDefaultTreeDefinition(props: Props): TreeNodeMetadata | undefined;
    get invisible(): boolean;
    protected loadIdempotentKey: string | undefined;
    /**
     * 加载指定节点的子节点（展开时懒加载）
     * @param node
     */
    loadData(node: OioTreeNode<V>): Promise<TreeNodeResponseBody[] | ResponseBody[]>;
    protected $loadData(node: OioTreeNode<V>): Promise<ResponseBody[]>;
    /**
     * 加载指定节点的更多子节点
     * @param node
     */
    loadMoreData(node: OioTreeNode<V>): Promise<ResponseBody[]>;
    /**
     * 加载全部节点
     */
    loadAllData(): Promise<TreeNodeResponseBody[]>;
    onUpdateExpandedKeys(val: string[]): void;
    onUpdateCheckedKeys(val: string[]): void;
    onUpdateHalfCheckedKeys(val: string[]): void;
    protected get enableSearch(): boolean;
    protected enableLoadData: boolean;
    protected onSearch(keywords: string): void;
    protected debounceInternalOnSearch: DebouncedFunc<(keywords: string) => void> | undefined;
    protected internalOnSearch(keywords: string): Promise<void>;
    fetchData(node: OioTreeNode<V>, disableSelfReferences?: boolean): Promise<ResponseBody[]>;
    fetchAll(): Promise<TreeNodeResponseBody[]>;
    protected getBackfillDataFilter(metadata: TreeNodeMetadata, index: number): string | undefined;
    fillChildren(node: OioTreeNode<V>, results: ResponseBody[]): void;
    protected generatorNewTreeNode(parent: OioTreeNode<V>, key: string, title: string | undefined, metadata: TreeNodeMetadata, data: ActiveRecord): OioTreeNode<V>;
    protected isLeafPredict(node: TreeNodeMetadata | undefined): boolean;
    protected computeNodeTitle(val: V): string;
    protected generatorExpressionParameters(): ExpressionRunParam;
    protected $onSelectedChange(selectedNodes: OioTreeNode<TreeData>[] | null | undefined): void;
    /**
     * 加载状态调用函数
     * @param node
     * @param fn
     * @param args
     * @protected
     */
    loadNode<R>(node: OioTreeNode<V>, fn: (...args: any[]) => R, ...args: any[]): Promise<R>;
    executeNodeExpression<T>(activeRecord: ActiveRecord, expression: string, errorValue?: T): T | string | undefined;
    protected mountedProcess(): Promise<void>;
    protected refreshProcess(): Promise<void>;
    protected subscribeProcess(): void;
    protected reloadBackfillDataByValue(): Promise<void>;
    /**
     * 通过值进行回填数据
     * @protected
     */
    protected backfillDataByValue(): Promise<boolean>;
    /**
     * 获取回填数据
     * @protected
     */
    protected fetchBackfillData(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): Promise<TreeNodeResponseBody[] | undefined>;
    /**
     * 回填数据判定
     * @protected
     */
    protected backfillDataPredict(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): boolean;
    /**
     * 回填数据处理
     * @param data
     * @protected
     */
    protected abstract backfillDataProcess(data: BackfillDataParameters<V>): ReturnPromise<void>;
    /**
     * 清理回填数据
     * @protected
     */
    protected abstract clearBackfillDataProcess(): ReturnPromise<void>;
    protected get isFetchAll(): boolean;
    /**
     * 回填树节点存储
     * @protected
     */
    protected backfillTreeNodes: OioTreeNode<V>[][];
    /**
     * 转换回填数据
     * @param currentValues 当前选中数据
     * @param metadataList 节点元数据列表
     * @param list 回填数据
     * @param customCreateNodeCallback 自定义创建节点回调
     * @param customUpdateNodeCallback 自定义更新节点回调
     * @protected
     */
    protected convertBackfillData(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[], list: TreeNodeResponseBody[], customCreateNodeCallback?: (node: OioTreeNode<V>, value: V | undefined) => void, customUpdateNodeCallback?: (node: OioTreeNode<V>, value: V) => void): BackfillDataParameters<V> | undefined;
    protected getBackfillData(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): BackfillDataParameters<V> | undefined;
    protected recursionPushSelectNodes(node: OioTreeNode<TreeData>, currentValues: ActiveRecord[], selectedNodes: OioTreeNode<TreeData>[], compareRecords: ActiveRecord[]): void;
    /**
     * 生成选中比较记录
     * @param currentValues 当前选中数据
     * @param metadataList 节点元数据列表
     * @protected
     */
    protected generatorCompareRecords(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): ActiveRecord[] | undefined;
    protected pushSelectedNodes(currentValues: ActiveRecord[], selectedNodes: OioTreeNode<TreeData>[], compareRecords: ActiveRecord[], node: OioTreeNode<TreeData>, record: ActiveRecord | undefined): void;
    protected convertTreeByTreeSearchResponseBody(list: TreeNodeResponseBody[]): {
        nodes: OioTreeNode<V>[];
        expandedKeys: string[];
    };
    protected static readonly SELECTED_PREDICT_IGNORED_PREFIX = "__";
    protected isSelectedNode(compareRecords: ActiveRecord[], record: ActiveRecord): boolean;
    protected collectionBackfillTreeNodes(nodes: OioTreeNode<V>[]): void;
    protected get watchedFilter(): string;
    protected resolveDynamicDomain(filter: string): string;
    protected filterChanged(): void;
    protected $$mounted(): void;
    protected $$unmounted(): void;
}
export {};
