/**
* DevExtreme (ui/tree_list.d.ts)
* Version: 21.1.0 (build 21016-0316)
* Build date: Sat Jan 16 2021
*
* Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import '../jquery_augmentation';

import {
    dxElement
} from '../core/element';

import {
    template
} from '../core/templates/template';

import DataSource from '../data/data_source';

import {
    event
} from '../events/index';

import {
    GridBase,
    GridBaseColumn,
    GridBaseColumnButton,
    GridBaseEditing,
    GridBaseEditingTexts,
    GridBaseOptions,
    GridBasePaging,
    GridBaseScrolling,
    GridBaseSelection
} from './data_grid';

import dxScrollable from './scroll_view/ui.scrollable';

import Widget from './widget/ui.widget';
/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListOptions extends GridBaseOptions<dxTreeList> {
    /**
     */
    autoExpandAll?: boolean;
    /**
     */
    columns?: Array<dxTreeListColumn | string>;
    /**
     */
    customizeColumns?: ((columns: Array<dxTreeListColumn>) => any);
    /**
     */
    dataStructure?: 'plain' | 'tree';
    /**
     */
    editing?: dxTreeListEditing;
    /**
     */
    expandNodesOnFiltering?: boolean;
    /**
     */
    expandedRowKeys?: Array<any>;
    /**
     */
    filterMode?: 'fullBranch' | 'withAncestors' | 'matchOnly';
    /**
     */
    hasItemsExpr?: string | Function;
    /**
     */
    itemsExpr?: string | Function;
    /**
     */
    keyExpr?: string | Function;
    /**
     */
    onCellClick?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, event?: event, data?: any, key?: any, value?: any, displayValue?: any, text?: string, columnIndex?: number, column?: any, rowIndex?: number, rowType?: string, cellElement?: dxElement, row?: dxTreeListRowObject }) => any) | string;
    /**
     */
    onCellDblClick?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, event?: event, data?: any, key?: any, value?: any, displayValue?: any, text?: string, columnIndex?: number, column?: dxTreeListColumn, rowIndex?: number, rowType?: string, cellElement?: dxElement, row?: dxTreeListRowObject }) => any);
    /**
     */
    onCellHoverChanged?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, eventType?: string, data?: any, key?: any, value?: any, text?: string, displayValue?: any, columnIndex?: number, rowIndex?: number, column?: dxTreeListColumn, rowType?: string, cellElement?: dxElement, row?: dxTreeListRowObject }) => any);
    /**
     */
    onCellPrepared?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, data?: any, key?: any, value?: any, displayValue?: any, text?: string, columnIndex?: number, column?: dxTreeListColumn, rowIndex?: number, rowType?: string, row?: dxTreeListRowObject, isSelected?: boolean, isExpanded?: boolean, isNewRow?: boolean, cellElement?: dxElement, watch?: Function, oldValue?: any }) => any);
    /**
     */
    onContextMenuPreparing?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, items?: Array<any>, target?: string, targetElement?: dxElement, columnIndex?: number, column?: dxTreeListColumn, rowIndex?: number, row?: dxTreeListRowObject }) => any);
    /**
     */
    onEditingStart?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, data?: any, key?: any, cancel?: boolean, column?: any }) => any);
    /**
     */
    onEditorPrepared?: ((options: { component?: dxTreeList, element?: dxElement, model?: any, parentType?: string, value?: any, setValue?: any, updateValueTimeout?: number, width?: number, disabled?: boolean, rtlEnabled?: boolean, editorElement?: dxElement, readOnly?: boolean, dataField?: string, row?: dxTreeListRowObject }) => any);
    /**
     */
    onEditorPreparing?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, parentType?: string, value?: any, setValue?: any, updateValueTimeout?: number, width?: number, disabled?: boolean, rtlEnabled?: boolean, cancel?: boolean, editorElement?: dxElement, readOnly?: boolean, editorName?: string, editorOptions?: any, dataField?: string, row?: dxTreeListRowObject }) => any);
    /**
     */
    onFocusedCellChanged?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, cellElement?: dxElement, columnIndex?: number, rowIndex?: number, row?: dxTreeListRowObject, column?: dxTreeListColumn }) => any);
    /**
     */
    onFocusedCellChanging?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, cellElement?: dxElement, prevColumnIndex?: number, prevRowIndex?: number, newColumnIndex?: number, newRowIndex?: number, event?: event, rows?: Array<dxTreeListRowObject>, columns?: Array<dxTreeListColumn>, cancel?: boolean, isHighlighted?: boolean }) => any);
    /**
     */
    onFocusedRowChanged?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, rowElement?: dxElement, rowIndex?: number, row?: dxTreeListRowObject }) => any);
    /**
     */
    onFocusedRowChanging?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, rowElement?: dxElement, prevRowIndex?: number, newRowIndex?: number, event?: event, rows?: Array<dxTreeListRowObject>, cancel?: boolean }) => any);
    /**
     */
    onNodesInitialized?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, root?: dxTreeListNode }) => any);
    /**
     */
    onRowClick?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, event?: event, data?: any, key?: any, values?: Array<any>, columns?: Array<any>, rowIndex?: number, rowType?: string, isSelected?: boolean, isExpanded?: boolean, isNewRow?: boolean, rowElement?: dxElement, handled?: boolean, node?: dxTreeListNode, level?: number }) => any) | string;
    /**
     */
    onRowDblClick?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, event?: event, data?: any, key?: any, values?: Array<any>, columns?: Array<dxTreeListColumn>, rowIndex?: number, rowType?: string, isSelected?: boolean, isExpanded?: boolean, isNewRow?: boolean, rowElement?: dxElement }) => any);
    /**
     */
    onRowPrepared?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, data?: any, key?: any, values?: Array<any>, columns?: Array<dxTreeListColumn>, rowIndex?: number, rowType?: string, isSelected?: boolean, isExpanded?: boolean, isNewRow?: boolean, rowElement?: dxElement, node?: dxTreeListNode, level?: number }) => any);
    /**
     */
    paging?: dxTreeListPaging;
    /**
     */
    parentIdExpr?: string | Function;
    /**
     */
    remoteOperations?: {
    /**
     * Warning! This type is used for internal purposes. Do not import it directly.
     */
      filtering?: boolean,
      /**
       * Warning! This type is used for internal purposes. Do not import it directly.
       */
      grouping?: boolean,
      /**
       * Warning! This type is used for internal purposes. Do not import it directly.
       */
      sorting?: boolean
    } | 'auto';
    /**
     */
    rootValue?: any;
    /**
     */
    scrolling?: dxTreeListScrolling;
    /**
     */
    selection?: dxTreeListSelection;
}
/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListEditing extends GridBaseEditing {
    /**
     * Specifies whether a user can add new rows. It is called for each data row when defined as a function.
     */
    allowAdding?: boolean | ((options: { component?: dxTreeList, row?: dxTreeListRowObject }) => boolean);
    /**
     * Specifies whether a user can delete rows. It is called for each data row when defined as a function.
     */
    allowDeleting?: boolean | ((options: { component?: dxTreeList, row?: dxTreeListRowObject }) => boolean);
    /**
     * Specifies whether a user can update rows. It is called for each data row when defined as a function
     */
    allowUpdating?: boolean | ((options: { component?: dxTreeList, row?: dxTreeListRowObject }) => boolean);
    /**
     * Contains properties that specify texts for editing-related UI elements.
     */
    texts?: dxTreeListEditingTexts;
}
/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListEditingTexts extends GridBaseEditingTexts {
    /**
     * Specifies text for the button that adds a new nested row. Applies if the editing.mode is 'batch' or 'cell'.
     */
    addRowToNode?: string;
}
/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListPaging extends GridBasePaging {
    /**
     * Enables paging.
     */
    enabled?: boolean;
}
/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListScrolling extends GridBaseScrolling {
    /**
     * Specifies the scrolling mode.
     */
    mode?: 'standard' | 'virtual';
}
/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListSelection extends GridBaseSelection {
    /**
     * Specifies whether selection is recursive.
     */
    recursive?: boolean;
}
/**
 */
