import Vue, { VNode, CreateElement } from "vue";
import { PagerModel, ParameterModel } from 'hq-tools';
import { TreeChild, CellGroup } from 'view-design';
import { GridOptions as AgGridOptions, CellClickedEvent, GridApi, ColumnApi, Column as AgColumn, Context, GridReadyEvent, RowEvent, ColDef } from 'ag-grid-community'
import { ColumnGroup, Column } from './../../components/hongqi-grid/src/column/column'
export declare interface BtnOption {
    type?: string,
    size?: string,
    icon?: string,
    name?: string,
    text?: string,
    style?: any,
}

export declare interface PagerOptions {
    loadUrl: string,
    fastQueryParameters: ParameterModel[]
}
export declare interface GridOptions extends AgGridOptions {
    subTotal: boolean,
    rowIndex: boolean,
    onBtnClickFunc: { [key: string]: (event: CellClickedEvent) => void | Promise<any> }
}
export declare interface GridColumnConfig {
    title: string;
    children: GridColumnConfig[];
    column: AgColumn;
    expand: boolean;
    disabled: boolean;
    hide: boolean;
    sort: boolean;
    filter: boolean | string;
}
export declare class HongqiGrid extends Vue {
    /**
     * props
     */
    name?: string;
    theme?: string;
    dicts?: Object;
    columns?: Array<Column | CellGroup>;
    data?: any[];
    pagerOpts?: PagerOptions;
    gridOpts?: GridOptions;
    pageSizeOpts?: number[];
    tools?: string[];
    frameworkComponents?: { [key: string]: Vue };
    height?: string;

    /**
     * data
     */
    gridOptions: AgGridOptions;
    gridApi: GridApi;
    columnApi: ColumnApi;
    formatedColumns: AgColumn[];
    localeText: { [key: string]: string };
    rowData: any[];
    pager: PagerModel;
    gridDicts: { [key: string]: { [key: string]: string } }
    gridmixinedOpts: GridOptions;
    context: Context;
    fastQueryShow: boolean;
    configShow: boolean;
    advanceFastQueryParams: ParameterModel[];
    exportModal: boolean;
    exportCofig: { state: '0' | '1', max: number };
    loading: boolean;
    configData: GridColumnConfig[];

    /**
     * computed
     */
    gridStyle: { [key: string]: string };
    flatColumns: AgColumn[];
    exportURL: string;
    gridFrameworkComponents: { [key: string]: Vue };

    /**
     * methods
     */
    onGridReady: (param: GridReadyEvent) => void;
    onFastQuerySearch: (advanceFastQueryParams: ParameterModel[]) => void;
    load: (data: any[]) => void
    dataHanddle: () => void;
    pageChange: (nowPage: number) => void
    pageSizeChange: (pageSize: number) => void
    exportCsv: () => void;
    exportExcelModalShow: () => void;
    exportExcel: () => void;
    print: () => void;
    getSelections: () => void;
    showInfo: () => void;
    onConfigClick: (selection: TreeChild[], node: TreeChild) => void;
    hideColumn: (column: AgColumn, visible: boolean) => void;


    $emit(
        eventName: "selection",
        selection: any[]
    ): this;

    $emit(
        eventName: "btnclick",
        params: {
            name: string,
            params: {
                rowIndex: number,
                row: any,
                column: ColDef
            }
        }
    ): this;

    $emit(
        eventName: "grid-ready",
        grid: HongqiGrid
    ): this;

    $emit(
        eventName: "on-load-success",
        pager: PagerModel
    ): this;

    $emit(
        eventName: "on-data-ready",
        data: any[]
    ): this;

    $emit(
        eventName: "on-page-change",
        pager: PagerModel
    ): this;

    $emit(
        eventName: "on-page-size-change",
        pager: PagerModel
    ): this;


}