import { IHandlerServer } from './handlers/handler';
import { Observable } from 'rxjs';
import { FilterInfo } from './models/filter-info.model';
export declare type GridOption = GridLocalOption | GridDotnetOption | GridCustomOption;
export declare type GridCommand = GridCommandNoChildren | GridCommandWithChildren;
export declare type GridColumn = GridColumnText | GridColumnColor | GridColumnNumber | GridColumnBool | GridColumnDate | GridColumnDateTime | GridColumnTime | GridColumnValues | GridColumnRadio | GridColumnImage | GridColumnChildren;
export declare type GridExternalFilter = GridExternalFilterText | GridExternalFilterDate | GridExternalFilterDateRange | GridExternalFilterDateRangeFull | GridExternalFilterNumber | GridExternalFilterNumberRange | GridExternalFilterValues | GridExternalFilterRadio | GridExternalFilterBool | GridExternalFilterCustom;
export declare const defaultGridOption: GridOption;
export interface GridBaseOption {
    height?: string;
    key?: string;
    filter?: GridBaseOptionFilter;
    checkable?: boolean;
    sortable?: boolean;
    numberable?: boolean;
    editor?: {
        type?: 'focus' | 'inline' | 'popup';
        addable?: boolean;
        editable?: boolean;
        disabled?: boolean | ((rowData: any) => boolean);
        onAdd?: (rowData: any) => void;
        onEdit?: (rowData: any) => void;
        onSave?: (rowData: any) => void | Promise<void>;
        validate?: (rowData: any) => string | Promise<string>;
    };
    paginate?: {
        pageSize?: number;
        pageCount?: number;
    };
    exportable?: boolean;
    export?: GridBaseOptionExport;
    translate?: boolean;
    hideFooter?: boolean;
    hideReload?: boolean;
    commands?: GridCommand[];
    columns: GridColumn[];
    subInformation?: SubInformationDisabledLazyLoading | SubInformationEnabledLazyLoading;
    mobileOrTablet?: {
        htmlTemplate?: (rowData: any, columns?: GridColumn[]) => string;
    };
    onClickRow?: (rowData: any) => void;
    onDblClickRow?: (rowData: any) => void;
    onCheck?: (items: any[], rowData?: any) => void;
    onImportExcel?: (items: any[]) => void;
    onReloadCompleted?: (items: any[]) => Promise<void> | void;
}
export interface GridBaseOptionExport {
    fileName?: string;
    validator?: (fileName: string) => string;
    items?: (filterInfo: FilterInfo) => Promise<any[]>;
    mapping?: (items: any[], fileName?: string) => any[] | Promise<any[]>;
    columns?: GridColumn[];
    sheets?: {
        name: string;
        items: any[] | (() => Promise<any[]>);
        fields: string[];
    }[];
}
export interface GridBaseOptionFilter {
    type?: 'inline' | 'popup';
    columnInline?: 'outside';
    disabled?: boolean;
    customFilter?: any | (() => any);
    externalFilters?: GridExternalFilter[];
    quickFilterVisibility?: 'inline' | 'popup' | 'none';
    multiple?: boolean;
}
interface GridLocalOption extends GridBaseOption {
    type: 'local';
    items: any[] | (() => any[] | Promise<any[]>);
}
interface GridDotnetOption extends GridBaseOption {
    type: 'dotnet';
    method?: 'POST' | 'GET';
    url: string;
    handler?: {
        beforeRequest: (filterInfo: FilterInfo) => Promise<FilterInfo>;
        afterResponse: (items: any[], total: number) => Promise<{
            items: any[];
            total: number;
        }>;
    };
}
interface GridCustomOption extends GridBaseOption {
    type: 'custom';
    url: string;
    method?: 'POST' | 'GET';
    handlerCustom?: IHandlerServer;
}
interface GridCommandBase {
    icon: string | ((rowData?: any) => string);
    title?: string | ((rowData?: any) => string);
    translate?: boolean;
    disabled?: boolean | ((rowData?: any) => boolean);
    hidden?: boolean | (() => boolean);
    hiddenByItem?: ((rowData: any) => boolean) | ((rowData: any) => Promise<boolean>);
}
export interface GridCommandNoChildren extends GridCommandBase {
    click?: (rowData?: any) => void;
}
export interface GridCommandWithChildren extends GridCommandBase {
    children?: GridCommandNoChildren[];
}
interface GridBaseColumn {
    field: string;
    title: string;
    translate?: boolean;
    description?: string;
    width?: string;
    fixed?: boolean;
    format?: string;
    hidden?: boolean | (() => boolean);
    htmlTemplate?: (value: any, rowData?: any, isMobileOrTablet?: boolean) => string;
    transform?: (value: any, rowData?: any) => string;
    badge?: ((rowData?: any, value?: any) => 'PRIMARY' | 'SECONDARY' | 'INFO' | 'SUCCESS' | 'WARNING' | 'DANGER' | 'LIGHT' | 'DARK');
    click?: (value: any, rowData?: any) => void;
    ignoreImport?: boolean;
    sortable?: boolean;
    align?: 'left' | 'center' | 'right';
    filter?: {
        disabled?: boolean;
        priority?: 'low';
    };
}
export interface EditorHandler {
    [column: string]: {
        visible?: boolean | 'create' | 'update';
        items?: any[] | Observable<any[]>;
    };
}
export interface GridItem {
    blinker?: any;
    originItem?: any;
    temporary?: any;
    isChecked?: boolean;
    editingStatus?: 'create' | 'update';
    editorHandler?: EditorHandler & {
        disabled?: boolean;
        errorMessage?: string;
        saving?: boolean;
    };
    subInformation?: {
        isOpened?: boolean;
        isLoaded?: boolean;
        isLoading?: boolean;
        subItems?: any[];
    };
    [key: string]: any;
}
export interface ColumnCommand {
    icon: string | ((rowData?: any) => string);
    title?: string | ((rowData?: any) => string);
    click: (rowData: GridItem) => void;
    hiddenByItem?: ((rowData: any) => boolean) | ((rowData: any) => Promise<boolean>);
}
interface GridColumnText extends GridBaseColumn {
    type: 'string';
    commands?: ColumnCommand[];
    editor?: {
        autocomplete?: boolean;
        alwayDisplay?: boolean;
        click?: (rowData: any) => void;
        change?: (rowData: any, value?: any) => void;
        keyupEnter?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        item?: DynamicEditorItem;
        required?: boolean | ((rowData: any) => boolean);
        defaultValue?: string;
    };
}
interface GridColumnColor extends GridBaseColumn {
    type: 'color';
    editor?: {
        alwayDisplay?: boolean;
        change?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        required?: boolean | ((rowData: any) => boolean);
        defaultValue?: string;
    };
}
interface GridColumnNumber extends GridBaseColumn {
    type: 'number';
    editor?: {
        alwayDisplay?: boolean;
        click?: (rowData: any) => void;
        change?: (rowData: any) => void;
        keyupEnter?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        required?: boolean | ((rowData: any) => boolean);
        defaultValue?: number;
    };
}
interface GridColumnBool extends GridBaseColumn {
    type: 'bool';
    trueValue?: string;
    falseValue?: string;
    editor?: {
        alwayDisplay?: boolean;
        click?: (rowData: any) => void;
        change?: (rowData: any) => void;
        keyupEnter?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        required?: boolean | ((rowData: any) => boolean);
        defaultValue?: boolean;
    };
}
interface GridColumnDate extends GridBaseColumn {
    type: 'date';
    editor?: {
        alwayDisplay?: boolean;
        change?: (rowData: any) => void;
        keyupEnter?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        required?: boolean | ((rowData: any) => boolean);
        defaultValue?: string | Date;
    };
}
interface GridColumnDateTime extends GridBaseColumn {
    type: 'datetime';
    editor?: {
        alwayDisplay?: boolean;
        change?: (rowData: any) => void;
        keyupEnter?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        required?: boolean | ((rowData: any) => boolean);
        defaultValue?: string | Date;
    };
}
interface GridColumnTime extends GridBaseColumn {
    type: 'time';
    editor?: {
        alwayDisplay?: boolean;
        change?: (rowData: any) => void;
        keyupEnter?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        required?: boolean | ((rowData: any) => boolean);
        defaultValue?: string | Date;
    };
}
interface GridColumnValues extends GridBaseColumn {
    type: 'values';
    values: {
        value: string;
        text: string;
        icon?: string;
        color?: string;
        backgroundColor?: string;
    }[];
    dictionary?: {
        [value: string]: {
            text: string;
            icon?: string;
            color?: string;
            backgroundColor?: string;
        };
    };
    editor?: {
        autocomplete?: boolean;
        alwayDisplay?: boolean;
        change?: (rowData: any, value?: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        item?: DynamicEditorItem;
        required?: boolean | ((rowData: any) => boolean);
        defaultValue?: string | number;
    };
}
interface GridColumnRadio extends GridBaseColumn {
    type: 'radio';
    values?: any[];
    valueField: string;
    displayField: string;
    editor?: {
        required?: boolean;
        values?: {
            value: string;
            text: string;
        }[];
        alwayDisplay?: boolean;
        change?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
        defaultValue?: string | number;
    };
}
interface GridColumnImage extends GridBaseColumn {
    type: 'image';
    display: {
        height: number;
        width: number;
    };
    editor?: {
        alwayDisplay?: boolean;
        change?: (rowData: any) => void;
        disabled?: boolean | ((rowData: any) => boolean);
    };
}
export interface GridColumnChildren extends GridBaseColumn {
    type: 'children';
    children: (Exclude<GridColumn, GridColumnChildren> & {
        dynamicTitle?: (rowData: any) => string | Promise<string>;
        colSpan: 1 | 2;
    })[];
}
interface GridBaseExternalFilter {
    field: string;
    priority?: 'low';
    disabled?: boolean;
}
interface GridExternalFilterText extends GridBaseExternalFilter {
    type: 'string';
    title: string;
    default?: string;
}
interface GridExternalFilterDate extends GridBaseExternalFilter {
    type: 'date';
    title: string;
    default?: Date | string;
}
interface GridExternalFilterDateRange extends GridBaseExternalFilter {
    type: 'daterange';
    title: string;
    fromTitle: string;
    toTitle: string;
    enableTime?: boolean;
    minDate?: string | Date;
    maxDate?: string | Date;
    defaultFrom?: Date | string;
    defaultTo?: Date | string;
}
interface GridExternalFilterDateRangeFull extends GridBaseExternalFilter {
    type: 'daterangefull';
    title: string;
    enableTime?: boolean;
    minDate?: string | Date;
    maxDate?: string | Date;
    defaultFrom?: Date | string;
    defaultTo?: Date | string;
}
interface GridExternalFilterNumber extends GridBaseExternalFilter {
    type: 'number';
    title: string;
    default?: number;
}
interface GridExternalFilterNumberRange extends GridBaseExternalFilter {
    type: 'numberrange';
    title: string;
    fromTitle: string;
    toTitle: string;
    defaultFrom?: Date | string;
    defaultTo?: Date | string;
}
interface GridExternalFilterValues extends GridBaseExternalFilter {
    type: 'values';
    title: string;
    values: any[] | ((searchText?: string) => Promise<any[]>);
    valueField: string;
    displayField: string;
    selection?: 'AUTOCOMPLETE' | 'MULTIPLE' | 'MULTIPLEAUTOCOMPLETE';
}
interface GridExternalFilterRadio extends GridBaseExternalFilter {
    type: 'radio';
    title: string;
    values: any[];
    valueField: string;
    displayField: string;
}
interface GridExternalFilterBool extends GridBaseExternalFilter {
    type: 'bool';
    title: string;
    trueValue?: string;
    falseValue?: string;
}
interface GridExternalFilterCustom extends GridBaseExternalFilter {
    type: 'custom';
    title: string;
    onLoad?: (externalFilter: any, valueKey?: string, displayKey?: string) => {
        valueKey?: string;
        displayKey?: string;
    };
    onClick: (externalFilter: any, valueKey?: string, displayKey?: string) => void;
}
interface SubInformationDisabledLazyLoading {
    lazyLoading: false;
    field: string;
    columns: (GridColumn & {
        title: string | ((rowData: any) => string);
    })[];
    height?: string;
}
interface SubInformationEnabledLazyLoading {
    lazyLoading: true;
    onLoad: (rowData: any) => Promise<any[]>;
    columns: GridColumn[];
    height?: string;
}
export declare type DynamicEditorItem = DynamicEditorItemByValue | DynamicEditorItemByFunction;
interface DynamicEditorItemByValue {
    type: 'default';
    value: string;
    display: string;
    items: any[] | Observable<any[]>;
}
interface DynamicEditorItemByFunction {
    type: 'dependent';
    value: string;
    display: string;
    items: (rowData: any) => any[] | Observable<any[]> | Promise<any[]>;
    dependOnField: string;
}
export interface MobileConfiguration {
    htmlTemplate: (rowData?: any, columns?: GridColumn[]) => string;
}
export {};