export default class dxTreeList extends Widget implements GridBase {
    constructor(element: Element, options?: dxTreeListOptions)
    constructor(element: JQuery, options?: dxTreeListOptions)
    /**
     */
    addColumn(columnOptions: any | string): void;
    /**
     */
    addRow(): Promise<void> & JQueryPromise<void>;
    /**
     */
    addRow(parentId: any): Promise<void> & JQueryPromise<void>;
    /**
     */
    collapseRow(key: any): Promise<void> & JQueryPromise<void>;
    /**
     */
    expandRow(key: any): Promise<void> & JQueryPromise<void>;
    /**
     */
    forEachNode(callback: Function): void;
    /**
     */
    forEachNode(nodes: Array<dxTreeListNode>, callback: Function): void;
    /**
     */
    getNodeByKey(key: any | string | number): dxTreeListNode;
    /**
     */
    getRootNode(): dxTreeListNode;
    /**
     */
    getSelectedRowKeys(): Array<any>;
    /**
     */
    getSelectedRowKeys(mode: string): Array<any>;
    /**
     */
    getSelectedRowsData(): Array<any>;
    /**
     */
    getSelectedRowsData(mode: string): Array<any>;
    /**
     */
    getVisibleColumns(): Array<dxTreeListColumn>;
    /**
     */
    getVisibleColumns(headerLevel: number): Array<dxTreeListColumn>;
    /**
     */
    getVisibleRows(): Array<dxTreeListRowObject>;
    /**
     */
    isRowExpanded(key: any): boolean;
    /**
     */
    loadDescendants(): Promise<void> & JQueryPromise<void>;
    /**
     */
    loadDescendants(keys: Array<any>): Promise<void> & JQueryPromise<void>;
    /**
     */
    loadDescendants(keys: Array<any>, childrenOnly: boolean): Promise<void> & JQueryPromise<void>;

