UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

137 lines (136 loc) 6.18 kB
import React, { Component, ComponentType, Key, ReactNode } from 'react'; import { SpinProps } from '../spin'; import { Store } from './createStore'; import Column from './Column'; import ColumnGroup from './ColumnGroup'; import { ColumnProps, CustomColumn, ExportProps, handleProps, SelectionInfo, SelectionItemSelectFn, SorterRenderProps, SorterResult, TableComponents, TableLocale, TablePaginationConfig, TableProps, TableState, TableStateFilters } from './interface'; import { RadioChangeEvent } from '../radio'; import { CheckboxChangeEvent } from '../checkbox'; import { Size } from '../_util/enum'; import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext'; declare function defaultRenderSorter<T>(props: SorterRenderProps<T>): ReactNode; export default class Table<T> extends Component<TableProps<T>, TableState<T>> { static displayName: string; static get contextType(): typeof ConfigContext; static TableRowContext: React.Context<any>; static Column: typeof Column; static ColumnGroup: typeof ColumnGroup; static defaultProps: { dataSource: never[]; empty: null; useFixedHeader: boolean; rowSelection: null; className: string; size: Size; loading: boolean; bordered: boolean; resizable: boolean; indentSize: number; locale: {}; rowKey: string; showHeader: boolean; autoHeight: boolean; filterBar: boolean; noFilter: boolean; autoScroll: boolean; renderSorter: typeof defaultRenderSorter; }; context: ConfigContextValue; CheckboxPropsCache: { [key: string]: any; }; store: Store; columns: ColumnProps<T>[]; components: TableComponents; row: ComponentType<any>; iframe: HTMLIFrameElement; element: HTMLDivElement; refTable: HTMLDivElement; wrapper: HTMLDivElement; constructor(props: TableProps<T>); setElementRef: (node: any) => void; saveRef: (ref: any) => void; getCheckboxPropsByItem: (item: T, index: number) => any; getPrefixCls(): string; getDefaultSelection(): any[]; getDefaultPagination(props: TableProps<T>): {}; componentWillReceiveProps(nextProps: TableProps<T>): void; onRow: (record: T, index: number) => any; setSelectedRowKeys(selectedRowKeys: string[], selectionInfo: SelectionInfo<T>, selectedRows?: T[]): void; hasPagination(props?: any): boolean; isFiltersChanged(filters: TableStateFilters<T>): boolean; getSortOrderColumns(columns?: ColumnProps<T>[]): ColumnProps<T>[]; getFilteredValueColumns(columns?: ColumnProps<T>[]): ColumnProps<T>[]; getFiltersFromColumns(columns?: ColumnProps<T>[]): TableStateFilters<T>; getDefaultSortOrder(columns?: ColumnProps<T>[]): { sortColumn: null; sortOrder: null; } | { sortColumn: ColumnProps<T>; sortOrder: "ascend" | "descend" | null | undefined; }; getSortStateFromColumns(columns?: ColumnProps<T>[]): { sortColumn: ColumnProps<T>; sortOrder: "ascend" | "descend" | null | undefined; } | { sortColumn: null; sortOrder: null; }; getSorterFn(): ((a: T, b: T) => number) | undefined; toggleSortOrder(order: 'ascend' | 'descend' | null, column: ColumnProps<T>): void; handleFilter: (column: ColumnProps<T>, nextFilters: string[]) => void; setNewFilterState(newState: any): void; handleFilterSelectClear: () => void; handleFilterSelectChange: (barFilters: any[]) => void; handleColumnFilterChange: (e?: any) => void; getSelectedRows(_: { e?: CheckboxChangeEvent; selectionKey?: string; record?: T; rowIndex?: number; }): undefined; handleSelect: (record: T, rowIndex: number, e: CheckboxChangeEvent) => void; handleRadioSelect: (record: T, rowIndex: number, e: RadioChangeEvent) => void; handleSelectRow: (selectionKey: string, index: number, onSelectFunc: SelectionItemSelectFn) => any; handlePageChange: (current: number, ...otherArguments: any[]) => void; renderSelectionBox: (type: "checkbox" | "radio" | undefined) => (_: any, record: T, index: number) => JSX.Element; getRecordKey: (record: T, index: number) => any; getPopupContainer: () => HTMLElement; renderRowSelection(columns: ColumnProps<T>[], locale: TableLocale): ColumnProps<T>[]; getColumnKey(column: ColumnProps<T>, index?: number): Key | undefined; getMaxCurrent(total: number): number | undefined; isSortColumn(column: ColumnProps<T>): boolean; renderColumnsDropdown(columns: ColumnProps<T>[], locale: TableLocale): any[]; setCustomState(customColumns: any[]): void; renderCustomColumns: (columns: ColumnProps<T>[]) => ColumnProps<T>[]; /** * 获取用户个性化的 Table 的 头设置 * table's columns */ getCustomColumns(): CustomColumn[] | undefined; /** * 用户个性化 Table 编辑 */ handleCustomColumnFilter: () => void; handleShowSizeChange: (current: number, pageSize: number) => void; renderPagination(paginationPosition: string): JSX.Element | null; prepareParamsArguments(state: TableState<T>): [TablePaginationConfig | boolean, TableStateFilters<T>, SorterResult<T>, any[]]; findColumn(myKey: string | number): ColumnProps<T> | undefined; componentDidMount(): void; getCurrentPageData(): T[]; getFlatData(): any[]; getFlatCurrentPageData(): any[]; recursiveSort(data: T[], sorterFn: (a: any, b: any) => number): T[]; getLocalData(): T[]; doBarFilter(filter: any, record: T): boolean; createComponents(components?: TableComponents, prevComponents?: TableComponents): void; handleResize: (col: ColumnProps<T>) => (_: any, dragCallbackData: any) => void; getContentHeight: () => number; syncSize: () => number; renderTable: (contextLocale: TableLocale, loading: SpinProps) => React.ReactNode; renderConfigConsumer(): JSX.Element | undefined; renderExportButton: (props: ExportProps) => JSX.Element; handleExport: (exportedProps: handleProps) => void; render(): JSX.Element; } export {};