import * as React from 'react'; import { SpinProps } from '../spin'; import { Store } from './createStore'; import { RadioChangeEvent } from '../radio'; import { CheckboxChangeEvent } from '../checkbox'; import { PaginationConfig } from '../pagination'; import { ButtonProps } from '../button'; export { PaginationConfig } from '../pagination'; export declare type CompareFn = ((a: T, b: T, sortOrder?: 'ascend' | 'descend') => number); export declare type ColumnFilterItem = { text: string; value: string; children?: ColumnFilterItem[]; }; export interface ColumnProps { title?: React.ReactNode; key?: React.Key; dataIndex?: string; render?: (text: any, record: T, index: number) => React.ReactNode; align?: 'left' | 'right' | 'center'; filters?: ColumnFilterItem[]; onFilter?: (value: any, record: T) => boolean; filterMultiple?: boolean; filterDropdown?: React.ReactNode | ((props: Object) => React.ReactNode); filterDropdownVisible?: boolean; onFilterDropdownVisibleChange?: (visible: boolean) => void; sorter?: boolean | CompareFn; defaultSortOrder?: 'ascend' | 'descend'; colSpan?: number; width?: string | number; className?: string; fixed?: boolean | ('left' | 'right'); filterIcon?: React.ReactNode; filteredValue?: any[]; sortOrder?: 'ascend' | 'descend'; children?: ColumnProps[]; filterBar?: boolean; filterField?: boolean; onCellClick?: (record: T, event: any) => void; onCell?: (record: T) => any; onHeaderCell?: (props: ColumnProps) => any; orderSeq?: number; } export interface TableComponents { table?: any; header?: { wrapper?: any; row?: any; cell?: any; }; body?: { wrapper?: any; row?: any; cell?: any; }; } export interface TableLocale { filterTitle?: string; filterConfirm?: React.ReactNode; filterReset?: React.ReactNode; emptyText?: React.ReactNode | (() => React.ReactNode); selectAll?: React.ReactNode; selectInvert?: React.ReactNode; } export declare const enum TableAutoHeightType { maxHeight = "maxHeight", minHeight = "minHeight" } export declare type RowSelectionType = 'checkbox' | 'radio'; export declare type SelectionSelectFn = (record: T, selected: boolean, selectedRows: Object[], nativeEvent: Event) => any; export declare type TableSelectWay = 'onSelect' | 'onSelectAll' | 'onSelectInvert'; export interface TableRowSelection { type?: RowSelectionType; selectedRowKeys?: string[] | number[]; onChange?: (selectedRowKeys: string[] | number[], selectedRows: Object[]) => void; getCheckboxProps?: (record: T) => Object; onSelect?: SelectionSelectFn; onSelectAll?: (selected: boolean, selectedRows: Object[], changeRows: Object[]) => void; onSelectInvert?: (selectedRows: Object[]) => void; selections?: SelectionItem[] | boolean; hideDefaultSelections?: boolean; fixed?: boolean; columnWidth?: string | number; } export declare type SortOrder = 'descend' | 'ascend'; export interface SorterResult { column: ColumnProps; order: SortOrder; field: string; columnKey: string; } export declare type TableSize = 'default' | 'middle' | 'small'; export interface TableProps { prefixCls?: string; dropdownPrefixCls?: string; rowSelection?: TableRowSelection; pagination?: PaginationConfig | false; size?: TableSize; dataSource?: T[]; components?: TableComponents; columns?: ColumnProps[]; rowKey?: string | ((record: T, index: number) => string); rowClassName?: (record: T, index: number) => string; expandedRowRender?: (record: T, index: number, indent: number, expanded: boolean) => React.ReactNode; defaultExpandAllRows?: boolean; defaultExpandedRowKeys?: string[] | number[]; expandedRowKeys?: string[] | number[]; expandIconAsCell?: boolean; resizable?: boolean; customCode?: string; filterBarLocale?: ColumnFilterMenuLocale; customColumns?: any[]; defaultCustomColumns?: any[]; onCustomColumnFilter?: (customColumns: any[]) => void; expandIconColumnIndex?: number; expandRowByClick?: boolean; onExpandedRowsChange?: (expandedRowKeys: string[] | number[]) => void; onExpand?: (expanded: boolean, record: T) => void; onChange?: (pagination: PaginationConfig, filters: Record, sorter: SorterResult) => void; loading?: boolean | SpinProps; locale?: Object; indentSize?: number; onRowClick?: (record: T, index: number, event: Event) => void; onRow?: (record: T, index: number) => any; onHeaderRow?: (columns: ColumnProps[], index: number) => any; useFixedHeader?: boolean; bordered?: boolean; showHeader?: boolean; footer?: (currentPageData: Object[]) => React.ReactNode; title?: (currentPageData: Object[]) => React.ReactNode; scroll?: { x?: boolean | number | string; y?: boolean | number | string; }; childrenColumnName?: string; bodyStyle?: React.CSSProperties; className?: string; style?: React.CSSProperties; children?: React.ReactNode; exported?: ExportProps; autoHeight?: boolean | { type: TableAutoHeightType; diff: number; }; } export interface TableStateFilters { [key: string]: string[]; } export interface TableState { columnAdjust: any; pagination: PaginationConfig; filters: TableStateFilters; sortColumn: ColumnProps | null; sortOrder?: SortOrder; customColumns: any[]; tableAutoHeight?: number; } export declare type SelectionItemSelectFn = (key: string[]) => any; export interface SelectionItem { key: string; text: React.ReactNode; onSelect: SelectionItemSelectFn; } export interface SelectionCheckboxAllProps { store: Store; locale: any; disabled: boolean; getCheckboxPropsByItem: (item: any, index: number) => any; getRecordKey: (record: any, index?: number) => string; data: T[]; prefixCls: string | undefined; onSelect: (key: string, index: number, selectFunc: any) => void; hideDefaultSelections?: boolean; selections?: SelectionItem[] | boolean; getPopupContainer: (triggerNode?: Element) => HTMLElement; } export interface SelectionCheckboxAllState { checked?: boolean; indeterminate?: boolean; } export interface SelectionBoxProps { store: Store; type?: RowSelectionType; defaultSelection: string[]; rowIndex: string; name?: string; disabled?: boolean; onChange: (e: RadioChangeEvent | CheckboxChangeEvent) => void; } export interface SelectionBoxState { checked?: boolean; } export interface SelectionInfo { selectWay: TableSelectWay; record?: T; checked?: boolean; changeRowKeys?: React.Key[]; nativeEvent?: Event; } export interface FilterMenuProps { locale: TableLocale; selectedKeys: string[]; column: ColumnProps; confirmFilter: (column: ColumnProps, selectedKeys: string[]) => any; prefixCls: string; dropdownPrefixCls: string; getPopupContainer: (triggerNode?: Element) => HTMLElement; } export interface FilterMenuState { selectedKeys: string[]; keyPathOfSelectedItem: { [key: string]: string; }; visible?: boolean; } export interface CustomColumn { fieldKey: string; hidden: 0 | 1; fixedLeft: 0 | 1; fixedRight: 0 | 1; orderSeq: number; } export interface ColumnFilterMenuLocale { display: string; fixedLeft: string; orderSeq: string; field: string; } export interface ColumnFilterMenuProps { customCode: string; locale: TableLocale; filterBarLocale: ColumnFilterMenuLocale; customColumns?: CustomColumn[]; store: any; columns: ColumnProps[]; prefixCls: string; dropdownPrefixCls: string; confirmFilter: (customColumns: CustomColumn[]) => void; getPopupContainer: (trigger: HTMLElement) => HTMLElement; } export interface ColumnFilterMenuState { prevCustomColumns: CustomColumn[]; customColumns: CustomColumn[]; editing: boolean; } export interface ColumnFilterMenuItemProps { column: ColumnProps; customColumn?: CustomColumn; index: number; } export interface ColumnFilterMenuItemState { customColumn: CustomColumn; prevCustomColumn: CustomColumn; } export declare type handleProps = { dataParam?: Object; method: 'get' | 'post'; action: string; }; export declare type ExportProps = ButtonProps & handleProps & { onClick: (props: handleProps) => void; };