    beginCustomLoading(messageText: string): void;
    byKey(key: any | string | number): Promise<any> & JQueryPromise<any>;
    cancelEditData(): void;
    cellValue(rowIndex: number, dataField: string): any;
    cellValue(rowIndex: number, dataField: string, value: any): void;
    cellValue(rowIndex: number, visibleColumnIndex: number): any;
    cellValue(rowIndex: number, visibleColumnIndex: number, value: any): void;
    clearFilter(): void;
    clearFilter(filterName: string): void;
    clearSelection(): void;
    clearSorting(): void;
    closeEditCell(): void;
    collapseAdaptiveDetailRow(): void;
    columnCount(): number;
    columnOption(id: number | string): any;
    columnOption(id: number | string, optionName: string): any;
    columnOption(id: number | string, optionName: string, optionValue: any): void;
    columnOption(id: number | string, options: any): void;
    deleteColumn(id: number | string): void;
    deleteRow(rowIndex: number): void;
    deselectAll(): Promise<void> & JQueryPromise<void>;
    deselectRows(keys: Array<any>): Promise<any> & JQueryPromise<any>;
    editCell(rowIndex: number, dataField: string): void;
    editCell(rowIndex: number, visibleColumnIndex: number): void;
    editRow(rowIndex: number): void;
    endCustomLoading(): void;
    expandAdaptiveDetailRow(key: any): void;
    filter(): any;
    filter(filterExpr: any): void;
    focus(): void;
    focus(element: Element | JQuery): void;
    getCellElement(rowIndex: number, dataField: string): dxElement | undefined;
    getCellElement(rowIndex: number, visibleColumnIndex: number): dxElement | undefined;
    getCombinedFilter(): any;
    getCombinedFilter(returnDataField: boolean): any;
    getDataSource(): DataSource;
    getKeyByRowIndex(rowIndex: number): any;
    getRowElement(rowIndex: number): Array<Element> & JQuery | undefined;
    getRowIndexByKey(key: any | string | number): number;
    getScrollable(): dxScrollable;
    getVisibleColumnIndex(id: number | string): number;
    hasEditData(): boolean;
    hideColumnChooser(): void;
    isAdaptiveDetailRowExpanded(key: any): boolean;
    isRowFocused(key: any): boolean;
    isRowSelected(key: any): boolean;
    keyOf(obj: any): any;
    navigateToRow(key: any): void;
    pageCount(): number;
    pageIndex(): number;
    pageIndex(newIndex: number): Promise<void> & JQueryPromise<void>;
    pageSize(): number;
    pageSize(value: number): void;
    refresh(): Promise<void> & JQueryPromise<void>;
    refresh(changesOnly: boolean): Promise<void> & JQueryPromise<void>;
    repaintRows(rowIndexes: Array<number>): void;
    saveEditData(): Promise<void> & JQueryPromise<void>;
    searchByText(text: string): void;
    selectAll(): Promise<void> & JQueryPromise<void>;
    selectRows(keys: Array<any>, preserve: boolean): Promise<any> & JQueryPromise<any>;
    selectRowsByIndexes(indexes: Array<number>): Promise<any> & JQueryPromise<any>;
    showColumnChooser(): void;
    state(): any;
    state(state: any): void;
    undeleteRow(rowIndex: number): void;
    updateDimensions(): void;
}

