| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 | /* eslint-disable max-len */import React, { ReactNode, MutableRefObject } from 'react';import { BaseProps } from '../_base/baseComponent';import { PaginationProps } from '../pagination';import { CheckboxProps } from '../checkbox';import { DropdownProps } from '../dropdown';import { Locale } from '../locale/interface';import { ArrayElement } from '../_base/base';import { strings } from '@douyinfe/semi-foundation/table/constants';import {    BaseRowKeyType,    BaseSortOrder,    BaseGroupBy,    BaseGroupByFn,    BaseFixed,    BaseAlign,    BaseChangeInfoSorter,    BaseSorter,    BaseFilter,    BaseChangeInfoFilter,    BaseIncludeGroupRecord} from '@douyinfe/semi-foundation/table/foundation';import { ScrollDirection, CSSDirection } from 'react-window';export interface TableProps<RecordType extends Record<string, any> = any> extends BaseProps {    bordered?: boolean;    children?: ReactNode;    childrenRecordName?: string;    className?: string;    clickGroupedRowToExpand?: boolean;    columns?: ColumnProps<RecordType>[];    components?: TableComponents;    dataSource?: RecordType[];    defaultExpandAllGroupRows?: boolean;    defaultExpandAllRows?: boolean;    defaultExpandedRowKeys?: (string | number)[];    empty?: ReactNode;    expandAllGroupRows?: boolean;    expandAllRows?: boolean;    expandCellFixed?: Fixed;    expandIcon?: ExpandIcon;    expandedRowKeys?: (string | number)[];    expandedRowRender?: ExpandedRowRender<RecordType>;    expandRowByClick?: boolean;    footer?: Footer<RecordType>;    getVirtualizedListRef?: GetVirtualizedListRef;    groupBy?: GroupBy<RecordType>;    hideExpandedColumn?: boolean;    id?: string;    indentSize?: number;    loading?: boolean;    pagination?: TablePagination;    prefixCls?: string;    renderGroupSection?: RenderGroupSection;    renderPagination?: RenderPagination;    resizable?: Resizable<RecordType>;    rowExpandable?: RowExpandable<RecordType>;    rowKey?: RowKey<RecordType>;    rowSelection?: RowSelection<RecordType>;    scroll?: Scroll;    showHeader?: boolean;    size?: Size;    style?: React.CSSProperties;    title?: Title<RecordType>;    virtualized?: Virtualized;    onChange?: OnChange<RecordType>;    onExpand?: OnExpand<RecordType>;    onExpandedRowsChange?: OnExpandedRowsChange<RecordType>;    onGroupedRow?: OnGroupedRow<RecordType>;    onHeaderRow?: OnHeaderRow<RecordType>;    onRow?: OnRow<RecordType>;    sticky?: Sticky;    direction?: Direction}export interface ColumnProps<RecordType extends Record<string, any> = any> {    [x: string]: any;    align?: Align;    children?: Array<ColumnProps<RecordType>>;    className?: string;    colSpan?: number;    dataIndex?: string;    defaultFilteredValue?: any[];    defaultSortOrder?: SortOrder;    filterChildrenRecord?: boolean;    filterDropdown?: React.ReactNode;    filterDropdownProps?: DropdownProps;    filterDropdownVisible?: boolean;    filterIcon?: FilterIcon;    filterMultiple?: boolean;    filteredValue?: any[];    filters?: Filter[];    fixed?: Fixed;    key?: string | number;    render?: ColumnRender<RecordType>;    renderFilterDropdownItem?: RenderFilterDropdownItem;    sortChildrenRecord?: boolean;    sortOrder?: SortOrder;    sorter?: Sorter<RecordType>;    title?: ColumnTitle;    useFullRender?: boolean;    width?: string | number;    onCell?: OnCell<RecordType>;    onFilter?: OnFilter<RecordType>;    onFilterDropdownVisibleChange?: OnFilterDropdownVisibleChange;    onHeaderCell?: OnHeaderCell<RecordType>}export type Align = BaseAlign;export type SortOrder = BaseSortOrder;export type FilterIcon = boolean | React.ReactNode | FilterIconRenderFunction;export interface Filter extends BaseFilter {    value?: any;    text?: React.ReactNode;    children?: Filter[]}export type Fixed = BaseFixed;export type OnCell<RecordType> = (record?: RecordType, rowIndex?: number) => OnCellReturnObject;export type OnFilter<RecordType> = (filteredValue?: any, record?: RecordType) => boolean;export type OnFilterDropdownVisibleChange = (visible?: boolean) => void;export type OnHeaderCell<RecordType> = (record?: RecordType, columnIndex?: number) => OnHeaderCellReturnObject;export type ColumnRender<RecordType> = (text: any, record: RecordType, index: number, options?: RenderOptions) => ColumnRenderReturnType;export type RenderFilterDropdownItem = (itemInfo?: FilterDropdownItem) => ReactNode;export type Sorter<RecordType> = BaseSorter<RecordType>;export type ColumnTitle = React.ReactNode | ((ColumnTitleProps?: ColumnTitleProps) => React.ReactNode);export type FilterIconRenderFunction = (filtered: boolean) => React.ReactNode;export type ColumnTitleProps = {    sorter?: React.ReactNode;    filter?: React.ReactNode;    selection?: React.ReactNode};export type ColumnRenderReturnType = React.ReactNode | RenderReturnObject;export interface RenderReturnObject {    [x: string]: any;    children: React.ReactNode;    props: {        [x: string]: any;        colSpan?: number;        rowSpan?: number    }}export interface FilterDropdownItem {    [x: string]: any;    value?: any;    text?: React.ReactNode;    onChange?: React.MouseEventHandler<HTMLLIElement>;    level?: number;    filterMultiple?: boolean;    checked?: boolean}export interface RenderOptions {    expandIcon?: React.ReactNode;    selection?: React.ReactNode;    indentText?: React.ReactNode}export interface OnCellReturnObject extends React.TdHTMLAttributes<HTMLElement> {    [x: string]: any;    style?: React.CSSProperties;    className?: string;    onClick?: (e: React.MouseEvent) => void}export interface OnHeaderCellReturnObject extends React.ThHTMLAttributes<HTMLElement> {    [x: string]: any;    style?: React.CSSProperties;    className?: string;    onClick?: (e: React.MouseEvent) => void}interface OnRowReturnOmit {    ref?: React.RefObject<any>}export interface OnRowReturnObject extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof OnRowReturnOmit> {    [x: string]: any;    className?: string;    style?: React.CSSProperties;    onClick?: (e: React.MouseEvent) => void}export interface OnGroupedRowReturnObject extends Omit<React.HTMLAttributes<HTMLTableRowElement>, 'className'> {    [x: string]: any;    style?: React.CSSProperties;    onClick?: (e: React.MouseEvent) => void}export type OnHeaderRowReturnObject = Omit<React.HTMLAttributes<HTMLTableRowElement>, 'ref' | 'style'>;export interface Scroll {    x?: number | string;    y?: number | string;    scrollToFirstRowOnChange?: boolean}export interface Data {    [x: string]: any;    key?: string | number}export interface TableComponents {    table?: ReactNode;    header?: {        outer?: ReactNode;        wrapper?: ReactNode;        row?: ReactNode;        cell?: ReactNode    };    body?: {        outer?: ReactNode;        wrapper?: ReactNode;        row?: ReactNode;        cell?: ReactNode;        colgroup?: {            wrapper?: ReactNode;            col?: ReactNode        }    };    footer?: {        wrapper?: ReactNode;        row?: ReactNode;        cell?: ReactNode;        outer?: ReactNode    }}export interface RowSelectionProps<RecordType> {    className?: string;    disabled?: boolean;    fixed?: Fixed;    getCheckboxProps?: GetCheckboxProps<RecordType>;    hidden?: boolean;    selectedRowKeys?: (string | number)[];    title?: ReactNode;    width?: string | number;    onChange?: RowSelectionOnChange<RecordType>;    onSelect?: RowSelectionOnSelect<RecordType>;    onSelectAll?: RowSelectionOnSelectAll<RecordType>}export type GetCheckboxProps<RecordType> = (record: RecordType) => CheckboxProps;export type RowSelectionOnChange<RecordType> = (selectedRowKeys?: (string | number)[], selectedRows?: RecordType[]) => void;export type RowSelectionOnSelect<RecordType> = (    record?: RecordType,    selected?: boolean,    selectedRows?: RecordType[],    nativeEvent?: React.MouseEvent) => void;export type RowSelectionOnSelectAll<RecordType> = (selected?: boolean, selectedRows?: RecordType[], changedRows?: RecordType[]) => void;export type ExpandIcon = ((expanded?: boolean) => React.ReactNode) | React.ReactNode;export type ExpandedRowRender<RecordType> = (record?: RecordType, index?: number, expanded?: boolean) => React.ReactNode;export type Footer<RecordType> = ReactNode | ((pageData?: RecordType[]) => React.ReactNode);export type FormatPageText = ((pageInfo?: { currentStart?: number; currentEnd?: number; total?: number }) => React.ReactNode) | boolean;export type GetVirtualizedListRef = (ref: MutableRefObject<any>) => void;export type GroupByFunction<RecordType> = BaseGroupByFn<RecordType>;export type GroupBy<RecordType> = BaseGroupBy<RecordType>;export type Size = ArrayElement<typeof strings.SIZES>;export type Title<RecordType> = React.ReactNode | ((pageData?: RecordType[]) => React.ReactNode);export type PaginationPosition = ArrayElement<typeof strings.PAGINATION_POSITIONS>;export type Pagination = TablePaginationProps | boolean;export type TablePagination = Pagination;export interface ChangeInfoFilter<RecordType> extends BaseChangeInfoFilter<RecordType> {    filters?: Filter[];    onFilter?: OnFilter<RecordType>}export type ChangeInfoSorter<RecordType> = BaseChangeInfoSorter<RecordType>;export interface ChangeInfo<RecordType> {    pagination?: TablePaginationProps;    filters?: ChangeInfoFilter<RecordType>[];    sorter?: ChangeInfoSorter<RecordType>;    extra?: Record<string, any>}export type OnChange<RecordType> = (changeInfo: ChangeInfo<RecordType>) => void;export type OnRow<RecordType> = (record?: RecordType, index?: number) => OnRowReturnObject;export type OnGroupedRow<RecordType> = (record?: RecordType, index?: number) => OnGroupedRowReturnObject;export type OnHeaderRow<RecordType> = (columns?: ColumnProps<RecordType>[], index?: number) => OnHeaderRowReturnObject;export type OnExpandedRowsChange<RecordType> = (expandedRows?: IncludeGroupRecord<RecordType>[]) => void;export type OnExpand<RecordType> = (expanded?: boolean, record?: IncludeGroupRecord<RecordType>, mouseEvent?: React.MouseEvent) => void;export type RenderGroupSection = (groupKey?: string | number, group?: (string | number)[]) => ReactNode | {    [x: string]: any;    children: ReactNode};export type RenderPagination = (paginationProps: TablePaginationProps) => ReactNode;export type RowExpandable<RecordType> = (record?: RecordType) => boolean;export type RowKey<RecordType> = BaseRowKeyType | ((record?: RecordType) => string);export type RowSelection<RecordType> = RowSelectionProps<RecordType> | boolean;export type VirtualizedOnScrollArgs = {    scrollDirection?: ScrollDirection;    scrollOffset?: number;    scrollUpdateWasRequested?: boolean};export type VirtualizedMode = 'list' | 'grid';export type VirtualizedItemSizeFn = (index?: number) => number;export type VirtualizedItemSize = number | VirtualizedItemSizeFn;export type VirtualizedOnScroll = (object: VirtualizedOnScrollArgs) => void;export interface VirtualizedProps {    [x: string]: any;    mode?: VirtualizedMode;    itemSize?: VirtualizedItemSize;    onScroll?: VirtualizedOnScroll}export type Virtualized = boolean | VirtualizedProps;export interface TablePaginationProps extends BaseProps, PaginationProps {    position?: PaginationPosition;    formatPageText?: FormatPageText}export type Resizable<RecordType> = ResizableProps<RecordType> | boolean;export interface ResizableProps<RecordType> {    onResize?: ResizeFn<RecordType>;    onResizeStart?: ResizeFn<RecordType>;    onResizeStop?: ResizeFn<RecordType>}export type ResizeFn<RecordType> = (column: RecordType) => RecordType;export interface BodyScrollEvent extends React.UIEvent {    [x: string]: any;    currentTarget: any;    target: any}export type BodyScrollPosition = 'both' | 'middle' | 'left' | 'right';export type TableLocale = Locale['Table'];export type Direction = CSSDirection;export type IncludeGroupRecord<RecordType> = BaseIncludeGroupRecord<RecordType>;export type Sticky = boolean | {    top?: number}
 |