import { CdkDragDrop } from '@angular/cdk/drag-drop';
import { ThemePalette } from '@angular/material/core';
import { ActivatedRoute, Router } from '@angular/router';
import { PaginatorConfig, PaginatorFetcher, PaginatorFilters, StorageConfig } from '../paginator/paginator.model';
import { ScrollOptions } from '../scrollbar/scrollbar.model';
export type AlignCell = 'left' | 'center' | 'right';
export type CellConfig<T> = string | ((item: T) => string);
export type ClazzConfig<T> = string | ((item: T) => string);
export declare class ExpandableItem {
    disableExpansion?: boolean;
    [key: string]: any;
}
/**
 * Column ocnfiguration
 */
export interface Column<T> {
    /**
     * Column key
     */
    key?: string;
    /**
     * Configuration for cell
     *
     * Define a string to refer a template
     * or
     * Define a function to get string result
     */
    cell: CellConfig<T>;
    /**
     * Column can be hide by default
     */
    display?: boolean;
    /**
     * Width attribute
     */
    width?: string;
    /**
     * Define a class for a cell
     * Can depend of current item
     */
    clazz?: ClazzConfig<T>;
    /**
     * Manage align on cell
     *
     * Possible values : 'left' | 'center' | 'right'
     */
    align?: AlignCell;
    /**
     * Header text
     */
    header?: string;
    /**
     * Is the column sortable
     */
    sortable?: boolean;
    /**
     * Sort key
     */
    sortKey?: string;
    /**
     * Active sum on column
     */
    total?: boolean;
    /**
     * Format if sum is activated
     */
    totalFormat?: string;
    /**
     * Stick the column at the start of table
     */
    sticky?: boolean;
    /**
     * Stick the column at the end of table
     */
    stickyEnd?: boolean;
}
export interface SortConfig {
    /**
     * Default value of sort
     */
    default?: string;
    /**
     * Reset pagination when sort change
     */
    resetPaginationOnSortChange?: boolean;
}
export declare type SortDirection = 'asc' | 'desc';
export interface GroupByConfig<T> {
    /**
     * Define the fields where group is applied
     */
    fields: string[];
    /**
     * Define groups for the groupBy
     * Useful to manager empty default groups
     */
    groups?: Partial<Group<T>>[];
}
export interface DragAndDropConfig<T> {
    /**
     * Enables drag and drop feature
     */
    enabled: boolean;
    /**
     * Disable drag and drop on items with the specified criterias
     */
    disableDragOnItem?: (item: T) => boolean;
    /**
     * Position field to update on the item (onlyt if the table is not paginated)
     */
    positionField?: string;
}
export declare class FilterFetcher {
    type?: 'text' | 'date' | 'select';
    fetcher?: PaginatorFetcher<any>;
    limit?: number;
    attribute?: string;
}
export declare class FilterConfig extends FilterFetcher {
    open?: boolean;
}
export declare class Tag {
    display: boolean;
    color?: ThemePalette;
}
export declare class FiltersConfig {
    columns: {
        [key: string]: FilterFetcher;
    };
    tags?: Tag;
}
export interface MenuConfig<T> {
    disabled?: boolean | ((item: T) => boolean);
}
export declare class GroupColumn {
    name: string;
    header?: string;
    columns?: string[];
    align?: 'left' | 'center' | 'right';
}
/**
 * Table options
 */
export declare class TableOption {
    /**
     * Limit height of table
     */
    maxHeight?: string;
    /**
     * Add scroll options
     *
     * See mic-scrollbar component and OverlayScrollbars library
     */
    scrollOptions?: ScrollOptions;
}
/**
 * Define the selection behavior for the table
 */
export declare class TableSelection {
    /**
     * Header checkbox (to select all item) could be disabled
     */
    disableHeaderCheckbox?: boolean;
    /**
     * Key of column use to define labels of checkbox
     */
    columnKeyForCheckboxLabel?: string;
    /**
     * Label for header checkbox
     */
    allLabel?: string;
}
/**
 * Define row specifications
 */
export declare class TableRowSpecification<T> {
    /**
     * Add class on rows
     */
    clazz?: ClazzConfig<T>;
    /**
     * Specify menu configuration
     */
    menu?: MenuConfig<T>;
    /**
     * Allow to disable animation in expand
     */
    disableExpandAnimation?: boolean;
    /**
     * Allow click on entire row for expand
     */
    entireRowExpand?: boolean;
    /**
     * Allow multiple rows to expand
     */
    multipleExpandedRows?: boolean;
}
/**
 * Main configuration class for table component
 */
export declare class TableConfig<T> {
    /**
     * Sort configuration
     */
    sort?: SortConfig;
    /**
     * GroupBy configuration
     */
    groupBy?: GroupByConfig<T>;
    /**
     * Allow drag and drop management
     */
    dragAndDrop?: DragAndDropConfig<T>;
    /**
     * Options specifications
     */
    options?: TableOption;
    /**
     * Define selecton behaviour
     */
    selection?: TableSelection;
    /**
     * Storage configuration
     */
    storage?: StorageConfig;
    /**
     * Pagination configuration
     */
    paginator?: PaginatorConfig;
    /**
     * Row specificities
     */
    rows?: TableRowSpecification<T>;
    /**
     * Describe columns and content
     */
    columns: {
        [key: string]: Column<T>;
    };
    /**
     * Groups columns configuration
     */
    groupsColumns?: GroupColumn[];
    /**
     * Event to get row click
     */
    onRowClick?: (item: T, e: MouseEvent) => void;
    /**
     * Event to get rows expand
     */
    onRowExpand?: (item: T[], isExpanded: boolean) => void;
    /**
     * Event to get items updated after drag and drop
     */
    onItemUpdated?: (items: T[], e: CdkDragDrop<string[]>) => void;
    /**
     * Event to get selection change
     */
    onSelectionChange?: (items: T[]) => void;
    /**
     * Event to get columns selection change
     */
    onColumnsChange?: (columns: string[]) => void;
    /**
     * Get stored state from the table config
     *
     * @param config
     * @param route
     * @returns
     */
    static getState(config: TableConfig<any>, route?: ActivatedRoute): Partial<PaginatorFilters>;
    /**
     * Store columns
     *
     * Available storage :
     * - sessionStorage
     * - localStorage
     * - query parameters
     *
     * @param config
     * @param columns
     * @param otherColumns
     * @param router
     */
    static storeColumns(config: TableConfig<any>, columns: string[], otherColumns: string[], router?: Router): void;
    /**
     * Get displayed columns from storage
     *
     * Available storage :
     * - sessionStorage
     * - localStorage
     * - query parameters
     *
     * @param config
     * @param route
     * @returns
     */
    static getColumns(config: TableConfig<any>, route: ActivatedRoute): string[];
    /**
     * Get columns from storage
     *
     * @param config
     * @param route
     * @returns
     */
    private static getStoredColumns;
}
export declare class Group<T> {
    level: number;
    parent: Group<T>;
    totalCounts: number;
    field: string;
    value: string;
    [key: string]: unknown;
    items: T[];
    expended?: boolean;
}
export declare class CellRowConfig<T> {
    style: string;
    config?: TableConfig<T>;
    item?: T;
    columns?: {
        [key: string]: Column<T>;
    };
    columnKey?: string;
    expandedRow?: T;
}
