import * as React from "react"; import { SortableHandle } from "react-sortable-hoc"; import { Size } from "../../interfaces"; import { SmartLinkCheckboxProps } from "../SmartLinkCheckbox/SmartLinkCheckbox"; import { SmartLinkPaginationProps } from "../SmartLinkPagination/SmartLinkPagination"; import {Tooltip} from '@smart-link/shared/@material-ui/core'; interface Filter { text: string; value: string; children?: Filter[] } interface PaginationConfig { current: number; pageSize: number; } type Key = string | number export interface TableColumn { title: string | (() => React.ReactNode); key: Key; className?: string; fixed?: 'left' | 'right' | boolean; ellipsis?: boolean | {}; align?: 'left' | 'center' | 'right'; colSpan?: number; dataIndex: string | number | number[] | string[]; render?: (value: any, record: RecordType, index: number) => React.ReactNode; resizable?: boolean; rowSpan?: number; width?: number | string; onCell?: (data: any, index?: number) => React.HTMLAttributes; sorter?: boolean | ((a: RecordType, b: RecordType) => number) | { compare: (a: any, b: any) => number; multiple: number; }; sortOrder?: 'ascend' | 'descend' | null; defaultSortOrder?: 'ascend' | 'descend' | null; sortDirections?: 'ascend' | 'descend' | null; filtered?: boolean; filters?: 'search' | Filter[]; filterDropdown?: React.ReactNode | (() => React.ReactNode) filterMultiple?: boolean; filteredValue?: string[] | number[]; defaultFilteredValue?: string[] | number[]; filterIcon?: React.ReactNode | (() => React.ReactNode) onFilter?: (value: any, record: RecordType) => boolean; filterDropdownVisible?: boolean; onFilterDropdownVisibleChange?: (visible: boolean) => void } export interface SmartLinkTableProps { rowKey: string; prefixCls?: string; className?: string; style?: React.CSSProperties; children?: React.ReactNode; data?: RecordType[]; dropdownPrefixCls?: string; dataSource?: RecordType[]; draggable?: string | boolean; emptyText?: React.ReactNode; customScrollbar?: boolean; columns: TableColumn[]; pagination?: boolean | ({ position: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; } & SmartLinkPaginationProps); loading?: boolean; bordered?: boolean; stripe?: boolean; size?: Size onTitleResize?: (info: {index: number; column: TableColumn, size: {width: number}}) => void; onRowDrag?: (info: {dragIndex: number, hoverIndex: number}) => void; onChange?: (pagination: PaginationConfig, filters: Record, sorter: any,extra: any) => void; onExpand?: (expanded: boolean, record: RecordType) => void; resizable?: boolean; rowSelection?: { type: 'checkbox' | 'radio'; selectedRowKeys?: Key[]; onChange?: (selectedRowKeys: Key[], selectedRows: RecordType[]) => void; getCheckboxProps?: (record: RecordType) => Partial; onSelect?: (record: RecordType, selected: boolean, selectedRows: RecordType[]) => void, // SelectionSelectFn; onSelectAll?: (selected: boolean, selectedRows: RecordType[], changeRows: RecordType[]) => void; onSelectMultiple?: (selected: boolean, selectedRows: RecordType[], changeRows: RecordType[]) => void; onSelectInvert?: (selectedRowKeys: Key[]) => void; onSelectNone?: () => void; selections?: boolean | Key[]; hideDefaultSelections?: boolean; fixed?: boolean; columnWidth?: string | number; columnTitle?: string | React.ReactNode; }; getPopupContainer?: React.ReactNode; searchable?: boolean; scroll?: { x?: number | string; y?: number | string; scrollToFirstRowOnChange?: boolean; }; sortDirections?: 'ascend' | 'descend' | null; } export interface TableTooltipProps { } export interface ISmartLinkTable { (props: SmartLinkTableProps): React.ReactElement; SELECTION_ALL: 'SELECTION_ALL'; SELECTION_INVERT: 'SELECTION_INVERT'; SELECTION_NONE: 'SELECTION_NONE'; SortableHandle: typeof SortableHandle; TableTooltip: typeof Tooltip; } declare const SmartLinkTable: ISmartLinkTable; export default SmartLinkTable