import { Sort, SortDirection } from '@alauda/ui';
import { LiteralUnion, KubernetesResource } from '../core';
import { Translation, TranslationValue } from '../translate/types';
import { TableUtilService } from './util.service';
export declare type TableColumnSortDirection = Exclude<SortDirection, ''>;
export declare type TableColumnSortHandler<Item extends object, Context = TableUtilService<Item>, Value = string | number> = (this: Context, a: Value, b: Value) => number;
export interface TableColumnSort<Item extends object, Context = TableUtilService<Item>, Value = string | number> {
    direction?: TableColumnSortDirection;
    active?: true;
    handler?: TableColumnSortHandler<Item, Context, Value>;
}
export declare type TableColumnDefPath<Item extends object, Context = TableUtilService<Item>> = string | number | ReadonlyArray<string | number> | ((this: Context, item: Item) => string | number);
export declare type TableColumnTranslateHandler<Item extends object, Context = TableUtilService<Item>, Value = string | number> = (value: Value, context: Context) => TranslationValue;
export interface TableColumnDef<Item extends object, Context = TableUtilService<Item>, Extra extends object = object, Name extends string = string, Value = string | number> {
    label?: string;
    name: Name;
    path?: TableColumnDefPath<Item, Context>;
    direction?: 'column' | 'row';
    translate?: string | Translation | TableColumnTranslateHandler<Item, Context, Value> | true;
    sort?: TableColumnSortDirection | TableColumnSortHandler<Item, Context> | TableColumnSort<Item, Context> | true;
    filter?(this: Context, value: Value, filterValue: Value, item: Item, name: string, params: Record<string, unknown>): boolean;
    ellipsis?: boolean;
    class?: string | Record<string, boolean>;
    style?: string | Record<string, string | number>;
    extra?: Extra;
}
export interface TableColumnNameExtra {
    link: boolean;
}
export declare type TableColumnActionDisabledHandler<Item extends object, Context = TableUtilService<Item>> = (item: Item, util: Context) => boolean;
export declare type TableColumnActionTooltipHandler<Item extends object, Context = TableUtilService<Item>> = (item: Item, util: Context) => string;
export interface TableColumnActionConfig<Item extends object, Context = TableUtilService<Item>> {
    handler: TableColumnActionDisabledHandler<Item, Context>;
    tooltip?: string | TableColumnActionTooltipHandler<Item, Context>;
}
export interface TableColumnActionExtraItem<Item extends object, Context = TableUtilService<Item>> {
    disabled?: TableColumnActionDisabledHandler<Item, Context> | TableColumnActionConfig<Item, Context>;
}
export interface NormalizedTableColumnActionExtraItem<Item extends object, Context = TableUtilService<Item>> {
    disabled: TableColumnActionConfig<Item, Context>;
}
export interface TableColumnActionExtra<Item extends object, Context = TableUtilService<Item>> {
    update?: (TableColumnActionExtraItem<Item, Context> & {
        link?: boolean;
    }) | false;
    delete?: TableColumnActionExtraItem<Item, Context> | false;
}
export interface NormalizedTableColumnActionExtra<Item extends object, Context = TableUtilService<Item>> {
    update?: (NormalizedTableColumnActionExtraItem<Item, Context> & {
        link?: boolean;
    }) | false;
    delete?: NormalizedTableColumnActionExtraItem<Item, Context> | false;
}
export interface DefaultExtraMapper<Item extends object, Context = TableUtilService<Item>> {
    name: TableColumnNameExtra;
    action: TableColumnActionExtra<Item, Context>;
}
export interface NormalizedDefaultExtraMapper<Item extends object, Context = TableUtilService<Item>> {
    name: TableColumnNameExtra;
    action: NormalizedTableColumnActionExtra<Item, Context>;
}
export declare type NormalizedTableColumnDef<Item extends object, Context = TableUtilService<Item>, Extra extends object = object, Name extends string = string> = TableColumnDef<Item, Context, Extra, Name> & {
    sort?: TableColumnSort<Item>;
    translate?: TableColumnTranslateHandler<Item, Context>;
};
export declare type TableColumn<Item extends object = KubernetesResource, Context = TableUtilService<Item>, Extra extends object = object, Name extends string = string> = string | TableColumnDef<Item, Context, Extra, Name>;
export declare type TableColumns<Item extends object = KubernetesResource, Context = TableUtilService<Item>, ExtendExtraMapper extends object = object, ExtraMapper extends object = DefaultExtraMapper<Item, Context> & ExtendExtraMapper, Name extends keyof ExtraMapper & string = keyof ExtraMapper & string> = ReadonlyArray<LiteralUnion<Name, string> | TableColumnDef<Item, Context, ExtraMapper[Name] & object, LiteralUnion<Name, string>>>;
export declare type TableColumnDefs<Item extends object = KubernetesResource, Context = TableUtilService<Item>, ExtendExtraMapper extends object = object, ExtraMapper extends object = NormalizedDefaultExtraMapper<Item, Context> & ExtendExtraMapper, Name extends keyof ExtraMapper & string = keyof ExtraMapper & string> = Array<NormalizedTableColumnDef<Item, Context, ExtraMapper[Name] & object, LiteralUnion<Name, string>>>;
export declare type TableFilterFn<Item extends object, Context = TableUtilService<Item>> = (this: Context, items: Item[], columnDefs: Array<TableColumnDef<Item, Context>>, activeSort?: Sort, filterParams?: Record<string, string | number>, context?: Context) => Item[];