/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListColumn extends GridBaseColumn {
    /**
     */
    buttons?: Array<'add' | 'cancel' | 'delete' | 'edit' | 'save' | 'undelete' | dxTreeListColumnButton>;
    /**
     */
    cellTemplate?: template | ((cellElement: dxElement, cellInfo: { data?: any, component?: dxTreeList, value?: any, oldValue?: any, displayValue?: any, text?: string, columnIndex?: number, rowIndex?: number, column?: dxTreeListColumn, row?: dxTreeListRowObject, rowType?: string, watch?: Function }) => any);
    /**
     */
    columns?: Array<dxTreeListColumn | string>;
    /**
     */
    editCellTemplate?: template | ((cellElement: dxElement, cellInfo: { setValue?: any, data?: any, component?: dxTreeList, value?: any, displayValue?: any, text?: string, columnIndex?: number, rowIndex?: number, column?: dxTreeListColumn, row?: dxTreeListRowObject, rowType?: string, watch?: Function }) => any);
    /**
     */
    headerCellTemplate?: template | ((columnHeader: dxElement, headerInfo: { component?: dxTreeList, columnIndex?: number, column?: dxTreeListColumn }) => any);
    /**
     */
    type?: 'adaptive' | 'buttons';
}

/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListColumnButton extends GridBaseColumnButton {
    /**
     */
    name?: 'add' | 'cancel' | 'delete' | 'edit' | 'save' | 'undelete' | string;
    /**
     */
    onClick?: ((e: { component?: dxTreeList, element?: dxElement, model?: any, event?: event, row?: dxTreeListRowObject, column?: dxTreeListColumn }) => any) | string;
    /**
     */
    template?: template | ((cellElement: dxElement, cellInfo: { component?: dxTreeList, data?: any, key?: any, columnIndex?: number, column?: dxTreeListColumn, rowIndex?: number, rowType?: string, row?: dxTreeListRowObject }) => string | Element | JQuery);
    /**
     */
    visible?: boolean | ((options: { component?: dxTreeList, row?: dxTreeListRowObject, column?: dxTreeListColumn }) => boolean);
}

/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListNode {
    /**
     */
    children?: Array<dxTreeListNode>;
    /**
     */
    data?: any;
    /**
     */
    hasChildren?: boolean;
    /**
     */
    key?: any;
    /**
     */
    level?: number;
    /**
     */
    parent?: dxTreeListNode;
    /**
     */
    visible?: boolean;
}

/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export interface dxTreeListRowObject {
    /**
     */
    isEditing?: boolean;
    /**
     */
    isExpanded?: boolean;
    /**
     */
    isNewRow?: boolean;
    /**
     */
    isSelected?: boolean;
    /**
     */
    key?: any;
    /**
     */
    level?: number;
    /**
     */
    node?: dxTreeListNode;
    /**
     */
    rowIndex?: number;
    /**
     */
    rowType?: string;
    /**
     */
    values?: Array<any>;
}

declare global {
interface JQuery {
    dxTreeList(): JQuery;
    dxTreeList(options: "instance"): dxTreeList;
    dxTreeList(options: string): any;
    dxTreeList(options: string, ...params: any[]): any;
    dxTreeList(options: dxTreeListOptions): JQuery;
}
}
/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export type Options = dxTreeListOptions;

/** @deprecated use Options instead */
/**
 * Warning! This type is used for internal purposes. Do not import it directly.
 */
export type IOptions = dxTreeListOptions;
