tdesign-react
Version:
TDesign Component for React
59 lines (58 loc) • 2.55 kB
TypeScript
import { WheelEvent, MutableRefObject } from 'react';
import { ClassName, Styles } from '../../common';
import { BaseTableCol, TableRowData, TdBaseTableProps } from '../type';
import { TableRowFixedClasses, RowAndColFixedPosition, TableColFixedClasses } from '../interface';
import { AffixRef } from '../../affix';
export declare function getColumnFixedStyles(col: TdBaseTableProps['columns'][0], index: number, rowAndColFixedPosition: RowAndColFixedPosition, tableColFixedClasses: TableColFixedClasses): {
style?: Styles;
classes?: ClassName;
};
export declare function getRowFixedStyles(rowId: string | number, rowIndex: number, rowLength: number, fixedRows: TdBaseTableProps['fixedRows'], rowAndColFixedPosition: RowAndColFixedPosition, tableRowFixedClasses: TableRowFixedClasses, virtualTranslateY?: number): {
style: Styles;
classes: ClassName;
};
export default function useFixed(props: TdBaseTableProps, finalColumns: BaseTableCol<TableRowData>[], affixRef?: {
paginationAffixRef: MutableRefObject<AffixRef>;
horizontalScrollAffixRef: MutableRefObject<AffixRef>;
headerTopAffixRef: MutableRefObject<AffixRef>;
footerBottomAffixRef: MutableRefObject<AffixRef>;
}): {
tableWidth: MutableRefObject<number>;
tableElmWidth: MutableRefObject<number>;
thWidthList: MutableRefObject<{
[colKey: string]: number;
}>;
isFixedHeader: boolean;
isWidthOverflow: boolean;
tableContentRef: MutableRefObject<HTMLDivElement>;
isFixedColumn: boolean;
showColumnShadow: {
left: boolean;
right: boolean;
};
rowAndColFixedPosition: RowAndColFixedPosition;
virtualScrollHeaderPos: {
left: number;
top: number;
};
scrollbarWidth: number;
setData: import("react").Dispatch<import("react").SetStateAction<TableRowData[]>>;
refreshTable: () => void;
setTableElmWidth: (width: number) => void;
emitScrollEvent: (e: WheelEvent<HTMLDivElement>) => void;
updateThWidthListHandler: () => void;
updateColumnFixedShadow: (target: HTMLElement, extra?: {
skipScrollLimit?: boolean;
}) => void;
setUseFixedTableElmRef: (val: HTMLTableElement) => void;
getThWidthList: (type?: "default" | "calculate") => {
[colKey: string]: number;
};
updateThWidthList: (trList: HTMLCollection | {
[colKey: string]: number;
}) => {
[colKey: string]: number;
};
addTableResizeObserver: (tableElement: HTMLDivElement) => () => void;
updateTableAfterColumnResize: () => void;
};