@jiaozhiye/qm-design-vue
Version:
A Component Library for Vue3.0
86 lines (85 loc) • 4.09 kB
TypeScript
import { Ref, ComputedRef } from 'vue';
import type { TableBodyRef, IColumn, IFetchParams, IPagination, IRecord, IRowColSpan, IRowKey, IRule, ITableProps, IMergedCell, IMergeCellItem } from '../table/types';
import type { ITableRef } from '../hooks/useTableVar';
import type { ITableState } from '../hooks/useTableRef';
import type { ComponentSize } from '../../../_utils/types';
export type ITableContext = {
$emit: (name: string, ...args: any[]) => void;
getRowKey: (row: IRecord, index: number) => IRowKey;
tableProps: ITableProps;
tableVar: ITableRef;
tableBodyRef: Ref<TableBodyRef | undefined>;
prefixCls: string;
$size: ComputedRef<ComponentSize>;
tableFlatData: Ref<IRecord[]>;
flattenColumns: ComputedRef<IColumn[]>;
editableColumns: ComputedRef<IColumn[]>;
leftFixedColumns: ComputedRef<IColumn[]>;
rightFixedColumns: ComputedRef<IColumn[]>;
expandIconIndex: ComputedRef<string>;
sorter: Ref<ITableState['sorter']>;
filters: Ref<ITableState['filters']>;
superFilters: Ref<ITableState['superFilters']>;
mergedTdCells: Ref<IMergedCell[]>;
derivedMergeCells: ComputedRef<IMergeCellItem[]>;
tableRowHeight: ComputedRef<number>;
layout: Ref<ITableState['layout']>;
bordered: ComputedRef<boolean>;
showFooter: ComputedRef<boolean>;
showSummary: ComputedRef<boolean>;
summationRows: ComputedRef<Record<string, number | string>[]>;
pagination: Ref<IPagination>;
fetchParams: ComputedRef<IFetchParams>;
selectionKeys: Ref<IRowKey[]>;
invalidRowKeys: Ref<IRowKey[]>;
rowExpandedKeys: Ref<ITableState['rowExpandedKeys']>;
highlightKey: Ref<IRowKey>;
isFetch: ComputedRef<boolean>;
isPingLeft: Ref<boolean>;
isPingRight: Ref<boolean>;
isHeadSorter: ComputedRef<boolean>;
isHeadFilter: ComputedRef<boolean>;
isFullScreen: Ref<boolean>;
isTableEmpty: ComputedRef<boolean>;
isHeadGroup: ComputedRef<boolean>;
isTreeTable: ComputedRef<boolean>;
isGroupSubtotal: ComputedRef<boolean>;
isWebPagination: ComputedRef<boolean>;
dataChange: () => void;
tableChange: () => void;
getTableData: () => Promise<void>;
setElementStore: (key: string, value: HTMLElement) => void;
createWebPageData: () => IRecord[];
createTableFullData: (records: IRecord[]) => void;
createAllExpandedKeys: () => IRowKey[];
updateTableData: () => void;
setSorter: (value: ITableState['sorter'], forceUpdate?: boolean) => void;
setFilters: (value: ITableState['filters'], forceUpdate?: boolean) => void;
setSuperFilters: (options: ITableState['superFilters']) => void;
setSelectionKeysEffect: (rowKeys: IRowKey[]) => void;
setHighlightKey: (rowKey: IRowKey) => void;
setRowExpandedKeys: (rowKeys: IRowKey[]) => void;
setSelectionRows: (records: IRecord[]) => void;
setInvalidRowKeys: (rowKeys: IRowKey[]) => void;
setMergedCells: (options: IMergedCell[]) => void;
getSpan: (row: IRecord, column: IColumn, rowIndex: number, columnIndex: number, tableData: IRecord[]) => IRowColSpan;
getStickyLeft: (dataIndex: string, part?: string) => number;
getStickyRight: (dataIndex: string, part?: string) => number;
scrollXToColumn: (dataIndex: string, index?: number) => void;
scrollYToRecord: (rowKey: IRowKey, index?: number) => void;
setPagination: (pagination: IPagination) => void;
setPingLeft: (value: boolean) => void;
setPingRight: (value: boolean) => void;
setSpinning: (value: boolean) => void;
setFullScreen: (value: boolean) => void;
doFieldValidate: (rules: IRule[], val: unknown, rowKey: IRowKey, columnKey: string, columnTitle: string) => void;
createTableData: (list: IRecord[], fn?: (list: IRecord[]) => IRecord[]) => void;
createGroupData: (records: IRecord[]) => IRecord[];
scrollBottomDebouncer: (event: Event) => void;
resetTableScroll: () => void;
clearTableSorter: () => void;
clearTableFilter: () => void;
clearSuperFilters: () => void;
clearRowSelection: () => void;
clearRowHighlight: () => void;
};