@jiaozhiye/qm-design-vue
Version:
A Component Library for Vue3.0
46 lines (45 loc) • 1.98 kB
TypeScript
import { Ref, ComputedRef, CSSProperties } from 'vue';
import { getRowKeyType } from '../table/types';
import type { IColumn, IMergeCellItem, IRecord, IRowKey, ITableProps, TableBodyRef } from '../table/types';
import type { ITableState } from './useTableRef';
import type { ITableRef } from './useTableVar';
import type { ComponentSize } from '../../../_utils/types';
type IExtra = {
getRowKey: getRowKeyType;
tableVar: ITableRef;
tableBodyRef: Ref<TableBodyRef | undefined>;
topElementRef: Ref<HTMLDivElement | undefined>;
tableElementRef: Ref<HTMLDivElement | undefined>;
$size: ComputedRef<ComponentSize>;
tableFlatData: Ref<IRecord[]>;
tableColumns: ComputedRef<IColumn[]>;
flattenColumns: ComputedRef<IColumn[]>;
leftFixedColumns: ComputedRef<IColumn[]>;
tableRowHeight: ComputedRef<number>;
derivedMergeCells: ComputedRef<IMergeCellItem[]>;
highlightKey: Ref<IRowKey>;
selectionKeys: Ref<IRowKey[]>;
layout: Ref<ITableState['layout']>;
showFooter: ComputedRef<boolean>;
showPagination: ComputedRef<boolean>;
isFullScreen: Ref<boolean>;
setLayout: (layout: ITableState['layout']) => void;
setElementStore: (key: string, value: HTMLElement) => void;
};
declare const useTableLayout: <T extends ITableProps>(props: T, extra: IExtra) => {
createElementStore: () => void;
tableStyles: ComputedRef<CSSProperties>;
getSpan: (row: IRecord, column: IColumn, rowIndex: number, columnIndex: number, tableData: IRecord[]) => {
rowSpan: number;
colSpan: number;
};
getStickyLeft: (dataIndex: string) => number;
getStickyRight: (dataIndex: string, part?: string) => number;
scrollXToColumn: (dataIndex: string, index?: number) => void;
scrollYToRecord: (rowKey: IRowKey, index?: number) => void;
createTableFocus: () => void;
calcTableHeight: () => void;
resetTableScroll: () => void;
doLayout: () => void;
};
export default useTableLayout;