UNPKG

@are-visual/virtual-table

Version:
68 lines (59 loc) 2.42 kB
import * as _are_visual_virtual_table from '@are-visual/virtual-table'; import { ColumnType, ColumnDescriptor } from '@are-visual/virtual-table'; import * as react from 'react'; import { DetailedHTMLProps, HTMLAttributes, Key, CSSProperties, ReactNode, MouseEvent, ReactElement } from 'react'; import * as react_jsx_runtime from 'react/jsx-runtime'; type NativeProps = DetailedHTMLProps<HTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement>; interface CellProps extends NativeProps, Pick<ColumnType<unknown>, 'align'> { columnKey?: Key; colSpan?: number; } interface FooterProps { className?: string; style?: CSSProperties; /** Summary 位于底部,且设置 fixed 时生效 */ zIndex?: number; /** Summary 位于底部,且设置 fixed 时生效 */ bottom?: number | string; columns: ColumnDescriptor[]; fixed?: boolean; children?: ReactNode; defaultColumnWidth: number; } interface SummaryOutletProps<T> { className?: string; style?: CSSProperties; dataSource: T[]; onClick?: (e?: MouseEvent<HTMLElement>) => void; } declare function SummaryOutlet<T>(props: SummaryOutletProps<T>): react_jsx_runtime.JSX.Element; interface SummaryRowProps { children?: ReactNode | ((column: ColumnType<any>, key: Key) => ReactNode); className?: string; style?: CSSProperties; onClick?: (e?: MouseEvent<HTMLElement>) => void; } interface SummaryProps { fixed?: boolean | 'top' | 'bottom'; children?: ReactNode; } declare function Summary({ children }: SummaryProps): ReactElement; declare namespace Summary { var Row: react.FC<SummaryRowProps>; var Cell: react.MemoExoticComponent<(props: CellProps) => react_jsx_runtime.JSX.Element | null>; var Outlet: typeof SummaryOutlet; } interface InlineCellProps<T> extends Omit<CellProps, 'ref' | 'columnKey' | 'render' | 'children'> { render?: (dataSource: T[]) => ReactNode; } declare module '@are-visual/virtual-table' { interface ColumnExtra<T = any> { summary?: InlineCellProps<T>; } } interface TableSummaryOptions<T = any> extends Pick<FooterProps, 'bottom' | 'className' | 'style' | 'zIndex'> { summary: (data: T[]) => ReactNode; } declare const tableSummary: <T = any>(options?: TableSummaryOptions<T> | undefined) => _are_visual_virtual_table.Middleware<T>; export { Summary, tableSummary }; export type { InlineCellProps, TableSummaryOptions };