/**
* @file Table
* @author fex
*/
///
import React from 'react';
import Sortable from 'sortablejs';
import { ClassNamesFn, ThemeProps, LocaleProps } from 'amis-core';
export interface ColumnProps {
title: string | React.ReactNode | Function;
name: string;
className?: Function;
children?: Array;
render: Function;
fixed?: boolean | string;
width?: number | string;
sorter?: (a: any, b: any) => number | boolean;
sortOrder?: string;
filters?: Array;
filterMode?: string;
filterMultiple?: boolean;
filteredValue?: Array;
filtered?: boolean;
filterDropdown?: Function | React.ReactNode;
align?: string;
breakpoint?: '*' | 'xs' | 'sm' | 'md' | 'lg';
}
export interface ThProps extends ColumnProps {
rowSpan: number;
colSpan: number;
groupId: string;
depth: number;
}
export interface TdProps extends ColumnProps {
rowSpan: number;
colSpan: number;
groupId: string;
}
export interface RowSelectionOptionProps {
key: string;
text: string;
onSelect: Function;
}
export interface RowSelectionProps {
type: string;
rowClick?: boolean;
fixed: boolean;
selectedRowKeys: Array;
keyField?: string;
columnWidth?: number;
selections?: Array;
onChange?: Function;
getCheckboxProps: Function;
maxSelectedLength?: number;
}
export interface ExpandableProps {
expandedRowKeys?: Array;
keyField: string;
columnWidth?: number;
rowExpandable: Function;
defaultExpandedRowKeys?: Array;
onExpand?: Function;
onExpandedRowsChange?: Function;
expandedRowRender?: Function;
expandedRowClassName?: Function;
expandIcon?: Function;
fixed?: boolean;
position?: string;
}
export interface SummaryProps {
colSpan: number;
fixed: string | boolean;
render: Function | React.ReactNode;
}
export interface OnRowProps {
onRowMouseEnter?: Function;
onRowMouseLeave?: Function;
onRowClick?: Function;
}
export interface SortProps {
orderBy: string;
order: string;
}
export interface TableProps extends ThemeProps, LocaleProps {
title: string | React.ReactNode | Function;
footer: string | React.ReactNode | Function;
className?: string;
dataSource: Array;
classnames: ClassNamesFn;
columns: Array;
scroll?: ScrollProps;
rowSelection?: RowSelectionProps;
onSort?: Function;
expandable?: ExpandableProps;
bordered?: boolean;
size?: string;
headSummary?: Function | React.ReactNode | Array>;
footSummary?: Function | React.ReactNode | Array>;
draggable?: boolean;
onDrag?: Function;
resizable?: boolean;
placeholder?: string | React.ReactNode | Function;
loading?: boolean | string | React.ReactNode;
sticky?: boolean;
onFilter?: Function;
childrenColumnName?: string;
keyField?: string;
indentSize: number;
onRow?: OnRowProps;
rowClassName?: Function;
lineHeight?: string;
showHeader?: boolean;
onSelect?: Function;
onSelectAll?: Function;
itemActions?: Function;
onRef?: (ref: any) => void;
}
export interface ScrollProps {
x: number | string | true;
y: number | string;
}
export interface TableState {
selectedRowKeys: Array;
dataSource: Array;
expandedRowKeys: Array;
colWidths: Array;
hoverRow: {
rowIndex?: number;
record: any;
target: HTMLTableRowElement;
} | null;
}
export declare class Table extends React.PureComponent {
static defaultProps: {
title: string;
className: string;
dataSource: never[];
columns: never[];
indentSize: number;
placeholder: string;
showHeader: boolean;
};
constructor(props: TableProps);
getPopOverContainer(): Element | Text | null;
thColumns: Array>;
tdColumns: Array;
selectedRows: Array;
unSelectedRows: Array;
sortable: Sortable | null;
resizeStart: number;
resizeTarget: Array;
resizeWidth: number;
tableDom: React.RefObject;
theadDom: React.RefObject;
tbodyDom: React.RefObject;
contentDom: React.RefObject;
headerDom: React.RefObject;
bodyDom: React.RefObject;
tfootDom: React.RefObject;
footDom: React.RefObject;
getColWidths(): any[];
getSelectedRows(dataSource: Array, selectedRowKeys: Array): {
selectedRows: any[];
unSelectedRows: any[];
};
updateTableBodyFixed(): void;
updateColWidths(): void;
updateTableFixedRows(): void;
componentDidMount(): void;
componentDidUpdate(prevProps: TableProps, prevState: TableState): void;
componentWillUnmount(): void;
initDragging(): void;
destroyDragging(): void;
updateStickyHeader(): void;
updateFixedRow(row: HTMLElement, columns: Array): void;
prependColumns(columns: Array): void;
updateTheadFixedRow(thead: HTMLElement, columns: Array): void;
updateTbodyFixedRow(tbody: HTMLElement, columns: Array): void;
updateSummaryFixedRow(children: HTMLCollection | Array, columns: Array): void;
updateFootSummaryFixedRow(tfoot: HTMLElement): void;
updateHeadSummaryFixedRow(tbody: HTMLElement): void;
renderColGroup(colWidths?: Array): JSX.Element;
onResizeMouseDown(event: any, index: number): void;
onResizeMouseMove(event: any): void;
onResizeMouseUp(event: MouseEvent): void;
renderTHead(): JSX.Element;
onRowClick(event: React.ChangeEvent, record?: any, rowIndex?: number): Promise;
onRowMouseEnter(event: React.ChangeEvent, record?: any, rowIndex?: number): void;
onRowMouseLeave(event: React.ChangeEvent, record?: any, rowIndex?: number): void;
onMouseLeave(): void;
onExpandRows(data: Array): void;
onCollapseRows(data: Array): void;
getChildrenColumnName(): string;
getRowSelectionKeyField(): string;
getExpandableKeyField(): string;
hasChildrenRow(data: any): any;
isExpandableRow(data: any, rowIndex: number): any;
getDataChildrenKeys(data: any): string[];
hasCheckedRows(data: any): boolean;
hasCheckedChildrenRows(data: any): boolean;
isExpanded(record: any): boolean;
getExpandedIcons(record: any): JSX.Element;
selectedSingleRow(value: boolean, data: any): Promise;
renderRow(data: any, rowIndex: number, levels: Array): any[];
renderTBody(): JSX.Element;
isExpandableTable(): boolean;
isRightExpandable(): boolean | undefined;
isLeftExpandable(): boolean | undefined;
isNestedTable(): boolean;
getExtraColumnCount(): number;
renderSummaryRow(summary: any): any;
renderTFoot(): JSX.Element;
updateTableDom(dom: HTMLElement): void;
onTableContentScroll(event: React.ChangeEvent): void;
onWheel(event: WheelEvent): void;
onTableScroll(event: any): void;
renderLoading(): JSX.Element;
renderTable(): JSX.Element;
renderScrollTableHeader(): JSX.Element;
renderScrollTableBody(): JSX.Element;
renderScrollTableFoot(): JSX.Element;
renderScrollTable(): JSX.Element;
render(): JSX.Element;
}
declare const _default: {
new (props: Omit & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): JSX.Element;
context: any;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps> & Readonly<{
children?: import("react").ReactNode;
}>;
state: Readonly<{}>;
refs: {
[key: string]: import("react").ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps, keyof ThemeProps> & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: import("react").Context;
ComposedComponent: import("react").ComponentType & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps> & {
themeKey?: string | undefined;
}>;
} & import("hoist-non-react-statics").NonReactStatics & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps> & {
themeKey?: string | undefined;
}, {}> & {
ComposedComponent: import("react").ComponentType & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
} & ThemeProps> & {
themeKey?: string | undefined;
};
};
export default _default;